|
From: Steven M. <sr...@us...> - 2005-02-24 00:08:43
|
Update of /cvsroot/instantobjects/Source/Design In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17875 Modified Files: InstantAttributeEditor.pas InstantAttributeEditor.dfm Log Message: Further updates for Attribute Editor when called from either the IO Class Editor in Delphi's Model Viewer or Object Foundry in ModelMaker. 1. Tidied up code and added Auto check box to Attribute Editor form for ExternalStoragename so that user changes are not automatically overwritten by other changes. The Auto check box setting is not persistent and defaults to Unchecked each time the editor is launched. 2. Removed redundant code now that ExternalLinkedStorage is not required. 3. The InMM flag was no longer needed and has been removed. This was achieved after a bug fix in OFClasses.pas. Index: InstantAttributeEditor.dfm =================================================================== RCS file: /cvsroot/instantobjects/Source/Design/InstantAttributeEditor.dfm,v retrieving revision 1.5 retrieving revision 1.6 diff -C2 -d -r1.5 -r1.6 *** InstantAttributeEditor.dfm 18 Feb 2005 14:49:38 -0000 1.5 --- InstantAttributeEditor.dfm 24 Feb 2005 00:08:33 -0000 1.6 *************** *** 1,7 **** inherited InstantAttributeEditorForm: TInstantAttributeEditorForm ! Left = 229 ! Top = 215 Width = 249 ! Height = 350 Caption = 'Attribute Editor' ParentFont = True --- 1,7 ---- inherited InstantAttributeEditorForm: TInstantAttributeEditorForm ! Left = 78 ! Top = 485 Width = 249 ! Height = 358 Caption = 'Attribute Editor' ParentFont = True *************** *** 12,21 **** inherited EditPanel: TPanel Width = 241 ! Height = 292 object PageControl: TPageControl Left = 4 Top = 4 Width = 233 ! Height = 284 ActivePage = DefinitionSheet Align = alClient --- 12,21 ---- inherited EditPanel: TPanel Width = 241 ! Height = 293 object PageControl: TPageControl Left = 4 Top = 4 Width = 233 ! Height = 285 ActivePage = DefinitionSheet Align = alClient *************** *** 65,69 **** object ExternalStorageNameLabel: TLabel Left = 8 ! Top = 208 Width = 109 Height = 13 --- 65,69 ---- object ExternalStorageNameLabel: TLabel Left = 8 ! Top = 214 Width = 109 Height = 13 *************** *** 80,86 **** end object NameEdit: TDBEdit ! Left = 8 Top = 24 ! Width = 209 Height = 21 DataField = 'Name' --- 80,86 ---- end object NameEdit: TDBEdit ! Left = 7 Top = 24 ! Width = 210 Height = 21 DataField = 'Name' *************** *** 90,94 **** end object TypeEdit: TDBComboBox ! Left = 8 Top = 64 Width = 137 --- 90,94 ---- end object TypeEdit: TDBComboBox ! Left = 7 Top = 64 Width = 137 *************** *** 103,109 **** end object ObjectClassEdit: TDBComboBox ! Left = 8 Top = 104 ! Width = 209 Height = 21 DataField = 'Metadata.ObjectClassName' --- 103,109 ---- end object ObjectClassEdit: TDBComboBox ! Left = 7 Top = 104 ! Width = 210 Height = 21 DataField = 'Metadata.ObjectClassName' *************** *** 116,122 **** end object StorageNameEdit: TDBEdit ! Left = 8 Top = 144 ! Width = 209 Height = 21 DataField = 'StorageName' --- 116,122 ---- end object StorageNameEdit: TDBEdit ! Left = 7 Top = 144 ! Width = 210 Height = 21 DataField = 'StorageName' *************** *** 135,141 **** end object ExternalStorageNameEdit: TDBEdit ! Left = 8 ! Top = 225 ! Width = 209 Height = 21 DataField = 'ExternalStorageName' --- 135,141 ---- end object ExternalStorageNameEdit: TDBEdit ! Left = 7 ! Top = 231 ! Width = 210 Height = 21 DataField = 'ExternalStorageName' *************** *** 157,160 **** --- 157,170 ---- OnChange = StorageKindEditChange end + object AutoCheckBox: TCheckBox + Left = 172 + Top = 212 + Width = 45 + Height = 17 + Alignment = taLeftJustify + Caption = 'Auto' + TabOrder = 7 + OnClick = AutoCheckBoxClick + end end object AccessSheet: TTabSheet *************** *** 369,376 **** end inherited BottomPanel: TPanel ! Top = 292 Width = 241 inherited ButtonPanel: TPanel Left = 81 end end --- 379,394 ---- end inherited BottomPanel: TPanel ! Top = 293 Width = 241 inherited ButtonPanel: TPanel Left = 81 + inherited OkButton: TButton + Left = 1 + Top = 2 + end + inherited CancelButton: TButton + Left = 81 + Top = 2 + end end end Index: InstantAttributeEditor.pas =================================================================== RCS file: /cvsroot/instantobjects/Source/Design/InstantAttributeEditor.pas,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** InstantAttributeEditor.pas 21 Feb 2005 06:37:31 -0000 1.12 --- InstantAttributeEditor.pas 24 Feb 2005 00:08:33 -0000 1.13 *************** *** 49,54 **** type TInstantStringsEvent = procedure(Sender: TObject; Items: TStrings) of object; - TInstantAttrStringsEvent = procedure(Sender: TObject; const ClassName: string; - Items: TStrings) of object; TInstantAttributeEditorForm = class(TInstantEditForm) --- 49,52 ---- *************** *** 96,99 **** --- 94,98 ---- StorageKindEdit: TDBComboBox; StorageKindLabel: TLabel; + AutoCheckBox: TCheckBox; procedure FormCreate(Sender: TObject); procedure NameEditChange(Sender: TObject); *************** *** 109,121 **** procedure StorageKindEditChange(Sender: TObject); procedure ExternalStorageNameEditChange(Sender: TObject); - procedure ExternalLinkedNameEditChange(Sender: TObject); procedure StorageNameEditChange(Sender: TObject); private ! // True if in ModelMaker, default is False ! FInMM: Boolean; FLimited: Boolean; FModel: TInstantCodeModel; FOnLoadClasses: TInstantStringsEvent; - FOnLoadClassAttributes: TInstantAttrStringsEvent; function GetSubject: TInstantCodeAttribute; procedure SetSubject(const Value: TInstantCodeAttribute); --- 108,118 ---- procedure StorageKindEditChange(Sender: TObject); procedure ExternalStorageNameEditChange(Sender: TObject); procedure StorageNameEditChange(Sender: TObject); + procedure AutoCheckBoxClick(Sender: TObject); private ! FBaseClassStorageName: string; FLimited: Boolean; FModel: TInstantCodeModel; FOnLoadClasses: TInstantStringsEvent; function GetSubject: TInstantCodeAttribute; procedure SetSubject(const Value: TInstantCodeAttribute); *************** *** 124,128 **** protected procedure LoadClasses; - procedure LoadClassAttributes; procedure LoadData; override; procedure LoadEnums(TypeInfo: PTypeInfo; Items: TStrings; --- 121,124 ---- *************** *** 137,145 **** procedure ComputeExternalStorageName; public ! property InMM: boolean read FInMM write FInMM; property Limited: Boolean read FLimited write SetLimited; property Model: TInstantCodeModel read FModel write SetModel; ! property OnLoadClasses: TInstantStringsEvent read FOnLoadClasses write FOnLoadClasses; ! property OnLoadClassAttributes: TInstantAttrStringsEvent read FOnLoadClassAttributes write FOnLoadClassAttributes; property Subject: TInstantCodeAttribute read GetSubject write SetSubject; end; --- 133,142 ---- procedure ComputeExternalStorageName; public ! property BaseClassStorageName: string read FBaseClassStorageName write ! FBaseClassStorageName; property Limited: Boolean read FLimited write SetLimited; property Model: TInstantCodeModel read FModel write SetModel; ! property OnLoadClasses: TInstantStringsEvent read FOnLoadClasses ! write FOnLoadClasses; property Subject: TInstantCodeAttribute read GetSubject write SetSubject; end; *************** *** 160,164 **** PageControl.ActivePage := DefinitionSheet; ActiveControl := NameEdit; - FInMM := False; end; --- 157,160 ---- *************** *** 312,316 **** SubjectExposer.AssignFieldValue(Field, Text); UpdateControls; - LoadClassAttributes; end; --- 308,311 ---- *************** *** 337,344 **** end; end; ! if InMM then ! SaveData ! else ! inherited; end; --- 332,337 ---- end; end; ! ! inherited; end; *************** *** 519,523 **** EnableCtrl(ExternalStorageNameLabel, IsExternal and not (Subject.AttributeType = atPart)); ! EnableCtrl(ExternalStorageNameEdit, IsExternal and not (Subject.AttributeType = atPart)); --- 512,518 ---- EnableCtrl(ExternalStorageNameLabel, IsExternal and not (Subject.AttributeType = atPart)); ! EnableCtrl(ExternalStorageNameEdit, IsExternal ! and not (Subject.AttributeType = atPart)); ! EnableCtrl(AutoCheckBox, IsExternal and not (Subject.AttributeType = atPart)); *************** *** 544,558 **** with ExternalStorageNameEdit do if Text <> '' then ! SubjectExposer.AssignFieldValue(Field, Text); ! UpdateControls; ! end; ! ! procedure TInstantAttributeEditorForm.ExternalLinkedNameEditChange(Sender: TObject); ! begin UpdateControls; end; ! procedure TInstantAttributeEditorForm.LoadClassAttributes; begin end; --- 539,550 ---- with ExternalStorageNameEdit do if Text <> '' then ! SubjectExposer.AssignFieldValue(Field, Text); UpdateControls; end; ! procedure TInstantAttributeEditorForm.AutoCheckBoxClick(Sender: TObject); begin + if AutoCheckBox.Checked then + ComputeExternalStorageName; end; *************** *** 560,564 **** Sender: TObject); begin - inherited; UpdateControls; end; --- 552,555 ---- *************** *** 566,588 **** procedure TInstantAttributeEditorForm.ComputeExternalStorageName; - function GetClassStorageName: string; - begin - if Assigned(FModel) then - begin - if Subject.Metadata.ClassMetadata.StorageName <> '' then - Result := Subject.Metadata.ClassMetadata.StorageName - else begin - Result := Subject.Metadata.ClassMetadata.Name; - // Remove the 'T' from classname - if (Length(Result) > 1) and (Result[1] = 'T') then - Delete(Result, 1, 1); - end; - end - else begin - // ToDo: Fix this up for ObjectFoundry. - Result := ''; - end; - end; - function GetStorageName: string; begin --- 557,560 ---- *************** *** 594,602 **** begin ! if ExternalStorageNameEdit.Enabled then ! ExternalStorageNameEdit.Text := Format('%s_%s', ! [GetClassStorageName(), GetStorageName()]) ! else ! ExternalStorageNameEdit.Text := ''; end; --- 566,580 ---- begin ! with ExternalStorageNameEdit do ! if Enabled then ! begin ! if (Subject.ExternalStorageName <> '') and not AutoCheckBox.Checked then ! Text := Subject.ExternalStorageName ! else ! if (Text = '') or AutoCheckBox.Checked then ! Text := Format('%s_%s', [BaseClassStorageName, GetStorageName()]); ! end ! else ! Text := ''; end; *************** *** 614,615 **** --- 592,595 ---- + + |