mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-10 12:59:00 +02:00
Gtk2: removed redundant and unused RecreateWnd() from gtk2widgetset, also removed unused GetDoubleBufferedDC()
git-svn-id: trunk@36250 -
This commit is contained in:
parent
cf9baeddd4
commit
e95c6fcbb0
@ -162,8 +162,6 @@ type
|
||||
procedure DestroyEmptySubmenu(Sender: TObject);
|
||||
procedure DestroyConnectedWidget(Widget: PGtkWidget;
|
||||
CheckIfDestroying: boolean);
|
||||
function RecreateWnd(Sender: TObject): Integer;
|
||||
|
||||
// clipboard
|
||||
procedure SetClipboardWidget(TargetWidget: PGtkWidget);
|
||||
|
||||
@ -174,7 +172,6 @@ type
|
||||
procedure DisposeDC(aDC: TGtkDeviceContext);
|
||||
function CreateDCForWidget(AWidget: PGtkWidget; AWindow: PGdkWindow;
|
||||
AWithChildWindows: Boolean; ADoubleBuffer: PgdkDrawable = nil): HDC;
|
||||
function GetDoubleBufferedDC(Handle: HWND): HDC;
|
||||
|
||||
// GDIObjects
|
||||
function IsValidGDIObject(const AGDIObj: HGDIOBJ): Boolean;
|
||||
|
@ -2613,33 +2613,6 @@ begin
|
||||
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Method: TGtk2WidgetSet.RecreateWnd
|
||||
Params: Sender: TObject - the lcl wincontrol, that is to recreated
|
||||
Returns: none
|
||||
|
||||
Destroys Handle and child Handles and recreates them.
|
||||
-------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.RecreateWnd(Sender: TObject): Integer;
|
||||
var
|
||||
aWinControl, aParent: TWinControl;
|
||||
begin
|
||||
aWinControl := TWinControl(Sender);
|
||||
aParent := aWinControl.Parent;
|
||||
if aParent <> nil then
|
||||
begin
|
||||
// remove and insert the control
|
||||
// this will destroy and recreate all child handles
|
||||
aWinControl.Parent := nil;
|
||||
aWinControl.Parent := aParent;
|
||||
end;
|
||||
DebugLn(['TGtk2WidgetSet.RecreateWnd ',DbgSName(Sender)]);
|
||||
ResizeChild(Sender,aWinControl.Left,aWinControl.Top,
|
||||
aWinControl.Width,aWinControl.Height);
|
||||
SetVisible(Sender, aWinControl.HandleObjectShouldBeVisible);
|
||||
Result := 0;
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: CreateTimer
|
||||
Params: Interval:
|
||||
@ -5365,107 +5338,6 @@ begin
|
||||
DC.SetWidget(AWidget, AWindow, AWithChildWindows, ADoubleBuffer);
|
||||
end;
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
function TGtk2WidgetSet.GetDoubleBufferedDC(Handle: HWND): HDC;
|
||||
------------------------------------------------------------------------------}
|
||||
function TGtk2WidgetSet.GetDoubleBufferedDC(Handle: HWND): HDC;
|
||||
var
|
||||
Widget: PGtkWidget;
|
||||
WidgetInfo: PWinWidgetInfo;
|
||||
AWindow: PGdkWindow;
|
||||
Width, Height: integer;
|
||||
BufferWidth, BufferHeight: integer;
|
||||
DoubleBuffer: PGdkPixmap;
|
||||
BufferCreated: Boolean;
|
||||
DevContext: TGtkDeviceContext absolute Result;
|
||||
CaretWasVisible: Boolean;
|
||||
MainWidget: PGtkWidget;
|
||||
GC: PGdkGC;
|
||||
//LCLObject: TObject;
|
||||
//x, y: integer;
|
||||
begin
|
||||
Result:=0;
|
||||
Widget:=PGtkWidget(Handle);
|
||||
{$IFDEF VerboseDoubleBuffer}
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC ',GetWidgetClassName(Widget));
|
||||
{$ENDIF}
|
||||
WidgetInfo:=GetWidgetInfo(Widget,true);
|
||||
AWindow:=Widget^.Window;
|
||||
Width:=Widget^.allocation.width;
|
||||
Height:=Widget^.allocation.height;
|
||||
// create or resize DoubleBuffer
|
||||
DoubleBuffer:=WidgetInfo^.DoubleBuffer;
|
||||
if DoubleBuffer<>nil then begin
|
||||
gdk_window_get_size(DoubleBuffer,@BufferWidth,@BufferHeight);
|
||||
{$IFDEF VerboseDoubleBuffer}
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC Checking ',
|
||||
' Width=',Width,' Height=',Height,
|
||||
' BufferWidth=',BufferWidth,' BufferHeight=',BufferHeight
|
||||
);
|
||||
{$ENDIF}
|
||||
// lazy update of buffer
|
||||
if (BufferWidth<Width) or (BufferHeight<Height)
|
||||
or (BufferWidth>(Width*2+20)) or (BufferHeight>(Height*2+20))
|
||||
then begin
|
||||
{$IFDEF VerboseDoubleBuffer}
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC Destroying old double buffer ');
|
||||
{$ENDIF}
|
||||
gdk_pixmap_unref(DoubleBuffer);
|
||||
DoubleBuffer:=nil;
|
||||
WidgetInfo^.DoubleBuffer:=nil;
|
||||
end;
|
||||
end;
|
||||
BufferCreated:=false;
|
||||
if DoubleBuffer=nil then begin
|
||||
// create DoubleBuffer
|
||||
{$IFDEF VerboseDoubleBuffer}
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC Creating double buffer ',
|
||||
' Width=',Width,' Height=',Height);
|
||||
{$ENDIF}
|
||||
DoubleBuffer:=gdk_pixmap_new(AWindow,Width,Height,-1);
|
||||
WidgetInfo^.DoubleBuffer := DoubleBuffer;
|
||||
BufferCreated:=true;
|
||||
end;
|
||||
|
||||
// create DC for double buffer
|
||||
Result := CreateDCForWidget(Widget, Widget^.Window, False, DoubleBuffer);
|
||||
|
||||
|
||||
if BufferCreated
|
||||
then begin
|
||||
// create GC
|
||||
GC:=DevContext.GC;
|
||||
// copy old context to buffer
|
||||
gdk_gc_set_clip_region(GC, nil);
|
||||
gdk_gc_set_clip_rectangle(GC, nil);
|
||||
|
||||
// hide caret
|
||||
HideCaretOfWidgetGroup(Widget,MainWidget,CaretWasVisible);
|
||||
// copy
|
||||
gdk_window_copy_area(DoubleBuffer, GC,0,0,
|
||||
Widget^.Window,0,0,Width,Height);
|
||||
|
||||
{LCLObject:=GetParentLCLObject(Widget);
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC ',DbgS(Widget),8),'=',GetWidgetClassName(Widget),' ',DbgS(Cardinal(LCLObject));
|
||||
if (LCLObject is TPanel)
|
||||
and (csDesigning in TPanel(LCLObject).ComponentState) then begin
|
||||
gdk_window_get_origin(Widget^.Window,@x,@y);
|
||||
DebugLn('TGtk2WidgetSet.BeginPaint ',TPanel(LCLObject).Name,':',TPanel(LCLObject).ClassName,
|
||||
' Widget=',GetWidgetClassName(Widget),
|
||||
' Origin=',x,',',y,
|
||||
' ',Widget^.allocation.x,',',Widget^.allocation.y);
|
||||
end;}
|
||||
|
||||
// restore caret
|
||||
if CaretWasVisible then
|
||||
GTKAPIWidget_ShowCaret(PGTKAPIWidget(MainWidget));
|
||||
end;
|
||||
{$IFDEF VerboseDoubleBuffer}
|
||||
DebugLn('TGtk2WidgetSet.GetDoubleBufferedDC DC=',DbgS(Result));
|
||||
{$ENDIF}
|
||||
end;
|
||||
|
||||
|
||||
{------------------------------------------------------------------------------
|
||||
Function: NewGDIObject
|
||||
Params: none
|
||||
|
Loading…
Reference in New Issue
Block a user