Add a button right beside the last query tab which can open a new query tab, so it's more clear that we have multi tabs now.

This commit is contained in:
Ansgar Becker
2009-08-04 19:19:24 +00:00
parent 36e9dabd15
commit a965b30441
2 changed files with 22 additions and 1 deletions

View File

@@ -2135,6 +2135,7 @@ object MainForm: TMainForm
object actNewQueryTab: TAction
Category = 'File'
Caption = 'New query tab'
Hint = 'Open a blank query tab'
ImageIndex = 132
ShortCut = 16468
OnExecute = actNewQueryTabExecute

View File

@@ -23,7 +23,7 @@ uses
TntStdCtrls, Tabs, SynUnicode, mysqlconn, EditVar, helpers, queryprogress,
mysqlquery, createdatabase, table_editor, SynRegExpr,
WideStrUtils, ZDbcLogging, ExtActns, CommCtrl, routine_editor, options,
Contnrs;
Contnrs, PngSpeedButton;
const
// The InnoDB folks are raging over the lack of count(*) support
@@ -804,6 +804,7 @@ type
DataGridCurrentFrom,
DataGridCurrentFilter,
DataGridCurrentSort : WideString;
btnAddTab : TPngSpeedButton;
property Delimiter: String read FDelimiter write SetDelimiter;
procedure CallSQLHelpWithKeyword( keyword: String );
@@ -1411,6 +1412,15 @@ begin
// Add two static results for the Data and Query tab. Results for added query tabs will be created on demand.
FGridResults.Add(TGridResult.Create);
FGridResults.Add(TGridResult.Create);
btnAddTab := TPngSpeedButton.Create(PageControlMain);
btnAddTab.Parent := PageControlMain;
btnAddTab.PngImage := PngImageListMain.PngImages[actNewQueryTab.ImageIndex].PngImage;
btnAddTab.Height := PageControlMain.TabHeight - 2;
btnAddTab.Width := btnAddTab.Height;
btnAddTab.Flat := True;
btnAddTab.Hint := actNewQueryTab.Hint;
btnAddTab.OnClick := actNewQueryTab.OnExecute;
end;
@@ -9286,6 +9296,16 @@ begin
btn.Top := Rect.Top + 2;
btn.Left := Rect.Right - 19;
end;
// Set position of "Add tab" button
VisiblePageIndex := PageControlMain.PageCount-1;
for i:=0 to PageControlMain.PageCount-1 do begin
if not PageControlMain.Pages[i].TabVisible then
Dec(VisiblePageIndex);
end;
Rect := PageControlMain.TabRect(VisiblePageIndex);
btnAddTab.Top := Rect.Top;
btnAddTab.Left := Rect.Right + 5;
LockWindowUpdate(0);
end;