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

Fixed colourpicker.

On windows now uses the OnMouseMove event, displays the correct and x,y.. 
Added a GetDimensionBox to Window, not sure if it works/compiles correctly on Linux.
:-)

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@172 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2009-11-01 17:58:57 +00:00
parent 01f971a476
commit a46ff70ce4
5 changed files with 2059 additions and 1956 deletions

View File

@ -7,7 +7,7 @@
<TargetFileExt Value=""/>
<Title Value="Mufasa Stand Alone"/>
<UseXPManifest Value="True"/>
<ActiveEditorIndexAtStart Value="3"/>
<ActiveEditorIndexAtStart Value="2"/>
</General>
<VersionInfo>
<ProjectVersion Value=""/>
@ -139,14 +139,14 @@
<UnitName Value="Graphics"/>
<CursorPos X="15" Y="1287"/>
<TopLine Value="1272"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit14>
<Unit15>
<Filename Value="../cogat/Units/CogatUnits/compbitmaps.pas"/>
<UnitName Value="CompBitmaps"/>
<CursorPos X="1" Y="109"/>
<TopLine Value="92"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit15>
<Unit16>
<Filename Value="../Documents/lazarus/lcl/include/rasterimage.inc"/>
@ -168,8 +168,8 @@
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="TestUnit"/>
<CursorPos X="3" Y="463"/>
<TopLine Value="461"/>
<CursorPos X="26" Y="248"/>
<TopLine Value="231"/>
<EditorIndex Value="1"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
@ -225,9 +225,11 @@
<Filename Value="../../Units/MMLCore/client.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Client"/>
<CursorPos X="87" Y="4"/>
<TopLine Value="1"/>
<CursorPos X="25" Y="42"/>
<TopLine Value="31"/>
<EditorIndex Value="7"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit26>
<Unit27>
<Filename Value="../../Units/MMLCore/mufasatypes.pas"/>
@ -256,9 +258,11 @@
<Filename Value="../../Units/MMLCore/window.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="Window"/>
<CursorPos X="8" Y="151"/>
<TopLine Value="128"/>
<CursorPos X="62" Y="629"/>
<TopLine Value="618"/>
<EditorIndex Value="4"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit30>
<Unit31>
<Filename Value="../../../cogat/Units/CogatUnits/comptypes.pas"/>
@ -277,9 +281,11 @@
<Unit33>
<Filename Value="../../Units/MMLCore/input.pas"/>
<UnitName Value="Input"/>
<CursorPos X="91" Y="37"/>
<TopLine Value="29"/>
<CursorPos X="3" Y="176"/>
<TopLine Value="139"/>
<EditorIndex Value="8"/>
<UsageCount Value="52"/>
<Loaded Value="True"/>
</Unit33>
<Unit34>
<Filename Value="../../Units/MMLCore/finder.pas"/>
@ -308,9 +314,9 @@
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="mmlpsthread"/>
<CursorPos X="46" Y="119"/>
<TopLine Value="92"/>
<EditorIndex Value="2"/>
<CursorPos X="26" Y="31"/>
<TopLine Value="17"/>
<EditorIndex Value="6"/>
<UsageCount Value="202"/>
<Loaded Value="True"/>
</Unit37>
@ -377,9 +383,9 @@
</Unit46>
<Unit47>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<CursorPos X="21" Y="38"/>
<CursorPos X="39" Y="38"/>
<TopLine Value="26"/>
<EditorIndex Value="3"/>
<EditorIndex Value="9"/>
<UsageCount Value="74"/>
<Loaded Value="True"/>
</Unit47>
@ -482,7 +488,7 @@
<UnitName Value="GraphType"/>
<CursorPos X="19" Y="634"/>
<TopLine Value="630"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit62>
<Unit63>
<Filename Value="../../../FPC/FPCCheckout/packages/fcl-image/src/fpcolors.inc"/>
@ -571,8 +577,8 @@
<Unit76>
<Filename Value="../../Units/MMLAddon/PSInc/Wrappers/other.inc"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="46"/>
<EditorIndex Value="4"/>
<TopLine Value="1"/>
<EditorIndex Value="10"/>
<UsageCount Value="18"/>
<Loaded Value="True"/>
</Unit76>
@ -671,7 +677,7 @@
<UnitName Value="Controls"/>
<CursorPos X="20" Y="463"/>
<TopLine Value="447"/>
<EditorIndex Value="7"/>
<EditorIndex Value="12"/>
<UsageCount Value="16"/>
<Loaded Value="True"/>
</Unit91>
@ -679,7 +685,7 @@
<Filename Value="../../../lazarus/lcl/include/control.inc"/>
<CursorPos X="31" Y="85"/>
<TopLine Value="80"/>
<EditorIndex Value="8"/>
<EditorIndex Value="13"/>
<UsageCount Value="13"/>
<Loaded Value="True"/>
</Unit92>
@ -723,9 +729,11 @@
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="colourpicker"/>
<CursorPos X="26" Y="198"/>
<TopLine Value="191"/>
<CursorPos X="18" Y="100"/>
<TopLine Value="96"/>
<EditorIndex Value="2"/>
<UsageCount Value="201"/>
<Loaded Value="True"/>
</Unit98>
<Unit99>
<Filename Value="../../../cogat/Units/CogatUnits/compdragger.pas"/>
@ -748,9 +756,11 @@
<Filename Value="../../Units/MMLAddon/windowselector.pas"/>
<IsPartOfProject Value="True"/>
<UnitName Value="windowselector"/>
<CursorPos X="32" Y="12"/>
<TopLine Value="31"/>
<UsageCount Value="192"/>
<CursorPos X="38" Y="161"/>
<TopLine Value="135"/>
<EditorIndex Value="5"/>
<UsageCount Value="193"/>
<Loaded Value="True"/>
</Unit101>
<Unit102>
<Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/objpas/classes/classesh.inc"/>
@ -761,9 +771,11 @@
<Unit103>
<Filename Value="../../../lazarus/lcl/forms.pp"/>
<UnitName Value="Forms"/>
<CursorPos X="13" Y="1649"/>
<TopLine Value="1638"/>
<CursorPos X="17" Y="647"/>
<TopLine Value="636"/>
<EditorIndex Value="3"/>
<UsageCount Value="15"/>
<Loaded Value="True"/>
</Unit103>
<Unit104>
<Filename Value="../../../usr/lib64/fpc/2.2.4/source/rtl/unix/cthreads.pp"/>
@ -784,7 +796,7 @@
<UnitName Value="dtmutil"/>
<CursorPos X="32" Y="18"/>
<TopLine Value="1"/>
<UsageCount Value="179"/>
<UsageCount Value="180"/>
</Unit106>
<Unit107>
<Filename Value="../../../cogat/Units/CogatUnits/compmaths.pas"/>
@ -826,7 +838,7 @@
<UnitName Value="mmath"/>
<CursorPos X="32" Y="42"/>
<TopLine Value="16"/>
<UsageCount Value="159"/>
<UsageCount Value="160"/>
</Unit112>
<Unit113>
<Filename Value="../../../Documents/fpc/rtl/objpas/types.pp"/>
@ -840,21 +852,21 @@
<UnitName Value="Classes"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit114>
<Unit115>
<Filename Value="../../../Documents/fpc/rtl/unix/sysutils.pp"/>
<UnitName Value="sysutils"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit115>
<Unit116>
<Filename Value="../../../Documents/lazarus/lcl/lclintf.pas"/>
<UnitName Value="LCLIntf"/>
<CursorPos X="51" Y="261"/>
<TopLine Value="251"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit116>
<Unit117>
<Filename Value="../../Units/MMLCore/ocr.pas"/>
@ -862,14 +874,14 @@
<UnitName Value="ocr"/>
<CursorPos X="43" Y="42"/>
<TopLine Value="5"/>
<UsageCount Value="129"/>
<UsageCount Value="130"/>
</Unit117>
<Unit118>
<Filename Value="../../Units/PascalScript/uPSR_extctrls.pas"/>
<UnitName Value="uPSR_extctrls"/>
<CursorPos X="1" Y="1"/>
<TopLine Value="1"/>
<UsageCount Value="0"/>
<UsageCount Value="10"/>
</Unit118>
<Unit119>
<Filename Value="../../../Documents and Settings/Raymond/Bureaublad/project.pas"/>
@ -877,7 +889,7 @@
<UnitName Value="project"/>
<CursorPos X="46" Y="15"/>
<TopLine Value="1"/>
<UsageCount Value="126"/>
<UsageCount Value="127"/>
</Unit119>
<Unit120>
<Filename Value="../../../FPC/FPCCheckout/rtl/inc/heap.inc"/>
@ -991,7 +1003,7 @@
<UnitName Value="web"/>
<CursorPos X="90" Y="16"/>
<TopLine Value="1"/>
<UsageCount Value="54"/>
<UsageCount Value="55"/>
</Unit137>
<Unit138>
<Filename Value="../../../lazarus/lcl/lazhelphtml.pas"/>
@ -1191,9 +1203,9 @@
<ResourceBaseClass Value="Frame"/>
<UnitName Value="framescript"/>
<CursorPos X="24" Y="32"/>
<TopLine Value="168"/>
<EditorIndex Value="6"/>
<UsageCount Value="47"/>
<TopLine Value="32"/>
<EditorIndex Value="11"/>
<UsageCount Value="48"/>
<Loaded Value="True"/>
</Unit162>
<Unit163>
@ -1412,131 +1424,129 @@
<Filename Value="../../../fpc/rtl/objpas/classes/classesh.inc"/>
<CursorPos X="21" Y="1436"/>
<TopLine Value="1424"/>
<EditorIndex Value="5"/>
<UsageCount Value="10"/>
<Loaded Value="True"/>
</Unit195>
</Units>
<JumpHistory Count="30" HistoryIndex="29">
<Position1>
<Filename Value="testunit.pas"/>
<Caret Line="507" Column="1" TopLine="498"/>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="125" Column="22" TopLine="113"/>
</Position1>
<Position2>
<Filename Value="testunit.pas"/>
<Caret Line="438" Column="15" TopLine="436"/>
<Caret Line="247" Column="46" TopLine="233"/>
</Position2>
<Position3>
<Filename Value="testunit.pas"/>
<Caret Line="579" Column="83" TopLine="572"/>
<Caret Line="248" Column="57" TopLine="228"/>
</Position3>
<Position4>
<Filename Value="testunit.pas"/>
<Caret Line="636" Column="1" TopLine="669"/>
<Caret Line="218" Column="23" TopLine="206"/>
</Position4>
<Position5>
<Filename Value="testunit.pas"/>
<Caret Line="4" Column="114" TopLine="1"/>
<Caret Line="247" Column="46" TopLine="242"/>
</Position5>
<Position6>
<Filename Value="testunit.pas"/>
<Caret Line="27" Column="48" TopLine="14"/>
<Caret Line="725" Column="46" TopLine="722"/>
</Position6>
<Position7>
<Filename Value="testunit.pas"/>
<Caret Line="187" Column="23" TopLine="175"/>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="37" Column="17" TopLine="25"/>
</Position7>
<Position8>
<Filename Value="testunit.pas"/>
<Caret Line="218" Column="58" TopLine="206"/>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="186" Column="25" TopLine="177"/>
</Position8>
<Position9>
<Filename Value="testunit.pas"/>
<Caret Line="242" Column="78" TopLine="235"/>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="234" Column="19" TopLine="231"/>
</Position9>
<Position10>
<Filename Value="testunit.pas"/>
<Caret Line="247" Column="48" TopLine="235"/>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="38" Column="24" TopLine="26"/>
</Position10>
<Position11>
<Filename Value="framescript.pas"/>
<Caret Line="62" Column="27" TopLine="49"/>
<Filename Value="testunit.pas"/>
<Caret Line="725" Column="46" TopLine="722"/>
</Position11>
<Position12>
<Filename Value="testunit.pas"/>
<Caret Line="723" Column="68" TopLine="677"/>
<Caret Line="464" Column="3" TopLine="461"/>
</Position12>
<Position13>
<Filename Value="testunit.pas"/>
<Caret Line="463" Column="11" TopLine="461"/>
<Caret Line="463" Column="3" TopLine="457"/>
</Position13>
<Position14>
<Filename Value="testunit.pas"/>
<Caret Line="247" Column="13" TopLine="231"/>
<Caret Line="619" Column="31" TopLine="616"/>
</Position14>
<Position15>
<Filename Value="testunit.pas"/>
<Caret Line="248" Column="23" TopLine="233"/>
<Caret Line="606" Column="11" TopLine="602"/>
</Position15>
<Position16>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="46" Column="5" TopLine="43"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="132" Column="29" TopLine="114"/>
</Position16>
<Position17>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="70" Column="23" TopLine="58"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="106" Column="28" TopLine="94"/>
</Position17>
<Position18>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="75" Column="71" TopLine="58"/>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="51" Column="45" TopLine="38"/>
</Position18>
<Position19>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="125" Column="22" TopLine="113"/>
<Filename Value="testunit.pas"/>
<Caret Line="606" Column="11" TopLine="602"/>
</Position19>
<Position20>
<Filename Value="testunit.pas"/>
<Caret Line="247" Column="46" TopLine="233"/>
<Caret Line="463" Column="13" TopLine="461"/>
</Position20>
<Position21>
<Filename Value="testunit.pas"/>
<Caret Line="248" Column="57" TopLine="228"/>
<Caret Line="248" Column="26" TopLine="231"/>
</Position21>
<Position22>
<Filename Value="testunit.pas"/>
<Caret Line="218" Column="23" TopLine="206"/>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="31" Column="26" TopLine="17"/>
</Position22>
<Position23>
<Filename Value="testunit.pas"/>
<Caret Line="247" Column="46" TopLine="242"/>
<Filename Value="../../Units/MMLCore/client.pas"/>
<Caret Line="42" Column="25" TopLine="31"/>
</Position23>
<Position24>
<Filename Value="testunit.pas"/>
<Caret Line="725" Column="46" TopLine="722"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="106" Column="23" TopLine="87"/>
</Position24>
<Position25>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="37" Column="17" TopLine="25"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="107" Column="20" TopLine="87"/>
</Position25>
<Position26>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="186" Column="25" TopLine="177"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="241" Column="7" TopLine="224"/>
</Position26>
<Position27>
<Filename Value="../../Units/MMLAddon/mmlpsthread.pas"/>
<Caret Line="234" Column="19" TopLine="231"/>
<Filename Value="../../Units/MMLCore/window.pas"/>
<Caret Line="51" Column="64" TopLine="40"/>
</Position27>
<Position28>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="1" Column="1" TopLine="19"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="143" Column="29" TopLine="134"/>
</Position28>
<Position29>
<Filename Value="../../Units/MMLAddon/PSInc/pscompile.inc"/>
<Caret Line="38" Column="24" TopLine="26"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="179" Column="89" TopLine="144"/>
</Position29>
<Position30>
<Filename Value="testunit.pas"/>
<Caret Line="725" Column="46" TopLine="722"/>
<Filename Value="../../Units/MMLAddon/colourpicker.pas"/>
<Caret Line="203" Column="26" TopLine="185"/>
</Position30>
</JumpHistory>
</ProjectOptions>

