=) 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"/>
<TargetFileExt Value=""/>
<Title Value="Simba"/>
<Icon Value="0"/>
<UseXPManifest Value="True"/>
<Icon Value="0"/>
</General>
<VersionInfo>
<Language Value="0419"/>
<CharSet Value="04B0"/>
<StringTable Comments="" CompanyName="" FileDescription="" FileVersion="0.0.0.0" InternalName="" LegalCopyright="" LegalTrademarks="" OriginalFilename="" ProductName="" ProductVersion=""/>
</VersionInfo>
<PublishOptions>
<Version Value="2"/>

View File

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

File diff suppressed because it is too large Load Diff

View File

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

View File

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