summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--examples/apps/uidesigner/uidesigner.lpi8
-rw-r--r--examples/apps/uidesigner/vfddesigner.pas7
-rw-r--r--examples/apps/uidesigner/vfdfile.pas55
-rw-r--r--examples/apps/uidesigner/vfdmain.pas2
-rw-r--r--src/corelib/gfx_widget.pas52
-rw-r--r--src/gui/gui_dialogs.pas7
-rw-r--r--src/gui/gui_form.pas7
7 files changed, 103 insertions, 35 deletions
diff --git a/examples/apps/uidesigner/uidesigner.lpi b/examples/apps/uidesigner/uidesigner.lpi
index 7ddc1083..99714a81 100644
--- a/examples/apps/uidesigner/uidesigner.lpi
+++ b/examples/apps/uidesigner/uidesigner.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <PathDelim Value="/"/>
+ <PathDelim Value="\"/>
<Version Value="5"/>
<General>
<Flags>
@@ -9,7 +9,7 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <IconPath Value="./"/>
+ <IconPath Value=".\"/>
<TargetFileExt Value=""/>
<Title Value="uiDesigner"/>
</General>
@@ -18,14 +18,13 @@
</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)"/>
+ <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/>
</local>
</RunParams>
<RequiredPackages Count="1">
@@ -104,6 +103,7 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
+ <PathDelim Value="\"/>
<Parsing>
<SyntaxOptions>
<AllowLabel Value="False"/>
diff --git a/examples/apps/uidesigner/vfddesigner.pas b/examples/apps/uidesigner/vfddesigner.pas
index c094c8c0..e2517e07 100644
--- a/examples/apps/uidesigner/vfddesigner.pas
+++ b/examples/apps/uidesigner/vfddesigner.pas
@@ -63,7 +63,6 @@ type
TDesignedForm = class(TfpgForm)
public
procedure AfterCreate; override;
- FormDesigner: TFormDesigner;
end;
@@ -275,6 +274,7 @@ var
wgd: TWidgetDesigner;
shift: boolean;
begin
+ writeln('TFormDesigner.MsgMouseDown');
FDragging := True;
FWasDrag := False;
FDragPosX := msg.Params.mouse.x;
@@ -311,6 +311,7 @@ var
shift: boolean;
x, y: integer;
begin
+writeln('TFormDesigner.MsgMouseUp');
FDragging := False;
shift := (ssShift in msg.Params.mouse.shiftstate);
@@ -480,8 +481,8 @@ var
l1: TfpgLabel;
ed1: TfpgEdit;
begin
- Exit;
-
+// Exit;
+ writeln('InitTest');
l1 := CreateLabel(FForm, 10, 10, 'Test Label');
ed1 := CreateEdit(FForm, 10, 50, 150, 0);
diff --git a/examples/apps/uidesigner/vfdfile.pas b/examples/apps/uidesigner/vfdfile.pas
index f31f82da..f7966327 100644
--- a/examples/apps/uidesigner/vfdfile.pas
+++ b/examples/apps/uidesigner/vfdfile.pas
@@ -34,39 +34,29 @@ type
Position: integer;
Data: string;
end;
+
TVFDFile = class
protected
FFileData: string;
FParsedData: string;
-
FBlocks: TList;
-
public
NewFormsDecl: string;
NewFormsImpl: string;
-
constructor Create;
destructor Destroy; override;
-
function LoadFile(fname: string): boolean;
-
procedure AddBlock(aposition: integer; ablockid, aformname, ablockdata: string);
function BlockCount: integer;
function Block(index: integer): TVFDFileBlock;
-
procedure FreeBlocks;
-
function GetBlocks: integer; // parse file
function MergeBlocks: string; // store file
-
procedure AddNewFormDecl(formname, formheadblock: string);
procedure AddNewFormImpl(formname, formbody: string);
-
function FindFormBlock(blockid, formname: string): TVFDFileBlock;
-
procedure SetFormData(formname, headblock, bodyblock: string);
-
procedure NewFileSkeleton(unitname: string);
end;
@@ -91,9 +81,13 @@ var
s: string;
begin
s :=
- ' T' + formname + ' = class(TGfxForm)'#10 + ' public'#10 + ' {@VFD_HEAD_BEGIN: ' + formname + '}'#10 +
- formheadblock + ' {@VFD_HEAD_END: ' + formname + '}'#10 + #10 + ' procedure AfterCreate; override;'#10
- + ' end;'#10 + ''#10;
+ ' T' + formname + ' = class(TfpgForm)' + LineEnding +
+ ' public' + LineEnding +
+ ' {@VFD_HEAD_BEGIN: ' + formname + '}' + LineEnding +
+ formheadblock +
+ ' {@VFD_HEAD_END: ' + formname + '}' + LineEnding + LineEnding +
+ ' procedure AfterCreate; override;' + LineEnding
+ + ' end;' + LineEnding + LineEnding;
NewFormsDecl := NewFormsDecl + s;
end;
@@ -101,8 +95,13 @@ procedure TVFDFile.AddNewFormImpl(formname, formbody: string);
var
s: string;
begin
- s := #10#10 + 'procedure T' + formname + '.AfterCreate;'#10 + 'begin'#10 + ' {@VFD_BODY_BEGIN: ' + formname + '}'#10 +
- formbody + ' {@VFD_BODY_END: ' + formname + '}'#10 + 'end;'#10;
+ s := LineEnding + LineEnding +
+ 'procedure T' + formname + '.AfterCreate;' + LineEnding +
+ 'begin' + LineEnding +
+ ' {@VFD_BODY_BEGIN: ' + formname + '}' + LineEnding +
+ formbody +
+ ' {@VFD_BODY_END: ' + formname + '}' + LineEnding +
+ 'end;' + LineEnding;
NewFormsImpl := NewFormsImpl + s;
end;
@@ -214,7 +213,7 @@ begin
deletelen := length(startmarker);
dropmarker := False;
- Writeln('marker: ', startmarker);
+// Writeln('marker: ', startmarker);
// block marker ?
@@ -322,7 +321,7 @@ begin
iblock := startmarker;
if endmarker <> '' then
- iblock := iblock + #10 + fb.Data + endmarker;
+ iblock := iblock + LineEnding + fb.Data + endmarker;
if fb.BlockID = 'VFD_NEWFORM_DECL' then
iblock := NewFormsDecl + iblock
@@ -348,13 +347,19 @@ end;
procedure TVFDFile.NewFileSkeleton(unitname: string);
begin
FFileData :=
- 'unit ' + unitname + ';'#10 + #10 + '{$ifdef FPC}'#10 + '{$mode objfpc}{$H+}'#10 +
- '{$endif}'#10 + ''#10 + 'interface'#10 + ''#10 + 'uses'#10 +
- ' SysUtils, Classes, gfxbase, wgedit, unitkeys, schar16, gfxstyle,'#10 +
- ' gfxwidget, gfxform, wglabel, wgbutton,'#10 + ' wglistbox, wgmemo, wgchoicelist, wggrid, sqldb, sqluis,'#10
- + ' wgdbgrid, gfxdialogs, wgcheckbox;'#10 + ''#10 + 'type'#10 + ''#10 +
- '{@VFD_NEWFORM_DECL}'#10 + ''#10 + 'implementation'#10 + ''#10 + '{@VFD_NEWFORM_IMPL}'#10
- + ''#10 + 'end.'#10;
+ 'unit ' + unitname + ';'+ LineEnding + LineEnding +
+ '{$mode objfpc}{$H+}' + LineEnding + LineEnding +
+ 'interface' + LineEnding + LineEnding +
+ 'uses' + LineEnding +
+ ' SysUtils, Classes, gfxbase, fpgfx, gui_edit, ' + LineEnding +
+ ' gfx_widget, gui_form, gui_label, gui_button,' + LineEnding +
+ ' gui_listbox, gui_memo, gui_combobox, gui_grid, ' + LineEnding +
+ ' gui_dialogs, gui_checkbox;' + LineEnding + LineEnding +
+ 'type' + LineEnding + LineEnding +
+ '{@VFD_NEWFORM_DECL}' + LineEnding + LineEnding +
+ 'implementation' + LineEnding + LineEnding +
+ '{@VFD_NEWFORM_IMPL}' + LineEnding + LineEnding +
+ 'end.' + LineEnding;
GetBlocks;
end;
diff --git a/examples/apps/uidesigner/vfdmain.pas b/examples/apps/uidesigner/vfdmain.pas
index 90a3564e..7945a03c 100644
--- a/examples/apps/uidesigner/vfdmain.pas
+++ b/examples/apps/uidesigner/vfdmain.pas
@@ -431,7 +431,7 @@ begin
s := ExtractFileName(FEditedFileName);
if s = '' then
s := '[new]';
- frmMain.WindowTitle := s + ' - fpGUI uiDesigner ' + program_version;
+ frmMain.WindowTitle := 'fpGUI uiDesigner v' + program_version + ' - ' + s;
end;
end.
diff --git a/src/corelib/gfx_widget.pas b/src/corelib/gfx_widget.pas
index 39a155c3..b0e22233 100644
--- a/src/corelib/gfx_widget.pas
+++ b/src/corelib/gfx_widget.pas
@@ -41,6 +41,7 @@ type
procedure MsgMouseScroll(var msg: TfpgMessageRec); message FPGM_SCROLL;
procedure SetActiveWidget(const AValue: TfpgWidget);
protected
+ FFormDesigner: TObject;
FVisible: boolean;
FEnabled: boolean;
FFocusable: boolean;
@@ -95,6 +96,7 @@ type
procedure MoveAndResizeBy(dx, dy, dw, dh: TfpgCoord);
procedure SetPosition(aleft, atop, awidth, aheight: TfpgCoord);
procedure Invalidate; // double check this works as developers expect????
+ property FormDesigner: TObject read FFormDesigner write FFormDesigner;
property Parent: TfpgWidget read GetParent write SetParent;
property ActiveWidget: TfpgWidget read FActiveWidget write SetActiveWidget;
property Visible: boolean read FVisible write SetVisible;
@@ -246,6 +248,12 @@ var
consumed: boolean;
wg: TfpgWidget;
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
key := msg.params.keyboard.keycode;
ss := msg.params.keyboard.shiftstate;
consumed := False;
@@ -269,6 +277,12 @@ var
consumed: boolean;
wg: TfpgWidget;
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
key := msg.params.keyboard.keycode;
ss := msg.params.keyboard.shiftstate;
consumed := False;
@@ -289,6 +303,12 @@ procedure TfpgWidget.MsgMouseDown(var msg: TfpgMessageRec);
var
mb: TMouseButton;
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
if not FEnabled then
exit; // Do we want this here?
@@ -318,6 +338,12 @@ var
mb: TMouseButton;
IsDblClick: boolean;
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
if not FEnabled then
exit; // Do we want this here?
@@ -359,6 +385,12 @@ end;
procedure TfpgWidget.MsgMouseMove(var msg: TfpgMessageRec);
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
HandleMouseMove(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.Buttons, msg.Params.mouse.shiftstate);
if Assigned(OnMouseMove) then
OnMouseMove(self, msg.Params.mouse.shiftstate,
@@ -382,6 +414,12 @@ end;
procedure TfpgWidget.MsgMouseEnter(var msg: TfpgMessageRec);
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
HandleMouseEnter;
if Assigned(FOnMouseEnter) then
FOnMouseEnter(self);
@@ -389,6 +427,12 @@ end;
procedure TfpgWidget.MsgMouseExit(var msg: TfpgMessageRec);
begin
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
HandleMouseExit;
if Assigned(FOnMouseExit) then
FOnMouseExit(Self);
@@ -706,6 +750,10 @@ end;
procedure TfpgWidget.MsgResize(var msg: TfpgMessageRec);
begin
HandleResize(msg.Params.rect.Width, msg.Params.rect.Height);
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ end;
end;
procedure TfpgWidget.HandleResize(awidth, aheight: TfpgCoord);
@@ -723,6 +771,10 @@ end;
procedure TfpgWidget.MsgMove(var msg: TfpgMessageRec);
begin
HandleMove(msg.Params.rect.left, msg.Params.rect.top);
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ end;
end;
procedure TfpgWidget.HandleMove(x, y: TfpgCoord);
diff --git a/src/gui/gui_dialogs.pas b/src/gui/gui_dialogs.pas
index 0cad667f..715685d4 100644
--- a/src/gui/gui_dialogs.pas
+++ b/src/gui/gui_dialogs.pas
@@ -716,8 +716,11 @@ begin
if grid.CurrentEntry.EntryType <> etDir then
edFileName.Text := grid.CurrentEntry.Name;
-
- btnOK.Enabled := grid.CurrentEntry.EntryType = etFile;
+
+ if FOpenMode then
+ btnOK.Enabled := grid.CurrentEntry.EntryType = etFile
+ else
+ btnOK.Enabled := edFileName.Text <> '';
lbFileInfo.Text := s;
end;
diff --git a/src/gui/gui_form.pas b/src/gui/gui_form.pas
index 4e075068..7acab61c 100644
--- a/src/gui/gui_form.pas
+++ b/src/gui/gui_form.pas
@@ -112,6 +112,13 @@ begin
if (fpgApplication.TopModalForm = nil) or (fpgApplication.TopModalForm = self) then
begin
FocusRootWidget := self;
+
+ if FFormDesigner <> nil then
+ begin
+ FFormDesigner.Dispatch(msg);
+ Exit;
+ end;
+
if ActiveWidget = nil then
ActiveWidget := FindFocusWidget(nil, fsdFirst)
else