From 6813e28eef5479f66ae45cf1a5c3121119e7f721 Mon Sep 17 00:00:00 2001 From: juha Date: Sat, 12 Dec 2020 11:41:07 +0000 Subject: [PATCH] LazUtils: Move math helper functions from LCLProc to LazUtilities. Deprecate LCLProc versions. git-svn-id: trunk@64197 - --- components/ideintf/idecommands.pas | 2 +- components/lazutils/lazutilities.pas | 59 +++++++++++++- components/opengl/glgtk3glxcontext.pas | 11 +-- components/opengl/openglcontext.pas | 6 +- components/packagetabs/packagetabs_impl.pas | 8 +- components/packagetabs/packagetabsstr.pas | 2 +- components/synedit/synedit.pp | 2 +- components/synedit/syneditmiscclasses.pp | 4 +- components/synedit/syngutterlineoverview.pp | 12 ++- debugger/debugattachdialog.pas | 12 +-- debugger/debugger.pp | 6 +- debugger/processdebugger.pp | 11 ++- debugger/processlist.pas | 16 ++-- designer/anchoreditor.pas | 12 ++- designer/designer.pp | 2 +- designer/jitforms.pp | 2 +- ide/codetoolsdefpreview.pas | 5 +- ide/frames/oi_options.pas | 4 +- lcl/extgraphics.pas | 7 +- lcl/forms/calcform.pas | 11 +-- lcl/graphmath.pp | 3 +- lcl/interfacebase.pp | 5 +- lcl/interfaces/gtk2/gtk2def.pp | 4 +- lcl/interfaces/gtk2/gtk2fontcache.pas | 4 +- lcl/interfaces/gtk2/gtk2int.pas | 3 +- lcl/interfaces/gtk2/gtk2proc.pp | 3 +- lcl/interfaces/gtk3/gtk3int.pas | 2 +- lcl/interfaces/gtk3/gtk3widgets.pas | 5 +- lcl/interfaces/qt/qtint.pp | 2 +- lcl/interfaces/qt5/qtint.pp | 6 +- lcl/lclproc.pas | 80 ++++++------------- .../frames/package_description_options.pas | 4 +- 32 files changed, 186 insertions(+), 129 deletions(-) diff --git a/components/ideintf/idecommands.pas b/components/ideintf/idecommands.pas index 8b6b6fffa8..c558143b4b 100644 --- a/components/ideintf/idecommands.pas +++ b/components/ideintf/idecommands.pas @@ -34,7 +34,7 @@ uses // LCL LCLProc, LCLType, LCLIntf, Forms, Menus, // LazUtils - LazLoggerBase, LazTracer, + LazLoggerBase, LazTracer, LazMethodList, // IdeIntf IDEImagesIntf; diff --git a/components/lazutils/lazutilities.pas b/components/lazutils/lazutilities.pas index 49125fcacc..d7d1a2d72e 100644 --- a/components/lazutils/lazutilities.pas +++ b/components/lazutils/lazutilities.pas @@ -13,12 +13,21 @@ unit LazUtilities; interface uses - Classes, SysUtils; + Classes, SysUtils, TypInfo; procedure FreeThenNil(var obj); function ComparePointers(p1, p2: Pointer): integer; inline; function CompareBoolean(b1, b2: boolean): integer; +function GetEnumValueDef(TypeInfo: PTypeInfo; const Name: string; + const DefaultValue: Integer): Integer; + +function RoundToInt(e: Extended): integer; inline; +function RoundToCardinal(e: Extended): cardinal; inline; +function TruncToInt(e: Extended): integer; inline; +function TruncToCardinal(e: Extended): cardinal; inline; +function StrToDouble(const s: string): double; inline; + { MergeSortWithLen: sort ascending, e.g. Compare(List[0],List[1])<0 keeping order (for each i mrOK then + if DebugAttachDialogForm.ChooseProcess(ProcessLst, Result) <> mrOK then Result := ''; finally FreeAndNil(DebugAttachDialogForm); end; finally - FreeAndNil(ProcessList); + FreeAndNil(ProcessLst); end; end; diff --git a/debugger/debugger.pp b/debugger/debugger.pp index b18dff8a42..15faefb9ac 100644 --- a/debugger/debugger.pp +++ b/debugger/debugger.pp @@ -39,11 +39,9 @@ interface uses TypInfo, Classes, SysUtils, math, - // LCL - LCLProc, // LazUtils - Laz2_XMLCfg, LazFileUtils, LazStringUtils, LazLoggerBase, LazConfigStorage, - LazClasses, Maps, + Laz2_XMLCfg, LazFileUtils, LazStringUtils, LazUtilities, LazLoggerBase, + LazConfigStorage, LazClasses, Maps, // DebuggerIntf DbgIntfBaseTypes, DbgIntfMiscClasses, DbgIntfDebuggerBase; diff --git a/debugger/processdebugger.pp b/debugger/processdebugger.pp index 0d3c6549a2..3fa68ab3b6 100644 --- a/debugger/processdebugger.pp +++ b/debugger/processdebugger.pp @@ -38,8 +38,15 @@ unit ProcessDebugger; interface uses - Classes, SysUtils, FileUtil, UTF8Process, LazFileUtils, DbgIntfDebuggerBase, - Process, Debugger, LCLProc, BaseDebugManager, Dialogs, ProcessList; + Classes, SysUtils, Process, + // LCL + Dialogs, + // LazUtils + FileUtil, UTF8Process, LazFileUtils, LazLoggerBase, + // DebuggerIntf + DbgIntfDebuggerBase, + // IDE + ProcessList, Debugger; type diff --git a/debugger/processlist.pas b/debugger/processlist.pas index 6174b9a995..11c4d32c05 100644 --- a/debugger/processlist.pas +++ b/debugger/processlist.pas @@ -25,13 +25,14 @@ unit ProcessList; interface uses - Classes, SysUtils, LCLProc, UTF8Process; + Classes, SysUtils, + // LazUtils + UTF8Process, LazLoggerBase; type { The TProcessList is used by the IDE to store all running programs and external tools, that are not watched. From time to time the IDE checks, - if the processes has terminated and will free them cleanly to avoid - zombies. } + if the processes has terminated and will free them cleanly to avoid zombies. } TProcessList = class private FItems: TList; // list of TProcessUTF8 @@ -58,7 +59,8 @@ var function GetDefaultProcessList: TProcessList; begin - if DefaultProcessList=nil then DefaultProcessList:=TProcessList.Create; + if DefaultProcessList=nil then + DefaultProcessList:=TProcessList.Create; Result:=DefaultProcessList; end; @@ -131,12 +133,8 @@ begin end; end; -initialization - DefaultProcessList:=nil; - finalization - DefaultProcessList.Free; - DefaultProcessList:=nil; + FreeAndNil(DefaultProcessList); end. diff --git a/designer/anchoreditor.pas b/designer/anchoreditor.pas index 939200bb49..2997992aae 100644 --- a/designer/anchoreditor.pas +++ b/designer/anchoreditor.pas @@ -35,9 +35,15 @@ unit AnchorEditor; interface uses - Classes, SysUtils, LCLProc, Forms, Controls, Dialogs, StdCtrls, Buttons, Spin, - ExtCtrls, Graphics, IDECommands, PropEdits, IDEDialogs, LazarusIDEStrConsts, - IDEOptionDefs, IDEImagesIntf, EnvironmentOpts; + Classes, SysUtils, + // LCL + Forms, Controls, Dialogs, StdCtrls, Buttons, Spin, ExtCtrls, Graphics, + // LazUtils + LazUtilities, + // IdeIntf + IDECommands, PropEdits, IDEDialogs, IDEImagesIntf, + // IDE + LazarusIDEStrConsts, IDEOptionDefs, EnvironmentOpts; type diff --git a/designer/designer.pp b/designer/designer.pp index 34b74db7fa..f5258b1789 100644 --- a/designer/designer.pp +++ b/designer/designer.pp @@ -42,7 +42,7 @@ uses LCLProc, LCLType, LResources, LCLIntf, LMessages, InterfaceBase, Forms, Controls, GraphType, Graphics, Dialogs, ExtCtrls, Menus, ClipBrd, // LazUtils - LazFileUtils, LazFileCache, + LazFileUtils, LazFileCache, LazLoggerBase, // IDEIntf IDEDialogs, PropEdits, PropEditUtils, ComponentEditors, MenuIntf, IDEImagesIntf, FormEditingIntf, ComponentReg, IDECommands, LazIDEIntf, diff --git a/designer/jitforms.pp b/designer/jitforms.pp index 3d19dd4aff..f2a1a558d0 100644 --- a/designer/jitforms.pp +++ b/designer/jitforms.pp @@ -50,7 +50,7 @@ uses // LCL Forms, Controls, Dialogs, LResources, LCLMemManager, LCLProc, //LazUtils - AvgLvlTree, LazLoggerBase, + AvgLvlTree, LazUtilities, LazLoggerBase, LazTracer, // CodeTools BasicCodeTools, // IdeIntf diff --git a/ide/codetoolsdefpreview.pas b/ide/codetoolsdefpreview.pas index 3a906e59f8..1cf3ec336a 100644 --- a/ide/codetoolsdefpreview.pas +++ b/ide/codetoolsdefpreview.pas @@ -32,10 +32,9 @@ interface uses Classes, SysUtils, Math, Laz_AVL_Tree, // LCL - LCLProc, Forms, Controls, Graphics, Dialogs, ButtonPanel, Buttons, - StdCtrls, ComCtrls, ExtCtrls, + Forms, Controls, Graphics, Dialogs, ButtonPanel, Buttons, StdCtrls, ComCtrls, ExtCtrls, // LazUtils - LazFileUtils, + LazFileUtils, LazUtilities, LazLoggerBase, // Codetools DefineTemplates, ExprEval, // SynEdit diff --git a/ide/frames/oi_options.pas b/ide/frames/oi_options.pas index cfcc4040de..def52ddbaf 100644 --- a/ide/frames/oi_options.pas +++ b/ide/frames/oi_options.pas @@ -30,7 +30,9 @@ interface uses Classes, SysUtils, // LCL - LCLProc, Forms, StdCtrls, Dialogs, Spin, ColorBox, Graphics, Buttons, + Forms, StdCtrls, Dialogs, Spin, ColorBox, Graphics, Buttons, + // LazUtils + LazUtilities, // IdeIntf ObjectInspector, IDEOptionsIntf, IDEOptEditorIntf, IDEImagesIntf, // IDE diff --git a/lcl/extgraphics.pas b/lcl/extgraphics.pas index 0b8d4ce13f..79c4b75405 100644 --- a/lcl/extgraphics.pas +++ b/lcl/extgraphics.pas @@ -19,7 +19,12 @@ unit ExtGraphics; interface -uses Types, Classes, LCLProc, Graphics, Math, GraphMath; +uses + Types, Classes, Math, + // LazUtils + LazUtilities, + // LCL + Graphics, GraphMath; type TShapeDirection = (atUp, atDown, atLeft, atRight); diff --git a/lcl/forms/calcform.pas b/lcl/forms/calcform.pas index f9a2790d13..4d916bfe23 100644 --- a/lcl/forms/calcform.pas +++ b/lcl/forms/calcform.pas @@ -22,8 +22,12 @@ unit CalcForm; interface uses - Classes, SysUtils, Forms, Controls, Graphics, - StdCtrls, ExtCtrls, Buttons, Menus, Clipbrd; + Classes, SysUtils, + // LazUtils + LazUtilities, + // LCL + Forms, Controls, Graphics, StdCtrls, ExtCtrls, Buttons, Menus, Clipbrd, + WSExtDlgs, LCLStrConsts; const CalcDefPrecision = 15; @@ -151,9 +155,6 @@ var implementation -uses - LclProc, WSExtDlgs, LCLStrConsts; - type TCalcBtnKind = (cbNone, cbNum0, cbNum1, cbNum2, cbNum3, cbNum4, cbNum5, cbNum6, diff --git a/lcl/graphmath.pp b/lcl/graphmath.pp index 59ea8d9d0c..70f3dec01b 100644 --- a/lcl/graphmath.pp +++ b/lcl/graphmath.pp @@ -31,7 +31,8 @@ interface Uses Types, Classes, SysUtils, Math, - LCLProc; + // LazUtils + LazUtilities; Type TFloatPoint = Record diff --git a/lcl/interfacebase.pp b/lcl/interfacebase.pp index 5d36eb813f..66276aa7a2 100644 --- a/lcl/interfacebase.pp +++ b/lcl/interfacebase.pp @@ -29,10 +29,9 @@ interface uses Types, Classes, SysUtils, Math, FPImage, // LazUtils - LazUTF8, IntegerList, + LazUTF8, IntegerList, LazUtilities, LazLoggerBase, GraphType, // LCL - LCLType, LCLProc, LMessages, LCLPlatformDef, - GraphType, GraphMath, IntfGraphics, Themes; + LCLProc, LCLType, LMessages, LCLPlatformDef, GraphMath, IntfGraphics, Themes; type PEventHandler = type Pointer; diff --git a/lcl/interfaces/gtk2/gtk2def.pp b/lcl/interfaces/gtk2/gtk2def.pp index b16d84493a..ee876f0e6e 100644 --- a/lcl/interfaces/gtk2/gtk2def.pp +++ b/lcl/interfaces/gtk2/gtk2def.pp @@ -28,10 +28,10 @@ uses // RTL Classes, SysUtils, glib2, gdk2pixbuf, pango, gdk2, gtk2, // LazUtils - DynHashArray, LazLoggerBase, + DynHashArray, LazLoggerBase, LazTracer, LazUtilities, // LCL Gtk2Extra, - LCLIntf, LCLProc, LCLType, LCLMemManager, + LCLIntf, LCLType, LCLMemManager, GraphType, Gtk2Globals, Graphics {for TColor}; {$ifdef TraceGdiCalls} diff --git a/lcl/interfaces/gtk2/gtk2fontcache.pas b/lcl/interfaces/gtk2/gtk2fontcache.pas index 9a560899d7..97fa2b9314 100644 --- a/lcl/interfaces/gtk2/gtk2fontcache.pas +++ b/lcl/interfaces/gtk2/gtk2fontcache.pas @@ -16,9 +16,9 @@ uses // RTL Classes, SysUtils, glib2, pango, Laz_AVL_Tree, // LazUtils - LazLoggerBase, + LazUtilities, LazLoggerBase, LazTracer, // LCL - LCLProc, LCLType, Gtk2Def, LCLResCache; + LCLType, Gtk2Def, LCLResCache; type TGtkFontCacheDescriptor = class; diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index 304989ad9a..97ea8c4f83 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -39,7 +39,8 @@ uses {$EndIf} gdk2pixbuf, gtk2, gdk2, glib2, Pango, // LazUtils - LazFileUtils, LazUTF8, DynHashArray, Maps, IntegerList, LazLoggerBase, LazStringUtils, + LazFileUtils, LazUTF8, DynHashArray, Maps, IntegerList, + LazLoggerBase, LazTracer, LazUtilities, LazStringUtils, // LCL Dialogs, Controls, Forms, LCLStrConsts, LMessages, LCLProc, LCLIntf, LCLType, GraphType, GraphMath, diff --git a/lcl/interfaces/gtk2/gtk2proc.pp b/lcl/interfaces/gtk2/gtk2proc.pp index 51a993237b..3b1e8f14c1 100644 --- a/lcl/interfaces/gtk2/gtk2proc.pp +++ b/lcl/interfaces/gtk2/gtk2proc.pp @@ -49,7 +49,8 @@ uses LResources, Controls, Forms, Buttons, Menus, StdCtrls, ComCtrls, ExtCtrls, Dialogs, ExtDlgs, ImgList, LCLMessageGlue, // LazUtils - Masks, FileUtil, LazFileUtils, LazStringUtils, LazLoggerBase, LazUTF8, DynHashArray, + FileUtil, LazFileUtils, LazStringUtils, LazUtilities, LazLoggerBase, LazTracer, + Masks, LazUTF8, DynHashArray, // Gtk2 Gtk2FontCache, Gtk2Globals, Gtk2Def, Gtk2Extra, {%H-}Gtk2Debug; diff --git a/lcl/interfaces/gtk3/gtk3int.pas b/lcl/interfaces/gtk3/gtk3int.pas index bf050544ce..2e3d3fcaf7 100644 --- a/lcl/interfaces/gtk3/gtk3int.pas +++ b/lcl/interfaces/gtk3/gtk3int.pas @@ -26,7 +26,7 @@ uses {$ENDIF} SysUtils, Classes, types, Math, FPImage, // LazUtils - LazUTF8, IntegerList, GraphType, + LazUtilities, LazLoggerBase, LazTracer, LazUTF8, IntegerList, GraphType, // LCL LCLPlatformDef, InterfaceBase, LCLProc, LCLType, LMessages, LCLMessageGlue, Controls, Forms, Graphics, GraphUtil, IntfGraphics, diff --git a/lcl/interfaces/gtk3/gtk3widgets.pas b/lcl/interfaces/gtk3/gtk3widgets.pas index 5c56a3c616..9a34a99200 100644 --- a/lcl/interfaces/gtk3/gtk3widgets.pas +++ b/lcl/interfaces/gtk3/gtk3widgets.pas @@ -25,8 +25,9 @@ uses Classes, SysUtils, types, math, // LCL Controls, StdCtrls, ExtCtrls, Buttons, ComCtrls, Graphics, Dialogs, Forms, Menus, ExtDlgs, - Spin, CheckLst, PairSplitter, LCLType, LCLProc, LMessages, LCLMessageGlue, LCLIntf, - graphtype, + Spin, CheckLst, PairSplitter, LCLType, LMessages, LCLMessageGlue, LCLIntf, + // LazUtils + LazUtilities, LazLoggerBase, GraphType, // GTK3 LazGtk3, LazGdk3, LazGObject2, LazGLib2, LazCairo1, LazPango1, LazGdkPixbuf2, gtk3objects, gtk3procs, gtk3private, Gtk3CellRenderer; diff --git a/lcl/interfaces/qt/qtint.pp b/lcl/interfaces/qt/qtint.pp index c0be476d31..4b700373a6 100644 --- a/lcl/interfaces/qt/qtint.pp +++ b/lcl/interfaces/qt/qtint.pp @@ -38,7 +38,7 @@ uses // FPC Classes, SysUtils, Math, Types, // LazUtils - LazUTF8, Maps, LazStringUtils, + LazUTF8, Maps, LazUtilities, LazStringUtils, // LCL LCLPlatformDef, InterfaceBase, LCLProc, LCLType, LCLIntf, LMessages, LCLMessageGlue, LCLStrConsts, diff --git a/lcl/interfaces/qt5/qtint.pp b/lcl/interfaces/qt5/qtint.pp index 24150524eb..cee86861ed 100644 --- a/lcl/interfaces/qt5/qtint.pp +++ b/lcl/interfaces/qt5/qtint.pp @@ -37,10 +37,10 @@ uses // FPC Classes, SysUtils, Math, Types, maps, // LazUtils - LazStringUtils, + LazStringUtils, LazUtilities, LazLoggerBase, // LCL - InterfaceBase, LCLPlatformDef, LCLProc, LazUTF8, LCLType, LMessages, LCLMessageGlue, LCLStrConsts, - Controls, ExtCtrls, Forms, + InterfaceBase, LCLPlatformDef, LazUTF8, LCLProc, LCLType, LMessages, + LCLMessageGlue, LCLStrConsts, Controls, ExtCtrls, Forms, Dialogs, StdCtrls, LCLIntf, GraphType, GraphUtil, Themes, // WS {$IFDEF HASX11} diff --git a/lcl/lclproc.pas b/lcl/lclproc.pas index 533deafc99..12bb1c118d 100644 --- a/lcl/lclproc.pas +++ b/lcl/lclproc.pas @@ -26,9 +26,9 @@ interface uses {$IFDEF Darwin}MacOSAll, {$ENDIF} - Classes, SysUtils, Math, TypInfo, Types, Laz_AVL_Tree, + Classes, SysUtils, Math, Types, Laz_AVL_Tree, // LazUtils - FPCAdds, LazFileUtils, LazUtilities, LazMethodList, LazUTF8, LazUTF8Classes, + LazFileUtils, LazUtilities, LazMethodList, LazUTF8, LazUTF8Classes, LazLoggerBase, LazTracer, // LCL LCLStrConsts, LCLType; @@ -85,9 +85,6 @@ procedure MergeSort(List: TFPList; const OnCompare: TListSortCompare); overload; procedure MergeSort(List: TFPList; StartIndex, EndIndex: integer; const OnCompare: TListSortCompare); overload; procedure MergeSort(List: TStrings; const OnCompare: TStringsSortCompare); overload; -function GetEnumValueDef(TypeInfo: PTypeInfo; const Name: string; - const DefaultValue: Integer): Integer; - function KeyAndShiftStateToKeyString(Key: word; ShiftState: TShiftState): String; function KeyStringIsIrregular(const s: string): boolean; function ShortCutToText(ShortCut: TShortCut): string; inline; // localized output @@ -135,18 +132,19 @@ function DeleteAmpersands(var Str : String) : Integer; function RemoveAmpersands(const ASource: String): String; function RemoveAmpersands(Src: PChar; var LineLength: Longint): PChar; -function ComparePointers(p1, p2: Pointer): integer; inline; function CompareHandles(h1, h2: THandle): integer; function CompareRect(R1, R2: PRect): Boolean; function ComparePoints(const p1, p2: TPoint): integer; function CompareCaret(const FirstCaret, SecondCaret: TPoint): integer; -function CompareMethods(const m1, m2: TMethod): boolean; inline; -function RoundToInt(const e: Extended): integer; inline; -function RoundToCardinal(const e: Extended): cardinal; inline; -function TruncToInt(const e: Extended): integer; inline; -function TruncToCardinal(const e: Extended): cardinal; inline; -function StrToDouble(const s: string): double; inline; +// Deprecated in 2.1 / 12.12.2020 / Remove in 2.3 +function CompareMethods(m1, m2: TMethod): boolean; deprecated 'Use LazMethodList.CompareMethods'; +function ComparePointers(p1, p2: Pointer): integer; deprecated 'Use LazUtilities.ComparePointers'; +function RoundToInt(e: Extended): integer; deprecated 'Use LazUtilities.RoundToInt'; +function RoundToCardinal(e: Extended): cardinal; deprecated 'Use LazUtilities.RoundToCardinal'; +function TruncToInt(e: Extended): integer; deprecated 'Use LazUtilities.TruncToInt'; +function TruncToCardinal(e: Extended): cardinal; deprecated 'Use LazUtilities.TruncToCardinal'; +function StrToDouble(const s: string): double; deprecated 'Use LazUtilities.StrToDouble'; // Call debugging procedure in LazLoggerBase. procedure RaiseGDBException(const Msg: string); inline; @@ -328,8 +326,6 @@ var implementation -uses gettext; - const {$IFDEF WithOldDebugln} Str_LCL_Debug_File = 'lcldebug.log'; @@ -687,14 +683,6 @@ begin Result:=ComparePointers(Item,TDebugLCLItemInfo(DebugItemInfo).Item); end; -function GetEnumValueDef(TypeInfo: PTypeInfo; const Name: string; - const DefaultValue: Integer): Integer; -begin - Result:=GetEnumValue(TypeInfo,Name); - if Result<0 then - Result:=DefaultValue; -end; - function KeyCodeToKeyString(Key: TShortCut; Localized: boolean): string; begin if Key <= High(KeyCodeStrings) then @@ -930,8 +918,7 @@ end; procedure OwnerFormDesignerModified(AComponent: TComponent); begin - if ([csDesigning,csLoading,csDestroying]*AComponent.ComponentState - =[csDesigning]) + if ([csDesigning,csLoading,csDestroying]*AComponent.ComponentState=[csDesigning]) then begin if OwnerFormDesignerModifiedProc<>nil then OwnerFormDesignerModifiedProc(AComponent); @@ -1051,11 +1038,6 @@ begin end; end; -function ComparePointers(p1, p2: Pointer): integer; -begin - Result:=LazUtilities.ComparePointers(p1, p2); -end; - function CompareHandles(h1, h2: THandle): integer; begin if h1>h2 then @@ -1104,49 +1086,39 @@ begin Result:=0; end; -function CompareMethods(const m1, m2: TMethod): boolean; +function CompareMethods(m1, m2: TMethod): boolean; begin Result:=LazMethodList.CompareMethods(m1, m2); end; -function RoundToInt(const e: Extended): integer; +function ComparePointers(p1, p2: Pointer): integer; begin - Result:=integer(Round(e)); - {$IFDEF VerboseRound} - DebugLn('RoundToInt ',e,' ',Result); - {$ENDIF} + Result:=LazUtilities.ComparePointers(p1, p2); end; -function RoundToCardinal(const e: Extended): cardinal; +function RoundToInt(e: Extended): integer; begin - Result:=cardinal(Round(e)); - {$IFDEF VerboseRound} - DebugLn('RoundToCardinal ',e,' ',Result); - {$ENDIF} + Result:=LazUtilities.RoundToInt(e); end; -function TruncToInt(const e: Extended): integer; +function RoundToCardinal(e: Extended): cardinal; begin - Result:=integer(Trunc(e)); - {$IFDEF VerboseRound} - DebugLn('TruncToInt ',e,' ',Result); - {$ENDIF} + Result:=LazUtilities.RoundToCardinal(e); end; -function TruncToCardinal(const e: Extended): cardinal; +function TruncToInt(e: Extended): integer; begin - Result:=cardinal(Trunc(e)); - {$IFDEF VerboseRound} - DebugLn('TruncToCardinal ',e,' ',Result); - {$ENDIF} + Result:=LazUtilities.TruncToInt(e); +end; + +function TruncToCardinal(e: Extended): cardinal; +begin + Result:=LazUtilities.TruncToCardinal(e); end; function StrToDouble(const s: string): double; begin - {$IFDEF VerboseRound} - DebugLn('StrToDouble "',s,'"'); - {$ENDIF} - Result:=Double(StrToFloat(s)); + Result:=LazUtilities.StrToDouble(s); end; procedure MergeSort(List: TFPList; const OnCompare: TListSortCompare); diff --git a/packager/frames/package_description_options.pas b/packager/frames/package_description_options.pas index 3d295835d2..18bc118f4c 100644 --- a/packager/frames/package_description_options.pas +++ b/packager/frames/package_description_options.pas @@ -7,7 +7,9 @@ interface uses Classes, SysUtils, // LCL - Forms, Controls, StdCtrls, Spin, LCLProc, + Forms, Controls, StdCtrls, Spin, + // LazUtils + LazUtilities, // IdeIntf PackageDependencyIntf, IDEOptionsIntf, IDEOptEditorIntf, // IDE