--- ibx/trunk/design/IBDBReg.pas 2016/09/22 17:10:15 44 +++ ibx/trunk/design/IBDBReg.pas 2016/12/06 10:33:46 45 @@ -39,7 +39,6 @@ unit IBDBReg; *) {$A+} (* Aligned records: On *) {$B-} (* Short circuit boolean expressions: Off *) -{$G+} (* Imported data: On *) {$H+} (* Huge Strings: On *) {$J-} (* Modification of Typed Constants: Off *) {$M+} (* Generate run-time type information: On *) @@ -47,7 +46,6 @@ unit IBDBReg; {$Q-} (* Overflow checks: Off *) {$R-} (* Range checks: Off *) {$T+} (* Typed address: On *) -{$U+} (* Pentim-safe FDIVs: On *) {$W-} (* Always generate stack frames: Off *) {$X+} (* Extended syntax: On *) {$Z1} (* Minimum Enumeration Size: 1 Byte *) @@ -56,7 +54,7 @@ interface uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf, - IBUpdateSQL, IBXConst, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor, + IBUpdateSQL, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor, dbFieldLinkPropEditor, dbFieldListPropEditor, IBDialogs; type @@ -134,6 +132,15 @@ type function GetVerbCount: Integer; override; end; + { TIBArrayGridEditor } + + TIBArrayGridEditor = class(TComponentEditor) + public + procedure ExecuteVerb(Index: Integer); override; + function GetVerb(Index: Integer): string; override; + function GetVerbCount: Integer; override; + end; + { TIBQueryEditor } TIBQueryEditor = class(TFieldsComponentEditor) @@ -355,22 +362,51 @@ type procedure SetIndexFieldNames(const Value: string); override; end; + { TIBFieldDefsProperty } + + TIBFieldDefsProperty = class(TCollectionPropertyEditor) + public + procedure Edit; override; + end; + + { TIBIndexDefsProperty } + + TIBIndexDefsProperty = class(TCollectionPropertyEditor) + public + procedure Edit; override; + end; procedure Register; implementation -uses IB, IBQuery, IBStoredProc, IBCustomDataSet, - IBIntf, IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, +uses IB, IBQuery, IBStoredProc, IBCustomDataSet, FBMessages, + IBSQL, IBSQLMonitor, IBDatabaseInfo, IBEvents, IBTypes, IBServices, IBDatabaseEdit, IBTransactionEdit, IBBatchMove, IBExtract,LResources, IBSelectSQLEditor, IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor, IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor, IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox, - IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs; - + IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs, + IBArrayGrid; +const + IBPalette1 = 'Firebird'; {do not localize} + IBPalette2 = 'Firebird Admin'; {do not localize} + IBPalette3 = 'Firebird Data Controls'; {do not localize} + + resourcestring + SInterbaseExpressVersion = 'Firebird Express for Lazarus 2.0.0'; + SEditSQL = 'Edit SQL'; + SIBSQLEditor = 'IBSQL Editor'; + SIBServiceEditor = 'Edit IB Service'; + SIBUpdateSQLEditor = '&UpdateSQL Editor...'; + SIBDataSetEditor = '&Dataset Editor...'; + SExecute = 'E&xecute'; + SIBDatabaseEditor = 'Da&tabase Editor...'; + SIBTransactionEditor = '&Transaction Editor...'; + SIBUpdateLayout = 'Update Layout'; procedure Register; begin @@ -380,7 +416,7 @@ begin Exit; end; - RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField]); + RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField]); {$if lcl_fullversion < 01010000} {see http://bugs.freepascal.org/view.php?id=19035 } RegisterNoIcon([TIntegerField]); @@ -389,13 +425,13 @@ begin TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBEvents, TIBSQL, TIBDatabaseInfo, TIBSQLMonitor, TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract, TIBXScript, TIBLocalDBSupport]); - if IBServiceAPIPresent then + if FirebirdAPI.HasServiceAPI then RegisterComponents(IBPalette2, [TIBConfigService, TIBBackupService, TIBRestoreService, TIBValidationService, TIBStatisticalService, TIBLogService, TIBSecurityService, TIBServerProperties]); - RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid]); + RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid, TIBArrayGrid]); RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize} RegisterPropertyEditor(TypeInfo(string), TIBStoredProc, 'StoredProcName', TIBStoredProcNameProperty); {do not localize} RegisterPropertyEditor(TypeInfo(TParams), TIBStoredProc, 'Params', TIBStoredProcParamsProperty); @@ -403,6 +439,8 @@ begin RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexName', TIBIndexNameProperty); {do not localize} RegisterPropertyEditor(TypeInfo(string), TIBTable, 'IndexFieldNames', TIBIndexFieldNamesProperty); {do not localize} RegisterPropertyEditor(TypeInfo(string), TIBTable, 'MasterFields', TIBTableFieldLinkProperty); {do not localize} + RegisterPropertyEditor(TypeInfo(TFieldDefs), TIBTable, 'FieldDefs', TIBFieldDefsProperty); {do not localize} + RegisterPropertyEditor(TypeInfo(TIndexDefs), TIBTable, 'IndexDefs', TIBIndexDefsProperty); {do not localize} RegisterPropertyEditor(TypeInfo(TStrings), TIBQuery, 'SQL', TIBQuerySQLProperty); {do not localize} RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'SelectSQL', TIBDatasetSQLProperty); {do not localize} RegisterPropertyEditor(TypeInfo(TStrings), TIBDataSet, 'ModifySQL', TIBUpdateSQLProperty); {do not localize} @@ -426,6 +464,7 @@ begin RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor); RegisterComponentEditor(TIBSQL, TIBSQLEditor); RegisterComponentEditor(TIBCustomService, TIBServiceEditor); + RegisterComponentEditor(TIBArrayGrid, TIBArrayGridEditor); {Firebird Data Access Controls} @@ -463,6 +502,58 @@ begin end; end; +{ TIBIndexDefsProperty } + +procedure TIBIndexDefsProperty.Edit; +var IndexDefs: TIndexDefs; +begin + IndexDefs := TIndexDefs(GetObjectValue); + if IndexDefs <> nil then + IndexDefs.Update; + inherited Edit; +end; + +{ TIBFieldDefsProperty } + +procedure TIBFieldDefsProperty.Edit; +var FieldDefs: TFieldDefs; +begin + FieldDefs := TFieldDefs(GetObjectValue); + if FieldDefs <> nil then + FieldDefs.Update; + inherited Edit; +end; + +{ TIBArrayGridEditor } + +procedure TIBArrayGridEditor.ExecuteVerb(Index: Integer); +begin + if Index < inherited GetVerbCount then + inherited ExecuteVerb(Index) + else + case Index of + 0: TIBArrayGrid(Component).UpdateLayout; + end; +end; + +function TIBArrayGridEditor.GetVerb(Index: Integer): string; +begin + if Index < inherited GetVerbCount then + Result := inherited GetVerb(Index) else + begin + Dec(Index, inherited GetVerbCount); + case Index of + 0: Result := SIBUpdateLayout; + 1 : Result := SInterbaseExpressVersion ; + end; + end; +end; + +function TIBArrayGridEditor.GetVerbCount: Integer; +begin + Result := 2; +end; + { TDBLookupPropertiesGridFieldProperty } procedure TDBLookupPropertiesGridFieldProperty.FillValues( @@ -757,7 +848,7 @@ function TIBUpdateSQLEditor.GetVerb(Inde begin case Index of 0 : Result := SIBUpdateSQLEditor; - 1: Result := SInterbaseExpressVersion; + 1: Result := SInterbaseExpressVersion ; end; end; @@ -769,8 +860,6 @@ end; { TIBDataSetEditor } procedure TIBDataSetEditor.ExecuteVerb(Index: Integer); -var - IBDataset: TIBDataset; begin if Index < inherited GetVerbCount then inherited ExecuteVerb(Index) else @@ -794,7 +883,7 @@ begin case Index of 0: Result := SIBDataSetEditor; 1: Result := SExecute; - 2: Result := SInterbaseExpressVersion; + 2: Result := SInterbaseExpressVersion ; end; end; end; @@ -851,7 +940,7 @@ begin Dec(Index, inherited GetVerbCount); case Index of 0: Result := SIBDatabaseEditor; - 1 : Result := SInterbaseExpressVersion; + 1 : Result := SInterbaseExpressVersion ; end; end; end; @@ -874,7 +963,7 @@ function TIBTransactionEditor.GetVerb(In begin case Index of 0: Result := SIBTransactionEditor; - 1: Result := SInterbaseExpressVersion; + 1: Result := SInterbaseExpressVersion ; end; end; @@ -910,7 +999,7 @@ begin case Index of 0: Result := SExecute; 1: Result := SEditSQL; - 2: Result := SInterbaseExpressVersion; + 2: Result := SInterbaseExpressVersion ; end; end; end; @@ -940,7 +1029,7 @@ begin Dec(Index, inherited GetVerbCount); case Index of 0: Result := SExecute; - 1: Result := SInterbaseExpressVersion; + 1: Result := SInterbaseExpressVersion ; end; end; end; @@ -1025,7 +1114,6 @@ end; procedure TIBRefreshSQLProperty.Edit; var IBDataset: TIBDataset; - aDatabase: TIBDatabase; begin IBDataset := GetComponent(0) as TIBDataset; if IBRefreshSQLEditor.EditSQL(IBDataSet,IBDataSet.RefreshSQL) then Modified; @@ -1119,7 +1207,7 @@ function TIBSQLEditor.GetVerb(Index: Int begin case Index of 0 : Result := SIBSQLEditor; - 1: Result := SInterbaseExpressVersion; + 1: Result := SInterbaseExpressVersion ; end; end;