1
0
mirror of https://github.com/moparisthebest/Simba synced 2024-11-28 20:12:16 -05:00

=) Added a new client selector for Windows!

git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@584 3f818213-9676-44b0-a9b4-5e4c4e03d09d
This commit is contained in:
Raymond 2010-03-07 21:18:52 +00:00
parent aa01a29202
commit f26d4c4b5e
5 changed files with 1365 additions and 1353 deletions

View File

@ -10,12 +10,13 @@
<MainUnit Value="0"/> <MainUnit Value="0"/>
<TargetFileExt Value=""/> <TargetFileExt Value=""/>
<Title Value="Simba"/> <Title Value="Simba"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>
<Icon Value="0"/>
</General> </General>
<VersionInfo> <VersionInfo>
<Language Value="0419"/> <Language Value="0419"/>
<CharSet Value="04B0"/> <CharSet Value="04B0"/>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
</VersionInfo> </VersionInfo>
<PublishOptions> <PublishOptions>
<Version Value="2"/> <Version Value="2"/>

View File

@ -200,6 +200,7 @@ object Form1: TForm1
end end
object TT_Console: TToolButton object TT_Console: TToolButton
Left = 407 Left = 407
Hint = 'Hide/Show Console'
Top = 2 Top = 2
Action = ActionConsole Action = ActionConsole
end end

File diff suppressed because it is too large Load Diff

View File

