Skip to content

Commit 07f2665

Browse files
authored
Merge pull request #101 from sgapollo/master
51, 71
2 parents ef47ac9 + fbc6b5e commit 07f2665

File tree

7 files changed

+135
-23
lines changed

7 files changed

+135
-23
lines changed

Lang/English.lng

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -351,10 +351,12 @@ Ver=1
351351
27006=Sets to System HighlightText value
352352
27007=Sets to WhiteSpace value
353353
27008=Show function hints
354+
27070=New Document Encoding:
354355
27009=Hint: use Ctrl+Scroll to edit text size
355356
27010=Editor
356357
27011=Font:
357358
27012=Size:
359+
27012=Use font ligatures is available
358360
27013=Editor Font
359361
27014=Gutter
360362
27015=Auto size
@@ -938,7 +940,8 @@ Ver=1
938940
62016=Question
939941
62017=Compilation successful
940942
62018=Compilation aborted by user
941-
62019=Line:%6d Col:%6d Sel:%6d Lines:%6d Length:%6d
943+
62019=Line:%20d Col:%20d Sel:%20d Lines:%20d Length:%20d
944+
62019_1=Line:%6d Col:%6d Sel:%6d Lines:%6d Length:%6d
942945
62020=Done parsing
943946
62021=Found %d matches
944947
62022=Done parsing in %g seconds
@@ -1256,6 +1259,4 @@ Ver=1
12561259
79018=Could not find AStyle
12571260
79019=Powered by %s
12581261
79020=Max. line length:
1259-
79021=// Could not find the AStyle output file:<CR>// %s
1260-
79022=Use font ligatures is available
1261-
79023=New Document Encoding:
1262+
79021=// Could not find the AStyle output file:<CR>// %s

Source/Editor.pas

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1553,6 +1553,7 @@ procedure TEditor.InitCompletion;
15531553
begin
15541554
fCompletionBox := MainForm.CodeCompletion;
15551555
fCompletionBox.Enabled := devCodeCompletion.Enabled;
1556+
fCompletionBox.Color := devCodeCompletion.BackColor;
15561557

15571558
if devEditor.ShowFunctionTip then begin
15581559
if not Assigned(fFunctionTipTimer) then

Source/EditorOptFrm.pas

Lines changed: 32 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,12 @@ procedure TEditorOptForm.FormCreate(Sender: TObject);
341341
try
342342
StrtoAttr(Attribute, devEditor.Syntax.Values[AttrName]);
343343
cpp.Attribute[I].Assign(Attribute);
344+
345+
if SameText(cpp.Attribute[I].Name, 'WhiteSpace') or SameText(cpp.Attribute[I].Name, 'Space') then begin
346+
cpCompletionBackground.NoneColorColor := cpp.Attribute[I].Background;
347+
cpCompletionBackground.DefaultColorColor := cpp.Attribute[I].Background;
348+
end;
349+
344350
finally
345351
Attribute.Free;
346352
end;
@@ -406,7 +412,14 @@ procedure TEditorOptForm.FormCreate(Sender: TObject);
406412
chkCBParseLocalH.Checked := devCodeCompletion.ParseLocalHeaders;
407413
chkCBParseGlobalH.Checked := devCodeCompletion.ParseGlobalHeaders;
408414
tbCompletionDelay.Position := devCodeCompletion.Delay;
409-
cpCompletionBackground.Selected := devCodeCompletion.BackColor;
415+
416+
cpCompletionBackground.Items.InsertObject(1, 'Default', TObject(cpCompletionBackground.DefaultColorColor));
417+
418+
if cpCompletionBackground.DefaultColorColor = devCodeCompletion.BackColor then
419+
cpCompletionBackground.ItemIndex := 1
420+
else
421+
cpCompletionBackground.Selected := devCodeCompletion.BackColor;
422+
410423
chkEnableCompletionClick(nil);
411424

412425
// Symbol Completion
@@ -438,7 +451,6 @@ procedure TEditorOptForm.FormCreate(Sender: TObject);
438451
// Set defaults of color buttons, don't want all system colors too
439452
cpMarginColor.Items.InsertObject(1, 'Default', TObject(cpMarginColor.DefaultColorColor));
440453
cpHighColor.Items.InsertObject(1, 'Default', TObject(cpHighColor.DefaultColorColor));
441-
cpCompletionBackground.Items.InsertObject(1, 'Default', TObject(cpCompletionBackground.DefaultColorColor));
442454
end;
443455

