1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-10 19:35:10 -05:00

Property changes, and a workaround for a - for now unknown - bug.

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@28 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-09-04 18:20:45 +00:00
parent badc4a3c3b
commit faca7515f0
5 changed files with 227 additions and 221 deletions

View File

@ -38,7 +38,7 @@
<CursorPos X="41" Y="17"/>
<TopLine Value="1"/>
<EditorIndex Value="0"/>
<UsageCount Value="55"/>
<UsageCount Value="58"/>
<Loaded Value="True"/>
</Unit0>
<Unit1>
@ -167,10 +167,10 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="46" Y="50"/>
<TopLine Value="38"/>
<CursorPos X="61" Y="24"/>
<TopLine Value="91"/>
<EditorIndex Value="1"/>
<UsageCount Value="21"/>
<UsageCount Value="24"/>
<Loaded Value="True"/>
</Unit18>
<Unit19>
@ -299,20 +299,20 @@
<Filename Value="../../Units/MMLCore/client.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Client"/>
<CursorPos X="30" Y="29"/>
<CursorPos X="34" Y="29"/>
<TopLine Value="14"/>
<EditorIndex Value="3"/>
<UsageCount Value="20"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit37>
<Unit38>
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="MufasaTypes"/>
<CursorPos X="1" Y="1"/>
<CursorPos X="3" Y="16"/>
<TopLine Value="1"/>
<EditorIndex Value="2"/>
<UsageCount Value="20"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit38>
<Unit39>
@ -321,27 +321,27 @@
<CursorPos X="18" Y="8"/>
<TopLine Value="1"/>
<EditorIndex Value="6"/>
<UsageCount Value="20"/>
<UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit39>
<Unit40>
<Filename Value="../../Units/MMLCore/files.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="files"/>
<CursorPos X="54" Y="19"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<EditorIndex Value="5"/>
<UsageCount Value="21"/>
<UsageCount Value="24"/>
<Loaded Value="True"/>
</Unit40>
<Unit41>
<Filename Value="../../Units/MMLCore/window.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Window"/>
<CursorPos X="15" Y="40"/>
<TopLine Value="1"/>
<CursorPos X="49" Y="38"/>
<TopLine Value="11"/>
<EditorIndex Value="4"/>
<UsageCount Value="20"/>
<UsageCount Value="23"/>
<Loaded Value="True"/>
</Unit41>
<Unit42>
@ -357,130 +357,130 @@
<CursorPos X="80" Y="9"/>
<TopLine Value="1"/>
<EditorIndex Value="7"/>
<UsageCount Value="10"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit43>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="project1.lpr"/>
<Caret Line="17" Column="17" TopLine="1"/>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="43" Column="20" TopLine="28"/>
</Position1>
<Position2>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="13" Column="20" TopLine="7"/>
<Caret Line="55" Column="24" TopLine="40"/>
</Position2>
<Position3>
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
<Caret Line="30" Column="22" TopLine="11"/>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="36" Column="27" TopLine="31"/>
</Position3>
<Position4>
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
<Caret Line="31" Column="23" TopLine="11"/>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="41" Column="46" TopLine="31"/>
</Position4>
<Position5>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="439" Column="74" TopLine="11"/>
<Caret Line="463" Column="34" TopLine="448"/>
</Position5>
<Position6>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="43" Column="20" TopLine="28"/>
<Caret Line="34" Column="12" TopLine="30"/>
</Position6>
<Position7>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="55" Column="24" TopLine="40"/>
<Caret Line="46" Column="19" TopLine="31"/>
</Position7>
<Position8>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="36" Column="27" TopLine="31"/>
<Caret Line="72" Column="19" TopLine="50"/>
</Position8>
<Position9>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="41" Column="46" TopLine="31"/>
<Caret Line="37" Column="11" TopLine="21"/>
</Position9>
<Position10>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="463" Column="34" TopLine="448"/>
<Caret Line="38" Column="96" TopLine="28"/>
</Position10>
<Position11>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="34" Column="12" TopLine="30"/>
<Caret Line="417" Column="42" TopLine="402"/>
</Position11>
<Position12>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="46" Column="19" TopLine="31"/>
<Caret Line="449" Column="1" TopLine="431"/>
</Position12>
<Position13>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="72" Column="19" TopLine="50"/>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="37" Column="18" TopLine="12"/>
</Position13>
<Position14>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="37" Column="11" TopLine="21"/>
<Caret Line="20" Column="29" TopLine="11"/>
</Position14>
<Position15>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="38" Column="96" TopLine="28"/>
<Filename Value="testunit.pas"/>
<Caret Line="211" Column="1" TopLine="182"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="417" Column="42" TopLine="402"/>
<Filename Value="testunit.pas"/>
<Caret Line="154" Column="49" TopLine="140"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="449" Column="1" TopLine="431"/>
<Filename Value="testunit.pas"/>
<Caret Line="155" Column="8" TopLine="140"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="37" Column="18" TopLine="12"/>
<Filename Value="testunit.pas"/>
<Caret Line="160" Column="23" TopLine="145"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLCore/files.pas"/>
<Caret Line="20" Column="29" TopLine="11"/>
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
<Caret Line="8" Column="18" TopLine="1"/>
</Position19>
<Position20>
<Filename Value="testunit.pas"/>
<Caret Line="211" Column="1" TopLine="182"/>
<Caret Line="29" Column="14" TopLine="11"/>
</Position20>
<Position21>
<Filename Value="testunit.pas"/>
<Caret Line="154" Column="49" TopLine="140"/>
<Caret Line="161" Column="39" TopLine="146"/>
</Position21>
<Position22>
<Filename Value="testunit.pas"/>
<Caret Line="155" Column="8" TopLine="140"/>
<Caret Line="29" Column="20" TopLine="16"/>
</Position22>
<Position23>
<Filename Value="testunit.pas"/>
<Caret Line="160" Column="23" TopLine="145"/>
<Caret Line="51" Column="14" TopLine="46"/>
</Position23>
<Position24>
<Filename Value="../../../cogat/Units/CogatUnits/compfiles.pas"/>
<Caret Line="8" Column="18" TopLine="1"/>
<Filename Value="testunit.pas"/>
<Caret Line="54" Column="17" TopLine="48"/>
</Position24>
<Position25>
<Filename Value="testunit.pas"/>
<Caret Line="29" Column="14" TopLine="11"/>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="31" Column="71" TopLine="14"/>
</Position25>
<Position26>
<Filename Value="testunit.pas"/>
<Caret Line="161" Column="39" TopLine="146"/>
<Caret Line="137" Column="62" TopLine="121"/>
</Position26>
<Position27>
<Filename Value="testunit.pas"/>
<Caret Line="29" Column="20" TopLine="16"/>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="157" Column="52" TopLine="141"/>
</Position27>
<Position28>
<Filename Value="testunit.pas"/>
<Caret Line="51" Column="14" TopLine="46"/>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="232" Column="59" TopLine="217"/>
</Position28>
<Position29>
<Filename Value="testunit.pas"/>
<Caret Line="54" Column="17" TopLine="48"/>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="236" Column="29" TopLine="217"/>
</Position29>
<Position30>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="31" Column="71" TopLine="14"/>
<Caret Line="1" Column="1" TopLine="1"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -26,7 +26,7 @@ constructor TClient.Create;
begin
inherited Create;
MWindow := TMWindow.Create();
MWindow := TMWindow.Create(Self);
MInput := TMInput.Create(Self);
MFiles := TMFiles.Create;
end;

