From e95c6fcbb0d8493b81bc3c1a6a28ab93e5124c32 Mon Sep 17 00:00:00 2001 From: zeljko Date: Fri, 23 Mar 2012 09:07:15 +0000 Subject: [PATCH] Gtk2: removed redundant and unused RecreateWnd() from gtk2widgetset, also removed unused GetDoubleBufferedDC() git-svn-id: trunk@36250 - --- lcl/interfaces/gtk2/gtk2int.pas | 3 - lcl/interfaces/gtk2/gtk2widgetset.inc | 128 -------------------------- 2 files changed, 131 deletions(-) diff --git a/lcl/interfaces/gtk2/gtk2int.pas b/lcl/interfaces/gtk2/gtk2int.pas index 4365dd5e65..b67e61364b 100644 --- a/lcl/interfaces/gtk2/gtk2int.pas +++ b/lcl/interfaces/gtk2/gtk2int.pas @@ -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; diff --git a/lcl/interfaces/gtk2/gtk2widgetset.inc b/lcl/interfaces/gtk2/gtk2widgetset.inc index 2256cb3984..9eca9e8863 100644 --- a/lcl/interfaces/gtk2/gtk2widgetset.inc +++ b/lcl/interfaces/gtk2/gtk2widgetset.inc @@ -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*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