summaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-27 23:04:56 -0700
committerDavid Laurence Emerson <dle3ab@angelbase.com>2013-05-27 23:04:56 -0700
commitec68e3ec7ea545a2165644a3ec08ca9e36be2402 (patch)
tree131fe96875f9c26e6b444b6add4ad712ec6f4a18 /examples
parent486f4f48ff250ce64ab532a302b6bbd6c05c4050 (diff)
parentc45010b6370b50f8e6192ddb7dc3d7762c8c29f7 (diff)
downloadfpGUI-ec68e3ec7ea545a2165644a3ec08ca9e36be2402.tar.xz
Merge branch 'master' into scroll-frame
Conflicts: src/corelib/x11/fpgui_toolkit.lpk
Diffstat (limited to 'examples')
-rw-r--r--examples/apps/debugserver/fpgDebugServer.lpi2
-rw-r--r--examples/apps/docedit/docedit.lpi22
-rw-r--r--examples/apps/docedit/frm_main.pas4
-rw-r--r--examples/apps/ide/src/builderthread.pas18
-rw-r--r--examples/apps/ide/src/filemonitor.pas16
-rw-r--r--examples/apps/ide/src/fpg_textedit.pas47
-rw-r--r--examples/apps/ide/src/frm_configureide.pas16
-rw-r--r--examples/apps/ide/src/frm_debug.pas16
-rw-r--r--examples/apps/ide/src/frm_find.pas21
-rw-r--r--examples/apps/ide/src/frm_main.pas203
-rw-r--r--examples/apps/ide/src/frm_procedurelist.pas29
-rw-r--r--examples/apps/ide/src/frm_projectoptions.pas16
-rw-r--r--examples/apps/ide/src/ideconst.pas16
-rw-r--r--examples/apps/ide/src/ideimages.pas16
-rw-r--r--examples/apps/ide/src/idemacros.pas16
-rw-r--r--examples/apps/ide/src/ideutils.pas20
-rw-r--r--examples/apps/ide/src/maximus.lpr16
-rw-r--r--examples/apps/ide/src/maximus.project33
-rw-r--r--examples/apps/ide/src/project.pas17
-rw-r--r--examples/apps/ide/src/stringhelpers.pas16
-rw-r--r--examples/apps/ide/src/templates/default/program.pas11
-rw-r--r--examples/apps/ide/src/templates/default/unit.pas9
-rw-r--r--examples/apps/ide/src/templates/fpgui/mainform.pas45
-rw-r--r--examples/apps/ide/src/templates/fpgui/program.pas31
-rw-r--r--examples/apps/ide/src/templates/fpgui/program_all_in_one.pas55
-rw-r--r--examples/apps/ide/src/templates/fpgui/simpleform.pas45
-rw-r--r--examples/apps/ide/src/templates/fptest/program.pas30
-rw-r--r--examples/apps/ide/src/templates/fptest/testunit.pas39
-rw-r--r--examples/apps/ide/src/unitlist.pas16
-rw-r--r--examples/corelib/aggcanvas/agg_canvas_test.lpi71
-rw-r--r--examples/corelib/aggcanvas/agg_canvas_test.lpr389
-rw-r--r--examples/corelib/aggcanvas/arial.ttfbin0 -> 275572 bytes
-rw-r--r--examples/corelib/aggcanvas/arialbd.ttfbin0 -> 286620 bytes
-rw-r--r--examples/corelib/aggcanvas/extrafpc.cfg5
-rw-r--r--examples/corelib/aggcanvas/times.ttfbin0 -> 409280 bytes
-rw-r--r--examples/corelib/aggcanvas/timesi.ttfbin0 -> 248368 bytes
-rw-r--r--examples/gui/command_interface/commands.pas18
-rw-r--r--examples/gui/command_interface/frm_main.pas23
-rw-r--r--examples/gui/reporting/u_demo.pas51
-rw-r--r--examples/gui/sprites/background.bmpbin0 -> 439262 bytes
-rw-r--r--examples/gui/sprites/ide_icon48x48.bmpbin6966 -> 0 bytes
-rw-r--r--examples/gui/sprites/splash_logo.bmpbin439262 -> 0 bytes
-rw-r--r--examples/gui/sprites/spritedemo.lpr5
-rw-r--r--examples/gui/sprites/ufo.bmpbin0 -> 5598 bytes
-rw-r--r--examples/gui/stdimages/stdimglist.lpi18
-rw-r--r--examples/gui/stdimages/stdimglist.lpr4
46 files changed, 1266 insertions, 159 deletions
diff --git a/examples/apps/debugserver/fpgDebugServer.lpi b/examples/apps/debugserver/fpgDebugServer.lpi
index da1b22f2..f26f35ee 100644
--- a/examples/apps/debugserver/fpgDebugServer.lpi
+++ b/examples/apps/debugserver/fpgDebugServer.lpi
@@ -54,7 +54,7 @@
<CompilerOptions>
<Version Value="11"/>
<Target>
- <Filename Value="fpgDebugServer"/>
+ <Filename Value="dbugsrv"/>
</Target>
<SearchPaths>
<UnitOutputDirectory Value="units/$(TargetCPU)-$(TargetOS)"/>
diff --git a/examples/apps/docedit/docedit.lpi b/examples/apps/docedit/docedit.lpi
index 640d3114..3e06fdd7 100644
--- a/examples/apps/docedit/docedit.lpi
+++ b/examples/apps/docedit/docedit.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <Version Value="7"/>
+ <Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
@@ -9,11 +9,13 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <TargetFileExt Value=""/>
</General>
<VersionInfo>
- <ProjectVersion Value=""/>
+ <StringTable ProductVersion=""/>
</VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="default" Default="True"/>
+ </BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@@ -69,9 +71,19 @@
</Units>
</ProjectOptions>
<CompilerOptions>
- <Version Value="8"/>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="docedit"/>
+ </Target>
+ <SearchPaths>
+ <UnitOutputDirectory Value="units"/>
+ </SearchPaths>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
<Other>
- <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/apps/docedit/frm_main.pas b/examples/apps/docedit/frm_main.pas
index f6404b79..884a2d5b 100644
--- a/examples/apps/docedit/frm_main.pas
+++ b/examples/apps/docedit/frm_main.pas
@@ -63,7 +63,9 @@ type
implementation
uses
- fpg_dialogs, frm_options;
+ fpg_dialogs,
+ fpg_constants,
+ frm_options;
const
diff --git a/examples/apps/ide/src/builderthread.pas b/examples/apps/ide/src/builderthread.pas
index bfdc48b1..b5a1ad6f 100644
--- a/examples/apps/ide/src/builderthread.pas
+++ b/examples/apps/ide/src/builderthread.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit BuilderThread;
{$mode objfpc}{$H+}
@@ -115,7 +131,7 @@ begin
finally
FreeAndNil(p);
end;
-
+
end;
procedure TBuilderThread.DoOutputLine;
diff --git a/examples/apps/ide/src/filemonitor.pas b/examples/apps/ide/src/filemonitor.pas
index 1c97185a..6d28642c 100644
--- a/examples/apps/ide/src/filemonitor.pas
+++ b/examples/apps/ide/src/filemonitor.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit filemonitor;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/fpg_textedit.pas b/examples/apps/ide/src/fpg_textedit.pas
index b68c78b3..013ad86b 100644
--- a/examples/apps/ide/src/fpg_textedit.pas
+++ b/examples/apps/ide/src/fpg_textedit.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,
@@ -124,17 +124,20 @@ type
function GetGutterVisible: Boolean;
function GetHScrollPos: Integer;
function GetVScrollPos: Integer;
+ function GetCaretPosH: Integer;
+ function GetCaretPosV: Integer;
procedure SetFontDesc(const AValue: string);
procedure SetGutterShowLineNumbers(const AValue: Boolean);
procedure SetGutterVisible(const AValue: Boolean);
procedure SetHScrollPos(const AValue: Integer);
+ procedure SetCaretPosH(const AValue: Integer);
+ procedure SetCaretPosV(const AValue: Integer);
procedure SetLines(const AValue: TStrings);
procedure SetScrollBarStyle(const AValue: TfpgScrollStyle);
procedure SetTabWidth(const AValue: Integer);
procedure SetVScrollPos(const AValue: Integer);
procedure UpdateCharBounds;
procedure GetSelBounds(var AStartNo, AEndNo, AStartOffs, AEndOffs: Integer);
- procedure UpdateScrollBars;
procedure VScrollBarMove(Sender: TObject; position: integer);
procedure HScrollBarMove(Sender: TObject; position: integer);
procedure SetVPos(p: Integer);
@@ -181,6 +184,7 @@ type
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
+ procedure UpdateScrollBars;
function GetClientRect: TfpgRect; override;
function GetWordAtPos(const X, Y: Integer; out XBegin: Integer): TfpgString;
procedure GetRowColAtPos(const X, Y: Integer; out Row, Col: Integer);
@@ -196,6 +200,8 @@ type
procedure SaveToFile(const AFileName: TfpgString);
procedure LoadFromFile(const AFileName: TfpgString);
procedure FindText(TextToFind: TfpgString; FindOptions: TfpgFindOptions; Backward: Boolean = False);
+ property CaretPos_H: Integer read GetCaretPosH write SetCaretPosH;
+ property CaretPos_V: Integer read GetCaretPosV write SetCaretPosV;
property FontHeight: Integer read FChrH;
property FontWidth: Integer read FChrW;
property ScrollPos_H: Integer read GetHScrollPos write SetHScrollPos;
@@ -418,6 +424,16 @@ begin
Result := VPos;
end;
+function TfpgBaseTextEdit.GetCaretPosH: Integer;
+begin
+ Result := CaretPos.Y;
+end;
+
+function TfpgBaseTextEdit.GetCaretPosV: Integer;
+begin
+ Result := CaretPos.X;
+end;
+
procedure TfpgBaseTextEdit.SetFontDesc(const AValue: string);
begin
FFont.Free;
@@ -455,6 +471,16 @@ begin
FTabWidth := AValue;
end;
+procedure TfpgBaseTextEdit.SetCaretPosH(const AValue: integer);
+begin
+ CaretPos.Y := AValue;
+end;
+
+procedure TfpgBaseTextEdit.SetCaretPosV(const AValue: integer);
+begin
+ CaretPos.X := AValue;
+end;
+
procedure TfpgBaseTextEdit.SetVScrollPos(const AValue: Integer);
begin
SetVPos(AValue);
@@ -666,7 +692,7 @@ end;
to set selection if Shift key is pressed. }
procedure TfpgBaseTextEdit.KeyboardCaretNav(const ShiftState: TShiftState; const AKeyCode: Word);
var
- SaveXCaret: Integer;
+ SaveYCaretOffset: Integer;
procedure CtrlKeyLeftKey;
var
@@ -971,6 +997,8 @@ begin
CaretPos.Y := 0;
CaretPos.X := 0;
end;
+ ScrollPos_V := 0;
+ UpdateScrollBars;
Exit;
end;
if ssShift in ShiftState then
@@ -1017,6 +1045,8 @@ begin
CaretPos.Y := pred(FLines.Count);
CaretPos.X := Length(FLines[CaretPos.Y]);
end;
+ ScrollPos_V := CaretPos.Y - FVisLines;
+ UpdateScrollBars;
Exit;
end;
if ssShift in ShiftState then
@@ -1048,7 +1078,7 @@ begin
FSelStartNo := CaretPos.Y;
FSelStartOffs := CaretPos.X;
end;
- SaveXCaret := CaretPos.Y - FTopLine;
+ SaveYCaretOffset := CaretPos.Y - FTopLine;
if AKeyCode = keyPageUp then
begin
if VPos = 0 then
@@ -1062,15 +1092,15 @@ begin
if FVScrollBar.Visible then
FVScrollBar.PageUp;
// restore caret at same line offset as before
- CaretPos.Y := FTopLine + SaveXCaret;
+ CaretPos.Y := FTopLine + SaveYCaretOffset;
end;
end
else
- begin
+ begin { PageDown handling }
if VPos > (FLines.Count - FVisLines) then
begin
CaretPos.Y := FLines.Count-1;
- CaretPos.X := Length(FLines[CaretPos.Y]);
+ CaretPos.X := UTF8Length(FLines[CaretPos.Y]);
end
else
begin
@@ -1078,7 +1108,7 @@ begin
if FVScrollBar.Visible then
FVScrollBar.PageDown;
// restore caret at same line offset as before
- CaretPos.Y := FTopLine + SaveXCaret;
+ CaretPos.Y := FTopLine + SaveYCaretOffset;
end;
end;
if ssShift in ShiftState then
@@ -1677,6 +1707,7 @@ begin
if SLine = '' then // short circut the code block
begin
FLines.Delete(CaretPos.Y);
+ FVScrollBar.Max := FVScrollBar.Max - 1;
end
else
begin
diff --git a/examples/apps/ide/src/frm_configureide.pas b/examples/apps/ide/src/frm_configureide.pas
index 2b2e42c1..fad0418f 100644
--- a/examples/apps/ide/src/frm_configureide.pas
+++ b/examples/apps/ide/src/frm_configureide.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit frm_configureide;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/frm_debug.pas b/examples/apps/ide/src/frm_debug.pas
index 267871c2..6991b916 100644
--- a/examples/apps/ide/src/frm_debug.pas
+++ b/examples/apps/ide/src/frm_debug.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit frm_debug;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/frm_find.pas b/examples/apps/ide/src/frm_find.pas
index 03e27dd2..3ec856f7 100644
--- a/examples/apps/ide/src/frm_find.pas
+++ b/examples/apps/ide/src/frm_find.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit frm_find;
{$mode objfpc}{$H+}
@@ -88,6 +104,11 @@ begin
begin
Consumed := True;
btnFind.Click;
+ end
+ else if KeyCode = keyEscape then
+ begin
+ Consumed := True;
+ Close;
end;
end;
diff --git a/examples/apps/ide/src/frm_main.pas b/examples/apps/ide/src/frm_main.pas
index 92d5243e..6ef73f50 100644
--- a/examples/apps/ide/src/frm_main.pas
+++ b/examples/apps/ide/src/frm_main.pas
@@ -1,3 +1,21 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ Maximus IDE is an example application, to showcase a bit more of
+ what fpGUI can do in a larger project. It also ties in a lot of
+ various fpGUI widgets and framework functionality.
+}
+
unit frm_main;
{$mode objfpc}{$H+}
@@ -22,7 +40,6 @@ type
btnOpen: TfpgButton;
btnSave: TfpgButton;
btnSaveAll: TfpgButton;
- btnTest: TfpgButton;
pnlStatusBar: TfpgBevel;
lblStatus: TfpgLabel;
pnlClientArea: TfpgBevel;
@@ -39,8 +56,6 @@ type
tsFiles: TfpgTabSheet;
grdFiles: TfpgFileGrid;
Splitter2: TfpgSplitter;
- grdOpenFiles: TfpgStringGrid;
- Splitter3: TfpgSplitter;
pcEditor: TfpgPageControl;
tseditor: TfpgTabSheet;
TextEditor: TfpgTextEdit;
@@ -54,7 +69,11 @@ type
mnuSettings: TfpgPopupMenu;
mnuHelp: TfpgPopupMenu;
{@VFD_HEAD_END: MainForm}
+ {$ifdef DEBUGSVR}
+ btnTest: TfpgButton;
+ {$endif}
pmOpenRecentMenu: TfpgPopupMenu;
+ miFile: TfpgMenuItem;
miRecentProjects: TfpgMenuItem;
FRecentFiles: TfpgMRU;
FRegex: TRegExpr;
@@ -68,6 +87,7 @@ type
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure btnQuitClicked(Sender: TObject);
procedure btnOpenFileClicked(Sender: TObject);
+ procedure miFileNewUnit(Sender: TObject);
procedure miFileSave(Sender: TObject);
procedure miFileSaveAs(Sender: TObject);
procedure miEditCutClicked(Sender: TObject);
@@ -95,8 +115,10 @@ type
procedure miRecentProjectsClick(Sender: TObject; const FileName: String);
procedure miProjectSave(Sender: TObject);
procedure miProjectSaveAs(Sender: TObject);
+ procedure AddUnitToProject(const AUnitName: TfpgString);
procedure miProjectAddUnitToProject(Sender: TObject);
procedure tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
+ procedure grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
procedure TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
procedure BuildTerminated(Sender: TObject);
procedure BuildOutput(Sender: TObject; const ALine: string);
@@ -108,6 +130,7 @@ type
procedure ClearMessagesWindow;
procedure CloseAllTabs;
procedure LoadProject(const AFilename: TfpgString);
+ function CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet;
function OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet;
procedure miTest(Sender: TObject);
function GetUnitsNode: TfpgTreeNode;
@@ -176,6 +199,34 @@ begin
end;
end;
+procedure TMainForm.miFileNewUnit(Sender: TObject);
+var
+ newunit: TfpgString;
+ sl: TStringList;
+ FInternalMacroList: TIDEMacroList;
+ i: integer;
+begin
+ if fpgInputQuery('New Unit', 'Please give the new unit a file name', newunit) then
+ begin
+ if GProject.UnitList.FileExists(newunit) then
+ begin
+ ShowMessage(Format('The unit <%s> already exists in the project', [newunit]));
+ Exit;
+ end;
+ sl := TStringList.Create;
+ try
+ sl.LoadFromFile(GMacroList.ExpandMacro('${TEMPLATEDIR}default/unit.pas'));
+ sl.Text := StringReplace(sl.Text, '${UNITNAME}', fpgChangeFileExt(fpgExtractFileName(newunit), ''), [rfReplaceAll, rfIgnoreCase]);
+ sl.SaveToFile(GProject.ProjectDir + newunit);
+ finally
+ sl.Free;
+ end;
+// AddUnitToProject(newunit);
+
+ OpenEditorPage(newunit);
+ end;
+end;
+
procedure TMainForm.miFileSave(Sender: TObject);
var
s: TfpgString;
@@ -471,6 +522,7 @@ begin
s := s + cProjectExt;
try
GProject.Save(s);
+ FRecentFiles.AddItem(s);
except
on E: Exception do
begin
@@ -482,26 +534,20 @@ begin
end;
end;
-procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
+procedure TMainForm.AddUnitToProject(const AUnitName: TfpgString);
var
u: TUnit;
s: TfpgString;
r: TfpgTreeNode;
n: TfpgTreeNode;
begin
- s := pcEditor.ActivePage.Hint;
-// writeln('adding unit: ', s);
- if s = '' then
- Exit;
- if GProject.UnitList.FileExists(s) then
- Exit;
u := TUnit.Create;
- u.FileName := s;
+ u.FileName := AUnitName;
u.Opened := True;
GProject.UnitList.Add(u);
// add reference to tabsheet
pcEditor.ActivePage.TagPointer := u;
- s := ExtractRelativepath(GProject.ProjectDir, u.FileName);
+ s := fpgExtractRelativepath(GProject.ProjectDir, u.FileName);
r := GetUnitsNode;
n := r.AppendText(s);
// add reference to treenode
@@ -509,6 +555,19 @@ begin
tvProject.Invalidate;
end;
+procedure TMainForm.miProjectAddUnitToProject(Sender: TObject);
+var
+ s: TfpgString;
+begin
+ s := pcEditor.ActivePage.Hint;
+// writeln('adding unit: ', s);
+ if s = '' then
+ Exit;
+ if GProject.UnitList.FileExists(s) then
+ Exit;
+ AddUnitToProject(s);
+end;
+
procedure TMainForm.tvProjectDoubleClick(Sender: TObject; AButton: TMouseButton; AShift: TShiftState; const AMousePos: TPoint);
var
r: TfpgTreeNode;
@@ -528,6 +587,22 @@ begin
end;
end;
+procedure TMainForm.grdMessageKeyPressed(Sender: TObject; var KeyCode: Word; var ShiftState: TShiftState; var Consumed: Boolean);
+var
+ cr: TClipboardKeyType;
+ i: integer;
+ s: TfpgString;
+begin
+ cr := CheckClipboardKey(KeyCode, ShiftState);
+ if cr = ckCopy then
+ begin
+ s := '';
+ for i := 0 to grdMessages.RowCount-1 do
+ s := s + grdMessages.Cells[0, i] + LineEnding;
+ fpgClipboard.Text := s;
+ end;
+end;
+
procedure TMainForm.TabSheetClosing(Sender: TObject; ATabSheet: TfpgTabSheet);
var
u: TUnit;
@@ -578,8 +653,7 @@ begin
begin
for i := 0 to GProject.UnitList.Count-1 do
begin
- {$Note ExtractRelativePath still needs a fpGUI wrapper }
- s := ExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName);
+ s := fpgExtractRelativepath(GProject.ProjectDir, GProject.UnitList[i].FileName);
n := r.AppendText(s);
n.Data := GProject.UnitList[i];
end;
@@ -655,6 +729,20 @@ begin
AddMessage('Project loaded');
end;
+function TMainForm.CreateNewEditorTab(const ATitle: TfpgString): TfpgTabSheet;
+var
+ m: TfpgTextEdit;
+begin
+ Result := pcEditor.AppendTabSheet(ATitle);
+ m := TfpgTextEdit.Create(Result);
+ m.SetPosition(1, 1, 200, 20);
+ m.Align := alClient;
+ m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2');
+ m.GutterVisible := True;
+ m.GutterShowLineNumbers := True;
+ m.RightEdge := True;
+end;
+
function TMainForm.OpenEditorPage(const AFilename: TfpgString): TfpgTabSheet;
var
s: TfpgString;
@@ -662,10 +750,11 @@ var
i: integer;
found: Boolean;
ts: TfpgTabSheet;
- m: TfpgTextEdit;
ext: TfpgString;
pos_h: integer;
pos_v: integer;
+ cur_pos_h: integer;
+ cur_pos_v: integer;
editor: TfpgTextEdit;
begin
s := AFilename;
@@ -684,10 +773,15 @@ begin
editor := TfpgTextEdit(pcEditor.Pages[i].Components[0]);
pos_h := editor.ScrollPos_H;
pos_v := editor.ScrollPos_V;
+ cur_pos_h := editor.CaretPos_H;
+ cur_pos_v := editor.CaretPos_V;
editor.Lines.BeginUpdate;
editor.LoadFromFile(s);
editor.ScrollPos_H := pos_h;
editor.ScrollPos_V := pos_v;
+ editor.CaretPos_H := cur_pos_h;
+ editor.CaretPos_V := cur_pos_v;
+ editor.UpdateScrollBars;
editor.Lines.EndUpdate;
pcEditor.ActivePageIndex := i;
ts := pcEditor.ActivePage;
@@ -696,17 +790,12 @@ begin
else
begin
// we need a new tabsheet
- ts := pcEditor.AppendTabSheet(f);
- m := TfpgTextEdit.Create(ts);
- m.SetPosition(1, 1, 200, 20);
- m.Align := alClient;
- m.FontDesc := gINI.ReadString(cEditor, 'Font', '#Edit2');
- m.GutterVisible := True;
- m.GutterShowLineNumbers := True;
- m.RightEdge := True;
- TfpgTextEdit(ts.Components[0]).Lines.BeginUpdate;
- TfpgTextEdit(ts.Components[0]).Lines.LoadFromFile(s);
- TfpgTextEdit(ts.Components[0]).Lines.EndUpdate;
+ ts := CreateNewEditorTab(f);
+ editor := ts.Components[0] as TfpgTextEdit;
+ editor.Lines.BeginUpdate;
+ if fpgFileExists(s) then
+ editor.Lines.LoadFromFile(s);
+ editor.Lines.EndUpdate;
if gINI.ReadBool(cEditor, 'SyntaxHighlighting', True) then
begin
ext := fpgExtractFileExt(AFilename);
@@ -733,12 +822,14 @@ var
s: TfpgString;
r: TfpgString;
begin
+ {$ifdef DEBUGSVR}
TempHourGlassCursor(TfpgWidget(self));
s := cMacro_Compiler + ' -FU' +cMacro_Target+' -Fu' + cMacro_FPGuiLibDir;
-// writeln('source string = ', s);
+ SendDebug('source string = ' + s);
r := GMacroList.ExpandMacro(s);
-// writeln('expanded string = ', r);
+ SendDebug('expanded string = ' + r);
sleep(5000);
+ {$endif}
end;
function TMainForm.GetUnitsNode: TfpgTreeNode;
@@ -1243,20 +1334,6 @@ begin
TabOrder := 6;
end;
- btnTest := TfpgButton.Create(Toolbar);
- with btnTest do
- begin
- Name := 'btnTest';
- SetPosition(168, 2, 80, 24);
- Text := 'test';
- Down := False;
- FontDesc := '#Label1';
- Hint := '';
- ImageName := '';
- TabOrder := 7;
- OnClick := @miTest;
- end;
-
pnlStatusBar := TfpgBevel.Create(self);
with pnlStatusBar do
begin
@@ -1325,6 +1402,7 @@ begin
RowSelect := True;
ShowHeader := False;
TabOrder := 13;
+ OnKeyPress := @grdMessageKeyPressed;
end;
tsScribble := TfpgTabSheet.Create(pnlWindow);
@@ -1420,31 +1498,6 @@ begin
Align := alLeft;
end;
- grdOpenFiles := TfpgStringGrid.Create(pnlClientArea);
- with grdOpenFiles do
- begin
- Name := 'grdOpenFiles';
- SetPosition(516, 2, 120, 279);
- Align := alRight;
- BackgroundColor := TfpgColor($80000002);
- AddColumn('File', 100, taLeftJustify);
- FontDesc := '#Grid';
- HeaderFontDesc := '#GridHeader';
- Hint := '';
- RowCount := 0;
- RowSelect := True;
- ShowHeader := False;
- TabOrder := 24;
- end;
-
- Splitter3 := TfpgSplitter.Create(pnlClientArea);
- with Splitter3 do
- begin
- Name := 'Splitter3';
- SetPosition(508, 2, 8, 279);
- Align := alRight;
- end;
-
pcEditor := TfpgPageControl.Create(pnlClientArea);
with pcEditor do
begin
@@ -1483,7 +1536,7 @@ begin
begin
Name := 'mnuFile';
SetPosition(476, 61, 172, 20);
- AddMenuItem('New...', rsKeyCtrl+'N', nil).Enabled := False;
+ miFile := AddMenuItem('New...', rsKeyCtrl+'N', @miFileNewUnit);
AddMenuItem('-', '', nil);
AddMenuItem('Open...', rsKeyCtrl+'O', @btnOpenFileClicked);
AddMenuItem('Open Recent', '', nil).Enabled := False;
@@ -1643,6 +1696,20 @@ begin
FRecentFiles.LoadMRU;
{$IFDEF DEBUGSVR}
+ btnTest := TfpgButton.Create(Toolbar);
+ with btnTest do
+ begin
+ Name := 'btnTest';
+ SetPosition(168, 2, 80, 24);
+ Text := 'test';
+ Down := False;
+ FontDesc := '#Label1';
+ Hint := '';
+ ImageName := '';
+ TabOrder := 7;
+ OnClick := @miTest;
+ end;
+
SendMethodExit('TMainForm.AfterCreate');
{$ENDIF}
end;
diff --git a/examples/apps/ide/src/frm_procedurelist.pas b/examples/apps/ide/src/frm_procedurelist.pas
index 4b5b7548..14eb77dd 100644
--- a/examples/apps/ide/src/frm_procedurelist.pas
+++ b/examples/apps/ide/src/frm_procedurelist.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit frm_procedurelist;
{$mode objfpc}{$H+}
@@ -194,7 +210,7 @@ begin
{
E := TSimpleEngine.Create;
try
- writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget]));
+// writeln(Format('Parsing file <%s> for OS <%s> and CPU <%s>', [FFilename, OSTarget, CPUTarget]));
M := ParseSource(E, FFilename, OSTarget, CPUTarget);
{ Cool, we successfully parsed the unit.
@@ -203,8 +219,7 @@ begin
for I := 0 to Decls.Count - 1 do
begin
p := TObject(Decls[I]) as TPasElement;
- Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']');
-
+// Writeln('Interface item ', I, ': ' + p.Name + ' [line ' + IntToStr(p.SourceLinenumber) + ']');
end;
FreeAndNil(M);
finally
@@ -357,7 +372,7 @@ begin
else if StrContains('destructor', ProcName, False) then // Do not localize.
Result := ImageIndexTrash
else if StrBeginsWith('class proc', ProcName, False) // Do not localize.
- or StrContains('class func', ProcName, False)
+ or StrContains('class func', ProcName, False)
or (ProcClass <> '') then
Result := ImageIndexGear
else
@@ -991,7 +1006,7 @@ begin
finally
SFile.Free;
end;
- SendDebug('Procedure List: Starting Parse');
+// SendDebug('Procedure List: Starting Parse');
case Language of
ltPas: Parser.Origin := MemStream.Memory;
// ltCpp: CParser.SetOrigin(MemStream.Memory, MemStream.Size);
@@ -1004,7 +1019,7 @@ begin
finally
LoadObjectCombobox;
end;
- SendDebug('Procedure List: QuickSorting procedures');
+// SendDebug('Procedure List: QuickSorting procedures');
QuickSort(0, FProcList.Count - 1);
// StatusBar.Panels[1].Text := Trim(IntToStr(lvProcs.Items.Count));
finally
@@ -1155,7 +1170,7 @@ begin
FLanguage := ltPas;
FSearchAll := True; // search anywhere in a method name
// FImageList := TfpgImageList.Create;
-
+
// CreateImage_BMP(@grdimg_destructor_16, SizeOf(grdimg_destructor_16));
fpgImages.AddMaskedBMP( // 16x16 image
diff --git a/examples/apps/ide/src/frm_projectoptions.pas b/examples/apps/ide/src/frm_projectoptions.pas
index 74178090..1e1c318a 100644
--- a/examples/apps/ide/src/frm_projectoptions.pas
+++ b/examples/apps/ide/src/frm_projectoptions.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit frm_projectoptions;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideconst.pas b/examples/apps/ide/src/ideconst.pas
index 03c43ec4..38973457 100644
--- a/examples/apps/ide/src/ideconst.pas
+++ b/examples/apps/ide/src/ideconst.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit ideconst;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideimages.pas b/examples/apps/ide/src/ideimages.pas
index 6963e6e9..929267af 100644
--- a/examples/apps/ide/src/ideimages.pas
+++ b/examples/apps/ide/src/ideimages.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit ideimages;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/idemacros.pas b/examples/apps/ide/src/idemacros.pas
index deee6507..e7632a07 100644
--- a/examples/apps/ide/src/idemacros.pas
+++ b/examples/apps/ide/src/idemacros.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit idemacros;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/ideutils.pas b/examples/apps/ide/src/ideutils.pas
index 672103f3..3a75dc0b 100644
--- a/examples/apps/ide/src/ideutils.pas
+++ b/examples/apps/ide/src/ideutils.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit ideutils;
{$mode objfpc}{$H+}
@@ -101,7 +117,7 @@ type
constructor Create(var AWidget: TfpgWidget);
destructor Destroy; override;
end;
-
+
constructor TTempHourClassCursor.Create(var AWidget: TfpgWidget);
begin
inherited Create;
@@ -115,7 +131,7 @@ begin
FWidget.MouseCursor := FOldCursor;
inherited Destroy;
end;
-
+
function TempHourGlassCursor(var AWidget: TfpgWidget): IInterface;
diff --git a/examples/apps/ide/src/maximus.lpr b/examples/apps/ide/src/maximus.lpr
index d481ba4a..1f758a43 100644
--- a/examples/apps/ide/src/maximus.lpr
+++ b/examples/apps/ide/src/maximus.lpr
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
program maximus;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/maximus.project b/examples/apps/ide/src/maximus.project
index 8c2f4261..31af43e3 100644
--- a/examples/apps/ide/src/maximus.project
+++ b/examples/apps/ide/src/maximus.project
@@ -3,19 +3,19 @@ ProjectName=maximus.project
MainUnit=maximus.lpr
TargetFile=maximus${EXEEXT}
DefaultMake=0
-MakeOptionsCount=5
+MakeOptionsCount=7
MakeOptionEnabled1=1,1,1,1,1,1
MakeOptionEnabled2=1,1,1,1,1,0
-MakeOptionEnabled3=0,1,0,0,0,1
+MakeOptionEnabled3=1,1,0,0,0,1
MakeOptionEnabled4=0,0,0,0,1,1
-MacroCount=6
-Macro1=TargetCPU=x86_64
-Macro2=TargetOS=linux
-Macro3=TargetCPU=i386
-Macro4=TargetOS=win32
+MacroCount=4
+Macro1=TargetCPU=i386
+Macro2=TargetOS=win32
+Macro3=FPGUI_DIR=/home/graemeg/programming/fpgui/
+Macro4=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/
Macro5=FPGUI_DIR=/home/graemeg/programming/fpgui/
Macro6=tiOPF_fpGUI_Dir=/home/graemeg/programming/3rdParty/tiOPF2/src/
-UnitDirsCount=7
+UnitDirsCount=8
UnitDirEnabled1=1,1,1,1,0,0,0,1,0,0
UnitDirEnabled2=1,1,1,1,0,0,1,1,0,0
UnitDirEnabled3=1,1,1,0,0,0,1,1,0,0
@@ -23,14 +23,18 @@ UnitDirEnabled4=0,0,0,1,0,0,1,1,0,0
UnitDirEnabled5=1,1,1,1,0,0,1,1,0,0
UnitDirEnabled6=1,1,1,1,0,0,1,0,0,0
UnitDirEnabled7=0,0,0,0,1,1,1,0,0,0
-UnitDirEnabled8=0,0,0,0,0,1,1,0,0,0
+UnitDirEnabled8=1,0,0,0,0,0,1,1,0,0
UnitOutputDir=units/${TARGET}/
MakeOptionEnabled5=1,0,0,0,0,0
+MakeOptionEnabled6=1,0,0,0,0,0
+MakeOptionEnabled7=0,0,0,0,0,0
MakeOption1=-l -Mobjfpc -Sch
MakeOption2=-g -gl -O- -gw2 -godwarfsets
MakeOption3=-B
MakeOption4=-O2 -XX -Xs -CX
MakeOption5=-veiw
+MakeOption6=-dDEBUGSVR
+MakeOption7=-dAGGCanvas
UnitDir1=${FPGUIDIR}src/
UnitDir2=${FPGUIDIR}src/corelib/
UnitDir3=${FPGUIDIR}src/corelib/x11/
@@ -38,26 +42,27 @@ UnitDir4=${FPGUIDIR}src/corelib/gdi/
UnitDir5=${FPGUIDIR}src/gui/
UnitDir6=${FPGUIDIR}src/gui/db/
UnitDir7=${FPGUILIBDIR}
+UnitDir8=${FPGUIDIR}src/corelib/render/software/
[Units]
UnitCount=20
Unit1=builderthread.pas,0
Unit2=filemonitor.pas,0
-Unit3=fpg_textedit.pas,0
+Unit3=fpg_textedit.pas,-1
Unit4=frm_configureide.pas,0
Unit5=frm_debug.pas,0
Unit6=frm_find.pas,-1
Unit7=frm_main.pas,-1
-Unit8=frm_procedurelist.pas,0
-Unit9=frm_projectoptions.pas,0
+Unit8=frm_procedurelist.pas,-1
+Unit9=frm_projectoptions.pas,-1
Unit10=ideconst.pas,0
Unit11=ideimages.pas,0
-Unit12=idemacros.pas,0
+Unit12=idemacros.pas,-1
Unit13=ideutils.pas,0
Unit14=maximus.lpr,0
Unit15=mPasLex.pas,0
Unit16=project.pas,-1
Unit17=sha1.pas,0
Unit18=stringhelpers.pas,0
-Unit19=synregexpr.pas,-1
+Unit19=synregexpr.pas,0
Unit20=unitlist.pas,0
diff --git a/examples/apps/ide/src/project.pas b/examples/apps/ide/src/project.pas
index cde77fdf..a82a23c5 100644
--- a/examples/apps/ide/src/project.pas
+++ b/examples/apps/ide/src/project.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit Project;
{$mode objfpc}{$H+}
@@ -254,6 +270,7 @@ begin
FIniFile := TfpgINIFile.CreateExt(AProjectFile);
ProjectDir := fpgExtractFilePath(AProjectFile);
+ fpgSetCurrentDir(ProjectDir);
ProjectName := FIniFile.ReadString(cProjectOptions, 'ProjectName', fpgChangeFileExt(fpgExtractFileName(AProjectFile), ''));
MainUnit := FIniFile.ReadString(cProjectOptions, 'MainUnit', '');
TargetFile := FIniFile.ReadString(cProjectOptions, 'TargetFile', '');
diff --git a/examples/apps/ide/src/stringhelpers.pas b/examples/apps/ide/src/stringhelpers.pas
index 35fb9060..6e563da5 100644
--- a/examples/apps/ide/src/stringhelpers.pas
+++ b/examples/apps/ide/src/stringhelpers.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit stringhelpers;
{$mode objfpc}{$H+}
diff --git a/examples/apps/ide/src/templates/default/program.pas b/examples/apps/ide/src/templates/default/program.pas
new file mode 100644
index 00000000..d901e3ac
--- /dev/null
+++ b/examples/apps/ide/src/templates/default/program.pas
@@ -0,0 +1,11 @@
+program ${PROGRAMNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ Classes,
+ SysUtils;
+
+begin
+ WriteLn('Hello');
+end.
diff --git a/examples/apps/ide/src/templates/default/unit.pas b/examples/apps/ide/src/templates/default/unit.pas
new file mode 100644
index 00000000..b3837ea3
--- /dev/null
+++ b/examples/apps/ide/src/templates/default/unit.pas
@@ -0,0 +1,9 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+implementation
+
+end.
diff --git a/examples/apps/ide/src/templates/fpgui/mainform.pas b/examples/apps/ide/src/templates/fpgui/mainform.pas
new file mode 100644
index 00000000..6b9500ac
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/mainform.pas
@@ -0,0 +1,45 @@
+unit frm_main;
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ public
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(374, 228, 490, 258);
+ WindowTitle := 'MainForm';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+
+ {@VFD_BODY_END: MainForm}
+ {%endregion}
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/templates/fpgui/program.pas b/examples/apps/ide/src/templates/fpgui/program.pas
new file mode 100644
index 00000000..7f3f9732
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/program.pas
@@ -0,0 +1,31 @@
+program ${PROGRAMNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes,
+ fpg_main,
+ frm_main;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas
new file mode 100644
index 00000000..0b17ee85
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/program_all_in_one.pas
@@ -0,0 +1,55 @@
+program ${PROJECTNAME};
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes, fpg_main, fpg_form;
+
+type
+
+ TMainForm = class(TfpgForm)
+ public
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+
+
+{@VFD_NEWFORM_IMPL}
+
+procedure TMainForm.AfterCreate;
+begin
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(316, 186, 300, 250);
+ WindowTitle := 'MainForm';
+
+ {@VFD_BODY_END: MainForm}
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ try
+ frm.Show;
+ fpgApplication.Run;
+ finally
+ frm.Free;
+ end;
+end;
+
+begin
+ MainProc;
+end.
+
+
diff --git a/examples/apps/ide/src/templates/fpgui/simpleform.pas b/examples/apps/ide/src/templates/fpgui/simpleform.pas
new file mode 100644
index 00000000..d804f4a3
--- /dev/null
+++ b/examples/apps/ide/src/templates/fpgui/simpleform.pas
@@ -0,0 +1,45 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form;
+
+type
+
+ T${FORMNAME} = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: ${FORMNAME}}
+ {@VFD_HEAD_END: ${FORMNAME}}
+ public
+ procedure AfterCreate; override;
+ end;
+
+{@VFD_NEWFORM_DECL}
+
+implementation
+
+{@VFD_NEWFORM_IMPL}
+
+procedure T${FORMNAME}.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: ${FORMNAME}}
+ Name := '${FORMNAME}';
+ SetPosition(374, 228, 490, 258);
+ WindowTitle := 'New Form';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+
+ {@VFD_BODY_END: ${FORMNAME}}
+ {%endregion}
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/templates/fptest/program.pas b/examples/apps/ide/src/templates/fptest/program.pas
new file mode 100644
index 00000000..8c4729bc
--- /dev/null
+++ b/examples/apps/ide/src/templates/fptest/program.pas
@@ -0,0 +1,30 @@
+program ${%PROGRAMNAME%};
+
+{$Mode objfpc}{$H+}
+
+
+{$Define TextRunner}
+{.$Define GUIRunner}
+
+
+{$ifdef GuiRunner}
+ {$apptype gui}
+{$endif}
+
+
+uses
+ {$IFDEF TextRunner}
+ TextTestRunner,
+ {$ENDIF}
+ {$IFDEF GUIRunner}
+ GUITestRunner,
+ {$ENDIF}
+ Classes,
+ SampleTests;
+
+begin
+ // Register all tests
+ SampleTests.RegisterTests;
+
+ RunRegisteredTests;
+end.
diff --git a/examples/apps/ide/src/templates/fptest/testunit.pas b/examples/apps/ide/src/templates/fptest/testunit.pas
new file mode 100644
index 00000000..83d2a624
--- /dev/null
+++ b/examples/apps/ide/src/templates/fptest/testunit.pas
@@ -0,0 +1,39 @@
+unit ${UNITNAME};
+
+{$mode objfpc}{$H+}
+
+interface
+
+uses
+ TestFramework;
+
+type
+ TMyTestCase = class(TTestCase)
+ published
+ procedure FirstTest;
+ end;
+
+
+procedure RegisterTests;
+
+
+implementation
+
+//uses
+// SomeUnitToTest;
+
+
+procedure RegisterTests;
+begin
+ TestFramework.RegisterTest(TMyTestCase.Suite);
+end;
+
+{ TMyTestCase }
+
+procedure TMyTestCase.FirstTest;
+begin
+ Check(2, 1+1, 'Failed on 1');
+end;
+
+
+end.
diff --git a/examples/apps/ide/src/unitlist.pas b/examples/apps/ide/src/unitlist.pas
index b8ca59ad..827326e7 100644
--- a/examples/apps/ide/src/unitlist.pas
+++ b/examples/apps/ide/src/unitlist.pas
@@ -1,3 +1,19 @@
+{
+ fpGUI IDE - Maximus
+
+ Copyright (C) 2012 - 2013 Graeme Geldenhuys
+
+ 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:
+ ---
+}
+
unit UnitList;
{$mode objfpc}{$H+}
diff --git a/examples/corelib/aggcanvas/agg_canvas_test.lpi b/examples/corelib/aggcanvas/agg_canvas_test.lpi
new file mode 100644
index 00000000..f02ac5df
--- /dev/null
+++ b/examples/corelib/aggcanvas/agg_canvas_test.lpi
@@ -0,0 +1,71 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <Version Value="9"/>
+ <General>
+ <Flags>
+ <MainUnitHasCreateFormStatements Value="False"/>
+ <MainUnitHasTitleStatement Value="False"/>
+ <LRSInOutputDirectory Value="False"/>
+ </Flags>
+ <SessionStorage Value="InProjectDir"/>
+ <MainUnit Value="0"/>
+ <Title Value="agg_canvas_test"/>
+ </General>
+ <VersionInfo>
+ <StringTable ProductVersion=""/>
+ </VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="default" Default="True"/>
+ </BuildModes>
+ <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="1">
+ <Unit0>
+ <Filename Value="agg_canvas_test.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="agg_canvas_test"/>
+ </Unit0>
+ </Units>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="11"/>
+ <Target>
+ <Filename Value="agg_canvas_test"/>
+ </Target>
+ <SearchPaths>
+ <UnitOutputDirectory Value="units"/>
+ </SearchPaths>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
+ <CodeGeneration>
+ <Optimizations>
+ <OptimizationLevel Value="0"/>
+ </Optimizations>
+ </CodeGeneration>
+ <Other>
+ <CompilerMessages>
+ <UseMsgFile Value="True"/>
+ </CompilerMessages>
+ <CustomOptions Value="-dAggCanvas"/>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/examples/corelib/aggcanvas/agg_canvas_test.lpr b/examples/corelib/aggcanvas/agg_canvas_test.lpr
new file mode 100644
index 00000000..63ba1d53
--- /dev/null
+++ b/examples/corelib/aggcanvas/agg_canvas_test.lpr
@@ -0,0 +1,389 @@
+{
+ 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 demo was simply to test the Agg2D unit and the TAgg2D canvas
+ class. In this demo the AggPas TAgg2D canvas does all the painting.
+
+ *** IMPORTANT ***
+ For this demo to work, the fpGUI Toolkit MUST be compiled with
+ the AggCanvas compiler define enabled.
+}
+
+program agg_canvas_test;
+
+{$mode objfpc}{$H+}
+
+uses
+ Classes, SysUtils,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_imgfmt_bmp,
+ fpg_widget,
+ Agg2D,
+ fpg_dialogs;
+
+
+type
+ TMainForm = class(TfpgForm)
+ private
+ {@VFD_HEAD_BEGIN: MainForm}
+ {@VFD_HEAD_END: MainForm}
+ procedure FormKeyPressed(Sender: TObject; var KeyCode: word; var ShiftState: TShiftState; var Consumed: boolean);
+ procedure FormPaint(Sender: TObject);
+ procedure CustomPaintJob;
+ public
+ procedure AfterCreate; override;
+ end;
+
+
+
+{ TMainForm }
+
+procedure TMainForm.FormKeyPressed(Sender: TObject; var KeyCode: word;
+ var ShiftState: TShiftState; var Consumed: boolean);
+begin
+ if KeyCode = keyF1 then
+ begin
+ ShowMessage('This is a simple Canvas primitives painting test.');
+ end;
+end;
+
+procedure TMainForm.FormPaint(Sender: TObject);
+begin
+ CustomPaintJob;
+end;
+
+// We can now call all the paint methods from HandlePaint or
+// the OnPaint event.fpgcanvas
+procedure TMainForm.CustomPaintJob;
+var
+ r: TfpgRect;
+ fnt: TfpgFont;
+ y: integer;
+ ac: TAgg2D;
+ c1, c2: TAggColor;
+ d: double;
+ i: integer;
+
+ procedure DrawMacLionButton(const x, y: double; const astate: byte; const atext: ansistring);
+ { AState values are interpreted as follows:
+ 0: normal state
+ 1: hover state
+ 2: clicked state }
+ var
+ x1, y1, x2, y2, h, w: double;
+ c1, c2: TAggColor;
+ begin
+ h := 21;
+ w := 100;
+ x1 := x;
+ y1 := y;
+ x2 := x1 + w;
+ y2 := y1 + h;
+
+ ac.NoLine;
+
+ // Top vertical gradient
+ case astate of
+ 0: begin
+ c1.Construct(255, 255, 255, 255);
+ c2.Construct(243, 243, 243, 255);
+ end;
+ 1: begin
+ c1.Construct(204, 229, 252, 255);
+ c2.Construct(161, 209, 249, 255);
+ end;
+ 2: begin
+ c1.Construct(144, 195, 241, 255);
+ c2.Construct(113, 180, 239, 255);
+ end;
+ end;
+ ac.FillLinearGradient(x1, y1, x1, y1+(h/2), c1, c2);
+ ac.RoundedRect(x1+1, y1+1, x2+0.5, y2-(h/2)+0.5, 0.3, 3/2, 0.3, 3/2);
+
+ // Bottom vertical gradient
+ case astate of
+ 0: begin
+ c1.Construct(236, 236, 236, 255);
+ c2.Construct(242, 242, 242, 255);
+ end;
+ 1: begin
+ c1.Construct(143, 202, 251, 255);
+ c2.Construct(207, 245, 253, 255);
+ end;
+ 2: begin
+ c1.Construct(97, 173, 240, 255);
+ c2.Construct(147, 206, 241, 255);
+ end;
+ end;
+ ac.FillLinearGradient(x1, y1+(h/2)+1, x1, y2, c1, c2);
+ ac.RoundedRect(x1+1, y1+(h/2)+0.5, x2+0.5, y2+0.5, 0.3, 3/2, 0.3, 3/2);
+
+ // outer rounded rectangle
+ ac.NoFill;
+ case astate of
+ 0: begin
+ ac.LineColor($9a, $9a, $9a);
+ end;
+ 1,
+ 2: begin
+ ac.LineColor(86, 87, 143);
+ end;
+ end;
+ ac.LineWidth(1.0);
+ ac.RoundedRect(x1+0.5, y1+0.5, x2+0.5, y2+0.5, 3, 3);
+
+ // Slight shadow under the button
+ ac.LineColor($df, $df, $df, $ff);
+ ac.Line(x1+0.5, y2+1.5, x2-0.5, y2+1.5);
+
+ // button text
+ c1.Construct(0,0,0);
+ ac.FillColor(c1);
+ ac.NoLine;
+ ac.Font('arialbd.ttf', 13);
+ ac.TextAlignment(AGG_AlignCenter ,AGG_AlignCenter );
+ ac.Text(
+ (x1 + x2 ) / 2.0 ,
+ (y1 + y2 ) / 2.0 ,
+ atext,
+ true ,0.0 ,0.0 );
+
+ end;
+begin
+ // casting so we have full access to the Agg2D canvas functions
+ ac := TAgg2D(Canvas);
+
+ ac.LineWidth(1.0);
+// ac.ClearAll($ed, $ed, $ed); // mac os x window background color
+ ac.ClearAll(255, 255, 255);
+
+ // Testing Rectangles
+ Canvas.SetColor(clBlack);
+ r.SetRect(0, 0, 1, 1); // 1x1 (this is really a dot)
+ Canvas.DrawRectangle(r);
+ Canvas.SetColor(clRed);
+ r.SetRect(0, 1, 1, 5); // 1x5 (this is really a vertical line)
+ Canvas.DrawRectangle(r);
+ Canvas.SetColor(clMagenta);
+ r.SetRect(1, 0, 5, 1); // 5x1 (this is really a horizontal line)
+ Canvas.DrawRectangle(r);
+
+ Canvas.SetColor(clBlack);
+ r.Top := 5;
+ r.Left := 60;
+ r.Width := 50;
+ r.Height := 50;
+ Canvas.DrawRectangle(r);
+
+ r.Left := 120;
+ Canvas.SetLineStyle(2, lsDash);
+ Canvas.DrawRectangle(r);
+
+ r.Left := 180;
+ Canvas.SetColor(clGreen);
+ Canvas.SetLineStyle(1, lsDot);
+ Canvas.DrawRectangle(r);
+
+ r.Left := 240;
+ Canvas.SetColor(clBlue);
+ Canvas.SetLineStyle(1, lsSolid);
+ Canvas.FillRectangle(r);
+
+ // Testing line drawing
+ ac.NoFill;
+ Canvas.SetColor(clBlue);
+ Canvas.DrawLine(5, 5, 54, 54);
+ Canvas.DrawLine(54, 5, 5, 54);
+ Canvas.SetColor(clRed);
+ { Diagonal line }
+ r.SetRect(60, 5, 50, 50);
+ Canvas.DrawLine(r.Left, r.Top, r.Right, r.Bottom);
+ { Horizontal line }
+ Canvas.DrawLine(r.Left, r.Top-2, r.Right, r.Top-2);
+ { Vertical line }
+ Canvas.DrawLine(r.Left-2, r.Top, r.Left-2, r.Bottom);
+
+
+ // Testing Text and Fonts
+ y := 60;
+ Canvas.SetTextColor(clBlack);
+ Canvas.DrawString(5, y, 'This text must be black and default font');
+
+ // red dot indicates top/left corner of where previous text was started
+ Canvas.Pixels[5,y] := clRed;
+// Canvas.DrawLine(5,y-4, 5,y+5);
+// Canvas.DrawLine(1,y, 10, y);
+
+ Canvas.SetTextColor(clRed);
+ y := y + Canvas.Font.Height; // fonts are different sizes on differet OS's
+ Canvas.DrawString(5, y, 'This text must be red.');
+ Canvas.SetTextColor(clBlack);
+ y := y + Canvas.Font.Height;
+ Canvas.DrawString(5, y, 'Russian (UTF-8) text: Невозможно создать директорию');
+ y := y + Canvas.Font.Height;
+ fnt := fpgApplication.GetFont('Times-14:bold');
+ Canvas.Font := fnt;
+ Canvas.DrawString(5, y, 'Font used is ' + Canvas.Font.FontDesc);
+ y := y + Canvas.Font.Height;
+
+
+ // Testing basic style drawings
+ Canvas.Font := fpgApplication.DefaultFont;
+ Canvas.DrawString(320, 3, 'DrawButtonFace():');
+
+ r.SetRect(300, 20, 75, 25);
+ Canvas.DrawButtonFace(r, []);
+ Canvas.DrawString(385, 20, '= []');
+ r.Top := 50;
+ Canvas.DrawButtonFace(r, [btfIsDefault]);
+ Canvas.DrawString(385, 50, '= [btnIsDefault]');
+ r.Top := 80;
+ Canvas.DrawButtonFace(r, [btfIsPressed]);
+ Canvas.DrawString(385, 80, '= [btnIsPressed]');
+ r.Top := 110;
+ Canvas.DrawButtonFace(r, [btfIsEmbedded, btfIsPressed]);
+ Canvas.DrawString(385, 110, '= [embed & press]');
+ r.Top := 140;
+ Canvas.DrawButtonFace(r, [btfIsEmbedded]);
+ Canvas.DrawString(385, 140, '= [btnIsEmbedded]');
+
+ Canvas.DrawString(45, y, 'DrawControlFrame():');
+ y := y + Canvas.Font.Height;
+ Canvas.DrawControlFrame(5, y, 150, 23);
+
+ // A Vector Text example
+ //----------------------
+ ac.LineWidth(1 );
+ ac.TextAlignment(AGG_AlignLeft ,AGG_AlignBottom );
+ // Normal Text
+ ac.LineColor($00 ,$00 ,$8B );
+ ac.FillColor($1E ,$90 ,$FF );
+ ac.Font('times.ttf' ,45);
+ ac.Text(20 ,250 , 'Vectors are cool !' );
+ // Upside-down Text
+ ac.FlipText(true );
+ ac.LineColor($C0 ,$C0 ,$C0 );
+ ac.FillColor($C0 ,$C0 ,$C0 );
+ ac.Text(20 ,255 ,'Vectors are cool !' );
+
+ // reset the text flip effect
+ ac.FlipText(False);
+
+ // Cool new button styles are now possible
+ DrawMacLionButton(65, 300, 0, 'Normal');
+ DrawMacLionButton(65, 330, 1, 'Hover');
+ DrawMacLionButton(65, 360, 2, 'Clicked');
+ // nice display of virtical text
+ c1.Construct(0,0,0);
+ ac.FillColor(c1);
+ ac.TextHints(true);
+ ac.NoLine;
+ ac.Font('arial.ttf', 13, false,
+ false, AGG_VectorFontCache, 45.0);
+ ac.Text(190, 310, 'Mac OS X Lion buttons', true ,0.0 ,0.0 );
+ // reset text alignment to normal behaviour
+ ac.TextAlignment(AGG_AlignLeft ,AGG_AlignBottom );
+
+
+ // Star shape
+ ac.LineCap(AGG_CapRound);
+ ac.LineWidth(5);
+ ac.LineColor($32 ,$cd ,$32 );
+ c1.Construct(0, 0 , 255, 200);
+ c2.Construct(0, 0, 255, 50);
+ ac.FillLinearGradient(100, 100, 150, 150, c1, c2);
+ ac.Star(100 ,150 ,30 ,70 ,55 ,5 );
+
+ // Draw Arc from 45 degrees to 270 degrees
+ ac.LineColor($FF ,$00 ,$00 );
+ ac.LineWidth(5 );
+ ac.Arc(300 ,320 ,80 ,50 ,Deg2Rad(45 ) ,Deg2Rad(270 ) );
+
+
+ // Lines at various thicknesses & coordinate translation
+ ac.LineColor(0, 0, 0);
+ ac.LineCap(AGG_CapRound);
+ d := 0.1;
+ for i := 1 to 10 do
+ begin
+ ac.LineWidth(d);
+ ac.Line(350, 240, 410, 180);
+ ac.Translate(8, 0);
+ d := d + 0.3;
+ end;
+ ac.ResetTransformations;
+
+
+
+ ac.LineWidth(20 );
+ ac.ResetPath;
+ ac.MoveTo(360 ,310 );
+ ac.LineTo(400 ,270 );
+ ac.LineTo(440 ,310 );
+
+ // Default AGG_JoinRound
+ ac.Translate(10 ,-10 );
+ ac.DrawPath(AGG_StrokeOnly );
+
+ // Change to AGG_JoinMiter
+ ac.LineJoin (AGG_JoinMiter );
+ ac.Translate(0 ,50 );
+ ac.DrawPath (AGG_StrokeOnly );
+
+ // Change to AGG_JoinBevel
+ ac.LineJoin (AGG_JoinBevel );
+ ac.Translate(0 ,50 );
+ ac.DrawPath (AGG_StrokeOnly );
+
+ ac.ResetTransformations;
+end;
+
+procedure TMainForm.AfterCreate;
+begin
+ {%region 'Auto-generated GUI code' -fold}
+ {@VFD_BODY_BEGIN: MainForm}
+ Name := 'MainForm';
+ SetPosition(357, 214, 500, 400);
+ WindowTitle := 'fpGUI with AGG-powered Canvas test';
+ Hint := '';
+ WindowPosition := wpOneThirdDown;
+ OnKeyPress := @FormKeyPressed;
+ OnPaint := @FormPaint;
+
+ {@VFD_BODY_END: MainForm}
+ {%endregion}
+
+ fpgApplication.HelpKey := keyNul;
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+
+ frm := TMainForm.Create(nil);
+ frm.Show;
+ fpgApplication.Run;
+ frm.Free;
+end;
+
+
+begin
+ MainProc;
+end.
+
diff --git a/examples/corelib/aggcanvas/arial.ttf b/examples/corelib/aggcanvas/arial.ttf
new file mode 100644
index 00000000..7ff88f22
--- /dev/null
+++ b/examples/corelib/aggcanvas/arial.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/arialbd.ttf b/examples/corelib/aggcanvas/arialbd.ttf
new file mode 100644
index 00000000..c2eb3ddd
--- /dev/null
+++ b/examples/corelib/aggcanvas/arialbd.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/extrafpc.cfg b/examples/corelib/aggcanvas/extrafpc.cfg
new file mode 100644
index 00000000..775d592f
--- /dev/null
+++ b/examples/corelib/aggcanvas/extrafpc.cfg
@@ -0,0 +1,5 @@
+-FUunits
+-Fu../../../lib/$fpctarget
+-Xs
+-XX
+-CX
diff --git a/examples/corelib/aggcanvas/times.ttf b/examples/corelib/aggcanvas/times.ttf
new file mode 100644
index 00000000..a998feec
--- /dev/null
+++ b/examples/corelib/aggcanvas/times.ttf
Binary files differ
diff --git a/examples/corelib/aggcanvas/timesi.ttf b/examples/corelib/aggcanvas/timesi.ttf
new file mode 100644
index 00000000..28798d3c
--- /dev/null
+++ b/examples/corelib/aggcanvas/timesi.ttf
Binary files differ
diff --git a/examples/gui/command_interface/commands.pas b/examples/gui/command_interface/commands.pas
index c487b0b1..d4a30858 100644
--- a/examples/gui/command_interface/commands.pas
+++ b/examples/gui/command_interface/commands.pas
@@ -14,11 +14,11 @@ uses
type
// non reference counted interface
- TNullInterfacedObject = class(TObject)
+ TNullInterfacedObject = class(TObject, IUnknown)
protected
- function QueryInterface(const IID: TGUID; out Obj): longint; stdcall;
- function _AddRef: longint; stdcall;
- function _Release: longint; stdcall;
+ function QueryInterface(constref iid : tguid;out obj) : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+ function _AddRef : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
+ function _Release : longint;{$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
end;
@@ -44,7 +44,7 @@ uses
{ TNullInterfacedObject }
-function TNullInterfacedObject.QueryInterface(const IID: TGUID; out Obj): longint; stdcall;
+function TNullInterfacedObject.QueryInterface(constref IID: TGUID; out Obj): longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
if GetInterface(IID, Obj) then
Result := 0
@@ -52,12 +52,12 @@ begin
result := integer(e_nointerface);
end;
-function TNullInterfacedObject._AddRef: longint; stdcall;
+function TNullInterfacedObject._AddRef: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
Result := -1;
end;
-function TNullInterfacedObject._Release: longint; stdcall;
+function TNullInterfacedObject._Release: longint; {$IFNDEF WINDOWS}cdecl{$ELSE}stdcall{$ENDIF};
begin
Result := -1;
end;
@@ -72,7 +72,7 @@ end;
procedure TAddCommand.Execute;
begin
- Writeln('>> TAddComand.Execute');
+ DebugLn('>> TAddComand.Execute');
FMemo.Lines.Add('Hello ' + IntToStr(Random(500)));
FMemo.Invalidate;
end;
@@ -81,7 +81,7 @@ end;
procedure TExitCommand.Execute;
begin
- Writeln('>> TExitComand.Execute');
+ DebugLn('>> TExitComand.Execute');
fpgApplication.Terminated := True;
end;
diff --git a/examples/gui/command_interface/frm_main.pas b/examples/gui/command_interface/frm_main.pas
index bc330130..3a29bccf 100644
--- a/examples/gui/command_interface/frm_main.pas
+++ b/examples/gui/command_interface/frm_main.pas
@@ -9,19 +9,19 @@ unit frm_main;
interface
uses
- SysUtils, Classes, fpg_base, fpg_main, fpg_edit,
- fpg_widget, fpg_form, fpg_label, fpg_button,
- fpg_listbox, fpg_memo, fpg_combobox, fpg_grid,
- fpg_dialogs, fpg_checkbox, fpg_tree, fpg_trackbar,
- fpg_progressbar, fpg_radiobutton, fpg_tab, fpg_menu,
- fpg_panel;
+ SysUtils,
+ Classes,
+ fpg_base,
+ fpg_main,
+ fpg_form,
+ fpg_button,
+ fpg_memo,
+ fpg_menu;
type
TMainForm = class(TfpgForm)
private
- procedure CommandHandler(Sender: TObject);
- public
{@VFD_HEAD_BEGIN: MainForm}
btnAdd: TfpgButton;
memName1: TfpgMemo;
@@ -29,6 +29,9 @@ type
MainMenu: TfpgMenuBar;
mnuFile: TfpgPopupMenu;
{@VFD_HEAD_END: MainForm}
+ miAdd: TfpgMenuItem;
+ procedure CommandHandler(Sender: TObject);
+ public
procedure AfterCreate; override;
end;
@@ -61,7 +64,7 @@ begin
Name := 'MainForm';
SetPosition(293, 236, 284, 254);
WindowTitle := 'Command Interface Test';
- WindowPosition := wpScreenCenter;
+ WindowPosition := wpOneThirdDown;
btnAdd := TfpgButton.Create(self);
with btnAdd do
@@ -106,6 +109,7 @@ begin
begin
Name := 'mnuFile';
SetPosition(44, 72, 120, 20);
+ miAdd := AddMenuItem('Add Item', '', @CommandHandler);
AddMenuItem('Quit', '', @CommandHandler);
end;
@@ -116,6 +120,7 @@ begin
// instantiate the Command classes
btnAdd.SetCommand(TAddCommand.Create(memName1));
btnQuit.SetCommand(TExitCommand.Create);
+ miAdd.SetCommand(btnAdd.GetCommand); // reuse exist command from btnAdd instance
// The menu item File|Quit shares the command of btnQuit
mnuFile.MenuItemByName('Quit').SetCommand(btnQuit.GetCommand);
end;
diff --git a/examples/gui/reporting/u_demo.pas b/examples/gui/reporting/u_demo.pas
index 44ed4999..349b0ad1 100644
--- a/examples/gui/reporting/u_demo.pas
+++ b/examples/gui/reporting/u_demo.pas
@@ -31,7 +31,7 @@ type
Bt_PdfMultiPages: TfpgButton;
Bt_PdfMultiSections: TfpgButton;
Bt_PdfOutlines: TfpgButton;
- Bt_PdfCadres: TfpgButton;
+ Bt_PdfFrames: TfpgButton;
Bt_PdfColor: TfpgButton;
Bt_PdfLines: TfpgButton;
Bt_PdfGrid: TfpgButton;
@@ -45,7 +45,7 @@ type
Bt_VisuMultiPages: TfpgButton;
Bt_VisuMultiSections: TfpgButton;
Bt_VisuOutlines: TfpgButton;
- Bt_VisuCadres: TfpgButton;
+ Bt_VisuFrames: TfpgButton;
Bt_VisuColor: TfpgButton;
Bt_VisuLines: TfpgButton;
Bt_VisuGrid: TfpgButton;
@@ -59,7 +59,7 @@ type
Bt_PrintMultiPages: TfpgButton;
Bt_PrintMultiSections: TfpgButton;
Bt_PrintOutlines: TfpgButton;
- Bt_PrintCadres: TfpgButton;
+ Bt_PrintFrames: TfpgButton;
Bt_PrintColor: TfpgButton;
Bt_PrintLines: TfpgButton;
Bt_PrintGrid: TfpgButton;
@@ -83,7 +83,7 @@ type
procedure Bt_PdfMultiPagesClick(Sender: TObject);
procedure Bt_PdfMultiSectionsClick(Sender: TObject);
procedure Bt_PdfOutlinesClick(Sender: TObject);
- procedure Bt_PdfCadresClick(Sender: TObject);
+ procedure Bt_PdfFramesClick(Sender: TObject);
procedure Bt_PdfColorClick(Sender: TObject);
procedure Bt_PdfLinesClick(Sender: TObject);
procedure Bt_PdfGridClick(Sender: TObject);
@@ -96,7 +96,7 @@ type
procedure Bt_VisuMultiPagesClick(Sender: TObject);
procedure Bt_VisuMultiSectionsClick(Sender: TObject);
procedure Bt_VisuOutlinesClick(Sender: TObject);
- procedure Bt_VisuCadresClick(Sender: TObject);
+ procedure Bt_VisuFramesClick(Sender: TObject);
procedure Bt_VisuColorClick(Sender: TObject);
procedure Bt_VisuLinesClick(Sender: TObject);
procedure Bt_VisuGridClick(Sender: TObject);
@@ -109,7 +109,7 @@ type
procedure Bt_PrintMultiPagesClick(Sender: TObject);
procedure Bt_PrintMultiSectionsClick(Sender: TObject);
procedure Bt_PrintOutlinesClick(Sender: TObject);
- procedure Bt_PrintCadresClick(Sender: TObject);
+ procedure Bt_PrintFramesClick(Sender: TObject);
procedure Bt_PrintColorClick(Sender: TObject);
procedure Bt_PrintLinesClick(Sender: TObject);
procedure Bt_PrintGridClick(Sender: TObject);
@@ -124,7 +124,7 @@ type
procedure PrintMultiPages(Preview: Boolean);
procedure PrintMultiSections(Preview: Boolean);
procedure PrintOutlines(Preview: Boolean);
- procedure PrintCadres(Preview: Boolean);
+ procedure PrintFrames(Preview: Boolean);
procedure PrintColor(Preview: Boolean);
procedure PrintLines(Preview: Boolean);
procedure PrintGrid(Preview: Boolean);
@@ -221,14 +221,14 @@ begin
end;
end;
-procedure TF_Demo.Bt_PdfCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_PdfFramesClick(Sender: TObject);
begin
FReport := T_Report.Create;
with FReport do
begin
// Language:= Version;
- PrintCadres(False);
- DefaultFile:= 'Cadres.pdf';
+ PrintFrames(False);
+ DefaultFile:= 'Frames.pdf';
PrintPdf(LayoutMode, ZoomValue, Preferences);
Free;
end;
@@ -319,7 +319,7 @@ begin
begin
// Language:= Version;
PrintTtfFont(False);
- DefaultFile:= 'TtfFont.pdf';
+ DefaultFile:= 'TrueTypeFonts.pdf';
PrintPdf(LayoutMode, ZoomValue, Preferences);
Free;
end;
@@ -385,14 +385,14 @@ begin
end;
end;
-procedure TF_Demo.Bt_VisuCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_VisuFramesClick(Sender: TObject);
begin
FReport := T_Report.Create;
with FReport do
begin
//Language:= Version;
- DefaultFile := 'Cadres.pdf';
- PrintCadres(True);
+ DefaultFile := 'Frames.pdf';
+ PrintFrames(True);
Free;
end;
end;
@@ -506,7 +506,7 @@ begin
end;
-procedure TF_Demo.Bt_PrintCadresClick(Sender: TObject);
+procedure TF_Demo.Bt_PrintFramesClick(Sender: TObject);
begin
end;
@@ -756,7 +756,7 @@ begin
end;
end;
-procedure TF_Demo.PrintCadres(Preview: Boolean);
+procedure TF_Demo.PrintFrames(Preview: Boolean);
var
FtTitle, FtText: integer;
{TsThin,} TsNorm, TsThick: integer;
@@ -1212,11 +1212,12 @@ begin
SetPosition(0, 0, 900, 600);
WindowPosition := wpScreenCenter;
Sizeable := False;
- fpgSetNamedColor(clWindowBackground, clPaleGreen);
- fpgSetNamedColor(clButtonFace, clCyan);
- fpgSetNamedColor(clText1, clBlue);
- fpgSetNamedColor(clSelection, clSkyBlue);
- fpgSetNamedColor(clSelectionText, clDarkBlue);
+
+ //fpgSetNamedColor(clWindowBackground, clPaleGreen);
+ //fpgSetNamedColor(clButtonFace, clCyan);
+ //fpgSetNamedColor(clText1, clBlue);
+ //fpgSetNamedColor(clSelection, clSkyBlue);
+ //fpgSetNamedColor(clSelectionText, clDarkBlue);
fpgSetNamedFont('Label1', 'bitstream vera sans-10');
fpgSetNamedFont('Edit1', 'bitstream vera sans-10');
L_Pdf := CreateLabel(Self, 50, 5, 'Print to PDF', 150, 20, taCenter);
@@ -1225,7 +1226,7 @@ begin
Bt_PdfMultiPages := CreateButton(Self, 50, 110, 150, 'Multiple pages', @Bt_PdfMultiPagesClick, 'stdimg.Adobe_pdf');
Bt_PdfMultiSections := CreateButton(Self, 50, 150, 150, 'Multiple sections', @Bt_PdfMultiSectionsClick, 'stdimg.Adobe_pdf');
Bt_PdfOutlines := CreateButton(Self, 50, 190, 150, 'Outlines', @Bt_PdfOutlinesClick, 'stdimg.Adobe_pdf');
- Bt_PdfCadres := CreateButton(Self, 50, 230, 150, 'Draw frames', @Bt_PdfCadresClick, 'stdimg.Adobe_pdf');
+ Bt_PdfFrames := CreateButton(Self, 50, 230, 150, 'Draw frames', @Bt_PdfFramesClick, 'stdimg.Adobe_pdf');
Bt_PdfColor := CreateButton(Self, 50, 270, 150, 'Show colors', @Bt_PdfColorClick, 'stdimg.Adobe_pdf');
Bt_PdfLines := CreateButton(Self, 50, 310, 150, 'Draw lines', @Bt_PdfLinesClick, 'stdimg.Adobe_pdf');
Bt_PdfGrid := CreateButton(Self, 50, 350, 150, 'Show grid', @Bt_PdfGridClick, 'stdimg.Adobe_pdf');
@@ -1239,7 +1240,7 @@ begin
Bt_VisuMultiPages := CreateButton(Self, 250, 110, 150, 'Multiple pages', @Bt_VisuMultiPagesClick, 'stdimg.preview');
Bt_VisuMultiSections := CreateButton(Self, 250, 150, 150, 'Multiple sections', @Bt_VisuMultiSectionsClick, 'stdimg.preview');
Bt_VisuOutlines := CreateButton(Self, 250, 190, 150, 'Outlines', @Bt_VisuOutlinesClick, 'stdimg.preview');
- Bt_VisuCadres := CreateButton(Self, 250, 230, 150, 'Draw frames', @Bt_VisuCadresClick, 'stdimg.preview');
+ Bt_VisuFrames := CreateButton(Self, 250, 230, 150, 'Draw frames', @Bt_VisuFramesClick, 'stdimg.preview');
Bt_VisuColor := CreateButton(Self, 250, 270, 150, 'Show colors', @Bt_VisuColorClick, 'stdimg.preview');
Bt_VisuLines := CreateButton(Self, 250, 310, 150, 'Draw lines', @Bt_VisuLinesClick, 'stdimg.preview');
Bt_VisuGrid := CreateButton(Self, 250, 350, 150, 'Show grid', @Bt_VisuGridClick, 'stdimg.preview');
@@ -1258,8 +1259,8 @@ begin
Bt_PrintMultiSections.Enabled := False;
Bt_PrintOutlines := CreateButton(Self, 450, 190, 150, 'Outlines', @Bt_PrintOutlinesClick, 'stdimg.print');
Bt_PrintOutlines.Enabled := False;
- Bt_PrintCadres := CreateButton(Self, 450, 230, 150, 'Draw frames', @Bt_PrintCadresClick, 'stdimg.print');
- Bt_PrintCadres.Enabled := False;
+ Bt_PrintFrames := CreateButton(Self, 450, 230, 150, 'Draw frames', @Bt_PrintFramesClick, 'stdimg.print');
+ Bt_PrintFrames.Enabled := False;
Bt_PrintColor := CreateButton(Self, 450, 270, 150, 'Show colors', @Bt_PrintColorClick, 'stdimg.print');
Bt_PrintColor.Enabled := False;
Bt_PrintLines := CreateButton(Self, 450, 310, 150, 'Draw lines', @Bt_PrintLinesClick, 'stdimg.print');
diff --git a/examples/gui/sprites/background.bmp b/examples/gui/sprites/background.bmp
new file mode 100644
index 00000000..a7a6cd43
--- /dev/null
+++ b/examples/gui/sprites/background.bmp
Binary files differ
diff --git a/examples/gui/sprites/ide_icon48x48.bmp b/examples/gui/sprites/ide_icon48x48.bmp
deleted file mode 100644
index 3e710b1d..00000000
--- a/examples/gui/sprites/ide_icon48x48.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/gui/sprites/splash_logo.bmp b/examples/gui/sprites/splash_logo.bmp
deleted file mode 100644
index 0096893a..00000000
--- a/examples/gui/sprites/splash_logo.bmp
+++ /dev/null
Binary files differ
diff --git a/examples/gui/sprites/spritedemo.lpr b/examples/gui/sprites/spritedemo.lpr
index 5de6e813..ead9f1bf 100644
--- a/examples/gui/sprites/spritedemo.lpr
+++ b/examples/gui/sprites/spritedemo.lpr
@@ -73,6 +73,7 @@ begin
// paint debug info
if FShowInterval then
begin
+ Canvas.TextColor := clWhite;
Canvas.DrawText(4, 4, 'Timer Interval: ' + IntToStr(Timer.Interval));
end;
end;
@@ -124,8 +125,8 @@ begin
OnClose := @FormClose;
OnDestroy := @FormDestroy;
- Background := LoadImage_BMP('splash_logo.bmp');
- SpriteImg := LoadImage_BMP('ide_icon48x48.bmp');
+ Background := LoadImage_BMP('background.bmp');
+ SpriteImg := LoadImage_BMP('ufo.bmp');
SpriteImg.CreateMaskFromSample(0, 0);
SpriteImg.UpdateImage;
diff --git a/examples/gui/sprites/ufo.bmp b/examples/gui/sprites/ufo.bmp
new file mode 100644
index 00000000..709bcaa2
--- /dev/null
+++ b/examples/gui/sprites/ufo.bmp
Binary files differ
diff --git a/examples/gui/stdimages/stdimglist.lpi b/examples/gui/stdimages/stdimglist.lpi
index 94af915b..f519fc99 100644
--- a/examples/gui/stdimages/stdimglist.lpi
+++ b/examples/gui/stdimages/stdimglist.lpi
@@ -1,7 +1,7 @@
<?xml version="1.0"?>
<CONFIG>
<ProjectOptions>
- <Version Value="7"/>
+ <Version Value="9"/>
<General>
<Flags>
<SaveOnlyProjectUnits Value="True"/>
@@ -9,11 +9,13 @@
</Flags>
<SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
- <TargetFileExt Value=""/>
</General>
<VersionInfo>
- <StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
+ <StringTable ProductVersion=""/>
</VersionInfo>
+ <BuildModes Count="1">
+ <Item1 Name="default" Default="True"/>
+ </BuildModes>
<PublishOptions>
<Version Value="2"/>
<IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/>
@@ -38,10 +40,14 @@
</Units>
</ProjectOptions>
<CompilerOptions>
- <Version Value="8"/>
+ <Version Value="11"/>
+ <Parsing>
+ <SyntaxOptions>
+ <UseAnsiStrings Value="False"/>
+ </SyntaxOptions>
+ </Parsing>
<Other>
- <CustomOptions Value="-FUunits
-"/>
+ <CustomOptions Value="-FUunits"/>
<CompilerPath Value="$(CompPath)"/>
</Other>
</CompilerOptions>
diff --git a/examples/gui/stdimages/stdimglist.lpr b/examples/gui/stdimages/stdimglist.lpr
index 09e57990..2d4ba9d9 100644
--- a/examples/gui/stdimages/stdimglist.lpr
+++ b/examples/gui/stdimages/stdimglist.lpr
@@ -4,7 +4,7 @@ program stdimglist;
uses
Classes, SysUtils,
- fpg_base, fpg_main, fpg_form, fpg_imgfmt_bmp, fpg_button;
+ fpg_base, fpg_main, fpg_form, fpg_imgfmt_bmp, fpg_button, u_reportimages;
type
@@ -28,6 +28,8 @@ begin
MinWidth := 200;
MinHeight := 100;
+ CreateReportImages;
+
btnClose := CreateButton(self, Width-90, Height-35, 75, 'Quit', @btnCloseClick);
btnClose.ImageName := 'stdimg.quit';
btnClose.Anchors := [anRight, anBottom];