1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-25 02:32:19 -05:00

Fix for SaveScreenshot on Linux

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@138 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Wizzup? 2009-10-17 23:09:36 +00:00
parent 3220330c90
commit 0109f1c91c
3 changed files with 123 additions and 193 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/> <Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="19"/> <ActiveEditorIndexAtStart Value="12"/>
</General> </General>
<VersionInfo> <VersionInfo>
<ProjectVersion Value=""/> <ProjectVersion Value=""/>
@ -38,9 +38,9 @@
<Filename Value="project1.lpr"/> <Filename Value="project1.lpr"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="project1"/> <UnitName Value="project1"/>
<CursorPos X="132" Y="31"/> <CursorPos X="38" Y="22"/>
<TopLine Value="18"/> <TopLine Value="16"/>
<EditorIndex Value="24"/> <EditorIndex Value="17"/>
<UsageCount Value="205"/> <UsageCount Value="205"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit0> </Unit0>
@ -172,7 +172,7 @@
<UnitName Value="TestUnit"/> <UnitName Value="TestUnit"/>
<CursorPos X="21" Y="263"/> <CursorPos X="21" Y="263"/>
<TopLine Value="249"/> <TopLine Value="249"/>
<EditorIndex Value="18"/> <EditorIndex Value="15"/>
<UsageCount Value="194"/> <UsageCount Value="194"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit18> </Unit18>
@ -262,9 +262,9 @@
<Filename Value="../../Units/MMLCore/window.pas"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="Window"/> <UnitName Value="Window"/>
<CursorPos X="1" Y="1"/> <CursorPos X="69" Y="425"/>
<TopLine Value="1"/> <TopLine Value="409"/>
<EditorIndex Value="11"/> <EditorIndex Value="9"/>
<UsageCount Value="193"/> <UsageCount Value="193"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit30> </Unit30>
@ -320,9 +320,9 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/> <UnitName Value="mmlpsthread"/>
<CursorPos X="122" Y="144"/> <CursorPos X="22" Y="172"/>
<TopLine Value="88"/> <TopLine Value="156"/>
<EditorIndex Value="12"/> <EditorIndex Value="10"/>
<UsageCount Value="182"/> <UsageCount Value="182"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit37> </Unit37>
@ -389,9 +389,9 @@
</Unit46> </Unit46>
<Unit47> <Unit47>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<CursorPos X="104" Y="114"/> <CursorPos X="27" Y="63"/>
<TopLine Value="60"/> <TopLine Value="48"/>
<EditorIndex Value="15"/> <EditorIndex Value="11"/>
<UsageCount Value="59"/> <UsageCount Value="59"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit47> </Unit47>
@ -405,9 +405,7 @@
<Filename Value="../../../FPC/FPCCheckout/rtl/inc/objpash.inc"/> <Filename Value="../../../FPC/FPCCheckout/rtl/inc/objpash.inc"/>
<CursorPos X="23" Y="175"/> <CursorPos X="23" Y="175"/>
<TopLine Value="160"/> <TopLine Value="160"/>
<EditorIndex Value="7"/>
<UsageCount Value="24"/> <UsageCount Value="24"/>
<Loaded Value="True"/>
</Unit49> </Unit49>
<Unit50> <Unit50>
<Filename Value="../../Units/MMLCore/bitmaps.pas"/> <Filename Value="../../Units/MMLCore/bitmaps.pas"/>
@ -430,16 +428,16 @@
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/colour.inc"/>
<CursorPos X="34" Y="56"/> <CursorPos X="34" Y="56"/>
<TopLine Value="39"/> <TopLine Value="39"/>
<EditorIndex Value="16"/> <EditorIndex Value="13"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit52> </Unit52>
<Unit53> <Unit53>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/bitmap.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/bitmap.inc"/>
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<CursorPos X="1" Y="229"/> <CursorPos X="1" Y="1"/>
<TopLine Value="174"/> <TopLine Value="1"/>
<EditorIndex Value="17"/> <EditorIndex Value="14"/>
<UsageCount Value="171"/> <UsageCount Value="171"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit53> </Unit53>
@ -572,7 +570,7 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="colour_conv"/> <UnitName Value="colour_conv"/>
<CursorPos X="41" Y="76"/> <CursorPos X="41" Y="76"/>
<TopLine Value="144"/> <TopLine Value="76"/>
<EditorIndex Value="1"/> <EditorIndex Value="1"/>
<UsageCount Value="154"/> <UsageCount Value="154"/>
<Loaded Value="True"/> <Loaded Value="True"/>
@ -592,9 +590,11 @@
</Unit75> </Unit75>
<Unit76> <Unit76>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<CursorPos X="1" Y="1"/> <CursorPos X="31" Y="41"/>
<TopLine Value="1"/> <TopLine Value="19"/>
<UsageCount Value="5"/> <EditorIndex Value="12"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit76> </Unit76>
<Unit77> <Unit77>
<Filename Value="../../Units/PascalScript/uPSCompiler.pas"/> <Filename Value="../../Units/PascalScript/uPSCompiler.pas"/>
@ -726,7 +726,7 @@
<UnitName Value="dtm"/> <UnitName Value="dtm"/>
<CursorPos X="34" Y="141"/> <CursorPos X="34" Y="141"/>
<TopLine Value="112"/> <TopLine Value="112"/>
<EditorIndex Value="9"/> <EditorIndex Value="7"/>
<UsageCount Value="129"/> <UsageCount Value="129"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit96> </Unit96>
@ -768,7 +768,7 @@
<UnitName Value="windowselector"/> <UnitName Value="windowselector"/>
<CursorPos X="32" Y="12"/> <CursorPos X="32" Y="12"/>
<TopLine Value="1"/> <TopLine Value="1"/>
<EditorIndex Value="23"/> <EditorIndex Value="16"/>
<UsageCount Value="115"/> <UsageCount Value="115"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit101> </Unit101>
@ -783,9 +783,7 @@
<UnitName Value="Forms"/> <UnitName Value="Forms"/>
<CursorPos X="3" Y="1529"/> <CursorPos X="3" Y="1529"/>
<TopLine Value="1499"/> <TopLine Value="1499"/>
<EditorIndex Value="21"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit103> </Unit103>
<Unit104> <Unit104>
<Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/unix/cthreads.pp"/> <Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/unix/cthreads.pp"/>
@ -847,8 +845,8 @@
<IsPartOfProject Value="True"/> <IsPartOfProject Value="True"/>
<UnitName Value="mmath"/> <UnitName Value="mmath"/>
<CursorPos X="133" Y="45"/> <CursorPos X="133" Y="45"/>
<TopLine Value="42"/> <TopLine Value="40"/>
<EditorIndex Value="10"/> <EditorIndex Value="8"/>
<UsageCount Value="82"/> <UsageCount Value="82"/>
<Loaded Value="True"/> <Loaded Value="True"/>
</Unit112> </Unit112>
@ -909,169 +907,101 @@
<Filename Value="../../../FPC/FPCCheckout/rtl/inc/heap.inc"/> <Filename Value="../../../FPC/FPCCheckout/rtl/inc/heap.inc"/>
<CursorPos X="34" Y="463"/> <CursorPos X="34" Y="463"/>
<TopLine Value="455"/> <TopLine Value="455"/>
<EditorIndex Value="8"/>
<UsageCount Value="21"/> <UsageCount Value="21"/>
<Loaded Value="True"/>
</Unit120> </Unit120>
<Unit121> <Unit121>
<Filename Value="../../../FPC/FPCCheckout/rtl/win/wininc/struct.inc"/> <Filename Value="../../../FPC/FPCCheckout/rtl/win/wininc/struct.inc"/>
<CursorPos X="6" Y="217"/> <CursorPos X="6" Y="217"/>
<TopLine Value="196"/> <TopLine Value="196"/>
<EditorIndex Value="14"/>
<UsageCount Value="20"/> <UsageCount Value="20"/>
<Loaded Value="True"/>
</Unit121> </Unit121>
<Unit122> <Unit122>
<Filename Value="../../../lazarus/lcl/include/customform.inc"/> <Filename Value="../../../lazarus/lcl/include/customform.inc"/>
<CursorPos X="45" Y="1541"/> <CursorPos X="45" Y="1541"/>
<TopLine Value="1522"/> <TopLine Value="1522"/>
<EditorIndex Value="13"/>
<UsageCount Value="16"/> <UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit122> </Unit122>
<Unit123> <Unit123>
<Filename Value="../../../lazarus/lcl/include/winapih.inc"/> <Filename Value="../../../lazarus/lcl/include/winapih.inc"/>
<CursorPos X="10" Y="177"/> <CursorPos X="10" Y="177"/>
<TopLine Value="162"/> <TopLine Value="162"/>
<EditorIndex Value="20"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit123> </Unit123>
<Unit124> <Unit124>
<Filename Value="../../../lazarus/lcl/include/application.inc"/> <Filename Value="../../../lazarus/lcl/include/application.inc"/>
<CursorPos X="28" Y="206"/> <CursorPos X="28" Y="206"/>
<TopLine Value="200"/> <TopLine Value="200"/>
<EditorIndex Value="22"/>
<UsageCount Value="12"/> <UsageCount Value="12"/>
<Loaded Value="True"/>
</Unit124> </Unit124>
<Unit125> <Unit125>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<UnitName Value="SynEditKeyCmds"/> <UnitName Value="SynEditKeyCmds"/>
<CursorPos X="113" Y="1151"/> <CursorPos X="113" Y="1151"/>
<TopLine Value="1119"/> <TopLine Value="1119"/>
<EditorIndex Value="19"/>
<UsageCount Value="10"/> <UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit125> </Unit125>
</Units> </Units>
<JumpHistory Count="29" HistoryIndex="28"> <JumpHistory Count="15" HistoryIndex="14">
<Position1> <Position1>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="301" Column="26" TopLine="286"/> <Caret Line="119" Column="1" TopLine="113"/>
</Position1> </Position1>
<Position2> <Position2>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="319" Column="68" TopLine="305"/> <Caret Line="152" Column="13" TopLine="137"/>
</Position2> </Position2>
<Position3> <Position3>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="321" Column="70" TopLine="305"/> <Caret Line="14" Column="46" TopLine="1"/>
</Position3> </Position3>
<Position4> <Position4>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="761" Column="40" TopLine="771"/> <Caret Line="49" Column="36" TopLine="41"/>
</Position4> </Position4>
<Position5> <Position5>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="62" Column="86" TopLine="67"/> <Caret Line="264" Column="21" TopLine="89"/>
</Position5> </Position5>
<Position6> <Position6>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="177" Column="16" TopLine="163"/> <Caret Line="371" Column="21" TopLine="356"/>
</Position6> </Position6>
<Position7> <Position7>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="228" Column="38" TopLine="214"/> <Caret Line="409" Column="21" TopLine="394"/>
</Position7> </Position7>
<Position8> <Position8>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="229" Column="66" TopLine="214"/> <Caret Line="490" Column="16" TopLine="475"/>
</Position8> </Position8>
<Position9> <Position9>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="230" Column="38" TopLine="214"/> <Caret Line="172" Column="22" TopLine="156"/>
</Position9> </Position9>
<Position10> <Position10>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="231" Column="38" TopLine="214"/> <Caret Line="8" Column="45" TopLine="1"/>
</Position10> </Position10>
<Position11> <Position11>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="232" Column="38" TopLine="214"/> <Caret Line="63" Column="27" TopLine="48"/>
</Position11> </Position11>
<Position12> <Position12>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<Caret Line="233" Column="38" TopLine="214"/> <Caret Line="41" Column="23" TopLine="19"/>
</Position12> </Position12>
<Position13> <Position13>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="234" Column="38" TopLine="214"/> <Caret Line="50" Column="40" TopLine="35"/>
</Position13> </Position13>
<Position14> <Position14>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="235" Column="38" TopLine="214"/> <Caret Line="69" Column="33" TopLine="54"/>
</Position14> </Position14>
<Position15> <Position15>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/> <Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="539" Column="46" TopLine="525"/> <Caret Line="345" Column="39" TopLine="330"/>
</Position15> </Position15>
<Position16>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="540" Column="42" TopLine="525"/>
</Position16>
<Position17>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="541" Column="42" TopLine="525"/>
</Position17>
<Position18>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="542" Column="46" TopLine="525"/>
</Position18>
<Position19>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="543" Column="41" TopLine="525"/>
</Position19>
<Position20>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="544" Column="41" TopLine="525"/>
</Position20>
<Position21>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="545" Column="42" TopLine="525"/>
</Position21>
<Position22>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="578" Column="52" TopLine="564"/>
</Position22>
<Position23>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1074" Column="33" TopLine="1060"/>
</Position23>
<Position24>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1075" Column="26" TopLine="1060"/>
</Position24>
<Position25>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1076" Column="18" TopLine="1060"/>
</Position25>
<Position26>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1077" Column="18" TopLine="1060"/>
</Position26>
<Position27>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1078" Column="18" TopLine="1060"/>
</Position27>
<Position28>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1087" Column="18" TopLine="1060"/>
</Position28>
<Position29>
<Filename Value="../../../lazarus/components/synedit/syneditkeycmds.pp"/>
<Caret Line="1091" Column="18" TopLine="1077"/>
</Position29>
</JumpHistory> </JumpHistory>
</ProjectOptions> </ProjectOptions>
<CompilerOptions> <CompilerOptions>

