From 84d9c47dee2a6c27e4c8ce467fe618591104977f Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Mon, 21 Jul 2014 22:00:56 +0100 Subject: new ToggleBox widget Hi I made a Togglebox widget descended from TfpgComboBox. It has button that slides side to side for checked/unchecked with a subtle animation when toggled. Various colors can be changed and the animation disabled. --- src/corelib/fpg_main.pas | 6 ++++++ src/corelib/gdi/fpgui_toolkit.lpk | 6 +++++- src/corelib/gdi/fpgui_toolkit.pas | 2 +- src/corelib/x11/fpg_x11.pas | 2 +- src/corelib/x11/fpgui_toolkit.lpk | 6 +++++- src/corelib/x11/fpgui_toolkit.pas | 4 ++-- 6 files changed, 20 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 2e255923..ea12679f 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -203,6 +203,7 @@ type procedure DrawControlFrame(ACanvas: TfpgCanvas; r: TfpgRect); overload; function GetControlFrameBorders: TRect; virtual; procedure DrawBevel(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; ARaised: Boolean = True); virtual; + function GetBevelWidth: TfpgCoord; virtual; procedure DrawDirectionArrow(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; direction: TArrowDirection); virtual; procedure DrawString(ACanvas: TfpgCanvas; x, y: TfpgCoord; AText: string; AEnabled: boolean = True); virtual; procedure DrawFocusRect(ACanvas: TfpgCanvas; r: TfpgRect); virtual; @@ -2264,6 +2265,11 @@ begin ACanvas.DrawLine(r.Right, r.Bottom, r.Left-1, r.Bottom); end; +function TfpgStyle.GetBevelWidth: TfpgCoord; +begin + Result := 1; +end; + procedure TfpgStyle.DrawDirectionArrow(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord; direction: TArrowDirection); var { diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index c4e4958e..00de1506 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -31,7 +31,7 @@ - + @@ -448,6 +448,10 @@ + + + + diff --git a/src/corelib/gdi/fpgui_toolkit.pas b/src/corelib/gdi/fpgui_toolkit.pas index 12ac41b9..a20c428f 100644 --- a/src/corelib/gdi/fpgui_toolkit.pas +++ b/src/corelib/gdi/fpgui_toolkit.pas @@ -22,7 +22,7 @@ uses fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon, Agg2D, fpg_dbugintf, fpg_dbugmsg, - fpg_style_carbon, fpg_style_plastic, fpg_style_win8; + fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle; implementation diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 569772ae..c94cf1fb 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1685,7 +1685,7 @@ begin OnIdle(self); fpFD_ZERO(rfds); fpFD_SET(xfd, rfds); - r := fpSelect(xfd + 1, @rfds, nil, nil, {atimeoutms} 50); + r := fpSelect(xfd + 1, @rfds, nil, nil, Min(atimeoutms, 50)); if r <> 0 then // We got a X event or the timeout happened XNextEvent(display, @ev) else diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index 96af53ed..1970ab87 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -29,7 +29,7 @@ - + @@ -458,6 +458,10 @@ + + + + diff --git a/src/corelib/x11/fpgui_toolkit.pas b/src/corelib/x11/fpgui_toolkit.pas index 86e456f4..429d3497 100644 --- a/src/corelib/x11/fpgui_toolkit.pas +++ b/src/corelib/x11/fpgui_toolkit.pas @@ -22,8 +22,8 @@ uses fpg_stylemanager, fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon, Agg2D, - fpg_dbugintf, fpg_dbugmsg, fpg_fontcache, fpg_style_carbon, - fpg_style_plastic, fpg_style_win8, fpg_scrollframe; + fpg_dbugintf, fpg_dbugmsg, fpg_fontcache, fpg_style_carbon, + fpg_style_plastic, fpg_style_win8, fpg_scrollframe, fpg_toggle; implementation -- cgit v1.2.3-70-g09d2 From d35d988ed4c394ad4fbac469295de010f9371354 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 23 Jul 2014 06:43:41 +0100 Subject: remove old code comment not needed any more --- src/corelib/fpg_widget.pas | 2 +- src/gui/fpg_customgrid.pas | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 527e2987..872ac2c8 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -176,7 +176,7 @@ type procedure KillFocus; procedure MoveAndResizeBy(const dx, dy, dw, dh: TfpgCoord); procedure SetPosition(aleft, atop, awidth, aheight: TfpgCoord); virtual; - procedure Invalidate; // double check this works as developers expect???? + procedure Invalidate; property FormDesigner: TObject read FFormDesigner write SetFormDesigner; property Parent: TfpgWidget read GetParent write SetParent; property AcceptDrops: boolean read FAcceptDrops write SetAcceptDrops default False; diff --git a/src/gui/fpg_customgrid.pas b/src/gui/fpg_customgrid.pas index 98040374..923bed91 100644 --- a/src/gui/fpg_customgrid.pas +++ b/src/gui/fpg_customgrid.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, -- cgit v1.2.3-70-g09d2 From 358883bd8c4db329bf07d93d976071e950604358 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 24 Jul 2014 23:47:26 +0100 Subject: Fixed StretchDraw() "abstract error" due to DoFreeImage call. --- src/corelib/fpg_base.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 7ee462c4..96332d5d 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -2105,7 +2105,7 @@ end; procedure TfpgBaseInterpolation.Execute(x, y, w, h: integer); begin - tempimage := TfpgImageBase.Create; + tempimage := TfpgImage.Create; tempimage.AllocateImage(image.ColorDepth, w, image.Height); xfactor := image.Width / w; -- cgit v1.2.3-70-g09d2 From 536bb20956573285c964c7eb66f34c9857d461da Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 25 Jul 2014 01:11:34 +0100 Subject: Bump 'develop' branch to next version number --- docs/fpGUIHelpIntegration.lpk | 2 +- docs/manifest.xml | 4 ++-- docview/src/docview.rc | 8 ++++---- src/VERSION_FILE.inc | 2 +- src/corelib/fpg_constants.pas | 2 +- src/corelib/gdi/fpgui_toolkit.lpk | 2 +- src/corelib/x11/fpgui_toolkit.lpk | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src/corelib') diff --git a/docs/fpGUIHelpIntegration.lpk b/docs/fpGUIHelpIntegration.lpk index 7d02a4e4..7c06a92a 100644 --- a/docs/fpGUIHelpIntegration.lpk +++ b/docs/fpGUIHelpIntegration.lpk @@ -24,7 +24,7 @@ "/> - + diff --git a/docs/manifest.xml b/docs/manifest.xml index d89f8ec5..fc0d48a0 100644 --- a/docs/manifest.xml +++ b/docs/manifest.xml @@ -1,8 +1,8 @@ - - fpgui-0.6.3-0.zip + + fpgui-1.3.0-0.zip Graeme Geldenhuys Modified LGPL graemeg@gmail.com diff --git a/docview/src/docview.rc b/docview/src/docview.rc index 64d63286..24dc3cfe 100644 --- a/docview/src/docview.rc +++ b/docview/src/docview.rc @@ -1,8 +1,8 @@ MAINICON ICON "../images/docview-48x48.ico" 1 VERSIONINFO -FILEVERSION 1, 1, 0, 0 -PRODUCTVERSION 1, 1, 0, 0 +FILEVERSION 1, 3, 0, 0 +PRODUCTVERSION 1, 3, 0, 0 FILEFLAGSMASK 0 FILEOS 0x40000 FILETYPE 1 @@ -13,12 +13,12 @@ FILETYPE 1 { VALUE "CompanyName", "fpGUI Toolkit" VALUE "FileDescription", "fpGUI's INF Documentation Viewer" - VALUE "FileVersion", "1.1.0" + VALUE "FileVersion", "1.3.0" VALUE "InternalName", "docview" VALUE "LegalCopyright", "GNU Public License" VALUE "OriginalFilename", "docview" VALUE "ProductName", "fpGUI Toolkit" - VALUE "ProductVersion", "1.1.0" + VALUE "ProductVersion", "1.3.0" } } BLOCK "VarFileInfo" diff --git a/src/VERSION_FILE.inc b/src/VERSION_FILE.inc index b47293e2..518bafb7 100644 --- a/src/VERSION_FILE.inc +++ b/src/VERSION_FILE.inc @@ -1 +1 @@ -FPGUI_VERSION = '1.1'; +FPGUI_VERSION = '1.3'; diff --git a/src/corelib/fpg_constants.pas b/src/corelib/fpg_constants.pas index 37b3f135..60bd18e7 100644 --- a/src/corelib/fpg_constants.pas +++ b/src/corelib/fpg_constants.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index 00de1506..f07e97c0 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -30,7 +30,7 @@ - + diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index 1970ab87..b46195d4 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -28,7 +28,7 @@ - + -- cgit v1.2.3-70-g09d2 From b01b72f0886583100830cb42e2001d477f22976d Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 27 Jul 2014 00:23:10 +0100 Subject: 2 new units: fpg_CSVParser and fpg_StringGridBuilder fpg_CSVParser contains a class and singleton method to allow parsing CSV files. fpg_StringGridBuilder is a class that allows you to load a CSV file and automatically populate a StringGrid with its content. --- src/corelib/fpg_csvparser.pas | 320 ++++++++++++++++++++++++++++++++++++++ src/corelib/gdi/fpgui_toolkit.lpk | 10 +- src/corelib/gdi/fpgui_toolkit.pas | 3 +- src/corelib/x11/fpgui_toolkit.lpk | 10 +- src/corelib/x11/fpgui_toolkit.pas | 3 +- src/gui/fpg_stringgridbuilder.pas | 178 +++++++++++++++++++++ 6 files changed, 520 insertions(+), 4 deletions(-) create mode 100644 src/corelib/fpg_csvparser.pas create mode 100644 src/gui/fpg_stringgridbuilder.pas (limited to 'src/corelib') diff --git a/src/corelib/fpg_csvparser.pas b/src/corelib/fpg_csvparser.pas new file mode 100644 index 00000000..f5c0d0ed --- /dev/null +++ b/src/corelib/fpg_csvparser.pas @@ -0,0 +1,320 @@ +{ + fpGUI - Free Pascal GUI Toolkit + + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + Uses a Finite State Machine to parse CSV files. + Graeme Geldenhuys + + This unit shows how one could use the State Design Pattern to implement a + FSM (Finite State Machine) to create a CSV Parser. It handles invalid + CSV as well and will raise an appropriate exception. In the State pattern, + each of the states becomes a subclass of the base class. Each subclass must + implement the abstract method which will handle the input character and + decide on the next state. +} + +unit fpg_CSVParser; + +{$mode objfpc}{$H+} + +interface + +uses + Classes; + +type + { forward declarations } + TCSVParser = class; + TParserStateClass = class of TCSVParserState; + + + { Abstract State object } + TCSVParserState = class(TObject) + private + FParser: TCSVParser; + procedure ChangeState(NewState: TParserStateClass); + procedure AddCharToCurrField(Ch: char); + procedure AddCurrFieldToList; + public + constructor Create(AParser: TCSVParser); + { Must be implemented in the concrete classes to handle the input character + and decide on the next state. } + procedure ProcessChar(Ch: AnsiChar; Pos: integer); virtual; abstract; + end; + + + { A concrete state object - used when starting a new field } + TCSVParserFieldStartState = class(TCSVParserState) + public + procedure ProcessChar(Ch: AnsiChar; Pos: integer); override; + end; + + + { A concrete state object - used while scanning a field } + TCSVParserScanFieldState = class(TCSVParserState) + public + procedure ProcessChar(Ch: AnsiChar; Pos: integer); override; + end; + + + { A concrete state object - used while scanning double quoted fields } + TCSVParserScanQuotedState = class(TCSVParserState) + public + procedure ProcessChar(Ch: AnsiChar; Pos: integer); override; + end; + + + { A concrete state object - used when found the ending double quote } + TCSVParserEndQuotedState = class(TCSVParserState) + public + procedure ProcessChar(Ch: AnsiChar; Pos: integer); override; + end; + + + { A concrete state object - some error occured / invalid CSV structure } + TCSVParserGotErrorState = class(TCSVParserState) + public + procedure ProcessChar(Ch: AnsiChar; Pos: integer); override; + end; + + + { The actual state machine - CSV parser } + TCSVParser = class(TObject) + private + FCurrentLine: string; + FState: TCSVParserState; + { Cache state objects for greater performance. This comes in handy when + parsing a large CSV file. For smaller files you might want to create them + on the fly. } + FFieldStartState: TCSVParserFieldStartState; + FScanFieldState: TCSVParserScanFieldState; + FScanQuotedState: TCSVParserScanQuotedState; + FEndQuotedState: TCSVParserEndQuotedState; + FGotErrorState: TCSVParserGotErrorState; + { Fields used during parsing } + FCurrField: string; + FFieldList: TStrings; + function GetState: TParserStateClass; + procedure SetState(const Value: TParserStateClass); + protected + procedure AddCharToCurrField(Ch: char); + procedure AddCurrFieldToList; + { An example of Self Encapsulating Field refactoring } + property State: TParserStateClass read GetState write SetState; + public + constructor Create; + destructor Destroy; override; + { prodecure to call, to start the parsing process } + procedure ExtractFields(const S: string; const pFieldList: TStrings); + property CurrentLine: string read FCurrentLine; + end; + + +// global singleton function +function gCSVParser: TCSVParser; + + +implementation + +uses + SysUtils; + +var + uCSVParser: TCSVParser; + + +// Lazy mans singleton +function gCSVParser: TCSVParser; +begin + if uCSVParser = nil then + uCSVParser := TCSVParser.Create; + Result := uCSVParser; +end; + +{ TCSVParser } + +constructor TCSVParser.Create; +begin + inherited Create; + FCurrentLine := ''; + FFieldStartState := TCSVParserFieldStartState.Create(Self); + FScanFieldState := TCSVParserScanFieldState.Create(Self); + FScanQuotedState := TCSVParserScanQuotedState.Create(Self); + FEndQuotedState := TCSVParserEndQuotedState.Create(Self); + FGotErrorState := TCSVParserGotErrorState.Create(Self); +end; + +destructor TCSVParser.Destroy; +begin + FFieldStartState.Free; + FScanFieldState.Free; + FScanQuotedState.Free; + FEndQuotedState.Free; + FGotErrorState.Free; + inherited; +end; + +function TCSVParser.GetState: TParserStateClass; +begin + Result := TParserStateClass(FState.ClassType); +end; + +procedure TCSVParser.SetState(const Value: TParserStateClass); +begin + if Value = TCSVParserFieldStartState then + FState := FFieldStartState + else if Value = TCSVParserScanFieldState then + FState := FScanFieldState + else if Value = TCSVParserScanQuotedState then + FState := FScanQuotedState + else if Value = TCSVParserEndQuotedState then + FState := FEndQuotedState + else if Value = TCSVParserGotErrorState then + FState := FGotErrorState; +end; + +procedure TCSVParser.ExtractFields(const S: string; const pFieldList: TStrings); +var + i: integer; + Ch: AnsiChar; +begin + FCurrentLine := S; + FFieldList := pFieldList; + Assert(Assigned(FFieldList), 'FieldList not assigned'); + { Initialize by clearing the string list, and starting in FieldStart state } + FFieldList.Clear; + State := TCSVParserFieldStartState; + FCurrField := ''; + + { Read through all the characters in the string } + for i := 1 to Length(s) do + begin + { Get the next character } + Ch := s[i]; + FState.ProcessChar(Ch, i); + end; + + { If we are in the ScanQuoted or GotError state at the end of the string, + there was a problem with a closing quote. You can add the second if test + for an extra failsafe! } + if (State = TCSVParserScanQuotedState) then + // or (State = TCSVParserGotErrorState) then + raise Exception.Create('Missing closing quote'); + + { If the current field is not empty, add it to the list } + if (FCurrField <> '') then + AddCurrFieldToList; +end; + +procedure TCSVParser.AddCharToCurrField(Ch: char); +begin + FCurrField := FCurrField + Ch; +end; + +procedure TCSVParser.AddCurrFieldToList; +begin + FFieldList.Add(FCurrField); + // Clear the field in preparation for collecting the next one + FCurrField := ''; +end; + +{ TCSVParserState } + +constructor TCSVParserState.Create(AParser: TCSVParser); +begin + inherited Create; + FParser := AParser; +end; + +procedure TCSVParserState.ChangeState(NewState: TParserStateClass); +begin + FParser.State := NewState; +end; + +procedure TCSVParserState.AddCharToCurrField(Ch: char); +begin + FParser.AddCharToCurrField(Ch); +end; + +procedure TCSVParserState.AddCurrFieldToList; +begin + FParser.AddCurrFieldToList; +end; + +{ TCSVParserFieldStartState } + +procedure TCSVParserFieldStartState.ProcessChar(Ch: AnsiChar; Pos: integer); +begin + case Ch of + '"': ChangeState(TCSVParserScanQuotedState); + ',': AddCurrFieldToList; + else + AddCharToCurrField(Ch); + ChangeState(TCSVParserScanFieldState); + end; +end; + +{ TCSVParserScanFieldState } + +procedure TCSVParserScanFieldState.ProcessChar(Ch: AnsiChar; Pos: integer); +begin + if (Ch = ',') then + begin + AddCurrFieldToList; + ChangeState(TCSVParserFieldStartState); + end + else + AddCharToCurrField(Ch); +end; + +{ TCSVParserScanQuotedState } + +procedure TCSVParserScanQuotedState.ProcessChar(Ch: AnsiChar; Pos: integer); +begin + if (Ch = '"') then + ChangeState(TCSVParserEndQuotedState) + else + AddCharToCurrField(Ch); +end; + +{ TCSVParserEndQuotedState } + +procedure TCSVParserEndQuotedState.ProcessChar(Ch: AnsiChar; Pos: integer); +begin + if (Ch = ',') then + begin + AddCurrFieldToList; + ChangeState(TCSVParserFieldStartState); + end + else + ChangeState(TCSVParserGotErrorState); +end; + +{ TCSVParserGotErrorState } + +procedure TCSVParserGotErrorState.ProcessChar(Ch: AnsiChar; Pos: integer); +begin + raise Exception.Create(Format('Error in line at position %d: ' + #10 + + '<%s>', [Pos, FParser.CurrentLine])); +end; + + +initialization + uCSVParser := nil; + +finalization + if uCSVParser <> nil then + uCSVParser.Free; + +end. + diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index f07e97c0..487a5e06 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -31,7 +31,7 @@ - + @@ -452,6 +452,14 @@ + + + + + + + + diff --git a/src/corelib/gdi/fpgui_toolkit.pas b/src/corelib/gdi/fpgui_toolkit.pas index a20c428f..4704d56a 100644 --- a/src/corelib/gdi/fpgui_toolkit.pas +++ b/src/corelib/gdi/fpgui_toolkit.pas @@ -22,7 +22,8 @@ uses fpg_style_win2k, fpg_style_motif, fpg_style_clearlooks, fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon, Agg2D, fpg_dbugintf, fpg_dbugmsg, - fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle; + fpg_style_carbon, fpg_style_plastic, fpg_style_win8, fpg_toggle, + fpg_StringGridBuilder, fpg_CSVParser; implementation diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index b46195d4..e59e4617 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -29,7 +29,7 @@ - + @@ -462,6 +462,14 @@ + + + + + + + + diff --git a/src/corelib/x11/fpgui_toolkit.pas b/src/corelib/x11/fpgui_toolkit.pas index 429d3497..be9f3b5a 100644 --- a/src/corelib/x11/fpgui_toolkit.pas +++ b/src/corelib/x11/fpgui_toolkit.pas @@ -23,7 +23,8 @@ uses fpg_style_bluecurve, fpg_style_bitmap, fpg_readonly, fpg_imgfmt_png, U_Command, U_Pdf, U_Report, U_ReportImages, U_Visu, fpg_trayicon, Agg2D, fpg_dbugintf, fpg_dbugmsg, fpg_fontcache, fpg_style_carbon, - fpg_style_plastic, fpg_style_win8, fpg_scrollframe, fpg_toggle; + fpg_style_plastic, fpg_style_win8, fpg_scrollframe, fpg_toggle, + fpg_StringGridBuilder, fpg_CSVParser; implementation diff --git a/src/gui/fpg_stringgridbuilder.pas b/src/gui/fpg_stringgridbuilder.pas new file mode 100644 index 00000000..fd3fe3b8 --- /dev/null +++ b/src/gui/fpg_stringgridbuilder.pas @@ -0,0 +1,178 @@ +{ + fpGUI - Free Pascal GUI Toolkit + + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + distribution, for details of the copyright. + + See the file COPYING.modifiedLGPL, included in this distribution, + for details about redistributing fpGUI. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. + + Description: + This unit defines a helper class that can populate a StringGrid + from a CSV file. In future this could be expaned to other file + types or even data structures. +} +unit fpg_StringGridBuilder; + +{$mode objfpc}{$H+} + +interface + +uses + Classes, + SysUtils, + fpg_base, + fpg_grid; + +type + TStringGridBuilder = class(TObject) + private + FData: TStringList; + FGrid: TfpgStringGrid; + FCSVFile: TfpgString; + FHasHeader: boolean; + protected + procedure InternalSetupColumns; virtual; + procedure InternalSetupData; virtual; + procedure InternalRepaintRow(const AData: TfpgString; const ARow: integer); virtual; + public + constructor Create; + constructor CreateCustom(const AGrid: TfpgStringGrid; const ACSVFile: TfpgString; const AWithHeader: boolean = True); virtual; + destructor Destroy; override; + procedure Run; + property Grid: TfpgStringGrid read FGrid; + end; + +implementation + +uses + fpg_main, + fpg_utils, + fpg_CSVParser; + +{ TStringGridBuilder } + +procedure TStringGridBuilder.InternalSetupColumns; +var + x: integer; + fields: TStringList; +begin + fields := TStringList.Create; + try + gCsvParser.ExtractFields(FData[0], fields); + // setup correct column count + FGrid.ColumnCount := fields.Count; + // initialize columns + if FHasHeader then + begin + for x := 0 to fields.Count-1 do + begin + FGrid.ColumnTitle[x] := fields[x]; +// FGrid.ColumnWidth[x] := StrToInt(FColumns.ValueFromIndex[x]); + end; + end; + finally + fields.Free; + end; +end; + +procedure TStringGridBuilder.InternalSetupData; +var + y: integer; +begin + FGrid.BeginUpdate; + FGrid.MouseCursor := mcHourGlass; + try + try + // set correct row count. Columns have already been handled. + if FHasHeader then + begin + FGrid.RowCount := FData.Count-1; + for y := 1 to FData.Count-1 do // rows + begin + // writeln(' Row: ', y, ' Data: ', FData.Strings[y-1]); + InternalRepaintRow(FData.Strings[y], y-1); + end; + end + else + begin + FGrid.RowCount := FData.Count; + for y := 0 to FData.Count-1 do // rows + begin + // writeln(' Row: ', y, ' Data: ', FData.Strings[y-1]); + InternalRepaintRow(FData.Strings[y], y); + end; + end; + except + fpgApplication.HandleException(self); + end; + finally + if FGrid.RowCount > 0 then + FGrid.FocusRow := 0; + FGrid.EndUpdate; + FGrid.MouseCursor := mcDefault; + end; +end; + +procedure TStringGridBuilder.InternalRepaintRow(const AData: TfpgString; const ARow: integer); +var + x: integer; + fields: TStrings; + value: string; +begin + fields := TStringList.Create; + try + gCsvParser.ExtractFields(AData, fields); + for x := 0 to FGrid.ColumnCount-1 do + begin + if x < fields.Count then + value := fields.Strings[x] + else + value := ''; + FGrid.Cells[x, ARow] := value + end; + finally + fields.Free; + end; +end; + +constructor TStringGridBuilder.Create; +begin + FData := TStringList.Create; +end; + +constructor TStringGridBuilder.CreateCustom(const AGrid: TfpgStringGrid; const ACSVFile: TfpgString; const AWithHeader: boolean); +begin + Create; + FGrid := AGrid; + FCSVFile := ACSVFile; + FGrid.Clear; + FHasHeader := AWithHeader; + FGrid.ShowHeader := AWithHeader; +end; + +destructor TStringGridBuilder.Destroy; +begin + FGrid := nil; + FData.Free; + inherited Destroy; +end; + +procedure TStringGridBuilder.Run; +begin + if FCSVFile = '' then + raise Exception.Create('TStringGridBuilder: CSV filename is empty!'); + if not fpgFileExists(FCSVFile) then + raise Exception.CreateFmt('TStringGridBuilder: The CSV file <%s> does not exist.', [FCSVFile]); + FData.LoadFromFile(fpgToOSEncoding(FCSVFile)); + InternalSetupColumns; + InternalSetupData; +end; + + +end. + -- cgit v1.2.3-70-g09d2 From 373b713182b6da1b1af992810926ed75b41ba8e8 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 16 Sep 2014 19:04:00 +0100 Subject: Edit2 font alias is now a variable and not hard coded. This makes it a bit more configurable (default values) for various platforms. Thanks to Marcus Sackrow for the suggestion. --- src/corelib/fpg_base.pas | 7 ++++--- src/corelib/fpg_main.pas | 38 +++++++++++++++++++------------------- 2 files changed, 23 insertions(+), 22 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 96332d5d..f676aa19 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -138,6 +138,7 @@ var FPG_DEFAULT_FONT_DESC: string = 'Liberation Sans-10:antialias=true'; FPG_DEFAULT_SANS: string = 'Liberation Sans'; {$ENDIF} + FPG_DEFAULT_FIXED_FONT_DESC: string = 'Courier New-10'; const UserNamedColorStart = 128; @@ -727,8 +728,8 @@ type destructor Destroy; override; function Execute(const ADropActions: TfpgDropActions; const ADefaultAction: TfpgDropAction = daCopy): TfpgDropAction; virtual; abstract; end; - - + + { TfpgBaseTimer } TfpgBaseTimer = class(TObject) diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 7ba8a96a..02f0acde 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -51,7 +51,7 @@ type TfpgMenuItemFlags = set of (mifSelected, mifHasFocus, mifSeparator, mifEnabled, mifChecked, mifSubMenu); - + TfpgTextFlags = set of (txtLeft, txtHCenter, txtRight, txtTop, txtVCenter, txtBottom, txtWrap, txtDisabled, txtAutoSize); @@ -62,7 +62,7 @@ type const AllAnchors = [anLeft, anRight, anTop, anBottom]; TextFlagsDflt = [txtLeft, txtTop]; - + type { ******************************************* @@ -229,7 +229,7 @@ type function GetCheckBoxSize: integer; virtual; procedure DrawCheckbox(ACanvas: TfpgCanvas; x, y: TfpgCoord; ix, iy: TfpgCoord); virtual; end; - + TMsgHookItem = class Dest: TObject; @@ -327,12 +327,12 @@ type property Width: integer read FWidth; property Height: integer read FHeight; end; - - + + TfpgClipboard = class(TfpgClipboardImpl) end; - + TfpgFileList = class(TfpgFileListImpl) end; @@ -1296,7 +1296,7 @@ begin Result := TStringList.Create else Exit; //==> - + for n := 0 to fpgNamedFonts.Count-1 do begin oFont := TNamedFontItem(fpgNamedFonts[n]); @@ -1365,7 +1365,7 @@ begin fpgStyleManager.FreeStyleInstance; fpgStyle := nil; fpgCaret.Free; - + for i := fpgTimers.Count-1 downto 0 do if fpgTimers[i] <> nil then TfpgTimer(fpgTimers[i]).Free; @@ -1381,7 +1381,7 @@ begin FFontResList.Free; FreeAndNil(FModalFormStack); - + for i := 0 to FMessageHookList.Count-1 do TMsgHookItem(FMessageHookList[i]).Free; FreeAndNil(FMessageHookList); @@ -1392,7 +1392,7 @@ begin uMsgQueueList.Delete(i); end; uMsgQueueList.Free; - + inherited Destroy; end; @@ -1503,7 +1503,7 @@ begin ShortDayNames[5] := rsShortThu; ShortDayNames[6] := rsShortFri; ShortDayNames[7] := rsShortSat; - + LongDayNames[1] := rsLongSun; LongDayNames[2] := rsLongMon; LongDayNames[3] := rsLongTue; @@ -1937,10 +1937,10 @@ begin end; end; nw := Max(wtxt, w); - + wraplst := TStringList.Create; wraplst.Text := AText; - + if (txtWrap in AFlags) then begin for i := 0 to wraplst.Count-1 do @@ -1950,7 +1950,7 @@ begin end; htxt := (Font.Height * wraplst.Count) + (ALineSpace * Pred(wraplst.Count)); - + // Now paint the actual text for i := 0 to wraplst.Count-1 do begin @@ -1965,7 +1965,7 @@ begin nx := x + (w - wtxt) div 2 else // txtLeft is default nx := x; - + // vertical alignment if (txtBottom in AFlags) then ny := y + l + h - htxt @@ -1976,7 +1976,7 @@ begin fpgStyle.DrawString(self, nx, ny, wraplst[i], lEnabled); end; - + wraplst.Free; Result := htxt; end; @@ -2054,7 +2054,7 @@ begin fpgSetNamedFont('Label1', FPG_DEFAULT_FONT_DESC); fpgSetNamedFont('Label2', FPG_DEFAULT_FONT_DESC + ':bold'); fpgSetNamedFont('Edit1', FPG_DEFAULT_FONT_DESC); - fpgSetNamedFont('Edit2', 'Courier New-10'); + fpgSetNamedFont('Edit2', FPG_DEFAULT_FIXED_FONT_DESC); fpgSetNamedFont('List', FPG_DEFAULT_FONT_DESC); fpgSetNamedFont('Grid', FPG_DEFAULT_SANS + '-9'); fpgSetNamedFont('GridHeader', FPG_DEFAULT_SANS + '-9:bold'); @@ -2254,7 +2254,7 @@ begin ACanvas.SetColor(clWindowBackground); ACanvas.SetLineStyle(1, lsSolid); ACanvas.FillRectangle(x, y, w, h); - + if ARaised then ACanvas.SetColor(clHilite2) else -- cgit v1.2.3-70-g09d2 From 8409869f55b178214d4a20f39e19603817d55105 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 19 Sep 2014 15:44:56 +0100 Subject: Windows: Just for fun, allow the ability to hook into the System Menu This means we can easily add an "About fpGUI" menu item in the System Menu of a window. --- src/corelib/fpg_base.pas | 3 ++- src/corelib/gdi/fpg_gdi.pas | 13 ++++++++++++- 2 files changed, 14 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index f676aa19..62bd3827 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -121,7 +121,8 @@ const FPGM_FREEME = 19; FPGM_DROPENTER = 20; FPGM_DROPEXIT = 21; - FPGM_HSCROLL = 22; + FPGM_HSCROLL = 22; + FPGM_ABOUT = 23; FPGM_USER = 50000; FPGM_KILLME = MaxInt; diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index f1372928..159d73d5 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -347,6 +347,10 @@ var OldMousePos: TPoint; // used to detect fake MouseMove events NeedToUnitialize: Boolean; + +const + ID_ABOUT = 200001; + // some required keyboard functions {$INCLUDE fpg_keys_gdi.inc} @@ -1204,6 +1208,13 @@ begin Windows.EndPaint(w.WinHandle, @PaintStruct); end; + WM_SYSCOMMAND: + begin + if wParam = ID_ABOUT then + fpgSendMessage(nil, w, FPGM_ABOUT, msgp) + else + Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); + end else Result := Windows.DefWindowProc(hwnd, uMsg, wParam, lParam); end; -- cgit v1.2.3-70-g09d2 From 7e5728dadffc5a281b5adfac4b262c7f3a12b57c Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 12 Oct 2014 13:10:52 +0100 Subject: Surface the Window related to the Canvas instance. This is so we can do more advance things with themes like calling invalidate on a widget (eg: animated theme on hover) --- src/corelib/fpg_main.pas | 1 + 1 file changed, 1 insertion(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 02f0acde..8bdb33bd 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -183,6 +183,7 @@ type function DrawText(x, y, w, h: TfpgCoord; const AText: TfpgString; AFlags: TfpgTextFlags = TextFlagsDflt; ALineSpace: integer = 2): integer; overload; function DrawText(x, y: TfpgCoord; const AText: TfpgString; AFlags: TfpgTextFlags = TextFlagsDflt; ALineSpace: integer = 2): integer; overload; function DrawText(r: TfpgRect; const AText: TfpgString; AFlags: TfpgTextFlags = TextFlagsDflt; ALineSpace: integer = 2): integer; overload; + property Window: TfpgWindowBase read FWindow; end; -- cgit v1.2.3-70-g09d2 From d34fad2f2e084aaf5e4461b5a83eaf5b5c798509 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 15 Oct 2014 13:21:49 +0100 Subject: Fixes compiler warning --- src/corelib/gdi/fpg_gdi.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index 159d73d5..1d5b7dff 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -1290,7 +1290,7 @@ begin if MainForm <> nil then lHandle := TfpgGDIWindow(MainForm).FWinHandle else - lHandle := -1; + lHandle := 0; FHiddenWindow := CreateWindow('FPGHIDDEN', '', DWORD(WS_POPUP), 0, 0, 0, 0, lHandle, 0, MainInstance, nil); end; -- cgit v1.2.3-70-g09d2 From 69eca93aa07bd47924f8e769cfedd5e071be6d51 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 15 Oct 2014 13:22:17 +0100 Subject: Fixes finding of Windows font files. --- src/corelib/render/software/Agg2D.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 229294d2..8809bcd8 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -3559,7 +3559,10 @@ procedure TAgg2D.DoSetFontRes(fntres: TfpgFontResourceBase); {$IFDEF WINDOWS} begin {$IFDEF AGG2D_USE_FREETYPE } - Font('c:\WINNT\Fonts\arial.ttf', 10); + if DirectoryExists('c:\WINNT\Fonts') then + Font('c:\WINNT\Fonts\arial.ttf', 10) + else + Font('c:\Windows\Fonts\arial.ttf', 10); {$ENDIF } {$IFDEF AGG2D_USE_WINFONTS} Font('Arial', 13); -- cgit v1.2.3-70-g09d2 From 8e8f619239f08e7c085a15726dc815d15b4f5a6f Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 15 Oct 2014 13:37:19 +0100 Subject: console agg_2D: Line() and Rectangle() now have FixAlignment parameter This syncs the console agg_2D with the fpGUI Agg2D implementation. --- src/corelib/render/software/agg_2D.pas | 42 +++++++++++++++++++++++++++------- 1 file changed, 34 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/agg_2D.pas b/src/corelib/render/software/agg_2D.pas index 45d88e44..f167630f 100644 --- a/src/corelib/render/software/agg_2D.pas +++ b/src/corelib/render/software/agg_2D.pas @@ -1876,13 +1876,25 @@ begin end; { LINE } -procedure Agg2D.line(x1 ,y1 ,x2 ,y2 : double ); +procedure Agg2D.line(const x1, y1, x2, y2: double; AFixAlignment: boolean = false); +var + lx1, ly1, lx2, ly2: double; begin m_path.remove_all; - addLine (x1 ,y1 ,x2 ,y2 ); - drawPath(StrokeOnly ); + lx1 := x1; + ly1 := y1; + lx2 := x2; + ly2 := y2; + + if AFixAlignment then + begin + AlignPoint(@lx1, @ly1); + AlignPoint(@lx2, @ly2); + end; + addLine(lx1, ly1, lx2, ly2); + drawPath(StrokeOnly); end; { TRIANGLE } @@ -1899,13 +1911,27 @@ begin end; { RECTANGLE } -procedure Agg2D.rectangle(x1 ,y1 ,x2 ,y2 : double ); +procedure Agg2D.rectangle(const x1 ,y1 ,x2 ,y2 : double; AFixAlignment: boolean); +var + lx1, ly1, lx2, ly2: double; begin m_path.remove_all; - m_path.move_to(x1 ,y1 ); - m_path.line_to(x2 ,y1 ); - m_path.line_to(x2 ,y2 ); - m_path.line_to(x1 ,y2 ); + + lx1 := x1; + ly1 := y1; + lx2 := x2; + ly2 := y2; + + if AFixAlignment then + begin + AlignPoint(@lx1, @ly1); + AlignPoint(@lx2, @ly2); + end; + + m_path.move_to(lx1 ,ly1 ); + m_path.line_to(lx2 ,ly1 ); + m_path.line_to(lx2 ,ly2 ); + m_path.line_to(lx1 ,ly2 ); m_path.close_polygon; drawPath(FillAndStroke ); -- cgit v1.2.3-70-g09d2 From ae49a6e611fc8d0a6e2d38b6e51a224cbbb807ba Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 15 Oct 2014 13:38:32 +0100 Subject: Sync more fpGUI Agg2D code to console agg_2D unit. Not much, but it is a start. There are still many more of this to come. --- src/corelib/render/software/agg_2D.pas | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/agg_2D.pas b/src/corelib/render/software/agg_2D.pas index f167630f..4ffe3bd1 100644 --- a/src/corelib/render/software/agg_2D.pas +++ b/src/corelib/render/software/agg_2D.pas @@ -2128,7 +2128,7 @@ procedure Agg2D.font( fileName : char_ptr; height : double; bold : boolean = false; italic : boolean = false; - ch : FontCacheType = RasterFontCache; + ch : FontCacheType = VectorFontCache; angle : double = 0.0 ); var b : int; @@ -2147,10 +2147,11 @@ begin m_fontEngine.hinting_(m_textHints ); if ch = VectorFontCache then - m_fontEngine.height_(height ) + {$NOTE We need to fix this. Translating from font pt to pixels is inaccurate. This is just a temp fix for now. } + m_fontEngine.height_(height * 1.3333 ) // 9pt = ~12px so that is a ratio of 1.3333 else m_fontEngine.height_(worldToScreen(height ) ); -{$ENDIF } +{$ENDIF} {$IFDEF AGG2D_USE_WINFONTS} m_fontEngine.hinting_(m_textHints ); @@ -2193,7 +2194,9 @@ end; procedure Agg2D.textHints(hints : boolean ); begin m_textHints:=hints; - + {$IFNDEF AGG2D_NO_FONT} + m_fontEngine.hinting_(m_textHints ); + {$ENDIF} end; { TEXTWIDTH } @@ -2376,6 +2379,7 @@ end; procedure Agg2D.resetPath; begin m_path.remove_all; + m_path.move_to(0 ,0 ); end; -- cgit v1.2.3-70-g09d2 From c61b3711838b9524d448cbb9004b244359ba58ea Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 15 Oct 2014 14:10:11 +0100 Subject: aggpas: Adds a extrafpc.cfg config file to easily compile AggPas Demos Usage: fpc @extrafpc.cfg .dpr --- src/corelib/render/software/agg-demos/extrafpc.cfg | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 src/corelib/render/software/agg-demos/extrafpc.cfg (limited to 'src/corelib') diff --git a/src/corelib/render/software/agg-demos/extrafpc.cfg b/src/corelib/render/software/agg-demos/extrafpc.cfg new file mode 100644 index 00000000..94482a02 --- /dev/null +++ b/src/corelib/render/software/agg-demos/extrafpc.cfg @@ -0,0 +1,21 @@ +-FUunits +-Fu../ +-Fu../ctrl/ +#IFDEF UNIX + -Fu../platform/linux/ +#ENDIF +#IFDEF WINDOWS + -Fu../platform/win/ + -WG +#ENDIF +#IFDEF Carbon + -Fu../platform/mac/ +#ENDIF +-Fu../svg/ +-Fu../util/ +-Fi../ +-Xs +-XX +-CX +-Mdelphi + -- cgit v1.2.3-70-g09d2 From 3a0793fe12c04006ad98875fc2a105c471850a78 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 24 Jul 2014 06:47:13 +0100 Subject: Revert "CanvasBase.GradientFill causes a math error" This reverts commit 1bd4b9091d3649f531c77ef0d0d656de4f6e3129. --- src/corelib/fpg_base.pas | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 62bd3827..aa30c309 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1743,9 +1743,9 @@ begin RGBStop := fpgColorToRGBTriple(AStop); if ADirection = gdVertical then - count := ARect.Height + count := ARect.Bottom - ARect.Top else - count := ARect.Width; + count := ARect.Right - ARect.Left; RDiff := RGBStop.Red - RGBStart.Red; GDiff := RGBStop.Green - RGBStart.Green; -- cgit v1.2.3-70-g09d2 From 1cbf064db5130438cbc7153f121b535fcea56e41 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 17 Oct 2014 20:13:23 +0100 Subject: Fixes "division by zero" error eg: Compile DocView and resize the contents panel all the way to the right. The gradient panel ends up having < 1 width, which means it is not visible any more, so really the GradientFill doesn't need to do anything. --- src/corelib/fpg_base.pas | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index aa30c309..0da0557a 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1747,6 +1747,9 @@ begin else count := ARect.Right - ARect.Left; + if count < 1 then + Exit; // there is nothing to paint + RDiff := RGBStop.Red - RGBStart.Red; GDiff := RGBStop.Green - RGBStart.Green; BDiff := RGBStop.Blue - RGBStart.Blue; -- cgit v1.2.3-70-g09d2 From e9d974dc967c8bb83c2cbc77d776106a782ab3b2 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 19 Oct 2014 16:26:19 +0100 Subject: Changes created due to running "localize.sh" script Basically just reordering some resources. --- languages/fpgui.po | 56 ++++++++++++++++++++++++------------------------- src/corelib/lang_af.inc | 28 ++++++++++++------------- src/corelib/lang_fr.inc | 16 +++++++------- 3 files changed, 50 insertions(+), 50 deletions(-) (limited to 'src/corelib') diff --git a/languages/fpgui.po b/languages/fpgui.po index d84c2be4..4c6a64ef 100644 --- a/languages/fpgui.po +++ b/languages/fpgui.po @@ -254,6 +254,10 @@ msgstr "" msgid "Font Aliases" msgstr "" +#: fpg_constants:rserrreportfontfilemissing +msgid "Font file <%s.fnt> not found" +msgstr "" + #: fpg_constants:rsshortfri msgid "Fri" msgstr "" @@ -278,6 +282,10 @@ msgstr "" msgid "Ignore" msgstr "" +#: fpg_constants:rserrreportimagefilemissing +msgid "Image <%s> is missing" +msgstr "" + #: fpg_constants:rsinformation msgid "Information" msgstr "" @@ -422,6 +430,14 @@ msgstr "" msgid "Owner" msgstr "" +#: fpg_constants:rsfiletypepdf +msgid "PDF Documents" +msgstr "" + +#: fpg_constants:rsreportpage +msgid "Page" +msgstr "" + #: fpg_constants:rspassword msgid "Password" msgstr "" @@ -438,6 +454,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rsreportpreview +msgid "Preview" +msgstr "" + #: fpg_constants:rscollectionrecentlyused msgid "Recently Used" msgstr "" @@ -482,6 +502,10 @@ msgstr "" msgid "Search" msgstr "" +#: fpg_constants:rsreportsection +msgid "Section" +msgstr "" + #: fpg_constants:rsselect msgid "Select" msgstr "" @@ -542,6 +566,10 @@ msgstr "" msgid "Text to Insert" msgstr "" +#: fpg_constants:rserrreportnopagestoprint +msgid "There are no pages to print" +msgstr "" + #: fpg_constants:rsshortthu msgid "Thu" msgstr "" @@ -610,35 +638,7 @@ msgstr "" msgid "Yes to All" msgstr "" -#: fpg_constants:rserrreportimagefilemissing -msgid "Image <%s> is missing" -msgstr "" - -#: fpg_constants:rserrreportnopagestoprint -msgid "There are no pages to print" -msgstr "" - -#: fpg_constants:rserrreportfontfilemissing -msgid "Font file <%s.fnt> not found" -msgstr "" - -#: fpg_constants:rsfiletypepdf -msgid "PDF Documents" -msgstr "" - -#: fpg_constants:rsreportpage -msgid "Page" -msgstr "" - -#: fpg_constants:rsreportsection -msgid "Section" -msgstr "" - #: fpg_constants:rsreportpageof msgid "of" msgstr "" -#: fpg_constants:rsreportpreview -msgid "Preview" -msgstr "" - diff --git a/src/corelib/lang_af.inc b/src/corelib/lang_af.inc index bd15fe69..9a97a50d 100644 --- a/src/corelib/lang_af.inc +++ b/src/corelib/lang_af.inc @@ -23,11 +23,11 @@ rsbold = 'Vetdruk'; rscancel = 'Kanselleer'; rscannotcreatedir = 'Kan nie die lêergids skep nie'; rschange = 'Verander'; -rschangetitle = 'Change Title'; +rschangetitle = 'Verander Titel'; rscharactermap = 'Karakter Kaart'; rsclose = 'Sluit'; rscollection = 'Versameling'; -rsconfigurebookmarks = 'Configure Bookmarks'; +rsconfigurebookmarks = 'Instel Boekmerke'; rsconfirm = 'Bevestig'; rsconfirmation = 'Bevestiging'; rscopy = 'Kopieer'; @@ -43,7 +43,7 @@ rslongdec = 'Desember'; rskeydel = 'Del'; rsdelete = 'Skrap'; rsdirectories = 'Lêergidse'; -rsdirectory = 'Directory'; +rsdirectory = 'Lêergids'; rskeydown = 'Down'; rsdrive = 'Dryf'; rsedit = 'Redigeer'; @@ -56,7 +56,7 @@ rskeyesc = 'Esc'; rsexampletext = 'Teks Voorbeeld'; rsexit = 'Staak'; rserrfailedtocreatedir = 'Kon nie die lêergids <%s> skep nie'; -rsfailedtofindhelpviewer = 'Failed to find the help viewer.'; +rsfailedtofindhelpviewer = 'Kon nie die help program find nie.'; rsfalse = 'Onwaar'; rscollectionfavourites = 'Gunstelinge'; rsshortfeb = 'Feb'; @@ -67,14 +67,14 @@ rsfiles = 'Lêers'; rsfind = 'Vind'; rscollectionfixedwidth = 'Vaste wydte'; rscollectionfontaliases = 'Font Kenname'; -rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; +rserrreportfontfilemissing = 'Font lêer" <%s.fnt> is nie gevind nie'; rsshortfri = 'Vr'; rslongfri = 'Vrydag'; rsfilegroup = 'Groep'; rshelp = 'Help'; rskeyhome = 'Home'; rsignore = 'Ignoreer'; -rserrreportimagefilemissing = 'Image <%s> is missing'; +rserrreportimagefilemissing = 'Beeld-lêer <%s> is vermis'; rsinformation = 'Informasie'; rskeyins = 'Ins'; rsinsert = 'Invoeg'; @@ -98,8 +98,8 @@ rskeymeta = 'Meta+'; rsfilemodifiedtime = 'Wysigings Tyd'; rsshortmon = 'Ma'; rslongmon = 'Maandag'; -rsmovedown = 'Move Down'; -rsmoveup = 'Move Up'; +rsmovedown = 'Skyf Af'; +rsmoveup = 'Skyf Op'; rsname = 'Naam'; rsno = 'Nee'; rsnotoall = 'Nee vir Alles'; @@ -111,13 +111,13 @@ rslongoct = 'Oktober'; rsopen = 'Open'; rsopenafile = 'Maak ''n leêr op'; rsfileowner = 'Eienaar'; -rsfiletypepdf = 'PDF Documents'; -rsreportpage = 'Page'; +rsfiletypepdf = 'PDF Dokumente'; +rsreportpage = 'Bladsy'; rspassword = 'Wagwoord'; rspaste = 'Plak'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; -rsreportpreview = 'Preview'; +rsreportpreview = 'Voorskou'; rscollectionrecentlyused = 'Onlangs gebruik'; rsreplace = 'Vervang'; rsretry = 'Herprobeer'; @@ -129,7 +129,7 @@ rslongsat = 'Saterdag'; rssave = 'Stoor'; rssaveafile = 'Stoor ''n lêer as'; rssearch = 'Soek'; -rsreportsection = 'Section'; +rsreportsection = 'Seksie'; rsselect = 'Kies'; rsselectadirectory = 'Kies ''n lêergids'; rsselectafont = 'Kies ''n lettertipe'; @@ -145,7 +145,7 @@ rsshortsun = 'So'; rslongsun = 'Sondag'; rskeytab = 'Tab'; rstexttoinsert = 'Teks om in te voeg'; -rserrreportnopagestoprint = 'There are no pages to print'; +rserrreportnopagestoprint = 'Daar is geen bladsye om te druk nie'; rsshortthu = 'Do'; rslongthu = 'Donderdag'; rstoday = 'Vandag'; @@ -163,4 +163,4 @@ rslongwed = 'Woensdag'; rsaddnewitem = 'Wil jy die nuwe item <%s> in die lys bylas?'; rsyes = 'Ja'; rsyestoall = 'Ja vir Alles'; -rsreportpageof = 'of'; +rsreportpageof = 'van'; diff --git a/src/corelib/lang_fr.inc b/src/corelib/lang_fr.inc index 7409c5ff..f111a2ea 100644 --- a/src/corelib/lang_fr.inc +++ b/src/corelib/lang_fr.inc @@ -56,8 +56,8 @@ rskeyesc = 'Esc'; rsexampletext = 'Texte exemple'; rsexit = 'Sortir'; rserrfailedtocreatedir = 'Le répertoire <%s> n''''a pas pu être ouvert'; -rsfailedtofindhelpviewer = 'Failed to find the help viewer.'; -rsfalse = 'False'; +rsfailedtofindhelpviewer = 'Visualiseur d''aide non trouvé'; +rsfalse = 'Faux'; rscollectionfavourites = 'Favoris'; rsshortfeb = 'Fév'; rslongfeb = 'Février'; @@ -67,14 +67,14 @@ rsfiles = 'Fichiers'; rsfind = 'Trouver'; rscollectionfixedwidth = 'Longueur fixe'; rscollectionfontaliases = 'Alias'; -rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; +rserrreportfontfilemissing = 'Fichier de police <%s.fnt> non trouvé'; rsshortfri = 'Ven'; rslongfri = 'Vendredi'; rsfilegroup = 'Groupe'; rshelp = 'Aide'; rskeyhome = 'Home'; rsignore = 'Ignorer'; -rserrreportimagefilemissing = 'Image <%s> is missing'; +rserrreportimagefilemissing = 'Image <%s> introuvable'; rsinformation = 'Information'; rskeyins = 'Ins'; rsinsert = 'Insérer'; @@ -111,13 +111,13 @@ rslongoct = 'Octobre'; rsopen = 'Ouvrir'; rsopenafile = 'Ouvrir un fichier'; rsfileowner = 'Propriétaire'; -rsfiletypepdf = 'PDF Documents'; +rsfiletypepdf = 'Documents PDF'; rsreportpage = 'Page'; rspassword = 'Mot de passe'; rspaste = 'Coller'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; -rsreportpreview = 'Preview'; +rsreportpreview = 'Prévisualisation'; rscollectionrecentlyused = 'Récemment utilisé'; rsreplace = 'Remplacer'; rsretry = 'Retenter'; @@ -145,7 +145,7 @@ rsshortsun = 'Dim'; rslongsun = 'Dimanche'; rskeytab = 'Tab'; rstexttoinsert = 'Texte à insérer'; -rserrreportnopagestoprint = 'There are no pages to print'; +rserrreportnopagestoprint = 'Il n''y a pas de page à imprimer'; rsshortthu = 'Jeu'; rslongthu = 'Jeudi'; rstoday = 'Aujourd''''hui'; @@ -163,4 +163,4 @@ rslongwed = 'Mercredi'; rsaddnewitem = 'Voulez-vous ajouter l''''item <%s> à la liste?'; rsyes = 'Oui'; rsyestoall = 'Oui à tous'; -rsreportpageof = 'of'; +rsreportpageof = 'de'; -- cgit v1.2.3-70-g09d2 From 3778ccae5b383b45c08f51f435b45714a2d1d363 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sun, 19 Oct 2014 20:22:13 +0100 Subject: New fpgApplication.GetScreenPixelColor() for X11 We can now color pick a value on a X11 desktop. --- src/corelib/fpg_base.pas | 1 + src/corelib/gdi/fpg_gdi.pas | 6 ++++++ src/corelib/x11/fpg_x11.pas | 23 +++++++++++++++++++++++ 3 files changed, 30 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 0da0557a..eb7136b8 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -577,6 +577,7 @@ type procedure CreateForm(InstanceClass: TComponentClass; out Reference); function GetScreenWidth: TfpgCoord; virtual; abstract; function GetScreenHeight: TfpgCoord; virtual; abstract; + function GetScreenPixelColor(APos: TPoint): TfpgColor; virtual; abstract; function Screen_dpi_x: integer; virtual; abstract; function Screen_dpi_y: integer; virtual; abstract; function Screen_dpi: integer; virtual; abstract; diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index 1d5b7dff..8b7b9939 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -246,6 +246,7 @@ type procedure DoFlush; function GetScreenWidth: TfpgCoord; override; function GetScreenHeight: TfpgCoord; override; + function GetScreenPixelColor(APos: TPoint): TfpgColor; override; function Screen_dpi_x: integer; override; function Screen_dpi_y: integer; override; function Screen_dpi: integer; override; @@ -1416,6 +1417,11 @@ begin // Result := Windows.GetSystemMetrics(SM_CYSCREEN); end; +function TfpgGDIApplication.GetScreenPixelColor(APos: TPoint): TfpgColor; +begin + raise EfpGUIException.Create('Not implemented yet'); +end; + function TfpgGDIApplication.Screen_dpi_x: integer; begin Result := GetDeviceCaps(wapplication.display, LOGPIXELSX) diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index c94cf1fb..f98e8198 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -331,6 +331,7 @@ type procedure DoFlush; function GetScreenWidth: TfpgCoord; override; function GetScreenHeight: TfpgCoord; override; + function GetScreenPixelColor(APos: TPoint): TfpgColor; override; function Screen_dpi_x: integer; override; function Screen_dpi_y: integer; override; function Screen_dpi: integer; override; @@ -2240,6 +2241,28 @@ begin Result := wa.Height; end; +function TfpgX11Application.GetScreenPixelColor(APos: TPoint): TfpgColor; +var + Image: PXImage; + Pixel: Cardinal; + x_Color: TXColor; +begin + Result := 0; + Image := XGetImage(Display, FRootWindow, APos.X, APos.Y, 1, 1, $FFFFFFFF, ZPixmap); + if Image = nil then + raise Exception.Create('fpGFX/X11: Invalid XImage'); + try + Pixel := XGetPixel(Image, 0, 0); + x_Color.pixel := Pixel; + XQueryColor(Display, DefaultColorMap, @x_Color); + Result := TfpgColor(((x_Color.red and $00FF) shl 16) or + ((x_Color.green and $00FF) shl 8) or + (x_Color.blue and $00FF)); + finally + XDestroyImage(Image); + end; +end; + function TfpgX11Application.Screen_dpi_x: integer; var mm: integer; -- cgit v1.2.3-70-g09d2 From 6a3d645d0edc18051ec8ac3ad8e6fdb9dc51aa54 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 20 Oct 2014 13:03:54 +0100 Subject: gdi: Implements TfpgGDIApplication.GetScreenPixelColor() The color picker in the ColorWheel demo now works on all supported platforms. --- src/corelib/gdi/fpg_gdi.pas | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index 8b7b9939..b24b04be 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -1418,8 +1418,11 @@ begin end; function TfpgGDIApplication.GetScreenPixelColor(APos: TPoint): TfpgColor; +var + c: longword; begin - raise EfpGUIException.Create('Not implemented yet'); + c := Windows.GetPixel(FDisplay, APos.X, APos.Y); + Result := WinColorTofpgColor(c); end; function TfpgGDIApplication.Screen_dpi_x: integer; -- cgit v1.2.3-70-g09d2 From 6d0585a89b86a24e90e74ff96f81da9853d3c35d Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 21 Oct 2014 13:53:20 +0100 Subject: aggpas: Implements and uses a GetWindowsFontPath function. AggPas now correctly queries the correct Windows install path. Thanks Marcus for pointing out my hasty commit from before. --- src/corelib/render/software/Agg2D.pas | 5 +---- src/corelib/render/software/agg_platform_gdi.inc | 13 +++++++++++++ 2 files changed, 14 insertions(+), 4 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 8809bcd8..333e37ea 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -3559,10 +3559,7 @@ procedure TAgg2D.DoSetFontRes(fntres: TfpgFontResourceBase); {$IFDEF WINDOWS} begin {$IFDEF AGG2D_USE_FREETYPE } - if DirectoryExists('c:\WINNT\Fonts') then - Font('c:\WINNT\Fonts\arial.ttf', 10) - else - Font('c:\Windows\Fonts\arial.ttf', 10); + Font(GetWindowsFontDir + 'arial.ttf', 10); {$ENDIF } {$IFDEF AGG2D_USE_WINFONTS} Font('Arial', 13); diff --git a/src/corelib/render/software/agg_platform_gdi.inc b/src/corelib/render/software/agg_platform_gdi.inc index 88d3b586..c61d068f 100644 --- a/src/corelib/render/software/agg_platform_gdi.inc +++ b/src/corelib/render/software/agg_platform_gdi.inc @@ -21,6 +21,19 @@ type // to get access to protected methods (seeing that FPC doesn't support Friend-classes) TImageHack = class(TfpgImage); +function GetWindowsFontDir: string; +var + lWinFontPath: array[0..MAX_PATH] of WideChar; + lPasWinFontPath: string; + i: Integer; +begin + // Find for example C:\Windows\Fonts or C:\WINNT\Fonts + Windows.GetWindowsDirectoryW(@lWinFontPath[0], MAX_PATH); + lPasWinFontPath := lWinFontPath; + lPasWinFontPath := IncludeTrailingPathDelimiter(lPasWinFontPath) + 'Fonts' + PathDelim; + Result := lPasWinFontPath; +end; + procedure TAgg2D.DoPutBufferToScreen(x, y, w, h: TfpgCoord); var srcdc: HDC; -- cgit v1.2.3-70-g09d2 From 023aea10cc61dfef406cd39b8cf76be65a9df134 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 22 Oct 2014 15:35:36 +0100 Subject: agg_2D: fixes compilation errors. The interface did not match the implementation section. My fault for not doing a good enough sync with agg2d.pas! :-/ --- src/corelib/render/software/agg_2D.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/agg_2D.pas b/src/corelib/render/software/agg_2D.pas index 4ffe3bd1..0fcbc3d9 100644 --- a/src/corelib/render/software/agg_2D.pas +++ b/src/corelib/render/software/agg_2D.pas @@ -414,9 +414,9 @@ type opt : ViewportOption = XMidYMid ); // Basic Shapes - procedure line (x1 ,y1 ,x2 ,y2 : double ); + procedure line (const x1 ,y1 ,x2 ,y2 : double; AFixAlignment: boolean = false ); procedure triangle (x1 ,y1 ,x2 ,y2 ,x3 ,y3 : double ); - procedure rectangle(x1 ,y1 ,x2 ,y2 : double ); + procedure rectangle(const x1 ,y1 ,x2 ,y2 : double; AFixAlignment: boolean = false); procedure roundedRect(x1 ,y1 ,x2 ,y2 ,r : double ); overload; procedure roundedRect(x1 ,y1 ,x2 ,y2 ,rx ,ry : double ); overload; @@ -443,7 +443,7 @@ type fileName : char_ptr; height : double; bold : boolean = false; italic : boolean = false; - ch : FontCacheType = RasterFontCache; + ch : FontCacheType = VectorFontCache; angle : double = 0.0 ); function fontHeight : double; -- cgit v1.2.3-70-g09d2 From d5f04ab2977e0457c4fe8c512d61a1c88daa828b Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 15 Nov 2014 21:06:19 +0000 Subject: aggpas: fixes spelling mistake in code comment --- src/corelib/render/software/agg_blur.pas | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/agg_blur.pas b/src/corelib/render/software/agg_blur.pas index 5ddda2bc..78e6df72 100644 --- a/src/corelib/render/software/agg_blur.pas +++ b/src/corelib/render/software/agg_blur.pas @@ -25,7 +25,7 @@ // http://incubator.quasimondo.com/processing/fast_blur_deluxe.php // (search phrase "Stackblur: Fast But Goodlooking"). // The major improvement is that there's no more division table -// that was very expensive to create for large blur radii. Insted, +// that was very expensive to create for large blur radii. Instead, // for 8-bit per channel and radius not exceeding 254 the division is // replaced by multiplication and shift. // -- cgit v1.2.3-70-g09d2 From 442a7c7f743f39aa0b7afc15f51c1e148a31094f Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 6 Dec 2014 15:37:06 +0000 Subject: Fixes compiler hint about unused variable --- src/corelib/render/software/Agg2D.pas | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/render/software/Agg2D.pas b/src/corelib/render/software/Agg2D.pas index 333e37ea..b77b9ce9 100644 --- a/src/corelib/render/software/Agg2D.pas +++ b/src/corelib/render/software/Agg2D.pas @@ -2653,9 +2653,10 @@ procedure TAgg2D.Font( italic : boolean = false; cache : TAggFontCacheType = AGG_VectorFontCache; angle : double = 0.0 ); +{$IFDEF AGG2D_USE_WINFONTS} var b : int; - +{$ENDIF} begin m_textAngle :=angle; m_fontHeight :=height; -- cgit v1.2.3-70-g09d2 From d173baebc3d3c695ba90763d9a0e175770105650 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 20 Aug 2014 00:02:45 +0100 Subject: Implements custom form icon support for X11 TfpgForm now has a new IconName property. Load a 16x16 image into the global fpgImages instance and use that icons name in the IconName property. Windows support is still work-in-progress. --- src/corelib/fpg_base.pas | 2 +- src/corelib/fpg_widget.pas | 2 -- src/corelib/x11/fpg_x11.pas | 54 ++++++++++++++++++++++++++++++++++++++++----- src/gui/fpg_form.pas | 5 ++++- 4 files changed, 54 insertions(+), 9 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index eb7136b8..e6e3ab7e 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -2187,7 +2187,7 @@ begin p := FImageData; Inc(p, (FWidth * y) + x); p^ := AValue; -// write(IntToHex(AValue, 6) + ' '); +// write(IntToHex(AValue, 8) + ' '); end; constructor TfpgImageBase.Create; diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 872ac2c8..3212e75c 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -39,8 +39,6 @@ type TfpgDragDropEvent = procedure(Sender, Source: TObject; X, Y: integer; AData: variant) of object; - { TfpgWidget } - TfpgWidget = class(TfpgWindow) private FAcceptDrops: boolean; diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index f98e8198..54908c0f 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2013 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -222,6 +222,7 @@ type TfpgX11Window = class(TfpgWindowBase) private QueueEnabledDrops: boolean; + procedure ApplyFormIcon; protected FWinFlags: TXWindowStateFlags; FWinHandle: TfpgWinHandle; @@ -315,6 +316,7 @@ type xia_wm_protocols: TAtom; xia_wm_delete_window: TAtom; xia_wm_state: TAtom; + xia_net_wm_icon: TAtom; xia_targets: TAtom; xia_save_targets: TAtom; netlayer: TNETWindowLayer; @@ -1484,6 +1486,7 @@ begin xia_wm_protocols := XInternAtom(FDisplay, 'WM_PROTOCOLS', TBool(False)); xia_wm_delete_window := XInternAtom(FDisplay, 'WM_DELETE_WINDOW', TBool(False)); xia_wm_state := XInternAtom(FDisplay, 'WM_STATE', TBool(False)); + xia_net_wm_icon := XInternAtom(FDisplay, '_NET_WM_ICON', TBool(False)); { initializa the XDND atoms } FDNDTypeList := TObjectList.Create; @@ -2301,6 +2304,45 @@ end; { TfpgX11Window } +procedure TfpgX11Window.ApplyFormIcon; +var + ico: TfpgImage; + ar1: array of longword; // 32 bit CPU's + ar2: array of qword; // 64 bit CPU's + ps: pbyte; + pd: ^TRGBTriple; + i: integer; + iconName: string; +begin + if self is TfpgForm then + iconName := TfpgForm(self).IconName; + if iconName = '' then + Exit; + ico := fpgImages.GetImage(iconName); + if Assigned(ico) then + begin + SetLength(ar1, 2 + (ico.Width * ico.Height)); + ar1[0] := ico.Width; + ar1[1] := ico.Height; + pd := @ar1[2]; + ps := ico.ImageData; + move(ps^,pd^, ico.ImageDataSize); + end + else + exit; // we don't have a icon to set + + {$ifdef cpu64} + setlength(ar2,length(ar1)); + for i := low(ar2) to high(ar2) do + ar2[i] := ar1[i]; // copy array data over + XChangeProperty(xapplication.display, FWinHandle, xapplication.xia_net_wm_icon, + XA_CARDINAL, 32, PropModeReplace, @ar2[0], Length(ar2)); + {$else} + XChangeProperty(xapplication.display, FWinHandle, xapplication.xia_net_wm_icon, + XA_CARDINAL, 32, PropModeReplace, @ar1[0], Length(ar1)); + {$endif} +end; + procedure TfpgX11Window.DoAllocateWindowHandle(AParent: TfpgWindowBase); var pwh: TfpgWinHandle; @@ -2359,13 +2401,13 @@ begin if AParent = nil then // is a toplevel window begin { setup a window icon } - IconPixMap := XCreateBitmapFromData(fpgApplication.Display, FWinHandle, + + IconPixMap := XCreateBitmapFromData(xapplication.display, FWinHandle, @IconBitmapBits, IconBitmapWidth, IconBitmapHeight); WMHints := XAllocWMHints; WMHints^.icon_pixmap := IconPixmap; WMHints^.flags := IconPixmapHint; - { setup window grouping posibilities } if (not (waX11SkipWMHints in FWindowAttributes)) and (FWindowType = wtWindow) then begin @@ -2373,8 +2415,7 @@ begin WMHints^.window_group := xapplication.FLeaderWindow; end; - - XSetWMProperties(fpgApplication.Display, FWinHandle, nil, nil, nil, 0, nil, WMHints, nil); + XSetWMProperties(xapplication.display, FWinHandle, nil, nil, nil, 0, nil, WMHints, nil); if (not (waX11SkipWMHints in FWindowAttributes)) and (FWindowType = wtWindow) then begin @@ -2395,6 +2436,9 @@ begin begin DoDNDEnabled(True); end; + + if xapplication.xia_net_wm_icon <> 0 then + ApplyFormIcon; end; FillChar(hints, sizeof(hints), 0); diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas index 7d5fe042..af76de2a 100644 --- a/src/gui/fpg_form.pas +++ b/src/gui/fpg_form.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2011 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -44,6 +44,7 @@ type TfpgBaseForm = class(TfpgWidget) private FFullScreen: boolean; + FIconName: TfpgString; FOnActivate: TNotifyEvent; FOnClose: TFormCloseEvent; FOnCloseQuery: TFormCloseQueryEvent; @@ -76,6 +77,7 @@ type procedure DoKeyShortcut(const AOrigin: TfpgWidget; const keycode: word; const shiftstate: TShiftState; var consumed: boolean; const IsChildOfOrigin: boolean = False); override; { -- properties -- } property DNDEnabled: boolean read FDNDEnabled write SetDNDEnabled default False; + property IconName: string read FIconName write FIconName; property Sizeable: boolean read FSizeable write FSizeable; property ModalResult: TfpgModalResult read FModalResult write FModalResult; property FullScreen: boolean read FFullScreen write FFullScreen default False; @@ -115,6 +117,7 @@ type property FullScreen; property Height; property Hint; + property IconName; property Left; property MaxHeight; property MaxWidth; -- cgit v1.2.3-70-g09d2 From 1be09e22f74ffdc37318c2a5e2c91fb79cdedd8c Mon Sep 17 00:00:00 2001 From: Fred van Stappen Date: Sat, 20 Dec 2014 01:10:35 +0000 Subject: color dialog: Color Picker and Hex Value editbox added. Thanks to Fred van Stappen for the original contribution. I (Graeme) make a couple more changes, code clean-up, and dialog translation. --- src/corelib/fpg_stdimages.pas | 7 +- src/corelib/lang_en.inc | 8 ++ src/corelib/stdimages.inc | 22 ++++ src/gui/colordialog.inc | 286 ++++++++++++++++++++++++++++++++++++++---- 4 files changed, 298 insertions(+), 25 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_stdimages.pas b/src/corelib/fpg_stdimages.pas index b02331aa..a641fa32 100644 --- a/src/corelib/fpg_stdimages.pas +++ b/src/corelib/fpg_stdimages.pas @@ -288,7 +288,12 @@ begin 'stdimg.executable', @stdimg_executable_16, sizeof(stdimg_executable_16), 0,0); - + + fpgImages.AddMaskedBMP( + 'stdimg.colpicker', + @stdimg_colpicker, + sizeof(stdimg_colpicker), 0,0); + // Dialog icons fpgImages.AddMaskedBMP( diff --git a/src/corelib/lang_en.inc b/src/corelib/lang_en.inc index 6a681932..d262102c 100644 --- a/src/corelib/lang_en.inc +++ b/src/corelib/lang_en.inc @@ -164,3 +164,11 @@ rsaddnewitem = 'Would you like to add the new item <%s> to the list?'; rsyes = 'Yes'; rsyestoall = 'Yes to All'; rsreportpageof = 'of'; +rsContinuous = 'Continuous'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; +rsColorRed = 'Red'; +rsColorGreen = 'Green'; +rsColorBlue = 'Blue'; +rsHexadecimal = 'Hexadecimal'; +rsTabsheetColorWheel = 'Color Wheel'; +rsTabPredefined = 'Predefined'; diff --git a/src/corelib/stdimages.inc b/src/corelib/stdimages.inc index 36255154..510a1ce6 100644 --- a/src/corelib/stdimages.inc +++ b/src/corelib/stdimages.inc @@ -3222,4 +3222,26 @@ Const 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,255, 0,255,255, 0,255,255, 0,255); +const + stdimg_colpicker: array[0..333] of byte = ( + 66, 77, 78, 1, 0, 0, 0, 0, 0, 0,118, 0, 0, 0, 40, 0, 0, + 0, 18, 0, 0, 0, 18, 0, 0, 0, 1, 0, 4, 0, 0, 0, 0, 0, + 216, 0, 0, 0, 19, 11, 0, 0, 19, 11, 0, 0, 16, 0, 0, 0, 16, + 0, 0, 0, 0, 0, 0, 0,132,132, 0, 0,255,255, 0, 0, 0, 0, + 132, 0,132,132,132, 0,206,214,214, 0, 0, 0,255, 0,255,255,255, + 0,255,255,255, 0,255,255,255, 0,255,255,255, 0,255,255,255, 0, + 255,255,255, 0,255,255,255, 0,255,255,255, 0,255,255,255, 0, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 0, 0, 0, 85, 34, 34, 37, 85, 85, + 85, 85, 85, 0, 0, 0, 82, 34, 34, 34, 37, 85, 85, 85, 85, 0, 0, + 0, 85, 80, 5, 85, 85, 85, 85, 85, 85, 0, 0, 0, 85, 80, 32, 5, + 85, 85, 85, 85, 85, 0, 0, 0, 85, 85, 1, 64, 85, 85, 85, 85, 85, + 0, 0, 0, 85, 85, 2, 20, 5, 85, 85, 85, 85, 0, 0, 0, 85, 85, + 80, 33, 64, 85, 85, 85, 85, 0, 0, 0, 85, 85, 85, 5,116, 5, 85, + 85, 85, 0, 0, 0, 85, 85, 85, 80, 87, 64, 85, 85, 85, 0, 0, 0, + 85, 85, 85, 85, 5,116, 3, 85, 85, 0, 0, 0, 85, 85, 85, 85, 80, + 83, 48, 69, 85, 0, 0, 0, 85, 85, 85, 85, 85, 54, 3, 52, 85, 0, + 0, 0, 85, 85, 85, 85, 85, 99, 99, 51, 69, 0, 0, 0, 85, 85, 85, + 85, 85, 85, 54, 99, 53, 0, 0, 0, 85, 85, 85, 85, 85, 85, 55, 99, + 53, 0, 0, 0, 85, 85, 85, 85, 85, 85, 83, 51, 69, 0, 0, 0, 85, + 85, 85, 85, 85, 85, 85, 85, 85, 0, 0, 0); diff --git a/src/gui/colordialog.inc b/src/gui/colordialog.inc index 93d8d731..0ef8c3bb 100644 --- a/src/gui/colordialog.inc +++ b/src/gui/colordialog.inc @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -22,6 +22,28 @@ type + TColorPickedEvent = procedure(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor) of object; + + TPickerButton = class(TfpgButton) + private + FContinuousResults: Boolean; + FOnColorPicked: TColorPickedEvent; + FColorPos: TPoint; + FColor: TfpgColor; + FColorPicking: Boolean; + private + procedure DoColorPicked; + protected + procedure HandleLMouseDown(X, Y: integer; ShiftState: TShiftState); override; + procedure HandleLMouseUp(x, y: integer; shiftstate: TShiftState); override; + procedure HandleMouseMove(x, y: integer; btnstate: word; shiftstate: TShiftState); override; + public + constructor Create(AOwner: TComponent); override; + published + property ContinuousResults: Boolean read FContinuousResults write FContinuousResults; + property OnColorPicked: TColorPickedEvent read FOnColorPicked write FOnColorPicked; + end; + TfpgColorSelectDialog = class(TfpgBaseDialog) private {@VFD_HEAD_BEGIN: ColorSelectDialog} @@ -37,19 +59,29 @@ type edR: TfpgSpinEdit; edG: TfpgSpinEdit; edB: TfpgSpinEdit; - Label3: TfpgLabel; - Label4: TfpgLabel; - Label5: TfpgLabel; - pnlColorPreview: TfpgBevel; + lblRed: TfpgLabel; + lblGreen: TfpgLabel; + lblBlue: TfpgLabel; + btnPicker: TPickerButton; + chkContinuous: TfpgCheckBox; + lblHex: TfpgLabel; + edHex: TfpgEdit; {@VFD_HEAD_END: ColorSelectDialog} FViaRGB: Boolean; // to prevent recursive changes + FColorPicking: Boolean; + procedure btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor); + procedure chkContinuousChanged(Sender: TObject); function GetSelectedColor: TfpgColor; procedure SetSelectedColor(const AValue: TfpgColor); procedure ColorChanged(Sender: TObject); + procedure NamedColorChanged(Sender: TObject); procedure RGBChanged(Sender: TObject); procedure UpdateRGBComponents; procedure PopulatePaletteColorCombo; procedure cbColorPaletteChange(Sender: TObject); + procedure OnTabChange(Sender: TObject; tab:TfpgTabSheet); + protected + procedure SetupCaptions; override; public constructor Create(AOwner: TComponent); override; procedure AfterCreate; override; @@ -79,8 +111,120 @@ begin end; end; + +function ConvertToHex(Value: integer): string; +var + ValH, ValL: integer; +begin + ValH := Value div 16; + ValL := Value mod 16; + case ValH of + 15: + Result := 'F'; + 14: + Result := 'E'; + 13: + Result := 'D'; + 12: + Result := 'C'; + 11: + Result := 'B'; + 10: + Result := 'A'; + else + Result := IntToStr(ValH); + end; + case ValL of + 15: + Result := Result + 'F'; + 14: + Result := Result + 'E'; + 13: + Result := Result + 'D'; + 12: + Result := Result + 'C'; + 11: + Result := Result + 'B'; + 10: + Result := Result + 'A'; + else + Result := Result + IntToStr(ValL); + end; +end; + +function Hex(Red, Green, Blue: integer): string; +begin + Result := '$' + ConvertToHex(Red) + ConvertToHex(Green) + ConvertToHex(Blue); +end; + +{ TPickerButton } + +procedure TPickerButton.DoColorPicked; +var + pt: TPoint; +begin + pt := WindowToScreen(self, FColorPos); + FColor := fpgApplication.GetScreenPixelColor(pt); + if Assigned(FOnColorPicked) then + FOnColorPicked(self, FColorPos, FColor); +end; + +procedure TPickerButton.HandleLMouseDown(X, Y: integer; ShiftState: TShiftState); +begin + inherited HandleLMouseDown(X, Y, ShiftState); + MouseCursor := mcCross; + FColorPicking := True; + CaptureMouse; +end; + +procedure TPickerButton.HandleLMouseUp(x, y: integer; shiftstate: TShiftState); +begin + inherited HandleLMouseUp(x, y, shiftstate); + ReleaseMouse; + FColorPicking := False; + MouseCursor := mcDefault; + DoColorPicked; +end; + +procedure TPickerButton.HandleMouseMove(x, y: integer; btnstate: word; + shiftstate: TShiftState); +begin + //inherited HandleMouseMove(x, y, btnstate, shiftstate); + if not FColorPicking then + Exit; + FColorPos.x := x; + FColorPos.y := y; + if FContinuousResults then + DoColorPicked; +end; + +constructor TPickerButton.Create(AOwner: TComponent); +begin + inherited Create(AOwner); + FColorPicking := False; + FContinuousResults := False; +end; + { TfpgColorSelectDialog } +procedure TfpgColorSelectDialog.OnTabChange(Sender: TObject; tab:TfpgTabSheet); +begin + if pcColorSelect.ActivePageIndex = 0 then + RGBChanged(sender) + else + NamedColorChanged(sender) ; +end; + +procedure TfpgColorSelectDialog.btnColorPicked(Sender: TObject; const AMousePos: TPoint; const AColor: TfpgColor); +begin + ColorWheel.SetSelectedColor(AColor); +end; + +procedure TfpgColorSelectDialog.chkContinuousChanged(Sender: TObject); +begin + btnPicker.ContinuousResults := chkContinuous.Checked; +end; + function TfpgColorSelectDialog.GetSelectedColor: TfpgColor; begin if pcColorSelect.ActivePageIndex = 0 then @@ -99,7 +243,24 @@ begin // UpdateHSVComponents; if not FViaRGB then UpdateRGBComponents; - pnlColorPreview.BackgroundColor := ValueBar.SelectedColor; +end; + +procedure TfpgColorSelectDialog.NamedColorChanged(Sender: TObject); +var + tred, tgreen, tblue: Byte; +begin + tred := fpgGetRed(ColorListBox1.Color); + tgreen := fpgGetGreen(ColorListBox1.Color); + tblue := fpgGetBlue(ColorListBox1.Color); + + // keep text readable based on background color + if (tred + tgreen + tblue) / (256*3) >0.60 then + edHex.TextColor := clBlack + else + edHex.TextColor := clWhite ; + + edHex.BackgroundColor:=ColorListBox1.Color; + edHex.Text := Hex(tred,tgreen,tblue); end; procedure TfpgColorSelectDialog.RGBChanged(Sender: TObject); @@ -114,6 +275,13 @@ begin c := FPColorTofpgColor(rgb); ColorWheel.SetSelectedColor(c); // This will trigger ColorWheel and ValueBar OnChange event FViaRGB := False; + // keep text readable based on background color + if ValueBar.Value > 0.75 then + edHex.TextColor := clBlack + else + edHex.TextColor := clWhite; + edHex.BackgroundColor := c; + edHex.Text := Hex(rgb.Red, rgb.Green, rgb.Blue); end; procedure TfpgColorSelectDialog.UpdateRGBComponents; @@ -126,6 +294,13 @@ begin edR.Value := rgb.Red; edG.Value := rgb.Green; edB.Value := rgb.Blue; + // keep text readable based on background color + if ValueBar.Value > 0.75 then + edHex.TextColor := clBlack + else + edHex.TextColor := clWhite; + edHex.BackgroundColor := c; + edHex.Text := Hex(rgb.Red, rgb.Green, rgb.Blue); end; procedure TfpgColorSelectDialog.PopulatePaletteColorCombo; @@ -149,21 +324,34 @@ begin ColorListBox1.SetFocus; end; +procedure TfpgColorSelectDialog.SetupCaptions; +begin + inherited SetupCaptions; + tsColorWheel.Text := rsTabsheetColorWheel; + tsColorNames.Text := rsTabPredefined; + lblRed.Text := rsColorRed; + lblGreen.Text := rsColorGreen; + lblBlue.Text := rsColorBlue; + chkContinuous.Text := rsContinuous; + btnPicker.Hint := rsColorPickerHint; + lblHex.Text := rsHexadecimal; +end; + constructor TfpgColorSelectDialog.Create(AOwner: TComponent); begin inherited Create(AOwner); FViaRGB := false; end; - procedure TfpgColorSelectDialog.AfterCreate; begin {%region 'Auto-generated GUI code' -fold} {@VFD_BODY_BEGIN: ColorSelectDialog} Name := 'ColorSelectDialog'; - SetPosition(340, 164, 328, 375); + SetPosition(340, 164, 328, 385); WindowTitle := 'Color Select Dialog'; Hint := ''; + IconName := ''; WindowPosition := wpOneThirdDown; pcColorSelect := TfpgPageControl.Create(self); @@ -172,9 +360,9 @@ begin Name := 'pcColorSelect'; SetPosition(4, 4, 320, 332); Anchors := [anLeft,anRight,anTop,anBottom]; - ActivePageIndex := 0; Hint := ''; TabOrder := 1; + OnChange := @OnTabChange; end; tsColorWheel := TfpgTabSheet.Create(pcColorSelect); @@ -182,6 +370,7 @@ begin begin Name := 'tsColorWheel'; SetPosition(3, 24, 314, 305); + Anchors := [anLeft,anRight,anTop,anBottom]; Text := 'Color Wheel'; end; @@ -190,7 +379,8 @@ begin begin Name := 'tsColorNames'; SetPosition(3, 24, 314, 305); - Text := 'Predefined'; + Anchors := [anLeft,anRight,anTop,anBottom]; + Text := rsTabPredefined; end; cbColorPalette := TfpgComboBox.Create(tsColorNames); @@ -199,9 +389,12 @@ begin Name := 'cbColorPalette'; SetPosition(8, 24, 299, 22); Anchors := [anLeft,anRight,anTop]; + ExtraHint := ''; FontDesc := '#List'; Hint := ''; + FocusItem := -1; TabOrder := 1; + OnChange:= @NamedColorChanged; end; ColorListBox1 := TfpgColorListBox.Create(tsColorNames); @@ -210,10 +403,11 @@ begin Name := 'ColorListBox1'; SetPosition(8, 72, 299, 224); Anchors := [anLeft,anRight,anTop,anBottom]; - Color := TfpgColor($00FFFF); + Color := TfpgColor($FF00FFFF); FontDesc := '#List'; Hint := ''; TabOrder := 2; + OnChange:= @NamedColorChanged; end; Label1 := TfpgLabel.Create(tsColorNames); @@ -282,10 +476,10 @@ begin OnChange := @RGBChanged; end; - Label3 := TfpgLabel.Create(tsColorWheel); - with Label3 do + lblRed := TfpgLabel.Create(tsColorWheel); + with lblRed do begin - Name := 'Label3'; + Name := 'lblRed'; SetPosition(8, 220, 80, 16); Alignment := taRightJustify; FontDesc := '#Label1'; @@ -293,10 +487,10 @@ begin Text := 'Red'; end; - Label4 := TfpgLabel.Create(tsColorWheel); - with Label4 do + lblGreen := TfpgLabel.Create(tsColorWheel); + with lblGreen do begin - Name := 'Label4'; + Name := 'lblGreen'; SetPosition(8, 248, 80, 16); Alignment := taRightJustify; FontDesc := '#Label1'; @@ -304,10 +498,10 @@ begin Text := 'Green'; end; - Label5 := TfpgLabel.Create(tsColorWheel); - with Label5 do + lblBlue := TfpgLabel.Create(tsColorWheel); + with lblBlue do begin - Name := 'Label5'; + Name := 'lblBlue'; SetPosition(8, 276, 80, 16); Alignment := taRightJustify; FontDesc := '#Label1'; @@ -315,17 +509,61 @@ begin Text := 'Blue'; end; - pnlColorPreview := TfpgBevel.Create(tsColorWheel); - with pnlColorPreview do + btnPicker := TPickerButton.Create(tsColorWheel); + with btnPicker do + begin + Name := 'btnPicker'; + SetPosition(167, 230, 23, 23); + Text := ''; + FontDesc := '#Label1'; + Hint := ''; + ImageMargin := -1; + ImageName := 'stdimg.colpicker'; + FShowHint := True; + TabOrder := 24; + OnColorPicked := @btnColorPicked; + end; + + chkContinuous := TfpgCheckBox.Create(tsColorWheel); + with chkContinuous do begin - Name := 'pnlColorPreview'; - SetPosition(248, 232, 52, 52); + Name := 'chkContinuous'; + SetPosition(167, 258, 130, 20); + FontDesc := '#Label1'; + Hint := ''; + TabOrder := 25; + Text := 'Continuous'; + OnChange := @chkContinuousChanged; + end; + + lblHex := TfpgLabel.Create(self); + with lblHex do + begin + Name := 'lblHex'; + SetPosition(25, 340, 100, 15); + Alignment := taCenter; + FontDesc := '#Label1'; + Hint := ''; + Text := 'Hexadecimal'; + end; + + edHex := TfpgEdit.Create(self); + with edHex do + begin + Name := 'edHex'; + SetPosition(25, 356, 100, 23); + ExtraHint := ''; + FontDesc := '#Label1'; Hint := ''; + TabOrder := 3; + Text := ''; + MaxLength:= 7; end; {@VFD_BODY_END: ColorSelectDialog} {%endregion} + FColorPicking := False; // link colorwheel and valuebar ColorWheel.ValueBar := ValueBar; -- cgit v1.2.3-70-g09d2 From 8d0a14417d1b42f83e5b576f0b9bcc3aa11ae11b Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 20 Dec 2014 01:19:47 +0000 Subject: Updated translation constants for all language files with lastest updates. --- languages/fpgui.af.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.de.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.en.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.es.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.fr.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.it.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.pt.po | 32 ++++++++++++++++++++++++++++++++ languages/fpgui.ru.po | 32 ++++++++++++++++++++++++++++++++ src/corelib/lang_af.inc | 8 ++++++++ src/corelib/lang_de.inc | 8 ++++++++ src/corelib/lang_en.inc | 16 ++++++++-------- src/corelib/lang_es.inc | 8 ++++++++ src/corelib/lang_fr.inc | 8 ++++++++ src/corelib/lang_it.inc | 8 ++++++++ src/corelib/lang_pt.inc | 8 ++++++++ src/corelib/lang_ru.inc | 8 ++++++++ 17 files changed, 352 insertions(+), 8 deletions(-) (limited to 'src/corelib') diff --git a/languages/fpgui.af.po b/languages/fpgui.af.po index 7a6bb628..98ac495d 100644 --- a/languages/fpgui.af.po +++ b/languages/fpgui.af.po @@ -76,6 +76,10 @@ msgstr "Augustus" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Vetdruk" @@ -100,6 +104,10 @@ msgstr "Verander Titel" msgid "Character Map" msgstr "Karakter Kaart" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Sluit" @@ -108,6 +116,10 @@ msgstr "Sluit" msgid "Collection" msgstr "Versameling" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "Instel Boekmerke" @@ -120,6 +132,10 @@ msgstr "Bevestig" msgid "Confirmation" msgstr "Bevestiging" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Kopieer" @@ -280,6 +296,10 @@ msgstr "Vr" msgid "Friday" msgstr "Vrydag" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Groep" @@ -288,6 +308,10 @@ msgstr "Groep" msgid "Help" msgstr "Help" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "Voorskou" @@ -472,6 +500,10 @@ msgstr "Voorskou" msgid "Recently Used" msgstr "Onlangs gebruik" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Vervang" diff --git a/languages/fpgui.de.po b/languages/fpgui.de.po index e079f440..09e4ae1a 100644 --- a/languages/fpgui.de.po +++ b/languages/fpgui.de.po @@ -75,6 +75,10 @@ msgstr "August" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Fett" @@ -99,6 +103,10 @@ msgstr "" msgid "Character Map" msgstr "" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Schließen" @@ -107,6 +115,10 @@ msgstr "Schließen" msgid "Collection" msgstr "Sammlung" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -119,6 +131,10 @@ msgstr "Bestätigen" msgid "Confirmation" msgstr "Bestätigung" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Kopieren" @@ -279,6 +295,10 @@ msgstr "Fre" msgid "Friday" msgstr "Freitag" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Gruppe" @@ -287,6 +307,10 @@ msgstr "Gruppe" msgid "Help" msgstr "Hilfe" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -463,6 +487,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -471,6 +499,10 @@ msgstr "" msgid "Recently Used" msgstr "Zuletzt verwendet" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Ersetzen" diff --git a/languages/fpgui.en.po b/languages/fpgui.en.po index fe4e5c70..20f85e86 100644 --- a/languages/fpgui.en.po +++ b/languages/fpgui.en.po @@ -76,6 +76,10 @@ msgstr "" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "" @@ -100,6 +104,10 @@ msgstr "" msgid "Character Map" msgstr "" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "" @@ -108,6 +116,10 @@ msgstr "" msgid "Collection" msgstr "" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -120,6 +132,10 @@ msgstr "" msgid "Confirmation" msgstr "" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "" @@ -280,6 +296,10 @@ msgstr "" msgid "Friday" msgstr "" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "" @@ -288,6 +308,10 @@ msgstr "" msgid "Help" msgstr "" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -472,6 +500,10 @@ msgstr "" msgid "Recently Used" msgstr "" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "" diff --git a/languages/fpgui.es.po b/languages/fpgui.es.po index c33ce8af..181fa6a3 100644 --- a/languages/fpgui.es.po +++ b/languages/fpgui.es.po @@ -76,6 +76,10 @@ msgstr "" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Negrita" @@ -100,6 +104,10 @@ msgstr "" msgid "Character Map" msgstr "" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Cerrar" @@ -108,6 +116,10 @@ msgstr "Cerrar" msgid "Collection" msgstr "Colección" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -120,6 +132,10 @@ msgstr "Confirmar" msgid "Confirmation" msgstr "Confirmación" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Copiar" @@ -280,6 +296,10 @@ msgstr "Vie" msgid "Friday" msgstr "Viernes" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Grupo" @@ -288,6 +308,10 @@ msgstr "Grupo" msgid "Help" msgstr "Ayuda" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -472,6 +500,10 @@ msgstr "" msgid "Recently Used" msgstr "Usados Recientemente" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Reemplazar" diff --git a/languages/fpgui.fr.po b/languages/fpgui.fr.po index 9bbc641c..303891bb 100644 --- a/languages/fpgui.fr.po +++ b/languages/fpgui.fr.po @@ -76,6 +76,10 @@ msgstr "Août" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Gras" @@ -100,6 +104,10 @@ msgstr "Changer le titre" msgid "Character Map" msgstr "Table de caractères" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Fermer" @@ -108,6 +116,10 @@ msgstr "Fermer" msgid "Collection" msgstr "Collection" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "Configurer les signets" @@ -120,6 +132,10 @@ msgstr "Confirmer" msgid "Confirmation" msgstr "Confirmation" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Copier" @@ -280,6 +296,10 @@ msgstr "Ven" msgid "Friday" msgstr "Vendredi" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Groupe" @@ -288,6 +308,10 @@ msgstr "Groupe" msgid "Help" msgstr "Aide" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "Prévisualisation" @@ -472,6 +500,10 @@ msgstr "Prévisualisation" msgid "Recently Used" msgstr "Récemment utilisé" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Remplacer" diff --git a/languages/fpgui.it.po b/languages/fpgui.it.po index 9231802a..795ed273 100644 --- a/languages/fpgui.it.po +++ b/languages/fpgui.it.po @@ -76,6 +76,10 @@ msgstr "Agosto" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Grassetto" @@ -100,6 +104,10 @@ msgstr "" msgid "Character Map" msgstr "" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Chiudi" @@ -108,6 +116,10 @@ msgstr "Chiudi" msgid "Collection" msgstr "Collezione" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -120,6 +132,10 @@ msgstr "Conferma" msgid "Confirmation" msgstr "Conferma" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Copia" @@ -280,6 +296,10 @@ msgstr "Ven" msgid "Friday" msgstr "Venerdì" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Gruppo" @@ -288,6 +308,10 @@ msgstr "Gruppo" msgid "Help" msgstr "Aiuto" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -472,6 +500,10 @@ msgstr "" msgid "Recently Used" msgstr "Usati Recentemente" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Sostituisci" diff --git a/languages/fpgui.po b/languages/fpgui.po index 4c6a64ef..7ecf17b4 100644 --- a/languages/fpgui.po +++ b/languages/fpgui.po @@ -642,3 +642,35 @@ msgstr "" msgid "of" msgstr "" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + diff --git a/languages/fpgui.pt.po b/languages/fpgui.pt.po index ab5cddb2..e3ea6725 100644 --- a/languages/fpgui.pt.po +++ b/languages/fpgui.pt.po @@ -76,6 +76,10 @@ msgstr "Agosto" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Negrito" @@ -100,6 +104,10 @@ msgstr "Mudar Título" msgid "Character Map" msgstr "Mapa de Caracteres" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Fechar" @@ -108,6 +116,10 @@ msgstr "Fechar" msgid "Collection" msgstr "Coleção" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -120,6 +132,10 @@ msgstr "Confirmar" msgid "Confirmation" msgstr "Confirmação" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Copiar" @@ -280,6 +296,10 @@ msgstr "Sex" msgid "Friday" msgstr "Sexta-feira" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Grupo" @@ -288,6 +308,10 @@ msgstr "Grupo" msgid "Help" msgstr "Ajuda" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -472,6 +500,10 @@ msgstr "" msgid "Recently Used" msgstr "Recentemente Usado" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Substituir" diff --git a/languages/fpgui.ru.po b/languages/fpgui.ru.po index 7cf1cc80..870321e0 100644 --- a/languages/fpgui.ru.po +++ b/languages/fpgui.ru.po @@ -76,6 +76,10 @@ msgstr "Август" msgid "BkSp" msgstr "" +#: fpg_constants:rscolorblue +msgid "Blue" +msgstr "" + #: fpg_constants:rsbold msgid "Bold" msgstr "Жирный" @@ -100,6 +104,10 @@ msgstr "" msgid "Character Map" msgstr "" +#: fpg_constants:rscolorpickerhint +msgid "Click on Picker and maintain click => release to get the color" +msgstr "" + #: fpg_constants:rsclose msgid "Close" msgstr "Закрыть" @@ -108,6 +116,10 @@ msgstr "Закрыть" msgid "Collection" msgstr "Группа" +#: fpg_constants:rstabsheetcolorwheel +msgid "Color Wheel" +msgstr "" + #: fpg_constants:rsconfigurebookmarks msgid "Configure Bookmarks" msgstr "" @@ -120,6 +132,10 @@ msgstr "Подтвердить" msgid "Confirmation" msgstr "Подтверждение" +#: fpg_constants:rscontinuous +msgid "Continuous" +msgstr "" + #: fpg_constants:rscopy msgid "Copy" msgstr "Копировать" @@ -280,6 +296,10 @@ msgstr "Пт" msgid "Friday" msgstr "Пятница" +#: fpg_constants:rscolorgreen +msgid "Green" +msgstr "" + #: fpg_constants:rsfilegroup msgid "Group" msgstr "Группа" @@ -288,6 +308,10 @@ msgstr "Группа" msgid "Help" msgstr "Справка" +#: fpg_constants:rshexadecimal +msgid "Hexadecimal" +msgstr "" + #: fpg_constants:rskeyhome msgid "Home" msgstr "" @@ -464,6 +488,10 @@ msgstr "" msgid "PgUp" msgstr "" +#: fpg_constants:rstabpredefined +msgid "Predefined" +msgstr "" + #: fpg_constants:rsreportpreview msgid "Preview" msgstr "" @@ -472,6 +500,10 @@ msgstr "" msgid "Recently Used" msgstr "Ранее использованные" +#: fpg_constants:rscolorred +msgid "Red" +msgstr "" + #: fpg_constants:rsreplace msgid "Replace" msgstr "Заменить" diff --git a/src/corelib/lang_af.inc b/src/corelib/lang_af.inc index 9a97a50d..173dd6b2 100644 --- a/src/corelib/lang_af.inc +++ b/src/corelib/lang_af.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Eienskape'; rsshortaug = 'Aug'; rslongaug = 'Augustus'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Vetdruk'; rscancel = 'Kanselleer'; rscannotcreatedir = 'Kan nie die lêergids skep nie'; rschange = 'Verander'; rschangetitle = 'Verander Titel'; rscharactermap = 'Karakter Kaart'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Sluit'; rscollection = 'Versameling'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Instel Boekmerke'; rsconfirm = 'Bevestig'; rsconfirmation = 'Bevestiging'; +rscontinuous = 'Continuous'; rscopy = 'Kopieer'; rserrcouldnotopendir = 'Kon nie die lêergids <%s> oop maak nie'; rscreate = 'Skep'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Kenname'; rserrreportfontfilemissing = 'Font lêer" <%s.fnt> is nie gevind nie'; rsshortfri = 'Vr'; rslongfri = 'Vrydag'; +rscolorgreen = 'Green'; rsfilegroup = 'Groep'; rshelp = 'Help'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignoreer'; rserrreportimagefilemissing = 'Beeld-lêer <%s> is vermis'; @@ -117,8 +123,10 @@ rspassword = 'Wagwoord'; rspaste = 'Plak'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Voorskou'; rscollectionrecentlyused = 'Onlangs gebruik'; +rscolorred = 'Red'; rsreplace = 'Vervang'; rsretry = 'Herprobeer'; rskeyright = 'Right'; diff --git a/src/corelib/lang_de.inc b/src/corelib/lang_de.inc index e8fe0a9a..a261926f 100644 --- a/src/corelib/lang_de.inc +++ b/src/corelib/lang_de.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Attribute'; rsshortaug = 'Aug'; rslongaug = 'August'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Fett'; rscancel = 'Abbrechen'; rscannotcreatedir = 'Kann Verzeichnis nicht anlegen'; rschange = 'Ändern'; rschangetitle = 'Change Title'; rscharactermap = 'Character Map'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Schließen'; rscollection = 'Sammlung'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Bestätigen'; rsconfirmation = 'Bestätigung'; +rscontinuous = 'Continuous'; rscopy = 'Kopieren'; rserrcouldnotopendir = 'Konnte Verzeichnis <%> nicht anlegen'; rscreate = 'Anlegen'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font-Aliase'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Fre'; rslongfri = 'Freitag'; +rscolorgreen = 'Green'; rsfilegroup = 'Gruppe'; rshelp = 'Hilfe'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Übergehen'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Passwort'; rspaste = 'Einfügen'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Zuletzt verwendet'; +rscolorred = 'Red'; rsreplace = 'Ersetzen'; rsretry = 'Wiederholen'; rskeyright = 'Right'; diff --git a/src/corelib/lang_en.inc b/src/corelib/lang_en.inc index d262102c..aec26b22 100644 --- a/src/corelib/lang_en.inc +++ b/src/corelib/lang_en.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Attributes'; rsshortaug = 'Aug'; rslongaug = 'August'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Bold'; rscancel = 'Cancel'; rscannotcreatedir = 'Cannot create directory'; rschange = 'Change'; rschangetitle = 'Change Title'; rscharactermap = 'Character Map'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Close'; rscollection = 'Collection'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Confirm'; rsconfirmation = 'Confirmation'; +rscontinuous = 'Continuous'; rscopy = 'Copy'; rserrcouldnotopendir = 'Could not open the directory <%s>'; rscreate = 'Create'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Fri'; rslongfri = 'Friday'; +rscolorgreen = 'Green'; rsfilegroup = 'Group'; rshelp = 'Help'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignore'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Password'; rspaste = 'Paste'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Recently Used'; +rscolorred = 'Red'; rsreplace = 'Replace'; rsretry = 'Retry'; rskeyright = 'Right'; @@ -164,11 +172,3 @@ rsaddnewitem = 'Would you like to add the new item <%s> to the list?'; rsyes = 'Yes'; rsyestoall = 'Yes to All'; rsreportpageof = 'of'; -rsContinuous = 'Continuous'; -rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; -rsColorRed = 'Red'; -rsColorGreen = 'Green'; -rsColorBlue = 'Blue'; -rsHexadecimal = 'Hexadecimal'; -rsTabsheetColorWheel = 'Color Wheel'; -rsTabPredefined = 'Predefined'; diff --git a/src/corelib/lang_es.inc b/src/corelib/lang_es.inc index 780af188..f53ccb76 100644 --- a/src/corelib/lang_es.inc +++ b/src/corelib/lang_es.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Atributos'; rsshortaug = 'Aug'; rslongaug = 'August'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Negrita'; rscancel = 'Cancelar'; rscannotcreatedir = 'No se puede crear la carpeta'; rschange = 'Cambiar'; rschangetitle = 'Change Title'; rscharactermap = 'Character Map'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Cerrar'; rscollection = 'Colección'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Confirmar'; rsconfirmation = 'Confirmación'; +rscontinuous = 'Continuous'; rscopy = 'Copiar'; rserrcouldnotopendir = 'No se puede abrir la carpeta <%s>'; rscreate = 'Create'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Aliases de Fuentes'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Vie'; rslongfri = 'Viernes'; +rscolorgreen = 'Green'; rsfilegroup = 'Grupo'; rshelp = 'Ayuda'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignorar'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Contraseña'; rspaste = 'Pegar'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Usados Recientemente'; +rscolorred = 'Red'; rsreplace = 'Reemplazar'; rsretry = 'Reintentar'; rskeyright = 'Right'; diff --git a/src/corelib/lang_fr.inc b/src/corelib/lang_fr.inc index f111a2ea..0a9a8e21 100644 --- a/src/corelib/lang_fr.inc +++ b/src/corelib/lang_fr.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Attributs'; rsshortaug = 'Aoû'; rslongaug = 'Août'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Gras'; rscancel = 'Annuler'; rscannotcreatedir = 'Impossible de créer le répertoire'; rschange = 'Modifier'; rschangetitle = 'Changer le titre'; rscharactermap = 'Table de caractères'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Fermer'; rscollection = 'Collection'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configurer les signets'; rsconfirm = 'Confirmer'; rsconfirmation = 'Confirmation'; +rscontinuous = 'Continuous'; rscopy = 'Copier'; rserrcouldnotopendir = 'Le répertoire <%s> n''''a pas pu être ouvert'; rscreate = 'Créer'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Alias'; rserrreportfontfilemissing = 'Fichier de police <%s.fnt> non trouvé'; rsshortfri = 'Ven'; rslongfri = 'Vendredi'; +rscolorgreen = 'Green'; rsfilegroup = 'Groupe'; rshelp = 'Aide'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignorer'; rserrreportimagefilemissing = 'Image <%s> introuvable'; @@ -117,8 +123,10 @@ rspassword = 'Mot de passe'; rspaste = 'Coller'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Prévisualisation'; rscollectionrecentlyused = 'Récemment utilisé'; +rscolorred = 'Red'; rsreplace = 'Remplacer'; rsretry = 'Retenter'; rskeyright = 'Right'; diff --git a/src/corelib/lang_it.inc b/src/corelib/lang_it.inc index 2ab860ad..26eb36d8 100644 --- a/src/corelib/lang_it.inc +++ b/src/corelib/lang_it.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Attributi'; rsshortaug = 'Ago'; rslongaug = 'Agosto'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Grassetto'; rscancel = 'Annulla'; rscannotcreatedir = 'Non riesco a creare la cartella'; rschange = 'Cambia'; rschangetitle = 'Change Title'; rscharactermap = 'Character Map'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Chiudi'; rscollection = 'Collezione'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Conferma'; rsconfirmation = 'Conferma'; +rscontinuous = 'Continuous'; rscopy = 'Copia'; rserrcouldnotopendir = 'Impossibile aprire la cartella <%s>'; rscreate = 'Crea'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Ven'; rslongfri = 'Venerdì'; +rscolorgreen = 'Green'; rsfilegroup = 'Gruppo'; rshelp = 'Aiuto'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignora'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Password'; rspaste = 'Incolla'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Usati Recentemente'; +rscolorred = 'Red'; rsreplace = 'Sostituisci'; rsretry = 'Riprova'; rskeyright = 'Right'; diff --git a/src/corelib/lang_pt.inc b/src/corelib/lang_pt.inc index f9c4aa13..fb3dd92b 100644 --- a/src/corelib/lang_pt.inc +++ b/src/corelib/lang_pt.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Atributos'; rsshortaug = 'Ago'; rslongaug = 'Agosto'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Negrito'; rscancel = 'Cancelar'; rscannotcreatedir = 'Não foi possível criar diretório'; rschange = 'Editar'; rschangetitle = 'Mudar Título'; rscharactermap = 'Mapa de Caracteres'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Fechar'; rscollection = 'Coleção'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Confirmar'; rsconfirmation = 'Confirmação'; +rscontinuous = 'Continuous'; rscopy = 'Copiar'; rserrcouldnotopendir = 'Não pode abrir o diretório <%s>'; rscreate = 'Criar'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Font Aliases'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Sex'; rslongfri = 'Sexta-feira'; +rscolorgreen = 'Green'; rsfilegroup = 'Grupo'; rshelp = 'Ajuda'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Ignorar'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Senha'; rspaste = 'Colar'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Recentemente Usado'; +rscolorred = 'Red'; rsreplace = 'Substituir'; rsretry = 'Retentar'; rskeyright = 'Right'; diff --git a/src/corelib/lang_ru.inc b/src/corelib/lang_ru.inc index a6d8a46e..d3f35c2f 100644 --- a/src/corelib/lang_ru.inc +++ b/src/corelib/lang_ru.inc @@ -19,17 +19,21 @@ rsfileattributes = 'Атрибуты'; rsshortaug = 'Авг'; rslongaug = 'Август'; rskeybksp = 'BkSp'; +rscolorblue = 'Blue'; rsbold = 'Жирный'; rscancel = 'Отмена'; rscannotcreatedir = 'Невозможно создать директорию'; rschange = 'Изменить'; rschangetitle = 'Change Title'; rscharactermap = 'Character Map'; +rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Закрыть'; rscollection = 'Группа'; +rstabsheetcolorwheel = 'Color Wheel'; rsconfigurebookmarks = 'Configure Bookmarks'; rsconfirm = 'Подтвердить'; rsconfirmation = 'Подтверждение'; +rscontinuous = 'Continuous'; rscopy = 'Копировать'; rserrcouldnotopendir = 'Невозможно открыть директорию <%s>'; rscreate = 'Создать'; @@ -70,8 +74,10 @@ rscollectionfontaliases = 'Псевдонимы шрифтов'; rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; rsshortfri = 'Пт'; rslongfri = 'Пятница'; +rscolorgreen = 'Green'; rsfilegroup = 'Группа'; rshelp = 'Справка'; +rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Пропустить'; rserrreportimagefilemissing = 'Image <%s> is missing'; @@ -117,8 +123,10 @@ rspassword = 'Пароль'; rspaste = 'Вставить'; rskeypgdn = 'PgDn'; rskeypgup = 'PgUp'; +rstabpredefined = 'Predefined'; rsreportpreview = 'Preview'; rscollectionrecentlyused = 'Ранее использованные'; +rscolorred = 'Red'; rsreplace = 'Заменить'; rsretry = 'Повторить'; rskeyright = 'Right'; -- cgit v1.2.3-70-g09d2 From 65b988eab2511e98f2450755a3d76978434a8983 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Fri, 26 Dec 2014 12:54:08 +0000 Subject: Encapsulate TfpgStyle's font objects Now the TfpgStyle class will free the font objects if they are reassigned No more memory leaks or manually freeing the font objects first. --- src/corelib/fpg_main.pas | 79 ++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 63 insertions(+), 16 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 8bdb33bd..3bdb43e2 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -191,14 +191,26 @@ type will rework this to use a Style Manager like the previous fpGUI. Also support Bitmap based styles for easier theme implementations. } TfpgStyle = class(TObject) + protected + FDefaultFont: TfpgFont; + FFixedFont: TfpgFont; + FMenuAccelFont: TfpgFont; + FMenuDisabledFont: TfpgFont; + FMenuFont: TfpgFont; + procedure SetDefaultFont(AValue: TfpgFont); + procedure SetFixedFont(AValue: TfpgFont); + procedure SetMenuAccelFont(AValue: TfpgFont); + procedure SetMenuDisabledFont(AValue: TfpgFont); + procedure SetMenuFont(AValue: TfpgFont); public - DefaultFont: TfpgFont; - FixedFont: TfpgFont; - MenuFont: TfpgFont; - MenuAccelFont: TfpgFont; - MenuDisabledFont: TfpgFont; constructor Create; virtual; destructor Destroy; override; + { font objects } + property DefaultFont: TfpgFont read FDefaultFont write SetDefaultFont; + property FixedFont: TfpgFont read FFixedFont write SetFixedFont; + property MenuFont: TfpgFont read FMenuFont write SetMenuFont; + property MenuAccelFont: TfpgFont read FMenuAccelFont write SetMenuAccelFont; + property MenuDisabledFont: TfpgFont read FMenuDisabledFont write SetMenuDisabledFont; { General } procedure DrawControlFrame(ACanvas: TfpgCanvas; x, y, w, h: TfpgCoord); virtual; overload; procedure DrawControlFrame(ACanvas: TfpgCanvas; r: TfpgRect); overload; @@ -510,7 +522,7 @@ type end; - TNamedFontItem = class + TNamedFontItem = class(TObject) public FontID: string; FontDesc: string; @@ -2049,6 +2061,41 @@ end; { TfpgStyle } +procedure TfpgStyle.SetDefaultFont(AValue: TfpgFont); +begin + if FDefaultFont = AValue then Exit; + FDefaultFont.Free; + FDefaultFont := AValue; +end; + +procedure TfpgStyle.SetFixedFont(AValue: TfpgFont); +begin + if FFixedFont = AValue then Exit; + FFixedFont.Free; + FFixedFont := AValue; +end; + +procedure TfpgStyle.SetMenuAccelFont(AValue: TfpgFont); +begin + if FMenuAccelFont = AValue then Exit; + FMenuAccelFont.Free; + FMenuAccelFont := AValue; +end; + +procedure TfpgStyle.SetMenuDisabledFont(AValue: TfpgFont); +begin + if FMenuDisabledFont = AValue then Exit; + FMenuDisabledFont.Free; + FMenuDisabledFont := AValue; +end; + +procedure TfpgStyle.SetMenuFont(AValue: TfpgFont); +begin + if FMenuFont = AValue then Exit; + FMenuFont.Free; + FMenuFont := AValue; +end; + constructor TfpgStyle.Create; begin // Setup font aliases @@ -2101,20 +2148,20 @@ begin // Global Font Objects - DefaultFont := fpgGetFont(fpgGetNamedFontDesc('Label1')); - FixedFont := fpgGetFont(fpgGetNamedFontDesc('Edit2')); - MenuFont := fpgGetFont(fpgGetNamedFontDesc('Menu')); - MenuAccelFont := fpgGetFont(fpgGetNamedFontDesc('MenuAccel')); - MenuDisabledFont := fpgGetFont(fpgGetNamedFontDesc('MenuDisabled')); + FDefaultFont := fpgGetFont(fpgGetNamedFontDesc('Label1')); + FFixedFont := fpgGetFont(fpgGetNamedFontDesc('Edit2')); + FMenuFont := fpgGetFont(fpgGetNamedFontDesc('Menu')); + FMenuAccelFont := fpgGetFont(fpgGetNamedFontDesc('MenuAccel')); + FMenuDisabledFont := fpgGetFont(fpgGetNamedFontDesc('MenuDisabled')); end; destructor TfpgStyle.Destroy; begin - DefaultFont.Free; - FixedFont.Free; - MenuFont.Free; - MenuAccelFont.Free; - MenuDisabledFont.Free; + FDefaultFont.Free; + FFixedFont.Free; + FMenuFont.Free; + FMenuAccelFont.Free; + FMenuDisabledFont.Free; inherited Destroy; end; -- cgit v1.2.3-70-g09d2 From def6be738e34d5ff5d4679a96d25c137aac31e31 Mon Sep 17 00:00:00 2001 From: Andrew Haines Date: Sun, 1 Feb 2015 09:37:07 -0500 Subject: Changes to allow modal windows to have owners. --- examples/gui/filedialog/filedialog.lpi | 22 +++++++++++++--------- examples/gui/filedialog/filedialog.lpr | 2 +- examples/gui/modalforms/modalforms.lpi | 22 +++++++++++++--------- examples/gui/modalforms/modalforms.lpr | 5 +++-- src/corelib/fpg_main.pas | 11 +++++++---- src/corelib/fpg_widget.pas | 2 +- src/corelib/x11/fpg_x11.pas | 10 +++++++--- src/gui/fpg_dialogs.pas | 2 ++ src/gui/fpg_form.pas | 2 ++ src/gui/fpg_menu.pas | 1 + 10 files changed, 50 insertions(+), 29 deletions(-) (limited to 'src/corelib') diff --git a/examples/gui/filedialog/filedialog.lpi b/examples/gui/filedialog/filedialog.lpi index 2291e3f1..359ca76e 100644 --- a/examples/gui/filedialog/filedialog.lpi +++ b/examples/gui/filedialog/filedialog.lpi @@ -1,7 +1,7 @@ - + - + @@ -9,11 +9,13 @@ - - + + + + @@ -34,16 +36,18 @@ - - + + + + + + - - + diff --git a/examples/gui/filedialog/filedialog.lpr b/examples/gui/filedialog/filedialog.lpr index e1dca3d7..7ea47bed 100644 --- a/examples/gui/filedialog/filedialog.lpr +++ b/examples/gui/filedialog/filedialog.lpr @@ -118,7 +118,7 @@ procedure TMainForm.btnOpenFileClick(Sender: TObject); var dlg: TfpgFileDialog; begin - dlg := TfpgFileDialog.Create(nil); + dlg := TfpgFileDialog.Create(Self); try // defines 3 filters (All Files, Object Pascal and Lazarus Project) dlg.Filter := 'All Files (*)|*|Object Pascal (*.pas;*.lpr;*.pp)|*.pas;*.lpr;*.pp|Lazarus Project (*.lpi)|*.lpi'; diff --git a/examples/gui/modalforms/modalforms.lpi b/examples/gui/modalforms/modalforms.lpi index 7f6f526a..938d807b 100644 --- a/examples/gui/modalforms/modalforms.lpi +++ b/examples/gui/modalforms/modalforms.lpi @@ -1,20 +1,21 @@ - + - - + + - - - + + + + @@ -35,15 +36,18 @@ - - + + + + + + - diff --git a/examples/gui/modalforms/modalforms.lpr b/examples/gui/modalforms/modalforms.lpr index 99f53ab3..bac0af81 100644 --- a/examples/gui/modalforms/modalforms.lpr +++ b/examples/gui/modalforms/modalforms.lpr @@ -99,7 +99,7 @@ procedure TForm1.btnOpenForm2Click(Sender: TObject); var frm: TForm2; begin - frm := TForm2.Create(nil); + frm := TForm2.Create(Self); try frm.ShowModal; writeln('Form2: This should only appear after the form closes.'); @@ -113,6 +113,7 @@ end; constructor TForm1.Create(AOwner: TComponent); begin inherited Create(AOwner); + Visible:=False; WindowTitle := 'Form1'; Sizeable := False; SetPosition(150, 150, 200, 200); @@ -144,7 +145,7 @@ procedure TMainForm.btnOpenForm1Click(Sender: TObject); var frm: TForm1; begin - frm := TForm1.Create(nil); + frm := TForm1.Create(Self); try frm.ShowModal; writeln('Form1: This should only appear after the form closes.'); diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 2e255923..df9a78e7 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -2015,10 +2015,13 @@ begin FModalForWin := nil; - if (AOwner <> nil) and (AOwner is TfpgWindow) then - FWindowType := wtChild - else - FWindowType := wtWindow; + if not (FWindowType in [wtModalForm, wtPopup]) then + begin + if (AOwner <> nil) and (AOwner is TfpgWindow) then + FWindowType := wtChild + else + FWindowType := wtWindow; + end; FCanvas := CreateCanvas; end; diff --git a/src/corelib/fpg_widget.pas b/src/corelib/fpg_widget.pas index 8fb68a04..1f9bda21 100644 --- a/src/corelib/fpg_widget.pas +++ b/src/corelib/fpg_widget.pas @@ -503,7 +503,7 @@ begin inherited Create(AOwner); - if (AOwner <> nil) and (AOwner is TfpgWidget) then + if (AOwner <> nil) and (AOwner is TfpgWidget) and (not (WindowType in [wtModalForm, wtPopup])) {and not InheritsFrom(TfpgForm)} then begin Parent := TfpgWidget(AOwner); FTabOrder := AOwner.ComponentCount; diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index bc9c9dbd..bae72c40 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -2271,11 +2271,13 @@ var WMHints: PXWMHints; prop: TAtom; mwmhints: TMWMHints; + IsToplevel: Boolean; begin if HandleIsValid then Exit; //==> - if AParent <> nil then + IsToplevel := (AParent = nil) or (FWindowType in [wtModalForm, wtPopup]); + if not IsToplevel then pwh := TfpgX11Window(AParent).WinHandle else pwh := xapplication.RootWindow; @@ -2314,7 +2316,7 @@ begin FWinHandle := wh; FBackupWinHandle := wh; - if AParent = nil then // is a toplevel window + if IsToplevel then // is a toplevel window begin { setup a window icon } IconPixMap := XCreateBitmapFromData(fpgApplication.Display, FWinHandle, @@ -2400,11 +2402,13 @@ begin // for modal windows, this is necessary if FWindowType = wtModalForm then begin - if Parent = nil then + if IsToplevel then begin lmwh := 0; if fpgApplication.PrevModalForm <> nil then lmwh := TfpgX11Window(fpgApplication.PrevModalForm).WinHandle + {else if AParent <> nil then + lmwh := TfpgX11Window(AParent).WinHandle} { 2011-03-24: Graeme Geldenhuys I commented code this code because it caused more problems that it solved when multiple modal dialogs or prompts are shown in succession. diff --git a/src/gui/fpg_dialogs.pas b/src/gui/fpg_dialogs.pas index 8f3639e6..99c5b208 100644 --- a/src/gui/fpg_dialogs.pas +++ b/src/gui/fpg_dialogs.pas @@ -577,6 +577,8 @@ end; constructor TfpgBaseDialog.Create(AOwner: TComponent); begin + // WindowType must be set before inherited or our parent property will be set + WindowType:=wtModalForm; inherited Create(AOwner); Width := 500; Height := 400; diff --git a/src/gui/fpg_form.pas b/src/gui/fpg_form.pas index 7d5fe042..c80a1e53 100644 --- a/src/gui/fpg_form.pas +++ b/src/gui/fpg_form.pas @@ -342,6 +342,8 @@ function TfpgBaseForm.ShowModal: TfpgModalResult; var lCloseAction: TCloseAction; begin + if HasHandle and (FWindowType <> wtModalForm) then + HandleHide; FWindowType := wtModalForm; fpgApplication.PushModalForm(self); ModalResult := mrNone; diff --git a/src/gui/fpg_menu.pas b/src/gui/fpg_menu.pas index ee345927..3310db48 100644 --- a/src/gui/fpg_menu.pas +++ b/src/gui/fpg_menu.pas @@ -1341,6 +1341,7 @@ end; constructor TfpgPopupMenu.Create(AOwner: TComponent); begin + FWindowType:=wtPopup; inherited Create(AOwner); FMargin := 3; FTextMargin := 3; -- cgit v1.2.3-70-g09d2 From b69b5d4abc3979d1d88ba09722a40e4bd2bf85ff Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 12 Feb 2015 10:01:06 +0000 Subject: Version bump --- docs/manifest.xml | 4 ++-- docview/src/docview.rc | 8 ++++---- src/VERSION_FILE.inc | 2 +- src/corelib/gdi/fpgui_toolkit.lpk | 2 +- src/corelib/x11/fpgui_toolkit.lpk | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) (limited to 'src/corelib') diff --git a/docs/manifest.xml b/docs/manifest.xml index fc0d48a0..d0abae93 100644 --- a/docs/manifest.xml +++ b/docs/manifest.xml @@ -1,8 +1,8 @@ - - fpgui-1.3.0-0.zip + + fpgui-1.4.0-0.zip Graeme Geldenhuys Modified LGPL graemeg@gmail.com diff --git a/docview/src/docview.rc b/docview/src/docview.rc index 24dc3cfe..35c0ade5 100644 --- a/docview/src/docview.rc +++ b/docview/src/docview.rc @@ -1,8 +1,8 @@ MAINICON ICON "../images/docview-48x48.ico" 1 VERSIONINFO -FILEVERSION 1, 3, 0, 0 -PRODUCTVERSION 1, 3, 0, 0 +FILEVERSION 1, 4, 0, 0 +PRODUCTVERSION 1, 4, 0, 0 FILEFLAGSMASK 0 FILEOS 0x40000 FILETYPE 1 @@ -13,12 +13,12 @@ FILETYPE 1 { VALUE "CompanyName", "fpGUI Toolkit" VALUE "FileDescription", "fpGUI's INF Documentation Viewer" - VALUE "FileVersion", "1.3.0" + VALUE "FileVersion", "1.4.0" VALUE "InternalName", "docview" VALUE "LegalCopyright", "GNU Public License" VALUE "OriginalFilename", "docview" VALUE "ProductName", "fpGUI Toolkit" - VALUE "ProductVersion", "1.3.0" + VALUE "ProductVersion", "1.4.0" } } BLOCK "VarFileInfo" diff --git a/src/VERSION_FILE.inc b/src/VERSION_FILE.inc index 518bafb7..bac1d842 100644 --- a/src/VERSION_FILE.inc +++ b/src/VERSION_FILE.inc @@ -1 +1 @@ -FPGUI_VERSION = '1.3'; +FPGUI_VERSION = '1.4'; diff --git a/src/corelib/gdi/fpgui_toolkit.lpk b/src/corelib/gdi/fpgui_toolkit.lpk index 487a5e06..3566dc09 100644 --- a/src/corelib/gdi/fpgui_toolkit.lpk +++ b/src/corelib/gdi/fpgui_toolkit.lpk @@ -30,7 +30,7 @@ - + diff --git a/src/corelib/x11/fpgui_toolkit.lpk b/src/corelib/x11/fpgui_toolkit.lpk index e59e4617..f53dd62e 100644 --- a/src/corelib/x11/fpgui_toolkit.lpk +++ b/src/corelib/x11/fpgui_toolkit.lpk @@ -28,7 +28,7 @@ - + -- cgit v1.2.3-70-g09d2 From b4672388778f4c89a5cd05d87bb8818fa6d31592 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 19 Feb 2015 00:57:31 +0000 Subject: Removed fpgApplication.DefaultFont We really don't need yet another "default font". All references to fpgApplication.DefaultFont has been changed to fpgStyle.DefaultFont - as it should be. --- docview/components/richtext/CanvasFontManager.pas | 4 ++-- docview/components/richtext/RichTextStyleUnit.pas | 2 +- extras/contributed/nicegrid/fpg_nicegrid.pas | 2 +- src/corelib/fpg_base.pas | 2 +- src/corelib/fpg_main.pas | 5 ----- src/gui/fpg_editbtn.pas | 8 ++++---- 6 files changed, 9 insertions(+), 14 deletions(-) (limited to 'src/corelib') diff --git a/docview/components/richtext/CanvasFontManager.pas b/docview/components/richtext/CanvasFontManager.pas index edeb8cb9..e650141b 100644 --- a/docview/components/richtext/CanvasFontManager.pas +++ b/docview/components/richtext/CanvasFontManager.pas @@ -222,7 +222,7 @@ begin // if nothing found, use default font of fpGUI if FontDesc = '' then - FontDesc := fpgApplication.DefaultFont.FontDesc; + FontDesc := fpgStyle.DefaultFont.FontDesc; end; @@ -242,7 +242,7 @@ destructor TCanvasFontManager.Destroy; var i: Integer; begin - FCanvas.Font := fpgApplication.DefaultFont; + FCanvas.Font := fpgStyle.DefaultFont; FDefaultFont.Free; for i := 0 to FFontCache.Count-1 do diff --git a/docview/components/richtext/RichTextStyleUnit.pas b/docview/components/richtext/RichTextStyleUnit.pas index e0cc3b62..f6582802 100644 --- a/docview/components/richtext/RichTextStyleUnit.pas +++ b/docview/components/richtext/RichTextStyleUnit.pas @@ -470,7 +470,7 @@ end; Procedure TRichTextSettings.AssignFont(var AFont: TfpgFont; NewFont: TfpgFont ); begin If NewFont = Nil Then - NewFont := fpgApplication.DefaultFont; + NewFont := fpgStyle.DefaultFont; if FontSame( NewFont, AFont ) then begin diff --git a/extras/contributed/nicegrid/fpg_nicegrid.pas b/extras/contributed/nicegrid/fpg_nicegrid.pas index a65448fb..233f9962 100644 --- a/extras/contributed/nicegrid/fpg_nicegrid.pas +++ b/extras/contributed/nicegrid/fpg_nicegrid.pas @@ -3417,7 +3417,7 @@ end; constructor TfpgMergeCell.Create; begin inherited Create; - Font := fpgApplication.DefaultFont.FontDesc; + Font := fpgStyle.DefaultFont.FontDesc; end; destructor TfpgMergeCell.Destroy; diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index e6e3ab7e..365ca20a 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1864,7 +1864,7 @@ begin SetColor(clText1); SetTextColor(clText1); - SetFont(fpgApplication.DefaultFont); + SetFont(fpgStyle.DefaultFont); SetLineStyle(0, lsSolid); FBeginDrawCount := 0; diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index d74a9be4..1bdbff2e 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -275,7 +275,6 @@ type FDisplayParams: string; FScreenWidth: integer; FScreenHeight: integer; - FDefaultFont: TfpgFont; FFontResList: TList; FMessageHookList: TFPList; procedure FreeFontRes(afontres: TfpgFontResource); @@ -297,7 +296,6 @@ type procedure SetMessageHook(AWidget: TObject; const AMsgCode: integer; AListener: TObject); procedure ShowException(E: Exception); procedure UnsetMessageHook(AWidget: TObject; const AMsgCode: integer; AListener: TObject); - property DefaultFont: TfpgFont read FDefaultFont; property HintPause: Integer read FHintPause write SetHintPause; property HintWindow: TfpgWindow read FHintWindow; property ScreenWidth: integer read FScreenWidth; @@ -1384,8 +1382,6 @@ begin TfpgTimer(fpgTimers[i]).Free; fpgTimers.Free; - FDefaultFont.Free; - for i := FFontResList.Count-1 downto 0 do begin TfpgFontResource(FFontResList[i]).Free; @@ -1671,7 +1667,6 @@ end; procedure TfpgApplication.InternalInit; begin - FDefaultFont := GetFont(FPG_DEFAULT_FONT_DESC); fpgInitTimers; fpgNamedFonts := TList.Create; diff --git a/src/gui/fpg_editbtn.pas b/src/gui/fpg_editbtn.pas index 65417efd..6c871806 100644 --- a/src/gui/fpg_editbtn.pas +++ b/src/gui/fpg_editbtn.pas @@ -183,7 +183,7 @@ begin Canvas.Clear(clBoxColor); fpgStyle.DrawControlFrame(Canvas, 0, 0, Width - Height, Height); fpgStyle.DrawButtonFace(Canvas, Width - Height, 0, Height, Height, [btfIsEmbedded]); - Canvas.SetFont(fpgApplication.DefaultFont); + Canvas.SetFont(fpgStyle.DefaultFont); if Text <> '' then begin Canvas.TextColor := clText3; @@ -354,7 +354,7 @@ begin Canvas.Clear(clBoxColor); fpgStyle.DrawControlFrame(Canvas, 0, 0, Width - Height, Height); fpgStyle.DrawButtonFace(Canvas, Width - Height, 0, Height, Height, [btfIsEmbedded]); - Canvas.SetFont(fpgApplication.DefaultFont); + Canvas.SetFont(fpgStyle.DefaultFont); if Filename <> '' then begin Canvas.TextColor := clText3; @@ -439,7 +439,7 @@ begin Canvas.Clear(clBoxColor); fpgStyle.DrawControlFrame(Canvas, 0, 0, Width - Height, Height); fpgStyle.DrawButtonFace(Canvas, Width - Height, 0, Height, Height, [btfIsEmbedded]); - Canvas.SetFont(fpgApplication.DefaultFont); + Canvas.SetFont(fpgStyle.DefaultFont); if Directory <> '' then begin Canvas.TextColor := clText3; @@ -502,7 +502,7 @@ begin fpgStyle.DrawControlFrame(Canvas, 0, 0, Width - Height, Height); fpgStyle.DrawButtonFace(Canvas, Width - Height, 0, Height, Height, [btfIsEmbedded]); Canvas.TextColor := clShadow1; - Canvas.SetFont(fpgApplication.DefaultFont); + Canvas.SetFont(fpgStyle.DefaultFont); Canvas.DrawText(0, 0, Width - Height, Height, ClassName, [txtHCenter, txtVCenter]); img := fpgImages.GetImage('stdimg.font'); // don't free the img instance - we only got a reference if img <> nil then -- cgit v1.2.3-70-g09d2 From 58fbaf95ad23b3b3393d172cbee6cc0eea5611d9 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Thu, 19 Feb 2015 00:58:10 +0000 Subject: Minor optimisation to CanvasBase.SetFont() --- src/corelib/fpg_base.pas | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 365ca20a..4c107e93 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1847,6 +1847,8 @@ procedure TfpgCanvasBase.SetFont(AFont: TfpgFontBase); begin if AFont = nil then exit; + if FFont = AFont then + exit; FFont := AFont; DoSetFontRes(AFont.FFontRes); end; -- cgit v1.2.3-70-g09d2 From 7a273fb571e35eb8edc3ca6e5d54d070db962012 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 28 Feb 2015 17:49:08 +0000 Subject: bug: Fixes GDI issue where if font name contain a @ or - symbol the couldn't be selected For example: '@Terminal-10' did not work. Neither did 'VNI-Bamas-10'. The tokenizer was improved to look-ahead or accept extra characters like the @ symbol. --- src/corelib/gdi/fpg_gdi.pas | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) (limited to 'src/corelib') diff --git a/src/corelib/gdi/fpg_gdi.pas b/src/corelib/gdi/fpg_gdi.pas index b24b04be..a1d314f6 100644 --- a/src/corelib/gdi/fpg_gdi.pas +++ b/src/corelib/gdi/fpg_gdi.pas @@ -2621,13 +2621,31 @@ var Result := c; end; + function LookAhead: char; + var + i: integer; + lc: char; + begin + i := cp+1; + if i > length(desc) then + lc := #0 + else + lc := desc[i]; + result := lc; + end; + procedure NextToken; begin token := ''; - while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '0'..'9']) do + while (c <> #0) and (c in [' ', 'a'..'z', 'A'..'Z', '_', '@', '0'..'9']) do begin token := token + c; NextC; + if (c = '-') and (LookAhead in [' ', 'a'..'z', 'A'..'Z', '_']) then + begin + token := token + c; + NextC; + end; end; end; -- cgit v1.2.3-70-g09d2 From fca9ec960fff4ce351a11a80f005372562004735 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 9 Mar 2015 19:24:44 +0000 Subject: Adds new functions to fpg_utils * fpgGitBit() - queries bit values * fpgSetBit() - sets bit values * fpgIntToBin() - outputs bit valuse as a string --- src/corelib/fpg_utils.pas | 37 +++++++++++++++++++++++++++++++------ 1 file changed, 31 insertions(+), 6 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_utils.pas b/src/corelib/fpg_utils.pas index 9a135d73..df68a050 100644 --- a/src/corelib/fpg_utils.pas +++ b/src/corelib/fpg_utils.pas @@ -39,13 +39,14 @@ function fpgFileSize(const AFilename: TfpgString): integer; function fpgAddTrailingValue(const ALine, AValue: TfpgString; ADuplicates: Boolean = True): TfpgString; function fpgAppendPathDelim(const Path: TfpgString): TfpgString; function fpgHasSubDirs(const Dir: TfpgString; AShowHidden: Boolean): Boolean; -function fpgAllFilesMask: TfpgString; +function fpgAllFilesMask: TfpgString; deprecated; function fpgConvertLineEndings(const s: TfpgString): TfpgString; function fpgGetToolkitConfigDir: TfpgString; -{ This is so that when we support LTR and RTL languages, the colon will be - added at the correct place. } function fpgAddColon(const AText: TfpgString): TfpgString; -function fpgIsBitSet(const AData: integer; const AIndex: integer): boolean; +function fpgIsBitSet(const AData: integer; const AIndex: integer): boolean; deprecated; +function fpgGetBit(const AData: LongInt; ABit: Longint): boolean; inline; +procedure fpgSetBit(var AData: Longint; ABit: Longint; const AValue: boolean); inline; +function fpgIntToBin(AValue: uint64; ADigits: byte=64): string; // RTL wrapper filesystem functions with platform independant encoding @@ -214,7 +215,6 @@ begin Result := Path; end; -{function fpgHasSubDirs returns True if the directory passed has subdirectories} function fpgHasSubDirs(const Dir: TfpgString; AShowHidden: Boolean): Boolean; var FileInfo: TSearchRec; @@ -225,7 +225,7 @@ begin if Dir <> '' then begin FCurrentDir := fpgAppendPathDelim(Dir); - FCurrentDir := FCurrentDir + fpgAllFilesMask; + FCurrentDir := FCurrentDir + AllFilesMask; try if fpgFindFirst(FCurrentDir, faAnyFile or $00000080, FileInfo) = 0 then repeat @@ -299,6 +299,31 @@ begin Result := (AData and (1 shl AIndex) <> 0); end; +function fpgGetBit(const AData: LongInt; ABit: Longint): boolean; +begin + Result := (AData and (1 shl ABit) <> 0); +end; + +procedure fpgSetBit(var AData: Longint; ABit: Longint; const AValue: boolean); +begin + if AValue <> fpgGetBit(AData, ABit) then + AData := AData xor (1 shl ABit); +end; + +function fpgIntToBin(AValue: uint64; ADigits: byte=64): string; +begin + SetLength(Result, ADigits); + while ADigits > 0 do + begin + if odd(AValue) then + Result[ADigits] := '1' + else + Result[ADigits] := '0'; + AValue := AValue shr 1; + dec(ADigits); + end; +end; + end. -- cgit v1.2.3-70-g09d2 From e2895e6527939b6770180e5f9644fa71fa878058 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 9 Mar 2015 19:25:13 +0000 Subject: Replace deprecated functions with alternatives --- src/corelib/x11/fpg_x11.pas | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/x11/fpg_x11.pas b/src/corelib/x11/fpg_x11.pas index 381b81a3..ff6e7272 100644 --- a/src/corelib/x11/fpg_x11.pas +++ b/src/corelib/x11/fpg_x11.pas @@ -1071,19 +1071,19 @@ begin {$IFDEF DNDDEBUG} writeln(Format(' ver(%d) check-XdndTypeList(%s) data=%xh,%d,%d,%d,%d', [ FDNDVersion, - BoolToStr(fpgIsBitSet(ev.xclient.data.l[1], 0), True), + BoolToStr(fpgGetBit(ev.xclient.data.l[1], 0), True), ev.xclient.data.l[0], ev.xclient.data.l[1], ev.xclient.data.l[2], ev.xclient.data.l[3], ev.xclient.data.l[4] ])); writeln(Format(' * We will be using XDND v%d protocol *', [FDNDVersion])); - if fpgIsBitSet(ev.xclient.data.l[1], 0) then + if fpgGetBit(ev.xclient.data.l[1], 0) then writeln(' ** We need to fetch XdndTypeList (>3 types)'); {$ENDIF} // read typelist - if fpgIsBitSet(ev.xclient.data.l[1], 0) then + if fpgGetBit(ev.xclient.data.l[1], 0) then begin // now fetch the data XGetWindowProperty(Display, FSrcWinHandle, -- cgit v1.2.3-70-g09d2 From 1fdff5e9409d875785ed11e35f4b11bfb3f9ea54 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Tue, 10 Mar 2015 17:44:08 +0000 Subject: Removes deprecated TFPColor usage - That includes any color conversion functions - Projects using TFPColor --- prototypes/fpgui2/tests/frm_threedee.pas | 12 ++++++------ src/corelib/fpg_base.pas | 28 +--------------------------- src/corelib/fpg_imgutils.pas | 8 ++++---- src/corelib/fpg_main.pas | 11 +---------- src/gui/colordialog.inc | 10 +++++----- src/gui/fpg_colormapping.pas | 10 +++++----- src/gui/fpg_toggle.pas | 3 +-- 7 files changed, 23 insertions(+), 59 deletions(-) (limited to 'src/corelib') diff --git a/prototypes/fpgui2/tests/frm_threedee.pas b/prototypes/fpgui2/tests/frm_threedee.pas index 5f6548ed..836de485 100644 --- a/prototypes/fpgui2/tests/frm_threedee.pas +++ b/prototypes/fpgui2/tests/frm_threedee.pas @@ -119,18 +119,18 @@ Const procedure FillRectGradient(Canvas: TfpgCanvas; X, Y, W, H: TfpgCoord; Strip: Integer; Astart, Astop: TfpgColor); var - RGBStart: TFPColor; - RGBStop: TFPColor; + RGBStart: TRGBTriple; + RGBStop: TRGBTriple; RDiff, GDiff, BDiff: Integer; count: Integer; i: Integer; - newcolor: TFPColor; + newcolor: TRGBTriple; Hx, Hy: TfpgCoord; // Coordinates for Horizontal Lines Vx, Vy: TfpgCoord; // Coordinates for Vertical Lines avgcolor: TfpgColor; begin - RGBStart := fpgColorToFPColor(fpgColorToRGB(AStart)); - RGBStop := fpgColorToFPColor(fpgColorToRGB(AStop)); + RGBStart := fpgColorToRGBTriple(fpgColorToRGB(AStart)); + RGBStop := fpgColorToRGBTriple(fpgColorToRGB(AStop)); count := Strip; Hx := X; @@ -151,7 +151,7 @@ begin newcolor.Blue := RGBStart.Blue + (i * BDiff) div count; Canvas.SetLineStyle(1, lsSolid); - Canvas.SetColor(FPColorTofpgColor(newcolor)); + Canvas.SetColor(RGBTripleTofpgColor(newcolor)); Canvas.DrawLine(Hx, Hy, W+2, Hy); // Horizontal Line Canvas.DrawLine(Vx, Vy, Vx, H+2); // Vertical Line // next Horizontal Line: one pixel lower, one pixel shorter on the left diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 4c107e93..4138dad9 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -49,14 +49,6 @@ type Alpha: byte; end; - // Same declaration as in FPImage unit, but we don't use FPImage yet, so declare it here - TFPColor = record - Red: byte; - Green: byte; - Blue: byte; - Alpha: byte; - end deprecated; - TWindowType = (wtChild, wtWindow, wtModalForm, wtPopup); TWindowAttribute = (waSizeable, waAutoPos, waScreenCenterPos, waStayOnTop, @@ -766,9 +758,7 @@ function CheckClipboardKey(AKey: Word; AShiftstate: TShiftState): TClipboardKe { Color } function fpgColorToRGBTriple(const AColor: TfpgColor): TRGBTriple; -function fpgColorToFPColor(const AColor: TfpgColor): TFPColor; deprecated; function RGBTripleTofpgColor(const AColor: TRGBTriple): TfpgColor; -function FPColorTofpgColor(const AColor: TFPColor): TfpgColor; deprecated; function fpgGetRed(const AColor: TfpgColor): byte; function fpgGetGreen(const AColor: TfpgColor): byte; function fpgGetBlue(const AColor: TfpgColor): byte; @@ -997,27 +987,11 @@ begin end end; -function fpgColorToFPColor(const AColor: TfpgColor): TFPColor; deprecated; -begin - with Result do - begin - Red := fpgGetRed(AColor); - Green := fpgGetGreen(AColor); - Blue := fpgGetBlue(AColor); - Alpha := fpgGetAlpha(AColor); - end -end; - function RGBTripleTofpgColor(const AColor: TRGBTriple): TfpgColor; begin Result := AColor.Blue or (AColor.Green shl 8) or (AColor.Red shl 16) or (AColor.Alpha shl 24); end; -function FPColorTofpgColor(const AColor: TFPColor): TfpgColor; deprecated; -begin - Result := AColor.Blue or (AColor.Green shl 8) or (AColor.Red shl 16) or (AColor.Alpha shl 24); -end; - function fpgGetRed(const AColor: TfpgColor): byte; var c: TfpgColor; diff --git a/src/corelib/fpg_imgutils.pas b/src/corelib/fpg_imgutils.pas index 97f33fb7..79892f5b 100644 --- a/src/corelib/fpg_imgutils.pas +++ b/src/corelib/fpg_imgutils.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -78,11 +78,11 @@ end; function fpgCalculateGray(const AFrom: TfpgColor; const ABrighter: boolean = False; const APercent: integer = 0): TfpgColor; var g: integer; - rgb: TFPColor; + rgb: TRGBTriple; begin with GrayConvMatrix do begin - rgb := fpgColorToFPColor(AFrom); + rgb := fpgColorToRGBTriple(AFrom); g := round(red*rgb.red + green*rgb.green + blue*rgb.blue); if ABrighter then @@ -97,7 +97,7 @@ begin rgb.Green := g; rgb.Blue := g; end; - Result := FPColorTofpgColor(rgb); + Result := RGBTripleTofpgColor(rgb); end; diff --git a/src/corelib/fpg_main.pas b/src/corelib/fpg_main.pas index 1bdbff2e..1f063cb5 100644 --- a/src/corelib/fpg_main.pas +++ b/src/corelib/fpg_main.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -467,7 +467,6 @@ operator - (const APoint: TfpgPoint; i: Integer) p: TfpgPoint; operator - (const ASize: TfpgSize; const APoint: TPoint) s: TfpgSize; operator - (const ASize: TfpgSize; const APoint: TfpgPoint) s: TfpgSize; operator - (const ASize: TfpgSize; i: Integer) s: TfpgSize; -operator = (const AColor1, AColor2: TFPColor) b: Boolean; deprecated; operator = (const AColor1, AColor2: TRGBTriple) b: Boolean; @@ -1181,14 +1180,6 @@ begin s.h := ASize.h - i; end; -operator = (const AColor1, AColor2: TFPColor) b: Boolean; -begin - b := (AColor1.Red = AColor2.Red) - and (AColor1.Green = AColor2.Green) - and (AColor1.Blue = AColor2.Blue) - and (AColor1.Alpha = AColor2.Alpha); -end; - operator = (const AColor1, AColor2: TRGBTriple) b: Boolean; begin b := (AColor1.Red = AColor2.Red) diff --git a/src/gui/colordialog.inc b/src/gui/colordialog.inc index 0ef8c3bb..763c8b7f 100644 --- a/src/gui/colordialog.inc +++ b/src/gui/colordialog.inc @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -265,14 +265,14 @@ end; procedure TfpgColorSelectDialog.RGBChanged(Sender: TObject); var - rgb: TFPColor; + rgb: TRGBTriple; c: TfpgColor; begin FViaRGB := True; // prevent recursive updates rgb.Red := edR.Value; rgb.Green := edG.Value; rgb.Blue := edB.Value; - c := FPColorTofpgColor(rgb); + c := RGBTripleTofpgColor(rgb); ColorWheel.SetSelectedColor(c); // This will trigger ColorWheel and ValueBar OnChange event FViaRGB := False; // keep text readable based on background color @@ -286,11 +286,11 @@ end; procedure TfpgColorSelectDialog.UpdateRGBComponents; var - rgb: TFPColor; + rgb: TRGBTriple; c: TfpgColor; begin c := ValueBar.SelectedColor; - rgb := fpgColorToFPColor(c); + rgb := fpgColorToRGBTriple(c); edR.Value := rgb.Red; edG.Value := rgb.Green; edB.Value := rgb.Blue; diff --git a/src/gui/fpg_colormapping.pas b/src/gui/fpg_colormapping.pas index b915bd93..a22b949e 100644 --- a/src/gui/fpg_colormapping.pas +++ b/src/gui/fpg_colormapping.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2010 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -45,9 +45,9 @@ var r, g, b: longint; hi, lo: longint; d: longint; - rgb: TFPColor; + rgb: TRGBTriple; begin - rgb := fpgColorToFPColor(C); + rgb := fpgColorToRGBTriple(C); r := rgb.Red; g := rgb.Green; b := rgb.Blue; @@ -78,7 +78,7 @@ end; function HSVToRGB(const H: longint; const S, V: double): TfpgColor; var r, g, b: longint; - rgb: TFPColor; + rgb: TRGBTriple; begin if (h < 0) or (h > 1535) or (S < 0) or (S > 1) or (V < 0) or (V > 1) then begin @@ -130,7 +130,7 @@ begin rgb.Red := r; rgb.Green := g; rgb.Blue := b; - Result := FPColorTofpgColor(rgb); + Result := RGBTripleTofpgColor(rgb); end; diff --git a/src/gui/fpg_toggle.pas b/src/gui/fpg_toggle.pas index b35ca661..9cdfe3af 100644 --- a/src/gui/fpg_toggle.pas +++ b/src/gui/fpg_toggle.pas @@ -1,7 +1,7 @@ { fpGUI - Free Pascal GUI Toolkit - Copyright (C) 2006 - 2014 See the file AUTHORS.txt, included in this + Copyright (C) 2006 - 2015 See the file AUTHORS.txt, included in this distribution, for details of the copyright. See the file COPYING.modifiedLGPL, included in this distribution, @@ -158,7 +158,6 @@ end; procedure TfpgToggle.HandlePaint; var ToggleText: TfpgString; - PaintColor: TFPColor; TextEnabled: TfpgTextFlags; BvlWdth: TfpgCoord; ButtonRect: TfpgRect; -- cgit v1.2.3-70-g09d2 From d72f3b73f6f55e77eb69cdf55b5771edaa1d0b15 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Wed, 18 Mar 2015 09:34:22 +0000 Subject: Two new form helper functions added to fpgApplication - GetFormByClassName() - GetFormByName() --- src/corelib/fpg_base.pas | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index 4138dad9..d2d2e868 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -567,6 +567,8 @@ type function PrevModalForm: TfpgWindowBase; function RemoveWindowFromModalStack(AForm: TfpgWindowBase): Integer; procedure CreateForm(InstanceClass: TComponentClass; out Reference); + function GetFormByClassName(const AClassName: string): TfpgWindowBase; + function GetFormByName(const AName: string): TfpgWindowBase; function GetScreenWidth: TfpgCoord; virtual; abstract; function GetScreenHeight: TfpgCoord; virtual; abstract; function GetScreenPixelColor(APos: TPoint): TfpgColor; virtual; abstract; @@ -2500,6 +2502,36 @@ begin end; end; +function TfpgApplicationBase.GetFormByClassName(const AClassName: string): TfpgWindowBase; +var + i: integer; +begin + Result := nil; + for i := 0 to FormCount-1 do + begin + if Forms[i].ClassName = AClassName then + begin + Result := Forms[i]; + break; + end; + end; +end; + +function TfpgApplicationBase.GetFormByName(const AName: string): TfpgWindowBase; +var + i: integer; +begin + Result := nil; + for i := 0 to FormCount-1 do + begin + if Forms[i].Name = AName then + begin + Result := Forms[i]; + break; + end; + end; +end; + procedure TfpgApplicationBase.Terminate; var i: integer; -- cgit v1.2.3-70-g09d2 From dbc10f77a1da95beaf0f850c9d475804282e225f Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Sat, 4 Apr 2015 15:40:00 +0100 Subject: Russion language file update --- src/corelib/lang_ru.inc | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/lang_ru.inc b/src/corelib/lang_ru.inc index d3f35c2f..ce5b753e 100644 --- a/src/corelib/lang_ru.inc +++ b/src/corelib/lang_ru.inc @@ -7,7 +7,7 @@ rserrnotassigned = 'Значение <%s> не определено'; rsnewitemdetected = 'Обнаружен новый элемент'; rsabort = 'Прервать'; rsabout = 'Информация о %s'; -rsaddcurrentdirectory = 'Add current directory'; +rsaddcurrentdirectory = 'Добавить текущую директорию'; rsall = 'Все'; rsallfiles = 'Все файлы'; rscollectionallfonts = 'Все шрифты'; @@ -19,18 +19,18 @@ rsfileattributes = 'Атрибуты'; rsshortaug = 'Авг'; rslongaug = 'Август'; rskeybksp = 'BkSp'; -rscolorblue = 'Blue'; +rscolorblue = 'Синий'; rsbold = 'Жирный'; rscancel = 'Отмена'; rscannotcreatedir = 'Невозможно создать директорию'; rschange = 'Изменить'; -rschangetitle = 'Change Title'; +rschangetitle = 'Изменить Заголовок'; rscharactermap = 'Character Map'; rscolorpickerhint = 'Click on Picker and maintain click => release to get the color'; rsclose = 'Закрыть'; rscollection = 'Группа'; rstabsheetcolorwheel = 'Color Wheel'; -rsconfigurebookmarks = 'Configure Bookmarks'; +rsconfigurebookmarks = 'Настроить Закладки'; rsconfirm = 'Подтвердить'; rsconfirmation = 'Подтверждение'; rscontinuous = 'Continuous'; @@ -47,7 +47,7 @@ rslongdec = 'Декабрь'; rskeydel = 'Del'; rsdelete = 'Удалить'; rsdirectories = 'Директории'; -rsdirectory = 'Directory'; +rsdirectory = 'Директория'; rskeydown = 'Down'; rsdrive = 'Диск'; rsedit = 'Редактировать'; @@ -71,7 +71,7 @@ rsfiles = 'Файлы'; rsfind = 'Найти'; rscollectionfixedwidth = 'Моноширинные'; rscollectionfontaliases = 'Псевдонимы шрифтов'; -rserrreportfontfilemissing = 'Font file <%s.fnt> not found'; +rserrreportfontfilemissing = 'Файл шрифта <%s.fnt> не найден'; rsshortfri = 'Пт'; rslongfri = 'Пятница'; rscolorgreen = 'Green'; @@ -80,7 +80,7 @@ rshelp = 'Справка'; rshexadecimal = 'Hexadecimal'; rskeyhome = 'Home'; rsignore = 'Пропустить'; -rserrreportimagefilemissing = 'Image <%s> is missing'; +rserrreportimagefilemissing = 'Изображение <%s> не найдено'; rsinformation = 'Информация'; rskeyins = 'Ins'; rsinsert = 'Вставка'; @@ -117,7 +117,7 @@ rslongoct = 'Октябрь'; rsopen = 'Открыть'; rsopenafile = 'Открыть файл'; rsfileowner = 'Владелец'; -rsfiletypepdf = 'PDF Documents'; +rsfiletypepdf = 'PDF Документы'; rsreportpage = 'Page'; rspassword = 'Пароль'; rspaste = 'Вставить'; @@ -153,7 +153,7 @@ rsshortsun = 'Вс'; rslongsun = 'Воскресенье'; rskeytab = 'Tab'; rstexttoinsert = 'Text to Insert'; -rserrreportnopagestoprint = 'There are no pages to print'; +rserrreportnopagestoprint = 'Нет страниц для печати'; rsshortthu = 'Чт'; rslongthu = 'Четверг'; rstoday = 'Сегодня'; -- cgit v1.2.3-70-g09d2 From 7d93cea8a25fefcdf5edf3d448f4c3045f895814 Mon Sep 17 00:00:00 2001 From: Graeme Geldenhuys Date: Mon, 6 Apr 2015 23:48:50 +0100 Subject: Revert "Minor optimisation to CanvasBase.SetFont()" This reverts commit 58fbaf95ad23b3b3393d172cbee6cc0eea5611d9. --- src/corelib/fpg_base.pas | 2 -- 1 file changed, 2 deletions(-) (limited to 'src/corelib') diff --git a/src/corelib/fpg_base.pas b/src/corelib/fpg_base.pas index d2d2e868..c110f3b0 100644 --- a/src/corelib/fpg_base.pas +++ b/src/corelib/fpg_base.pas @@ -1823,8 +1823,6 @@ procedure TfpgCanvasBase.SetFont(AFont: TfpgFontBase); begin if AFont = nil then exit; - if FFont = AFont then - exit; FFont := AFont; DoSetFontRes(AFont.FFontRes); end; -- cgit v1.2.3-70-g09d2