summaryrefslogtreecommitdiff
path: root/gfx
diff options
context:
space:
mode:
authorsekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 11:27:12 +0000
committersekelsenmat <sekelsenmat@ae50a9b5-8222-0410-bf8d-8a13f76226bf>2007-07-11 11:27:12 +0000
commit206939d343826dfbe7e39189dbcbfc61840aa6fe (patch)
tree4b548b48aff5e59bac75363172dee53c737439f7 /gfx
parent6d1c5274aacdf55d21b98a7e61b2d3a100fbd9eb (diff)
downloadfpGUI-206939d343826dfbe7e39189dbcbfc61840aa6fe.tar.xz
Removed Rect parameter from Paint event
Diffstat (limited to 'gfx')
-rw-r--r--gfx/gdi/gfx_gdi.pas6
-rw-r--r--gfx/geldirty.pas390
-rw-r--r--gfx/gfxbase.pas4
3 files changed, 198 insertions, 202 deletions
diff --git a/gfx/gdi/gfx_gdi.pas b/gfx/gdi/gfx_gdi.pas
index 34179a40..eeb1c34d 100644
--- a/gfx/gdi/gfx_gdi.pas
+++ b/gfx/gdi/gfx_gdi.pas
@@ -201,7 +201,6 @@ type
procedure CaptureMouse; override;
procedure ReleaseMouse; override;
{ Event processing methods }
-// procedure ProcessEvent(AEvent: TFEvent); override;
procedure EvCreate; override;
procedure EvFocusIn; override;
procedure EvFocusOut; override;
@@ -1625,11 +1624,8 @@ begin
end;
procedure TGDIWindow.EvPaint;
-var
- r: TRect;
begin
- if Assigned(OnPaint) then
- OnPaint(Self, r);
+ if Assigned(OnPaint) then OnPaint(Self);
end;
procedure TGDIWindow.EvMove;
diff --git a/gfx/geldirty.pas b/gfx/geldirty.pas
index f552399a..afbf780d 100644
--- a/gfx/geldirty.pas
+++ b/gfx/geldirty.pas
@@ -1,195 +1,195 @@
-{
- fpGUI - Free Pascal Graphical User Interface
-
- GelDirty - Window dirty list (redrawing queue)
-
- Copyright (C) 2000 - 2006 See the file AUTHORS, included in this
- distribution, for details of the copyright.
-
- See the file COPYING.modifiedLGPL, included in this distribution,
- for details about the copyright.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-}
-unit GELDirty;
-
-{$IFDEF Debug}
- {$ASSERTIONS On}
-{$ENDIF}
-
-{$ifdef fpc}
- {$mode objfpc}{$H+}
-{$endif}
-
-interface
-uses
- Classes,
- GfxBase; // fpGFX units
-
-
-type
-
- PDirtyListEntry = ^TDirtyListEntry;
- TDirtyListEntry = record
- Prev, Next: PDirtyListEntry;
- Window: TFCustomWindow;
- Rect: TRect;
- end;
-
-
- TDirtyList = class
- private
- FFirst, FLast: PDirtyListEntry;
- protected
- procedure RemoveEntry(AEntry: PDirtyListEntry);
- public
- destructor Destroy; override;
- procedure AddRect(AWindow: TFCustomWindow; const ARect: TRect);
- procedure ClearQueueForWindow(AWindow: TFCustomWindow);
- procedure PaintQueueForWindow(AWindow: TFCustomWindow);
- procedure PaintAll;
- property First: PDirtyListEntry read FFirst write FFirst; // !!!
- end;
-
-
-implementation
-
-
-destructor TDirtyList.Destroy;
-var
- Entry, NextEntry: PDirtyListEntry;
-begin
- Entry := FFirst;
- while Assigned(Entry) do
- begin
- NextEntry := Entry^.Next;
- Dispose(Entry);
- Entry := NextEntry;
- end;
- inherited Destroy;
-end;
-
-
-procedure TDirtyList.AddRect(AWindow: TFCustomWindow; const ARect: TRect);
-var
- Entry, NextEntry: PDirtyListEntry;
-begin
- // Check for empty or invalid update rectangle
- if (ARect.Left >= ARect.Right) or (ARect.Top >= ARect.Bottom) or
- (ARect.Right < 0) or (ARect.Top < 0) or
- (ARect.Left >= AWindow.ClientWidth) or
- (ARect.Top >= AWindow.ClientHeight) then
- exit;
-
- { Check if the new rectangle is already contained in some other rectangle
- in the dirty list for the same window }
- Entry := FFirst;
- while Assigned(Entry) do
- begin
- NextEntry := Entry^.Next;
- with Entry^.Rect do
- if AWindow = Entry^.Window then
- if (ARect.Left >= Left) and (ARect.Top >= Top) and
- (ARect.Right <= Right) and (ARect.Bottom <= Bottom) then
- // Rectangle is already contained in dirt list -> do nothing
- exit
- else if (Left >= ARect.Left) and (Top >= ARect.Top) and
- (Right <= ARect.Right) and (Bottom <= ARect.Bottom) then
- begin
- // The new rectangle contains the currently checked rectangle
- Entry^.Rect := ARect;
- exit;
- end;
- Entry := NextEntry;
- end;
-
-
- // If we got this far, then we really have to add the rectangle to our list
-
- New(Entry);
- Entry^.Window := AWindow;
- Entry^.Rect := ARect;
- Entry^.Next := nil;
-
- if Assigned(FFirst) then
- begin
- Entry^.Prev := FLast;
- FLast^.Next := Entry;
- FLast := Entry;
- end else
- begin
- Entry^.Prev := nil;
- FFirst := Entry;
- FLast := Entry;
- end;
-end;
-
-
-procedure TDirtyList.ClearQueueForWindow(AWindow: TFCustomWindow);
-var
- Entry, NextEntry: PDirtyListEntry;
-begin
- Entry := FFirst;
- while Assigned(Entry) do
- begin
- NextEntry := Entry^.Next;
- if Entry^.Window = AWindow then
- RemoveEntry(Entry);
- Entry := NextEntry;
- end;
-end;
-
-
-procedure TDirtyList.PaintQueueForWindow(AWindow: TFCustomWindow);
-var
- IsNotEmpty: Boolean;
- Entry, NextEntry: PDirtyListEntry;
-begin
- IsNotEmpty := False;
- AWindow.Canvas.SaveState;
- AWindow.Canvas.EmptyClipRect;
-
- Entry := First;
- while Assigned(Entry) do
- begin
- NextEntry := Entry^.Next;
- if Entry^.Window = AWindow then
- begin
- IsNotEmpty := AWindow.Canvas.UnionClipRect(Entry^.Rect);
- RemoveEntry(Entry);
- end;
- Entry := NextEntry;
- end;
-
- if IsNotEmpty and Assigned(AWindow.OnPaint) then
- AWindow.OnPaint(AWindow, AWindow.Canvas.GetClipRect);
-
- AWindow.Canvas.RestoreState;
-end;
-
-
-procedure TDirtyList.PaintAll;
-begin
- while Assigned(FFirst) do
- PaintQueueForWindow(FFirst^.Window);
-end;
-
-
-procedure TDirtyList.RemoveEntry(AEntry: PDirtyListEntry);
-begin
- if Assigned(AEntry^.Prev) then
- AEntry^.Prev^.Next := AEntry^.Next
- else
- FFirst := AEntry^.Next;
- if Assigned(AEntry^.Next) then
- AEntry^.Next^.Prev := AEntry^.Prev
- else
- FLast := AEntry^.Prev;
- Dispose(AEntry);
-end;
-
-
-end.
-
+{
+ fpGUI - Free Pascal Graphical User Interface
+
+ GelDirty - Window dirty list (redrawing queue)
+
+ Copyright (C) 2000 - 2006 See the file AUTHORS, included in this
+ distribution, for details of the copyright.
+
+ See the file COPYING.modifiedLGPL, included in this distribution,
+ for details about the copyright.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+}
+unit GELDirty;
+
+{$IFDEF Debug}
+ {$ASSERTIONS On}
+{$ENDIF}
+
+{$ifdef fpc}
+ {$mode objfpc}{$H+}
+{$endif}
+
+interface
+uses
+ Classes,
+ GfxBase; // fpGFX units
+
+
+type
+
+ PDirtyListEntry = ^TDirtyListEntry;
+ TDirtyListEntry = record
+ Prev, Next: PDirtyListEntry;
+ Window: TFCustomWindow;
+ Rect: TRect;
+ end;
+
+
+ TDirtyList = class
+ private
+ FFirst, FLast: PDirtyListEntry;
+ protected
+ procedure RemoveEntry(AEntry: PDirtyListEntry);
+ public
+ destructor Destroy; override;
+ procedure AddRect(AWindow: TFCustomWindow; const ARect: TRect);
+ procedure ClearQueueForWindow(AWindow: TFCustomWindow);
+ procedure PaintQueueForWindow(AWindow: TFCustomWindow);
+ procedure PaintAll;
+ property First: PDirtyListEntry read FFirst write FFirst; // !!!
+ end;
+
+
+implementation
+
+
+destructor TDirtyList.Destroy;
+var
+ Entry, NextEntry: PDirtyListEntry;
+begin
+ Entry := FFirst;
+ while Assigned(Entry) do
+ begin
+ NextEntry := Entry^.Next;
+ Dispose(Entry);
+ Entry := NextEntry;
+ end;
+ inherited Destroy;
+end;
+
+
+procedure TDirtyList.AddRect(AWindow: TFCustomWindow; const ARect: TRect);
+var
+ Entry, NextEntry: PDirtyListEntry;
+begin
+ // Check for empty or invalid update rectangle
+ if (ARect.Left >= ARect.Right) or (ARect.Top >= ARect.Bottom) or
+ (ARect.Right < 0) or (ARect.Top < 0) or
+ (ARect.Left >= AWindow.ClientWidth) or
+ (ARect.Top >= AWindow.ClientHeight) then
+ exit;
+
+ { Check if the new rectangle is already contained in some other rectangle
+ in the dirty list for the same window }
+ Entry := FFirst;
+ while Assigned(Entry) do
+ begin
+ NextEntry := Entry^.Next;
+ with Entry^.Rect do
+ if AWindow = Entry^.Window then
+ if (ARect.Left >= Left) and (ARect.Top >= Top) and
+ (ARect.Right <= Right) and (ARect.Bottom <= Bottom) then
+ // Rectangle is already contained in dirt list -> do nothing
+ exit
+ else if (Left >= ARect.Left) and (Top >= ARect.Top) and
+ (Right <= ARect.Right) and (Bottom <= ARect.Bottom) then
+ begin
+ // The new rectangle contains the currently checked rectangle
+ Entry^.Rect := ARect;
+ exit;
+ end;
+ Entry := NextEntry;
+ end;
+
+
+ // If we got this far, then we really have to add the rectangle to our list
+
+ New(Entry);
+ Entry^.Window := AWindow;
+ Entry^.Rect := ARect;
+ Entry^.Next := nil;
+
+ if Assigned(FFirst) then
+ begin
+ Entry^.Prev := FLast;
+ FLast^.Next := Entry;
+ FLast := Entry;
+ end else
+ begin
+ Entry^.Prev := nil;
+ FFirst := Entry;
+ FLast := Entry;
+ end;
+end;
+
+
+procedure TDirtyList.ClearQueueForWindow(AWindow: TFCustomWindow);
+var
+ Entry, NextEntry: PDirtyListEntry;
+begin
+ Entry := FFirst;
+ while Assigned(Entry) do
+ begin
+ NextEntry := Entry^.Next;
+ if Entry^.Window = AWindow then
+ RemoveEntry(Entry);
+ Entry := NextEntry;
+ end;
+end;
+
+
+procedure TDirtyList.PaintQueueForWindow(AWindow: TFCustomWindow);
+var
+ IsNotEmpty: Boolean;
+ Entry, NextEntry: PDirtyListEntry;
+begin
+ IsNotEmpty := False;
+ AWindow.Canvas.SaveState;
+ AWindow.Canvas.EmptyClipRect;
+
+ Entry := First;
+ while Assigned(Entry) do
+ begin
+ NextEntry := Entry^.Next;
+ if Entry^.Window = AWindow then
+ begin
+ IsNotEmpty := AWindow.Canvas.UnionClipRect(Entry^.Rect);
+ RemoveEntry(Entry);
+ end;
+ Entry := NextEntry;
+ end;
+
+ if IsNotEmpty and Assigned(AWindow.OnPaint) then
+ AWindow.OnPaint(AWindow);
+
+ AWindow.Canvas.RestoreState;
+end;
+
+
+procedure TDirtyList.PaintAll;
+begin
+ while Assigned(FFirst) do
+ PaintQueueForWindow(FFirst^.Window);
+end;
+
+
+procedure TDirtyList.RemoveEntry(AEntry: PDirtyListEntry);
+begin
+ if Assigned(AEntry^.Prev) then
+ AEntry^.Prev^.Next := AEntry^.Next
+ else
+ FFirst := AEntry^.Next;
+ if Assigned(AEntry^.Next) then
+ AEntry^.Next^.Prev := AEntry^.Prev
+ else
+ FLast := AEntry^.Prev;
+ Dispose(AEntry);
+end;
+
+
+end.
+
diff --git a/gfx/gfxbase.pas b/gfx/gfxbase.pas
index 6b263e61..834dd0b6 100644
--- a/gfx/gfxbase.pas
+++ b/gfx/gfxbase.pas
@@ -482,7 +482,7 @@ type
FOnMouseReleased: TGfxMouseButtonEvent;
FOnMouseMove: TGfxMouseMoveEvent;
FOnMouseWheel: TGfxMouseWheelEvent;
- FOnPaint: TGfxPaintEvent;
+ FOnPaint: TNotifyEvent;
FOnMove: TNotifyEvent;
FOnResize: TNotifyEvent;
FOnShow: TNotifyEvent;
@@ -577,7 +577,7 @@ type
property OnMouseReleased: TGfxMouseButtonEvent read FOnMouseReleased write FOnMouseReleased;
property OnMouseMove: TGfxMouseMoveEvent read FOnMouseMove write FOnMouseMove;
property OnMouseWheel: TGfxMouseWheelEvent read FOnMouseWheel write FOnMouseWheel;
- property OnPaint: TGfxPaintEvent read FOnPaint write FOnPaint;
+ property OnPaint: TNotifyEvent read FOnPaint write FOnPaint;
property OnMove: TNotifyEvent read FOnMove write FOnMove;
property OnResize: TNotifyEvent read FOnResize write FOnResize;
property OnShow: TNotifyEvent read FOnShow write FOnShow;