444456
procedure TEditorOptForm.cboEditorFontDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State:
@@ -823,7 +835,11 @@ procedure TEditorOptForm.btnOkClick(Sender: TObject);
823835
with devCodeCompletion do begin
824836
Enabled := chkEnableCompletion.Checked;
825837
Delay := tbCompletionDelay.Position;
826-
BackColor := cpCompletionBackground.Selected;
838+
if cpCompletionBackground.ItemIndex = 1 then
839+
BackColor := cpCompletionBackground.DefaultColorColor
840+
else
841+
BackColor := cpCompletionBackground.Selected;
842+
827843
ParseLocalHeaders := chkCBParseLocalH.Checked;
828844
ParseGlobalHeaders := chkCBParseGlobalH.Checked;
829845
end;
@@ -989,9 +1005,13 @@ procedure TEditorOptForm.StyleChange(Sender: TObject);
9891005
Background := cpBackground.Selected;
9901006

9911007
// Update default color
992-
if SameText(Name, 'WhiteSpace') then begin
1008+
if SameText(Attr.Name, 'WhiteSpace') or SameText(Attr.Name, 'Space') then begin
9931009
ffgColor := Foreground;
9941010
fbgColor := Background;
1011+
1012+
cpCompletionBackground.NoneColorColor := Background;
1013+
cpCompletionBackground.DefaultColorColor := Background;
1014+
cpCompletionBackground.Items.Objects[1] := TObject(Background);
9951015
end;
9961016

9971017
Style := [];
@@ -1106,10 +1126,17 @@ procedure TEditorOptForm.cboQuickColorSelect(Sender: TObject);
11061126

11071127
offset := cboQuickColor.ItemIndex * 1000;
11081128
for i := 0 to pred(cpp.AttrCount) do begin
1109-
attr := TSynHighlighterAttributes.Create(cpp.Attribute[i].Name,cpp.Attribute[i].Name);
1129+
attr := TSynHighlighterAttributes.Create(cpp.Attribute[i].Name, cpp.Attribute[i].Name);
11101130
try
11111131
StrtoAttr(Attr, LoadStr(i + offset + 1));
11121132
cpp.Attribute[i].Assign(Attr);
1133+
1134+
if SameText(Attr.Name, 'WhiteSpace') or SameText(Attr.Name, 'Space') then begin
1135+
cpCompletionBackground.NoneColorColor := Attr.Background;
1136+
cpCompletionBackground.DefaultColorColor := Attr.Background;
1137+
cpCompletionBackground.Items.Objects[1] := TObject(Attr.Background);
1138+
end;
1139+
11131140
finally
11141141
Attr.Free;
11151142
end;

Source/LangIDs.inc

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ const
376376
ID_EOPT_AUTOINDENT2 = 26028;
377377
ID_EOPT_ADDINDENT = 26029;
378378
ID_EOPT_TABS = 26030;
379-
379+
380380
ID_EOPT_SPECIALCHARS = 27001;
381381
ID_EOPT_PARSERHINTS = 27002;
382382
ID_EOPT_MATCH = 27003;
@@ -385,12 +385,14 @@ const
385385
ID_EOPT_HINTHIGHLIGHT = 27006;
386386
ID_EOPT_HINTWHITESPACE = 27007;
387387
ID_EOPT_CLOSEBRACE = 27008;
388+
ID_EOPT_NEWDOCENCODING = 27070;
388389

389390
// Display Tab
390391
ID_EOPT_CTRLSCROLLHINT = 27009;
391392
ID_EOPT_EDFONT = 27010;
392393
ID_EOPT_FONT = 27011;
393394
ID_EOPT_SIZE = 27012;
395+
ID_EOPT_LIGATURE = 27071;
394396
ID_EOPT_EDITORPRE = 27013;
395397
ID_EOPT_GUTTER = 27014;
396398
ID_EOPT_GUTTERAUTO = 27015;
@@ -411,7 +413,6 @@ const
411413
ID_EOPT_ELEMENTS = 27028;
412414
ID_EOPT_SAVESYNTAX = 27029;
413415

