DTM editor now works! (As extension and normal script ;)).. It was a silly bug

This commit is contained in:
Raymond 2010-06-16 22:25:04 +02:00
parent 1a8f3d2875
commit 385bea53e3
5 changed files with 28 additions and 3 deletions

View File

@ -1,8 +1,10 @@
program DTMEditor_Extension;
var
{$ifndef PS_EXTENSION}
Client : TClient;
Simba_MainMenu : TMainMenu;
{$endif}
{$i mml.simba}
const
Version = '0.5';
@ -607,7 +609,7 @@ begin
h := GetImageTarget;
if (bmpOverlay = nil) then
bmpOverlay := bmpBuffer.Copy(0, 0, bmpBuffer.Width - 1, bmpBuffer.Height - 1);
SetTargetBitmap(bmpBuffer.Index);
SetTargetBitmap(bmpBuffer);
if FindColorsTolerance(Points, getColour, 0, 0, bmpBuffer.Width - 1, bmpBuffer.Height - 1, getTolerance) then
bmpOverlay.DrawTPA(Points, MarkCol);
@ -1295,12 +1297,14 @@ begin
end;
end;
{$ifndef PS_EXTENSION}
procedure ThreadSafe_ShowForm;
var
v: TVariantArray;
begin
ThreadSafeCall('ShowForm', v);
end;
{$ENDIF}
{
Simba integration
@ -1344,6 +1348,8 @@ begin;
end;
begin
{$ifndef PS_EXTENSION}
Client := GetTClient;
ThreadSafe_ShowForm;
{$endif}
end.

View File

@ -356,6 +356,8 @@ begin
with PSInstance do
begin
{$I ../../Units/MMLAddon/PSInc/psdefines.inc}
Defines.Add('PS_EXTENSION');
Defines.Add('EXTENSION');
end;
PSInstance.Script := Self.Script;

View File

@ -21,6 +21,10 @@
Math.inc for the Mufasa Macro Library
}
function ps_round(e : extended) : integer; extdecl;
begin
result := round(e);
end;
function ps_iAbs(a : integer) : integer;extdecl;
begin
result := abs(a);

View File

@ -52,7 +52,7 @@ AddFunction(@ps_CreateDTMPoint,'function CreateDTMPoint(x,y,c,t,asz : integer; b
{maths}
SetCurrSection('Math');
AddFunction(nil,'function Round(e:extended) : integer');
AddFunction(@ps_round,'function Round(e:extended) : integer');
AddFunction(@ps_ceil,'function ceil(e : extended) : integer');
AddFunction(@ps_floor,'function floor(e : extended) : integer');
AddFunction(@ps_pow,'function pow(base,exponent : extended) : extended');

View File

@ -106,11 +106,24 @@ begin
end;
end;
procedure TPenColor_W(Self: TPen; const T: TColor);begin Self.Color := T; end;
procedure TPenColor_R(Self: TPen; var T: TColor);begin T := Self.Color; end;
procedure TPenMode_W(Self: TPen; const T: TPENMODE);begin Self.Mode := T; end;
procedure TPenMode_R(Self: TPen; var T: TPENMODE);begin T := Self.Mode; end;
procedure TPenWidth_W(Self: TPen; const T: Integer);begin Self.Width := T; Writeln(t); end;
procedure TPenWidth_R(Self: TPen; var T: Integer);begin T := Self.Width; Writeln(self.width) end;
procedure TPenStyle_W(Self: TPen; const T: TPenStyle);begin Self.Style := T; end;
procedure TPenStyle_R(Self: TPen; var T: TPenStyle);begin T := Self.Style; end;
procedure RIRegisterTPEN(Cl: TPSRuntimeClassImporter);
begin
with Cl.Add(TPEN) do
begin
RegisterConstructor(@TPEN.CREATE, 'CREATE');
RegisterPropertyHelper(@TPenStyle_R,@TPenStyle_W,'Style');
RegisterPropertyHelper(@TPenWidth_R,@TPenWidth_W,'Width');
RegisterPropertyHelper(@TPenMode_R,@TPenMode_W,'Mode');
RegisterPropertyHelper(@TPenColor_R,@TPenColor_W,'Color');
end;
end;