diff options
author | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-16 15:48:49 +0200 |
---|---|---|
committer | Graeme Geldenhuys <graeme@mastermaths.co.za> | 2010-11-16 15:48:49 +0200 |
commit | df01cca8ddbcbaf2208bac4feee911bec5c77def (patch) | |
tree | 728c7262055cd7266d2e177841abc85044a0dbf6 /uidesigner/vfdfile.pas | |
parent | a153120f574ab425e1f3e60bea6f1d6d4f131742 (diff) | |
download | fpGUI-df01cca8ddbcbaf2208bac4feee911bec5c77def.tar.xz |
UIDesigner: has a new option to include/exclude code regions in new dialogs/forms
Diffstat (limited to 'uidesigner/vfdfile.pas')
-rw-r--r-- | uidesigner/vfdfile.pas | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/uidesigner/vfdfile.pas b/uidesigner/vfdfile.pas index ea7bf268..0644fb78 100644 --- a/uidesigner/vfdfile.pas +++ b/uidesigner/vfdfile.pas @@ -64,6 +64,9 @@ type implementation +uses + fpg_iniutils; + const cBlockPrefix = '{@VFD_'; @@ -100,15 +103,30 @@ end; procedure TVFDFile.AddNewFormImpl(formname, formbody: string); var s: string; + lUseRegions: boolean; + lRegionTop, lRegionBottom: string; begin + { Does the developer code regions or not - a Lazarus IDE feature } + lUseRegions := gINI.ReadBool('Options', 'UseCodeRegions', True); + if lUseRegions then + begin + lRegionTop := ' {%region ''Auto-generated GUI code'' -fold}' + LineEnding; + lRegionBottom := ' {%endregion}' + LineEnding; + end + else + begin + lRegionTop := ''; + lRegionBottom := ''; + end; + s := LineEnding + LineEnding + 'procedure T' + formname + '.AfterCreate;' + LineEnding + 'begin' + LineEnding + - ' {%region ''Auto-generated GUI code'' -fold}' + LineEnding + + lRegionTop + ' {@VFD_BODY_BEGIN: ' + formname + '}' + LineEnding + formbody + ' {@VFD_BODY_END: ' + formname + '}' + LineEnding + - ' {%endregion}' + LineEnding + + lRegionBottom + 'end;' + LineEnding; NewFormsImpl := NewFormsImpl + s; end; |