diff options
Diffstat (limited to 'uidesigner')
-rw-r--r-- | uidesigner/extrafpc.cfg | 4 | ||||
-rw-r--r-- | uidesigner/icons.inc | 101 | ||||
-rw-r--r-- | uidesigner/images/scrollframe.bmp | bin | 0 -> 1618 bytes | |||
-rw-r--r-- | uidesigner/newformdesigner.pas | 119 | ||||
-rw-r--r-- | uidesigner/tests/frm_menutest.pas | 86 | ||||
-rw-r--r-- | uidesigner/tests/menutest.lpi | 57 | ||||
-rw-r--r-- | uidesigner/tests/menutest.lpr | 27 | ||||
-rw-r--r-- | uidesigner/tests/tabsheet_design.lpi | 58 | ||||
-rw-r--r-- | uidesigner/tests/tabsheet_design.lpr | 30 | ||||
-rw-r--r-- | uidesigner/tests/tabtest.pas | 226 | ||||
-rw-r--r-- | uidesigner/uidesigner.lpi | 11 | ||||
-rw-r--r-- | uidesigner/uidesigner.lpr | 9 | ||||
-rw-r--r-- | uidesigner/vfd_constants.pas | 91 | ||||
-rw-r--r-- | uidesigner/vfddesigner.pas | 31 | ||||
-rw-r--r-- | uidesigner/vfdfile.pas | 4 | ||||
-rw-r--r-- | uidesigner/vfdformparser.pas | 6 | ||||
-rw-r--r-- | uidesigner/vfdforms.pas | 136 | ||||
-rw-r--r-- | uidesigner/vfdmain.pas | 39 | ||||
-rw-r--r-- | uidesigner/vfdprops.pas | 12 | ||||
-rw-r--r-- | uidesigner/vfdwidgetclass.pas | 2 | ||||
-rw-r--r-- | uidesigner/vfdwidgets.pas | 6 |
21 files changed, 447 insertions, 608 deletions
diff --git a/uidesigner/extrafpc.cfg b/uidesigner/extrafpc.cfg index 06ab13a9..7804b795 100644 --- a/uidesigner/extrafpc.cfg +++ b/uidesigner/extrafpc.cfg @@ -3,3 +3,7 @@ -Xs -XX -CX +#ifdef mswindows +-WG +#endif + diff --git a/uidesigner/icons.inc b/uidesigner/icons.inc index b764e738..0e75a91f 100644 --- a/uidesigner/icons.inc +++ b/uidesigner/icons.inc @@ -3619,3 +3619,104 @@ const 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255, 255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0,255,255, 0, 255,255, 0,255,255, 0,255, 0, 0, 0); + + +const + stdimg_vfd_scrollframe: array[0..1617] of byte = ( + 66, 77, 82, 6, 0, 0, 0, 0, 0, 0,122, 0, 0, 0,108, 0, 0, + 0, 22, 0, 0, 0, 22, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 216, 5, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 66, 71, 82,115, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,146,119,119,146,119,119,146,119,119,146,119, + 119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146, + 119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119, + 146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119, 0, 0,146,119,119,193,192,194,193,192,194,193,192,194,193,192, + 194,146,119,119,255,252,251,201,188,186,255,252,251,201,188,186,255, + 252,251,146,119,119,193,192,194,193,192,194,193,192,194,193,192,194, + 146,119,119,237,239,239,237,239,239,237,239,239,237,239,239,146,119, + 119, 0, 0,146,119,119,193,192,194,137,137,137, 6, 8, 8,237,239, + 239,146,119,119,201,188,186,255,252,251,201,188,186,255,252,251,201, + 188,186,146,119,119,193,192,194, 4, 6, 7,137,137,137,237,239,239, + 146,119,119,237,239,239,237,239,239,237,239,239,237,239,239,146,119, + 119, 0, 0,146,119,119,193,192,194,122,122,122, 1, 1, 1,237,239, + 239,146,119,119,255,252,251,201,188,186,255,252,251,201,188,186,255, + 252,251,146,119,119,193,192,194, 1, 5, 6,122,122,122,237,239,239, + 146,119,119,237,239,239,237,239,239,237,239,239,237,239,239,146,119, + 119, 0, 0,146,119,119,193,192,194,237,239,239,237,239,239,237,239, + 239,146,119,119,201,188,186,255,252,251,201,188,186,255,252,251,201, + 188,186,146,119,119,193,192,194,237,239,239,237,239,239,237,239,239, + 146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119, 0, 0,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146, + 119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119, + 146,119,119,193,192,194,193,192,194,193,192,194,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239,122,122,122,137,137,137,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,148,145,148,148,145,148,148,145, + 148,148,145,148,148,145,148,148,145,148,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239, 1, 1, 1, 6, 8, 8,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,237,239,239,237,239, + 239,237,239,239,237,239,239,148,145,148,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239,237,239,239,237,239,239,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,237,239,239,237,239, + 239,237,239,239,237,239,239,148,145,148,255,255,255,148,145,148,148, + 145,148,148,145,148,148,145,148,148,145,148,148,145,148,255,255,255, + 146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,193,192,194,193,192, + 194,193,192,194,193,192,194,148,145,148,255,255,255,193,192,194,237, + 239,239,237,239,239,237,239,239,237,239,239,148,145,148,255,255,255, + 146,119,119,201,188,186,255,254,254,198,193,192,255,251,252,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,193,192,194,237, + 239,239,237,239,239,237,239,239,237,239,239,148,145,148,255,255,255, + 146,119,119,255,252,251,209,193,194,255,251,251,204,196,197,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,193,192,194,193, + 192,194,193,192,194,193,192,194,193,192,194,148,145,148,255,255,255, + 146,119,119,213,204,201,254,244,244,208,200,200,255,254,255,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,255,255,252,189,184,183,255,254,253,192,192,192,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,148,145,148,148, + 145,148,148,145,148,148,145,148,148,145,148,148,145,148,255,255,255, + 146,119,119,197,188,185,255,255,254,183,188,186,251,255,255,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,193,192,194,237, + 239,239,237,239,239,237,239,239,237,239,239,148,145,148,255,255,255, + 146,119,119,255,255,254,187,192,190,248,255,255,184,190,189,146,119, + 119, 0, 0,146,119,119,255,255,255,148,145,148,148,145,148,148,145, + 148,148,145,148,148,145,148,148,145,148,255,255,255,193,192,194,237, + 239,239,237,239,239,237,239,239,237,239,239,148,145,148,255,255,255, + 146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,237,239,239,237,239, + 239,237,239,239,237,239,239,148,145,148,255,255,255,193,192,194,193, + 192,194,193,192,194,193,192,194,193,192,194,148,145,148,255,255,255, + 146,119,119,193,192,194,193,192,194,193,192,194,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,237,239,239,237,239, + 239,237,239,239,237,239,239,148,145,148,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239, 1, 5, 6, 4, 6, 7,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,193,192,194,193,192,194,193,192, + 194,193,192,194,193,192,194,148,145,148,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239,122,122,122,137,137,137,193,192,194,146,119, + 119, 0, 0,146,119,119,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 146,119,119,237,239,239,237,239,239,237,239,239,193,192,194,146,119, + 119, 0, 0,146,119,119,146,119,119,146,119,119,146,119,119,146,119, + 119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,146, + 119,119,146,119,119,146,119,119,146,119,119,146,119,119,146,119,119, + 146,119,119,146,119,119,146,119,119,146,119,119,146,119,119,255,255, + 255, 0, 0); + diff --git a/uidesigner/images/scrollframe.bmp b/uidesigner/images/scrollframe.bmp Binary files differnew file mode 100644 index 00000000..3733100b --- /dev/null +++ b/uidesigner/images/scrollframe.bmp diff --git a/uidesigner/newformdesigner.pas b/uidesigner/newformdesigner.pas index eec39b12..31b9431d 100644 --- a/uidesigner/newformdesigner.pas +++ b/uidesigner/newformdesigner.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -61,6 +61,8 @@ type procedure miHelpAboutClick(Sender: TObject); procedure miHelpAboutGUI(Sender: TObject); procedure miMRUClick(Sender: TObject; const FileName: string); + procedure SetupCaptions; + procedure BuildThemePreviewMenu; public {@VFD_HEAD_BEGIN: frmMain} MainMenu: TfpgMenuBar; @@ -148,15 +150,17 @@ type TfrmAbout = class(TfpgForm) private {@VFD_HEAD_BEGIN: frmAbout} - lblName1: TfpgLabel; + lblAppName: TfpgLabel; lblVersion: TfpgLabel; - btnName1: TfpgButton; - lblName3: TfpgLabel; - lblName4: TfpgHyperlink; + btnClose: TfpgButton; + lblWrittenBy: TfpgLabel; + lblURL: TfpgHyperlink; lblCompiled: TfpgLabel; {@VFD_HEAD_END: frmAbout} + procedure SetupCaptions; + procedure FormShow(Sender: TObject); public - procedure AfterCreate; override; + procedure AfterCreate; override; class procedure Execute; end; @@ -172,9 +176,12 @@ implementation uses fpg_main, - vfdmain, fpg_iniutils, - fpg_dialogs; + fpg_dialogs, + fpg_constants, + fpg_stylemanager, + vfdmain, + vfd_constants; // Anchor images @@ -183,6 +190,25 @@ uses {@VFD_NEWFORM_IMPL} +procedure TfrmAbout.SetupCaptions; +begin + WindowTitle := rsDlgProductInfo; + lblAppName.Text := cAppName; + lblVersion.Text := Format(rsVersion, [cAppVersion]); + lblWrittenBy.Text := Format(rsWrittenBy, ['Graeme Geldenhuys']); + lblURL.URL := fpGUIWebsite; + lblURL.Text := fpGUIWebsite; + lblCompiled.Text := Format(rsCompiledOn, [{$I %date%} + ' ' + {$I %time%}]); + btnClose.Text := rsClose; +end; + +procedure TfrmAbout.FormShow(Sender: TObject); +begin + SetupCaptions; + lblURL.HotTrackColor := clBlue; + lblURL.TextColor := clRoyalBlue; +end; + procedure TfrmAbout.AfterCreate; begin {%region 'Auto-generated GUI code' -fold} @@ -191,13 +217,14 @@ begin SetPosition(378, 267, 276, 180); WindowTitle := 'Product Information...'; Hint := ''; - Sizeable := False; WindowPosition := wpScreenCenter; + Sizeable := False; + OnShow := @FormShow; - lblName1 := TfpgLabel.Create(self); - with lblName1 do + lblAppName := TfpgLabel.Create(self); + with lblAppName do begin - Name := 'lblName1'; + Name := 'lblAppName'; SetPosition(12, 16, 255, 31); FontDesc := 'Arial-20'; Hint := ''; @@ -215,14 +242,13 @@ begin Text := 'Version: %s'; end; - btnName1 := TfpgButton.Create(self); - with btnName1 do + btnClose := TfpgButton.Create(self); + with btnClose do begin - Name := 'btnName1'; + Name := 'btnClose'; SetPosition(194, 148, 75, 24); Anchors := [anRight,anBottom]; Text := 'Close'; - Down := False; FontDesc := '#Label1'; Hint := ''; ImageName := 'stdimg.close'; @@ -230,27 +256,28 @@ begin TabOrder := 2; end; - lblName3 := TfpgLabel.Create(self); - with lblName3 do + lblWrittenBy := TfpgLabel.Create(self); + with lblWrittenBy do begin - Name := 'lblName3'; + Name := 'lblWrittenBy'; SetPosition(12, 100, 241, 14); FontDesc := 'Arial-9'; Hint := ''; Text := 'Written by Graeme Geldenhuys'; end; - lblName4 := TfpgHyperlink.Create(self); - with lblName4 do + lblURL := TfpgHyperlink.Create(self); + with lblURL do begin - Name := 'lblName4'; + Name := 'lblURL'; SetPosition(12, 116, 246, 14); - Text := 'http://fpgui.sourceforge.net'; - URL := 'http://fpgui.sourceforge.net'; FontDesc := 'Arial-9:underline'; - TextColor := clRoyalBlue; + Hint := ''; HotTrackColor := clBlue; HotTrackFont := 'Arial-9:underline'; + Text := 'http://fpgui.sourceforge.net'; + TextColor := clRoyalBlue; + URL := 'http://fpgui.sourceforge.net'; end; lblCompiled := TfpgLabel.Create(self); @@ -273,8 +300,6 @@ var begin frm := TfrmAbout.Create(nil); try - frm.lblVersion.Text := Format(frm.lblVersion.Text, [program_version]); - frm.lblCompiled.Text := Format(frm.lblCompiled.Text, [ {$I %date%} + ' ' + {$I %time%}]); frm.ShowModal; finally frm.Free; @@ -314,7 +339,6 @@ begin Name := 'btnNewForm'; SetPosition(4, 28, 25, 24); Text := ''; - Down := False; FontDesc := '#Label1'; Hint := 'Add New Form to Unit'; ImageMargin := -1; @@ -331,9 +355,8 @@ begin Name := 'btnOpen'; SetPosition(30, 28, 25, 24); Text := ''; - Down := False; FontDesc := '#Label1'; - Hint := 'Open a file'; + Hint := ''; ImageMargin := -1; ImageName := 'stdimg.open'; ImageSpacing := 0; @@ -348,7 +371,6 @@ begin Name := 'btnSave'; SetPosition(56, 28, 25, 24); Text := ''; - Down := False; FontDesc := '#Label1'; Hint := 'Save the current form design'; ImageMargin := -1; @@ -377,11 +399,12 @@ begin Name := 'chlPalette'; SetPosition(4, 67, 144, 22); Anchors := [anLeft,anBottom]; + ExtraHint := ''; FontDesc := '#List'; Hint := ''; Items.Add('-'); - TabOrder := 5; FocusItem := 0; + TabOrder := 5; end; filemenu := TfpgPopupMenu.Create(self); @@ -442,11 +465,6 @@ begin begin Name := 'previewmenu'; SetPosition(324, 36, 120, 20); - AddMenuItem('with Windows 9x', '', nil).Enabled := False; - AddMenuItem('with Windows XP', '', nil).Enabled := False; - AddMenuItem('with OpenSoft', '', nil).Enabled := False; - AddMenuItem('with Motif', '', nil).Enabled := False; - AddMenuItem('with OpenLook', '', nil).Enabled := False; end; {@VFD_BODY_END: frmMain} @@ -479,6 +497,8 @@ begin end; end; + BuildThemePreviewMenu; + chlPalette.Items.Sort; MainMenu.AddMenuItem('&File', nil).SubMenu := filemenu; MainMenu.AddMenuItem('&Settings', nil).SubMenu := setmenu; @@ -623,7 +643,7 @@ begin x := 64; - btnAnLeft := CreateButton(self, x, y - 2, 28, '', nil); + btnAnLeft := CreateButton(self, x, y - 2, 26, '', nil); with btnAnLeft do begin ImageName := 'vfd.anchorleft'; @@ -897,6 +917,7 @@ procedure TfrmMain.FormShow(Sender: TObject); begin gINI.ReadFormState(self); UpdateWindowPosition; + SetupCaptions; end; procedure TfrmMain.PaletteBarResized(Sender: TObject); @@ -937,6 +958,28 @@ begin maindsgn.OnLoadFile(maindsgn); end; +procedure TfrmMain.SetupCaptions; +begin + btnOpen.Hint := rsOpenFormFile; +end; + +procedure TfrmMain.BuildThemePreviewMenu; +var + sl: TStringList; + i: integer; +begin + sl := TStringList.Create; + fpgStyleManager.AssignStyleTypes(sl); + sl.Sort; + for i := 0 to sl.Count-1 do + begin + if sl[i] = 'auto' then + continue; + previewmenu.AddMenuItem(sl[i], '', nil).Enabled := False; + end; + sl.Free; +end; + constructor TfrmMain.Create(AOwner: TComponent); begin inherited Create(AOwner); diff --git a/uidesigner/tests/frm_menutest.pas b/uidesigner/tests/frm_menutest.pas deleted file mode 100644 index 4f707e11..00000000 --- a/uidesigner/tests/frm_menutest.pas +++ /dev/null @@ -1,86 +0,0 @@ -unit frm_menutest; - -{$mode objfpc}{$H+} - -interface - -uses - SysUtils, Classes, gfxbase, fpgfx, gui_edit, - gfx_widget, gui_form, gui_label, gui_button, - gui_listbox, gui_memo, gui_combobox, gui_grid, - gui_dialogs, gui_checkbox, gui_tree, gui_trackbar, - gui_progressbar, gui_radiobutton, gui_tab, gui_menu; - -type - - TfrmMain = class(TfpgForm) - private - procedure miExitClicked(Sender: TObject); - public - {@VFD_HEAD_BEGIN: frmMain} - MainMenu: TfpgMenuBar; - miFile: TfpgPopupMenu; - btnName1: TfpgButton; - {@VFD_HEAD_END: frmMain} - - procedure AfterCreate; override; - end; - -{@VFD_NEWFORM_DECL} - -implementation - -{@VFD_NEWFORM_IMPL} - -procedure TfrmMain.miExitClicked(Sender: TObject); -begin - Close; -end; - -procedure TfrmMain.AfterCreate; -begin - {@VFD_BODY_BEGIN: frmMain} - Name := 'frmMain'; - SetPosition(278, 186, 399, 142); - WindowTitle := 'frmMain'; - WindowPosition := wpScreenCenter; - - MainMenu := TfpgMenuBar.Create(self); - with MainMenu do - begin - Name := 'MainMenu'; - SetPosition(0, 0, 400, 23); - Anchors := [anLeft,anRight,anTop]; - end; - - miFile := TfpgPopupMenu.Create(self); - with miFile do - begin - Name := 'miFile'; - SetPosition(200, 48, 152, 24); - AddMenuItem('&New...', 'Ctrl-N', nil); - AddMenuItem('&Open...', 'Ctrl-O', nil); - AddMenuItem('-', '', nil); - AddMenuItem('E&xit', 'Alt+F4', @miExitClicked); - end; - - btnName1 := TfpgButton.Create(self); - with btnName1 do - begin - Name := 'btnName1'; - SetPosition(8, 112, 75, 24); - Text := 'Button'; - FontDesc := '#Label1'; - ImageName := 'stdimg.quit'; - ModalResult := 0; - ShowImage := True; - OnClick := @miExitClicked; - end; - - {@VFD_BODY_END: frmMain} - - MainMenu.AddMenuItem('&File', nil).SubMenu := miFile; -end; - - -end. diff --git a/uidesigner/tests/menutest.lpi b/uidesigner/tests/menutest.lpi deleted file mode 100644 index 3f9b35ec..00000000 --- a/uidesigner/tests/menutest.lpi +++ /dev/null @@ -1,57 +0,0 @@ -<?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=""/> - <Title Value="menutest"/> - </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_toolkit"/> - </Item1> - </RequiredPackages> - <Units Count="2"> - <Unit0> - <Filename Value="menutest.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="menutest"/> - </Unit0> - <Unit1> - <Filename Value="frm_menutest.pas"/> - <IsPartOfProject Value="True"/> - <UnitName Value="frm_menutest"/> - </Unit1> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/uidesigner/tests/menutest.lpr b/uidesigner/tests/menutest.lpr deleted file mode 100644 index 80b985be..00000000 --- a/uidesigner/tests/menutest.lpr +++ /dev/null @@ -1,27 +0,0 @@ -program menutest; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, frm_menutest, fpgfx; - - - -procedure MainProc; -var - frm: TfrmMain; -begin - fpgApplication.Initialize; - frm := TfrmMain.Create(nil); - frm.Show; - fpgApplication.Run; -end; - -begin - MainProc; -end. - - diff --git a/uidesigner/tests/tabsheet_design.lpi b/uidesigner/tests/tabsheet_design.lpi deleted file mode 100644 index 2124c06d..00000000 --- a/uidesigner/tests/tabsheet_design.lpi +++ /dev/null @@ -1,58 +0,0 @@ -<?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=""/> - <Title Value="project1"/> - </General> - <VersionInfo> - <ProjectVersion Value=""/> - </VersionInfo> - <PublishOptions> - <Version Value="2"/> - <IgnoreBinaries Value="False"/> - <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_toolkit"/> - </Item1> - </RequiredPackages> - <Units Count="2"> - <Unit0> - <Filename Value="tabsheet_design.lpr"/> - <IsPartOfProject Value="True"/> - <UnitName Value="tabsheet_design"/> - </Unit0> - <Unit1> - <Filename Value="tabtest.pas"/> - <IsPartOfProject Value="True"/> - <UnitName Value="tabtest"/> - </Unit1> - </Units> - </ProjectOptions> - <CompilerOptions> - <Version Value="5"/> - <CodeGeneration> - <Generate Value="Faster"/> - </CodeGeneration> - <Other> - <CompilerPath Value="$(CompPath)"/> - </Other> - </CompilerOptions> -</CONFIG> diff --git a/uidesigner/tests/tabsheet_design.lpr b/uidesigner/tests/tabsheet_design.lpr deleted file mode 100644 index 7acb50aa..00000000 --- a/uidesigner/tests/tabsheet_design.lpr +++ /dev/null @@ -1,30 +0,0 @@ -program tabsheet_design; - -{$mode objfpc}{$H+} - -uses - {$IFDEF UNIX}{$IFDEF UseCThreads} - cthreads, - {$ENDIF}{$ENDIF} - Classes, fpgfx, tabtest; - - -procedure MainProc; -var - frm: TfrmTabTest; -begin - fpgApplication.Initialize; - frm := TfrmTabTest.Create(nil); - try - frm.Show; - fpgApplication.Run; - finally - frm.Free; - end; -end; - -begin - MainProc; -end. - - diff --git a/uidesigner/tests/tabtest.pas b/uidesigner/tests/tabtest.pas deleted file mode 100644 index 9355a6d2..00000000 --- a/uidesigner/tests/tabtest.pas +++ /dev/null @@ -1,226 +0,0 @@ -unit tabtest; - -{$mode objfpc}{$H+} - -interface - -uses - SysUtils, Classes, gfxbase, fpgfx, gui_edit, - gfx_widget, gui_form, gui_label, gui_button, - gui_listbox, gui_memo, gui_combobox, gui_grid, - gui_dialogs, gui_checkbox, gui_tree, gui_trackbar, - gui_progressbar, gui_radiobutton, gui_tab, gui_menu, - gui_bevel; - -type - - TfraGeneral = class(TfpgForm) - public - {@VFD_HEAD_BEGIN: fraGeneral} - lblName1: TfpgLabel; - edtName1: TfpgEdit; - memName1: TfpgMemo; - btnName1: TfpgButton; - {@VFD_HEAD_END: fraGeneral} - procedure AfterCreate; override; - end; - - - TfraAddress = class(TfpgForm) - public - {@VFD_HEAD_BEGIN: fraAddress} - edtName1: TfpgEdit; - lblName1: TfpgLabel; - lblName2: TfpgLabel; - lblName3: TfpgLabel; - cbName1: TfpgComboBox; - {@VFD_HEAD_END: fraAddress} - procedure AfterCreate; override; - end; - - - TfrmTabTest = class(TfpgForm) - private - procedure btnCloseClicked(Sender: TObject); - public - {@VFD_HEAD_BEGIN: frmTabTest} - pcName1: TfpgPageControl; - btnClose: TfpgButton; - {@VFD_HEAD_END: frmTabTest} - - // these must be added manually for now, until the GUI Designer is improved. - tsGeneral: TfpgTabSheet; - tsAddress: TfpgTabSheet; - tsAccounts: TfpgTabSheet; - fraGeneral: TfraGeneral; - fraAddress: TfraAddress; - procedure AfterCreate; override; - end; - - -{@VFD_NEWFORM_DECL} - -implementation - -{@VFD_NEWFORM_IMPL} - -procedure TfraAddress.AfterCreate; -begin - {@VFD_BODY_BEGIN: fraAddress} - Name := 'fraAddress'; - SetPosition(602, 485, 208, 127); - WindowTitle := 'fraAddress'; - - edtName1 := TfpgEdit.Create(self); - with edtName1 do - begin - Name := 'edtName1'; - SetPosition(64, 32, 120, 22); - Text := ''; - FontDesc := '#Edit1'; - end; - - lblName1 := TfpgLabel.Create(self); - with lblName1 do - begin - Name := 'lblName1'; - SetPosition(4, 4, 156, 16); - Text := 'TabSheet - Address'; - FontDesc := '#Label2'; - end; - - lblName2 := TfpgLabel.Create(self); - with lblName2 do - begin - Name := 'lblName2'; - SetPosition(8, 36, 44, 16); - Text := 'Street'; - FontDesc := '#Label1'; - end; - - lblName3 := TfpgLabel.Create(self); - with lblName3 do - begin - Name := 'lblName3'; - SetPosition(8, 60, 48, 16); - Text := 'City'; - FontDesc := '#Label1'; - end; - - cbName1 := TfpgComboBox.Create(self); - with cbName1 do - begin - Name := 'cbName1'; - SetPosition(64, 56, 120, 23); - Items.Add('Somerset West'); - Items.Add('Cape Town'); - Items.Add('Durban'); - Items.Add('Jo''burg'); - Items.Add('Pretoria'); - FontDesc := '#List'; - FocusItem := 1; - end; - - {@VFD_BODY_END: fraAddress} -end; - - -procedure TfraGeneral.AfterCreate; -begin - {@VFD_BODY_BEGIN: fraGeneral} - Name := 'fraGeneral'; - SetPosition(611, 290, 197, 165); - WindowTitle := 'fraGeneral'; - - lblName1 := TfpgLabel.Create(self); - with lblName1 do - begin - Name := 'lblName1'; - SetPosition(4, 4, 212, 16); - Text := 'TabSheet - General'; - FontDesc := '#Label2'; - end; - - edtName1 := TfpgEdit.Create(self); - with edtName1 do - begin - Name := 'edtName1'; - SetPosition(12, 28, 144, 22); - Anchors := [anLeft,anRight,anTop]; - Text := ''; - FontDesc := '#Edit1'; - end; - - memName1 := TfpgMemo.Create(self); - with memName1 do - begin - Name := 'memName1'; - SetPosition(12, 56, 172, 96); - Anchors := [anLeft,anRight,anTop,anBottom]; - FontDesc := '#Edit1'; - end; - - btnName1 := TfpgButton.Create(self); - with btnName1 do - begin - Name := 'btnName1'; - SetPosition(160, 28, 19, 20); - Anchors := [anRight,anTop]; - Text := '...'; - FontDesc := '#Label1'; - ImageName := ''; - ModalResult := 0; - end; - - {@VFD_BODY_END: fraGeneral} -end; - -procedure TfrmTabTest.btnCloseClicked(Sender: TObject); -begin - Close; -end; - -procedure TfrmTabTest.AfterCreate; -begin - {@VFD_BODY_BEGIN: frmTabTest} - Name := 'frmTabTest'; - SetPosition(293, 290, 275, 198); - WindowTitle := 'Tab Design Test'; - - pcName1 := TfpgPageControl.Create(self); - with pcName1 do - begin - Name := 'pcName1'; - SetPosition(8, 12, 258, 148); - Anchors := [anLeft,anRight,anTop,anBottom]; - FixedTabWidth := 0; - Style := tsTabs; - TabPosition := tpTop; - tsGeneral := AppendTabSheet('General'); - tsAddress := AppendTabSheet('Address'); - tsAccounts := AppendTabSheet('EAddress'); - ActivePage := tsGeneral; - end; - - btnClose := TfpgButton.Create(self); - with btnClose do - begin - Name := 'btnClose'; - SetPosition(192, 168, 75, 24); - Anchors := [anRight,anBottom]; - Text := 'Close'; - FontDesc := '#Label1'; - ImageName := ''; - ModalResult := 0; - OnClick := @btnCloseClicked; - end; - - {@VFD_BODY_END: frmTabTest} - - fraGeneral := TfraGeneral.Create(tsGeneral); - fraGeneral.Align := alClient; - fraAddress := TfraAddress.Create(tsAddress); - fraAddress.Align := alClient; -end; - -end. diff --git a/uidesigner/uidesigner.lpi b/uidesigner/uidesigner.lpi index 83bb344b..be5b651a 100644 --- a/uidesigner/uidesigner.lpi +++ b/uidesigner/uidesigner.lpi @@ -1,4 +1,4 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <CONFIG> <ProjectOptions> <Version Value="9"/> @@ -32,7 +32,7 @@ <PackageName Value="fpgui_toolkit"/> </Item1> </RequiredPackages> - <Units Count="16"> + <Units Count="17"> <Unit0> <Filename Value="uidesigner.lpr"/> <IsPartOfProject Value="True"/> @@ -111,10 +111,15 @@ <Filename Value="icons.inc"/> <IsPartOfProject Value="True"/> </Unit15> + <Unit16> + <Filename Value="vfd_constants.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="vfd_constants"/> + </Unit16> </Units> </ProjectOptions> <CompilerOptions> - <Version Value="9"/> + <Version Value="11"/> <SearchPaths> <UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/> </SearchPaths> diff --git a/uidesigner/uidesigner.lpr b/uidesigner/uidesigner.lpr index 968a45dc..90da9d39 100644 --- a/uidesigner/uidesigner.lpr +++ b/uidesigner/uidesigner.lpr @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Library - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -25,7 +25,8 @@ uses {$ENDIF}{$ENDIF} Classes, SysUtils, fpg_base, fpg_main, vfdmain, vfdresizer, vfdforms, vfdfile, newformdesigner, vfdwidgets, vfdformparser, vfdeditors, - vfdwidgetclass, vfdutils, vfdprops, vfddesigner, vfdpropeditgrid; + vfdwidgetclass, vfdutils, vfdprops, vfddesigner, vfdpropeditgrid, + vfd_constants; procedure MainProc; @@ -37,10 +38,10 @@ begin maindsgn := TMainDesigner.Create; maindsgn.CreateWindows; - // Note: This needs improving!! + // Making sure the correct form is set as the MainForm fpgApplication.MainForm := frmMain; - { If file passed in as param, load it! } + { If a file is passed in as a parameter, then load it } maindsgn.EditedFileName := ParamStr(1); if FileExists(maindsgn.EditedFileName) then maindsgn.OnLoadFile(maindsgn); diff --git a/uidesigner/vfd_constants.pas b/uidesigner/vfd_constants.pas new file mode 100644 index 00000000..908b7436 --- /dev/null +++ b/uidesigner/vfd_constants.pas @@ -0,0 +1,91 @@ +{ + fpGUI - Free Pascal GUI Toolkit + + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + This unit contains all the language resource strings used by the + UI Designer project. Thus making it possible to translate the UI Designer + to other languages. It also contains all project constants. +} + +unit vfd_constants; + +{$mode objfpc}{$H+} + +interface + +uses + fpg_constants; + + +const + cFileFilter = '%s (%s)|%s'; + cPascalSourceFiles = '*.pp;*.pas;*.inc;*.dpr;*.lpr'; + cAppName = 'fpGUI UI Designer'; + cAppVersion = FPGUI_VERSION; + cAppNameAndVersion = cAppName + ' v' + cAppVersion; + cDesignerINIVersion = 1; + +resourcestring + rsOpenFormFile = 'Open form file'; + rsPascalSourceFiles = 'Pascal source filess'; + rsSaveFormFile = 'Save form source'; + rsVersion = 'Version: %s'; + rsWrittenBy = 'Written by %s'; + rsCompiledOn = 'Compiled on: %s'; + rsNewUnnamedForm = 'new'; + rsDesignerHelp1 = 'F11: switch to Properties'; + rsDesignerHelp2 = 'TAB, SHIFT+TAB: select next widget'; + rsDesignerHelp3 = 'F2: edit widget order'; + rsDesignerQuickHelp = 'Quick Help'; + rsLeft = 'Left'; + rsTop = 'Top'; + rsWidth = 'Width'; + rsHeight = 'Height'; + rsNewClassName = 'Class name'; + rsNewFormName = 'Form name'; + rsPosition = 'Position'; + rsFormTitle = 'Form %s'; + rsUp = 'Up'; + rsDown = 'Down'; + rsGridResolution = 'Grid resolution'; + rsRecentFilesCount = 'Recent files count'; + rsShowFullPathName = 'Show the full file path'; + rsFormDesigner = 'Form designer'; + rsOpenRecentSettings = 'Open Recent menu settings'; + rsVarious = 'Various'; + rsUndoOnPropertyExit = 'Undo on property editor exit'; + rsOneClickSelectAndMove = 'One click select and move'; + rsDefaultFileExt = 'Default file extension'; + rsUseCodeRegions = 'Use code-folding regions in auto-generated code'; + rsIndentType = 'Indent Type for generated code'; + + rsDlgProductInfo = 'Product Information'; + rsDlgSetup = 'General Settings'; + rsDlgInsertCustomWidget = 'Insert Custom Widget'; + rsDlgNewForm = 'New Form'; + rsDlgEditFormPosition = 'Form Position'; + rsDlgWidgetOrder = 'Widget Order'; + rsDlgTabOrder = 'Tab Order'; + + rsErrUnitNotFound = 'The unit <%s> was not found.'; + rsErrLoadingForm = 'Error loading form'; + rsErrFailedToFindDesignerForm = 'Failed to find Designer Form'; + rsErrFormSaveIOError = 'Form save I/O failure in <%s>.'; + rsErrNameConflict = 'Name Conflict'; + rsErrNoStringsProperty = 'Failed to find TStrings type property.'; + rsErrFailedToParseBoolean = 'Failed to parse Boolean value <%s>'; + +implementation + +end. + diff --git a/uidesigner/vfddesigner.pas b/uidesigner/vfddesigner.pas index db548784..70757ba4 100644 --- a/uidesigner/vfddesigner.pas +++ b/uidesigner/vfddesigner.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -142,13 +142,14 @@ type implementation uses + TypInfo, vfdmain, vfdutils, - TypInfo, + vfd_constants, fpg_tree; const - cEditOrder: array[TfpgEditMode] of string = ('Widget Order', 'Tab Order'); + cEditOrder: array[TfpgEditMode] of string = (rsDlgWidgetOrder, rsDlgTabOrder); { TWidgetDesigner } @@ -643,9 +644,7 @@ end; procedure TFormDesigner.EditWidgetOrTabOrder(AMode: TfpgEditMode); var frm: TWidgetOrderForm; - n, fi: integer; - cd: TWidgetDesigner; - identlevel: integer; + n: integer; lFocused: TfpgTreeNode; lNode: TfpgTreeNode; s: string; @@ -678,9 +677,7 @@ begin frm := TWidgetOrderForm.Create(nil); frm.WindowTitle := cEditOrder[AMode]; frm.Title := cEditOrder[AMode]; - fi := 0; - identlevel := 0; frm.Treeview1.RootNode.Clear; lFocused := nil; @@ -743,10 +740,10 @@ begin end; keyF1: - ShowMessage('F11: switch to Properties' + LineEnding + - 'TAB, SHIFT+TAB: select next widget' + LineEnding + - 'F2: edit widget order' + LineEnding {+ - 'F4: edit items' + LineEnding}, 'Small help'); + ShowMessage(rsDesignerHelp1 + LineEnding + + rsDesignerHelp2 + LineEnding + + rsDesignerHelp3 + LineEnding {+ + 'F4: edit items' + LineEnding}, rsDesignerQuickHelp); keyF2: EditWidgetOrTabOrder(emTabOrder); @@ -981,22 +978,22 @@ begin if Sender = frmProperties.btnLeft then begin - frm.lbPos.Text := 'Left:'; + frm.lbPos.Text := rsLeft + ':'; frm.edPos.Text := IntToStr(wg.Left); end else if Sender = frmProperties.btnTop then begin - frm.lbPos.Text := 'Top:'; + frm.lbPos.Text := rsTop + ':'; frm.edPos.Text := IntToStr(wg.Top); end else if Sender = frmProperties.btnWidth then begin - frm.lbPos.Text := 'Width:'; + frm.lbPos.Text := rsWidth + ':'; frm.edPos.Text := IntToStr(wg.Width); end else if Sender = frmProperties.btnHeight then begin - frm.lbPos.Text := 'Height:'; + frm.lbPos.Text := rsHeight + ':'; frm.edPos.Text := IntToStr(wg.Height); end; @@ -1473,7 +1470,7 @@ procedure TDesignedForm.AfterCreate; begin inherited AfterCreate; WindowPosition := wpUser; - WindowTitle := 'New Form'; + WindowTitle := rsDlgNewForm; SetPosition(300, 150, 300, 250); end; diff --git a/uidesigner/vfdfile.pas b/uidesigner/vfdfile.pas index 3db2ae31..b6636fa2 100644 --- a/uidesigner/vfdfile.pas +++ b/uidesigner/vfdfile.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Description: - This unit handles the load, save and merge functions. Doing + This unit handles the load, save and merge functions. Doing VFD marker searching. } diff --git a/uidesigner/vfdformparser.pas b/uidesigner/vfdformparser.pas index 831e5083..75681cbe 100644 --- a/uidesigner/vfdformparser.pas +++ b/uidesigner/vfdformparser.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -65,6 +65,8 @@ function GetColorValue(var s: string): integer; implementation +uses + vfd_constants; { TVFDFormParser } @@ -152,7 +154,7 @@ begin else if UpperCase(fs) = 'FALSE' then Result := False else - raise exception.Create('Failed to parse Boolean value <' + s + '>'); + raise Exception.CreateFmt(rsErrFailedToParseBoolean, [s]); if Result then Delete(s, 1, 4) diff --git a/uidesigner/vfdforms.pas b/uidesigner/vfdforms.pas index d1557fbc..9d9b42bd 100644 --- a/uidesigner/vfdforms.pas +++ b/uidesigner/vfdforms.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -12,7 +12,7 @@ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. Description: - The main uiDesigner forms. + This unit defines various forms/dialogs used in the UI Designer. } unit vfdforms; @@ -33,18 +33,23 @@ uses fpg_combobox, fpg_trackbar, fpg_checkbox, - fpg_panel, fpg_tree; type TVFDDialog = class(TfpgForm) protected - procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override; + procedure HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); override; + procedure SetupCaptions; virtual; + procedure FormShow(Sender: TObject); virtual; + public + constructor Create(AOwner: TComponent); override; end; TInsertCustomForm = class(TVFDDialog) + protected + procedure SetupCaptions; override; public l1, l2: TfpgLabel; @@ -52,34 +57,38 @@ type edName: TfpgEdit; btnOK: TfpgButton; btnCancel: TfpgButton; - procedure AfterCreate; override; - procedure OnButtonClick(Sender: TObject); + procedure AfterCreate; override; + procedure OnButtonClick(Sender: TObject); end; TNewFormForm = class(TVFDDialog) private - procedure OnedNameKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); + procedure OnedNameKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); + protected + procedure SetupCaptions; override; public l1: TfpgLabel; edName: TfpgEdit; btnOK: TfpgButton; btnCancel: TfpgButton; - procedure AfterCreate; override; - procedure OnButtonClick(Sender: TObject); + procedure AfterCreate; override; + procedure OnButtonClick(Sender: TObject); end; TEditPositionForm = class(TVFDDialog) private - procedure edPosKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); + procedure edPosKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean); + protected + procedure SetupCaptions; override; public lbPos: TfpgLabel; edPos: TfpgEdit; btnOK: TfpgButton; btnCancel: TfpgButton; - procedure AfterCreate; override; - procedure OnButtonClick(Sender: TObject); + procedure AfterCreate; override; + procedure OnButtonClick(Sender: TObject); end; @@ -87,6 +96,8 @@ type private function GetTitle: string; procedure SetTitle(const AValue: string); + protected + procedure SetupCaptions; override; public {@VFD_HEAD_BEGIN: WidgetOrderForm} lblTitle: TfpgLabel; @@ -105,13 +116,15 @@ type end; - TfrmVFDSetup = class(TfpgForm) + TfrmVFDSetup = class(TVFDDialog) private FINIVersion: integer; - procedure FormShow(Sender: TObject); procedure LoadSettings; procedure SaveSettings; procedure btnOKClick(Sender: TObject); + protected + procedure FormShow(Sender: TObject); override; + procedure SetupCaptions; override; public {@VFD_HEAD_BEGIN: frmVFDSetup} lb1: TfpgLabel; @@ -132,7 +145,6 @@ type cbIndentationType: TfpgComboBox; lblIndentType: TfpgLabel; {@VFD_HEAD_END: frmVFDSetup} - constructor Create(AOwner: TComponent); override; procedure AfterCreate; override; procedure BeforeDestruction; override; end; @@ -145,20 +157,27 @@ uses fpg_main, fpg_iniutils, fpg_constants, + fpg_utils, + vfd_constants, vfdprops; // used to get Object Inspector defaults -const - cDesignerINIVersion = 1; - { TInsertCustomForm } +procedure TInsertCustomForm.SetupCaptions; +begin + inherited SetupCaptions; + WindowTitle := rsDlgInsertCustomWidget; + l1.Text := fpgAddColon(rsNewClassName); + l2.Text := fpgAddColon(rsName); +end; + procedure TInsertCustomForm.AfterCreate; begin {%region 'Auto-generated GUI code' -fold} inherited; WindowPosition := wpScreenCenter; - WindowTitle := 'Insert Custom Widget'; + WindowTitle := 'TInsertCustomForm'; SetPosition(0, 0, 300, 100); l1 := CreateLabel(self, 8, 4, 'Class name:'); @@ -166,8 +185,8 @@ begin edClass.Text := 'Tfpg'; l2 := CreateLabel(self, 8, 48, 'Name:'); edName := CreateEdit(self, 8, 68, 150, 0); - btnOK := CreateButton(self, 180, 20, 100, 'OK', @OnButtonClick); - btnCancel := CreateButton(self, 180, 52, 100, 'Cancel', @OnButtonClick); + btnOK := CreateButton(self, 180, 20, 100, rsOK, @OnButtonClick); + btnCancel := CreateButton(self, 180, 52, 100, rsCancel, @OnButtonClick); {%endregion} end; @@ -188,12 +207,19 @@ begin btnOK.Click; end; +procedure TNewFormForm.SetupCaptions; +begin + inherited SetupCaptions; + WindowTitle := rsDlgNewForm; + l1.Text := fpgAddColon(rsNewFormName); +end; + procedure TNewFormForm.AfterCreate; begin inherited AfterCreate; WindowPosition := wpScreenCenter; SetPosition(0, 0, 286, 66); - WindowTitle := 'New Form'; + WindowTitle := 'TNewFormForm'; l1 := CreateLabel(self, 8, 8, 'Form name:'); edName := CreateEdit(self, 8, 28, 180, 0); @@ -220,16 +246,23 @@ begin btnOK.Click; end; +procedure TEditPositionForm.SetupCaptions; +begin + inherited SetupCaptions; + WindowTitle := rsDlgEditFormPosition; + lbPos.Text := fpgAddColon(rsPosition); +end; + procedure TEditPositionForm.AfterCreate; begin inherited AfterCreate; WindowPosition := wpScreenCenter; Width := 186; Height := 66; - WindowTitle := 'Position'; + WindowTitle := 'TEditPositionForm'; Sizeable := False; - lbPos := CreateLabel(self, 8, 8, 'Pos: '); + lbPos := CreateLabel(self, 8, 8, 'Pos:'); edPos := CreateEdit(self, 8, 28, 80, 0); edPos.OnKeyPress := @edPosKeyPressed; btnOK := CreateButton(self, 98, 8, 80, rsOK, @OnButtonClick); @@ -256,6 +289,17 @@ begin lblTitle.Text := Format(lblTitle.Text, [AValue]); end; +procedure TWidgetOrderForm.SetupCaptions; +begin + inherited SetupCaptions; + WindowTitle := rsDlgWidgetOrder; + lblTitle.Text := fpgAddColon(rsFormTitle); + btnOK.Text := rsOK; + btnCancel.Text := rsCancel; + btnUp.Text := rsUp; + btnDown.Text := rsDown; +end; + constructor TWidgetOrderForm.Create(AOwner: TComponent); begin inherited Create(AOwner); @@ -275,7 +319,7 @@ begin {@VFD_BODY_BEGIN: WidgetOrderForm} Name := 'WidgetOrderForm'; SetPosition(534, 173, 426, 398); - WindowTitle := 'Widget order'; + WindowTitle := 'TWidgetOrderForm'; Hint := ''; WindowPosition := wpScreenCenter; @@ -388,6 +432,11 @@ end; { TVFDDialogBase } +procedure TVFDDialog.FormShow(Sender: TObject); +begin + SetupCaptions; +end; + procedure TVFDDialog.HandleKeyPress(var keycode: word; var shiftstate: TShiftState; var consumed: boolean); begin if keycode = keyEscape then @@ -398,8 +447,20 @@ begin inherited HandleKeyPress(keycode, shiftstate, consumed); end; +procedure TVFDDialog.SetupCaptions; +begin + // to be implemented in descendants +end; + +constructor TVFDDialog.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + OnShow := @FormShow; +end; + procedure TfrmVFDSetup.FormShow(Sender: TObject); begin + inherited FormShow(Sender); { If it's an older version, don't load the size because the dialog dimensions probably changed in a newer version } if FINIVersion >= cDesignerINIVersion then @@ -408,6 +469,25 @@ begin gINI.ReadFormState(self, -1, -1, True); end; +procedure TfrmVFDSetup.SetupCaptions; +begin + inherited SetupCaptions; + WindowTitle := rsDlgSetup; + lb1.Text := fpgAddColon(rsGridResolution); + btnOK.Text := rsOK; + btnCancel.Text := rsCancel; + lblRecentFiles.Text := fpgAddColon(rsRecentFilesCount); + chkFullPath.Text := rsShowFullPathName; + lblName1.Text := rsFormDesigner; + lblName2.Text := rsOpenRecentSettings; + lblName3.Text := rsVarious; + chkUndoOnExit.Text := rsUndoOnPropertyExit; + chkOneClick.Text := rsOneClickSelectAndMove; + Label1.Text := fpgAddColon(rsDefaultFileExt); + chkCodeRegions.Text := rsUseCodeRegions; + lblIndentType.Text := fpgAddColon(rsIndentType); +end; + procedure TfrmVFDSetup.LoadSettings; begin FINIVersion := gINI.ReadInteger('Designer', 'Version', 0); @@ -440,12 +520,6 @@ begin ModalResult := mrOK; end; -constructor TfrmVFDSetup.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - OnShow := @FormShow; -end; - procedure TfrmVFDSetup.AfterCreate; begin {@VFD_BODY_BEGIN: frmVFDSetup} diff --git a/uidesigner/vfdmain.pas b/uidesigner/vfdmain.pas index 1f5485dc..5dcb90d4 100644 --- a/uidesigner/vfdmain.pas +++ b/uidesigner/vfdmain.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -28,16 +28,12 @@ uses fpg_main, fpg_widget, fpg_dialogs, - fpg_constants, vfdprops, vfdforms, vfddesigner, vfdfile, newformdesigner; -const - program_version = FPGUI_VERSION; - type TMainDesigner = class(TObject) @@ -85,9 +81,11 @@ var implementation uses - vfdformparser, + fpg_constants, fpg_iniutils, - fpg_utils; + fpg_utils, + vfd_constants, + vfdformparser; var DefaultPasExt : String = '.pas'; @@ -123,8 +121,10 @@ begin begin afiledialog := TfpgFileDialog.Create(nil); afiledialog.Filename := EditedFilename; - afiledialog.WindowTitle := 'Open form file'; - afiledialog.Filter := 'Pascal source files (*.pp;*.pas;*.inc;*.dpr;*.lpr)|*.pp;*.pas;*.inc;*.dpr;*.lpr|All Files (*)|*'; + afiledialog.WindowTitle := rsOpenFormFile; + afiledialog.Filter := + Format(cFileFilter, [rsPascalSourceFiles, cPascalSourceFiles, cPascalSourceFiles]) + + '|' + Format(cFileFilter, [rsAllFiles, AllFilesMask, AllFilesMask]); if afiledialog.RunOpenFile then begin EditedFileName := aFileDialog.Filename; @@ -147,7 +147,7 @@ begin if not fpgFileExists(fname) then begin - ShowMessage('File does not exists.', 'Error loading form'); + ShowMessage(Format(rsErrUnitNotFound, [fname]), rsErrLoadingForm); Exit; end; @@ -186,8 +186,10 @@ begin begin afiledialog := TfpgFileDialog.Create(nil); afiledialog.Filename := EditedFilename; - afiledialog.WindowTitle := 'Save form source'; - afiledialog.Filter := 'Pascal source files (*.pp;*.pas;*.inc;*.dpr;*.lpr)|*.pp;*.pas;*.inc;*.dpr;*.lpr|All Files (*)|*'; + afiledialog.WindowTitle := rsSaveFormFile; + afiledialog.Filter := + Format(cFileFilter, [rsPascalSourceFiles, cPascalSourceFiles, cPascalSourceFiles]) + + '|' + Format(cFileFilter, [rsAllFiles, AllFilesMask, AllFilesMask]); if afiledialog.RunSaveFile then begin fname:=aFileDialog.Filename; @@ -224,7 +226,7 @@ begin fd := nil; fd := Designer(n); if fd = nil then - raise Exception.Create('Failed to find Designer Form'); + raise Exception.Create(rsErrFailedToFindDesignerForm); FFile.SetFormData(fd.Form.Name, fd.GetFormSourceDecl, fd.GetFormSourceImpl); end; @@ -241,8 +243,7 @@ begin frmMain.mru.AddItem(fname); except on E: Exception do - raise Exception.Create('Form save I/O failure in TMainDesigner.OnSaveFile.' + #13 + - E.Message); + raise Exception.CreateFmt(rsErrFormSaveIOError + LineEnding + E.Message, ['TMainDesigner.OnSaveFile']); end; end; @@ -302,7 +303,7 @@ begin begin if DoesNameAlreadyExist(nfrm.edName.Text) then begin - TfpgMessageDialog.Critical('Name Conflict','The form name already exists in the current unit, please try again'); + TfpgMessageDialog.Critical(rsErrNameConflict,'The form name already exists in the current unit, please try again'); exit; end; fd := TFormDesigner.Create; @@ -323,7 +324,7 @@ end; procedure TMainDesigner.CreateWindows; begin frmMain := TfrmMain.Create(nil); - frmMain.WindowTitle := 'fpGUI Designer v' + program_version; + frmMain.WindowTitle := cAppNameAndVersion; frmMain.Show; frmProperties := TfrmProperties.Create(nil); @@ -459,8 +460,8 @@ begin FEditedFileName := Value; s := ExtractFileName(FEditedFileName); if s = '' then - s := '[new]'; - frmMain.WindowTitle := 'fpGUI Designer v' + program_version + ' - ' + s; + s := '[' + rsNewUnnamedForm + ']'; + frmMain.WindowTitle := cAppNameAndVersion + ' - ' + s; end; procedure TMainDesigner.LoadDefaults; diff --git a/uidesigner/vfdprops.pas b/uidesigner/vfdprops.pas index faf4d858..55fff148 100644 --- a/uidesigner/vfdprops.pas +++ b/uidesigner/vfdprops.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -176,6 +176,7 @@ uses TypInfo, vfdformparser, vfdeditors, + vfd_constants, fpg_dialogs; @@ -442,7 +443,7 @@ var begin sl := TStringList(GetObjectProp(wg, Name, TStrings)); if not Assigned(sl) then - raise Exception.Create('Failed to find TStrings type property.'); + raise Exception.Create(rsErrNoStringsProperty); Result := ''; @@ -461,7 +462,7 @@ var begin sl := TStringList(GetObjectProp(wg, Name, TStrings)); if not Assigned(sl) then - raise Exception.Create('Failed to find TStrings type property.'); + raise Exception.Create(rsErrNoStringsProperty); Result := '[' + IntToStr(sl.Count) + ' lines]'; end; @@ -471,7 +472,7 @@ var begin sl := TStringList(GetObjectProp(wg, Name, TStrings)); if not Assigned(sl) then - raise Exception.Create('Failed to find TStrings type property.'); + raise Exception.Create(rsErrNoStringsProperty); EditStringList(sl); end; @@ -500,7 +501,7 @@ begin begin sl := TStringList(GetObjectProp(wg, Name, TStrings)); if not Assigned(sl) then - raise Exception.Create('Failed to find TStrings type property.'); + raise Exception.Create(rsErrNoStringsProperty); sl.Add(sval); end; end; @@ -854,7 +855,6 @@ var PropInfo: PPropInfo; i: integer; c: TfpgColor; - nc: TfpgColor; begin PropInfo := GetPropInfo(wg.ClassType, Name); i := GetOrdProp(wg, Name); diff --git a/uidesigner/vfdwidgetclass.pas b/uidesigner/vfdwidgetclass.pas index 7b9d3c62..76bececc 100644 --- a/uidesigner/vfdwidgetclass.pas +++ b/uidesigner/vfdwidgetclass.pas @@ -162,7 +162,7 @@ end; function TVFDWidgetProperty.GetPropertySource(wg: TfpgWidget; const ident: string): string; begin - + Result := ''; end; function TVFDWidgetProperty.ParseSourceLine(wg: TfpgWidget; const line: string): boolean; diff --git a/uidesigner/vfdwidgets.pas b/uidesigner/vfdwidgets.pas index 26efe1e3..2238e4e5 100644 --- a/uidesigner/vfdwidgets.pas +++ b/uidesigner/vfdwidgets.pas @@ -172,7 +172,6 @@ begin sizeof(stdimg_vfd_colorlistbox), 0, 0); - fpgImages.AddMaskedBMP( 'vfd.combobox', @stdimg_vfd_combobox, sizeof(stdimg_vfd_combobox), @@ -322,6 +321,10 @@ begin 'vfd.hyperlink', @stdimg_vfd_hyperlink, sizeof(stdimg_vfd_hyperlink), 0, 0); + + fpgImages.AddBMP( + 'vfd.scrollframe', @stdimg_vfd_scrollframe, + sizeof(stdimg_vfd_scrollframe)); end; procedure AddWidgetPosProps(wgc: TVFDWidgetClass); @@ -691,6 +694,7 @@ begin wc.AddProperty('Position', TPropertyInteger, ''); wc.AddProperty('ShowHint', TPropertyBoolean, ''); wc.AddProperty('ShowPosition', TPropertyBoolean, ''); + wc.AddProperty('SliderLength', TPropertyInteger, ''); wc.AddProperty('TabOrder', TPropertyInteger, 'The tab order'); wc.AddProperty('TextColor', TPropertyColor, ''); wc.WidgetIconName := 'vfd.trackbar'; |