View File

@ -5,7 +5,7 @@ object Form1: TForm1
Width = 723
ActiveControl = PageControl1
Caption = 'Action1'
ClientHeight = 528
ClientHeight = 533
ClientWidth = 723
Menu = MainMenu1
OnClose = FormClose
@ -154,8 +154,8 @@ object Form1: TForm1
end
object StatusBar: TStatusBar
Left = 0
Height = 21
Top = 507
Height = 23
Top = 510
Width = 723
Panels = <
item
@ -172,17 +172,17 @@ object Form1: TForm1
end
object PanelMemo: TPanel
Left = 0
Height = 147
Height = 150
Top = 360
Width = 723
Align = alBottom
Anchors = [akTop, akLeft, akRight, akBottom]
ClientHeight = 147
ClientHeight = 150
ClientWidth = 723
TabOrder = 2
object Memo1: TMemo
Left = 1
Height = 145
Height = 148
Top = 1
Width = 721
Align = alClient

File diff suppressed because it is too large Load Diff

View File

@ -66,6 +66,7 @@ type
FPickEvent : TPickEvent;
oldx, oldy, Color, colorx, colory: Integer;
targetleft,targettop : integer;
TheChangedEvent,TheChangingEvent : TNotifyEvent;
NoteHandle, BitmapHandle, ImageHandle : HDC;
@ -91,6 +92,7 @@ procedure TMColorPicker.Pick(Out C, X, Y: Integer);
var
w, h: integer;
bmp: TBitmap;
box : TBox;
{$IFNDEF PICKER_CLIENT}
{$IFDEF LINUX}
@ -102,6 +104,15 @@ var
begin
Form := TForm.Create(Application.MainForm);
if Window.GetDimensionBox( box) then
begin;
targetleft := box.x1;
targettop := box.y1;
end else
begin;
targetleft := 0;
targettop := 0;
end;
{$IFNDEF PICKER_CLIENT}
{$IFDEF LINUX}
OldWindow := Window.CurWindow;
@ -125,8 +136,8 @@ begin
Image.Parent := Form;
Image.left := 0;
image.Width := 0;
Image.width := Form.Width - 1;
Image.Height := Form.Height - 1;
Image.width := Form.Width;
Image.Height := Form.Height;
Image.Cursor:= crCross;
Image.OnMouseDown:= @ColorPickDown;
Image.OnMouseMove:=@ImageMouseMove;
@ -159,7 +170,6 @@ begin
Timor.OnTimer:= @TimorTimer;
Timor.Interval:= 50;
Timor.Enabled:= False;
Form.ShowModal;
// add x to history here.
@ -184,9 +194,40 @@ end;
procedure TMColorPicker.ImageMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
{$ifdef mswindows}
var
TempPoint : TPoint;
begin
TempPoint := Point(x,y);
{ If a form cannot be fully set to 0,0 }
TempPoint.X := TempPoint.X - Form.Left;
TempPoint.Y := TempPoint.Y - Form.Top;
BitBlt(ImageHandle, oldx + 5, oldy + 5,147,33,BitmapHandle,oldx + 5,oldy + 5,SRCCOPY);
Color := WidgetSet.DCGetPixel(ImageHandle, TempPoint.X, TempPoint.Y);
Rectangle(NoteHandle,1,1,85,32);
// Text:='Pos: ' + inttostr(TempPoint.x - Client.Rect.Left) + ',' + inttostr(TempPoint.y - Client.Rect.Bottom);
Text:='Pos: ' + inttostr(TempPoint.x - targetleft) + ',' + inttostr(TempPoint.y - targettop);
ExtTextOut(NoteHandle, 5, 3,0,nil,pchar(text),length(text),nil);
Text := 'Color: ' + inttostr(Color);
ExtTextOut(NoteHandle, 5, 15,0,nil,pchar(text),length(text),nil);
BitBlt( ImageHandle, TempPoint.x + 5, TempPoint.y + 5,147,33,NoteHandle,0,0,SRCCOPY);
Brush.Color := Color;
Image.Canvas.Rectangle(TempPoint.x + 123, TempPoint.y + 8, tempPoint.x + 149, temppoint.y + 34);
// Rectangle(ImageHandle,TempPoint.x + 123, TempPoint.y + 8, tempPoint.x + 149, temppoint.y + 34);
TheChangingEvent(Sender);
StretchBlt(ImageHandle,TempPoint.x + 95, TempPoint.y + 9, 24,24, BitmapHandle, TempPoint.x - 1, TempPoint.y-1,3,3, SRCCOPY);
TheChangedEvent(Sender);
Oldx := TempPoint.x;
Oldy := TempPoint.y;
end;
{$else}
begin
Timor.Enabled:= True;
end;
{$endif}
procedure TMColorPicker.TimorTimer(Sender: TObject);
var
@ -203,7 +244,7 @@ begin
Color := WidgetSet.DCGetPixel(ImageHandle, TempPoint.X, TempPoint.Y);
Rectangle(NoteHandle,1,1,85,32);
// Text:='Pos: ' + inttostr(TempPoint.x - Client.Rect.Left) + ',' + inttostr(TempPoint.y - Client.Rect.Bottom);
Text:='Pos: ' + inttostr(TempPoint.x) + ',' + inttostr(TempPoint.y);
Text:='Pos: ' + inttostr(TempPoint.x - targetleft) + ',' + inttostr(TempPoint.y - targettop);
ExtTextOut(NoteHandle, 5, 3,0,nil,pchar(text),length(text),nil);
Text := 'Color: ' + inttostr(Color);
ExtTextOut(NoteHandle, 5, 15,0,nil,pchar(text),length(text),nil);
@ -223,11 +264,11 @@ procedure TMColorPicker.ColorPickDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin;
Color:= WidgetSet.DCGetPixel(Image.Canvas.Handle,x,y);
Self.Colorx := x;
Self.Colory := y;
Self.Colorx := x - targetleft;
Self.Colory := y - targettop;
Timor.enabled := false;
if OnPick <> nil then
Onpick(Sender,Color,x,y);
Onpick(Sender,Color,Colorx,Colory);
Form.Close;
end;

