mirror of
https://github.com/HeidiSQL/HeidiSQL.git
synced 2026-03-13 09:24:25 +08:00
Implement a parent class for all database object editors (table, view, routine, trigger) and let these editors derive from this class. Could simplify code in the future.
This commit is contained in:
@@ -9,7 +9,7 @@ uses
|
||||
Contnrs, grideditlinks, mysql_structures, mysql_connection, helpers;
|
||||
|
||||
type
|
||||
TfrmTableEditor = class(TFrame)
|
||||
TfrmTableEditor = class(TDBObjectEditor)
|
||||
btnSave: TButton;
|
||||
btnDiscard: TButton;
|
||||
btnHelp: TButton;
|
||||
@@ -168,7 +168,6 @@ type
|
||||
procedure listColumnsNodeMoved(Sender: TBaseVirtualTree; Node: PVirtualNode);
|
||||
private
|
||||
{ Private declarations }
|
||||
FModified: Boolean;
|
||||
FLoaded: Boolean;
|
||||
FAlterTableName: WideString;
|
||||
CreateCodeValid, AlterCodeValid: Boolean;
|
||||
@@ -177,13 +176,11 @@ type
|
||||
procedure ValidateColumnControls;
|
||||
procedure ValidateIndexControls;
|
||||
procedure MoveFocusedIndexPart(NewIdx: Cardinal);
|
||||
procedure SetModified(Value: Boolean);
|
||||
procedure ResetModificationFlags;
|
||||
function ComposeCreateStatement: WideString;
|
||||
function ComposeAlterStatement: WideString;
|
||||
function GetIndexSQL(idx: Integer): WideString;
|
||||
function GetForeignKeySQL(idx: Integer): WideString;
|
||||
property Modified: Boolean read FModified write SetModified;
|
||||
procedure UpdateSQLcode;
|
||||
function CellEditingAllowed(Node: PVirtualNode; Column: TColumnIndex): Boolean;
|
||||
function GetIndexIcon(idx: Integer): Integer;
|
||||
@@ -446,6 +443,8 @@ begin
|
||||
ForeignKey.Modified := False;
|
||||
end;
|
||||
Modified := False;
|
||||
btnSave.Enabled := Modified;
|
||||
btnDiscard.Enabled := Modified;
|
||||
end;
|
||||
|
||||
|
||||
@@ -757,6 +756,11 @@ begin
|
||||
if Sender is TComponent then
|
||||
TComponent(Sender).Tag := ModifiedFlag;
|
||||
Modified := True;
|
||||
btnSave.Enabled := Modified;
|
||||
btnDiscard.Enabled := Modified;
|
||||
CreateCodeValid := False;
|
||||
AlterCodeValid := False;
|
||||
UpdateSQLcode;
|
||||
end;
|
||||
end;
|
||||
|
||||
@@ -1215,18 +1219,6 @@ begin
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmTableEditor.SetModified(Value: Boolean);
|
||||
begin
|
||||
// Some value has changed
|
||||
FModified := Value;
|
||||
btnSave.Enabled := FModified;
|
||||
btnDiscard.Enabled := FModified;
|
||||
CreateCodeValid := False;
|
||||
AlterCodeValid := False;
|
||||
UpdateSQLcode;
|
||||
end;
|
||||
|
||||
|
||||
procedure TfrmTableEditor.editNumEditChange(Sender: TObject);
|
||||
var
|
||||
ed: TEdit;
|
||||
|
||||
Reference in New Issue
Block a user