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

Je ziet maar

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@11 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2009-09-03 03:59:26 +00:00
parent abb0020dc5
commit ba1e0833b0
6 changed files with 683 additions and 556 deletions

View File

@ -103,13 +103,14 @@ var
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
var var
MousePoint : TPoint; MousePoint : TPoint;
Rect : TRect;
{$ENDIF} {$ENDIF}
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
Windows.GetCursorPos(MousePoint); Windows.GetCursorPos(MousePoint);
Windows.ScreenToClient( TClient(Client).MWindow.TargetHandle, MousePoint); GetWindowRect(TClient(Client).MWindow.TargetHandle,Rect);
x := MousePoint.x; x := MousePoint.x - Rect.Left;
y := MousePoint.y; y := MousePoint.y - Rect.Top;
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
@ -131,6 +132,7 @@ begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
GetWindowRect(TClient(Client).MWindow.TargetHandle, Rect); GetWindowRect(TClient(Client).MWindow.TargetHandle, Rect);
Windows.SetCursorPos(x + Rect.Left, y + Rect.Top); Windows.SetCursorPos(x + Rect.Left, y + Rect.Top);
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
@ -229,8 +231,8 @@ begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
case mType of case mType of
Mouse_Left: Result := (GetAsyncKeyState(VK_LBUTTON) <> 0); Mouse_Left: Result := (GetAsyncKeyState(VK_LBUTTON) <> 0);
Mouse_Middle: Result := (GetAsyncKeyState(VK_MBUTTON) <> 0) Mouse_Middle: Result := (GetAsyncKeyState(VK_MBUTTON) <> 0);
Mouse_Right: Result := (GetAsyncKeyState(VK_RBUTTON) <> 0) mouse_Right: Result := (GetAsyncKeyState(VK_RBUTTON) <> 0);
end; end;
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}

View File

