Bläddra i källkod

Cosmetic: shorten up main treeview selection code

Reinier Olislagers 11 år sedan
förälder
incheckning
5da7be2ec7
7 ändrade filer med 173 tillägg och 184 borttagningar
  1. 52 64
      main.pas
  2. 6 6
      newtable.lfm
  3. 56 56
      newtable.lrs
  4. 16 16
      newtable.pas
  5. 22 22
      reg.lfm
  6. 21 19
      reg.lrs
  7. 0 1
      reg.pas

+ 52 - 64
main.pas

@@ -3796,72 +3796,60 @@ var
 begin
   Node:= tvMain.Selected;
   if node <> nil then
-  if Node.Level = 1 then // Database level, Fill objects
   begin
-    // Do nothing
-  end
-  else
-  if Node.Level = 2 then // Objects Type Level
-  begin
-    if tvMain.Selected.Text = 'Query Window' then
-    begin
-      QWindow:= ShowQueryWindow(tvMain.Selected.Parent.OverlayIndex, 'Query Window');
-      QWindow.Show;
-    end
-    else  // Expand object
-    begin
-      tvMainExpanded(nil, Node);
-      Rec:= RegisteredDatabases[Node.Parent.OverlayIndex].RegRec;
-    end;
-  end
-  else
-  if Node.Level = 3 then  // Object Item Level, like some tables, procedures.
-  begin
-    ParentText:= Node.Parent.Text;
-    if Pos('(', ParentText) > 0 then
-    ParentText:= Trim(Copy(ParentText, 1, Pos('(', ParentText) - 1));
-
-    if ParentText = 'Tables' then
-    begin
-      lmViewFieldsClick(nil);
-      lmViewFirst1000Click(nil);
-    end
-    else
-    if ParentText = 'Generators' then
-      lmViewGenClick(nil)
-    else
-    if ParentText = 'Triggers' then
-      lmViewTriggerClick(nil)
-    else
-    if ParentText = 'Views' then
-      lmDisplay1000VClick(nil)
-    else
-    if ParentText = 'Stored Procedures' then
-      lmViewStoredProcedureClick(nil)
-    else
-    if ParentText = 'Functions' then
-      lmViewUDFClick(nil)
-    else
-    if ParentText = 'System Tables' then
-      lmOpenSystemTableClick(nil)
-    else
-    if ParentText = 'Domains' then
-      lmViewDomainClick(nil)
-    else
-    if ParentText = 'Roles' then
-      lmPermissionsClick(nil)
-    else
-    if ParentText = 'Exceptions' then
-      lmScriptExceptionClick(nil)
-    else
-    if ParentText = 'Users' then
-      lmPermissionsClick(nil)
-
-  end
-  else
-  if Node.Level = 4 then // Table fields (Edit)
-    lmEditFieldClick(nil);
+    case Node.Level of
+      1: // Database level: fill objects;
+      begin
+        // do nothing
+      end;
+      2: // Objects Type Level
+      begin
+        if tvMain.Selected.Text = 'Query Window' then
+        begin
+          QWindow:= ShowQueryWindow(tvMain.Selected.Parent.OverlayIndex, 'Query Window');
+          QWindow.Show;
+        end
+        else  // Expand object
+        begin
+          tvMainExpanded(nil, Node);
+          Rec:= RegisteredDatabases[Node.Parent.OverlayIndex].RegRec;
+        end;
+      end;
+      3: // Object Item Level, like some tables, procedures.
+      begin
+        ParentText:= Node.Parent.Text;
+        if Pos('(', ParentText) > 0 then
+          ParentText:= Trim(Copy(ParentText, 1, Pos('(', ParentText) - 1));
 
+        case ParentText of
+          'Tables':
+          begin
+            lmViewFieldsClick(nil);
+            lmViewFirst1000Click(nil);
+          end;
+          'Generators': lmViewGenClick(nil);
+          'Triggers': lmViewTriggerClick(nil);
+          'Views': lmDisplay1000VClick(nil);
+          'Stored Procedures': lmViewStoredProcedureClick(nil);
+          'Functions': lmViewUDFClick(nil);
+          'System Tables': lmOpenSystemTableClick(nil);
+          'Domains': lmViewDomainClick(nil);
+          'Roles': lmPermissionsClick(nil);
+          'Exceptions': lmScriptExceptionClick(nil);
+          'Users': lmPermissionsClick(nil);
+          else ShowMessage('Error in TurboBird code tVMainDblClick level 3. Please correct.');
+        end;
+      end;
+      4: // Table fields (Edit)
+      begin
+        lmEditFieldClick(nil);
+      end;
+      else
+      begin
+        // do nothing; ignore
+      end;
+    end;
+  end;
 end;
 
 (**************    Expanded     *****************)

+ 6 - 6
newtable.lfm