414-
415416
// Code Tab -- Inserts
416417
ID_EOPT_CICODE = 27030;
417418
ID_EOPT_CIMENU = 27031;
@@ -1310,6 +1311,3 @@ const
13101311
ID_FORMATTER_POWEREDBY = 79019;
13111312
ID_FORMATTER_MAXLINELENGTH = 79020;
13121313
ID_FORMATTER_LOADERROR = 79021;
1313-
1314-
ID_EOPT_LIGATURE = 79022;
1315-
ID_EOPT_NEWDOCENCODING = 79023;

Source/VCL/ClassBrowsing/CodeCompletionForm.dfm

Lines changed: 47 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,27 @@ object CodeComplForm: TCodeComplForm
33
Top = 305
44
BorderIcons = []
55
BorderStyle = bsNone
6-
ClientHeight = 286
6+
ClientHeight = 230
77
ClientWidth = 472
8-
Color = clBtnFace
8+
Color = clDefault
9+
CustomTitleBar.Enabled = True
10+
CustomTitleBar.SystemHeight = False
11+
CustomTitleBar.ShowCaption = False
12+
CustomTitleBar.ShowIcon = False
13+
CustomTitleBar.SystemColors = False
14+
CustomTitleBar.SystemButtons = False
15+
CustomTitleBar.BackgroundColor = clWhite
16+
CustomTitleBar.ForegroundColor = 65793
17+
CustomTitleBar.InactiveBackgroundColor = clWhite
18+
CustomTitleBar.InactiveForegroundColor = 10066329
19+
CustomTitleBar.ButtonForegroundColor = 65793
20+
CustomTitleBar.ButtonBackgroundColor = clWhite
21+
CustomTitleBar.ButtonHoverForegroundColor = 65793
22+
CustomTitleBar.ButtonHoverBackgroundColor = 16053492
23+
CustomTitleBar.ButtonPressedForegroundColor = 65793
24+
CustomTitleBar.ButtonPressedBackgroundColor = 15395562
25+
CustomTitleBar.ButtonInactiveForegroundColor = 10066329
26+
CustomTitleBar.ButtonInactiveBackgroundColor = clWhite
927
Constraints.MinHeight = 128
1028
Constraints.MinWidth = 256
1129
Font.Charset = DEFAULT_CHARSET
@@ -14,17 +32,37 @@ object CodeComplForm: TCodeComplForm
1432
Font.Name = 'Courier New'
1533
Font.Style = []
1634
FormStyle = fsStayOnTop
35+
GlassFrame.Enabled = True
36+
GlassFrame.Top = 1
1737
KeyPreview = True
1838
OldCreateOrder = False
39+
StyleElements = [seFont]
1940
OnDeactivate = FormDeactivate
2041
OnShow = FormShow
2142
PixelsPerInch = 96
2243
TextHeight = 16
23-
object lbCompletion: TListBox
44+
object Bevel1: TBevel
2445
Left = 0
2546
Top = 0
2647
Width = 472
27-
Height = 286
48+
Height = 230
49+
Align = alClient
50+
Shape = bsFrame
51+
ExplicitLeft = 208
52+
ExplicitTop = 88
53+
ExplicitWidth = 50
54+
ExplicitHeight = 50
55+
end
56+
object lbCompletion: TListBox
57+
AlignWithMargins = True
58+
Left = 5
59+
Top = 5
60+
Width = 462
61+
Height = 220
62+
Margins.Left = 5
63+
Margins.Top = 5
64+
Margins.Right = 5
65+
Margins.Bottom = 5
2866
Style = lbOwnerDrawFixed
2967
AutoComplete = False
3068
Align = alClient
@@ -37,11 +75,15 @@ object CodeComplForm: TCodeComplForm
3775
Font.Height = -13
3876
Font.Name = 'Courier New'
3977
Font.Style = []
40-
ItemHeight = 16
4178
ParentFont = False
4279
TabOrder = 0
80+
StyleElements = [seFont, seBorder]
4381
OnDblClick = lbCompletionDblClick
4482
OnDrawItem = lbCompletionDrawItem
4583
OnKeyPress = lbCompletionKeyPress
84+
ExplicitLeft = 8
85+
ExplicitTop = -2
86+
ExplicitWidth = 466
87+
ExplicitHeight = 224
4688
end
4789
end

Source/VCL/ClassBrowsing/CodeCompletionForm.pas

