Skip to content

Commit

Permalink
dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ollydev committed Feb 12, 2024
1 parent 623420e commit 750c1b3
Show file tree
Hide file tree
Showing 12 changed files with 662 additions and 2,095 deletions.
2 changes: 1 addition & 1 deletion Source/Simba.lpi
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
<IsPartOfProject Value="True"/>
</Unit107>
<Unit108>
<Filename Value="imagebox/simba.imagebox_new.pas"/>
<Filename Value="imagebox/simba.imagebox.pas"/>
<IsPartOfProject Value="True"/>
</Unit108>
<Unit109>
Expand Down
8 changes: 4 additions & 4 deletions Source/forms/simba.aca.lfm
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
object SimbaACAForm: TSimbaACAForm
Left = 3178
Left = 3110
Height = 886
Top = 375
Top = 360
Width = 1076
Caption = 'Auto Color Aid'
ClientHeight = 886
ClientWidth = 1076
ClientHeight = 0
ClientWidth = 0
Constraints.MinHeight = 400
Constraints.MinWidth = 500
DesignTimePPI = 120
Expand Down
18 changes: 9 additions & 9 deletions Source/forms/simba.aca.pas
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface
uses
Classes, SysUtils, Forms, Controls, Dialogs, DividerBevel, Graphics,
ExtCtrls, ComCtrls, StdCtrls, Menus, ColorBox, LMessages,
simba.base, simba.imagebox_new, simba.imagebox_canvas, simba.imagebox_zoom,
simba.base, simba.imagebox, simba.imagebox_canvas, simba.imagebox_zoom,
simba.colormath, simba.finder;