@@ -1,7 +1,7 @@
 object fmNewTable: TfmNewTable
-  Left = 535
+  Left = 347
   Height = 618
-  Top = 192
+  Top = 86
   Width = 594
   ActiveControl = edNewTable
   Caption = 'New Table'
@@ -11,7 +11,7 @@ object fmNewTable: TfmNewTable
   OnClose = FormClose
   OnKeyDown = FormKeyDown
   Position = poScreenCenter
-  LCLVersion = '1.2.0.3'
+  LCLVersion = '1.2.2.0'
   object Label1: TLabel
     Left = 18
     Height = 13
@@ -66,7 +66,7 @@ object fmNewTable: TfmNewTable
       end>
     FixedColor = 14539471
     FixedCols = 0
-    Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAlwaysShowEditor, goSmoothScroll]
+    Options = [goFixedVertLine, goFixedHorzLine, goVertLine, goHorzLine, goRangeSelect, goEditing, goAutoAddRows, goAlwaysShowEditor, goSmoothScroll]
     RowCount = 3
     TabOrder = 1
     OnEditingDone = StringGrid1PickListSelect
@@ -74,7 +74,7 @@ object fmNewTable: TfmNewTable
     OnMouseUp = StringGrid1MouseUp
     OnPickListSelect = StringGrid1PickListSelect
   end
-  object BitBtn2: TBitBtn
+  object bbCancel: TBitBtn
     Left = 448
     Height = 46
     Top = 560
@@ -85,7 +85,7 @@ object fmNewTable: TfmNewTable
     Color = 16249563
     Kind = bkCancel
     ModalResult = 2
-    OnClick = BitBtn2Click
+    OnClick = bbCancelClick
     TabOrder = 2
   end
   object bbScript: TBitBtn

+ 56 - 56
newtable.lrs

