added action to copy symbol identifier

This commit is contained in:
Basile Burg 2014-12-02 08:11:44 +01:00
parent cb5ad75f3d
commit bdbc857e1f
1 changed files with 20 additions and 6 deletions

View File

@ -6,7 +6,7 @@ interface
uses uses
Classes, SysUtils, TreeFilterEdit, Forms, Controls, Graphics, ExtCtrls, Menus, Classes, SysUtils, TreeFilterEdit, Forms, Controls, Graphics, ExtCtrls, Menus,
ComCtrls, ce_widget, jsonparser, fpjson, process, actnlist, Buttons, ComCtrls, ce_widget, jsonparser, fpjson, process, actnlist, Buttons, Clipbrd,
ce_common, ce_project, ce_observer, ce_synmemo, ce_interfaces; ce_common, ce_project, ce_observer, ce_synmemo, ce_interfaces;
type type
@ -25,6 +25,7 @@ type
private private
fDmdProc: TCheckedAsyncProcess; fDmdProc: TCheckedAsyncProcess;
fLogMessager: TCELogMessageSubject; fLogMessager: TCELogMessageSubject;
fActCopyIdent: TAction;
fActRefresh: TAction; fActRefresh: TAction;
fActRefreshOnChange: TAction; fActRefreshOnChange: TAction;
fActRefreshOnFocus: TAction; fActRefreshOnFocus: TAction;
@ -43,6 +44,7 @@ type
procedure actAutoRefreshExecute(Sender: TObject); procedure actAutoRefreshExecute(Sender: TObject);
procedure actRefreshOnChangeExecute(Sender: TObject); procedure actRefreshOnChangeExecute(Sender: TObject);
procedure actRefreshOnFocusExecute(Sender: TObject); procedure actRefreshOnFocusExecute(Sender: TObject);
procedure actCopyIdentExecute(Sender: TObject);
procedure updateVisibleCat; procedure updateVisibleCat;
// //
procedure produceJsonInfo; procedure produceJsonInfo;
@ -93,6 +95,10 @@ begin
fAutoRefresh := false; fAutoRefresh := false;
fRefreshOnFocus := true; fRefreshOnFocus := true;
fRefreshOnChange := false; fRefreshOnChange := false;
fActCopyIdent := TAction.Create(self);
fActCopyIdent.OnExecute:=@actCopyIdentExecute;
fActCopyIdent.Caption := 'Copy identifer';
fActRefresh := TAction.Create(self); fActRefresh := TAction.Create(self);
fActRefresh.OnExecute := @actRefreshExecute; fActRefresh.OnExecute := @actRefreshExecute;
fActRefresh.Caption := 'Refresh'; fActRefresh.Caption := 'Refresh';
@ -196,17 +202,18 @@ end;
function TCEStaticExplorerWidget.contextActionCount: integer; function TCEStaticExplorerWidget.contextActionCount: integer;
begin begin
result := 5; result := 6;
end; end;
function TCEStaticExplorerWidget.contextAction(index: integer): TAction; function TCEStaticExplorerWidget.contextAction(index: integer): TAction;
begin begin
case index of case index of
0: exit(fActSelectInSource); 0: exit(fActSelectInSource);
1: exit(fActRefresh); 1: exit(fActCopyIdent);
2: exit(fActAutoRefresh); 2: exit(fActRefresh);
3: exit(fActRefreshOnChange); 3: exit(fActAutoRefresh);
4: exit(fActRefreshOnFocus); 4: exit(fActRefreshOnChange);
5: exit(fActRefreshOnFocus);
else result := nil; else result := nil;
end; end;
end; end;
@ -231,6 +238,13 @@ procedure TCEStaticExplorerWidget.actRefreshOnFocusExecute(Sender: TObject);
begin begin
refreshOnFocus := not refreshOnFocus; refreshOnFocus := not refreshOnFocus;
end; end;
procedure TCEStaticExplorerWidget.actCopyIdentExecute(Sender: TObject);
begin
if Tree.Selected = nil then exit;
Clipboard.AsText:= Tree.Selected.Text;
end;
{$ENDREGION} {$ENDREGION}
{$REGION ICEMultiDocObserver ---------------------------------------------------} {$REGION ICEMultiDocObserver ---------------------------------------------------}