From c5d4624df2a06303bcf2435bbdbdf148591c1520 Mon Sep 17 00:00:00 2001 From: Raymond Date: Mon, 4 Jan 2010 18:40:10 +0000 Subject: [PATCH] Updated a lil' bit git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@370 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- Units/MMLAddon/colourpicker.pas | 67 ++++++++------------------------- Units/MMLCore/window.pas | 1 + 2 files changed, 17 insertions(+), 51 deletions(-) diff --git a/Units/MMLAddon/colourpicker.pas b/Units/MMLAddon/colourpicker.pas index 5068a5e..fe502e4 100644 --- a/Units/MMLAddon/colourpicker.pas +++ b/Units/MMLAddon/colourpicker.pas @@ -39,6 +39,7 @@ uses {$ENDIF} ; + type TPickEvent = procedure (Sender: TObject; Color, X, Y: Integer); @@ -103,29 +104,21 @@ var SS : TShiftState; p : TPoint; - {$IFNDEF PICKER_CLIENT} - {$IFDEF LINUX} - OldWindow: TWindow; - {$ELSE} - OldWindow: HWND; - {$ENDIF} - {$ENDIF} bmp: TMufasaBitmap; + Desktop : TMWindow; - InputWindow: TMWindow; begin { Disable both of the color pick buttons } + w := 0; + h := 0; + if not Self.Window.TargetValid then + self.Window.SetDesktop; - - InputWindow := TMWindow.Create; - InputWindow.SetWindow(Self.Window); - - { If the Window is not valid, set it to the desktop } - if not InputWindow.TargetValid then - InputWindow.SetDesktop; - - Input := TMInput.Create(InputWindow); + Desktop := TMWindow.Create; + Desktop.SetDesktop; + Input := TMInput.Create(Self.Window); + Desktop.GetDimensions(w, h); Application.MainForm.Enabled := False; ColourHistoryForm.Enabled := False; @@ -134,27 +127,8 @@ begin ScreenForm := TForm.Create(Application.MainForm); InfoForm := TForm.Create(ScreenForm); -{ 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; - {$ELSE} - OldWindow := Window.TargetHandle; - {$ENDIF} - Window.SetDesktop; - {$ENDIF} - w := 0; - h := 0; - { Get the dimensions of the screen } - Window.GetDimensions(w, h); + + { Initialize the form that will hold the client image } ScreenForm.Caption := 'SimbaColourPicker'; @@ -203,7 +177,7 @@ begin { Copy the client to ImageMain } bmp:=TMufasaBitmap.Create; - bmp.CopyClientToBitmap(Window, true, 0, 0, w-1, h-1); + bmp.CopyClientToBitmap(Desktop, true, 0, 0, w-1, h-1); ImageMain.Picture.Bitmap.Free; ImageMain.Picture.Bitmap := bmp.ToTBitmap; bmp.Free; @@ -213,7 +187,6 @@ begin InfoHandle:= ImageInfo.Canvas.Handle; TheChangedEvent := ImageMain.Canvas.OnChange; TheChangingEvent := ImageMain.Canvas.OnChanging; - { Show the forms } ScreenForm.Show; InfoForm.Show; @@ -236,14 +209,6 @@ begin x := Colorx; y := Colory; - {$IFNDEF PICKER_CLIENT} - {$IFDEF LINUX} - Window.SetTarget(OldWindow); - {$ELSE} - Window.SetTarget(OldWindow, w_Window); - {$ENDIF} - {$ENDIF} - { Free forms and images } ImageMain.Free; ImageInfo.Free; @@ -251,7 +216,7 @@ begin ScreenForm.Free; Input.Free; - InputWindow.Free; + Desktop.free; { Re-enable the color pick buttons } Application.MainForm.Enabled := True; @@ -310,8 +275,8 @@ procedure TMColorPicker.ImageInfoMouseMove(Sender: TObject; Shift: TShiftState; Y: Integer); begin { Move the info form } - InfoForm.Top := Mouse.CursorPos.Y - 15; - InfoForm.Left := Mouse.CursorPos.X + 5; +// InfoForm.Top := Mouse.CursorPos.Y - 15; +// InfoForm.Left := Mouse.CursorPos.X + 5; end; procedure TMColorPicker.ColorPickUp(Sender: TObject; Button: TMouseButton; diff --git a/Units/MMLCore/window.pas b/Units/MMLCore/window.pas index 5706913..5a71218 100644 --- a/Units/MMLCore/window.pas +++ b/Units/MMLCore/window.pas @@ -281,6 +281,7 @@ begin OnSetTarget(w_window, Self.TargetMode); Self.TargetDC:= DesktopDC; Self.TargetHandle:= DesktopHWND; + UpdateDrawBitmap; {$ENDIF} end;