@@ -1,62 +1,62 @@
 { This is an automatically generated lazarus resource file }
 
 LazarusResources.Add('TfmNewTable','FORMDATA',[
-  'TPF0'#11'TfmNewTable'#10'fmNewTable'#4'Left'#3#23#2#6'Height'#3'j'#2#3'Top'#3
-  +#192#0#5'Width'#3'R'#2#13'ActiveControl'#7#10'edNewTable'#7'Caption'#6#9'New'
-  +' Table'#12'ClientHeight'#3'j'#2#11'ClientWidth'#3'R'#2#10'KeyPreview'#9#7'O'
-  +'nClose'#7#9'FormClose'#9'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#14'poSc'
-  +'reenCenter'#10'LCLVersion'#6#7'1.2.0.3'#0#6'TLabel'#6'Label1'#4'Left'#2#18#6
-  +'Height'#2#13#3'Top'#2#9#5'Width'#2'O'#7'Caption'#6#14'New Table name'#11'Fo'
-  +'nt.Height'#2#245#11'ParentColor'#8#10'ParentFont'#8#0#0#5'TEdit'#10'edNewTa'
-  +'ble'#4'Left'#2#18#6'Height'#2#21#3'Top'#2#28#5'Width'#3#206#0#7'OnKeyUp'#7
-  +#15'edNewTableKeyUp'#8'TabOrder'#2#0#0#0#11'TStringGrid'#11'StringGrid1'#4'L'
-  +'eft'#2#18#6'Height'#3#163#1#3'Top'#2'B'#5'Width'#3'='#2#7'Anchors'#11#5'akT'
-  +'op'#6'akLeft'#7'akRight'#8'akBottom'#0#8'ColCount'#2#6#7'Columns'#14#1#13'T'
-  +'itle.Caption'#6#10'Field Name'#5'Width'#2'd'#0#1#13'Title.Caption'#6#9'Data'
-  +' Type'#5'Width'#2'x'#0#1#13'Title.Caption'#6#4'Size'#0#1#11'ButtonStyle'#7
-  +#17'cbsCheckboxColumn'#13'Title.Caption'#6#10'Allow Null'#5'Width'#2'Z'#0#1
-  +#11'ButtonStyle'#7#17'cbsCheckboxColumn'#13'Title.Caption'#6#5'P-Key'#11'Tit'
-  +'le.Color'#4#219#216#174#0#16'Title.Font.Color'#4#12#8#253#0#0#1#13'Title.Ca'
-  +'ption'#6#13'Default Value'#5'Width'#2'x'#0#0#10'FixedColor'#4#207#218#221#0
-  +#9'FixedCols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'g'
-  +'oVertLine'#10'goHorzLine'#13'goRangeSelect'#9'goEditing'#18'goAlwaysShowEdi'
-  +'tor'#14'goSmoothScroll'#0#8'RowCount'#2#3#8'TabOrder'#2#1#13'OnEditingDone'
-  +#7#25'StringGrid1PickListSelect'#7'OnKeyUp'#7#16'StringGrid1KeyUp'#9'OnMouse'
-  +'Up'#7#18'StringGrid1MouseUp'#16'OnPickListSelect'#7#25'StringGrid1PickListS'
-  +'elect'#0#0#7'TBitBtn'#7'BitBtn2'#4'Left'#3#192#1#6'Height'#2'.'#3'Top'#3'0'
-  +#2#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#6'Cancel'#9#7'Caption'
-  +#6#6'Cancel'#5'Color'#4#219#242#247#0#4'Kind'#7#8'bkCancel'#11'ModalResult'#2
-  +#2#7'OnClick'#7#12'BitBtn2Click'#8'TabOrder'#2#2#0#0#7'TBitBtn'#8'bbScript'#4
-  +'Left'#2#18#6'Height'#2'.'#3'Top'#3'0'#2#5'Width'#2'v'#7'Anchors'#11#6'akLef'
-  +'t'#8'akBottom'#0#7'Caption'#6#6'Script'#5'Color'#4#219#242#247#0#4'Kind'#7#5
-  +'bkYes'#7'OnClick'#7#13'bbScriptClick'#8'TabOrder'#2#3#0#0#9'TCheckBox'#11'c'
-  +'xCreateGen'#4'Left'#2#18#6'Height'#2#17#3'Top'#3#247#1#5'Width'#3#239#0#7'A'
-  +'nchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6'+Create Auto increment Gene'
-  +'rator and Trigger'#8'TabOrder'#2#4#0#0#7'TBitBtn'#7'bbClose'#4'Left'#3'0'#2
-  +#6'Height'#2#24#3'Top'#2#0#5'Width'#2#27#7'Anchors'#11#5'akTop'#7'akRight'#0
-  +#7'Caption'#6#4' X  '#5'Color'#4#219#242#247#0#10'Font.Style'#11#6'fsBold'#0
-  +#7'OnClick'#7#12'bbCloseClick'#10'ParentFont'#8#8'TabOrder'#2#5#0#0#9'TCheck'
-  +'Box'#17'cxGrantPermission'#4'Left'#2#16#6'Height'#2#17#3'Top'#3#24#2#5'Widt'
-  +'h'#2'/'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#5'Grant'#8'OnCha'
-  +'nge'#7#23'cxGrantPermissionChange'#8'TabOrder'#2#6#0#0#9'TComboBox'#12'cbPe'
-  +'rmission'#4'Left'#2'`'#6'Height'#2#21#3'Top'#3#20#2#5'Width'#3#145#0#7'Anch'
-  +'ors'#11#6'akLeft'#8'akBottom'#0#7'Enabled'#8#10'ItemHeight'#2#13#9'ItemInde'
-  +'x'#2#0#13'Items.Strings'#1#6#4'Full'#6#7'Modify '#6#4'Read'#0#5'Style'#7#14
-  +'csDropDownList'#8'TabOrder'#2#7#4'Text'#6#4'Full'#0#0#6'TLabel'#12'laPermis'
-  +'sion'#4'Left'#3#0#1#6'Height'#2#13#3'Top'#3#24#2#5'Width'#2'?'#7'Anchors'#11
-  +#6'akLeft'#8'akBottom'#0#7'Caption'#6#13'Permission to'#11'ParentColor'#8#7
-  +'Visible'#8#0#0#9'TComboBox'#12'cbRolesUsers'#4'Left'#3'i'#1#6'Height'#2#21#3
-  +'Top'#3#20#2#5'Width'#3#181#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#10'ItemH'
-  +'eight'#2#13#13'Items.Strings'#1#6#4'Full'#6#5'Read '#6#6'Insert'#0#8'TabOrd'
-  +'er'#2#8#7'Visible'#8#0#0#6'TImage'#6'Image1'#4'Left'#3#192#1#6'Height'#2'?'
-  +#3'Top'#2#0#5'Width'#2'P'#12'Picture.Data'#10#189#10#0#0#23'TPortableNetwork'
-  +'Graphic'#161#10#0#0#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0'@'#0#0#0'@'#8
-  +#6#0#0#0#170'iq'#222#0#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0#13
-  +#215#0#0#13#215#1'B('#155'x'#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'#155
-  +#238'<'#26#0#0#10#30'IDATx'#156#237'[MhU'#219#21#254#214#249#203#185#215#188
-  +#220'h~j'#213#151#196#24'#'#25'X'#131'>H0'#133'V(t'#148'I;'#234'@'#177'"tP'
-  +#138#208'A'#139'#'#133'"'#165#208#161#224#228'U|8'#16#4#235'@'#20#138#130'P^'
-  +'G'#26#127'jP'#136'6'#228'E^$'#168'Qs'#239'M'#206#239'^'#29#220#187#239#219
+  'TPF0'#11'TfmNewTable'#10'fmNewTable'#4'Left'#3'['#1#6'Height'#3'j'#2#3'Top'#2
+  +'V'#5'Width'#3'R'#2#13'ActiveControl'#7#10'edNewTable'#7'Caption'#6#9'New Ta'
+  +'ble'#12'ClientHeight'#3'j'#2#11'ClientWidth'#3'R'#2#10'KeyPreview'#9#7'OnCl'
+  +'ose'#7#9'FormClose'#9'OnKeyDown'#7#11'FormKeyDown'#8'Position'#7#14'poScree'
+  +'nCenter'#10'LCLVersion'#6#7'1.2.2.0'#0#6'TLabel'#6'Label1'#4'Left'#2#18#6'H'
+  +'eight'#2#13#3'Top'#2#9#5'Width'#2'O'#7'Caption'#6#14'New Table name'#11'Fon'
+  +'t.Height'#2#245#11'ParentColor'#8#10'ParentFont'#8#0#0#5'TEdit'#10'edNewTab'
+  +'le'#4'Left'#2#18#6'Height'#2#21#3'Top'#2#28#5'Width'#3#206#0#7'OnKeyUp'#7#15
+  +'edNewTableKeyUp'#8'TabOrder'#2#0#0#0#11'TStringGrid'#11'StringGrid1'#4'Left'
+  +#2#18#6'Height'#3#163#1#3'Top'#2'B'#5'Width'#3'='#2#7'Anchors'#11#5'akTop'#6
+  +'akLeft'#7'akRight'#8'akBottom'#0#8'ColCount'#2#6#7'Columns'#14#1#13'Title.C'
+  +'aption'#6#10'Field Name'#5'Width'#2'd'#0#1#13'Title.Caption'#6#9'Data Type'
+  +#5'Width'#2'x'#0#1#13'Title.Caption'#6#4'Size'#0#1#11'ButtonStyle'#7#17'cbsC'
+  +'heckboxColumn'#13'Title.Caption'#6#10'Allow Null'#5'Width'#2'Z'#0#1#11'Butt'
+  +'onStyle'#7#17'cbsCheckboxColumn'#13'Title.Caption'#6#5'P-Key'#11'Title.Colo'
+  +'r'#4#219#216#174#0#16'Title.Font.Color'#4#12#8#253#0#0#1#13'Title.Caption'#6
+  +#13'Default Value'#5'Width'#2'x'#0#0#10'FixedColor'#4#207#218#221#0#9'FixedC'
+  +'ols'#2#0#7'Options'#11#15'goFixedVertLine'#15'goFixedHorzLine'#10'goVertLin'
+  +'e'#10'goHorzLine'#13'goRangeSelect'#9'goEditing'#13'goAutoAddRows'#18'goAlw'
+  +'aysShowEditor'#14'goSmoothScroll'#0#8'RowCount'#2#3#8'TabOrder'#2#1#13'OnEd'
+  +'itingDone'#7#25'StringGrid1PickListSelect'#7'OnKeyUp'#7#16'StringGrid1KeyUp'
+  +#9'OnMouseUp'#7#18'StringGrid1MouseUp'#16'OnPickListSelect'#7#25'StringGrid1'
+  +'PickListSelect'#0#0#7'TBitBtn'#8'bbCancel'#4'Left'#3#192#1#6'Height'#2'.'#3
+  +'Top'#3'0'#2#5'Width'#2'`'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#6'Cancel'#9
+  +#7'Caption'#6#6'Cancel'#5'Color'#4#219#242#247#0#4'Kind'#7#8'bkCancel'#11'Mo'
+  +'dalResult'#2#2#7'OnClick'#7#13'bbCancelClick'#8'TabOrder'#2#2#0#0#7'TBitBtn'
+  +#8'bbScript'#4'Left'#2#18#6'Height'#2'.'#3'Top'#3'0'#2#5'Width'#2'v'#7'Ancho'
+  +'rs'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#6'Script'#5'Color'#4#219#242#247
+  +#0#4'Kind'#7#5'bkYes'#7'OnClick'#7#13'bbScriptClick'#8'TabOrder'#2#3#0#0#9'T'
+  +'CheckBox'#11'cxCreateGen'#4'Left'#2#18#6'Height'#2#17#3'Top'#3#247#1#5'Widt'
+  +'h'#3#239#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6'+Create Auto '
+  +'increment Generator and Trigger'#8'TabOrder'#2#4#0#0#7'TBitBtn'#7'bbClose'#4
+  +'Left'#3'0'#2#6'Height'#2#24#3'Top'#2#0#5'Width'#2#27#7'Anchors'#11#5'akTop'
+  +#7'akRight'#0#7'Caption'#6#4' X  '#5'Color'#4#219#242#247#0#10'Font.Style'#11
+  +#6'fsBold'#0#7'OnClick'#7#12'bbCloseClick'#10'ParentFont'#8#8'TabOrder'#2#5#0
+  +#0#9'TCheckBox'#17'cxGrantPermission'#4'Left'#2#16#6'Height'#2#17#3'Top'#3#24
+  +#2#5'Width'#2'/'#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#5'Grant'
+  +#8'OnChange'#7#23'cxGrantPermissionChange'#8'TabOrder'#2#6#0#0#9'TComboBox'
+  +#12'cbPermission'#4'Left'#2'`'#6'Height'#2#21#3'Top'#3#20#2#5'Width'#3#145#0
+  +#7'Anchors'#11#6'akLeft'#8'akBottom'#0#7'Enabled'#8#10'ItemHeight'#2#13#9'It'
+  +'emIndex'#2#0#13'Items.Strings'#1#6#4'Full'#6#7'Modify '#6#4'Read'#0#5'Style'
+  +#7#14'csDropDownList'#8'TabOrder'#2#7#4'Text'#6#4'Full'#0#0#6'TLabel'#12'laP'
+  +'ermission'#4'Left'#3#0#1#6'Height'#2#13#3'Top'#3#24#2#5'Width'#2'?'#7'Ancho'
+  +'rs'#11#6'akLeft'#8'akBottom'#0#7'Caption'#6#13'Permission to'#11'ParentColo'
+  +'r'#8#7'Visible'#8#0#0#9'TComboBox'#12'cbRolesUsers'#4'Left'#3'i'#1#6'Height'
+  +#2#21#3'Top'#3#20#2#5'Width'#3#181#0#7'Anchors'#11#6'akLeft'#8'akBottom'#0#10
+  +'ItemHeight'#2#13#13'Items.Strings'#1#6#4'Full'#6#5'Read '#6#6'Insert'#0#8'T'
+  +'abOrder'#2#8#7'Visible'#8#0#0#6'TImage'#6'Image1'#4'Left'#3#192#1#6'Height'
+  +#2'?'#3'Top'#2#0#5'Width'#2'P'#12'Picture.Data'#10#189#10#0#0#23'TPortableNe'
+  +'tworkGraphic'#161#10#0#0#137'PNG'#13#10#26#10#0#0#0#13'IHDR'#0#0#0'@'#0#0#0
+  +'@'#8#6#0#0#0#170'iq'#222#0#0#0#4'sBIT'#8#8#8#8'|'#8'd'#136#0#0#0#9'pHYs'#0#0
+  +#13#215#0#0#13#215#1'B('#155'x'#0#0#0#25'tEXtSoftware'#0'www.inkscape.org'
+  +#155#238'<'#26#0#0#10#30'IDATx'#156#237'[MhU'#219#21#254#214#249#203#185#215
+  +#188#220'h~j'#213#151#196#24'#'#25'X'#131'>H0'#133'V(t'#148'I;'#234'@'#177'"'
+  +'tP'#138#208'A'#139'#'#133'"'#165#208#161#224#228'U|8'#16#4#235'@'#20#138#130
+  +'P^G'#26#127'jP'#136'6'#228'E^$'#168'Qs'#239'M'#206#239'^'#29#220#187#239#219
   +#247#228#220#159'sn'#174'B_'#23'l'#206#222#235#236#179#207'^'#223'^{'#237#181
   +#255#136#153#241'}&'#237'SW'#224'S'#211#255#1#248#212#21#248#212'd'#180#242
   +'1'#17#17#0'Z\\'#28#176','#235#11'f'#142#5'4'#12#195#186'i'#0#240'}'#127'qdd'

+ 16 - 16
newtable.pas

@@ -16,7 +16,7 @@ type
   TfmNewTable = class(TForm)
     bbClose: TBitBtn;
     bbScript: TBitBtn;
-    BitBtn2: TBitBtn;
+    bbCancel: TBitBtn;
     cbPermission: TComboBox;
     cbRolesUsers: TComboBox;
     cxGrantPermission: TCheckBox;
@@ -28,7 +28,7 @@ type
     StringGrid1: TStringGrid;
     procedure bbCloseClick(Sender: TObject);
     procedure bbScriptClick(Sender: TObject);
-    procedure BitBtn2Click(Sender: TObject);
+    procedure bbCancelClick(Sender: TObject);
     procedure cxGrantPermissionChange(Sender: TObject);
     procedure edNewTableKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState);
     procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
@@ -215,10 +215,8 @@ begin
         Result:= False;
         MessageDlg('Warning', 'There is no primary key', mtWarning, [mbOk], 0);
       end;
-
     end;
   end;
-
 end;
 
 function TfmNewTable.GetFieldsCount: Integer;
@@ -227,10 +225,13 @@ var
 begin
   Result:= 0;
   with StringGrid1 do
-  for i:= 1 to RowCount - 1 do
-  if Trim(Cells[0, i]) <> '' then
-    Inc(Result);
-
+  begin
+    for i:= 1 to RowCount - 1 do
+    begin
+      if Trim(Cells[0, i]) <> '' then
+        Inc(Result);
+    end;
+  end;
 end;
 
 function TfmNewTable.GetClosestType(ATypePart: string): string;
@@ -262,7 +263,6 @@ begin
         Break;
       end;
     end;
-
   end;
 end;
 
@@ -280,6 +280,7 @@ begin
       List.Text:= GenerateCreateSQL(KeyField, GeneratorName);
       if cxCreateGen.Checked then
       begin;
+        //todo: move this to a utility function somewhere
         List.Add('');
         List.Add('-- Generator');
         List.Add('create generator ' + GeneratorName + ';');
@@ -301,7 +302,7 @@ begin
   end;
 end;
 
-procedure TfmNewTable.BitBtn2Click(Sender: TObject);
+procedure TfmNewTable.bbCancelClick(Sender: TObject);
 begin
   bbCloseClick(nil);
 end;
@@ -311,13 +312,12 @@ begin
   cbPermission.Enabled:= cxGrantPermission.Checked;
   laPermission.Visible:= cxGrantPermission.Checked;
   cbRolesUsers.Visible:= cxGrantPermission.Checked;
-
 end;
 
 procedure TfmNewTable.edNewTableKeyUp(Sender: TObject; var Key: Word;
   Shift: TShiftState);
 begin
-  if key = 13 then
+  if key = VK_RETURN then
     StringGrid1.SetFocus;
 end;
 
@@ -354,7 +354,7 @@ var
   aType: string;
 begin
   with StringGrid1 do
-  if Key = 40 then // Key down
+  if Key = VK_DOWN then // Cursor down
   if Trim(Cells[0, RowCount - 1]) <> '' then
   begin
     RowCount:= RowCount + 1;
@@ -363,18 +363,18 @@ begin
     Cells[4, Row]:= '0';
   end
   else
-  if Key = 45 then // Insert
+  if Key = VK_INSERT then // Insert
   begin
     InsertColRow(False, Row);
   end
   else
-  if Key = 46 then // Delete
+  if Key = VK_DELETE then // Delete
   begin
     if RowCount > 1 then
       DeleteColRow(False, Row);
   end
   else
-  if key = 13 then // Enter
+  if key = VK_RETURN then // Enter
   begin
     if (Row + 1 = RowCount) and (Col > 1) then
     begin

+ 22 - 22
reg.lfm

@@ -9,58 +9,58 @@ object fmReg: TfmReg
   ClientWidth = 592
   Color = clWhite
   Position = poScreenCenter
-  LCLVersion = '1.0.4.0'
+  LCLVersion = '1.2.2.0'
   object Label1: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 70
-    Width = 110
+    Width = 80
     Caption = 'server:database'
     ParentColor = False
   end
   object Label2: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 117
-    Width = 72
+    Width = 51
     Caption = 'User name'
     ParentColor = False
   end
   object Label3: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 165
-    Width = 67
+    Width = 46
     Caption = 'Password'
     ParentColor = False
   end
   object Label4: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 19
-    Width = 31
+    Width = 20
     Caption = 'Title'
     ParentColor = False
   end
   object Label5: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 211
-    Width = 53
+    Width = 38
     Caption = 'Charset'
     ParentColor = False
   end
   object Label6: TLabel
     Left = 13
-    Height = 18
+    Height = 13
     Top = 248
-    Width = 31
+    Width = 21
     Caption = 'Role'
     ParentColor = False
   end
   object edDatabaseName: TEdit
     Left = 126
-    Height = 27
+    Height = 21
     Top = 64
     Width = 289
     TabOrder = 1
@@ -76,14 +76,14 @@ object fmReg: TfmReg
   end
   object edUserName: TEdit
     Left = 126
-    Height = 27
+    Height = 21
     Top = 110
     Width = 145
     TabOrder = 3
   end
   object edPassword: TEdit
     Left = 126
-    Height = 27
+    Height = 21
     Top = 156
     Width = 145
     EchoMode = emPassword
@@ -190,7 +190,7 @@ object fmReg: TfmReg
   end
   object edTitle: TEdit
     Left = 127
-    Height = 27
+    Height = 21
     Top = 16
     Width = 289
     TabOrder = 0
@@ -208,25 +208,25 @@ object fmReg: TfmReg
   end
   object cxSavePassword: TCheckBox
     Left = 279
-    Height = 24
+    Height = 17
     Top = 160
-    Width = 126
+    Width = 93
     Caption = 'Save Password'
     TabOrder = 5
   end
   object edRole: TEdit
     Left = 127
-    Height = 27
+    Height = 21
     Top = 248
     Width = 144
     TabOrder = 7
   end
   object cbCharset: TComboBox
     Left = 127
-    Height = 29
+    Height = 21
     Top = 200
     Width = 140
-    ItemHeight = 0
+    ItemHeight = 13
     ItemIndex = 0
     Items.Strings = (
       'NONE'

+ 21 - 19
reg.lrs

@@ -1,23 +1,25 @@
+{ This is an automatically generated lazarus resource file }
+
 LazarusResources.Add('TfmReg','FORMDATA',[
   'TPF0'#6'TfmReg'#5'fmReg'#4'Left'#3#151#1#6'Height'#3'\'#1#3'Top'#3#201#0#5'W'
   +'idth'#3'P'#2#13'ActiveControl'#7#7'edTitle'#7'Caption'#6#26'Register Firebi'
   +'rd Database'#12'ClientHeight'#3'\'#1#11'ClientWidth'#3'P'#2#5'Color'#7#7'cl'
-  +'White'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#7'1.0.4.0'#0#6'TLa'
-  +'bel'#6'Label1'#4'Left'#2#13#6'Height'#2#18#3'Top'#2'F'#5'Width'#2'n'#7'Capt'
+  +'White'#8'Position'#7#14'poScreenCenter'#10'LCLVersion'#6#7'1.2.2.0'#0#6'TLa'
+  +'bel'#6'Label1'#4'Left'#2#13#6'Height'#2#13#3'Top'#2'F'#5'Width'#2'P'#7'Capt'
   +'ion'#6#15'server:database'#11'ParentColor'#8#0#0#6'TLabel'#6'Label2'#4'Left'
-  +#2#13#6'Height'#2#18#3'Top'#2'u'#5'Width'#2'H'#7'Caption'#6#9'User name'#11
-  +'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#13#6'Height'#2#18#3'Top'#3
-  +#165#0#5'Width'#2'C'#7'Caption'#6#8'Password'#11'ParentColor'#8#0#0#6'TLabel'
-  +#6'Label4'#4'Left'#2#13#6'Height'#2#18#3'Top'#2#19#5'Width'#2#31#7'Caption'#6
+  +#2#13#6'Height'#2#13#3'Top'#2'u'#5'Width'#2'3'#7'Caption'#6#9'User name'#11
+  +'ParentColor'#8#0#0#6'TLabel'#6'Label3'#4'Left'#2#13#6'Height'#2#13#3'Top'#3
+  +#165#0#5'Width'#2'.'#7'Caption'#6#8'Password'#11'ParentColor'#8#0#0#6'TLabel'
+  +#6'Label4'#4'Left'#2#13#6'Height'#2#13#3'Top'#2#19#5'Width'#2#20#7'Caption'#6
   +#5'Title'#11'ParentColor'#8#0#0#6'TLabel'#6'Label5'#4'Left'#2#13#6'Height'#2
-  +#18#3'Top'#3#211#0#5'Width'#2'5'#7'Caption'#6#7'Charset'#11'ParentColor'#8#0
-  +#0#6'TLabel'#6'Label6'#4'Left'#2#13#6'Height'#2#18#3'Top'#3#248#0#5'Width'#2
-  +#31#7'Caption'#6#4'Role'#11'ParentColor'#8#0#0#5'TEdit'#14'edDatabaseName'#4
-  +'Left'#2'~'#6'Height'#2#27#3'Top'#2'@'#5'Width'#3'!'#1#8'TabOrder'#2#1#0#0#7
+  +#13#3'Top'#3#211#0#5'Width'#2'&'#7'Caption'#6#7'Charset'#11'ParentColor'#8#0
+  +#0#6'TLabel'#6'Label6'#4'Left'#2#13#6'Height'#2#13#3'Top'#3#248#0#5'Width'#2
+  +#21#7'Caption'#6#4'Role'#11'ParentColor'#8#0#0#5'TEdit'#14'edDatabaseName'#4
+  +'Left'#2'~'#6'Height'#2#21#3'Top'#2'@'#5'Width'#3'!'#1#8'TabOrder'#2#1#0#0#7
   +'TButton'#8'btBrowse'#4'Left'#3#168#1#6'Height'#2#25#3'Top'#2'B'#5'Width'#2
   +#27#7'Caption'#6#3'...'#7'OnClick'#7#13'btBrowseClick'#8'TabOrder'#2#2#0#0#5
-  +'TEdit'#10'edUserName'#4'Left'#2'~'#6'Height'#2#27#3'Top'#2'n'#5'Width'#3#145
-  +#0#8'TabOrder'#2#3#0#0#5'TEdit'#10'edPassword'#4'Left'#2'~'#6'Height'#2#27#3
+  +'TEdit'#10'edUserName'#4'Left'#2'~'#6'Height'#2#21#3'Top'#2'n'#5'Width'#3#145
+  +#0#8'TabOrder'#2#3#0#0#5'TEdit'#10'edPassword'#4'Left'#2'~'#6'Height'#2#21#3
   +'Top'#3#156#0#5'Width'#3#145#0#8'EchoMode'#7#10'emPassword'#12'PasswordChar'
   +#6#1'-'#8'TabOrder'#2#4#0#0#7'TBitBtn'#5'bbReg'#4'Left'#2#8#6'Height'#2'&'#3
   +'Top'#3'('#1#5'Width'#2'c'#7'Caption'#6#8'Register'#5'Color'#4#219#242#247#0
@@ -131,16 +133,16 @@ LazarusResources.Add('TfmReg','FORMDATA',[
   +'ick'#8'TabOrder'#2#9#0#0#7'TBitBtn'#8'bbCancel'#4'Left'#2'x'#6'Height'#2'&'
   +#3'Top'#3'('#1#5'Width'#2'X'#7'Caption'#6#6'Cancel'#5'Color'#4#219#242#247#0
   +#4'Kind'#7#8'bkCancel'#11'ModalResult'#2#2#8'TabOrder'#2#10#0#0#5'TEdit'#7'e'
-  +'dTitle'#4'Left'#2#127#6'Height'#2#27#3'Top'#2#16#5'Width'#3'!'#1#8'TabOrder'
+  +'dTitle'#4'Left'#2#127#6'Height'#2#21#3'Top'#2#16#5'Width'#3'!'#1#8'TabOrder'
   +#2#0#0#0#7'TBitBtn'#6'bbTest'#4'Left'#3'('#1#6'Height'#2'('#3'Top'#3'('#1#5
   +'Width'#3#160#0#7'Caption'#6#15'Test connection'#5'Color'#4#219#242#247#0#4
   +'Kind'#7#5'bkAll'#7'OnClick'#7#11'bbTestClick'#8'TabOrder'#2#8#0#0#9'TCheckB'
-  +'ox'#14'cxSavePassword'#4'Left'#3#23#1#6'Height'#2#24#3'Top'#3#160#0#5'Width'
-  +#2'~'#7'Caption'#6#13'Save Password'#8'TabOrder'#2#5#0#0#5'TEdit'#6'edRole'#4
-  +'Left'#2#127#6'Height'#2#27#3'Top'#3#248#0#5'Width'#3#144#0#8'TabOrder'#2#7#0
-  +#0#9'TComboBox'#9'cbCharset'#4'Left'#2#127#6'Height'#2#29#3'Top'#3#200#0#5'W'
-  +'idth'#3#140#0#10'ItemHeight'#2#0#9'ItemIndex'#2#0#13'Items.Strings'#1#6#4'N'
-  +'ONE'#6#4'TRIM'#6#5'ASCII'#6#5'BIG_5'#6#6'CP943C'#6#4'CYRL'#6#6'DOS437'#6#6
+  +'ox'#14'cxSavePassword'#4'Left'#3#23#1#6'Height'#2#17#3'Top'#3#160#0#5'Width'
+  +#2']'#7'Caption'#6#13'Save Password'#8'TabOrder'#2#5#0#0#5'TEdit'#6'edRole'#4
+  +'Left'#2#127#6'Height'#2#21#3'Top'#3#248#0#5'Width'#3#144#0#8'TabOrder'#2#7#0
+  +#0#9'TComboBox'#9'cbCharset'#4'Left'#2#127#6'Height'#2#21#3'Top'#3#200#0#5'W'
+  +'idth'#3#140#0#10'ItemHeight'#2#13#9'ItemIndex'#2#0#13'Items.Strings'#1#6#4
+  +'NONE'#6#4'TRIM'#6#5'ASCII'#6#5'BIG_5'#6#6'CP943C'#6#4'CYRL'#6#6'DOS437'#6#6
   +'DOS737'#6#6'DOS775'#6#6'DOS850'#6#6'DOS852'#6#6'DOS857'#6#6'DOS858'#6#6'DOS'
   +'860'#6#6'DOS861'#6#6'DOS862'#6#6'DOS863'#6#6'DOS864'#6#6'DOS865'#6#6'DOS866'
   +#6#6'DOS869'#6#9'EUCJ_0208'#6#3'GBK'#6#7'GB_2312'#6#9'ISO8859_1'#6#10'ISO885'

+ 0 - 1
reg.pas

@@ -112,7 +112,6 @@ var
   FileName: string;
 begin
   try
-
     FileName:= fmMain.getConfigurationDirectory + 'turbobird.reg';
 
     AssignFile(F, FileName);