From ab66df423f40cfadedeb3a833a0c375a7030b201 Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 16 Jan 2005 11:40:11 +0000 Subject: [PATCH] fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin git-svn-id: trunk@6608 - --- ide/condef.lfm | 4 +- ide/condef.lrs | 4 +- ideintf/graphpropedits.pas | 6 -- lcl/forms.pp | 4 +- lcl/include/graphiccontrol.inc | 6 +- lcl/include/intfbaselcl.inc | 4 + lcl/include/intfbasewinapi.inc | 10 ++- lcl/include/paintbox.inc | 4 +- lcl/include/wincontrol.inc | 43 ++++++++--- lcl/interfaces/gtk/gtkproc.inc | 19 ++++- lcl/interfaces/gtk/gtkwinapi.inc | 120 ++++++++++++------------------ lcl/interfaces/gtk/gtkwinapih.inc | 5 +- 12 files changed, 127 insertions(+), 102 deletions(-) diff --git a/ide/condef.lfm b/ide/condef.lfm index 00e82d7027..b66a1d84a8 100644 --- a/ide/condef.lfm +++ b/ide/condef.lfm @@ -103,7 +103,7 @@ object CondForm: TCondForm Caption = '&Remove' TabOrder = 5 OnClick = RemoveBtnClick - Left = 133 + Left = 134 Height = 25 Top = 64 Width = 82 @@ -132,7 +132,7 @@ object CondForm: TCondForm Cancel = True Caption = 'Cancel' TabOrder = 7 - Left = 136 + Left = 134 Height = 25 Top = 125 Width = 82 diff --git a/ide/condef.lrs b/ide/condef.lrs index d84dcc71f9..f47116eeb7 100644 --- a/ide/condef.lrs +++ b/ide/condef.lrs @@ -28,14 +28,14 @@ LazarusResources.Add('TCondForm','FORMDATA',[ +'ck'#4'Left'#3#134#0#6'Height'#2#25#3'Top'#2#6#5'Width'#2'R'#0#0#7'TBitBtn'#9 +'RemoveBtn'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'OnClick'#7#14'RemoveBtnCli' +'ck'#7'Anchors'#11#5'akTop'#7'akRight'#0#7'Caption'#6#7'&Remove'#8'TabOrder' - +#2#5#7'OnClick'#7#14'RemoveBtnClick'#4'Left'#3#133#0#6'Height'#2#25#3'Top'#2 + +#2#5#7'OnClick'#7#14'RemoveBtnClick'#4'Left'#3#134#0#6'Height'#2#25#3'Top'#2 +'@'#5'Width'#2'R'#0#0#7'TBitBtn'#5'OkBtn'#7'Anchors'#11#5'akTop'#7'akRight'#0 +#7'Default'#9#4'Kind'#7#4'bkOK'#11'ModalResult'#2#1#7'Anchors'#11#5'akTop'#7 +'akRight'#0#7'Default'#9#11'ModalResult'#2#1#7'Caption'#6#3'&OK'#8'TabOrder' +#2#6#4'Left'#3#134#0#6'Height'#2#25#3'Top'#2'_'#5'Width'#2'R'#0#0#7'TBitBtn' +#7'BitBtn1'#7'Anchors'#11#5'akTop'#7'akRight'#0#4'Kind'#7#8'bkCancel'#11'Mod' +'alResult'#2#2#7'Anchors'#11#5'akTop'#7'akRight'#0#11'ModalResult'#2#2#6'Can' - +'cel'#9#7'Caption'#6#6'Cancel'#8'TabOrder'#2#7#4'Left'#3#136#0#6'Height'#2#25 + +'cel'#9#7'Caption'#6#6'Cancel'#8'TabOrder'#2#7#4'Left'#3#134#0#6'Height'#2#25 +#3'Top'#2'}'#5'Width'#2'R'#0#0#7'TButton'#10'AddInverse'#7'Anchors'#11#5'akT' +'op'#7'akRight'#0#7'Caption'#6#11'Add Inverse'#8'TabOrder'#2#4#7'OnClick'#7 +#15'AddInverseCLICK'#4'Left'#3#134#0#6'Height'#2#25#3'Top'#2'"'#5'Width'#2'R' diff --git a/ideintf/graphpropedits.pas b/ideintf/graphpropedits.pas index 098bbf80ee..c817e44ff7 100644 --- a/ideintf/graphpropedits.pas +++ b/ideintf/graphpropedits.pas @@ -796,14 +796,8 @@ begin end; function TFontPropertyEditor.GetAttributes: TPropertyAttributes; -var - APersistent: TPersistent; begin Result := [paMultiSelect, paSubProperties, paDialog, paReadOnly]; - APersistent:=GetComponent(0); - if (APersistent<>nil) and (APersistent is TControl) - and (not (APersistent is TStaticText)) then - Result:=Result+[paDisableSubProperties]-[paDialog]; end; diff --git a/lcl/forms.pp b/lcl/forms.pp index 5444253e34..ff75ea74bb 100644 --- a/lcl/forms.pp +++ b/lcl/forms.pp @@ -185,11 +185,11 @@ type published property Align; property Anchors; - property AutoSize default True; + property AutoSize; //property AutoScroll; property BorderSpacing; //property BiDiMode; - property BorderStyle default bsSingle; + property BorderStyle; property ChildSizing; property Constraints; //property DockSite; diff --git a/lcl/include/graphiccontrol.inc b/lcl/include/graphiccontrol.inc index 88d66f95c8..8e0228edf2 100644 --- a/lcl/include/graphiccontrol.inc +++ b/lcl/include/graphiccontrol.inc @@ -41,7 +41,7 @@ end; ------------------------------------------------------------------------------} destructor TGraphicControl.Destroy; begin - FCanvas.Free; + FreeAndNil(FCanvas); inherited Destroy; end; @@ -58,6 +58,7 @@ begin begin Canvas.Lock; try + //debugln('TGraphicControl.WMPaint A ',DbgSName(Self)); Canvas.Handle := Message.DC; try Paint; @@ -89,6 +90,9 @@ end; { ============================================================================= $Log$ + Revision 1.10 2005/01/16 11:40:10 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.9 2004/04/10 17:58:57 mattias implemented mainunit hints for include files diff --git a/lcl/include/intfbaselcl.inc b/lcl/include/intfbaselcl.inc index c958f80c68..4d80a4d8c7 100644 --- a/lcl/include/intfbaselcl.inc +++ b/lcl/include/intfbaselcl.inc @@ -105,6 +105,7 @@ var Clip: hRGN; begin // If the interface has a better way to check a region it can override this + //debugln('TWidgetSet.DCClipRegionValid DC=',HexStr(Cardinal(DC),8)); Clip:=CreateEmptyRegion; Result:=GetClipRGN(DC,Clip)>=0; DeleteObject(Clip); @@ -632,6 +633,9 @@ end; { ============================================================================= $Log$ + Revision 1.32 2005/01/16 11:40:10 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.31 2004/10/23 14:47:44 micha remove old code: statusbar methods in twidgetset diff --git a/lcl/include/intfbasewinapi.inc b/lcl/include/intfbasewinapi.inc index 0db10fe32a..d1df0890fd 100644 --- a/lcl/include/intfbasewinapi.inc +++ b/lcl/include/intfbasewinapi.inc @@ -704,7 +704,7 @@ begin GetClipRGN(DC, OldC); Clip := CreateEmptyRegion; //DebugLn('TWidgetSet.ExtSelectClipRGN A OldC=',HexStr(Cardinal(OldC),8), - // ' Clip=',HexStr(Cardinal(Clip),8),' RGn=',HexStr(Cardinal(RGN),8),' Mode=',Mode); + // ' Clip=',HexStr(Cardinal(Clip),8),' RGn=',HexStr(Cardinal(RGN),8),' Mode=',dbgs(Mode)); Result := CombineRGN(Clip, OldC, RGN, Mode); //DebugLn('TWidgetSet.ExtSelectClipRGN B Result=',Result); If Result <> ERROR then @@ -962,9 +962,10 @@ var RRGN : hRGN; begin RRGN := CreateRectRgn(Left, Top, Right, Bottom); - //DebugLn('TWidgetSet.IntersectClipRect A RGN=',HexStr(Cardinal(RRGN),8),' ',Left,',',Top,',',Right,',',Bottom); + //DebugLn('TWidgetSet.IntersectClipRect A RGN=',HexStr(Cardinal(RRGN),8), + // ' ',dbgs(Left),',',dbgs(Top),',',dbgs(Right),',',dbgs(Bottom)); If not DCClipRegionValid(DC) then - Result := ExtSelectClipRGN(DC, RRGN, RGN_COPY) + Result := SelectClipRGN(DC, RRGN) else Result := ExtSelectClipRGN(DC, RRGN, RGN_AND); DeleteObject(RRGN); @@ -1414,6 +1415,9 @@ end; { ============================================================================= $Log$ + Revision 1.17 2005/01/16 11:40:10 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.16 2005/01/08 11:03:18 mattias implemented TPen.Mode=pmXor from Jesus diff --git a/lcl/include/paintbox.inc b/lcl/include/paintbox.inc index bbb723e47d..766ff4aec8 100644 --- a/lcl/include/paintbox.inc +++ b/lcl/include/paintbox.inc @@ -26,13 +26,15 @@ end; procedure TPaintBox.Paint; begin if csDesigning in ComponentState then begin - Canvas.Font := Font; Canvas.Brush.Color := Color; with Canvas do begin Pen.Style := psDash; + Pen.Color:=clBlack; Brush.Style := bsClear; Rectangle(0, 0, Width - 1, Height - 1); + Line(0,0,Width-1,Height-1); + Line(Width-1,0,0,Height-1); end; exit; end; diff --git a/lcl/include/wincontrol.inc b/lcl/include/wincontrol.inc index 4d7fa29982..c43968bc27 100644 --- a/lcl/include/wincontrol.inc +++ b/lcl/include/wincontrol.inc @@ -1631,8 +1631,9 @@ var DC: HDC; PS: TPaintStruct; //defined in LCLIntf.pp ControlsNeedsClipping: boolean; + CurControl: TControl; begin -//DebugLn('[TWinControl.PaintHandler] ',Name,':',ClassName,' DC=',HexStr(Message.DC,8)); + //DebugLn('[TWinControl.PaintHandler] ',Name,':',ClassName,' DC=',HexStr(TheMessage.DC,8)); if (csDestroying in ComponentState) or (not HandleAllocated) then exit; {$IFDEF VerboseDsgnPaintMsg} @@ -1644,7 +1645,8 @@ begin DC := TheMessage.DC; if DC = 0 then DC := BeginPaint(Handle, PS); try - // check if child controls needs clipping + // check if child controls need clipping + //DebugLn('[TWinControl.PaintHandler] ',DbgSName(Self),' B'); ControlsNeedsClipping:=false; if FControls<>nil then for I := 0 to FControls.Count - 1 do @@ -1653,24 +1655,29 @@ begin break; end; // exclude child controls and send new paint message - if not ControlsNeedsClipping then + if not ControlsNeedsClipping then begin + //DebugLn('[TWinControl.PaintHandler] ',DbgSName(Self),' no clipping ...'); PaintWindow(DC) - else + end else begin SaveIndex := SaveDC(DC); Clip := SimpleRegion; - for I := 0 to FControls.Count - 1 do - if ControlMustBeClipped(TControl(FControls[I])) then - with TControl(FControls[I]) do begin - //DebugLn('TWinControl.PaintHandler Exclude Child ',Self.Name,':',Self.ClassName,' Control=',Name,':',ClassName); + for I := 0 to FControls.Count - 1 do begin + CurControl:=TControl(FControls[I]); + if ControlMustBeClipped(CurControl) then + with CurControl do begin + //DebugLn('TWinControl.PaintHandler Exclude Child ',DbgSName(Self),' Control=',DbgSName(CurControl),'(',dbgs(CurControl.BoundsRect),')'); Clip := ExcludeClipRect(DC, Left, Top, Left + Width, Top + Height); if Clip = NullRegion then Break; end; + end; + //DebugLn('[TWinControl.PaintHandler] ',DbgSName(Self),' with clipping ...'); if Clip <> NullRegion then PaintWindow(DC); RestoreDC(DC, SaveIndex); end; // paint controls + //DebugLn('[TWinControl.PaintHandler] ',DbgSName(Self),' PaintControls ...'); PaintControls(DC, nil); finally if TheMessage.DC = 0 then EndPaint(Handle, PS); @@ -1683,7 +1690,10 @@ procedure TWinControl.PaintControls(DC: HDC; First: TControl); var I, Count, SaveIndex: Integer; // FrameBrush: HBRUSH; - TempControl : TCOntrol; + TempControl : TControl; + {$IFDEF VerboseControlDCOrigin} + P: TPoint; + {$ENDIF} begin //DebugLn('[TWinControl.PaintControls] ',Name,':',ClassName,' DC=',HexStr(DC,8)); if (csDestroying in ComponentState) @@ -1710,7 +1720,7 @@ begin begin TempControl := TControl(FControls.Items[I]); //DebugLn('TWinControl.PaintControls B Self=',Self.Name,':',Self.ClassName,' Control=',TempControl.Name,':',TempControl.ClassName,' ',TempControl.Left,',',TempControl.Top,',',TempControl.Width,',',TempControl.Height); - with (TempControl) do + with TempControl do if (Visible or ((csDesigning in ComponentState) and not (csNoDesignVisible in ControlStyle))) @@ -1720,8 +1730,16 @@ begin Include(FControlState, csPaintCopy); SaveIndex := SaveDC(DC); MoveWindowOrg(DC, Left, Top); - //DebugLn('TWinControl.PaintControls B Self=',Self.Name,':',Self.ClassName,' Control=',Name,':',ClassName,' ',Left,',',Top,',',Width,',',Height); + {$IFDEF VerboseControlDCOrigin} + DebugLn('TWinControl.PaintControls B Self=',DbgSName(Self),' Control=',DbgSName(TempControl),' ',dbgs(Left),',',dbgs(Top),',',dbgs(Width),',',dbgs(Height)); + {$ENDIF} IntersectClipRect(DC, 0, 0, Width, Height); + {$IFDEF VerboseControlDCOrigin} + DebugLn('TWinControl.PaintControls C'); + P:=Point(-1,-1); + GetWindowOrgEx(DC,@P); + debugln(' DCOrigin=',dbgs(P)); + {$ENDIF} Perform(LM_PAINT, WParam(DC), 0); RestoreDC(DC, SaveIndex); Exclude(FControlState, csPaintCopy); @@ -4281,6 +4299,9 @@ end; { ============================================================================= $Log$ + Revision 1.298 2005/01/16 11:40:10 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.297 2005/01/13 19:52:50 mattias added desgntime check for TControl.Width/Height for negative values diff --git a/lcl/interfaces/gtk/gtkproc.inc b/lcl/interfaces/gtk/gtkproc.inc index 016a1ff0c4..6c0c5029d5 100644 --- a/lcl/interfaces/gtk/gtkproc.inc +++ b/lcl/interfaces/gtk/gtkproc.inc @@ -1470,7 +1470,9 @@ var aRect : TGDKRectangle; SimpleRGN: PGdkRegion; begin + {$IFDEF DebugGDK} BeginGDKErrorTrap; + {$ENDIF} If RGN = nil then Result := ERROR else @@ -1485,7 +1487,9 @@ begin Result := COMPLEXREGION; gdk_region_destroy(SimpleRGN); end; + {$IFDEF DebugGDK} EndGDKErrorTrap; + {$ENDIF} end; {------------------------------------------------------------------------------ @@ -1501,7 +1505,9 @@ var begin with TDeviceContext(DC) do begin + {$IFDEF DebugGDK} BeginGDKErrorTrap; + {$ENDIF} gdk_gc_set_clip_region(gc, nil); gdk_gc_set_clip_rectangle (gc, nil); If (ClipRegion <> 0) then begin @@ -1511,7 +1517,9 @@ begin gdk_gc_set_clip_region(gc, PGDIObject(ClipRegion)^.GDIRegionObject); end; end; + {$IFDEF DebugGDK} EndGDKErrorTrap; + {$ENDIF} end; end; @@ -1523,8 +1531,8 @@ begin BeginGDKErrorTrap; gdk_region_get_clipbox(RGN,@aRect); EndGDKErrorTrap; - Result:=Result+'('+IntToStr(aRect.x)+','+IntToStr(aRect.y)+',' - +IntToStr(aRect.Width)+','+IntToStr(aRect.Height)+' ' + Result:=Result+'(x='+IntToStr(Integer(aRect.x))+',y='+IntToStr(Integer(aRect.y))+',w=' + +IntToStr(aRect.Width)+',h='+IntToStr(aRect.Height)+' ' +'Type='+IntToStr(RegionType(RGN))+')'; end; @@ -1536,9 +1544,13 @@ begin GDkRect.y:=ARect.Top; GDkRect.Width:=ARect.Right-ARect.Left; GDkRect.Height:=ARect.Bottom-ARect.Top; + {$IFDEF DebugGDK} BeginGDKErrorTrap; + {$ENDIF} Result:=gdk_region_rectangle(@GDKRect); + {$IFDEF DebugGDK} EndGDKErrorTrap; + {$ENDIF} end; Procedure FreeGDIColor(GDIColor: PGDIColor); @@ -7900,6 +7912,9 @@ end; { ============================================================================= $Log$ + Revision 1.328 2005/01/16 11:40:10 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.327 2005/01/11 21:40:29 micha fix gtk compilation for tstatictext.layout diff --git a/lcl/interfaces/gtk/gtkwinapi.inc b/lcl/interfaces/gtk/gtkwinapi.inc index 5a7d1650a9..a8d03e2715 100644 --- a/lcl/interfaces/gtk/gtkwinapi.inc +++ b/lcl/interfaces/gtk/gtkwinapi.inc @@ -816,7 +816,7 @@ begin end; gdk_visual_ref(GdiObject^.Visual); GdiObject^.SystemVisual := False; - + // the visual is created only when needed {If GdiObject^.Visual <> nil then gdk_visual_ref(GdiObject^.Visual) @@ -3104,19 +3104,7 @@ end; function TGtkWidgetSet.ExcludeClipRect(dc: hdc; Left, Top, Right, Bottom : Integer) : Integer; begin - Result := SIMPLEREGION; - If (not IsValidDC(DC)) then - Result := ERROR - else with TDeviceContext(DC) do - begin - if GC = nil - then begin - DebugLn('WARNING: [TGtkWidgetSet.ExcludeClipRect] Uninitialized GC'); - Result := ERROR; - end - else - Result := Inherited ExcludeClipRect(DC, Left, Top, Right, Bottom); - end; + Result := Inherited ExcludeClipRect(DC, Left, Top, Right, Bottom); end; {------------------------------------------------------------------------------ @@ -3153,6 +3141,7 @@ var Clip, Tmp : hRGN; X, Y : Longint; + DCOrigin: TPoint; begin Result := SIMPLEREGION; If not IsValidDC(DC) then @@ -3165,8 +3154,8 @@ begin Result := ERROR; end else begin - //DebugLn('TGtkWidgetSet.ExtSelectClipRGN A ClipRegValid=',DCClipRegionValid(DC), - // ' Mode=',Mode,' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject)); + //DebugLn('TGtkWidgetSet.ExtSelectClipRGN A ClipRegValid=',dbgs(DCClipRegionValid(DC)), + // ' Mode=',dbgs(Mode),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject)); If ClipRegion=0 then begin // there is no clipping region in the DC Case Mode of @@ -3181,18 +3170,19 @@ begin RGN_AND, RGN_DIFF: begin - {$IFDEF DebugGDKTraps} - BeginGDKErrorTrap; - {$ENDIF} + // get existing clip GDK_Window_Get_Size(Drawable, @X, @Y); - {$IFDEF DebugGDKTraps} - EndGDKErrorTrap; - {$ENDIF} - Clip := CreateRectRGN(0,0,X,Y); + DCOrigin:=GetDCOffset(TDeviceContext(DC)); + Clip := CreateRectRGN(-DCOrigin.X,-DCOrigin.Y,X-DCOrigin.X,Y-DCOrigin.Y); + // create target clip Tmp := CreateEmptyRegion; - Result := CombineRGN(Tmp, Clip, RGN, mode); - DeleteObject(Clip); + // combine + Result := CombineRGN(Tmp, Clip, RGN, Mode); + // commit + //DebugLn('TGtkWidgetSet.ExtSelectClipRGN B ClipRegValid=',dbgs(ClipRegion),' TmpRGN=',GDKRegionAsString(PGdiObject(Tmp)^.GDIRegionObject)); SelectClipRGN(DC, Tmp); + // clean up + DeleteObject(Clip); DeleteObject(Tmp); end; end; @@ -4075,26 +4065,11 @@ end; -1 = error ------------------------------------------------------------------------------} Function TGtkWidgetSet.GetClipRGN(DC : hDC; RGN : hRGN) : longint; - - function GetDefaultClipRgn: longint; - var - ARect: TRect; - GdiObject: PGDIObject; - begin - Result:=SimpleRegion; - GetClipBox(DC,@ARect); - GdiObject:=PGdiObject(RGN); - if GdiObject^.GDIRegionObject<>nil then - gdk_region_destroy(GdiObject^.GDIRegionObject); - GdiObject^.GDIRegionObject:=CreateRectGDKRegion(ARect); - //DebugLn('TGtkWidgetSet.GetClipRGN A DC=',HexStr(Cardinal(DC),8), - // ' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject), - // ' Result=',Result); - end; - var DCOrigin: TPoint; ClipRegionWithDCOffset: PGdkRegion; + CurRegionObject: PGdkRegion; + ARect: TRect; begin Result := SIMPLEREGION; If (not IsValidDC(DC)) then @@ -4103,19 +4078,29 @@ begin Result := ERROR; DebugLn('WARNING: [TGtkWidgetSet.GetClipRGN] Invalid HRGN'); end - else if TDeviceContext(DC).ClipRegion=0 then - Result:=GetDefaultClipRgn - else if (not IsValidGDIObject(TDeviceContext(DC).ClipRegion)) then + else if (TDeviceContext(DC).ClipRegion<>0) + and (not IsValidGDIObject(TDeviceContext(DC).ClipRegion)) then Result := ERROR else with TDeviceContext(DC) do begin - // create a copy of the current clipregion - ClipRegionWithDCOffset:= gdk_region_copy(PGdiObject(ClipRegion)^.GDIRegionObject); - // move it to the DC offset - // Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10, - // then the ClipRegion must be moved to 0,0 - DCOrigin:=GetDCOffset(TDeviceContext(DC)); - gdk_region_offset(ClipRegionWithDCOffset,-DCOrigin.x,-DCOrigin.Y); + CurRegionObject:=nil; + if ClipRegion<>0 then + CurRegionObject:=PGdiObject(ClipRegion)^.GDIRegionObject; + ARect:=Rect(0,0,0,0); + if CurRegionObject<>nil then begin + // create a copy of the current clipregion + ClipRegionWithDCOffset:=gdk_region_copy(CurRegionObject); + // move it to the DC offset + // Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10, + // then the ClipRegion must be moved to 0,0 + DCOrigin:=GetDCOffset(TDeviceContext(DC)); + //debugln('TGtkWidgetSet.GetClipRGN DCOrigin=',dbgs(DCOrigin),' CurRegionObject=',dbgs(CurRegionObject),' ',dbgs(ARect)); + gdk_region_offset(ClipRegionWithDCOffset,-DCOrigin.x,-DCOrigin.Y); + end else begin + // create a default clipregion + GetClipBox(DC,@ARect); + ClipRegionWithDCOffset:=CreateRectGDKRegion(ARect); + end; // free the old region in RGN if PGdiObject(RGN)^.GDIRegionObject<>nil then gdk_region_destroy(PGdiObject(RGN)^.GDIRegionObject); @@ -4124,7 +4109,7 @@ begin Result := RegionType(ClipRegionWithDCOffset); //DebugLn('TGtkWidgetSet.GetClipRGN B DC=',HexStr(Cardinal(DC),8), - // ' DCOrigin=',DCOrigin.X,',',DCOrigin.Y,' RGN=',GDKRegionAsString(ClipRegionWithDCOffset),' Result=',Result); + // ' DCOrigin=',dbgs(DCOrigin),' RGN=',GDKRegionAsString(ClipRegionWithDCOffset),' Result=',dbgs(Result)); If Result = NULLREGION then Result := 0 else If Result <> ERROR then @@ -5883,20 +5868,7 @@ end; function TGtkWidgetSet.IntersectClipRect(dc: hdc; Left, Top, Right, Bottom: Integer): Integer; begin - Result := SIMPLEREGION; - If not IsValidDC(DC) then - Result := ERROR - else with TDeviceContext(DC) do - begin - if GC = nil - then begin - DebugLn('WARNING: [TGtkWidgetSet.IntersectClipRect] Uninitialized GC'); - Result := ERROR; - end - else begin - Result := Inherited IntersectClipRect(DC, Left, Top, Right, Bottom); - end; - end; + Result := Inherited IntersectClipRect(DC, Left, Top, Right, Bottom); end; {------------------------------------------------------------------------------ @@ -7247,10 +7219,12 @@ var RegObj: PGdkRegion; DCOrigin: TPoint; begin + If not IsValidDC(DC) then begin + Result := ERROR; + exit; + end; Result := SIMPLEREGION; - If not IsValidDC(DC) then - Result := ERROR - else with TDeviceContext(DC) do + with TDeviceContext(DC) do begin if (GC = nil) and (RGN <> 0) then begin @@ -7273,9 +7247,10 @@ begin ClipRegion := CreateRegionCopy(RGN); RegObj:=PGdiObject(ClipRegion)^.GDIRegionObject; DCOrigin:=GetDCOffset(TDeviceContext(DC)); + //DebugLn('TGtkWidgetSet.SelectClipRGN A RegObj=',GDKRegionAsString(RegObj),' DCOrigin=',dbgs(DCOrigin),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject)); gdk_region_offset(RegObj,DCOrigin.x,DCOrigin.Y); Result := RegionType(RegObj); - //DebugLn('TGtkWidgetSet.SelectClipRGN RGN=',GDKRegionAsString(RegObj),' DCOrigin=',DCOrigin.X,',',DCOrigin.Y); + //DebugLn('TGtkWidgetSet.SelectClipRGN B RegObj=',GDKRegionAsString(RegObj),' DCOrigin=',dbgs(DCOrigin)); SelectGDIRegion(DC); end else begin @@ -8865,6 +8840,9 @@ end; { ============================================================================= $Log$ + Revision 1.385 2005/01/16 11:40:11 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.384 2005/01/08 11:03:18 mattias implemented TPen.Mode=pmXor from Jesus diff --git a/lcl/interfaces/gtk/gtkwinapih.inc b/lcl/interfaces/gtk/gtkwinapih.inc index 73a46e197b..3d0ff59994 100644 --- a/lcl/interfaces/gtk/gtkwinapih.inc +++ b/lcl/interfaces/gtk/gtkwinapih.inc @@ -61,7 +61,7 @@ function CreatePixmapIndirect(const Data: Pointer; const TransColor: Longint): H Function CreatePolygonRgn(Points: PPoint; NumPts: Integer; FillMode: integer): HRGN; Override; function CreateRectRgn(X1,Y1,X2,Y2 : Integer): HRGN; override; -Procedure DeleteCriticalSection(var CritSection: TCriticalSection); Override; +procedure DeleteCriticalSection(var CritSection: TCriticalSection); override; function DeleteDC(hDC: HDC): Boolean; override; function DeleteObject(GDIObject: HGDIOBJ): Boolean; override; function DestroyCaret(Handle : HWND): Boolean; override; @@ -214,6 +214,9 @@ Function WindowFromPoint(Point : TPoint) : HWND; override; { ============================================================================= $Log$ + Revision 1.92 2005/01/16 11:40:11 mattias + fixed TGtkWidgetSet.ExtSelectClipRGN for DCOrigin + Revision 1.91 2005/01/08 11:03:18 mattias implemented TPen.Mode=pmXor from Jesus