Lines changed: 46 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ interface
2424
uses
2525
{$IFDEF WIN32}
2626
Windows, Classes, Graphics, Forms, StdCtrls, Controls,
27-
CodeCompletion, CppParser, CBUtils;
27+
CodeCompletion, CppParser, CBUtils, Winapi.Messages, Vcl.ExtCtrls;
2828
{$ENDIF}
2929
{$IFDEF LINUX}
3030
Xlib, SysUtils, Classes, QGraphics, QForms, QStdCtrls, QControls,
@@ -34,6 +34,7 @@ interface
3434
type
3535
TCodeComplForm = class(TForm)
3636
lbCompletion: TListBox;
37+
Bevel1: TBevel;
3738
procedure FormShow(Sender: TObject);
3839
procedure FormDeactivate(Sender: TObject);
3940
procedure lbCompletionDblClick(Sender: TObject);
@@ -42,6 +43,9 @@ TCodeComplForm = class(TForm)
4243
private
4344
{ Private declarations }
4445
fOwner: TCodeCompletion;
46+
47+
protected
48+
procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST;
4549
public
4650
constructor Create(AOwner: TComponent); override;
4751
procedure CreateParams(var Params: TCreateParams); override;
@@ -58,6 +62,8 @@ procedure TCodeComplForm.FormShow(Sender: TObject);
5862
begin
5963
Width := fOwner.Width;
6064
Height := fOwner.Height;
65+
Color := fOwner.Color;
66+
lbCompletion.Color := fOwner.Color;
6167
lbCompletion.DoubleBuffered := true; // performance hit, but reduces flicker a lit
6268
end;
6369

@@ -70,7 +76,7 @@ procedure TCodeComplForm.CreateParams(var Params: TCreateParams);
7076
begin
7177
inherited CreateParams(Params);
7278

73-
Params.Style := Params.Style or WS_SIZEBOX;
79+
// Params.Style := Params.Style or WS_SIZEBOX;
7480
end;
7581

7682
constructor TCodeComplForm.Create(AOwner: TComponent);
@@ -151,5 +157,43 @@ procedure TCodeComplForm.lbCompletionKeyPress(Sender: TObject; var Key: Char);
151157
fOwner.OnKeyPress(self, Key);
152158
end;
153159

160+
procedure TCodeComplForm.WMNCHitTest(var Message: TWMNCHitTest);
161+
var
162+
D: Integer;
163+
P: TPoint;
164+
begin
165+
166+
D := GetSystemMetrics(SM_CXSIZEFRAME);
167+
168+
P := Self.ScreenToClient(Message.Pos);
169+
170+
if P.Y < D then
171+
begin
172+
if P.X < D then
173+
Message.Result := HTTOPLEFT
174+
else if P.X > ClientWidth - D then
175+
Message.Result := HTTOPRIGHT
176+
else
177+
Message.Result := HTTOP;
178+
end
179+
else if P.Y > ClientHeight - D then
180+
begin
181+
if P.X < D then
182+
Message.Result := HTBOTTOMLEFT
183+
else if P.X > ClientWidth - D then
184+
Message.Result := HTBOTTOMRIGHT
185+
else
186+
Message.Result := HTBOTTOM;
187+
end
188+
else
189+
begin
190+
if P.X < D then
191+
Message.Result := HTLEFT
192+
else if P.X > ClientWidth - D then
193+
Message.Result := HTRIGHT
194+
end;
195+
196+
end;
197+
154198
end.
155199

Source/devCFG.pas

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2563,7 +2563,6 @@ procedure TdevEditor.AssignEditor(editor: TSynEdit; const FileName: String);
25632563
Options := Options + [eoTrimTrailingSpaces];
25642564
if fShowLigatures then
25652565
Options := Options + [eoShowLigatures];
2566-
25672566
finally
25682567
EndUpdate;
25692568
end;
@@ -2596,7 +2595,7 @@ procedure TdevCodeCompletion.SettoDefaults;
25962595
fWidth := 320;
25972596
fHeight := 240;
25982597
fDelay := 180;
2599-
fBackColor := clWindow;
2598+
fBackColor := clDefault;
26002599
fEnabled := True;
26012600
fParseLocalHeaders := True;
26022601
fParseGlobalHeaders := True;

0 commit comments

Comments
 (0)