diff options
114 files changed, 13315 insertions, 0 deletions
diff --git a/prototypes/fpgui2/docs/notes.txt b/prototypes/fpgui2/docs/notes.txt new file mode 100644 index 00000000..aae0b240 --- /dev/null +++ b/prototypes/fpgui2/docs/notes.txt @@ -0,0 +1,37 @@ + + These are some notes I thought will come in handly as I work through the + code and write new code. + + +Event handling +================== +* Each platform gets the events from the underlying graphics library. +* Events get caught and translated into a fpGUI message record. +* The fpGUI message record gets placed (using pgfPostMessage) in a custom +fpGUI message queue (which is a preset linkedlist structure with 512 links). +* From there the fpGUI message records get delivered to the specific window +* Certain messages traverse up the hierarchy to be processed by all parents. + +The standard 'message' feature of Object Pascal gets used to deliver the +fpGUI message records to the different windows (widgets). + + + +Pen and Brush support (X11) +=========================== +* They come from the GC +* It seems they are seperate GC's and swapped around when needed in the +different Xlib drawing routines. Both created with the XCreateGC() function + eg: + d->gc = Pen + d->gc_brush = Brush + + XFillRectangle(dpy, screen, d->gc_brush, .....); + XDrawRectangle(dpy, screen, d->gc, .....); + +* Updating the Pen and Brush attributes are done with a call to XChangeGC(), +passing in the relevant GC (d->gc or d->gc_brush). + + + + diff --git a/prototypes/fpgui2/docs/readme.txt b/prototypes/fpgui2/docs/readme.txt new file mode 100644 index 00000000..e853a943 --- /dev/null +++ b/prototypes/fpgui2/docs/readme.txt @@ -0,0 +1,8 @@ + + This version of fpGUI is to try out a implementation where every + widget has a window handle. In other words every widget is actually + a embedded window in the Form window. + +Graeme. + + diff --git a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi new file mode 100644 index 00000000..f09daf7e --- /dev/null +++ b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpi @@ -0,0 +1,55 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value=".\"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="eventtest.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="eventtest"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <CodeGeneration> + <Optimizations> + <OptimizationLevel Value="0"/> + </Optimizations> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr new file mode 100644 index 00000000..786ec3a0 --- /dev/null +++ b/prototypes/fpgui2/examples/core/eventtest/eventtest.lpr @@ -0,0 +1,152 @@ +program eventtest; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, SysUtils, GFXBase, fpGFX, gui_form, gfx_widget; + +type + TMainForm = class(TfpgForm) + private + function ShiftStateToStr(AShift: word): string; + function MouseState(AShift: word; const AMousePos: TPoint): string; + protected + procedure HandleClose; override; + procedure HandlePaint; override; + procedure HandleDoubleClick(x, y: integer; button: word; shiftstate: word); override; + procedure HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleMouseEnter; override; + procedure HandleMouseExit; override; + procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: word); override; + procedure HandleLMouseDown(x, y: integer; shiftstate: word); override; + procedure HandleLMouseUp(x, y: integer; shiftstate: word); override; + procedure HandleRMouseDown(x, y: integer; shiftstate: word); override; + procedure HandleRMouseUp(x, y: integer; shiftstate: word); override; + public + constructor Create(aowner: TComponent); override; + end; + +{ TMainForm } + +function TMainForm.ShiftStateToStr(AShift: word): string; +begin + Result := ''; + {$Note This must move into gfx_XXX units and return TShiftState enum} + if (AShift and ss_Shift) <> 0 then + Result := 'Shift '; + if (AShift and ss_Alt) <> 0 then + Result := Result + 'Alt '; + if (AShift and ss_Control) <> 0 then + Result := Result + 'Ctrl '; +end; + +function TMainForm.MouseState(AShift: word; const AMousePos: TPoint): string; +var + ShiftStateStr: String; +begin + ShiftStateStr := ShiftStateToStr(AShift); + Result := '[X=' + IntToStr(AMousePos.x) + ' Y=' + IntToStr(AMousePos.y); + if Length(ShiftStateStr) > 0 then + Result := Result + ' ' + ShiftStateStr; + Result := Result + '] '; +end; + +procedure TMainForm.HandleClose; +begin + WriteLn('HandleClose'); + inherited HandleClose; +end; + +procedure TMainForm.HandlePaint; +begin + WriteLn('HandlePaint'); + inherited HandlePaint; +end; + +procedure TMainForm.HandleDoubleClick(x, y: integer; button: word; + shiftstate: word); +begin + WriteLn('HandleDoubleClick'); + inherited HandleDoubleClick(x, y, button, shiftstate); +end; + +procedure TMainForm.HandleKeyChar(var keycode: word; var shiftstate: word; + var consumed: boolean); +begin + Write('Character generated: '); + if Char(keycode) >= ' ' then + WriteLn('''', Char(keycode), '''') + else + WriteLn('#', Ord(keycode)); + + inherited HandleKeyChar(keycode, shiftstate, consumed); +end; + +procedure TMainForm.HandleMouseEnter; +begin + WriteLn('Mouse entered window'); + inherited HandleMouseEnter; +end; + +procedure TMainForm.HandleMouseExit; +begin + WriteLn('Mouse left window'); + inherited HandleMouseExit; +end; + +procedure TMainForm.HandleMouseMove(x, y: integer; btnstate: word; + shiftstate: word); +begin + WriteLn(MouseState(shiftstate, Point(x, y)), 'Mouse moved'); + inherited HandleMouseMove(x, y, btnstate, shiftstate); +end; + +procedure TMainForm.HandleLMouseDown(x, y: integer; shiftstate: word); +begin + WriteLn('Left mouse button down'); + inherited HandleLMouseDown(x, y, shiftstate); +end; + +procedure TMainForm.HandleLMouseUp(x, y: integer; shiftstate: word); +begin + Writeln('Left mouse button up'); + inherited HandleLMouseUp(x, y, shiftstate); +end; + +procedure TMainForm.HandleRMouseDown(x, y: integer; shiftstate: word); +begin + Writeln('Right mouse button down'); + inherited HandleRMouseDown(x, y, shiftstate); +end; + +procedure TMainForm.HandleRMouseUp(x, y: integer; shiftstate: word); +begin + WriteLn('Right mouse button up'); + inherited HandleRMouseUp(x, y, shiftstate); +end; + +constructor TMainForm.Create(aowner: TComponent); +begin + inherited Create(aowner); + SetPosition(100, 100, 500, 100); + WindowTitle := 'fpGFX event test'; +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/examples/core/imgtest/bitmaptest.dpr b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.dpr new file mode 100644 index 00000000..969cb09f --- /dev/null +++ b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.dpr @@ -0,0 +1,68 @@ +program bitmaptest; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_imgfmt_bmp, + gui_form; + +type + + { TMainForm } + + TMainForm = class(TfpgForm) + protected + procedure HandlePaint; override; + public + procedure AfterCreate; override; + end; + + + { TMainForm } + + procedure TMainForm.AfterCreate; + begin + SetPosition(100, 100, 256, 256); + WindowTitle := 'fpGUI2 Bitmap Test'; + end; + + procedure TMainForm.HandlePaint; + var + img: TfpgImage; + i, j: integer; + begin + Canvas.BeginDraw; // activate double buffering in time. + inherited HandlePaint; + + img := TfpgImage.Create; + img.AllocateImage(32, 256, 256); + img.UpdateImage; + // populate the bitmap with pretty colors :-) + for j := 0 to 255 do + for i := 0 to 255 do + PLongWord(img.ImageData)[j * 256 + i] := (i shl 16) or (j shl 8); + + Canvas.DrawImage(0, 0, img); + img.Free; + Canvas.EndDraw; + 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/examples/core/imgtest/bitmaptest.lpi b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.lpi new file mode 100644 index 00000000..844bcc82 --- /dev/null +++ b/prototypes/fpgui2/examples/core/imgtest/bitmaptest.lpi @@ -0,0 +1,63 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + <Title Value="bitmaptest"/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="bitmaptest.dpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="bitmaptest"/> + </Unit0> + <Unit1> + <Filename Value="uhelpers.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="uhelpers"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <IncludeFiles Value="../source/"/> + <OtherUnitFiles Value="../source/;../source/x11/;../gui/"/> + </SearchPaths> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi new file mode 100644 index 00000000..8ec0e1a4 --- /dev/null +++ b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpi @@ -0,0 +1,51 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="stdimglist.lpr"/> + <IsPartOfProject Value="True"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr new file mode 100644 index 00000000..06212cfc --- /dev/null +++ b/prototypes/fpgui2/examples/gui/stdimages/stdimglist.lpr @@ -0,0 +1,93 @@ +program stdimglist; + +{$mode objfpc}{$H+} + +uses + Classes, SysUtils, + fpgfx, gfxbase, gui_form, gfx_imgfmt_bmp, gui_button; + +type + + TMainForm = class(TfpgForm) + private + btnClose: TfpgButton; + procedure btnCloseClick(Sender: TObject); + protected + procedure HandlePaint; override; + public + constructor Create(aowner: TComponent); override; + procedure AfterCreate; override; + end; + +{ TMainForm } + +procedure TMainForm.AfterCreate; +begin + SetPosition(100,100,700,500); + WindowTitle := 'fpGUI Standard Image Listing'; +end; + +procedure TMainForm.btnCloseClick(Sender: TObject); +begin + Close; +end; + +procedure TMainForm.HandlePaint; +var + n: integer; + x: TfpgCoord; + y: TfpgCoord; + sl: TStringList; + img: TfpgImage; +begin + Canvas.BeginDraw; // begin double buffering + inherited HandlePaint; + + sl := TStringList.Create; + x := 8; + y := 8; + fpgImages.ListImages(sl); + + for n := 0 to sl.Count-1 do + begin + Canvas.DrawString(x, y, sl[n]+':'); + + img := TfpgImage(sl.Objects[n]); + if img <> nil then + Canvas.DrawImage(x+150, y, img); + + inc(y, img.Height+8); + if y > Height-32 then // largest images are 32 in height + begin + inc(x, 200); + y := 8; + end; + end; + + Canvas.EndDraw; + sl.Free; +end; + +constructor TMainForm.Create(aowner: TComponent); +begin + inherited Create(aowner); + // Place button in bottom right corner. + btnClose := CreateButton(self, Width-90, Height-35, 75, 'Quit', @btnCloseClick); + btnClose.ImageName := 'stdimg.quit'; +// btnClose.Focusable := False; + btnClose.Anchors := [anRight, anBottom]; +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/images/arrow_down.bmp b/prototypes/fpgui2/images/arrow_down.bmp Binary files differnew file mode 100644 index 00000000..853bf3c8 --- /dev/null +++ b/prototypes/fpgui2/images/arrow_down.bmp diff --git a/prototypes/fpgui2/images/arrow_left.bmp b/prototypes/fpgui2/images/arrow_left.bmp Binary files differnew file mode 100644 index 00000000..6402f832 --- /dev/null +++ b/prototypes/fpgui2/images/arrow_left.bmp diff --git a/prototypes/fpgui2/images/arrow_right.bmp b/prototypes/fpgui2/images/arrow_right.bmp Binary files differnew file mode 100644 index 00000000..223e3a5a --- /dev/null +++ b/prototypes/fpgui2/images/arrow_right.bmp diff --git a/prototypes/fpgui2/images/arrow_up.bmp b/prototypes/fpgui2/images/arrow_up.bmp Binary files differnew file mode 100644 index 00000000..0c51179c --- /dev/null +++ b/prototypes/fpgui2/images/arrow_up.bmp diff --git a/prototypes/fpgui2/images/btn_cancel_16.bmp b/prototypes/fpgui2/images/btn_cancel_16.bmp Binary files differnew file mode 100644 index 00000000..5a92a713 --- /dev/null +++ b/prototypes/fpgui2/images/btn_cancel_16.bmp diff --git a/prototypes/fpgui2/images/btn_close_16.bmp b/prototypes/fpgui2/images/btn_close_16.bmp Binary files differnew file mode 100644 index 00000000..e3e355c3 --- /dev/null +++ b/prototypes/fpgui2/images/btn_close_16.bmp diff --git a/prototypes/fpgui2/images/btn_ok_16.bmp b/prototypes/fpgui2/images/btn_ok_16.bmp Binary files differnew file mode 100644 index 00000000..99be5cd5 --- /dev/null +++ b/prototypes/fpgui2/images/btn_ok_16.bmp diff --git a/prototypes/fpgui2/images/choice_no_16.bmp b/prototypes/fpgui2/images/choice_no_16.bmp Binary files differnew file mode 100644 index 00000000..d3e21f1b --- /dev/null +++ b/prototypes/fpgui2/images/choice_no_16.bmp diff --git a/prototypes/fpgui2/images/choice_yes_16.bmp b/prototypes/fpgui2/images/choice_yes_16.bmp Binary files differnew file mode 100644 index 00000000..374a9bbd --- /dev/null +++ b/prototypes/fpgui2/images/choice_yes_16.bmp diff --git a/prototypes/fpgui2/images/dialog_confirmation_32.bmp b/prototypes/fpgui2/images/dialog_confirmation_32.bmp Binary files differnew file mode 100644 index 00000000..7cac692a --- /dev/null +++ b/prototypes/fpgui2/images/dialog_confirmation_32.bmp diff --git a/prototypes/fpgui2/images/dialog_error_32.bmp b/prototypes/fpgui2/images/dialog_error_32.bmp Binary files differnew file mode 100644 index 00000000..c540509d --- /dev/null +++ b/prototypes/fpgui2/images/dialog_error_32.bmp diff --git a/prototypes/fpgui2/images/dialog_information_32.bmp b/prototypes/fpgui2/images/dialog_information_32.bmp Binary files differnew file mode 100644 index 00000000..1e36b1d4 --- /dev/null +++ b/prototypes/fpgui2/images/dialog_information_32.bmp diff --git a/prototypes/fpgui2/images/dialog_warning_32.bmp b/prototypes/fpgui2/images/dialog_warning_32.bmp Binary files differnew file mode 100644 index 00000000..f643d0bc --- /dev/null +++ b/prototypes/fpgui2/images/dialog_warning_32.bmp diff --git a/prototypes/fpgui2/images/document.bmp b/prototypes/fpgui2/images/document.bmp Binary files differnew file mode 100644 index 00000000..6b8c4947 --- /dev/null +++ b/prototypes/fpgui2/images/document.bmp diff --git a/prototypes/fpgui2/images/edit.bmp b/prototypes/fpgui2/images/edit.bmp Binary files differnew file mode 100644 index 00000000..ddfed2b2 --- /dev/null +++ b/prototypes/fpgui2/images/edit.bmp diff --git a/prototypes/fpgui2/images/edit_copy_16.bmp b/prototypes/fpgui2/images/edit_copy_16.bmp Binary files differnew file mode 100644 index 00000000..532a071f --- /dev/null +++ b/prototypes/fpgui2/images/edit_copy_16.bmp diff --git a/prototypes/fpgui2/images/edit_cut_16.bmp b/prototypes/fpgui2/images/edit_cut_16.bmp Binary files differnew file mode 100644 index 00000000..69829380 --- /dev/null +++ b/prototypes/fpgui2/images/edit_cut_16.bmp diff --git a/prototypes/fpgui2/images/edit_delete_16.bmp b/prototypes/fpgui2/images/edit_delete_16.bmp Binary files differnew file mode 100644 index 00000000..d7a93e8e --- /dev/null +++ b/prototypes/fpgui2/images/edit_delete_16.bmp diff --git a/prototypes/fpgui2/images/edit_paste_16.bmp b/prototypes/fpgui2/images/edit_paste_16.bmp Binary files differnew file mode 100644 index 00000000..d0807b0f --- /dev/null +++ b/prototypes/fpgui2/images/edit_paste_16.bmp diff --git a/prototypes/fpgui2/images/folder_16.bmp b/prototypes/fpgui2/images/folder_16.bmp Binary files differnew file mode 100644 index 00000000..5e49bf7c --- /dev/null +++ b/prototypes/fpgui2/images/folder_16.bmp diff --git a/prototypes/fpgui2/images/folder_new_16.bmp b/prototypes/fpgui2/images/folder_new_16.bmp Binary files differnew file mode 100644 index 00000000..a846a032 --- /dev/null +++ b/prototypes/fpgui2/images/folder_new_16.bmp diff --git a/prototypes/fpgui2/images/folder_open_16.bmp b/prototypes/fpgui2/images/folder_open_16.bmp Binary files differnew file mode 100644 index 00000000..8caa1d62 --- /dev/null +++ b/prototypes/fpgui2/images/folder_open_16.bmp diff --git a/prototypes/fpgui2/images/folder_up_16.bmp b/prototypes/fpgui2/images/folder_up_16.bmp Binary files differnew file mode 100644 index 00000000..1edf959f --- /dev/null +++ b/prototypes/fpgui2/images/folder_up_16.bmp diff --git a/prototypes/fpgui2/images/font_16.bmp b/prototypes/fpgui2/images/font_16.bmp Binary files differnew file mode 100644 index 00000000..0b525df1 --- /dev/null +++ b/prototypes/fpgui2/images/font_16.bmp diff --git a/prototypes/fpgui2/images/help_16.bmp b/prototypes/fpgui2/images/help_16.bmp Binary files differnew file mode 100644 index 00000000..63f418bf --- /dev/null +++ b/prototypes/fpgui2/images/help_16.bmp diff --git a/prototypes/fpgui2/images/hidden.bmp b/prototypes/fpgui2/images/hidden.bmp Binary files differnew file mode 100644 index 00000000..c5fe782c --- /dev/null +++ b/prototypes/fpgui2/images/hidden.bmp diff --git a/prototypes/fpgui2/images/link.bmp b/prototypes/fpgui2/images/link.bmp Binary files differnew file mode 100644 index 00000000..8331e9bd --- /dev/null +++ b/prototypes/fpgui2/images/link.bmp diff --git a/prototypes/fpgui2/images/list_add_16.bmp b/prototypes/fpgui2/images/list_add_16.bmp Binary files differnew file mode 100644 index 00000000..974167a7 --- /dev/null +++ b/prototypes/fpgui2/images/list_add_16.bmp diff --git a/prototypes/fpgui2/images/list_remove_16.bmp b/prototypes/fpgui2/images/list_remove_16.bmp Binary files differnew file mode 100644 index 00000000..b2e7a4ad --- /dev/null +++ b/prototypes/fpgui2/images/list_remove_16.bmp diff --git a/prototypes/fpgui2/images/menu_exit_16.bmp b/prototypes/fpgui2/images/menu_exit_16.bmp Binary files differnew file mode 100644 index 00000000..8e3199a1 --- /dev/null +++ b/prototypes/fpgui2/images/menu_exit_16.bmp diff --git a/prototypes/fpgui2/images/menu_preferences_16.bmp b/prototypes/fpgui2/images/menu_preferences_16.bmp Binary files differnew file mode 100644 index 00000000..1c8007b1 --- /dev/null +++ b/prototypes/fpgui2/images/menu_preferences_16.bmp diff --git a/prototypes/fpgui2/images/menu_quit_16.bmp b/prototypes/fpgui2/images/menu_quit_16.bmp Binary files differnew file mode 100644 index 00000000..18753c16 --- /dev/null +++ b/prototypes/fpgui2/images/menu_quit_16.bmp diff --git a/prototypes/fpgui2/images/menu_save_16.bmp b/prototypes/fpgui2/images/menu_save_16.bmp Binary files differnew file mode 100644 index 00000000..9e58b661 --- /dev/null +++ b/prototypes/fpgui2/images/menu_save_16.bmp diff --git a/prototypes/fpgui2/images/menu_save_all_16.bmp b/prototypes/fpgui2/images/menu_save_all_16.bmp Binary files differnew file mode 100644 index 00000000..62ed2104 --- /dev/null +++ b/prototypes/fpgui2/images/menu_save_all_16.bmp diff --git a/prototypes/fpgui2/images/menu_saveas_16.bmp b/prototypes/fpgui2/images/menu_saveas_16.bmp Binary files differnew file mode 100644 index 00000000..fb89079f --- /dev/null +++ b/prototypes/fpgui2/images/menu_saveas_16.bmp diff --git a/prototypes/fpgui2/images/refresh_16.bmp b/prototypes/fpgui2/images/refresh_16.bmp Binary files differnew file mode 100644 index 00000000..8e8a1288 --- /dev/null +++ b/prototypes/fpgui2/images/refresh_16.bmp diff --git a/prototypes/fpgui2/images/search_16.bmp b/prototypes/fpgui2/images/search_16.bmp Binary files differnew file mode 100644 index 00000000..0d49be63 --- /dev/null +++ b/prototypes/fpgui2/images/search_16.bmp diff --git a/prototypes/fpgui2/images/stdimg_update.sh b/prototypes/fpgui2/images/stdimg_update.sh new file mode 100755 index 00000000..c93744c9 --- /dev/null +++ b/prototypes/fpgui2/images/stdimg_update.sh @@ -0,0 +1,3 @@ +#!/bin/sh +chmod +x updatestdimgs +./updatestdimgs > ../source/core/stdimages.inc
\ No newline at end of file diff --git a/prototypes/fpgui2/images/stdimg_updatew.bat b/prototypes/fpgui2/images/stdimg_updatew.bat new file mode 100755 index 00000000..35c410f2 --- /dev/null +++ b/prototypes/fpgui2/images/stdimg_updatew.bat @@ -0,0 +1 @@ +updatestdimgs > ../source/core/stdimages.inc
\ No newline at end of file diff --git a/prototypes/fpgui2/images/themes/luna/arrows.bmp b/prototypes/fpgui2/images/themes/luna/arrows.bmp Binary files differnew file mode 100644 index 00000000..758442fa --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/arrows.bmp diff --git a/prototypes/fpgui2/images/themes/luna/button.bmp b/prototypes/fpgui2/images/themes/luna/button.bmp Binary files differnew file mode 100644 index 00000000..8ae427cf --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/button.bmp diff --git a/prototypes/fpgui2/images/themes/luna/checkbox.bmp b/prototypes/fpgui2/images/themes/luna/checkbox.bmp Binary files differnew file mode 100644 index 00000000..dca4a692 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/checkbox.bmp diff --git a/prototypes/fpgui2/images/themes/luna/combobox.bmp b/prototypes/fpgui2/images/themes/luna/combobox.bmp Binary files differnew file mode 100644 index 00000000..9b59abcc --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/combobox.bmp diff --git a/prototypes/fpgui2/images/themes/luna/edittext.bmp b/prototypes/fpgui2/images/themes/luna/edittext.bmp Binary files differnew file mode 100644 index 00000000..efa8981e --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/edittext.bmp diff --git a/prototypes/fpgui2/images/themes/luna/groupbox.bmp b/prototypes/fpgui2/images/themes/luna/groupbox.bmp Binary files differnew file mode 100644 index 00000000..60975283 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/groupbox.bmp diff --git a/prototypes/fpgui2/images/themes/luna/header.bmp b/prototypes/fpgui2/images/themes/luna/header.bmp Binary files differnew file mode 100644 index 00000000..d613a632 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/header.bmp diff --git a/prototypes/fpgui2/images/themes/luna/progressbar.bmp b/prototypes/fpgui2/images/themes/luna/progressbar.bmp Binary files differnew file mode 100644 index 00000000..7de5143e --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/progressbar.bmp diff --git a/prototypes/fpgui2/images/themes/luna/radiobutton.bmp b/prototypes/fpgui2/images/themes/luna/radiobutton.bmp Binary files differnew file mode 100644 index 00000000..c66df229 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/radiobutton.bmp diff --git a/prototypes/fpgui2/images/themes/luna/scrollbar.bmp b/prototypes/fpgui2/images/themes/luna/scrollbar.bmp Binary files differnew file mode 100644 index 00000000..11786b71 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/scrollbar.bmp diff --git a/prototypes/fpgui2/images/themes/luna/tabbody.bmp b/prototypes/fpgui2/images/themes/luna/tabbody.bmp Binary files differnew file mode 100644 index 00000000..65d5890c --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/tabbody.bmp diff --git a/prototypes/fpgui2/images/themes/luna/tabs.bmp b/prototypes/fpgui2/images/themes/luna/tabs.bmp Binary files differnew file mode 100644 index 00000000..ecb563d2 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/tabs.bmp diff --git a/prototypes/fpgui2/images/themes/luna/toolbarbutton.bmp b/prototypes/fpgui2/images/themes/luna/toolbarbutton.bmp Binary files differnew file mode 100644 index 00000000..d507fc19 --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/toolbarbutton.bmp diff --git a/prototypes/fpgui2/images/themes/luna/toolbarsep.bmp b/prototypes/fpgui2/images/themes/luna/toolbarsep.bmp Binary files differnew file mode 100644 index 00000000..50cc567a --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/toolbarsep.bmp diff --git a/prototypes/fpgui2/images/themes/luna/trackbar.bmp b/prototypes/fpgui2/images/themes/luna/trackbar.bmp Binary files differnew file mode 100644 index 00000000..1b47eb0f --- /dev/null +++ b/prototypes/fpgui2/images/themes/luna/trackbar.bmp diff --git a/prototypes/fpgui2/images/themes/silver/arrows.bmp b/prototypes/fpgui2/images/themes/silver/arrows.bmp Binary files differnew file mode 100644 index 00000000..897199a8 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/arrows.bmp diff --git a/prototypes/fpgui2/images/themes/silver/button.bmp b/prototypes/fpgui2/images/themes/silver/button.bmp Binary files differnew file mode 100644 index 00000000..cca0f695 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/button.bmp diff --git a/prototypes/fpgui2/images/themes/silver/checkbox.bmp b/prototypes/fpgui2/images/themes/silver/checkbox.bmp Binary files differnew file mode 100644 index 00000000..dca4a692 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/checkbox.bmp diff --git a/prototypes/fpgui2/images/themes/silver/checkedmenu.bmp b/prototypes/fpgui2/images/themes/silver/checkedmenu.bmp Binary files differnew file mode 100644 index 00000000..3152efc3 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/checkedmenu.bmp diff --git a/prototypes/fpgui2/images/themes/silver/checkedmenu.png b/prototypes/fpgui2/images/themes/silver/checkedmenu.png Binary files differnew file mode 100644 index 00000000..a06e1182 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/checkedmenu.png diff --git a/prototypes/fpgui2/images/themes/silver/combobox.bmp b/prototypes/fpgui2/images/themes/silver/combobox.bmp Binary files differnew file mode 100644 index 00000000..35ab06bd --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/combobox.bmp diff --git a/prototypes/fpgui2/images/themes/silver/edittext.bmp b/prototypes/fpgui2/images/themes/silver/edittext.bmp Binary files differnew file mode 100644 index 00000000..efa8981e --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/edittext.bmp diff --git a/prototypes/fpgui2/images/themes/silver/groupbox.bmp b/prototypes/fpgui2/images/themes/silver/groupbox.bmp Binary files differnew file mode 100644 index 00000000..60975283 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/groupbox.bmp diff --git a/prototypes/fpgui2/images/themes/silver/header.bmp b/prototypes/fpgui2/images/themes/silver/header.bmp Binary files differnew file mode 100644 index 00000000..68337a81 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/header.bmp diff --git a/prototypes/fpgui2/images/themes/silver/progressbar.bmp b/prototypes/fpgui2/images/themes/silver/progressbar.bmp Binary files differnew file mode 100644 index 00000000..7de5143e --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/progressbar.bmp diff --git a/prototypes/fpgui2/images/themes/silver/radiobutton.bmp b/prototypes/fpgui2/images/themes/silver/radiobutton.bmp Binary files differnew file mode 100644 index 00000000..966ef7c4 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/radiobutton.bmp diff --git a/prototypes/fpgui2/images/themes/silver/scrollbar.bmp b/prototypes/fpgui2/images/themes/silver/scrollbar.bmp Binary files differnew file mode 100644 index 00000000..1bac337e --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/scrollbar.bmp diff --git a/prototypes/fpgui2/images/themes/silver/tabbody.bmp b/prototypes/fpgui2/images/themes/silver/tabbody.bmp Binary files differnew file mode 100644 index 00000000..6d57593b --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/tabbody.bmp diff --git a/prototypes/fpgui2/images/themes/silver/tabs.bmp b/prototypes/fpgui2/images/themes/silver/tabs.bmp Binary files differnew file mode 100644 index 00000000..c9351a13 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/tabs.bmp diff --git a/prototypes/fpgui2/images/themes/silver/toolbarbutton.bmp b/prototypes/fpgui2/images/themes/silver/toolbarbutton.bmp Binary files differnew file mode 100644 index 00000000..d507fc19 --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/toolbarbutton.bmp diff --git a/prototypes/fpgui2/images/themes/silver/toolbarsep.bmp b/prototypes/fpgui2/images/themes/silver/toolbarsep.bmp Binary files differnew file mode 100644 index 00000000..50cc567a --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/toolbarsep.bmp diff --git a/prototypes/fpgui2/images/themes/silver/trackbar.bmp b/prototypes/fpgui2/images/themes/silver/trackbar.bmp Binary files differnew file mode 100644 index 00000000..b7c3018e --- /dev/null +++ b/prototypes/fpgui2/images/themes/silver/trackbar.bmp diff --git a/prototypes/fpgui2/images/updatestdimgs b/prototypes/fpgui2/images/updatestdimgs Binary files differnew file mode 100755 index 00000000..f9bafbb8 --- /dev/null +++ b/prototypes/fpgui2/images/updatestdimgs diff --git a/prototypes/fpgui2/images/updatestdimgs.pas b/prototypes/fpgui2/images/updatestdimgs.pas new file mode 100644 index 00000000..e476539f --- /dev/null +++ b/prototypes/fpgui2/images/updatestdimgs.pas @@ -0,0 +1,28 @@ +program updatestdimgs; + +{$IFDEF FPC} + {$mode delphi} + {$H+} +{$ELSE} +{$APPTYPE CONSOLE} +{$ENDIF} + +uses SysUtils, {$ifdef Win32}Windows{$else}linux{$endif}; + +var + sr : TSearchRec; + i,p : integer; + s : string; + cmdline : string; +begin + i := FindFirst('*.bmp',faAnyFile,sr); + while i=0 do + begin + s := sr.Name; + p := pos('.bmp',s); + if p > 0 then s := copy(s,1,p-1); + cmdline := 'bin2obj -c stdimg_'+s+' '+sr.Name; + WinExec(PChar(cmdline),0); + i := FindNext(sr); + end; +end. diff --git a/prototypes/fpgui2/source/core/fpgfx.pas b/prototypes/fpgui2/source/core/fpgfx.pas new file mode 100644 index 00000000..6ca78510 --- /dev/null +++ b/prototypes/fpgui2/source/core/fpgfx.pas @@ -0,0 +1,1467 @@ +unit fpgfx; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase + // This is the only place we have such IFDEF!!! Is this ok, or must be + // implement it like we have done for the previous version of fpGFX? + {$IFDEF MSWINDOWS} + ,gfx_gdi + {$ENDIF} + {$IFDEF UNIX} + ,gfx_x11 + {$ENDIF} + ; + +type + TOrientation = (orVertical, orHorizontal); + + TAlign = (alNone, alTop, alBottom, alLeft, alRight, alClient); + + TAnchor = (anLeft, anRight, anTop, anBottom); + TAnchors = set of TAnchor; + + TClipboardKeyType = (ckNone, ckCopy, ckPaste, ckCut); + + TFButtonFlags = set of (btnIsEmbedded, btnIsDefault, btnIsPressed, + btnIsSelected, btnHasFocus, btnHasParentColor); + +const + AllAnchors = [anLeft, anRight, anTop, anBottom]; + + // Used for the internal message queue + cMessageQueueSize = 512; + + +type + TKeyPressNotifyEvent = procedure(Sender: TObject; var keycode: word; var shiftstate: word; + var consumed: boolean) of object; + TMouseNotifyEvent = procedure(Sender: TObject; x, y: TfpgCoord; var button: word; + var shiftstate: word) of object; + +type + TSizeParams = record + min_width: TfpgCoord; + max_width: TfpgCoord; + min_height: TfpgCoord; + max_height: TfpgCoord; + end; + + + TfpgFontResource = class(TfpgFontResourceImpl) + protected + FFontDesc: string; + FRefCount: integer; + public + constructor Create(const afontdesc: string); + function IncRefCount: integer; + function DecRefCount: integer; + property FontDesc: string read FFontDesc; + end; + + + TfpgFont = class(TfpgFontBase) + private + FFontDesc: string; + FFontRes: TfpgFontResource; + public + constructor Create(afontres: TfpgFontResource; const afontdesc: string); + destructor Destroy; override; + function TextWidth(const txt: string): integer; + function Ascent: integer; + function Descent: integer; + function Height: integer; + property FontDesc: string read FFontDesc; + property FontRes: TfpgFontResource read FFontRes; + property Handle: TfpgFontResource read FFontRes; + end; + + + // forward declaration + TfpgCanvas = class; + + + TfpgWindow = class(TfpgWindowImpl) + protected + FParentWindow: TfpgWindow; + FCanvas: TfpgCanvas; + procedure AllocateWindowHandle; + procedure ReleaseWindowHandle; + public + constructor Create(aowner: TComponent); override; + destructor Destroy; override; + procedure UpdateWindowPosition; + function Right: TfpgCoord; + function Bottom: TfpgCoord; + property ParentWindow: TfpgWindow read FParentWindow write FParentWindow; + property Canvas: TfpgCanvas read FCanvas; + property WinHandle; // surface this property from TfpgXXXImpl class + end; + + + TfpgImage = class(TfpgImageImpl) + protected + FWidth: integer; + FHeight: integer; + FColorDepth: integer; + FMasked: boolean; + FImageData: pointer; + FImageDataSize: integer; + FMaskData: pointer; + FMaskDataSize: integer; + public + constructor Create; + destructor Destroy; override; + procedure FreeImage; + procedure AllocateImage(acolordepth, awidth, aheight: integer); + procedure AllocateMask; + procedure Invert; + procedure UpdateImage; + procedure CreateMaskFromSample(x, y: integer); + property ImageData: pointer read FImageData; + property ImageDataSize: integer read FImageDataSize; + property MaskData: pointer read FMaskData; + property MaskDataSize: integer read FMaskDataSize; + property Width: integer read FWidth; + property Height: integer read FHeight; + property ColorDepth: integer read FColorDepth; + property Masked: boolean read FMasked; + end; + + + TfpgImages = class + private + FImages: TStringList; + public + constructor Create; + destructor Destroy; override; + function AddImage(const imgid: string; img: TfpgImage): boolean; + function DeleteImage(const imgid: string; freeimg: boolean): boolean; + function GetImage(const imgid: string): TfpgImage; + function AddBMP(const imgid: string; bmpdata: pointer; bmpsize: integer): TfpgImage; + function AddMaskedBMP(const imgid: string; bmpdata: pointer; bmpsize: integer; mcx, mcy: integer): TfpgImage; + procedure ListImages(var sl: TStringList); + end; + + + TfpgCanvas = class(TfpgCanvasImpl) + private + FColorText: TfpgColor; + protected + FBufferedDraw: boolean; + FPersistentResources: boolean; + FWindow: TfpgWindow; + FColor: TfpgColor; + FTextColor: TfpgColor; + FFont: TfpgFont; + FLineWidth: integer; + FLineStyle: TfpgLineStyle; + FBeginDrawCount: integer; + public + constructor Create(awin: TfpgWindow); reintroduce; + destructor Destroy; override; + procedure BeginDraw; overload; + procedure BeginDraw(abuffered: boolean); overload; + procedure EndDraw(x, y, w, h: TfpgCoord); overload; + procedure EndDraw; overload; + procedure FreeResources; + procedure SetFont(fnt: TfpgFont); + procedure SetColor(cl: TfpgColor); + procedure SetTextColor(cl: TfpgColor); + procedure SetLineStyle(awidth: integer; astyle: TfpgLineStyle); + procedure DrawString(x, y: TfpgCoord; const txt: string); + procedure Clear(col: TfpgColor); + procedure GetWinRect(var r: TfpgRect); + procedure FillRectangle(x, y, w, h: TfpgCoord); overload; + procedure FillRectangle(r: TfpgRect); overload; + procedure XORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); + procedure XORFillRect(col: TfpgColor; r: TfpgRect); + procedure FillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); + procedure DrawRectangle(x, y, w, h: TfpgCoord); + procedure DrawRect(r: TfpgRect); + procedure DrawLine(x1, y1, x2, y2: TfpgCoord); + procedure SetClipRect(const rect: TfpgRect); + function GetClipRect: TfpgRect; + procedure AddClipRect(const rect: TfpgRect); + procedure ClearClipRect; + procedure DrawImage(x, y: TfpgCoord; img: TfpgImage); + procedure DrawImagePart(x, y: TfpgCoord; img: TfpgImage; xi, yi, w, h: integer); + procedure DrawButtonFace(x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); + procedure DrawControlFrame(x, y, w, h: TfpgCoord); + procedure DrawDirectionArrow(x, y, w, h: TfpgCoord; direction: integer); + property Font: TfpgFont read FFont write SetFont; + property Color: TfpgColor read FColor; + property TextColor: TfpgColor read FColorText; + end; + + { This is very basic for now, just to remind us of theming support. Later we + will rework this to use a Style Manager like the previous fpGUI. Styles must + also move out of fpGFX. Also support Bitmap based styles for easier theme + implementations. } + TfpgStyle = class + public + DefaultFont: TfpgFont; + MenuFont: TfpgFont; + MenuAccelFont: TfpgFont; + MenuDisabledFont: TfpgFont; + public + constructor Create; virtual; + procedure DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); virtual; + procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); virtual; + procedure DrawDirectionArrow(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; direction: integer); virtual; + end; + + + TfpgApplication = class(TfpgApplicationImpl) + protected + FDisplayParams: string; + FScreenWidth: integer; + FScreenHeight: integer; + FDefaultFont: TfpgFont; + FFontResList: TList; + procedure FreeFontRes(afontres: TfpgFontResource); + procedure InternalInit; + procedure RunMessageLoop; + procedure WaitWindowMessage(atimeoutms: integer); + public + constructor Create(const aparams: string = ''); override; + destructor Destroy; override; + function GetFont(const afontdesc: string): TfpgFont; + procedure Initialize; + procedure Run; + procedure Flush; + procedure ProcessMessages; + property ScreenWidth: integer read FScreenWidth; + property ScreenHeight: integer read FScreenHeight; + property DefaultFont: TfpgFont read FDefaultFont; + end; + + + TfpgTimer = class + private + FEnabled: boolean; + FNextAlarm: TDateTime; + FInterval: integer; + procedure SetEnabled(const AValue: boolean); + public + OnTimer: TNotifyEvent; + constructor Create(ainterval: integer); + destructor Destroy; override; + procedure CheckAlarm(ctime: TDateTime); + property Enabled: boolean read FEnabled write SetEnabled; + property NextAlarm: TDateTime read FNextAlarm; + property Interval: integer read FInterval write FInterval; + end; + + + { Caret (text cursor). Inverts painting over text and has blinking + support. } + TfpgCaret = class + private + FEnabled: boolean; + FVisible: boolean; + FInterval: integer; + FCanvas: TfpgCanvas; + FTop: TfpgCoord; + FLeft: TfpgCoord; + FWidth: TfpgCoord; + FHeight: TfpgCoord; + FTimer: TfpgTimer; + procedure OnTimerTime(Sender: TObject); + public + constructor Create; + destructor Destroy; override; + procedure SetCaret(acanvas: TfpgCanvas; x, y, w, h: TfpgCoord); + procedure UnSetCaret(acanvas: TfpgCanvas); + procedure InvertCaret; + end; + +var + fpgStyle: TfpgStyle; // move this into fpgApplication + fpgCaret: TfpgCaret; // move this into fpgApplication + fpgImages: TfpgImages; // move this into fpgApplication + +// Application singleton +function fpgApplication: TfpgApplication; + +// Fonts (easy access function) +function fpgGetFont(const afontdesc: string): TfpgFont; + +// Message Queue (easy access function) +procedure fpgWaitWindowMessage; +procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; +procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer); overload; +procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; +procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer); overload; +procedure fpgDeliverMessage(var msg: TfpgMessageRec); +procedure fpgDeliverMessages; +function fpgGetFirstMessage: PfpgMessageRec; +procedure fpgDeleteFirstMessage; + +// Color routines +function fpgColorToRGB(col: TfpgColor): TfpgColor; +function fpgGetNamedColor(col: TfpgColor): TfpgColor; +procedure fpgSetNamedColor(colorid, rgbvalue: longword); +function fpgGetNamedFontDesc(afontid: string): string; +procedure fpgSetNamedFont(afontid, afontdesc: string); + +// Timers rountines +procedure fpgInitTimers; +procedure fpgCheckTimers; +function fpgClosestTimer(ctime: TDateTime; amaxtime: integer): integer; + + +implementation + +uses + gfx_imgfmt_bmp, + gfx_stdimages; + +var + fpgTimers: TList; + fpgNamedColors: array[0..255] of TfpgColor; + fpgNamedFonts: TList; + uApplication: TfpgApplication; + +const + ONE_MILISEC = 1 / (24 * 60 * 60 * 1000); + +type + TNamedFontItem = class + public + FontID: string; + FontDesc: string; + constructor Create(AFontID, AFontDesc: string); + end; + +constructor TNamedFontItem.Create(AFontID, AFontDesc: string); +begin + FontID := AFontID; + FontDesc := AFontDesc; +end; + +{$include gfx_msgqueue.inc} + +// Timer support + +procedure fpgInitTimers; +begin + if fpgTimers = nil then + fpgTimers := TList.Create; +end; + +procedure fpgCheckTimers; +var + n: integer; + ctime: TDateTime; +begin + ctime := now; + for n := 1 to fpgTimers.Count do + TfpgTimer(fpgTimers[n - 1]).CheckAlarm(ctime); +end; + +function fpgClosestTimer(ctime: TDateTime; amaxtime: integer): integer; +var + n: integer; + t: TfpgTimer; + dt: TDateTime; +begin + dt := ctime + amaxtime * ONE_MILISEC; + + for n := 1 to fpgTimers.Count do + begin + t := TfpgTimer(fpgTimers[n - 1]); + if t.Enabled and (t.NextAlarm < dt) then + dt := t.NextAlarm; + end; + + Result := trunc(0.5 + (dt - ctime) / ONE_MILISEC); + if Result < 0 then + Result := 0; +end; + +procedure TfpgTimer.SetEnabled(const AValue: boolean); +begin + if not FEnabled and AValue then + FNextAlarm := now + interval * ONE_MILISEC; + FEnabled := AValue; +end; + +constructor TfpgTimer.Create(ainterval: integer); +begin + FInterval := ainterval; + OnTimer := nil; + FEnabled := False; + fpgTimers.Add(self); +end; + +destructor TfpgTimer.Destroy; +var + i: integer; +begin + i := fpgTimers.IndexOf(self); + if i >= 0 then + fpgTimers.Delete(i); + inherited Destroy; +end; + +procedure TfpgTimer.CheckAlarm(ctime: TDateTime); +begin + if not FEnabled then + Exit; + + if FNextAlarm <= ctime then + begin + // set the next alarm point + if interval > 0 then + while FNextAlarm <= ctime do + FNextAlarm := FNextAlarm + interval * ONE_MILISEC; + + if Assigned(OnTimer) then + OnTimer(self); + end; +end; + +function fpgApplication: TfpgApplication; +begin + if not Assigned(uApplication) then + uApplication := TfpgApplication.Create; + result := uApplication; +end; + +function fpgColorToRGB(col: TfpgColor): TfpgColor; +begin + if (col and $80000000) <> 0 then + Result := fpgNamedColors[col and $FF] or (col and $7F000000)// named color keeping alpha + else + Result := col; +end; + +function fpgGetNamedColor(col: TfpgColor): TfpgColor; +begin + Result := fpgNamedColors[col and $FF]; +end; + +procedure fpgSetNamedColor(colorid, rgbvalue: longword); +var + i: longword; +begin + if (colorid and $80000000) = 0 then + Exit; + i := colorid and $FF; + fpgNamedColors[i] := rgbvalue; +end; + +function fpgGetNamedFontDesc(afontid: string): string; +var + n: integer; +begin + for n := 0 to fpgNamedFonts.Count - 1 do + if (lowercase(TNamedFontItem(fpgNamedFonts[n]).FontID) = lowercase(afontid)) then + begin // found + Result := TNamedFontItem(fpgNamedFonts[n]).FontDesc; + Exit; //==> + end; + + Writeln('GetNamedFontDesc error: "' + afontid + '" is missing. Default is used.'); + Result := FPG_DEFAULT_FONT_DESC; +end; + +procedure fpgSetNamedFont(afontid, afontdesc: string); +var + n: integer; +begin + n := 0; + while (n < fpgNamedFonts.Count) and (lowercase(TNamedFontItem(fpgNamedFonts[n]).FontID) <> lowercase(afontid)) do + Inc(n); + + if n < fpgNamedFonts.Count then + TNamedFontItem(fpgNamedFonts[n]).FontDesc := afontdesc// already defined + + else + fpgNamedFonts.Add(TNamedFontItem.Create(afontid, afontdesc)); +end; + +procedure fpgWaitWindowMessage; +begin + fpgApplication.WaitWindowMessage(0); +end; + +function fpgGetFont(const afontdesc: string): TfpgFont; +begin + Result := fpgApplication.GetFont(afontdesc); +end; + +constructor TfpgApplication.Create(const aparams: string); +begin + FFontResList := TList.Create; + FDisplayParams := aparams; + FScreenWidth := -1; + FScreenHeight := -1; + + inherited Create(aparams); + + if IsInitialized then + begin + FScreenWidth := GetScreenWidth; + FScreenHeight := GetScreenHeight; + end; + + FDefaultFont := GetFont(FPG_DEFAULT_FONT_DESC); +end; + +destructor TfpgApplication.Destroy; +var + i: integer; +begin + for i := 0 to (fpgNamedFonts.Count - 1) do + TNamedFontItem(fpgNamedFonts.Items[i]).Free; + fpgNamedFonts.Free; + + fpgImages.Free; + + FFontResList.Free; + inherited Destroy; +end; + +function TfpgApplication.GetFont(const afontdesc: string): TfpgFont; +var + fr: TfpgFontResource; + n: integer; + fdesc: string; +begin + fdesc := afontdesc; + + if copy(fdesc, 1, 1) = '#' then + fdesc := fpgGetNamedFontDesc(copy(afontdesc, 2, length(afontdesc))); + + Result := nil; + + for n := 0 to FFontResList.Count - 1 do + if TfpgFontResource(FFontResList[n]).FontDesc = fdesc then + begin + fr := TfpgFontResource(FFontResList[n]); + Inc(fr.FRefCount); + Result := TfpgFont.Create(fr, afontdesc); + Exit; //==> + end; + + fr := TfpgFontResource.Create(fdesc); + + if fr.HandleIsValid then + begin + FFontResList.Add(fr); + Result := TfpgFont.Create(fr, afontdesc); + end + else + begin + fr.Free; + writeln('error opening font.'); + end; +end; + +procedure TfpgApplication.Initialize; +begin + {$Note remember to process parameter!! } + if IsInitialized then + InternalInit + else + raise Exception.Create('Failed in initialize the Application object!'); +end; + +procedure TfpgApplication.Run; +begin + RunMessageLoop; +end; + +procedure TfpgApplication.FreeFontRes(afontres: TfpgFontResource); +var + n: integer; +begin + for n := 0 to FFontResList.Count - 1 do + if FFontResList[n] = Pointer(afontres) then + begin + TfpgFontResource(FFontResList[n]).Free; + FFontResList.Delete(n); + Exit; + end; +end; + +procedure TfpgApplication.InternalInit; +begin + fpgInitTimers; + fpgNamedFonts := TList.Create; + fpgStyle := TfpgStyle.Create; + fpgCaret := TfpgCaret.Create; + fpgImages := TfpgImages.Create; + fpgCreateStandardImages; +end; + +procedure TfpgApplication.Flush; +begin + DoFlush; +end; + +procedure TfpgApplication.ProcessMessages; +begin + Flush; + while DoMessagesPending do + begin + WaitWindowMessage(0); + Flush; + end; +end; + +procedure TfpgApplication.WaitWindowMessage(atimeoutms: integer); +begin + DoWaitWindowMessage(fpgClosestTimer(now, atimeoutms)); + fpgDeliverMessages; + fpgCheckTimers; +end; + +procedure TfpgApplication.RunMessageLoop; +begin + repeat + WaitWindowMessage(1000); + until False; +end; + +{ TfpgFont } + +constructor TfpgFont.Create(afontres: TfpgFontResource; const afontdesc: string); +begin + FFontRes := afontres; + FFontDesc := afontdesc; + afontres.IncRefCount; +end; + +destructor TfpgFont.Destroy; +begin + if TfpgFontResource(FFontRes).DecRefCount <= 0 then + fpgApplication.FreeFontRes(TfpgFontResource(FFontRes)); + + inherited; +end; + +function TfpgFont.TextWidth(const txt: string): integer; +begin + Result := FFontRes.GetTextWidth(txt); +end; + +function TfpgFont.Ascent: integer; +begin + Result := FFontRes.GetAscent; +end; + +function TfpgFont.Descent: integer; +begin + Result := FFontRes.GetDescent; +end; + +function TfpgFont.Height: integer; +begin + Result := FFontRes.GetHeight; +end; + +{ TfpgFontResource } + +constructor TfpgFontResource.Create(const afontdesc: string); +begin + inherited; + FRefCount := 0; +end; + +function TfpgFontResource.DecRefCount: integer; +begin + Dec(FRefCount); + Result := FRefCount; +end; + +function TfpgFontResource.IncRefCount: integer; +begin + Inc(FRefCount); + Result := FRefCount; +end; + +{ TfpgCanvas } + +constructor TfpgCanvas.Create(awin: TfpgWindow); +begin + inherited Create; + + FBeginDrawCount := 0; + FWindow := awin; + + // options + FBufferedDraw := True; // transparent widgets must turn this off + FPersistentResources := False; +end; + +destructor TfpgCanvas.Destroy; +begin + if fpgCaret.FCanvas = self then + fpgCaret.UnSetCaret(self); + inherited Destroy; +end; + +procedure TfpgCanvas.BeginDraw; +begin + BeginDraw(FBufferedDraw); +end; + +procedure TfpgCanvas.BeginDraw(abuffered: boolean); +begin + if FBeginDrawCount < 1 then + begin + DoBeginDraw(FWindow, abuffered); + + SetColor(clText1); + SetTextColor(clText1); + SetFont(fpgApplication.DefaultFont); + + SetLineStyle(0, lsSolid); + + FBeginDrawCount := 0; + end; + Inc(FBeginDrawCount); +end; + +procedure TfpgCanvas.EndDraw(x, y, w, h: TfpgCoord); +begin + if FBeginDrawCount > 0 then + begin + Dec(FBeginDrawCount); + if FBeginDrawCount = 0 then + begin + DoPutBufferToScreen(x, y, w, h); + + if not FPersistentResources then + DoEndDraw; // !!! + end; + end; +end; + +procedure TfpgCanvas.EndDraw; +begin + EndDraw(0, 0, FWindow.Width, FWindow.Height); +end; + +procedure TfpgCanvas.FreeResources; +begin + DoEndDraw; + FBeginDrawCount := 0; +end; + +procedure TfpgCanvas.SetFont(fnt: TfpgFont); +begin + FFont := fnt; + DoSetFontRes(fnt.FFontRes); +end; + +procedure TfpgCanvas.SetTextColor(cl: TfpgColor); +begin + FTextColor := cl; + DoSetTextColor(FTextColor); +end; + +procedure TfpgCanvas.SetColor(cl: TfpgColor); +begin + FColor := cl; + DoSetColor(FColor); +end; + +procedure TfpgCanvas.SetLineStyle(awidth: integer; astyle: TfpgLineStyle); +begin + FLineWidth := awidth; + FLineStyle := astyle; + DoSetLineStyle(FLineWidth, FLineStyle); +end; + +procedure TfpgCanvas.DrawString(x, y: TfpgCoord; const txt: string); +begin + DoDrawString(x, y, txt); +end; + +procedure TfpgCanvas.Clear(col: TfpgColor); +var + ACol: TfpgColor; + AWinRect: TfpgRect; +begin + ACol := FColor; + DoSetColor(col); + DoGetWinRect(AWinRect); + DoFillRectangle(0, 0, AWinRect.Width, AWinRect.Height); + DoSetColor(ACol); +end; + +procedure TfpgCanvas.GetWinRect(var r: TfpgRect); +begin + DoGetWinRect(r); +end; + +procedure TfpgCanvas.FillRectangle(x, y, w, h: TfpgCoord); +begin + DoFillRectangle(x, y, w, h); +end; + +procedure TfpgCanvas.XORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); +begin + DoXORFillRectangle(col, x, y, w, h); +end; + +procedure TfpgCanvas.XORFillRect(col: TfpgColor; r: TfpgRect); +begin + DoXORFillRectangle(col, r.Left, r.Top, r.Width, r.Height); +end; + +procedure TfpgCanvas.FillRectangle(r: TfpgRect); +begin + DoFillRectangle(r.Left, r.Top, r.Width, r.Height); +end; + +procedure TfpgCanvas.FillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); +begin + DoFillTriangle(x1, y1, x2, y2, x3, y3); +end; + +procedure TfpgCanvas.DrawRectangle(x, y, w, h: TfpgCoord); +begin + DoDrawRectangle(x, y, w, h); +end; + +procedure TfpgCanvas.DrawRect(r: TfpgRect); +begin + DoDrawRectangle(r.Left, r.Top, r.Width, r.Height); +end; + +procedure TfpgCanvas.DrawLine(x1, y1, x2, y2: TfpgCoord); +begin + DoDrawLine(x1, y1, x2, y2); +end; + +procedure TfpgCanvas.SetClipRect(const rect: TfpgRect); +begin + DoSetClipRect(rect); +end; + +function TfpgCanvas.GetClipRect: TfpgRect; +begin + Result := DoGetClipRect; +end; + +procedure TfpgCanvas.AddClipRect(const rect: TfpgRect); +begin + DoAddClipRect(rect); +end; + +procedure TfpgCanvas.ClearClipRect; +begin + DoClearClipRect; +end; + +procedure TfpgCanvas.DrawImage(x, y: TfpgCoord; img: TfpgImage); +begin + if img = nil then + exit; + DrawImagePart(x, y, img, 0, 0, img.Width, img.Height); +end; + +procedure TfpgCanvas.DrawImagePart(x, y: TfpgCoord; img: TfpgImage; xi, yi, w, h: integer); +begin + DoDrawImagePart(x, y, img, xi, yi, w, h); +end; + +procedure TfpgCanvas.DrawButtonFace(x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); +begin + fpgStyle.DrawButtonFace(self, x, y, w, h, AFlags); +end; + +procedure TfpgCanvas.DrawControlFrame(x, y, w, h: TfpgCoord); +begin + fpgStyle.DrawControlFrame(self, x, y, w, h); +end; + +procedure TfpgCanvas.DrawDirectionArrow(x, y, w, h: TfpgCoord; direction: integer); +begin + fpgStyle.DrawDirectionArrow(self, x, y, w, h, direction); +end; + +{ TfpgWindow } + +constructor TfpgWindow.Create(aowner: TComponent); +begin + inherited Create(aowner); // initialize the platform internals + + FTop := 0; + FLeft := 0; + FWidth := 16; + FHeight := 16; + + FMinWidth := 2; + FMinHeight := 2; + + FModalForWin := nil; + + if (aowner <> nil) and (aowner is TfpgWindow) then + begin + FParentWindow := TfpgWindow(aowner); + FWindowType := wtChild; + end + else + begin + FParentWindow := nil; + FWindowType := wtWindow; + end; + + FCanvas := TfpgCanvas.Create(self); +end; + +destructor TfpgWindow.Destroy; +begin + FCanvas.Free; + inherited Destroy; +end; + +procedure TfpgWindow.AllocateWindowHandle; +begin + DoAllocateWindowHandle(FParentWindow); +end; + +procedure TfpgWindow.ReleaseWindowHandle; +begin + if HasHandle then + begin + Canvas.FreeResources; + DoReleaseWindowHandle; + end; +end; + +function TfpgWindow.Right: TfpgCoord; +begin + Result := FLeft + FWidth - 1; +end; + +function TfpgWindow.Bottom: TfpgCoord; +begin + Result := FTop + FHeight - 1; +end; + +procedure TfpgWindow.UpdateWindowPosition; +begin + if HasHandle then + DoUpdateWindowPosition(FLeft, FTop, FWidth, FHeight); +end; + +{ TfpgImage } + +procedure TfpgImage.AllocateImage(acolordepth, awidth, aheight: integer); +var + dww: integer; +begin + FreeImage; + FWidth := awidth; + FHeight := aheight; + FColorDepth := acolordepth; + + // Real bitmap + if FColorDepth = 1 then + dww := (awidth + 31) div 32 + else + dww := FWidth; + + FImageDataSize := dww * FHeight * 4; + GetMem(FImageData, FImageDataSize); +end; + +procedure TfpgImage.AllocateMask; +var + dww: integer; +begin + if (FWidth < 1) or (FHeight < 1) then + Exit; + + FMasked := True; + if FMaskData <> nil then + FreeMem(FMaskData); + + dww := (FWidth + 31) div 32; + FMaskDataSize := dww * FHeight * 4; + GetMem(FMaskData, FMaskDataSize); +end; + +constructor TfpgImage.Create; +begin + inherited; + FWidth := 0; + FHeight := 0; + FColorDepth := 0; + + FImageData := nil; + FImageDataSize := 0; + FMaskData := nil; + FMaskDataSize := 0; + FMasked := False; +end; + +procedure TfpgImage.CreateMaskFromSample(x, y: integer); +var + p: ^longword; + pmsk: ^byte; + c: longword; + linecnt: integer; + pixelcnt: integer; + bit: byte; + msklinelen: integer; +begin + if FColorDepth = 1 then + Exit; + + if (FImageData = nil) then + Exit; + + AllocateMask; + + p := FImageData; + if x < 0 then + Inc(p, FWidth - 1) + else + Inc(p, x); + if y < 0 then + Inc(p, FWidth * (FHeight - 1)) + else + Inc(p, FWidth * y); + + c := p^; // the sample + + msklinelen := FWidth div 32; + if (FWidth and $1F) > 0 then + Inc(msklinelen); + + msklinelen := msklinelen shl 2; + + p := FImageData; + linecnt := 0; + + repeat + pixelcnt := 0; + bit := $80; + pmsk := FMaskData; + Inc(pmsk, linecnt * msklinelen); + + repeat + if bit = $80 then + pmsk^ := 0; + + if p^ <> c then + pmsk^ := pmsk^ or bit; + + Inc(p); + Inc(pixelcnt); + + if bit = 1 then + begin + bit := $80; + Inc(pmsk); + end + else + bit := bit shr 1; + until pixelcnt >= FWidth; + + Inc(linecnt); + until linecnt >= FHeight; +end; + +destructor TfpgImage.Destroy; +begin + FreeImage; + inherited; +end; + +procedure TfpgImage.FreeImage; +begin + if FImageData <> nil then + FreeMem(FImageData); + FImageData := nil; + FImageDataSize := 0; + if FMaskData <> nil then + FreeMem(FMaskData); + FMaskData := nil; + FMaskDataSize := 0; + FMasked := False; + FWidth := 0; + FHeight := 0; +end; + +procedure TfpgImage.Invert; +var + p: ^byte; + n: integer; +begin + if FImageData = nil then + Exit; + + p := FImageData; + for n := 1 to FImageDataSize do + begin + p^ := p^ xor $FF; + Inc(p); + end; + + if FMaskData <> nil then + begin + p := FMaskData; + for n := 1 to FMaskDataSize do + begin + p^ := p^ xor $FF; + Inc(p); + end; + end; +end; + +procedure TfpgImage.UpdateImage; +begin + if FImageData <> nil then + DoInitImage(FColorDepth, FWidth, FHeight, FImageData); + + if FMaskData <> nil then + DoInitImageMask(FWidth, FHeight, FMaskData); +end; + +{ TfpgStyle } + +constructor TfpgStyle.Create; +begin + // Setup font aliases + fpgSetNamedFont('Label1', 'Arial-10'); + fpgSetNamedFont('Label2', 'Arial-10:bold'); + fpgSetNamedFont('Edit1', 'Arial-10'); + fpgSetNamedFont('Edit2', 'Courier New-10'); + fpgSetNamedFont('List', 'Arial-10'); + fpgSetNamedFont('Grid', 'Arial-9:antialias=false'); + fpgSetNamedFont('GridHeader', 'Arial-9:bold:antialias=false'); + fpgSetNamedFont('Menu', 'Arial-10'); + fpgSetNamedFont('MenuAccel', 'Arial-10:bold'); + fpgSetNamedFont('MenuDisabled', 'Arial-10:italic'); + + {$Note Refactor this so under Windows it can detect the system colors instead.} + fpgSetNamedColor(clWindowBackground, $D4D0C8); + fpgSetNamedColor(clBoxColor, $FFFFFF); + fpgSetNamedColor(clShadow1, $808080); + fpgSetNamedColor(clShadow2, $404040); + fpgSetNamedColor(clHilite1, $E0E0E0); + fpgSetNamedColor(clHilite2, $FFFFFF); + fpgSetNamedColor(clText1, $000000); + fpgSetNamedColor(clText2, $000040); + fpgSetNamedColor(clText3, $800000); + fpgSetNamedColor(clText4, $404000); + fpgSetNamedColor(clSelection, $000080); + fpgSetNamedColor(clSelectionText, $FFFFFF); + fpgSetNamedColor(clInactiveSel, $D0D0FF); + fpgSetNamedColor(clInactiveSelText, $000000); + fpgSetNamedColor(clScrollBar, $E8E4DB); + fpgSetNamedColor(clButtonFace, $D4D0C8); + fpgSetNamedColor(clListBox, $FFFFFF); + fpgSetNamedColor(clGridLines, $A0A0A0); + fpgSetNamedColor(clGridHeader, $E0E0E0); + fpgSetNamedColor(clWidgetFrame, $000000); + fpgSetNamedColor(clInactiveWgFrame, $A0A0A0); + fpgSetNamedColor(clTextCursor, $000000); + fpgSetNamedColor(clChoiceListBox, $E8E8E8); + fpgSetNamedColor(clUnset, $D0D0FF); + fpgSetNamedColor(clMenuText, $000000); + fpgSetNamedColor(clMenuDisabled, $909090); + + // Global Font Objects + DefaultFont := fpgGetFont(fpgGetNamedFontDesc('Label1')); + MenuFont := fpgGetFont(fpgGetNamedFontDesc('Menu')); + MenuAccelFont := fpgGetFont(fpgGetNamedFontDesc('MenuAccel')); + MenuDisabledFont := fpgGetFont(fpgGetNamedFontDesc('MenuDisabled')); +end; + +procedure TfpgStyle.DrawButtonFace(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; AFlags: TFButtonFlags); +begin + ACanvas.SetColor(clButtonFace); + ACanvas.FillRectangle(x, y, w, h); + + // Left and Top (outer) + if (btnIsPressed in AFlags) then + begin + if (btnIsEmbedded in AFlags) then + ACanvas.SetColor(clHilite1) + else + ACanvas.SetColor(clShadow2); + end + else + ACanvas.SetColor(clHilite1); + ACanvas.DrawLine(x, y + h - 2, x, y); // left + ACanvas.DrawLine(x, y, x + w - 1, y); // top + + // Left and Top (inner) + if btnIsPressed in AFlags then + begin + ACanvas.SetColor(clShadow1); + ACanvas.DrawLine(x + 1, y + h - 3, x + 1, y + 1); // left + ACanvas.DrawLine(x + 1, y + 1, x + w - 2, y + 1); // top + end; + + // Right and Bottom (outer) + if (btnIsPressed in AFlags) then + begin + if (btnIsEmbedded in AFlags) then + ACanvas.SetColor(clHilite1) + else + ACanvas.SetColor(clShadow2); + end + else + ACanvas.SetColor(clShadow2); + ACanvas.DrawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); // right + ACanvas.DrawLine(x, y + h - 1, x + w - 1, y + h - 1); // bottom + + // Right and Bottom (inner) + if btnIsPressed in AFlags then + ACanvas.SetColor(clHilite1) + else + ACanvas.SetColor(clShadow1); + ACanvas.DrawLine(x + w - 2, y + 2, x + w - 2, y + h - 2); // right + ACanvas.DrawLine(x + 1, y + h - 2, x + w - 2, y + h - 2); // bottom +end; + +procedure TfpgStyle.DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); +begin + ACanvas.SetColor(clShadow1); + ACanvas.DrawLine(x, y, x + w - 1, y); + ACanvas.DrawLine(x, y + h - 1, x, y); + + ACanvas.SetColor(clShadow2); + ACanvas.DrawLine(x + 1, y + 1, x + w - 2, y + 1); + ACanvas.DrawLine(x + 1, y + h - 2, x + 1, y + 1); + + ACanvas.SetColor(clHilite2); + ACanvas.DrawLine(x + 1, y + h - 1, x + w - 1, y + h - 1); + ACanvas.DrawLine(x + w - 1, y + 1, x + w - 1, y + h - 1); + + ACanvas.SetColor(clHilite1); + ACanvas.DrawLine(x + 2, y + h - 2, x + w - 2, y + h - 2); + ACanvas.DrawLine(x + w - 2, y + 2, x + w - 2, y + h - 2); +end; + +procedure TfpgStyle.DrawDirectionArrow(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; direction: integer); +var + peekx: TfpgCoord; + peeky: TfpgCoord; + basex: TfpgCoord; + basey: TfpgCoord; + side: TfpgCoord; + margin: TfpgCoord; +begin + ACanvas.SetColor(clText1); + side := (w div 4) + 1; + margin := side + 1; + + if direction < 2 then // vertical + begin + peekx := x + (w div 2); + if direction = 1 then // down + begin + peeky := y + h - margin; + basey := peeky - side; + end + else + begin // up + peeky := y + margin; + basey := peeky + side; + end; + ACanvas.FillTriangle(peekx, peeky, peekx + side, basey, peekx - side, basey); + end + else // horizontal + begin + peeky := y + (h div 2); + if direction = 3 then // right + begin + peekx := x + w - margin; + basex := peekx - side; + end + else // left + begin + peekx := x + margin; + basex := peekx + side; + end; + ACanvas.FillTriangle(peekx, peeky, basex, peeky - side, basex, peeky + side); + end; +end; + +{ TfpgCaret } + +procedure TfpgCaret.OnTimerTime(Sender: TObject); +begin + if FEnabled then + InvertCaret; +end; + +constructor TfpgCaret.Create; +begin + FEnabled := False; + FInterval := 500; // blinking interval + FCanvas := nil; + FTop := 0; + FLeft := 0; + FWidth := 1; + FHeight := 8; + FTimer := TfpgTimer.Create(FInterval); + FTimer.OnTimer := @OnTimerTime; + FTimer.Enabled := True; +end; + +destructor TfpgCaret.Destroy; +begin + FTimer.Free; + inherited Destroy; +end; + +procedure TfpgCaret.SetCaret(acanvas: TfpgCanvas; x, y, w, h: TfpgCoord); +begin + FEnabled := True; + FVisible := False; + FCanvas := acanvas; + FLeft := x; + FTop := y; + FWidth := w; + FHeight := h; + InvertCaret; + + FTimer.Enabled := False; + FTimer.Interval := FInterval; + FTimer.Enabled := True; +end; + +procedure TfpgCaret.UnSetCaret(acanvas: TfpgCanvas); +begin + if (FCanvas = acanvas) or (acanvas = nil) then + begin + FEnabled := False; + FCanvas := nil; + end; +end; + +procedure TfpgCaret.InvertCaret; +begin + if FCanvas = nil then + Exit; //==> + + // we could not be sure about the buffer contents! + FCanvas.BeginDraw(False); + try + // this works well on narrow characters like 'i' or 'l' in non-mono fonts + FCanvas.XORFillRectangle($FFFFFF, FLeft, FTop, FWidth, FHeight); + FVisible := not FVisible; + finally + FCanvas.EndDraw(FLeft, FTop, FWidth, FHeight); + end; +end; + +{ TfpgImages } + +constructor TfpgImages.Create; +begin + FImages := TStringList.Create; +end; + +destructor TfpgImages.Destroy; +var + n: integer; +begin + for n := 0 to FImages.Count - 1 do + FImages.Objects[n].Free; + FImages.Free; + inherited Destroy; +end; + +function TfpgImages.AddImage(const imgid: string; img: TfpgImage): boolean; +var + i: integer; +begin + i := FImages.IndexOf(LowerCase(imgid)); + if i >= 0 then + begin + FImages.Strings[i] := LowerCase(imgid); + FImages.Objects[i] := img; + Result := False; + end + else + begin + FImages.AddObject(LowerCase(imgid), img); + Result := True; + end; +end; + +function TfpgImages.DeleteImage(const imgid: string; freeimg: boolean): boolean; +var + i: integer; + img: TfpgImage; +begin + i := FImages.IndexOf(LowerCase(imgid)); + if i >= 0 then + begin + if freeimg then + TfpgImage(FImages.Objects[i]).Free; + FImages.Delete(i); + Result := True; + end + else + Result := False; +end; + +function TfpgImages.GetImage(const imgid: string): TfpgImage; +var + i: integer; +begin + i := FImages.IndexOf(LowerCase(imgid)); + if i >= 0 then + Result := TfpgImage(FImages.Objects[i]) + else + Result := nil; +end; + +function TfpgImages.AddBMP(const imgid: string; bmpdata: pointer; bmpsize: integer): TfpgImage; +begin + Result := CreateImage_BMP(bmpdata, bmpsize); + if Result <> nil then + AddImage(imgid, Result); +end; + +function TfpgImages.AddMaskedBMP(const imgid: string; bmpdata: pointer; bmpsize: integer; + mcx, mcy: integer): TfpgImage; +begin + Result := AddBMP(imgid, bmpdata, bmpsize); + if Result <> nil then + begin + Result.CreateMaskFromSample(mcx, mcy); + Result.UpdateImage; + end; +end; + +procedure TfpgImages.ListImages(var sl: TStringList); +begin + if sl <> nil then + sl.Assign(FImages); +end; + + +initialization + uApplication := nil; + fpgTimers := nil; + fpgCaret := nil; + fpgImages := nil; + fpgInitMsgQueue; + +finalization; + fpgCaret.Free; + uApplication.free; + +end. + diff --git a/prototypes/fpgui2/source/core/gdi/fpGFX2.lpk b/prototypes/fpgui2/source/core/gdi/fpGFX2.lpk new file mode 100644 index 00000000..722c4707 --- /dev/null +++ b/prototypes/fpgui2/source/core/gdi/fpGFX2.lpk @@ -0,0 +1,108 @@ +<?xml version="1.0"?>
+<CONFIG>
+ <Package Version="2">
+ <PathDelim Value="\"/>
+ <Name Value="fpGFX2"/>
+ <Author Value="Graeme Geldenhuys"/>
+ <CompilerOptions>
+ <Version Value="5"/>
+ <PathDelim Value="\"/>
+ <SearchPaths>
+ <IncludeFiles Value="..\..\"/>
+ <OtherUnitFiles Value="..\;..\..\gui\"/>
+ <UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
+ </SearchPaths>
+ <CodeGeneration>
+ <Generate Value="Faster"/>
+ </CodeGeneration>
+ <Other>
+ <CompilerPath Value="$(CompPath)"/>
+ </Other>
+ </CompilerOptions>
+ <Description Value="fpGFX redesign with multiple handles per window
+"/>
+ <License Value="Modified LGPL
+"/>
+ <Version Minor="1"/>
+ <Files Count="16">
+ <Item1>
+ <Filename Value="..\gfxbase.pas"/>
+ <UnitName Value="gfxbase"/>
+ </Item1>
+ <Item2>
+ <Filename Value="..\gfxbaseinterfaces.pas"/>
+ <UnitName Value="gfxbaseinterfaces"/>
+ </Item2>
+ <Item3>
+ <Filename Value="..\fpgfx.pas"/>
+ <UnitName Value="fpgfx"/>
+ </Item3>
+ <Item4>
+ <Filename Value="..\gfx_stdimages.pas"/>
+ <UnitName Value="gfx_stdimages"/>
+ </Item4>
+ <Item5>
+ <Filename Value="..\gfx_imgfmt_bmp.pas"/>
+ <UnitName Value="gfx_imgfmt_bmp"/>
+ </Item5>
+ <Item6>
+ <Filename Value="..\gfx_widget.pas"/>
+ <UnitName Value="gfx_widget"/>
+ </Item6>
+ <Item7>
+ <Filename Value="..\..\gui\gui_form.pas"/>
+ <UnitName Value="gui_form"/>
+ </Item7>
+ <Item8>
+ <Filename Value="..\..\gui\gui_label.pas"/>
+ <UnitName Value="gui_label"/>
+ </Item8>
+ <Item9>
+ <Filename Value="..\..\gui\gui_button.pas"/>
+ <UnitName Value="gui_button"/>
+ </Item9>
+ <Item10>
+ <Filename Value="..\..\gui\gui_edit.pas"/>
+ <UnitName Value="gui_edit"/>
+ </Item10>
+ <Item11>
+ <Filename Value="..\..\gui\gui_combobox.pas"/>
+ <UnitName Value="gui_combobox"/>
+ </Item11>
+ <Item12>
+ <Filename Value="..\..\gui\gui_popupwindow.pas"/>
+ <UnitName Value="gui_popupwindow"/>
+ </Item12>
+ <Item13>
+ <Filename Value="gfx_gdi.pas"/>
+ <UnitName Value="gfx_gdi"/>
+ </Item13>
+ <Item14>
+ <Filename Value="..\..\gui\gui_scrollbar.pas"/>
+ <UnitName Value="gui_scrollbar"/>
+ </Item14>
+ <Item15>
+ <Filename Value="..\..\gui\gui_memo.pas"/>
+ <UnitName Value="gui_memo"/>
+ </Item15>
+ <Item16>
+ <Filename Value="..\gfx_utf8utils.pas"/>
+ <UnitName Value="gfx_UTF8utils"/>
+ </Item16>
+ </Files>
+ <RequiredPkgs Count="1">
+ <Item1>
+ <PackageName Value="FCL"/>
+ <MinVersion Major="1" Valid="True"/>
+ </Item1>
+ </RequiredPkgs>
+ <UsageOptions>
+ <UnitPath Value="$(PkgOutDir)\"/>
+ </UsageOptions>
+ <PublishOptions>
+ <Version Value="2"/>
+ <DestinationDirectory Value="$(TestDir)\publishedpackage\"/>
+ <IgnoreBinaries Value="False"/>
+ </PublishOptions>
+ </Package>
+</CONFIG>
diff --git a/prototypes/fpgui2/source/core/gdi/fpGFX2.pas b/prototypes/fpgui2/source/core/gdi/fpGFX2.pas new file mode 100644 index 00000000..17a05954 --- /dev/null +++ b/prototypes/fpgui2/source/core/gdi/fpGFX2.pas @@ -0,0 +1,16 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpGFX2; + +interface + +uses + gfxbase, gfxbaseinterfaces, fpgfx, gfx_stdimages, gfx_imgfmt_bmp, gfx_widget, + gui_form, gui_label, gui_button, gui_edit, gui_combobox, gui_popupwindow, + gfx_gdi, gui_scrollbar, gui_memo, gfx_UTF8utils; + +implementation + +end. diff --git a/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas new file mode 100644 index 00000000..f84a331a --- /dev/null +++ b/prototypes/fpgui2/source/core/gdi/gfx_gdi.pas @@ -0,0 +1,1413 @@ +unit gfx_gdi; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + Windows, + gfxbase; + +{ Constants missing on windows unit } +const + WM_MOUSEWHEEL = $020a; + VER_PLATFORM_WIN32_CE = 3; + +{ Unicode selection variables } +var + UnicodeEnabledOS: Boolean; + WinVersion: TOSVersionInfo; + + +type + TfpgWinHandle = HWND; + TfpgGContext = HDC; + +type + TfpgWindowImpl = class; + + + TfpgFontResourceImpl = class(TfpgFontResourceBase) + private + FFontData: HFONT; + FMetrics: Windows.TEXTMETRIC; + protected + function OpenFontByDesc(const desc: string): HFONT; + property Handle: HFONT read FFontData; + public + constructor Create(const afontdesc: string); + destructor Destroy; override; + function HandleIsValid: boolean; + function GetAscent: integer; + function GetDescent: integer; + function GetHeight: integer; + function GetTextWidth(const txt: string): integer; + end; + + + TfpgFontImpl = class(TfpgFontBase) + end; + + + TfpgImageImpl = class(TfpgImageBase) + private + FBMPHandle: HBITMAP; + FMaskHandle: HBITMAP; + FIsTwoColor: boolean; + property BMPHandle: HBITMAP read FBMPHandle; + property MaskHandle: HBITMAP read FMaskHandle; + protected + procedure DoFreeImage; + procedure DoInitImage(acolordepth, awidth, aheight: integer; aimgdata: Pointer); + procedure DoInitImageMask(awidth, aheight: integer; aimgdata: Pointer); + public + constructor Create; + end; + + + TfpgCanvasImpl = class(TfpgCanvasBase) + private + FDrawing: boolean; + FBufferBitmap: HBitmap; + FDrawWindow: TfpgWindowImpl; + Fgc, FWinGC: TfpgGContext; + FColorText: TfpgColor; + FColor: TfpgColor; + FBackgroundColor: TfpgColor; + FCurFontRes: TfpgFontResourceImpl; + FClipRect: TfpgRect; + FClipRectSet: Boolean; + FLineStyle: integer; + FLineWidth: integer; + FWindowsColor: longword; + FBrush: HBRUSH; + FPen: HPEN; + FClipRegion: HRGN; + FIntLineStyle: integer; + FIntLineWidth: integer; + protected + procedure DoSetFontRes(fntres: TfpgFontResourceImpl); + procedure DoSetTextColor(cl: TfpgColor); + procedure DoSetColor(cl: TfpgColor); + procedure DoSetLineStyle(awidth: integer; astyle: TfpgLineStyle); + procedure DoDrawString(x, y: TfpgCoord; const txt: string); + procedure DoGetWinRect(var r: TfpgRect); + procedure DoFillRectangle(x, y, w, h: TfpgCoord); + procedure DoXORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); + procedure DoFillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); + procedure DoDrawRectangle(x, y, w, h: TfpgCoord); + procedure DoDrawLine(x1, y1, x2, y2: TfpgCoord); + procedure DoSetClipRect(const rect: TfpgRect); + function DoGetClipRect: TfpgRect; + procedure DoAddClipRect(const rect: TfpgRect); + procedure DoClearClipRect; + procedure DoDrawImagePart(x, y: TfpgCoord; img: TfpgImageImpl; xi, yi, w, h: integer); + procedure DoBeginDraw(awin: TfpgWindowImpl; buffered: boolean); + procedure DoPutBufferToScreen(x, y, w, h: TfpgCoord); + procedure DoEndDraw; + public + constructor Create; + destructor Destroy; override; + end; + + + TfpgWindowImpl = class(TfpgWindowBase) + protected + FWinHandle: TfpgWinHandle; + FModalForWin: TfpgWindowImpl; + FWinStyle: longword; + FWinStyleEx: longword; + FParentWinHandle: TfpgWinHandle; + procedure DoAllocateWindowHandle(aparent: TfpgWindowImpl); + procedure DoReleaseWindowHandle; + function HandleIsValid: boolean; override; + procedure DoUpdateWindowPosition(aleft, atop, awidth, aheight: TfpgCoord); + procedure DoMoveWindow(x, y: TfpgCoord); + //procedure MoveToScreenCenter; override; + procedure DoSetWindowTitle(const atitle: string); + property WinHandle: TfpgWinHandle read FWinHandle; + public + constructor Create(AOwner: TComponent); override; + end; + + + TfpgApplicationImpl = class(TfpgApplicationBase) + protected + FDisplay: HDC; + WindowClass: TWndClass; + WidgetClass: TWndClass; + hcr_default: HCURSOR; + hcr_dir_ew: HCURSOR; + hcr_dir_ns: HCURSOR; + hcr_edit: HCURSOR; + hcr_dir_nwse: HCURSOR; + hcr_dir_nesw: HCURSOR; + hcr_move: HCURSOR; + hcr_crosshair: HCURSOR; + FFocusedWindow: THANDLE; + LastClickWindow: TfpgWinHandle; // double click generation + LastWinClickTime: longword; + FTimerWnd: HWND; + public + constructor Create(const aparams: string); override; + function DoMessagesPending: boolean; + procedure DoWaitWindowMessage(atimeoutms: integer); + procedure DoFlush; + function GetScreenWidth: TfpgCoord; + function GetScreenHeight: TfpgCoord; + property Display: HDC read FDisplay; + end; + + +implementation + +uses + {$Note Remove the dependency on gfx_widget and gfx_form units.} + fpgfx, + gfx_widget,//, gfx_form; + gfx_UTF8Utils; + +var + wapplication: TfpgApplication; + MouseFocusedWH: HWND; + + +function fpgColorToWin(col: TfpgColor): TfpgColor; +var + c: dword; +begin + c := fpgColorToRGB(col); + //swapping bytes + Result := ((c and $FF0000) shr 16) or ((c and $0000FF) shl 16) or (c and $00FF00); +end; + + +function GetMyWidgetFromHandle(wh: TfpgWinHandle): TfpgWidget; +begin + if (wh <> 0) and (MainInstance = longword(GetWindowLong(wh, GWL_HINSTANCE))) then + Result := TfpgWidget(Windows.GetWindowLong(wh, GWL_USERDATA)) + else + Result := nil; +end; + +(* +procedure SendMouseMessage(wg : TWidget; msg : UINT; button : integer; wParam : WPARAM; lParam : LPARAM); +var + p3 : integer; + x,y : integer; + wwg : TWidget; + pwg : TWidget; + h : THANDLE; + pt : TPOINT; +begin + x := SmallInt(lParam and $FFFF); + y := SmallInt((lParam and $FFFF0000) shr 16); + + p3 := button shl 8; + + if (wParam and MK_CONTROL) <> 0 then p3 := p3 or ss_control; + if (wParam and MK_SHIFT) <> 0 then p3 := p3 or ss_shift; + + + wwg := wg; + + if (PopupListFirst <> nil) then + begin + if wg = nil then Writeln('wg is NIL !!!'); + + pt.x := x; + pt.y := y; + + ClientToScreen(wg.WinHandle, pt); + + //Writeln('click x=',pt.X,' y=',pt.y); + + h := WindowFromPoint(pt); + wwg := GetMyWidgetFromHandle(h); + + // if wwg <> nil then writeln('widget ok.'); + + pwg := wwg; + while (pwg <> nil) and (pwg.Parent <> nil) do pwg := pwg.Parent; + + if ((pwg = nil) or (PopupListFind(pwg.WinHandle) = nil)) and (not PopupDontCloseWidget(wwg)) and + ((msg = MSG_MOUSEDOWN) or (msg = MSG_MOUSEUP)) then + begin + ClosePopups; + + SendMessage(nil, wwg, MSG_POPUPCLOSE, 0, 0, 0 ); + end; + + // sending the message... + if wwg <> nil then + begin + ScreenToClient(wwg.WinHandle, pt); + x := pt.x; + y := pt.y; + end; + end; + + if ptkTopModalForm <> nil then + begin + pwg := WidgetParentForm(wwg); + if (pwg <> nil) and (ptkTopModalForm <> pwg) then wwg := nil; + end; + + if wwg <> nil then + begin + if (Msg = MSG_MOUSEDOWN) and (PopupListFirst = nil) then + begin + SetCapture(wwg.WinHandle); + end + else if (Msg = MSG_MOUSEUP) and (PopupListFirst = nil) then + begin + ReleaseCapture(); + end; + + SendMessage(nil, wwg, Msg, x, y, p3); + + end; + +end; + +*) + +function fpgWindowProc(hwnd: HWND; uMsg: UINT; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; +var + w: TfpgWindowImpl; + kwg, mwg: TfpgWidget; + kcode, i: integer; + sstate: integer; + h: THANDLE; + p: PChar; + pt: TPOINT; + r: TRECT; + blockmsg: boolean; + msgp: TfpgMessageParams; + mcode: integer; + wmsg: TMsg; + PaintStruct: TPaintStruct; +begin + if uMsg = WM_CREATE then + begin + w := TfpgWindowImpl(PCreateStruct(lParam)^.lpCreateParams); + w.FWinHandle := hwnd; // this is very important, because number of messages sent + // before the createwindow returns the window handle + Windows.SetWindowLong(hwnd, GWL_USERDATA, longword(w)); + end; + + w := TfpgWindowImpl(Windows.GetWindowLong(hwnd, GWL_USERDATA)); + Result := 0; + + if not Assigned(w) then + begin + Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); + Exit; + end; + + blockmsg := False; + fillchar(msgp, sizeof(msgp), 0); + + case uMsg of + WM_CHAR, + WM_KEYUP, + WM_KEYDOWN: + begin + kwg := FindKeyboardFocus; + if kwg <> nil then + w := kwg; + + sstate := 0; + if GetKeyState(VK_SHIFT) < 0 then + sstate := sstate + ss_shift; + if GetKeyState(VK_MENU) < 0 then + sstate := sstate + ss_alt; + if GetKeyState(VK_CONTROL) < 0 then + sstate := sstate + ss_control; + + kcode := (lParam shr 16) and $1FF; + + msgp.keyboard.keycode := kcode; + msgp.keyboard.shiftstate := sstate; + + if uMsg = WM_KEYDOWN then + begin + fpgSendMessage(nil, w, FPGM_KEYPRESS, msgp); + + // generating WM_CHAR + fillchar(wmsg, sizeof(wmsg), 0); + + wmsg.hwnd := hwnd; + wmsg.message := uMsg; + wmsg.wParam := wParam; + wmsg.lParam := lParam; + + Windows.TranslateMessage(@wmsg); + // TranslateMessage sends WM_CHAR ocassionally + // but NOBODY KNOWS WHEN! + + // lets generate the FPGM_KEYCHAR for some special keys + // based on this table of Windows virtual keys + case wParam of + $70..$7B, // F1..F12 + $21..$24, // home, end, pageup, pagedn + $2D..$2E, // insert, delete + $25..$28: // arrows + begin + msgp.keyboard.keycode := kcode or $FF00; // scan code + $FF00 + fpgSendMessage(nil, w, FPGM_KEYCHAR, msgp); + end; + end; + end + else if uMsg = WM_KEYUP then + fpgSendMessage(nil, w, FPGM_KEYRELEASE, msgp) + else if uMsg = WM_CHAR then + begin + msgp.keyboard.keycode := wParam; + fpgSendMessage(nil, w, FPGM_KEYCHAR, msgp); + end; + + end; + + (* + WM_SETCURSOR: + begin + //Writeln('Hittest: ',IntToHex((lParam and $FFFF),4)); + if (lParam and $FFFF) <= 1 then + begin + ptkSetMouseCursor(wg.WinHandle, wg.MouseCursor); + result := 1; + end + else Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); + end; +*) + + WM_MOUSEMOVE, + WM_LBUTTONDOWN, + WM_LBUTTONUP, + WM_LBUTTONDBLCLK, + WM_RBUTTONDOWN, + WM_RBUTTONUP: + begin + msgp.mouse.x := smallint(lParam and $FFFF); + msgp.mouse.y := smallint((lParam and $FFFF0000) shr 16); + + case uMsg of + WM_MOUSEMOVE: + mcode := FPGM_MOUSEMOVE; + WM_LBUTTONDOWN, + WM_RBUTTONDOWN: + mcode := FPGM_MOUSEDOWN; + WM_LBUTTONUP, + WM_RBUTTONUP: + mcode := FPGM_MOUSEUP; + WM_LBUTTONDBLCLK: + mcode := FPGM_DOUBLECLICK; + else + mcode := 0; + end; + + case uMsg of + WM_MOUSEMOVE: + begin + i := 0; + if (wParam and MK_LBUTTON) <> 0 then + i := i or MOUSE_LEFT; + if (wParam and MK_RBUTTON) <> 0 then + i := i or MOUSE_RIGHT; + if (wParam and MK_MBUTTON) <> 0 then + i := i or MOUSE_MIDDLE; + msgp.mouse.Buttons := i; + end; + + WM_LBUTTONDOWN, + WM_LBUTTONUP, + WM_LBUTTONDBLCLK: + msgp.mouse.Buttons := MOUSE_LEFT; + + WM_RBUTTONDOWN, + WM_RBUTTONUP: + msgp.mouse.Buttons := MOUSE_RIGHT; + end; + + sstate := 0; + if (wParam and MK_CONTROL) <> 0 then + sstate := sstate or ss_control; + if (wParam and MK_SHIFT) <> 0 then + sstate := sstate or ss_shift; + msgp.mouse.shiftstate := sstate; + + if mcode <> 0 then + fpgSendMessage(nil, w, mcode, msgp); + { + if uMsg = WM_MOUSEMOVE then + begin + // OK! Windoze doesn't provide MOUSEENTER and MOUSEEXIT messages, so we + // have to generate implicitly 'couse we need it for buttons + + GetCursorPos(PT); + h := WindowFromPoint(PT); + if h <> MouseFocusedWH then + begin + if MouseFocusedWH > 0 then + begin + mwg := GetMyWidgetFromHandle(MouseFocusedWH); + if mwg <> nil then fpgSendMessage(nil, mwg, FPGM_MOUSEEXIT); + end; + + mwg := GetMyWidgetFromHandle(h); + if mwg <> nil then + begin + MouseFocusedWH := h; + fpgSendMessage(nil, mwg, FPGM_MOUSEENTER); + end + else + begin + MouseFocusedWH := 0; + end; + end; + end; +} + end; + + WM_SIZE: + begin + // note that WM_SIZING allows some control on sizeing + + //writeln('WM_SIZE: wp=',IntToHex(wparam,8), ' lp=',IntToHex(lparam,8)); + + msgp.rect.Width := smallint(lParam and $FFFF); + msgp.rect.Height := smallint((lParam and $FFFF0000) shr 16); + + //writeln('WM_SIZE: width=',msgp.rect.width, ' height=',msgp.rect.height); + + // skip minimize... + if lparam <> 0 then + fpgSendMessage(nil, w, FPGM_RESIZE, msgp); + end; + + + WM_MOVE: + begin + // window decoration correction ... + if (GetWindowLong(w.WinHandle, GWL_STYLE) and WS_CHILD) = 0 then + begin + GetWindowRect(w.WinHandle, r); + msgp.rect.Left := r.Left; + msgp.rect.top := r.Top; + end + else + begin + msgp.rect.Left := smallint(lParam and $FFFF); + msgp.rect.Top := smallint((lParam and $FFFF0000) shr 16); + end; + + fpgSendMessage(nil, w, FPGM_MOVE, msgp); + end; + + (* + WM_MOUSEWHEEL: + begin + //writeln('MWHEEL: wp=',IntToHex(wparam,8), ' lp=',IntToHex(lparam,8)); // and $FF00) shr 8); + + pt.x := (lParam and $FFFF); + pt.y := ((lParam and $FFFF0000) shr 16); + + h := WindowFromPoint(pt); //, CWP_SKIPINVISIBLE or CWP_SKIPDISABLED); + if h > 0 then + begin + wg := TWidget(Windows.GetWindowLong(h, GWL_USERDATA)); + end; + + if wg <> nil then + begin + if int(wParam) < 0 then SendMessage(nil, wg, MSG_SCROLL, 1, 3, 0) + else SendMessage(nil, wg, MSG_SCROLL, 0, 3, 0); + end; + end; +*) + WM_ACTIVATE: + if ((wParam and $FFFF) = WA_INACTIVE) then + fpgSendMessage(nil, w, FPGM_DEACTIVATE) + else + fpgSendMessage(nil, w, FPGM_ACTIVATE); + + WM_TIMER: + Result := 0;//Writeln('TIMER EVENT!!!'); + // used for event wait timeout + + + (* + WM_NCACTIVATE: + begin + if (ptkTopModalForm <> nil) then + begin + if (wParam = 0) and (ptkTopModalForm = wg) then + begin + blockmsg := true; + end + else if (wParam <> 0) and (ptkTopModalForm <> wg) then + begin + blockmsg := true; + end; + end; + + if (PopupListFirst <> nil) and (PopupListFirst.Visible) then BlockMsg := True; + + //writeln('ncactivate: ', ord(BlockMsg)); + + if not BlockMsg then + Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); + + end; +*) + + WM_CLOSE: fpgSendMessage(nil, w, FPGM_CLOSE, msgp); + + WM_PAINT: + begin + Windows.BeginPaint(w.WinHandle, @PaintStruct); + fpgSendMessage(nil, w, FPGM_PAINT, msgp); + Windows.EndPaint(w.WinHandle, @PaintStruct); + end; + + else + Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); + end; +end; + +{ TfpgApplicationImpl } + +constructor TfpgApplicationImpl.Create(const aparams: string); +begin + FIsInitialized := False; + FDisplay := Windows.GetDC(0); + + with WindowClass do + begin + style := CS_HREDRAW or CS_VREDRAW or CS_OWNDC or CS_DBLCLKS; + lpfnWndProc := WndProc(@fpgWindowProc); + hInstance := MainInstance; + hIcon := LoadIcon(0, IDI_APPLICATION); + hCursor := LoadCursor(0, IDC_ARROW); + hbrBackground := 0; //COLOR_WINDOW; + lpszClassName := 'FPGWIN'; + end; + Windows.RegisterClass(@WindowClass); + + with WidgetClass do + begin + style := CS_OWNDC or CS_DBLCLKS; + lpfnWndProc := WndProc(@fpgWindowProc); + hInstance := MainInstance; + hIcon := 0; + hCursor := 0; + hbrBackground := 0; //COLOR_BACKGROUND; + lpszClassName := 'FPGWIDGET'; + end; + Windows.RegisterClass(@WidgetClass); + + hcr_default := LoadCursor(0, IDC_ARROW); + hcr_dir_ew := LoadCursor(0, IDC_SIZEWE); + hcr_dir_ns := LoadCursor(0, IDC_SIZENS); + hcr_edit := LoadCursor(0, IDC_IBEAM); + hcr_dir_nwse := LoadCursor(0, IDC_SIZENWSE); + hcr_DIR_NESW := LoadCursor(0, IDC_SIZENESW); + hcr_MOVE := LoadCursor(0, IDC_SIZEALL); + hcr_CROSSHAIR := LoadCursor(0, IDC_CROSS); + + FIsInitialized := True; + wapplication := TfpgApplication(self); +end; + +function TfpgApplicationImpl.DoMessagesPending: boolean; +var + Msg: TMsg; +begin + Result := Windows.PeekMessageW(@Msg, 0, 0, 0, PM_NOREMOVE); +end; + +procedure TfpgApplicationImpl.DoWaitWindowMessage(atimeoutms: integer); +var + Msg: TMsg; + timerid: longword; + timerwnd: HWND; + mp: boolean; +begin + timerid := 0; + timerwnd := 0; + + if (atimeoutms >= 0) and (not DoMessagesPending) then + if atimeoutms > 0 then + timerid := Windows.SetTimer(timerwnd, 1, atimeoutms, nil) + {$Note This needs to be enabled again, but find a butter solution.} + // timerwnd := fpgMainForm.WinHandle; + else + Exit; // handling waiting timeout + + {$Note Incorporate Felipes code from previous fpGUI in here. It handles WinCE and Windows just fine. } + if (GetVersion() < $80000000) then + Windows.GetMessageW(@Msg, 0, 0, 0) //NT + else + Windows.GetMessage(@Msg, 0, 0, 0); //Win98 + + Windows.DispatchMessage(@msg); + + if timerid > 0 then + Windows.KillTimer(timerwnd, 1); +end; + +procedure TfpgApplicationImpl.DoFlush; +begin + GdiFlush; +end; + +function TfpgApplicationImpl.GetScreenWidth: TfpgCoord; +var + r: TRECT; +begin + GetWindowRect(GetDesktopWindow, r); + Result := r.Right - r.Left; +end; + +function TfpgApplicationImpl.GetScreenHeight: TfpgCoord; +var + r: TRECT; +begin + GetWindowRect(GetDesktopWindow, r); + Result := r.Bottom - r.Top; +end; + +{ TfpgWindowImpl } + +procedure TfpgWindowImpl.DoAllocateWindowHandle(aparent: TfpgWindowImpl); +var + wcname: string; + wname: string; + mid: dword; + rwidth: integer; + rheight: integer; + r: TRect; +begin + if FWinHandle > 0 then + Exit; + + FWinStyle := WS_OVERLAPPEDWINDOW; + FWinStyleEx := WS_EX_APPWINDOW; + mid := 0; + wcname := 'FPGWIN'; + + if aparent <> nil then + FParentWinHandle := aparent.WinHandle + else + FParentWinHandle := 0; + + if FWindowType = wtChild then + begin + FWinStyle := WS_CHILD; + FWinStyleEx := 0; + mid := 1; + wcname := 'FPGWIDGET'; + end + else if FWindowType in [wtPopup] then + begin + FWinStyle := WS_POPUP; + FWinStyleEx := WS_EX_TOOLWINDOW; + end; + + if FWindowType = wtModalForm then + begin + // for modal windows, this is necessary + FWinStyle := WS_OVERLAPPEDWINDOW or WS_POPUPWINDOW; + FWinStyle := FWinStyle and not (WS_MINIMIZEBOX); + FWinStyleEx := 0; + end; + + AdjustWindowStyle; + + if waAutoPos in FWindowAttributes then + begin + FLeft := TfpgCoord(CW_USEDEFAULT); + FTop := TfpgCoord(CW_USEDEFAULT); + end; + + if (FWindowType <> wtChild) and not (waSizeable in FWindowAttributes) then + FWinStyle := FWinStyle and not (WS_SIZEBOX or WS_MAXIMIZEBOX or WS_MINIMIZEBOX); + + FWinStyle := FWinStyle or WS_CLIPCHILDREN or WS_CLIPSIBLINGS; + + wname := ''; + rwidth := FWidth; + rheight := FHeight; + + if (FWinStyle and WS_CHILD) = 0 then + begin + r.Left := FLeft; + r.Top := FTop; + r.Right := FLeft + FWidth; + r.Bottom := FTop + FHeight; + AdjustWindowRectEx(r, FWinStyle, False, FWinStyleEx); + rwidth := r.Right - r.Left; + rheight := r.Bottom - r.Top; + end; + + FWinHandle := Windows.CreateWindowEx( + FWinStyleEx, // extended window style + PChar(wcname), // registered class name + PChar(wname), // window name + FWinStyle, // window style + FLeft, // horizontal position of window + FTop, // vertical position of window + rwidth, // window width + rheight, // window height + FParentWinHandle, // handle to parent or owner window + mid, // menu handle or child identifier + MainInstance, // handle to application instance + Self // window-creation data + ); + + if waScreenCenterPos in FWindowAttributes then + begin + FLeft := (wapplication.ScreenWidth - FWidth) div 2; + FTop := (wapplication.ScreenHeight - FHeight) div 2; + DoMoveWindow(FLeft, FTop); + end; + + SetWindowParameters; // the forms require some adjustments before the Window appears + + BringWindowToTop(FWinHandle); + + if FWindowType in [wtPopup] then + Windows.ShowWindow(FWinHandle, SW_SHOWNOACTIVATE) + else + Windows.ShowWindow(FWinHandle, SW_SHOWNORMAL); + + if (waAutoPos in FWindowAttributes) or + (waScreenCenterPos in FWindowAttributes) then + begin + GetWindowRect(FWinHandle, r); + FLeft := r.Left; + FTop := r.Top; + end; + + Windows.UpdateWindow(FWinHandle); +end; + +procedure TfpgWindowImpl.DoReleaseWindowHandle; +begin + if FWinHandle <= 0 then + Exit; + Windows.DestroyWindow(FWinHandle); + FWinHandle := 0; +end; + +procedure TfpgWindowImpl.DoMoveWindow(x, y: TfpgCoord); +begin + if FWinHandle > 0 then + Windows.SetWindowPos(WinHandle, 0, x, y, 0, 0, SWP_NOZORDER or SWP_NOSIZE or SWP_NOREDRAW); +end; + +{ +procedure TfpgWindowImpl.MoveToScreenCenter; +var + r : TRECT; +begin + GetWindowRect(WinHandle, r); + FLeft := (wapplication.ScreenWidth-(r.Right - r.Left)) div 2; + FTop := (wapplication.ScreenHeight-(r.Bottom - r.Top)) div 2; + MoveWindow(FLeft,FTop); +end; +} + +procedure TfpgWindowImpl.DoSetWindowTitle(const atitle: string); +begin + {$ifdef wince} + Windows.SetWindowText(WinHandle, PWideChar(Utf8Decode(ATitle))); + {$else} + if UnicodeEnabledOS then + Windows.SetWindowTextW(WinHandle, PWideChar(Utf8Decode(ATitle))) + else + Windows.SetWindowText(WinHandle, PChar(Utf8ToAnsi(ATitle))); + {$endif} +end; + +constructor TfpgWindowImpl.Create(aowner: TComponent); +begin + inherited; + FWinHandle := 0; +end; + +function TfpgWindowImpl.HandleIsValid: boolean; +begin + Result := FWinHandle > 0; +end; + +procedure TfpgWindowImpl.DoUpdateWindowPosition(aleft, atop, awidth, aheight: TfpgCoord); +begin + Windows.SetWindowPos( + WinHandle, 0, + aleft, atop, awidth, aheight, + SWP_NOZORDER or SWP_NOREDRAW + ); +end; + +{ TfpgCanvasImpl } + +constructor TfpgCanvasImpl.Create; +begin + FDrawing := False; + FDrawWindow := nil; + FBufferBitmap := 0; +end; + +destructor TfpgCanvasImpl.Destroy; +begin + if FDrawing then + DoEndDraw; + inherited; +end; + +procedure TfpgCanvasImpl.DoBeginDraw(awin: TfpgWindowImpl; buffered: boolean); +var + ARect: TfpgRect; + bmsize: Windows.TSIZE; +begin + if FDrawing and buffered and (FBufferBitmap > 0) then + begin + // check if the dimensions are ok + GetBitmapDimensionEx(FBufferBitmap, bmsize); + FDrawWindow := awin; + DoGetWinRect(ARect); + if (bmsize.cx <> ARect.Width) or (bmsize.cy <> ARect.Height) then + DoEndDraw; + end; + + if not FDrawing then + begin + FDrawWindow := awin; + FWinGC := Windows.GetDC(FDrawWindow.FWinHandle); + + if buffered then + begin + DoGetWinRect(ARect); + FBufferBitmap := Windows.CreateCompatibleBitmap(FWinGC, ARect.Width, ARect.Height); + Fgc := CreateCompatibleDC(FWinGC); + SelectObject(Fgc, FBufferBitmap); + end + else + begin + FBufferBitmap := 0; + Fgc := FWinGC; + end; + + SetTextAlign(Fgc, TA_TOP); //TA_BASELINE); + SetBkMode(Fgc, TRANSPARENT); + + FBrush := CreateSolidBrush(0); + FPen := CreatePen(PS_SOLID, 0, 0); + FClipRegion := CreateRectRgn(0, 0, 1, 1); + + FColor := clText1; + FLineStyle := PS_SOLID; + FLineWidth := 0; + FBackgroundColor := clBoxColor; + end; + + FDrawing := True; +end; + +procedure TfpgCanvasImpl.DoEndDraw; +begin + if FDrawing then + begin + DeleteObject(FBrush); + DeleteObject(FPen); + DeleteObject(FClipRegion); + + if FBufferBitmap > 0 then + DeleteObject(FBufferBitmap); + FBufferBitmap := 0; + + if Fgc <> FWinGC then + DeleteDC(Fgc); + + Windows.ReleaseDC(FDrawWindow.FWinHandle, FWingc); + + FDrawing := False; + FDrawWindow := nil; + end; +end; + +procedure TfpgCanvasImpl.DoPutBufferToScreen(x, y, w, h: TfpgCoord); +begin + if FBufferBitmap > 0 then + BitBlt(FWinGC, x, y, w, h, Fgc, x, y, SRCCOPY); +end; + +procedure TfpgCanvasImpl.DoAddClipRect(const rect: TfpgRect); +var + rg: HRGN; +begin + rg := CreateRectRgn(rect.left, rect.top, rect.left + rect.Width, rect.top + rect.Height); + FClipRect := Rect; + FClipRectSet := True; + CombineRgn(FClipRegion, rg, FClipRegion, RGN_AND); + SelectClipRgn(Fgc, FClipRegion); + DeleteObject(rg); +end; + +procedure TfpgCanvasImpl.DoClearClipRect; +begin + SelectClipRgn(Fgc, 0); + FClipRectSet := False; +end; + +procedure TfpgCanvasImpl.DoDrawLine(x1, y1, x2, y2: TfpgCoord); +var + pts: array[1..2] of Windows.TPoint; +begin + pts[1].X := x1; + pts[1].Y := y1; + pts[2].X := x2; + pts[2].Y := y2; + PolyLine(Fgc, pts, 2); + SetPixel(Fgc, x2, y2, FWindowsColor); +end; + +procedure TfpgCanvasImpl.DoDrawRectangle(x, y, w, h: TfpgCoord); +var + wr: Windows.TRect; +begin + wr.Left := x; + wr.Top := y; + wr.Right := x + w; + wr.Bottom := y + h; + Windows.FrameRect(Fgc, wr, FBrush); +end; + +procedure TfpgCanvasImpl.DoDrawString(x, y: TfpgCoord; const txt: string); +var + WideText: widestring; +begin + if UTF8Length(txt) < 1 then + Exit; //==> + + WideText := Utf8Decode(txt); + {$ifdef wince} + Windows.ExtTextOut(Fgc, x, y, ETO_CLIPPED, nil, PWideChar(WideText), Length(WideText), nil); + {$else} + Windows.TextOutW(Fgc, x, y, PWideChar(WideText), Length(WideText)); + {$endif} +end; + +procedure TfpgCanvasImpl.DoFillRectangle(x, y, w, h: TfpgCoord); +var + wr: Windows.TRect; +begin + wr.Left := x; + wr.Top := y; + wr.Right := x + w; + wr.Bottom := y + h; + Windows.FillRect(Fgc, wr, FBrush); +end; + +procedure TfpgCanvasImpl.DoFillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); +var + pts: array[1..3] of Windows.TPoint; +begin + pts[1].X := x1; + pts[1].Y := y1; + pts[2].X := x2; + pts[2].Y := y2; + pts[3].X := x3; + pts[3].Y := y3; + Polygon(Fgc, pts, 3); +end; + +function TfpgCanvasImpl.DoGetClipRect: TfpgRect; +begin + Result := FClipRect; +end; + +procedure TfpgCanvasImpl.DoGetWinRect(var r: TfpgRect); +var + wr: Windows.TRECT; +begin + GetClientRect(FDrawWindow.FWinHandle, wr); + r.top := wr.Top; + r.left := wr.Left; + r.Width := wr.Right - wr.Left + 1; + r.Height := wr.Bottom - wr.Top + 1; +end; + +procedure TfpgCanvasImpl.DoSetClipRect(const rect: TfpgRect); +begin + FClipRectSet := True; + FClipRect := rect; + DeleteObject(FClipRegion); + FClipRegion := CreateRectRgn(rect.left, rect.top, rect.left + rect.Width, rect.top + rect.Height); + SelectClipRgn(Fgc, FClipRegion); +end; + +procedure TfpgCanvasImpl.DoSetColor(cl: TfpgColor); +begin + DeleteObject(FBrush); + DeleteObject(FPen); + + FWindowsColor := fpgColorToWin(cl); + + FBrush := CreateSolidBrush(FWindowsColor); + FPen := CreatePen(FintLineStyle, FintLineWidth, FWindowsColor); + SelectObject(Fgc, FBrush); + SelectObject(Fgc, FPen); +end; + +procedure TfpgCanvasImpl.DoSetLineStyle(awidth: integer; astyle: TfpgLineStyle); +begin +{ Notes from MSDN: If the value specified by nWidth is greater +than 1, the fnPenStyle parameter must be PS_NULL, PS_SOLID, or +PS_INSIDEFRAME. } + FintLineWidth := awidth; + case AStyle of + lsDot: + begin + FintLineStyle := PS_DOT; + FintLineWidth := 1; + end; + lsDash: + begin + FintLineStyle := PS_DASH; + FintLineWidth := 1; + end; + lsSolid: + FintLineStyle := PS_SOLID; + else + begin + FintLineStyle := PS_DOT; + FintLineWidth := 1; + end; + end; + + DeleteObject(FPen); + FPen := CreatePen(FintLineStyle, FintLineWidth, FWindowsColor); + SelectObject(Fgc, FPen); +end; + +procedure TfpgCanvasImpl.DoSetTextColor(cl: TfpgColor); +begin + Windows.SetTextColor(Fgc, fpgColorToWin(cl)); +end; + +procedure TfpgCanvasImpl.DoSetFontRes(fntres: TfpgFontResourceImpl); +begin + if fntres = nil then + Exit; + FCurFontRes := fntres; + Windows.SelectObject(Fgc, FCurFontRes.Handle); +end; + +procedure TfpgCanvasImpl.DoDrawImagePart(x, y: TfpgCoord; img: TfpgImageImpl; xi, yi, w, h: integer); +const + DSTCOPY = $00AA0029; + ROP_DSPDxax = $00E20746; +var + tmpdc: HDC; + rop: longword; +begin + if img = nil then + Exit; + + tmpdc := CreateCompatibleDC(wapplication.display); + SelectObject(tmpdc, img.BMPHandle); + + if img.FIsTwoColor then + rop := PATCOPY //ROP_DSPDxax + else + rop := SRCCOPY; + + if img.MaskHandle > 0 then + MaskBlt(Fgc, x, y, w, h, tmpdc, xi, yi, img.MaskHandle, xi, yi, MakeRop4(rop, DSTCOPY)) + else + BitBlt(Fgc, x, y, w, h, tmpdc, xi, yi, rop); + + DeleteDC(tmpdc); +end; + +procedure TfpgCanvasImpl.DoXORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); +var + hb: HBRUSH; + nullpen: HPEN; +begin + hb := CreateSolidBrush(fpgColorToWin(fpgColorToRGB(col))); + nullpen := CreatePen(PS_NULL, 0, 0); + + SetROP2(Fgc, R2_XORPEN); + SelectObject(Fgc, hb); + SelectObject(Fgc, nullpen); + + Windows.Rectangle(Fgc, x, y, x + w + 1, y + h + 1); + + SetROP2(Fgc, R2_COPYPEN); + DeleteObject(hb); + SelectObject(Fgc, FPen); +end; + +{ TfpgFontResourceImpl } + +constructor TfpgFontResourceImpl.Create(const afontdesc: string); +begin + FFontData := OpenFontByDesc(afontdesc); + + if HandleIsValid then + begin + SelectObject(wapplication.display, FFontData); + GetTextMetrics(wapplication.display, FMetrics); + end; +end; + +destructor TfpgFontResourceImpl.Destroy; +begin + if HandleIsValid then + Windows.DeleteObject(FFontData); + inherited; +end; + +function TfpgFontResourceImpl.OpenFontByDesc(const desc: string): HFONT; +var + lf: Windows.LOGFONT; + facename: string; + cp: integer; + c: char; + token: string; + prop, propval: string; + + function NextC: char; + begin + Inc(cp); + if cp > length(desc) then + c := #0 + else + c := desc[cp]; + Result := c; + end; + + procedure NextToken; + begin + token := ''; + while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '0'..'9']) do + begin + token := token + c; + NextC; + end; + end; + +begin + FillChar(lf, sizeof(lf), 0); + + with lf do + begin + lfWidth := 0; { have font mapper choose } + lfEscapement := 0; { only straight fonts } + lfOrientation := 0; { no rotation } + lfWeight := FW_NORMAL; + lfItalic := 0; + lfUnderline := 0; + lfStrikeOut := 0; + lfCharSet := DEFAULT_CHARSET; //0; //Byte(Font.Charset); + lfQuality := ANTIALIASED_QUALITY; + { Everything else as default } + lfOutPrecision := OUT_DEFAULT_PRECIS; + lfClipPrecision := CLIP_DEFAULT_PRECIS; + lfPitchAndFamily := DEFAULT_PITCH; + end; + + cp := 0; + NextC; + NextToken; + + facename := token + #0; + move(facename[1], lf.lfFaceName[0], length(facename)); + + if c = '-' then + begin + NextC; + NextToken; + lf.lfHeight := -MulDiv(StrToIntDef(token, 0), GetDeviceCaps(wapplication.display, LOGPIXELSY), 72); + end; + + while c = ':' do + begin + NextC; + NextToken; + + prop := UpperCase(token); + propval := ''; + + if c = '=' then + begin + NextC; + NextToken; + propval := UpperCase(token); + end; + + if prop = 'BOLD' then + lf.lfWeight := FW_BOLD + else if prop = 'ITALIC' then + lf.lfItalic := 1 + else if prop = 'ANTIALIAS' then + if propval = 'FALSE' then + lf.lfQuality := DEFAULT_QUALITY; + end; + + Result := CreateFontIndirectA(@lf); +end; + +function TfpgFontResourceImpl.HandleIsValid: boolean; +begin + Result := FFontData <> 0; +end; + +function TfpgFontResourceImpl.GetAscent: integer; +begin + Result := FMetrics.tmAscent; +end; + +function TfpgFontResourceImpl.GetDescent: integer; +begin + Result := FMetrics.tmDescent; +end; + +function TfpgFontResourceImpl.GetHeight: integer; +begin + Result := FMetrics.tmHeight; +end; + +function TfpgFontResourceImpl.GetTextWidth(const txt: string): integer; +var + ts: Windows.SIZE; + WideText: widestring; +begin + if length(txt) < 1 then + begin + Result := 0; + Exit; + end; + SelectObject(wapplication.display, FFontData); + + WideText := Utf8Decode(txt); + {$ifdef wince} + Windows.GetTextExtentPoint32(wapplication.display, PWideChar(WideText), Length(WideText), ts); + {$else} + Windows.GetTextExtentPoint32W(wapplication.display, PWideChar(WideText), Length(WideText), ts); + {$endif} + + Result := ts.cx; +end; + +{ TfpgImageImpl } + +constructor TfpgImageImpl.Create; +begin + FBMPHandle := 0; + FMaskHandle := 0; + FIsTwoColor := False; +end; + +procedure TfpgImageImpl.DoFreeImage; +begin + if FBMPHandle > 0 then + DeleteObject(FBMPHandle); + FBMPHandle := 0; + if FMaskHandle > 0 then + DeleteObject(FMaskHandle); + FMaskHandle := 0; +end; + +procedure TfpgImageImpl.DoInitImage(acolordepth, awidth, aheight: integer; aimgdata: Pointer); +var + bi: TBitmapInfo; +begin + if FBMPHandle > 0 then + DeleteObject(FBMPHandle); + + FBMPHandle := CreateCompatibleBitmap(wapplication.display, awidth, aheight); + + FillChar(bi, sizeof(bi), 0); + + with bi.bmiHeader do + begin + biSize := sizeof(bi); + biWidth := awidth; + biHeight := -aheight; + biPlanes := 1; + if acolordepth = 1 then + bibitcount := 1 + else + bibitcount := 32; + biCompression := BI_RGB; + biSizeImage := 0; + biXPelsPerMeter := 96; + biYPelsPerMeter := 96; + biClrUsed := 0; + biClrImportant := 0; + end; + + SetDIBits(wapplication.display, FBMPHandle, 0, aheight, aimgdata, bi, DIB_RGB_COLORS); + + FIsTwoColor := (acolordepth = 1); +end; + +type + TMyMonoBitmap = packed record + bmiHeader: TBitmapInfoHeader; + bmColors: array[1..2] of longword; + end; + +procedure TfpgImageImpl.DoInitImageMask(awidth, aheight: integer; aimgdata: Pointer); +var + bi: TMyMonoBitmap; + pbi: PBitmapInfo; +begin + if FMaskHandle > 0 then + DeleteObject(FMaskHandle); + FMaskHandle := CreateBitmap(awidth, aheight, 1, 1, nil); + FillChar(bi, sizeof(bi), 0); + + with bi.bmiHeader do + begin + biSize := sizeof(bi.bmiHeader); + biWidth := awidth; + biHeight := -aheight; + biPlanes := 1; + bibitcount := 1; + biCompression := BI_RGB; + biSizeImage := 0; + biXPelsPerMeter := 96; + biYPelsPerMeter := 96; + biClrUsed := 2; + biClrImportant := 0; + end; + bi.bmColors[1] := $000000; + bi.bmColors[2] := $FFFFFF; + + pbi := @bi; + SetDIBits(wapplication.display, FMaskHandle, 0, aheight, aimgdata, pbi^, DIB_RGB_COLORS); +end; + +initialization + wapplication := nil; + MouseFocusedWH := 0; + +{$IFDEF WinCE} + UnicodeEnabledOS := True; +{$ELSE} + WinVersion.dwOSVersionInfoSize := SizeOf(TOSVersionInfo); + GetVersionEx(WinVersion); + UnicodeEnabledOS := (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_NT) or + (WinVersion.dwPlatformID = VER_PLATFORM_WIN32_CE); +{$ENDIF} + +end. + diff --git a/prototypes/fpgui2/source/core/gfx_imgfmt_bmp.pas b/prototypes/fpgui2/source/core/gfx_imgfmt_bmp.pas new file mode 100644 index 00000000..95454ba3 --- /dev/null +++ b/prototypes/fpgui2/source/core/gfx_imgfmt_bmp.pas @@ -0,0 +1,326 @@ +{ + BMP format image parser +} + +unit gfx_imgfmt_bmp; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + fpgfx, + gfxbase; + +procedure ReadImage_BMP(img: TfpgImage; bmp: Pointer; bmpsize: longword); +function LoadImage_BMP(const AFileName: string): TfpgImage; +function CreateImage_BMP(bmp: Pointer; bmpsize: longword): TfpgImage; + +implementation + +function CreateImage_BMP(bmp: Pointer; bmpsize: longword): TfpgImage; +begin + Result := TfpgImage.Create; + ReadImage_BMP(Result, bmp, bmpsize); +end; + +function LoadImage_BMP(const AFileName: string): TfpgImage; +var + AFile: file of char; + AImageData: Pointer; + AImageDataSize: longint; +begin + Result := nil; + if not FileExists(AFileName) then + Exit; //==> + + AssignFile(AFile, AFileName); + Reset(AFile); + AImageDataSize := FileSize(AFile); + GetMem(AImageData, AImageDataSize); + try + BlockRead(AFile, AImageData^, AImageDataSize); + Result := TfpgImage.Create; + ReadImage_BMP(Result, AImageData, AImageDataSize); + finally + CloseFile(AFile); + FreeMem(AImageData); + end; +end; + + +type + // Windows BMP format description: + + TBMPHeaderRec = packed record + signature: word; + filesize: longword; + reserved: longword; + dataoffset: longword; + end; + PBMPHeaderRec = ^TBMPHeaderRec; + + TBMPInfoHeaderRec = packed record + headersize: longword; // = 40 + Width: longword; + Height: longword; + planes: word; + bitcount: word; + compression: longword; + imagesize: longword; // bytes in the image data (after the color table) + XpixelsPerM: longword; + YpixelsPerM: longword; + ColorsUsed: longword; + ColorsImportant: longword; + end; + PBMPInfoHeaderRec = ^TBMPInfoHeaderRec; + + // Then follows the Color Table if bitcount <= 8 + + TBMPColorTableRec = packed record + red: byte; + green: byte; + blue: byte; + reserved: byte; + end; + + // Then follows the image data + // Every line padded to 32 bits + // The lines stored bottom-up + +type + PByte = ^byte; + Pword = ^word; + Plongword = ^longword; + +procedure ReadImage_BMP(img: TfpgImage; bmp: Pointer; bmpsize: longword); +var + bh: PBMPHeaderRec; + ih: PBMPInfoHeaderRec; + p: PByte; + ppal: plongword; + pcol: Plongword; + palsize: integer; + pdata: PByte; + b: byte; + bit: byte; + bcnt: byte; + linecnt: longword; + pixelcnt: longword; + pdest: Plongword; + depth: integer; + + function GetPalColor(cindex: longword): longword; + var + pc: Plongword; + begin + pc := ppal; + Inc(pc, cindex); + Result := pc^; + end; + +begin + if img = nil then + Exit; + + img.FreeImage; + + p := bmp; + PByte(bh) := p; + ppal := nil; + if bh^.filesize <> bmpsize then + Exit; + + pdata := bmp; + Inc(pdata, bh^.dataoffset); + + Inc(p, SizeOf(TBMPHeaderRec)); + + PByte(ih) := p; + + depth := ih^.bitcount; + + if depth > 1 then + img.AllocateImage(32, ih^.Width, ih^.Height)// color image + + else + begin + img.AllocateImage(1, ih^.Width, ih^.Height); + img.AllocateMask; + end; + +{$ifdef Win32} + // its the Windows native format + // img.SetWindowsBitmap(pdata, ih, 0, ih^.height); + // Exit; +{$else} + +{$endif} + + //Writeln('width: ',img.width,' height: ',img.height,' depth: ',depth); + //Writeln('compression: ',ih^.compression); + + Inc(p, SizeOf(TBMPInfoHeaderRec)); + + if ih^.bitcount <= 8 then + begin + // reading color palette + case ih^.bitcount of + 1: palsize := 2; + 4: palsize := 16; + else + // 256 + palsize := 256; + end; + + GetMem(ppal, palsize * SizeOf(longword)); + + pcol := ppal; + pixelcnt := 0; + while integer(p) < integer(pdata) do + begin + pcol^ := Plongword(p)^; + //Writeln('color: ',HexStr(pcol^,8)); + Inc(pcol); + Inc(Plongword(p)); + Inc(pixelcnt); + end; + + //writeln(pixelcnt,' colors loaded.'); + + end; + + pdest := img.ImageData; + Inc(pdest, img.Width * (img.Height - 1)); // bottom-up line order + p := bmp; + Inc(p, bh^.dataoffset); + + // reading the data... + case ih^.bitcount of + 1: + begin + // direct line transfer + //writeln('reading 1-bit color bitmap'); + linecnt := 0; + bcnt := img.Width div 32; + if (img.Width and $1F) > 0 then + Inc(bcnt); + + pdest := img.ImageData; + Inc(pdest, bcnt * (img.Height - 1)); // bottom-up line order + repeat + move(p^, pdest^, bcnt * 4); + Inc(p, bcnt * 4); + Dec(pdest, bcnt); + Inc(linecnt); + until linecnt >= img.Height; + + //Writeln(linecnt,' lines loaded.'); + move(img.ImageData^, img.MaskData^, img.ImageDataSize); + img.Invert; + end; + + 4: + begin + //writeln('reading 4-bit color'); + linecnt := 0; + repeat + // parse one line.. + bit := 0; + pixelcnt := 0; + bcnt := 0; + repeat + if bit = 0 then + b := (p^ shr 4) and $0F + else + begin + b := p^ and $0F; + Inc(p); + Inc(bcnt); + end; + + pdest^ := GetPalColor(b); + Inc(pdest); + Inc(pixelcnt); + bit := bit xor 1; + until pixelcnt >= img.Width; + + while (bcnt mod 4) <> 0 do + begin + Inc(bcnt); + Inc(p); + end; + + Inc(linecnt); + Dec(pdest, img.Width * 2); // go to next line + until linecnt >= img.Height; + end; + + 8: + begin + //writeln('reading 8-bit color'); + linecnt := 0; + repeat + // parse one line.. + pixelcnt := 0; + repeat + pdest^ := GetPalColor(p^); + Inc(p); + Inc(pdest); + Inc(pixelcnt); + until pixelcnt >= img.Width; + + while (pixelcnt mod 4) <> 0 do + begin + Inc(pixelcnt); + Inc(p); + end; + + Inc(linecnt); + Dec(pdest, img.Width * 2); // go to next line + until linecnt >= img.Height; + end; + + 24: + begin + //writeln('reading truecolor'); + linecnt := 0; + repeat + // parse one line.. + pixelcnt := 0; + repeat + pdest^ := p^; + Inc(p); + pdest^ := pdest^ or (longword(p^) shl 8); + Inc(p); + pdest^ := pdest^ or (longword(p^) shl 16); + Inc(p); + Inc(pdest); + Inc(pixelcnt); + until pixelcnt >= img.Width; + + pixelcnt := img.Width * 3; + while (pixelcnt mod 4) <> 0 do + begin + Inc(pixelcnt); + Inc(p); + end; + + Inc(linecnt); + Dec(pdest, img.Width * 2); // go to next line + until linecnt >= img.Height; + end; + else + writeln('Unsupported BMP format!'); + end; + + if ppal <> nil then + FreeMem(ppal); + + img.UpdateImage; +end; + +end. + diff --git a/prototypes/fpgui2/source/core/gfx_msgqueue.inc b/prototypes/fpgui2/source/core/gfx_msgqueue.inc new file mode 100644 index 00000000..ae893b44 --- /dev/null +++ b/prototypes/fpgui2/source/core/gfx_msgqueue.inc @@ -0,0 +1,195 @@ + +// fpGFX internal message queue implementation + +type + // a simlpe linked list implementation + TMessageListElement = class + protected + Next: TMessageListElement; + Prev: TMessageListElement; + public + msg: TfpgMessageRec; + end; + +var + // to make things easier we have a few global variable that will get set + UsedFirstMessage: TMessageListElement; + UsedLastMessage: TMessageListElement; + FreeFirstMessage: TMessageListElement; + FreeLastMessage: TMessageListElement; + +procedure MsgListInsertElement(Elem: TMessageListElement; var First: TMessageListElement; var Last: TMessageListElement); +begin + Elem.Prev := nil; + Elem.Next := nil; + + if First = nil then + begin + First := Elem; + Last := Elem; + end + else + begin + Last.Next := Elem; + Elem.Prev := Last; + Last := Elem; + end; +end; + +procedure MsgListRemoveElement(Elem: TMessageListElement; var First: TMessageListElement; var Last: TMessageListElement); +begin + if Elem = First then + First := Elem.Next; + + if Elem = Last then + Last := Elem.Prev; + + if Elem.Next <> nil then + Elem.Next.Prev := Elem.Prev; + + if Elem.Prev <> nil then + Elem.Prev.Next := Elem.Next; +end; + +function pgfAllocateMessage: PfpgMessageRec; +var + e: TMessageListElement; +begin + e := FreeFirstMessage; + if e <> nil then + begin + MsgListRemoveElement(e, FreeFirstMessage, FreeLastMessage); + MsgListInsertElement(e, UsedFirstMessage, UsedLastMessage); + result := @(e.msg); + end + else + result := nil; +end; + +procedure fpgDeleteFirstMessage; +var + e: TMessageListElement; +begin + e := UsedFirstMessage; + if e <> nil then + begin + MsgListRemoveElement(e, UsedFirstMessage, UsedLastMessage); + MsgListInsertElement(e, FreeFirstMessage, FreeLastMessage); + end; +end; + +function fpgGetFirstMessage: PfpgMessageRec; +begin + if UsedFirstMessage <> nil then + Result := @(UsedFirstMessage.msg) + else + Result := nil; +end; + +procedure fpgInitMsgQueue; +var + n: integer; + e: TMessageListElement; +begin + UsedFirstMessage := nil; + UsedLastMessage := nil; + FreeFirstMessage := nil; + FreeLastMessage := nil; + + for n := 1 to cMessageQueueSize do + begin + e := TMessageListElement.Create; + MsgListInsertElement(e,FreeFirstMessage,FreeLastMessage); + end; +end; + +procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; +var + p: PfpgMessageRec; +begin + if Dest = nil then + Exit; //==> + + p := pgfAllocateMessage; + if p <> nil then + begin + p^.MsgCode := MsgCode; + p^.Sender := Sender; + p^.Dest := Dest; + p^.Params := aparams; + end + else + Writeln('THE MESSAGE QUEUE IS FULL.'); +end; + +procedure fpgPostMessage(Sender, Dest: TObject; MsgCode: integer); overload; +var + p: PfpgMessageRec; +begin + if Dest = nil then + Exit; //==> + + p := pgfAllocateMessage; + if p <> nil then + begin + p^.MsgCode := MsgCode; + p^.Sender := Sender; + p^.Dest := Dest; + end + else + Writeln('THE MESSAGE QUEUE IS FULL.'); +end; + +procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer; var aparams: TfpgMessageParams); overload; +var + m: TfpgMessageRec; +begin + if Dest = nil then + Exit; //==> + + m.MsgCode := MsgCode; + m.Sender := Sender; + m.Dest := Dest; + m.Params := aparams; + + m.Dest.Dispatch(m) +end; + +procedure fpgSendMessage(Sender, Dest: TObject; MsgCode: integer); overload; +var + m: TfpgMessageRec; +begin + if Dest = nil then + Exit; //==> + + m.MsgCode := MsgCode; + m.Sender := Sender; + m.Dest := Dest; + + m.Dest.Dispatch(m) +end; + +procedure fpgDeliverMessage(var msg: TfpgMessageRec); +begin + if msg.MsgCode = FPGM_KILLME then + msg.Dest.Free + else + msg.Dest.Dispatch(msg); +end; + +procedure fpgDeliverMessages; +var + mp: PfpgMessageRec; + m: TfpgMessageRec; +begin + repeat + mp := fpgGetFirstMessage; + if mp <> nil then + begin + m := mp^; + fpgDeleteFirstMessage; + fpgDeliverMessage(m); + end; + until mp = nil; +end; + diff --git a/prototypes/fpgui2/source/core/gfx_stdimages.pas b/prototypes/fpgui2/source/core/gfx_stdimages.pas new file mode 100644 index 00000000..27d0ab6c --- /dev/null +++ b/prototypes/fpgui2/source/core/gfx_stdimages.pas @@ -0,0 +1,316 @@ +{ + Standard fpGUI images that will be used in things like Message, + FileOpen, FileSave dialogs, Buttons, etc.. +} +unit gfx_stdimages; + +{$mode objfpc}{$H+} + +interface + +uses + fpgfx; + +procedure fpgCreateStandardImages; + +implementation + +{$I stdimages.inc} + +Const + // 60x12 pixel 4bpp bitmap + RadioBitmapData: array[0..359] of Byte = ( + $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, $00, $00, $22, $22, $00, $00, + $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, $00, $22, $11, $11, $22, $00, + $02, $11, $77, $77, $11, $50, $02, $11, $77, $77, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, $02, $11, $33, $33, $11, $50, + $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $66, $66, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $66, $66, $33, $45, $21, $33, $22, $22, $33, $45, + $21, $77, $77, $77, $77, $45, $21, $77, $76, $67, $77, $45, $21, $33, $33, $33, $33, $45, $21, $33, $36, $63, $33, $45, $21, $33, $32, $23, $33, $45, + $02, $17, $77, $77, $74, $50, $02, $17, $77, $77, $74, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, $02, $13, $33, $33, $34, $50, + $02, $44, $77, $77, $44, $50, $02, $44, $77, $77, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, $02, $44, $33, $33, $44, $50, + $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, $00, $55, $44, $44, $55, $00, + $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00, $00, $00, $55, $55, $00, $00 + ); + + // 12x12 pixel monochrome bitmap + RadioMaskData: array[0..23] of Byte = ($0f, $00, $3f, $c0, $7f, $e0, $7f, + $e0, $ff, $f0, $ff, $f0, $ff, $f0, $ff, $f0, $7f, $e0, $7f, $e0, $3f, $c0, + $0f, $00); + + // 65x13 pixel 4bpp bitmap + CheckBoxBitmapData: array[0..428] of Byte = ( + $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $52, $22, $22, $22, $22, $22, $25, $22, $22, $22, $22, $22, $22, $50, + $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $52, $11, $11, $11, $11, $11, $45, $21, $11, $11, $11, $11, $14, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $63, $45, $21, $33, $33, $33, $32, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $76, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $36, $63, $45, $21, $33, $33, $33, $22, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $67, $77, $66, $67, $45, $21, $33, $33, $33, $33, $34, $52, $13, $63, $33, $66, $63, $45, $21, $32, $33, $32, $22, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $66, $76, $66, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $36, $66, $33, $45, $21, $32, $23, $22, $23, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $66, $66, $67, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $66, $66, $63, $33, $45, $21, $32, $22, $22, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $76, $66, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $36, $66, $33, $33, $45, $21, $33, $22, $23, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $67, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $63, $33, $33, $45, $21, $33, $32, $33, $33, $34, $50, + $21, $77, $77, $77, $77, $74, $52, $17, $77, $77, $77, $77, $45, $21, $33, $33, $33, $33, $34, $52, $13, $33, $33, $33, $33, $45, $21, $33, $33, $33, $33, $34, $50, + $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $52, $44, $44, $44, $44, $44, $45, $24, $44, $44, $44, $44, $44, $50, + $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $55, $50 + ); + + // 64x8 pixel 4bpp bitmap + ArrowBitmapData: array[0..255] of Byte = ( + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $23, $33, $33, $23, $33, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $32, $25, $33, $33, $22, $33, $33, + $33, $31, $33, $33, $11, $11, $11, $13, $33, $11, $13, $33, $33, $31, $11, $33, $33, $32, $33, $33, $22, $22, $22, $23, $33, $22, $25, $33, $33, $22, $23, $33, + $33, $11, $13, $33, $31, $11, $11, $33, $31, $11, $13, $33, $33, $31, $11, $13, $33, $22, $23, $33, $32, $22, $22, $55, $32, $22, $25, $33, $33, $22, $22, $33, + $31, $11, $11, $33, $33, $11, $13, $33, $33, $11, $13, $33, $33, $31, $11, $33, $32, $22, $22, $33, $33, $22, $25, $53, $33, $22, $25, $33, $33, $22, $25, $53, + $11, $11, $11, $13, $33, $31, $33, $33, $33, $31, $13, $33, $33, $31, $13, $33, $22, $22, $22, $23, $33, $32, $55, $33, $33, $32, $25, $33, $33, $22, $55, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $13, $33, $33, $31, $33, $33, $35, $55, $55, $55, $33, $33, $53, $33, $33, $33, $25, $33, $33, $25, $53, $33, + $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $33, $35, $33, $33, $35, $33, $33 + ); + + + +procedure fpgCreateStandardImages; +var + img : TfpgImage; +begin + // system images. Change these to the composite arrow bmp that includes + // disabled state + img := fpgImages.AddBMP( + 'sys.sb.up', + @stdimg_arrow_up, + sizeof(stdimg_arrow_up) ); + + img := fpgImages.AddBMP( + 'sys.sb.down', + @stdimg_arrow_down, + sizeof(stdimg_arrow_down) ); + + img := fpgImages.AddBMP( + 'sys.sb.left', + @stdimg_arrow_left, + sizeof(stdimg_arrow_left) ); + + img := fpgImages.AddBMP( + 'sys.sb.right', + @stdimg_arrow_right, + sizeof(stdimg_arrow_right) ); + + // Add RadioButton, CheckBox images as well. + + + // General purpose images: + img := fpgImages.AddMaskedBMP( + 'stdimg.ok', + @stdimg_btn_ok_16, + sizeof(stdimg_btn_ok_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.cancel', + @stdimg_btn_cancel_16, + sizeof(stdimg_btn_cancel_16), 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.yes', + @stdimg_choice_yes_16, + sizeof(stdimg_choice_yes_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.no', + @stdimg_choice_no_16, + sizeof(stdimg_choice_no_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.close', + @stdimg_btn_close_16, + sizeof(stdimg_btn_close_16), 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.quit', + @stdimg_menu_quit_16, + sizeof(stdimg_menu_quit_16), 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.exit', + @stdimg_menu_exit_16, + sizeof(stdimg_menu_exit_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.configure', + @stdimg_menu_preferences_16, + sizeof(stdimg_menu_preferences_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.document', + @stdimg_document, + sizeof(stdimg_document), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.search', + @stdimg_search_16, + sizeof(stdimg_search_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.refresh', + @stdimg_refresh_16, + sizeof(stdimg_refresh_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.font', + @stdimg_font_16, + sizeof(stdimg_font_16), + 15,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.copy', + @stdimg_edit_copy_16, + sizeof(stdimg_edit_copy_16), + 15,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.cut', + @stdimg_edit_cut_16, + sizeof(stdimg_edit_cut_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.paste', + @stdimg_edit_paste_16, + sizeof(stdimg_edit_paste_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.delete', + @stdimg_edit_delete_16, + sizeof(stdimg_edit_delete_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.edit', + @stdimg_edit, + sizeof(stdimg_edit), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.folder', + @stdimg_folder_16, + sizeof(stdimg_folder_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.foldernew', + @stdimg_folder_new_16, + sizeof(stdimg_folder_new_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.folderopen', + @stdimg_folder_open_16, + sizeof(stdimg_folder_open_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.folderup', + @stdimg_folder_up_16, + sizeof(stdimg_folder_up_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.open', + @stdimg_folder_open_16, + sizeof(stdimg_folder_open_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.save', + @stdimg_menu_save_16, + sizeof(stdimg_menu_save_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.saveas', + @stdimg_menu_saveas_16, + sizeof(stdimg_menu_saveas_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.saveall', + @stdimg_menu_save_all_16, + sizeof(stdimg_menu_save_all_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.help', + @stdimg_help_16, + sizeof(stdimg_help_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.hidden', + @stdimg_hidden, + sizeof(stdimg_hidden), + 0,0 ); + + img := fpgImages.AddBMP( + 'stdimg.link', + @stdimg_link, + sizeof(stdimg_link) + ); + img := fpgImages.AddMaskedBMP( + 'stdimg.add', + @stdimg_list_add_16, + sizeof(stdimg_list_add_16), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.remove', + @stdimg_list_remove_16, + sizeof(stdimg_list_remove_16), + 0,0 ); + + + // Dialog icons + img := fpgImages.AddMaskedBMP( + 'stdimg.dlg.help', + @stdimg_dialog_confirmation_32, + sizeof(stdimg_dialog_confirmation_32), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.dlg.info', + @stdimg_dialog_information_32, + sizeof(stdimg_dialog_information_32), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.dlg.warning', + @stdimg_dialog_warning_32, + sizeof(stdimg_dialog_warning_32), + 0,0 ); + + img := fpgImages.AddMaskedBMP( + 'stdimg.dlg.critical', + @stdimg_dialog_error_32, + sizeof(stdimg_dialog_error_32), + 0,0 ); + +{ + Here is a template for more images + + img := fpgImages.AddMaskedBMP( + 'stdimg.', + @stdimg_, + sizeof(stdimg_), 0,0 ); +} +end; + +end. + diff --git a/prototypes/fpgui2/source/core/gfx_utf8utils.pas b/prototypes/fpgui2/source/core/gfx_utf8utils.pas new file mode 100644 index 00000000..6734a9d5 --- /dev/null +++ b/prototypes/fpgui2/source/core/gfx_utf8utils.pas @@ -0,0 +1,142 @@ +{ + Some handly UTF8 function copied from the Lazarus LCL. Surely we can move + this into FPC? +} +unit gfx_UTF8utils; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + + +function UTF8Pos(const SearchForText, SearchInText: string): integer; +function UTF8Copy(const s: string; StartCharIndex, CharCount: integer): string; +function UTF8Length(const s: string): integer; +function UTF8Length(p: PChar; ByteCount: integer): integer; +function UTF8CharStart(UTF8Str: PChar; Len, Index: integer): PChar; +function UTF8CharacterLength(p: PChar): integer; + +{$Note I believe we need a UTF8Delete and UTF8Insert as well. } + + +implementation + +// returns the character index, where the SearchForText starts in SearchInText +function UTF8Pos(const SearchForText, SearchInText: string): integer; +var + p: LongInt; +begin + p:=System.Pos(SearchForText,SearchInText); + if p>0 then + Result:=UTF8Length(PChar(SearchInText),p-1)+1 + else + Result:=0; +end; + +// returns substring +function UTF8Copy(const s: string; StartCharIndex, CharCount: integer): string; +var + StartBytePos: PChar; + EndBytePos: PChar; + MaxBytes: PtrInt; +begin + StartBytePos:=UTF8CharStart(PChar(s),length(s),StartCharIndex-1); + if StartBytePos=nil then + Result:='' + else + begin + MaxBytes:=PtrInt(PChar(s)+length(s)-StartBytePos); + EndBytePos:=UTF8CharStart(StartBytePos,MaxBytes,CharCount); + if EndBytePos=nil then + Result:=copy(s,StartBytePos-PChar(s)+1,MaxBytes) + else + Result:=copy(s,StartBytePos-PChar(s)+1,EndBytePos-StartBytePos); + end; +end; + +function UTF8Length(const s: string): integer; +begin + Result := UTF8Length(PChar(s),length(s)); +end; + +function UTF8Length(p: PChar; ByteCount: integer): integer; +var + CharLen: LongInt; +begin + Result:=0; + while (ByteCount>0) do + begin + inc(Result); + CharLen:=UTF8CharacterLength(p); + inc(p,CharLen); + dec(ByteCount,CharLen); + end; +end; + +function UTF8CharStart(UTF8Str: PChar; Len, Index: integer): PChar; +var + CharLen: LongInt; +begin + Result:=UTF8Str; + if Result<>nil then + begin + while (Index>0) and (Len>0) do + begin + CharLen:=UTF8CharacterLength(Result); + dec(Len,CharLen); + dec(Index); + inc(Result,CharLen); + end; + if (Index>0) or (Len<0) then + Result:=nil; + end; +end; + +function UTF8CharacterLength(p: PChar): integer; +begin + if p<>nil then + begin + if ord(p^)< %11000000 then + begin + // regular single byte character (#0 is a character, this is pascal ;) + Result:=1; + end + else if ((ord(p^) and %11100000) = %11000000) then + begin + // could be 2 byte character + if (ord(p[1]) and %11000000) = %10000000 then + Result:=2 + else + Result:=1; + end + else if ((ord(p^) and %11110000) = %11100000) then + begin + // could be 3 byte character + if ((ord(p[1]) and %11000000) = %10000000) + and ((ord(p[2]) and %11000000) = %10000000) then + Result:=3 + else + Result:=1; + end + else if ((ord(p^) and %11111000) = %11110000) then + begin + // could be 4 byte character + if ((ord(p[1]) and %11000000) = %10000000) + and ((ord(p[2]) and %11000000) = %10000000) + and ((ord(p[3]) and %11000000) = %10000000) then + Result:=4 + else + Result:=1; + end + else + Result:=1; + end + else + Result:=0; +end; + +end. + diff --git a/prototypes/fpgui2/source/core/gfx_widget.pas b/prototypes/fpgui2/source/core/gfx_widget.pas new file mode 100644 index 00000000..22cd85f3 --- /dev/null +++ b/prototypes/fpgui2/source/core/gfx_widget.pas @@ -0,0 +1,770 @@ +unit gfx_widget; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + fpgfx, + gfxbase; + +type + TFocusSearchDirection = (fsdFirst, fsdLast, fsdNext, fsdPrev); + + { TfpgWidget } + + TfpgWidget = class(TfpgWindow) + private + FAlignRect: TfpgRect; + FOnScreen: boolean; + procedure SetActiveWidget(const AValue: TfpgWidget); + procedure SetEnabled(const AValue: boolean); + procedure SetVisible(const AValue: boolean); + protected + FParent: TfpgWidget; + FVisible: boolean; + FEnabled: boolean; + FFocusable: boolean; + FFocused: boolean; + FTabOrder: integer; + FAnchors: TAnchors; + FActiveWidget: TfpgWidget; + FAlign: TAlign; + procedure DoAlign(aalign: TAlign); + procedure HandlePaint; virtual; + procedure HandleResize(awidth, aheight: TfpgCoord); virtual; + procedure HandleMove(x, y: TfpgCoord); virtual; + procedure HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); virtual; + procedure HandleKeyPress(var keycode: word; var shiftstate: word; var consumed: boolean); virtual; + procedure HandleKeyRelease(var keycode: word; var shiftstate: word; var consumed: boolean); virtual; + procedure HandleSetFocus; virtual; + procedure HandleKillFocus; virtual; + procedure HandleLMouseDown(x, y: integer; shiftstate: word); virtual; + procedure HandleRMouseDown(x, y: integer; shiftstate: word); virtual; + procedure HandleLMouseUp(x, y: integer; shiftstate: word); virtual; + procedure HandleRMouseUp(x, y: integer; shiftstate: word); virtual; + procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: word); virtual; + procedure HandleDoubleClick(x, y: integer; button: word; shiftstate: word); virtual; + procedure HandleMouseEnter; virtual; + procedure HandleMouseExit; virtual; + function FindFocusWidget(startwg: TfpgWidget; direction: TFocusSearchDirection): TfpgWidget; + procedure HandleAlignments(dwidth, dheight: TfpgCoord); virtual; + procedure HandleShow; virtual; + procedure HandleHide; virtual; + procedure MoveAndResize(aleft, atop, awidth, aheight: TfpgCoord); + procedure MoveAndResizeBy(dx, dy, dw, dh: TfpgCoord); + procedure SetPosition(aleft, atop, awidth, aheight: TfpgCoord); + procedure RePaint; + public + constructor Create(aowner: TComponent); override; + destructor Destroy; override; + procedure MsgPaint(var msg: TfpgMessageRec); message FPGM_PAINT; + procedure MsgResize(var msg: TfpgMessageRec); message FPGM_RESIZE; + procedure MsgMove(var msg: TfpgMessageRec); message FPGM_MOVE; + procedure MsgKeyChar(var msg: TfpgMessageRec); message FPGM_KEYCHAR; + procedure MsgKeyPress(var msg: TfpgMessageRec); message FPGM_KEYPRESS; + procedure MsgKeyRelease(var msg: TfpgMessageRec); message FPGM_KEYRELEASE; + procedure MsgMouseDown(var msg: TfpgMessageRec); message FPGM_MOUSEDOWN; + procedure MsgMouseUp(var msg: TfpgMessageRec); message FPGM_MOUSEUP; + procedure MsgMouseMove(var msg: TfpgMessageRec); message FPGM_MOUSEMOVE; + procedure MsgDoubleClick(var msg: TfpgMessageRec); message FPGM_DOUBLECLICK; + procedure MsgMouseEnter(var msg: TfpgMessageRec); message FPGM_MOUSEENTER; + procedure MsgMouseExit(var msg: TfpgMessageRec); message FPGM_MOUSEEXIT; + OnKeyPress: TKeyPressNotifyEvent; + procedure SetFocus; + procedure KillFocus; + property Parent: TfpgWidget read FParent write FParent; + property ActiveWidget: TfpgWidget read FActiveWidget write SetActiveWidget; + property Visible: boolean read FVisible write SetVisible; + property Enabled: boolean read FEnabled write SetEnabled; + property TabOrder: integer read FTabOrder write FTabOrder; + property Focusable: boolean read FFocusable write FFocusable; + property Focused: boolean read FFocused write FFocused; + property Anchors: TAnchors read FAnchors write FAnchors; + property Align: TAlign read FAlign write FAlign; + end; + + +var + FocusRootWidget: TfpgWidget; + + +function FindKeyboardFocus: TfpgWidget; + +implementation + +function FindKeyboardFocus: TfpgWidget; +begin + Result := nil; + + if FocusRootWidget <> nil then + begin + Result := FocusRootWidget; + while (Result <> nil) and (Result.ActiveWidget <> nil) do + Result := Result.ActiveWidget; + end; +end; + + +{ TfpgWidget } + +procedure TfpgWidget.SetEnabled(const AValue: boolean); +begin + if FEnabled = AValue then + Exit; + FEnabled := AValue; + RePaint; +end; + +procedure TfpgWidget.SetActiveWidget(const AValue: TfpgWidget); +begin + if FActiveWidget = AValue then + Exit; + + if FActiveWidget <> nil then + FActiveWidget.HandleKillFocus; + FActiveWidget := AValue; + if FActiveWidget <> nil then + FActiveWidget.HandleSetFocus; +end; + +procedure TfpgWidget.SetVisible(const AValue: boolean); +begin + if FVisible = AValue then + Exit; + FVisible := AValue; + + if FOnScreen then + if FVisible then + HandleShow + else + begin + HandleHide; + FOnScreen := True; + end; +end; + +constructor TfpgWidget.Create(aowner: TComponent); +begin + FOnScreen := False; + FVisible := True; + FActiveWidget := nil; + FEnabled := True; + FFocusable := False; + FFocused := False; + FTabOrder := 0; + FAnchors := [anLeft, anTop]; + FAlign := alNone; + OnKeyPress := nil; + + if (aowner <> nil) and (aowner is TfpgWidget) then + FParent := TfpgWidget(aowner) + else + FParent := nil; + + if FParent <> nil then + FWindowType := wtChild; + + inherited; +end; + +destructor TfpgWidget.Destroy; +begin + HandleHide; + inherited; +end; + +procedure TfpgWidget.MsgPaint(var msg: TfpgMessageRec); +begin + HandlePaint; +end; + +procedure TfpgWidget.MsgKeyChar(var msg: TfpgMessageRec); +var + key, ss: word; + consumed: boolean; + wg: TfpgWidget; +begin + key := msg.params.keyboard.keycode; + ss := msg.params.keyboard.shiftstate; + + consumed := False; + HandleKeyChar(key, ss, consumed); + + if not consumed then + begin + wg := Parent; + while (not consumed) and (wg <> nil) do + begin + wg.HandleKeyChar(key, ss, consumed); + wg := wg.Parent; + end; + end; +end; + +procedure TfpgWidget.MsgKeyPress(var msg: TfpgMessageRec); +var + key, ss: word; + consumed: boolean; + wg: TfpgWidget; +begin + key := msg.params.keyboard.keycode; + ss := msg.params.keyboard.shiftstate; + consumed := False; + + HandleKeyPress(key, ss, consumed); + if not consumed then + begin + wg := Parent; + while (not consumed) and (wg <> nil) do + begin + wg.HandleKeyPress(key, ss, consumed); + wg := wg.Parent; + end; + end; +end; + +procedure TfpgWidget.MsgKeyRelease(var msg: TfpgMessageRec); +var + key, ss: word; + consumed: boolean; + wg: TfpgWidget; +begin + key := msg.params.keyboard.keycode; + ss := msg.params.keyboard.shiftstate; + consumed := False; + + HandleKeyRelease(key, ss, consumed); + if not consumed then + begin + wg := Parent; + while (not consumed) and (wg <> nil) do + begin + wg.HandleKeyRelease(key, ss, consumed); + wg := wg.Parent; + end; + end; +end; + +procedure TfpgWidget.MsgMouseDown(var msg: TfpgMessageRec); +begin + case msg.Params.mouse.Buttons of + MOUSE_LEFT: + HandleLMouseDown(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate); + MOUSE_RIGHT: + HandleRMouseDown(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate); + end; +end; + +procedure TfpgWidget.MsgMouseUp(var msg: TfpgMessageRec); +begin + case msg.Params.mouse.Buttons of + MOUSE_LEFT: + HandleLMouseUp(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate); + MOUSE_RIGHT: + HandleRMouseUp(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.shiftstate); + end; +end; + +procedure TfpgWidget.MsgMouseMove(var msg: TfpgMessageRec); +begin + HandleMouseMove(msg.Params.mouse.x, msg.Params.mouse.y, msg.Params.mouse.Buttons, msg.Params.mouse.shiftstate); +end; + +procedure TfpgWidget.MsgDoubleClick(var msg: TfpgMessageRec); +begin + // +end; + +procedure TfpgWidget.MsgMouseEnter(var msg: TfpgMessageRec); +begin + HandleMouseEnter; +end; + +procedure TfpgWidget.MsgMouseExit(var msg: TfpgMessageRec); +begin + HandleMouseExit; +end; + +procedure TfpgWidget.HandleShow; +var + n: integer; + c: TComponent; +begin + FOnScreen := True; + if FVisible then + begin + FParentWindow := FParent; + AllocateWindowHandle; + + for n := 0 to ComponentCount - 1 do + begin + c := Components[n]; + if (c is TfpgWidget) and (TfpgWidget(c).Parent = self) then + TfpgWidget(c).HandleShow; + end; + end; +end; + +procedure TfpgWidget.HandleHide; +var + n: integer; + c: TComponent; +begin + for n := 0 to ComponentCount - 1 do + begin + c := Components[n]; + if (c is TfpgWidget) and (TfpgWidget(c).Parent = self) then + TfpgWidget(c).HandleHide; + end; + FOnScreen := False; + + ReleaseWindowHandle; +end; + +procedure TfpgWidget.RePaint; +begin + if HasHandle then + HandlePaint; +end; + +procedure TfpgWidget.SetFocus; +begin + HandleSetFocus; +end; + +procedure TfpgWidget.KillFocus; +begin + HandleKillFocus; +end; + +procedure TfpgWidget.HandlePaint; +begin + // descendants will implement this. +end; + +procedure TfpgWidget.HandleKeyPress(var keycode, shiftstate: word; var consumed: boolean); +begin + // descendants will implement this. +end; + +procedure TfpgWidget.HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); +var + wg: TfpgWidget; + dir: integer; +begin + if Assigned(OnKeyPress) then + OnKeyPress(self, keycode, shiftstate, consumed); + + if consumed then + Exit; + + dir := 0; + + case keycode of + KEY_TAB: + if (shiftstate and ss_shift) <> 0 then + dir := -1 + else + dir := 1; + + KEY_ENTER, + KEY_DOWN, + KEY_RIGHT: + dir := 1; + + KEY_UP, + KEY_LEFT: + dir := -1; + end; + + if dir = 1 then + begin + // forward + wg := FindFocusWidget(ActiveWidget, fsdNext); + ActiveWidget := wg; + if wg <> nil then + consumed := True + else + begin + if Parent = nil then + begin + wg := FindFocusWidget(ActiveWidget, fsdFirst); + ActiveWidget := wg; + consumed := True; + end; + end; + end + else if dir = -1 then + begin + // backward + wg := FindFocusWidget(ActiveWidget, fsdPrev); + ActiveWidget := wg; + if wg <> nil then + begin + consumed := True; + // we must find the last one! + while wg <> nil do + begin + wg.ActiveWidget := wg.FindFocusWidget(ActiveWidget, fsdLast); + wg := wg.ActiveWidget; + end; + end + else if Parent = nil then + begin + wg := FindFocusWidget(ActiveWidget, fsdLast); + ActiveWidget := wg; + consumed := True; + end; + end; +end; + +procedure TfpgWidget.HandleKeyRelease(var keycode: word; var shiftstate: word; var consumed: boolean); +begin + // nothing yet. +end; + +procedure TfpgWidget.HandleSetFocus; +var + awg: TfpgWidget; +begin + if not FFocused then + begin + FFocused := True; + RePaint; + // focusing a child + if ActiveWidget <> nil then + ActiveWidget.SetFocus + else + begin + // try to find it for the first time. + awg := FindFocusWidget(nil, fsdFirst); + if awg <> nil then + ActiveWidget := awg; + end; + end; + + if Parent <> nil then + begin + Parent.ActiveWidget := self; + Parent.SetFocus; + end; +end; + +procedure TfpgWidget.HandleKillFocus; +begin + FFocused := False; + RePaint; + + if ActiveWidget <> nil then + ActiveWidget.KillFocus; +end; + +procedure TfpgWidget.HandleLMouseDown(x, y: integer; shiftstate: word); +var + pw: TfpgWidget; + w: TfpgWidget; +begin + // setting the focus through all parents + pw := Parent; + w := self; + while pw <> nil do + begin + if w.Visible and w.Enabled and w.Focusable then + pw.ActiveWidget := w; + w := pw; + pw := pw.Parent; + end; +end; + +procedure TfpgWidget.HandleRMouseDown(x, y: integer; shiftstate: word); +begin + +end; + +procedure TfpgWidget.HandleLMouseUp(x, y: integer; shiftstate: word); +begin + +end; + +procedure TfpgWidget.HandleRMouseUp(x, y: integer; shiftstate: word); +begin + +end; + +procedure TfpgWidget.HandleMouseMove(x, y: integer; btnstate: word; shiftstate: word); +begin + +end; + +procedure TfpgWidget.HandleDoubleClick(x, y: integer; button: word; shiftstate: word); +begin + +end; + +procedure TfpgWidget.HandleMouseEnter; +begin + +end; + +procedure TfpgWidget.HandleMouseExit; +begin + +end; + +function TfpgWidget.FindFocusWidget(startwg: TfpgWidget; direction: TFocusSearchDirection): TfpgWidget; +var + w: TfpgWidget; + n: integer; + FoundIt: boolean; + lasttaborder: integer; +begin + Result := nil; + FoundIt := False; + if direction in [fsdLast, fsdPrev] then + lasttaborder := -999999 + else + lasttaborder := 999999; + + for n := 0 to ComponentCount - 1 do + if Components[n] is TfpgWidget then + begin + w := TfpgWidget(Components[n]); + + if w.Visible and w.Enabled and w.Focusable then + case direction of + fsdFirst: + if w.TabOrder < lasttaborder then + begin + Result := w; + lasttaborder := w.TabOrder; + end; + + fsdLast: + if lasttaborder <= w.TabOrder then + begin + Result := w; + lasttaborder := w.TabOrder; + end; + + fsdNext: + if startwg = w then + FoundIt := True + else if w.TabOrder < lasttaborder then + if (startwg = nil) or + (w.TabOrder > startwg.TabOrder) or + (FoundIt and (w.TabOrder = startwg.TabOrder)) then + begin + Result := w; + lasttaborder := w.TabOrder; + end; + + fsdPrev: + if startwg = w then + FoundIt := True + else if w.TabOrder >= lasttaborder then + if (startwg = nil) or + (w.TabOrder < startwg.TabOrder) or + (not FoundIt and (w.TabOrder = startwg.TabOrder)) then + begin + Result := w; + lasttaborder := w.TabOrder; + end; + + end; + end; +end; + +procedure TfpgWidget.MsgResize(var msg: TfpgMessageRec); +begin + HandleResize(msg.Params.rect.Width, msg.params.rect.Height); +end; + +procedure TfpgWidget.HandleResize(awidth, aheight: TfpgCoord); +var + dw: integer; + dh: integer; +begin + dw := awidth - FWidth; + dh := aheight - FHeight; + FWidth := awidth; + FHeight := aheight; + HandleAlignments(dw, dh); +end; + +procedure TfpgWidget.MsgMove(var msg: TfpgMessageRec); +begin + HandleMove(msg.Params.rect.left, msg.Params.rect.top); +end; + +procedure TfpgWidget.HandleMove(x, y: TfpgCoord); +begin + FLeft := x; + FTop := y; +end; + +procedure TfpgWidget.HandleAlignments(dwidth, dheight: TfpgCoord); +var + n: integer; + wg: TfpgWidget; + dx: integer; + dy: integer; + dw: integer; + dh: integer; +begin + FAlignRect.top := 0; + FAlignRect.Left := 0; + FAlignRect.Width := Width; + FAlignRect.Height := Height; + + DoAlign(alTop); + DoAlign(alBottom); + DoAlign(alLeft); + DoAlign(alRight); + DoAlign(alClient); + + // handle anchors finally for alNone + for n := 0 to ComponentCount - 1 do + if (Components[n] is TfpgWidget) then + begin + wg := TfpgWidget(Components[n]); + + if (wg.FAlign = alNone) and + (anBottom in wg.Anchors) or (anRight in wg.Anchors) then + begin + // we must alter the window + dx := 0; + dy := 0; + dw := 0; + dh := 0; + + if (anLeft in wg.Anchors) and (anRight in wg.Anchors) then + dw := dwidth + else if anRight in wg.Anchors then + dx := dwidth; + + if (anTop in wg.Anchors) and (anBottom in wg.Anchors) then + dh := dheight + else if anBottom in wg.Anchors then + dy := dheight; + + wg.MoveAndResizeBy(dx, dy, dw, dh); + end; + end; + + RePaint; +end; + +procedure TfpgWidget.MoveAndResize(aleft, atop, awidth, aheight: TfpgCoord); +begin + if (aleft <> FLeft) or (atop <> FTop) then + HandleMove(aleft, atop); + if (awidth <> FWidth) or (aheight <> FHeight) then + HandleResize(awidth, aheight); + + UpdateWindowPosition; +end; + +procedure TfpgWidget.MoveAndResizeBy(dx, dy, dw, dh: TfpgCoord); +begin + if (dx <> 0) or (dy <> 0) or + (dw <> 0) or (dh <> 0) then + MoveAndResize(FLeft + dx, FTop + dy, FWidth + dw, FHeight + dh); +end; + +function CompareInts(i1, i2: integer): integer; +begin + if i1 < i2 then + Result := -1 + else if i1 > i2 then + Result := 1 + else + Result := 0; +end; + +function AlignCompare(p1, p2: Pointer): integer; +var + w1: TfpgWidget; + w2: TfpgWidget; +begin + w1 := TfpgWidget(p1); + w2 := TfpgWidget(p2); + case w1.Align of + alTop: Result := CompareInts(w1.Top, w2.Top); + alBottom: Result := CompareInts(w2.Top, w1.Top); + alLeft: Result := CompareInts(w1.Left, w2.Left); + alRight: Result := CompareInts(w2.Left, w1.Left); + else + Result := 0; + end; +end; + +procedure TfpgWidget.DoAlign(aalign: TAlign); +var + alist: TList; + w: TfpgWidget; + n: integer; +begin + alist := TList.Create; + for n := 0 to ComponentCount - 1 do + if Components[n] is TfpgWidget then + begin + w := TfpgWidget(Components[n]); + if w.Align = aalign then + alist.Add(w); + end; + + alist.Sort(@AlignCompare); + + // and process this list in order + for n := 0 to alist.Count - 1 do + begin + w := TfpgWidget(alist[n]); + case aalign of + alTop: + begin + w.MoveAndResize(FAlignRect.Left, FAlignRect.Top, FAlignRect.Width, w.Height); + Inc(FAlignRect.top, w.Height); + Dec(FAlignRect.Height, w.Height); + end; + + alBottom: + begin + w.MoveAndResize(FAlignRect.Left, FAlignRect.Top + FAlignRect.Height - w.Height, FAlignRect.Width, w.Height); + Dec(FAlignRect.Height, w.Height); + end; + + alLeft: + begin + w.MoveAndResize(FAlignRect.Left, FAlignRect.Top, w.Width, FAlignRect.Height); + Inc(FAlignRect.Left, w.Width); + Dec(FAlignRect.Width, w.Width); + end; + + alRight: + begin + w.MoveAndResize(FAlignRect.Left + FAlignRect.Width - w.Width, FAlignRect.Top, w.Width, FAlignRect.Height); + Dec(FAlignRect.Width, w.Width); + end; + + alClient: + w.MoveAndResize(FAlignRect.Left, FAlignRect.Top, FAlignRect.Width, FAlignRect.Height); + end; { case } + end; + + alist.Free; +end; + +procedure TfpgWidget.SetPosition(aleft, atop, awidth, aheight: TfpgCoord); +begin + MoveAndResize(aleft, atop, awidth, aheight); +end; + + +initialization + FocusRootWidget := nil; + +end. + diff --git a/prototypes/fpgui2/source/core/gfxbase.pas b/prototypes/fpgui2/source/core/gfxbase.pas new file mode 100644 index 00000000..00e72e84 --- /dev/null +++ b/prototypes/fpgui2/source/core/gfxbase.pas @@ -0,0 +1,271 @@ +unit gfxbase; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils; + +type + TfpgCoord = integer; // we might use floating point coordinates in the future... + TfpgColor = longword; + +type + TWindowType = (wtChild, wtWindow, wtModalForm, wtPopup); + + TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos); + TWindowAttributes = set of TWindowAttribute; + + TMouseCursor = (mcDefault, mcArrow, mcCross, mcIBeam, mcSizeEW, mcSizeNS, + mcSizeNWSE, mcSizeNESW, mcMove, mcHourGlass); + +const + MOUSE_LEFT = 1; + MOUSE_RIGHT = 2; + MOUSE_MIDDLE = 4; + + + ss_Shift = $0001; + ss_Control = $0004; + ss_Alt = $0008; + ss_CapsLock = $0002; + ss_NumLock = $0010; + ss_ScrollLock = $0080; + + // Platform independent messages used by fpGUI (TfpgWidget) + FPGM_PAINT = 1; + FPGM_ACTIVATE = 2; + FPGM_DEACTIVATE = 3; + FPGM_KEYPRESS = 4; + FPGM_KEYRELEASE = 5; + FPGM_KEYCHAR = 6; + FPGM_MOUSEDOWN = 7; + FPGM_MOUSEUP = 8; + FPGM_MOUSEMOVE = 9; + FPGM_DOUBLECLICK = 10; + FPGM_MOUSEENTER = 11; + FPGM_MOUSEEXIT = 12; + FPGM_CLOSE = 13; + FPGM_SCROLL = 14; + FPGM_RESIZE = 15; + FPGM_MOVE = 16; + FPGM_POPUPCLOSE = 17; + FPGM_KILLME = 9999; + + + // The special keys, based on the well-known keyboard scan codes + KEY_LEFT = $FF4B; + KEY_RIGHT = $FF4D; + KEY_DOWN = $FF50; + KEY_UP = $FF48; + KEY_END = $FF4F; + KEY_HOME = $FF47; + KEY_PGUP = $FF49; + KEY_PGDN = $FF51; + KEY_INSERT = $FF52; + KEY_DELETE = $FF53; + KEY_F1 = $FF3B; + KEY_F2 = KEY_F1 + 1; + KEY_F3 = KEY_F1 + 2; + KEY_F4 = KEY_F1 + 3; + KEY_F5 = KEY_F1 + 4; + KEY_F6 = KEY_F1 + 5; + KEY_F7 = KEY_F1 + 6; + KEY_F8 = KEY_F1 + 7; + KEY_F9 = KEY_F1 + 8; + KEY_F10 = KEY_F1 + 9; + KEY_F11 = $FF57; + KEY_F12 = $FF58; + // some general keys + KEY_TAB = $0009; + KEY_ENTER = $000D; + KEY_SPACE = $0020; + KEY_ESC = $001B; + KEY_BACKSPACE = $0008; + + + // scan codes for KeyPress/KeyRelease + KEYSC_ENTER = $1C; + KEYSC_SPACE = $39; + +type + TfpgRect = object // not class for static allocations + Top: TfpgCoord; + Left: TfpgCoord; + Width: TfpgCoord; + Height: TfpgCoord; + procedure SetRect(aleft, atop, awidth, aheight: TfpgCoord); + function Bottom: TfpgCoord; + function Right: TfpgCoord; + procedure SetBottom(Value: TfpgCoord); + procedure SetRight(Value: TfpgCoord); + end; + +type + TfpgMsgParmMouse = record + x: TfpgCoord; + y: TfpgCoord; + Buttons: word; + shiftstate: word; + end; + + TfpgMsgParmKeyboard = record + keycode: word; + shiftstate: word; + end; + + TfpgMessageParams = record + case integer of + 0: (mouse: TfpgMsgParmMouse); + 1: (keyboard: TfpgMsgParmKeyboard); + 2: (rect: TfpgRect); + end; + + TfpgMessageRec = record + MsgCode: integer; + Sender: TObject; + Dest: TObject; + Params: TfpgMessageParams; + end; + PfpgMessageRec = ^TfpgMessageRec; + +const + FPG_DEFAULT_FONT_DESC = 'Arial-10'; + +const + UserNamedColorStart = 128; + +// named color identifiers +const + clWindowBackground = $80000001; + clBoxColor = $80000002; + clButtonFace = $80000003; + clShadow1 = $80000004; + clShadow2 = $80000005; + clHilite1 = $80000006; + clHilite2 = $80000007; + clText1 = $80000008; + clText2 = $80000009; + clText3 = $8000000A; + clText4 = $8000000B; + clSelection = $8000000C; + clSelectionText = $8000000D; + clInactiveSel = $8000000E; + clInactiveSelText = $8000000F; + clScrollBar = $80000010; + clListBox = $80000011; + clGridLines = $80000012; + clGridHeader = $80000013; + clWidgetFrame = $80000014; + clInactiveWgFrame = $80000015; + clTextCursor = $80000016; + clChoiceListBox = $80000017; + clUnset = $80000018; + clMenuText = $80000019; + clMenuDisabled = $8000001A; + +type + TfpgLineStyle = (lsSolid, lsDash, lsDot); + + + TfpgImageBase = class(TObject) + end; + + + TfpgCanvasBase = class(TObject) + end; + + + TfpgFontResourceBase = class(TObject) + end; + + + TfpgFontBase = class(TObject) + end; + + + TfpgWindowBase = class(TComponent) + protected + FWindowType: TWindowType; + FWindowAttributes: TWindowAttributes; + FTop: TfpgCoord; + FLeft: TfpgCoord; + FWidth: TfpgCoord; + FHeight: TfpgCoord; + FMinWidth: TfpgCoord; + FMinHeight: TfpgCoord; + function HandleIsValid: boolean; virtual; abstract; + public + // make some setup before the window shows + procedure AdjustWindowStyle; virtual; // forms modify the window creation parameters + procedure SetWindowParameters; virtual; // invoked after the window is created + // general properties + property HasHandle: boolean read HandleIsValid; + property WindowType: TWindowType read FWindowType write FWindowType; + property WindowAttributes: TWindowAttributes read FWindowAttributes write FWindowAttributes; + property Left: TfpgCoord read FLeft write FLeft; + property Top: TfpgCoord read FTop write FTop; + property Width: TfpgCoord read FWidth write FWidth; + property Height: TfpgCoord read FHeight write FHeight; + property MinWidth: TfpgCoord read FMinWidth write FMinWidth; + property MinHeight: TfpgCoord read FMinHeight write FMinHeight; + end; + + + TfpgApplicationBase = class(TObject) + protected + FIsInitialized: Boolean; + public + constructor Create(const AParams: string); virtual; abstract; + property IsInitialized: boolean read FIsInitialized; + end; + + +implementation + +{ TfpgRect } + +procedure TfpgRect.SetRect(aleft, atop, awidth, aheight: TfpgCoord); +begin + Left := aleft; + Top := atop; + Width := awidth; + Height := aheight; +end; + +function TfpgRect.Bottom: TfpgCoord; +begin + Result := Top + Height - 1; +end; + +function TfpgRect.Right: TfpgCoord; +begin + Result := Left + Width - 1; +end; + +procedure TfpgRect.SetBottom(Value: TfpgCoord); +begin + Height := Value - Top + 1; +end; + +procedure TfpgRect.SetRight(Value: TfpgCoord); +begin + Width := Value - Left + 1; +end; + +{ TfpgWindowBase } + +procedure TfpgWindowBase.AdjustWindowStyle; +begin + // does nothing here +end; + +procedure TfpgWindowBase.SetWindowParameters; +begin + // does nothing +end; + +end. + diff --git a/prototypes/fpgui2/source/core/gfxbaseinterfaces.pas b/prototypes/fpgui2/source/core/gfxbaseinterfaces.pas new file mode 100644 index 00000000..1a3f28ff --- /dev/null +++ b/prototypes/fpgui2/source/core/gfxbaseinterfaces.pas @@ -0,0 +1,25 @@ +unit gfxbaseinterfaces; + +{$mode objfpc}{$H+} + +interface + +uses + Classes; + +type + // forward declarations + IGFXWindow = interface; + + + IGFXWindow = interface(IInterface) + ['{45964C7E-A7E9-4915-9EA1-3F26C5C55A2F}'] + procedure DoAllocateWindowHandle(AParent: IGFXWindow); + procedure DoSetWindowTitle(const ATitle: string); + end; + + +implementation + +end. + diff --git a/prototypes/fpgui2/source/core/stdimages.inc b/prototypes/fpgui2/source/core/stdimages.inc new file mode 100644 index 00000000..b195625c --- /dev/null +++ b/prototypes/fpgui2/source/core/stdimages.inc @@ -0,0 +1,2282 @@ + +Const + stdimg_list_add_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0,215, 13, 0, 0,215, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,182,132, + 93,164,101, 52,164,101, 52,182,132, 93,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,164,101, 52,230,206, + 183,230,206,183,164,101, 52,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,164,101, 52,230,206,183,217,173, + 134,164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,164,101, 52,230,206,183,217,173,134,164,101, + 52,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,182,132, 93,164,101, 52,164,101, 52, + 164,101, 52,164,101, 52,217,173,134,217,173,134,164,101, 52,164,101, + 52,164,101, 52,164,101, 52,182,132, 93,255,255,255,255,255,255,255, + 255,255,255,255,255,164,101, 52,229,204,180,219,183,149,219,182,148, + 218,180,146,218,179,144,217,173,134,216,170,131,215,168,127,215,166, + 125,224,190,159,164,101, 52,255,255,255,255,255,255,255,255,255,255, + 255,255,164,101, 52,232,211,192,231,209,187,231,209,188,230,206,183, + 230,206,183,230,206,183,230,206,183,230,205,182,230,204,181,230,204, + 182,164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,182, + 132, 93,164,101, 52,164,101, 52,164,101, 52,164,101, 52,230,206,183, + 230,206,183,164,101, 52,164,101, 52,164,101, 52,164,101, 52,182,132, + 93,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,164,101, 52,230,206,183,230,206,183, + 164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,164,101, 52,230,206,183,230,206,183,164,101, 52, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,164,101, 52,230,206,183,230,206,183,164,101, 52,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,182, + 132, 93,164,101, 52,164,101, 52,182,132, 93,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_menu_saveas_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,216,171,142,205,149,112,189,115, 66,183,104, 53,181,104, + 53,180,103, 52,178,102, 52,176,101, 51,174,100, 51,172, 99, 50,170, + 98, 50,169, 97, 50,168, 96, 49,167, 97, 50,171,105, 60,188,134, 97, + 195,125, 79,235,198,173,234,197,173,254,251,248,254,251,248,254,251, + 248,254,251,248,254,251,248,254,251,248,254,251,248,254,251,248,254, + 251,248,254,251,248,200,154,124,199,152,121,173,107, 64,186,108, 56, + 237,202,179,224,162,122,254,250,247, 98,192,136, 98,192,136, 98,192, + 136, 98,192,136, 98,192,136, 98,192,136, 98,192,136, 98,192,136,253, + 249,246,202,141,101,201,155,124,167, 97, 50,187,108, 56,238,204,182, + 225,162,122,254,250,247,191,220,194,191,220,194,191,220,194,191,220, + 194,191,220,194,191,220,194,191,220,194,191,220,194,253,249,246,205, + 144,104,204,158,129,168, 97, 50,187,107, 56,239,206,184,225,162,121, + 254,250,247, 98,192,136, 98,192,136,206,247,255, 41, 41, 41, 82, 82, + 82,206,247,255, 98,192,136, 98,192,136,253,249,246,207,147,106,206, + 163,132,170, 97, 50,186,106, 54,239,208,187,226,162,122,254,251,248, + 206,247,255,206,247,255,206,247,255,206,247,255,206,247,255,206,247, + 255,206,247,255,206,247,255,254,251,248,211,150,109,210,167,138,171, + 98, 50,187,106, 54,240,210,190,226,163,122,226,163,122,206,247,255, + 206,247,255,206,247,255, 41, 41, 41, 82, 82, 82,206,247,255,206,247, + 255,206,247,255,216,153,113,214,153,112,213,171,142,173, 99, 51,187, + 106, 54,242,213,194,227,163,122,208,242,250,206,247,255,206,247,255, + 206,247,255, 82, 82, 82, 41, 41, 41,132,156,165,206,247,255,206,247, + 255,210,247,254,217,155,115,218,176,149,175,100, 51,187,106, 54,242, + 216,197,227,164,123,181,238,254,181,239,255,181,239,255,181,239,255, + 181,239,255, 82, 82, 82, 41, 41, 41, 82, 82, 82,181,239,255,181,239, + 254,220,157,116,221,181,154,177,101, 52,187,107, 54,244,217,199,230, + 166,125,186,236,250,181,239,255, 41, 41, 41, 82, 82, 82,181,239,255, + 181,239,255, 41, 41, 41, 41, 41, 41,181,239,255,186,239,253,218,156, + 116,225,186,159,179,102, 52,187,108, 55,244,220,201,231,167,125,201, + 230,240,181,239,255, 41, 41, 41, 41, 41, 41,181,239,255,132,156,165, + 41, 41, 41, 41, 41, 41,181,239,255,201,239,249,222,160,119,228,190, + 164,180,103, 52,189,110, 58,245,221,204,231,168,126,250,240,232,181, + 239,255,132,156,165, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, 41, + 132,156,165,181,239,255,247,229,217,224,162,120,231,194,169,182,104, + 53,192,116, 66,246,223,208,232,168,126,252,246,241,198,242,246,148, + 247,255,148,247,255,148,247,255,148,247,255,148,247,255,148,247,255, + 184,228,232,247,230,219,225,163,122,239,213,195,183,106, 54,198,130, + 85,246,223,209,233,170,128,254,250,246,253,250,246,218,241,243,175, + 244,250,153,246,254,153,246,254,175,244,250,218,241,243,249,236,226, + 248,231,219,238,208,186,236,208,189,189,116, 67,214,165,133,246,224, + 209,247,224,209,254,251,248,254,251,247,253,249,246,252,245,240,250, + 240,234,251,242,237,253,249,246,253,250,247,251,241,235,248,233,223, + 236,209,190,205,146,106,226,197,177,225,189,166,217,171,141,201,137, + 94,192,117, 67,189,110, 58,187,108, 55,187,107, 54,187,106, 54,187, + 106, 54,188,108, 57,189,110, 59,187,109, 58,191,116, 68,201,141,101, + 231,206,188,255,255,255); + +Const + stdimg_help_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,236,227, + 220,192,161,139,164,117, 85,142, 85, 45,142, 85, 45,165,119, 87,193, + 161,139,236,227,220,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,254,254,253,198,169,149,147, 91, 53,203,175, + 155,229,214,203,248,244,241,249,245,242,232,219,209,211,186,167,149, + 94, 56,199,171,151,254,254,253,255,255,255,255,255,255,255,255,255, + 254,254,253,163,116, 84,175,134,105,243,237,233,221,201,186,199,165, + 139,187,145,113,193,153,121,213,183,159,233,218,205,248,243,239,183, + 145,117,166,120, 88,254,254,253,255,255,255,255,255,255,199,170,150, + 174,133,105,243,238,233,183,143,114,165,114, 76,179,135,101,255,255, + 255,255,255,255,193,151,116,197,155,120,215,185,160,249,245,241,180, + 140,112,199,171,151,255,255,255,236,227,220,146, 91, 52,242,235,230, + 177,135,105,157,103, 64,163,111, 73,178,132, 98,255,255,255,255,255, + 255,189,146,111,193,150,114,197,155,120,214,183,157,247,241,237,147, + 93, 54,236,227,220,192,161,139,195,166,145,211,188,173,148, 92, 51, + 154,100, 60,161,108, 69,169,120, 82,200,168,143,204,173,148,183,137, + 101,187,143,107,191,147,112,193,150,115,231,215,201,207,181,161,193, + 161,139,162,115, 83,221,204,192,175,134,106,145, 88, 47,151, 96, 56, + 157,103, 64,167,118, 81,228,212,200,229,214,202,180,134, 98,182,135, + 99,185,139,103,186,142,106,209,178,155,230,215,204,165,118, 86,141, + 83, 43,245,240,237,148, 94, 56,142, 83, 42,148, 91, 51,153, 98, 58, + 159,105, 66,243,237,232,255,255,255,208,181,160,176,127, 90,178,131, + 94,180,133, 96,189,148,117,248,243,240,142, 84, 45,141, 83, 43,245, + 240,237,147, 92, 54,138, 79, 37,144, 86, 45,149, 93, 52,154, 99, 59, + 181,139,109,252,251,249,254,254,254,193,157,130,172,122, 84,173,124, + 86,183,141,108,247,243,239,142, 84, 44,162,115, 83,221,204,192,172, + 130,101,135, 74, 32,139, 80, 39,144, 86, 45,149, 92, 52,153, 98, 58, + 194,161,137,255,255,255,243,236,232,165,114, 75,166,115, 77,195,161, + 134,225,210,198,164,117, 85,192,161,139,195,165,144,208,185,169,135, + 74, 32,135, 74, 32,159,110, 75,160,111, 77,148, 91, 50,168,122, 89, + 255,255,255,253,252,251,161,109, 70,159,106, 67,218,198,183,198,170, + 149,192,161,139,236,227,220,146, 92, 53,241,234,229,165,120, 88,135, + 74, 32,176,136,108,254,253,253,233,222,214,246,242,239,255,255,255, + 220,202,189,152, 96, 56,179,137,107,242,235,230,145, 91, 52,236,227, + 220,255,255,255,198,169,149,173,131,103,242,235,231,166,120, 89,156, + 105, 71,222,206,194,247,243,240,241,234,230,208,184,167,160,111, 77, + 173,130,100,243,237,232,171,128, 98,198,169,149,255,255,255,255,255, + 255,254,254,253,163,116, 84,170,127, 97,240,232,227,208,185,169,172, + 130,101,150, 96, 59,150, 96, 59,172,130,101,209,186,170,240,233,228, + 170,128, 98,163,116, 84,254,254,253,255,255,255,255,255,255,255,255, + 255,254,254,253,198,169,149,145, 91, 52,193,162,141,219,201,189,244, + 239,235,244,239,235,219,201,189,193,163,141,145, 90, 51,199,170,150, + 254,254,253,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,236,227,220,192,161,139,162,115, 83,141, 83, 43,141, + 83, 43,162,115, 83,192,161,139,236,227,220,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_dialog_error_32 : Array[0..3125] of byte = ( + 66, 77, 54, 12, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 32, 0, 0, 0, 32, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,254,254,254,249,249,249,242,242,242,233, + 233,233,225,225,225,219,219,219,213,213,213,208,208,208,204,204,204, + 208,208,208,211,211,211,216,216,216,222,222,222,229,229,229,239,239, + 239,247,247,247,252,252,252,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,245,245,245,231,231, + 231,219,219,219,208,208,208,198,198,198,187,187,187,178,178,178,169, + 169,169,162,162,162,156,156,156,153,153,153,154,154,154,157,157,157, + 162,162,162,170,170,170,179,179,179,189,189,189,199,199,199,209,209, + 209,222,222,222,239,239,239,252,252,252,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,245,245,245,233,233,233,220,220,220,208,208,208,195,195, + 195,183,183,183,159,159,170,102,102,164, 44, 44,169, 20, 20,172, 8, + 8,175, 2, 2,177, 7, 7,174, 19, 19,171, 40, 40,165, 96, 96,158, + 149,149,160,172,172,172,184,184,184,197,197,197,209,209,209,222,222, + 222,235,235,235,252,252,252,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,254,254, + 242,242,242,231,231,231,219,219,219,179,179,204, 60, 60,185, 6, 6, + 179, 16, 18,187, 25, 33,199, 39, 52,207, 49, 65,211, 57, 76,215, 48, + 65,210, 38, 50,203, 24, 32,197, 16, 17,184, 6, 6,178, 59, 59,182, + 171,171,196,209,209,209,221,221,221,232,232,232,244,244,244,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,250,250,253, + 101,101,208, 10, 10,182, 21, 26,196, 61, 78,218, 54, 70,218, 36, 46, + 211, 25, 30,207, 18, 22,205, 15, 17,203, 18, 22,203, 25, 30,205, 35, + 45,208, 52, 69,213, 55, 75,215, 21, 26,194, 9, 9,181,104,104,206, + 245,245,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,235,235,249, 51, 51,195, 17, 18,191, 59, 74,219, + 51, 64,218, 19, 21,209, 10, 10,206, 10, 10,205, 10, 10,205, 10, 10, + 204, 10, 10,203, 9, 9,203, 9, 9,202, 9, 9,201, 9, 9,200, 19, + 22,203, 47, 62,212, 53, 71,213, 15, 17,187, 54, 54,196,236,236,249, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,239,239,250, 27, + 27,187, 22, 26,198, 66, 82,225, 26, 31,214, 11, 11,210, 11, 11,209, + 11, 11,208, 11, 11,208, 10, 10,207, 10, 10,206, 10, 10,205, 10, 10, + 205, 10, 10,204, 10, 10,204, 9, 9,203, 9, 9,202, 9, 9,202, 24, + 30,206, 59, 78,217, 20, 24,193, 30, 30,188,240,240,250,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,252,252,254, 57, 57,197, 24, 27,202, 64, 78,226, 20, + 22,215, 12, 12,213, 12, 12,212, 12, 12,211, 11, 11,211, 11, 11,210, + 11, 11,209, 11, 11,209, 11, 11,208, 11, 11,207, 10, 10,207, 10, 10, + 206, 10, 10,205, 10, 10,204, 10, 10,204, 10, 10,203, 17, 20,205, 56, + 74,217, 21, 25,194, 60, 60,197,252,252,254,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,120,120, + 216, 19, 20,194, 68, 82,229, 19, 21,218, 13, 13,216, 13, 13,215, 12, + 12,214, 12, 12,214, 12, 12,213, 12, 12,212, 12, 12,211, 11, 11,211, + 11, 11,210, 11, 11,210, 11, 11,209, 11, 11,208, 11, 11,208, 10, 10, + 207, 10, 10,206, 10, 10,205, 10, 10,205, 17, 19,206, 60, 78,219, 18, + 19,191,124,124,217,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,230,230,247, 17, 17,187, 63, 75,228, 28, 31, + 222, 13, 13,219, 13, 13,218, 13, 13,217, 13, 13,216, 13, 13,216, 13, + 13,215, 12, 12,215, 12, 12,214, 12, 12,213, 12, 12,213, 12, 12,212, + 12, 12,211, 11, 11,210, 11, 11,210, 11, 11,209, 11, 11,208, 11, 11, + 208, 11, 11,207, 10, 10,207, 23, 28,210, 53, 69,217, 17, 17,185,232, + 232,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 91, 91,207, 28, 31,208, 53, 61,229, 14, 14,221, 14, 14,221, 14, 14, + 220, 14, 14,220, 14, 14,219, 13, 13,218, 13, 13,218, 13, 13,217, 13, + 13,216, 13, 13,215, 12, 12,215, 12, 12,214, 12, 12,214, 12, 12,213, + 12, 12,212, 12, 12,211, 11, 11,211, 11, 11,210, 11, 11,209, 11, 11, + 209, 11, 11,208, 47, 59,217, 23, 27,200, 94, 94,208,255,255,255,255, + 255,255,255,255,255,255,255,255,240,240,250, 10, 10,183, 70, 82,232, + 29, 30,227, 29, 29,226, 22, 22,224, 14, 14,223, 14, 14,222, 14, 14, + 221, 14, 14,220, 14, 14,220, 14, 14,219, 13, 13,219, 13, 13,218, 13, + 13,217, 13, 13,216, 13, 13,216, 13, 13,215, 12, 12,214, 12, 12,214, + 12, 12,213, 12, 12,213, 12, 12,212, 12, 12,211, 11, 11,210, 18, 21, + 212, 60, 77,222, 9, 10,182,242,242,251,255,255,255,255,255,255,255, + 255,255,166,166,228, 24, 25,197,104,111,238, 84, 84,235, 84, 84,234, + 84, 84,234, 72, 72,232, 51, 51,229, 25, 25,225, 15, 15,223, 14, 14, + 222, 14, 14,221, 14, 14,221, 14, 14,220, 14, 14,219, 13, 13,219, 13, + 13,218, 13, 13,218, 13, 13,217, 13, 13,216, 13, 13,215, 12, 12,215, + 12, 12,214, 12, 12,213, 12, 12,213, 12, 12,212, 58, 72,223, 20, 22, + 193,170,170,229,255,255,255,255,255,255,255,255,255, 78, 78,204, 55, + 58,217,103,107,240, 82, 82,236, 83, 83,236, 83, 83,236, 83, 83,235, + 82, 82,234, 81, 81,234, 58, 58,230, 26, 26,225, 15, 15,224, 15, 15, + 223, 14, 14,223, 14, 14,222, 14, 14,221, 14, 14,220, 14, 14,220, 14, + 14,219, 13, 13,218, 13, 13,218, 13, 13,217, 13, 13,216, 13, 13,216, + 13, 13,215, 12, 12,214, 40, 48,221, 28, 34,205, 82, 82,203,255,255, + 255,255,255,255,255,255,255, 38, 38,193, 88, 94,229, 93, 95,240, 80, + 80,237, 80, 80,237, 80, 80,237,243,243,243,243,243,243,243,243,243, + 243,243,243,243,243,243,241,241,241,239,239,239,239,239,239,239,239, + 239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239, + 239,239,239,239,239,239,239,239, 13, 13,218, 13, 13,217, 23, 23,218, + 51, 56,223, 46, 55,215, 40, 40,192,255,255,255,255,255,255,255,255, + 255, 16, 16,185,109,115,238, 87, 87,240, 79, 79,239, 79, 79,239, 79, + 79,238,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 243,243,243,243,243,243,240,240,240,239,239,239,239,239,239,239,239, + 239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239,239, + 239,239, 23, 23,221, 57, 57,226, 79, 79,229, 87, 89,229, 76, 87,225, + 19, 19,185,255,255,255,255,255,255,255,255,255, 3, 3,180,120,126, + 244, 81, 82,242, 77, 77,241, 77, 77,240, 77, 77,240,243,243,243,243, + 243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 243,243,243,241,241,241,239,239,239,239,239,239,239,239,239,239,239, + 239,239,239,239,239,239,239,239,239,239,241,241,241, 74, 74,231, 76, + 76,231, 76, 76,230, 82, 84,230, 97,110,233, 5, 5,180,255,255,255, + 255,255,255,255,255,255, 16, 16,185,103,108,239, 84, 85,244, 75, 75, + 243, 75, 75,242, 75, 75,241,243,243,243,243,243,243,243,243,243,243, + 243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 242,242,242,240,240,240,240,240,240,239,239,239,240,240,240,242,242, + 242,243,243,243,243,243,243, 75, 75,233, 75, 75,232, 75, 75,232, 83, + 85,233, 85, 95,228, 19, 19,186,255,255,255,255,255,255,255,255,255, + 37, 37,193, 82, 86,233, 87, 89,245, 73, 73,244, 73, 73,243, 74, 74, + 243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243,243, + 243, 73, 73,234, 72, 72,233, 73, 73,233, 87, 90,235, 69, 76,223, 40, + 40,193,255,255,255,255,255,255,255,255,255, 77, 77,205, 53, 56,223, + 97, 99,247, 72, 72,246, 71, 71,245, 71, 71,245, 71, 71,244, 71, 71, + 243, 72, 72,243, 72, 72,243, 71, 71,242, 71, 71,241, 71, 71,241, 71, + 71,240, 72, 72,240, 72, 72,240, 71, 71,239, 71, 71,239, 71, 71,238, + 71, 71,237, 71, 71,236, 71, 71,237, 71, 71,236, 71, 71,236, 71, 71, + 235, 71, 71,234, 94, 99,237, 44, 49,214, 81, 81,204,255,255,255,255, + 255,255,255,255,255,165,165,228, 29, 30,203,113,118,250, 71, 71,247, + 71, 71,247, 71, 71,246, 71, 71,246, 70, 70,245, 70, 70,245, 70, 70, + 244, 70, 70,244, 70, 70,243, 70, 70,242, 69, 69,242, 69, 69,242, 69, + 69,241, 69, 69,240, 70, 70,240, 70, 70,239, 69, 69,239, 69, 69,239, + 69, 69,238, 69, 69,237, 69, 69,237, 70, 70,236, 69, 69,236,108,116, + 241, 25, 26,198,170,170,229,255,255,255,255,255,255,255,255,255,240, + 240,250, 10, 10,184,116,121,249, 77, 78,249, 71, 71,249, 71, 71,248, + 71, 71,248, 71, 71,247, 71, 71,246, 71, 71,246, 71, 71,246, 70, 70, + 245, 70, 70,244, 70, 70,244, 70, 70,243, 70, 70,243, 70, 70,242, 69, + 69,242, 69, 69,241, 69, 69,241, 69, 69,240, 69, 69,239, 68, 68,239, + 68, 68,239, 68, 68,239, 74, 75,239,106,115,240, 11, 11,183,241,241, + 251,255,255,255,255,255,255,255,255,255,255,255,255, 89, 89,208, 45, + 46,223,106,109,252, 71, 71,250, 71, 71,250, 71, 71,250, 71, 71,249, + 71, 71,248, 71, 71,248, 71, 71,247, 71, 71,247, 71, 71,246, 71, 71, + 246, 70, 70,245, 70, 70,245, 70, 70,244, 70, 70,243, 70, 70,243, 70, + 70,242, 69, 69,242, 69, 69,242, 69, 69,241, 69, 69,240, 69, 69,240, + 100,107,242, 43, 45,215, 93, 93,209,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,230,230,247, 17, 17,189,111,115,250, 85, + 86,252, 72, 72,252, 71, 71,251, 71, 71,251, 71, 71,250, 71, 71,250, + 71, 71,249, 71, 71,249, 71, 71,248, 71, 71,247, 71, 71,247, 71, 71, + 246, 71, 71,246, 71, 71,246, 70, 70,245, 70, 70,244, 70, 70,244, 70, + 70,243, 70, 70,242, 69, 69,242, 81, 83,242,104,111,241, 18, 18,188, + 232,232,248,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,120,120,217, 27, 28,206,122,126,254, 79, 79,253, 72, + 72,253, 72, 72,253, 72, 72,252, 71, 71,251, 71, 71,251, 71, 71,250, + 71, 71,250, 71, 71,250, 71, 71,249, 71, 71,248, 71, 71,248, 71, 71, + 247, 71, 71,246, 71, 71,246, 71, 71,246, 70, 70,245, 70, 70,245, 75, + 76,245,117,124,247, 28, 29,202,123,123,217,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252,252, + 254, 55, 55,198, 44, 44,218,121,124,254, 79, 80,254, 72, 72,254, 72, + 72,253, 72, 72,253, 72, 72,253, 72, 72,252, 72, 72,252, 71, 71,251, + 71, 71,250, 71, 71,250, 71, 71,250, 71, 71,249, 71, 71,249, 71, 71, + 248, 71, 71,247, 71, 71,247, 78, 79,247,115,122,248, 43, 45,214, 59, + 59,199,252,252,254,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,238,238,250, 28, 28, + 189, 45, 45,216,125,127,254, 86, 88,254, 72, 72,254, 72, 72,254, 72, + 72,254, 72, 72,254, 72, 72,253, 72, 72,253, 72, 72,253, 72, 72,252, + 71, 71,251, 71, 71,251, 71, 71,250, 71, 71,250, 71, 71,250, 86, 87, + 250,120,126,250, 43, 45,213, 29, 29,189,240,240,250,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,234,234,249, 50, 50,196, 30, 30, + 204,115,117,248,111,114,254, 80, 81,254, 72, 72,254, 72, 72,254, 72, + 72,254, 72, 72,254, 72, 72,254, 72, 72,253, 72, 72,253, 72, 72,253, + 72, 72,252, 81, 82,252,109,113,252,111,116,246, 28, 29,201, 52, 52, + 196,235,235,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,249,249,253,105,105,212, 10, 10,184, 53, 54, + 218,122,124,251,117,120,254, 99,100,254, 88, 89,254, 82, 82,254, 77, + 78,254, 82, 82,254, 87, 89,254, 98,100,254,115,119,254,119,123,251, + 50, 51,216, 12, 12,185,105,105,212,250,250,253,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,218,218,244, 74, 74,203, 11, 11,183, 35, 35, + 204, 68, 69,227, 92, 94,239,110,111,246,123,126,252,109,111,246, 91, + 93,238, 67, 68,227, 34, 34,204, 9, 9,183, 77, 77,204,219,219,244, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,237,237,250,162,162,227, 75, 75,204, 38, 38, + 193, 17, 17,186, 4, 4,180, 17, 17,186, 38, 38,194, 77, 77,205,164, + 164,228,238,238,250,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255); + +Const + stdimg_menu_save_all_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,202,138, + 97,195,132, 88,211,139,104,225,143,112,220,141,108,218,139,109,215, + 138,110,205,139,108,171,109, 68,166, 95, 46,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,198,131, 85,239,206, + 186,221,255,255,135,238,199,162,244,215,162,246,215,140,238,199,224, + 255,255,221,162,133,171,106, 62,255,255,255,255,255,255,255,255,255, + 255,255,255,208,153,117,203,148,110,195,127, 81,239,182,154,234,243, + 232, 81,191,132,111,201,152,113,201,153, 84,191,132,228,244,233,221, + 156,123,170,105, 58,255,255,255,255,255,255,255,255,255,255,255,255, + 205,147,107,241,212,195,196,129, 84,234,182,151,243,243,234,237,241, + 230,239,241,230,239,240,230,237,241,229,243,245,237,213,156,121,176, + 112, 68,255,255,255,255,255,255,213,163,131,208,158,123,199,131, 88, + 238,180,153,201,139, 97,230,181,146,226,167,129,225,167,129,222,163, + 125,220,161,123,219,159,121,217,158,119,212,154,115,187,126, 87,255, + 255,255,255,255,255,210,157,121,242,216,201,201,145,106,225,190,159, + 202,141,101,234,184,153,221,165,126,221,166,128,219,163,124,217,160, + 122,217,160,121,216,159,120,216,158,120,191,132, 93,255,255,255,255, + 255,255,208,154,118,242,197,175,205,153,115,215,184,148,200,136, 93, + 239,191,161,253,252,250,254,252,251,254,253,253,254,253,252,253,251, + 250,253,252,251,221,168,133,193,127, 83,255,255,255,255,255,255,208, + 156,120,238,197,173,207,155,119,235,192,164,199,134, 91,239,192,158, + 255,255,255,204,147,110,255,255,255,255,255,255,255,251,247,255,248, + 241,228,175,140,199,138, 97,255,255,255,255,255,255,212,164,130,235, + 197,169,204,142,101,238,190,161,204,141,101,243,205,176,255,255,255, + 227,199,179,255,255,255,255,255,255,255,255,255,255,255,255,234,191, + 161,201,137, 96,255,255,255,255,255,255,213,165,134,238,199,175,202, + 140, 99,237,191,158,212,151,110,212,158,123,208,152,113,214,164,130, + 205,142,104,205,144,105,208,154,117,209,153,115,200,139, 98,238,220, + 208,255,255,255,255,255,255,212,161,127,242,205,181,210,156,121,244, + 211,186,255,255,255,231,206,189,255,255,254,255,255,255,251,246,242, + 248,241,237,237,199,173,208,152,117,255,255,255,255,255,255,255,255, + 255,255,255,255,211,160,126,242,205,179,218,165,129,212,160,126,214, + 166,131,219,176,146,211,157,123,211,158,123,211,159,123,209,154,117, + 207,154,118,240,225,214,255,255,255,255,255,255,255,255,255,255,255, + 255,215,165,134,246,216,193,255,255,255,233,211,195,255,255,255,255, + 255,255,255,255,255,255,255,255,238,205,181,212,162,130,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,221,173, + 141,221,179,151,218,174,143,223,183,156,216,166,136,216,168,137,218, + 175,146,219,175,145,212,164,131,241,227,217,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_btn_ok_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,247,250, + 247,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,247,250,248, 55,131, 61, 52,125, + 58,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,248,251,248, 64,142, 71, 84,163, 92, 79,159, 87, 51,125, + 57,248,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,248,251,248, + 73,154, 81, 91,172,100,119,202,130,116,200,126, 81,160, 89, 52,126, + 58,248,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,248,252,249, 81,166, 90, 99,181,109, + 126,206,137,123,204,135,118,202,129,118,201,129, 82,162, 90, 53,127, + 59,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,249,252,250, 89,176, 99,107,189,118,132,210,144,122,201,133, + 96,178,106, 99,180,109,120,201,131,120,203,130, 83,163, 92, 54,128, + 60,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,211, + 236,214,108,189,118,121,201,134,128,206,141, 83,167, 92,178,214,181, + 156,201,160, 92,173,103,124,204,134,121,203,133, 84,164, 93, 55,129, + 61,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,217, + 239,220,108,189,117,109,192,121,181,219,185,255,255,255,255,255,255, + 152,199,157, 94,174,104,125,205,137,124,205,135, 86,165, 95, 56,130, + 62,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,213, + 237,216,190,226,195,255,255,255,255,255,255,255,255,255,255,255,255, + 153,200,157, 95,175,105,127,206,138,126,206,137, 87,166, 96, 57,131, + 63,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 153,200,158, 96,176,106,129,207,141,127,207,139, 88,167, 97, 57,133, + 64,249,251,249,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 153,201,158, 98,178,108,130,209,143,122,200,133, 87,166, 96,159,196, + 162,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 154,202,159, 99,179,109, 95,175,105,165,203,169,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 154,202,159,165,206,169,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_folder_new_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 198,167,146,138, 78, 37,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, + 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, + 74, 32,135, 74, 32,135, 74, 32,138, 78, 37,198,169,148,138, 78, 37, + 217,181,149,221,186,154,221,186,154,221,186,154,221,186,154,221,186, + 154,221,186,154,221,186,154,221,186,154,221,186,154,221,186,154,221, + 186,154,221,186,154,217,181,149,138, 79, 37,135, 74, 32,223,192,162, + 213,172,134,213,172,134,213,172,134,213,172,134,213,172,134,213,172, + 134,213,172,134,213,172,134,212,172,134,212,172,134,212,172,134,213, + 172,134,223,192,162,135, 74, 32,135, 74, 32,226,197,170,215,175,138, + 215,175,138,215,175,138,215,175,138,215,175,138,215,175,138,213,175, + 138,210,177,142,207,178,144,206,178,145,207,178,144,212,176,140,224, + 197,170,135, 74, 32,135, 74, 32,228,202,177,217,179,143,217,179,143, + 217,179,143,217,179,143,217,179,143,213,180,145,196,186,158,180,192, + 170,164,199,184,163,199,184,170,197,179,188,190,165,212,205,184,133, + 78, 38,135, 74, 32,230,205,181,217,179,143,217,179,143,217,179,143, + 217,179,143,212,180,146,187,190,165,144,206,198, 9,212,234, 95,222, + 232, 95,223,233, 10,212,236,128,212,211,169,216,209,124,104, 74,135, + 74, 32,231,207,184,217,179,143,217,179,143,217,179,143,214,179,144, + 192,188,161,139,206,200, 7,212,235,234,251,252, 4,212,237, 4,212, + 237,234,251,253, 7,212,237,111,226,235,107,153,141,135, 74, 32,232, + 210,188,217,179,143,217,179,143,216,179,143,208,182,149,165,197,181, + 89,219,229, 4,212,237,252,254,254,230,250,252,230,250,252,231,250, + 252, 4,213,237, 78,228,246, 92,189,192,136, 76, 34,230,209,188,234, + 212,192,234,212,192,233,212,192,216,214,198,146,220,221, 63,222,240, + 2,212,237,231,251,253,230,250,253,230,250,253,230,249,252, 1,212, + 237, 57,225,245, 86,202,209,139, 77, 36,136, 76, 34,135, 74, 32,135, + 74, 32,134, 74, 32,127, 92, 57, 97,161,154, 3,211,236,230,250,252, + 230,250,253,230,250,253,230,250,253,230,250,253,230,250,252, 4,213, + 237, 84,197,202,135, 74, 32,204,164,133,188,136, 95,188,136, 94,187, + 136, 94,178,143,106,123,167,154, 3,210,234,231,250,252,230,250,253, + 230,250,253,230,250,253,230,250,253,230,250,252, 4,213,236, 93,177, + 176,135, 74, 32,209,176,151,218,186,158,205,161,124,205,161,123,200, + 163,127,178,196,180, 8,210,233, 1,211,236, 0,212,237,237,251,253, + 237,251,253, 0,212,237, 1,212,237, 6,210,233,146,193,189,225,210, + 200,144, 89, 49,218,191,169,236,217,200,236,217,200,236,217,200,203, + 194,176,108,139,122, 80,218,232, 33,218,241, 0,212,237, 0,212,237, + 25,218,241, 70,227,245,157,241,251,231,252,254,255,255,255,225,210, + 200,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,134, 75, 33,207, + 211,204,190,245,252,129,235,248, 95,229,246, 90,229,246,118,234,248, + 183,244,252,234,252,254,253,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_edit_paste_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,155,181,197, 18, 80,118, 1, 68,108, 1, 68, + 108, 1, 68,108, 1, 68,108, 1, 68,108, 1, 68,108, 1, 68,108, 1, + 68,108, 1, 68,108, 1, 68,108, 19, 80,117,162,186,201,255,255,255, + 251,252,253, 13, 76,115, 35,127,186, 59,125,167,100,111,115,104,108, + 106,104,108,106,104,108,106,104,108,106,104,108,106, 61,124,163, 61, + 124,163, 61,124,163, 34,123,179, 16, 78,116,253,254,254,239,243,246, + 9, 74,114, 38,135,197, 99,109,112,237,238,237,254,254,254,254,254, + 254,254,254,254,238,239,239,253,254,254,100,105,103, 39,135,197, 39, + 135,197, 39,135,197, 3, 68,108,247,249,250,239,243,246, 9, 74,114, + 38,135,197,100,104,102,255,255,255,228,231,231,213,216,216,190,194, + 193,180,183,183,255,255,255,255,255,255,100,105,103, 39,135,197, 40, + 134,194, 3, 68,108,247,249,250,239,243,246, 9, 74,114, 38,135,197, + 100,104,102,255,255,255,231,233,233,229,231,231,214,217,217,182,185, + 185,255,255,255,255,255,255,255,255,255,100,105,103, 40,134,194, 3, + 68,108,247,249,250,239,243,246, 9, 75,114, 38,135,197,100,104,102, + 255,255,255,234,236,236,232,234,234,230,232,232,203,206,205,182,186, + 185,181,185,184,255,255,255,100,105,103, 40,134,194, 3, 68,108,247, + 249,250,239,243,246, 9, 75,114, 38,135,197,100,104,102,255,255,255, + 237,238,238,235,236,236,233,235,235,231,233,233,216,218,218,202,205, + 204,255,255,255,100,105,103, 40,134,194, 3, 68,108,247,249,250,239, + 243,246, 9, 75,114, 38,135,197,100,104,102,255,255,255,239,240,240, + 238,239,239,236,237,237,234,235,235,232,234,234,217,219,219,255,255, + 255,100,105,103, 40,134,194, 3, 68,108,247,249,250,239,243,246, 9, + 75,114, 38,135,197,100,104,102,255,255,255,239,240,240,181,181,179, + 181,181,179,180,180,178,178,178,177,232,234,234,255,255,255,100,105, + 103, 40,134,194, 3, 68,108,247,249,250,239,243,246, 9, 75,115, 38, + 135,197,100,104,102,255,255,255,239,240,240,239,240,240,239,240,240, + 239,240,240,237,239,239,235,237,237,255,255,255,100,105,103, 40,134, + 194, 3, 68,108,247,249,250,239,243,246, 9, 75,115, 38,135,197,100, + 104,102,255,255,255,239,240,240,181,181,179,181,181,179,181,181,179, + 181,181,179,238,239,239,255,255,255,100,105,103, 40,134,194, 3, 68, + 108,247,249,250,239,243,246, 9, 75,115, 39,136,198,100,104,102,255, + 255,255,239,240,240,239,240,240,239,240,240,239,240,240,239,240,240, + 239,240,240,255,255,255,100,105,103, 40,134,194, 3, 68,108,247,249, + 250,239,243,246, 9, 75,115, 39,136,198,100,111,113,241,241,241,224, + 224,224,187,187,187,187,187,187,187,187,187,187,187,187,224,224,224, + 242,242,242,100,109,110, 39,135,197, 3, 68,108,247,249,250,251,252, + 253, 13, 77,116, 36,132,192, 62,126,164,100,109,112, 94, 94, 94,124, + 127,127,125,128,128,125,128,128,123,126,126, 94, 94, 94,100,108,110, + 64,124,161, 35,127,185, 16, 78,117,253,254,254,255,255,255,155,182, + 197, 18, 80,119, 1, 68,108, 3, 68,107, 91, 92, 92,137,149,149,138, + 151,151,138,151,151,137,149,149, 91, 92, 92, 3, 68,107, 1, 68,108, + 19, 81,118,162,186,201,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,254,254,254,137,138,138, 92, 92, 92, 92, 92, 92, 92, + 92, 92, 92, 92, 92,137,138,138,254,254,254,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_dialog_confirmation_32 : Array[0..3125] of byte = ( + 66, 77, 54, 12, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 32, 0, 0, 0, 32, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,252,252,252,247,247,247,239,239,239,232, + 232,232,224,224,224,220,220,220,215,215,215,213,213,213,215,215,215, + 218,218,218,224,224,224,230,230,230,238,238,238,245,245,245,251,251, + 251,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,253,253,253,242,242,242,228,228, + 228,217,217,217,206,205,205,181,166,156,159,124, 99,146, 97, 62,141, + 86, 49,138, 80, 39,138, 80, 39,141, 86, 48,145, 95, 60,154,119, 94, + 172,157,147,191,190,190,201,201,201,210,210,210,222,222,222,238,238, + 238,251,251,251,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 248,248,248,235,235,235,222,222,222,204,201,198,165,132,109,139, 83, + 43,163,116, 84,201,171,149,228,212,200,238,229,221,246,240,236,246, + 241,236,239,229,222,229,214,202,203,174,152,163,117, 84,139, 82, 43, + 155,123, 99,185,182,179,201,201,201,214,214,214,226,226,226,244,244, + 244,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,245,245,245,231,231,231, + 183,157,139,140, 85, 45,184,146,120,236,226,217,252,250,248,252,250, + 249,252,250,249,252,250,249,252,250,249,252,250,249,252,250,249,252, + 250,249,252,250,249,252,250,249,238,228,220,187,151,124,140, 84, 45, + 171,145,128,210,210,210,223,223,223,236,236,236,253,253,253,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,250,248,247,171,131,102,165,119, 87,234,222,213, + 252,250,248,252,250,248,238,228,220,217,193,174,200,166,137,195,155, + 124,189,147,111,190,148,113,198,160,128,205,170,143,221,197,179,240, + 230,223,252,250,249,252,250,249,236,225,216,167,122, 89,165,125, 96, + 231,229,228,246,246,246,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,252,251,250,160, + 112, 78,186,150,123,248,244,241,252,250,248,237,226,218,199,165,138, + 181,134, 97,184,139,102,187,142,106,190,146,110,192,148,112,193,150, + 114,193,151,115,193,150,115,192,149,113,190,147,111,207,175,149,240, + 230,222,252,250,249,249,245,242,190,155,129,161,113, 80,252,251,250, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,254,254,173,131,102,186,150,124,251,249,247,252, + 250,248,219,198,181,178,131, 94,180,133, 96,184,138,102,187,143,107, + 191,147,111,193,151,115,196,154,118,197,156,121,198,157,122,198,156, + 121,196,155,119,194,152,117,192,149,113,191,147,111,225,205,189,252, + 250,249,252,250,248,190,155,130,174,132,103,255,254,254,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,201,173, + 154,174,131,101,249,246,243,251,249,248,206,177,154,174,125, 87,178, + 131, 94,183,136,100,187,142,105,190,147,111,194,151,116,229,226,224, + 230,228,225,230,228,225,230,228,226,202,162,127,201,160,125,198,157, + 122,195,153,118,192,149,113,188,144,107,214,187,166,252,250,249,250, + 247,245,177,136,106,201,173,154,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,247,242,239,149, 94, 57,238,228,221,251,249, + 248,213,188,169,171,122, 83,176,127, 90,180,133, 96,185,139,102,189, + 145,109,193,150,114,197,155,120,232,232,232,233,233,233,234,234,234, + 234,234,234,206,168,134,205,165,131,202,162,127,198,157,122,194,152, + 117,190,147,111,186,141,105,220,197,179,252,250,249,240,231,225,150, + 96, 59,247,242,239,255,255,255,255,255,255,255,255,255,255,255,255, + 183,145,120,194,163,139,251,249,248,232,218,208,169,119, 80,172,123, + 85,177,129, 91,182,135, 98,186,141,105,191,147,111,195,153,117,199, + 158,124,234,234,234,235,235,235,236,236,236,236,236,236,211,173,140, + 208,170,136,205,166,131,201,160,126,197,155,120,192,149,113,188,143, + 107,184,138,102,236,223,214,252,250,248,199,169,147,183,146,121,255, + 255,255,255,255,255,255,255,255,249,246,245,144, 87, 48,243,236,231, + 251,249,247,183,142,110,168,118, 79,173,124, 86,178,130, 93,182,136, + 99,187,142,106,192,148,113,196,155,119,201,161,126,234,231,229,235, + 232,230,236,234,232,236,234,232,215,178,146,211,174,141,207,169,135, + 203,163,128,198,157,122,193,151,115,189,145,108,184,139,102,195,158, + 128,252,249,248,245,238,234,144, 88, 49,249,246,245,255,255,255,255, + 255,255,215,194,180,176,134,105,251,249,247,229,215,205,164,112, 73, + 169,118, 80,173,124, 86,178,131, 93,183,137,100,188,143,107,192,149, + 113,197,155,120,202,162,127,206,168,134,211,174,141,216,180,147,220, + 186,153,217,182,150,213,176,143,208,170,136,203,164,130,199,158,123, + 194,151,116,189,145,109,185,139,102,180,133, 96,234,221,211,252,250, + 248,179,139,110,215,194,180,255,255,255,255,255,255,171,127, 98,209, + 184,166,251,249,247,200,169,146,164,112, 73,169,118, 79,173,124, 86, + 178,130, 93,183,137,100,187,143,106,192,149,113,197,155,120,201,161, + 127,239,239,239,241,241,241,242,242,242,242,242,242,217,183,152,212, + 175,142,208,170,136,203,163,129,199,157,122,194,151,116,189,145,109, + 184,139,102,180,133, 95,209,181,159,252,250,248,213,190,173,172,129, + 99,255,255,255,255,255,255,147, 92, 55,231,218,209,251,249,247,180, + 139,107,163,111, 72,168,117, 79,173,124, 85,177,130, 92,182,136, 99, + 187,142,105,191,148,112,196,154,119,200,160,125,236,230,225,242,242, + 242,243,243,243,244,244,244,227,206,188,210,172,139,206,167,133,202, + 162,127,197,156,121,193,150,114,188,144,108,184,138,101,179,132, 95, + 192,155,125,252,250,248,234,222,214,148, 93, 56,255,255,255,255,255, + 255,138, 79, 37,242,235,230,251,249,247,170,122, 87,163,110, 71,167, + 116, 78,172,122, 84,176,128, 91,181,134, 97,185,140,104,190,146,110, + 194,152,116,198,157,122,217,191,170,244,244,244,245,245,245,246,246, + 246,244,244,244,219,193,170,203,164,130,200,159,124,196,154,118,191, + 148,112,187,142,106,183,137,100,178,131, 93,184,141,107,252,250,248, + 244,238,233,139, 79, 38,255,255,255,255,255,255,138, 78, 37,251,249, + 247,251,249,247,162,110, 72,162,109, 69,166,115, 76,171,121, 82,175, + 127, 89,179,132, 95,184,138,101,188,143,107,192,149,113,196,154,118, + 199,158,123,224,204,186,247,247,247,248,248,248,247,247,247,244,244, + 244,216,191,169,197,155,120,193,150,115,189,145,109,185,140,103,181, + 134, 97,177,129, 91,176,129, 93,252,250,248,251,249,248,138, 79, 38, + 255,255,255,255,255,255,138, 79, 37,242,235,230,251,249,247,168,120, + 85,160,107, 67,165,113, 74,169,119, 80,173,124, 86,177,130, 92,181, + 135, 98,185,140,104,189,145,109,192,149,114,195,153,118,198,157,122, + 222,200,181,249,249,249,249,249,249,247,247,247,243,243,242,206,173, + 146,190,147,111,187,142,106,183,137,100,179,132, 94,175,126, 88,180, + 137,103,252,250,248,244,237,233,138, 79, 37,255,255,255,255,255,255, + 147, 92, 54,230,217,208,251,249,247,177,134,103,158,105, 65,163,110, + 71,167,116, 77,171,121, 83,175,127, 89,179,132, 94,183,136,100,186, + 141,104,189,145,109,192,148,113,194,151,116,195,153,118,226,207,192, + 250,250,250,248,248,248,245,245,245,229,218,209,187,143,106,184,138, + 101,180,134, 96,177,129, 91,173,123, 85,187,149,118,251,249,248,233, + 221,212,148, 93, 55,255,255,255,255,255,255,170,127, 97,207,181,164, + 251,249,247,196,164,140,156,102, 62,161,108, 68,165,113, 74,169,118, + 79,172,123, 85,176,128, 90,179,132, 95,189,148,116,185,140,104,188, + 143,107,190,146,110,191,147,111,199,162,131,251,251,251,249,249,249, + 246,246,246,240,239,237,184,138,101,181,134, 97,177,130, 92,174,125, + 87,170,120, 82,204,174,152,251,249,248,211,187,170,171,128, 98,255, + 255,255,255,255,255,215,194,180,173,132,102,251,248,247,227,212,201, + 154, 99, 59,158,105, 65,162,110, 70,166,115, 76,170,119, 81,173,124, + 86,176,128, 90,238,237,236,219,200,185,195,157,127,185,140,103,186, + 141,106,217,193,173,252,252,252,249,249,249,246,246,246,240,237,235, + 180,133, 96,177,130, 92,174,126, 88,171,121, 83,167,116, 78,231,217, + 206,251,249,248,176,136,107,215,194,180,255,255,255,255,255,255,249, + 246,245,143, 87, 47,242,234,229,250,248,246,173,129, 97,156,101, 61, + 159,106, 66,163,111, 71,166,115, 76,170,120, 81,173,123, 85,240,240, + 240,243,243,243,245,245,245,245,243,241,247,245,243,252,252,252,251, + 251,251,248,248,248,245,245,245,221,206,193,176,128, 90,174,125, 87, + 171,121, 83,168,117, 78,183,143,111,251,249,247,243,236,232,144, 88, + 48,249,246,245,255,255,255,255,255,255,255,255,255,181,144,118,190, + 157,133,251,248,247,228,214,203,154,100, 59,156,102, 62,160,107, 67, + 163,111, 72,166,115, 76,169,119, 80,239,239,239,242,242,242,245,245, + 245,247,247,247,249,249,249,250,250,250,249,249,249,247,247,247,237, + 232,227,182,141,108,172,123, 85,170,120, 81,167,116, 78,165,115, 75, + 231,218,208,251,249,248,194,163,140,182,145,119,255,255,255,255,255, + 255,255,255,255,255,255,255,246,242,238,147, 92, 54,235,225,217,251, + 248,247,204,177,158,153, 98, 58,157,103, 62,160,107, 67,163,110, 71, + 165,114, 75,186,150,121,208,184,166,228,216,207,238,233,229,247,246, + 245,243,240,238,232,222,215,209,184,165,176,129, 94,170,120, 82,168, + 118, 79,166,115, 76,164,112, 72,210,184,165,251,249,248,237,227,220, + 148, 93, 56,246,242,238,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,200,172,153,170,127, 96,248,244,242,251,249,247,194, + 162,138,153, 98, 57,156,102, 62,159,105, 65,161,109, 69,163,111, 72, + 165,114, 75,167,116, 77,168,117, 78,169,118, 79,169,119, 80,169,118, + 80,168,118, 79,167,116, 78,166,115, 76,164,112, 73,162,110, 70,200, + 169,146,251,249,247,249,245,243,172,130,100,201,173,154,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254, + 254,172,130,101,181,143,116,250,248,246,251,249,247,209,184,167,154, + 101, 61,155,100, 60,157,103, 63,159,106, 66,161,108, 69,162,110, 71, + 163,111, 72,164,112, 73,164,113, 73,164,113, 73,164,112, 73,163,111, + 71,162,109, 69,162,110, 71,213,189,172,251,249,247,251,248,247,184, + 147,121,172,131,101,255,254,254,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,252,251,250,157,107, + 73,181,142,115,246,242,238,251,248,247,232,219,210,180,140,110,153, + 98, 58,155,101, 60,157,103, 63,158,104, 64,159,106, 66,160,106, 67, + 160,107, 67,160,107, 67,159,106, 66,158,105, 65,185,146,117,233,221, + 212,251,249,247,247,243,239,183,145,119,158,108, 74,252,251,250,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,251,249,248,174,132,103,163,115, + 82,229,215,205,251,248,247,251,249,247,232,220,211,202,173,152,177, + 134,103,167,120, 84,159,105, 66,159,106, 67,168,122, 87,179,137,106, + 204,175,155,233,221,213,251,249,247,251,249,247,230,217,208,165,117, + 85,175,133,104,251,249,248,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,203,176,159,142, 85, 46,177,136, + 109,231,218,209,251,248,247,251,249,247,251,249,247,251,249,247,251, + 249,247,251,249,247,251,249,247,251,249,247,251,249,247,251,249,247, + 232,220,211,179,139,112,142, 85, 46,204,177,159,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,247,244,241,189,155,133,142, 84, 45,161,112, + 79,191,157,135,220,201,188,233,221,212,242,235,231,242,235,231,233, + 221,213,220,202,189,192,159,137,162,114, 80,142, 84, 45,189,155,133, + 247,244,241,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,253,252,252,224,209,198,184,149,124,156,106, + 71,146, 92, 53,139, 81, 40,139, 81, 40,146, 92, 53,156,106, 71,184, + 149,125,224,209,198,253,252,252,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255); + +Const + stdimg_list_remove_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0,215, 13, 0, 0,215, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,182,132, 93,164,101, 52,164,101, 52, + 164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, + 52,164,101, 52,164,101, 52,182,132, 93,255,255,255,255,255,255,255, + 255,255,255,255,255,164,101, 52,229,204,180,219,183,149,219,182,148, + 218,180,146,218,179,144,217,173,134,216,170,131,215,168,127,215,166, + 125,224,190,159,164,101, 52,255,255,255,255,255,255,255,255,255,255, + 255,255,164,101, 52,232,211,192,231,209,187,231,209,188,230,206,183, + 230,206,183,230,206,183,230,206,183,230,205,182,230,204,181,230,204, + 182,164,101, 52,255,255,255,255,255,255,255,255,255,255,255,255,182, + 132, 93,164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52, + 164,101, 52,164,101, 52,164,101, 52,164,101, 52,164,101, 52,182,132, + 93,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_arrow_right : Array[0..89] of byte = ( + 66, 77, 90, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0, + 0, 4, 0, 0, 0, 7, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 2, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0,255,255,255, 0,112, 0, 0, 0, 48, 0, + 0, 0, 16, 0, 0, 0, 0, 0, 0, 0, 16, 0, 0, 0, 48, 0, 0, + 0,112, 0, 0, 0); + +Const + stdimg_choice_yes_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,194,228,199, 12,164, 60, 17,171, 71, 13,173, 73,104,175, + 120,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 87,183,107, 78,224,155, 92,234,170, 92,234,171, 35,192,104, 87,167, + 106,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,234,244,235, 32,183, 89, + 102,255,205,104,255,201, 85,255,195, 73,252,184, 24,199,107, 85,166, + 102,254,254,254,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,157,207,165, 22,223,131, 47,255,181, + 45,255,174, 30,255,170, 3,255,160, 17,250,157, 12,190, 93, 68,158, + 86,252,253,252,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 68,173, 91, 0,248,147, 1,254,156, 10,254,160, + 18,251,159, 38,250,165, 49,242,160, 70,234,157, 21,183, 87, 74,169, + 94,247,251,247,255,255,255,255,255,255,255,255,255,255,255,255,224, + 238,224, 7,173, 65, 7,243,144, 45,243,160, 72,243,171,105,199,139, + 96,231,164,112,241,183,110,233,172,102,224,157, 28,169, 74, 57,157, + 75,242,248,242,255,255,255,255,255,255,255,255,255,148,199,148, 18, + 202,101, 79,235,162,102,241,178, 85,205,129,252,253,252,172,211,180, + 89,192,126,129,232,178,130,225,170,129,215,157, 45,168, 78, 63,165, + 77,238,246,238,255,255,255,255,255,255,127,196,134, 86,221,149,112, + 231,171,111,233,173,152,207,158,255,255,255,255,255,255,210,233,211, + 101,183,121,151,227,181,150,221,173,157,217,170, 60,168, 84, 44,152, + 56,229,241,229,255,255,255,237,246,237,138,190,142, 97,180,115, 81, + 180,107,226,240,226,255,255,255,255,255,255,255,255,255,212,232,212, + 109,181,120,173,225,187,170,219,179,181,219,181, 84,174,101, 42,147, + 51,214,234,214,255,255,255,255,255,255,252,253,252,229,242,229,254, + 254,254,255,255,255,255,255,255,255,255,255,255,255,255,224,239,224, + 121,181,123,195,228,198,191,223,191,206,230,203,110,184,122,115,185, + 121,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,225,239,225, + 126,181,126,218,237,218,228,242,228,169,210,169,173,204,172,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,235,244,235, + 115,168,114,139,187,139,195,215,194,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_arrow_left : Array[0..89] of byte = ( + 66, 77, 90, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0, + 0, 4, 0, 0, 0, 7, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, + 28, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 2, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0,255,255,255, 0,224, 0, 0, 0,192, 0, + 0, 0,128, 0, 0, 0, 0, 0, 0, 0,128, 0, 0, 0,192, 0, 0, + 0,224, 0, 0, 0); + +Const + stdimg_refresh_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,197,157,126,255,254,254,255,255,255,255,255, + 255,253,252,251,225,205,189,189,144,108,174,118, 73,166,105, 57,176, + 122, 79,196,156,124,242,233,226,255,255,255,255,255,255,255,255,255, + 255,255,255,164,101, 52,203,167,139,255,255,255,225,204,188,172,113, + 68,184,134, 93,206,166,132,216,182,151,219,185,153,211,172,138,195, + 149,111,169,109, 63,223,200,183,255,255,255,255,255,255,255,255,255, + 165,104, 56,185,136, 96,180,129, 88,180,128, 86,227,202,180,236,218, + 201,231,209,188,227,201,176,222,190,160,210,171,136,206,165,130,211, + 174,142,169,110, 64,240,230,222,255,255,255,255,255,255,167,105, 58, + 241,228,216,212,178,149,244,233,224,243,232,221,237,220,204,210,173, + 143,179,125, 83,166,104, 56,166,105, 57,166,106, 58,169,109, 61,176, + 120, 76,197,157,125,255,255,255,255,255,255,166,104, 57,246,238,230, + 245,236,227,245,237,228,230,210,193,179,126, 84,185,136, 97,236,222, + 212,255,255,255,217,191,171,175,117, 74,182,124, 79,167,107, 59,167, + 107, 59,255,255,255,255,255,255,165,104, 55,246,238,230,235,215,196, + 234,217,201,164,102, 53,217,191,171,255,255,255,255,255,255,255,255, + 255,251,248,246,173,115, 70,225,196,174,200,158,124,164,101, 52,253, + 252,251,255,255,255,165,103, 54,245,237,229,246,237,229,245,236,228, + 215,184,157,177,122, 79,249,245,242,255,255,255,255,255,255,255,255, + 255,255,255,255,251,246,242,244,232,223,165,103, 54,251,248,245,255, + 255,255,166,105, 57,164,102, 53,164,102, 53,165,102, 54,165,103, 54, + 165,103, 55,189,143,108,245,237,232,246,241,236,246,241,236,246,241, + 236,246,241,236,246,241,236,245,238,233,255,255,255,255,255,255,250, + 247,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,198,158,128,164,101, 52,175,120, 76,178,123, 82,178,123, + 82,178,124, 82,164,101, 52,252,250,249,255,255,255,165,103, 54,217, + 189,167,247,238,232,250,246,242,254,254,253,255,255,255,255,255,255, + 254,253,252,187,139,102,209,174,145,246,238,231,242,230,219,246,238, + 230,167,108, 61,252,250,248,255,255,255,164,102, 54,168,108, 61,221, + 187,162,174,118, 75,243,234,227,255,255,255,255,255,255,255,255,255, + 221,197,179,164,102, 53,233,215,199,235,216,198,245,236,227,168,109, + 62,251,249,247,255,255,255,170,111, 65,171,112, 65,169,109, 61,170, + 112, 66,213,184,162,246,240,235,230,213,200,183,134, 95,188,141,103, + 235,219,205,245,235,226,246,238,230,246,238,230,169,109, 62,251,248, + 246,255,255,255,202,164,135,192,145,106,197,152,114,168,107, 60,164, + 102, 53,168,108, 60,186,139,101,217,187,161,241,228,216,242,230,219, + 243,232,221,206,168,137,234,216,200,169,110, 63,250,247,245,255,255, + 255,240,230,222,169,111, 65,211,173,140,220,189,157,221,190,161,229, + 203,180,233,211,191,238,221,204,240,226,213,231,210,191,178,124, 82, + 187,141,104,174,117, 73,165,104, 55,250,247,244,255,255,255,255,255, + 255,226,207,192,169,109, 63,193,146,107,211,176,143,223,194,168,222, + 193,168,212,177,147,188,140,102,170,112, 67,224,202,185,255,255,255, + 219,194,174,164,101, 52,250,246,243,255,255,255,255,255,255,255,255, + 255,245,237,232,200,161,132,178,125, 83,168,108, 61,176,120, 77,190, + 145,110,225,205,189,253,252,251,255,255,255,255,255,255,255,255,255, + 212,182,159,249,245,242); + +Const + stdimg_arrow_down : Array[0..77] of byte = ( + 66, 77, 78, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0, + 0, 7, 0, 0, 0, 4, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 2, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0,255,255,255, 0,238, 0, 0, 0,198, 0, + 0, 0,130, 0, 0, 0, 0, 0, 0, 0); + +Const + stdimg_font_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,200,200,200,128,128,128,135,135,135,133, + 133,133,133,133,133,128,128,128,202,202,202,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,171,171,171, 88, 88, 88,102,102,102,108,108,108, 99, + 99, 99, 83, 83, 83,176,176,176,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,254,254,254,255,255,255,255,255,255,255,255, + 255,254,254,254,237,237,237, 81, 81, 81, 84, 84, 84, 81, 81, 81,237, + 237,237,252,252,252,255,255,255,255,255,255,255,255,255,255,255,255, + 160,162,180, 60, 77,162, 76, 89,162, 77, 90,161, 74, 87,161, 73, 84, + 156,207,207,209, 80, 80, 77, 45, 45, 45, 74, 74, 74,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,151,154,186, + 36, 59,219, 0, 43,255, 0, 47,255, 0, 39,239, 45, 62,197,204,204, + 209, 65, 65, 63, 7, 7, 7, 60, 60, 60,251,251,251,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,254,254,254,234,234,238, + 19, 38,213, 0, 32,255, 80, 88,168,251,251,251,253,253,253, 55, 55, + 55, 0, 0, 0, 58, 58, 58,251,251,251,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,245,245,245, 28, 37,212, + 0, 16,255, 86, 89,166,255,255,255,254,254,254, 55, 55, 55, 1, 1, + 1, 58, 58, 58,251,251,251,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,242,242,242, 27, 28,213, 0, 3,255, + 85, 85,168,255,255,255,253,253,253, 55, 55, 55, 0, 0, 0, 58, 58, + 58,251,251,251,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,242,242,242, 27, 27,213, 0, 0,255, 84, 84,166, + 255,255,255,253,253,253, 57, 57, 57, 11, 11, 11, 60, 60, 60,251,251, + 251,255,255,255,251,251,251,248,248,248,255,255,255,255,255,255,255, + 255,255,242,242,242, 27, 27,220, 3, 4,166, 62, 62, 88,255,255,255, + 255,255,255, 71, 71, 71, 49, 49, 49, 71, 71, 71,255,255,255,255,255, + 255,100,100,100,127,127,127,255,255,255,255,255,255,255,255,255,242, + 242,242, 27, 27,224, 19, 19,138, 52, 52, 32,195,195,195,239,239,239, + 78, 78, 78, 93, 93, 93, 76, 76, 76,243,243,243,210,210,210, 40, 40, + 40,108,108,108,235,235,235,236,236,236,255,255,255,242,242,242, 29, + 29,225, 24, 24,153,113,113, 93, 65, 65, 65, 71, 71, 71, 84, 84, 81, + 139,139,138, 75, 75, 75, 74, 74, 74, 66, 66, 66,113,113,113,126,126, + 126, 78, 78,167, 88, 88,152,255,255,255,250,250,250, 48, 48,225, 37, + 38,161,103,103, 98,114,114,111,106,106,103,106,106,115,112,112,115, + 111,111,111,105,105,105,113,113,113,113,113,113,140,140,140, 83, 83, + 197, 45, 45,204,189,189,191,214,214,214, 59, 60,212, 81, 83,247, 72, + 72,146,208,208,208,143,143,161, 43, 44,213,125,125,156,226,226,226, + 225,225,225,225,225,225,221,221,221,240,240,240,105,105,181,113,114, + 255, 76, 76,207, 77, 77,191, 97, 98,244,127,128,255, 79, 79,220, 83, + 84,188, 87, 87,223,104,105,255,151,151,176,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,123,123,178, 80, 80,215, 84, 84, + 223, 80, 80,228, 81, 81,220, 74, 74,218, 79, 79,223, 77, 77,228, 83, + 83,239, 67, 68,231,170,170,187,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_edit : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0,235, 10, 0, 0,235, 10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 98,146, 94, 48, 48, 48, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 98,146, 94, 98,146, 94, + 98,146, 94, 88, 88, 88,220,220,220,255,255,255,255,255,255,255,255, + 255,255,255,255,160,160,160,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 0, 0, 0, 98,146, 94, 98,146, 94, 98,146, 94, + 88, 88, 88,220,220,220,160,160,160,160,160,160, 0, 0, 0,160,160, + 160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160,160, + 160,160, 0, 0, 0, 98,146, 94, 98,146, 94, 98,146, 94, 88, 88, 88, + 220,220,220,255,255,255,255,255,255, 88, 88, 88, 48, 48, 48, 0, 0, + 64,195,195,195,220,220,220,255,255,255,255,255,255,255,255,255, 0, + 0, 0, 98,146, 94, 98,146, 94, 98,146, 94, 88, 88, 88,220,220,220, + 255,255,255,255,255,255,255,255,255, 88, 88, 88,168,220,255, 0, 88, + 192, 0, 88,192,195,195,195,220,220,220,255,255,255, 0, 0, 0, 98, + 146, 94, 98,146, 94, 98,146, 94, 88, 88, 88,220,220,220,195,195,195, + 195,195,195,195,195,195,160,160,160,168,220,255,168,220,255,168,220, + 255, 0, 88,192, 0, 88,192,160,160,160, 0, 0, 0, 98,146, 94, 98, + 146, 94, 98,146, 94, 88, 88, 88,220,220,220,255,255,255,255,255,255, + 255,255,255,255,255,255, 88,168,255,168,220,255,168,220,255,168,220, + 255,168,220,255, 0, 0, 64, 0, 0, 0, 98,146, 94, 98,146, 94, 98, + 146, 94, 88, 88, 88,220,220,220,255,255,255,255,255,255,255,255,255, + 255,255,255,160,160,160,168,220,255,168,220,255, 0,128,255, 0,128, + 255, 0, 88,192, 48, 48, 48, 98,146, 94, 98,146, 94, 98,146, 94, 88, + 88, 88,220,220,220,195,195,195,195,195,195,195,195,195,195,195,195, + 195,195,195, 88,168,255,168,220,255, 0,128,255, 0,128,255, 0,128, + 255, 0, 88,192, 48, 48, 48, 98,146, 94, 98,146, 94, 88, 88, 88,220, + 220,220,255,255,255,255,255,255,255,255,255,255,255,255,195,195,195, + 255,255,255, 88,168,255, 88,168,255, 0,128,255, 0,128,255, 0,128, + 255, 0, 88,192, 0, 0, 64, 98,146, 94, 88, 88, 88,220,220,220,255, + 255,255,255,255,255,255,255,255,255,255,255,195,195,195,255,255,255, + 255,255,255, 88,168,255, 88,168,255, 0,128,255, 0,128,255, 0,128, + 255, 0, 88,192, 98,146, 94, 88, 88, 88,220,220,220,195,195,195,195, + 195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195,195, + 195,195,195, 88,168,255, 88,168,255, 0,128,255, 0,128,255, 0,128, + 255, 98,146, 94, 88, 88, 88,220,220,220,255,255,255,255,255,255,255, + 255,255,255,255,255,195,195,195,255,255,255,255,255,255,255,255,255, + 255,255,255, 88,168,255, 88,168,255, 0,128,255, 0,128,255, 98,146, + 94, 88, 88, 88,220,220,220,255,255,255,255,255,255,255,255,255,255, + 255,255,195,195,195,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255, 88,168,255, 88,168,255, 0,128,255, 98,146, 94, 88, 88, + 88,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220, + 220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220,220, + 88, 88, 88, 88,168,255, 88,168,255, 98,146, 94, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 98,146, 94, 98,146, 94); + +Const + stdimg_menu_quit_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,225,225,225,207,207,208,208,208, + 209,208,208,209,208,208,209,208,208,209,208,208,209,208,208,209,208, + 208,209,208,208,209,207,207,208,221,221,221,255,255,255,255,255,255, + 255,255,255,160,160,178, 31, 31,163, 31, 31,163, 31, 31,163, 31, 31, + 163, 31, 31,163, 31, 31,163, 31, 31,163, 31, 31,163, 31, 31,163, 31, + 31,163, 31, 31,163, 31, 31,163,141,141,166,254,254,254,255,255,255, + 33, 33,176, 6, 5,193, 0, 0,194, 0, 0,201, 0, 0,206, 0, 0, + 217, 24, 24,228, 26, 26,234, 12, 15,235, 6, 12,236, 26, 36,239, 36, + 48,241, 50, 67,251, 42, 47,189,255,255,255,255,255,255, 16, 16,173, + 0, 0,181, 0, 0,190, 0, 0,195,108,108,225,216,216,249,255,255, + 255,255,255,255,227,227,253,133,136,243, 24, 34,233, 31, 43,235, 45, + 60,239, 39, 46,196,255,255,255,255,255,255, 16, 16,170, 0, 0,181, + 1, 1,187,142,142,229,255,255,255,223,223,246,144,144,233,139,139, + 235,212,212,246,255,255,255,173,177,248, 32, 44,235, 42, 57,239, 38, + 45,195,255,255,255,255,255,255, 18, 18,168, 1, 1,179,105,105,214, + 255,255,255,173,173,233, 10, 10,206, 0, 0,213, 0, 0,221, 2, 2, + 224,149,151,238,255,255,255,147,153,246, 29, 43,237, 37, 44,193,255, + 255,255,255,255,255, 23, 23,166, 23, 23,185,211,211,242,246,246,252, + 51, 51,207, 30, 30,212, 31, 31,218, 19, 19,222, 0, 0,227, 7, 10, + 227,228,228,250,235,236,254, 41, 53,238, 34, 40,192,255,255,255,255, + 255,255, 27, 27,164, 51, 51,190,239,239,250,220,220,246, 44, 44,203, + 54, 54,212, 50, 50,217, 54, 54,223, 57, 56,230, 18, 19,230,181,182, + 247,255,255,255, 51, 60,238, 30, 35,190,255,255,255,255,255,255, 31, + 31,163, 58, 58,188,227,227,245,239,239,251, 67, 67,206, 61, 61,210, + 155,155,235,158,158,239, 73, 73,227, 74, 74,233,222,222,252,239,240, + 253, 30, 36,234, 28, 31,189,255,255,255,255,255,255, 36, 36,162, 65, + 65,188,170,170,222,255,255,255,159,159,229, 74, 74,208,238,238,251, + 244,244,253, 84, 84,224,149,149,239,255,255,255,197,197,244, 14, 16, + 231, 22, 23,187,255,255,255,255,255,255, 40, 40,162, 89, 89,193, 97, + 97,194,221,221,238,255,255,255,147,147,224,225,225,247,230,230,249, + 160,160,235,255,255,255,233,233,246,131,131,230, 99, 99,237, 23, 23, + 185,255,255,255,255,255,255, 46, 46,163,107,107,195,100,100,195,113, + 113,198,175,175,215,133,133,212,231,231,248,233,233,250,165,165,225, + 208,208,232,135,135,222,123,123,229,141,141,234, 53, 53,186,255,255, + 255,255,255,255, 55, 55,165,120,120,195,118,118,196,118,118,200,113, + 113,199,123,123,207,241,241,251,246,246,253,131,131,216,128,128,215, + 137,137,224,143,143,225,150,150,229, 68, 68,186,255,255,255,255,255, + 255, 84, 84,167,172,172,222,170,170,219,172,172,222,175,175,225,179, + 179,229,176,176,228,179,179,231,189,189,237,191,191,238,195,195,239, + 197,197,240,209,209,247,163,163,193,255,255,255,255,255,255,187,187, + 224,103,103,175,100,100,172,100,100,171,101,101,172,101,101,172,101, + 101,173,102,102,173,102,102,173,102,102,173,103,103,173,104,104,173, + 104,104,175,198,198,224,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_arrow_up : Array[0..77] of byte = ( + 66, 77, 78, 0, 0, 0, 0, 0, 0, 0, 62, 0, 0, 0, 40, 0, 0, + 0, 7, 0, 0, 0, 4, 0, 0, 0, 1, 0, 1, 0, 0, 0, 0, 0, + 16, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 2, 0, 0, 0, 2, + 0, 0, 0, 0, 0, 0, 0,255,255,255, 0, 0, 0, 0, 0,130, 0, + 0, 0,198, 0, 0, 0,238, 0, 0, 0); + +Const + stdimg_dialog_information_32 : Array[0..3125] of byte = ( + 66, 77, 54, 12, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 32, 0, 0, 0, 32, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254, + 254,254,252,252,252,248,248,248,245,245,245,243,243,243,241,241,241, + 239,239,239,239,239,239,241,241,241,243,243,243,245,245,245,249,249, + 249,252,252,252,254,254,254,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,254,254,254,249,249,249,243,243,243,238,238,238,233,233,233,229, + 229,229,223,223,223,216,216,216,201,201,201,198,198,198,207,207,207, + 209,209,209,214,214,214,221,221,221,228,228,228,232,232,232,236,236, + 236,242,242,242,250,250,250,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,254,254,254,248,248,248,242,242, + 242,236,236,236,230,230,230,223,223,223,210,210,210,195,195,195,117, + 117,117, 92, 92, 92, 92, 92, 92,112,112,112,170,170,170,183,183,183, + 194,194,194,206,206,206,218,218,218,229,229,229,234,234,234,240,240, + 240,246,246,246,254,254,254,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,249,249,249,243,243,243,238,238,238,232,232, + 232,226,226,226,215,215,215,154,154,154, 97, 97, 97,185,185,185,185, + 185,185,106,106,106,142,142,142,191,191,191,201,201,201,211,211,211, + 223,223,223,230,230,230,236,236,236,241,241,241,247,247,247,254,254, + 254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,251,251,251,247,247,247,242,242,242,208,214,214,123,144, + 144, 53, 84, 84, 44, 77, 77, 46, 80, 80, 44, 79, 79, 46, 78, 78, 64, + 90, 90,114,138,138,222,223,223,233,233,233,236,236,236,241,241,241, + 245,245,245,250,250,250,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255, 51, 88, 88, 65,125,125,118,178,177,148,198, + 196,177,224,221,167,213,210,154,203,200, 93,137,136, 63,104,105, 69, + 101,101,242,244,244,252,252,252,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 45, 88, 88, 90,161,161,242,251,250,197,244,242,198,247,244,185,233, + 231,141,183,181,126,169,169, 97,143,145, 49, 89, 89,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,154,174,174, 61,112,112, + 134,166,165,192,241,238,198,247,244,189,239,237,171,223,221, 80,123, + 123, 62,102,102,116,140,140,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 57, 95, 95, 71,134,133,193,230,229,186,234,232, + 183,230,227,167,210,209,143,186,186,135,185,185, 97,143,145, 49, 85, + 85,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 71, + 123,122,111,177,177,183,176,175,132,129,125,118,108,106,115,104,101, + 122,116,113,116,120,118, 85,106,105, 70,101,101,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,129,141,139,118,111,106,181, + 174,170,220,215,211,231,228,225,235,231,228,235,232,230,214,214,211, + 144,139,137,122,117,115,251,250,250,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,229,227,226,131,118,114,218,210,203,206,205,198,145,154,149,167, + 186,181,167,192,189,142,166,166,201,221,219,238,235,233,178,171,168, + 173,166,164,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,149,137,134,221,205, + 197,240,227,218,206,203,194,159,161,158,202,210,206,203,217,215,151, + 161,160,225,233,233,253,250,249,254,243,242,133,121,118,241,240,240, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,245,244,244,127,114,110,244,229,220,238,225,213,218,211, + 205,229,223,218,250,246,242,252,251,248,223,222,222,221,221,220,253, + 251,250,253,244,242,190,178,175,209,205,204,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,214,211,210, + 160,146,140,242,226,214,239,224,213,233,227,220,245,238,232,249,245, + 241,252,249,247,251,250,248,224,224,223,251,249,247,252,245,242,215, + 205,202,183,175,173,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,229,227,226,130,117,114,223,206,194,236,218,203, + 242,231,223,245,236,228,245,237,230,248,243,238,250,247,244,252,249, + 247,248,246,245,252,248,246,250,244,239,251,241,237,139,127,124,209, + 205,204,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,235,233,233,129, + 116,112,213,193,179,233,210,193,231,212,194,248,243,238,240,230,221, + 240,237,233,241,239,237,238,237,237,234,233,231,228,226,226,235,234, + 232,247,241,235,248,238,232,248,237,233,139,127,123,218,214,212,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,254,254,254,142,129,124,202,177,157,226,199,177,222, + 195,169,243,234,226,250,247,246,248,247,246,239,234,231,236,231,226, + 230,226,222,229,226,222,225,223,221,226,226,226,212,210,208,242,232, + 222,245,231,224,243,230,225,133,120,117,249,249,249,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,206,202, + 200,158,136,124,222,190,165,213,178,146,220,191,164,251,249,247,240, + 230,221,238,225,213,242,230,221,243,234,224,244,235,227,245,237,230, + 245,237,230,216,213,211,206,205,205,240,227,216,236,221,207,246,232, + 224,194,180,172,193,188,185,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,154,141,137,201,167,145,208,169, + 134,211,173,140,227,204,184,237,221,207,239,226,214,242,231,221,243, + 234,225,245,237,230,246,239,232,245,237,229,242,233,223,241,231,220, + 245,236,228,237,222,209,233,215,200,234,216,200,240,225,219,148,136, + 133,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,129,114,110,220,181,158,201,154,113,216,184,155,233,215, + 198,236,220,206,238,225,212,241,228,217,242,231,222,243,234,226,245, + 236,228,245,237,230,245,236,229,241,229,218,236,221,207,233,216,200, + 231,211,192,227,203,182,252,239,235,125,113,109,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,118,104,100, + 227,182,158,205,152,111,226,202,180,233,214,198,235,219,204,237,223, + 209,239,226,214,241,230,219,242,231,222,243,233,224,243,234,224,243, + 234,225,242,231,221,236,219,205,230,210,191,227,203,182,223,196,171, + 252,239,236,118,105,101,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,128,113,109,223,177,154,212,153,114, + 228,207,187,232,214,196,234,217,202,236,222,207,238,224,211,240,227, + 216,240,229,217,242,230,220,241,230,220,241,230,219,240,229,218,237, + 223,210,226,202,180,223,196,172,221,191,166,249,234,230,127,114,110, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,149,135,131,207,164,142,221,161,125,230,202,180,232,213,195, + 234,217,201,235,219,204,237,222,208,238,225,212,239,226,215,240,227, + 216,239,227,215,239,226,214,239,226,214,238,224,210,223,197,173,218, + 188,160,224,195,173,232,214,204,148,135,131,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,196,191,189,170, + 138,124,229,173,143,224,178,149,234,213,196,234,215,199,234,218,202, + 237,221,206,237,223,209,238,223,211,238,224,212,238,224,212,238,224, + 211,236,222,208,236,220,205,219,189,162,214,179,148,236,214,198,185, + 166,155,196,191,189,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,246,245,245,130,115,110,224,175,150,223, + 159,123,230,196,174,234,214,197,234,216,201,236,219,204,236,220,206, + 236,221,207,237,222,209,237,222,208,236,220,206,235,219,204,232,213, + 195,211,175,143,217,182,153,239,220,209,130,116,111,246,245,245,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,199,192,191,154,129,117,231,183,157,222,157,120,226, + 187,161,234,213,196,234,216,200,235,218,203,236,219,205,236,220,206, + 236,219,205,235,218,202,234,217,201,217,186,156,211,173,139,243,224, + 213,163,143,131,199,192,191,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,254, + 254,162,149,146,166,137,122,232,185,162,223,162,128,216,161,125,221, + 185,157,226,201,179,231,212,194,234,216,200,230,210,192,225,200,177, + 214,180,149,213,175,144,240,219,207,177,154,142,162,149,146,254,254, + 254,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,252,251,251,161,149, + 146,147,127,118,221,179,158,233,184,158,222,167,134,212,156,116,206, + 152,111,204,153,111,204,157,116,214,174,141,231,202,182,231,207,193, + 155,136,127,161,149,146,252,251,251,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,199,193,192,127,112, + 108,165,139,127,207,169,149,230,192,173,236,202,183,237,204,187,232, + 201,185,212,181,165,170,148,137,128,113,109,199,193,192,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,250,250,249,206,202,200,162,150, + 146,134,119,113,120,106,102,120,106,102,134,119,113,162,150,146,206, + 202,200,250,250,249,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255); + +Const + stdimg_link : Array[0..449] of byte = ( + 66, 77,194, 1, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 11, 0, 0, 0, 11, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 140, 1, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,128,128,128,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255, 0, 0, 0, 0, 0, 0,128,128,128,255,255,255,255,255,255,255, + 255,255, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255, 0, 0, 0, 0, 0, 0,128,128,128,255,255,255,255,255, + 255, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 0, 0, 0, 0, 0, 0,128,128,128,255,255,255, + 255,255,255, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0,128,128,128,255, + 255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255, + 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0,128,128, + 128,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, + 128,128,128,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, + 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, 0, + 0, 0,128,128,128,255,255,255,255,255,255,255,255,255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255, 0, 0, + 0, 0, 0, 0,128,128,128,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 0, 0, 0, 0, 0, 0,128,128,128,128,128,128,128,128,128,128,128, + 128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128,128, + 128,128, 0, 0, 0, 0, 0, 0); + +Const + stdimg_menu_exit_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,236,242,246,204, + 219,232,165,193,214,128,167,197, 99,148,184, 22, 94,147, 29, 99,151, + 153,153,153,113,113,113, 84, 84, 84, 81, 81, 81, 79, 79, 79, 76, 76, + 76, 74, 74, 74, 71, 71, 71, 69, 69, 69, 37,103,157, 50,116,168, 61, + 124,175, 71,132,181, 78,138,186, 62,126,173, 32,101,152,255,255,255, + 255,255,255, 88, 88, 88,162,162,162,162,162,162,163,163,163,164,164, + 164,164,164,164,165,165,165, 47,111,165,120,171,210,120,171,211,115, + 167,209,105,160,205, 64,127,174, 35,103,154,255,255,255,255,255,255, + 92, 92, 92,161,161,161, 60,115, 64,160,161,161,163,163,163,163,163, + 163,164,164,164, 54,116,170,125,175,212, 91,154,201, 84,149,199, 88, + 150,200, 65,128,174, 38,105,157,255,255,255,255,255,255, 96, 96, 96, + 160,160,160, 61,118, 65, 54,113, 57,162,162,162,162,162,162,163,163, + 163, 61,121,176,130,179,215, 98,159,204, 90,154,201, 94,155,202, 67, + 129,175, 44,109,160, 55,130, 62, 52,126, 59, 49,121, 55, 46,117, 52, + 73,145, 80, 70,143, 76, 57,115, 61,161,161,161,162,162,162, 69,126, + 180,136,183,217,103,163,207, 97,158,204, 99,159,204, 69,131,177, 49, + 113,164, 59,135, 66,137,203,146,132,200,141,128,198,136,123,195,131, + 119,193,127, 71,143, 77, 59,116, 63,161,161,161, 76,132,186,141,187, + 219,110,168,209,102,166,209, 95,180,223, 71,133,177, 55,117,169, 62, + 139, 70,143,206,153,125,198,135,120,195,129,115,192,124,116,192,124, + 121,194,129, 73,144, 79, 84,127, 87, 84,137,191,148,191,221,117,173, + 212, 99,184,225, 75,212,255, 66,139,184, 61,122,173, 65,144, 74,148, + 210,159,145,208,154,141,205,150,137,203,146,132,200,141, 81,152, 88, + 65,124, 70,159,159,159, 90,142,196,152,195,224,124,179,215,116,175, + 214, 94,196,237, 75,136,179, 69,127,178, 68,148, 77, 66,145, 75, 63, + 141, 72, 61,137, 69, 93,164,101, 90,160, 97, 69,131, 75,158,158,158, + 158,158,158, 96,146,201,158,199,226,131,184,218,125,180,215,126,179, + 215, 79,137,180, 75,132,183,255,255,255,255,255,255,119,119,119,154, + 154,154, 61,138, 69, 73,138, 79,156,156,156,157,157,157,157,157,157, + 102,150,204,162,203,227,137,189,220,131,185,218,132,185,218, 81,139, + 181, 82,137,188,255,255,255,255,255,255,122,122,122,153,153,153, 82, + 145, 89,153,154,153,155,155,155,156,156,156,156,156,156,108,154,208, + 167,206,229,143,193,223,137,189,220,139,189,220, 83,141,182, 90,142, + 194,255,255,255,255,255,255,125,125,125,153,153,153,153,153,153,154, + 154,154,154,154,154,155,155,155,155,155,155,111,157,211,170,209,231, + 171,209,231,152,199,225,145,194,222, 86,143,183, 96,147,198,255,255, + 255,255,255,255,128,128,128,126,126,126,124,124,124,122,122,122,119, + 119,119,117,117,117,114,114,114,113,158,212,111,158,214,135,178,220, + 171,211,232,169,208,230, 88,144,184,103,151,203,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,132,172,220,109,156,212, + 133,177,218, 90,145,185,109,156,207,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,177,202,232, + 108,156,211,112,158,210); + +Const + stdimg_menu_save_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,216,171,142,205,149,112,189,115, 66,183,104, 53,181,104, + 53,180,103, 52,178,102, 52,176,101, 51,174,100, 51,172, 99, 50,170, + 98, 50,169, 97, 50,168, 96, 49,167, 97, 50,171,105, 60,188,134, 97, + 195,125, 79,235,198,173,234,197,173,254,251,248,254,251,248,254,251, + 248,254,251,248,254,251,248,254,251,248,254,251,248,254,251,248,254, + 251,248,254,251,248,200,154,124,199,152,121,173,107, 64,186,108, 56, + 237,202,179,224,162,122,254,250,247, 98,192,136, 98,192,136, 98,192, + 136, 98,192,136, 98,192,136, 98,192,136, 98,192,136, 98,192,136,253, + 249,246,202,141,101,201,155,124,167, 97, 50,187,108, 56,238,204,182, + 225,162,122,254,250,247,191,220,194,191,220,194,191,220,194,191,220, + 194,191,220,194,191,220,194,191,220,194,191,220,194,253,249,246,205, + 144,104,204,158,129,168, 97, 50,187,107, 56,239,206,184,225,162,121, + 254,250,247, 98,192,136, 98,192,136, 98,192,136, 98,192,136, 98,192, + 136, 98,192,136, 98,192,136, 98,192,136,253,249,246,207,147,106,206, + 163,132,170, 97, 50,186,106, 54,239,208,187,226,162,122,254,251,248, + 254,251,248,254,251,248,254,251,248,254,251,248,254,251,248,254,251, + 248,254,251,248,254,251,248,254,251,248,211,150,109,210,167,138,171, + 98, 50,187,106, 54,240,210,190,226,163,122,226,163,122,225,163,122, + 226,163,123,225,163,123,224,161,120,222,159,119,221,159,118,220,157, + 116,217,155,114,216,153,113,214,153,112,213,171,142,173, 99, 51,187, + 106, 54,242,213,194,227,163,122,227,163,122,226,163,123,226,163,123, + 226,164,123,225,162,121,224,161,120,222,160,119,222,158,117,220,157, + 116,218,155,115,217,155,115,218,176,149,175,100, 51,187,106, 54,242, + 216,197,227,164,123,227,163,122,227,164,122,226,164,123,226,163,123, + 225,163,123,225,162,121,223,160,119,222,159,118,221,158,116,219,156, + 114,220,157,116,221,181,154,177,101, 52,187,107, 54,244,217,199,230, + 166,125,200,140,100,201,141,101,201,142,103,203,146,108,203,146,109, + 202,144,105,200,140,101,200,140,100,200,140,100,200,140,100,218,156, + 116,225,186,159,179,102, 52,187,108, 55,244,220,201,231,167,125,249, + 236,225,249,236,225,249,237,227,252,244,238,253,250,247,253,247,243, + 250,237,229,247,231,219,247,229,217,246,229,216,222,160,119,228,190, + 164,180,103, 52,189,110, 58,245,221,204,231,168,126,250,240,232,250, + 240,232,201,141,102,250,240,233,253,248,243,254,250,248,252,244,239, + 249,233,223,247,231,219,247,229,217,224,162,120,231,194,169,182,104, + 53,192,116, 66,246,223,208,232,168,126,252,246,241,252,246,241,200, + 140,100,250,241,233,251,244,238,253,250,247,253,249,246,250,240,232, + 248,232,221,247,230,219,225,163,122,239,213,195,183,106, 54,198,130, + 85,246,223,209,233,170,128,254,250,246,253,250,246,200,140,100,251, + 243,238,251,241,234,252,246,242,254,251,248,252,246,241,249,236,226, + 248,231,219,238,208,186,236,208,189,189,116, 67,214,165,133,246,224, + 209,247,224,209,254,251,248,254,251,247,253,249,246,252,245,240,250, + 240,234,251,242,237,253,249,246,253,250,247,251,241,235,248,233,223, + 236,209,190,205,146,106,226,197,177,225,189,166,217,171,141,201,137, + 94,192,117, 67,189,110, 58,187,108, 55,187,107, 54,187,106, 54,187, + 106, 54,188,108, 57,189,110, 59,187,109, 58,191,116, 68,201,141,101, + 231,206,188,255,255,255); + +Const + stdimg_btn_cancel_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255, 63, 61,237, 59, 56,235,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 33, + 31,227, 30, 28,226,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255, 74, 71,240, 79, 76,242, 64, 62,237, 60, 57,235,255,255, + 255,255,255,255,255,255,255,255,255,255, 39, 37,229, 36, 34,228, 49, + 47,234, 31, 29,226,255,255,255,255,255,255,255,255,255, 84, 81,243, + 88, 86,245, 99, 97,250, 88, 85,246, 65, 63,237, 61, 58,236,255,255, + 255,255,255,255, 48, 45,231, 44, 42,230, 65, 63,241, 76, 74,246, 49, + 47,234, 31, 29,226,255,255,255,255,255,255, 89, 86,245, 91, 88,246, + 101, 98,250,113,112,255, 89, 86,246, 66, 64,238, 62, 59,236, 57, 55, + 235, 53, 50,233, 71, 69,242, 99, 98,255, 74, 72,244, 47, 45,233, 34, + 32,227,255,255,255,255,255,255,255,255,255, 90, 87,245, 91, 89,246, + 102, 99,250,116,113,255, 90, 88,246, 67, 65,238, 62, 60,236, 80, 77, + 244,104,103,255, 80, 78,245, 54, 52,235, 42, 39,229,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 91, 88,246, 92, 90,246, + 103,100,250,116,114,255,115,112,255,112,110,255,110,108,255, 87, 85, + 247, 63, 61,238, 50, 48,232,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 92, 89,246, 93, 91,247, + 121,118,255, 89, 86,255, 87, 84,255,114,112,255, 72, 70,240, 60, 57, + 235,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255, 97, 94,248, 93, 90,246,125,121,255, + 94, 91,255, 91, 88,255,118,116,255, 70, 67,239, 65, 63,237,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,105,103,251,102, 99,249,112,109,251,128,126,255,126,123,255, + 124,121,255,121,119,255, 94, 92,247, 71, 68,239, 66, 64,238,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,113,110,253,110, + 107,252,119,116,253,134,130,255,118,115,252,100, 98,248, 96, 93,247, + 109,106,250,123,121,255, 96, 93,247, 72, 69,239, 67, 65,238,255,255, + 255,255,255,255,255,255,255,118,115,255,116,113,254,125,122,254,138, + 135,255,124,121,253,108,105,251, 99, 97,249, 95, 92,247, 97, 94,248, + 110,108,250,125,122,255, 97, 95,247, 73, 70,240, 68, 65,238,255,255, + 255,255,255,255,119,116,255,122,119,255,129,126,255,129,126,254,116, + 113,253,108,105,251,255,255,255,255,255,255, 96, 93,247, 98, 95,248, + 111,109,251,126,124,255, 98, 95,248, 74, 71,240, 69, 66,238,255,255, + 255,255,255,255,119,116,255,122,119,255,121,118,254,114,111,253,255, + 255,255,255,255,255,255,255,255,255,255,255, 97, 94,248,100, 97,248, + 106,104,249, 84, 81,243, 79, 77,242,255,255,255,255,255,255,255,255, + 255,255,255,255,119,116,255,119,116,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 98, 95,248, 93, 91,247, + 89, 86,245,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 99, 96,248,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_folder_up_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 198,167,146,138, 78, 37,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, + 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, + 74, 32,135, 74, 32,135, 74, 32,138, 78, 37,198,169,148,138, 78, 37, + 217,181,149,221,186,154,221,186,154,221,186,154,221,186,154,221,186, + 154,221,186,154,221,186,154,221,186,154,221,186,154,221,186,154,221, + 186,154,221,186,154,217,181,149,138, 79, 37,135, 74, 32,223,192,162, + 213,172,134,213,172,134,213,172,134,213,172,134,213,172,134,213,172, + 134,213,172,134,213,172,134,213,172,134,213,172,134,213,172,134,213, + 172,134,223,192,162,135, 74, 32,135, 74, 32,226,197,170,215,175,138, + 215,175,138,215,175,138,143, 85, 42,143, 85, 42,143, 85, 42,143, 85, + 42,143, 85, 42,143, 85, 42,215,175,138,215,175,138,215,175,138,226, + 197,170,135, 74, 32,135, 74, 32,228,202,177,217,179,143,217,179,143, + 217,179,143,143, 85, 42,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,217,179,143,217,179,143,228,202,177,135, + 74, 32,135, 74, 32,230,205,181,217,179,143,143, 85, 42,205,164,128, + 143, 85, 42,205,164,128,143, 85, 42,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,217,179,143,230,205,181,135, 74, 32,135, + 74, 32,231,207,184,217,179,143,182,133, 95,143, 85, 42,143, 85, 42, + 143, 85, 42,182,133, 95,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,231,207,184,135, 74, 32,135, 74, 32,232, + 210,188,217,179,143,217,179,143,205,164,128,143, 85, 42,205,164,128, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,232,210,188,135, 74, 32,136, 76, 34,230,209,188,234, + 212,192,234,212,192,234,212,192,234,212,192,234,212,192,226,197,169, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,234,212,192,135, 74, 32,139, 77, 36,136, 76, 34,135, 74, 32,135, + 74, 32,135, 74, 32,135, 74, 32,140, 82, 42,218,190,167,227,200,173, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,235,215, + 196,135, 74, 32,135, 74, 32,204,164,133,188,136, 95,188,136, 94,188, + 136, 94,188,136, 94,175,120, 80,144, 86, 46,220,194,172,236,217,199, + 236,217,199,236,217,199,236,217,199,236,217,199,233,214,196,138, 79, + 37,135, 74, 32,209,176,151,218,186,158,205,161,124,205,161,123,205, + 161,124,218,186,158,190,150,120,135, 74, 32,135, 74, 32,135, 74, 32, + 135, 74, 32,135, 74, 32,135, 74, 32,138, 78, 37,198,168,147,225,210, + 200,144, 89, 49,218,191,169,236,217,200,236,217,200,236,217,200,218, + 191,169,144, 89, 49,225,210,200,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,225,210, + 200,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,225, + 210,200,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_folder_open_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0,215, 13, 0, 0,215, 13, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 252,252,252,233,233,233,232,232,232,234,234,234,234,234,234,234,234, + 234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234,234, + 234,234,234,234,234,232,232,232,219,219,219,237,237,237,233,227,223, + 165,129,103,139, 82, 41,139, 82, 41,157,108, 74,157,108, 74,157,108, + 74,157,108, 74,157,108, 74,157,108, 74,157,108, 74,157,108, 74,157, + 108, 74,139, 82, 41,145,110, 84,255,255,255,251,249,247,139, 82, 41, + 209,165,123,210,165,124,210,165,124,210,165,124,210,165,124,210,165, + 124,210,165,124,210,165,124,210,165,124,210,165,124,210,165,124,209, + 165,123,139, 82, 41,246,239,233,231,219,211,157,104, 63,208,161,116, + 207,159,114,207,159,114,207,159,114,207,159,114,207,159,114,207,159, + 114,207,159,114,207,159,114,207,159,114,207,159,114,208,161,116,139, + 82, 41,222,196,174,139, 82, 41,196,151,112,208,162,119,207,160,117, + 207,160,117,207,160,117,207,160,117,207,160,117,207,160,117,207,160, + 117,207,160,117,207,160,117,207,160,117,208,162,119,154,100, 60,207, + 171,139,139, 82, 41,206,164,127,210,165,123,209,164,122,209,164,122, + 209,164,122,209,164,122,209,164,122,209,164,122,209,164,122,209,164, + 122,209,164,122,209,164,122,210,166,124,157,103, 62,139, 82, 41,139, + 82, 41,215,180,148,220,186,153,220,186,153,220,186,153,220,185,152, + 216,178,142,212,169,129,211,168,127,211,168,127,211,168,127,211,168, + 127,211,168,127,212,169,129,209,169,133,139, 82, 41,139, 82, 41,139, + 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41, + 210,173,142,218,180,145,217,179,145,217,179,145,217,179,145,217,179, + 145,217,180,145,217,183,152,139, 82, 41,255,255,255,139, 82, 41,127, + 120,111,253,253,253,248,249,249,243,241,240,210,190,176,139, 82, 41, + 139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, + 41,139, 82, 41,139, 82, 41,255,255,255,139, 82, 41,142,136,127,242, + 242,242,241,242,241,241,241,241,239,239,238,239,239,238,239,239,238, + 239,239,238,239,239,238,239,239,238,239,239,238,125,110, 96,139, 82, + 41,255,255,255,255,255,255,139, 82, 41,177,154,132,151,138,124,150, + 137,123,148,136,121,148,137,123,149,142,131,149,141,130,147,139,129, + 145,137,127,143,135,124,141,133,123,169,151,133,139, 82, 41,255,255, + 255,255,255,255,139, 82, 41,218,183,153,212,172,137,212,172,137,213, + 174,140,217,183,154,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41, + 139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,255,255,255,255,255, + 255,157,103, 62,197,159,132,213,181,155,213,181,155,211,179,152,139, + 82, 41,255,255,255,244,239,235,244,239,235,244,239,235,244,239,235, + 244,239,235,244,239,235,247,242,239,255,255,255,255,255,255,247,242, + 239,139, 82, 41,139, 82, 41,139, 82, 41,139, 82, 41,255,255,255,251, + 249,247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_folder_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 198,167,146,138, 78, 37,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, + 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, + 74, 32,135, 74, 32,135, 74, 32,138, 78, 37,198,169,148,138, 78, 37, + 217,181,149,221,186,154,221,186,154,221,186,154,221,186,154,221,186, + 154,221,186,154,221,186,154,221,186,154,221,186,154,221,186,154,221, + 186,154,221,186,154,217,181,149,138, 79, 37,135, 74, 32,223,192,162, + 213,172,134,213,172,134,213,172,134,213,172,134,213,172,134,213,172, + 134,213,172,134,213,172,134,213,172,134,213,172,134,213,172,134,213, + 172,134,223,192,162,135, 74, 32,135, 74, 32,226,197,170,215,175,138, + 215,175,138,215,175,138,215,175,138,215,175,138,215,175,138,215,175, + 138,215,175,138,215,175,138,215,175,138,215,175,138,215,175,138,226, + 197,170,135, 74, 32,135, 74, 32,228,202,177,217,179,143,217,179,143, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,217,179,143,217,179,143,228,202,177,135, + 74, 32,135, 74, 32,230,205,181,217,179,143,217,179,143,217,179,143, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,217,179,143,230,205,181,135, 74, 32,135, + 74, 32,231,207,184,217,179,143,217,179,143,217,179,143,217,179,143, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,217,179,143,231,207,184,135, 74, 32,135, 74, 32,232, + 210,188,217,179,143,217,179,143,217,179,143,217,179,143,217,179,143, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,217,179,143,232,210,188,135, 74, 32,136, 76, 34,230,209,188,234, + 212,192,234,212,192,234,212,192,234,212,192,234,212,192,226,197,169, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,217,179, + 143,234,212,192,135, 74, 32,139, 77, 36,136, 76, 34,135, 74, 32,135, + 74, 32,135, 74, 32,135, 74, 32,140, 82, 42,218,190,167,227,200,173, + 217,179,143,217,179,143,217,179,143,217,179,143,217,179,143,235,215, + 196,135, 74, 32,135, 74, 32,204,164,133,188,136, 95,188,136, 94,188, + 136, 94,188,136, 94,175,120, 80,144, 86, 46,220,194,172,236,217,199, + 236,217,199,236,217,199,236,217,199,236,217,199,233,214,196,138, 79, + 37,135, 74, 32,209,176,151,218,186,158,205,161,124,205,161,123,205, + 161,124,218,186,158,190,150,120,135, 74, 32,135, 74, 32,135, 74, 32, + 135, 74, 32,135, 74, 32,135, 74, 32,138, 78, 37,198,168,147,225,210, + 200,144, 89, 49,218,191,169,236,217,200,236,217,200,236,217,200,218, + 191,169,144, 89, 49,225,210,200,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,225,210, + 200,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,225, + 210,200,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_btn_close_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,183,183,183,174,174,174, 48,113,169, 44,110,166, 40,107, + 163, 36,104,160, 33,102,158, 29, 99,155, 26, 97,153, 23, 95,151, 20, + 92,148, 17, 91,147,108,108,108,108,108,108,255,255,255,255,255,255, + 255,255,255,255,255,255, 54,117,173,134,182,216,131,179,215,129,178, + 214,125,175,213,123,173,212,121,171,211,118,170,210,116,168,209, 21, + 93,149,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255, 60,121,177,139,185,218,102,162,206, 98,160,205, 95,157, + 203, 91,154,201, 88,151,200, 84,149,199,119,171,211, 25, 96,152,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 66,125,181,143,189,220,108,167,208,103,164,207,100,161,205, 96,158, + 204, 92,155,202, 89,153,201,123,173,212, 30,100,156,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255, 72,130,186, + 147,192,221,113,171,210,109,168,209,105,165,207,102,162,206, 98,159, + 204, 94,156,203,127,176,213, 35,103,159,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 78,134,190,152,195,223, + 119,175,213,115,172,211,111,169,210,107,167,208, 91,183,227, 84,194, + 237,129,180,215, 40,107,163,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255, 83,138,194,156,198,225,124,179,215, + 121,177,213,117,173,212,113,171,210, 95,186,228, 75,212,255,124,187, + 224, 46,111,167,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 89,142,198,160,201,227,130,184,217,126,181,216, + 122,178,214,119,175,213,115,172,211,109,171,212,140,186,218, 51,115, + 171,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255, 94,145,201,164,204,228,135,187,219,132,185,218,128,182,216, + 124,179,215,121,176,213,116,173,212,143,189,220, 57,119,175,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 99, + 149,205,168,207,229,140,191,221,136,189,220,133,186,219,129,183,217, + 126,180,215,122,178,214,148,193,221, 63,124,180,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,103,152,208,171, + 209,231,144,194,223,141,192,222,138,190,220,135,187,219,131,184,218, + 128,182,216,153,196,224, 69,128,184,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,107,155,211,174,212,232,171, + 211,232,170,209,231,168,207,229,165,205,228,162,203,228,160,201,226, + 157,199,225, 75,132,188,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,110,157,213,108,155,211,105,154,210,102, + 151,207, 99,149,205, 96,147,203, 92,144,200, 89,142,198, 85,139,195, + 81,136,192,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_edit_copy_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,180,183, + 181,134,139,137,133,138,136,133,138,136,133,138,136,133,138,136,133, + 138,136,133,138,136,164,167,166,194,197,196,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,136,141,139,244,244, + 244,246,247,247,245,246,246,251,252,252,251,251,251,212,212,212,150, + 154,152,226,228,227,133,138,136,194,197,196,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,136,141,139,249,250,250,239,240, + 240,239,240,240,239,240,240,250,250,250,250,250,250,149,154,152,250, + 250,250,226,227,227,133,138,136,157,161,160,219,220,220,195,197,196, + 195,197,196,195,197,196,135,140,138,253,254,254,239,240,240,239,240, + 240,239,240,240,239,240,240,250,250,250,149,154,152,250,250,250,247, + 248,248,226,228,227,133,138,136,196,198,197,249,249,249,249,250,250, + 249,249,249,136,141,139,255,255,255,239,240,240,239,240,240,239,240, + 240,239,240,240,239,240,240,137,142,140,137,142,140,137,142,140,137, + 142,140,133,138,136,196,198,197,252,252,252,245,245,245,245,245,245, + 136,141,139,255,255,255,239,240,240,198,199,199,198,199,199,198,199, + 199,198,199,199,198,199,199,238,238,238,246,247,247,195,196,195,133, + 138,136,196,198,197,255,255,255,246,246,246,225,226,226,135,140,138, + 255,255,255,239,240,240,239,240,240,239,240,240,239,240,240,239,240, + 240,239,240,240,239,240,240,250,250,250,243,243,243,133,138,136,196, + 198,197,255,255,255,246,247,247,246,246,246,136,141,139,255,255,255, + 239,240,240,198,199,199,198,199,199,198,199,199,198,199,199,198,199, + 199,239,240,240,239,240,240,255,255,255,133,138,136,196,198,197,255, + 255,255,247,247,247,226,227,227,135,140,138,255,255,255,239,240,240, + 239,240,240,239,240,240,239,240,240,239,240,240,239,240,240,239,240, + 240,239,240,240,255,255,255,133,138,136,196,198,197,255,255,255,247, + 248,248,247,247,247,136,141,139,255,255,255,239,240,240,198,199,199, + 198,199,199,198,199,199,198,199,199,198,199,199,198,199,199,239,240, + 240,255,255,255,133,138,136,196,198,197,255,255,255,247,248,248,227, + 228,228,135,140,138,255,255,255,239,240,240,239,240,240,239,240,240, + 239,240,240,239,240,240,239,240,240,239,240,240,239,240,240,255,255, + 255,133,138,136,196,198,197,255,255,255,247,248,248,247,248,248,136, + 141,139,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,133,138, + 136,196,198,197,255,255,255,247,248,248,227,228,228,170,173,173,133, + 138,136,133,138,136,133,138,136,133,138,136,133,138,136,133,138,136, + 133,138,136,133,138,136,133,138,136,133,138,136,177,180,179,196,198, + 197,255,255,255,247,248,248,247,247,247,247,247,247,247,247,247,247, + 247,247,247,247,247,247,248,248,247,248,248,255,255,255,194,197,196, + 255,255,255,255,255,255,255,255,255,255,255,255,196,198,197,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,194,197,196,255,255,255, + 255,255,255,255,255,255,255,255,255,219,220,220,194,197,196,194,197, + 196,194,197,196,194,197,196,194,197,196,194,197,196,194,197,196,194, + 197,196,194,197,196,194,197,196,217,219,218,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_edit_delete_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,186,188,188,145,148,147,173,176,175,255,255, + 255,255,255,255,144,148,146,158,161,160,163,166,164,255,255,255,255, + 255,255,219,220,219,151,153,153,189,191,190,255,255,255,255,255,255, + 255,255,255,141,145,144,250,250,250,151,154,153,169,172,171,159,162, + 161,150,154,152,238,239,239,170,174,172,155,158,157,152,155,154,139, + 142,141,255,255,255,172,175,175,255,255,255,255,255,255,255,255,255, + 186,188,188,142,146,145,246,246,246,153,156,155,171,173,172,143,147, + 144,224,225,224,178,180,180,211,213,212,152,155,154,236,236,236,160, + 163,162,212,213,213,255,255,255,255,255,255,255,255,255,255,255,255, + 141,144,143,221,222,221,142,147,144,201,201,201,138,143,140,206,208, + 207,164,166,165,200,200,200,124,128,127,227,228,228,146,149,148,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,117,121,120, + 203,205,204,133,138,135,166,167,166,146,147,147,179,180,179,146,147, + 146,182,183,182,124,128,127,189,190,189,123,126,125,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,106,110,109,205,206,206, + 108,111,111,172,174,173,109,112,111,175,177,176,108,111,110,178,180, + 179,111,115,114,179,180,180,109,113,112,255,255,255,255,255,255,255, + 255,255,165,118, 87,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32, + 135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, + 32,135, 74, 32,135, 74, 32,135, 74, 32,135, 74, 32,165,118, 87,135, + 74, 32,221,187,156,207,159,114,207,159,114,207,159,114,207,159,114, + 207,159,114,207,159,114,207,159,114,207,159,114,207,159,114,207,159, + 114,207,159,114,207,159,114,221,187,156,135, 74, 32,135, 74, 32,221, + 187,156,221,187,156,221,187,156,221,187,156,221,187,156,221,187,156, + 221,187,156,221,187,156,221,187,156,221,187,156,221,187,156,221,187, + 156,221,187,156,221,187,156,135, 74, 32,135, 74, 32,221,187,156,202, + 138, 88,202,138, 88,202,138, 88,202,138, 88,202,138, 88,202,138, 88, + 202,138, 88,202,138, 88,202,138, 88,202,138, 88,202,138, 88,202,138, + 88,221,187,156,135, 74, 32,135, 74, 32,221,187,156,134, 82, 44,134, + 81, 43,134, 81, 43,134, 81, 43,134, 81, 43,134, 81, 43,134, 82, 44, + 134, 82, 44,134, 82, 44,134, 82, 44,134, 82, 44,134, 82, 44,221,187, + 156,135, 74, 32,135, 74, 32,221,187,156,106, 91, 78,201,201,201,156, + 156,156,156,156,156,156,156,156,155,155,155,155,155,155,155,155,155, + 155,155,155,155,155,155,155,155,155,106, 91, 78,221,187,156,135, 74, + 32,135, 74, 32,221,187,156,119,124,122,217,217,217,189,189,189,189, + 189,189,189,189,189,189,189,189,188,188,188,188,188,188,188,188,188, + 191,191,191,192,192,192,119,124,122,221,187,156,135, 74, 32,195,165, + 144,135, 74, 32,133,138,136,231,231,231,215,215,215,214,214,214,214, + 214,214,214,214,214,214,214,214,213,213,213,213,213,213,218,218,218, + 220,220,220,133,138,136,135, 74, 32,195,165,144,255,255,255,255,255, + 255,133,138,136,241,241,241,235,235,235,235,235,235,235,235,235,234, + 234,234,234,234,234,234,234,234,234,234,234,234,234,234,233,233,233, + 133,138,136,255,255,255,255,255,255,255,255,255,255,255,255,171,174, + 173,133,138,136,133,138,136,133,138,136,133,138,136,133,138,136,133, + 138,136,133,138,136,133,138,136,133,138,136,133,138,136,171,174,173, + 255,255,255,255,255,255); + +Const + stdimg_search_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,252, + 253,254,231,238,244,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,250,251,253,100,148,186, 34, + 103,157,129,168,198,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,250,252,253,111,156,194, 85,141,188,137,181,221, 24, + 95,151,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,251,252, + 253,123,164,202,100,151,197,157,193,228,102,153,199, 49,113,165,255, + 255,255,255,255,255,255,255,255,255,255,255,255,254,254,233,207,186, + 219,178,146,211,166,128,208,161,124,210,166,133,174,161,153,117,162, + 204,171,203,232,118,164,206, 64,123,175,222,232,241,255,255,255,255, + 255,255,255,255,255,255,254,254,232,202,176,232,201,174,245,225,205, + 247,229,211,247,229,209,243,221,200,223,186,156,199,168,145,134,174, + 213, 80,135,187,225,234,243,255,255,255,255,255,255,255,255,255,255, + 255,255,241,219,200,237,208,183,248,232,217,245,222,200,243,216,189, + 243,214,187,244,219,194,247,228,210,223,187,157,160,151,149,227,236, + 245,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,238, + 206,178,247,231,215,246,225,204,244,219,194,244,218,192,243,216,189, + 243,215,187,244,219,194,243,222,201,210,168,135,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,240,206,175,249, + 236,223,245,223,200,245,221,198,244,220,195,244,218,193,243,217,190, + 243,215,189,248,230,211,211,166,128,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,244,211,181,249,237,225,246, + 225,204,245,223,201,245,222,199,244,220,196,244,219,194,244,218,192, + 248,231,214,215,171,135,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,248,219,193,249,235,222,247,231,214,246, + 225,204,245,224,202,245,222,200,245,221,197,246,225,203,245,226,208, + 223,185,153,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,252,234,216,248,226,204,250,238,227,247,231,214,246, + 226,206,246,225,203,246,227,208,249,234,221,236,207,181,236,212,191, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,251,228,206,249,226,205,250,236,222,249,238,226,249, + 237,226,248,233,218,240,213,189,237,208,183,255,254,254,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,252,234,217,250,221,194,246,214,185,244,211,181,243, + 212,184,245,224,205,255,255,254,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_dialog_warning_32 : Array[0..3125] of byte = ( + 66, 77, 54, 12, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 32, 0, 0, 0, 32, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 12, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,252,252,252,244,244,244,237,237,237,235,235, + 235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, + 235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, + 235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235,235, + 235,235,235,235,237,237,237,242,242,242,248,248,248,254,254,254,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,239,239,239, + 222,222,222,198,198,207,190,190,201,186,186,197,186,186,197,186,186, + 197,186,186,197,186,186,197,186,186,197,186,186,197,186,186,197,186, + 186,197,186,186,197,186,186,197,186,186,197,186,186,197,186,186,197, + 186,186,197,186,186,197,186,186,197,186,186,197,186,186,197,190,190, + 201,189,189,200,197,197,206,223,223,223,246,246,246,255,255,255,255, + 255,255,255,255,255,244,244,244,178,178,210, 22, 22,165, 0, 0,159, + 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0, + 159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, + 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, + 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0,159, 0, 0, + 159, 21, 21,165,173,173,209,250,250,250,255,255,255,255,255,255,243, + 243,243, 39, 39,171, 61, 61,196,112,112,224,117,117,226,116,116,226, + 113,113,225,111,111,225,108,108,224,105,105,223,102,102,223,100,100, + 222, 97, 97,222, 94, 94,221, 92, 92,220, 89, 89,220, 86, 86,219, 83, + 83,219, 81, 81,218, 78, 78,218, 75, 75,217, 72, 72,216, 69, 69,216, + 67, 67,215, 64, 64,215, 62, 62,214, 54, 54,212, 28, 28,188, 20, 20, + 166,246,246,246,255,255,255,255,255,255,253,253,253, 15, 15,166,121, + 121,221, 20, 20,208, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, + 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0, + 204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, + 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, 0, 0,204, + 0, 0,204, 10, 10,206, 56, 56,207, 2, 2,160,247,247,251,255,255, + 255,255,255,255,255,255,255, 90, 90,194, 89, 89,200, 58, 58,216, 0, + 0,204,163,163,219,210,210,224,210,210,224,211,211,225,212,212,226, + 212,212,226,213,213,227,214,214,228,215,215,229,216,216,230,216,216, + 230,217,217,231,217,217,231,218,218,232,218,218,232,219,219,233,220, + 220,234,221,221,235,222,222,236,193,193,231, 0, 0,204, 27, 27,209, + 44, 44,192, 53, 53,181,255,255,255,255,255,255,255,255,255,255,255, + 255,221,221,242, 25, 25,168,117,117,221, 8, 8,206, 80, 80,211,224, + 224,224,225,225,225,225,225,225,226,226,226,227,227,227,227,227,227, + 228,228,228,229,229,229,230,230,230,230,230,230,231,231,231,232,232, + 232,233,233,233,234,234,234,234,234,234,235,235,235,236,236,236,237, + 237,237,105,105,219, 3, 3,205, 59, 59,211, 14, 14,166,193,193,232, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,109,109, + 201, 85, 85,197, 68, 68,218, 2, 2,204,179,179,219,224,224,224,225, + 225,225,225,225,225,226,226,226,227,227,227,227,227,227,228,228,228, + 60, 60, 60, 55, 55, 55,230,230,230,231,231,231,232,232,232,233,233, + 233,234,234,234,234,234,234,235,235,235,205,205,231, 7, 7,205, 36, + 36,211, 47, 47,188, 70, 70,186,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,234,234,247, 23, 23,169,121,121, + 220, 14, 14,207, 59, 59,209,223,223,223,224,224,224,224,224,224,225, + 225,225,226,226,226,226,226,226,227,227,227, 55, 55, 55, 53, 53, 53, + 230,230,230,230,230,230,231,231,231,232,232,232,233,233,233,234,234, + 234,234,234,234, 82, 82,215, 8, 8,206, 67, 67,210, 10, 10,163,212, + 212,239,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,129,129,208, 74, 74,190, 81, 81,220, 0, 0, + 204,162,162,218,223,223,223,224,224,224,224,224,224,225,225,225,226, + 226,226,226,226,226,215,215,215,215,215,215,229,229,229,230,230,230, + 230,230,230,231,231,231,232,232,232,233,233,233,186,186,227, 1, 1, + 204, 47, 47,213, 46, 46,185, 96, 96,196,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 244,244,251, 25, 25,169,121,121,218, 23, 23,209, 42, 42,208,221,221, + 223,223,223,223,224,224,224,224,224,224,225,225,225,226,226,226, 37, + 37, 37, 37, 37, 37,228,228,228,229,229,229,229,229,229,230,230,230, + 231,231,231,232,232,232, 59, 59,211, 14, 14,207, 73, 73,209, 11, 11, + 164,228,228,245,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,151,151,216, + 63, 63,185, 94, 94,222, 0, 0,204,141,141,215,223,223,223,223,223, + 223,224,224,224,224,224,224,225,225,225, 27, 27, 27, 27, 27, 27,227, + 227,227,228,228,228,229,229,229,229,229,229,230,230,230,164,164,223, + 0, 0,204, 60, 60,215, 41, 41,179,120,120,205,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,251,251,253, 35, 35,174,116,116,215, + 34, 34,211, 27, 27,206,215,215,221,223,223,223,223,223,223,224,224, + 224,224,224,224, 13, 13, 13, 13, 13, 13,226,226,226,227,227,227,228, + 228,228,229,229,229,226,226,228, 40, 40,209, 24, 24,209, 75, 75,206, + 16, 16,167,241,241,250,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,172,172,224, 49, 49,178,106,106,223, 1, 1,204, + 121,121,213,222,222,222,222,222,222,223,223,223,224,224,224, 3, 3, + 3, 3, 3, 3,225,225,225,226,226,226,227,227,227,228,228,228,140, + 140,218, 1, 1,204, 75, 75,218, 34, 34,174,144,144,213,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254, + 254,255, 49, 49,179,109,109,211, 47, 47,213, 16, 16,206,206,206,220, + 222,222,222,222,222,222,215,215,215, 0, 0, 0, 0, 0, 0,217,217, + 217,225,225,225,226,226,226,218,218,226, 25, 25,207, 36, 36,211, 74, + 74,203, 27, 27,171,249,249,253,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,193,193,232, 36, + 36,173,117,117,224, 4, 4,205,102,102,212,221,221,221,222,222,222, + 204,204,204, 0, 0, 0, 0, 0, 0,206,206,206,225,225,225,225,225, + 225,118,118,216, 4, 4,205, 87, 87,219, 27, 27,170,167,167,222,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255, 69, 69,186,100,100,205, 59, + 59,216, 7, 7,205,195,195,219,221,221,221,193,193,193, 0, 0, 0, + 0, 0, 0,195,195,195,224,224,224,206,206,223, 12, 12,205, 49, 49, + 214, 70, 70,199, 45, 45,178,254,254,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,211,211,238, 25, 25,170,124,124,224, 8, 8,206, 82, + 82,210,221,221,221,218,218,218,207,207,207,207,207,207,220,220,220, + 223,223,223, 97, 97,213, 9, 9,206, 98, 98,219, 17, 17,166,189,189, + 230,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255, 92, 92,194, 89, 89,199, 72, 72,218, 2, 2,204,180,180,217,221, + 221,221,221,221,221,222,222,222,222,222,222,192,192,220, 4, 4,204, + 64, 64,217, 65, 65,194, 68, 68,186,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,226,226,244, 20, 20, + 168,128,128,224, 15, 15,207, 63, 63,209,220,220,220,221,221,221,221, + 221,221,222,222,222, 74, 74,210, 17, 17,207,104,104,219, 11, 11,163, + 210,210,238,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,114,114,202, 79, 79,193, 85, 85, + 220, 0, 0,204,162,162,215,220,220,220,220,220,220,173,173,217, 1, + 1,204, 80, 80,220, 59, 59,189, 92, 92,194,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,238,238,249, 20, 20,167,128,128,222, 25, 25,209, 44, 44, + 207,218,218,219,220,220,220, 53, 53,208, 28, 28,210,106,106,217, 10, + 10,164,226,226,244,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 137,137,211, 67, 67,187, 99, 99,223, 0, 0,204,143,143,214,152,152, + 214, 1, 1,204, 97, 97,223, 51, 51,184,118,118,204,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,246,246,252, 25, 25,169, + 122,122,218, 36, 36,211, 21, 21,206, 23, 23,205, 42, 42,212,104,104, + 215, 14, 14,165,239,239,249,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,158,158,218, 53, 53,181,113,113,225, + 1, 1,204, 3, 3,205,113,113,225, 41, 41,177,142,142,212,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,252,252,254, 37, 37,174,111,111,213, 66, 66,217, 70, 70,218, + 96, 96,210, 25, 25,170,248,248,252,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,180, + 180,227, 22, 22,168,109,109,218,106,106,218, 20, 20,169,165,165,221, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,140,140,211, 12, + 12,165, 8, 8,163,124,124,206,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,252,252,254,251,251,253,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255); + +Const + stdimg_hidden : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 15, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 18, 11, 0, 0, 18, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255, + 255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255, 0, 0, 0,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, + 0, 0,255,255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0,255, + 255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255,255, + 255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255, 0, 0, 0,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255, 0, 0, 0,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255, 0, 0, + 0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 255,255,255,255,255,255,255,255,255,255,255,255, 0, 0, 0,255,255, + 255,255,255,255,255,255,255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, 0, + 0, 0, 0, 0, 0, 0, 0, 0,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255, 0, 0, 0,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255, 0, 0, 0); + +Const + stdimg_document : Array[0..1061] of byte = ( + 66, 77, 38, 4, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 18, 0, 0, 0, 18, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 240, 3, 0, 0,235, 10, 0, 0,235, 10, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,135,135,135,135,135,135,135,135,135,135,135,135, 98, 98, + 98, 91, 91, 91, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, + 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 90, 97, 97, 97, + 135,135,135,135,135,135, 0, 0,135,135,135,135,135,135,135,135,135, + 88, 88, 88, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, 48, + 48, 48, 90, 90, 90,135,135,135,135,135,135, 0, 0,135,135,135,135, + 135,135,135,135,135, 88, 88, 88,182,193,198,182,193,198,172,189,196, + 163,184,195,154,179,194,145,175,192,136,170,191,127,165,190,118,160, + 189,115,158,188, 48, 48, 48, 90, 90, 90,135,135,135,135,135,135, 0, + 0,135,135,135,135,135,135,135,135,135, 88, 88, 88,222,222,222,225, + 237,244,216,232,242,208,228,240,200,222,238,191,218,236,184,214,233, + 176,209,231,167,204,229,120,161,188, 48, 48, 48, 90, 90, 90,135,135, + 135,135,135,135, 0, 0,135,135,135,135,135,135,135,135,135, 88, 88, + 88,222,222,222,233,241,247,137,144,148,132,141,147,127,139,146,122, + 136,145,117,133,143,112,130,142,176,209,231,127,163,188, 48, 48, 48, + 90, 90, 90,135,135,135,135,135,135, 0, 0,135,135,135,135,135,135, + 135,135,135, 88, 88, 88,222,222,222,242,246,250,234,242,248,226,238, + 245,218,233,242,210,228,240,201,224,238,193,220,236,186,214,233,133, + 166,188, 48, 48, 48, 90, 90, 90,135,135,135,135,135,135, 0, 0,135, + 135,135,135,135,135,135,135,135, 88, 88, 88,222,222,222,251,252,252, + 148,151,152,143,148,151,138,145,149,133,142,148,128,139,146,123,136, + 145,194,219,236,138,168,188, 48, 48, 48, 90, 90, 90,135,135,135,135, + 135,135, 0, 0,135,135,135,135,135,135,135,135,135, 88, 88, 88,222, + 222,222,255,255,255,252,253,253,244,248,250,235,243,248,228,238,245, + 220,234,243,212,230,241,202,223,236,144,171,188, 48, 48, 48, 90, 90, + 90,135,135,135,135,135,135, 0, 0,135,135,135,135,135,135,135,135, + 135, 88, 88, 88,222,222,222,255,255,255,155,155,155,154,154,154,148, + 151,152,143,148,151,139,145,149,134,143,148,212,226,236,151,174,188, + 48, 48, 48, 90, 90, 90,135,135,135,135,135,135, 0, 0,135,135,135, + 135,135,135,135,135,135, 88, 88, 88,223,223,223,255,255,255,255,255, + 255,255,255,255,254,254,254,245,248,251,237,244,248,227,237,243,220, + 231,238,151,174,188, 48, 48, 48, 90, 90, 90,135,135,135,135,135,135, + 0, 0,135,135,135,135,135,135,135,135,135, 88, 88, 88,222,222,222, + 255,255,255,155,155,155,155,155,155,155,155,155,155,155,155,246,249, + 251,236,240,244,217,224,231,175,182,190, 48, 48, 48, 90, 90, 90,135, + 135,135,135,135,135, 0, 0,135,135,135,135,135,135,135,135,135, 88, + 88, 88,222,222,222,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,245,245,246,222,224,226,177,183,188,132,137,143, 48, 48, + 48, 90, 90, 90,135,135,135,135,135,135, 0, 0,135,135,135,135,135, + 135,135,135,135, 88, 88, 88,222,222,222,255,255,255,155,155,155,155, + 155,155,155,155,155,255,255,255,137,137,137,112,112,112,107,107,107, + 66, 66, 66, 48, 48, 48, 96, 96, 96,135,135,135,135,135,135, 0, 0, + 135,135,135,135,135,135,135,135,135, 88, 88, 88,222,222,222,255,255, + 255,255,255,255,255,255,255,255,255,255,252,252,252,112,112,112,206, + 206,206,255,255,255,153,153,153, 48, 48, 48,135,135,135,133,133,133, + 135,135,135, 0, 0,135,135,135,135,135,135,135,135,135, 88, 88, 88, + 222,222,222,255,255,255,255,255,255,255,255,255,255,255,255,234,234, + 234,109,109,109,255,255,255,153,153,153, 88, 88, 88,135,135,135,133, + 133,133,135,135,135,135,135,135, 0, 0,135,135,135,135,135,135,135, + 135,135, 88, 88, 88,222,222,222,222,222,222,222,222,222,222,222,222, + 222,222,222,177,183,188, 88, 88, 88,153,153,153, 88, 88, 88,135,135, + 135,133,133,133,135,135,135,135,135,135,135,135,135, 0, 0,135,135, + 135,135,135,135,135,135,135, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, 88, + 135,135,135,133,133,133,135,135,135,135,135,135,135,135,135,135,135, + 135, 0, 0,135,135,135,135,135,135,135,135,135,135,135,135,135,135, + 135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135, + 135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135,135, + 135,135,135,135,135,135, 0, 0); + +Const + stdimg_menu_preferences_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,215,194,180,135, 74, 32,135, 74, 32,135, 74, 32,223,207, + 196,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 135, 74, 32,190,165,146,184,156,134,184,156,134,135, 74, 32,223,207, + 196,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,193, + 196,195,154,158,157,193,196,195,255,255,255,255,255,255,135, 74, 32, + 204,187,173,167,145,125,181,149,122,174,139,114,135, 74, 32,223,207, + 196,255,255,255,255,255,255,255,255,255,219,220,220,133,138,136,158, + 161,160,133,138,136,255,255,255,255,255,255,135, 74, 32,204,187,173, + 164,141,120,162,138,116,180,149,122,179,147,124,135, 74, 32,255,255, + 255,255,255,255,219,220,220,133,138,136,210,211,212,194,195,196,133, + 138,136,255,255,255,255,255,255,232,221,213,135, 74, 32,212,200,189, + 164,141,120,164,141,120,190,165,146,135, 74, 32,255,255,255,219,220, + 220,133,138,136,226,227,228,194,196,198,133,138,136,193,196,195,255, + 255,255,255,255,255,255,255,255,243,237,233,135, 74, 32,204,187,173, + 204,187,173,179,147,124,135, 74, 32,193,196,195,133,138,136,211,211, + 212,189,190,191,133,138,136,219,220,220,253,253,253,255,255,255,255, + 255,255,255,255,255,255,255,255,243,237,233,135, 74, 32,135, 74, 32, + 135, 74, 32,133,131,125,170,173,173,200,201,202,189,190,191,133,138, + 136,219,220,220,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 181,183,184,133,138,136,183,184,185,133,138,136,219,220,220,253,253, + 253,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,219, + 220,220,133,138,136,133,138,136,133,138,136,133,138,136,208,209,210, + 163,164,164,133,138,136,193,196,195,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,219,220,220,133,138,136,243, + 243,243,239,240,240,237,238,238,234,236,236,182,185,186,133,138,136, + 219,220,220,133,138,136,219,220,220,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,133,138,136,245,246,246,169,172,171,133, + 138,136,247,247,247,226,227,229,170,173,173,245,246,246,255,255,255, + 219,220,220,133,138,136,219,220,220,255,255,255,255,255,255,255,255, + 255,255,255,255,219,220,220,133,138,136,255,255,255,219,220,220,133, + 138,136,250,250,250,133,138,136,255,255,255,255,255,255,255,255,255, + 219,220,220,133,138,136,135,140,138,179,179,179,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,133,138,136,238, + 240,240,133,138,136,255,255,255,255,255,255,255,255,255,255,255,255, + 133,138,136,240,240,240,133,138,136,179,179,179,255,255,255,255,255, + 255,255,255,255,255,255,255,133,138,136,233,235,236,133,138,136,219, + 220,220,255,255,255,255,255,255,255,255,255,255,255,255,179,179,179, + 133,138,136,238,239,239,133,138,136,255,255,255,255,255,255,255,255, + 255,255,255,255,219,220,220,133,138,136,219,220,220,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,179,179,179, + 133,138,136,219,220,220,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255); + +Const + stdimg_choice_no_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,217,217,217, 98, 98,162,164,164,178,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,152,152,171,101,101,160,227,227,227,255,255,255, + 214,214,216, 48, 48,162, 55, 55,241, 19, 19,202,152,152,172,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,254,254,254,135, + 135,164, 17, 17,205, 48, 48,234, 61, 61,154,226,226,226,102,102,162, + 8, 8,224, 72, 72,245, 76, 76,240, 5, 5,200,135,135,163,255,255, + 255,255,255,255,255,255,255,249,249,249,116,116,157, 5, 5,205, 90, + 90,239, 90, 90,244, 9, 9,217,126,126,165, 85, 85,174, 34, 34,254, + 55, 55,255, 89, 89,255, 74, 74,237, 5, 5,199,119,119,156,253,253, + 253,244,244,244, 98, 98,152, 8, 8,206, 90, 90,237,115,115,255, 85, + 85,255, 54, 54,253,110,110,169,151,151,196, 29, 29,255, 43, 43,255, + 57, 57,255, 86, 86,255, 69, 69,235, 5, 5,196,102,102,148, 85, 85, + 147, 9, 9,203, 84, 84,237,106,106,255, 80, 80,255, 65, 65,255, 52, + 52,255,175,175,199,255,255,255,147,147,196, 30, 30,255, 43, 43,255, + 53, 53,255, 74, 74,255, 55, 55,232, 1, 1,187, 6, 6,192, 68, 68, + 237, 88, 88,255, 71, 71,255, 62, 62,255, 54, 54,249,171,171,200,255, + 255,255,255,255,255,255,255,255,163,163,199, 31, 31,251, 47, 47,255, + 60, 60,255, 78, 78,255, 49, 49,232, 55, 55,237, 75, 75,255, 56, 56, + 255, 50, 50,255, 55, 55,241,188,188,206,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,184,184,206, 77, 77,238, 97, 97,255, + 96, 96,255, 96, 96,255, 98, 98,255, 98, 98,255, 91, 91,255, 73, 73, + 227,207,207,217,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,226,226,226, 43, 43,156, 61, 61,244, 99, 99,255, + 99, 99,255,100,100,255,100,100,255, 54, 54,237, 75, 75,146,247,247, + 247,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,214, + 214,214, 47, 47,123, 0, 0,166, 49, 49,242,107,107,255,106,106,255, + 106,106,255,105,105,255, 33, 33,230, 0, 0,152, 82, 82,127,240,240, + 240,255,255,255,255,255,255,255,255,255,212,212,213, 43, 43,115, 0, + 0,164, 55, 55,243,121,121,255,120,120,255,121,121,255,121,121,255, + 120,120,255,116,116,255, 38, 38,229, 0, 0,146, 82, 82,123,239,239, + 239,255,255,255,228,228,228, 45, 45,112, 0, 0,156, 66, 66,242,138, + 138,255,137,137,255,136,136,255,102,102,209,103,103,224,141,141,255, + 136,136,255,132,132,255, 42, 42,227, 0, 0,139, 91, 91,128,250,250, + 250,182,182,189, 0, 0,156, 73, 73,242,155,155,255,153,153,255,153, + 153,255,115,115,207,249,249,249,222,222,227,110,110,228,158,158,255, + 153,153,255,148,148,255, 47, 47,229, 13, 13,130,230,230,230,186,186, + 198, 85, 85,254,174,174,255,169,169,255,168,168,255,119,119,205,246, + 246,246,255,255,255,255,255,255,218,218,224,118,118,228,175,175,255, + 169,169,255,169,169,255, 60, 60,222,233,233,233,242,242,242,127,127, + 208,187,187,255,187,187,255,122,122,207,246,246,246,255,255,255,255, + 255,255,255,255,255,255,255,255,218,218,224,126,126,228,200,200,255, + 164,164,255,152,152,199,253,253,253,255,255,255,249,249,249,126,126, + 210,127,127,214,248,248,248,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,218,218,224,121,121,231,154,154,197, + 255,255,255,255,255,255); + +Const + stdimg_edit_cut_16 : Array[0..821] of byte = ( + 66, 77, 54, 3, 0, 0, 0, 0, 0, 0, 54, 0, 0, 0, 40, 0, 0, + 0, 16, 0, 0, 0, 16, 0, 0, 0, 1, 0, 24, 0, 0, 0, 0, 0, + 0, 3, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 0, 0, 0, 0, 0, + 0, 0, 0,255,255,255,172,172,226, 37, 37,178, 26, 26,175, 29, 29, + 174,209,209,239,255,255,255,255,255,255,255,255,255,255,255,255,172, + 172,226, 70, 70,190, 27, 27,176, 39, 39,179,209,209,239,255,255,255, + 255,255,255, 49, 49,182, 41, 41,219, 36, 36,209, 31, 31,206, 31, 31, + 177,209,209,239,255,255,255,255,255,255,209,209,239, 29, 29,177, 36, + 36,212, 34, 34,208, 31, 31,206, 39, 39,178,255,255,255,255,255,255, + 19, 19,173, 33, 33,208,255,255,255,117,117,213, 35, 35,211, 52, 52, + 184,255,255,255,255,255,255, 59, 59,187, 37, 37,214,114,114,214,255, + 255,255, 35, 35,210, 22, 22,173,255,255,255,255,255,255, 43, 43,179, + 37, 37,213,134,134,213,255,255,255, 38, 38,208, 13, 13,170,255,255, + 255,255,255,255, 5, 5,169, 38, 39,205,255,255,255,137,137,214, 34, + 34,209, 43, 43,179,255,255,255,255,255,255,172,172,226, 7, 7,168, + 35, 35,209, 73, 73,192, 26, 27,194, 1, 1,166,255,255,255,241,242, + 250, 30, 31,205, 25, 27,193, 74, 74,193, 33, 33,206, 7, 7,167,143, + 143,216,255,255,255,255,255,255,255,255,255,142,142,215, 9, 9,170, + 34, 34,210, 31, 31,206, 16, 17,184, 92, 94,196, 6, 7,169, 26, 26, + 201, 34, 34,209, 33, 33,203, 12, 12,170,171,171,225,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,127,127,210, + 33, 33,175, 6, 6,166, 70, 75,163, 2, 2,166, 25, 26,199, 37, 37, + 178,131,131,211,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,212,214,213, + 132,137,137,195,198,197,175,178,179, 52, 55,160,231,232,232,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,181,184,183,184,188,187, + 230,232,231,167,172,170,139,144,142,184,187,186,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,231,232,232,136,141,139,223,225,225,245,246,245, + 151,156,154,165,169,168,140,145,143,231,232,232,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,152,156,154,178,182,181,247,247,247,142,147,145,156,160,159, + 179,182,181,182,187,185,172,175,174,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,255,255,255,228,229,229,136, + 141,139,217,220,219,239,240,239,171,175,173,184,187,186,179,184,182, + 203,206,205,137,142,140,197,199,198,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,255,255,255,144,148,146,176,181,179,246, + 247,247,155,159,157,202,204,203,255,255,255,141,146,144,201,206,204, + 172,176,175,156,160,159,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,255,255,255,136,141,139,208,212,210,239,240,239,179, + 183,181,255,255,255,255,255,255,225,227,226,167,172,170,195,200,198, + 142,147,145,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,255,255,255,143,148,146,247,247,247,170,173,172,202,204,203,255, + 255,255,255,255,255,255,255,255,152,156,155,208,211,210,169,173,171, + 255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255, + 255,221,223,222,145,149,148,162,166,165,255,255,255,255,255,255,255, + 255,255,255,255,255,185,187,186,148,152,150,255,255,255,255,255,255, + 255,255,255,255,255,255); diff --git a/prototypes/fpgui2/source/core/x11/fpGFX2.lpk b/prototypes/fpgui2/source/core/x11/fpGFX2.lpk new file mode 100644 index 00000000..e5e642d5 --- /dev/null +++ b/prototypes/fpgui2/source/core/x11/fpGFX2.lpk @@ -0,0 +1,115 @@ +<?xml version="1.0"?> +<CONFIG> + <Package Version="2"> + <Name Value="fpGFX2"/> + <Author Value="Graeme Geldenhuys"/> + <CompilerOptions> + <Version Value="5"/> + <SearchPaths> + <IncludeFiles Value="../../"/> + <OtherUnitFiles Value="../;../../gui/"/> + <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> + </SearchPaths> + <CodeGeneration> + <Optimizations> + <OptimizationLevel Value="0"/> + </Optimizations> + </CodeGeneration> + <Other> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> + <Description Value="fpGFX redesign with multiple handles per window +"/> + <License Value="Modified LGPL +"/> + <Version Minor="1"/> + <Files Count="18"> + <Item1> + <Filename Value="x11_xft.pas"/> + <UnitName Value="x11_xft"/> + </Item1> + <Item2> + <Filename Value="x11_keyconv.pas"/> + <UnitName Value="x11_keyconv"/> + </Item2> + <Item3> + <Filename Value="../gfxbase.pas"/> + <UnitName Value="gfxbase"/> + </Item3> + <Item4> + <Filename Value="../gfxbaseinterfaces.pas"/> + <UnitName Value="gfxbaseinterfaces"/> + </Item4> + <Item5> + <Filename Value="gfx_x11.pas"/> + <UnitName Value="gfx_x11"/> + </Item5> + <Item6> + <Filename Value="../fpgfx.pas"/> + <UnitName Value="fpgfx"/> + </Item6> + <Item7> + <Filename Value="../gfx_stdimages.pas"/> + <UnitName Value="gfx_stdimages"/> + </Item7> + <Item8> + <Filename Value="../gfx_imgfmt_bmp.pas"/> + <UnitName Value="gfx_imgfmt_bmp"/> + </Item8> + <Item9> + <Filename Value="../gfx_widget.pas"/> + <UnitName Value="gfx_widget"/> + </Item9> + <Item10> + <Filename Value="../../gui/gui_form.pas"/> + <UnitName Value="gui_form"/> + </Item10> + <Item11> + <Filename Value="../../gui/gui_label.pas"/> + <UnitName Value="gui_label"/> + </Item11> + <Item12> + <Filename Value="../../gui/gui_button.pas"/> + <UnitName Value="gui_button"/> + </Item12> + <Item13> + <Filename Value="../../gui/gui_edit.pas"/> + <UnitName Value="gui_edit"/> + </Item13> + <Item14> + <Filename Value="../../gui/gui_combobox.pas"/> + <UnitName Value="gui_combobox"/> + </Item14> + <Item15> + <Filename Value="../../gui/gui_popupwindow.pas"/> + <UnitName Value="gui_popupwindow"/> + </Item15> + <Item16> + <Filename Value="../../gui/gui_scrollbar.pas"/> + <UnitName Value="gui_scrollbar"/> + </Item16> + <Item17> + <Filename Value="../../gui/gui_memo.pas"/> + <UnitName Value="gui_memo"/> + </Item17> + <Item18> + <Filename Value="../gfx_utf8utils.pas"/> + <UnitName Value="gfx_UTF8utils"/> + </Item18> + </Files> + <RequiredPkgs Count="1"> + <Item1> + <PackageName Value="FCL"/> + <MinVersion Major="1" Valid="True"/> + </Item1> + </RequiredPkgs> + <UsageOptions> + <UnitPath Value="$(PkgOutDir)/"/> + </UsageOptions> + <PublishOptions> + <Version Value="2"/> + <IgnoreBinaries Value="False"/> + </PublishOptions> + </Package> +</CONFIG> diff --git a/prototypes/fpgui2/source/core/x11/fpGFX2.pas b/prototypes/fpgui2/source/core/x11/fpGFX2.pas new file mode 100644 index 00000000..2818c30e --- /dev/null +++ b/prototypes/fpgui2/source/core/x11/fpGFX2.pas @@ -0,0 +1,17 @@ +{ This file was automatically created by Lazarus. Do not edit! +This source is only used to compile and install the package. + } + +unit fpGFX2; + +interface + +uses + x11_xft, x11_keyconv, gfxbase, gfxbaseinterfaces, gfx_x11, fpgfx, + gfx_stdimages, gfx_imgfmt_bmp, gfx_widget, gui_form, gui_label, gui_button, + gui_edit, gui_combobox, gui_popupwindow, gui_scrollbar, gui_memo, + gfx_UTF8utils; + +implementation + +end. diff --git a/prototypes/fpgui2/source/core/x11/gfx_x11.pas b/prototypes/fpgui2/source/core/x11/gfx_x11.pas new file mode 100644 index 00000000..2e1d5d79 --- /dev/null +++ b/prototypes/fpgui2/source/core/x11/gfx_x11.pas @@ -0,0 +1,1391 @@ +unit gfx_x11; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + X, + Xlib, + XUtil, + x11_xft, + x11_keyconv, + gfxbase; + +type + TfpgWinHandle = TXID; + TfpgGContext = Xlib.TGc; + +type + PInt = ^integer; + + TXIC = record + dummy: Pointer; + end; + PXIC = ^TXIC; + + TXIM = record + dummy: Pointer; + end; + PXIM = ^TXIM; + + PXdbeSwapInfo = ^TXdbeSwapInfo; + + TXdbeSwapInfo = record + Window: TfpgWinHandle; + SwapAction: PChar; + end; + +type + TfpgWindowImpl = class; + + + TfpgFontResourceImpl = class(TfpgFontResourceBase) + private + FFontData: PXftFont; + protected + property Handle: PXftFont read FFontData; + public + constructor Create(const afontdesc: string); + destructor Destroy; override; + function HandleIsValid: boolean; + function GetAscent: integer; + function GetDescent: integer; + function GetHeight: integer; + function GetTextWidth(const txt: string): integer; + end; + + + TfpgImageImpl = class(TfpgImageBase) + private + FXimg: TXImage; + FXimgmask: TXImage; + FMasked: boolean; + function XImage: PXImage; + function XImageMask: PXImage; + protected + procedure DoFreeImage; + procedure DoInitImage(acolordepth, awidth, aheight: integer; aimgdata: Pointer); + procedure DoInitImageMask(awidth, aheight: integer; aimgdata: Pointer); + public + constructor Create; + end; + + + TfpgCanvasImpl = class(TfpgCanvasBase) + private + FDrawing: boolean; + FDrawWindow: TfpgWindowImpl; + FBufferPixmap: TPixmap; + FDrawHandle: TXID; + Fgc: TfpgGContext; + FColorText: TfpgColor; + FColor: TfpgColor; + FCurFontRes: TfpgFontResourceImpl; + FClipRect: TfpgRect; + FClipRectSet: boolean; + FLineStyle: integer; + FLineWidth: integer; + FXftDraw: PXftDraw; + FXftDrawBuffer: PXftDraw; + FColorTextXft: TXftColor; + FClipRegion: TRegion; + protected + procedure DoSetFontRes(fntres: TfpgFontResourceImpl); + procedure DoSetTextColor(cl: TfpgColor); + procedure DoSetColor(cl: TfpgColor); + procedure DoSetLineStyle(awidth: integer; astyle: TfpgLineStyle); + procedure DoDrawString(x, y: TfpgCoord; const txt: string); + procedure DoGetWinRect(var r: TfpgRect); + procedure DoFillRectangle(x, y, w, h: TfpgCoord); + procedure DoXORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); + procedure DoFillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); + procedure DoDrawRectangle(x, y, w, h: TfpgCoord); + procedure DoDrawLine(x1, y1, x2, y2: TfpgCoord); + procedure DoSetClipRect(const rect: TfpgRect); + function DoGetClipRect: TfpgRect; + procedure DoAddClipRect(const rect: TfpgRect); + procedure DoClearClipRect; + procedure DoDrawImagePart(x, y: TfpgCoord; img: TfpgImageImpl; xi, yi, w, h: integer); + procedure DoBeginDraw(awin: TfpgWindowImpl; buffered: boolean); + procedure DoPutBufferToScreen(x, y, w, h: TfpgCoord); + procedure DoEndDraw; + public + constructor Create; + destructor Destroy; override; + end; + + + TfpgWindowImpl = class(TfpgWindowBase) + protected + FWinHandle: TfpgWinHandle; + FModalForWin: TfpgWindowImpl; + procedure DoAllocateWindowHandle(aparent: TfpgWindowImpl); + procedure DoReleaseWindowHandle; + function HandleIsValid: boolean; override; + procedure DoSetWindowTitle(const atitle: string); + procedure DoMoveWindow(x, y: TfpgCoord); + procedure DoUpdateWindowPosition(aleft, atop, awidth, aheight: TfpgCoord); + property WinHandle: TfpgWinHandle read FWinHandle; + public + constructor Create(AOwner: TComponent); override; + end; + + + TfpgApplicationImpl = class(TfpgApplicationBase) + protected + FDisplay: PXDisplay; + DisplayDepth: integer; + DefaultBackground: TfpgColor; + DefaultForeground: TfpgColor; + DefaultScreen: integer; + DefaultVisual: PVisual; + DefaultColorMap: TColorMap; + RootWindow: TfpgWinHandle; + xia_clipboard: TAtom; + xia_motif_wm_hints: TAtom; + xia_wm_protocols: TAtom; + xia_wm_delete_window: TAtom; + xia_wm_state: TAtom; + xia_wm_state_modal: TAtom; + xia_targets: TAtom; + InputMethod: PXIM; + InputContext: PXIC; + LastClickWindow: TfpgWinHandle; // double click generation + LastWinClickTime: longword; + public + constructor Create(const aparams: string); override; + destructor Destroy; override; + function DoMessagesPending: boolean; + procedure DoWaitWindowMessage(atimeoutms: integer); + procedure DoFlush; + function GetScreenWidth: TfpgCoord; + function GetScreenHeight: TfpgCoord; + property Display: PXDisplay read FDisplay; + end; + + +implementation + +uses + baseunix, + fpgfx, + gfx_widget, {$Note This dependency to gfx_widget must be removed.} + xatom, + gfx_UTF8utils; + +var + xapplication: TfpgApplication; + +const + // map X11 event types to custom event types + MSG_KEYPRESS = KeyPress; + MSG_KEYRELEASE = KeyRelease; + MSG_MOUSEDOWN = ButtonPress; + MSG_MOUSEUP = ButtonRelease; + MSG_MOUSEMOVE = MotionNotify; + MSG_MOUSEENTER = EnterNotify; + MSG_MOUSEEXIT = LeaveNotify; + MSG_ACTIVATE = FocusIn; + MSG_DEACTIVATE = FocusOut; + // = KeymapNotify; + MSG_PAINT = Expose; + MSG_CLOSE = ClientMessage; // Take note of this! + // = MapNotify; + // = ReparentNotify // OnCreate event + MSG_SCROLL = 65; + MSG_RESIZE = 66; + MSG_POPUPCLOSE = 67; + MSG_MOVE = 68; + MSG_DOUBLECLICK = 69; + + + // some externals + +// defines: +procedure XRenderSetPictureClipRectangles(disp: PXDisplay; pic: TPicture; xorigin, yorigin: integer; + rect: PXRectangle; num: integer); cdecl; external; + +// redefines: +function XmbLookupString(p1: PXIC; ev: PXKeyPressedEvent; str: PChar; len: longword; ks: PKeySym; + stat: PStatus): longint; cdecl; external; + +// Double buffer functions +function XdbeQueryExtension(ADisplay: PXDisplay; AMajor, AMinor: PInt): PStatus; cdecl; external; +function XdbeAllocateBackBufferName(ADisplay: PXDisplay; AWindow: TfpgWinHandle; ASwapAction: PChar): TfpgWinHandle; + cdecl; external; +function XdbeSwapBuffers(ADisplay: PXDisplay; ASwapInfo: PXdbeSwapInfo; AScreenNums: integer): PStatus; + cdecl; external; +function XdbeDeallocateBackBufferName(ADisplay: PXDisplay; ABuffer: TfpgWinHandle): PStatus; cdecl; external; + +function XOpenIM(para1: PDisplay; para2: PXrmHashBucketRec; para3: Pchar; para4: Pchar): PXIM; cdecl; external; +function XCreateIC(para1: PXIM; para2: array of const): PXIC; cdecl; external; + + +function ConvertTo565Pixel(rgb: longword): word; +begin + Result := (rgb and $F8) shr 3; + Result := Result or ((rgb and $FC00) shr 5); + Result := Result or ((rgb and $F80000) shr 8); +end; + +function fpgColorToX(col: TfpgColor): longword; +var + xc: TXColor; + c: TfpgColor; +begin + c := fpgColorToRGB(col); + + if xapplication.DisplayDepth >= 24 then + Result := c + else if xapplication.DisplayDepth = 16 then + Result := ConvertTo565Pixel(c) + else + begin + c := col; + xc.blue := (c and $000000FF) shl 8; + xc.green := (c and $0000FF00); + xc.red := (c and $00FF0000) shr 8; + + // THIS CALL IS TOO SLOW !!!!!: + XAllocColor(xapplication.display, xapplication.DefaultColorMap, @xc); + Result := xc.pixel; + end; +end; + +procedure SetXftColor(col: TfpgColor; var colxft: TXftColor); +var + c: TfpgColor; +begin + c := fpgColorToRGB(col); + + colxft.color.blue := (c and $000000FF) shl 8; + colxft.color.green := (c and $0000FF00); + colxft.color.red := (c and $00FF0000) shr 8; + + colxft.color.alpha := (c and $7F000000) shr 15; + colxft.color.alpha := colxft.color.alpha xor $FFFF; // invert: 0 in ptkColor means not translucent + + colxft.pixel := 0; +end; + +type + PWindowLookupRec = ^WindowLookupRec; + + WindowLookupRec = record + w: TfpgWindowImpl; + Next: PWindowLookupRec; + end; + +var + FirstWindowLookupRec: PWindowLookupRec; + LastWindowLookupRec: PWindowLookupRec; + +procedure AddWindowLookup(w: TfpgWindowImpl); +var + p: PWindowLookupRec; +begin + if w = nil then + Exit; + + New(p); + p^.w := w; + p^.Next := nil; + if FirstWindowLookupRec = nil then + FirstWindowLookupRec := p + else + LastWindowLookupRec^.Next := p; + LastWindowLookupRec := p; +end; + +procedure RemoveWindowLookup(w: TfpgWindowImpl); +var + prevp: PWindowLookupRec; + p: PWindowLookupRec; + px: PWindowLookupRec; +begin + p := FirstWindowLookupRec; + prevp := nil; + + while p <> nil do + if p^.w = w then + begin + if prevp = nil then + FirstWindowLookupRec := p^.Next + else + prevp^.Next := p^.Next; + if LastWindowLookupRec = p then + LastWindowLookupRec := prevp; + px := p; + p := p^.Next; + Dispose(px); + end + else + begin + prevp := p; + p := p^.Next; + end; +end; + +function FindWindowByHandle(wh: TfpgWinHandle): TfpgWindowImpl; +var + p: PWindowLookupRec; +begin + p := FirstWindowLookupRec; + while p <> nil do + begin + if p^.w.WinHandle = wh then + begin + Result := p^.w; + Exit; + end; + p := p^.Next; + end; + Result := nil; +end; + +function GetXEventName(Event: longint): string; +const + EventNames: array[2..34] of string = ( + 'KeyPress', 'KeyRelease', 'ButtonPress', 'ButtonRelease', 'MotionNotify', + 'EnterNotify', 'LeaveNotify', 'FocusIn', 'FocusOut', 'KeymapNotify', + 'Expose', 'GraphicsExpose', 'NoExpose', 'VisibilityNotify', 'CreateNotify', + 'DestroyNotify', 'UnmapNotify', 'MapNotify', 'MapRequest', 'ReparentNotify', + 'ConfigureNotify', 'ConfigureRequest', 'GravityNotify', 'ResizeRequest', + 'CirculateNotify', 'CirculateRequest', 'PropertyNotify', 'SelectionClear', + 'SelectionRequest', 'SelectionNotify', 'ColormapNotify', 'ClientMessage', + 'MappingNotify'); +begin + if (Event >= Low(EventNames)) and (Event <= High(EventNames)) then + Result := EventNames[Event] + else + Result := '#' + IntToStr(Event); +end; + +{ TfpgApplicationImpl } + +constructor TfpgApplicationImpl.Create(const aparams: string); +var + wa: TXWindowAttributes; +begin + FIsInitialized := False; + FDisplay := XOpenDisplay(PChar(aparams)); + + if FDisplay = nil then + Exit; //==> + + DefaultScreen := XDefaultScreen(Display); + RootWindow := XRootWindow(FDisplay, DefaultScreen); + DefaultBackground := XBlackPixel(FDisplay, DefaultScreen); + DefaultForeground := XWhitePixel(FDisplay, DefaultScreen); + + DefaultVisual := XDefaultVisual(FDisplay, DefaultScreen); + DisplayDepth := XDefaultDepth(FDisplay, DefaultScreen); + + //Writeln('display depth: ',DisplayDepth); + DefaultColorMap := XDefaultColorMap(FDisplay, DefaultScreen); + + // Initialize atoms + xia_clipboard := XInternAtom(FDisplay, 'CLIPBOARD', longbool(0)); + xia_targets := XInternAtom(FDisplay, 'TARGETS', longbool(0)); + xia_motif_wm_hints := XInternAtom(FDisplay, '_MOTIF_WM_HINTS', longbool(0)); + xia_wm_protocols := XInternAtom(FDisplay, 'WM_PROTOCOLS', longbool(0)); + xia_wm_delete_window := XInternAtom(FDisplay, 'WM_DELETE_WINDOW', longbool(0)); + xia_wm_state := XInternAtom(FDisplay, '_NET_WM_STATE', longbool(0)); + xia_wm_state_modal := XInternAtom(FDisplay, '_NET_WM_STATE_MODAL', longbool(0)); + + // for correct keyboard handling + InputMethod := XOpenIM(FDisplay, nil, nil, nil); + if InputMethod = nil then + Exit; + + InputContext := XCreateIC(InputMethod, [XNInputStyle, XIMPreeditNothing or XIMStatusNothing, 0]); + if InputContext = nil then + Exit; + + FIsInitialized := True; + xapplication := TfpgApplication(self); +end; + +destructor TfpgApplicationImpl.Destroy; +begin + XCloseDisplay(FDisplay); + inherited Destroy; +end; + +function TfpgApplicationImpl.DoMessagesPending: boolean; +begin + Result := (XPending(display) > 0); +end; + +function GetParentWindow(wh: TfpgWinHandle; var pw, rw: TfpgWinHandle): boolean; +var + rootw: TfpgWinHandle; + parentw: TfpgWinHandle; + childs: ^TfpgWinHandle; + cnum: longword; +begin + childs := nil; + if XQueryTree(xapplication.display, wh, @rootw, @parentw, @childs, @cnum) <> 0 then + begin + pw := parentw; + rw := rootw; + Result := True; + end + else + Result := False; + if childs <> nil then + XFree(childs); +end; + +function GetDecorationWindow(wh: TfpgWinHandle): TfpgWinHandle; +var + lpw: TfpgWinHandle; + pw: TfpgWinHandle; + rw: TfpgWinHandle; + bok: boolean; +begin + pw := wh; + repeat + lpw := pw; + bok := GetParentWindow(lpw, pw, rw); + until (not bok) or (pw = rw); + if bok then + Result := lpw + else + Result := 0; +end; + +function X11keycodeToScanCode(akeycode: word): word; +begin + case akeycode and $ff of + $09..$5B: Result := akeycode - 8; + $6C: Result := $11C; // numpad enter + $6D: Result := $11D; // right ctrl + $70: Result := $135; // numpad / + $62: Result := $148; + $64: Result := $14B; + $66: Result := $14D; + $68: Result := $150; + $6A: Result := $152; + $61: Result := $147; + $63: Result := $149; + $6B: Result := $153; + $67: Result := $14F; + $69: Result := $151; + $71: Result := $138; + else + Result := akeycode; + end; +end; + +procedure TfpgApplicationImpl.DoWaitWindowMessage(atimeoutms: integer); +var + ev: TXEvent; + n: integer; + i: integer; + r: integer; + i2: integer; + ks: integer; + uc: word; + a: array[1..16] of char; + ss: integer; + sr: integer; + p: PChar; + blockmsg: boolean; + b: boolean; + w: TfpgWindowImpl; + ew: TfpgWindowImpl; + kwg: TfpgWidget; + wh: TfpgWinHandle; + wa: TXWindowAttributes; + px: integer; + py: integer; + mcode: integer; + msgp: TfpgMessageParams; + rfds: TFDSet; + xfd: integer; +begin + xfd := XConnectionNumber(display); + + repeat + if (atimeoutms >= 0) and (XPending(display) <= 0) then + begin + // waiting some event for the given timeout + + // this Select handles only the first 256 file descriptors + // poll would be better but FPC has no official poll interface (if I'm right) + if atimeoutms > 0 then + begin + fpFD_ZERO(rfds); + fpFD_SET(xfd, rfds); + r := fpSelect(xfd + 1, @rfds, nil, nil, atimeoutms); + end + else + r := 0; + + if r <= 0 then + Exit; // no event received. + end; + XNextEvent(display, @ev); + until (not XFilterEvent(@ev, 0)); + + blockmsg := False; + fillchar(msgp, sizeof(msgp), 0); + + // WriteLn('Event ',GetXEventName(ev._type),': ', ev._type,' window: ', ev.xany.window); + + // According to a comment in X.h, the valid event types start with 2! + if ev._type < 2 then + exit; + + + case ev._type of + MSG_KEYPRESS, + MSG_KEYRELEASE: + begin + msgp.keyboard.keycode := X11keycodeToScanCode(ev.xkey.keycode); + msgp.keyboard.shiftstate := ev.xkey.state; + + kwg := FindKeyboardFocus; + if kwg <> nil then + w := kwg + else + w := FindWindowByHandle(ev.xkey.window); + + //Writeln('XKey event(',ev._type,'):', + // IntToHex(ev.xkey.keycode,4),' (',ev.xkey.keycode,'), shift=',IntToHex(ev.xkey.state,4)); + + if ev._type = MSG_KEYPRESS then + begin + fpgPostMessage(nil, w, FPGM_KEYPRESS, msgp); + + //Writeln('scancode: ',IntToHex(X11keycodeToScanCode(ev.xkey.keycode),4) + // ,' (',X11keycodeToScanCode(ev.xkey.keycode),')'); + + // force some function keys to send as keychar too + + uc := msgp.keyboard.keycode; + + b := True; + case uc of + $01: uc := $001B; // esc + $0E: uc := $0008; // backspace + $1C, $11C: uc := $000D; // enter + $0F: uc := $0009; // tab + $3B..$44, + $57, $58, // F1 .. F12 + $147..$149, // nav keys + $14B, $14D, + $14F..$153: + uc := uc or $FF00; + else + b := False; + end; + + if b then + begin + msgp.keyboard.keycode := uc; + fpgPostMessage(nil, w, FPGM_KEYCHAR, msgp); + end + else + begin + // try to convert it to some char + sr := 0; + r := XmbLookupString(InputContext, PXKeyPressedEvent(@ev), @a, 16, @ks, @sr); + uc := ks and $FFFF; + + KeySymToUnicode(ks, @uc); + msgp.keyboard.keycode := uc; + fpgPostMessage(nil, w, FPGM_KEYCHAR, msgp); + end; + end + else if ev._type = MSG_KEYRELEASE then + fpgPostMessage(nil, w, FPGM_KEYRELEASE, msgp); + end; + + MSG_MOUSEDOWN, + MSG_MOUSEUP: + begin + msgp.mouse.x := ev.xbutton.x; + msgp.mouse.y := ev.xbutton.y; + msgp.mouse.Buttons := ev.xbutton.button; + msgp.mouse.shiftstate := ev.xbutton.state; + + w := FindWindowByHandle(ev.xbutton.window); + if not blockmsg then + begin + if (ev.xbutton.button >= 4) and (ev.xbutton.button <= 7) then // mouse wheel + begin + // generate scroll events: + if ev._type = MSG_MOUSEDOWN then + begin + if ev.xbutton.button > 5 then + i := 1 + else + i := 3; // amount +// fpgPostMessage(nil, ewg, MSG_SCROLL, ev.xbutton.button mod 4, i, ev.xbutton.state ); + end; + end + else + begin + if ev._type = MSG_MOUSEUP then + mcode := FPGM_MOUSEUP + else + mcode := FPGM_MOUSEDOWN; + fpgPostMessage(nil, w, mcode, msgp); + end; { if/else } + end; { if not blocking } + end; + + MSG_PAINT: + begin + repeat + // + until not XCheckTypedWindowEvent(display, ev.xany.window, MSG_PAINT, @ev); + + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_PAINT); + end; + + MSG_MOUSEMOVE: + begin + repeat + // + until not XCheckTypedWindowEvent(display, ev.xbutton.window, MSG_MOUSEMOVE, @ev); + + if not blockmsg then + begin + msgp.mouse.x := ev.xmotion.x; + msgp.mouse.y := ev.xmotion.y; + msgp.mouse.Buttons := (ev.xmotion.state and $FF00) shr 8; + msgp.mouse.shiftstate := ev.xmotion.state and $FF; + fpgPostMessage(nil, FindWindowByHandle(ev.xbutton.window), FPGM_MOUSEMOVE, msgp); + end; + end; + + // message blockings for modal windows + MSG_CLOSE: + if not blockmsg then + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_CLOSE); + + + ConfigureNotify: + begin + repeat + // + until not XCheckTypedWindowEvent(display, ev.xany.window, ConfigureNotify, @ev); + + msgp.rect.Left := ev.xconfigure.x; + msgp.rect.Top := ev.xconfigure.y; + msgp.rect.Width := ev.xconfigure.Width; + msgp.rect.Height := ev.xconfigure.Height; + + w := FindWindowByHandle(ev.xconfigure.window); + if w <> nil then + begin + if w.FWindowType <> wtChild then + begin + wh := GetDecorationWindow(ev.xconfigure.window); + if wh > 0 then + begin + XGetWindowAttributes(display, wh, @wa); + msgp.rect.Left := wa.x; + msgp.rect.Top := wa.y; + end; + end; + + if (w.FWidth <> msgp.rect.Width) or (w.FHeight <> msgp.rect.Height) then + fpgPostMessage(nil, w, FPGM_RESIZE, msgp); + + if (w.FLeft <> msgp.rect.Left) or (w.FTop <> msgp.rect.Top) then + fpgPostMessage(nil, w, FPGM_MOVE, msgp); + end; + end; + +{ + SelectionNotify: + begin + ProcessSelection(ev); + end; + + SelectionRequest: + begin + ProcessSelectionRequest(ev); + end; +} + + MSG_ACTIVATE: + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_ACTIVATE); + + MSG_DEACTIVATE: + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_DEACTIVATE); + + MSG_MOUSEENTER: + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_MOUSEENTER); + + MSG_MOUSEEXIT: + fpgPostMessage(nil, FindWindowByHandle(ev.xany.window), FPGM_MOUSEEXIT); + + else + {$Note This needs attention} + WriteLn('fpGFX/X11: Unhandled X11 event received: ', GetXEventName(ev._type)); + end; +end; + +procedure TfpgApplicationImpl.DoFlush; +begin + XFlush(FDisplay); +end; + +function TfpgApplicationImpl.GetScreenWidth: TfpgCoord; +var + wa: TXWindowAttributes; +begin + XGetWindowAttributes(FDisplay, RootWindow, @wa); + Result := wa.Width; +end; + +function TfpgApplicationImpl.GetScreenHeight: TfpgCoord; +var + wa: TXWindowAttributes; +begin + XGetWindowAttributes(FDisplay, RootWindow, @wa); + Result := wa.Height; +end; + +{ TfpgWindowImpl } + +procedure TfpgWindowImpl.DoAllocateWindowHandle(aparent: TfpgWindowImpl); +var + pwh: TfpgWinHandle; + wh: TfpgWinHandle; + attr: TXSetWindowAttributes; + mask: longword; + bcolor: longword; + hints: TXSizeHints; +begin + if FWinHandle > 0 then + Exit; + + if aparent <> nil then + pwh := aparent.WinHandle + else + pwh := xapplication.RootWindow; + + FillChar(attr, sizeof(attr), 0); + mask := 0; + if FWindowType in [wtPopup] then + begin + attr.Override_Redirect := longbool(1); + mask := CWOverrideRedirect; + end; + + AdjustWindowStyle; + + wh := XCreateWindow(xapplication.Display, pwh, + FLeft, FTop, FWidth, FHeight, 0, + CopyFromParent, + InputOutput, + xapplication.DefaultVisual, + mask, @attr); + + FWinHandle := wh; + hints.flags := 0; + + if not (waAutoPos in FWindowAttributes) then + hints.flags := hints.flags or PPosition; + + if waScreenCenterPos in FWindowAttributes then + begin + hints.flags := hints.flags or PPosition; + + FLeft := (xapplication.ScreenWidth - FWidth) div 2; + FTop := (xapplication.ScreenHeight - FHeight) div 2; + DoMoveWindow(FLeft, FTop); + end; + + if (FWindowType <> wtChild) and (waSizeable in FWindowAttributes) then + begin + hints.flags := hints.flags or PMinSize; + hints.min_width := FMinWidth; + hints.min_height := FMinHeight; + end + else + begin + hints.flags := hints.flags or PMinSize or PMaxSize; + hints.min_width := FWidth; + hints.min_height := FHeight; + hints.max_width := FWidth; + hints.max_height := FHeight; + end; + + XSetWMNormalHints(xapplication.display, FWinHandle, @hints); + + if FWindowType <> wtChild then + XSetWMProtocols(xapplication.Display, FWinHandle, @(xapplication.xia_wm_delete_window), + 1);// send close event instead of quitting the whole application... + + // for modal windows, this is necessary + if (FWindowType = wtModalForm) and (aparent <> nil) then + XSetTransientForHint(xapplication.display, self.FWinHandle, aparent.WinHandle); + + XSelectInput(xapplication.Display, wh, KeyPressMask or KeyReleaseMask or + ButtonPressMask or ButtonReleaseMask or + EnterWindowMask or LeaveWindowMask or + ButtonMotionMask or PointerMotionMask or + ExposureMask or FocusChangeMask or + StructureNotifyMask); + + SetWindowParameters; + XMapWindow(xapplication.Display, wh); + AddWindowLookup(self); +end; + +procedure TfpgWindowImpl.DoReleaseWindowHandle; +begin + if FWinHandle <= 0 then + Exit; + + RemoveWindowLookup(self); + XDestroyWindow(xapplication.Display, FWinHandle); + + FWinHandle := 0; +end; + +function TfpgWindowImpl.HandleIsValid: boolean; +begin + Result := (FWinHandle > 0); +end; + +procedure TfpgWindowImpl.DoMoveWindow(x, y: TfpgCoord); +begin + if FWinHandle > 0 then + XMoveWindow(xapplication.display, FWinHandle, x, y); +end; + +procedure TfpgWindowImpl.DoUpdateWindowPosition(aleft, atop, awidth, aheight: TfpgCoord); +var + w: longword; + h: longword; +begin + if awidth > 1 then + w := awidth + else + w := 1; + if aheight > 1 then + h := aheight + else + h := 1; + + if FWinHandle > 0 then + XMoveResizeWindow(xapplication.display, FWinHandle, aleft, atop, w, h); +end; + +procedure TfpgWindowImpl.DoSetWindowTitle(const atitle: string); +var + s8: string; + p: PByte; +begin + if FWinHandle <= 0 then + Exit; + + s8 := atitle; + + if length(s8) > 0 then + p := @s8[1] + else + p := nil; + XChangeProperty(xapplication.display, FWinHandle, 39, 31, 8, 0, p, length(s8)); + XChangeProperty(xapplication.display, FWinHandle, 37, 31, 8, 0, p, length(s8)); + + { +var + tp: TXTextProperty; +begin + tp.value := PCUChar(ATitle); + tp.encoding := XA_WM_NAME; + tp.format := 8; + tp.nitems := UTF8Length(ATitle); + + XSetWMName(xapplication.display, FWinHandle, @tp); + XStoreName(xapplication.display, FWinHandle, PChar(ATitle)); + XSetIconName(xapplication.display, FWinHandle, PChar(ATitle)); + XSetWMIconName(xapplication.display, FWinHandle, @tp); + +} +end; + +constructor TfpgWindowImpl.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FWinHandle := 0; +end; + +{ TfpgFontResourceImpl } + +constructor TfpgFontResourceImpl.Create(const afontdesc: string); +begin + FFontData := XftFontOpenName(xapplication.display, xapplication.DefaultScreen, PChar(afontdesc)); +end; + +destructor TfpgFontResourceImpl.Destroy; +begin + if HandleIsValid then + XftFontClose(xapplication.Display, FFontData); + + inherited; +end; + +function TfpgFontResourceImpl.HandleIsValid: boolean; +begin + Result := (FFontData <> nil); +end; + +function TfpgFontResourceImpl.GetAscent: integer; +begin + Result := FFontData^.ascent; +end; + +function TfpgFontResourceImpl.GetDescent: integer; +begin + Result := FFontData^.descent; +end; + +function TfpgFontResourceImpl.GetHeight: integer; +begin + // Not sure which one is better? + Result := FFontData^.height; // GetAscent + GetDescent; +end; + +function TfpgFontResourceImpl.GetTextWidth(const txt: string): integer; +var + extents: TXGlyphInfo; +begin + if length(txt) < 1 then + begin + Result := 0; + Exit; + end; + XftTextExtentsUTF8(xapplication.display, FFontData, PChar(txt), Length(txt), extents); + Result := extents.xOff; +end; + +{ TfpgCanvasImpl } + +constructor TfpgCanvasImpl.Create; +begin + FDrawing := False; + FDrawWindow := nil; + + FBufferPixmap := 0; + FDrawHandle := 0; + Fgc := nil; + FXftDraw := nil; + FClipRegion := nil; +end; + +destructor TfpgCanvasImpl.Destroy; +begin + if FDrawing then + DoEndDraw; + inherited Destroy; +end; + +procedure TfpgCanvasImpl.DoBeginDraw(awin: TfpgWindowImpl; buffered: boolean); +var + x: integer; + y: integer; + rw: TXID; + d: TXID; + w: longword; + h: longword; + bw: longword; + pmw: longword; + pmh: longword; + GcValues: TXGcValues; +begin + XGetGeometry(xapplication.display, awin.FWinHandle, @rw, @x, @y, @w, @h, @bw, @d); + + if FDrawing and buffered and (FBufferPixmap > 0) then + if FBufferPixmap > 0 then + begin + // check if the dimensions are ok + XGetGeometry(xapplication.display, FBufferPixmap, @rw, @x, @y, @pmw, @pmh, @bw, @d); + if (pmw <> w) or (pmh <> h) then + DoEndDraw; + end; + + if not FDrawing then + begin + FDrawWindow := awin; + + if buffered then + begin + FBufferPixmap := XCreatePixmap(xapplication.display, FDrawWindow.FWinHandle, w, h, xapplication.DisplayDepth); + FDrawHandle := FBufferPixmap; + end + else + begin + FBufferPixmap := 0; + FDrawHandle := FDrawWindow.FWinHandle; + end; + + Fgc := XCreateGc(xapplication.display, FDrawHandle, 0, @GcValues); + + FXftDraw := XftDrawCreate(xapplication.display, FDrawHandle, + XDefaultVisual(xapplication.display, xapplication.DefaultScreen), + XDefaultColormap(xapplication.display, xapplication.DefaultScreen)); + + FClipRegion := XCreateRegion; + end; + + FDrawing := True; +end; + +procedure TfpgCanvasImpl.DoPutBufferToScreen(x, y, w, h: TfpgCoord); +var + cgc: TfpgGContext; + GcValues: TXGcValues; +begin + if FBufferPixmap > 0 then + begin + cgc := XCreateGc(xapplication.display, FBufferPixmap, 0, @GcValues); + XCopyArea(xapplication.Display, FBufferPixmap, FDrawWindow.FWinHandle, cgc, x, y, w, h, x, y); + XFreeGc(xapplication.display, cgc); + end; +end; + +procedure TfpgCanvasImpl.DoEndDraw; +begin + if FDrawing then + begin + XDestroyRegion(FClipRegion); + XftDrawDestroy(FXftDraw); + XFreeGc(xapplication.display, Fgc); + + if FBufferPixmap > 0 then + XFreePixmap(xapplication.Display, FBufferPixmap); + FBufferPixmap := 0; + + FDrawing := False; + FDrawWindow := nil; + end; +end; + +procedure TfpgCanvasImpl.DoSetFontRes(fntres: TfpgFontResourceImpl); +begin + if fntres = nil then + Exit; + FCurFontRes := fntres; +end; + +procedure TfpgCanvasImpl.DoSetTextColor(cl: TfpgColor); +begin + SetXftColor(cl, FColorTextXft); +end; + +procedure TfpgCanvasImpl.DoSetColor(cl: TfpgColor); +begin + XSetForeGround(xapplication.display, Fgc, fpgColorToX(cl)); +end; + +procedure TfpgCanvasImpl.DoSetLineStyle(awidth: integer; astyle: TfpgLineStyle); +//const +// DotDashes: array[0..1] of Char = #1#1; +// DotDashes: array[0..1] of Char = #4#2; + { It was #1#1 which gives 1 pixel dots. Now it gives a 4 pixel line and a + 2 pixel space. } +var + ls: integer; + DotDashes: array[0..6] of Char; + len: integer; +begin + {$Note Extend this and the GDI code some more to support more Line Styles} + // This design can be improved on. It smells! + len := 0; + case AStyle of + lsDot: + begin + ls := LineOnOffDash; + len := 2; + DotDashes[0] := Char(#1); + DotDashes[1] := Char(#1); + end; + lsDash: + begin + ls := LineOnOffDash; + len := 2; + DotDashes[0] := Char(#4); + DotDashes[1] := Char(#2); + end; + lsSolid: + ls := LineSolid; + else + ls := LineSolid; + end; + XSetLineAttributes(xapplication.display, Fgc, awidth, ls, CapButt, JoinMiter); + if ls = LineOnOffDash then + XSetDashes(xapplication.display, Fgc, 0, DotDashes, len); +end; + +procedure TfpgCanvasImpl.DoDrawString(x, y: TfpgCoord; const txt: string); +begin + if Length(txt) < 1 then + Exit; + + XftDrawStringUTF8(FXftDraw, FColorTextXft, FCurFontRes.Handle, x, y + FCurFontRes.GetAscent, + PChar(txt), Length(txt)); +end; + +procedure TfpgCanvasImpl.DoGetWinRect(var r: TfpgRect); +var + rw: TfpgWinHandle; + x: integer; + y: integer; + bw: longword; + d: longword; +begin + r.left := 0; + r.Top := 0; + XGetGeometry(xapplication.display, FDrawWindow.FWinHandle, @rw, @x, @y, @(r.Width), @(r.Height), @bw, @d); +end; + +procedure TfpgCanvasImpl.DoFillRectangle(x, y, w, h: TfpgCoord); +begin + XFillRectangle(xapplication.display, FDrawHandle, Fgc, x, y, w, h); +end; + +procedure TfpgCanvasImpl.DoXORFillRectangle(col: TfpgColor; x, y, w, h: TfpgCoord); +begin + XSetForeGround(xapplication.display, Fgc, fpgColorToX(fpgColorToRGB(col))); + XSetFunction(xapplication.display, Fgc, GXxor); + XFillRectangle(xapplication.display, FDrawHandle, Fgc, x, y, w, h); + XSetForeGround(xapplication.display, Fgc, 0); + XSetFunction(xapplication.display, Fgc, GXcopy); +end; + +procedure TfpgCanvasImpl.DoFillTriangle(x1, y1, x2, y2, x3, y3: TfpgCoord); +var + pts: array[1..3] of TXPoint; +begin + pts[1].x := x1; + pts[1].y := y1; + pts[2].x := x2; + pts[2].y := y2; + pts[3].x := x3; + pts[3].y := y3; + + XFillPolygon(xapplication.display, FDrawHandle, Fgc, @pts, 3, 0, 0); +end; + +procedure TfpgCanvasImpl.DoDrawRectangle(x, y, w, h: TfpgCoord); +begin + XDrawRectangle(xapplication.display, FDrawHandle, Fgc, x, y, w - 1, h - 1); // transformed into polyline requests! +end; + +procedure TfpgCanvasImpl.DoDrawLine(x1, y1, x2, y2: TfpgCoord); +begin + XDrawLine(xapplication.display, FDrawHandle, Fgc, x1, y1, x2, y2); +end; + +procedure TfpgCanvasImpl.DoSetClipRect(const rect: TfpgRect); +var + r: TXRectangle; + rg: TRegion; +begin + r.x := rect.left; + r.y := rect.top; + r.Width := rect.Width; + r.Height := rect.Height; + + rg := XCreateRegion; + + XUnionRectWithRegion(@r, rg, FClipRegion); + XSetRegion(xapplication.display, Fgc, FClipRegion); + XftDrawSetClip(FXftDraw, FClipRegion); + + FClipRect := rect; + FClipRectSet := True; + XDestroyRegion(rg); +end; + +function TfpgCanvasImpl.DoGetClipRect: TfpgRect; +begin + Result := FClipRect; +end; + +procedure TfpgCanvasImpl.DoAddClipRect(const rect: TfpgRect); +var + r: TXRectangle; + rg: TRegion; +begin + r.x := rect.left; + r.y := rect.top; + r.Width := rect.Width; + r.Height := rect.Height; + + rg := XCreateRegion; + XUnionRectWithRegion(@r, rg, rg); + XIntersectRegion(FClipRegion, rg, FClipRegion); + XSetRegion(xapplication.display, Fgc, FClipRegion); + + FClipRect := Rect; + FClipRectSet := True; + + XftDrawSetClip(FXftDraw, FClipRegion); + XDestroyRegion(rg); +end; + +procedure TfpgCanvasImpl.DoClearClipRect; +var + r: TfpgRect; +begin + DoGetWinRect(r); + DoSetClipRect(r); + FClipRectSet := False; +end; + +procedure TfpgCanvasImpl.DoDrawImagePart(x, y: TfpgCoord; img: TfpgImageImpl; xi, yi, w, h: integer); +var + msk: TPixmap; + gc2: Tgc; + drawgc: Tgc; + GcValues: TXGcValues; +begin + if img = nil then + Exit; + + if img.FMasked then + begin + // rendering the mask + + msk := XCreatePixmap(xapplication.display, XDefaultRootWindow(xapplication.display), w, h, 1); + GcValues.foreground := 1; + GcValues.background := 0; + + // clear mask + gc2 := XCreateGc(xapplication.display, msk, GCForeground or GCBackground, @GcValues); + XSetForeground(xapplication.display, gc2, 0); + XFillRectangle(xapplication.display, msk, gc2, 0, 0, w, h); + + XSetForeground(xapplication.display, gc2, 1); + XPutImage(xapplication.display, msk, gc2, img.XImageMask, xi, yi, 0, 0, w, h); + + drawgc := XCreateGc(xapplication.display, FDrawHandle, 0, @GcValues); + XSetClipMask(xapplication.display, drawgc, msk); + XSetClipOrigin(xapplication.display, drawgc, x, y); + + XPutImage(xapplication.display, FDrawHandle, drawgc, img.XImage, xi, yi, x, y, w, h); + XFreePixmap(xapplication.display, msk); + XFreeGc(xapplication.display, drawgc); + XFreeGc(xapplication.display, gc2); + end + else + XPutImage(xapplication.display, FDrawHandle, Fgc, img.XImage, xi, yi, x, y, w, h); +end; + +{ TfpgImageImpl } + +constructor TfpgImageImpl.Create; +begin + inherited Create; +end; + +procedure TfpgImageImpl.DoFreeImage; +begin + // does nothing on X11 +end; + +procedure TfpgImageImpl.DoInitImage(acolordepth, awidth, aheight: integer; aimgdata: Pointer); +begin + FMasked := False; + + with FXimg do + begin + Width := awidth; + Height := aheight; + xoffset := 0; + obdata := #0; + byte_order := LSBFirst; + bitmap_bit_order := MSBFirst; + bitmap_pad := 32; + bytes_per_line := 0; + + if acolordepth = 1 then + begin + format := XYBitmap; + bitmap_unit := 8; + depth := 1; + bits_per_pixel := 1; + red_mask := 1; + green_mask := 0; + blue_mask := 0; + end + else + begin + format := ZPixmap; + bitmap_unit := 32; + + // only truecolor 24/32 displays supported now, otherwise color conversion required! + // this must be match for the display !!! + depth := xapplication.DisplayDepth; // acolordepth; + bits_per_pixel := 32; + + red_mask := $000000FF; + green_mask := $0000FF00; + blue_mask := $00FF0000; + end; + + Data := aimgdata; + end; + + XInitImage(@FXimg); +end; + +procedure TfpgImageImpl.DoInitImageMask(awidth, aheight: integer; aimgdata: Pointer); +begin + FMasked := True; + + with FXimgMask do + begin + Width := awidth; + Height := aheight; + xoffset := 0; + format := XYBitmap; + byte_order := LSBFirst; + bitmap_unit := 8; + bitmap_bit_order := MSBFirst; + bitmap_pad := 32; + depth := 1; + bytes_per_line := 0; + bits_per_pixel := 1; + + red_mask := 1; + green_mask := 0; + blue_mask := 0; + + obdata := #0; + + Data := aimgdata; + end; + + XInitImage(@FXimgMask); +end; + +function TfpgImageImpl.XImage: PXImage; +begin + Result := @FXimg; +end; + +function TfpgImageImpl.XImageMask: PXImage; +begin + Result := @FXimgMask; +end; + +initialization + xapplication := nil; + +end. + diff --git a/prototypes/fpgui2/source/core/x11/x11_keyconv.pas b/prototypes/fpgui2/source/core/x11/x11_keyconv.pas new file mode 100644 index 00000000..297ff50b --- /dev/null +++ b/prototypes/fpgui2/source/core/x11/x11_keyconv.pas @@ -0,0 +1,319 @@ +unit x11_keyconv; + +{$mode objfpc}{$H+} + +interface + +// + +// This conversion was taken from the OppenOffice 1.0.1 source code. +procedure KeySymToUnicode(ks : longword; res : PWord); + +implementation + +type + unichar = word; + +const + +// Latin-1 Byte 3 = $00 + keymap00 : array[32..255] of unichar = ( + $0020, $0021, $0022, $0023, $0024, $0025, $0026, $0027, + $0028, $0029, $002a, $002b, $002c, $002d, $002e, $002f, + $0030, $0031, $0032, $0033, $0034, $0035, $0036, $0037, + $0038, $0039, $003a, $003b, $003c, $003d, $003e, $003f, + $0040, $0041, $0042, $0043, $0044, $0045, $0046, $0047, + $0048, $0049, $004a, $004b, $004c, $004d, $004e, $004f, + $0050, $0051, $0052, $0053, $0054, $0055, $0056, $0057, + $0058, $0059, $005a, $005b, $005c, $005d, $005e, $005f, + $0060, $0061, $0062, $0063, $0064, $0065, $0066, $0067, + $0068, $0069, $006a, $006b, $006c, $006d, $006e, $006f, + $0070, $0071, $0072, $0073, $0074, $0075, $0076, $0077, + $0078, $0079, $007a, $007b, $007c, $007d, $007e, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $00a0, $00a1, $00a2, $00a3, $00a4, $00a5, $00a6, $00a7, + $00a8, $00a9, $00aa, $00ab, $00ac, $00ad, $00ae, $00af, + $00b0, $00b1, $00b2, $00b3, $00b4, $00b5, $00b6, $00b7, + $00b8, $00b9, $00ba, $00bb, $00bc, $00bd, $00be, $00bf, + $00c0, $00c1, $00c2, $00c3, $00c4, $00c5, $00c6, $00c7, + $00c8, $00c9, $00ca, $00cb, $00cc, $00cd, $00ce, $00cf, + $00d0, $00d1, $00d2, $00d3, $00d4, $00d5, $00d6, $00d7, + $00d8, $00d9, $00da, $00db, $00dc, $00dd, $00de, $00df, + $00e0, $00e1, $00e2, $00e3, $00e4, $00e5, $00e6, $00e7, + $00e8, $00e9, $00ea, $00eb, $00ec, $00ed, $00ee, $00ef, + $00f0, $00f1, $00f2, $00f3, $00f4, $00f5, $00f6, $00f7, + $00f8, $00f9, $00fa, $00fb, $00fc, $00fd, $00fe, $00ff + ); + +// Latin-2 Byte 3 = $01 + keymap01 : array[161..255] of unichar = ( + $0104, $02d8, $0141, $0000, $013d, $015a, $0000, $0000, + $0160, $015e, $0164, $0179, $0000, $017d, $017b, $0000, + $0105, $02db, $0142, $0000, $013e, $015b, $02c7, $0000, + $0161, $015f, $0165, $017a, $02dd, $017e, $017c, $0154, + $0000, $0000, $0102, $0000, $0139, $0106, $0000, $010c, + $0000, $0118, $0000, $011a, $0000, $0000, $010e, $0110, + $0143, $0147, $0000, $0000, $0150, $0000, $0000, $0158, + $016e, $0000, $0170, $0000, $0000, $0162, $0000, $0155, + $0000, $0000, $0103, $0000, $013a, $0107, $0000, $010d, + $0000, $0119, $0000, $011b, $0000, $0000, $010f, $0111, + $0144, $0148, $0000, $0000, $0151, $0000, $0000, $0159, + $016f, $0000, $0171, $0000, $0000, $0163, $02d9 ); + +// Latin-3 Byte 3 = $02 + keymap02 : array[161..254] of unichar = ( + $0126, $0000, $0000, $0000, $0000, $0124, $0000, $0000, + $0130, $0000, $011e, $0134, $0000, $0000, $0000, $0000, + $0127, $0000, $0000, $0000, $0000, $0125, $0000, $0000, + $0131, $0000, $011f, $0135, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $010a, $0108, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0120, $0000, $0000, $011c, + $0000, $0000, $0000, $0000, $016c, $015c, $0000, $0000, + $0000, $0000, $0000, $0000, $010b, $0109, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0121, $0000, $0000, $011d, + $0000, $0000, $0000, $0000, $016d, $015d ); + +// Latin-4 Byte 3 = $03 + keymap03 : array[162..254] of unichar = ( + $0138, $0156, $0000, $0128, $013b, $0000, $0000, $0000, + $0112, $0122, $0166, $0000, $0000, $0000, $0000, $0000, + $0000, $0157, $0000, $0129, $013c, $0000, $0000, $0000, + $0113, $0123, $0167, $014a, $0000, $014b, $0100, $0000, + $0000, $0000, $0000, $0000, $0000, $012e, $0000, $0000, + $0000, $0000, $0116, $0000, $0000, $012a, $0000, $0145, + $014c, $0136, $0000, $0000, $0000, $0000, $0000, $0172, + $0000, $0000, $0000, $0168, $016a, $0000, $0101, $0000, + $0000, $0000, $0000, $0000, $0000, $012f, $0000, $0000, + $0000, $0000, $0117, $0000, $0000, $012b, $0000, $0146, + $014d, $0137, $0000, $0000, $0000, $0000, $0000, $0173, + $0000, $0000, $0000, $0169, $016b ); + +// Kana Byte 3 = $04 + keymap04 : array[126..223] of unichar = ( + $203e, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $3002, $300c, $300d, $3001, $30fb, + $30f2, $30a1, $30a3, $30a5, $30a7, $30a9, $30e3, $30e5, + $30e7, $30c3, $30fc, $30a2, $30a4, $30a6, $30a8, $30aa, + $30ab, $30ad, $30af, $30b1, $30b3, $30b5, $30b7, $30b9, + $30bb, $30bd, $30bf, $30c1, $30c4, $30c6, $30c8, $30ca, + $30cb, $30cc, $30cd, $30ce, $30cf, $30d2, $30d5, $30d8, + $30db, $30de, $30df, $30e0, $30e1, $30e2, $30e4, $30e6, + $30e8, $30e9, $30ea, $30eb, $30ec, $30ed, $30ef, $30f3, + $309b, $309c ); + +// Arabic Byte 3 = $05 + keymap05 : array[172..242] of unichar = ( + $060c, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $061b, + $0000, $0000, $0000, $061f, $0000, $0621, $0622, $0623, + $0624, $0625, $0626, $0627, $0628, $0629, $062a, $062b, + $062c, $062d, $062e, $062f, $0630, $0631, $0632, $0633, + $0634, $0635, $0636, $0637, $0638, $0639, $063a, $0000, + $0000, $0000, $0000, $0000, $0640, $0641, $0642, $0643, + $0644, $0645, $0646, $0647, $0648, $0649, $064a, $064b, + $064c, $064d, $064e, $064f, $0650, $0651, $0652 ); + +// Cyrillic Byte 3 = $06 + keymap06 : array[161..255] of unichar = ( + $0452, $0453, $0451, $0454, $0455, $0456, $0457, $0458, + $0459, $045a, $045b, $045c, $0000, $045e, $045f, $2116, + $0402, $0403, $0401, $0404, $0405, $0406, $0407, $0408, + $0409, $040a, $040b, $040c, $0000, $040e, $040f, $044e, + $0430, $0431, $0446, $0434, $0435, $0444, $0433, $0445, + $0438, $0439, $043a, $043b, $043c, $043d, $043e, $043f, + $044f, $0440, $0441, $0442, $0443, $0436, $0432, $044c, + $044b, $0437, $0448, $044d, $0449, $0447, $044a, $042e, + $0410, $0411, $0426, $0414, $0415, $0424, $0413, $0425, + $0418, $0419, $041a, $041b, $041c, $041d, $041e, $041f, + $042f, $0420, $0421, $0422, $0423, $0416, $0412, $042c, + $042b, $0417, $0428, $042d, $0429, $0427, $042a ); + +// Greek Byte 3 = $07 + keymap07 : array[161..249] of unichar = ( + $0386, $0388, $0389, $038a, $03aa, $0000, $038c, $038e, + $03ab, $0000, $038f, $0000, $0000, $0385, $2015, $0000, + $03ac, $03ad, $03ae, $03af, $03ca, $0390, $03cc, $03cd, + $03cb, $03b0, $03ce, $0000, $0000, $0000, $0000, $0000, + $0391, $0392, $0393, $0394, $0395, $0396, $0397, $0398, + $0399, $039a, $039b, $039c, $039d, $039e, $039f, $03a0, + $03a1, $03a3, $0000, $03a4, $03a5, $03a6, $03a7, $03a8, + $03a9, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $03b1, $03b2, $03b3, $03b4, $03b5, $03b6, $03b7, $03b8, + $03b9, $03ba, $03bb, $03bc, $03bd, $03be, $03bf, $03c0, + $03c1, $03c3, $03c2, $03c4, $03c5, $03c6, $03c7, $03c8, + $03c9 ); + +// Technical Byte 3 = $08 + keymap08 : array[161..254] of unichar = ( + $23b7, $250c, $2500, $2320, $2321, $2502, $23a1, $23a3, + $23a4, $23a6, $239b, $239d, $239e, $23a0, $23a8, $23ac, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $2264, $2260, $2265, $222b, $2234, + $221d, $221e, $0000, $0000, $2207, $0000, $0000, $223c, + $2243, $0000, $0000, $0000, $21d4, $21d2, $2261, $0000, + $0000, $0000, $0000, $0000, $0000, $221a, $0000, $0000, + $0000, $2282, $2283, $2229, $222a, $2227, $2228, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $2202, $0000, + $0000, $0000, $0000, $0000, $0000, $0192, $0000, $0000, + $0000, $0000, $2190, $2191, $2192, $2193 ); + +// Special Byte 3 = $09 + keymap09 : array[224..248] of unichar = ( + $25c6, $2592, $2409, $240c, $240d, $240a, $0000, $0000, + $2424, $240b, $2518, $2510, $250c, $2514, $253c, $23ba, + $23bb, $2500, $23bc, $23bd, $251c, $2524, $2534, $252c, + $2502 ); + +// Publishing Byte 3 = $0a = 10 + keymap10 : array[161..254] of unichar = ( + $2003, $2002, $2004, $2005, $2007, $2008, $2009, $200a, + $2014, $2013, $0000, $0000, $0000, $2026, $2025, $2153, + $2154, $2155, $2156, $2157, $2158, $2159, $215a, $2105, + $0000, $0000, $2012, $2329, $0000, $232a, $0000, $0000, + $0000, $0000, $215b, $215c, $215d, $215e, $0000, $0000, + $2122, $2613, $0000, $25c1, $25b7, $25cb, $25af, $2018, + $2019, $201c, $201d, $211e, $0000, $2032, $2033, $0000, + $271d, $0000, $25ac, $25c0, $25b6, $25cf, $25ae, $25e6, + $25ab, $25ad, $25b3, $25bd, $2606, $2022, $25aa, $25b2, + $25bc, $261c, $261e, $2663, $2666, $2665, $0000, $2720, + $2020, $2021, $2713, $2717, $266f, $266d, $2642, $2640, + $260e, $2315, $2117, $2038, $201a, $201e ); + +// APL Byte 3 = $0b = 11 + keymap11 : array[163..252] of unichar = ( + $003c, $0000, $0000, $003e, $0000, $2228, $2227, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $00af, $0000, $22a5, + $2229, $230a, $0000, $005f, $0000, $0000, $0000, $2218, + $0000, $2395, $0000, $22a4, $25cb, $0000, $0000, $0000, + $2308, $0000, $0000, $222a, $0000, $2283, $0000, $2282, + $0000, $22a2, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $22a3 ); + +// Hebrew Byte 3 = $0c = 12 + keymap12 : array[223..250] of unichar = ( + $2017, $05d0, $05d1, $05d2, $05d3, $05d4, $05d5, $05d6, + $05d7, $05d8, $05d9, $05da, $05db, $05dc, $05dd, $05de, + $05df, $05e0, $05e1, $05e2, $05e3, $05e4, $05e5, $05e6, + $05e7, $05e8, $05e9, $05ea ); + +// Thai Byte 3 = $0d = 13 + keymap13 : array[161..249] of unichar = ( + $0e01, $0e02, $0e03, $0e04, $0e05, $0e06, $0e07, $0e08, + $0e09, $0e0a, $0e0b, $0e0c, $0e0d, $0e0e, $0e0f, $0e10, + $0e11, $0e12, $0e13, $0e14, $0e15, $0e16, $0e17, $0e18, + $0e19, $0e1a, $0e1b, $0e1c, $0e1d, $0e1e, $0e1f, $0e20, + $0e21, $0e22, $0e23, $0e24, $0e25, $0e26, $0e27, $0e28, + $0e29, $0e2a, $0e2b, $0e2c, $0e2d, $0e2e, $0e2f, $0e30, + $0e31, $0e32, $0e33, $0e34, $0e35, $0e36, $0e37, $0e38, + $0e39, $0e3a, $0000, $0000, $0000, $0000, $0e3f, $0e40, + $0e41, $0e42, $0e43, $0e44, $0e45, $0e46, $0e47, $0e48, + $0e49, $0e4a, $0e4b, $0e4c, $0e4d, $0000, $0000, $0e50, + $0e51, $0e52, $0e53, $0e54, $0e55, $0e56, $0e57, $0e58, + $0e59 ); + +// Korean Byte 3 = $0e = 14 + keymap14 : array[161..255] of unichar = ( + $3131, $3132, $3133, $3134, $3135, $3136, $3137, $3138, + $3139, $313a, $313b, $313c, $313d, $313e, $313f, $3140, + $3141, $3142, $3143, $3144, $3145, $3146, $3147, $3148, + $3149, $314a, $314b, $314c, $314d, $314e, $314f, $3150, + $3151, $3152, $3153, $3154, $3155, $3156, $3157, $3158, + $3159, $315a, $315b, $315c, $315d, $315e, $315f, $3160, + $3161, $3162, $3163, $11a8, $11a9, $11aa, $11ab, $11ac, + $11ad, $11ae, $11af, $11b0, $11b1, $11b2, $11b3, $11b4, + $11b5, $11b6, $11b7, $11b8, $11b9, $11ba, $11bb, $11bc, + $11bd, $11be, $11bf, $11c0, $11c1, $11c2, $316d, $3171, + $3178, $317f, $3181, $3184, $3186, $318d, $318e, $11eb, + $11f0, $11f9, $0000, $0000, $0000, $0000, $20a9 ); + +// missing: +// Latin-8 Byte 3 = $12 = 18 + +// Latin-9 Byte 3 = $13 = 19 + keymap19 : array[188..190] of unichar = ( + $0152, $0153, $0178 ); + +// missing: +// Armenian Byte 3 = $14 = 20 +// Georgian Byte 3 = $15 = 21 +// Azeri Byte 3 = $16 = 22 +// Vietnamese Byte 3 = $1e = 30 + +// Currency Byte 3 = $20 = 32 + keymap32 : array[160..172] of unichar = ( + $20a0, $20a1, $20a2, $20a3, $20a4, $20a5, $20a6, $20a7, + $20a8, $0000, $20aa, $20ab, $20ac ); + +// Keyboard (Keypad mappings) Byte 3 = $ff = 255 + keymap255 : array[128..189] of unichar = ( + $0020, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $FF0D, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $0000, $0000, $0000, $0000, $0000, $0000, + $0000, $0000, $002a, $002b, $002c, $002d, $002e, $002f, + $0030, $0031, $0032, $0033, $0034, $0035, $0036, $0037, + $0038, $0039, $0000, $0000, $0000, $003d ); + +type + keymap = array[0..255] of word; + mapptr = ^keymap; + +procedure TranslateCode(var res : word; ccode : byte; map : mapptr; lowind,highind : byte); +begin + //writeln('code: ',ccode,' low: ',lowind,' high: ',highind); + if (ccode >= lowind) and (ccode <= highind) then res := map^[ccode-lowind]; +end; + +procedure KeySymToUnicode(ks : longword; res : PWord); +var + table : byte; + ccode : byte; +begin + table := ((ks and $0000FF00) shr 8); + ccode := ks and $ff; + res^ := ks and $FFFF; + case table of + 00 : TranslateCode(res^, ccode, @keymap00, low(keymap00), high(keymap00) ); + 01 : TranslateCode(res^, ccode, @keymap01, low(keymap01), high(keymap01) ); + 02 : TranslateCode(res^, ccode, @keymap02, low(keymap01), high(keymap02) ); + 03 : TranslateCode(res^, ccode, @keymap03, low(keymap01), high(keymap03) ); + 04 : TranslateCode(res^, ccode, @keymap04, low(keymap01), high(keymap04) ); + 05 : TranslateCode(res^, ccode, @keymap05, low(keymap01), high(keymap05) ); + 06 : TranslateCode(res^, ccode, @keymap06, low(keymap01), high(keymap06) ); + 07 : TranslateCode(res^, ccode, @keymap07, low(keymap01), high(keymap07) ); + 08 : TranslateCode(res^, ccode, @keymap08, low(keymap01), high(keymap08) ); + 09 : TranslateCode(res^, ccode, @keymap09, low(keymap01), high(keymap09) ); + + 10 : TranslateCode(res^, ccode, @keymap10, low(keymap10), high(keymap10) ); + 11 : TranslateCode(res^, ccode, @keymap11, low(keymap11), high(keymap11) ); + 12 : TranslateCode(res^, ccode, @keymap12, low(keymap12), high(keymap12) ); + 13 : TranslateCode(res^, ccode, @keymap13, low(keymap13), high(keymap13) ); + 14 : TranslateCode(res^, ccode, @keymap14, low(keymap14), high(keymap14) ); +// 15 : TranslateCode(res^, ccode, @keymap15, low(keymap15), high(keymap15) ); +// 16 : TranslateCode(res^, ccode, @keymap16, low(keymap16), high(keymap16) ); +// 17 : TranslateCode(res^, ccode, @keymap17, low(keymap17), high(keymap17) ); +// 18 : TranslateCode(res^, ccode, @keymap18, low(keymap18), high(keymap18) ); + 19 : TranslateCode(res^, ccode, @keymap19, low(keymap19), high(keymap19) ); + + 32 : TranslateCode(res^, ccode, @keymap32, low(keymap32), high(keymap32) ); + + 255 : TranslateCode(res^, ccode, @keymap255, low(keymap255), high(keymap255) ); + end; +end; + +end. diff --git a/prototypes/fpgui2/source/core/x11/x11_xft.pas b/prototypes/fpgui2/source/core/x11/x11_xft.pas new file mode 100644 index 00000000..805797cd --- /dev/null +++ b/prototypes/fpgui2/source/core/x11/x11_xft.pas @@ -0,0 +1,162 @@ +{ + fpGFX - Free Pascal Graphics Library + Copyright (C) 2006-2007 by Graeme Geldenhuys + member of the fpGFX development team. + + Xft interface functions + + See the file COPYING.fpGFX, included in this distribution, + for details about the copyright. + + 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. + + **********************************************************************} + + +unit x11_xft; + +{$mode objfpc}{$H+} + +{$linklib Xft} + +interface +uses + Classes + ,SysUtils + ,X + ,XLib + ,Xutil + ; + + +type + TPicture = longword; + + TXftDraw = record + dummy : Pointer; + end; + PXftDraw = ^TXftDraw; + + TXftFont = record + ascent : integer; + descent : integer; + height : integer; + max_advance_width : integer; + ptr1 : Pointer; // charset + ptr2 : Pointer; // pattern + end; + PXftFont = ^TXftFont; + + TXRenderColor = record + red : word; + green : word; + blue : word; + alpha : word; + end; + + TXftColor = record + pixel : ptrint; + color : TXRenderColor; + end; + + TXGlyphInfo = packed record + width : word; + height : word; + x : smallint; + y : smallint; + xOff : smallint; + yOff : smallint; + end; + + TFcPattern = record + dummy : integer; + end; + + PFcPattern = ^TFcPattern; + PPFcPattern = ^PFcPattern; + + TFcFontSet = packed record + nfont : integer; + sfont : integer; + fonts : PPFcPattern; + end; + PFcFontSet = ^TFcFontSet; + +const + FC_FAMILY : PChar = 'family'; + FC_SIZE : PChar = 'size'; + FC_SCALABLE : PChar = 'scalable'; + + FcTypeVoid = 0; + FcTypeInteger = 1; + FcTypeDouble = 2; + FcTypeString = 3; + FcTypeBool = 4; + FcTypeMatrix = 5; + FcTypeCharSet = 6; + FcTypeFTFace = 7; + FcTypeLangSet = 8; + +function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; +procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; +procedure XftDrawDestroy(draw : PXftDraw); cdecl; + +function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; + +function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; +procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; + +procedure XftDrawStringUtf8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; +procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; +procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; + +procedure XftTextExtentsUtf8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; +procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; +procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; + +//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; + +//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; + +procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; + +function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; +function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; +procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; + + + +implementation + + +function XftDrawCreate(display : PXDisplay; win : TXID; vis : PVisual; colorm : longint) : PXftDraw; cdecl; external; +procedure XftDrawChange(xftd : PXftDraw; win : TXID); cdecl; external; +procedure XftDrawDestroy(draw : PXftDraw); cdecl; external; + +function XftDrawPicture(draw : PXftDraw) : TPicture; cdecl; external; + +function XftFontOpenName(display : PXDisplay; scr : integer; par3 : PChar) : PXftFont; cdecl; external; +procedure XftFontClose(display : PXDisplay; fnt : PXftFont); cdecl; external; + +procedure XftDrawStringUtf8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; +procedure XftDrawString8(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; +procedure XftDrawString16(draw : PXftDraw; var col : TXftColor; fnt : PXftFont; x,y : integer; txt : PChar; len : integer); cdecl; external; + +procedure XftTextExtentsUtf8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; +procedure XftTextExtents8(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; +procedure XftTextExtents16(display : PXDisplay; fnt : PXftFont; txt : PChar; len : integer; var extents : TXGlyphInfo); cdecl; external; + +//function XftGlyphExists(display : PXDisplay; fnt : PXftFont; ch : integer) : longbool; cdecl; external; + +//procedure XftDrawSetClipRectangles(draw : PXftDraw; xorigin, yorigin : integer; rect : PXRectangle; rnum : integer); cdecl; external; + +procedure XftDrawSetClip(draw : PXftDraw; rg : TRegion); cdecl; external; + +function XftListFonts(display : PXDisplay; screen : integer; params : array of const) : PFcFontSet; cdecl; external; +function XftNameUnparse(pat : PFcPattern; dest : PChar; destlen : integer) : boolean; cdecl; external; +procedure FcFontSetDestroy(fsp : PFcFontSet); cdecl; external; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_button.pas b/prototypes/fpgui2/source/gui/gui_button.pas new file mode 100644 index 00000000..b93f154a --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_button.pas @@ -0,0 +1,425 @@ +unit gui_button; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget; + +type + + TfpgButton = class(TfpgWidget) + private + FEmbedded: Boolean; + FImageName: string; + FClicked: Boolean; + FImage: TfpgImage; + FShowImage: Boolean; + FClickOnPush: Boolean; + FDown: Boolean; + FImageMargin: integer; + FImageSpacing: integer; + FGroupIndex: integer; + FAllowAllUp: boolean; + FModalResult: integer; + function GetFontDesc: string; + procedure SetEmbedded(const AValue: Boolean); + procedure SetFontDesc(const AValue: string); + procedure SetImageName(const AValue: string); + procedure SetText(const AValue: string); + procedure SetDown(AValue: Boolean); + procedure SetImageMargin(const Value: integer); + procedure SetImageSpacing(const Value: integer); + function GetAllowDown: Boolean; + procedure SetAllowDown(const Value: Boolean); + procedure SetAllowAllUp(const Value: boolean); + protected + FText: string; + FFont: TfpgFont; + procedure SetShowImage(AValue: Boolean); + procedure HandlePaint; override; + procedure HandleKeyPress(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleKeyRelease(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleLMouseDown(X, Y: integer; ShiftState: word); override; + procedure HandleLMouseUp(x, y: integer; shiftstate: word); override; + procedure HandleMouseExit; override; + procedure HandleMouseEnter; override; + public + OnClick: TNotifyEvent; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure DoPush; + procedure DoRelease; + procedure Click; + property Down: Boolean read FDown write SetDown; + property Font: TfpgFont read FFont; + property AllowDown: Boolean read GetAllowDown write SetAllowDown; + published + property Text: string read FText write SetText; + property FontDesc: string read GetFontDesc write SetFontDesc; + property ImageName: string read FImageName write SetImageName; + property ImageMargin: integer read FImageMargin write SetImageMargin; + property ImageSpacing: integer read FImageSpacing write SetImageSpacing; + property GroupIndex: integer read FGroupIndex write FGroupIndex; + property AllowAllUp: boolean read FAllowAllUp write SetAllowAllUp; + property ModalResult: integer read FModalResult write FModalResult; + property Embedded: Boolean read FEmbedded write SetEmbedded default False; + property ShowImage: Boolean read FShowImage write SetShowImage default True; + end; + +function CreateButton(AOwner: TComponent; x, y, w: TfpgCoord; AText: string; + AOnClickEvent: TNotifyEvent): TfpgButton; + +implementation + +uses + gui_form; {$Note Try and remove this gui_form dependency.} + +function CreateButton(AOwner: TComponent; x, y, w: TfpgCoord; AText: string; + AOnClickEvent: TNotifyEvent): TfpgButton; +begin + Result := TfpgButton.Create(AOwner); + Result.Left := x; + Result.Top := y; + Result.Text := AText; + Result.Width := w; + Result.OnClick := AOnClickEvent; +end; + +{ TfpgButton } + +procedure TfpgButton.SetDown(AValue: Boolean); +begin + if AValue <> FDown then + begin + FDown := AValue; + if AllowDown then + RePaint; + end; +end; + +procedure TfpgButton.SetShowImage(AValue: Boolean); +begin + if AValue <> FShowImage then + begin + FShowImage := AValue; + if (FImage <> nil) and ShowImage then + RePaint; + end; +end; + +procedure TfpgButton.SetText(const AValue: string); +begin + if FText = AValue then + Exit; + FText := AValue; + RePaint; +end; + +procedure TfpgButton.SetImageName(const AValue: string); +begin + FImageName := AValue; + FImage := fpgImages.GetImage(FImageName); + Repaint; +end; + +function TfpgButton.GetFontDesc: string; +begin + Result := FFont.FontDesc; +end; + +procedure TfpgButton.SetEmbedded(const AValue: Boolean); +begin + if FEmbedded = AValue then + Exit; + FEmbedded := AValue; +end; + +procedure TfpgButton.SetFontDesc(const AValue: string); +begin + FFont.Free; + FFont := fpgGetFont(AValue); + RePaint; +end; + +constructor TfpgButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FText := 'Button'; + FFont := fpgGetFont('#Label1'); + FHeight := FFont.Height + 8; + FWidth := 75; + FFocusable := True; + OnClick := nil; + FDown := False; + FClicked := False; + FDown := False; + FClickOnPush := False; + FGroupIndex := 0; + FImage := nil; + FImageName := ''; + FShowImage := True; + FImageMargin := 3; + FImageSpacing := -1; + FModalResult := 0; + FEmbedded := False; +end; + +destructor TfpgButton.Destroy; +begin + FImage := nil; + FText := ''; + FFont.Free; + inherited Destroy; +end; + +procedure TfpgButton.HandlePaint; +var + AText: string; + x, y, iy, w: integer; + r: TfpgRect; + pofs: integer; + lBtnFlags: TFButtonFlags; +begin + Canvas.BeginDraw; + Canvas.Clear(clButtonFace); + Canvas.ClearClipRect; + + lBtnFlags := []; + if FDown then + Include(lBtnFlags, btnIsPressed); + + if FFocused and (not FEmbedded) then + Include(lBtnFlags, btnHasFocus); + + if FEmbedded then + Include(lBtnFlags, btnIsEmbedded); + + fpgStyle.DrawButtonFace(Canvas, 0, 0, Width, Height, lBtnFlags); + + if FFocused and (not FEmbedded) then + begin + Canvas.SetColor(clText1); + Canvas.SetLineStyle(1, lsDot); + Canvas.DrawRectangle(3, 3, Width - 6, Height - 6); + end + else + begin + Canvas.SetTextColor(clText1); + Canvas.SetColor(clText1); + end; + + r.left := 2; + r.top := 2; + r.Width := Width - 4; + r.Height := Height - 4; + Canvas.SetClipRect(r); + + Canvas.SetFont(Font); + AText := FText; + y := Height div 2 - FFont.Height div 2; + if y < 3 then + y := 3; + + if FDown then + pofs := 1 + else + pofs := 0; + + if (ShowImage) and (FImage <> nil) then + begin + iy := Height div 2 - FImage.Height div 2; + if ImageMargin = -1 then // centered + begin + w := FFont.TextWidth(AText) + FImage.Width; + if FImageSpacing > 0 then + Inc(w, FImageSpacing); + x := (Width div 2) - (w div 2); + if x < 3 then + x := 3; + end + else + begin + x := FImageMargin + 3; + end; + + Canvas.DrawImage(x + pofs, iy + pofs, FImage); + Inc(x, FImage.Width); + if FImageSpacing > 0 then + Inc(x, FImageSpacing); + + if (FImageSpacing = -1) and (FImageMargin >= 0) then + begin + w := (Width - 3 - x) div 2 - FFont.TextWidth(AText) div 2; + if w < 1 then + w := 1; // minimal spacing + x := x + w; + end; + end + else + x := (Width div 2) - (FFont.TextWidth(AText) div 2); + + if x < 3 then + x := 3; + + Canvas.DrawString(x + pofs, y + pofs, AText); + Canvas.EndDraw; +end; + +procedure TfpgButton.DoPush; +var + n: integer; + c: TComponent; +begin + FClickOnPush := (not FDown) and AllowDown; + + // search the other buttons in the group + for n := 0 to FParent.ComponentCount - 1 do + begin + c := FParent.Components[n]; + if (c <> self) and (c is TfpgButton) then + with TfpgButton(c) do + if GroupIndex = self.GroupIndex then + Down := False; + end; + + FDown := True; + FClicked := True; + + RePaint; + if FClickOnPush then + Click; +end; + +procedure TfpgButton.DoRelease; +begin + if AllowDown then + begin + if FDown and (not FClickOnPush) and FAllowAllUp then + begin + FDown := False; + RePaint; + Click; + end; + end + else + begin + if FDown and FClicked then + Click; + FDown := False; + RePaint; + end; + + FClickOnPush := False; + FClicked := False; +end; + +procedure TfpgButton.HandleKeyPress(var keycode: word; var shiftstate: word; var consumed: boolean); +begin + if (keycode = KEYSC_ENTER) or (keycode = KEYSC_SPACE) then + begin + DoPush; + Consumed := True; + end + else + inherited; +end; + +procedure TfpgButton.HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); +begin + if (keycode = KEY_ENTER) or (keycode = KEY_SPACE) then + Consumed := True + else + inherited; +end; + +procedure TfpgButton.HandleKeyRelease(var keycode: word; var shiftstate: word; var consumed: boolean); +begin + if (keycode = KEYSC_ENTER) or (keycode = KEYSC_SPACE) then + begin + DoRelease; + Consumed := True; + end + else + inherited; +end; + +procedure TfpgButton.HandleLMouseDown(X, Y: integer; ShiftState: word); +begin + inherited; + DoPush; +end; + +procedure TfpgButton.HandleLMouseUp(x, y: integer; shiftstate: word); +begin + inherited; + DoRelease; +end; + +procedure TfpgButton.HandleMouseExit; +begin + inherited HandleMouseExit; + if FDown and (not AllowDown) then + begin + FDown := False; + RePaint; + end; +end; + +procedure TfpgButton.HandleMouseEnter; +begin + inherited HandleMouseEnter; + if FClicked and (not AllowDown) then + begin + FDown := True; + RePaint; + end; +end; + +procedure TfpgButton.Click; +var + pform: TfpgForm; +begin + pform := WidgetParentForm(self); + if pform <> nil then + pform.ModalResult := ModalResult; + + if Assigned(OnClick) then + OnClick(self); +end; + +procedure TfpgButton.SetImageMargin(const Value: integer); +begin + FImageMargin := Value; + Repaint; +end; + +procedure TfpgButton.SetImageSpacing(const Value: integer); +begin + FImageSpacing := Value; + Repaint; +end; + +function TfpgButton.GetAllowDown: Boolean; +begin + Result := GroupIndex > 0; +end; + +procedure TfpgButton.SetAllowDown(const Value: Boolean); +begin + GroupIndex := 1; +end; + +procedure TfpgButton.SetAllowAllUp(const Value: boolean); +begin + FAllowAllUp := Value; +end; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_combobox.pas b/prototypes/fpgui2/source/gui/gui_combobox.pas new file mode 100644 index 00000000..46b85268 --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_combobox.pas @@ -0,0 +1,155 @@ +unit gui_combobox; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfx_widget, + gui_form, + gfxbase, + gui_button; + +type + + TfpgCustomComboBox = class(TfpgWidget) + private + FDropDownCount: integer; + FDropDown: TfpgForm; + FBackgroundColor: TfpgColor; + FInternalBtn: TfpgButton; + procedure SetDropDownCount(const AValue: integer); + procedure DoDropDown; + procedure InternalBtnClick(Sender: TObject); + protected + property DropDownCount: integer read FDropDownCount write SetDropDownCount default 8; + procedure HandleLMouseDown(x, y: integer; shiftstate: word); override; + procedure HandlePaint; override; + public + constructor Create(AOwner: TComponent); override; + end; + + + TfpgComboBox = class(TfpgCustomComboBox) + published + property DropDownCount; + end; + + +function CreateComboBox(AOwner: TComponent; x, y, w: TfpgCoord; AList: TStringList): TfpgComboBox; + + +implementation + +uses + fpgfx, + Math; + +type + // This is so we can access protected methods + TPrivateWidget = class(TfpgWidget) + end; + + +function CreateComboBox(AOwner: TComponent; x, y, w: TfpgCoord; AList: TStringList): TfpgComboBox; +begin + Result := TfpgComboBox.Create(AOwner); + Result.Left := x; + Result.Top := y; + Result.Width := w; + Result.Focusable := True; + + Result.Height := 23; // replace this with font height + margins + {$Note We still need to handle the AList param as well.} +end; + +{ TfpgCustomComboBox } + +procedure TfpgCustomComboBox.SetDropDownCount(const AValue: integer); +begin + if FDropDownCount = AValue then + Exit; + FDropDownCount := AValue; +end; + +procedure TfpgCustomComboBox.DoDropDown; +begin + if (not Assigned(FDropDown)) or (not FDropDown.HasHandle) then + begin + FDropDown := TfpgForm.Create(nil); + FDropDown.WindowType := wtPopup; + FDropDown.Sizeable := False; + FDropDown.Left := Left; + FDropDown.Top := Top + Height; + FDropDown.Width := Width; + FDropDown.Height := DropDownCount * Height; + FDropDown.Show; + end + else + begin + FDropDown.Close; + FreeAndNil(FDropDown); + end; +end; + +procedure TfpgCustomComboBox.InternalBtnClick(Sender: TObject); +begin + TPrivateWidget(FInternalBtn).MoveAndResize(Width - min(Height, 20) - 3, 2, Height - 4, Height - 4); + DoDropDown; +end; + +procedure TfpgCustomComboBox.HandleLMouseDown(x, y: integer; shiftstate: word); +begin + inherited HandleLMouseDown(x, y, shiftstate); + DoDropDown; +end; + +procedure TfpgCustomComboBox.HandlePaint; +var + r: TfpgRect; +begin + inherited HandlePaint; + Canvas.BeginDraw; + Canvas.ClearClipRect; + Canvas.DrawControlFrame(0, 0, Width, Height); + + // internal background rectangle (without frame) + r.Left := 2; + r.Top := 2; + r.Width := Width - 4; + r.Height := Height - 4; + Canvas.SetClipRect(r); + + if Enabled then + Canvas.SetColor(FBackgroundColor) + else + Canvas.SetColor(clWindowBackground); + // we already set the clip rectangle so we can paint full size + Canvas.FillRectAngle(2, 2, Width - 4, Height - 4); + // Canvas.FillRectAngle(0,0,Width,Height); + + // pgfStyle.DrawButtonFace(canvas, width - min(height, 20)-3, 2, height-4, height-4, [btnIsEmbedded]); + // pgfStyle.DrawDirectionArrow(canvas, width - height + 1, 1, height-2, height-2, 1); + + Canvas.EndDraw; +end; + +constructor TfpgCustomComboBox.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FBackgroundColor := clBoxColor; + FDropDownCount := 8; + if not Assigned(FInternalBtn) then + begin + FInternalBtn := CreateButton(self, Width - min(Height, 20) - 3, 2, Height - 4, '', @InternalBtnClick); + FInternalBtn.Embedded := True; + FInternalBtn.Parent := self; + FInternalBtn.ImageName := 'sys.sb.down'; + FInternalBtn.ShowImage := True; + end; +end; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_edit.pas b/prototypes/fpgui2/source/gui/gui_edit.pas new file mode 100644 index 00000000..32f1dbac --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_edit.pas @@ -0,0 +1,494 @@ +unit gui_edit; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget; + +type + + TfpgEdit = class(TfpgWidget) + private + FText: string; + FMaxLength: integer; + FCursorPos: integer; + FSideMargin: integer; + FBackgroundColor: TfpgColor; + FSelStart, FSelOffset: integer; + FSelecting: boolean; + FMouseDragPos: integer; + FFont: TfpgFont; + FDrawOffset: integer; + function GetFontName: string; + procedure SetFontName(const AValue: string); + procedure SetText(const AValue: string); + procedure DeleteSelection; + procedure DoCopy; + procedure DoPaste; + procedure AdjustCursor; + function GetDrawText: string; + procedure HandlePaint; override; + procedure HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleLMouseDown(x, y: integer; shiftstate: word); override; + procedure HandleMouseMove(x, y: integer; btnstate, shiftstate: word); override; + public + PasswordMode: boolean; + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + function SelectionText: string; + property Font: TfpgFont read FFont; + OnChange: TNotifyEvent; + published + property Text: string read FText write SetText; + property FontName: string read GetFontName write SetFontName; + end; + +function CreateEdit(AOwner: TComponent; x, y, w, h: TfpgCoord): TfpgEdit; + +implementation + +uses + gfx_UTF8utils; + +function CreateEdit(AOwner: TComponent; x, y, w, h: TfpgCoord): TfpgEdit; +begin + Result := TfpgEdit.Create(AOwner); + Result.Left := x; + Result.Top := y; + Result.Width := w; + if h > 0 then + Result.Height := h; +end; + +{ TfpgEdit } + +constructor TfpgEdit.Create(AOwner: TComponent); +begin + inherited; + Focusable := True; + + FFont := fpgGetFont('#Edit1'); // owned object ! + + FHeight := FFont.Height + 6; + FWidth := 120; + FBackgroundColor := clBoxColor; + FSelecting := False; + FSideMargin := 3; + FMaxLength := 0; + FText := ''; + FCursorPos := UTF8Length(FText); + FSelStart := FCursorPos; + FSelOffset := 0; + FDrawOffset := 0; + PasswordMode := False; + + OnChange := nil; +end; + +destructor TfpgEdit.Destroy; +begin + FFont.Free; + inherited Destroy; +end; + +procedure TfpgEdit.SetText(const AValue: string); +begin + if FText = AValue then + Exit; + + FText := AValue; + FCursorPos := UTF8Length(FText); + FSelStart := FCursorPos; + FSelOffset := 0; + FDrawOffset := 0; + + AdjustCursor; + if FWinHandle > 0 then + RePaint; +end; + +function TfpgEdit.GetFontName: string; +begin + Result := FFont.FontDesc; +end; + +procedure TfpgEdit.SetFontName(const AValue: string); +begin + FFont.Free; + FFont := fpgGetFont(AValue); + RePaint; +end; + +procedure TfpgEdit.DeleteSelection; +begin + if FSelOffset <> 0 then + begin + if FSelOffset < 0 then + begin + Delete(FText, 1 + FSelStart + FSelOffset, -FSelOffset); + FCurSorPos := FSelStart + FSelOffset; + end + else + begin + Delete(FText, 1 + FSelStart, FSelOffset); + FCurSorPos := FSelStart; + end; + FSelOffset := 0; + FSelStart := FCursorPos; + end; +end; + +procedure TfpgEdit.DoCopy; +begin + if FSelOffset = 0 then + Exit; + //SetClipboardText(SelectionText); +end; + +procedure TfpgEdit.DoPaste; +var + s: string; +begin + DeleteSelection; + //s := GetClipboardText; + if (FMaxLength > 0) then + if UTF8Length(FText) + UTF8Length(s) > FMaxLength then + s := UTF8Copy(s, 1, FMaxLength - UTF8Length(FText)); // trim the clipboard text if needed + + if UTF8Length(s) < 1 then + Exit; //==> + {$Note Is Insert() UTF-8 safe? } + Insert(s, FText, FCursorPos + 1); + FCursorPos := FCursorPos + UTF8Length(s); + AdjustCursor; + Repaint; +end; + +procedure TfpgEdit.AdjustCursor; +var + tw: integer; + VisibleWidth: integer; +begin + tw := FFont.TextWidth(UTF8Copy(GetDrawText, 1, FCursorPos)); + VisibleWidth := (FWidth - 2 * FSideMargin); + + if tw - FDrawOffset > VisibleWidth - 2 then + FDrawOffset := tw - VisibleWidth + 2 + else if tw - FDrawOffset < 0 then + begin + FDrawOffset := tw; + if tw <> 0 then + Dec(FDrawOffset, 2); + end; +end; + +function TfpgEdit.GetDrawText: string; +begin + if not PassWordMode then + Result := FText + else + Result := StringOfChar('*', UTF8Length(FText)); +end; + +procedure TfpgEdit.HandlePaint; +var + r: TfpgRect; + tw, tw2, st, len: integer; + dtext: string; +begin + Canvas.BeginDraw; + Canvas.ClearClipRect; + Canvas.DrawControlFrame(0, 0, Width, Height); + + r.Left := 2; + r.Top := 2; + r.Width := Width - 4; + r.Height := Height - 4; + Canvas.SetClipRect(r); + + if Enabled then + Canvas.SetColor(FBackgroundColor) + else + Canvas.SetColor(clWindowBackground); + + Canvas.FillRectAngle(2, 2, Width - 4, Height - 4); + dtext := GetDrawText; + Canvas.SetTextColor(clText1); + Canvas.SetFont(FFont); + Canvas.DrawString(-FDrawOffset + FSideMargin, 3, dtext); + + if Focused then + begin + // drawing selection + if FSelOffset <> 0 then + begin + len := FSelOffset; + st := FSelStart; + if len < 0 then + begin + st := st + len; + len := -len; + end; + + tw := FFont.TextWidth(UTF8copy(dtext, 1, st)); + tw2 := FFont.TextWidth(UTF8copy(dtext, 1, st + len)); + Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, -FDrawOffset + + FSideMargin + tw, 3, tw2 - tw, FFont.Height); + end; + + // drawing cursor + tw := FFont.TextWidth(UTF8copy(dtext, 1, FCursorPos)); + fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, 3, 2, FFont.Height - 1); + end + else + fpgCaret.UnSetCaret(Canvas); + + Canvas.EndDraw; +end; + +procedure TfpgEdit.HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); +var + prevval: string; + s: string; + + procedure StopSelection; + begin + FSelStart := FCursorPos; + FSelOffset := 0; + end; + +begin + //inherited; + //if Consumed then Exit; + + prevval := Text; + {$Note Is this UTF8 safe? } + s := char(keycode); + Consumed := False; + { + Consumed := true; + case ptkCheckClipBoardKey(keycode, shiftstate) of + ckCopy: DoCopy; + ckPaste: DoPaste; + ckCut: begin + DoCopy; + DeleteSelection; + end; + else + Consumed := false; + end; +} + + if not Consumed then + begin + // checking for movement keys: + consumed := True; + + case keycode of + KEY_LEFT: + if FCursorPos > 0 then + begin + Dec(FCursorPos); + + if (shiftstate and ss_control) <> 0 then + // word search... + // while (FCursorPos > 0) and not ptkIsAlphaNum(copy(FText,FCursorPos,1)) + // do Dec(FCursorPos); + // while (FCursorPos > 0) and ptkIsAlphaNum(copy(FText,FCursorPos,1)) + // do Dec(FCursorPos); + ; + + end; + + KEY_RIGHT: + if FCursorPos < UTF8Length(FText) then + begin + Inc(FCursorPos); + + if (shiftstate and ss_control) <> 0 then + // word search... + // while (FCursorPos < Length(FText)) and ptkIsAlphaNum(copy(FText,FCursorPos+1,1)) + // do Inc(FCursorPos); + // while (FCursorPos < Length(FText)) and not ptkIsAlphaNum(copy(FText,FCursorPos+1,1)) + // do Inc(FCursorPos); + ; + end; + + KEY_HOME: + FCursorPos := 0; + + KEY_END: + FCursorPos := UTF8Length(FText); + else + Consumed := False; + end; + + if Consumed then + begin + AdjustCursor; + + FSelecting := (shiftstate and ss_shift) <> 0; + + if FSelecting then + FSelOffset := FCursorPos - FSelStart + else + StopSelection; + end; + end; // movement key checking + + if not Consumed then + begin + consumed := True; + + case keycode of + KEY_BACKSPACE: + if FCursorPos > 0 then + begin + Delete(FText, FCursorPos, 1); + Dec(FCursorPos); + end;// backspace + + + KEY_DELETE: + if FSelOffset <> 0 then + DeleteSelection + else if FCursorPos < UTF8Length(FText) then + Delete(FText, FCursorPos + 1, 1); + else + Consumed := False; + end; + + if Consumed then + begin + StopSelection; + AdjustCursor; + end; + + end; + + if not Consumed and (keycode >= 32) and (keycode < $FF00) then + begin + // printeable + if (FMaxLength <= 0) or (UTF8Length(FText) < FMaxLength) then + begin + DeleteSelection; + {$Note Is this UTF8 safe? } + Insert(s, FText, FCursorPos + 1); + Inc(FCursorPos); + FSelStart := FCursorPos; + AdjustCursor; + end; + + consumed := True; + end; + + if prevval <> Text then + if Assigned(OnChange) then + OnChange(self); + + if consumed then + RePaint + else + inherited; +end; + +procedure TfpgEdit.HandleLMouseDown(x, y: integer; shiftstate: word); +var + s: string; + n: integer; + cpx: integer; + cp: integer; + cx: integer; + dtext: string; +begin + inherited HandleLMouseDown(x, y, shiftstate); + + // searching the appropriate character position + dtext := GetDrawText; + cpx := FFont.TextWidth(UTF8Copy(dtext, 1, FCursorPos)) - FDrawOffset + FSideMargin; + cp := FCursorPos; + s := ''; + + for n := 0 to UTF8Length(dtext) do + begin + cx := FFont.TextWidth(UTF8Copy(dtext, 1, n)) - FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + FMouseDragPos := cp; + FCursorPos := cp; + + if (shiftstate and ss_shift) <> 0 then + FSelOffset := FCursorPos - FSelStart + else + begin + FSelStart := cp; + FSelOffset := 0; + end; + Repaint; +end; + +procedure TfpgEdit.HandleMouseMove(x, y: integer; btnstate, shiftstate: word); +var + s: string; + n: integer; + cpx: integer; + cp: integer; + cx: integer; + dtext: string; +begin + if (btnstate and MOUSE_LEFT) = 0 then + Exit; + + // searching the appropriate character position + dtext := GetDrawText; + cpx := FFont.TextWidth(UTF8Copy(dtext, 1, FCursorPos)) - FDrawOffset + FSideMargin; + cp := FCursorPos; + s := ''; + + for n := 0 to UTF8Length(dtext) do + begin + cx := FFont.TextWidth(UTF8Copy(dtext, 1, n)) - FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + //FMouseDragPos := cp; + FSelOffset := cp - FSelStart; + if FCursorPos <> cp then + begin + FCursorPos := cp; + Repaint; + end; +end; + +function TfpgEdit.SelectionText: string; +begin + if FSelOffset <> 0 then + begin + if FSelOffset < 0 then + Result := UTF8Copy(FText, 1 + FSelStart + FSelOffset, -FSelOffset) + else + begin + Result := UTF8Copy(FText, 1 + FSelStart, FSelOffset); + end; + end + else + Result := ''; +end; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_form.pas b/prototypes/fpgui2/source/gui/gui_form.pas new file mode 100644 index 00000000..7866ec91 --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_form.pas @@ -0,0 +1,214 @@ +unit gui_form; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + gfx_widget; + +type + TWindowPosition = (wpUser, wpAuto, wpScreenCenter); + + + TfpgForm = class(TfpgWidget) + protected + FPrevModalForm: TfpgForm; + FModalResult: integer; + FParentForm: TfpgForm; + FWindowPosition: TWindowPosition; + FWindowTitle: string; + FSizeable: boolean; + FBackgroundColor: TfpgColor; + procedure AdjustWindowStyle; override; + procedure SetWindowParameters; override; + procedure SetWindowTitle(const AValue: string); + procedure MsgActivate(var msg: TfpgMessageRec); message FPGM_ACTIVATE; + procedure MsgDeActivate(var msg: TfpgMessageRec); message FPGM_DEACTIVATE; + procedure MsgClose(var msg: TfpgMessageRec); message FPGM_CLOSE; + procedure HandlePaint; override; + procedure HandleClose; virtual; + public + constructor Create(aowner: TComponent); override; + procedure AfterCreate; virtual; + procedure Show; + procedure Hide; + function ShowModal: integer; + procedure Close; + property Sizeable: boolean read FSizeable write FSizeable; + property WindowPosition: TWindowPosition read FWindowPosition write FWindowPosition; + property WindowTitle: string read FWindowTitle write SetWindowTitle; + property ModalResult: integer read FModalResult write FModalResult; + end; + + +var + // Don't like this. It's a bit of a hack. Possibly move this into + // fpgApplication, but do we want fpgApplication to have that dependency?? + fpgMainForm: TfpgForm; + fpgTopModalForm: TfpgForm; + +function WidgetParentForm(wg: TfpgWidget): TfpgForm; + + +implementation + +uses + fpgfx; + +function WidgetParentForm(wg: TfpgWidget): TfpgForm; +var + w: TfpgWidget; +begin + w := wg; + while w <> nil do + begin + if w is TfpgForm then + begin + Result := TfpgForm(w); + Exit; + end; + w := w.Parent; + end; + Result := nil; +end; + +{ TfpgForm } + +procedure TfpgForm.SetWindowTitle(const AValue: string); +begin + FWindowTitle := avalue; + inherited DoSetWindowTitle(FWindowTitle); +end; + +procedure TfpgForm.HandlePaint; +begin + canvas.BeginDraw; + canvas.Clear(FBackgroundColor); + canvas.EndDraw(0, 0, FWidth, FHeight); +end; + +procedure TfpgForm.AdjustWindowStyle; +begin + if fpgMainForm = nil then + fpgMainForm := self; + + if FWindowPosition = wpAuto then + Include(FWindowAttributes, waAutoPos) + else + Exclude(FWindowAttributes, waAutoPos); + + if FWindowPosition = wpScreenCenter then + Include(FWindowAttributes, waScreenCenterPos) + else + Exclude(FWindowAttributes, waScreenCenterPos); + + if FSizeable then + Include(FWindowAttributes, waSizeable) + else + Exclude(FWindowAttributes, waSizeable); +end; + +procedure TfpgForm.SetWindowParameters; +begin + inherited; + DoSetWindowTitle(FWindowTitle); +end; + +constructor TfpgForm.Create(aowner: TComponent); +begin + inherited; + FWindowPosition := wpUser; + FWindowTitle := ''; + FSizeable := True; + FParentForm := nil; + FBackgroundColor := clWindowBackground; + FMinWidth := 32; + FMinHeight := 32; + FModalResult := 0; + FPrevModalForm := nil; + + AfterCreate; +end; + +procedure TfpgForm.AfterCreate; +begin + // for the user +end; + +procedure TfpgForm.Show; +begin + HandleShow; +end; + +function TfpgForm.ShowModal: integer; +begin + FPrevModalForm := fpgTopModalForm; + fpgTopModalForm := self; + ModalResult := 0; + + Show; + // processing messages until this form ends. + // delivering the remaining messages + fpgApplication.ProcessMessages; + repeat + fpgWaitWindowMessage; + until (ModalResult <> 0) or (not Visible); + + fpgTopModalForm := FPrevModalForm; + Result := ModalResult; +end; + +procedure TfpgForm.MsgActivate(var msg: TfpgMessageRec); +begin + if (fpgTopModalForm = nil) or (fpgTopModalForm = self) then + begin + FocusRootWidget := self; + if ActiveWidget = nil then + ActiveWidget := FindFocusWidget(nil, fsdFirst) + else + ActiveWidget.SetFocus; + end; +end; + +procedure TfpgForm.MsgDeActivate(var msg: TfpgMessageRec); +begin + if ActiveWidget <> nil then + ActiveWidget.KillFocus; +end; + +procedure TfpgForm.MsgClose(var msg: TfpgMessageRec); +begin + HandleClose; +end; + +procedure TfpgForm.HandleClose; +begin + Close; +end; + +procedure TfpgForm.Hide; +begin + if (fpgTopModalForm = self) then + fpgTopModalForm := self.FPrevModalForm; + HandleHide; + if ModalResult = 0 then + ModalResult := -1; +end; + +procedure TfpgForm.Close; +begin + Hide; + if fpgMainForm = self then + Halt(0); +end; + +initialization + fpgMainForm := nil; + fpgTopModalForm := nil; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_label.pas b/prototypes/fpgui2/source/gui/gui_label.pas new file mode 100644 index 00000000..cacd6f63 --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_label.pas @@ -0,0 +1,122 @@ +unit gui_label; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget; + +type + + TfpgLabel = class(TfpgWidget) + private + FBackgroundColor: TfpgColor; + FColor: TfpgColor; + function GetFontDesc: string; + procedure SetBackgroundColor(const AValue: TfpgColor); + procedure SetFontDesc(const AValue: string); + procedure SetColor(const AValue: TfpgColor); + procedure SetText(const AValue: string); + protected + FText: string; + FFont: TfpgFont; + procedure HandlePaint; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + property Font: TfpgFont read FFont; + published + property Text: string read FText write SetText; + property FontDesc: string read GetFontDesc write SetFontDesc; + property Color: TfpgColor read FColor write SetColor; + property BackgroundColor: TfpgColor read FBackgroundColor write SetBackgroundColor; + end; + + TLabelClass = class of TfpgLabel; + +function CreateLabel(AOwner: TComponent; x, y: TfpgCoord; AText: string): TfpgLabel; + +implementation + +function CreateLabel(AOwner: TComponent; x, y: TfpgCoord; AText: string): TfpgLabel; +begin + Result := TfpgLabel.Create(AOwner); + Result.Left := x; + Result.Top := y; + Result.Text := AText; + Result.Width := Result.Font.TextWidth(Result.Text); +end; + +{ TfpgLabel } + +procedure TfpgLabel.SetColor(const AValue: TfpgColor); +begin + if FColor = AValue then + Exit; + FColor := AValue; + RePaint; +end; + +function TfpgLabel.GetFontDesc: string; +begin + Result := FFont.FontDesc; +end; + +procedure TfpgLabel.SetBackgroundColor(const AValue: TfpgColor); +begin + if FBackgroundColor = AValue then + Exit; + FBackgroundColor := AValue; + RePaint; +end; + +procedure TfpgLabel.SetFontDesc(const AValue: string); +begin + FFont.Free; + FFont := fpgGetFont(AValue); + RePaint; +end; + +procedure TfpgLabel.SetText(const AValue: string); +begin + if FText = AValue then + Exit; + FText := AValue; + RePaint; +end; + +constructor TfpgLabel.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FText := 'Label'; + FFont := fpgGetFont('#Label1'); + FHeight := FFont.Height; + FWidth := 80; + FColor := clText1; + FBackgroundColor := clWindowBackground; +end; + +destructor TfpgLabel.Destroy; +begin + FText := ''; + FFont.Free; + inherited Destroy; +end; + +procedure TfpgLabel.HandlePaint; +begin + Canvas.BeginDraw; + Canvas.Clear(FBackgroundColor); + Canvas.SetFont(Font); + Canvas.SetTextColor(FColor); + Canvas.DrawString(0, 0, FText); + Canvas.EndDraw; +end; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_memo.pas b/prototypes/fpgui2/source/gui/gui_memo.pas new file mode 100644 index 00000000..f10ba212 --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_memo.pas @@ -0,0 +1,1184 @@ +unit gui_memo; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget, + gui_scrollbar; + +type + + TfpgMemo = class(TfpgWidget) + private + FLines: TStringList; + FMaxLength: integer; + FCursorPos: integer; + FCursorLine: integer; + FSideMargin: integer; + FSelStartLine: integer; + FSelEndLine: integer; + FSelStartPos: integer; + FSelEndPos: integer; + FSelecting: boolean; + FMouseDragging: boolean; + FMouseDragPos: integer; + FFont: TfpgFont; + FBackgroundColor: TfpgColor; + FDrawOffset: integer; + FLineHeight: integer; + FFirstLine: integer; + FVScrollBar: TfpgScrollBar; + FHScrollBar: TfpgScrollBar; + FWrapping: boolean; + FLongestLineWidth: TfpgCoord; + function GetFontDesc: string; + procedure SetFontDesc(const AValue: string); + procedure RecalcLongestLine; + procedure DeleteSelection; + procedure DoCopy; + procedure DoPaste; + procedure AdjustCursor; + function LineCount: integer; + function GetLineText(linenum: integer): string; + procedure SetLineText(linenum: integer; Value: string); + function GetCursorX: integer; + procedure SetCPByX(x: integer); + function CurrentLine: string; + function VisibleLines: integer; + function VisibleWidth: integer; + procedure VScrollBarMove(Sender: TObject; position: integer); + procedure HScrollBarMove(Sender: TObject; position: integer); + procedure SetText(const AValue: string); + function GetText: string; + procedure SetCursorLine(aValue: integer); + protected + procedure HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); override; + procedure HandleLMouseDown(x, y: integer; shiftstate: word); override; + procedure HandleMouseMove(x, y: integer; btnstate, shiftstate: word); override; + procedure HandleResize(dwidth, dheight: integer); override; + //procedure HandleWindowScroll(direction, amount : integer); override; + procedure HandlePaint; override; + procedure HandleShow; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure UpdateScrollBar; + function SelectionText: string; + property LineHeight: integer read FLineHeight; + property CursorLine: integer read FCursorLine write SetCursorLine; + property Text: string read GetText write SetText; + property Font: TfpgFont read FFont; + OnChange: TNotifyEvent; + published + property Lines: TStringList read FLines; + property FontDesc: string read GetFontDesc write SetFontDesc; + end; + + +implementation + +uses + gfx_UTF8utils; + +{ TfpgMemo } + +procedure TfpgMemo.SetCursorLine(aValue: integer); +var + i: integer; + MaxLine: integer; + yp: integer; +begin + if (aValue < 1) or (aValue = FCursorLine) then + Exit; // wrong value + if aValue < FFirstLine then + begin + FFirstLine := aValue; // moves the selected line to the top of the displayed rectangle + FCursorLine := aValue; + FCursorPos := 0; + RePaint; + Exit; + end; + yp := 2; + MaxLine := 0; + for i := FFirstLine to LineCount do + begin + yp := yp + LineHeight; + if yp > Height then + begin + MaxLine := i - 1; + break; + end; + end; + if MaxLine < aValue then + begin + FFirstLine := aValue; + FCursorLine := aValue; + FCursorPos := 0; + RePaint; + Exit; + end + else + begin + FCursorLine := aValue; + FCursorPos := 0; + RePaint; + Exit; + end; +end; + +constructor TfpgMemo.Create(AOwner: TComponent); +begin + inherited; + Focusable := True; + FFont := fpgGetFont('#Edit1'); + FHeight := FFont.Height * 3 + 4; + FWidth := 120; + FLineHeight := FFont.Height + 2; + + FSelecting := False; + FSideMargin := 3; + FMaxLength := 0; + + OnChange := nil; + + FLines := TStringList.Create; + FFirstLine := 1; + FCursorLine := 1; + + FCursorPos := 0; + FSelStartPos := FCursorPos; + FSelEndPos := 0; + FSelStartLine := 0; + FSelEndLine := 0; + + FBackgroundColor := clBoxColor; + + FDrawOffset := 0; + FMouseDragging := False; + + FVScrollBar := TfpgScrollBar.Create(self); + FVScrollBar.Orientation := orVertical; + FVScrollBar.OnScroll := @VScrollBarMove; + FVScrollBar.Top := 0; + FVScrollBar.Left := Width - FVScrollBar.Width; + FVScrollBar.Height := Height; + + FHScrollBar := TfpgScrollBar.Create(self); + FHScrollBar.Orientation := orHorizontal; + FHScrollBar.OnScroll := @HScrollBarMove; + FHScrollBar.Top := Height - FHScrollbar.Height; + + FWrapping := False; +end; + +destructor TfpgMemo.Destroy; +begin + FLines.Free; + FFont.Free; + inherited Destroy; +end; + +procedure TfpgMemo.RecalcLongestLine; +var + n: integer; + lw: TfpgCoord; +begin + FLongestLineWidth := 0; + for n := 1 to LineCount do + begin + lw := FFont.TextWidth(getlinetext(n)); + if lw > FlongestLineWidth then + FlongestLineWidth := lw; + end; +end; + +function TfpgMemo.GetFontDesc: string; +begin + Result := FFont.FontDesc; +end; + +procedure TfpgMemo.DeleteSelection; +var + n: integer; + selsl: integer; + selsp: integer; + selel: integer; + selep: integer; + ls: string; + len: integer; + st: integer; +begin + if FSelEndLine < 1 then + Exit; + + if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then + begin + selsl := FSelStartLine; + selsp := FSelStartPos; + selel := FSelEndLine; + selep := FSelEndPos; + end + else + begin + selel := FSelStartLine; + selep := FSelStartPos; + selsl := FSelEndLine; + selsp := FSelEndPos; + end; + + for n := selsl to selel do + begin + ls := GetLineText(n); + + if selsl < n then + st := 0 + else + st := selsp; + if selel > n then + len := UTF8Length(ls) + else + len := selep - st; + + Delete(ls, st + 1, len); + SetLineText(n, ls); + end; + + if selsl < selel then + begin + ls := GetlineText(selsl); + ls := ls + GetLineText(selel); + SetLineText(selsl, ls); + end; + + for n := selsl + 1 to selel do + FLines.Delete(selsl); + + FCursorPos := selsp; + FCursorLine := selsl; + FSelEndLine := 0; +end; + +procedure TfpgMemo.DoCopy; +var + n: integer; + selsl: integer; + selsp: integer; + selel: integer; + selep: integer; + ls: string; + len: integer; + st: integer; + s: string; +begin + if FSelEndLine < 1 then + Exit; + + if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then + begin + selsl := FSelStartLine; + selsp := FSelStartPos; + selel := FSelEndLine; + selep := FSelEndPos; + end + else + begin + selel := FSelStartLine; + selep := FSelStartPos; + selsl := FSelEndLine; + selsp := FSelEndPos; + end; + + s := ''; + + for n := selsl to selel do + begin + if n > selsl then + s := s + #13#10; + + ls := GetLineText(n); + + if selsl < n then + st := 0 + else + st := selsp; + + if selel > n then + len := UTF8Length(ls) + else + len := selep - st; + + s := s + UTF8Copy(ls, st + 1, len); + end; + + //SetClipboardText(s); +end; + +procedure TfpgMemo.DoPaste; +var + s: string; + si: string; + si8: string; + lineend: string; + n: integer; + l: integer; + lcnt: integer; +begin + Exit; + (* + DeleteSelection; + s := GetClipboardText; + + si := UTF8Copy(CurrentLine,1,FCursorPos); + lineend := UTF8Copy(CurrentLine,FCursorPos+1, UTF8Length(CurrentLine)); + l := FCursorLine; + n := 1; + lcnt := 0; + si8 := ''; + while n <= length(s) do + begin + if (s[n] = #13) or (s[n] = #10) then + begin + if lcnt = 0 then SetLineText(l, si + si8) + else FLines.Insert(l-1, si + si8); + + si := ''; + si8 := ''; + inc(lcnt); + inc(l); + + // skip multibyte line end: + if (s[n]=#13) and (n < length(s)) and (s[n+1]=#10) then inc(n); + end + else + begin + si8 := si8 + s[n]; + end; + inc(n); + end; + + si := si + si8; + + FCursorPos := UTF8Length(si); + si := si + lineend; + + if lcnt = 0 then + begin + SetLineText(l, si) + end + else + begin + FLines.Insert(l-1, si); + FCursorLine := l; + end; + + AdjustCursor; + Repaint; +*) +end; + +procedure TfpgMemo.AdjustCursor; +var + tw: integer; +begin + // horizontal adjust + RecalcLongestLine; + tw := FFont.TextWidth(UTF8Copy(CurrentLine, 1, FCursorPos)); + + if tw - FDrawOffset > VisibleWidth - 2 then + FDrawOffset := tw - VisibleWidth + 2 + else if tw - FDrawOffset < 0 then + begin + FDrawOffset := tw; + if tw <> 0 then + Dec(FDrawOffset, 2); + end; + + // vertical adjust + + if FCursorLine < FFirstLine then + FFirstLine := FCursorLine; + if FCursorline - FFirstLine + 1 > VisibleLines then + FFirstLine := FCursorline - VisibleLines + 1; + + if FFirstLine + VisibleLines > LineCount then + begin + FFirstLine := LineCount - VisibleLines + 1; + if FFirstline < 1 then + FFirstLine := 1; + end; + + UpdateScrollbar; +end; + +procedure TfpgMemo.UpdateScrollBar; +var + vlines: integer; + vsbw, x: integer; + hsbwas: boolean; + vsbwas: boolean; + vsbvis: boolean; +begin + hsbwas := FHScrollBar.Visible; + vsbwas := FVScrollBar.Visible; + vlines := (Height - (FSideMargin shl 1)) div Lineheight; + vsbvis := (LineCount > vlines); + + if vsbvis then + vsbw := FVScrollBar.Width + else + vsbw := 0; + + FHScrollBar.Visible := FLongestLineWidth > (Width - vsbw - FSideMargin * 2) - 1; + + if FHScrollBar.Visible and not vsbvis then + begin + // recheck vertical scrollbar + vlines := (Height - (FSideMargin shl 1) - FHScrollBar.Height) div Lineheight; + vsbvis := (LineCount > vlines); + end; + + FVScrollBar.Visible := vsbvis; + + if FHScrollBar.Visible then + begin + if not FVScrollBar.Visible then + x := Width + else + x := Width - FVscrollBar.Width; + if x <> FHScrollBar.Width then + begin + FHScrollBar.Width := x; + FHScrollBar.UpdateWindowPosition; + end; + end; + + if FHScrollBar.Visible then + begin + FHScrollBar.Min := 0; + FHScrollBar.Max := FLongestLineWidth - VisibleWidth - 1; + if (FLongestLineWidth <= 0) or (FLongestLineWidth <= VisibleWidth) then + FHScrollBar.SliderSize := 1 + else + FHScrollBar.SliderSize := VisibleWidth / FLongestLineWidth; + FHScrollBar.Position := FDrawOffset; + FHScrollBar.RepaintSlider; + end; + + if FVScrollBar.Visible then + begin + FVScrollBar.Min := 1; + FVScrollBar.SliderSize := VisibleLines / LineCount; + FVScrollBar.Max := LineCount - VisibleLines + 1; + FVScrollBar.Position := FFirstLine; + + FVScrollBar.RePaintSlider; + end; + + if (hsbwas <> FHScrollBar.Visible) or (vsbwas <> FVScrollBar.Visible) then + AdjustCursor; +end; + +function TfpgMemo.LineCount: integer; +begin + Result := FLines.Count; +end; + +function TfpgMemo.GetLineText(linenum: integer): string; +begin + if LineCount < 1 then + FLines.Add(''); + if (linenum >= 1) and (linenum <= LineCount) then + Result := FLines.Strings[linenum - 1] + else + Result := ''; +end; + +procedure TfpgMemo.SetFontDesc(const AValue: string); +begin + FFont.Free; + FFont := fpgGetFont(AValue); + RePaint; +end; + +procedure TfpgMemo.SetLineText(linenum: integer; Value: string); +begin + FLines.Strings[linenum - 1] := Value; +end; + +function TfpgMemo.GetCursorX: integer; +begin + Result := FFont.TextWidth(copy(CurrentLine, 1, FCursorPos)); +end; + +// Set cursor position by X +procedure TfpgMemo.SetCPByX(x: integer); +var + s: string; + n: integer; + cpx: integer; + cp: integer; + cx: integer; + ls: string; +begin + // searching the appropriate character position + ls := CurrentLine; + cpx := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)); // + FDrawOffset + FSideMargin; + cp := FCursorPos; + if cp > UTF8Length(ls) then + cp := UTF8Length(ls); + + s := ''; + + for n := 0 to UTF8Length(ls) do + begin + cx := FFont.TextWidth(UTF8Copy(ls, 1, n)); // + FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + FCursorPos := cp; +end; + +function TfpgMemo.CurrentLine: string; +begin + Result := GetLineText(FCursorLine); +end; + +function TfpgMemo.VisibleLines: integer; +var + sh: integer; +begin + if FHScrollBar.Visible then + sh := 18 + else + sh := 0; + Result := (Height - (FSideMargin shl 1) - sh) div Lineheight; +end; + +function TfpgMemo.VisibleWidth: integer; +var + sw: integer; +begin + if FVScrollBar.Visible then + sw := FVScrollBar.Width + else + sw := 0; + Result := (Width - (FSideMargin shl 1) - sw); +end; + +procedure TfpgMemo.HandleShow; +begin + // FVScrollBar.SetDimensions(width-18,0,18,height); + // FHScrollBar.SetDimensions(0,height-18,width-18,18); + // FHScrollBar.Visible := false; + inherited HandleShow; + RecalcLongestLine; + UpdateScrollBar; +end; + +procedure TfpgMemo.VScrollBarMove(Sender: TObject; position: integer); +begin + if FFirstLine <> position then + begin + FFirstLine := position; + repaint; + end; +end; + +procedure TfpgMemo.HScrollBarMove(Sender: TObject; position: integer); +begin + if position <> FDrawOffset then + begin + FDrawOffset := position; + Repaint; + end; +end; + +procedure TfpgMemo.HandlePaint; +var + n: integer; + tw, tw2, st, len: integer; + yp: integer; + ls: string; + r: TfpgRect; + selsl, selsp, selel, selep: integer; +begin + Canvas.BeginDraw; + Canvas.ClearClipRect; + fpgStyle.DrawControlFrame(Canvas, 0, 0, Width, Height); + + r.Left := 2; + r.Top := 2; + r.Width := Width - 4; + r.Height := Height - 4; + Canvas.SetClipRect(r); + + if Enabled then + Canvas.SetColor(FBackgroundColor) + else + Canvas.SetColor(clWindowBackground); + + Canvas.FillRectAngle(2, 2, Width - 4, Height - 4); + Canvas.SetFont(FFont); + + if (FSelStartLine shl 16) + FSelStartPos <= (FSelEndLine shl 16) + FSelEndPos then + begin + selsl := FSelStartLine; + selsp := FSelStartPos; + selel := FSelEndLine; + selep := FSelEndPos; + end + else + begin + selel := FSelStartLine; + selep := FSelStartPos; + selsl := FSelEndLine; + selsp := FSelEndPos; + end; + + yp := 3; + for n := FFirstline to LineCount do + begin + ls := GetLineText(n); + Canvas.DrawString(-FDrawOffset + FSideMargin, yp, ls); + + if Focused then + begin + // drawing selection + if (FSelEndLine > 0) and (selsl <= n) and (selel >= n) then + begin + if selsl < n then + st := 0 + else + st := selsp; + if selel > n then + len := UTF8Length(ls) + else + len := selep - st; + + tw := FFont.TextWidth(UTF8Copy(ls, 1, st)); + tw2 := FFont.TextWidth(UTF8Copy(ls, 1, st + len)); + Canvas.XORFillRectangle(fpgColorToRGB(clSelection) xor $FFFFFF, -FDrawOffset + + FSideMargin + tw, yp, tw2 - tw, LineHeight); + end; + + //drawing cursor + if FCursorLine = n then + begin + // drawing cursor + tw := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)); + fpgCaret.SetCaret(Canvas, -FDrawOffset + FSideMargin + tw, yp, 1, FFont.Height); + end; + + end; + + yp := yp + LineHeight; + + if yp > Height then + Break; + end; + + if not Focused then + fpgCaret.UnSetCaret(Canvas); + + Canvas.EndDraw; +end; + +procedure TfpgMemo.HandleKeyChar(var keycode: word; var shiftstate: word; var consumed: boolean); +var + prevval: string; + s: string; + ls: string; + ls2: string; + cx: integer; + + procedure StopSelection; + begin + FSelStartLine := FCursorLine; + FSelStartPos := FCursorPos; + FSelEndLine := 0; + end; + +begin + inherited; + prevval := Text; + s := char(keycode); + Consumed := False; + (* + Consumed := true; + case pgfCheckClipBoardKey(keycode, shiftstate) of + ckCopy: DoCopy; + ckPaste: DoPaste; + ckCut: //if FSelEndLine > 0 then + begin + DoCopy; + DeleteSelection; + end; + else + Consumed := false; + end; +*) + + if not Consumed then + begin + // checking for movement keys: + consumed := True; + FSelecting := (shiftstate and ss_shift) <> 0; + + case keycode of + KEY_LEFT: + if FCursorPos > 0 then + begin + Dec(FCursorPos); + + if (shiftstate and ss_control) <> 0 then + // word search... + (* + while (FCursorPos > 0) and not pgfIsAlphaNum(copy(CurrentLine,FCursorPos,1)) + do Dec(FCursorPos); + + while (FCursorPos > 0) and pgfIsAlphaNum(copy(CurrentLine,FCursorPos,1)) + do Dec(FCursorPos); + *); + + end;// left + + KEY_RIGHT: + if FCursorPos < UTF8Length(CurrentLine) then + begin + Inc(FCursorPos); + + if (shiftstate and ss_control) <> 0 then + // word search... + (* + while (FCursorPos < length(CurrentLine)) and pgfIsAlphaNum(copy(CurrentLine,FCursorPos+1,1)) + do Inc(FCursorPos); + + while (FCursorPos < length(CurrentLine)) and not pgfIsAlphaNum(copy(CurrentLine,FCursorPos+1,1)) + do Inc(FCursorPos); + *); + + end;// right + + KEY_UP: + begin // up + cx := GetCursorX; + if FCursorLine > 1 then + begin + Dec(FCursorline); + SetCPByX(cx); + end; + end; + + KEY_DOWN: + begin // down + cx := GetCursorX; + if FCursorLine < LineCount then + begin + Inc(FCursorline); + SetCPByX(cx); + end; + end; + KEY_HOME: + FCursorPos := 0;// home + + KEY_END: + FCursorPos := UTF8Length(CurrentLine);// end + + KEY_PGUP: + if FCursorLine > 1 then + begin + cx := GetCursorX; + Dec(FCursorLine, VisibleLines); + if FCursorLine < 1 then + FCursorLine := 1; + SetCPByX(cx); + end;// pgup + + KEY_PGDN: + begin // pgdown + cx := GetCursorX; + if FCursorLine < LineCount then + begin + Inc(FCursorline, VisibleLines); + if FCursorLine > LineCount then + FCursorLine := LineCount; + SetCPByX(cx); + end; + end; + + else + Consumed := False; + end; + + if Consumed then + begin + AdjustCursor; + + if FSelecting then + begin + FSelEndPos := FCursorPos; + FSelEndLine := FCursorLine; + end + else + StopSelection; + end; + end; + + if not Consumed then + begin + consumed := True; + + case keycode of + KEY_ENTER: + begin // enter + ls := UTF8Copy(FLines[FCursorline - 1], 1, FCursorPos); + ls2 := UTF8Copy(FLines[FCursorline - 1], FCursorPos + 1, UTF8Length(FLines[FCursorline - 1])); + FLines.Insert(FCursorLine - 1, ls); + Inc(FCursorLine); + SetLineText(FCursorLine, ls2); + FCursorPos := 0; + end; + KEY_BACKSPACE: + if FCursorPos > 0 then + begin + ls := GetLineText(FCursorLine); + Delete(ls, FCursorPos, 1); + SetLineText(FCursorLine, ls); + Dec(FCursorPos); + end + else if FCursorLine > 1 then + begin + ls := CurrentLine; + FLines.Delete(FCursorLine - 1); + Dec(FCursorLine); + FCursorPos := UTF8Length(FLines.Strings[FCursorLine - 1]); + FLines.Strings[FCursorLine - 1] := FLines.Strings[FCursorLine - 1] + ls; + end;// backspace + + KEY_DELETE: + begin // del + ls := GetLineText(FCursorLine); + if FSelEndLine > 0 then + DeleteSelection + else if FCursorPos < UTF8Length(ls) then + begin + Delete(ls, FCursorPos + 1, 1); + SetLineText(FCursorLine, ls); + end + else if FCursorLine < LineCount then + begin + ls2 := FLines.Strings[FCursorLine]; + FLines.Delete(FCursorLine); + FLines.Strings[FCursorLine - 1] := ls + ls2; + end; + end; + else + consumed := False; + end; + + if Consumed then + begin + StopSelection; + AdjustCursor; + end; + end; + + if not Consumed and (keycode >= 32) and (keycode < $FF00) then + begin + // printeable + //FText := FText + s; + + if (FMaxLength <= 0) or (UTF8Length(FLines.Text) < FMaxLength) then + begin + DeleteSelection; + ls := GetLineText(FCursorLine); + insert(s, ls, FCursorPos + 1); + SetLineText(FCursorLine, ls); + Inc(FCursorPos); + FSelStartPos := FCursorPos; + FSelStartLine := FCursorLine; + FSelEndLine := 0; + AdjustCursor; + end; + + consumed := True; + end; + + if prevval <> Text then + if Assigned(OnChange) then + OnChange(self); + + if consumed then + RePaint; +end; + +procedure TfpgMemo.HandleLMouseDown(x, y: integer; shiftstate: word); +var + s: string; + n: integer; + cpx: integer; + cp: integer; + cx: integer; + lnum: integer; + ls: string; +begin + inherited HandleLMouseDown(x, y, shiftstate); + + // searching the appropriate character position + lnum := FFirstLine + (y - FSideMargin) div LineHeight; + if lnum > LineCount then + lnum := LineCount; + + ls := GetLineText(lnum); + cpx := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)) - FDrawOffset + FSideMargin; + cp := FCursorPos; + + s := ''; + + for n := 0 to UTF8Length(ls) do + begin + cx := FFont.TextWidth(UTF8Copy(ls, 1, n)) - FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + FMouseDragging := True; + FMouseDragPos := cp; + FCursorPos := cp; + FCursorLine := lnum; + + if (shiftstate and ss_shift) <> 0 then + begin + FSelEndLine := lnum; + FSelEndpos := cp; + end + else + begin + FSelStartLine := lnum; + FSelStartPos := cp; + FSelEndLine := 0; + end; + Repaint; +end; + +procedure TfpgMemo.HandleMouseMove(x, y: integer; btnstate, shiftstate: word); +var + s: string; + n: integer; + cpx: integer; + cp: integer; + cx: integer; + lnum: integer; + ls: string; +begin + if not FMouseDragging or ((btnstate and 1) = 0) then + begin + FMouseDragging := False; + Exit; + end; + + // searching the appropriate character position + lnum := FFirstLine + (y - FSideMargin) div LineHeight; + if lnum > LineCount then + lnum := LineCount; + + ls := GetLineText(lnum); + cpx := FFont.TextWidth(UTF8Copy(ls, 1, FCursorPos)) - FDrawOffset + FSideMargin; + cp := FCursorPos; + s := ''; + + for n := 0 to UTF8Length(ls) do + begin + cx := FFont.TextWidth(UTF8Copy(ls, 1, n)) - FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + if (cp <> FCursorPos) or (lnum <> FCursorLine) then + begin + FCursorLine := lnum; + FSelEndLine := lnum; + FSelEndPos := cp; + FCursorPos := cp; + Repaint; + end; + + + // searching the appropriate character position + { + cpx := FFont.TextWidth16(copy16(FText,1,FCursorPos)) + FDrawOffset + FSideMargin; + cp := FCursorPos; + + s := ''; + + for n := 0 to Length16(Text) do + begin + cx := FFont.TextWidth16(copy16(Text,1,n)) + FDrawOffset + FSideMargin; + if abs(cx - x) < abs(cpx - x) then + begin + cpx := cx; + cp := n; + end; + end; + + //FMouseDragPos := cp; + FSelOffset := cp-FSelStart; + if FCursorPos <> cp then + begin + FCursorPos := cp; + Repaint; + end; +} +end; + +(* +procedure TfpgMemo.HandleWindowScroll(direction, amount: integer); +var + pfl, pdo : integer; +begin + inherited HandleWindowScroll(direction, amount); + + pfl := FFirstLine; + pdo := FDrawOffset; + + if direction = 0 then + begin + dec(FFirstLine, amount); + end; + if direction = 1 then + begin + inc(FFirstLine, amount); + end; + if FFirstLine > LineCount - VisibleLines + 1 then FFirstLine := LineCount - VisibleLines + 1; + if FFirstLine < 1 then FFirstLine := 1; + + if FHScrollBar.Visible then + begin + if Direction = 2 then + begin + dec(FDrawOffset, amount*16); + end; + if Direction = 3 then + begin + inc(FDrawOffset, amount*16); + end; + + if FDrawOffset > FHScrollBar.Max then FDrawOffset := FHScrollBar.Max; + if FDrawOffset < 0 then FDrawOffset := 0; + end; + + if (pfl <> FFirstLine) or (pdo <> FDrawOffset) then + begin + UpdateScrollBar; + Repaint; + end; + +end; +*) + +procedure TfpgMemo.HandleResize(dwidth, dheight: integer); +begin + inherited HandleResize(dwidth, dheight); + + FVScrollBar.Top := 0; + FVScrollBar.Height := Height - FHScrollBar.Height; + FVScrollBar.Left := Width - FVScrollBar.Width; + FVScrollBar.UpdateWindowPosition; + + FHScrollBar.Top := Height - FHScrollBar.Height; + FHScrollBar.Width := Width - FVScrollBar.Width; + FHScrollBar.UpdateWindowPosition; + + UpdateScrollBar; +end; + +function TfpgMemo.SelectionText: string; +begin + { + if FSelOffset <> 0 then + begin + if FSelOffset < 0 then + begin + Result := Copy16(FText,1+FSelStart + FSelOffset,-FSelOffset); + end + else + begin + result := Copy16(FText,1+FSelStart,FSelOffset); + end; + end + else Result := ''; +} +end; + +function TfpgMemo.GetText: string; +var + n: integer; + s: string; +begin + s := ''; + for n := 1 to LineCount do + begin + if n > 1 then + s := s + #13#10; + s := s + GetLineText(n); + end; + Result := s; +end; + +procedure TfpgMemo.SetText(const AValue: string); +var + n: integer; + c: string[2]; + s: string; +begin + FLines.Clear; + s := ''; + n := 1; + while n <= UTF8Length(AValue) do + begin + c := UTF8Copy(AValue, n, 1); + if (c[1] = #13) or (c[1] = #10) then + begin + FLines.Add(s); + s := ''; + c := UTF8Copy(AValue, n + 1, 1); + if c[1] = #10 then + Inc(n); + end + else + s := s + c; + Inc(n); + end; + + if s <> '' then + FLines.Add(s); + + FDrawOffset := 0; + FCursorPos := 0; + FCursorLine := 1; + FSelStartLine := FCursorLine; + FSelStartPos := FCursorPos; + FSelEndLine := 0; + + AdjustCursor; + Repaint; +end; + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_popupwindow.pas b/prototypes/fpgui2/source/gui/gui_popupwindow.pas new file mode 100644 index 00000000..3757aab6 --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_popupwindow.pas @@ -0,0 +1,14 @@ +unit gui_popupwindow; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils; + +implementation + +end. + diff --git a/prototypes/fpgui2/source/gui/gui_scrollbar.pas b/prototypes/fpgui2/source/gui/gui_scrollbar.pas new file mode 100644 index 00000000..7a9e7c0a --- /dev/null +++ b/prototypes/fpgui2/source/gui/gui_scrollbar.pas @@ -0,0 +1,254 @@ +unit gui_scrollbar; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_widget; + +type + TScrollNotifyEvent = procedure(Sender: TObject; position: integer) of object; + + TfpgScrollBar = class(TfpgWidget) + protected + FSliderPos, FSliderLength: TfpgCoord; + FSliderDragging: boolean; + FSliderDragPos: TfpgCoord; + FSliderDragStart: TfpgCoord; + procedure DrawButton(x, y, w, h: TfpgCoord; const imgname: string); + procedure DrawSlider(recalc: boolean); + procedure HandleLMouseDown(x, y: integer; shiftstate: word); override; + procedure HandleLMouseUp(x, y: integer; shiftstate: word); override; + procedure HandleMouseMove(x, y: integer; btnstate, shiftstate: word); override; + procedure HandlePaint; override; + procedure PositionChange(d: integer); + public + OnScroll: TScrollNotifyEvent; + Orientation: TOrientation; + Min, Max: integer; + SliderSize: double; // 0-1 + Position: integer; + constructor Create(AOwner: TComponent); override; + procedure RepaintSlider; + end; + + +implementation + +{ TfpgScrollBar } + +constructor TfpgScrollBar.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + Orientation := orVertical; + Min := 0; + Max := 100; + Position := 10; + SliderSize := 0.5; + OnScroll := nil; + FSliderPos := 0; + FSliderDragging := False; + FSliderLength := 10; +end; + +procedure TfpgScrollBar.HandlePaint; +begin + Canvas.BeginDraw; + + if Orientation = orVertical then + begin + DrawButton(0, 0, Width, Width, 'sys.sb.up'); + DrawButton(0, Height - Width, Width, Width, 'sys.sb.down'); + end + else + begin + DrawButton(0, 0, Height, Height, 'sys.sb.left'); + DrawButton(Width - Height, 0, Height, Height, 'sys.sb.right'); + end; + + DrawSlider(True); + Canvas.EndDraw; +end; + +procedure TfpgScrollBar.RepaintSlider; +begin + if not HasHandle then + Exit; + DrawSlider(True); +end; + +procedure TfpgScrollBar.DrawButton(x, y, w, h: TfpgCoord; const imgname: string); +var + img: TfpgImage; +begin + Canvas.DrawButtonFace(x, y, w, h, [btnIsEmbedded]); + Canvas.SetColor(clText1); + img := fpgImages.GetImage(imgname); + if img <> nil then + Canvas.DrawImage(x + w div 2 - (img.Width div 2), y + h div 2 - (img.Height div 2), img); +end; + +procedure TfpgScrollBar.DrawSlider(recalc: boolean); +var + area: TfpgCoord; + mm: TfpgCoord; + rpr: TfpgRect; +begin + Canvas.BeginDraw; + + if SliderSize > 1 then + SliderSize := 1; + + Canvas.SetColor(clScrollBar); + + if Orientation = orVertical then + begin + Canvas.FillRectangle(0, Width, Width, Height - Width - Width); + area := Height - (Width shl 1); + end + else + begin + Canvas.FillRectangle(Height, 0, Width - Height - Height, Height); + area := Width - (Height shl 1); + end; + + if recalc then + begin + if Position > Max then + Position := Max; + if Position < min then + Position := Min; + + FSliderLength := trunc(area * SliderSize); + if FSliderLength < 8 then + FSliderLength := 8; + area := area - FSliderLength; + mm := Max - Min; + if mm = 0 then + FSliderPos := 0 + else + FSliderPos := Trunc(area * ((Position - min) / mm)); + end; + + if Orientation = orVertical then + begin + Canvas.DrawButtonFace(0, Width + FSliderPos, Width, FSliderLength, [btnIsEmbedded]); + Canvas.EndDraw(0, Width, Width, Height - Width - Width); + end + else + begin + Canvas.DrawButtonFace(Height + FSliderPos, 0, FSliderLength, Height, [btnIsEmbedded]); + Canvas.EndDraw(Height, 0, Width - Height - Height, Height); + end; +end; + +procedure TfpgScrollBar.HandleLMouseDown(x, y: integer; shiftstate: word); +begin + inherited; + + if Orientation = orVertical then + begin + if y <= Width then + PositionChange(-1) + else if y >= Height - Width then + PositionChange(1) + else if (y >= Width + FSliderPos) and (y <= Width + FSliderPos + FSliderLength) then + begin + FSliderDragging := True; + FSliderDragPos := y; + end; + end + else if x <= Height then + PositionChange(-1) + else if x >= Width - Height then + PositionChange(1) + else if (x >= Height + FSliderPos) and (x <= Height + FSliderPos + FSliderLength) then + begin + FSliderDragging := True; + FSliderDragPos := x; + end; + + if FSliderDragging then + begin + FSliderDragStart := FSliderPos; + DrawSlider(False); + end; +end; + +procedure TfpgScrollBar.HandleLMouseUp(x, y: integer; shiftstate: word); +begin + inherited; + FSliderDragging := False; +end; + +procedure TfpgScrollBar.HandleMouseMove(x, y: integer; btnstate, shiftstate: word); +var + d: integer; + area: integer; + newp: integer; + ppos: integer; +begin + inherited HandleMouseMove(x, y, btnstate, shiftstate); + + if (not FSliderDragging) or ((btnstate and MOUSE_LEFT) = 0) then + begin + FSliderDragging := False; + Exit; + end; + + if Orientation = orVertical then + begin + d := y - FSliderDragPos; + area := Height - (Width shl 1) - FSliderLength; + end + else + begin + d := x - FSliderDragPos; + area := Width - (Height shl 1) - FSliderLength; + end; + + ppos := FSliderPos; + FSliderPos := FSliderDragStart + d; + + if FSliderPos < 0 then + FSliderPos := 0; + if FSliderPos > area then + FSliderPos := area; + + if ppos <> FSliderPos then + DrawSlider(False); + + if area <> 0 then + newp := Min + trunc((Max - Min) * FSliderPos / area) + else + newp := Min; + + if newp <> Position then + begin + Position := newp; + if Assigned(OnScroll) then + OnScroll(self, Position); + end; +end; + +procedure TfpgScrollBar.PositionChange(d: integer); +begin + Position := Position + d; + if Position < Min then + Position := Min; + if Position > Max then + Position := Max; + + DrawSlider(True); + + if Assigned(OnScroll) then + OnScroll(self, Position); +end; + +end. + diff --git a/prototypes/fpgui2/tests/bitmaptest.dpr b/prototypes/fpgui2/tests/bitmaptest.dpr new file mode 100644 index 00000000..4c058339 --- /dev/null +++ b/prototypes/fpgui2/tests/bitmaptest.dpr @@ -0,0 +1,67 @@ +program bitmaptest; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_imgfmt_bmp, + gui_form; + +type + + { TMainForm } + + TMainForm = class(TfpgForm) + public + procedure AfterCreate; override; + procedure HandlePaint; override; + end; + + + { TMainForm } + + procedure TMainForm.AfterCreate; + begin + SetPosition(100, 100, 256, 256); + WindowTitle := 'fpGUI2 Bitmap Test'; + end; + + procedure TMainForm.HandlePaint; + var + img: TfpgImage; + i, j: integer; + begin + Canvas.BeginDraw; // activate double buffering in time. + inherited HandlePaint; + + img := TfpgImage.Create; + img.AllocateImage(32, 256, 256); + img.UpdateImage; + // populate the bitmap with pretty colors :-) + for j := 0 to 255 do + for i := 0 to 255 do + PLongWord(img.ImageData)[j * 256 + i] := (i shl 16) or (j shl 8); + + Canvas.DrawImage(0, 0, img); + img.Free; + Canvas.EndDraw; + 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/bitmaptest.lpi b/prototypes/fpgui2/tests/bitmaptest.lpi new file mode 100644 index 00000000..ff101435 --- /dev/null +++ b/prototypes/fpgui2/tests/bitmaptest.lpi @@ -0,0 +1,64 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value=".\"/> + <TargetFileExt Value=""/> + <Title Value="bitmaptest"/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="bitmaptest.dpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="bitmaptest"/> + </Unit0> + <Unit1> + <Filename Value="uhelpers.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="uhelpers"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <SearchPaths> + <IncludeFiles Value="..\source\"/> + <OtherUnitFiles Value="..\source\;..\source\x11\;..\gui\"/> + </SearchPaths> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/tests/button.bmp b/prototypes/fpgui2/tests/button.bmp Binary files differnew file mode 100644 index 00000000..8ae427cf --- /dev/null +++ b/prototypes/fpgui2/tests/button.bmp diff --git a/prototypes/fpgui2/tests/edittest.dpr b/prototypes/fpgui2/tests/edittest.dpr new file mode 100644 index 00000000..2ce1cb9c --- /dev/null +++ b/prototypes/fpgui2/tests/edittest.dpr @@ -0,0 +1,131 @@ +program edittest; + +{$mode objfpc}{$H+} + +uses + Classes, + SysUtils, + gfxbase, + fpgfx, + gfx_imgfmt_bmp, + gui_form, + gui_label, + gui_button, + gui_edit, + gui_combobox, + gui_scrollbar, + uhelpers, + gui_memo; + +type + + { TMainForm } + + TMainForm = class(TfpgForm) + private + procedure btnCloseClick(Sender: TObject); + procedure btnDisplayBMP(Sender: TObject); + public + label1: TfpgLabel; + label2: TfpgLabel; + edit1: TfpgEdit; + edit2: TfpgEdit; + btn: TfpgButton; + btn2: TfpgButton; + btn3: TfpgButton; + memo: TfpgMemo; + combo1: TfpgComboBox; + sbar: TfpgScrollBar; + procedure AfterCreate; override; + end; + + + { TMainForm } + + procedure TMainForm.btnCloseClick(Sender: TObject); + begin + Close; + end; + + procedure TMainForm.btnDisplayBMP(Sender: TObject); + var + bmp: TfpgImage; + begin + bmp := LoadImage_BMP('button.bmp'); + // bmp := LoadImage_BMP('..\images\close.bmp'); + bmp.CreateMaskFromSample(0, 0); + bmp.UpdateImage; + + Canvas.BeginDraw; + Canvas.ClearClipRect; + // For some reason, under Windows if I don't call this + // the forms background goes black. + Canvas.Clear(clWindowBackground); + + Canvas.DrawImage(10, 200, bmp); + Canvas.DrawImagePart(10, 240, bmp, 0, 0, 32, 21); + Canvas.DrawImagePart(50, 240, bmp, 32, 0, 32, 21); + Canvas.DrawString(16, 242, 'OK'); + + Canvas.EndDraw; + + bmp.Free; + end; + + + procedure TMainForm.AfterCreate; + begin + SetPosition(200, 200, 500, 350); + WindowTitle := 'fpGUI Widget Test'; + + label1 := CreateLabel(self, 5, 5, 'Hello world!'); + label2 := CreateLabel(self, 5, 20, 'Hello world in Bold!'); + label2.FontDesc := 'Sans-12:bold:underline'; + label2.Width := 200; + + edit1 := CreateEdit(self, 10, 40, 120, 22); + edit1.Text := 'Hello world. Hello world. Hello world.'; + edit2 := CreateEdit(self, 10, 70, 200, 22); + edit2.Text := 'Test Russian text -> Òåñò'; + + btn2 := CreateButton(self, 10, 100, 75, 'Normal', nil); + btn2.OnClick := @btnDisplayBMP; + btn3 := CreateButton(self, 100, 100, 75, 'Embedded', nil); + btn3.Embedded := True; + + + btn := CreateButton(self, 10, 130, 75, 'Close', @btnCloseClick); + btn.ImageName := 'stdimg.close'; + btn.ShowImage := True; + + combo1 := CreateComboBox(self, 10, 160, 120, nil); + // combo1.Height := 25;//22; + + memo := TfpgMemo.Create(self); + memo.Top := 10; + memo.Left := 250; + memo.Width := 200; + memo.Height := 80; + + sbar := TfpgScrollBar.Create(self); + sbar.Top := 160; + sbar.Left := 150; + sbar.Height := 100; + sbar.Max := 15; + 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 new file mode 100644 index 00000000..269ce784 --- /dev/null +++ b/prototypes/fpgui2/tests/edittest.lpi @@ -0,0 +1,59 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="\"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value=".\"/> + <TargetFileExt Value=""/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="\usr\X11R6\bin\xterm -T 'Lazarus Run Output' -e $(LazarusDir)\tools\runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="2"> + <Unit0> + <Filename Value="edittest.dpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="edittest"/> + </Unit0> + <Unit1> + <Filename Value="uhelpers.pas"/> + <IsPartOfProject Value="True"/> + <UnitName Value="uhelpers"/> + </Unit1> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <PathDelim Value="\"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/tests/fpgcanvas.lpi b/prototypes/fpgui2/tests/fpgcanvas.lpi new file mode 100644 index 00000000..9c070422 --- /dev/null +++ b/prototypes/fpgui2/tests/fpgcanvas.lpi @@ -0,0 +1,54 @@ +<?xml version="1.0"?> +<CONFIG> + <ProjectOptions> + <PathDelim Value="/"/> + <Version Value="5"/> + <General> + <Flags> + <SaveOnlyProjectUnits Value="True"/> + </Flags> + <SessionStorage Value="InProjectDir"/> + <MainUnit Value="0"/> + <IconPath Value="./"/> + <TargetFileExt Value=""/> + <Title Value="fpcanvas"/> + </General> + <VersionInfo> + <ProjectVersion Value=""/> + </VersionInfo> + <PublishOptions> + <Version Value="2"/> + <IncludeFileFilter Value="*.(pas|pp|inc|lfm|lpr|lrs|lpi|lpk|sh|xml)"/> + <ExcludeFileFilter Value="*.(bak|ppu|ppw|o|so);*~;backup"/> + </PublishOptions> + <RunParams> + <local> + <FormatVersion Value="1"/> + <LaunchingApplication PathPlusParams="/usr/X11R6/bin/xterm -T 'Lazarus Run Output' -e $(LazarusDir)/tools/runwait.sh $(TargetCmdLine)"/> + </local> + </RunParams> + <RequiredPackages Count="1"> + <Item1> + <PackageName Value="fpGFX2"/> + </Item1> + </RequiredPackages> + <Units Count="1"> + <Unit0> + <Filename Value="fpgcanvas.lpr"/> + <IsPartOfProject Value="True"/> + <UnitName Value="fpgcanvas"/> + </Unit0> + </Units> + </ProjectOptions> + <CompilerOptions> + <Version Value="5"/> + <CodeGeneration> + <Generate Value="Faster"/> + </CodeGeneration> + <Other> + <CustomOptions Value="-FUunits +"/> + <CompilerPath Value="$(CompPath)"/> + </Other> + </CompilerOptions> +</CONFIG> diff --git a/prototypes/fpgui2/tests/fpgcanvas.lpr b/prototypes/fpgui2/tests/fpgcanvas.lpr new file mode 100644 index 00000000..f26167d6 --- /dev/null +++ b/prototypes/fpgui2/tests/fpgcanvas.lpr @@ -0,0 +1,150 @@ +program fpgcanvas; + +{$mode objfpc}{$H+} + +uses + {$IFDEF UNIX}{$IFDEF UseCThreads} + cthreads, + {$ENDIF}{$ENDIF} + Classes, + fpgfx, + gfxbase, + gui_form, + gfx_imgfmt_bmp; + +const + // We need to define more such constants in fpGFX as standard + // RRGGBB + clRed = $FF0000; + clGreen = $00FF00; + clBlue = $0000FF; + clBlack = $000000; + +type + TMainForm = class(TfpgForm) + protected + procedure HandlePaint; override; + public + procedure AfterCreate; override; + end; + +{ TMainForm } + +procedure TMainForm.HandlePaint; +var + r: TfpgRect; + fnt: TfpgFont; + bmp: TfpgImage; + y: integer; +begin + // Enable double buffering. Must be before 'inherited' to prevent form + // clearing itself. + Canvas.BeginDraw; + inherited HandlePaint; + + // Testing line drawing + Canvas.DrawLine(5, 5, 50, 50); + Canvas.SetColor(clBlue); + Canvas.DrawLine(50, 5, 5, 50); + + // Testing Rectangles + Canvas.SetColor(clBlack); + r.Top := 5; + r.Left := 60; + r.Width := 50; + r.Height := 50; + Canvas.DrawRect(r); + + r.Left := 120; + Canvas.SetLineStyle(2, lsDash); + Canvas.DrawRect(r); + + r.Left := 180; + Canvas.SetColor(clGreen); + Canvas.SetLineStyle(1, lsDot); + Canvas.DrawRect(r); + + r.Left := 240; + Canvas.SetColor(clBlue); + Canvas.SetLineStyle(1, lsSolid); + Canvas.FillRectangle(r); + + + // Testing Text and Fonts + y := 60; + Canvas.SetTextColor(clBlack); + Canvas.DrawString(5, y, 'This text must be black and default font (' + fpgApplication.DefaultFont.FontDesc + ')'); + 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():'); + Canvas.DrawButtonFace(300, 20, 75, 25, []); + Canvas.DrawString(385, 20, '= []'); + Canvas.DrawButtonFace(300, 50, 75, 25, [btnIsDefault]); + Canvas.DrawString(385, 50, '= [btnIsDefault]'); + Canvas.DrawButtonFace(300, 80, 75, 25, [btnIsPressed]); + Canvas.DrawString(385, 80, '= [btnIsPressed]'); + Canvas.DrawButtonFace(300, 110, 75, 25, [btnHasFocus]); + Canvas.DrawString(385, 110, '= [btnHasFocus]'); + Canvas.DrawButtonFace(300, 140, 75, 25, [btnIsEmbedded]); + Canvas.DrawString(385, 140, '= [btnIsEmbedded]'); + + Canvas.DrawString(45, y, 'DrawControlFrame():'); + y := y + Canvas.Font.Height; + Canvas.DrawControlFrame(5, y, 200, 23); + + + // Testing Bitmap painting + bmp := LoadImage_BMP('button.bmp'); + try + bmp.CreateMaskFromSample(0,0); + bmp.UpdateImage; + Canvas.DrawString(5, 180, 'Single BMP file:'); + Canvas.DrawString(300, 210, '(mask enabled for all images)'); + Canvas.DrawImage(150, 180, bmp); + Canvas.DrawString(5, 210, 'Parts of BMP file:'); + Canvas.DrawImagePart(150, 210, bmp, 0, 0, 32, 21); + Canvas.DrawImagePart(190, 210, bmp, 32, 0, 32, 21); + Canvas.DrawImagePart(230, 210, bmp, 64, 0, 32, 21); + finally + bmp.Free; + end; + + + Canvas.EndDraw; +end; + +procedure TMainForm.AfterCreate; +begin + inherited AfterCreate; + SetPosition(100, 100, 500, 400); + WindowTitle := 'fpGFX Canvas Test'; +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/uhelpers.pas b/prototypes/fpgui2/tests/uhelpers.pas new file mode 100644 index 00000000..b7c65345 --- /dev/null +++ b/prototypes/fpgui2/tests/uhelpers.pas @@ -0,0 +1,34 @@ +unit uhelpers; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, SysUtils; + + +function InflateRect(var Rect: TRect; dx: Integer; dy: Integer): Boolean; + +implementation + +function InflateRect(var Rect: TRect; dx: Integer; dy: Integer): Boolean; +begin + if Assigned(@Rect) then + begin + with Rect do + begin + dec(Left, dx); + dec(Top, dy); + inc(Right, dx); + inc(Bottom, dy); + end; + Result := True; + end + else + Result := False; +end; + + +end. + |