mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2026-01-07 03:50:38 +01:00
SynEdit: Add SynCompletion to component palette / Add property edit for key commands
git-svn-id: trunk@35511 -
This commit is contained in:
parent
edfd74bc10
commit
cbacc22f81
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -2278,6 +2278,7 @@ components/synedit/design/syneditlazdsgn.txt svneol=native#text/plain
|
||||
components/synedit/design/tsynanysyn.png -text svneol=unset#image/png
|
||||
components/synedit/design/tsynautocomplete.png -text svneol=unset#image/png
|
||||
components/synedit/design/tsynbatsyn.png -text
|
||||
components/synedit/design/tsyncompletion.png -text
|
||||
components/synedit/design/tsyncppsyn.png -text svneol=unset#image/png
|
||||
components/synedit/design/tsyncsssyn.png -text svneol=unset#image/png
|
||||
components/synedit/design/tsyndiffsyn.png -text
|
||||
|
||||
@ -25,3 +25,4 @@ tsynbatsyn.png
|
||||
tsyninisyn.png
|
||||
tsynposyn.png
|
||||
tsynpluginsyncroedit.png
|
||||
tsyncompletion.png
|
||||
|
||||
BIN
components/synedit/design/tsyncompletion.png
Normal file
BIN
components/synedit/design/tsyncompletion.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 660 B |
@ -284,6 +284,7 @@ type
|
||||
procedure SetOnKeyPrevChar(const AValue: TNotifyEvent);
|
||||
public
|
||||
constructor Create(AOwner: TComponent); override;
|
||||
destructor Destroy; override;
|
||||
procedure Execute(s: string; x, y: integer); overload;
|
||||
procedure Execute(s: string; TopLeft: TPoint); overload;
|
||||
procedure Execute(s: string; TokenRect: TRect); overload; // Excute below or above the token // may be extended to adjust left corner too
|
||||
@ -298,17 +299,17 @@ type
|
||||
property OnValidate: TValidateEvent read GetOnValidate write SetOnValidate;
|
||||
property OnCancel: TNotifyEvent read GetOnCancel write SetOnCancel;
|
||||
property CurrentString: string read GetCurrentString write SetCurrentString;
|
||||
property FontHeight: integer read GetFontHeight;
|
||||
published
|
||||
property OnExecute: TNotifyEvent read FOnExecute write FOnExecute;
|
||||
property OnPaintItem: TSynBaseCompletionPaintItem
|
||||
read GetOnPaintItem write SetOnPaintItem;
|
||||
read GetOnPaintItem write SetOnPaintItem;
|
||||
property OnMeasureItem: TSynBaseCompletionMeasureItem read GetOnMeasureItem
|
||||
write SetOnMeasureItem;
|
||||
write SetOnMeasureItem;
|
||||
property ItemList: TStrings read GetItemList write SetItemList;
|
||||
property Position: Integer read GetPosition write SetPosition;
|
||||
property NbLinesInWindow: Integer read GetNbLinesInWindow
|
||||
write SetNbLinesInWindow;
|
||||
property FontHeight: integer read GetFontHeight;
|
||||
property OnSearchPosition: TSynBaseCompletionSearchPosition
|
||||
read GetOnSearchPosition write SetOnSearchPosition;
|
||||
property OnKeyCompletePrefix: TNotifyEvent read GetOnKeyCompletePrefix
|
||||
@ -347,7 +348,7 @@ type
|
||||
procedure OnFormPaint(Sender: TObject);
|
||||
procedure SetEditor(const Value: TCustomSynEdit); override;
|
||||
procedure DoEditorAdded(AValue: TCustomSynEdit); override;
|
||||
procedure DoEditorRemoving(AValue: TCustomSynEdit); override; /////////////
|
||||
procedure DoEditorRemoving(AValue: TCustomSynEdit); override;
|
||||
procedure SetShortCut(Value: TShortCut);
|
||||
procedure TranslateKey(Sender: TObject; Code: word; SState: TShiftState;
|
||||
var Data: pointer; var IsStartOfCombo: boolean; var Handled: boolean;
|
||||
@ -365,6 +366,7 @@ type
|
||||
property OnCodeCompletion: TCodeCompletionEvent
|
||||
read FOnCodeCompletion write FOnCodeCompletion;
|
||||
property ExecCommandID: TSynEditorCommand read FExecCommandID write FExecCommandID;
|
||||
property Editor;
|
||||
end;
|
||||
|
||||
{ TSynAutoComplete }
|
||||
@ -495,6 +497,7 @@ end;
|
||||
|
||||
constructor TSynBaseCompletionForm.Create(AOwner: TComponent);
|
||||
begin
|
||||
ControlStyle := ControlStyle + [csNoDesignVisible];
|
||||
FResizeLock := 1; // prevent DoResize (on Handle Creation) do reset LinesInWindow
|
||||
FDoubleClickSelects := True;
|
||||
FHintLock := 0;
|
||||
@ -1199,10 +1202,16 @@ constructor TSynBaseCompletion.Create(AOwner: TComponent);
|
||||
begin
|
||||
FWidth := 262;
|
||||
inherited Create(AOwner);
|
||||
Form := TSynBaseCompletionForm.Create(Self);
|
||||
Form := TSynBaseCompletionForm.Create(nil); // Do not create with owner, or the designer will make it visible
|
||||
Form.Width := FWidth;
|
||||
end;
|
||||
|
||||
destructor TSynBaseCompletion.Destroy;
|
||||
begin
|
||||
inherited Destroy;
|
||||
FreeAndNil(Form);
|
||||
end;
|
||||
|
||||
function TSynBaseCompletion.GetOnUTF8KeyPress: TUTF8KeyPressEvent;
|
||||
begin
|
||||
Result:=Form.OnUTF8KeyPress;
|
||||
@ -2130,8 +2139,30 @@ begin
|
||||
Result := Rect(0, 0, Canvas.TextWidth(AHint) + 4, FCompletionForm.FontHeight);
|
||||
end;
|
||||
|
||||
const
|
||||
SynComplutionCommandStrs: array[0..0] of TIdentMapEntry = (
|
||||
(Value: ecSynCompletionExecute; Name: 'ecSynCompletionExecute')
|
||||
);
|
||||
|
||||
function IdentToSynCompletionCommand(const Ident: string; var Cmd: longint): boolean;
|
||||
begin
|
||||
Result := IdentToInt(Ident, Cmd, SynComplutionCommandStrs);
|
||||
if Result then inc(Cmd, KeyOffset);
|
||||
end;
|
||||
|
||||
function SynCompletionCommandToIdent(Cmd: longint; var Ident: string): boolean;
|
||||
begin
|
||||
Result := (Cmd - ecPluginFirst >= KeyOffset) and (Cmd - ecPluginFirst < KeyOffset + ecSynCompletionCount);
|
||||
if not Result then exit;
|
||||
Result := IntToIdent(Cmd - KeyOffset, Ident, SynComplutionCommandStrs);
|
||||
end;
|
||||
|
||||
initialization
|
||||
KeyOffset := AllocatePluginKeyRange(ecSynCompletionCount, True);
|
||||
|
||||
RegisterKeyCmdIdentProcs({$IFDEF FPC}@{$ENDIF}IdentToSynCompletionCommand,
|
||||
{$IFDEF FPC}@{$ENDIF}SynCompletionCommandToIdent);
|
||||
|
||||
|
||||
end.
|
||||
|
||||
|
||||
@ -273,6 +273,7 @@ const
|
||||
ecGotFocus = 700;
|
||||
ecLostFocus = 701;
|
||||
|
||||
ecMax = 630; // for propertyEditor
|
||||
ecUserFirst = 1001; // Start of user-defined commands
|
||||
|
||||
ecPluginFirst = 20000;
|
||||
|
||||
@ -516,3 +516,31 @@ LazarusResources.Add('tsynpluginsyncroedit','PNG',[
|
||||
+#147#141'5n'#239#132#210#254#209'/'#149#170#210',z'#157#136'F'#135'H'#0'p'
|
||||
+#128'~'#254#187#224#152#223#148#134#235'&"*P1'#0#0#0#0'IEND'#174'B`'#130
|
||||
]);
|
||||
LazarusResources.Add('tsyncompletion','PNG',[
|
||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#24#0#0#0#24#8#6#0#0#0#224'w='#248#0
|
||||
+#0#0#1'sRGB'#0#174#206#28#233#0#0#0#4'gAMA'#0#0#177#143#11#252'a'#5#0#0#0#9
|
||||
+'pHYs'#0#0#14#195#0#0#14#195#1#199'o'#168'd'#0#0#0#6'bKGD'#0#255#0#255#0#255
|
||||
+#160#189#167#147#0#0#0#7'tIME'#7#215#12#17#20'"'#13','#150'j'#253#0#0#2#4'ID'
|
||||
+'ATHK'#181'V=K'#3'A'#16#157#139#254#8'!"'#8'ZXX'#133' '#150#150#154'4'#130')'
|
||||
+#180#208'B0*'#4#236#188'Z,'#236#140'Z'#152#20'6'#162#22'I0MbJAD'#27'c!'#136
|
||||
+#130#194'!('#136#160#246'Fs'#238#219#184#231#230#184#185#196#16#7#134#189#220
|
||||
+#222#188'7'#243'f?b'#216#194#232#31#205#0'A6'#155'o'#27#197'S~Bb'#5#199's'#20
|
||||
+#139#141#19#129' '#147'9'#180'-'#235'N'#250#242#242'&^'#181'd'#235#147#1#251
|
||||
+#237#229#204#190#202'-'#218'x'#134'ur'#169'o'#31'='#211'n'#233#166'n'#250'|k'
|
||||
+#132#173'49'#213'A3'#27#167#244'x'#178'G'#151#183#175#242';('#195#18#0#156#3
|
||||
+#252#210'h:'#196#179#27#252#253':K'#207'=I'#10#138#185'@+'#226#3#20#198#129
|
||||
+'/'#29#252#166#192'V'#0#128#225#196'1+Q3'#224#8'f'#9#252#244'F'#160#151',z'
|
||||
+#230'*3V"d'#143'Fs'#246#16#24'r'#26#10#205#189#192#17#203#18#160#2'4'#154'#I'
|
||||
+#238#159'S:{A~'#224' p6Z8<('#147'M'#165'J'#180#182#150'p'#18#215#251#0'R'#211
|
||||
+#220#250#211#186'h'#216#228#233#209#1'Z'#24#235#170#3#157#159#31'm'#138#4#201
|
||||
+#250#246#192#11'\!'#247#246#246#17#231':'#187'o'#15#220#153#235#129#150'uO'
|
||||
+#156'7E'#160#180'G'#147#189'VT-'#251'~OO'#167'w'#28#142#134';Y'#29#25#238's'
|
||||
+#9#217#195'p'#218#235#142'w'#241#248'l'#243#4'\7Q'#129#219#12#195#16#178#221
|
||||
+#213#189'f+@'#131'!'#13'F/S'#21#168'9'#128#23#10#5')'#153'n'#236'2'#157#19'K'
|
||||
+#19#174#14'6'#253#232#192#242#211'M'#129'G"'#17#135'D'#220'+'#181'OZ'#185'p>'
|
||||
+'E'#16#28#225'?'#16'r'#20#21#200'K'#6'#~'#227'"k'#216'd'#191#29'e'#154'&'#9
|
||||
+'"'#225#21#170'T?('#26#141'R'#177'X$T'#162#204#147#160#242'U'#241#195#149#178
|
||||
+'U'#197'7+'#171'+r'#180#171'"]'#184' '#3#9'$S'#18'9gQ'#185#252#232#11#218#202
|
||||
+'d('#212'];'#236'Tp;'#255']('#204'o'#157#198#176#133#240#173#229#179#0#0#0#0
|
||||
+'IEND'#174'B`'#130
|
||||
]);
|
||||
|
||||
@ -35,7 +35,7 @@ uses
|
||||
Classes, SysUtils,
|
||||
SynGutter, SynGutterCodeFolding, SynGutterChanges, SynGutterLineNumber,
|
||||
SynGutterMarks, SynGutterBase, SynGutterLineOverview, SynEditMouseCmds,
|
||||
SynEdit, SynCompletion, SynExportHTML, SynMacroRecorder,
|
||||
SynEditKeyCmds, SynEdit, SynCompletion, SynExportHTML, SynMacroRecorder,
|
||||
SynMemo, SynHighlighterPas, SynHighlighterCPP, SynHighlighterJava,
|
||||
SynHighlighterPerl, SynHighlighterHTML, SynHighlighterXML,
|
||||
SynHighlighterLFM, SynHighlighterMulti, SynHighlighterUNIXShellScript,
|
||||
@ -52,6 +52,7 @@ implementation
|
||||
|
||||
procedure RegisterSynCompletion;
|
||||
begin
|
||||
RegisterComponents('SynEdit',[TSynCompletion]);
|
||||
RegisterComponents('SynEdit',[TSynAutoComplete]);
|
||||
end;
|
||||
|
||||
@ -257,6 +258,8 @@ begin
|
||||
'', TSynPropertyEditGutterPartList);
|
||||
RegisterPropertyEditor(TypeInfo(TSynEditorMouseCommand), nil,
|
||||
'', TSynMouseCommandPropertyEditor);
|
||||
RegisterPropertyEditor(TypeInfo(TSynEditorCommand), nil,
|
||||
'', TSynKeyCommandPropertyEditor);
|
||||
|
||||
RegisterGutterPartClass(TSynGutterLineNumber, syndsLineNumbers);
|
||||
RegisterGutterPartClass(TSynGutterCodeFolding, syndsCodeFolding);
|
||||
|
||||
@ -24,7 +24,8 @@ interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc,
|
||||
SynEdit, SynGutterBase, SynEditMiscClasses, SynEditMouseCmds, SynDesignStringConstants,
|
||||
SynEdit, SynGutterBase, SynEditMiscClasses, SynEditMouseCmds, SynEditKeyCmds,
|
||||
SynDesignStringConstants,
|
||||
PropEdits, PropEditUtils, Forms, StdCtrls, ComCtrls, Dialogs, ComponentEditors,
|
||||
ObjInspStrConsts, Controls, IDEImagesIntf, typinfo, FormEditingIntf;
|
||||
|
||||
@ -100,6 +101,16 @@ type
|
||||
property PropertyName: String read FPropertyName;
|
||||
end;
|
||||
|
||||
{ TSynKeyCommandPropertyEditor }
|
||||
|
||||
TSynKeyCommandPropertyEditor = class(TIntegerPropertyEditor)
|
||||
public
|
||||
function GetAttributes: TPropertyAttributes; override;
|
||||
function OrdValueToVisualValue(OrdValue: longint): string; override;
|
||||
procedure GetValues(Proc: TGetStrProc); override;
|
||||
procedure SetValue(const NewValue: ansistring); override;
|
||||
end;
|
||||
|
||||
{ TSynMouseCommandPropertyEditor }
|
||||
|
||||
TSynMouseCommandPropertyEditor = class(TIntegerPropertyEditor)
|
||||
@ -183,6 +194,40 @@ begin
|
||||
Proc(TSetElementPropertyEditor.Create(Self, I));
|
||||
end;
|
||||
|
||||
{ TSynKeyCommandPropertyEditor }
|
||||
|
||||
function TSynKeyCommandPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||
begin
|
||||
Result := [paMultiSelect, paValueList, paRevertable];
|
||||
if GetDefaultOrdValue <> NoDefaultValue then
|
||||
Result := Result + [paHasDefaultValue];
|
||||
end;
|
||||
|
||||
function TSynKeyCommandPropertyEditor.OrdValueToVisualValue(OrdValue: longint): string;
|
||||
begin
|
||||
if not EditorCommandToIdent(OrdValue, Result) then
|
||||
Result := inherited OrdValueToVisualValue(OrdValue);
|
||||
end;
|
||||
|
||||
procedure TSynKeyCommandPropertyEditor.GetValues(Proc: TGetStrProc);
|
||||
var
|
||||
CValue: Integer;
|
||||
CName: String;
|
||||
i: TSynEditorMouseCommand;
|
||||
begin
|
||||
if not IdentToSynMouseCmd(GetVisualValue, CValue) then Proc(GetVisualValue);
|
||||
for i := 0 to ecMax do
|
||||
if EditorCommandToIdent(i, CName) then Proc(CName);
|
||||
end;
|
||||
|
||||
procedure TSynKeyCommandPropertyEditor.SetValue(const NewValue: ansistring);
|
||||
var
|
||||
CValue: Integer;
|
||||
begin
|
||||
if IdentToEditorCommand(NewValue, CValue) then SetOrdValue(CValue)
|
||||
else inherited SetValue(NewValue);
|
||||
end;
|
||||
|
||||
{ TSynMouseCommandPropertyEditor }
|
||||
|
||||
function TSynMouseCommandPropertyEditor.GetAttributes: TPropertyAttributes;
|
||||
|
||||
@ -7,7 +7,7 @@ object Form1: TForm1
|
||||
ClientHeight = 563
|
||||
ClientWidth = 559
|
||||
OnCreate = FormCreate
|
||||
LCLVersion = '0.9.29'
|
||||
LCLVersion = '0.9.31'
|
||||
inline SynEdit1: TSynEdit
|
||||
Left = 0
|
||||
Height = 280
|
||||
@ -24,50 +24,24 @@ object Form1: TForm1
|
||||
Gutter.Width = 57
|
||||
Gutter.MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 13
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcOnMainGutterClick
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 12
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcContextMenu
|
||||
end>
|
||||
RightGutter.Width = 0
|
||||
RightGutter.MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 13
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcOnMainGutterClick
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 12
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcContextMenu
|
||||
end>
|
||||
Keystrokes = <
|
||||
item
|
||||
@ -492,126 +466,71 @@ object Form1: TForm1
|
||||
end>
|
||||
MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 1
|
||||
Command = emcStartSelections
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssShift]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 1
|
||||
Command = emcStartSelections
|
||||
MoveCaret = True
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssAlt]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 3
|
||||
Command = emcStartColumnSelections
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssShift, ssAlt]
|
||||
ShiftMask = [ssShift, ssAlt]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 3
|
||||
Command = emcStartColumnSelections
|
||||
MoveCaret = True
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 12
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcContextMenu
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccDouble
|
||||
ClickDir = cdDown
|
||||
Command = 6
|
||||
Command = emcSelectWord
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccTriple
|
||||
ClickDir = cdDown
|
||||
Command = 7
|
||||
Command = emcSelectLine
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccQuad
|
||||
ClickDir = cdDown
|
||||
Command = 8
|
||||
Command = emcSelectPara
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbMiddle
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 10
|
||||
Command = emcPasteSelection
|
||||
MoveCaret = True
|
||||
Option = 0
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = [ssCtrl]
|
||||
ShiftMask = [ssShift, ssAlt, ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 11
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcMouseLink
|
||||
end>
|
||||
MouseSelActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdDown
|
||||
Command = 9
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcStartDragMove
|
||||
end>
|
||||
Lines.Strings = (
|
||||
'Press shift-space at the end of the next line(s):'
|
||||
@ -628,11 +547,23 @@ object Form1: TForm1
|
||||
'co'
|
||||
''
|
||||
)
|
||||
Options = [eoAutoIndent, eoGroupUndo, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces, eoBracketHighlight]
|
||||
Options = [eoAutoIndent, eoBracketHighlight, eoGroupUndo, eoSmartTabs, eoTabsToSpaces, eoTrimTrailingSpaces]
|
||||
VisibleSpecialChars = [vscSpace, vscTabAtLast]
|
||||
BracketHighlightStyle = sbhsBoth
|
||||
BracketMatchColor.Background = clNone
|
||||
BracketMatchColor.Foreground = clNone
|
||||
BracketMatchColor.Style = [fsBold]
|
||||
FoldedCodeColor.Background = clNone
|
||||
FoldedCodeColor.Foreground = clGray
|
||||
FoldedCodeColor.FrameColor = clGray
|
||||
MouseLinkColor.Background = clNone
|
||||
MouseLinkColor.Foreground = clBlue
|
||||
LineHighlightColor.Background = clNone
|
||||
LineHighlightColor.Foreground = clNone
|
||||
inline SynLeftGutterPartList1: TSynGutterPartList
|
||||
object SynGutterMarks1: TSynGutterMarks
|
||||
Width = 24
|
||||
MouseActions = <>
|
||||
end
|
||||
object SynGutterLineNumber1: TSynGutterLineNumber
|
||||
Width = 17
|
||||
@ -646,35 +577,26 @@ object Form1: TForm1
|
||||
end
|
||||
object SynGutterChanges1: TSynGutterChanges
|
||||
Width = 4
|
||||
MouseActions = <>
|
||||
ModifiedColor = 59900
|
||||
SavedColor = clGreen
|
||||
end
|
||||
object SynGutterSeparator1: TSynGutterSeparator
|
||||
Width = 2
|
||||
MouseActions = <>
|
||||
end
|
||||
object SynGutterCodeFolding1: TSynGutterCodeFolding
|
||||
MouseActions = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbRight
|
||||
ClickCount = ccSingle
|
||||
ClickDir = cdUp
|
||||
Command = 16
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcCodeFoldContextMenu
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssShift]
|
||||
Button = mbMiddle
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcCodeFoldCollaps
|
||||
end
|
||||
item
|
||||
Shift = [ssShift]
|
||||
@ -682,58 +604,36 @@ object Form1: TForm1
|
||||
Button = mbMiddle
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Command = emcCodeFoldCollaps
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 0
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcNone
|
||||
end>
|
||||
MarkupInfo.Background = clNone
|
||||
MarkupInfo.Foreground = clGray
|
||||
MouseActionsExpanded = <
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = []
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 14
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcCodeFoldCollaps
|
||||
end>
|
||||
MouseActionsCollapsed = <
|
||||
item
|
||||
Shift = [ssCtrl]
|
||||
ShiftMask = [ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 15
|
||||
MoveCaret = False
|
||||
Option = 0
|
||||
Priority = 0
|
||||
Command = emcCodeFoldExpand
|
||||
end
|
||||
item
|
||||
Shift = []
|
||||
ShiftMask = [ssCtrl]
|
||||
Button = mbLeft
|
||||
ClickCount = ccAny
|
||||
ClickDir = cdDown
|
||||
Command = 15
|
||||
MoveCaret = False
|
||||
Command = emcCodeFoldExpand
|
||||
Option = 1
|
||||
Priority = 0
|
||||
end>
|
||||
end
|
||||
end
|
||||
@ -910,4 +810,20 @@ object Form1: TForm1
|
||||
left = 211
|
||||
top = 83
|
||||
end
|
||||
object SynCompletion1: TSynCompletion
|
||||
OnExecute = DoExecute
|
||||
Position = 0
|
||||
NbLinesInWindow = 6
|
||||
OnSearchPosition = DoSearchPosition
|
||||
ClSelect = clHighlight
|
||||
CaseSensitive = False
|
||||
Width = 262
|
||||
ShowSizeDrag = True
|
||||
ShortCut = 16416
|
||||
EndOfTokenChr = '()[].'
|
||||
ExecCommandID = ecSynCompletionExecute
|
||||
Editor = SynEdit1
|
||||
left = 96
|
||||
top = 88
|
||||
end
|
||||
end
|
||||
|
||||
@ -26,17 +26,17 @@ type
|
||||
Splitter1: TSplitter;
|
||||
Splitter2: TSplitter;
|
||||
SynAutoComplete1: TSynAutoComplete;
|
||||
SynCompletion1: TSynCompletion;
|
||||
SynEdit1: TSynEdit;
|
||||
procedure chkExecChange(Sender: TObject);
|
||||
procedure chkSearchChange(Sender: TObject);
|
||||
procedure chkSizeDragChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure Memo1Change(Sender: TObject);
|
||||
private
|
||||
{ private declarations }
|
||||
SynCompletion: TSynCompletion;
|
||||
procedure DoExecute(Sender: TObject);
|
||||
procedure DoSearchPosition(var APosition: integer);
|
||||
private
|
||||
{ private declarations }
|
||||
public
|
||||
{ public declarations }
|
||||
end;
|
||||
@ -58,11 +58,11 @@ end;
|
||||
procedure TForm1.DoExecute(Sender: TObject);
|
||||
procedure Add(s: String);
|
||||
begin
|
||||
if pos(lowercase(SynCompletion.CurrentString), lowercase(s)) = 1 then
|
||||
SynCompletion.ItemList.Add(s);
|
||||
if pos(lowercase(SynCompletion1.CurrentString), lowercase(s)) = 1 then
|
||||
SynCompletion1.ItemList.Add(s);
|
||||
end;
|
||||
begin
|
||||
SynCompletion.ItemList.Clear;
|
||||
SynCompletion1.ItemList.Clear;
|
||||
if chkExec.Checked then begin
|
||||
Add('Personal Computer');
|
||||
Add('Personal');
|
||||
@ -71,30 +71,30 @@ begin
|
||||
Add('Police');
|
||||
Add('Constable');
|
||||
end else begin
|
||||
SynCompletion.ItemList.Add('Personal Computer');
|
||||
SynCompletion.ItemList.Add('Personal');
|
||||
SynCompletion.ItemList.Add('Computer');
|
||||
SynCompletion.ItemList.Add('Police Constable');
|
||||
SynCompletion.ItemList.Add('Police');
|
||||
SynCompletion.ItemList.Add('Constable');
|
||||
SynCompletion1.ItemList.Add('Personal Computer');
|
||||
SynCompletion1.ItemList.Add('Personal');
|
||||
SynCompletion1.ItemList.Add('Computer');
|
||||
SynCompletion1.ItemList.Add('Police Constable');
|
||||
SynCompletion1.ItemList.Add('Police');
|
||||
SynCompletion1.ItemList.Add('Constable');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.DoSearchPosition(var APosition: integer);
|
||||
procedure Add(s: String);
|
||||
begin
|
||||
if pos(lowercase(SynCompletion.CurrentString), lowercase(s)) = 1 then
|
||||
SynCompletion.ItemList.Add(s);
|
||||
if pos(lowercase(SynCompletion1.CurrentString), lowercase(s)) = 1 then
|
||||
SynCompletion1.ItemList.Add(s);
|
||||
end;
|
||||
begin
|
||||
SynCompletion.ItemList.Clear;
|
||||
SynCompletion1.ItemList.Clear;
|
||||
Add('Personal Computer');
|
||||
Add('Personal');
|
||||
Add('Computer');
|
||||
Add('Police Constable');
|
||||
Add('Police');
|
||||
Add('Constable');
|
||||
if SynCompletion.ItemList.Count > 0 then
|
||||
if SynCompletion1.ItemList.Count > 0 then
|
||||
APosition := 0
|
||||
else
|
||||
APosition := -1;
|
||||
@ -103,13 +103,6 @@ end;
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
Memo1Change(nil);
|
||||
SynCompletion := TSynCompletion.Create(Form1);
|
||||
SynCompletion.Editor := SynEdit1;
|
||||
SynCompletion.CaseSensitive := False;
|
||||
SynCompletion.OnExecute := @DoExecute;
|
||||
SynCompletion.OnSearchPosition := @DoSearchPosition;
|
||||
SynCompletion.ShowSizeDrag := True;
|
||||
SynCompletion.DoubleClickSelects := True;
|
||||
end;
|
||||
|
||||
procedure TForm1.chkExecChange(Sender: TObject);
|
||||
@ -120,15 +113,15 @@ end;
|
||||
procedure TForm1.chkSearchChange(Sender: TObject);
|
||||
begin
|
||||
if chkSearch.Checked then
|
||||
SynCompletion.OnSearchPosition := @DoSearchPosition
|
||||
SynCompletion1.OnSearchPosition := @DoSearchPosition
|
||||
else
|
||||
SynCompletion.OnSearchPosition := nil;
|
||||
SynCompletion1.OnSearchPosition := nil;
|
||||
SynEdit1.SetFocus;
|
||||
end;
|
||||
|
||||
procedure TForm1.chkSizeDragChange(Sender: TObject);
|
||||
begin
|
||||
SynCompletion.ShowSizeDrag := chkSizeDrag.Checked;
|
||||
SynCompletion1.ShowSizeDrag := chkSizeDrag.Checked;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
Loading…
Reference in New Issue
Block a user