defaultElementForm, defaultAttributeForm : Type Library Editor Support.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4232 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
inoussa
2015-07-30 19:16:53 +00:00
parent 5622ce75fd
commit f666da77a0
2 changed files with 95 additions and 21 deletions

View File

@ -1,6 +1,6 @@
object fModuleEdit: TfModuleEdit
Left = 750
Height = 300
Height = 326
Top = 93
Width = 400
HorzScrollBar.Page = 399
@ -8,14 +8,14 @@ object fModuleEdit: TfModuleEdit
ActiveControl = Button1
BorderStyle = bsSizeToolWin
Caption = 'Module properties'
ClientHeight = 300
ClientHeight = 326
ClientWidth = 400
Position = poDesktopCenter
LCLVersion = '1.2.2.0'
LCLVersion = '1.4.1.0'
object Panel1: TPanel
Left = 0
Height = 50
Top = 250
Top = 276
Width = 400
Align = alBottom
ClientHeight = 50
@ -45,7 +45,7 @@ object fModuleEdit: TfModuleEdit
end
object PageControl1: TPageControl
Left = 0
Height = 250
Height = 276
Top = 0
Width = 400
ActivePage = TabSheet1
@ -54,47 +54,93 @@ object fModuleEdit: TfModuleEdit
TabOrder = 1
object TabSheet1: TTabSheet
Caption = 'Module'
ClientHeight = 222
ClientHeight = 250
ClientWidth = 392
object Label1: TLabel
Left = 20
Height = 15
Top = 39
Width = 32
Height = 13
Top = 24
Width = 27
Caption = 'Name'
ParentColor = False
end
object Label2: TLabel
Left = 20
Height = 15
Top = 127
Width = 62
Height = 13
Top = 77
Width = 55
Caption = 'Namespace'
ParentColor = False
end
object edtName: TEdit
Left = 20
Height = 23
Top = 55
Width = 344
Height = 21
Top = 40
Width = 356
Anchors = [akTop, akLeft, akRight]
TabOrder = 0
Text = 'edtName'
end
object edtNamespace: TEdit
Left = 20
Height = 23
Top = 143
Width = 344
Height = 21
Top = 93
Width = 356
Anchors = [akTop, akLeft, akRight]
TabOrder = 1
Text = 'edtNamespace'
end
object edtDefaultElementForm: TRadioGroup
Left = 20
Height = 108
Top = 132
Width = 170
AutoFill = True
Caption = ' Default Element Form '
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 90
ClientWidth = 166
Items.Strings = (
'<unspecified>'
'qualified'
'unqualified'
)
TabOrder = 2
end
object edtDefaultAttributeForm: TRadioGroup
Left = 206
Height = 108
Top = 132
Width = 170
AutoFill = True
Caption = ' Default Attribute Form '
ChildSizing.LeftRightSpacing = 6
ChildSizing.EnlargeHorizontal = crsHomogenousChildResize
ChildSizing.EnlargeVertical = crsHomogenousChildResize
ChildSizing.ShrinkHorizontal = crsScaleChilds
ChildSizing.ShrinkVertical = crsScaleChilds
ChildSizing.Layout = cclLeftToRightThenTopToBottom
ChildSizing.ControlsPerLine = 1
ClientHeight = 90
ClientWidth = 166
Items.Strings = (
'<unspecified>'
'qualified'
'unqualified'
)
TabOrder = 3
end
end
end
object AL: TActionList
left = 115
top = 126
left = 136
top = 32
object actOK: TAction
Caption = 'OK'
OnExecute = actOKExecute

View File

@ -19,7 +19,7 @@ interface
uses
Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, ExtCtrls,
ComCtrls, StdCtrls, ActnList, Buttons,
pastree, pascal_parser_intf,
pastree, pascal_parser_intf, xsd_consts,
edit_helper;
type
@ -37,6 +37,8 @@ type
Label2: TLabel;
PageControl1: TPageControl;
Panel1: TPanel;
edtDefaultElementForm: TRadioGroup;
edtDefaultAttributeForm: TRadioGroup;
TabSheet1: TTabSheet;
procedure actOKExecute(Sender: TObject);
procedure actOKUpdate(Sender: TObject);
@ -73,16 +75,42 @@ begin
TAction(Sender).Enabled := not ( IsStrEmpty(edtName.Text) or IsStrEmpty(edtNamespace.Text));
end;
function FormStringToIndex(const AStr : string) : Integer;
begin
if (AStr = s_qualified) then
Result := 1
else if (AStr = s_unqualified) then
Result := 2
else
Result := 0;
end;
procedure TfModuleEdit.LoadFromObject();
var
s : string;
begin
edtName.Text := FSymbolTable.GetExternalName(FObject);
edtNamespace.Text := FSymbolTable.GetExternalName(FObject);
s := FSymbolTable.Properties.GetValue(FObject,s_elementFormDefault);
edtDefaultElementForm.ItemIndex := FormStringToIndex(s);
s := FSymbolTable.Properties.GetValue(FObject,s_attributeFormDefault);
edtDefaultAttributeForm.ItemIndex := FormStringToIndex(s);
end;
procedure TfModuleEdit.SaveToObject();
var
s : string;
begin
FObject.Name := ExtractIdentifier(edtName.Text);
FSymbolTable.RegisterExternalAlias(FObject,Trim(edtNamespace.Text));
s := '';
if (edtDefaultElementForm.ItemIndex > 0) then
s := edtDefaultElementForm.Items[edtDefaultElementForm.ItemIndex];
FSymbolTable.Properties.SetValue(FObject,s_elementFormDefault,s);
s := '';
if (edtDefaultAttributeForm.ItemIndex > 0) then
s := edtDefaultAttributeForm.Items[edtDefaultAttributeForm.ItemIndex];
FSymbolTable.Properties.SetValue(FObject,s_attributeFormDefault,s);
end;
function TfModuleEdit.UpdateObject(