|
From: <wp...@us...> - 2009-08-19 20:54:17
|
Revision: 853
http://instantobjects.svn.sourceforge.net/instantobjects/revision/?rev=853&view=rev
Author: wp2udk
Date: 2009-08-19 20:54:06 +0000 (Wed, 19 Aug 2009)
Log Message:
-----------
Modified Paths:
--------------
trunk/Source/Brokers/BDE/InstantBDE.pas
trunk/Source/Core/InstantCode.pas
trunk/Source/Core/InstantMetadata.pas
trunk/Source/Core/InstantPersistence.pas
trunk/Source/Core/InstantPresentation.pas
trunk/Source/Core/InstantTypes.pas
trunk/Source/Design/InstantAttributeEditor.dfm
trunk/Source/Design/InstantAttributeEditor.pas
trunk/Source/Design/InstantClassEditor.dfm
trunk/Source/Design/InstantClassEditor.pas
trunk/Source/Design/InstantModelExplorer.pas
Modified: trunk/Source/Brokers/BDE/InstantBDE.pas
===================================================================
--- trunk/Source/Brokers/BDE/InstantBDE.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Brokers/BDE/InstantBDE.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -24,7 +24,7 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
- * Carlo Barazzetta, Nando Dessena, Steven Mitchell
+ * Carlo Barazzetta, Nando Dessena, Steven Mitchell, Brian Andersen
*
* ***** END LICENSE BLOCK ***** *)
@@ -405,7 +405,7 @@
procedure CreateTable(TableMetadata: TInstantTableMetadata);
const
FieldTypes: array[TInstantDataType] of TFieldType =
- (ftInteger, ftFloat, ftBCD, ftBoolean, ftString, ftMemo, ftDateTime, ftBlob, ftDate, ftTime);
+ (ftInteger, ftFloat, ftBCD, ftBoolean, ftString, ftMemo, ftDateTime, ftBlob, ftDate, ftTime, ftInteger);
var
I: Integer;
Table: TTable;
@@ -758,7 +758,7 @@
procedure TInstantDBBuildBDEAddTableCommand.InternalExecute;
const
FieldTypes: array[TInstantDataType] of TFieldType =
- (ftInteger, ftFloat, ftCurrency, ftBoolean, ftString, ftMemo, ftDateTime, ftBlob, ftDate, ftTime);
+ (ftInteger, ftFloat, ftCurrency, ftBoolean, ftString, ftMemo, ftDateTime, ftBlob, ftDate, ftTime, ftInteger);
var
I: Integer;
Table: TTable;
Modified: trunk/Source/Core/InstantCode.pas
===================================================================
--- trunk/Source/Core/InstantCode.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Core/InstantCode.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -589,6 +589,7 @@
function GetIncludeRemoveMethod: Boolean;
function GetIsComplex: Boolean;
function GetIsContainer: Boolean;
+ function GetIsEnum: Boolean;
function GetIsIndexed: Boolean;
function GetIsRequired: Boolean;
function GetMetadata: TInstantAttributeMetadata;
@@ -669,6 +670,7 @@
property Owner: TInstantCodeMetadataInfo read GetOwner;
property IsComplex: Boolean read GetIsComplex;
property IsContainer: Boolean read GetIsContainer;
+ property IsEnum: Boolean read GetIsEnum;
property PropTypeName: string read GetPropTypeName write SetPropTypeName;
property ValueGetterCode: string read GetValueGetterCode;
property ValuePropName: string read GetValuePropName;
@@ -1554,6 +1556,12 @@
procedure InternalRead; override;
end;
+ TEnumTypeProcessor = class(TSimpleTypeProcessor)
+ protected
+ procedure InternalRead; override;
+ procedure HandleArgument(Index: Integer; const Argument: string); override;
+ end;
+
const
{$IFDEF MSWINDOWS}
CRLF = #13#10;
@@ -1616,15 +1624,16 @@
'Boolean',
'string',
'TDateTime',
- '', // atBlob
- '', // atMemo
- '', // atGraphic
- '', // atPart
- '', // atReference
- '', // atParts,
+ '', // atBlob
+ '', // atMemo
+ '', // atGraphic
+ '', // atPart
+ '', // atReference
+ '', // atParts,
'', // atReferences
'TDate',
- 'TTime');
+ 'TTime',
+ ''); // atEnum
begin
for Result := Low(Result) to High(Result) do
if SameText(PropType, TypeNames[Result]) then
@@ -1652,6 +1661,7 @@
AddObject('Reference', TObjectTypeProcessor.Create);
AddObject('Parts', TContainerTypeProcessor.Create);
AddObject('References', TContainerTypeProcessor.Create);
+ AddObject('Enum', TEnumTypeProcessor.Create);
end;
end;
@@ -3582,15 +3592,24 @@
function TInstantCodeAttributeTailor.GetValueGetterCode: string;
begin
- Result := 'Result := ' + FieldValueName;
- if Attribute.IsComplex then
- Result := Result + ' as ' + Attribute.PropTypeName;
+ Result := 'Result := ';
+ if not Attribute.IsEnum then
+ begin
+ Result := Result + FieldValueName;
+ if Attribute.IsComplex then
+ Result := Result + ' as ' + Attribute.PropTypeName;
+ end else
+ Result := Result + Attribute.Metadata.EnumName + '(' + FieldValueName + ')';
+
Result := Result + ';';
end;
function TInstantCodeAttributeTailor.GetValueSetterCode: string;
+const
+ SetterText: array[Boolean] of string =
+ ('Value;', 'Ord(Value)');
begin
- Result := FieldValueName + ' := Value;';
+ Result := FieldValueName + ' := ' + SetterText[Attribute.IsEnum] + ';';
end;
procedure TInstantCodeAttributeTailor.SetIsArray(Value: Boolean);
@@ -3757,6 +3776,8 @@
Params := ObjectClassName
else if (AttributeType in [atString, atMemo]) and (Size > 0) then
Params := IntToStr(Size)
+ else if AttributeType = atEnum then
+ Params := EnumName
else
Exit;
Result := Result + '(' + Params + ')';
@@ -3828,6 +3849,12 @@
Metadata.AttributeClass.InheritsFrom(TInstantContainer);
end;
+function TInstantCodeAttribute.GetIsEnum: Boolean;
+begin
+ Result := Assigned(Metadata.AttributeClass) and
+ Metadata.AttributeClass.InheritsFrom(TInstantEnum);
+end;
+
function TInstantCodeAttribute.GetIsDefault: Boolean;
begin
Result := Metadata.IsDefault;
@@ -3907,9 +3934,13 @@
Result := InstantAttributeTypeToPropertyType(AttributeType);
if Result = '' then
with Metadata do
- if Assigned(AttributeClass) and
- AttributeClass.InheritsFrom(TInstantComplex) then
- Result := ObjectClassName;
+ if Assigned(AttributeClass) then
+ begin
+ if AttributeClass.InheritsFrom(TInstantComplex) then
+ Result := ObjectClassName else
+ if AttributeClass.InheritsFrom(TInstantEnum) then
+ Result := EnumName;
+ end;
end;
function TInstantCodeAttribute.GetReadOnly: Boolean;
@@ -8952,6 +8983,48 @@
end;
end;
+{ TEnumTypeProcessor }
+
+procedure TEnumTypeProcessor.HandleArgument(Index: Integer;
+ const Argument: string);
+//var
+// CodeObject: TInstantCodeObject;
+begin
+ case Index of
+ 1:
+ if IsValidIdent(Argument) then
+ begin
+// Code disabled: This checks if the Enumerated type exists. But it
+// only works if the type exists in the same unit as the
+// model.
+// Assert(FModule = nil, 'xxx');
+// if FModule <> nil then
+// begin
+// CodeObject := FModule.InterfaceSection.FindTypes.Find(Argument);
+// CodeObject := FModule.FindType(Argument);
+
+// if not Assigned(CodeObject) then
+// Error(Format('Identifier not found: %s', [Argument])) else
+// if CodeObject is TInstantCodeEnum then
+// begin
+ FMetadata.EnumName := Argument;
+// FMetadata.EnumValues := (CodeObject as TInstantCodeEnum).FItems;
+// end else
+// Error(Format('Enumerated type expected: %s', [Argument]));
+// end else
+// Error(Format('Invalid identifier name: %s', [Argument]));
+ end
+ else
+ inherited;
+ end;
+end;
+
+procedure TEnumTypeProcessor.InternalRead;
+begin
+ inherited;
+
+end;
+
initialization
CreateTypeProcessors;
Modified: trunk/Source/Core/InstantMetadata.pas
===================================================================
--- trunk/Source/Core/InstantMetadata.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Core/InstantMetadata.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -474,6 +474,7 @@
FStorageKind: TInstantStorageKind;
FExternalStorageName: string;
FValidator: TInstantValidator;
+ FEnumName: string;
function GetAttributeClass: TInstantAbstractAttributeClass;
function GetAttributeClassName: string;
function GetAttributeTypeName: string;
@@ -550,6 +551,7 @@
property StorageName: string read FStorageName write FStorageName;
property ValidCharsString: string read GetValidCharsString
write SetValidCharsString;
+ property EnumName: string read FEnumName write FEnumName;
end;
TInstantAttributeMetadatas = class(TInstantMetadatas)
@@ -579,8 +581,8 @@
AttributeClasses: array[TInstantAttributeType] of TInstantAttributeClass = (
nil, TInstantInteger, TInstantFloat, TInstantCurrency, TInstantBoolean,
TInstantString, TInstantDateTime, TInstantBlob, TInstantMemo,
- TInstantGraphic, TInstantPart, TInstantReference, TInstantParts,
- TInstantReferences, TInstantDate, TInstantTime);
+ TInstantGraphic, TInstantPart, TInstantReference, TInstantParts,
+ TInstantReferences, TInstantDate, TInstantTime, TInstantEnum);
{ TInstantMetadata }
@@ -1695,6 +1697,7 @@
Self.FStorageKind := FStorageKind;
Self.FExternalStorageName := FExternalStorageName;
Self.FValidCharsString := FValidCharsString;
+ Self.FEnumName := FEnumName;
end;
end;
Modified: trunk/Source/Core/InstantPersistence.pas
===================================================================
--- trunk/Source/Core/InstantPersistence.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Core/InstantPersistence.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -743,6 +743,9 @@
property RefItems[Index: Integer]: TInstantObjectReference read GetRefItems;
end;
+ TInstantEnum = class(TInstantInteger)
+ end;
+
TInstantObjectState = class(TPersistent)
private
FIsChanged: Boolean;
@@ -1578,7 +1581,8 @@
const
InstantDataTypeStrings: array[TInstantDataType] of string =
- ('Integer', 'Float', 'Currency', 'Boolean', 'String', 'Memo', 'DateTime', 'Blob', 'Date', 'Time');
+ ('Integer', 'Float', 'Currency', 'Boolean', 'String', 'Memo', 'DateTime',
+ 'Blob', 'Date', 'Time', 'Integer');
procedure AssignInstantDataTypeStrings(Strings: TStrings);
@@ -1662,7 +1666,8 @@
dtBlob, //atParts
dtBlob, //atReferences
dtDate, //atDate
- dtTime); //atTime
+ dtTime, //atTime
+ dtEnum); //atEnum
DataTypesXML: array[TInstantAttributeType] of TInstantDataType = (
dtString, //atUnknown
@@ -1680,7 +1685,8 @@
dtMemo, //atParts
dtMemo, //atReferences
dtDate, //atDate
- dtTime); //atTime
+ dtTime, //atTime
+ dtEnum); //atEnum
begin
if BlobStreamFormat = sfBinary then
Result := DataTypesBinary[AttributeType]
Modified: trunk/Source/Core/InstantPresentation.pas
===================================================================
--- trunk/Source/Core/InstantPresentation.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Core/InstantPresentation.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -816,7 +816,7 @@
FieldTypes: array[TInstantAttributeType] of TFieldType = (
ftUnknown, ftInteger, ftFloat, ftBCD, ftBoolean, ftString, ftDateTime,
ftBlob, ftMemo, ftBlob, ftInteger, ftInteger, ftDataSet, ftDataSet,
- ftDate, ftTime);
+ ftDate, ftTime, ftInteger);
begin
Result := FieldTypes[AttributeType];
end;
Modified: trunk/Source/Core/InstantTypes.pas
===================================================================
--- trunk/Source/Core/InstantTypes.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Core/InstantTypes.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -26,7 +26,7 @@
* Contributor(s):
* Carlo Barazzetta, Andrea Petrelli, Nando Dessena, Steven Mitchell,
* Joao Morais, Cesar Coll, Uberto Barbini, David Taylor, Hanedi Salas,
- * Riceball Lee, David Moorhouse
+ * Riceball Lee, David Moorhouse, Brian Andersen
*
* ***** END LICENSE BLOCK ***** *)
@@ -49,7 +49,7 @@
TInstantStorageKind = (skEmbedded, skExternal);
TInstantAttributeType = (atUnknown, atInteger, atFloat, atCurrency, atBoolean,
atString, atDateTime, atBlob, atMemo, atGraphic,
- atPart, atReference, atParts, atReferences, atDate, atTime);
+ atPart, atReference, atParts, atReferences, atDate, atTime, atEnum);
TInstantAttributeCategory = (acUnknown, acSimple, acElement, acContainer);
TInstantGraphicFileFormat = (gffUnknown, gffBmp, gffTiff, gffJpeg, gffPng,
@@ -58,7 +58,7 @@
TInstantPersistence = (peEmbedded, peStored);
TInstantDataType = (dtInteger, dtFloat, dtCurrency, dtBoolean, dtString,
- dtMemo, dtDateTime, dtBlob, dtDate, dtTime);
+ dtMemo, dtDateTime, dtBlob, dtDate, dtTime, dtEnum);
TInstantDataTypes = set of TInstantDataType;
TInstantFieldOption = (foRequired, foIndexed);
TInstantFieldOptions = set of TInstantFieldOption;
Modified: trunk/Source/Design/InstantAttributeEditor.dfm
===================================================================
--- trunk/Source/Design/InstantAttributeEditor.dfm 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Design/InstantAttributeEditor.dfm 2009-08-19 20:54:06 UTC (rev 853)
@@ -1,9 +1,9 @@
inherited InstantAttributeEditorForm: TInstantAttributeEditorForm
Left = 78
Top = 485
- Width = 249
- Height = 358
Caption = 'Attribute Editor'
+ ClientHeight = 371
+ ClientWidth = 241
ParentFont = True
OldCreateOrder = True
OnCreate = FormCreate
@@ -11,12 +11,12 @@
TextHeight = 13
inherited EditPanel: TPanel
Width = 241
- Height = 293
+ Height = 340
object PageControl: TPageControl
Left = 4
Top = 4
Width = 233
- Height = 285
+ Height = 332
ActivePage = DefinitionSheet
Align = alClient
TabOrder = 0
@@ -25,7 +25,7 @@
object NameLabel: TLabel
Left = 8
Top = 8
- Width = 28
+ Width = 27
Height = 13
Caption = '&Name'
FocusControl = NameEdit
@@ -41,14 +41,14 @@
object ObjectClassLabel: TLabel
Left = 8
Top = 88
- Width = 59
+ Width = 60
Height = 13
Caption = 'Object &Class'
FocusControl = ObjectClassEdit
end
object StorageNameLabel: TLabel
Left = 8
- Top = 128
+ Top = 176
Width = 68
Height = 13
Caption = '&Storage Name'
@@ -57,27 +57,35 @@
object SizeLabel: TLabel
Left = 160
Top = 48
- Width = 20
+ Width = 19
Height = 13
Caption = 'Si&ze'
FocusControl = SizeEdit
end
object ExternalStorageNameLabel: TLabel
Left = 8
- Top = 214
- Width = 109
+ Top = 262
+ Width = 111
Height = 13
Caption = '&External Storage Name'
FocusControl = ExternalStorageNameEdit
end
object StorageKindLabel: TLabel
Left = 8
- Top = 168
+ Top = 216
Width = 61
Height = 13
Caption = 'Storage &Kind'
FocusControl = StorageKindEdit
end
+ object EnumeratedTypeLabel: TLabel
+ Left = 7
+ Top = 132
+ Width = 83
+ Height = 13
+ Caption = '&Enumerated type'
+ FocusControl = EnumeratedTypeEdit
+ end
object NameEdit: TDBEdit
Left = 7
Top = 24
@@ -117,7 +125,7 @@
end
object StorageNameEdit: TDBEdit
Left = 7
- Top = 144
+ Top = 192
Width = 210
Height = 21
DataField = 'StorageName'
@@ -136,7 +144,7 @@
end
object ExternalStorageNameEdit: TDBEdit
Left = 7
- Top = 231
+ Top = 279
Width = 210
Height = 21
DataField = 'ExternalStorageName'
@@ -146,7 +154,7 @@
end
object StorageKindEdit: TDBComboBox
Left = 7
- Top = 184
+ Top = 232
Width = 210
Height = 21
Style = csDropDownList
@@ -159,7 +167,7 @@
end
object AutoExternalStorageNameCheckBox: TCheckBox
Left = 172
- Top = 212
+ Top = 260
Width = 45
Height = 17
Alignment = taLeftJustify
@@ -167,6 +175,18 @@
TabOrder = 7
OnClick = AutoExternalStorageNameCheckBoxClick
end
+ object EnumeratedTypeEdit: TDBComboBox
+ Left = 7
+ Top = 149
+ Width = 210
+ Height = 21
+ DataField = 'Metadata.EnumName'
+ DataSource = SubjectSource
+ ItemHeight = 13
+ TabOrder = 8
+ OnChange = EnumeratedTypeEditChange
+ OnEnter = EnumeratedTypeEditEnter
+ end
end
object AccessSheet: TTabSheet
Caption = 'Access'
@@ -174,7 +194,7 @@
object VisibilityLabel: TLabel
Left = 8
Top = 8
- Width = 36
+ Width = 37
Height = 13
Caption = '&Visibility'
FocusControl = VisibilityEdit
@@ -182,7 +202,7 @@
object SingularNameLabel: TLabel
Left = 120
Top = 8
- Width = 69
+ Width = 68
Height = 13
Caption = '&Singular Name'
FocusControl = SingularNameEdit
@@ -195,7 +215,7 @@
Style = csDropDownList
DataField = 'Visibility'
DataSource = SubjectSource
- ItemHeight = 13
+ ItemHeight = 0
TabOrder = 0
end
object MethodsGroupBox: TGroupBox
@@ -318,7 +338,7 @@
object EdtMaskLabel: TLabel
Left = 8
Top = 8
- Width = 47
+ Width = 45
Height = 13
Caption = 'Edit &Mask'
FocusControl = EditMaskEdit
@@ -334,7 +354,7 @@
object ValidCharsLabel: TLabel
Left = 8
Top = 48
- Width = 77
+ Width = 78
Height = 13
Caption = '&Valid Characters'
FocusControl = ValidCharsEdit
@@ -387,7 +407,7 @@
end
end
inherited BottomPanel: TPanel
- Top = 293
+ Top = 340
Width = 241
inherited ButtonPanel: TPanel
Left = 81
Modified: trunk/Source/Design/InstantAttributeEditor.pas
===================================================================
--- trunk/Source/Design/InstantAttributeEditor.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Design/InstantAttributeEditor.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -24,7 +24,8 @@
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
- * Carlo Barazzetta, Adrea Petrelli, Nando Dessena, Steven Mitchell, David Moorhouse
+ * Carlo Barazzetta, Adrea Petrelli, Nando Dessena, Steven Mitchell,
+ * David Moorhouse, Brian Andersen
*
* ***** END LICENSE BLOCK ***** *)
@@ -116,6 +117,8 @@
StorageKindLabel: TLabel;
AutoExternalStorageNameCheckBox: TCheckBox;
OptionUseNullCheckBox: TCheckBox;
+ EnumeratedTypeLabel: TLabel;
+ EnumeratedTypeEdit: TDBComboBox;
procedure NameEditKeyPress(Sender: TObject; var Key: Char);
procedure FormCreate(Sender: TObject);
procedure NameEditChange(Sender: TObject);
@@ -132,6 +135,8 @@
procedure ExternalStorageNameEditChange(Sender: TObject);
procedure AutoExternalStorageNameCheckBoxClick(Sender: TObject);
procedure StorageNameEditChange(Sender: TObject);
+ procedure EnumeratedTypeEditChange(Sender: TObject);
+ procedure EnumeratedTypeEditEnter(Sender: TObject);
private
FBaseClassStorageName: string;
FLimited: Boolean;
@@ -148,8 +153,10 @@
protected
procedure LoadClasses;
procedure LoadData; override;
- procedure LoadEnums(TypeInfo: PTypeInfo; Items: TStrings;
- Values: Pointer);
+// Do not delete
+// procedure LoadEnums(TypeInfo: PTypeInfo; Items: TStrings;
+// Values: Pointer);
+ procedure LoadEnum;
procedure LoadTypes;
procedure LoadVisibilities;
procedure LoadStorageKind;
@@ -268,9 +275,10 @@
LoadOptions;
LoadMethods;
end;
+ LoadEnum;
end;
-procedure TInstantAttributeEditorForm.LoadEnums(TypeInfo: PTypeInfo;
+{procedure TInstantAttributeEditorForm.LoadEnums(TypeInfo: PTypeInfo;
Items: TStrings; Values: Pointer);
type
PByteSet = ^TByteSet;
@@ -302,7 +310,7 @@
finally
Names.Free;
end;
-end;
+end; }
procedure TInstantAttributeEditorForm.LoadStorageKind;
begin
@@ -310,6 +318,31 @@
SubjectExposer.GetFieldStrings(StorageKindEdit.Field, StorageKindEdit.Items);
end;
+procedure TInstantAttributeEditorForm.LoadEnum;
+var
+ I: Integer;
+ CodeType: TInstantCodeType;
+begin
+ EnumeratedTypeEdit.Items.BeginUpdate;
+ try
+ EnumeratedTypeEdit.Clear;
+ if Assigned(FModel) then
+ begin
+ for I := 0 to Pred(FModel.TypeCount) do
+ begin
+ CodeType := FModel.Types[I];
+ if CodeType is TInstantCodeEnum then
+ EnumeratedTypeEdit.Items.AddObject(CodeType.Name, CodeType);
+ end;
+ end;
+
+ EnumeratedTypeEdit.ItemIndex :=
+ EnumeratedTypeEdit.Items.IndexOf(SubjectExposer.FieldByName('Metadata.EnumName').AsString);
+ finally
+ EnumeratedTypeEdit.Items.EndUpdate;
+ end;
+end;
+
procedure TInstantAttributeEditorForm.LoadTypes;
procedure RestrictForComplexAttr;
@@ -547,6 +580,7 @@
LoadTypes;
LoadVisibilities;
LoadStorageKind;
+ LoadEnum;
UpdateControls;
ComputeExternalStorageName;
end;
@@ -631,7 +665,7 @@
end;
var
- HasName, HasClass, IsComplex, IsContainer, CanBeExternal,
+ HasName, HasClass, HasEnum, IsComplex, IsContainer, IsEnum, CanBeExternal,
CanHaveStorageName, IsMaskable, IsString, IsValid: Boolean;
begin
CanBeExternal := False;
@@ -640,6 +674,7 @@
IsMaskable := False;
IsContainer := False;
IsString := False;
+ IsEnum := False;
if Assigned(Subject) then
begin
@@ -654,12 +689,14 @@
IsContainer := Subject.IsContainer;
CanHaveStorageName := Subject.CanHaveStorageName;
IsString := Subject.AttributeType in [atString, atMemo];
+ IsEnum := Subject.IsEnum;
end;
HasName := NameEdit.Text <> '';
HasClass := ObjectClassEdit.Text <> '';
+ HasEnum := EnumeratedTypeEdit.Text <> '';
- IsValid := HasName and (not IsComplex or HasClass);
+ IsValid := HasName and ((not IsComplex or HasClass)) or ((IsEnum) and (HasEnum));
DisableSubControls(DefinitionSheet, Limited);
DisableSubControls(AccessSheet, Limited);
@@ -681,6 +718,8 @@
EnableCtrl(StorageKindEdit, CanBeExternal and IsObjectClassPersistent);
EnableCtrl(StorageKindLabel, CanBeExternal and IsObjectClassPersistent);
+ EnableCtrl(EnumeratedTypeLabel, IsEnum);
+ EnableCtrl(EnumeratedTypeEdit, IsEnum);
end;
EnableCtrl(StorageNameLabel, CanHaveStorageName);
EnableCtrl(StorageNameEdit, CanHaveStorageName);
@@ -711,6 +750,18 @@
ComputeExternalStorageName;
end;
+procedure TInstantAttributeEditorForm.EnumeratedTypeEditChange(Sender: TObject);
+begin
+ inherited;
+ UpdateControls;
+end;
+
+procedure TInstantAttributeEditorForm.EnumeratedTypeEditEnter(Sender: TObject);
+begin
+ inherited;
+ LoadEnum;
+end;
+
procedure TInstantAttributeEditorForm.ExternalStorageNameEditChange(Sender:
TObject);
begin
Modified: trunk/Source/Design/InstantClassEditor.dfm
===================================================================
--- trunk/Source/Design/InstantClassEditor.dfm 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Design/InstantClassEditor.dfm 2009-08-19 20:54:06 UTC (rev 853)
@@ -139,6 +139,11 @@
Height = 170
end
end
+ inherited AttributesMenu: TPopupMenu
+ inherited AttributeNewItem: TMenuItem
+ OnClick = nil
+ end
+ end
end
end
end
Modified: trunk/Source/Design/InstantClassEditor.pas
===================================================================
--- trunk/Source/Design/InstantClassEditor.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Design/InstantClassEditor.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -281,6 +281,7 @@
if Value <> FModel then
begin
FModel := Value;
+ InstantAttributeViewFrame.Model := Value;
PopulateBaseClasses;
PopulateUnits;
end;
Modified: trunk/Source/Design/InstantModelExplorer.pas
===================================================================
--- trunk/Source/Design/InstantModelExplorer.pas 2009-08-19 20:25:12 UTC (rev 852)
+++ trunk/Source/Design/InstantModelExplorer.pas 2009-08-19 20:54:06 UTC (rev 853)
@@ -608,6 +608,7 @@
NewModel.AssignComponents(FModel);
FModel.Free;
FModel := NewModel;
+ InstantAttributeViewFrame.Model := FModel;
except
on E: Exception do
begin
|