View File

@ -48,6 +48,7 @@ type
function ReturnData(xs, ys, width, height: Integer): TRetData;
procedure FreeReturnData;
procedure GetDimensions(var W, H: Integer);
function GetDimensionBox(out Box : TBox) : boolean;
function CopyClientToBitmap(xs, ys, xe, ye: integer): TBitmap;
procedure ActivateClient;
{$IFDEF LINUX}
@ -597,6 +598,57 @@ begin
end;
end;
function TMWindow.GetDimensionBox(out Box : TBox) : boolean;
function IntToTBox(x1,y1,x2,y2 : integer) : TBox;inline;
begin;
result.x1 := x1;
result.y1 := y1;
result.x2 := x2;
result.y2 := y2;
end;
{$IFDEF LINUX}
var
Attrib: TXWindowAttributes;
newx,newy : integer;
childwindow : x.TWindow;
Old_Handler: TXErrorHandler;
{$ENDIF}
{$IFDEF MSWINDOWS}
var
Rect : TRect;
{$ENDIF}
begin
result := false;
case TargetMode of
w_Window:
begin
{$IFDEF MSWINDOWS}
result := true;
GetWindowRect(Self.TargetHandle, Rect);
box := IntToTBox(Rect.Left,Rect.top,Rect.Right - 1,Rect.Bottom - 1);
{$ENDIF}
end;
w_XWindow:
begin
{$IFDEF LINUX}
result := true;
Old_Handler := XSetErrorHandler(@MufasaXErrorHandler);
if XGetWindowAttributes(Self.XDisplay, Self.CurWindow, @Attrib) <> 0 Then
begin
XTranslateCoordinates(Self.XDisplay, Self.CurWindow, Self.DesktopWindow, 0,0, @newx, @newy, @childwindow);
box := IntToTBox(Attrib.x,Attrib.y,Attrib.x + Attrib.Width -1,Attrib.y +Attrib.Height-1 );
end else
box := IntToTBox(-1,-1,-1,-1);
XSetErrorHandler(Old_Handler);
{$ELSE}
raise Exception.createFMT('GetDimensions: You cannot use ' +
'the XImage mode on Windows.', []);
{$ENDIF}
end;
end;
end;
{$IFDEF LINUX}
function TMWindow.SetTarget(XWindow: x.TWindow): integer; overload;
var