View File

@ -1,30 +1,31 @@
unit MufasaTypes;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TRGB32 = packed record
B, G, R, A: Byte;
end;
PRGB32 = ^TRGB32;
TRetData = record
Ptr : PRGB32;
IncPtrWith : integer;
end;
TTargetWindowMode = (w_BMP, w_Window, w_HDC, w_ArrayPtr, w_XWindow);
TClickType = (mouse_Left, mouse_Right, mouse_Middle);
TMousePress = (mouse_Down, mouse_Up);
implementation
end.
unit MufasaTypes;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils;
type
TRGB32 = packed record
B, G, R, A: Byte;
end;
PRGB32 = ^TRGB32;
TRetData = record
Ptr : PRGB32;
IncPtrWith : integer;
end;
TTargetWindowMode = (w_BMP, w_Window, w_HDC, w_ArrayPtr, w_XWindow);
TClickType = (mouse_Left, mouse_Right, mouse_Middle);
TMousePress = (mouse_Down, mouse_Up);
implementation
end.

View File

@ -35,9 +35,12 @@ type
function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
constructor Create;
constructor Create(Client: TObject);
destructor Destroy; override;
public
// Client
Client: TObject;
// Target Window Mode.
TargetMode: TTargetWindowMode;
@ -104,10 +107,12 @@ uses
GraphType // For TRawImage
;
constructor TMWindow.Create;
constructor TMWindow.Create(Client: TObject);
begin
inherited Create;
Self.Client := Client;
Self.ArrayPtr := nil;
Self.ArraySize := Classes.Point(-1, -1);

