mirror of https://gitlab.com/basile.b/dexed.git
Merge branch 'a12_2_a13'
This commit is contained in:
commit
8ecd0221d3
Binary file not shown.
After Width: | Height: | Size: 662 B |
|
@ -7,8 +7,8 @@ interface
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, ExtendedNotebook, Forms, Controls, lcltype,
|
Classes, SysUtils, FileUtil, ExtendedNotebook, Forms, Controls, lcltype,
|
||||||
Graphics, SynEditKeyCmds, ComCtrls, SynEditHighlighter, ExtCtrls, Menus,
|
Graphics, SynEditKeyCmds, ComCtrls, SynEditHighlighter, ExtCtrls, Menus,
|
||||||
SynMacroRecorder, SynPluginSyncroEdit, SynEdit, SynCompletion, ce_widget,
|
SynMacroRecorder, SynPluginSyncroEdit, SynEdit, SynCompletion,
|
||||||
ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer;
|
ce_widget, ce_interfaces, ce_synmemo, ce_dlang, ce_common, ce_dcd, ce_observer;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
|
||||||
|
@ -19,7 +19,7 @@ type
|
||||||
procedure SetVisible(Value: Boolean); override;
|
procedure SetVisible(Value: Boolean); override;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler)
|
TCEEditorWidget = class(TCEWidget, ICEMultiDocObserver, ICEMultiDocHandler, ICEEditableShortCut)
|
||||||
PageControl: TExtendedNotebook;
|
PageControl: TExtendedNotebook;
|
||||||
macRecorder: TSynMacroRecorder;
|
macRecorder: TSynMacroRecorder;
|
||||||
editorStatus: TStatusBar;
|
editorStatus: TStatusBar;
|
||||||
|
@ -36,9 +36,10 @@ type
|
||||||
fDoc: TCESynMemo;
|
fDoc: TCESynMemo;
|
||||||
// TODO-cbugfix: syncro-edit partially broken, undetermined condition
|
// TODO-cbugfix: syncro-edit partially broken, undetermined condition
|
||||||
fSyncEdit: TSynPluginSyncroEdit;
|
fSyncEdit: TSynPluginSyncroEdit;
|
||||||
tokLst: TLexTokenList;
|
fTokList: TLexTokenList;
|
||||||
errLst: TLexErrorList;
|
fErrList: TLexErrorList;
|
||||||
fModStart: boolean;
|
fModStart: boolean;
|
||||||
|
fShortcutCount: Integer;
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
procedure pageCloseBtnClick(Sender: TObject);
|
procedure pageCloseBtnClick(Sender: TObject);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
@ -64,6 +65,10 @@ type
|
||||||
function findDocument(aFilename: string): TCESynMemo;
|
function findDocument(aFilename: string): TCESynMemo;
|
||||||
procedure openDocument(aFilename: string);
|
procedure openDocument(aFilename: string);
|
||||||
function closeDocument(index: Integer): boolean;
|
function closeDocument(index: Integer): boolean;
|
||||||
|
//
|
||||||
|
function scedWantFirst: boolean;
|
||||||
|
function scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
|
||||||
|
procedure scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
||||||
public
|
public
|
||||||
constructor create(aOwner: TComponent); override;
|
constructor create(aOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -88,8 +93,8 @@ var
|
||||||
begin
|
begin
|
||||||
inherited;
|
inherited;
|
||||||
//
|
//
|
||||||
tokLst := TLexTokenList.Create;
|
fTokList := TLexTokenList.Create;
|
||||||
errLst := TLexErrorList.Create;
|
fErrList := TLexErrorList.Create;
|
||||||
//
|
//
|
||||||
completion.OnPaintItem := @completionItemPaint;
|
completion.OnPaintItem := @completionItemPaint;
|
||||||
fSyncEdit := TSynPluginSyncroEdit.Create(self);
|
fSyncEdit := TSynPluginSyncroEdit.Create(self);
|
||||||
|
@ -120,8 +125,8 @@ begin
|
||||||
if PageControl.Page[i].ControlCount > 0 then
|
if PageControl.Page[i].ControlCount > 0 then
|
||||||
if (PageControl.Page[i].Controls[0] is TCESynMemo) then
|
if (PageControl.Page[i].Controls[0] is TCESynMemo) then
|
||||||
PageControl.Page[i].Controls[0].Free;
|
PageControl.Page[i].Controls[0].Free;
|
||||||
tokLst.Free;
|
fTokList.Free;
|
||||||
errLst.Free;
|
fErrList.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -252,6 +257,34 @@ begin
|
||||||
end;
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
|
{$REGION ICEEDitableSHortcut ---------------------------------------------------}
|
||||||
|
function TCEEditorWidget.scedWantFirst: boolean;
|
||||||
|
begin
|
||||||
|
result := fDoc <> nil;
|
||||||
|
fShortcutCount := 0;
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TCEEditorWidget.scedWantNext(out category, identifier: string; out aShortcut: TShortcut): boolean;
|
||||||
|
var
|
||||||
|
shrct: TSynEditKeyStroke;
|
||||||
|
begin
|
||||||
|
result := false;
|
||||||
|
if fShortcutCount > fDoc.Keystrokes.Count-1 then exit;
|
||||||
|
//
|
||||||
|
shrct := fDoc.Keystrokes.Items[fShortcutCount];
|
||||||
|
category := 'Editor';
|
||||||
|
identifier:= shrct.DisplayName;
|
||||||
|
aShortcut := Shortcut(shrct.Key, shrct.Shift);
|
||||||
|
//
|
||||||
|
fShortcutCount += 1;
|
||||||
|
result := true;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEEditorWidget.scedSendItem(const category, identifier: string; aShortcut: TShortcut);
|
||||||
|
begin
|
||||||
|
|
||||||
|
end;
|
||||||
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION PageControl/Editor things ---------------------------------------------}
|
{$REGION PageControl/Editor things ---------------------------------------------}
|
||||||
{$IFDEF LINUX}
|
{$IFDEF LINUX}
|
||||||
|
@ -411,15 +444,15 @@ begin
|
||||||
fKeyChanged := false;
|
fKeyChanged := false;
|
||||||
if fDoc.Lines.Count = 0 then exit;
|
if fDoc.Lines.Count = 0 then exit;
|
||||||
//
|
//
|
||||||
lex(fDoc.Lines.Text, tokLst, @lexFindToken);
|
lex(fDoc.Lines.Text, fTokList, @lexFindToken);
|
||||||
md := '';
|
md := '';
|
||||||
if fDoc.isDSource then
|
if fDoc.isDSource then
|
||||||
md := getModuleName(tokLst);
|
md := getModuleName(fTokList);
|
||||||
if md = '' then md := extractFileName(fDoc.fileName);
|
if md = '' then md := extractFileName(fDoc.fileName);
|
||||||
pageControl.ActivePage.Caption := md;
|
pageControl.ActivePage.Caption := md;
|
||||||
//
|
//
|
||||||
tokLst.Clear;
|
fTokList.Clear;
|
||||||
errLst.Clear;
|
fErrList.Clear;
|
||||||
// when a widget saves a temp file & syncro mode is on:
|
// when a widget saves a temp file & syncro mode is on:
|
||||||
// - editor is saved
|
// - editor is saved
|
||||||
// - gutter is updated (green bar indicating a saved block)
|
// - gutter is updated (green bar indicating a saved block)
|
||||||
|
|
|
@ -19,6 +19,9 @@ type
|
||||||
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
// attributes frameedges are not stored because of:
|
||||||
|
//TODO-cLCL&LAZ-specific: remove this comment once http://bugs.freepascal.org/view.php?id=27513 merged/fixed
|
||||||
|
|
||||||
(**
|
(**
|
||||||
* Container for the editor and highlither options.
|
* Container for the editor and highlither options.
|
||||||
* The base class is also used to backup the settings
|
* The base class is also used to backup the settings
|
||||||
|
|
|
@ -1288,6 +1288,34 @@ LazarusResources.Add('information','PNG',[
|
||||||
+#129's'#255'?'#166'w'#209#11#168'?'#130'{Y'#182'!'#185#0#0#0#0'IEND'#174'B`'
|
+#129's'#255'?'#166'w'#209#11#168'?'#130'{Y'#182'!'#185#0#0#0#0'IEND'#174'B`'
|
||||||
+#130
|
+#130
|
||||||
]);
|
]);
|
||||||
|
LazarusResources.Add('keyboard_pencil','PNG',[
|
||||||
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||||
|
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#2'8IDATx'#218#164'R'
|
||||||
|
+'M'#136'RQ'#24'='#239#169#185#24#245#197'@'#14#8#17#211'"'#8'l'#147#141#137
|
||||||
|
+#13'Q'#193#12#181')'#220'8'#208#166#141'A'#251'fQ'#8#193',dp;+'#131' h1'#19
|
||||||
|
+#22#204'*'#132'6'#25#131#191#208'B'#210#16'kB#'#18'-'#234#233'c'#242#223#219
|
||||||
|
+#253#174#189#199#163#149#208#133#239#221#159#247#157#243#157'{'#190'+1'#198
|
||||||
|
+#240'?'#195'J'#159'p8|'#154'O'#23'y8'#231#196'i<'#10#188#248'gA0'#157'N'#3
|
||||||
|
+#209'h'#244#161#219#237#246#206#131'n'#183#219#229'X,'#182#205#151'3'#130#201
|
||||||
|
+'d'#162'p6'#175','#203's'#149#167'\'#194#24'W'#224#27#137#188#168'V'#171#240
|
||||||
|
+#251#253#176#217'l'#176'X,"'#254'*'#196'x<'#198'h4B'#177'X'#132#203#229#18#24
|
||||||
|
+'3'#129'L'#213#9'@s&'#147'A'#165'RA '#16#128#207#231#19#224#193'``'#16'S'#14
|
||||||
|
+'a'#8'+><A'#162'C'#171#213'J'#242#144#203#229#16#137'D'#144#207#231#197#158
|
||||||
|
+#130'T'#208'L9'#148'K'#152#203#181#218'L'#1#223#200#196#172#19#12#135'C$'#147
|
||||||
|
+'IQ'#149#128#230#16#4#229'2'#30'e'#179'w'#229#163#163#247#186#2'YW@ID'#16#10
|
||||||
|
+#133#4#129'^'#157'K'#22'kM'#211'Pm4pis'#243#220'w`K'#28#6#131#193#251#220'@V'
|
||||||
|
+'*'#149'X'#167#211'a'#205'fS'#204#253'~_D'#183#219'e'#173'V'#139'5>'#190'b'
|
||||||
|
+#137'D'#130#245'z=v}y'#249#237'S`]('#224#238#202'f'#15't'#185#230#251'k?'#178
|
||||||
|
+'h|'#216#193#157#155#13#196#227'q|]XxW'#240'x^'#203#255'z'#192#171#195#225'p'
|
||||||
|
+#192'n'#183#27#173#252#173#22#209'<|'#140#149#149#243#216#223#127#131#245#171
|
||||||
|
+'g'#168'#'#173#194#210#210#204'D~WAP'#227#174#210#168#215#235#198#163#145'F'
|
||||||
|
+#21#12#127#189#192#218#218'5'#236#238#166#160'x6'#224'9'#21#20#24#163#141#170
|
||||||
|
+#170#246#210#233#244''''#189'EzL'#251#223#12#240#222'^'#10#139'''oC9q'#1#148
|
||||||
|
+'K'#24#30#16'/PQ'#20'/'#191#231#13#206#181'h~'#178#27'W'#6#171'O'#158#151'W'
|
||||||
|
+#183#30#156#253#146':8'#150#173#28'Zui?y'#129#148'$IeA'#224't:E'#155#204#131
|
||||||
|
+#140#227'2'#217#189'['#210'K'#229'8v'#158#165#236#7#170'&'#25#255'u'#127#254
|
||||||
|
+#8'0'#0#204#231'b U<'#159'Q'#0#0#0#0'IEND'#174'B`'#130
|
||||||
|
]);
|
||||||
LazarusResources.Add('link','PNG',[
|
LazarusResources.Add('link','PNG',[
|
||||||
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0#16#0#0#0#16#8#6#0#0#0#31#243#255'a'
|
||||||
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#0#219'IDATx'#218#236
|
+#0#0#0#25'tEXtSoftware'#0'Adobe ImageReadyq'#201'e<'#0#0#0#219'IDATx'#218#236
|
||||||
|
|
|
@ -35,11 +35,15 @@ inherited CEOptionEditorWidget: TCEOptionEditorWidget
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 140
|
Width = 140
|
||||||
Align = alLeft
|
Align = alLeft
|
||||||
|
AutoExpand = True
|
||||||
DefaultItemHeight = 18
|
DefaultItemHeight = 18
|
||||||
|
HideSelection = False
|
||||||
|
ReadOnly = True
|
||||||
ScrollBars = ssAutoBoth
|
ScrollBars = ssAutoBoth
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
OnDeletion = selCatDeletion
|
OnDeletion = selCatDeletion
|
||||||
OnSelectionChanged = selCatSelectionChanged
|
OnSelectionChanged = selCatSelectionChanged
|
||||||
|
Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
object pnlEd: TPanel
|
object pnlEd: TPanel
|
||||||
Left = 146
|
Left = 146
|
||||||
|
|
|
@ -1,28 +1,28 @@
|
||||||
object CEShortcutEditor: TCEShortcutEditor
|
object CEShortcutEditor: TCEShortcutEditor
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 471
|
Height = 463
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 431
|
Width = 424
|
||||||
ClientHeight = 471
|
ClientHeight = 463
|
||||||
ClientWidth = 431
|
ClientWidth = 424
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
DesignLeft = 796
|
DesignLeft = 796
|
||||||
DesignTop = 213
|
DesignTop = 213
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 471
|
Height = 463
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 431
|
Width = 424
|
||||||
Align = alClient
|
Align = alClient
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
ClientHeight = 471
|
ClientHeight = 463
|
||||||
ClientWidth = 431
|
ClientWidth = 424
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object fltItems: TTreeFilterEdit
|
object fltItems: TTreeFilterEdit
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 0
|
Top = 0
|
||||||
Width = 407
|
Width = 400
|
||||||
ButtonWidth = 23
|
ButtonWidth = 23
|
||||||
NumGlyphs = 1
|
NumGlyphs = 1
|
||||||
Align = alCustom
|
Align = alCustom
|
||||||
|
@ -33,24 +33,64 @@ object CEShortcutEditor: TCEShortcutEditor
|
||||||
end
|
end
|
||||||
object tree: TTreeView
|
object tree: TTreeView
|
||||||
Left = 1
|
Left = 1
|
||||||
Height = 389
|
Height = 400
|
||||||
Top = 28
|
Top = 28
|
||||||
Width = 430
|
Width = 423
|
||||||
Align = alCustom
|
Align = alCustom
|
||||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||||
|
AutoExpand = True
|
||||||
DefaultItemHeight = 18
|
DefaultItemHeight = 18
|
||||||
|
HideSelection = False
|
||||||
|
ReadOnly = True
|
||||||
ScrollBars = ssAutoBoth
|
ScrollBars = ssAutoBoth
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
|
OnSelectionChanged = treeSelectionChanged
|
||||||
|
Options = [tvoAutoExpand, tvoAutoItemHeight, tvoKeepCollapsedNodes, tvoReadOnly, tvoShowButtons, tvoShowLines, tvoShowRoot, tvoToolTips, tvoThemedDraw]
|
||||||
end
|
end
|
||||||
object Panel2: TPanel
|
object Panel2: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 50
|
Height = 31
|
||||||
Top = 421
|
Top = 432
|
||||||
Width = 431
|
Width = 424
|
||||||
Align = alBottom
|
Align = alBottom
|
||||||
BevelOuter = bvNone
|
BevelOuter = bvNone
|
||||||
Caption = 'Controls to edit the shortcut...'
|
ClientHeight = 31
|
||||||
|
ClientWidth = 424
|
||||||
TabOrder = 2
|
TabOrder = 2
|
||||||
|
object schrtText: TStaticText
|
||||||
|
Left = 4
|
||||||
|
Height = 23
|
||||||
|
Top = 4
|
||||||
|
Width = 277
|
||||||
|
Align = alClient
|
||||||
|
Alignment = taCenter
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
BorderStyle = sbsSunken
|
||||||
|
TabOrder = 0
|
||||||
|
end
|
||||||
|
object shcCatch: TEdit
|
||||||
|
Left = 312
|
||||||
|
Height = 25
|
||||||
|
Top = 3
|
||||||
|
Width = 112
|
||||||
|
Align = alRight
|
||||||
|
BorderSpacing.Top = 3
|
||||||
|
BorderSpacing.Bottom = 3
|
||||||
|
Enabled = False
|
||||||
|
OnExit = shcCatchExit
|
||||||
|
OnKeyDown = LabeledEdit1KeyDown
|
||||||
|
OnMouseLeave = shcCatchMouseLeave
|
||||||
|
TabOrder = 1
|
||||||
|
end
|
||||||
|
object btnActivate: TSpeedButton
|
||||||
|
Left = 285
|
||||||
|
Height = 23
|
||||||
|
Top = 4
|
||||||
|
Width = 23
|
||||||
|
Align = alRight
|
||||||
|
BorderSpacing.Around = 4
|
||||||
|
OnClick = btnActivateClick
|
||||||
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -5,8 +5,8 @@ unit ce_shortcutseditor;
|
||||||
interface
|
interface
|
||||||
|
|
||||||
uses
|
uses
|
||||||
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Menus,
|
Classes, SysUtils, FileUtil, TreeFilterEdit, Forms, Controls, Menus, Graphics,
|
||||||
ExtCtrls, LCLProc, ComCtrls,
|
ExtCtrls, LCLProc, ComCtrls, StdCtrls, LMessages, Buttons, LCLType,
|
||||||
ce_observer, ce_interfaces, ce_common, ce_writableComponent;
|
ce_observer, ce_interfaces, ce_common, ce_writableComponent;
|
||||||
|
|
||||||
type
|
type
|
||||||
|
@ -41,11 +41,21 @@ type
|
||||||
property item[index: Integer]: TShortcutItem read getShortcut; default;
|
property item[index: Integer]: TShortcutItem read getShortcut; default;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
{ TCEShortcutEditor }
|
||||||
|
|
||||||
TCEShortcutEditor = class(TFrame, ICEEditableOptions)
|
TCEShortcutEditor = class(TFrame, ICEEditableOptions)
|
||||||
|
shcCatch: TEdit;
|
||||||
Panel1: TPanel;
|
Panel1: TPanel;
|
||||||
fltItems: TTreeFilterEdit;
|
fltItems: TTreeFilterEdit;
|
||||||
Panel2: TPanel;
|
Panel2: TPanel;
|
||||||
|
schrtText: TStaticText;
|
||||||
|
btnActivate: TSpeedButton;
|
||||||
tree: TTreeView;
|
tree: TTreeView;
|
||||||
|
procedure btnActivateClick(Sender: TObject);
|
||||||
|
procedure LabeledEdit1KeyDown(Sender: TObject; var Key: Word;Shift: TShiftState);
|
||||||
|
procedure shcCatchExit(Sender: TObject);
|
||||||
|
procedure shcCatchMouseLeave(Sender: TObject);
|
||||||
|
procedure treeSelectionChanged(Sender: TObject);
|
||||||
private
|
private
|
||||||
fObservers: TCEEditableShortCutSubject;
|
fObservers: TCEEditableShortCutSubject;
|
||||||
fShortcuts: TShortCutCollection;
|
fShortcuts: TShortCutCollection;
|
||||||
|
@ -58,6 +68,9 @@ type
|
||||||
//
|
//
|
||||||
function findCategory(const aName: string; aData: Pointer): TTreeNode;
|
function findCategory(const aName: string; aData: Pointer): TTreeNode;
|
||||||
procedure updateFromObservers;
|
procedure updateFromObservers;
|
||||||
|
procedure updateEditCtrls;
|
||||||
|
protected
|
||||||
|
procedure UpdateShowing; override;
|
||||||
public
|
public
|
||||||
constructor create(TheOwner: TComponent); override;
|
constructor create(TheOwner: TComponent); override;
|
||||||
destructor destroy; override;
|
destructor destroy; override;
|
||||||
|
@ -139,6 +152,22 @@ begin
|
||||||
fObservers.Free;
|
fObservers.Free;
|
||||||
inherited;
|
inherited;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.UpdateShowing;
|
||||||
|
var
|
||||||
|
png : TPortableNetworkGraphic;
|
||||||
|
begin
|
||||||
|
inherited;
|
||||||
|
if not visible then exit;
|
||||||
|
//
|
||||||
|
png := TPortableNetworkGraphic.Create;
|
||||||
|
try
|
||||||
|
png.LoadFromLazarusResource('keyboard_pencil');
|
||||||
|
btnActivate.Glyph.Assign(png);
|
||||||
|
finally
|
||||||
|
png.free;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION ICEEditableOptions ----------------------------------------------------}
|
{$REGION ICEEditableOptions ----------------------------------------------------}
|
||||||
|
@ -165,6 +194,57 @@ end;
|
||||||
{$ENDREGION}
|
{$ENDREGION}
|
||||||
|
|
||||||
{$REGION shortcut editor things ------------------------------------------------}
|
{$REGION shortcut editor things ------------------------------------------------}
|
||||||
|
procedure TCEShortcutEditor.treeSelectionChanged(Sender: TObject);
|
||||||
|
begin
|
||||||
|
updateEditCtrls;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.shcCatchExit(Sender: TObject);
|
||||||
|
begin
|
||||||
|
shcCatch.Enabled := false;
|
||||||
|
updateEditCtrls;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.shcCatchMouseLeave(Sender: TObject);
|
||||||
|
begin
|
||||||
|
shcCatch.Enabled := false;
|
||||||
|
updateEditCtrls;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.btnActivateClick(Sender: TObject);
|
||||||
|
begin
|
||||||
|
if tree.Selected = nil then exit;
|
||||||
|
if tree.Selected.Level = 0 then exit;
|
||||||
|
if tree.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
shcCatch.Enabled := not shcCatch.Enabled;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.LabeledEdit1KeyDown(Sender: TObject; var Key: Word;
|
||||||
|
Shift: TShiftState);
|
||||||
|
begin
|
||||||
|
if tree.Selected = nil then exit;
|
||||||
|
if tree.Selected.Level = 0 then exit;
|
||||||
|
if tree.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
if Key = VK_RETURN then shcCatch.Enabled := false
|
||||||
|
else TShortcutItem(tree.Selected.Data).data := Shortcut(Key, Shift);
|
||||||
|
//
|
||||||
|
updateEditCtrls;
|
||||||
|
end;
|
||||||
|
|
||||||
|
procedure TCEShortcutEditor.updateEditCtrls;
|
||||||
|
begin
|
||||||
|
schrtText.Caption := '';
|
||||||
|
//
|
||||||
|
if tree.Selected = nil then exit;
|
||||||
|
if tree.Selected.Level = 0 then exit;
|
||||||
|
if tree.Selected.Data = nil then exit;
|
||||||
|
//
|
||||||
|
schrtText.Caption := TShortcutItem(tree.Selected.Data).combination;
|
||||||
|
shcCatch.Text:= '';
|
||||||
|
end;
|
||||||
|
|
||||||
function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode;
|
function TCEShortcutEditor.findCategory(const aName: string; aData: Pointer): TTreeNode;
|
||||||
var
|
var
|
||||||
i: Integer;
|
i: Integer;
|
||||||
|
@ -197,11 +277,13 @@ begin
|
||||||
if obs.scedWantFirst then while obs.scedWantNext(cat, idt, sht) do
|
if obs.scedWantFirst then while obs.scedWantNext(cat, idt, sht) do
|
||||||
begin
|
begin
|
||||||
// root category
|
// root category
|
||||||
|
if cat = '' then
|
||||||
|
continue;
|
||||||
|
if idt = '' then
|
||||||
|
continue;
|
||||||
prt := findCategory(cat, obs);
|
prt := findCategory(cat, obs);
|
||||||
if prt = nil then
|
if prt = nil then
|
||||||
prt := tree.Items.AddObject(nil, cat, obs);
|
prt := tree.Items.AddObject(nil, cat, obs);
|
||||||
if idt = '' then
|
|
||||||
continue;
|
|
||||||
// item as child
|
// item as child
|
||||||
itm := TShortcutItem(fShortcuts.items.Add);
|
itm := TShortcutItem(fShortcuts.items.Add);
|
||||||
itm.identifier := idt;
|
itm.identifier := idt;
|
||||||
|
|
Loading…
Reference in New Issue