@ -5,22 +5,28 @@ unit Window;
interface interface
uses uses
Classes, SysUtils, mufasatypes, graphics, Classes, SysUtils, mufasatypes{$IFDEF MSWINDOWS},windows {$ENDIF}, graphics,
LCLType LCLType
{$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF}; {$IFDEF LINUX}, xlib, x, xutil, ctypes{$ENDIF};
type type
{ TMWindow }
TMWindow = class(TObject) TMWindow = class(TObject)
function ReturnData(xs, ys, width, height: Integer): PRGB32; function ReturnData(xs, ys, width, height: Integer): PRGB32;
procedure FreeReturnData; procedure FreeReturnData;
procedure GetDimensions(var W, H: Integer); procedure GetDimensions(var W, H: Integer);
function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap; function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
procedure ActivateClient;
{$IFDEF LINUX} {$IFDEF LINUX}
function SetTarget(XWindow: x.TWindow): integer; overload; function SetTarget(XWindow: x.TWindow): integer; overload;
{$ENDIF} {$ENDIF}
{$IFDEF MSWINDOWS}
function UpdateDrawBitmap:boolean;
{$ENDIF}
function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload; function SetTarget(Window: THandle; NewType: TTargetWindowMode): integer; overload;
function SetTarget(ArrPtr: PRGB32): integer; overload; function SetTarget(ArrPtr: PRGB32): integer; overload;
@ -33,9 +39,15 @@ type
// Target Window Mode. // Target Window Mode.
TargetMode: TTargetWindowMode; TargetMode: TTargetWindowMode;
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
//Target handle; HWND //Target handle; HWND
TargetHandle : Hwnd; TargetHandle : Hwnd;
DrawBmpDataPtr : PRGB32;
//Works on linux as well, test it out
TargetDC : HDC;
DrawBitmap : TBitmap;
{$ENDIF} {$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
@ -90,6 +102,13 @@ constructor TMWindow.Create(Client: TObject);
begin begin
inherited Create; inherited Create;
Self.Client := Client; Self.Client := Client;
{$IFDEF MSWINDOWS}
Self.DrawBitmap := TBitmap.Create;
Self.TargetMode:= w_Window;
Self.TargetHandle:= windows.GetDesktopWindow;
Self.TargetDC:= GetWindowDC(Self.TargetHandle);
Self.UpdateDrawBitmap;
{$ENDIF}
{$IFDEF LINUX} {$IFDEF LINUX}
Self.TargetMode := w_XWindow; Self.TargetMode := w_XWindow;
@ -106,8 +125,6 @@ begin
Self.DesktopWindow:= RootWindow(Self.XDisplay, Self.XScreenNum); Self.DesktopWindow:= RootWindow(Self.XDisplay, Self.XScreenNum);
Self.CurWindow:= Self.DesktopWindow; Self.CurWindow:= Self.DesktopWindow;
{$ELSE}
// Set Target mode for windows.
{$ENDIF} {$ENDIF}
end; end;
@ -118,7 +135,11 @@ begin
{$IFDEF LINUX} {$IFDEF LINUX}
XCloseDisplay(Self.XDisplay); XCloseDisplay(Self.XDisplay);
{$ENDIF} {$ENDIF}
{$IFDEF MSWINDOWS}
if TargetMode = w_Window then
ReleaseDC(TargetHandle,TargetDC);
DrawBitmap.Free;
{$ENDIF}
inherited; inherited;
end; end;
@ -129,6 +150,13 @@ var
{$ENDIF} {$ENDIF}
begin begin
case Self.TargetMode of case Self.TargetMode of
w_Window:
begin
{$IFDEF MSWINDOWS}
BitBlt(Self.DrawBitmap.Canvas.Handle,0,0, width, height, Self.TargetDC, xs,ys, SRCCOPY);
Result := Self.DrawBmpDataPtr;
{$ENDIF}
end;
w_XWindow: w_XWindow:
begin begin
{$IFDEF LINUX} {$IFDEF LINUX}
@ -190,6 +218,17 @@ begin
hh := ye-ys; hh := ye-ys;
case Self.TargetMode Of case Self.TargetMode Of
w_Window:
begin
{$IFDEF MSWINDOWS}
if(xs < 0) or (ys < 0) or (xe > W) or (ye > H) then
Writeln('pervet');
Result := TBitmap.Create;
Result.SetSize(ww+1,hh+1);
BitBlt(result.canvas.handle,0,0,ww+1,hh+1,
self.TargetDC,xs,ys, SRCCOPY);
{$ENDIF}
end;
w_XWindow: w_XWindow:
begin begin
{$IFDEF LINUX} {$IFDEF LINUX}
@ -225,6 +264,30 @@ begin
end; end;
end; end;
procedure TMWindow.ActivateClient;
begin
{$IFDEF MSWINDOWS}
SetForegroundWindow(Self.TargetHandle);
{$ENDIF}
{$IFDEF LINUX}
XSetInputFocus(Self.XDisplay,Self.CurWindow,RevertToParent,CurrentTime);
{$ENDIF}
end;
{$IFDEF MSWINDOWS} //Probably need one for Linux as well
function TMWindow.UpdateDrawBitmap :boolean;
var
w,h : integer;
BmpInfo : Windows.TBitmap;
begin
GetDimensions(w,h);
DrawBitmap.SetSize(w,h);
GetObject(DrawBitmap.Handle, SizeOf(BmpInfo), @BmpInfo);
DrawBmpDataPtr := BmpInfo.bmBits;
end;
{$ENDIF}
procedure TMWindow.GetDimensions(var W, H: Integer); procedure TMWindow.GetDimensions(var W, H: Integer);
{$IFDEF LINUX} {$IFDEF LINUX}
var var
@ -233,10 +296,19 @@ var
childwindow : x.TWindow; childwindow : x.TWindow;
Old_Handler: TXErrorHandler; Old_Handler: TXErrorHandler;
{$ENDIF} {$ENDIF}
{$IFDEF MSWINDOWS}
var
Rect : TRect;
{$ENDIF}
begin begin
case TargetMode of case TargetMode of
w_Window: w_Window:
begin begin
{$IFDEF MSWINDOWS}
GetWindowRect(Self.TargetHandle, Rect);
w:= Rect.Right - Rect.left + 1;
h:= Rect.Bottom - Rect.Top + 1;
{$ENDIF}
end; end;
w_XWindow: w_XWindow:
begin begin
@ -280,8 +352,19 @@ begin
if NewType in [ w_XWindow, w_ArrayPtr ] then if NewType in [ w_XWindow, w_ArrayPtr ] then
begin begin
// throw exception // throw exception
Exit;
end; end;
case NewType of
w_Window :
begin;
ReleaseDC(Self.TargetHandle,Self.TargetDC);
Self.TargetHandle := Window;
Self.TargetDC := GetWindowDC(Window);
end;
end;
{$IFDEF MSWINDOWS}
UpdateDrawBitmap;
{$ENDIF}
end; end;
function TMWindow.SetTarget(ArrPtr: PRGB32): integer; overload; function TMWindow.SetTarget(ArrPtr: PRGB32): integer; overload;

View File

@ -6,7 +6,7 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="6"/> <ActiveEditorIndexAtStart Value="10"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -30,15 +30,15 @@
<PackageName Value="LCL"/> <PackageName Value="LCL"/>
</Item1> </Item1>
</RequiredPackages> </RequiredPackages>
<Units Count="26"> <Units Count="33">
<Unit0> <Unit0>
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="project1"/> <UnitName Value="project1"/>
<CursorPos X="60" Y="16"/> <CursorPos X="1" Y="19"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="1"/> <EditorIndex Value="0"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
<Unit1> <Unit1>
@ -49,7 +49,7 @@
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="33" Y="57"/> <CursorPos X="33" Y="57"/>
<TopLine Value="32"/> <TopLine Value="32"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
</Unit1> </Unit1>
<Unit2> <Unit2>
<Filename Value="client.pas"/> <Filename Value="client.pas"/>
@ -57,16 +57,14 @@
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="18" Y="34"/> <CursorPos X="18" Y="34"/>
<TopLine Value="10"/> <TopLine Value="10"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
</Unit2> </Unit2>
<Unit3> <Unit3>
<Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/> <Filename Value="../cogat/Units/CogatUnits/comptypes.pas"/>
<UnitName Value="CompTypes"/> <UnitName Value="CompTypes"/>
<CursorPos X="13" Y="531"/> <CursorPos X="13" Y="531"/>
<TopLine Value="523"/> <TopLine Value="523"/>
<EditorIndex Value="8"/>
<UsageCount Value="22"/> <UsageCount Value="22"/>
<Loaded Value="True"/>
</Unit3> </Unit3>
<Unit4> <Unit4>
<Filename Value="mufasatypes.pas"/> <Filename Value="mufasatypes.pas"/>
@ -74,7 +72,7 @@
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="52" Y="20"/> <CursorPos X="52" Y="20"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
</Unit4> </Unit4>
<Unit5> <Unit5>
<Filename Value="window.pas"/> <Filename Value="window.pas"/>
@ -82,10 +80,10 @@
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="4" Y="100"/> <CursorPos X="4" Y="100"/>
<TopLine Value="85"/> <TopLine Value="85"/>
<UsageCount Value="44"/> <UsageCount Value="48"/>
</Unit5> </Unit5>
<Unit6> <Unit6>
<Filename Value="../../Documents/fpc/rtl/inc/systemh.inc"/> <Filename Value="../Documents/fpc/rtl/inc/systemh.inc"/>
<CursorPos X="3" Y="261"/> <CursorPos X="3" Y="261"/>
<TopLine Value="246"/> <TopLine Value="246"/>
<UsageCount Value="8"/> <UsageCount Value="8"/>
@ -96,51 +94,49 @@
<UnitName Value="Input"/> <UnitName Value="Input"/>
<CursorPos X="5" Y="20"/> <CursorPos X="5" Y="20"/>
<TopLine Value="15"/> <TopLine Value="15"/>
<UsageCount Value="43"/> <UsageCount Value="47"/>
</Unit7> </Unit7>
<Unit8> <Unit8>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/> <Filename Value="../cogat/Units/CogatUnits/compinput.pas"/>
<UnitName Value="CompInput"/> <UnitName Value="CompInput"/>
<CursorPos X="43" Y="250"/> <CursorPos X="43" Y="250"/>
<TopLine Value="236"/> <TopLine Value="236"/>
<EditorIndex Value="10"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit8> </Unit8>
<Unit9> <Unit9>
<Filename Value="Units/MMLCore/client.pas"/> <Filename Value="Units/MMLCore/client.pas"/>
<UnitName Value="Client"/> <UnitName Value="Client"/>
<CursorPos X="1" Y="1"/> <CursorPos X="27" Y="16"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="7"/> <EditorIndex Value="11"/>
<UsageCount Value="18"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit9> </Unit9>
<Unit10> <Unit10>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/input.pas"/>
<UnitName Value="Input"/> <UnitName Value="Input"/>
<CursorPos X="42" Y="141"/> <CursorPos X="52" Y="241"/>
<TopLine Value="125"/> <TopLine Value="234"/>
<EditorIndex Value="2"/> <EditorIndex Value="1"/>
<UsageCount Value="18"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit10> </Unit10>
<Unit11> <Unit11>
<Filename Value="Units/MMLCore/mufasatypes.pas"/> <Filename Value="Units/MMLCore/mufasatypes.pas"/>
<UnitName Value="MufasaTypes"/> <UnitName Value="MufasaTypes"/>
<CursorPos X="40" Y="19"/> <CursorPos X="20" Y="3"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="3"/> <EditorIndex Value="6"/>
<UsageCount Value="18"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit11> </Unit11>
<Unit12> <Unit12>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="20" Y="279"/> <CursorPos X="14" Y="329"/>
<TopLine Value="258"/> <TopLine Value="185"/>
<EditorIndex Value="4"/> <EditorIndex Value="7"/>
<UsageCount Value="18"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit12> </Unit12>
<Unit13> <Unit13>
@ -149,40 +145,34 @@
<UnitName Value="windowutil"/> <UnitName Value="windowutil"/>
<CursorPos X="45" Y="13"/> <CursorPos X="45" Y="13"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<UsageCount Value="36"/> <UsageCount Value="40"/>
</Unit13> </Unit13>
<Unit14> <Unit14>
<Filename Value="../../Documents/lazarus/lcl/graphics.pp"/> <Filename Value="../Documents/lazarus/lcl/graphics.pp"/>
<UnitName Value="Graphics"/> <UnitName Value="Graphics"/>
<CursorPos X="15" Y="1287"/> <CursorPos X="15" Y="1287"/>
<TopLine Value="1272"/> <TopLine Value="1272"/>
<EditorIndex Value="0"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit14> </Unit14>
<Unit15> <Unit15>
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/> <Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
<UnitName Value="CompBitmaps"/> <UnitName Value="CompBitmaps"/>
<CursorPos X="1" Y="109"/> <CursorPos X="1" Y="109"/>
<TopLine Value="92"/> <TopLine Value="92"/>
<EditorIndex Value="11"/>
<UsageCount Value="17"/> <UsageCount Value="17"/>
<Loaded Value="True"/>
</Unit15> </Unit15>
<Unit16> <Unit16>
<Filename Value="../../Documents/lazarus/lcl/include/rasterimage.inc"/> <Filename Value="../Documents/lazarus/lcl/include/rasterimage.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="1" Y="1"/>
<TopLine Value="691"/> <TopLine Value="691"/>
<UsageCount Value="9"/> <UsageCount Value="9"/>
</Unit16> </Unit16>
<Unit17> <Unit17>
<Filename Value="../../Documents/fpc/packages/x11/src/xlib.pp"/> <Filename Value="../Documents/fpc/packages/x11/src/xlib.pp"/>
<UnitName Value="xlib"/> <UnitName Value="xlib"/>
<CursorPos X="47" Y="1272"/> <CursorPos X="47" Y="1272"/>
<TopLine Value="1257"/> <TopLine Value="1257"/>
<EditorIndex Value="5"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit17> </Unit17>
<Unit18> <Unit18>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
@ -190,10 +180,10 @@
<HasResources Value="True"/> <HasResources Value="True"/>
<ResourceBaseClass Value="Form"/> <ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="30" Y="72"/> <CursorPos X="34" Y="61"/>
<TopLine Value="64"/> <TopLine Value="50"/>
<EditorIndex Value="6"/> <EditorIndex Value="10"/>
<UsageCount Value="15"/> <UsageCount Value="17"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
<Unit19> <Unit19>
@ -201,19 +191,17 @@
<UnitName Value="CompColors"/> <UnitName Value="CompColors"/>
<CursorPos X="44" Y="914"/> <CursorPos X="44" Y="914"/>
<TopLine Value="897"/> <TopLine Value="897"/>
<EditorIndex Value="9"/>
<UsageCount Value="15"/> <UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit19> </Unit19>
<Unit20> <Unit20>
<Filename Value="../../Documents/fpc/packages/x11/src/x.pp"/> <Filename Value="../Documents/fpc/packages/x11/src/x.pp"/>
<UnitName Value="x"/> <UnitName Value="x"/>
<CursorPos X="4" Y="179"/> <CursorPos X="4" Y="179"/>
<TopLine Value="164"/> <TopLine Value="164"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit20> </Unit20>
<Unit21> <Unit21>
<Filename Value="../../Documents/fpc/rtl/unix/aliasctp.inc"/> <Filename Value="../Documents/fpc/rtl/unix/aliasctp.inc"/>
<CursorPos X="63" Y="45"/> <CursorPos X="63" Y="45"/>
<TopLine Value="30"/> <TopLine Value="30"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
@ -226,7 +214,7 @@
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit22> </Unit22>
<Unit23> <Unit23>
<Filename Value="../../Documents/lazarus/lcl/lcltype.pp"/> <Filename Value="../Documents/lazarus/lcl/lcltype.pp"/>
<UnitName Value="LCLType"/> <UnitName Value="LCLType"/>
<CursorPos X="9" Y="99"/> <CursorPos X="9" Y="99"/>
<TopLine Value="83"/> <TopLine Value="83"/>
@ -240,134 +228,189 @@
<SyntaxHighlighter Value="LFM"/> <SyntaxHighlighter Value="LFM"/>
</Unit24> </Unit24>
<Unit25> <Unit25>
<Filename Value="../../Documents/fpc/rtl/unix/unix.pp"/> <Filename Value="../Documents/fpc/rtl/unix/unix.pp"/>
<UnitName Value="Unix"/> <UnitName Value="Unix"/>
<CursorPos X="63" Y="63"/> <CursorPos X="63" Y="63"/>
<TopLine Value="56"/> <TopLine Value="56"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
</Unit25> </Unit25>
<Unit26>
<Filename Value="../Compilertje/Units/CogatUnits/compinput.pas"/>
<UnitName Value="CompInput"/>
<CursorPos X="6" Y="462"/>
<TopLine Value="449"/>
<EditorIndex Value="2"/>
<UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
<Filename Value="../FPC/FPCCheckout/rtl/win/wininc/func.inc"/>
<CursorPos X="10" Y="663"/>
<TopLine Value="635"/>
<EditorIndex Value="5"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit27>
<Unit28>
<Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<UnitName Value="CompTypes"/>
<CursorPos X="13" Y="418"/>
<TopLine Value="402"/>
<EditorIndex Value="3"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit28>
<Unit29>
<Filename Value="../Compilertje/Units/CogatUnits/compcolors.pas"/>
<UnitName Value="CompColors"/>
<CursorPos X="12" Y="603"/>
<TopLine Value="573"/>
<EditorIndex Value="4"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit29>
<Unit30>
<Filename Value="../lazarus/lcl/graphics.pp"/>
<UnitName Value="Graphics"/>
<CursorPos X="15" Y="1283"/>
<TopLine Value="1270"/>
<EditorIndex Value="8"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit30>
<Unit31>
<Filename Value="../lazarus/lcl/include/rasterimage.inc"/>
<CursorPos X="20" Y="351"/>
<TopLine Value="339"/>
<EditorIndex Value="9"/>
<UsageCount Value="11"/>
<Loaded Value="True"/>
</Unit31>
<Unit32>
<Filename Value="../lazarus/lcl/intfgraphics.pas"/>
<UnitName Value="IntfGraphics"/>
<CursorPos X="3" Y="3251"/>
<TopLine Value="3245"/>
<UsageCount Value="10"/>
</Unit32>
</Units> </Units>
<JumpHistory Count="30" HistoryIndex="29"> <JumpHistory Count="29" HistoryIndex="28">
<Position1> <Position1>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<Caret Line="97" Column="63" TopLine="82"/> <Caret Line="174" Column="9" TopLine="146"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<Caret Line="8" Column="33" TopLine="1"/> <Caret Line="177" Column="19" TopLine="146"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<Caret Line="100" Column="29" TopLine="84"/> <Caret Line="324" Column="19" TopLine="296"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/compinput.pas"/>
<Caret Line="106" Column="42" TopLine="89"/> <Caret Line="7" Column="140" TopLine="1"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="112" Column="55" TopLine="95"/> <Caret Line="18" Column="30" TopLine="1"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="testunit.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<Caret Line="38" Column="69" TopLine="31"/> <Caret Line="11" Column="138" TopLine="6"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="60" Column="14" TopLine="37"/> <Caret Line="156" Column="10" TopLine="146"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="22" Column="48" TopLine="1"/> <Caret Line="58" Column="34" TopLine="43"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="testunit.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="9" Column="16" TopLine="1"/> <Caret Line="28" Column="59" TopLine="1"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="project1.lpr"/>
<Caret Line="136" Column="1" TopLine="112"/> <Caret Line="16" Column="60" TopLine="1"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="project1.lpr"/>
<Caret Line="135" Column="125" TopLine="113"/> <Caret Line="19" Column="1" TopLine="1"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="127" Column="22" TopLine="113"/> <Caret Line="50" Column="42" TopLine="35"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="136" Column="21" TopLine="113"/> <Caret Line="62" Column="32" TopLine="59"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="135" Column="2" TopLine="113"/> <Caret Line="57" Column="22" TopLine="41"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="testunit.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/comptypes.pas"/>
<Caret Line="74" Column="3" TopLine="50"/> <Caret Line="5" Column="109" TopLine="1"/>
</Position15> </Position15>
<Position16> <Position16>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="138" Column="31" TopLine="113"/> <Caret Line="18" Column="27" TopLine="14"/>
</Position16> </Position16>
<Position17> <Position17>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="131" Column="45" TopLine="117"/> <Caret Line="169" Column="16" TopLine="159"/>
</Position17> </Position17>
<Position18> <Position18>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="92" Column="13" TopLine="75"/> <Caret Line="170" Column="16" TopLine="159"/>
</Position18> </Position18>
<Position19> <Position19>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="51" Column="40" TopLine="34"/> <Caret Line="176" Column="14" TopLine="159"/>
</Position19> </Position19>
<Position20> <Position20>
<Filename Value="Units/MMLCore/input.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="142" Column="1" TopLine="120"/> <Caret Line="180" Column="17" TopLine="171"/>
</Position20> </Position20>
<Position21> <Position21>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="51" Column="35" TopLine="31"/> <Caret Line="181" Column="16" TopLine="171"/>
</Position21> </Position21>
<Position22> <Position22>
<Filename Value="../cogat/Units/CogatUnits/compinput.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="32" Column="35" TopLine="19"/> <Caret Line="210" Column="16" TopLine="205"/>
</Position22> </Position22>
<Position23> <Position23>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="75" Column="47" TopLine="58"/> <Caret Line="215" Column="10" TopLine="205"/>
</Position23> </Position23>
<Position24> <Position24>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="71" Column="19" TopLine="56"/> <Caret Line="225" Column="19" TopLine="215"/>
</Position24> </Position24>
<Position25> <Position25>
<Filename Value="testunit.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="60" Column="3" TopLine="38"/> <Caret Line="239" Column="19" TopLine="229"/>
</Position25> </Position25>
<Position26> <Position26>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="Units/MMLCore/window.pas"/>
<Caret Line="280" Column="20" TopLine="259"/> <Caret Line="261" Column="17" TopLine="251"/>
</Position26> </Position26>
<Position27> <Position27>
<Filename Value="Units/MMLCore/window.pas"/> <Filename Value="testunit.pas"/>
<Caret Line="279" Column="7" TopLine="261"/> <Caret Line="68" Column="20" TopLine="53"/>
</Position27> </Position27>
<Position28> <Position28>
<Filename Value="testunit.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/compinput.pas"/>
<Caret Line="47" Column="46" TopLine="31"/> <Caret Line="9" Column="20" TopLine="1"/>
</Position28> </Position28>
<Position29> <Position29>
<Filename Value="testunit.pas"/> <Filename Value="../Compilertje/Units/CogatUnits/compinput.pas"/>
<Caret Line="29" Column="5" TopLine="15"/> <Caret Line="40" Column="52" TopLine="29"/>
</Position29> </Position29>
<Position30>
<Filename Value="project1.lpr"/>
<Caret Line="13" Column="56" TopLine="1"/>
</Position30>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>
@ -376,13 +419,6 @@
<IncludeFiles Value="$(ProjOutDir)/"/> <IncludeFiles Value="$(ProjOutDir)/"/>
<OtherUnitFiles Value="$(ProjPath)/Units/MMLCore/"/> <OtherUnitFiles Value="$(ProjPath)/Units/MMLCore/"/>
</SearchPaths> </SearchPaths>
<Linking>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
<Other> <Other>
<CustomOptions Value="-dUseCThreads"/> <CustomOptions Value="-dUseCThreads"/>
<CompilerPath Value="$(CompPath)"/> <CompilerPath Value="$(CompPath)"/>

View File

@ -1,11 +1,11 @@
object Form1: TForm1 object Form1: TForm1
Left = 293 Left = 966
Height = 516 Height = 527
Top = 200 Top = 461
Width = 779 Width = 779
ActiveControl = Button1 ActiveControl = Button1
Caption = 'Form1' Caption = 'Form1'
ClientHeight = 516 ClientHeight = 527
ClientWidth = 779 ClientWidth = 779
LCLVersion = '0.9.29' LCLVersion = '0.9.29'
object Button1: TButton object Button1: TButton

View File

@ -1,9 +1,9 @@
{ This is an automatically generated lazarus resource file } { This is an automatically generated lazarus resource file }
LazarusResources.Add('TForm1','FORMDATA',[ LazarusResources.Add('TForm1','FORMDATA',[
'TPF0'#6'TForm1'#5'Form1'#4'Left'#3'%'#1#6'Height'#3#4#2#3'Top'#3#200#0#5'Wid' 'TPF0'#6'TForm1'#5'Form1'#4'Left'#3#198#3#6'Height'#3#15#2#3'Top'#3#205#1#5'W'
+'th'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'ClientHe' +'idth'#3#11#3#13'ActiveControl'#7#7'Button1'#7'Caption'#6#5'Form1'#12'Client'
+'ight'#3#4#2#11'ClientWidth'#3#11#3#10'LCLVersion'#6#6'0.9.29'#0#7'TButton'#7 +'Height'#3#15#2#11'ClientWidth'#3#11#3#10'LCLVersion'#6#6'0.9.29'#0#7'TButto'
+'Button1'#4'Left'#2'E'#6'Height'#2#25#3'Top'#2' '#5'Width'#2'K'#7'Caption'#6 +'n'#7'Button1'#4'Left'#2'E'#6'Height'#2#25#3'Top'#2' '#5'Width'#2'K'#7'Capti'
+#7'Button1'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#0 +'on'#6#7'Button1'#7'OnClick'#7#12'Button1Click'#8'TabOrder'#2#0#0#0#0
]); ]);

View File

@ -51,14 +51,19 @@ Var
begin begin
while (not Terminated) do while (not Terminated) do
begin begin
Writeln('Creating the client');
Client := TClient.Create; Client := TClient.Create;
Writeln('Getting the dimensions');
Client.MWindow.GetDimensions(w, h); Client.MWindow.GetDimensions(w, h);
writeln(inttostr(w) + ' , ' + inttostr(h)); writeln(inttostr(w) + ' , ' + inttostr(h));
Writeln('Setting target');
//Client.MWindow.SetTarget(77736320); Client.MWindow.SetTarget(132840,w_window);
Client.MWindow.ActivateClient;
Client.MWindow.GetDimensions(w, h);
Writeln('Copying BMP');
bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h); bmp := Client.MWindow.CopyClientToBitmap(0, 0, w, h);
bmp.SaveToFile('/tmp/test.bmp'); bmp.SaveToFile('c:\test.bmp');
bmp.Free; bmp.Free;
//Sleep(1000); //Sleep(1000);
@ -78,6 +83,7 @@ begin
{ Do comparison here } { Do comparison here }
inc(ptr); inc(ptr);
end; end;
Client.MWindow.FreeReturnData; Client.MWindow.FreeReturnData;
Client.MInput.IsMouseButtonDown(mouse_Left); Client.MInput.IsMouseButtonDown(mouse_Left);