mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-06 18:24:26 +08:00
Issue #2155: paint session background and icon in session drop-down of SQL export dialog
This commit is contained in:
@ -672,9 +672,10 @@ object frmTableTools: TfrmTableTools
|
|||||||
BorderSpacing.Around = 6
|
BorderSpacing.Around = 6
|
||||||
DropDownCount = 16
|
DropDownCount = 16
|
||||||
ItemHeight = 20
|
ItemHeight = 20
|
||||||
Style = csDropDownList
|
Style = csOwnerDrawFixed
|
||||||
TabOrder = 6
|
TabOrder = 6
|
||||||
OnChange = comboExportOutputTypeChange
|
OnChange = comboExportOutputTypeChange
|
||||||
|
OnDrawItem = comboExportOutputTypeDrawItem
|
||||||
end
|
end
|
||||||
object comboExportOutputTarget: TComboBox
|
object comboExportOutputTarget: TComboBox
|
||||||
AnchorSideLeft.Control = tabSQLexport
|
AnchorSideLeft.Control = tabSQLexport
|
||||||
|
@ -13,10 +13,13 @@ uses
|
|||||||
SysUtils, Classes, Controls, Forms, StdCtrls, ComCtrls, Buttons, Dialogs,
|
SysUtils, Classes, Controls, Forms, StdCtrls, ComCtrls, Buttons, Dialogs,
|
||||||
laz.VirtualTrees, ExtCtrls, Graphics, RegExpr, Math, Generics.Collections, extra_controls,
|
laz.VirtualTrees, ExtCtrls, Graphics, RegExpr, Math, Generics.Collections, extra_controls,
|
||||||
dbconnection, apphelpers, Menus, DateUtils, Zipper, StrUtils,
|
dbconnection, apphelpers, Menus, DateUtils, Zipper, StrUtils,
|
||||||
SynEdit, ClipBrd, generic_types, fpjson, Variants, EditBtn, LazFileUtils;
|
SynEdit, ClipBrd, generic_types, fpjson, Variants, EditBtn, LazFileUtils, Types, LCLType, GraphUtil;
|
||||||
|
|
||||||
type
|
type
|
||||||
TToolMode = (tmMaintenance, tmFind, tmSQLExport, tmBulkTableEdit, tmGenerateData);
|
TToolMode = (tmMaintenance, tmFind, tmSQLExport, tmBulkTableEdit, tmGenerateData);
|
||||||
|
|
||||||
|
{ TfrmTableTools }
|
||||||
|
|
||||||
TfrmTableTools = class(TExtForm)
|
TfrmTableTools = class(TExtForm)
|
||||||
btnCloseOrCancel: TButton;
|
btnCloseOrCancel: TButton;
|
||||||
pnlTop: TPanel;
|
pnlTop: TPanel;
|
||||||
@ -99,6 +102,8 @@ type
|
|||||||
editGenerateDataNumRows: TEdit;
|
editGenerateDataNumRows: TEdit;
|
||||||
lblGenerateDataNullAmount: TLabel;
|
lblGenerateDataNullAmount: TLabel;
|
||||||
editGenerateDataNullAmount: TEdit;
|
editGenerateDataNullAmount: TEdit;
|
||||||
|
procedure comboExportOutputTypeDrawItem(Control: TWinControl;
|
||||||
|
Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||||
procedure FormCreate(Sender: TObject);
|
procedure FormCreate(Sender: TObject);
|
||||||
procedure FormShow(Sender: TObject);
|
procedure FormShow(Sender: TObject);
|
||||||
procedure btnHelpMaintenanceClick(Sender: TObject);
|
procedure btnHelpMaintenanceClick(Sender: TObject);
|
||||||
@ -253,6 +258,7 @@ var
|
|||||||
MenuItem: TMenuItem;
|
MenuItem: TMenuItem;
|
||||||
dt: TListNodeType;
|
dt: TListNodeType;
|
||||||
Obj: TDBObject;
|
Obj: TDBObject;
|
||||||
|
Params: TConnectionParameters;
|
||||||
begin
|
begin
|
||||||
HasSizeGrip := True;
|
HasSizeGrip := True;
|
||||||
OUTPUT_FILE := _('Single .sql file');
|
OUTPUT_FILE := _('Single .sql file');
|
||||||
@ -298,8 +304,10 @@ begin
|
|||||||
SessionPaths := TStringList.Create;
|
SessionPaths := TStringList.Create;
|
||||||
AppSettings.GetSessionPaths('', SessionPaths);
|
AppSettings.GetSessionPaths('', SessionPaths);
|
||||||
for i:=0 to SessionPaths.Count-1 do begin
|
for i:=0 to SessionPaths.Count-1 do begin
|
||||||
if SessionPaths[i] <> Mainform.ActiveConnection.Parameters.SessionPath then
|
if SessionPaths[i] = Mainform.ActiveConnection.Parameters.SessionPath then
|
||||||
comboExportOutputType.Items.Add(OUTPUT_SERVER+SessionPaths[i]);
|
Continue;
|
||||||
|
Params := TConnectionParameters.Create(SessionPaths[i]);
|
||||||
|
comboExportOutputType.Items.AddObject(OUTPUT_SERVER+SessionPaths[i], Params);
|
||||||
end;
|
end;
|
||||||
SessionPaths.Free;
|
SessionPaths.Free;
|
||||||
comboExportOutputTarget.Text := '';
|
comboExportOutputTarget.Text := '';
|
||||||
@ -336,6 +344,41 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure TfrmTableTools.comboExportOutputTypeDrawItem(Control: TWinControl;
|
||||||
|
Index: Integer; ARect: TRect; State: TOwnerDrawState);
|
||||||
|
var
|
||||||
|
Params: TConnectionParameters;
|
||||||
|
Canv: TCanvas;
|
||||||
|
ItemImageIndex: Integer;
|
||||||
|
begin
|
||||||
|
Canv := comboExportOutputType.Canvas;
|
||||||
|
if odSelected in State then begin
|
||||||
|
Canv.Brush.Color := clHighlight;
|
||||||
|
Canv.Pen.Color := clHighlightText;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
Canv.Brush.Color := clWindow;
|
||||||
|
Canv.Pen.Color := clWindowText;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Params := comboExportOutputType.Items.Objects[Index] as TConnectionParameters;
|
||||||
|
if Assigned(Params) then begin
|
||||||
|
if (Params.SessionColor <> clNone) and (not (odSelected in State)) then begin
|
||||||
|
Canv.Brush.Color := Params.SessionColor;
|
||||||
|
Canv.Pen.Color := clWindowText;
|
||||||
|
end;
|
||||||
|
ItemImageIndex := Params.ImageIndex;
|
||||||
|
end
|
||||||
|
else begin
|
||||||
|
ItemImageIndex := MainForm.actExportTables.ImageIndex;
|
||||||
|
end;
|
||||||
|
|
||||||
|
Canv.FillRect(ARect);
|
||||||
|
Canv.TextRect(ARect, ARect.Left + MainForm.VirtualImageListMain.Width + 4, ARect.Top, comboExportOutputType.Items[Index]);
|
||||||
|
MainForm.VirtualImageListMain.Draw(Canv, ARect.Left + 2, ARect.Top + 2, ItemImageIndex);
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure TfrmTableTools.FormShow(Sender: TObject);
|
procedure TfrmTableTools.FormShow(Sender: TObject);
|
||||||
var
|
var
|
||||||
Node, FirstChecked: PVirtualNode;
|
Node, FirstChecked: PVirtualNode;
|
||||||
|
Reference in New Issue
Block a user