mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-05 23:58:06 +02:00
LazUtils: Move math helper functions from LCLProc to LazUtilities. Deprecate LCLProc versions.
git-svn-id: trunk@64197 -
This commit is contained in:
parent
277bee311d
commit
6813e28eef
@ -34,7 +34,7 @@ uses
|
||||
// LCL
|
||||
LCLProc, LCLType, LCLIntf, Forms, Menus,
|
||||
// LazUtils
|
||||
LazLoggerBase, LazTracer,
|
||||
LazLoggerBase, LazTracer, LazMethodList,
|
||||
// IdeIntf
|
||||
IDEImagesIntf;
|
||||
|
||||
|
@ -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<j and Compare(List[i],List[j])=0) }
|
||||
@ -59,6 +68,54 @@ begin
|
||||
Result:=-1;
|
||||
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 RoundToInt(e: Extended): integer;
|
||||
begin
|
||||
Result:=integer(Round(e));
|
||||
{$IFDEF VerboseRound}
|
||||
DebugLn('RoundToInt ',e,' ',Result);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function RoundToCardinal(e: Extended): cardinal;
|
||||
begin
|
||||
Result:=cardinal(Round(e));
|
||||
{$IFDEF VerboseRound}
|
||||
DebugLn('RoundToCardinal ',e,' ',Result);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TruncToInt(e: Extended): integer;
|
||||
begin
|
||||
Result:=integer(Trunc(e));
|
||||
{$IFDEF VerboseRound}
|
||||
DebugLn('TruncToInt ',e,' ',Result);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function TruncToCardinal(e: Extended): cardinal;
|
||||
begin
|
||||
Result:=cardinal(Trunc(e));
|
||||
{$IFDEF VerboseRound}
|
||||
DebugLn('TruncToCardinal ',e,' ',Result);
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
function StrToDouble(const s: string): double;
|
||||
begin
|
||||
{$IFDEF VerboseRound}
|
||||
DebugLn('StrToDouble "',s,'"');
|
||||
{$ENDIF}
|
||||
Result:=Double(StrToFloat(s));
|
||||
end;
|
||||
|
||||
procedure MergeSortWithLen(List: PPointer; ListLength: PtrInt;
|
||||
const Compare: TListSortCompare);
|
||||
var
|
||||
|
@ -6,12 +6,13 @@ unit GLGtk3GlxContext;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, ctypes, LCLProc, LCLType, X, XUtil, XLib, gl, glext,
|
||||
InterfaceBase,
|
||||
glx,
|
||||
Classes, SysUtils, ctypes, X, XUtil, XLib, gl, glext, glx,
|
||||
// LazUtils
|
||||
LazUtilities,
|
||||
// LCL
|
||||
LCLType, InterfaceBase, LMessages, Controls,
|
||||
WSLCLClasses, LCLMessageGlue,
|
||||
LMessages, glib2, gtk3int, LazGdk3, LazGtk3, gtk3widgets,
|
||||
Controls;
|
||||
glib2, gtk3int, LazGdk3, LazGtk3, gtk3widgets;
|
||||
|
||||
function LBackingScaleFactor(Handle: HWND): single;
|
||||
procedure LOpenGLViewport({%H-}Handle: HWND; Left, Top, Width, Height: integer);
|
||||
|
@ -92,8 +92,10 @@ unit OpenGLContext;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, LCLProc, Forms, Controls, LCLType, LCLIntf, LResources,
|
||||
Graphics, LMessages, WSLCLClasses, WSControls,
|
||||
Classes, SysUtils,
|
||||
// LCL
|
||||
LCLType, LCLIntf, LResources, Forms, Controls, Graphics, LMessages,
|
||||
WSLCLClasses, WSControls,
|
||||
{$IFDEF UseGtkGLX}
|
||||
GLGtkGlxContext;
|
||||
{$ENDIF}
|
||||
|
@ -23,7 +23,7 @@
|
||||
Abstract:
|
||||
Replacement of source editor tabs/pages with buttons sorted by package and name.
|
||||
}
|
||||
unit packagetabs_impl;
|
||||
unit PackageTabs_impl;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
@ -32,15 +32,15 @@ interface
|
||||
uses
|
||||
Classes, SysUtils, Types, Contnrs,
|
||||
// LCL
|
||||
LCLProc, LCLIntf, Forms, Controls, StdCtrls, Buttons, ComCtrls, ExtCtrls,
|
||||
LCLIntf, Forms, Controls, StdCtrls, Buttons, ComCtrls, ExtCtrls,
|
||||
Graphics, Menus, Clipbrd,
|
||||
// LazUtils
|
||||
LazFileUtils, Laz2_XMLCfg,
|
||||
LazUtilities, LazFileUtils, Laz2_XMLCfg,
|
||||
// IdeIntf
|
||||
SrcEditorIntf, PackageIntf, LazIDEIntf, IDEImagesIntf, IDECommands,
|
||||
IDEOptEditorIntf, ProjectIntf,
|
||||
// PackageTabs
|
||||
packagetabsstr;
|
||||
PackageTabsStr;
|
||||
|
||||
type
|
||||
TPackageTabButton = class(TSpeedButton)
|
||||
|
@ -1,4 +1,4 @@
|
||||
unit packagetabsstr;
|
||||
unit PackageTabsStr;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
|
@ -116,7 +116,7 @@ uses
|
||||
LCLProc, LCLIntf, LCLType, LMessages, LResources, Messages, Controls, Graphics,
|
||||
Forms, StdCtrls, ExtCtrls, Menus, Clipbrd, StdActns,
|
||||
// LazUtils
|
||||
LazMethodList, LazLoggerBase, LazUTF8,
|
||||
LazUtilities, LazMethodList, LazLoggerBase, LazTracer, LazUTF8,
|
||||
// SynEdit
|
||||
SynEditTypes, SynEditSearch, SynEditKeyCmds, SynEditMouseCmds, SynEditMiscProcs,
|
||||
SynEditPointClasses, SynBeautifier, SynEditMarks,
|
||||
|
@ -45,9 +45,9 @@ interface
|
||||
uses
|
||||
Classes, SysUtils,
|
||||
// LazUtils
|
||||
LazMethodList,
|
||||
LazMethodList, LazUtilities, LazLoggerBase,
|
||||
// LCL
|
||||
LCLIntf, LCLType, LCLProc, Graphics, Controls, Clipbrd, ImgList,
|
||||
LCLIntf, LCLType, Graphics, Controls, Clipbrd, ImgList,
|
||||
// SynEdit
|
||||
SynEditHighlighter, SynEditMiscProcs, SynEditTypes, LazSynEditText, SynEditPointClasses;
|
||||
|
||||
|
@ -27,10 +27,14 @@ unit SynGutterLineOverview;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, Graphics, Controls, LCLProc, LCLType, LCLIntf, Forms, LMessages,
|
||||
FPCanvas, sysutils, math, SynGutterBase, SynEditTypes, LazSynEditText,
|
||||
SynEditTextBuffer, SynEditMarks, SynEditMiscClasses,
|
||||
SynEditMouseCmds, LazUtilities;
|
||||
Classes, sysutils, math, FPCanvas,
|
||||
// LCL
|
||||
Graphics, Controls, Forms, LCLType, LCLIntf, LMessages,
|
||||
// LazUtils
|
||||
LazUtilities,
|
||||
// SynEdit
|
||||
SynGutterBase, SynEditTypes, LazSynEditText, SynEditTextBuffer, SynEditMarks,
|
||||
SynEditMiscClasses, SynEditMouseCmds;
|
||||
|
||||
type
|
||||
TSynGutterLineOverview = class;
|
||||
|
@ -218,15 +218,15 @@ end;
|
||||
|
||||
function GetPidForAttach: string;
|
||||
var
|
||||
ProcessList: TRunningProcessInfoList;
|
||||
ProcessLst: TRunningProcessInfoList;
|
||||
begin
|
||||
Result := '';
|
||||
|
||||
ProcessList := TRunningProcessInfoList.Create(True);
|
||||
ProcessLst := TRunningProcessInfoList.Create(True);
|
||||
try
|
||||
// Check if we can enumerate processes.
|
||||
if not DebugBoss.FillProcessList(ProcessList) then
|
||||
if not EnumerateProcesses(ProcessList) then
|
||||
if not DebugBoss.FillProcessList(ProcessLst) then
|
||||
if not EnumerateProcesses(ProcessLst) then
|
||||
begin
|
||||
// If we can't just ask PID as string.
|
||||
InputQuery(rsAttachTo, rsEnterPID, Result);
|
||||
@ -236,14 +236,14 @@ begin
|
||||
// Enumerate.
|
||||
DebugAttachDialogForm := TDebugAttachDialogForm.Create(nil);
|
||||
try
|
||||
if DebugAttachDialogForm.ChooseProcess(ProcessList, Result) <> mrOK then
|
||||
if DebugAttachDialogForm.ChooseProcess(ProcessLst, Result) <> mrOK then
|
||||
Result := '';
|
||||
finally
|
||||
FreeAndNil(DebugAttachDialogForm);
|
||||
end;
|
||||
|
||||
finally
|
||||
FreeAndNil(ProcessList);
|
||||
FreeAndNil(ProcessLst);
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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.
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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,
|
||||
|
@ -50,7 +50,7 @@ uses
|
||||
// LCL
|
||||
Forms, Controls, Dialogs, LResources, LCLMemManager, LCLProc,
|
||||
//LazUtils
|
||||
AvgLvlTree, LazLoggerBase,
|
||||
AvgLvlTree, LazUtilities, LazLoggerBase, LazTracer,
|
||||
// CodeTools
|
||||
BasicCodeTools,
|
||||
// IdeIntf
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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);
|
||||
|
@ -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,
|
||||
|
@ -31,7 +31,8 @@ interface
|
||||
|
||||
Uses
|
||||
Types, Classes, SysUtils, Math,
|
||||
LCLProc;
|
||||
// LazUtils
|
||||
LazUtilities;
|
||||
|
||||
Type
|
||||
TFloatPoint = Record
|
||||
|
@ -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;
|
||||
|
@ -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}
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
||||
|
@ -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,
|
||||
|
@ -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;
|
||||
|
@ -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,
|
||||
|
@ -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}
|
||||
|
@ -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);
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user