mirror of
https://github.com/moparisthebest/Simba
synced 2025-02-07 02:30:19 -05:00
Tried to fix the DTM Editor.
This commit is contained in:
parent
5826ca19f0
commit
59fe8feb5e
@ -7,7 +7,7 @@ var
|
|||||||
|
|
||||||
{$i mml.simba}
|
{$i mml.simba}
|
||||||
const
|
const
|
||||||
Version = '0.5';
|
Version = '0.6';
|
||||||
ZoomPixels = 3; //Should be an odd number (1, 3, 5, 7, ..)
|
ZoomPixels = 3; //Should be an odd number (1, 3, 5, 7, ..)
|
||||||
|
|
||||||
var
|
var
|
||||||
@ -37,6 +37,15 @@ var
|
|||||||
MarkCol: Integer;
|
MarkCol: Integer;
|
||||||
PaintDTM, BufferChanged: Boolean;
|
PaintDTM, BufferChanged: Boolean;
|
||||||
|
|
||||||
|
procedure FreeAndNil(var Bmp: TMufasaBitmap);
|
||||||
|
begin
|
||||||
|
if (Bmp <> nil) then
|
||||||
|
begin
|
||||||
|
Bmp.Free;
|
||||||
|
Bmp := nil;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function GetLine(p1, p2: TPoint): TPointArray;
|
function GetLine(p1, p2: TPoint): TPointArray;
|
||||||
var
|
var
|
||||||
dx, dy: Extended;
|
dx, dy: Extended;
|
||||||
@ -321,13 +330,7 @@ end;
|
|||||||
|
|
||||||
procedure ResetBuffer;
|
procedure ResetBuffer;
|
||||||
begin
|
begin
|
||||||
{
|
FreeAndNil(bmpBuffer);
|
||||||
Freeing the BmpBuffer here causes access violations.
|
|
||||||
It will have to investigated later.
|
|
||||||
if (bmpBuffer <> nil) then
|
|
||||||
bmpBuffer.Free;
|
|
||||||
}
|
|
||||||
|
|
||||||
bmpBuffer := bmp.Copy(0, 0, bmp.Width - 1, bmp.Height - 1);
|
bmpBuffer := bmp.Copy(0, 0, bmp.Width - 1, bmp.Height - 1);
|
||||||
BufferChanged := False;
|
BufferChanged := False;
|
||||||
end;
|
end;
|
||||||
@ -518,11 +521,7 @@ begin
|
|||||||
edTolerance.Text := '0';
|
edTolerance.Text := '0';
|
||||||
shColour.Brush.Color := clWhite;
|
shColour.Brush.Color := clWhite;
|
||||||
|
|
||||||
if (bmpOverlay <> nil) then
|
FreeAndNil(bmpOverlay);
|
||||||
begin
|
|
||||||
bmpOverlay.Free;
|
|
||||||
bmpOverlay := nil;
|
|
||||||
end;
|
|
||||||
ResetBuffer;
|
ResetBuffer;
|
||||||
UpdateBitmap(True, False);
|
UpdateBitmap(True, False);
|
||||||
frm.ActiveControl := lb;
|
frm.ActiveControl := lb;
|
||||||
@ -661,10 +660,7 @@ begin
|
|||||||
PaintDTM := True;
|
PaintDTM := True;
|
||||||
|
|
||||||
if (bmpOverlay <> nil) then
|
if (bmpOverlay <> nil) then
|
||||||
begin
|
FreeAndNil(bmpOverlay)
|
||||||
bmpOverlay.Free;
|
|
||||||
bmpOverlay := nil;
|
|
||||||
end
|
|
||||||
else
|
else
|
||||||
ResetBuffer;
|
ResetBuffer;
|
||||||
UpdateBitmap(True, False);
|
UpdateBitmap(True, False);
|
||||||
@ -1292,10 +1288,8 @@ begin
|
|||||||
CreateForm;
|
CreateForm;
|
||||||
Result := frm.ShowModal;
|
Result := frm.ShowModal;
|
||||||
finally
|
finally
|
||||||
if (bmpOverlay <> nil) then
|
FreeAndNil(bmpOverlay);
|
||||||
bmpOverlay.Free;
|
FreeAndNil(bmpBuffer);
|
||||||
if (bmpBuffer <> nil) then
|
|
||||||
bmpBuffer.Free;
|
|
||||||
bmp.Free;
|
bmp.Free;
|
||||||
frm.Free;
|
frm.Free;
|
||||||
end;
|
end;
|
||||||
|
Loading…
Reference in New Issue
Block a user