55 |
|
uses SysUtils, Classes, Graphics, Dialogs, Controls, Forms, TypInfo, |
56 |
|
DB, IBTable, IBDatabase, IBEventsEditor, LazarusPackageIntf, |
57 |
|
IBUpdateSQL, IBUpdate, ComponentEditors, PropEdits, DBPropEdits, FieldsEditor, |
58 |
< |
dbFieldLinkPropEditor, dbFieldListPropEditor, IBDialogs; |
58 |
> |
dbFieldLinkPropEditor, IBDialogs; |
59 |
|
|
60 |
|
type |
61 |
|
|
149 |
|
function GetVerbCount: Integer; override; |
150 |
|
end; |
151 |
|
|
152 |
– |
{ TIBArrayGridEditor } |
153 |
– |
|
154 |
– |
TIBArrayGridEditor = class(TComponentEditor) |
155 |
– |
public |
156 |
– |
procedure ExecuteVerb(Index: Integer); override; |
157 |
– |
function GetVerb(Index: Integer): string; override; |
158 |
– |
function GetVerbCount: Integer; override; |
159 |
– |
end; |
160 |
– |
|
152 |
|
{ TIBQueryEditor } |
153 |
|
|
154 |
|
TIBQueryEditor = class(TFieldsComponentEditor) |
359 |
|
procedure Edit; override; |
360 |
|
end; |
361 |
|
|
371 |
– |
{ TDBDynamicGridFieldProperty } |
372 |
– |
|
373 |
– |
TDBDynamicGridFieldProperty = class(TFieldProperty) |
374 |
– |
public |
375 |
– |
procedure FillValues(const Values: TStringList); override; |
376 |
– |
end; |
377 |
– |
|
378 |
– |
{ TDBLookupPropertiesGridFieldProperty } |
379 |
– |
|
380 |
– |
TDBLookupPropertiesGridFieldProperty = class(TFieldProperty) |
381 |
– |
public |
382 |
– |
procedure FillValues(const Values: TStringList); override; |
383 |
– |
end; |
384 |
– |
|
385 |
– |
{ TIBTreeViewFieldProperty } |
386 |
– |
|
387 |
– |
TIBTreeViewFieldProperty = class(TFieldProperty) |
388 |
– |
public |
389 |
– |
procedure FillValues(const Values: TStringList); override; |
390 |
– |
end; |
391 |
– |
|
392 |
– |
{ TIBDynamicGridIndexNamesProperty } |
393 |
– |
|
394 |
– |
TIBDynamicGridIndexNamesProperty = class(TIndexFieldNamesProperty) |
395 |
– |
protected |
396 |
– |
function GetFieldDefs: TFieldDefs; override; |
397 |
– |
function GetIndexFieldNames: string; override; |
398 |
– |
procedure SetIndexFieldNames(const Value: string); override; |
399 |
– |
end; |
400 |
– |
|
362 |
|
{ TIBFieldDefsProperty } |
363 |
|
|
364 |
|
TIBFieldDefsProperty = class(TCollectionPropertyEditor) |
384 |
|
IBBatchMove, IBExtract,LResources, IBSelectSQLEditor, |
385 |
|
IBModifySQLEditor,IBDeleteSQLEditor,IBRefreshSQLEditor, |
386 |
|
IBInsertSQLEditor, IBGeneratorEditor, IBUpdateSQLEditor, IBDataSetEditor, |
387 |
< |
IBSQLEditor, ibserviceeditor, LCLVersion, IBDynamicGrid, IBLookupComboEditBox, |
388 |
< |
IBTreeView, DBControlGrid, ibxscript, IBLocalDBSupport, IBDSDialogs, |
428 |
< |
IBArrayGrid, IBVersion, IBDataOutput, IBXServiceEditor; |
387 |
> |
IBSQLEditor, ibserviceeditor, LCLVersion, ibxscript, IBLocalDBSupport, IBDSDialogs, |
388 |
> |
IBVersion, IBDataOutput, IBXServiceEditor, IBJournal; |
389 |
|
|
390 |
|
const |
391 |
|
IBPalette1 = 'Firebird'; {do not localize} |
392 |
|
IBPalette2 = 'Firebird Legacy Admin'; {do not localize} |
393 |
< |
IBPalette3 = 'Firebird Data Controls'; {do not localize} |
434 |
< |
IBPalette4 = 'Firebird Admin'; {do not localize} |
393 |
> |
IBPalette3 = 'Firebird Admin'; {do not localize} |
394 |
|
|
395 |
|
resourcestring |
396 |
|
SInterbaseExpressVersion = 'Firebird Express for Lazarus ' + IBX_VERSION; |
402 |
|
SExecute = 'E&xecute'; |
403 |
|
SIBDatabaseEditor = 'Da&tabase Editor...'; |
404 |
|
SIBTransactionEditor = '&Transaction Editor...'; |
446 |
– |
SIBUpdateLayout = 'Update Layout'; |
405 |
|
SFBLibLoadProblem = 'IBX is unable to locate or otherwise load the Firebird Library - have you remembered to install it?'; |
406 |
|
|
407 |
|
procedure Register; |
422 |
|
|
423 |
|
RegisterNoIcon([TIBStringField, TIBBCDField, TIBMemoField, TIBArrayField, |
424 |
|
TIBSmallintField, TIBIntegerField, TIBLargeIntField, TIBDateTimeField, |
425 |
< |
TIBTimeField]); |
426 |
< |
{$if lcl_fullversion < 01010000} |
425 |
> |
TIBTimeField, TIBFloatField]); |
426 |
> |
{$if not declared(TIntegerField)} |
427 |
|
{see http://bugs.freepascal.org/view.php?id=19035 } |
428 |
|
RegisterNoIcon([TIntegerField]); |
429 |
|
{$endif} |
430 |
|
RegisterComponents(IBPalette1, [ TIBQuery, TIBDataSet, |
431 |
|
TIBDatabase, TIBTransaction, TIBUpdateSQL, TIBUpdate, TIBEvents, |
432 |
|
TIBSQL, TIBDatabaseInfo, TIBSQLMonitor, |
433 |
< |
TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract, TIBXScript, TIBLocalDBSupport, |
433 |
> |
TIBStoredProc,TIBBatchMove, TIBTable,TIBExtract, TIBXScript, TIBJournal, TIBLocalDBSupport, |
434 |
|
TIBBlockFormatOut,TIBCSVDataOut,TIBInsertStmtsOut]); |
435 |
|
if FirebirdAPI.HasServiceAPI then |
436 |
|
begin |
437 |
< |
RegisterComponents(IBPalette4, [TIBXServicesConnection, TIBXConfigService, |
437 |
> |
RegisterComponents(IBPalette3, [TIBXServicesConnection, TIBXConfigService, |
438 |
|
TIBXClientSideBackupService, TIBXServerSideBackupService, |
439 |
|
TIBXClientSideRestoreService, TIBXServerSideRestoreService, |
440 |
|
TIBXValidationService, TIBXOnlineValidationService, TIBXStatisticalService, |
446 |
|
TIBLogService, TIBSecurityService, TIBServerProperties]); |
447 |
|
end; |
448 |
|
|
491 |
– |
RegisterComponents(IBPalette3,[TIBLookupComboEditBox,TIBDynamicGrid,TIBTreeView,TDBControlGrid, TIBArrayGrid]); |
449 |
|
|
450 |
|
RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'DatabaseName', TIBFileNameProperty); {do not localize} |
451 |
|
RegisterPropertyEditor(TypeInfo(TIBFileName), TIBDatabase, 'FirebirdLibraryPathName', TIBLibraryNameProperty); {do not localize} |
484 |
|
RegisterComponentEditor(TIBStoredProc, TIBStoredProcEditor); |
485 |
|
RegisterComponentEditor(TIBSQL, TIBSQLEditor); |
486 |
|
RegisterComponentEditor(TIBCustomService, TIBServiceEditor); |
530 |
– |
RegisterComponentEditor(TIBArrayGrid, TIBArrayGridEditor); |
487 |
|
RegisterComponentEditor(TIBXServicesConnection, TIBXServiceEditor); |
488 |
|
|
533 |
– |
|
534 |
– |
{Firebird Data Access Controls} |
535 |
– |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'KeyField', TDBDynamicGridFieldProperty); |
536 |
– |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'ListField', TDBDynamicGridFieldProperty); |
537 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBDynamicGrid, 'IndexFieldNames', TIBDynamicGridIndexNamesProperty); |
538 |
– |
RegisterPropertyEditor(TypeInfo(string), TDBLookupProperties, 'DataFieldName', TDBLookupPropertiesGridFieldProperty); |
539 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'KeyField', TIBTreeViewFieldProperty); |
540 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'TextField', TIBTreeViewFieldProperty); |
541 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ParentField', TIBTreeViewFieldProperty); |
542 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'HasChildField', TIBTreeViewFieldProperty); |
543 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'ImageIndexField', TIBTreeViewFieldProperty); |
544 |
– |
RegisterPropertyEditor(TypeInfo(string), TIBTreeView, 'SelectedIndexField', TIBTreeViewFieldProperty); |
545 |
– |
|
489 |
|
IBGUIInterface := TIBDSLCLInterface.Create; |
490 |
|
end; |
491 |
|
|
549 |
– |
procedure LoadDataSourceFields(DataSource: TDataSource; List: TStrings); |
550 |
– |
var |
551 |
– |
DataSet: TDataSet; |
552 |
– |
i: Integer; |
553 |
– |
begin |
554 |
– |
if Assigned(DataSource) then |
555 |
– |
begin |
556 |
– |
DataSet := DataSource.DataSet; |
557 |
– |
if Assigned(DataSet) then |
558 |
– |
begin |
559 |
– |
if DataSet.Fields.Count > 0 then |
560 |
– |
DataSet.GetFieldNames(List) |
561 |
– |
else |
562 |
– |
begin |
563 |
– |
DataSet.FieldDefs.Update; |
564 |
– |
for i := 0 to DataSet.FieldDefs.Count - 1 do |
565 |
– |
List.Add(DataSet.FieldDefs[i].Name); |
566 |
– |
end; |
567 |
– |
end; |
568 |
– |
end; |
569 |
– |
end; |
570 |
– |
|
492 |
|
{ TIBLibraryNameProperty } |
493 |
|
|
494 |
|
function TIBLibraryNameProperty.GetFilter: string; |
592 |
|
inherited Edit; |
593 |
|
end; |
594 |
|
|
674 |
– |
{ TIBArrayGridEditor } |
675 |
– |
|
676 |
– |
procedure TIBArrayGridEditor.ExecuteVerb(Index: Integer); |
677 |
– |
begin |
678 |
– |
if Index < inherited GetVerbCount then |
679 |
– |
inherited ExecuteVerb(Index) |
680 |
– |
else |
681 |
– |
case Index of |
682 |
– |
0: TIBArrayGrid(Component).UpdateLayout; |
683 |
– |
end; |
684 |
– |
end; |
685 |
– |
|
686 |
– |
function TIBArrayGridEditor.GetVerb(Index: Integer): string; |
687 |
– |
begin |
688 |
– |
if Index < inherited GetVerbCount then |
689 |
– |
Result := inherited GetVerb(Index) else |
690 |
– |
begin |
691 |
– |
Dec(Index, inherited GetVerbCount); |
692 |
– |
case Index of |
693 |
– |
0: Result := SIBUpdateLayout; |
694 |
– |
1 : Result := SInterbaseExpressVersion ; |
695 |
– |
end; |
696 |
– |
end; |
697 |
– |
end; |
698 |
– |
|
699 |
– |
function TIBArrayGridEditor.GetVerbCount: Integer; |
700 |
– |
begin |
701 |
– |
Result := 2; |
702 |
– |
end; |
703 |
– |
|
704 |
– |
{ TDBLookupPropertiesGridFieldProperty } |
705 |
– |
|
706 |
– |
procedure TDBLookupPropertiesGridFieldProperty.FillValues( |
707 |
– |
const Values: TStringList); |
708 |
– |
var |
709 |
– |
P: TDBLookupProperties; |
710 |
– |
begin |
711 |
– |
P :=TDBLookupProperties(GetComponent(0)); |
712 |
– |
if not (P is TDBLookupProperties) then exit; |
713 |
– |
LoadDataSourceFields(TIBDynamicGrid(P.Owner.Grid).DataSource, Values); |
714 |
– |
end; |
715 |
– |
|
716 |
– |
{ TIBTreeViewFieldProperty } |
717 |
– |
|
718 |
– |
procedure TIBTreeViewFieldProperty.FillValues(const Values: TStringList); |
719 |
– |
var ListSource: TDataSource; |
720 |
– |
begin |
721 |
– |
ListSource := TIBTreeView(GetComponent(0)).DataSource; |
722 |
– |
LoadDataSourceFields(ListSource, Values); |
723 |
– |
end; |
724 |
– |
|
725 |
– |
{ TIBDynamicGridIndexNamesProperty } |
726 |
– |
|
727 |
– |
function TIBDynamicGridIndexNamesProperty.GetFieldDefs: TFieldDefs; |
728 |
– |
var Grid: TIBDynamicGrid; |
729 |
– |
begin |
730 |
– |
Result := nil; |
731 |
– |
Grid := TIBDynamicGrid(GetComponent(0)); |
732 |
– |
if assigned(Grid.DataSource) and assigned(Grid.DataSource.DataSet) then |
733 |
– |
Result := Grid.DataSource.DataSet.FieldDefs |
734 |
– |
end; |
735 |
– |
|
736 |
– |
function TIBDynamicGridIndexNamesProperty.GetIndexFieldNames: string; |
737 |
– |
var Grid: TIBDynamicGrid; |
738 |
– |
begin |
739 |
– |
Grid := TIBDynamicGrid(GetComponent(0)); |
740 |
– |
Result := Grid.IndexFieldNames |
741 |
– |
end; |
742 |
– |
|
743 |
– |
procedure TIBDynamicGridIndexNamesProperty.SetIndexFieldNames( |
744 |
– |
const Value: string); |
745 |
– |
var Grid: TIBDynamicGrid; |
746 |
– |
begin |
747 |
– |
Grid := TIBDynamicGrid(GetComponent(0)); |
748 |
– |
Grid.IndexFieldNames := Value |
749 |
– |
end; |
750 |
– |
|
751 |
– |
{ TDBDynamicGridFieldProperty } |
752 |
– |
|
753 |
– |
procedure TDBDynamicGridFieldProperty.FillValues(const Values: TStringList); |
754 |
– |
var |
755 |
– |
P: TDBLookupProperties; |
756 |
– |
begin |
757 |
– |
P :=TDBLookupProperties(GetComponent(0)); |
758 |
– |
if not (P is TDBLookupProperties) then exit; |
759 |
– |
LoadDataSourceFields(P.ListSource, Values); |
760 |
– |
end; |
761 |
– |
|
595 |
|
{ TIBServiceEditor } |
596 |
|
|
597 |
|
procedure TIBServiceEditor.ExecuteVerb(Index: Integer); |