Skip to content

Commit

Permalink
Clean up some compiler errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Oct 1, 2024
1 parent c72094d commit 4b9fdc1
Show file tree
Hide file tree
Showing 19 changed files with 84 additions and 153 deletions.
12 changes: 6 additions & 6 deletions Source/Simba.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4055="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-CfSSE64
-dStaticFFI
Expand Down Expand Up @@ -181,7 +181,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-CfSSE64
-dLape_CDECL
Expand Down Expand Up @@ -229,7 +229,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-dLape_CDECL
-dLape_NoExtended"/>
Expand Down Expand Up @@ -277,7 +277,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-CfSSE64
-dLape_CDECL
Expand Down Expand Up @@ -333,7 +333,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-dLape_CDECL
-dLape_NoExtended"/>
Expand Down Expand Up @@ -765,7 +765,7 @@
</Linking>
<Other>
<CompilerMessages>
<IgnoredMessages idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
<IgnoredMessages idx6058="True" idx5094="True" idx5093="True" idx5092="True" idx5091="True" idx5089="True" idx5024="True" idx4105="True" idx4104="True" idx4055="True" idx2054="True" idx2005="True"/>
</CompilerMessages>
<CustomOptions Value="-CfSSE64
-dStaticFFI
Expand Down
2 changes: 1 addition & 1 deletion Source/ide/codetools/simba.ide_codetools_base.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ interface

uses
Classes, SysUtils,
simba.base, simba.containers;
simba.base;

type
// "Perfect Hashing"
Expand Down
1 change: 0 additions & 1 deletion Source/ide/codetools/simba.ide_codetools_debug.pas
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ implementation

uses
Controls, ComCtrls, Forms,
simba.form_main,
simba.component_treeview,
simba.ide_codetools_insight,
simba.ide_codetools_parser;
Expand Down
6 changes: 3 additions & 3 deletions Source/ide/simba.form_about.lfm
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ object SimbaAboutForm: TSimbaAboutForm
DesignTimePPI = 120
OnCreate = FormCreate
Position = poScreenCenter
LCLVersion = '3.0.0.3'
LCLVersion = '3.4.0.0'
object AboutMemo: TMemo
AnchorSideTop.Control = VersionLabel
AnchorSideTop.Side = asrBottom
Expand Down Expand Up @@ -41,8 +41,8 @@ object SimbaAboutForm: TSimbaAboutForm
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 190
Height = 35
Top = 599
Height = 30
Top = 604
Width = 586
Anchors = [akLeft, akRight, akBottom]
AutoSize = True
Expand Down
12 changes: 6 additions & 6 deletions Source/ide/simba.form_about.pas
Original file line number Diff line number Diff line change
Expand Up @@ -16,14 +16,16 @@ interface

type
TSimbaAboutForm = class(TForm)
protected
procedure DoFirstShow; override;
published
AboutMemo: TMemo;
ButtonExit: TButton;
ImageSimba: TImage;
VersionLabel: TLabel;
LabelTitle: TLabel;
procedure ButtonExitClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure DoFirstShow(Sender: TObject);
procedure VersionLabelClick(Sender: TObject);
procedure VersionLabelMouseEnter(Sender: TObject);
procedure VersionLabelMouseLeave(Sender: TObject);
Expand All @@ -40,7 +42,7 @@ implementation
lclintf, lazversion,
simba.fs;

procedure TSimbaAboutForm.DoFirstShow(Sender: TObject);
procedure TSimbaAboutForm.DoFirstShow;
begin
LabelTitle.Caption := Format('Simba %d', [SIMBA_VERSION]);
if (SIMBA_COMMIT <> '') then
Expand Down Expand Up @@ -72,10 +74,8 @@ procedure TSimbaAboutForm.ButtonExitClick(Sender: TObject);

procedure TSimbaAboutForm.FormCreate(Sender: TObject);
begin
AddHandlerFirstShow(@DoFirstShow, True);

Width := 550;
Height := 450;
Width := Scale96ToScreen(550);
Height := Scale96ToScreen(450);
end;

procedure TSimbaAboutForm.VersionLabelClick(Sender: TObject);
Expand Down
43 changes: 9 additions & 34 deletions Source/ide/simba.ide_initialization.pas
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ interface

uses
Classes, SysUtils,
simba.base, simba.datetime;
simba.base;