type
Expand Down Expand Up @@ -84,23 +84,23 @@ TSimbaACAForm = class(TForm)
procedure FormClose(Sender: TObject; var CloseAction: TCloseAction);
procedure ChangeDrawColor(Sender: TObject);
procedure ButtonUpdateImageClick(Sender: TObject);
procedure ClientImageMouseMove(Sender: TSimbaImageBoxNew; Shift: TShiftState; X, Y: Integer);
procedure ClientImageMouseDown(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ClientImageMouseMove(Sender: TSimbaImageBox; Shift: TShiftState; X, Y: Integer);
procedure ClientImageMouseDown(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MenuItemCopyBestColorClick(Sender: TObject);
procedure MenuItemLoadHSLCircleClick(Sender: TObject);
procedure MenuItemLoadHSLCircleExClick(Sender: TObject);
protected
FFreeOnClose: Boolean;
FWindow: TWindowHandle;
FImageBox: TSimbaImageBoxNew;
FImageBox: TSimbaImageBox;
FImageZoom: TSimbaImageBoxZoom;
FZoomInfo: TLabel;
FDebugTPA: TPointArray;
FDebugMat: TSingleMatrix;
FDrawColor: TColor;

procedure LoadHSLCircle(Radius: Integer);
procedure DoPaintArea(Sender: TSimbaImageBoxNew; ACanvas: TSimbaImageBoxCanvas; R: TRect);
procedure DoPaintArea(Sender: TSimbaImageBox; ACanvas: TSimbaImageBoxCanvas; R: TRect);
procedure CalculateBestColor;

function GetBestColorTol: TColorTolerance;
Expand All @@ -124,7 +124,7 @@ implementation
Clipbrd, TypInfo, LCLType,
simba.windowhandle, simba.image, simba.colormath_aca, simba.matrix_float, simba.dialog;

procedure TSimbaACAForm.ClientImageMouseMove(Sender: TSimbaImageBoxNew; Shift: TShiftState; X, Y: Integer);
procedure TSimbaACAForm.ClientImageMouseMove(Sender: TSimbaImageBox; Shift: TShiftState; X, Y: Integer);
begin
FImageZoom.SetTempColor(-1);
FImageZoom.Move(FImageBox.Background.Canvas, X, Y);
Expand All @@ -135,7 +135,7 @@ procedure TSimbaACAForm.ClientImageMouseMove(Sender: TSimbaImageBoxNew; Shift: T
Format('HSL: %.2f, %.2f, %.2f', [H, S, L]) + LineEnding;
end;

procedure TSimbaACAForm.ClientImageMouseDown(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TSimbaACAForm.ClientImageMouseDown(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
var
Pixel: Integer;
begin
Expand Down Expand Up @@ -188,7 +188,7 @@ procedure TSimbaACAForm.LoadHSLCircle(Radius: Integer);
Bitmap.Free();
end;

procedure TSimbaACAForm.DoPaintArea(Sender: TSimbaImageBoxNew; ACanvas: TSimbaImageBoxCanvas; R: TRect);
procedure TSimbaACAForm.DoPaintArea(Sender: TSimbaImageBox; ACanvas: TSimbaImageBoxCanvas; R: TRect);
begin
if (Length(FDebugTPA) > 0) then
ACanvas.DrawPoints(FDebugTPA, FDrawColor)
Expand Down Expand Up @@ -461,7 +461,7 @@ constructor TSimbaACAForm.Create(Window: TWindowHandle);

FFreeOnClose := True;

FImageBox := TSimbaImageBoxNew.Create(Self);
FImageBox := TSimbaImageBox.Create(Self);
FImageBox.Parent := PanelMain;
FImageBox.Align := alClient;
FImageBox.OnImgMouseDown := @ClientImageMouseDown;
Expand Down
17 changes: 8 additions & 9 deletions Source/forms/simba.debugimageform.pas
Original file line number Diff line number Diff line change
Expand Up @@ -11,23 +11,23 @@ interface

uses
classes, sysutils, forms, controls,
simba.imagebox_new;
simba.imagebox;

type
TSimbaDebugImageForm = class(TForm)
procedure FormCreate(Sender: TObject);
protected
FImageBox: TSimbaImageBoxNew;
FImageBox: TSimbaImageBox;
FMaxWidth, FMaxHeight: Integer;

procedure DoDoubleClick(Sender: TObject);
procedure DoImgDoubleClick(Sender: TSimbaImageBox; X, Y: Integer);
public
procedure Close;

procedure SetMaxSize(AWidth, AHeight: Integer);
procedure SetSize(AWidth, AHeight: Integer; AForce: Boolean; AEnsureVisible: Boolean = True);

property ImageBox: TSimbaImageBoxNew read FImageBox;
property ImageBox: TSimbaImageBox read FImageBox;
end;

var
Expand Down Expand Up @@ -56,16 +56,15 @@ procedure TSimbaDebugImageForm.FormCreate(Sender: TObject);
FMaxWidth := 1500;
FMaxHeight := 1000;

FImageBox := TSimbaImageBoxNew.Create(Self);
FImageBox := TSimbaImageBox.Create(Self);
FImageBox.Parent := Self;
FImageBox.Align := alClient;
//FImageBox.OnDblClick := @DoDoubleCLick;
FImageBox.OnImgDoubleClick := @DoImgDoubleClick;
end;

procedure TSimbaDebugImageForm.DoDoubleClick(Sender: TObject);
procedure TSimbaDebugImageForm.DoImgDoubleClick(Sender: TSimbaImageBox; X, Y: Integer);
begin
//with TSimbaImageBoxNew(Sender).MousePoint do
// DebugLn([EDebugLn.FOCUS], 'Debug Image Click: (%d, %d)', [X, Y]);
DebugLn([EDebugLn.FOCUS], 'Debug Image Click: (%d, %d)', [X, Y]);
end;

procedure TSimbaDebugImageForm.SetSize(AWidth, AHeight: Integer; AForce: Boolean; AEnsureVisible: Boolean);
Expand Down
22 changes: 11 additions & 11 deletions Source/forms/simba.dtmeditor.pas
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ interface
uses
classes, sysutils, fileutil, dividerbevel, forms, controls,
graphics, dialogs, extctrls, comctrls, stdctrls, menus, lcltype,
simba.base, simba.dtm, simba.imagebox_new, simba.imagebox_canvas, simba.imagebox_zoom;
simba.base, simba.dtm, simba.imagebox, simba.imagebox_canvas, simba.imagebox_zoom;

type
TSimbaDTMEditorForm = class(TForm)
Expand Down Expand Up @@ -79,7 +79,7 @@ TSimbaDTMEditorForm = class(TForm)
procedure ButtonUpdateImageClick(Sender: TObject);
protected
FFreeOnClose: Boolean;
FImageBox: TSimbaImageBoxNew;
FImageBox: TSimbaImageBox;
FImageZoom: TSimbaImageBoxZoom;
FZoomInfo: TLabel;
FDragging: Integer;
Expand All @@ -90,10 +90,10 @@ TSimbaDTMEditorForm = class(TForm)
FWindow: TWindowHandle;
FDTMString: String;

procedure DoImgMouseMove(Sender: TSimbaImageBoxNew; Shift: TShiftState; X, Y: Integer);
procedure DoImgMouseDown(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoImgMouseUp(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoImgPaint(Sender: TSimbaImageBoxNew; ACanvas: TSimbaImageBoxCanvas; R: TRect);
procedure DoImgMouseMove(Sender: TSimbaImageBox; Shift: TShiftState; X, Y: Integer);
procedure DoImgMouseDown(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoImgMouseUp(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure DoImgPaint(Sender: TSimbaImageBox; ACanvas: TSimbaImageBoxCanvas; R: TRect);

procedure AddPoint(X, Y, Col: Integer; Tol: Single; Size: Integer); overload;
procedure AddPoint(X, Y, Col: Integer); overload;
Expand All @@ -120,7 +120,7 @@ implementation
uses
simba.windowhandle, simba.colormath, simba.dialog;

procedure TSimbaDTMEditorForm.DoImgMouseMove(Sender: TSimbaImageBoxNew; Shift: TShiftState; X, Y: Integer);
procedure TSimbaDTMEditorForm.DoImgMouseMove(Sender: TSimbaImageBox; Shift: TShiftState; X, Y: Integer);
var
Point: TDTMPoint;
begin
Expand All @@ -143,7 +143,7 @@ procedure TSimbaDTMEditorForm.DoImgMouseMove(Sender: TSimbaImageBoxNew; Shift: T
FImageBox.Cursor := crDefault;
end;

procedure TSimbaDTMEditorForm.DoImgMouseDown(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TSimbaDTMEditorForm.DoImgMouseDown(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
case Button of
mbLeft:
Expand All @@ -165,7 +165,7 @@ procedure TSimbaDTMEditorForm.DoImgMouseDown(Sender: TSimbaImageBoxNew; Button:
end;
end;

procedure TSimbaDTMEditorForm.DoImgMouseUp(Sender: TSimbaImageBoxNew; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure TSimbaDTMEditorForm.DoImgMouseUp(Sender: TSimbaImageBox; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if (Button = mbLeft) then
FDragging := -1;
Expand Down Expand Up @@ -227,7 +227,7 @@ procedure TSimbaDTMEditorForm.ButtonUpdateImageClick(Sender: TObject);
DrawDTM();
end;

procedure TSimbaDTMEditorForm.DoImgPaint(Sender: TSimbaImageBoxNew; ACanvas: TSimbaImageBoxCanvas; R: TRect);
procedure TSimbaDTMEditorForm.DoImgPaint(Sender: TSimbaImageBox; ACanvas: TSimbaImageBoxCanvas; R: TRect);
var
Points: TDTMPointArray;
I: Integer;
Expand Down Expand Up @@ -534,7 +534,7 @@ constructor TSimbaDTMEditorForm.Create(Window: TWindowHandle);
FDrawColor := clRed;
FDragging := -1;

FImageBox := TSimbaImageBoxNew.Create(Self);
FImageBox := TSimbaImageBox.Create(Self);
FImageBox.Parent := PanelMain;
FImageBox.Align := alClient;
FImageBox.OnImgPaint := @DoImgPaint;
Expand Down
Loading

0 comments on commit 750c1b3

Please sign in to comment.