summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-11-12 09:53:42 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2008-11-12 09:53:42 +0000
commit3df54aadede2a405e5d4bec05e83b7e6c33893b7 (patch)
treea14b9d39791ca1f7d28e562e73767dcff825cc29
parentf19a5912b0b3221612293b320687049079587646 (diff)
downloadfpGUI-3df54aadede2a405e5d4bec05e83b7e6c33893b7.tar.xz
* Improved UI Designer component palette. Components now wrap around when they don't fit.
* Added some sensible MinWidth and MinHeight values to UI Designer main form.
-rw-r--r--uidesigner/newformdesigner.pas65
-rw-r--r--uidesigner/vfdmain.pas4
2 files changed, 59 insertions, 10 deletions
diff --git a/uidesigner/newformdesigner.pas b/uidesigner/newformdesigner.pas
index 2d0b099f..59a2aae2 100644
--- a/uidesigner/newformdesigner.pas
+++ b/uidesigner/newformdesigner.pas
@@ -56,6 +56,8 @@ type
TfrmMain = class(TfpgForm)
private
FFileOpenRecent: TfpgMenuItem;
+ procedure FormShow(Sender: TObject);
+ procedure PaletteBarResized(Sender: TObject);
procedure miHelpAboutClick(Sender: TObject);
procedure miHelpAboutGUI(Sender: TObject);
procedure miMRUClick(Sender: TObject; const FileName: string);
@@ -75,6 +77,7 @@ type
previewmenu: TfpgPopupMenu;
{@VFD_HEAD_END: frmMain}
mru: TfpgMRU;
+ constructor Create(AOwner: TComponent); override;
function GetSelectedWidget: TVFDWidgetClass;
procedure SetSelectedWidget(wgc: TVFDWidgetClass);
procedure AfterCreate; override;
@@ -276,24 +279,25 @@ end;
procedure TfrmMain.AfterCreate;
var
n: integer;
- x: integer;
+ x, y: integer;
wgc: TVFDWidgetClass;
btn: TwgPaletteButton;
begin
{@VFD_BODY_BEGIN: frmMain}
Name := 'frmMain';
- SetPosition(84, 123, 754, 87);
+ SetPosition(84, 123, 754, 92);
WindowTitle := 'frmMain';
ShowHint := True;
WindowPosition := wpUser;
- gINI.ReadFormState(self);
+ MinHeight := 82;
+ MinWidth := 315;
MainMenu := TfpgMenuBar.Create(self);
with MainMenu do
begin
Name := 'MainMenu';
- SetPosition(0, 0, 755, 24);
- Anchors := [anLeft,anRight,anTop];
+ SetPosition(0, 0, 753, 24);
+ Align := alTop;
end;
btnNewForm := TfpgButton.Create(self);
@@ -345,16 +349,19 @@ begin
with wgpalette do
begin
Name := 'wgpalette';
- SetPosition(116, 28, 639, 28);
- Anchors := [anLeft,anRight,anTop];
+ SetPosition(152, 28, 600, 62);
+ Anchors := [anLeft,anRight,anTop,anBottom];
+ // Width := self.Width - Left - 3;
Focusable := False;
+ OnResize := @PaletteBarResized;
end;
chlPalette := TfpgComboBox.Create(self);
with chlPalette do
begin
Name := 'chlPalette';
- SetPosition(116, 60, 200, 22);
+ SetPosition(4, 67, 144, 22);
+ Anchors := [anLeft,anBottom];
FontDesc := '#List';
Items.Add('-');
TabOrder := 5;
@@ -427,12 +434,13 @@ begin
x := 0;
+ y := 0;
for n := 0 to VFDWidgetCount-1 do
begin
wgc := VFDWidget(n);
btn := TwgPaletteButton.Create(wgpalette);
btn.VFDWidget := wgc;
- btn.SetPosition(x, 0, 30, 28);
+ btn.SetPosition(x, y, 30, 28);
btn.ImageName := wgc.WidgetIconName;
btn.ImageMargin := -1;
btn.Text := '';
@@ -444,7 +452,13 @@ begin
chlPalette.Items.AddObject(wgc.WidgetClass.ClassName, wgc);
Inc(x, 32);
+ if (x+30) >= wgpalette.Width then
+ begin
+ x := 0;
+ Inc(y, 30);
+ end;
end;
+
chlPalette.Items.Sort;
MainMenu.AddMenuItem('&File', nil).SubMenu := filemenu;
MainMenu.AddMenuItem('&Settings', nil).SubMenu := setmenu;
@@ -854,6 +868,33 @@ begin
editor.SetPosition(x, editor.Top, Width - ScrollBarWidth - x, editor.Height);
end;
+procedure TfrmMain.FormShow(Sender: TObject);
+begin
+ gINI.ReadFormState(self);
+ UpdateWindowPosition;
+end;
+
+procedure TfrmMain.PaletteBarResized(Sender: TObject);
+var
+ btn: TwgPaletteButton;
+ x, y, n: integer;
+begin
+ x := 0;
+ y := 0;
+ for n := 0 to wgPalette.ComponentCount-1 do
+ begin
+ btn := wgPalette.Components[n] as TwgPaletteButton;
+ btn.SetPosition(x, y, 30, 28);
+
+ Inc(x, 32);
+ if (x+30) >= wgpalette.Width then
+ begin
+ x := 0;
+ Inc(y, 30);
+ end;
+ end;
+end;
+
procedure TfrmMain.miHelpAboutClick(Sender: TObject);
begin
TfrmAbout.Execute;
@@ -871,6 +912,12 @@ begin
maindsgn.OnLoadFile(maindsgn);
end;
+constructor TfrmMain.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ OnShow := @FormShow;
+end;
+
function TfrmMain.GetSelectedWidget: TVFDWidgetClass;
begin
if chlPalette.FocusItem > 0 then
diff --git a/uidesigner/vfdmain.pas b/uidesigner/vfdmain.pas
index a310acfd..f9c53701 100644
--- a/uidesigner/vfdmain.pas
+++ b/uidesigner/vfdmain.pas
@@ -85,7 +85,8 @@ uses
vfdformparser,
fpg_iniutils,
fpg_utils,
- fpg_main;
+ fpg_main,
+ fpg_hint;
Var
DefaultPasExt : String = '.pas';
@@ -441,6 +442,7 @@ begin
DefaultPasExt := gINI.ReadString('Options', 'DefaultFileExt', '.pas');
UndoOnPropExit := gINI.ReadBool('Options', 'UndoOnExit', DefUndoOnPropExit);
fpgApplication.HintPause := 1000;
+ TfpgHintWindow(fpgApplication.HintWindow).Shadow := 0;
end;
end.