mirror of
https://github.com/moparisthebest/Simba
synced 2024-11-13 21:05:12 -05:00
Simba: Fix double-colour picking crash.
This commit is contained in:
parent
34eb23ba24
commit
297ea2abd8
@ -411,6 +411,7 @@ type
|
||||
OpenFileData : TOpenFileData;
|
||||
WriteFileData : TWriteFileData;
|
||||
ScriptStartData : TScriptStartData;
|
||||
|
||||
procedure UpdateInterpreter;
|
||||
procedure HandleConnectionData;
|
||||
procedure HandleOpenFileData;
|
||||
@ -2871,6 +2872,11 @@ var
|
||||
c, x, y: Integer;
|
||||
cobj: TColourPickerObject;
|
||||
begin
|
||||
if Picker.Picking then
|
||||
begin
|
||||
formWriteln('Error: Already picking a colour');
|
||||
exit;
|
||||
end;
|
||||
Picker.Pick(c, x, y);
|
||||
cobj := TColourPickerObject.Create(c, Classes.Point(x,y), '');
|
||||
|
||||
|
@ -51,7 +51,12 @@ type
|
||||
|
||||
procedure ImageMainMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
procedure ImageInfoMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
|
||||
Procedure ColorPickUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
|
||||
procedure ColorPickUp(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
|
||||
|
||||
private
|
||||
{ Are we currently picking? }
|
||||
FPicking: Boolean;
|
||||
|
||||
public
|
||||
manager: TIOManager;
|
||||
{ Form components }
|
||||
@ -68,7 +73,9 @@ type
|
||||
|
||||
{ Handles }
|
||||
InfoHandle, ImageHandle : HDC;
|
||||
|
||||
public
|
||||
property Picking: Boolean read FPicking;
|
||||
property OnPick: TColourPickEvent read FPickEvent write FPickEvent;
|
||||
end;
|
||||
|
||||
@ -80,7 +87,8 @@ constructor TMColorPicker.Create(manager: TIOManager);
|
||||
begin
|
||||
inherited Create;
|
||||
|
||||
self.manager := manager;
|
||||
Self.manager := manager;
|
||||
Self.FPicking := False;
|
||||
end;
|
||||
|
||||
destructor TMColorPicker.Destroy;
|
||||
@ -103,12 +111,17 @@ var
|
||||
|
||||
|
||||
begin
|
||||
if self.FPicking then
|
||||
raise Exception.Create('Pick() has not yet returned, but has been called'
|
||||
+ 'again');
|
||||
|
||||
Self.FPicking := True;
|
||||
{ Disable both of the color pick buttons }
|
||||
w := 0;
|
||||
h := 0;
|
||||
{ If the target window isn't valid (closed etc), make the destkop the new window}
|
||||
if not Self.Manager.TargetValid then
|
||||
self.Manager.SetDesktop;
|
||||
Self.Manager.SetDesktop;
|
||||
|
||||
{Desktop is needed for the whole picture}
|
||||
Desktop := TIOManager.Create;
|
||||
@ -214,6 +227,8 @@ begin
|
||||
|
||||
Desktop.free;
|
||||
|
||||
self.FPicking := False;
|
||||
|
||||
{ Re-enable the color pick buttons }
|
||||
// Application.MainForm.Enabled := True;
|
||||
// ColourHistoryForm.Enabled := True;
|
||||
|
Loading…
Reference in New Issue
Block a user