mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-08 15:17:22 +02:00
gtk2: rework SetWindowOrgEx() and related code
git-svn-id: trunk@38742 -
This commit is contained in:
parent
43c1ff001c
commit
977f05a8ef
@ -317,6 +317,7 @@ type
|
|||||||
procedure SetViewPortExt(const AValue: TPoint);
|
procedure SetViewPortExt(const AValue: TPoint);
|
||||||
procedure SetViewPortOrg(const AValue: TPoint);
|
procedure SetViewPortOrg(const AValue: TPoint);
|
||||||
procedure SetWindowExt(const AValue: TPoint);
|
procedure SetWindowExt(const AValue: TPoint);
|
||||||
|
procedure SetWindowOrg(AValue: TPoint);
|
||||||
protected
|
protected
|
||||||
function CreateGC: PGdkGC; virtual;
|
function CreateGC: PGdkGC; virtual;
|
||||||
|
|
||||||
@ -361,7 +362,7 @@ type
|
|||||||
function GetBrush: PGdiObject;
|
function GetBrush: PGdiObject;
|
||||||
function GetPen: PGdiObject;
|
function GetPen: PGdiObject;
|
||||||
function GetBitmap: PGdiObject;
|
function GetBitmap: PGdiObject;
|
||||||
function GetFunction: TGdkFunction; virtual; abstract;
|
function GetFunction: TGdkFunction;
|
||||||
function IsNullBrush: boolean;
|
function IsNullBrush: boolean;
|
||||||
function IsNullPen: boolean;
|
function IsNullPen: boolean;
|
||||||
function SelectObject(AGdiObject: PGdiObject): PGdiObject;
|
function SelectObject(AGdiObject: PGdiObject): PGdiObject;
|
||||||
@ -386,8 +387,9 @@ type
|
|||||||
// help functions
|
// help functions
|
||||||
function CopyDataFrom(ASource: TGtkDeviceContext; AClearSource, AMoveGDIOwnerShip, ARestore: Boolean): Boolean;
|
function CopyDataFrom(ASource: TGtkDeviceContext; AClearSource, AMoveGDIOwnerShip, ARestore: Boolean): Boolean;
|
||||||
function FillRect(ARect: TRect; ABrush: HBrush; SkipRop: Boolean): Boolean;
|
function FillRect(ARect: TRect; ABrush: HBrush; SkipRop: Boolean): Boolean;
|
||||||
|
procedure DrawTextWithColors(AText: PChar; ALength: LongInt; X, Y: Integer; FGColor, BGColor: PGdkColor);
|
||||||
|
|
||||||
// origins
|
// device origin
|
||||||
property Offset: TPoint read GetOffset;
|
property Offset: TPoint read GetOffset;
|
||||||
// drawing settings
|
// drawing settings
|
||||||
property CurrentBitmap: PGdiObject read FCurrentBitmap write SetCurrentBitmap;
|
property CurrentBitmap: PGdiObject read FCurrentBitmap write SetCurrentBitmap;
|
||||||
@ -405,7 +407,7 @@ type
|
|||||||
property ViewPortExt: TPoint read FViewPortExt write SetViewPortExt;
|
property ViewPortExt: TPoint read FViewPortExt write SetViewPortExt;
|
||||||
property ViewPortOrg: TPoint read FViewPortOrg write SetViewPortOrg;
|
property ViewPortOrg: TPoint read FViewPortOrg write SetViewPortOrg;
|
||||||
property WindowExt: TPoint read FWindowExt write SetWindowExt;
|
property WindowExt: TPoint read FWindowExt write SetWindowExt;
|
||||||
property WindowOrg: TPoint read FWindowOrg write FWindowOrg;
|
property WindowOrg: TPoint read FWindowOrg write SetWindowOrg;
|
||||||
// control
|
// control
|
||||||
property SelectedColors: TDevContextSelectedColorsType read FSelectedColors write SetSelectedColors;
|
property SelectedColors: TDevContextSelectedColorsType read FSelectedColors write SetSelectedColors;
|
||||||
property Flags: TDeviceContextsFlags read FFlags write FFlags;
|
property Flags: TDeviceContextsFlags read FFlags write FFlags;
|
||||||
@ -603,16 +605,7 @@ function dbgs(g: TGDIType): string; overload;
|
|||||||
function dbgs(const r: TGDKRectangle): string; overload;
|
function dbgs(const r: TGDKRectangle): string; overload;
|
||||||
function dbgs(r: PGDKRectangle): string; overload;
|
function dbgs(r: PGDKRectangle): string; overload;
|
||||||
|
|
||||||
type
|
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength: PtrInt);
|
||||||
{ TGtk2DeviceContext }
|
|
||||||
|
|
||||||
TGtk2DeviceContext = class(TGtkDeviceContext)
|
|
||||||
public
|
|
||||||
procedure DrawTextWithColors(AText: PChar; ALength: LongInt; X, Y: Integer; FGColor, BGColor: PGdkColor);
|
|
||||||
function GetFunction: TGdkFunction; override;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength: PtrInt);
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
@ -61,23 +61,11 @@ begin
|
|||||||
gdk_region_get_clipbox(FClipRegion^.GDIRegionObject, @Result);
|
gdk_region_get_clipbox(FClipRegion^.GDIRegionObject, @Result);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
function GetOffset
|
|
||||||
|
|
||||||
Returns the DC offset for the DC Origin.
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TGtkDeviceContext.GetOffset: TPoint;
|
function TGtkDeviceContext.GetOffset: TPoint;
|
||||||
var
|
var
|
||||||
Fixed: Pointer;
|
Fixed: Pointer;
|
||||||
begin
|
begin
|
||||||
if Self = nil then
|
Result := Point(0, 0);
|
||||||
begin
|
|
||||||
Result.X := 0;
|
|
||||||
Result.Y := 0;
|
|
||||||
Exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Result := WindowOrg;
|
|
||||||
if Assigned(FWidget) then
|
if Assigned(FWidget) then
|
||||||
begin
|
begin
|
||||||
Fixed := GetFixedWidget(FWidget);
|
Fixed := GetFixedWidget(FWidget);
|
||||||
@ -181,7 +169,12 @@ begin
|
|||||||
end;
|
end;
|
||||||
FMapMode := AValue;
|
FMapMode := AValue;
|
||||||
// to do: combine with affine transformations here when they get implemented
|
// to do: combine with affine transformations here when they get implemented
|
||||||
FHasTransf := (FMapMode <> MM_TEXT) or (FViewPortOrg.x <> 0) or (FViewPortOrg.y <> 0);
|
FHasTransf :=
|
||||||
|
(FMapMode <> MM_TEXT) or
|
||||||
|
(FViewPortOrg.x <> 0) or
|
||||||
|
(FViewPortOrg.y <> 0) or
|
||||||
|
(FWindowOrg.x <> 0) or
|
||||||
|
(FWindowOrg.y <> 0);
|
||||||
if not (FMapMode in [MM_TEXT, MM_ANISOTROPIC, MM_ISOTROPIC]) then
|
if not (FMapMode in [MM_TEXT, MM_ANISOTROPIC, MM_ISOTROPIC]) then
|
||||||
begin
|
begin
|
||||||
FViewPortExt.X := Gtk2WidgetSet.GetDeviceCaps(HDC(Self), LOGPIXELSX);
|
FViewPortExt.X := Gtk2WidgetSet.GetDeviceCaps(HDC(Self), LOGPIXELSX);
|
||||||
@ -281,6 +274,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGtkDeviceContext.SetWindowOrg(AValue: TPoint);
|
||||||
|
begin
|
||||||
|
if (FWindowOrg.x <> AValue.x) or
|
||||||
|
(FWindowOrg.y <> AValue.y) then
|
||||||
|
begin
|
||||||
|
FWindowOrg := AValue;
|
||||||
|
FHasTransf := True;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure TGtkDeviceContext.SetSelectedColors(AValue: TDevContextSelectedColorsType);
|
procedure TGtkDeviceContext.SetSelectedColors(AValue: TDevContextSelectedColorsType);
|
||||||
begin
|
begin
|
||||||
if FSelectedColors = AValue then Exit;
|
if FSelectedColors = AValue then Exit;
|
||||||
@ -303,31 +306,31 @@ end;
|
|||||||
|
|
||||||
procedure TGtkDeviceContext.InvTransfPoint(var X1, Y1: Integer);
|
procedure TGtkDeviceContext.InvTransfPoint(var X1, Y1: Integer);
|
||||||
begin
|
begin
|
||||||
X1 := MulDiv(X1 - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
X1 := MulDiv(X1 + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Y1 := MulDiv(Y1 - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Y1 := MulDiv(Y1 + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
// to do: put affine inverse transformation here (for all Inv.. methods)
|
// to do: put affine inverse transformation here (for all Inv.. methods)
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtkDeviceContext.InvTransfPointIndirect(const P: TPoint): TPoint;
|
function TGtkDeviceContext.InvTransfPointIndirect(const P: TPoint): TPoint;
|
||||||
begin
|
begin
|
||||||
Result.X := MulDiv(P.X - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
Result.X := MulDiv(P.X + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Result.Y := MulDiv(P.Y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Result.Y := MulDiv(P.Y + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkDeviceContext.InvTransfRect(var X1, Y1, X2, Y2: Integer);
|
procedure TGtkDeviceContext.InvTransfRect(var X1, Y1, X2, Y2: Integer);
|
||||||
begin
|
begin
|
||||||
X1 := MulDiv(X1 - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
X1 := MulDiv(X1 + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Y1 := MulDiv(Y1 - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Y1 := MulDiv(Y1 + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
X2 := MulDiv(X2 - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
X2 := MulDiv(X2 + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Y2 := MulDiv(Y2 - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Y2 := MulDiv(Y2 + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtkDeviceContext.InvTransfRectIndirect(const R: TRect): TRect;
|
function TGtkDeviceContext.InvTransfRectIndirect(const R: TRect): TRect;
|
||||||
begin
|
begin
|
||||||
Result.Left := MulDiv(R.Left - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
Result.Left := MulDiv(R.Left + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Result.Top := MulDiv(R.Top - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Result.Top := MulDiv(R.Top + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
Result.Right := MulDiv(R.Right - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
Result.Right := MulDiv(R.Right + FWindowOrg.x - FViewPortOrg.x, FWindowExt.x, FViewPortExt.x);
|
||||||
Result.Bottom := MulDiv(R.Bottom - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
Result.Bottom := MulDiv(R.Bottom + FWindowOrg.y - FViewPortOrg.y, FWindowExt.y, FViewPortExt.y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkDeviceContext.InvTransfExtent(var ExtX, ExtY: Integer);
|
procedure TGtkDeviceContext.InvTransfExtent(var ExtX, ExtY: Integer);
|
||||||
@ -373,30 +376,30 @@ end;
|
|||||||
procedure TGtkDeviceContext.TransfPoint(var X1, Y1: Integer);
|
procedure TGtkDeviceContext.TransfPoint(var X1, Y1: Integer);
|
||||||
begin
|
begin
|
||||||
// to do: put affine transformation here (for all Transf.. methods)
|
// to do: put affine transformation here (for all Transf.. methods)
|
||||||
X1 := MulDiv(X1, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
X1 := MulDiv(X1, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Y1 := MulDiv(Y1, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Y1 := MulDiv(Y1, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtkDeviceContext.TransfPointIndirect(const P: TPoint): TPoint;
|
function TGtkDeviceContext.TransfPointIndirect(const P: TPoint): TPoint;
|
||||||
begin
|
begin
|
||||||
Result.x := MulDiv(P.x, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
Result.x := MulDiv(P.x, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Result.Y := MulDiv(P.y, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Result.Y := MulDiv(P.y, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkDeviceContext.TransfRect(var X1, Y1, X2, Y2: Integer);
|
procedure TGtkDeviceContext.TransfRect(var X1, Y1, X2, Y2: Integer);
|
||||||
begin
|
begin
|
||||||
X1 := MulDiv(X1, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
X1 := MulDiv(X1, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Y1 := MulDiv(Y1, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Y1 := MulDiv(Y1, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
X2 := MulDiv(X2, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
X2 := MulDiv(X2, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Y2 := MulDiv(Y2, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Y2 := MulDiv(Y2, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtkDeviceContext.TransfRectIndirect(const R: TRect): TRect;
|
function TGtkDeviceContext.TransfRectIndirect(const R: TRect): TRect;
|
||||||
begin
|
begin
|
||||||
Result.Left := MulDiv(R.Left, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
Result.Left := MulDiv(R.Left, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Result.Top := MulDiv(R.Top, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Result.Top := MulDiv(R.Top, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
Result.Right := MulDiv(R.Right, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x;
|
Result.Right := MulDiv(R.Right, FViewPortExt.x, FWindowExt.x) + FViewPortOrg.x - FWindowOrg.x;
|
||||||
Result.Bottom := MulDiv(R.Bottom, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y;
|
Result.Bottom := MulDiv(R.Bottom, FViewPortExt.y, FWindowExt.y) + FViewPortOrg.y - FWindowOrg.y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TGtkDeviceContext.TransfExtent(var ExtX, ExtY: Integer);
|
procedure TGtkDeviceContext.TransfExtent(var ExtX, ExtY: Integer);
|
||||||
@ -430,7 +433,10 @@ begin
|
|||||||
if FCurrentFont^.LogFont.lfHeight > 0 then
|
if FCurrentFont^.LogFont.lfHeight > 0 then
|
||||||
AHeight := 1
|
AHeight := 1
|
||||||
else
|
else
|
||||||
AHeight := -1;
|
if FCurrentFont^.LogFont.lfHeight < 0 then
|
||||||
|
AHeight := -1
|
||||||
|
else
|
||||||
|
AHeight := 0;
|
||||||
if FCurrentFont^.LogFont.lfHeight <> AHeight then
|
if FCurrentFont^.LogFont.lfHeight <> AHeight then
|
||||||
begin
|
begin
|
||||||
FontCache.Unreference(FCurrentFont^.GDIFontObject);
|
FontCache.Unreference(FCurrentFont^.GDIFontObject);
|
||||||
@ -438,6 +444,7 @@ begin
|
|||||||
TmpObj := {%H-}PGdiObject(PtrUInt(GTK2WidgetSet.CreateFontIndirect(FCurrentFont^.LogFont)));
|
TmpObj := {%H-}PGdiObject(PtrUInt(GTK2WidgetSet.CreateFontIndirect(FCurrentFont^.LogFont)));
|
||||||
FCurrentFont^.GDIFontObject := TmpObj^.GDIFontObject;
|
FCurrentFont^.GDIFontObject := TmpObj^.GDIFontObject;
|
||||||
TmpObj^.GDIFontObject := nil;
|
TmpObj^.GDIFontObject := nil;
|
||||||
|
TmpObj^.RefCount := 0;
|
||||||
GTK2WidgetSet.DisposeGDIObject(TmpObj);
|
GTK2WidgetSet.DisposeGDIObject(TmpObj);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -624,7 +631,7 @@ var
|
|||||||
g: TGDIType;
|
g: TGDIType;
|
||||||
CurGDIObject: PGDIObject;
|
CurGDIObject: PGDIObject;
|
||||||
begin
|
begin
|
||||||
Result := (Self <> nil) and (ASource <> nil);
|
Result := Assigned(Self) and Assigned(ASource);
|
||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
|
|
||||||
if ARestore then
|
if ARestore then
|
||||||
@ -633,7 +640,7 @@ begin
|
|||||||
RaiseRestoreDifferentWidget;
|
RaiseRestoreDifferentWidget;
|
||||||
end else
|
end else
|
||||||
begin
|
begin
|
||||||
if FWidget <> nil then
|
if Assigned(FWidget) then
|
||||||
RaiseWidgetAlreadySet;
|
RaiseWidgetAlreadySet;
|
||||||
FWidget := ASource.FWidget;
|
FWidget := ASource.FWidget;
|
||||||
end;
|
end;
|
||||||
@ -642,7 +649,7 @@ begin
|
|||||||
FDrawable := ASource.FDrawable;
|
FDrawable := ASource.FDrawable;
|
||||||
FOriginalDrawable := ASource.FOriginalDrawable;
|
FOriginalDrawable := ASource.FOriginalDrawable;
|
||||||
|
|
||||||
if FGC <> nil then
|
if Assigned(FGC) then
|
||||||
begin
|
begin
|
||||||
// free old GC
|
// free old GC
|
||||||
gdk_gc_unref(FGC);
|
gdk_gc_unref(FGC);
|
||||||
@ -650,7 +657,7 @@ begin
|
|||||||
Exclude(FFlags, dcfPenSelected);
|
Exclude(FFlags, dcfPenSelected);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if (ASource.FGC <> nil) and (FDrawable <> nil) then
|
if Assigned(ASource.FGC) and Assigned(FDrawable) then
|
||||||
begin
|
begin
|
||||||
gdk_gc_get_values(ASource.FGC, @FGCValues);
|
gdk_gc_get_values(ASource.FGC, @FGCValues);
|
||||||
FGC := gdk_gc_new_with_values(FDrawable, @FGCValues,
|
FGC := gdk_gc_new_with_values(FDrawable, @FGCValues,
|
||||||
@ -666,7 +673,7 @@ begin
|
|||||||
else
|
else
|
||||||
Exclude(FFlags, dcfTextMetricsValid);
|
Exclude(FFlags, dcfTextMetricsValid);
|
||||||
|
|
||||||
for g:=Low(TGDIType) to High(TGDIType) do
|
for g := Low(TGDIType) to High(TGDIType) do
|
||||||
begin
|
begin
|
||||||
GDIObjects[g] := ASource.GDIObjects[g];
|
GDIObjects[g] := ASource.GDIObjects[g];
|
||||||
if AClearSource then
|
if AClearSource then
|
||||||
@ -674,14 +681,12 @@ begin
|
|||||||
|
|
||||||
if AMoveGDIOwnerShip then
|
if AMoveGDIOwnerShip then
|
||||||
begin
|
begin
|
||||||
if OwnedGDIObjects[g]<>nil then
|
if Assigned(OwnedGDIObjects[g]) then
|
||||||
begin
|
|
||||||
DeleteObject(HGDIOBJ({%H-}PtrUInt(OwnedGDIObjects[g])));
|
DeleteObject(HGDIOBJ({%H-}PtrUInt(OwnedGDIObjects[g])));
|
||||||
end;
|
|
||||||
|
|
||||||
CurGDIObject := ASource.OwnedGDIObjects[g];
|
CurGDIObject := ASource.OwnedGDIObjects[g];
|
||||||
|
|
||||||
if CurGDIObject<>nil then
|
if Assigned(CurGDIObject) then
|
||||||
begin
|
begin
|
||||||
ASource.OwnedGDIObjects[g] := nil;
|
ASource.OwnedGDIObjects[g] := nil;
|
||||||
OwnedGDIObjects[g] := CurGDIObject;
|
OwnedGDIObjects[g] := CurGDIObject;
|
||||||
@ -692,7 +697,6 @@ begin
|
|||||||
CopyGDIColor(ASource.CurrentBackColor, CurrentBackColor);
|
CopyGDIColor(ASource.CurrentBackColor, CurrentBackColor);
|
||||||
|
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
FWindowOrg := ASource.FWindowOrg;
|
|
||||||
PenPos := ASource.PenPos;
|
PenPos := ASource.PenPos;
|
||||||
|
|
||||||
if FHasTransf then
|
if FHasTransf then
|
||||||
@ -702,6 +706,7 @@ begin
|
|||||||
FViewPortExt := Point(1, 1);
|
FViewPortExt := Point(1, 1);
|
||||||
FViewPortOrg := Point(0, 0);
|
FViewPortOrg := Point(0, 0);
|
||||||
FWindowExt := Point(1, 1);
|
FWindowExt := Point(1, 1);
|
||||||
|
FWindowOrg := Point(0, 0);
|
||||||
TransfUpdateFont;
|
TransfUpdateFont;
|
||||||
TransfUpdatePen;
|
TransfUpdatePen;
|
||||||
end;
|
end;
|
||||||
@ -713,6 +718,7 @@ begin
|
|||||||
FViewPortExt := ASource.ViewPortExt;
|
FViewPortExt := ASource.ViewPortExt;
|
||||||
FViewPortOrg := ASource.ViewPortOrg;
|
FViewPortOrg := ASource.ViewPortOrg;
|
||||||
FWindowExt := ASource.WindowExt;
|
FWindowExt := ASource.WindowExt;
|
||||||
|
FWindowOrg := ASource.WindowOrg;
|
||||||
TransfUpdateFont;
|
TransfUpdateFont;
|
||||||
TransfUpdatePen;
|
TransfUpdatePen;
|
||||||
end;
|
end;
|
||||||
@ -1061,6 +1067,7 @@ end;
|
|||||||
|
|
||||||
constructor TGtkDeviceContext.Create;
|
constructor TGtkDeviceContext.Create;
|
||||||
begin
|
begin
|
||||||
|
Clear;
|
||||||
BkMode := OPAQUE;
|
BkMode := OPAQUE;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -1221,24 +1228,22 @@ begin
|
|||||||
Result := FCurrentBitmap;
|
Result := FCurrentBitmap;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TGtkDeviceContext.GetFunction: TGdkFunction;
|
||||||
|
begin
|
||||||
|
Result := GCValues._function;
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength: PtrInt);
|
procedure SetLayoutText(ALayout: PPangoLayout; AText: PChar; ALength: PtrInt);
|
||||||
var
|
var
|
||||||
OldStr: PChar;
|
OldStr: PChar;
|
||||||
begin
|
begin
|
||||||
OldStr := pango_layout_get_text(ALayout);
|
OldStr := pango_layout_get_text(ALayout);
|
||||||
if (strlcomp(AText, OldStr, ALength) <> 0) or (strlen(OldStr)<>ALength) then
|
if (strlen(OldStr)<>ALength) or (strlcomp(AText, OldStr, ALength) <> 0) then
|
||||||
pango_layout_set_text(ALayout, AText, ALength);
|
pango_layout_set_text(ALayout, AText, ALength);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TGtk2DeviceContext }
|
procedure TGtkDeviceContext.DrawTextWithColors(AText: PChar; ALength: LongInt;
|
||||||
|
|
||||||
function TGtk2DeviceContext.GetFunction: TGdkFunction;
|
|
||||||
begin
|
|
||||||
Result := GCValues._function;
|
|
||||||
end;
|
|
||||||
|
|
||||||
procedure TGtk2DeviceContext.DrawTextWithColors(AText: PChar; ALength: LongInt;
|
|
||||||
X, Y: Integer; FGColor, BGColor: PGdkColor);
|
X, Y: Integer; FGColor, BGColor: PGdkColor);
|
||||||
var
|
var
|
||||||
WidgetCont: PPangoContext;
|
WidgetCont: PPangoContext;
|
||||||
|
@ -84,7 +84,6 @@ type
|
|||||||
procedure SetAppActive(const AValue: Boolean);
|
procedure SetAppActive(const AValue: Boolean);
|
||||||
protected
|
protected
|
||||||
function CreateThemeServices: TThemeServices; override;
|
function CreateThemeServices: TThemeServices; override;
|
||||||
function GetDeviceContextClass: TGtkDeviceContextClass;
|
|
||||||
protected
|
protected
|
||||||
FKeyStateList_: TFPList; // Keeps track of which keys are pressed
|
FKeyStateList_: TFPList; // Keeps track of which keys are pressed
|
||||||
FDeviceContexts: TDynHashArray;// hasharray of HDC
|
FDeviceContexts: TDynHashArray;// hasharray of HDC
|
||||||
|
@ -769,14 +769,13 @@ begin
|
|||||||
DebugLn('TGtk2WidgetSet.GetRawImageFromDevice A DCOrigin=',dbgs(DCOrigin.X),',',dbgs(DCOrigin.Y),' SrcRect=',dbgs(ARect.Left),',',dbgs(ARect.Top),',',dbgs(ARect.Right),',',dbgs(ARect.Bottom));
|
DebugLn('TGtk2WidgetSet.GetRawImageFromDevice A DCOrigin=',dbgs(DCOrigin.X),',',dbgs(DCOrigin.Y),' SrcRect=',dbgs(ARect.Left),',',dbgs(ARect.Top),',',dbgs(ARect.Right),',',dbgs(ARect.Bottom));
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
R := ARect;
|
R := ARect;
|
||||||
|
LPtoDP(ADC, R, 2);
|
||||||
OffSetRect(R, DCOrigin.x, DCOrigin.y);
|
OffSetRect(R, DCOrigin.x, DCOrigin.y);
|
||||||
|
|
||||||
Drawable := DevCtx.Drawable;
|
Drawable := DevCtx.Drawable;
|
||||||
if Drawable = nil
|
if Drawable = nil then
|
||||||
then begin
|
|
||||||
// get screen shot
|
// get screen shot
|
||||||
Drawable := gdk_screen_get_root_window(gdk_screen_get_default);
|
Drawable := gdk_screen_get_root_window(gdk_screen_get_default);
|
||||||
end;
|
|
||||||
Result := RawImage_FromDrawable(ARawImage, Drawable, nil, @R);
|
Result := RawImage_FromDrawable(ARawImage, Drawable, nil, @R);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -241,7 +241,7 @@ begin
|
|||||||
Result.Style := gtk_widget_get_style(Result.Widget);
|
Result.Style := gtk_widget_get_style(Result.Widget);
|
||||||
end;
|
end;
|
||||||
Result.Window := DevCtx.Drawable;
|
Result.Window := DevCtx.Drawable;
|
||||||
Result.Origin := DevCtx.Offset;
|
Result.Origin := DevCtx.TransfPointIndirect(DevCtx.Offset);
|
||||||
|
|
||||||
Result.Painter := gptDefault;
|
Result.Painter := gptDefault;
|
||||||
Result.State := GTK_STATE_NORMAL;
|
Result.State := GTK_STATE_NORMAL;
|
||||||
|
@ -246,13 +246,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
{ TGtk2WidgetSet }
|
|
||||||
|
|
||||||
function TGtk2WidgetSet.GetDeviceContextClass: TGtkDeviceContextClass;
|
|
||||||
begin
|
|
||||||
Result := TGtk2DeviceContext;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: TGtk2WidgetSet._SetCallbackEx
|
Function: TGtk2WidgetSet._SetCallbackEx
|
||||||
|
|
||||||
@ -4030,6 +4023,9 @@ begin
|
|||||||
SrcDevContext.TransfPoint(XSrc, YSrc);
|
SrcDevContext.TransfPoint(XSrc, YSrc);
|
||||||
SrcDevContext.TransfExtent(SrcWidth, SrcHeight);
|
SrcDevContext.TransfExtent(SrcWidth, SrcHeight);
|
||||||
end;
|
end;
|
||||||
|
SrcDCOrigin := SrcDevContext.Offset;
|
||||||
|
Inc(XSrc, SrcDCOrigin.X);
|
||||||
|
Inc(YSrc, SrcDCOrigin.Y);
|
||||||
|
|
||||||
if DstDevContext.HasTransf then
|
if DstDevContext.HasTransf then
|
||||||
begin
|
begin
|
||||||
@ -4037,6 +4033,9 @@ begin
|
|||||||
DstDevContext.TransfPoint(X, Y);
|
DstDevContext.TransfPoint(X, Y);
|
||||||
DstDevContext.TransfExtent(Width, Height);
|
DstDevContext.TransfExtent(Width, Height);
|
||||||
end;
|
end;
|
||||||
|
DstDCOrigin := DstDevContext.Offset;
|
||||||
|
Inc(X, DstDCOrigin.X);
|
||||||
|
Inc(Y, DstDCOrigin.Y);
|
||||||
|
|
||||||
FlipHorz := Width < 0;
|
FlipHorz := Width < 0;
|
||||||
if FlipHorz then
|
if FlipHorz then
|
||||||
@ -4058,16 +4057,10 @@ begin
|
|||||||
SizeChange := (Width <> SrcWidth) or (Height <> SrcHeight) or FlipVert or FlipHorz;
|
SizeChange := (Width <> SrcWidth) or (Height <> SrcHeight) or FlipVert or FlipHorz;
|
||||||
ROpIsSpecial := (Rop <> SRCCOPY);
|
ROpIsSpecial := (Rop <> SRCCOPY);
|
||||||
|
|
||||||
SrcDCOrigin := SrcDevContext.Offset;
|
|
||||||
Inc(XSrc, SrcDCOrigin.X);
|
|
||||||
Inc(YSrc, SrcDCOrigin.Y);
|
|
||||||
if SrcDevContext.Drawable = nil then RaiseSrcDrawableNil;
|
if SrcDevContext.Drawable = nil then RaiseSrcDrawableNil;
|
||||||
gdk_window_get_size(PGdkWindow(SrcDevContext.Drawable), @SrcWholeWidth, @SrcWholeHeight);
|
gdk_window_get_size(PGdkWindow(SrcDevContext.Drawable), @SrcWholeWidth, @SrcWholeHeight);
|
||||||
|
|
||||||
|
|
||||||
DstDCOrigin := DstDevContext.Offset;
|
|
||||||
Inc(X, DstDCOrigin.X);
|
|
||||||
Inc(Y, DstDCOrigin.Y);
|
|
||||||
if DstDevContext.Drawable = nil then RaiseDestDrawableNil;
|
if DstDevContext.Drawable = nil then RaiseDestDrawableNil;
|
||||||
gdk_window_get_size(PGdkWindow(DstDevContext.Drawable), @DstWholeWidth, @DstWholeHeight);
|
gdk_window_get_size(PGdkWindow(DstDevContext.Drawable), @DstWholeWidth, @DstWholeHeight);
|
||||||
|
|
||||||
@ -5092,9 +5085,9 @@ var
|
|||||||
begin
|
begin
|
||||||
if (DC = nil) or (DC.Drawable = nil) then exit;
|
if (DC = nil) or (DC.Drawable = nil) then exit;
|
||||||
|
|
||||||
DCOrigin := DC.Offset;
|
DCOrigin := DC.TransfPointIndirect(DC.Offset);
|
||||||
inc(X,DCOrigin.X);
|
inc(X, DCOrigin.X);
|
||||||
inc(Y,DCOrigin.Y);
|
inc(Y, DCOrigin.Y);
|
||||||
|
|
||||||
DC.SelectedColors := dcscCustom;
|
DC.SelectedColors := dcscCustom;
|
||||||
GDKColor := AllocGDKColor(ColorToRGB(AColor));
|
GDKColor := AllocGDKColor(ColorToRGB(AColor));
|
||||||
@ -5153,9 +5146,9 @@ begin
|
|||||||
Result := clNone;
|
Result := clNone;
|
||||||
if (DC = nil) or (DC.Drawable = nil) then Exit;
|
if (DC = nil) or (DC.Drawable = nil) then Exit;
|
||||||
|
|
||||||
DCOrigin := DC.Offset;
|
DCOrigin := DC.TransfPointIndirect(DC.Offset);
|
||||||
inc(X,DCOrigin.X);
|
inc(X, DCOrigin.X);
|
||||||
inc(Y,DCOrigin.Y);
|
inc(Y, DCOrigin.Y);
|
||||||
|
|
||||||
gdk_drawable_get_size(DC.Drawable, @MaxX, @MaxY);
|
gdk_drawable_get_size(DC.Drawable, @MaxX, @MaxY);
|
||||||
if (X<0) or (Y<0) or (X>=MaxX) or (Y>=MaxY) then exit;
|
if (X<0) or (Y<0) or (X>=MaxX) or (Y>=MaxY) then exit;
|
||||||
@ -5247,7 +5240,7 @@ begin
|
|||||||
|
|
||||||
if FDCManager = nil
|
if FDCManager = nil
|
||||||
then begin
|
then begin
|
||||||
FDCManager := TDeviceContextMemManager.Create(GetDeviceContextClass);
|
FDCManager := TDeviceContextMemManager.Create(TGtkDeviceContext);
|
||||||
FDCManager.MinimumFreeCount := 1000;
|
FDCManager.MinimumFreeCount := 1000;
|
||||||
end;
|
end;
|
||||||
Result := FDCManager.NewDeviceContext;
|
Result := FDCManager.NewDeviceContext;
|
||||||
|
@ -1876,12 +1876,12 @@ end;
|
|||||||
ComplexRegion
|
ComplexRegion
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtk2WidgetSet.CombineRgn(Dest, Src1, Src2 : HRGN;
|
function TGtk2WidgetSet.CombineRgn(Dest, Src1, Src2: HRGN;
|
||||||
fnCombineMode : Longint) : Longint;
|
fnCombineMode: Longint): Longint;
|
||||||
var
|
var
|
||||||
Continue : Boolean;
|
Continue: Boolean;
|
||||||
D, S1, S2 : PGDKRegion;
|
D, S1, S2: PGDKRegion;
|
||||||
DObj, S1Obj, S2Obj : PGDIObject;
|
DObj, S1Obj, S2Obj: PGDIObject;
|
||||||
begin
|
begin
|
||||||
Result := SIMPLEREGION;
|
Result := SIMPLEREGION;
|
||||||
DObj := {%H-}PGdiObject(Dest);
|
DObj := {%H-}PGdiObject(Dest);
|
||||||
@ -1913,7 +1913,7 @@ begin
|
|||||||
D := nil;
|
D := nil;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
if DObj^.GDIRegionObject <> nil then
|
if Assigned(DObj^.GDIRegionObject) then
|
||||||
gdk_region_destroy(DObj^.GDIRegionObject);
|
gdk_region_destroy(DObj^.GDIRegionObject);
|
||||||
DObj^.GDIRegionObject := D;
|
DObj^.GDIRegionObject := D;
|
||||||
Result := RegionType(D);
|
Result := RegionType(D);
|
||||||
@ -2281,8 +2281,10 @@ var
|
|||||||
R: TRect;
|
R: TRect;
|
||||||
begin
|
begin
|
||||||
Result := False;
|
Result := False;
|
||||||
if IsValidDC(DC) then begin
|
if IsValidDC(DC) then
|
||||||
with LogPen do begin
|
begin
|
||||||
|
with LogPen do
|
||||||
|
begin
|
||||||
lopnStyle := PS_DOT;
|
lopnStyle := PS_DOT;
|
||||||
lopnWidth.X := 2;
|
lopnWidth.X := 2;
|
||||||
lopnColor := clWhite;
|
lopnColor := clWhite;
|
||||||
@ -2298,8 +2300,8 @@ begin
|
|||||||
|
|
||||||
Origin := DevCtx.Offset;
|
Origin := DevCtx.Offset;
|
||||||
try
|
try
|
||||||
|
with R do
|
||||||
with R do begin
|
begin
|
||||||
DrawHorzLine(Left, Top, Right-1);
|
DrawHorzLine(Left, Top, Right-1);
|
||||||
DrawVertLine(Right-1, Top, Bottom-1);
|
DrawVertLine(Right-1, Top, Bottom-1);
|
||||||
DrawHorzLine(Right-1, Bottom-1, Left);
|
DrawHorzLine(Right-1, Bottom-1, Left);
|
||||||
@ -2362,21 +2364,15 @@ var
|
|||||||
begin
|
begin
|
||||||
//DebugLn('TGtk2WidgetSet.DrawEdge Edge=',DbgS(Edge),8),' grfFlags=',DbgS(Cardinal(grfFlags));
|
//DebugLn('TGtk2WidgetSet.DrawEdge Edge=',DbgS(Edge),8),' grfFlags=',DbgS(Cardinal(grfFlags));
|
||||||
Result := IsValidDC(DC);
|
Result := IsValidDC(DC);
|
||||||
if Result
|
if Result then
|
||||||
then with TGtkDeviceContext(DC) do
|
with TGtkDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
R := ARect;
|
R := ARect;
|
||||||
|
|
||||||
if DevCtx.HasTransf then
|
LPtoDP(DC, R, 2);
|
||||||
begin
|
|
||||||
R := DevCtx.TransfRectIndirect(R);
|
|
||||||
TransfNormalize(R.Left, R.Right);
|
|
||||||
TransfNormalize(R.Top, R.Bottom);
|
|
||||||
end;
|
|
||||||
|
|
||||||
DCOrigin := Offset;
|
DCOrigin := Offset;
|
||||||
OffsetRect(R,DCOrigin.X,DCOrigin.Y);
|
OffsetRect(R, DCOrigin.X, DCOrigin.Y);
|
||||||
|
|
||||||
|
|
||||||
// try to use the gdk functions, so that the current theme is used
|
// try to use the gdk functions, so that the current theme is used
|
||||||
BInner := False;
|
BInner := False;
|
||||||
@ -2419,10 +2415,10 @@ begin
|
|||||||
if BInner then
|
if BInner then
|
||||||
DrawEdges(R,GC,Drawable,InnerTL,InnerBR);
|
DrawEdges(R,GC,Drawable,InnerTL,InnerBR);
|
||||||
|
|
||||||
// gdk_colormap_free_colors(gdk_colormap_get_system, @OuterTL, 1);
|
// gdk_colormap_free_colors(gdk_colormap_get_system, @OuterTL, 1);
|
||||||
// gdk_colormap_free_colors(gdk_colormap_get_system, @OuterBR, 1);
|
// gdk_colormap_free_colors(gdk_colormap_get_system, @OuterBR, 1);
|
||||||
// gdk_colormap_free_colors(gdk_colormap_get_system, @InnerTL, 1);
|
// gdk_colormap_free_colors(gdk_colormap_get_system, @InnerTL, 1);
|
||||||
// gdk_colormap_free_colors(gdk_colormap_get_system, @InnerBR, 1);
|
// gdk_colormap_free_colors(gdk_colormap_get_system, @InnerBR, 1);
|
||||||
|
|
||||||
//Draw interiour
|
//Draw interiour
|
||||||
if ((grfFlags and BF_MIDDLE) = BF_MIDDLE) then
|
if ((grfFlags and BF_MIDDLE) = BF_MIDDLE) then
|
||||||
@ -2436,8 +2432,9 @@ begin
|
|||||||
// adjust rect if needed
|
// adjust rect if needed
|
||||||
if (grfFlags and BF_ADJUST) = BF_ADJUST then
|
if (grfFlags and BF_ADJUST) = BF_ADJUST then
|
||||||
begin
|
begin
|
||||||
OffsetRect(R, -DCOrigin.X, -DCOrigin.Y);
|
|
||||||
ARect := R;
|
ARect := R;
|
||||||
|
OffsetRect(ARect, -DCOrigin.X, -DCOrigin.Y);
|
||||||
|
DPtoLP(DC, ARect, 2);
|
||||||
end;
|
end;
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
@ -2631,7 +2628,7 @@ var
|
|||||||
function NeedOffsetCalc: Boolean;
|
function NeedOffsetCalc: Boolean;
|
||||||
begin
|
begin
|
||||||
|
|
||||||
Result := (TGtk2DeviceContext(DC).CurrentFont^.LogFont.lfOrientation <> 0) and
|
Result := (TGtkDeviceContext(DC).CurrentFont^.LogFont.lfOrientation <> 0) and
|
||||||
(Flags and DT_SINGLELINE <> 0) and
|
(Flags and DT_SINGLELINE <> 0) and
|
||||||
(Flags and DT_VCENTER = 0) and (Flags and DT_CENTER = 0) and
|
(Flags and DT_VCENTER = 0) and (Flags and DT_CENTER = 0) and
|
||||||
(Flags and DT_RIGHT = 0) and (Flags and DT_BOTTOM = 0) and
|
(Flags and DT_RIGHT = 0) and (Flags and DT_BOTTOM = 0) and
|
||||||
@ -2665,7 +2662,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Pt.X := SavedRect.Left;
|
Pt.X := SavedRect.Left;
|
||||||
Pt.Y := SavedRect.Top;
|
Pt.Y := SavedRect.Top;
|
||||||
CalculateOffsetWithAngle(TGtk2DeviceContext(DC).CurrentFont^.LogFont.lfOrientation, Pt.X, Pt.Y);
|
CalculateOffsetWithAngle(TGtkDeviceContext(DC).CurrentFont^.LogFont.lfOrientation, Pt.X, Pt.Y);
|
||||||
end;
|
end;
|
||||||
TextUtf8Out(DC, LeftPos + Pt.X, TopPos + Pt.Y, theLine, lineLength);
|
TextUtf8Out(DC, LeftPos + Pt.X, TopPos + Pt.Y, theLine, lineLength);
|
||||||
end;
|
end;
|
||||||
@ -2698,7 +2695,7 @@ var
|
|||||||
begin
|
begin
|
||||||
Pt.X := SavedRect.Left;
|
Pt.X := SavedRect.Left;
|
||||||
Pt.Y := SavedRect.Top;
|
Pt.Y := SavedRect.Top;
|
||||||
CalculateOffsetWithAngle(TGtk2DeviceContext(DC).CurrentFont^.LogFont.lfOrientation, Pt.X, Pt.Y);
|
CalculateOffsetWithAngle(TGtkDeviceContext(DC).CurrentFont^.LogFont.lfOrientation, Pt.X, Pt.Y);
|
||||||
end;
|
end;
|
||||||
// Draw line of Text
|
// Draw line of Text
|
||||||
TextUtf8Out(DC, LeftPos + Pt.X, TopPos + Pt.Y, theLine, LineLength);
|
TextUtf8Out(DC, LeftPos + Pt.X, TopPos + Pt.Y, theLine, LineLength);
|
||||||
@ -3757,7 +3754,6 @@ var
|
|||||||
Clip,
|
Clip,
|
||||||
Tmp : hRGN;
|
Tmp : hRGN;
|
||||||
X, Y : Longint;
|
X, Y : Longint;
|
||||||
DCOrigin: TPoint;
|
|
||||||
begin
|
begin
|
||||||
Result := SIMPLEREGION;
|
Result := SIMPLEREGION;
|
||||||
if not IsValidDC(DC) then
|
if not IsValidDC(DC) then
|
||||||
@ -3766,7 +3762,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
//DebugLn('TGtk2WidgetSet.ExtSelectClipRGN A ClipRegValid=',dbgs(DCClipRegionValid(DC)),
|
//DebugLn('TGtk2WidgetSet.ExtSelectClipRGN A ClipRegValid=',dbgs(DCClipRegionValid(DC)),
|
||||||
// ' Mode=',dbgs(Mode),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject));
|
// ' Mode=',dbgs(Mode),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject));
|
||||||
if ClipRegion=nil then begin
|
if ClipRegion = nil then
|
||||||
|
begin
|
||||||
// there is no clipping region in the DC
|
// there is no clipping region in the DC
|
||||||
case Mode of
|
case Mode of
|
||||||
RGN_COPY:
|
RGN_COPY:
|
||||||
@ -3782,8 +3779,7 @@ begin
|
|||||||
begin
|
begin
|
||||||
// get existing clip
|
// get existing clip
|
||||||
GDK_Window_Get_Size(Drawable, @X, @Y);
|
GDK_Window_Get_Size(Drawable, @X, @Y);
|
||||||
DCOrigin:= Offset;
|
Clip := CreateRectRGN(0, 0, X, Y);
|
||||||
Clip := CreateRectRGN(-DCOrigin.X,-DCOrigin.Y,X-DCOrigin.X,Y-DCOrigin.Y);
|
|
||||||
// create target clip
|
// create target clip
|
||||||
Tmp := CreateEmptyRegion;
|
Tmp := CreateEmptyRegion;
|
||||||
// combine
|
// combine
|
||||||
@ -3813,7 +3809,7 @@ end;
|
|||||||
function TGtk2WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
function TGtk2WidgetSet.ExtTextOut(DC: HDC; X, Y: Integer; Options: Longint;
|
||||||
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
Rect: PRect; Str: PChar; Count: Longint; Dx: PInteger): Boolean;
|
||||||
var
|
var
|
||||||
DevCtx: TGtk2DeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
|
|
||||||
LineStart, LineEnd, StrEnd: PChar;
|
LineStart, LineEnd, StrEnd: PChar;
|
||||||
Width, Height: Integer;
|
Width, Height: Integer;
|
||||||
@ -3878,7 +3874,7 @@ begin
|
|||||||
|
|
||||||
if DevCtx.HasTransf then
|
if DevCtx.HasTransf then
|
||||||
begin
|
begin
|
||||||
if Rect <> nil then
|
if Assigned(Rect) then
|
||||||
Rect^ := DevCtx.TransfRectIndirect(Rect^);
|
Rect^ := DevCtx.TransfRectIndirect(Rect^);
|
||||||
DevCtx.TransfPoint(X, Y);
|
DevCtx.TransfPoint(X, Y);
|
||||||
end;
|
end;
|
||||||
@ -4086,17 +4082,12 @@ begin
|
|||||||
DevCtx.SelectedColors:= dcscCustom;
|
DevCtx.SelectedColors:= dcscCustom;
|
||||||
EnsureGCColor(DC, dccGDIBrushColor, True, False);//Brush Color
|
EnsureGCColor(DC, dccGDIBrushColor, True, False);//Brush Color
|
||||||
|
|
||||||
if DevCtx.HasTransf then
|
|
||||||
begin
|
|
||||||
R := DevCtx.TransfRectIndirect(ARect);
|
|
||||||
DevCtx.TransfNormalize(R.Left, R.Right);
|
|
||||||
DevCtx.TransfNormalize(R.Top, R.Bottom);
|
|
||||||
end else
|
|
||||||
R := ARect;
|
R := ARect;
|
||||||
|
LPtoDP(DC, R, 2);
|
||||||
|
|
||||||
DCOrigin := DevCtx.Offset;
|
DCOrigin := DevCtx.Offset;
|
||||||
gdk_draw_rectangle(DevCtx.Drawable, DevCtx.GC, 0,
|
gdk_draw_rectangle(DevCtx.Drawable, DevCtx.GC, 0,
|
||||||
R.Left+DCOrigin.X, R.Top+DCOrigin.Y,
|
R.Left + DCOrigin.X, R.Top + DCOrigin.Y,
|
||||||
R.Right-R.Left-1, R.Bottom-R.Top-1);
|
R.Right-R.Left-1, R.Bottom-R.Top-1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -4478,28 +4469,31 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
DCOrigin := DevCtx.Offset;
|
DCOrigin := DevCtx.Offset;
|
||||||
if DevCtx.ClipRegion = nil
|
if DevCtx.ClipRegion = nil then
|
||||||
then begin
|
begin
|
||||||
if (DevCtx.PaintRectangle.Left<>0)
|
if (DevCtx.PaintRectangle.Left<>0)
|
||||||
or (DevCtx.PaintRectangle.Top<>0)
|
or (DevCtx.PaintRectangle.Top<>0)
|
||||||
or (DevCtx.PaintRectangle.Right<>0)
|
or (DevCtx.PaintRectangle.Right<>0)
|
||||||
or (DevCtx.PaintRectangle.Bottom<>0) then begin
|
or (DevCtx.PaintRectangle.Bottom<>0) then
|
||||||
lpRect^:=DevCtx.PaintRectangle;
|
lpRect^ := DevCtx.PaintRectangle
|
||||||
end else begin
|
else
|
||||||
|
begin
|
||||||
gdk_window_get_size(DevCtx.Drawable, @X, @Y);
|
gdk_window_get_size(DevCtx.Drawable, @X, @Y);
|
||||||
lpRect^ := Rect(0,0,X,Y);
|
lpRect^ := Rect(0,0,X,Y);
|
||||||
end;
|
end;
|
||||||
OffsetRect(lpRect^,-DCOrigin.X, -DCOrigin.Y);
|
|
||||||
Result := SIMPLEREGION;
|
Result := SIMPLEREGION;
|
||||||
end
|
end
|
||||||
else begin
|
else
|
||||||
|
begin
|
||||||
Result := RegionType(DevCtx.ClipRegion^.GDIRegionObject);
|
Result := RegionType(DevCtx.ClipRegion^.GDIRegionObject);
|
||||||
gdk_region_get_clipbox(DevCtx.ClipRegion^.GDIRegionObject, @CRect);
|
gdk_region_get_clipbox(DevCtx.ClipRegion^.GDIRegionObject, @CRect);
|
||||||
lpRect^.Left := CRect.X-DCOrigin.X;
|
lpRect^.Left := CRect.X;
|
||||||
lpRect^.Top := CRect.Y-DCOrigin.Y;
|
lpRect^.Top := CRect.Y;
|
||||||
lpRect^.Right := lpRect^.Left + CRect.Width;
|
lpRect^.Right := lpRect^.Left + CRect.Width;
|
||||||
lpRect^.Bottom := lpRect^.Top + CRect.Height;
|
lpRect^.Bottom := lpRect^.Top + CRect.Height;
|
||||||
end;
|
end;
|
||||||
|
DPtoLP(DC, lpRect^, 2);
|
||||||
|
OffsetRect(lpRect^, -DCOrigin.X, -DCOrigin.Y);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -4571,35 +4565,41 @@ begin
|
|||||||
Result := SIMPLEREGION;
|
Result := SIMPLEREGION;
|
||||||
If (not IsValidDC(DC)) then
|
If (not IsValidDC(DC)) then
|
||||||
Result := ERROR
|
Result := ERROR
|
||||||
else If Not IsValidGDIObject(RGN) then begin
|
else
|
||||||
|
if Not IsValidGDIObject(RGN) then
|
||||||
|
begin
|
||||||
Result := ERROR;
|
Result := ERROR;
|
||||||
DebugLn('WARNING: [TGtk2WidgetSet.GetClipRGN] Invalid HRGN');
|
DebugLn('WARNING: [TGtk2WidgetSet.GetClipRGN] Invalid HRGN');
|
||||||
end
|
end
|
||||||
else if (TGtkDeviceContext(DC).ClipRegion<>nil)
|
else
|
||||||
and (not IsValidGDIObject(HGDIOBJ({%H-}PtrUInt(TGtkDeviceContext(DC).ClipRegion)))) then
|
if Assigned(TGtkDeviceContext(DC).ClipRegion) and
|
||||||
|
not IsValidGDIObject(HGDIOBJ({%H-}PtrUInt(TGtkDeviceContext(DC).ClipRegion))) then
|
||||||
Result := ERROR
|
Result := ERROR
|
||||||
else with TGtkDeviceContext(DC) do
|
else with TGtkDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
CurRegionObject:=nil;
|
CurRegionObject := nil;
|
||||||
if ClipRegion<>nil then
|
if Assigned(ClipRegion) then
|
||||||
CurRegionObject:=ClipRegion^.GDIRegionObject;
|
CurRegionObject := ClipRegion^.GDIRegionObject;
|
||||||
ARect:=Rect(0,0,0,0);
|
ARect := Rect(0, 0, 0, 0);
|
||||||
if CurRegionObject<>nil then begin
|
if Assigned(CurRegionObject) then
|
||||||
|
begin
|
||||||
// create a copy of the current clipregion
|
// create a copy of the current clipregion
|
||||||
ClipRegionWithDCOffset:=gdk_region_copy(CurRegionObject);
|
ClipRegionWithDCOffset := gdk_region_copy(CurRegionObject);
|
||||||
// move it to the DC offset
|
// move it to the DC offset
|
||||||
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
// Example: if the ClipRegion is at 10,10 and the DCOrigin is at 10,10,
|
||||||
// then the ClipRegion must be moved to 0,0
|
// then the ClipRegion must be moved to 0,0
|
||||||
DCOrigin := Offset;
|
DCOrigin := Offset;
|
||||||
//debugln('TGtk2WidgetSet.GetClipRGN DCOrigin=',dbgs(DCOrigin),' CurRegionObject=',dbgs(CurRegionObject),' ',dbgs(ARect));
|
//debugln('TGtk2WidgetSet.GetClipRGN DCOrigin=',dbgs(DCOrigin),' CurRegionObject=',dbgs(CurRegionObject),' ',dbgs(ARect));
|
||||||
gdk_region_offset(ClipRegionWithDCOffset,-DCOrigin.x,-DCOrigin.Y);
|
gdk_region_offset(ClipRegionWithDCOffset, -DCOrigin.x, -DCOrigin.Y);
|
||||||
end else begin
|
end
|
||||||
|
else
|
||||||
|
begin
|
||||||
// create a default clipregion
|
// create a default clipregion
|
||||||
GetClipBox(DC,@ARect);
|
GetClipBox(DC, @ARect);
|
||||||
ClipRegionWithDCOffset:=CreateRectGDKRegion(ARect);
|
ClipRegionWithDCOffset := CreateRectGDKRegion(ARect);
|
||||||
end;
|
end;
|
||||||
// free the old region in RGN
|
// free the old region in RGN
|
||||||
if {%H-}PGdiObject(RGN)^.GDIRegionObject<>nil then
|
if Assigned({%H-}PGdiObject(RGN)^.GDIRegionObject) then
|
||||||
gdk_region_destroy({%H-}PGdiObject(RGN)^.GDIRegionObject);
|
gdk_region_destroy({%H-}PGdiObject(RGN)^.GDIRegionObject);
|
||||||
// set the new region in RGN
|
// set the new region in RGN
|
||||||
{%H-}PGdiObject(RGN)^.GDIRegionObject := ClipRegionWithDCOffset;
|
{%H-}PGdiObject(RGN)^.GDIRegionObject := ClipRegionWithDCOffset;
|
||||||
@ -4657,7 +4657,7 @@ end;
|
|||||||
|
|
||||||
function TGtk2WidgetSet.GetCurrentObject(DC: HDC; uObjectType: UINT): HGDIOBJ;
|
function TGtk2WidgetSet.GetCurrentObject(DC: HDC; uObjectType: UINT): HGDIOBJ;
|
||||||
var
|
var
|
||||||
Gtk2DC: TGtk2DeviceContext absolute DC;
|
Gtk2DC: TGtkDeviceContext absolute DC;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if not GTK2WidgetSet.IsValidDC(DC) then
|
if not GTK2WidgetSet.IsValidDC(DC) then
|
||||||
@ -4837,25 +4837,25 @@ var
|
|||||||
DCWindow: PGdkWindow;
|
DCWindow: PGdkWindow;
|
||||||
begin
|
begin
|
||||||
Result := false;
|
Result := false;
|
||||||
OriginDiff := Point(0,0);
|
OriginDiff := Point(0, 0);
|
||||||
if not IsValidDC(PaintDC) then exit;
|
if not IsValidDC(PaintDC) then exit;
|
||||||
|
|
||||||
DCOrigin := DevCtx.Offset;
|
DCOrigin := DevCtx.Offset;
|
||||||
|
|
||||||
DCWindow:=PGdkWindow(DevCtx.Drawable);
|
DCWindow := PGdkWindow(DevCtx.Drawable);
|
||||||
gdk_window_get_origin(DCWindow, @(DCScreenOrigin.X), @(DCScreenOrigin.Y));
|
gdk_window_get_origin(DCWindow, @(DCScreenOrigin.X), @(DCScreenOrigin.Y));
|
||||||
inc(DCScreenOrigin.X, DCOrigin.X);
|
inc(DCScreenOrigin.X, DCOrigin.X);
|
||||||
inc(DCScreenOrigin.Y, DCOrigin.Y);
|
inc(DCScreenOrigin.Y, DCOrigin.Y);
|
||||||
|
|
||||||
Widget := GetFixedWidget({%H-}PGtkWidget(WindowHandle));
|
Widget := GetFixedWidget({%H-}PGtkWidget(WindowHandle));
|
||||||
if Widget = nil
|
if Widget = nil then
|
||||||
then Widget := {%H-}PGtkWidget(WindowHandle);
|
Widget := {%H-}PGtkWidget(WindowHandle);
|
||||||
|
|
||||||
gdk_window_get_origin(PGdkWindow(Widget^.window), @(WindowScreenOrigin.X), @(WindowScreenOrigin.Y));
|
gdk_window_get_origin(PGdkWindow(Widget^.window), @(WindowScreenOrigin.X), @(WindowScreenOrigin.Y));
|
||||||
|
|
||||||
OriginDiff.X := DCScreenOrigin.X-WindowScreenOrigin.X;
|
OriginDiff.X := DCScreenOrigin.X - WindowScreenOrigin.X;
|
||||||
OriginDiff.Y := DCScreenOrigin.Y-WindowScreenOrigin.Y;
|
OriginDiff.Y := DCScreenOrigin.Y - WindowScreenOrigin.Y;
|
||||||
Result := true;
|
Result := True;
|
||||||
//DebugLn(['TGtk2WidgetSet.GetDCOriginRelativeToWindow DCScreenOrigin=',dbgs(DCScreenOrigin),' WindowScreenOrigin=',dbgs(WindowScreenOrigin),' OriginDiff=',dbgs(OriginDiff)]);
|
//DebugLn(['TGtk2WidgetSet.GetDCOriginRelativeToWindow DCScreenOrigin=',dbgs(DCScreenOrigin),' WindowScreenOrigin=',dbgs(WindowScreenOrigin),' OriginDiff=',dbgs(OriginDiff)]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -5982,7 +5982,7 @@ end;
|
|||||||
function TGtk2WidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer;
|
function TGtk2WidgetSet.GetTextExtentPoint(DC: HDC; Str: PChar; Count: Integer;
|
||||||
var Size: TSize): Boolean;
|
var Size: TSize): Boolean;
|
||||||
var
|
var
|
||||||
DevCtx: TGtk2DeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
UseFont : PPangoLayout;
|
UseFont : PPangoLayout;
|
||||||
begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
Result := IsValidDC(DC);
|
||||||
@ -6152,7 +6152,7 @@ end;
|
|||||||
|
|
||||||
Returns the current offset of the DC.
|
Returns the current offset of the DC.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtk2WidgetSet.GetWindowOrgEx(dc : hdc; P : PPoint): Integer;
|
function TGtk2WidgetSet.GetWindowOrgEx(dc: hdc; P: PPoint): Integer;
|
||||||
var
|
var
|
||||||
DevCtx: TGtkDeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
begin
|
begin
|
||||||
@ -6160,8 +6160,8 @@ begin
|
|||||||
P^ := Point(0,0);
|
P^ := Point(0,0);
|
||||||
if not IsValidDC(DC) then exit(0);
|
if not IsValidDC(DC) then exit(0);
|
||||||
|
|
||||||
P^ := DevCtx.Offset;
|
P^ := DevCtx.WindowOrg;
|
||||||
Result:=1;
|
Result := 1;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -6648,10 +6648,8 @@ var
|
|||||||
DevCtx: TGtkDeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
|
|
||||||
DCOrigin: TPoint;
|
DCOrigin: TPoint;
|
||||||
FromX: Integer;
|
FromPt: TPoint;
|
||||||
FromY: Integer;
|
ToPt: TPoint;
|
||||||
ToX: Integer;
|
|
||||||
ToY: Integer;
|
|
||||||
begin
|
begin
|
||||||
if not IsValidDC(DC) then Exit(False);
|
if not IsValidDC(DC) then Exit(False);
|
||||||
|
|
||||||
@ -6660,21 +6658,16 @@ begin
|
|||||||
|
|
||||||
if DevCtx.IsNullPen then Exit(True);
|
if DevCtx.IsNullPen then Exit(True);
|
||||||
|
|
||||||
if DevCtx.HasTransf then
|
FromPt := DevCtx.PenPos;
|
||||||
DevCtx.TransfPoint(X, Y);
|
LPtoDP(DC, FromPt, 1);
|
||||||
|
ToPt := Point(X, Y);
|
||||||
DCOrigin := DevCtx.Offset;
|
LPToDP(DC, ToPt, 1);
|
||||||
|
|
||||||
FromX:=DevCtx.PenPos.X+DCOrigin.X;
|
|
||||||
FromY:=DevCtx.PenPos.Y+DCOrigin.Y;
|
|
||||||
ToX:=X+DCOrigin.X;
|
|
||||||
ToY:=Y+DCOrigin.Y;
|
|
||||||
|
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_draw_line(DevCtx.Drawable, DevCtx.GC, FromX, FromY, ToX, ToY);
|
gdk_draw_line(DevCtx.Drawable, DevCtx.GC, FromPt.X, FromPt.Y, ToPt.X, ToPt.Y);
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
|
|
||||||
DevCtx.PenPos:= Point(X, Y);
|
DevCtx.PenPos := Point(X, Y);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
@ -6831,44 +6824,18 @@ end;
|
|||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtk2WidgetSet.MoveToEx(DC: HDC; X, Y: Integer;
|
function TGtk2WidgetSet.MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean;
|
||||||
OldPoint: PPoint): Boolean;
|
|
||||||
var
|
var
|
||||||
DevCtx: TGtkDeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
begin
|
|
||||||
Result := IsValidDC(DC);
|
|
||||||
if Result
|
|
||||||
then with TGtkDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if OldPoint <> nil then OldPoint^ := PenPos;
|
|
||||||
|
|
||||||
if DevCtx.HasTransf then
|
|
||||||
DevCtx.TransfPoint(X, Y);
|
|
||||||
|
|
||||||
PenPos := Point(X, Y);
|
|
||||||
end;
|
|
||||||
end;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
|
||||||
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
|
|
||||||
|
|
||||||
Move the origin of all operations of a DeviceContext.
|
|
||||||
For example:
|
|
||||||
Moving the Origin to 10,20 and drawing a point to 50,50, results in
|
|
||||||
drawing a point to 60,70.
|
|
||||||
------------------------------------------------------------------------------}
|
|
||||||
function TGtk2WidgetSet.MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean;
|
|
||||||
var
|
|
||||||
NewOrigin: TPoint;
|
|
||||||
begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
Result := IsValidDC(DC);
|
||||||
if Result then
|
if Result then
|
||||||
with TGtkDeviceContext(DC) do
|
with TGtkDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
NewOrigin := WindowOrg;
|
if Assigned(OldPoint) then
|
||||||
inc(NewOrigin.X, dX);
|
OldPoint^ := PenPos;
|
||||||
inc(NewOrigin.Y, dY);
|
|
||||||
WindowOrg := NewOrigin;
|
PenPos := Point(X, Y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7071,8 +7038,8 @@ begin
|
|||||||
begin
|
begin
|
||||||
if DevCtx.HasTransf then
|
if DevCtx.HasTransf then
|
||||||
Points[I] := DevCtx.TransfPointIndirect(Points[I]);
|
Points[I] := DevCtx.TransfPointIndirect(Points[I]);
|
||||||
PointArray[i].x:=Points[i].x+DCOrigin.X;
|
PointArray[i].x := Points[i].x + DCOrigin.X;
|
||||||
PointArray[i].y:=Points[i].y+DCOrigin.Y;
|
PointArray[i].y := Points[i].y + DCOrigin.Y;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// draw line
|
// draw line
|
||||||
@ -7912,7 +7879,7 @@ begin
|
|||||||
if not IsValidDC(DC) then Exit(ERROR);
|
if not IsValidDC(DC) then Exit(ERROR);
|
||||||
|
|
||||||
// clear old clipregion
|
// clear old clipregion
|
||||||
if DevCtx.ClipRegion <> nil
|
if Assigned(DevCtx.ClipRegion)
|
||||||
then begin
|
then begin
|
||||||
OldClipRegion := DevCtx.ClipRegion;
|
OldClipRegion := DevCtx.ClipRegion;
|
||||||
DevCtx.ClipRegion := nil;// decrease DCCount
|
DevCtx.ClipRegion := nil;// decrease DCCount
|
||||||
@ -9183,16 +9150,17 @@ end;
|
|||||||
|
|
||||||
Sets the DC offset for the specified device context.
|
Sets the DC offset for the specified device context.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtk2WidgetSet.SetWindowOrgEx(DC : HDC; NewX, NewY : Integer;
|
function TGtk2WidgetSet.SetWindowOrgEx(DC: HDC; NewX, NewY: Integer; OldPoint: PPoint): Boolean;
|
||||||
OldPoint: PPoint) : Boolean;
|
|
||||||
var
|
var
|
||||||
OldP: TPoint;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
begin
|
begin
|
||||||
//DebugLn('[TGtk2WidgetSet.SetWindowOrgEx] ',NewX,' ',NewY);
|
if Assigned(OldPoint) then
|
||||||
GetWindowOrgEx(DC, @OldP);
|
GetWindowOrgEx(DC, OldPoint);
|
||||||
Result := MoveWindowOrgEx(DC, -NewX - OldP.X, -NewY - OldP.Y);
|
|
||||||
if OldPoint <> nil then
|
if not IsValidDC(DC) then exit(False);
|
||||||
OldPoint^ := OldP;
|
|
||||||
|
DevCtx.WindowOrg := Point(NewX, NewY);
|
||||||
|
Result := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -9654,10 +9622,10 @@ end;
|
|||||||
Returns:
|
Returns:
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtk2WidgetSet.TextOut(DC: HDC; X,Y : Integer; Str : Pchar;
|
function TGtk2WidgetSet.TextOut(DC: HDC; X, Y: Integer; Str: Pchar;
|
||||||
Count: Integer) : Boolean;
|
Count: Integer) : Boolean;
|
||||||
var
|
var
|
||||||
DevCtx: TGtk2DeviceContext absolute DC;
|
DevCtx: TGtkDeviceContext absolute DC;
|
||||||
DCOrigin: TPoint;
|
DCOrigin: TPoint;
|
||||||
yOffset: integer;
|
yOffset: integer;
|
||||||
BackGroundColor: PGdkColor;
|
BackGroundColor: PGdkColor;
|
||||||
@ -9666,7 +9634,6 @@ begin
|
|||||||
if not Result then Exit;
|
if not Result then Exit;
|
||||||
if Count <= 0 then Exit;
|
if Count <= 0 then Exit;
|
||||||
|
|
||||||
|
|
||||||
if DevCtx.HasTransf then
|
if DevCtx.HasTransf then
|
||||||
DevCtx.TransfPoint(X, Y);
|
DevCtx.TransfPoint(X, Y);
|
||||||
|
|
||||||
@ -9682,8 +9649,8 @@ begin
|
|||||||
EnsureGCColor(DC, dccCurrentTextColor, True, False);
|
EnsureGCColor(DC, dccCurrentTextColor, True, False);
|
||||||
|
|
||||||
BackGroundColor := nil;
|
BackGroundColor := nil;
|
||||||
if (DevCtx.GDIObjects[gdiBrush] <> nil) and (DevCtx.BkMode = OPAQUE) and
|
if Assigned(DevCtx.GDIObjects[gdiBrush]) and (DevCtx.BkMode = OPAQUE) and
|
||||||
(DevCtx.CurrentBackColor.Colormap <> nil) then
|
Assigned(DevCtx.CurrentBackColor.Colormap) then
|
||||||
begin
|
begin
|
||||||
EnsureGCColor(DC, dccCurrentBackColor, DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill = GDK_SOLID, True);
|
EnsureGCColor(DC, dccCurrentBackColor, DevCtx.GDIObjects[gdiBrush]^.GDIBrushFill = GDK_SOLID, True);
|
||||||
//do not set BackGroundColor if CurrentBrush.Color = CurrentBackColor.
|
//do not set BackGroundColor if CurrentBrush.Color = CurrentBackColor.
|
||||||
|
@ -170,7 +170,6 @@ function LPtoDP(DC: HDC; var Points; Count: Integer): BOOL; override;
|
|||||||
|
|
||||||
function MessageBox({%H-}hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
function MessageBox({%H-}hWnd: HWND; lpText, lpCaption: PChar; uType: Cardinal): integer; override;
|
||||||
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
function MoveToEx(DC: HDC; X, Y: Integer; OldPoint: PPoint): Boolean; override;
|
||||||
function MoveWindowOrgEx(DC: HDC; dX, dY: Integer): Boolean; override;
|
|
||||||
|
|
||||||
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
|
function OffsetRgn(RGN: HRGN; nXOffset, nYOffset: Integer): Integer; override;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user