@ -118,8 +118,8 @@ begin
Desktop.SetDesktop; Desktop.SetDesktop;
Desktop.GetDimensions(w, h); Desktop.GetDimensions(w, h);
Application.MainForm.Enabled := False; { Application.MainForm.Enabled := False;
ColourHistoryForm.Enabled := False; ColourHistoryForm.Enabled := False;}
{ Create a form that will hold the client image and a form that will show cursor and color data } { Create a form that will hold the client image and a form that will show cursor and color data }
ScreenForm := TForm.Create(Application.MainForm); ScreenForm := TForm.Create(Application.MainForm);
@ -132,15 +132,15 @@ begin
ScreenForm.Height := h; ScreenForm.Height := h;
ScreenForm.Top := 0; ScreenForm.Top := 0;
ScreenForm.left := 0; ScreenForm.left := 0;
//ScreenForm.WindowState := wsmaximized; //ScreenForm.WindowState := wsmaximized; {Dual screen problems}
ScreenForm.BorderStyle:= bsNone; ScreenForm.BorderStyle:= bsNone;
ScreenForm.FormStyle := fsStayOnTop; // ScreenForm.FormStyle := fsStayOnTop; {Runescape generates new handle ;-)}
{ Initialize the form that will hold the cursor and color info } { Initialize the form that will hold the cursor and color info }
InfoForm.Width := 173; InfoForm.Width := 173;
InfoForm.Height := 33; InfoForm.Height := 33;
InfoForm.BorderStyle := bsNone; InfoForm.BorderStyle := bsNone;
InfoForm.FormStyle := fsStayOnTop; // InfoForm.FormStyle := fsStayOnTop;
InfoForm.Left := Mouse.CursorPos.X + 5; InfoForm.Left := Mouse.CursorPos.X + 5;
InfoForm.Top := Mouse.CursorPos.Y - 15; InfoForm.Top := Mouse.CursorPos.Y - 15;
@ -200,6 +200,10 @@ begin
Application.ProcessMessages; Application.ProcessMessages;
end; end;
{ Close the forms }
InfoForm.Hide;
ScreenForm.Hide;
// add x to history here. // add x to history here.
c := Color; c := Color;
x := Colorx; x := Colorx;
@ -214,8 +218,8 @@ begin
Desktop.free; Desktop.free;
{ Re-enable the color pick buttons } { Re-enable the color pick buttons }
Application.MainForm.Enabled := True; // Application.MainForm.Enabled := True;
ColourHistoryForm.Enabled := True; // ColourHistoryForm.Enabled := True;
end; end;
procedure TMColorPicker.ImageMainMouseMove(Sender: TObject; Shift: TShiftState; X, procedure TMColorPicker.ImageMainMouseMove(Sender: TObject; Shift: TShiftState; X,
@ -283,10 +287,6 @@ begin;
if OnPick <> nil then if OnPick <> nil then
Onpick(Sender,Color,Colorx,Colory); Onpick(Sender,Color,Colorx,Colory);
{ Close the forms }
InfoForm.Close;
ScreenForm.Close;
{ Tell Pick() that we are done } { Tell Pick() that we are done }
closed := True; closed := True;
end; end;

View File

@ -35,7 +35,7 @@ uses
controls, controls,
graphics, graphics,
forms, forms,
mufasabase, extctrls,
{$IFNDEF MSWINDOWS}x, xlib,xatom {$IFNDEF MSWINDOWS}x, xlib,xatom
{$ELSE} {$ELSE}
windows windows
@ -152,41 +152,50 @@ end;
function TMWindowSelector.Drag: TNativeWindow; function TMWindowSelector.Drag: TNativeWindow;
var var
TargetRect: TRect; TargetRect: TRect;
DC: HDC; Region : HRGN;
OldPen, Pen: hPen;
OldBrush : hBrush;
BrushHandle : THandle;
Cursor : TCursor; Cursor : TCursor;
TempHandle : Hwnd; TempHandle : Hwnd;
Handle : Hwnd; Handle : Hwnd;
DragForm : TForm;
EdgeForm : TForm;
Style : DWord;
W,H,i: integer;
const
EdgeSize =4;
WindowCol = clred;
begin; begin;
Pen := CreatePen(PS_SOLID, GetSystemMetrics(SM_CXBORDER)*5, clred);
BrushHandle := GetStockObject(Null_Brush);
Cursor:= Screen.Cursor; Cursor:= Screen.Cursor;
Screen.Cursor:= crCross; Screen.Cursor:= crCross;
TempHandle := GetDesktopWindow; TempHandle := GetDesktopWindow;
EdgeForm := TForm.Create(nil);
EdgeForm.Color:= WindowCol;
EdgeForm.BorderStyle:= bsNone;
EdgeForm.Show;
DragForm := TForm.Create(nil);
DragForm.Color:= WindowCol;
DragForm.BorderStyle:= bsNone;
DragForm.Show;
Style := GetWindowLong(DragForm.Handle, GWL_EXSTYLE);
SetWindowLong(DragForm.Handle, GWL_EXSTYLE, Style or WS_EX_LAYERED or WS_EX_TRANSPARENT);
SetLayeredWindowAttributes(DragForm.Handle, 0, 100, LWA_ALPHA);
while GetAsyncKeyState(VK_LBUTTON) <> 0 do while GetAsyncKeyState(VK_LBUTTON) <> 0 do
begin; begin;
Handle:= WindowFromPoint(Mouse.CursorPos); Handle:= WindowFromPoint(Mouse.CursorPos);
if Handle <> TempHandle then if Handle <> TempHandle then
begin; begin;
if TempHandle <> 0 then GetWindowRect(Handle, TargetRect);
begin; W :=TargetRect.Right - TargetRect.Left+1;
Invalidaterect(temphandle, nil, true); H :=TargetRect.Bottom - TargetRect.Top+1;
UpdateWindow(temphandle); DragForm.SetBounds(TargetRect.Left,TargetRect.top,W,H);//Draw the transparent form
RedrawWindow(TempHandle, nil, 0, RDW_Frame or RDW_Invalidate or RDW_Updatenow or RDW_Allchildren);
end; SetWindowRgn(EdgeForm.Handle,0,false);//Delete the old region
if Handle <> 0 then EdgeForm.SetBounds(TargetRect.Left,TargetRect.top,W,H);//Move the form etc..
begin; Region := CreateRectRgn(0,0,w-1,h-1); //Create a full region, of the whole form
GetWindowRect(Handle, TargetRect); CombineRgn(Region,Region,CreateRectRgn(EdgeSize,EdgeSize,w-1-(edgesize),h-1-(edgesize)),RGN_XOR); //Combine a the 2 regions (of the full form and one without the edges)
DC := Windows.GetWindowDC(Handle); SetWindowRgn(edgeform.Handle,Region,true);//Set the only-edge-region!
OldPen := SelectObject(DC, Pen);
OldBrush := SelectObject(DC, BrushHandle);
Rectangle(DC, 0, 0, TargetRect.Right - TargetRect.Left, TargetRect.Bottom - TargetRect.Top);
SelectObject(DC, OldBrush);
SelectObject(DC, OldPen);
ReleaseDC(Handle, DC);
end;
TempHandle := Handle; TempHandle := Handle;
end; end;
Application.ProcessMessages; Application.ProcessMessages;
@ -196,10 +205,10 @@ begin;
LastPick:= TempHandle; LastPick:= TempHandle;
haspicked:= true; haspicked:= true;
Screen.Cursor:= cursor; Screen.Cursor:= cursor;
Invalidaterect(temphandle, nil, true); DragForm.Hide;
UpdateWindow(temphandle); DragForm.Free;
RedrawWindow(TempHandle, nil, 0, RDW_Frame or RDW_Invalidate or RDW_Updatenow or RDW_Allchildren); EdgeForm.Hide;
DeleteObject(Pen); EdgeForm.Free;
end; end;
{$ENDIF} {$ENDIF}