summaryrefslogtreecommitdiff
path: root/prototypes/fpgui2
diff options
context:
space:
mode:
authorgraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-27 15:04:35 +0000
committergraemeg <graemeg@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-27 15:04:35 +0000
commit0e2ffba0302d927fa856cbd62f725417714cc74c (patch)
tree8d51ff8d40cbb2f875bccccfe4b29744ee7d9e64 /prototypes/fpgui2
parent79f3d57b899e797fe9acc116146bf64e0327deb9 (diff)
downloadfpGUI-0e2ffba0302d927fa856cbd62f725417714cc74c.tar.xz
* Added the new test project I forgot earlier.
* Minor compiler fix for GDI.
Diffstat (limited to 'prototypes/fpgui2')
-rw-r--r--prototypes/fpgui2/tests/drawtest.bmpbin0 -> 7654 bytes
-rw-r--r--prototypes/fpgui2/tests/drawtest.lpi176
-rw-r--r--prototypes/fpgui2/tests/drawtest.lpr124
-rw-r--r--prototypes/fpgui2/tests/edittest.lpi7
-rw-r--r--prototypes/fpgui2/tests/square.bmpbin0 -> 7654 bytes
5 files changed, 304 insertions, 3 deletions
diff --git a/prototypes/fpgui2/tests/drawtest.bmp b/prototypes/fpgui2/tests/drawtest.bmp
new file mode 100644
index 00000000..2a3ec501
--- /dev/null
+++ b/prototypes/fpgui2/tests/drawtest.bmp
Binary files differ
diff --git a/prototypes/fpgui2/tests/drawtest.lpi b/prototypes/fpgui2/tests/drawtest.lpi
new file mode 100644
index 00000000..9ae3898f
--- /dev/null
+++ b/prototypes/fpgui2/tests/drawtest.lpi
@@ -0,0 +1,176 @@
+<?xml version="1.0"?>
+<CONFIG>
+ <ProjectOptions>
+ <PathDelim Value="\"/>
+ <Version Value="5"/>
+ <General>
+ <MainUnit Value="0"/>
+ <IconPath Value=".\"/>
+ <TargetFileExt Value=""/>
+ <ActiveEditorIndexAtStart Value="0"/>
+ </General>
+ <VersionInfo>
+ <ProjectVersion Value=""/>
+ <Language Value=""/>
+ <CharSet Value=""/>
+ </VersionInfo>
+ <PublishOptions>
+ <Version Value="2"/>
+ <DestinationDirectory Value="$(TestDir)\publishedproject\"/>
+ <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_package"/>
+ </Item1>
+ </RequiredPackages>
+ <Units Count="17">
+ <Unit0>
+ <Filename Value="drawtest.lpr"/>
+ <IsPartOfProject Value="True"/>
+ <UnitName Value="drawtest"/>
+ <CursorPos X="23" Y="37"/>
+ <TopLine Value="29"/>
+ <EditorIndex Value="0"/>
+ <UsageCount Value="24"/>
+ <Loaded Value="True"/>
+ </Unit0>
+ <Unit1>
+ <Filename Value="..\..\..\src\corelib\gfx_imgfmt_bmp.pas"/>
+ <UnitName Value="gfx_imgfmt_bmp"/>
+ <CursorPos X="24" Y="18"/>
+ <TopLine Value="1"/>
+ <EditorIndex Value="5"/>
+ <UsageCount Value="12"/>
+ <Loaded Value="True"/>
+ </Unit1>
+ <Unit2>
+ <Filename Value="..\..\..\src\corelib\predefinedcolors.inc"/>
+ <CursorPos X="15" Y="112"/>
+ <TopLine Value="102"/>
+ <EditorIndex Value="1"/>
+ <UsageCount Value="11"/>
+ <Loaded Value="True"/>
+ </Unit2>
+ <Unit3>
+ <Filename Value="..\..\..\src\corelib\gfxbase.pas"/>
+ <UnitName Value="gfxbase"/>
+ <CursorPos X="17" Y="240"/>
+ <TopLine Value="230"/>
+ <EditorIndex Value="2"/>
+ <UsageCount Value="12"/>
+ <Loaded Value="True"/>
+ </Unit3>
+ <Unit4>
+ <Filename Value="..\..\..\src\corelib\x11\gfx_x11.pas"/>
+ <UnitName Value="gfx_x11"/>
+ <CursorPos X="63" Y="1444"/>
+ <TopLine Value="1432"/>
+ <EditorIndex Value="3"/>
+ <UsageCount Value="12"/>
+ <Loaded Value="True"/>
+ </Unit4>
+ <Unit5>
+ <Filename Value="..\..\..\src\corelib\gdi\gfx_gdi.pas"/>
+ <UnitName Value="gfx_gdi"/>
+ <CursorPos X="31" Y="1231"/>
+ <TopLine Value="1193"/>
+ <EditorIndex Value="4"/>
+ <UsageCount Value="12"/>
+ <Loaded Value="True"/>
+ </Unit5>
+ <Unit6>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\objpas\classes\classesh.inc"/>
+ <CursorPos X="14" Y="25"/>
+ <TopLine Value="15"/>
+ <UsageCount Value="10"/>
+ </Unit6>
+ <Unit7>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\objpas\types.pp"/>
+ <UnitName Value="types"/>
+ <CursorPos X="13" Y="21"/>
+ <TopLine Value="5"/>
+ <UsageCount Value="10"/>
+ </Unit7>
+ <Unit8>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\windows.pp"/>
+ <UnitName Value="windows"/>
+ <CursorPos X="7" Y="33"/>
+ <TopLine Value="21"/>
+ <UsageCount Value="10"/>
+ </Unit8>
+ <Unit9>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\struct.inc"/>
+ <CursorPos X="12" Y="220"/>
+ <TopLine Value="210"/>
+ <UsageCount Value="10"/>
+ </Unit9>
+ <Unit10>
+ <Filename Value="..\..\..\src\gui\gui_listbox.pas"/>
+ <UnitName Value="gui_listbox"/>
+ <CursorPos X="1" Y="516"/>
+ <TopLine Value="506"/>
+ <UsageCount Value="10"/>
+ </Unit10>
+ <Unit11>
+ <Filename Value="..\..\..\src\gui\gui_button.pas"/>
+ <UnitName Value="gui_button"/>
+ <CursorPos X="1" Y="221"/>
+ <TopLine Value="210"/>
+ <UsageCount Value="10"/>
+ </Unit11>
+ <Unit12>
+ <Filename Value="..\..\..\src\gui\gui_combobox.pas"/>
+ <UnitName Value="gui_combobox"/>
+ <CursorPos X="11" Y="287"/>
+ <TopLine Value="269"/>
+ <UsageCount Value="10"/>
+ </Unit12>
+ <Unit13>
+ <Filename Value="..\..\..\src\gui\gui_edit.pas"/>
+ <UnitName Value="gui_edit"/>
+ <CursorPos X="12" Y="215"/>
+ <TopLine Value="204"/>
+ <UsageCount Value="10"/>
+ </Unit13>
+ <Unit14>
+ <Filename Value="..\..\..\src\gui\gui_memo.pas"/>
+ <UnitName Value="gui_memo"/>
+ <CursorPos X="11" Y="636"/>
+ <TopLine Value="625"/>
+ <UsageCount Value="10"/>
+ </Unit14>
+ <Unit15>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\func.inc"/>
+ <CursorPos X="1" Y="753"/>
+ <TopLine Value="745"/>
+ <UsageCount Value="10"/>
+ </Unit15>
+ <Unit16>
+ <Filename Value="..\..\..\..\..\FPC\2.0.x\src\rtl\win32\wininc\redef.inc"/>
+ <CursorPos X="18" Y="692"/>
+ <TopLine Value="681"/>
+ <UsageCount Value="10"/>
+ </Unit16>
+ </Units>
+ <JumpHistory Count="0" HistoryIndex="-1"/>
+ </ProjectOptions>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+</CONFIG>
diff --git a/prototypes/fpgui2/tests/drawtest.lpr b/prototypes/fpgui2/tests/drawtest.lpr
new file mode 100644
index 00000000..e7506645
--- /dev/null
+++ b/prototypes/fpgui2/tests/drawtest.lpr
@@ -0,0 +1,124 @@
+program drawtest;
+
+{$mode objfpc}{$H+}
+
+uses
+ {$IFDEF UNIX}{$IFDEF UseCThreads}
+ cthreads,
+ {$ENDIF}{$ENDIF}
+ Classes,
+ fpgfx,
+ gfxbase,
+ gui_form,
+ gfx_imgfmt_bmp;
+
+type
+
+ TMainForm = class(TfpgForm)
+ private
+ img: TfpgImage;
+ finalimg: TfpgImage;
+ protected
+ procedure HandlePaint; override;
+ procedure HandleShow; override;
+ public
+ constructor Create(AOwner: TComponent); override;
+ destructor Destroy; override;
+ end;
+
+{ TMainForm }
+
+procedure TMainForm.HandlePaint;
+var
+ r: TfpgRect;
+begin
+ Canvas.BeginDraw;
+ inherited HandlePaint;
+ Canvas.Clear(clSteelBlue);
+
+ Canvas.DrawString(10, 10, 'Original 50x50 image:');
+ Canvas.DrawImage(200, 10, img);
+ Canvas.DrawString(10, 60, 'All line and pixel drawing must only appear');
+ Canvas.DrawString(10, 60+Canvas.Font.Height, 'on black rectangles. Watch for line start and');
+ Canvas.DrawString(10, 60+(Canvas.Font.Height*2), 'ending points.');
+
+ // final image
+ Canvas.DrawString(10, 195-Canvas.Font.Height, 'The final images should look line this:');
+ Canvas.DrawImage(100, 200, finalimg);
+
+ // blank rectangle image
+ Canvas.DrawImage(100, 100, img);
+
+ // rectangle
+ Canvas.SetColor(clRed);
+ Canvas.DrawRectangle(102, 102, 147, 147); // (over second outer black rectangle)
+ Canvas.SetColor(clMagenta);
+ Canvas.DrawRectangle(104, 104, 145, 145); // (over third outer black rectangle)
+
+ // Point (outer 4 corners)
+ Canvas.Pixels[100, 100] := clBlue;
+ Canvas.Pixels[149, 100] := clBlue;
+ Canvas.Pixels[100, 149] := clBlue;
+ Canvas.Pixels[149, 149] := clBlue;
+
+ // FillRect
+ Canvas.SetColor(clYellow);
+ Canvas.FillRectangle(111, 111, 139, 139); // inner white rectangle
+
+ // line diagonal
+ Canvas.SetColor(clRed);
+ Canvas.DrawLine(110, 110, 139, 139); // top/left of inner black rect to bottom/right
+ Canvas.SetColor(clGreen);
+ Canvas.DrawLine(139, 110, 110, 139); // top/right of inner black rect to bottom/left
+
+ // line vertical
+ Canvas.SetColor(clBlue);
+ Canvas.DrawLine(108, 108, 108, 141);
+ Canvas.DrawLine(141, 108, 141, 141);
+
+ // line horizontal
+ Canvas.SetColor(clGreen);
+ Canvas.DrawLine(106, 106, 143, 106);
+ Canvas.DrawLine(106, 143, 143, 143);
+
+
+ Canvas.EndDraw;
+end;
+
+procedure TMainForm.HandleShow;
+begin
+ img := LoadImage_BMP('square.bmp');
+ finalimg := LoadImage_BMP('drawtest.bmp');
+ inherited HandleShow;
+end;
+
+constructor TMainForm.Create(AOwner: TComponent);
+begin
+ inherited Create(AOwner);
+ WindowTitle := 'Draw test';
+ SetPosition(100, 100, 300, 300);
+
+end;
+
+destructor TMainForm.Destroy;
+begin
+ img.Free;
+ finalimg.Free;
+ inherited Destroy;
+end;
+
+
+procedure MainProc;
+var
+ frm: TMainForm;
+begin
+ fpgApplication.Initialize;
+ frm := TMainForm.Create(nil);
+ frm.Show;
+ fpgApplication.Run;
+end;
+
+begin
+ MainProc;
+end.
+
diff --git a/prototypes/fpgui2/tests/edittest.lpi b/prototypes/fpgui2/tests/edittest.lpi
index 1ecb384f..b609d403 100644
--- a/prototypes/fpgui2/tests/edittest.lpi
+++ b/prototypes/fpgui2/tests/edittest.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=""/>
</General>
<VersionInfo>
@@ -23,7 +23,7 @@
<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">
@@ -42,6 +42,7 @@
</ProjectOptions>
<CompilerOptions>
<Version Value="5"/>
+ <PathDelim Value="\"/>
<CodeGeneration>
<Generate Value="Faster"/>
</CodeGeneration>
diff --git a/prototypes/fpgui2/tests/square.bmp b/prototypes/fpgui2/tests/square.bmp
new file mode 100644
index 00000000..89f68647
--- /dev/null
+++ b/prototypes/fpgui2/tests/square.bmp
Binary files differ