From f52f2986c4d63adf6a36c9fa042e08636f58716a Mon Sep 17 00:00:00 2001 From: Wizzup? Date: Sat, 14 Nov 2009 02:45:00 +0000 Subject: [PATCH] Some more changes, exceptions and comments. git-svn-id: http://www.villavu.com/repositories/merlijn/mufasa@232 3f818213-9676-44b0-a9b4-5e4c4e03d09d --- Projects/SAMufasaGUI/project1.lpi | 206 +++++++++++++++--------------- Units/MMLCore/bitmaps.pas | 2 +- Units/MMLCore/input.pas | 4 + Units/MMLCore/window.pas | 2 + 4 files changed, 109 insertions(+), 105 deletions(-) diff --git a/Projects/SAMufasaGUI/project1.lpi b/Projects/SAMufasaGUI/project1.lpi index 3379fbf..bb4647e 100644 --- a/Projects/SAMufasaGUI/project1.lpi +++ b/Projects/SAMufasaGUI/project1.lpi @@ -164,7 +164,7 @@ - + @@ -219,7 +219,7 @@ - + @@ -247,8 +247,8 @@ - - + + @@ -256,9 +256,9 @@ - - - + + + @@ -279,9 +279,9 @@ - - - + + + @@ -398,9 +398,11 @@ - - + + + + @@ -610,7 +612,7 @@ - + @@ -704,8 +706,8 @@ - - + + @@ -722,7 +724,7 @@ - + @@ -1188,7 +1190,7 @@ - + @@ -1503,8 +1505,8 @@ - - + + @@ -1755,133 +1757,129 @@ - - + + - + - - + + - - + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + - + - + - + - + - + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Units/MMLCore/bitmaps.pas b/Units/MMLCore/bitmaps.pas index 7b00184..81d78d1 100644 --- a/Units/MMLCore/bitmaps.pas +++ b/Units/MMLCore/bitmaps.pas @@ -892,7 +892,7 @@ end; procedure TMufasaBitmap.ValidatePoint(x, y: integer); begin if (x <0) or (x >= w) or (y < 0) or (y >= h) then - raise Exception.CreateFmt('You are accesing an invalid point, (%d,%d) at bitmap[%d]',[x,y,index]); + raise Exception.CreateFmt('You are accessing an invalid point, (%d,%d) at bitmap[%d]',[x,y,index]); end; constructor TMufasaBitmap.Create; diff --git a/Units/MMLCore/input.pas b/Units/MMLCore/input.pas index f6ff138..c9dcbfb 100644 --- a/Units/MMLCore/input.pas +++ b/Units/MMLCore/input.pas @@ -267,7 +267,11 @@ var var rect : TRect; {$ENDIF} + w,h: integer; begin + TClient(Client).MWindow.GetDimensions(w, h); + if (x < 0) or (y < 0) or (x > w) or (y > h) then + raise Exception.CreateFmt('SetMousePos: X, Y (%d, %d) is not valid', [x, y]); {$IFDEF MSWINDOWS} GetWindowRect(TClient(Client).MWindow.TargetHandle, Rect); diff --git a/Units/MMLCore/window.pas b/Units/MMLCore/window.pas index 03987b8..5dd4d6e 100644 --- a/Units/MMLCore/window.pas +++ b/Units/MMLCore/window.pas @@ -590,6 +590,7 @@ begin Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); if XGetWindowAttributes(Self.XDisplay, Self.CurWindow, @Attrib) <> 0 Then begin + { I don't think we need this XTranslateCoordinates... :D } XTranslateCoordinates(Self.XDisplay, Self.CurWindow, Self.DesktopWindow, 0,0, @newx, @newy, @childwindow); W := Attrib.Width; H := Attrib.Height; @@ -650,6 +651,7 @@ begin Old_Handler := XSetErrorHandler(@MufasaXErrorHandler); if XGetWindowAttributes(Self.XDisplay, Self.CurWindow, @Attrib) <> 0 Then begin + { I don't think we need this XTranslateCoordinates... :D } 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