mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2025-08-26 11:17:57 +08:00
Rounding for copy tabe dialog:
- Fix cut labels using Vista font - Fix wording in several places - Normalize positions of controls, use default 8px margin to form edges - Put a "Select / deselect all" checkbox below the field selection box - Move registry related constants to const.inc and normalize their names
This commit is contained in:
@ -176,6 +176,12 @@ const
|
||||
REGNAME_USERMNGR_WINHEIGHT = 'Usermanager_WindowHeight';
|
||||
REGNAME_SELECTDBO_WINWIDTH = 'SelectDBO_WindowWidth';
|
||||
REGNAME_SELECTDBO_WINHEIGHT = 'SelectDBO_WindowHeight';
|
||||
REGNAME_COPYTABLE_STRUCDATA = 'CopyTable_Option_StructureData';
|
||||
REGVAL_COPYTABLE_STRUCTURE = 0;
|
||||
REGVAL_COPYTABLE_STRUCTURE_AND_DATA = 1;
|
||||
DEFAULT_COPYTABLE_STRUCDATA = REGVAL_COPYTABLE_STRUCTURE_AND_DATA;
|
||||
REGNAME_COPYTABLE_INDEXES = 'CopyTable_Option_WithIndexes';
|
||||
REGNAME_COPYTABLE_ALLFIELDS = 'CopyTable_Option_WithAllFields';
|
||||
|
||||
REGPREFIX_COLWIDTHS = 'ColWidths_';
|
||||
REGPREFIX_COLSVISIBLE = 'ColsVisible_';
|
||||
|
@ -21,41 +21,41 @@ object CopyTableForm: TCopyTableForm
|
||||
PixelsPerInch = 96
|
||||
TextHeight = 13
|
||||
object lblNewTablename: TLabel
|
||||
Left = 16
|
||||
Top = 16
|
||||
Width = 105
|
||||
Left = 8
|
||||
Top = 8
|
||||
Width = 103
|
||||
Height = 13
|
||||
Caption = 'Copy .. to new Table:'
|
||||
Caption = 'Copy .. to new table:'
|
||||
end
|
||||
object lblTargetDB: TLabel
|
||||
Left = 16
|
||||
Top = 64
|
||||
Width = 85
|
||||
Left = 8
|
||||
Top = 56
|
||||
Width = 84
|
||||
Height = 13
|
||||
Caption = 'Target Database:'
|
||||
Caption = 'Target database:'
|
||||
end
|
||||
object editNewTablename: TTntEdit
|
||||
Left = 16
|
||||
Top = 32
|
||||
Width = 270
|
||||
Left = 8
|
||||
Top = 24
|
||||
Width = 286
|
||||
Height = 21
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
TabOrder = 0
|
||||
OnChange = editNewTablenameChange
|
||||
end
|
||||
object radioStructure: TRadioButton
|
||||
Left = 160
|
||||
Top = 117
|
||||
Width = 81
|
||||
Left = 154
|
||||
Top = 109
|
||||
Width = 140
|
||||
Height = 17
|
||||
Caption = 'Structure'
|
||||
TabOrder = 3
|
||||
OnClick = radioStructureClick
|
||||
end
|
||||
object radioStructureAndData: TRadioButton
|
||||
Left = 160
|
||||
Top = 141
|
||||
Width = 113
|
||||
Left = 154
|
||||
Top = 133
|
||||
Width = 140
|
||||
Height = 17
|
||||
Caption = 'Structure and Data'
|
||||
Checked = True
|
||||
@ -64,30 +64,30 @@ object CopyTableForm: TCopyTableForm
|
||||
OnClick = radioStructureAndDataClick
|
||||
end
|
||||
object CheckListBoxFields: TTntCheckListBox
|
||||
Left = 16
|
||||
Top = 165
|
||||
Width = 270
|
||||
Left = 8
|
||||
Top = 157
|
||||
Width = 286
|
||||
Height = 108
|
||||
OnClickCheck = CheckListBoxFieldsClickCheck
|
||||
Anchors = [akLeft, akTop, akBottom]
|
||||
Columns = 2
|
||||
Enabled = False
|
||||
ItemHeight = 13
|
||||
TabOrder = 2
|
||||
end
|
||||
object CheckBoxWithAllFields: TCheckBox
|
||||
Left = 16
|
||||
Top = 141
|
||||
Width = 97
|
||||
Left = 8
|
||||
Top = 133
|
||||
Width = 121
|
||||
Height = 17
|
||||
Caption = 'With all Columns'
|
||||
Caption = 'Include all columns'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 1
|
||||
OnClick = CheckBoxWithAllFieldsClick
|
||||
end
|
||||
object ButtonCancel: TButton
|
||||
Left = 203
|
||||
Top = 293
|
||||
Left = 211
|
||||
Top = 296
|
||||
Width = 83
|
||||
Height = 25
|
||||
Anchors = [akRight, akBottom]
|
||||
@ -97,19 +97,19 @@ object CopyTableForm: TCopyTableForm
|
||||
TabOrder = 5
|
||||
end
|
||||
object CheckBoxWithIndexes: TCheckBox
|
||||
Left = 16
|
||||
Top = 117
|
||||
Width = 97
|
||||
Left = 8
|
||||
Top = 109
|
||||
Width = 121
|
||||
Height = 17
|
||||
Caption = 'With Indexes'
|
||||
Caption = 'Include indexes'
|
||||
Checked = True
|
||||
State = cbChecked
|
||||
TabOrder = 6
|
||||
end
|
||||
object ComboSelectDatabase: TTntComboBox
|
||||
Left = 16
|
||||
Top = 83
|
||||
Width = 270
|
||||
Left = 8
|
||||
Top = 72
|
||||
Width = 286
|
||||
Height = 21
|
||||
Style = csDropDownList
|
||||
Anchors = [akLeft, akTop, akRight]
|
||||
@ -117,8 +117,8 @@ object CopyTableForm: TCopyTableForm
|
||||
TabOrder = 7
|
||||
end
|
||||
object ButtonOK: TButton
|
||||
Left = 114
|
||||
Top = 293
|
||||
Left = 122
|
||||
Top = 296
|
||||
Width = 83
|
||||
Height = 25
|
||||
Anchors = [akRight, akBottom]
|
||||
@ -128,4 +128,13 @@ object CopyTableForm: TCopyTableForm
|
||||
TabOrder = 8
|
||||
OnClick = ButtonOKClick
|
||||
end
|
||||
object chkSelectAll: TCheckBox
|
||||
Left = 8
|
||||
Top = 271
|
||||
Width = 286
|
||||
Height = 17
|
||||
Caption = 'Select / deselect all'
|
||||
TabOrder = 9
|
||||
OnClick = chkSelectAllClick
|
||||
end
|
||||
end
|
||||
|
@ -26,6 +26,7 @@ type
|
||||
lblTargetDB: TLabel;
|
||||
ComboSelectDatabase: TTntComboBox;
|
||||
ButtonOK: TButton;
|
||||
chkSelectAll: TCheckBox;
|
||||
procedure radioStructureClick(Sender: TObject);
|
||||
procedure radioStructureAndDataClick(Sender: TObject);
|
||||
procedure CheckBoxWithAllFieldsClick(Sender: TObject);
|
||||
@ -33,6 +34,8 @@ type
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure ButtonOKClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure CheckListBoxFieldsClickCheck(Sender: TObject);
|
||||
procedure chkSelectAllClick(Sender: TObject);
|
||||
private
|
||||
{ Private declarations }
|
||||
oldTableName : WideString;
|
||||
@ -42,13 +45,6 @@ type
|
||||
|
||||
function CopyTableWindow(AOwner: TComponent): Boolean;
|
||||
|
||||
const
|
||||
OPTION_UNDEFINED = 255;
|
||||
OPTION_STRUCTURE = 0;
|
||||
OPTION_STRUCTURE_AND_DATA = 1;
|
||||
OPTION_REGNAME_STRUC_DATA = 'CopyTable_Option_StructureData';
|
||||
OPTION_REGNAME_WITH_INDEXES = 'CopyTable_Option_WithIndexes';
|
||||
OPTION_REGNAME_WITH_ALL_FIELDS = 'CopyTable_Option_WithAllFields';
|
||||
|
||||
implementation
|
||||
|
||||
@ -84,6 +80,7 @@ end;
|
||||
procedure TCopyTableForm.CheckBoxWithAllFieldsClick(Sender: TObject);
|
||||
begin
|
||||
CheckListBoxFields.Enabled := not CheckBoxWithAllFields.Checked;
|
||||
chkSelectAll.Enabled := CheckListBoxFields.Enabled;
|
||||
end;
|
||||
|
||||
|
||||
@ -121,7 +118,7 @@ begin
|
||||
oldTableName := NodeData.Captions[0];
|
||||
editNewTablename.Text := oldTableName + '_copy';
|
||||
editNewTablename.SetFocus;
|
||||
lblNewTablename.Caption := 'Copy ''' + oldTableName + ''' to new Table:';
|
||||
lblNewTablename.Caption := 'Copy ''' + oldTableName + ''' to new table:';
|
||||
|
||||
// Select TargetDatabase
|
||||
ComboSelectDatabase.Items.Clear;
|
||||
@ -149,16 +146,19 @@ begin
|
||||
restore last settings
|
||||
@see feature #1647058
|
||||
}
|
||||
struc_data := mainform.GetRegValue( OPTION_REGNAME_STRUC_DATA, OPTION_STRUCTURE_AND_DATA );
|
||||
struc_data := mainform.GetRegValue( REGNAME_COPYTABLE_STRUCDATA, DEFAULT_COPYTABLE_STRUCDATA );
|
||||
case struc_data of
|
||||
OPTION_STRUCTURE:
|
||||
REGVAL_COPYTABLE_STRUCTURE:
|
||||
radioStructure.Checked := true;
|
||||
OPTION_STRUCTURE_AND_DATA:
|
||||
REGVAL_COPYTABLE_STRUCTURE_AND_DATA:
|
||||
radioStructureAndData.Checked := true;
|
||||
end;
|
||||
CheckBoxWithIndexes.Checked := mainform.GetRegValue( OPTION_REGNAME_WITH_INDEXES, CheckBoxWithIndexes.Checked );
|
||||
CheckBoxWithAllFields.Checked := mainform.GetRegValue( OPTION_REGNAME_WITH_ALL_FIELDS, CheckBoxWithAllFields.Checked );
|
||||
|
||||
CheckBoxWithIndexes.Checked := mainform.GetRegValue( REGNAME_COPYTABLE_INDEXES, CheckBoxWithIndexes.Checked );
|
||||
CheckBoxWithAllFields.Checked := mainform.GetRegValue( REGNAME_COPYTABLE_ALLFIELDS, CheckBoxWithAllFields.Checked );
|
||||
// Ensure CheckListBoxFields + chkSelectAll are en/disabled
|
||||
CheckBoxWithAllFieldsClick(Sender);
|
||||
// Ensure chkSelectAll shows its correct state
|
||||
CheckListBoxFieldsClickCheck(Sender);
|
||||
end;
|
||||
|
||||
|
||||
@ -177,15 +177,14 @@ begin
|
||||
// copy table!
|
||||
|
||||
// store settings
|
||||
struc_data := OPTION_UNDEFINED;
|
||||
if radioStructure.Checked then struc_data := OPTION_STRUCTURE;
|
||||
if radioStructureAndData.Checked then struc_data := OPTION_STRUCTURE_AND_DATA;
|
||||
if radioStructure.Checked then struc_data := REGVAL_COPYTABLE_STRUCTURE
|
||||
else struc_data := REGVAL_COPYTABLE_STRUCTURE_AND_DATA;
|
||||
|
||||
reg := TRegistry.Create;
|
||||
if reg.OpenKey(REGPATH, False) then begin
|
||||
reg.WriteInteger( OPTION_REGNAME_STRUC_DATA, struc_data );
|
||||
reg.WriteBool( OPTION_REGNAME_WITH_INDEXES, CheckBoxWithIndexes.Checked );
|
||||
reg.WriteBool( OPTION_REGNAME_WITH_ALL_FIELDS, CheckBoxWithAllFields.Checked );
|
||||
reg.WriteInteger( REGNAME_COPYTABLE_STRUCDATA, struc_data );
|
||||
reg.WriteBool( REGNAME_COPYTABLE_INDEXES, CheckBoxWithIndexes.Checked );
|
||||
reg.WriteBool( REGNAME_COPYTABLE_ALLFIELDS, CheckBoxWithAllFields.Checked );
|
||||
reg.CloseKey;
|
||||
end;
|
||||
reg.Free;
|
||||
@ -300,4 +299,33 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
procedure TCopyTableForm.CheckListBoxFieldsClickCheck(Sender: TObject);
|
||||
var
|
||||
i : Integer;
|
||||
allSelected, noneSelected : Boolean;
|
||||
begin
|
||||
allselected := True;
|
||||
noneSelected := True;
|
||||
for i := 0 to CheckListBoxFields.Items.Count - 1 do begin
|
||||
if CheckListBoxFields.Checked[i] then
|
||||
noneSelected := False
|
||||
else
|
||||
allSelected := False;
|
||||
end;
|
||||
if noneSelected then
|
||||
chkSelectAll.State := cbUnchecked
|
||||
else if allSelected then
|
||||
chkSelectAll.State := cbChecked
|
||||
else
|
||||
chkSelectAll.State := cbGrayed;
|
||||
end;
|
||||
|
||||
|
||||
procedure TCopyTableForm.chkSelectAllClick(Sender: TObject);
|
||||
begin
|
||||
// Avoid executing when checkbox was toggled by code (see proc below)
|
||||
if (Sender as TCheckBox).Focused then
|
||||
ToggleCheckListBox( CheckListBoxFields, (Sender as TCheckBox).Checked );
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user