type
TProcedureOfObject = procedure of object;
Expand Down Expand Up @@ -94,70 +94,45 @@ procedure SimbaIDEInitialization_AddBeforeShow(Proc: TProcedure; Name: String; B
procedure SimbaIDEInitialization_CallBeforeCreate;
var
Method: TInitializationMethod;
T: Double;
begin
for Method in BeforeCreateMethods do
begin
try
T := HighResolutionTime();

if Assigned(Method.Proc) then Method.Proc() else
if Assigned(Method.ProcObj) then Method.ProcObj();

//DebugLn('[SimbaIDEInitialization]: %s (%f ms)', [Method.Name, HighResolutionTime() - T]);
except
on E: Exception do
DebugLn('[SimbaIDEInitialization]: %s (exception: %s)', [Method.Name, E.Message]);
end;
try
if Assigned(Method.Proc) then Method.Proc() else
if Assigned(Method.ProcObj) then Method.ProcObj();
except
on E: Exception do
DebugLn('[SimbaIDEInitialization]: %s (exception: %s)', [Method.Name, E.Message]);
end;
end;

procedure SimbaIDEInitialization_CallBeforeShow_Background;
var
Method: TInitializationMethod;
T: Double;
begin
for Method in BeforeShowMethods do
begin
if not Method.BackgroundTask then
Continue;

if Method.BackgroundTask then
try
T := HighResolutionTime();

if Assigned(Method.Proc) then Method.Proc() else
if Assigned(Method.ProcObj) then Method.ProcObj();

//DebugLn('[SimbaIDEInitialization]: %s (%f ms in background)', [Method.Name, HighResolutionTime() - T]);
except
on E: Exception do
DebugLn('[SimbaIDEInitialization]: %s (exception: %s)', [Method.Name, E.Message]);
end;
end;
end;

procedure SimbaIDEInitialization_CallBeforeShow;
var
Method: TInitializationMethod;
T: Double;
begin
for Method in BeforeShowMethods do
begin
if Method.BackgroundTask then
Continue;

if not Method.BackgroundTask then
try
T := HighResolutionTime();

if Assigned(Method.Proc) then Method.Proc() else
if Assigned(Method.ProcObj) then Method.ProcObj();

//DebugLn('[SimbaIDEInitialization]: %s (%f ms)', [Method.Name, HighResolutionTime() - T]);
except
on E: Exception do
DebugLn('[SimbaIDEInitialization]: %s (exception: %s)', [Method.Name, E.Message]);
end;
end;

RunInThread(@SimbaIDEInitialization_CallBeforeShow_Background, True);
end;
Expand Down
2 changes: 0 additions & 2 deletions Source/script/imports/lcl/simba.import_lcl_form.pas
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ implementation
PComponent = ^TComponent;
PWinControl = ^TWinControl;
PFormBorderStyle = ^TFormBorderStyle;
PCanvas = ^TCanvas;
PFont = ^TFont;
PKeyEvent = ^TKeyEvent;
PKeyPressEvent = ^TKeyPressEvent;

Expand Down
5 changes: 3 additions & 2 deletions Source/script/simba.script_pluginloader.pas
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,12 @@ function LoadPlugin(var FileName: String; ExtraSearchDirs: TStringArray): TLibHa
OrginalFileName: String;
I: Integer;
begin
OrginalFileName := FileName;

FileName := SimbaEnv.FindPlugin(FileName, ExtraSearchDirs);
if (FileName = '') then
SimbaException('Plugin "%s" not found', [FileName]);
SimbaException('Plugin "%s" not found', [OrginalFileName]);

OrginalFileName := FileName;
for I := 0 to High(LoadedPlugins) do
if (LoadedPlugins[I].OrginalFileName = OrginalFileName) then
begin
Expand Down
3 changes: 1 addition & 2 deletions Source/shapebuilder_ellipse.inc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
procedure _BuildEllipse(centerX, centerY, radiusX, radiusY: Integer);
var
RadX, RadY, DeltaX, DeltaY, R, RX, RY: Integer;
X1, X2, Y1, Y2, Bpp, OldY: Integer;
X1, X2, Y1, Y2: Integer;
begin
X1 := CenterX - RadiusX;
X2 := CenterX + RadiusX;
Expand All @@ -17,7 +17,6 @@ begin

Y1 := Y1 + RadY;
Y2 := Y1;
OldY := Y1;

DeltaX := (RadX * RadX);
DeltaY := (RadY * RadY);
Expand Down
2 changes: 1 addition & 1 deletion Source/simba.array_algorithm.pas
Original file line number Diff line number Diff line change
Expand Up @@ -451,7 +451,7 @@ class function TArrayIndexOf.IndexOf(Item: _T; Arr: TArr): Integer;
Exit;

// can use these for better code
if (not IsManagedType(_T)) and (SizeOf(_T) in [1,2,4,8]) then
if (not IsManagedType(_T)) and ((SizeOf(_T) = 1) or (SizeOf(_T) = 2) or (SizeOf(_T) = 4) or (SizeOf(_T) = 8)) then
begin
case SizeOf(_T) of
1: Result := IndexByte(Arr[0], Length(Arr), PByte(@Item)^);
Expand Down
32 changes: 16 additions & 16 deletions Source/simba.colormath_conversion.pas
Original file line number Diff line number Diff line change
Expand Up @@ -42,22 +42,22 @@ TSimbaColorConversion = class
class function BGRAToRGB(const RGB: TColorBGRA): TColorRGB; static; inline;

class function RGBToColor(const RGB: TColorRGB): TColor; static; inline;
class function RGBToXYZ(const RGB: TColorRGB): TColorXYZ; static; inline;
class function RGBToLAB(const RGB: TColorRGB): TColorLAB; static; inline;
class function RGBToLCH(const RGB: TColorRGB): TColorLCH; static; inline;
class function RGBToHSV(const RGB: TColorRGB): TColorHSV; static; inline;
class function RGBToHSL(const RGB: TColorRGB): TColorHSL; static; inline;

class function LABToLCH(const LAB: TColorLAB): TColorLCH; static; inline;
class function LABToRGB(const LAB: TColorLAB): TColorRGB; static; inline;
class function LABToXYZ(const LAB: TColorLAB): TColorXYZ; static; inline;

class function HSVToRGB(const HSV: TColorHSV): TColorRGB; static; inline;
class function HSLToRGB(const HSL: TColorHSL): TColorRGB; static; inline;
class function LCHToRGB(const LCH: TColorLCH): TColorRGB; static; inline;
class function LCHToLAB(const LCH: TColorLCH): TColorLAB; static; inline;

class function XYZToRGB(const XYZ: TColorXYZ): TColorRGB; static; inline;
class function RGBToXYZ(const RGB: TColorRGB): TColorXYZ; static;
class function RGBToLAB(const RGB: TColorRGB): TColorLAB; static;
class function RGBToLCH(const RGB: TColorRGB): TColorLCH; static;
class function RGBToHSV(const RGB: TColorRGB): TColorHSV; static;
class function RGBToHSL(const RGB: TColorRGB): TColorHSL; static;

class function LABToLCH(const LAB: TColorLAB): TColorLCH; static;
class function LABToRGB(const LAB: TColorLAB): TColorRGB; static;
class function LABToXYZ(const LAB: TColorLAB): TColorXYZ; static;

class function HSVToRGB(const HSV: TColorHSV): TColorRGB; static;
class function HSLToRGB(const HSL: TColorHSL): TColorRGB; static;
class function LCHToRGB(const LCH: TColorLCH): TColorRGB; static;
class function LCHToLAB(const LCH: TColorLCH): TColorLAB; static;

class function XYZToRGB(const XYZ: TColorXYZ): TColorRGB; static;
end;

implementation
Expand Down
2 changes: 1 addition & 1 deletion Source/simba.container_slacktree.pas
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ function TPASelectNth_Axis(var arr:TPointArray; k, start, stop:Int32; axis:Byte=
l,r:Int32;
tmp,mid:TPoint;
begin
if stop-start < 0 then Exit();
if stop-start < 0 then Exit(TPoint.ZERO);

while (start < stop) do
begin
Expand Down
1 change: 1 addition & 0 deletions Source/simba.dialog.pas
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ procedure TSimbaDialogForm.CalculatePreferredSize(var PreferredWidth, PreferredH
begin
inherited CalculatePreferredSize(PreferredWidth, PreferredHeight, WithThemeSpace);

W := 0; H := 0;
TLabelProtectedAccess(QuestionLabel).CalculateSize(Monitor.Width div 2, W, H);
PreferredWidth := QuestionLabel.Left + QuestionLabel.BorderSpacing.Right + W;
end;
Expand Down
2 changes: 1 addition & 1 deletion Source/simba.finder_color.pas
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ implementation

uses
simba.containers, simba.colormath_conversion, simba.colormath_distance_unrolled,
simba.vartype_pointarray, simba.vartype_floatmatrix, simba.datetime, simba.vartype_box;
simba.vartype_pointarray, simba.vartype_floatmatrix, simba.vartype_box;

// How much to "Slice" (vertically) the image up for multithreading.
function CalculateSlices(SearchWidth, SearchHeight: Integer): Integer;
Expand Down
Loading

0 comments on commit 4b9fdc1

Please sign in to comment.