View File

@ -1,62 +1,62 @@
{ {
This file is part of the Mufasa Macro Library (MML) This file is part of the Mufasa Macro Library (MML)
Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer Copyright (c) 2009 by Raymond van Venetië and Merlijn Wajer
MML is free software: you can redistribute it and/or modify MML is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or the Free Software Foundation, either version 3 of the License, or
(at your option) any later version. (at your option) any later version.
MML is distributed in the hope that it will be useful, MML is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details. GNU General Public License for more details.
You should have received a copy of the GNU General Public License You should have received a copy of the GNU General Public License
along with MML. If not, see <http://www.gnu.org/licenses/>. along with MML. If not, see <http://www.gnu.org/licenses/>.
See the file COPYING, included in this distribution, See the file COPYING, included in this distribution,
for details about the copyright. for details about the copyright.
Other.inc for the Mufasa Macro Library Other.inc for the Mufasa Macro Library
} }
procedure GetClientDimensions(var w, h: integer); procedure GetClientDimensions(var w, h: integer);
begin begin
CurrThread.Client.MWindow.GetDimensions(w, h); CurrThread.Client.MWindow.GetDimensions(w, h);
end; end;
procedure Wait(t: Integer); procedure Wait(t: Integer);
begin begin
Sleep(t); Sleep(t);
end; end;
procedure SaveScreenshot(FileName: string); procedure SaveScreenshot(FileName: string);
var var
w,h : integer; w,h : integer;
begin; begin;
with CurrThread.Client.MWindow do with CurrThread.Client.MWindow do
begin; begin;
GetDimensions(w,h); GetDimensions(w,h);
with CopyClientToBitmap(0,0,w-1,h-1) do with CopyClientToBitmap(0,0,w,h) do
begin; begin;
SaveToFile(FileName); SaveToFile(FileName);
Free; Free;
end; end;
end; end;
end; end;
function Distance(x1, y1, x2, y2: Integer): Integer; function Distance(x1, y1, x2, y2: Integer): Integer;
begin; begin;
Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1))); Result := Round(Sqrt(Sqr(x2-x1) + Sqr(y2-y1)));
end; end;
function Freeze: boolean; function Freeze: boolean;
begin begin
result := CurrThread.Client.MWindow.Freeze(); result := CurrThread.Client.MWindow.Freeze();
end; end;
function Unfreeze: boolean; function Unfreeze: boolean;
begin begin
result := CurrThread.Client.MWindow.Unfreeze; result := CurrThread.Client.MWindow.Unfreeze;
end; end;

View File

@ -426,8 +426,8 @@ begin
begin begin
{$IFDEF MSWINDOWS} {$IFDEF MSWINDOWS}
Result := TBitmap.Create; Result := TBitmap.Create;
Result.SetSize(ww+1,hh+1); Result.SetSize(ww,hh);
BitBlt(result.canvas.handle,0,0,ww+1,hh+1, BitBlt(result.canvas.handle,0,0,ww,hh,
self.TargetDC,xs,ys, SRCCOPY); self.TargetDC,xs,ys, SRCCOPY);
{$ENDIF} {$ENDIF}
end; end;