summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-22 09:30:36 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-10-22 09:30:36 +0000
commit88ee46de57e74eeb01ad6b1e8cf3da9ff60259c0 (patch)
tree34ab69f343337cc9486511f68af2f109c02a3ffc
parent0830146bd2221d1ac5177c20b4b5e22ba48ad53c (diff)
downloadfpGUI-88ee46de57e74eeb01ad6b1e8cf3da9ff60259c0.tar.xz
* Minor update to the tiOPF generic edit mediators unit.
* Correctly set the default values for Form and PageControl components. * Improved the UI Designer so only non-default values for Boolean and Enum types are written to file.
-rw-r--r--examples/apps/uidesigner/vfdprops.pas23
-rw-r--r--examples/gui/alignment/aligntest.lpi2
-rw-r--r--examples/gui/filedialog/filedialog.lpi9
-rw-r--r--examples/gui/fontselect/fontselect.lpi107
-rw-r--r--extras/tiopf/gui/tiGenericEditMediators.pas5
-rw-r--r--src/gui/gui_form.pas4
-rw-r--r--src/gui/gui_tab.pas10
7 files changed, 85 insertions, 75 deletions
diff --git a/examples/apps/uidesigner/vfdprops.pas b/examples/apps/uidesigner/vfdprops.pas
index e4bf9912..fd6c37dc 100644
--- a/examples/apps/uidesigner/vfdprops.pas
+++ b/examples/apps/uidesigner/vfdprops.pas
@@ -422,13 +422,20 @@ function TPropertyBoolean.GetPropertySource(wg: TfpgWidget; const ident: string)
var
i: integer;
s: string;
+ PropInfo: PPropInfo;
begin
+ PropInfo := GetPropInfo(wg.ClassType, Name);
i := GetOrdProp(wg, Name);
- if i = 1 then
- s := 'True'
+ if PropInfo^.Default <> i then
+ begin
+ if i = 1 then
+ s := 'True'
+ else
+ s := 'False';
+ Result := ident + Name + ' := ' + s + ';' + LineEnding;
+ end
else
- s := 'False';
- Result := ident + Name + ' := ' + s + ';' + LineEnding;
+ Result := '';
end;
function TPropertyBoolean.GetValueText(wg: TfpgWidget): string;
@@ -516,8 +523,14 @@ begin
end;
function TPropertyEnum.GetPropertySource(wg: TfpgWidget; const ident: string): string;
+var
+ PropInfo: PPropInfo;
begin
- Result := ident + Name + ' := ' + GetEnumProp(wg, Name) + ';' + LineEnding;
+ PropInfo := GetPropInfo(wg.ClassType, Name);
+ if PropInfo^.Default <> GetOrdProp(wg, Name) then
+ Result := ident + Name + ' := ' + GetEnumProp(wg, Name) + ';' + LineEnding
+ else
+ Result := '';
end;
function TPropertyEnum.ParseSourceLine(wg: TfpgWidget; const line: string): boolean;
diff --git a/examples/gui/alignment/aligntest.lpi b/examples/gui/alignment/aligntest.lpi
index d69be9b7..4279af4a 100644
--- a/examples/gui/alignment/aligntest.lpi
+++ b/examples/gui/alignment/aligntest.lpi
@@ -2,7 +2,7 @@
<CONFIG>
<ProjectOptions>
<PathDelim Value="\"/>
- <Version Value="5"/>
+ <Version Value="6"/>
<General>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
diff --git a/examples/gui/filedialog/filedialog.lpi b/examples/gui/filedialog/filedialog.lpi
index 06092817..93c2d7b0 100644
--- a/examples/gui/filedialog/filedialog.lpi
+++ b/examples/gui/filedialog/filedialog.lpi
@@ -1,15 +1,15 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value=".\"/>
+ <IconPath Value="./"/>
<TargetFileExt Value=""/>
</General>
<VersionInfo>
@@ -23,7 +23,7 @@
<RunParams>
<local>
<FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -42,7 +42,6 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
- <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/examples/gui/fontselect/fontselect.lpi b/examples/gui/fontselect/fontselect.lpi
index 7cb6ee37..d23df471 100644
--- a/examples/gui/fontselect/fontselect.lpi
+++ b/examples/gui/fontselect/fontselect.lpi
@@ -1,54 +1,53 @@
-<?xml version="1.0"?>
-<CONFIG>
- <ProjectOptions>
- <PathDelim Value="\"/>
- <Version Value="5"/>
- <General>
- <Flags>
- <SaveOnlyProjectUnits Value="True"/>
- </Flags>
- <SessionStorage Value="InProjectDir"/>
- <MainUnit Value="0"/>
- <IconPath Value=".\"/>
- <TargetFileExt Value=""/>
- </General>
- <VersionInfo>
- <ProjectVersion Value=""/>
- </VersionInfo>
- <PublishOptions>
- <Version Value="2"/>
- <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
- <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
- </PublishOptions>
- <RunParams>
- <local>
- <FormatVersion Value="1"/>
- <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
- </local>
- </RunParams>
- <RequiredPackages Count="1">
- <Item1>
- <PackageName Value="fpgui_package"/>
- <MinVersion Minor="5" Valid="True"/>
- </Item1>
- </RequiredPackages>
- <Units Count="1">
- <Unit0>
- <Filename Value="fontselect.lpr"/>
- <IsPartOfProject Value="True"/>
- <UnitName Value="fontselect"/>
- </Unit0>
- </Units>
- </ProjectOptions>
- <CompilerOptions>
- <Version Value="5"/>
- <PathDelim Value="\"/>
- <CodeGeneration>
- <Generate Value="Faster"/>
- </CodeGeneration>
- <Other>
- <CustomOptions Value="-FUunits"/>
- <CompilerPath Value="$(CompPath)"/>
- </Other>
- </CompilerOptions>
-</CONFIG>
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="/"/>
+ <Version Value="6"/>
+ <General>
+ <Flags>
+ <SaveOnlyProjectUnits Value="True"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <IconPath Value="./"/>
+ <TargetFileExt Value=""/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
+ <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/>
+ </PublishOptions>
+ <RunParams>
+ <local>
+ <FormatVersion Value="1"/>
+ <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/>
+ </local>
+ </RunParams>
+ <RequiredPackages Count="1">
+ <Item1>
+ <PackageName Value="fpgui_package"/>
+ <MinVersion Minor="5" Valid="True"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="1">
+ <Unit0>
+ <Filename Value="fontselect.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="fontselect"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CustomOptions Value="-FUunits"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/extras/tiopf/gui/tiGenericEditMediators.pas b/extras/tiopf/gui/tiGenericEditMediators.pas
index ea483612..878bbed9 100644
--- a/extras/tiopf/gui/tiGenericEditMediators.pas
+++ b/extras/tiopf/gui/tiGenericEditMediators.pas
@@ -373,13 +373,12 @@ end;
procedure TMediatorView.GuiToObject;
begin
- Subject.PropValue[FieldName] := TypInfo.GetPropValue((FEditControl as ComponentClass), GuiFieldName);
+ Subject.PropValue[FieldName] := TypInfo.GetPropValue(FEditControl, GuiFieldName);
end;
procedure TMediatorView.ObjectToGui;
begin
- TypInfo.SetPropValue( (FEditControl as ComponentClass), GuiFieldName,
- Subject.PropValue[FieldName]);
+ TypInfo.SetPropValue(FEditControl, GuiFieldName, Subject.PropValue[FieldName]);
end;
procedure TMediatorView.SetupGUIandObject;
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 0efac32b..14291e15 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -74,8 +74,8 @@ type
property ModalResult: integer read FModalResult write FModalResult;
published
{$Note Refactor this to a TfpgCustomForm and only surface it here }
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
- property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition;
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition default wpAuto;
property WindowTitle: string read FWindowTitle write SetWindowTitle;
property OnActivate: TNotifyEvent read FOnActivate write FOnActivate;
property OnClose: TNotifyEvent read FOnClose write FOnClose;
diff --git a/src/gui/gui_tab.pas b/src/gui/gui_tab.pas
index d0b4640e..e33e0e97 100644
--- a/src/gui/gui_tab.pas
+++ b/src/gui/gui_tab.pas
@@ -126,11 +126,11 @@ type
property OnChange: TTabSheetChange read FOnChange write FOnChange;
published
property ActivePageIndex: integer read GetActivePageIndex write SetActivePageIndex;
- property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor;
- property FixedTabWidth: integer read FFixedTabWidth write SetFixedTabWidth;
- property SortPages: boolean read FSortPages write SetSortPages;
- property Style: TfpgTabStyle read FStyle write SetStyle;
- property TabPosition: TfpgTabPosition read FTabPosition write SetTabPosition;
+ property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor default clWindowBackground;
+ property FixedTabWidth: integer read FFixedTabWidth write SetFixedTabWidth default 0;
+ property SortPages: boolean read FSortPages write SetSortPages default False;
+ property Style: TfpgTabStyle read FStyle write SetStyle default tsTabs;
+ property TabPosition: TfpgTabPosition read FTabPosition write SetTabPosition default tpTop;
end;