View File

@ -1,129 +1,129 @@
unit windowutil;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
ctypes, // for cint, etc
GraphType, // For TRawImage
{$IFDEF LINUX}
x, xlib, // For X* stuff.
{$ENDIF}
mufasatypes;
{$IFDEF LINUX}
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
{$ENDIF}
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
implementation
{$IFDEF LINUX}
// Too global.
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
begin;
result := 0;
Writeln('X Error: ');
writeln('Error code: ' + inttostr(para2^.error_code));
writeln('Display: ' + inttostr(LongWord(para2^.display)));
writeln('Minor code: ' + inttostr(para2^.minor_code));
writeln('Request code: ' + inttostr(para2^.request_code));
writeln('Resource ID: ' + inttostr(para2^.resourceid));
writeln('Serial: ' + inttostr(para2^.serial));
writeln('Type: ' + inttostr(para2^._type));
end;
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
Begin
RawImage.Init; { Calls raw.Description.Init as well }
RawImage.Description.PaletteColorCount:=0;
RawImage.Description.MaskBitsPerPixel:=0;
RawImage.Description.Width := XImg^.width;
RawImage.Description.Height:= XImg^.height;
RawImage.Description.Format := ricfRGBA;
if XImg^.byte_order = LSBFirst then
RawImage.Description.ByteOrder := riboLSBFirst
else
RawImage.Description.ByteOrder:= riboMSBFirst;
RawImage.Description.BitOrder:= riboBitsInOrder; // should be fine
RawImage.Description.Depth:=XImg^.depth;
RawImage.Description.BitsPerPixel:=XImg^.bits_per_pixel;
RawImage.Description.LineOrder:=riloTopToBottom;
RawImage.Description.LineEnd := rileDWordBoundary;
RawImage.Description.RedPrec := 8;
RawImage.Description.GreenPrec:= 8;
RawImage.Description.BluePrec:= 8;
RawImage.Description.AlphaPrec:=0;
// Can be adjusted to the XImage RedMask, etc.
// For now I just assume the tester uses BGR.
RawImage.Description.RedShift:=16;
RawImage.Description.GreenShift:=8;
RawImage.Description.BlueShift:=0;
RawImage.DataSize := RawImage.Description.Width * RawImage.Description.Height
* (RawImage.Description.bitsperpixel shr 3);
//RawImage.DataSize := RawImage.Description.Height * RawImage.Description.BitsPerLine;
RawImage.Data := PByte(XImg^.data);
End;
{$ENDIF}
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
Begin
RawImage.Init; { Calls raw.Description.Init as well }
RawImage.Description.PaletteColorCount:=0;
RawImage.Description.MaskBitsPerPixel:=0;
RawImage.Description.Width := Size.X;
RawImage.Description.Height:= Size.Y;
RawImage.Description.Format := ricfRGBA;
RawImage.Description.ByteOrder := riboLSBFirst;
RawImage.Description.BitOrder:= riboBitsInOrder; // should be fine
RawImage.Description.Depth:=24;
RawImage.Description.BitsPerPixel:=32;
RawImage.Description.LineOrder:=riloTopToBottom;
RawImage.Description.LineEnd := rileDWordBoundary;
RawImage.Description.RedPrec := 8;
RawImage.Description.GreenPrec:= 8;
RawImage.Description.BluePrec:= 8;
RawImage.Description.AlphaPrec:=0;
RawImage.Description.RedShift:=16;
RawImage.Description.GreenShift:=8;
RawImage.Description.BlueShift:=0;
RawImage.DataSize := RawImage.Description.Width * RawImage.Description.Height
* (RawImage.Description.bitsperpixel shr 3);
RawImage.Data := PByte(Ptr);
End;
end.
unit windowutil;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils,
ctypes, // for cint, etc
GraphType, // For TRawImage
{$IFDEF LINUX}
x, xlib, // For X* stuff.
{$ENDIF}
mufasatypes;
{$IFDEF LINUX}
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
{$ENDIF}
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
implementation
{$IFDEF LINUX}
// Too global.
function MufasaXErrorHandler(para1:PDisplay; para2:PXErrorEvent):cint;cdecl;
begin;
result := 0;
Writeln('X Error: ');
writeln('Error code: ' + inttostr(para2^.error_code));
writeln('Display: ' + inttostr(LongWord(para2^.display)));
writeln('Minor code: ' + inttostr(para2^.minor_code));
writeln('Request code: ' + inttostr(para2^.request_code));
writeln('Resource ID: ' + inttostr(para2^.resourceid));
writeln('Serial: ' + inttostr(para2^.serial));
writeln('Type: ' + inttostr(para2^._type));
end;
Procedure XImageToRawImage(XImg: PXImage; Var RawImage: TRawImage);
Begin
RawImage.Init; { Calls raw.Description.Init as well }
RawImage.Description.PaletteColorCount:=0;
RawImage.Description.MaskBitsPerPixel:=0;
RawImage.Description.Width := XImg^.width;
RawImage.Description.Height:= XImg^.height;
RawImage.Description.Format := ricfRGBA;
if XImg^.byte_order = LSBFirst then
RawImage.Description.ByteOrder := riboLSBFirst
else
RawImage.Description.ByteOrder:= riboMSBFirst;
RawImage.Description.BitOrder:= riboBitsInOrder; // should be fine
RawImage.Description.Depth:=XImg^.depth;
RawImage.Description.BitsPerPixel:=XImg^.bits_per_pixel;
RawImage.Description.LineOrder:=riloTopToBottom;
RawImage.Description.LineEnd := rileDWordBoundary;
RawImage.Description.RedPrec := 8;
RawImage.Description.GreenPrec:= 8;
RawImage.Description.BluePrec:= 8;
RawImage.Description.AlphaPrec:=0;
// Can be adjusted to the XImage RedMask, etc.
// For now I just assume the tester uses BGR.
RawImage.Description.RedShift:=16;
RawImage.Description.GreenShift:=8;
RawImage.Description.BlueShift:=0;
RawImage.DataSize := RawImage.Description.Width * RawImage.Description.Height
* (RawImage.Description.bitsperpixel shr 3);
//RawImage.DataSize := RawImage.Description.Height * RawImage.Description.BitsPerLine;
RawImage.Data := PByte(XImg^.data);
End;
{$ENDIF}
Procedure ArrDataToRawImage(Ptr: PRGB32; Size: TPoint; Var RawImage: TRawImage);
Begin
RawImage.Init; { Calls raw.Description.Init as well }
RawImage.Description.PaletteColorCount:=0;
RawImage.Description.MaskBitsPerPixel:=0;
RawImage.Description.Width := Size.X;
RawImage.Description.Height:= Size.Y;
RawImage.Description.Format := ricfRGBA;
RawImage.Description.ByteOrder := riboLSBFirst;
RawImage.Description.BitOrder:= riboBitsInOrder; // should be fine
RawImage.Description.Depth:=24;
RawImage.Description.BitsPerPixel:=32;
RawImage.Description.LineOrder:=riloTopToBottom;
RawImage.Description.LineEnd := rileDWordBoundary;
RawImage.Description.RedPrec := 8;
RawImage.Description.GreenPrec:= 8;
RawImage.Description.BluePrec:= 8;
RawImage.Description.AlphaPrec:=0;
RawImage.Description.RedShift:=16;
RawImage.Description.GreenShift:=8;
RawImage.Description.BlueShift:=0;
RawImage.DataSize := RawImage.Description.Width * RawImage.Description.Height
* (RawImage.Description.bitsperpixel shr 3);
RawImage.Data := PByte(Ptr);
End;
end.