From ce0956bf8f46521c6743c5a9c9530a10a89d25eb Mon Sep 17 00:00:00 2001 From: Ansgar Becker Date: Tue, 3 Jul 2007 05:53:29 +0000 Subject: [PATCH] Drop dialog for selecting databases to display. As discussed it has no performance problem any longer to handle more than 50 dbs. --- packages/delphi10/heidisql.dpr | 1 - packages/delphi11/heidisql.dpr | 1 - packages/delphi6/heidisql.dpr | 1 - source/childwin.pas | 7 +- source/selectsomedatabases.dfm | 96 --------------------- source/selectsomedatabases.pas | 151 --------------------------------- 6 files changed, 1 insertion(+), 256 deletions(-) delete mode 100644 source/selectsomedatabases.dfm delete mode 100644 source/selectsomedatabases.pas diff --git a/packages/delphi10/heidisql.dpr b/packages/delphi10/heidisql.dpr index 7bed221d..cabc2e4e 100644 --- a/packages/delphi10/heidisql.dpr +++ b/packages/delphi10/heidisql.dpr @@ -19,7 +19,6 @@ uses loaddata in '..\..\source\loaddata.pas' {loaddataform}, usermanager in '..\..\source\usermanager.pas' {UserManagerForm}, options in '..\..\source\options.pas' {optionsform}, - selectsomedatabases in '..\..\source\selectsomedatabases.pas' {SelectFromManyDatabases}, optimizetables in '..\..\source\optimizetables.pas' {optimize}, printlist in '..\..\source\printlist.pas' {printlistForm}, copytable in '..\..\source\copytable.pas' {CopyTableForm}, diff --git a/packages/delphi11/heidisql.dpr b/packages/delphi11/heidisql.dpr index 0c1f6bfd..5ff4b638 100644 --- a/packages/delphi11/heidisql.dpr +++ b/packages/delphi11/heidisql.dpr @@ -18,7 +18,6 @@ uses loaddata in '..\..\source\loaddata.pas' {loaddataform}, usermanager in '..\..\source\usermanager.pas' {UserManagerForm}, options in '..\..\source\options.pas' {optionsform}, - selectsomedatabases in '..\..\source\selectsomedatabases.pas' {SelectFromManyDatabases}, optimizetables in '..\..\source\optimizetables.pas' {optimize}, printlist in '..\..\source\printlist.pas' {printlistForm}, copytable in '..\..\source\copytable.pas' {CopyTableForm}, diff --git a/packages/delphi6/heidisql.dpr b/packages/delphi6/heidisql.dpr index 9fcec1d5..2ac9241c 100644 --- a/packages/delphi6/heidisql.dpr +++ b/packages/delphi6/heidisql.dpr @@ -16,7 +16,6 @@ uses loaddata in '..\..\source\loaddata.pas' {loaddataform}, usermanager in '..\..\source\usermanager.pas' {UserManagerForm}, options in '..\..\source\options.pas' {optionsform}, - selectsomedatabases in '..\..\source\selectsomedatabases.pas' {SelectFromManyDatabases}, optimizetables in '..\..\source\optimizetables.pas' {optimize}, printlist in '..\..\source\printlist.pas' {printlistForm}, copytable in '..\..\source\copytable.pas' {CopyTableForm}, diff --git a/source/childwin.pas b/source/childwin.pas index 2004ce4a..e6e38366 100644 --- a/source/childwin.pas +++ b/source/childwin.pas @@ -527,7 +527,7 @@ implementation uses Main, createtable, fieldeditor, tbl_properties, tblcomment, - selectsomedatabases, optimizetables, copytable, sqlhelp, printlist, + optimizetables, copytable, sqlhelp, printlist, column_selection; @@ -1108,11 +1108,6 @@ begin SynSQLSyn1.TableNames.AddStrings( OnlyDBs2 ); SynSQLSyn1.TableNames.EndUpdate(); - if ( ( OnlyDBs.Count = 0 ) and ( OnlyDBs2.Count > 50 ) ) then - begin - SelectFromManyDatabasesWindow( Self, OnlyDBs2 ); - end; - // List Databases and Tables-Names tmpSelected := nil; for i := 0 to ( OnlyDBs2.Count - 1 ) do diff --git a/source/selectsomedatabases.dfm b/source/selectsomedatabases.dfm deleted file mode 100644 index 72d838d2..00000000 --- a/source/selectsomedatabases.dfm +++ /dev/null @@ -1,96 +0,0 @@ -object SelectFromManyDatabases: TSelectFromManyDatabases - Left = 217 - Top = 105 - BorderStyle = bsDialog - BorderWidth = 3 - Caption = 'Select Databases...' - ClientHeight = 343 - ClientWidth = 335 - Color = clBtnFace - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - OldCreateOrder = False - Position = poMainFormCenter - OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object lblSelectDB: TLabel - Left = 8 - Top = 64 - Width = 87 - Height = 13 - Caption = 'Select Databases:' - end - object lblWarning: TLabel - Left = 48 - Top = 8 - Width = 235 - Height = 39 - Caption = - 'Found more than 50 Databases on this host. This can take some mi' + - 'nutes to display them all (depending on your network-connection)' - WordWrap = True - end - object imgWarning: TImage - Left = 8 - Top = 8 - Width = 33 - Height = 33 - Picture.Data = { - 07544269746D617076020000424D760200000000000076000000280000002000 - 0000200000000100040000000000000200000000000000000000100000001000 - 000000000000000080000080000000808000800000008000800080800000C0C0 - C000808080000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00777778888888888888888888888888777777888888888888888888888888 - 88877730000000000000000000000008888873BBBBBBBBBBBBBBBBBBBBBBBB70 - 88883BBBBBBBBBBBBBBBBBBBBBBBBBB708883BBBBBBBBBBBBBBBBBBBBBBBBBBB - 08883BBBBBBBBBBBB7007BBBBBBBBBBB08873BBBBBBBBBBBB0000BBBBBBBBBB7 - 088773BBBBBBBBBBB0000BBBBBBBBBB0887773BBBBBBBBBBB7007BBBBBBBBB70 - 8877773BBBBBBBBBBBBBBBBBBBBBBB088777773BBBBBBBBBBB0BBBBBBBBBB708 - 87777773BBBBBBBBB707BBBBBBBBB08877777773BBBBBBBBB303BBBBBBBB7088 - 777777773BBBBBBBB000BBBBBBBB0887777777773BBBBBBB70007BBBBBB70887 - 7777777773BBBBBB30003BBBBBB088777777777773BBBBBB00000BBBBB708877 - 77777777773BBBBB00000BBBBB08877777777777773BBBBB00000BBBB7088777 - 777777777773BBBB00000BBBB0887777777777777773BBBB00000BBB70887777 - 7777777777773BBB70007BBB088777777777777777773BBBBBBBBBB708877777 - 77777777777773BBBBBBBBB08877777777777777777773BBBBBBBB7088777777 - 777777777777773BBBBBBB0887777777777777777777773BBBBBB70887777777 - 7777777777777773BBBBB088777777777777777777777773BBBB708777777777 - 77777777777777773BB707777777777777777777777777777333777777777777 - 7777} - Transparent = True - end - object btnShowAll: TButton - Left = 216 - Top = 80 - Width = 105 - Height = 25 - Cancel = True - Caption = 'Show all' - Default = True - TabOrder = 0 - OnClick = btnShowAllClick - end - object CheckListBoxDBs: TCheckListBox - Left = 8 - Top = 80 - Width = 201 - Height = 257 - OnClickCheck = CheckListBoxDBsClickCheck - ItemHeight = 13 - TabOrder = 1 - end - object btnSave: TButton - Left = 216 - Top = 112 - Width = 105 - Height = 25 - Caption = 'Save' - Enabled = False - TabOrder = 2 - OnClick = btnSaveClick - end -end diff --git a/source/selectsomedatabases.pas b/source/selectsomedatabases.pas deleted file mode 100644 index 7811b77c..00000000 --- a/source/selectsomedatabases.pas +++ /dev/null @@ -1,151 +0,0 @@ -unit selectsomedatabases; - - -// ------------------------------------- -// Select some or all databases to view -// ------------------------------------- - - -interface - -uses - Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, - StdCtrls, CheckLst, ExtCtrls, Registry; - -type - TSelectFromManyDatabases = class(TForm) - lblSelectDB: TLabel; - btnShowAll: TButton; - lblWarning: TLabel; - CheckListBoxDBs: TCheckListBox; - imgWarning: TImage; - btnSave: TButton; - procedure btnShowAllClick(Sender: TObject); - procedure CheckListBoxDBsClickCheck(Sender: TObject); - procedure FormShow(Sender: TObject); - procedure btnSaveClick(Sender: TObject); - private - FDbList : TStringList; - procedure SetDbList(const Value: TStringList); - public - property DbList : TStringList read FDbList write SetDbList; - end; - - function SelectFromManyDatabasesWindow (AOwner : TComponent; ADbList : TStringList; Flags : String = '') : Boolean; - - -implementation - -uses main, childwin, connections; - -{$R *.DFM} - - -function SelectFromManyDatabasesWindow (AOwner : TComponent; ADbList : TStringList; Flags : String = '') : Boolean; -var - f : TSelectFromManyDatabases; -begin - f := TSelectFromManyDatabases.Create(AOwner); - f.DbList := ADbList; - Result := (f.ShowModal=mrOK); - FreeAndNil (f); -end; - - -procedure TSelectFromManyDatabases.btnShowAllClick(Sender: TObject); -var - i : Integer; - someselected : Boolean; -begin - someselected := false; - - for i:=0 to CheckListBoxDBs.Items.Count -1 do - begin - if CheckListBoxDBs.Checked[i] then - begin - someselected := true; - break; - end; - end; - - if someselected then - //OnlyDBs2.clear; - FDbList.Clear; - with CheckListBoxDBs do - for i:=0 to Items.Count -1 do - begin - if Checked[i] then - FDbList.Add(Items[i]); - end; - - close; -end; - -procedure TSelectFromManyDatabases.CheckListBoxDBsClickCheck( - Sender: TObject); -var - i : Integer; - someselected : Boolean; -begin - someselected := false; - for i:=0 to CheckListBoxDBs.Items.Count -1 do - begin - if CheckListBoxDBs.Checked[i] then - begin - someselected := true; - break; - end; - end; - if someselected then - begin - btnShowAll.Caption := 'Show selected'; - btnSave.Enabled := true; - end - else - begin - btnShowAll.Caption := 'Show all'; - btnSave.Enabled := false; - end -end; - -procedure TSelectFromManyDatabases.FormShow(Sender: TObject); -begin - btnShowAll.Caption := 'Show all'; - btnSave.Enabled := false; -end; - -procedure TSelectFromManyDatabases.SetDbList(const Value: TStringList); -begin - FDbList := Value; - - //CheckListBoxDBs.Items.Clear; - - if Value<>nil then - CheckListBoxDBs.Items := Value; -end; - -procedure TSelectFromManyDatabases.btnSaveClick(Sender: TObject); -var - i : Integer; - odbs : String; -begin - for i:=0 to CheckListBoxDBs.Items.Count -1 do - if CheckListBoxDBs.Checked[i] then - begin - if odbs <> '' then - odbs := odbs + ';'; - odbs := odbs + CheckListBoxDBs.Items[i]; - end; - - // save settings: - with TRegistry.Create do - begin - openkey(REGPATH + '\Servers\' + Mainform.Childwin.Conn.Description, true); - WriteString('OnlyDBs', odbs); - closekey(); - end; - btnSave.Enabled := false; - MessageDlg('Saved selected Databases to your local settings.', mtInformation, [mbOK], 0); -end; - -end.