Permalink
Browse files

Add new TAction for clearing query log, and assign it to the rightcli…

…ck menu item of it. Give this new action the hotkey Ctrl+Q. Closes #25.
  • Loading branch information...
ansgarbecker committed Dec 2, 2017
1 parent 09e6942 commit 699ba07df6a009122fa60088056e0d526e85191a
Showing with 18 additions and 18 deletions.
  1. +9 −3 source/main.dfm
  2. +9 −15 source/main.pas
View
@@ -2505,6 +2505,14 @@ object MainForm: TMainForm
ShortCut = 16471
OnExecute = actClearEditorExecute
end
object actClearQueryLog: TAction
Category = 'SQL'
Caption = 'Clear'
Hint = 'Clear query log'
ImageIndex = 58
ShortCut = 16465
OnExecute = actClearEditorExecute
end
object actQueryStopOnErrors: TAction
Category = 'SQL'
AutoCheck = True
@@ -9734,9 +9742,7 @@ object MainForm: TMainForm
OnClick = Copylinetonewquerytab1Click
end
object Clear2: TMenuItem
Caption = 'Clear'
ImageIndex = 58
OnClick = Clear2Click
Action = actClearQueryLog
end
object menuLogHorizontalScrollbar: TMenuItem
Action = actLogHorizontalScrollbar
View
@@ -641,6 +641,7 @@ TMainForm = class(TForm)
ToolButton11: TToolButton;
actCopyRows: TAction;
Copyselectedrows1: TMenuItem;
actClearQueryLog: TAction;
procedure actCreateDBObjectExecute(Sender: TObject);
procedure menuConnectionsPopup(Sender: TObject);
procedure actExitApplicationExecute(Sender: TObject);
@@ -717,7 +718,6 @@ TMainForm = class(TForm)
procedure ListTablesNewText(Sender: TBaseVirtualTree; Node: PVirtualNode;
Column: TColumnIndex; NewText: String);
procedure TimerConnectedTimer(Sender: TObject);
procedure Clear2Click(Sender: TObject);
procedure QuickFilterClick(Sender: TObject);
procedure AutoRefreshSetInterval(Sender: TObject);
procedure AutoRefreshToggle(Sender: TObject);
@@ -2289,22 +2289,26 @@ procedure TMainForm.actClearEditorExecute(Sender: TObject);
var
m: TSynMemo;
begin
if Sender = actClearQueryEditor then
if Sender = actClearQueryEditor then begin
m := ActiveQueryMemo
else begin
end else if Sender = actClearQueryLog then begin
m := SynMemoSQLLog;
m.Gutter.LineNumberStart := m.Gutter.LineNumberStart + m.Lines.Count;
end else begin
m := SynMemoFilter;
editFilterSearch.Clear;
end;
m.SelectAll;
m.SelText := '';
m.SelStart := 0;
m.SelEnd := 0;
if QueryTabActive then begin
if Sender = actClearQueryEditor then begin
ActiveQueryTab.MemoFilename := '';
ActiveQueryTab.Memo.Modified := False;
end;
if m = SynMemoFilter then
if m = SynMemoFilter then begin
InvalidateVT(DataGrid, VTREE_NOTLOADED_PURGECACHE, False);
end;
end;
@@ -5940,16 +5944,6 @@ procedure TMainForm.TimerConnectedTimer(Sender: TObject);
end;
procedure TMainForm.Clear2Click(Sender: TObject);
begin
// clear history-memo
Screen.Cursor := crHourglass;
SynMemoSQLLog.Gutter.LineNumberStart := SynMemoSQLLog.Gutter.LineNumberStart + SynMemoSQLLog.Lines.Count;
SynMemoSQLLog.Lines.Clear;
Screen.Cursor := crDefault;
end;
procedure TMainForm.Copylinetonewquerytab1Click(Sender: TObject);
var
Tab: TQueryTab;

0 comments on commit 699ba07

Please sign in to comment.