1
0
mirror of https://github.com/moparisthebest/Simba synced 2025-01-31 07:10:28 -05:00

IOManager branch compiles --- key/mouse methods need os implementation still

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@437 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
BenLand100 2010-01-20 21:20:58 +00:00
parent 9cd2a2d876
commit 0a41342cec
3 changed files with 142 additions and 121 deletions

View File

@ -10,7 +10,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Simba"/> <Title Value="Simba"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="1"/> <ActiveEditorIndexAtStart Value="0"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -138,8 +138,8 @@
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<ComponentState Value="1"/> <ComponentState Value="1"/>
<CursorPos X="64" Y="1539"/> <CursorPos X="1" Y="1673"/>
<TopLine Value="1532"/> <TopLine Value="1656"/>
<EditorIndex Value="0"/> <EditorIndex Value="0"/>
<UsageCount Value="202"/> <UsageCount Value="202"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -215,7 +215,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="31" Y="59"/> <CursorPos X="31" Y="59"/>
<TopLine Value="42"/> <TopLine Value="174"/>
<EditorIndex Value="8"/> <EditorIndex Value="8"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -249,7 +249,7 @@
<UnitName Value="finder"/> <UnitName Value="finder"/>
<CursorPos X="10" Y="2000"/> <CursorPos X="10" Y="2000"/>
<TopLine Value="1972"/> <TopLine Value="1972"/>
<EditorIndex Value="15"/> <EditorIndex Value="14"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit27> </Unit27>
@ -353,7 +353,7 @@
<UnitName Value="bitmaps"/> <UnitName Value="bitmaps"/>
<CursorPos X="22" Y="681"/> <CursorPos X="22" Y="681"/>
<TopLine Value="671"/> <TopLine Value="671"/>
<EditorIndex Value="14"/> <EditorIndex Value="13"/>
<UsageCount Value="200"/> <UsageCount Value="200"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit42> </Unit42>
@ -368,7 +368,7 @@
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="13"/> <EditorIndex Value="12"/>
<UsageCount Value="34"/> <UsageCount Value="34"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit44> </Unit44>
@ -490,7 +490,7 @@
<UnitName Value="colour_conv"/> <UnitName Value="colour_conv"/>
<CursorPos X="1" Y="332"/> <CursorPos X="1" Y="332"/>
<TopLine Value="290"/> <TopLine Value="290"/>
<EditorIndex Value="16"/> <EditorIndex Value="15"/>
<UsageCount Value="201"/> <UsageCount Value="201"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit62> </Unit62>
@ -504,7 +504,7 @@
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="11"/> <EditorIndex Value="10"/>
<UsageCount Value="45"/> <UsageCount Value="45"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit64> </Unit64>
@ -1600,7 +1600,7 @@
<UnitName Value="framefunctionlist"/> <UnitName Value="framefunctionlist"/>
<CursorPos X="26" Y="295"/> <CursorPos X="26" Y="295"/>
<TopLine Value="7"/> <TopLine Value="7"/>
<UsageCount Value="147"/> <UsageCount Value="148"/>
</Unit223> </Unit223>
<Unit224> <Unit224>
<Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/> <Filename Value="../../../usr/local/share/lazarus/lcl/comctrls.pp"/>
@ -1655,7 +1655,7 @@
<UnitName Value="simpleanalyzer"/> <UnitName Value="simpleanalyzer"/>
<CursorPos X="52" Y="104"/> <CursorPos X="52" Y="104"/>
<TopLine Value="193"/> <TopLine Value="193"/>
<UsageCount Value="134"/> <UsageCount Value="135"/>
</Unit231> </Unit231>
<Unit232> <Unit232>
<Filename Value="../../Units/Misc/mPasLex.pas"/> <Filename Value="../../Units/Misc/mPasLex.pas"/>
@ -1715,7 +1715,7 @@
<Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/psexportedmethods.inc"/>
<CursorPos X="30" Y="109"/> <CursorPos X="30" Y="109"/>
<TopLine Value="98"/> <TopLine Value="98"/>
<EditorIndex Value="12"/> <EditorIndex Value="11"/>
<UsageCount Value="23"/> <UsageCount Value="23"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit240> </Unit240>
@ -1732,7 +1732,7 @@
<UnitName Value="updater"/> <UnitName Value="updater"/>
<CursorPos X="38" Y="211"/> <CursorPos X="38" Y="211"/>
<TopLine Value="65"/> <TopLine Value="65"/>
<UsageCount Value="107"/> <UsageCount Value="108"/>
</Unit242> </Unit242>
<Unit243> <Unit243>
<Filename Value="updateform.pas"/> <Filename Value="updateform.pas"/>
@ -1742,8 +1742,8 @@
<UnitName Value="updateform"/> <UnitName Value="updateform"/>
<CursorPos X="111" Y="102"/> <CursorPos X="111" Y="102"/>
<TopLine Value="81"/> <TopLine Value="81"/>
<EditorIndex Value="10"/> <EditorIndex Value="9"/>
<UsageCount Value="102"/> <UsageCount Value="103"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit243> </Unit243>
<Unit244> <Unit244>
@ -1865,7 +1865,7 @@
<UnitName Value="simbasettings"/> <UnitName Value="simbasettings"/>
<CursorPos X="26" Y="9"/> <CursorPos X="26" Y="9"/>
<TopLine Value="11"/> <TopLine Value="11"/>
<UsageCount Value="65"/> <UsageCount Value="66"/>
</Unit261> </Unit261>
<Unit262> <Unit262>
<Filename Value="../../Units/MMLAddon/settings.pas"/> <Filename Value="../../Units/MMLAddon/settings.pas"/>
@ -1910,7 +1910,7 @@
<UnitName Value="reportbug"/> <UnitName Value="reportbug"/>
<CursorPos X="53" Y="23"/> <CursorPos X="53" Y="23"/>
<TopLine Value="21"/> <TopLine Value="21"/>
<UsageCount Value="48"/> <UsageCount Value="49"/>
</Unit267> </Unit267>
<Unit268> <Unit268>
<Filename Value="../../Units/Synapse/synsock.pas"/> <Filename Value="../../Units/Synapse/synsock.pas"/>
@ -1967,7 +1967,7 @@
<UnitName Value="newinternets"/> <UnitName Value="newinternets"/>
<CursorPos X="80" Y="2"/> <CursorPos X="80" Y="2"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="44"/> <UsageCount Value="45"/>
</Unit275> </Unit275>
<Unit276> <Unit276>
<Filename Value="reportbug.lrs"/> <Filename Value="reportbug.lrs"/>
@ -2013,8 +2013,8 @@
<Unit282> <Unit282>
<Filename Value="../../Units/MMLCore/iomanager.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<UnitName Value="IOManager"/> <UnitName Value="IOManager"/>
<CursorPos X="84" Y="329"/> <CursorPos X="1" Y="229"/>
<TopLine Value="318"/> <TopLine Value="212"/>
<EditorIndex Value="5"/> <EditorIndex Value="5"/>
<UsageCount Value="14"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -2022,8 +2022,8 @@
<Unit283> <Unit283>
<Filename Value="../../Units/MMLCore/os_linux.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<UnitName Value="os_linux"/> <UnitName Value="os_linux"/>
<CursorPos X="1" Y="141"/> <CursorPos X="40" Y="41"/>
<TopLine Value="124"/> <TopLine Value="12"/>
<EditorIndex Value="7"/> <EditorIndex Value="7"/>
<UsageCount Value="14"/> <UsageCount Value="14"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -2033,132 +2033,126 @@
<UnitName Value="Mouse"/> <UnitName Value="Mouse"/>
<CursorPos X="21" Y="30"/> <CursorPos X="21" Y="30"/>
<TopLine Value="12"/> <TopLine Value="12"/>
<EditorIndex Value="9"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit284> </Unit284>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="29" HistoryIndex="28">
<Position1> <Position1>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="1275" Column="21" TopLine="1258"/> <Caret Line="155" Column="48" TopLine="139"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="579" Column="45" TopLine="573"/> <Caret Line="175" Column="5" TopLine="141"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="1277" Column="11" TopLine="1259"/> <Caret Line="151" Column="34" TopLine="130"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="290" Column="11" TopLine="273"/> <Caret Line="201" Column="24" TopLine="185"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="579" Column="62" TopLine="562"/> <Caret Line="271" Column="33" TopLine="254"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="228" Column="22" TopLine="1"/> <Caret Line="184" Column="39" TopLine="167"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="139" Column="54" TopLine="116"/> <Caret Line="288" Column="23" TopLine="271"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="32" Column="13" TopLine="23"/> <Caret Line="291" Column="18" TopLine="274"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="49" Column="46" TopLine="32"/> <Caret Line="298" Column="120" TopLine="281"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="59" Column="26" TopLine="42"/> <Caret Line="302" Column="32" TopLine="285"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="49" Column="38" TopLine="32"/> <Caret Line="173" Column="31" TopLine="156"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="59" Column="26" TopLine="42"/> <Caret Line="308" Column="43" TopLine="291"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="83" Column="1" TopLine="66"/> <Caret Line="384" Column="32" TopLine="367"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="85" Column="44" TopLine="68"/> <Caret Line="413" Column="39" TopLine="397"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="109" Column="24" TopLine="92"/> <Caret Line="449" Column="32" TopLine="418"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="283" Column="15" TopLine="129"/> <Caret Line="109" Column="79" TopLine="93"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="115" Column="18" TopLine="97"/> <Caret Line="236" Column="17" TopLine="220"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="118" Column="35" TopLine="101"/> <Caret Line="327" Column="105" TopLine="311"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="32" Column="39" TopLine="23"/> <Caret Line="163" Column="1" TopLine="145"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="196" Column="25" TopLine="86"/> <Caret Line="322" Column="32" TopLine="309"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="../../Units/MMLAddon/windowselector.pas"/> <Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="143" Column="25" TopLine="115"/> <Caret Line="99" Column="39" TopLine="82"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="37" Column="60" TopLine="16"/> <Caret Line="40" Column="49" TopLine="12"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<Caret Line="576" Column="53" TopLine="562"/> <Caret Line="51" Column="26" TopLine="33"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="1273" Column="85" TopLine="1256"/> <Caret Line="47" Column="30" TopLine="23"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="309" Column="12" TopLine="298"/> <Caret Line="32" Column="15" TopLine="23"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="1275" Column="46" TopLine="1257"/> <Caret Line="167" Column="21" TopLine="150"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="1548" Column="9" TopLine="1531"/> <Caret Line="154" Column="25" TopLine="144"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/os_linux.pas"/>
<Caret Line="1304" Column="10" TopLine="1287"/> <Caret Line="41" Column="40" TopLine="12"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="testunit.pas"/> <Filename Value="../../Units/MMLCore/iomanager.pas"/>
<Caret Line="1548" Column="10" TopLine="1531"/> <Caret Line="229" Column="1" TopLine="212"/>
</Position29> </Position29>
<Position30>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="229" Column="22" TopLine="206"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -3,7 +3,7 @@ unit IOManager;
interface interface
uses uses
Classes, SysUtils, mufasatypes; Classes, SysUtils, mufasatypes, graphics, LCLType, bitmaps, LCLIntf;
type type
@ -40,7 +40,7 @@ interface
TRawTarget = class(TTarget) TRawTarget = class(TTarget)
public public
constructor Create(rgb: prgb32; w,h: integer); constructor Create(rgb: prgb32; w,h: integer);
destructor Destory; override; destructor Destroy; override;
procedure GetTargetDimensions(var w, h: integer); override; procedure GetTargetDimensions(var w, h: integer); override;
function ReturnData(xs, ys, width, height: Integer): TRetData; override; function ReturnData(xs, ys, width, height: Integer): TRetData; override;
@ -65,7 +65,7 @@ interface
procedure SendString(str: PChar); override; abstract; procedure SendString(str: PChar); override; abstract;
procedure HoldKey(key: integer); override; abstract; procedure HoldKey(key: integer); override; abstract;
procedure ReleaseKey(key: integer); override; abstract; procedure ReleaseKey(key: integer); override; abstract;
function IsKeyHeld(key: integer): boolean; override; abstract;\ function IsKeyHeld(key: integer): boolean; override; abstract;
end; end;
{ Contains the pointers to a non-internal target implementation using the EIOS specification. { Contains the pointers to a non-internal target implementation using the EIOS specification.
@ -104,10 +104,9 @@ interface
TEIOS_Target = class(TTarget) TEIOS_Target = class(TTarget)
public public
constructor Create(client: TEIOS_Client; initval: pointer); constructor Create(client: TEIOS_Client; initval: pointer);
destructor Destory; override; destructor Destroy; override;
procedure GetTargetDimensions(var w, h: integer); override; procedure GetTargetDimensions(var w, h: integer); override;
function GetColor(x,y : integer) : TColor; override;
function ReturnData(xs, ys, width, height: Integer): TRetData; override; function ReturnData(xs, ys, width, height: Integer): TRetData; override;
procedure GetMousePosition(var x,y: integer); override; procedure GetMousePosition(var x,y: integer); override;
@ -152,8 +151,8 @@ interface
function GetClient(name: string): TEIOS_Client; function GetClient(name: string): TEIOS_Client;
private private
function FindClient(name:string): integer;
plugs: array of TEIOS_LoadedPlugin; plugs: array of TEIOS_LoadedPlugin;
function FindClient(name:string): integer;
end; end;
{ This class specifies the object that will go in the ThreadVar to give the script access { This class specifies the object that will go in the ThreadVar to give the script access
@ -170,7 +169,7 @@ interface
procedure SetDesktop; virtual; abstract; procedure SetDesktop; virtual; abstract;
function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload; function SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; overload;
function SetTarget(Bitmap : TMufasaBitmap) : integer; overload; function SetTarget(bmp : TMufasaBitmap) : integer; overload;
function SetTarget(name: string; initargs: pointer): integer; overload; function SetTarget(name: string; initargs: pointer): integer; overload;
function TargetValid: Boolean; function TargetValid: Boolean;
@ -179,9 +178,10 @@ interface
procedure FreeReturnData; procedure FreeReturnData;
procedure GetDimensions(var W, H: Integer); procedure GetDimensions(var W, H: Integer);
procedure ActivateClient;
property Frozen: boolean read IsFrozen; function IsFrozen: boolean;
procedure SetFrozen(frozen: boolean); procedure SetFrozen(makefrozen: boolean);
procedure GetMousePos(var X, Y: Integer); procedure GetMousePos(var X, Y: Integer);
procedure SetMousePos(X, Y: Integer); procedure SetMousePos(X, Y: Integer);
@ -198,7 +198,7 @@ interface
protected protected
controller: TEIOS_Controller; controller: TEIOS_Controller;
keymouse: TTarget; keymouse: TTarget;
image: TTarget image: TTarget;
frozen: TTarget; frozen: TTarget;
freezebuffer: prgb32; freezebuffer: prgb32;
bothsame: boolean; bothsame: boolean;
@ -233,8 +233,8 @@ implementation
begin begin
if bothsame then keymouse.Destroy() else if bothsame then keymouse.Destroy() else
begin begin
keymouse.Destroy(); keymouse.Free();
image.Destroy(); image.Free();
end; end;
if frozen <> nil then frozen.Destroy(); if frozen <> nil then frozen.Destroy();
if controller <> nil then controller.Destroy(); if controller <> nil then controller.Destroy();
@ -244,13 +244,13 @@ implementation
begin begin
if frozen <> nil then if frozen <> nil then
raise Exception.Create('You cannot set a target when Frozen'); raise Exception.Create('You cannot set a target when Frozen');
if not(bothsame) then image.Destroy(); if not(bothsame) then image.Free();
image:= target; image:= target;
bothsame:= false; bothsame:= false;
end; end;
procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget); procedure TIOManager_Abstract.SetKeyMouseTarget(target: TTarget);
begin begin
if not(bothsame) then keymouse.Destroy(); if not(bothsame) then keymouse.Free();
keymouse:= target; keymouse:= target;
bothsame:= false; bothsame:= false;
end; end;
@ -260,8 +260,8 @@ implementation
raise Exception.Create('You cannot set a target when Frozen'); raise Exception.Create('You cannot set a target when Frozen');
if bothsame then image.Destroy() else if bothsame then image.Destroy() else
begin begin
image.Destroy(); image.Free();
keymouse.Destroy(); keymouse.Free();
end; end;
image:= target; image:= target;
keymouse:= target; keymouse:= target;
@ -285,17 +285,22 @@ implementation
end else if frozen = nil then end else if frozen = nil then
begin begin
frozen:= image; frozen:= image;
frozen.GetDimensions(w,h); frozen.GetTargetDimensions(w,h);
buffer:= frozen.ReturnData(0,0,w,h); buffer:= frozen.ReturnData(0,0,w,h);
GetMem(freezebuffer, w * h * sizeof(TRGB32)); GetMem(freezebuffer, w * h * sizeof(TRGB32));
Move(PtrReturn.Ptr[0], freezebuffer[0], w*h*sizeof(TRGB32)); Move(buffer.Ptr[0], freezebuffer[0], w*h*sizeof(TRGB32));
frozen.FreeReturnData; frozen.FreeReturnData;
image:= TRawTarget.Create(freezebuffer,w,h); image:= TRawTarget.Create(freezebuffer,w,h);
end; end;
end; end;
function TIOManager_Abstract.IsFrozen: boolean;
begin
result:= frozen <> nil;
end;
function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end; function TIOManager_Abstract.GetColor(x,y : integer) : TColor; begin result:= image.GetColor(x,y); end;
function TIOManager_Abstract.ReturnData(xs,yx,width,height: integer): TRetData; begin result:= image.ReturnData(xs,yx,width,height); end; function TIOManager_Abstract.ReturnData(xs,ys,width,height: integer): TRetData; begin result:= image.ReturnData(xs,ys,width,height); end;
procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end; procedure TIOManager_Abstract.FreeReturnData; begin image.freeReturnData(); end;
function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y)); end; function TIOManager_Abstract.SetTarget(ArrPtr: PRGB32; Size: TPoint): integer; begin SetImageTarget(TRawTarget.Create(ArrPtr,Size.X,Size.Y)); end;
@ -304,8 +309,8 @@ implementation
var var
client: TEIOS_Client; client: TEIOS_Client;
begin begin
if not controller.ClientExists(name) then raise Exception.Create('EIOS Client by specified name does not exist');
client:= controller.GetClient(name); client:= controller.GetClient(name);
if client = nil then raise Exception.Create('EIOS Client by specified name does not exist');
SetBothTargets(TEIOS_Target.Create(client, initargs)); SetBothTargets(TEIOS_Target.Create(client, initargs));
end; end;
@ -314,6 +319,21 @@ implementation
result:= (keymouse <> nil) and (image <> nil); result:= (keymouse <> nil) and (image <> nil);
end; end;
procedure TIOManager_Abstract.GetDimensions(var W, H: Integer); begin image.GetTargetDimensions(w,h) end;
procedure TIOManager_Abstract.ActivateClient; begin {lolwat} end;
procedure TIOManager_Abstract.GetMousePos(var X, Y: Integer); begin keymouse.GetMousePosition(x,y) end;
procedure TIOManager_Abstract.SetMousePos(X, Y: Integer); begin keymouse.MoveMouse(x,y); end;
procedure TIOManager_Abstract.MouseButtonAction(x,y : integer; mClick: TClickType; mPress: TMousePress); begin {lolwat} end;
procedure TIOManager_Abstract.MouseButtonActionSilent(x,y : integer; mClick: TClickType; mPress: TMousePress); begin {lolwat} end;
procedure TIOManager_Abstract.ClickMouse(X, Y: Integer; mClick: TClickType); begin {lolwat} end;
procedure TIOManager_Abstract.KeyUp(key: Word); begin keymouse.ReleaseKey(key) end;
procedure TIOManager_Abstract.KeyDown(key: Word); begin keymouse.HoldKey(key) end;
procedure TIOManager_Abstract.PressKey(key: Word); begin {lolwat} end;
procedure TIOManager_Abstract.SendText(text: string); begin keymouse.SendString(PChar(@text[1])); end;
function TIOManager_Abstract.isKeyDown(key: Word): Boolean; begin result:= keymouse.IsKeyHeld(key); end;
//***implementation*** TTarget //***implementation*** TTarget
procedure TTarget.GetTargetDimensions(var w, h: integer); begin raise Exception.Create('GetTargetDimensions not avaliable for this target'); end; procedure TTarget.GetTargetDimensions(var w, h: integer); begin raise Exception.Create('GetTargetDimensions not avaliable for this target'); end;
@ -381,7 +401,7 @@ implementation
self.h:= h; self.h:= h;
end; end;
destructor TRawTarget.Destory; destructor TRawTarget.Destroy;
begin begin
{do nothing} {do nothing}
inherited Destroy; inherited Destroy;
@ -410,7 +430,7 @@ implementation
//Load plugins from plugins folder //Load plugins from plugins folder
end; end;
destructor TEIOS_Controller.Destroy destructor TEIOS_Controller.Destroy;
var var
i: integer; i: integer;
begin begin
@ -447,8 +467,6 @@ implementation
i:= FindClient(name); i:= FindClient(name);
if i >= 0 then if i >= 0 then
result:= plugs[i].client result:= plugs[i].client
else
result:= nil;
end; end;
end. end.

View File

@ -7,6 +7,8 @@ interface
type type
TNativeWindow = x.TWindow;
TWindow = class(TWindow_Abstract) TWindow = class(TWindow_Abstract)
public public
constructor Create(display: PDisplay; screennum: integer; window: x.TWindow); constructor Create(display: PDisplay; screennum: integer; window: x.TWindow);
@ -35,12 +37,12 @@ interface
TIOManager = class(TIOManager_Abstract) TIOManager = class(TIOManager_Abstract)
public public
constructor Create(plugin_dir: string); constructor Create(plugin_dir: string);
destructor Destroy; override; function SetTarget(target: TNativeWindow): integer; overload;
function SetTarget(target: x.TWindow): integer; overload; procedure SetDesktop; override;
procedure SetDesktop;
private private
procedure NativeInit; override; procedure NativeInit; override;
procedure NativeFree; override; procedure NativeFree; override;
public
display: PDisplay; display: PDisplay;
screennum: integer; screennum: integer;
desktop: x.TWindow; desktop: x.TWindow;
@ -49,6 +51,8 @@ interface
implementation implementation
uses windowutil, GraphType;
//***implementation*** TWindow //***implementation*** TWindow
constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow); constructor TWindow.Create(display: PDisplay; screennum: integer; window: x.TWindow);
@ -77,7 +81,7 @@ implementation
if XGetWindowAttributes(display, window, @Attrib) <> 0 Then if XGetWindowAttributes(display, window, @Attrib) <> 0 Then
begin begin
{ I don't think we need this XTranslateCoordinates... :D } { I don't think we need this XTranslateCoordinates... :D }
XTranslateCoordinates(display, seld.window, RootWindow(display, screennum), 0,0, @newx, @newy, @childwindow); XTranslateCoordinates(display, window, RootWindow(display, screennum), 0,0, @newx, @newy, @childwindow);
W := Attrib.Width; W := Attrib.Width;
H := Attrib.Height; H := Attrib.Height;
end else end else
@ -92,8 +96,9 @@ implementation
function TWindow.ReturnData(xs, ys, width, height: Integer): TRetData; function TWindow.ReturnData(xs, ys, width, height: Integer): TRetData;
var var
Old_Handler: TXErrorHandler; Old_Handler: TXErrorHandler;
w,h: integer;
begin begin
GetDimensions(w,h); GetTargetDimensions(w,h);
if (xs < 0) or (xs + width > w) or (ys < 0) or (ys + height > h) then if (xs < 0) or (xs + width > w) or (ys < 0) or (ys + height > h) then
raise Exception.CreateFMT('TMWindow.ReturnData: The parameters passed are wrong; xs,ys %d,%d width,height %d,%d',[xs,ys,width,height]); raise Exception.CreateFMT('TMWindow.ReturnData: The parameters passed are wrong; xs,ys %d,%d width,height %d,%d',[xs,ys,width,height]);
if dirty then if dirty then
@ -143,6 +148,11 @@ implementation
//***implementation*** IOManager //***implementation*** IOManager
constructor TIOManager.Create(plugin_dir: string);
begin
inherited Create(plugin_dir);
end;
procedure TIOManager.NativeInit; procedure TIOManager.NativeInit;
begin begin
display := XOpenDisplay(nil); display := XOpenDisplay(nil);
@ -150,7 +160,6 @@ implementation
begin begin
// throw Exception // throw Exception
end; end;
screen := XDefaultScreenOfDisplay(display);
screennum:= DefaultScreen(display); screennum:= DefaultScreen(display);
desktop:= RootWindow(display,screennum) desktop:= RootWindow(display,screennum)
end; end;
@ -170,4 +179,4 @@ implementation
SetBothTargets(TWindow.Create(display, screennum, target)) SetBothTargets(TWindow.Create(display, screennum, target))
end; end;
end.