mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-09-11 20:39:15 +02:00
gtk2 intf: the GC of device contexts are now created only when needed
git-svn-id: trunk@11106 -
This commit is contained in:
parent
cc70f5376b
commit
6a41acd5f4
@ -185,13 +185,18 @@ type
|
|||||||
dcscFont
|
dcscFont
|
||||||
);
|
);
|
||||||
|
|
||||||
|
{ TDeviceContext }
|
||||||
|
|
||||||
TDeviceContext = class
|
TDeviceContext = class
|
||||||
public
|
public
|
||||||
|
WithChildWindows: boolean;// this DC covers sub gdkwindows
|
||||||
|
|
||||||
// device handles
|
// device handles
|
||||||
DCWidget: PGtkWidget; // the owner
|
DCWidget: PGtkWidget; // the owner
|
||||||
GC: pgdkGC;
|
|
||||||
Drawable: PGDKDrawable;
|
Drawable: PGDKDrawable;
|
||||||
OriginalDrawable: PGDKDrawable; // only set if dcfDoubleBuffer in DCFlags
|
OriginalDrawable: PGDKDrawable; // only set if dcfDoubleBuffer in DCFlags
|
||||||
|
GC: pgdkGC;
|
||||||
|
GCValues: TGdkGCValues;
|
||||||
|
|
||||||
// origins
|
// origins
|
||||||
Origin: TPoint;
|
Origin: TPoint;
|
||||||
@ -217,7 +222,9 @@ type
|
|||||||
SelectedColors: TDevContextSelectedColorsType;
|
SelectedColors: TDevContextSelectedColorsType;
|
||||||
SavedContext: TDeviceContext; // linked list of saved DCs
|
SavedContext: TDeviceContext; // linked list of saved DCs
|
||||||
DCFlags: TDeviceContextsFlags;
|
DCFlags: TDeviceContextsFlags;
|
||||||
|
|
||||||
procedure Clear;
|
procedure Clear;
|
||||||
|
function GetGC: pgdkGC;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
@ -388,6 +395,11 @@ procedure InternalDisposePGDIObject(GDIObject: PGdiObject);
|
|||||||
function NewDeviceContext: TDeviceContext;
|
function NewDeviceContext: TDeviceContext;
|
||||||
procedure DisposeDeviceContext(DeviceContext: TDeviceContext);
|
procedure DisposeDeviceContext(DeviceContext: TDeviceContext);
|
||||||
|
|
||||||
|
type
|
||||||
|
TCreateGCForDC = procedure(DC: TDeviceContext) of object;
|
||||||
|
var
|
||||||
|
CreateGCForDC: TCreateGCForDC = nil;
|
||||||
|
|
||||||
{$IFDEF DebugLCLComponents}
|
{$IFDEF DebugLCLComponents}
|
||||||
var
|
var
|
||||||
DebugGtkWidgets: TDebugLCLItems = nil;
|
DebugGtkWidgets: TDebugLCLItems = nil;
|
||||||
@ -397,7 +409,6 @@ var
|
|||||||
|
|
||||||
procedure GtkDefDone;
|
procedure GtkDefDone;
|
||||||
|
|
||||||
|
|
||||||
implementation
|
implementation
|
||||||
|
|
||||||
|
|
||||||
@ -587,8 +598,9 @@ end;
|
|||||||
procedure TDeviceContext.Clear;
|
procedure TDeviceContext.Clear;
|
||||||
begin
|
begin
|
||||||
DCWidget:=nil;
|
DCWidget:=nil;
|
||||||
GC:=nil;
|
|
||||||
Drawable:=nil;
|
Drawable:=nil;
|
||||||
|
GC:=nil;
|
||||||
|
FillChar(GCValues, SizeOf(GCValues), #0);
|
||||||
|
|
||||||
Origin.X:=0;
|
Origin.X:=0;
|
||||||
Origin.Y:=0;
|
Origin.Y:=0;
|
||||||
@ -610,6 +622,13 @@ begin
|
|||||||
DCFlags:=[];
|
DCFlags:=[];
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function TDeviceContext.GetGC: pgdkGC;
|
||||||
|
begin
|
||||||
|
if GC=nil then
|
||||||
|
CreateGCForDC(Self);
|
||||||
|
Result:=GC;
|
||||||
|
end;
|
||||||
|
|
||||||
procedure GtkDefInit;
|
procedure GtkDefInit;
|
||||||
begin
|
begin
|
||||||
{$IFDEF DebugLCLComponents}
|
{$IFDEF DebugLCLComponents}
|
||||||
|
@ -243,6 +243,7 @@ type
|
|||||||
procedure RemoveCallbacks(Widget: PGtkWidget); virtual;
|
procedure RemoveCallbacks(Widget: PGtkWidget); virtual;
|
||||||
function ROP2ModeToGdkFunction(Mode: Integer): TGdkFunction;
|
function ROP2ModeToGdkFunction(Mode: Integer): TGdkFunction;
|
||||||
function gdkFunctionToROP2Mode(aFunction: TGdkFunction): Integer;
|
function gdkFunctionToROP2Mode(aFunction: TGdkFunction): Integer;
|
||||||
|
procedure OnCreateGCForDC(DC: TDeviceContext);
|
||||||
|
|
||||||
// for gtk specific components:
|
// for gtk specific components:
|
||||||
procedure SetLabelCaption(const ALabel: PGtkLabel; const ACaption: String;
|
procedure SetLabelCaption(const ALabel: PGtkLabel; const ACaption: String;
|
||||||
|
@ -175,6 +175,7 @@ begin
|
|||||||
// DCs, GDIObjects
|
// DCs, GDIObjects
|
||||||
FDeviceContexts := TDynHashArray.Create(-1);
|
FDeviceContexts := TDynHashArray.Create(-1);
|
||||||
FDeviceContexts.Options:=FDeviceContexts.Options+[dhaoCacheContains];
|
FDeviceContexts.Options:=FDeviceContexts.Options+[dhaoCacheContains];
|
||||||
|
CreateGCForDC:=@OnCreateGCForDC;
|
||||||
FGDIObjects := TDynHashArray.Create(-1);
|
FGDIObjects := TDynHashArray.Create(-1);
|
||||||
FGDIObjects.Options:=FGDIObjects.Options+[dhaoCacheContains];
|
FGDIObjects.Options:=FGDIObjects.Options+[dhaoCacheContains];
|
||||||
|
|
||||||
@ -3078,7 +3079,7 @@ var
|
|||||||
SelectGDKBrushProps(DC);
|
SelectGDKBrushProps(DC);
|
||||||
|
|
||||||
If not CurrentBrush^.IsNullBrush then begin
|
If not CurrentBrush^.IsNullBrush then begin
|
||||||
gdk_draw_rectangle(TempPixmap, GC, 1, 0, 0, Width, Height);
|
gdk_draw_rectangle(TempPixmap, GetGC, 1, 0, 0, Width, Height);
|
||||||
end;
|
end;
|
||||||
// Restore current brush
|
// Restore current brush
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
@ -3117,7 +3118,7 @@ var
|
|||||||
{$IFDEF VerboseStretchCopyArea}
|
{$IFDEF VerboseStretchCopyArea}
|
||||||
DebugLn('SrcDevBitmapToDrawable Simple copy');
|
DebugLn('SrcDevBitmapToDrawable Simple copy');
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
gdk_window_copy_area(DestDevContext.Drawable, DestDevContext.GC, X, Y,
|
gdk_window_copy_area(DestDevContext.Drawable, DestDevContext.GetGC, X, Y,
|
||||||
SrcPixmap, XSrc, YSrc, Width, Height);
|
SrcPixmap, XSrc, YSrc, Width, Height);
|
||||||
|
|
||||||
exit;
|
exit;
|
||||||
@ -3129,7 +3130,7 @@ var
|
|||||||
|
|
||||||
// perform raster operation and scaling into Scale and fGC
|
// perform raster operation and scaling into Scale and fGC
|
||||||
DestDevContext.SelectedColors := dcscCustom;
|
DestDevContext.SelectedColors := dcscCustom;
|
||||||
If not ScaleAndROP(DestDevContext.GC, SrcDevContext.Drawable, SrcPixmap,
|
If not ScaleAndROP(DestDevContext.GetGC, SrcDevContext.Drawable, SrcPixmap,
|
||||||
MaskPixmap)
|
MaskPixmap)
|
||||||
then begin
|
then begin
|
||||||
DebugLn('WARNING: SrcDevBitmapToDrawable: ScaleAndROP failed');
|
DebugLn('WARNING: SrcDevBitmapToDrawable: ScaleAndROP failed');
|
||||||
@ -3168,20 +3169,20 @@ var
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
// set clipping mask for transparency
|
// set clipping mask for transparency
|
||||||
MergeClipping(DestDevContext, DestDevContext.GC, X,Y,Width,Height,
|
MergeClipping(DestDevContext, DestDevContext.GetGC, X,Y,Width,Height,
|
||||||
MaskPixmap,XMask,YMask,
|
MaskPixmap,XMask,YMask,
|
||||||
NewClipMask);
|
NewClipMask);
|
||||||
|
|
||||||
// draw image
|
// draw image
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_window_copy_area(DestDevContext.Drawable, DestDevContext.GC, X, Y,
|
gdk_window_copy_area(DestDevContext.Drawable, DestDevContext.GetGC, X, Y,
|
||||||
SrcPixmap, XSrc, YSrc, SrcWidth, SrcHeight);
|
SrcPixmap, XSrc, YSrc, SrcWidth, SrcHeight);
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
// unset clipping mask for transparency
|
// unset clipping mask for transparency
|
||||||
ResetClipping(DestDevContext.GC);
|
ResetClipping(DestDevContext.GetGC);
|
||||||
|
|
||||||
// restore raster operation to SRCCOPY
|
// restore raster operation to SRCCOPY
|
||||||
GDK_GC_Set_Function(DestDevContext.GC, GDK_Copy);
|
GDK_GC_Set_Function(DestDevContext.GetGC, GDK_Copy);
|
||||||
|
|
||||||
Result:=True;
|
Result:=True;
|
||||||
end;
|
end;
|
||||||
@ -6130,9 +6131,9 @@ begin
|
|||||||
|
|
||||||
aDC.SelectedColors := dcscCustom;
|
aDC.SelectedColors := dcscCustom;
|
||||||
GDKColor:=AllocGDKColor(AColor);
|
GDKColor:=AllocGDKColor(AColor);
|
||||||
gdk_gc_set_foreground(aDC.GC, @GDKColor);
|
gdk_gc_set_foreground(aDC.GetGC, @GDKColor);
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_draw_point(aDC.Drawable, aDC.GC, X, Y);
|
gdk_draw_point(aDC.Drawable, aDC.GetGC, X, Y);
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6141,7 +6142,6 @@ var
|
|||||||
fWindow :pGdkWindow;
|
fWindow :pGdkWindow;
|
||||||
widget : PgtkWIdget;
|
widget : PgtkWIdget;
|
||||||
PixMap : pgdkPixMap;
|
PixMap : pgdkPixMap;
|
||||||
//gc : PGDKGc;
|
|
||||||
Child: PGtkWidget;
|
Child: PGtkWidget;
|
||||||
begin
|
begin
|
||||||
Assert(False, 'Trace:In AutoRedraw in GTKObject');
|
Assert(False, 'Trace:In AutoRedraw in GTKObject');
|
||||||
@ -6151,7 +6151,6 @@ begin
|
|||||||
pixmap := gtk_Object_get_data(pgtkobject(Child),'Pixmap');
|
pixmap := gtk_Object_get_data(pgtkobject(Child),'Pixmap');
|
||||||
if PixMap = nil then Exit;
|
if PixMap = nil then Exit;
|
||||||
fWindow := GetControlWindow(widget);
|
fWindow := GetControlWindow(widget);
|
||||||
//gc := gdk_gc_new(PgdkWindow(fWindow));
|
|
||||||
|
|
||||||
if fWindow<>nil then begin
|
if fWindow<>nil then begin
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
@ -6306,8 +6305,8 @@ begin
|
|||||||
|
|
||||||
If GDIBrushFill <> GDK_Solid then
|
If GDIBrushFill <> GDK_Solid then
|
||||||
If GDIBrushPixmap <> nil then begin
|
If GDIBrushPixmap <> nil then begin
|
||||||
gdk_gc_set_fill(GC, GDIBrushFill);
|
gdk_gc_set_fill(GetGC, GDIBrushFill);
|
||||||
gdk_gc_set_Stipple(GC,GDIBrushPixmap);
|
gdk_gc_set_Stipple(GetGC,GDIBrushPixmap);
|
||||||
end
|
end
|
||||||
end;
|
end;
|
||||||
TDeviceContext(DC).SelectedColors:=dcscBrush;
|
TDeviceContext(DC).SelectedColors:=dcscBrush;
|
||||||
@ -6344,7 +6343,7 @@ procedure TGtkWidgetSet.SelectGDKPenProps(DC: HDC);
|
|||||||
procedure SetDashes(const Dashes: array of gint8);
|
procedure SetDashes(const Dashes: array of gint8);
|
||||||
begin
|
begin
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
laz_gdk_gc_set_dashes(TDeviceContext(DC).GC,0,Pgint8(@Dashes[Low(Dashes)]),
|
laz_gdk_gc_set_dashes(TDeviceContext(DC).GetGC,0,Pgint8(@Dashes[Low(Dashes)]),
|
||||||
High(Dashes)-Low(Dashes)+1);
|
High(Dashes)-Low(Dashes)+1);
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
end;
|
end;
|
||||||
@ -6360,7 +6359,7 @@ begin
|
|||||||
|
|
||||||
if (not (dcfPenSelected in TDeviceContext(DC).DCFlags)) then begin
|
if (not (dcfPenSelected in TDeviceContext(DC).DCFlags)) then begin
|
||||||
Exclude(TDeviceContext(DC).DCFlags,dcfPenInvalid);
|
Exclude(TDeviceContext(DC).DCFlags,dcfPenInvalid);
|
||||||
if TDeviceContext(DC).GC<>nil then begin
|
if TDeviceContext(DC).GetGC<>nil then begin
|
||||||
with TDeviceContext(DC), CurrentPen^ do
|
with TDeviceContext(DC), CurrentPen^ do
|
||||||
begin
|
begin
|
||||||
IsNullPen := GDIPenStyle = PS_NULL;
|
IsNullPen := GDIPenStyle = PS_NULL;
|
||||||
@ -6447,11 +6446,11 @@ var
|
|||||||
aDC: TDeviceContext;
|
aDC: TDeviceContext;
|
||||||
ClientWidget: PGtkWidget;
|
ClientWidget: PGtkWidget;
|
||||||
FontGdiObject: PGdiObject;
|
FontGdiObject: PGdiObject;
|
||||||
GCValues: TGdkGCValues;
|
|
||||||
begin
|
begin
|
||||||
aDC := nil;
|
aDC := nil;
|
||||||
|
|
||||||
aDC := NewDC;
|
aDC := NewDC;
|
||||||
|
aDC.WithChildWindows := WithChildWindows;
|
||||||
aDC.DCWidget := TheWidget;
|
aDC.DCWidget := TheWidget;
|
||||||
|
|
||||||
FontGdiObject := nil;
|
FontGdiObject := nil;
|
||||||
@ -6460,7 +6459,6 @@ begin
|
|||||||
if TheWidget = nil
|
if TheWidget = nil
|
||||||
then begin
|
then begin
|
||||||
// screen: ToDo: multiple desktops
|
// screen: ToDo: multiple desktops
|
||||||
FillChar(GCValues, SizeOf(GCValues), #0);
|
|
||||||
end
|
end
|
||||||
else begin
|
else begin
|
||||||
// create a new devicecontext for this window
|
// create a new devicecontext for this window
|
||||||
@ -6479,29 +6477,19 @@ begin
|
|||||||
ClientWidget:=TheWidget;
|
ClientWidget:=TheWidget;
|
||||||
aDC.SpecialOrigin:=GtkWidgetIsA(ClientWidget,GTK_LAYOUT_GET_TYPE);
|
aDC.SpecialOrigin:=GtkWidgetIsA(ClientWidget,GTK_LAYOUT_GET_TYPE);
|
||||||
aDC.Drawable := TheWindow;
|
aDC.Drawable := TheWindow;
|
||||||
// create GC
|
{$IFDEF Gtk1}
|
||||||
if WithChildWindows then begin
|
aDC.GetGC;
|
||||||
//DebugLn('TGtkWidgetSet.CreateDCForWidget A WithChildWindows');
|
{$ENDIF}
|
||||||
FillChar(GCValues, SizeOf(GCValues), #0);
|
|
||||||
GCValues.subwindow_mode := GDK_INCLUDE_INFERIORS;
|
|
||||||
aDC.GC := gdk_gc_new_with_values(aDC.Drawable,
|
|
||||||
@GCValues,GDK_GC_FUNCTION or GDK_GC_SUBWINDOW);
|
|
||||||
end else begin
|
|
||||||
aDC.GC := gdk_gc_new(aDC.Drawable);
|
|
||||||
end;
|
|
||||||
gdk_gc_set_function(aDC.GC, GDK_COPY);
|
|
||||||
|
|
||||||
gdk_gc_get_values(aDC.GC, @GCValues);
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
if aDC <> nil
|
if aDC <> nil
|
||||||
then begin
|
then begin
|
||||||
{$Ifdef GTK1}
|
{$Ifdef GTK1}
|
||||||
// ToDo: create font on demand
|
// ToDo: create font on demand
|
||||||
if GCValues.Font <> nil
|
if aDC.GCValues.Font <> nil
|
||||||
then begin
|
then begin
|
||||||
FontGdiObject:=NewGDIObject(gdiFont);
|
FontGdiObject:=NewGDIObject(gdiFont);
|
||||||
FontGdiObject^.GDIFontObject := GCValues.Font;
|
FontGdiObject^.GDIFontObject := aDC.GCValues.Font;
|
||||||
FontCache.Reference(FontGdiObject^.GDIFontObject);
|
FontCache.Reference(FontGdiObject^.GDIFontObject);
|
||||||
end
|
end
|
||||||
else FontGdiObject := CreateDefaultFont;
|
else FontGdiObject := CreateDefaultFont;
|
||||||
@ -6524,7 +6512,7 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
Result := HDC(aDC);
|
Result := HDC(aDC);
|
||||||
Assert(False, Format('trace:< [TGtkWidgetSet.GetDC] Got 0x%x', [Result]));
|
Assert(False, Format('trace:< [TGtkWidgetSet.CreateDCForWidget] Got 0x%x', [Result]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -6542,6 +6530,7 @@ var
|
|||||||
DevContext: TDeviceContext;
|
DevContext: TDeviceContext;
|
||||||
CaretWasVisible: Boolean;
|
CaretWasVisible: Boolean;
|
||||||
MainWidget: PGtkWidget;
|
MainWidget: PGtkWidget;
|
||||||
|
GC: PGdkGC;
|
||||||
//LCLObject: TObject;
|
//LCLObject: TObject;
|
||||||
//x, y: integer;
|
//x, y: integer;
|
||||||
begin
|
begin
|
||||||
@ -6595,14 +6584,16 @@ begin
|
|||||||
Include(DevContext.DCFlags,dcfDoubleBuffer);
|
Include(DevContext.DCFlags,dcfDoubleBuffer);
|
||||||
|
|
||||||
if BufferCreated then begin
|
if BufferCreated then begin
|
||||||
|
// create GC
|
||||||
|
GC:=DevContext.GetGC;
|
||||||
// copy old context to buffer
|
// copy old context to buffer
|
||||||
gdk_gc_set_clip_region(DevContext.GC, nil);
|
gdk_gc_set_clip_region(GC, nil);
|
||||||
gdk_gc_set_clip_rectangle(DevContext.GC, nil);
|
gdk_gc_set_clip_rectangle(GC, nil);
|
||||||
|
|
||||||
// hide caret
|
// hide caret
|
||||||
HideCaretOfWidgetGroup(Widget,MainWidget,CaretWasVisible);
|
HideCaretOfWidgetGroup(Widget,MainWidget,CaretWasVisible);
|
||||||
// copy
|
// copy
|
||||||
gdk_window_copy_area(DoubleBuffer, DevContext.GC,0,0,
|
gdk_window_copy_area(DoubleBuffer, GC,0,0,
|
||||||
Widget^.Window,0,0,Width,Height);
|
Widget^.Window,0,0,Width,Height);
|
||||||
|
|
||||||
{LCLObject:=GetParentLCLObject(Widget);
|
{LCLObject:=GetParentLCLObject(Widget);
|
||||||
@ -7418,6 +7409,39 @@ begin
|
|||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
procedure TGTKWidgetSet.OnCreateGCForDC(DC: TDeviceContext);
|
||||||
|
var
|
||||||
|
CurWidget: PGtkWidget;
|
||||||
|
CurWindow: PGdkWindow;
|
||||||
|
begin
|
||||||
|
if DC.GC=nil then begin
|
||||||
|
// create GC
|
||||||
|
if DC.Drawable<>nil then begin
|
||||||
|
if DC.WithChildWindows then begin
|
||||||
|
FillChar(DC.GCValues, SizeOf(DC.GCValues), #0);
|
||||||
|
DC.GCValues.subwindow_mode := GDK_INCLUDE_INFERIORS;
|
||||||
|
DC.GC:=gdk_gc_new_with_values(DC.Drawable,
|
||||||
|
@DC.GCValues,GDK_GC_FUNCTION or GDK_GC_SUBWINDOW);
|
||||||
|
end else begin
|
||||||
|
DC.GC:=gdk_gc_new(DC.Drawable);
|
||||||
|
end;
|
||||||
|
end else begin
|
||||||
|
// create default GC
|
||||||
|
{$IFDEF Gtk1}
|
||||||
|
CurWidget:=GetStyleWidget(lgsWindow);
|
||||||
|
CurWindow:=CurWidget^.window;
|
||||||
|
DC.GC:=gdk_gc_new(CurWindow);
|
||||||
|
{$ELSE}
|
||||||
|
DC.GC:=gdk_gc_new(gdk_screen_get_root_window(gdk_screen_get_default));
|
||||||
|
{$ENDIF}
|
||||||
|
end;
|
||||||
|
if DC.GC<>nil then begin
|
||||||
|
gdk_gc_set_function(DC.GC, GDK_COPY);
|
||||||
|
gdk_gc_get_values(DC.GC, @DC.GCValues);
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
|
|
||||||
function TGtkWidgetSet.ForceLineBreaks(DC : hDC; Src: PChar; MaxWidthInPixels : Longint;
|
function TGtkWidgetSet.ForceLineBreaks(DC : hDC; Src: PChar; MaxWidthInPixels : Longint;
|
||||||
ProcessAmpersands : Boolean) : PChar;
|
ProcessAmpersands : Boolean) : PChar;
|
||||||
var
|
var
|
||||||
|
@ -1421,8 +1421,6 @@ end;
|
|||||||
Creates a copy DC from the given DC
|
Creates a copy DC from the given DC
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function CopyDCData(DestinationDC, SourceDC: TDeviceContext): Boolean;
|
function CopyDCData(DestinationDC, SourceDC: TDeviceContext): Boolean;
|
||||||
var
|
|
||||||
GCValues: TGDKGCValues;
|
|
||||||
begin
|
begin
|
||||||
// Assert(False, Format('Trace:> [CopyDCData] DestDC:0x%x, SourceDC:0x%x', [Integer(DestinationDC), Integer(SourceDC)]));
|
// Assert(False, Format('Trace:> [CopyDCData] DestDC:0x%x, SourceDC:0x%x', [Integer(DestinationDC), Integer(SourceDC)]));
|
||||||
Result := (DestinationDC <> nil) and (SourceDC <> nil);
|
Result := (DestinationDC <> nil) and (SourceDC <> nil);
|
||||||
@ -1433,6 +1431,7 @@ begin
|
|||||||
DCWidget := SourceDC.DCWidget;
|
DCWidget := SourceDC.DCWidget;
|
||||||
Drawable := SourceDC.Drawable;
|
Drawable := SourceDC.Drawable;
|
||||||
if GC<>nil then begin
|
if GC<>nil then begin
|
||||||
|
// free old GC
|
||||||
BeginGDKErrorTrap;
|
BeginGDKErrorTrap;
|
||||||
gdk_gc_unref(GC);
|
gdk_gc_unref(GC);
|
||||||
EndGDKErrorTrap;
|
EndGDKErrorTrap;
|
||||||
@ -1515,13 +1514,13 @@ begin
|
|||||||
{$IFDEF DebugGDK}
|
{$IFDEF DebugGDK}
|
||||||
BeginGDKErrorTrap;
|
BeginGDKErrorTrap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
gdk_gc_set_clip_region(gc, nil);
|
gdk_gc_set_clip_region(GetGC, nil);
|
||||||
gdk_gc_set_clip_rectangle (gc, nil);
|
gdk_gc_set_clip_rectangle (GetGC, nil);
|
||||||
If (ClipRegion <> 0) then begin
|
If (ClipRegion <> 0) then begin
|
||||||
Region:=PGDIObject(ClipRegion);
|
Region:=PGDIObject(ClipRegion);
|
||||||
RGNType := RegionType(Region^.GDIRegionObject);
|
RGNType := RegionType(Region^.GDIRegionObject);
|
||||||
If (RGNType <> ERROR) and (RGNType <> NULLREGION) then begin
|
If (RGNType <> ERROR) and (RGNType <> NULLREGION) then begin
|
||||||
gdk_gc_set_clip_region(gc, PGDIObject(ClipRegion)^.GDIRegionObject);
|
gdk_gc_set_clip_region(GetGC, PGDIObject(ClipRegion)^.GDIRegionObject);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DebugGDK}
|
{$IFDEF DebugGDK}
|
||||||
@ -1685,7 +1684,7 @@ var
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
begin
|
begin
|
||||||
GC:=TDeviceContext(DC).GC;
|
GC:=TDeviceContext(DC).GetGC;
|
||||||
GDIColor:=nil;
|
GDIColor:=nil;
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
@ -7330,7 +7329,7 @@ begin
|
|||||||
GetStyleWithName(WName);
|
GetStyleWithName(WName);
|
||||||
// return widget
|
// return widget
|
||||||
l:=IndexOfStyleWithName(WName);
|
l:=IndexOfStyleWithName(WName);
|
||||||
If l>=0 then
|
if l>=0 then
|
||||||
Result := PStyleObject(Styles.Objects[l])^.Widget;
|
Result := PStyleObject(Styles.Objects[l])^.Widget;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
@ -62,12 +62,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.Arc] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
// Draw outline
|
// Draw outline
|
||||||
SelectGDKPenProps(DC);
|
SelectGDKPenProps(DC);
|
||||||
|
|
||||||
@ -81,13 +75,12 @@ begin
|
|||||||
inc(Right,DCOrigin.X);
|
inc(Right,DCOrigin.X);
|
||||||
inc(Bottom,DCOrigin.Y);
|
inc(Bottom,DCOrigin.Y);
|
||||||
{$IFDEF DebugGDKTraps}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDKTraps}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_draw_arc(Drawable, GC, 0, left, top, right - left, bottom - top,
|
gdk_draw_arc(Drawable, GetGC, 0, left, top, right - left, bottom - top,
|
||||||
Angle1*4, Angle2*4);
|
Angle1*4, Angle2*4);
|
||||||
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
||||||
end else
|
end else
|
||||||
Result:=false;
|
Result:=false;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -105,18 +98,7 @@ end;
|
|||||||
function TGtkWidgetSet.AngleChord(DC: HDC;
|
function TGtkWidgetSet.AngleChord(DC: HDC;
|
||||||
x1, y1, x2, y2, angle1, angle2: Integer): Boolean;
|
x1, y1, x2, y2, angle1, angle2: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
|
||||||
if Result
|
|
||||||
then with TDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.AngleChord] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := Inherited AngleChord(DC, x1, y1, x2, y2, angle1, angle2);
|
Result := Inherited AngleChord(DC, x1, y1, x2, y2, angle1, angle2);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -2775,7 +2757,7 @@ var
|
|||||||
begin
|
begin
|
||||||
inc(X1,Origin.X);
|
inc(X1,Origin.X);
|
||||||
inc(Y1,Origin.Y);
|
inc(Y1,Origin.Y);
|
||||||
gdk_draw_point(TDeviceContext(DC).Drawable, TDeviceContext(DC).GC, X1, Y1);
|
gdk_draw_point(TDeviceContext(DC).Drawable, TDeviceContext(DC).GetGC, X1, Y1);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
procedure DrawVertLine(X1,Y1,Y2: integer);
|
procedure DrawVertLine(X1,Y1,Y2: integer);
|
||||||
@ -2889,12 +2871,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
Assert(False, 'Trace:[TGtkWidgetSet.DrawEdge] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
R := ARect;
|
R := ARect;
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
OffsetRect(R,DCOrigin.X,DCOrigin.Y);
|
OffsetRect(R,DCOrigin.X,DCOrigin.Y);
|
||||||
@ -2929,16 +2905,16 @@ begin
|
|||||||
BOuter := True;
|
BOuter := True;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
gdk_gc_set_fill(GC, GDK_SOLID);
|
gdk_gc_set_fill(GetGC, GDK_SOLID);
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
|
|
||||||
// Draw outer rect
|
// Draw outer rect
|
||||||
if BOuter then
|
if BOuter then
|
||||||
DrawEdges(R,GC,Drawable,OuterTL,OuterBR);
|
DrawEdges(R,GetGC,Drawable,OuterTL,OuterBR);
|
||||||
|
|
||||||
// Draw inner rect
|
// Draw inner rect
|
||||||
if BInner then
|
if BInner then
|
||||||
DrawEdges(R,GC,Drawable,InnerTL,InnerBR);
|
DrawEdges(R,GetGC,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);
|
||||||
@ -2956,10 +2932,10 @@ begin
|
|||||||
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
||||||
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef)))
|
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef)))
|
||||||
then
|
then
|
||||||
StyleFillRectangle(Drawable, GC, CurrentBrush^.GDIBrushColor.ColorRef,
|
StyleFillRectangle(Drawable, GetGC, CurrentBrush^.GDIBrushColor.ColorRef,
|
||||||
R.Left, R.Top, Width, Height)
|
R.Left, R.Top, Width, Height)
|
||||||
else
|
else
|
||||||
gdk_draw_rectangle(Drawable, GC, 1, R.Left, R.Top, Width, Height);
|
gdk_draw_rectangle(Drawable, GetGC, 1, R.Left, R.Top, Width, Height);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
// adjust rect if needed
|
// adjust rect if needed
|
||||||
@ -2968,7 +2944,6 @@ begin
|
|||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3170,11 +3145,6 @@ begin
|
|||||||
if Boolean(Result)
|
if Boolean(Result)
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.DrawText] Uninitialized GC');
|
|
||||||
Result := 0;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
Result := 0;
|
Result := 0;
|
||||||
Lines := nil;
|
Lines := nil;
|
||||||
NumLines := 0;
|
NumLines := 0;
|
||||||
@ -3319,13 +3289,13 @@ begin
|
|||||||
{$IFDEF VerboseDoubleBuffer}
|
{$IFDEF VerboseDoubleBuffer}
|
||||||
DebugLn('TGtkWidgetSet.EndPaint Copying from buffer to window: ',Width,' ',Height);
|
DebugLn('TGtkWidgetSet.EndPaint Copying from buffer to window: ',Width,' ',Height);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
gdk_gc_set_clip_region(DevContext.GC, nil);
|
gdk_gc_set_clip_region(DevContext.GetGC, nil);
|
||||||
gdk_gc_set_clip_rectangle(DevContext.GC, nil);
|
gdk_gc_set_clip_rectangle(DevContext.GetGC, nil);
|
||||||
|
|
||||||
// hide caret
|
// hide caret
|
||||||
HideCaretOfWidgetGroup(Widget,MainWidget,CaretWasVisible);
|
HideCaretOfWidgetGroup(Widget,MainWidget,CaretWasVisible);
|
||||||
// draw
|
// draw
|
||||||
gdk_window_copy_area(Widget^.Window, DevContext.GC, 0,0,
|
gdk_window_copy_area(Widget^.Window, DevContext.GetGC, 0,0,
|
||||||
DCDrawable, 0, 0, Width, Height);
|
DCDrawable, 0, 0, Width, Height);
|
||||||
|
|
||||||
{LCLObject:=GetParentLCLObject(Widget);
|
{LCLObject:=GetParentLCLObject(Widget);
|
||||||
@ -3802,12 +3772,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.Ellipse] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if x1<x2 then begin
|
if x1<x2 then begin
|
||||||
x:=x1;
|
x:=x1;
|
||||||
width:=x2-x1;
|
width:=x2-x1;
|
||||||
@ -3832,7 +3796,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
If not CurrentBrush^.IsNullBrush then
|
If not CurrentBrush^.IsNullBrush then
|
||||||
gdk_draw_arc(Drawable, GC, 1, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
|
gdk_draw_arc(Drawable, GetGC, 1, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
|
||||||
0, 360 shl 6);
|
0, 360 shl 6);
|
||||||
|
|
||||||
// Draw outline
|
// Draw outline
|
||||||
@ -3841,7 +3805,7 @@ begin
|
|||||||
If (dcfPenSelected in DCFlags) then begin
|
If (dcfPenSelected in DCFlags) then begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if (CurrentPen^.IsNullPen) then exit;
|
if (CurrentPen^.IsNullPen) then exit;
|
||||||
gdk_draw_arc(Drawable, GC, 0, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
|
gdk_draw_arc(Drawable, GetGC, 0, x+DCOrigin.X, y+DCOrigin.Y, Width, Height,
|
||||||
0, 360 shl 6);
|
0, 360 shl 6);
|
||||||
end else
|
end else
|
||||||
Result := False;
|
Result := False;
|
||||||
@ -3850,7 +3814,6 @@ begin
|
|||||||
EndGDKErrorTrap;
|
EndGDKErrorTrap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -3917,12 +3880,6 @@ begin
|
|||||||
Result := ERROR
|
Result := ERROR
|
||||||
else with TDeviceContext(DC) do
|
else with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.ExtSelectClipRGN] Uninitialized GC');
|
|
||||||
Result := ERROR;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
//DebugLn('TGtkWidgetSet.ExtSelectClipRGN A ClipRegValid=',dbgs(DCClipRegionValid(DC)),
|
//DebugLn('TGtkWidgetSet.ExtSelectClipRGN A ClipRegValid=',dbgs(DCClipRegionValid(DC)),
|
||||||
// ' Mode=',dbgs(Mode),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject));
|
// ' Mode=',dbgs(Mode),' RGN=',GDKRegionAsString(PGdiObject(RGN)^.GDIRegionObject));
|
||||||
If ClipRegion=0 then begin
|
If ClipRegion=0 then begin
|
||||||
@ -3959,7 +3916,6 @@ begin
|
|||||||
else
|
else
|
||||||
Result := Inherited ExtSelectClipRGN(dc, rgn, mode);
|
Result := Inherited ExtSelectClipRGN(dc, rgn, mode);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -4003,7 +3959,7 @@ var
|
|||||||
if (Dx=nil) then begin
|
if (Dx=nil) then begin
|
||||||
// no dist array -> write as one block
|
// no dist array -> write as one block
|
||||||
|
|
||||||
gdk_draw_text(Buffer, UseFont, GC, TxtPt.X, TxtPt.Y,
|
gdk_draw_text(Buffer, UseFont, GetGC, TxtPt.X, TxtPt.Y,
|
||||||
LineStart, LineLen);
|
LineStart, LineLen);
|
||||||
end else begin
|
end else begin
|
||||||
// dist array -> write each char separately
|
// dist array -> write each char separately
|
||||||
@ -4020,7 +3976,7 @@ var
|
|||||||
i:=1;
|
i:=1;
|
||||||
while (i<=LineLen) do begin
|
while (i<=LineLen) do begin
|
||||||
//debugln('TGtkWidgetSet.ExtTextOut.DrawTextLine ',dbgs(CharLen),' ',dbgs(ord(LinePos^)));
|
//debugln('TGtkWidgetSet.ExtTextOut.DrawTextLine ',dbgs(CharLen),' ',dbgs(ord(LinePos^)));
|
||||||
gdk_draw_text(Buffer, UseFont, GC, CurX, TxtPt.Y, LinePos, CharLen);
|
gdk_draw_text(Buffer, UseFont, GetGC, CurX, TxtPt.Y, LinePos, CharLen);
|
||||||
inc(LinePos,CharLen);
|
inc(LinePos,CharLen);
|
||||||
inc(CurX,CurDistX^);
|
inc(CurX,CurDistX^);
|
||||||
inc(CurDistX);
|
inc(CurDistX);
|
||||||
@ -4033,7 +3989,7 @@ var
|
|||||||
else
|
else
|
||||||
UnderLineLen := gdk_text_width(UseFont,LineStart, LineLen);
|
UnderLineLen := gdk_text_width(UseFont,LineStart, LineLen);
|
||||||
Y := TxtPt.Y + 1;
|
Y := TxtPt.Y + 1;
|
||||||
gdk_draw_line(Buffer, GC, TxtPt.X, Y, TxtPt.X+UnderLineLen, Y);
|
gdk_draw_line(Buffer, GetGC, TxtPt.X, Y, TxtPt.X+UnderLineLen, Y);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
{$IFDEF DebugGDKTraps}
|
{$IFDEF DebugGDKTraps}
|
||||||
@ -4047,12 +4003,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.ExtTextOut] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
if ((Options and (ETO_OPAQUE+ETO_CLIPPED)) <> 0)
|
if ((Options and (ETO_OPAQUE+ETO_CLIPPED)) <> 0)
|
||||||
and (Rect=nil) then begin
|
and (Rect=nil) then begin
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.ExtTextOut] Rect=nil');
|
DebugLn('WARNING: [TGtkWidgetSet.ExtTextOut] Rect=nil');
|
||||||
@ -4108,10 +4058,10 @@ begin
|
|||||||
BeginGDKErrorTrap;
|
BeginGDKErrorTrap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
if IsBackgroundColor(TColor(CurrentBackColor.ColorRef)) then
|
if IsBackgroundColor(TColor(CurrentBackColor.ColorRef)) then
|
||||||
StyleFillRectangle(buffer, GC, CurrentBackColor.ColorRef,
|
StyleFillRectangle(buffer, GetGC, CurrentBackColor.ColorRef,
|
||||||
Left, Top, Width, Height)
|
Left, Top, Width, Height)
|
||||||
else
|
else
|
||||||
gdk_draw_rectangle(buffer, GC, 1, Left, Top, Width, Height);
|
gdk_draw_rectangle(buffer, GetGC, 1, Left, Top, Width, Height);
|
||||||
{$IFDEF DebugGDKTraps}
|
{$IFDEF DebugGDKTraps}
|
||||||
EndGDKErrorTrap;
|
EndGDKErrorTrap;
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
@ -4177,12 +4127,6 @@ begin
|
|||||||
if not Result then exit;
|
if not Result then exit;
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.FillRect] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
if not PGdiObject(Brush)^.IsNullBrush then begin
|
if not PGdiObject(Brush)^.IsNullBrush then begin
|
||||||
Width := Rect.Right - Rect.Left;
|
Width := Rect.Right - Rect.Left;
|
||||||
Height := Rect.Bottom - Rect.Top;
|
Height := Rect.Bottom - Rect.Top;
|
||||||
@ -4202,12 +4146,12 @@ begin
|
|||||||
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
||||||
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef)))
|
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef)))
|
||||||
then begin
|
then begin
|
||||||
StyleFillRectangle(drawable, GC,
|
StyleFillRectangle(drawable, GetGC,
|
||||||
CurrentBrush^.GDIBrushColor.ColorRef,
|
CurrentBrush^.GDIBrushColor.ColorRef,
|
||||||
Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
|
Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
|
||||||
Width, Height)
|
Width, Height)
|
||||||
end else begin
|
end else begin
|
||||||
gdk_draw_rectangle(Drawable, GC, 1,
|
gdk_draw_rectangle(Drawable, GetGC, 1,
|
||||||
Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
|
Rect.Left+DCOrigin.X, Rect.Top+DCOrigin.Y,
|
||||||
Width, Height);
|
Width, Height);
|
||||||
end;
|
end;
|
||||||
@ -4234,7 +4178,7 @@ var
|
|||||||
DCOrigin: TPoint;
|
DCOrigin: TPoint;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
if IsValidDC(DC) and (TDeviceContext(DC).GC<>nil) then begin
|
if IsValidDC(DC) then begin
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
// Draw outline
|
// Draw outline
|
||||||
@ -4243,7 +4187,7 @@ begin
|
|||||||
Result := 1;
|
Result := 1;
|
||||||
if (not CurrentPen^.IsNullPen) then begin
|
if (not CurrentPen^.IsNullPen) then begin
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
gdk_draw_rectangle(Drawable, GC, 0,
|
gdk_draw_rectangle(Drawable, GetGC, 0,
|
||||||
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
|
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
|
||||||
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
|
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
|
||||||
end;
|
end;
|
||||||
@ -4285,11 +4229,6 @@ begin
|
|||||||
|
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil then begin
|
|
||||||
Result:= False;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
|
|
||||||
Widget:=TDeviceContext(DC).DCWidget;
|
Widget:=TDeviceContext(DC).DCWidget;
|
||||||
ClientWidget:=Widget;
|
ClientWidget:=Widget;
|
||||||
if Widget<>nil then begin
|
if Widget<>nil then begin
|
||||||
@ -4337,8 +4276,7 @@ var
|
|||||||
DCOrigin: TPoint;
|
DCOrigin: TPoint;
|
||||||
begin
|
begin
|
||||||
Result:=0;
|
Result:=0;
|
||||||
if IsValidDC(DC) and (TDeviceContext(DC).GC<>nil)
|
if IsValidDC(DC) and IsValidGDIObject(hBr) then begin
|
||||||
and IsValidGDIObject(hBr) then begin
|
|
||||||
// Draw outline
|
// Draw outline
|
||||||
Result := 1;
|
Result := 1;
|
||||||
if (not PGdiObject(hBr)^.IsNullBrush) then begin
|
if (not PGdiObject(hBr)^.IsNullBrush) then begin
|
||||||
@ -4347,7 +4285,7 @@ begin
|
|||||||
SelectedColors:=dcscCustom;
|
SelectedColors:=dcscCustom;
|
||||||
EnsureGCColor(DC, dccGDIBrushColor, True, False);//Brush Color
|
EnsureGCColor(DC, dccGDIBrushColor, True, False);//Brush Color
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
gdk_draw_rectangle(Drawable, GC, 0,
|
gdk_draw_rectangle(Drawable, GetGC, 0,
|
||||||
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
|
ARect.Left+DCOrigin.X, ARect.Top+DCOrigin.Y,
|
||||||
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
|
ARect.Right-ARect.Left, ARect.Bottom-ARect.Top);
|
||||||
end;
|
end;
|
||||||
@ -4785,13 +4723,8 @@ begin
|
|||||||
result := 0
|
result := 0
|
||||||
end else
|
end else
|
||||||
with TDeviceContext(DC) do begin
|
with TDeviceContext(DC) do begin
|
||||||
if GC = nil then begin
|
gdk_gc_get_values(GetGC, @Values);
|
||||||
Assert(False, 'Trace:[TGtkWidgetSet.GetROP2] Uninitialized GC');
|
Result := GdkFunctionToROP2Mode(Values.{$ifdef gtk1}thefunction{$else}_function{$endif} )
|
||||||
Result := 0;
|
|
||||||
end else begin
|
|
||||||
gdk_gc_get_values(GC, @Values);
|
|
||||||
result := GdkFunctionToROP2Mode( Values.{$ifdef gtk1}thefunction{$else}_function{$endif} )
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -6814,7 +6747,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC <> nil then begin
|
|
||||||
SelectGDKPenProps(DC);
|
SelectGDKPenProps(DC);
|
||||||
|
|
||||||
If (dcfPenSelected in DCFlags) then begin
|
If (dcfPenSelected in DCFlags) then begin
|
||||||
@ -6833,15 +6765,11 @@ begin
|
|||||||
debugln('TGtkWidgetSet.LineTo SWAPPED ',dbgs(FromX),' ',dbgs(FromY),' ',dbgs(ToX),' ',dbgs(ToY));
|
debugln('TGtkWidgetSet.LineTo SWAPPED ',dbgs(FromX),' ',dbgs(FromY),' ',dbgs(ToX),' ',dbgs(ToY));
|
||||||
end;}
|
end;}
|
||||||
//gdk_gc_set_line_attributes(gc,1,GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
//gdk_gc_set_line_attributes(gc,1,GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
||||||
gdk_draw_line(Drawable, GC, FromX, FromY, ToX, ToY);
|
gdk_draw_line(Drawable, GetGC, FromX, FromY, ToX, ToY);
|
||||||
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}EndGDKErrorTrap;{$ENDIF}
|
||||||
PenPos:= Point(X, Y);
|
PenPos:= Point(X, Y);
|
||||||
end else
|
end else
|
||||||
Result := False;
|
Result := False;
|
||||||
end else begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.LineTo] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
Assert(False, Format('trace:< [TGtkWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
|
Assert(False, Format('trace:< [TGtkWidgetSet.LineTo] DC:0x%x, X:%d, Y:%d', [DC, X, Y]));
|
||||||
end;
|
end;
|
||||||
@ -7056,22 +6984,11 @@ end;
|
|||||||
then the resulting Poly-Bézier will be drawn as a Polygon.
|
then the resulting Poly-Bézier will be drawn as a Polygon.
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TGtkWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
|
function TGtkWidgetSet.PolyBezier(DC: HDC; Points: PPoint; NumPts: Integer;
|
||||||
Filled, Continuous: Boolean): Boolean;
|
Filled, Continuous: Boolean): Boolean;
|
||||||
Begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
|
||||||
if Result
|
|
||||||
then with TDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.PolyBezier] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := Inherited PolyBezier(DC, Points, NumPts, Filled, Continuous);
|
Result := Inherited PolyBezier(DC, Points, NumPts, Filled, Continuous);
|
||||||
end;
|
end;
|
||||||
End;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: TGtkWidgetSet.Polygon
|
Method: TGtkWidgetSet.Polygon
|
||||||
@ -7106,12 +7023,6 @@ begin
|
|||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if NumPts<=0 then exit;
|
if NumPts<=0 then exit;
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.Polygon] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
|
|
||||||
// create the PointsArray, which is a copy of Points moved by the DCOrigin
|
// create the PointsArray, which is a copy of Points moved by the DCOrigin
|
||||||
@ -7154,7 +7065,7 @@ begin
|
|||||||
SelectClipRGN(DC, Tmp);
|
SelectClipRGN(DC, Tmp);
|
||||||
DeleteObject(Tmp);
|
DeleteObject(Tmp);
|
||||||
end else
|
end else
|
||||||
gdk_draw_polygon(Drawable, GC, 1, PointArray, NumPts);
|
gdk_draw_polygon(Drawable, GetGC, 1, PointArray, NumPts);
|
||||||
|
|
||||||
// draw outline
|
// draw outline
|
||||||
|
|
||||||
@ -7163,7 +7074,7 @@ begin
|
|||||||
If (dcfPenSelected in DCFlags) then begin
|
If (dcfPenSelected in DCFlags) then begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if (not CurrentPen^.IsNullPen) then begin
|
if (not CurrentPen^.IsNullPen) then begin
|
||||||
gdk_draw_polygon(Drawable, GC, 0, PointArray, NumPts);
|
gdk_draw_polygon(Drawable, GetGC, 0, PointArray, NumPts);
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
Result:=false;
|
Result:=false;
|
||||||
@ -7174,7 +7085,6 @@ begin
|
|||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TGtkWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean;
|
function TGtkWidgetSet.Polyline(DC: HDC; Points: PPoint; NumPts: Integer): boolean;
|
||||||
@ -7186,12 +7096,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.Polyline] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if NumPts<=0 then exit;
|
if NumPts<=0 then exit;
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
GetMem(PointArray,SizeOf(TGdkPoint)*NumPts);
|
GetMem(PointArray,SizeOf(TGdkPoint)*NumPts);
|
||||||
@ -7207,7 +7111,7 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
if (not CurrentPen^.IsNullPen) then begin
|
if (not CurrentPen^.IsNullPen) then begin
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_draw_lines(Drawable, GC, PointArray, NumPts);
|
gdk_draw_lines(Drawable, GetGC, PointArray, NumPts);
|
||||||
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end else
|
end else
|
||||||
@ -7215,7 +7119,6 @@ begin
|
|||||||
|
|
||||||
FreeMem(PointArray);
|
FreeMem(PointArray);
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -7335,21 +7238,11 @@ end;
|
|||||||
between which the Arc is drawn.
|
between which the Arc is drawn.
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtkWidgetSet.RadialArc(DC: HDC; left, top, right, bottom, sx, sy, ex, ey: Integer): Boolean;
|
function TGtkWidgetSet.RadialArc(DC: HDC; left, top, right, bottom,
|
||||||
Begin
|
sx, sy, ex, ey: Integer): Boolean;
|
||||||
Result := IsValidDC(DC);
|
begin
|
||||||
if Result
|
|
||||||
then with TDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.RadialArc] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := Inherited RadialArc(DC, left, top, right, bottom, sx, sy, ex, ey);
|
Result := Inherited RadialArc(DC, left, top, right, bottom, sx, sy, ex, ey);
|
||||||
end;
|
end;
|
||||||
End;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Method: RadialChord
|
Method: RadialChord
|
||||||
@ -7361,21 +7254,11 @@ End;
|
|||||||
the bounding-Arc is drawn.
|
the bounding-Arc is drawn.
|
||||||
|
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
function TGtkWidgetSet.RadialChord(DC: HDC; x1, y1, x2, y2, sx, sy, ex, ey: Integer): Boolean;
|
function TGtkWidgetSet.RadialChord(DC: HDC; x1, y1, x2, y2,
|
||||||
|
sx, sy, ex, ey: Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Result := IsValidDC(DC);
|
|
||||||
if Result
|
|
||||||
then with TDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.RadialChord] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := Inherited RadialChord(DC, x1, y1, x2, y2, sx, sy, ex, ey);
|
Result := Inherited RadialChord(DC, x1, y1, x2, y2, sx, sy, ex, ey);
|
||||||
end;
|
end;
|
||||||
End;
|
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
Function: RealizePalette
|
Function: RealizePalette
|
||||||
@ -7413,12 +7296,6 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.Rectangle] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
CalculateLeftTopWidthHeight(X1,Y1,X2,Y2,Left,Top,Width,Height);
|
CalculateLeftTopWidthHeight(X1,Y1,X2,Y2,Left,Top,Width,Height);
|
||||||
// X2, Y2 is not part of the rectangle
|
// X2, Y2 is not part of the rectangle
|
||||||
dec(Width);
|
dec(Width);
|
||||||
@ -7430,9 +7307,9 @@ begin
|
|||||||
If not CurrentBrush^.IsNullBrush then
|
If not CurrentBrush^.IsNullBrush then
|
||||||
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
if (CurrentBrush^.GDIBrushFill = GDK_SOLID)
|
||||||
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef))) then
|
and (IsBackgroundColor(TColor(CurrentBrush^.GDIBrushColor.ColorRef))) then
|
||||||
StyleFillRectangle(Drawable, GC, CurrentBrush^.GDIBrushColor.ColorRef, Left+DCOrigin.X, Top+DCOrigin.Y, Width, Height)
|
StyleFillRectangle(Drawable, GetGC, CurrentBrush^.GDIBrushColor.ColorRef, Left+DCOrigin.X, Top+DCOrigin.Y, Width, Height)
|
||||||
else
|
else
|
||||||
gdk_draw_rectangle(Drawable, GC, 1, Left+DCOrigin.X, Top+DCOrigin.Y,
|
gdk_draw_rectangle(Drawable, GetGC, 1, Left+DCOrigin.X, Top+DCOrigin.Y,
|
||||||
Width, Height);
|
Width, Height);
|
||||||
|
|
||||||
// Draw outline
|
// Draw outline
|
||||||
@ -7441,14 +7318,13 @@ begin
|
|||||||
If (dcfPenSelected in DCFlags) then begin
|
If (dcfPenSelected in DCFlags) then begin
|
||||||
Result := True;
|
Result := True;
|
||||||
if (not CurrentPen^.IsNullPen) then
|
if (not CurrentPen^.IsNullPen) then
|
||||||
gdk_draw_rectangle(Drawable, GC, 0, Left+DCOrigin.X, Top+DCOrigin.Y,
|
gdk_draw_rectangle(Drawable, GetGC, 0, Left+DCOrigin.X, Top+DCOrigin.Y,
|
||||||
Width, Height);
|
Width, Height);
|
||||||
end else
|
end else
|
||||||
Result:=false;
|
Result:=false;
|
||||||
|
|
||||||
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
Assert(False, Format('trace:< [TGtkWidgetSet.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
|
Assert(False, Format('trace:< [TGtkWidgetSet.Rectangle] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d', [DC, X1, Y1, X2, Y2]));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -7855,22 +7731,10 @@ end;
|
|||||||
of the corner arcs, RX is the radial width. If either is less than or equal to
|
of the corner arcs, RX is the radial width. If either is less than or equal to
|
||||||
0, the routine simly calls to standard Rectangle.
|
0, the routine simly calls to standard Rectangle.
|
||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TGtkWidgetSet.RoundRect(DC : hDC; X1, Y1, X2, Y2: Integer; RX,RY : Integer): Boolean;
|
function TGtkWidgetSet.RoundRect(DC : hDC; X1, Y1, X2, Y2: Integer;
|
||||||
|
RX,RY : Integer): Boolean;
|
||||||
begin
|
begin
|
||||||
Assert(False, Format('trace:> [TGtkWidgetSet.RoundRect] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d, RX:%d, RY:%d', [DC, X1, Y1, X2, Y2, RX, RY]));
|
|
||||||
Result := IsValidDC(DC);
|
|
||||||
if Result
|
|
||||||
then with TDeviceContext(DC) do
|
|
||||||
begin
|
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.RoundRect] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
end
|
|
||||||
else
|
|
||||||
Result := Inherited RoundRect(DC, X1, Y1, X2, Y2, RX, RY);
|
Result := Inherited RoundRect(DC, X1, Y1, X2, Y2, RX, RY);
|
||||||
end;
|
|
||||||
Assert(False, Format('trace:< [TGtkWidgetSet.RoundRect] DC:0x%x, X1:%d, Y1:%d, X2:%d, Y2:%d, RX:%d, RY:%d', [DC, X1, Y1, X2, Y2, RX, RY]));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -7998,24 +7862,16 @@ begin
|
|||||||
Result := SIMPLEREGION;
|
Result := SIMPLEREGION;
|
||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if (GC = nil) and (RGN <> 0)
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.SelectClipRGN] Uninitialized GC');
|
|
||||||
Result := ERROR;
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
// clear old clipregion
|
// clear old clipregion
|
||||||
if (ClipRegion<>0)
|
if (ClipRegion<>0)
|
||||||
and ((SavedContext=nil) or (SavedContext.ClipRegion<>ClipRegion)) then
|
and ((SavedContext=nil) or (SavedContext.ClipRegion<>ClipRegion)) then
|
||||||
DeleteObject(ClipRegion);
|
DeleteObject(ClipRegion);
|
||||||
ClipRegion := 0;
|
ClipRegion := 0;
|
||||||
|
|
||||||
If (GC = nil) or (RGN = 0) then begin
|
If (RGN = 0) then begin
|
||||||
if GC<>nil then
|
|
||||||
SelectGDIRegion(DC);
|
SelectGDIRegion(DC);
|
||||||
end
|
end
|
||||||
else
|
else If IsValidGDIObject(RGN) then begin
|
||||||
If IsValidGDIObject(RGN) then begin
|
|
||||||
ClipRegion := CreateRegionCopy(RGN);
|
ClipRegion := CreateRegionCopy(RGN);
|
||||||
RegObj:=PGdiObject(ClipRegion)^.GDIRegionObject;
|
RegObj:=PGdiObject(ClipRegion)^.GDIRegionObject;
|
||||||
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
DCOrigin:=GetDCOffset(TDeviceContext(DC));
|
||||||
@ -8036,7 +7892,6 @@ begin
|
|||||||
{$endif}
|
{$endif}
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -8130,13 +7985,10 @@ begin
|
|||||||
Result := HBRUSH(CurrentBrush);
|
Result := HBRUSH(CurrentBrush);
|
||||||
if CurrentBrush<>PGDIObject(GDIObj) then begin
|
if CurrentBrush<>PGDIObject(GDIObj) then begin
|
||||||
CurrentBrush := PGDIObject(GDIObj);
|
CurrentBrush := PGDIObject(GDIObj);
|
||||||
if GC <> nil
|
gdk_gc_set_fill(GetGC, GDIBrushFill);
|
||||||
then begin
|
|
||||||
gdk_gc_set_fill(GC, GDIBrushFill);
|
|
||||||
case GDIBrushFill of
|
case GDIBrushFill of
|
||||||
GDK_STIPPLED: gdk_gc_set_stipple(GC, GDIBrushPixMap);
|
GDK_STIPPLED: gdk_gc_set_stipple(GetGC, GDIBrushPixMap);
|
||||||
GDK_TILED: gdk_gc_set_tile(GC, GDIBrushPixMap);
|
GDK_TILED: gdk_gc_set_tile(GetGC, GDIBrushPixMap);
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
end;
|
end;
|
||||||
@ -8150,8 +8002,7 @@ begin
|
|||||||
if CurrentFont<> PGDIObject(GDIObj) then begin
|
if CurrentFont<> PGDIObject(GDIObj) then begin
|
||||||
CurrentFont := PGDIObject(GDIObj);
|
CurrentFont := PGDIObject(GDIObj);
|
||||||
{$IfDef GTK1}
|
{$IfDef GTK1}
|
||||||
if GC <> nil then
|
gdk_gc_set_font(GetGC, PGdiObject(GDIObj)^.GDIFontObject);
|
||||||
gdk_gc_set_font(GC, PGdiObject(GDIObj)^.GDIFontObject);
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
Exclude(DCFlags,dcfTextMetricsValid);
|
Exclude(DCFlags,dcfTextMetricsValid);
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
@ -8165,7 +8016,7 @@ begin
|
|||||||
if CurrentPen<> PGDIObject(GDIObj) then begin
|
if CurrentPen<> PGDIObject(GDIObj) then begin
|
||||||
CurrentPen := PGDIObject(GDIObj);
|
CurrentPen := PGDIObject(GDIObj);
|
||||||
DCFlags:=DCFlags-[dcfPenSelected];
|
DCFlags:=DCFlags-[dcfPenSelected];
|
||||||
if GC <> nil then SelectGDKPenProps(DC);
|
SelectGDKPenProps(DC);
|
||||||
SelectedColors := dcscCustom;
|
SelectedColors := dcscCustom;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -8174,10 +8025,7 @@ begin
|
|||||||
with TDeviceContext(DC) do
|
with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
Result := ClipRegion;
|
Result := ClipRegion;
|
||||||
if GC <> nil then
|
|
||||||
SelectClipRGN(DC, GDIObj)
|
SelectClipRGN(DC, GDIObj)
|
||||||
else
|
|
||||||
ClipRegion:=0;
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
else
|
else
|
||||||
@ -8189,8 +8037,7 @@ begin
|
|||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
end;
|
end;
|
||||||
|
|
||||||
//DebugLn('[TGtkWidgetSet.SelectObject] GDI=',DbgS(GDIObj)
|
//DebugLn('[TGtkWidgetSet.SelectObject] GDI=',DbgS(GDIObj),' Old=',DbgS(Result));
|
||||||
// ,' Old=',DbgS(Result));
|
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{------------------------------------------------------------------------------
|
{------------------------------------------------------------------------------
|
||||||
@ -8931,16 +8778,12 @@ end;
|
|||||||
------------------------------------------------------------------------------}
|
------------------------------------------------------------------------------}
|
||||||
Function TGtkWidgetSet.SetROP2(DC: HDC; Mode: Integer) : Integer;
|
Function TGtkWidgetSet.SetROP2(DC: HDC; Mode: Integer) : Integer;
|
||||||
Begin
|
Begin
|
||||||
if IsValidDC(DC) then with TDeviceContext(DC) do begin
|
if IsValidDC(DC)
|
||||||
if GC=nil then begin
|
then with TDeviceContext(DC) do begin
|
||||||
Assert(False, 'Trace:[TGtkWidgetSet.SetROP2] Uninitialized GC');
|
|
||||||
result := 0
|
|
||||||
end else begin
|
|
||||||
Result := GetROP2(DC);
|
Result := GetROP2(DC);
|
||||||
gdk_gc_set_function(GC, ROP2ModeToGdkFunction(Mode));
|
gdk_gc_set_function(GetGC, ROP2ModeToGdkFunction(Mode));
|
||||||
end;
|
|
||||||
end else begin
|
end else begin
|
||||||
Assert(False, 'Trace:[TGtkWidgetSet.SetROP2] Invalid GC');
|
Assert(False, 'Trace:[TGtkWidgetSet.SetROP2] Invalid DC');
|
||||||
Result := 0;
|
Result := 0;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -9668,11 +9511,6 @@ begin
|
|||||||
if Result and (Count>0)
|
if Result and (Count>0)
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtkWidgetSet.TextOut] Uninitialized GC');
|
|
||||||
end
|
|
||||||
else begin
|
|
||||||
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
||||||
then begin
|
then begin
|
||||||
UseFont := GetDefaultGtkFont(false);
|
UseFont := GetDefaultGtkFont(false);
|
||||||
@ -9713,7 +9551,7 @@ begin
|
|||||||
SelectGDKTextProps(DC);
|
SelectGDKTextProps(DC);
|
||||||
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDK}BeginGDKErrorTrap;{$ENDIF}
|
||||||
gdk_draw_text(Drawable, UseFont,
|
gdk_draw_text(Drawable, UseFont,
|
||||||
GC, TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
|
GetGC, TxtPt.X+DCOrigin.X, TxtPt.Y+DCOrigin.Y, Str, Count);
|
||||||
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
{$IFDEF DebugGDKTraps}EndGDKErrorTrap;{$ENDIF}
|
||||||
If Underline or StrikeOut then begin
|
If Underline or StrikeOut then begin
|
||||||
{Create & select pen of font color}
|
{Create & select pen of font color}
|
||||||
@ -9745,7 +9583,6 @@ begin
|
|||||||
Result := True;
|
Result := True;
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
end;
|
|
||||||
end;
|
end;
|
||||||
{$EndIf}
|
{$EndIf}
|
||||||
|
|
||||||
|
@ -337,7 +337,7 @@ var
|
|||||||
CharLen:=UTF8CharacterLength(CurStr);
|
CharLen:=UTF8CharacterLength(CurStr);
|
||||||
//gdk_draw_glyphs(DevCtx.drawable,DevCtx.gc );
|
//gdk_draw_glyphs(DevCtx.drawable,DevCtx.gc );
|
||||||
pango_layout_set_text(UseFont, CurStr, CharLen);
|
pango_layout_set_text(UseFont, CurStr, CharLen);
|
||||||
gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.gc, CurScreenX, Y,
|
gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.GC, CurScreenX, Y,
|
||||||
UseFont, Foreground, nil);
|
UseFont, Foreground, nil);
|
||||||
//gdk_draw_rectangle(DevCtx.Drawable,DevCtx.GC,1,CurScreenX,Y,3,3);
|
//gdk_draw_rectangle(DevCtx.Drawable,DevCtx.GC,1,CurScreenX,Y,3,3);
|
||||||
inc(CurScreenX,CurDx^);
|
inc(CurScreenX,CurDx^);
|
||||||
@ -347,7 +347,7 @@ var
|
|||||||
end;
|
end;
|
||||||
end else begin
|
end else begin
|
||||||
pango_layout_set_text(UseFont, Str, Count);
|
pango_layout_set_text(UseFont, Str, Count);
|
||||||
gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.gc, X, Y, UseFont,
|
gdk_draw_layout_with_colors(DevCtx.drawable, DevCtx.GC, X, Y, UseFont,
|
||||||
Foreground, nil);
|
Foreground, nil);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -359,12 +359,7 @@ begin
|
|||||||
if Result
|
if Result
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
GetGC; // create GC
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtk2WidgetSet.ExtTextOut] Uninitialized GC');
|
|
||||||
Result := False;
|
|
||||||
exit;
|
|
||||||
end;
|
|
||||||
if ((Options and (ETO_OPAQUE+ETO_CLIPPED)) <> 0)
|
if ((Options and (ETO_OPAQUE+ETO_CLIPPED)) <> 0)
|
||||||
and (Rect=nil) then begin
|
and (Rect=nil) then begin
|
||||||
DebugLn('WARNING: [TGtk2WidgetSet.ExtTextOut] Rect=nil');
|
DebugLn('WARNING: [TGtk2WidgetSet.ExtTextOut] Rect=nil');
|
||||||
@ -521,11 +516,6 @@ begin
|
|||||||
if Result and (Count>0)
|
if Result and (Count>0)
|
||||||
then with TDeviceContext(DC) do
|
then with TDeviceContext(DC) do
|
||||||
begin
|
begin
|
||||||
if GC = nil
|
|
||||||
then begin
|
|
||||||
DebugLn('WARNING: [TGtk2WidgetSet.TextOut] Uninitialized GC');
|
|
||||||
exit(false);
|
|
||||||
end;
|
|
||||||
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
if (CurrentFont = nil) or (CurrentFont^.GDIFontObject = nil)
|
||||||
then begin
|
then begin
|
||||||
UseFont := GetDefaultGtkFont(false);
|
UseFont := GetDefaultGtkFont(false);
|
||||||
@ -552,7 +542,7 @@ begin
|
|||||||
EnsureGCColor(DC, dccCurrentTextColor, True, False);
|
EnsureGCColor(DC, dccCurrentTextColor, True, False);
|
||||||
|
|
||||||
//DebugLn(['TGtk2WidgetSet.TextOut Str="',copy(Str,1,Count),'" X=',X+DCOrigin.X,',',Y+DCOrigin.Y+yOffset]);
|
//DebugLn(['TGtk2WidgetSet.TextOut Str="',copy(Str,1,Count),'" X=',X+DCOrigin.X,',',Y+DCOrigin.Y+yOffset]);
|
||||||
gdk_draw_layout_with_colors(drawable, GC,
|
gdk_draw_layout_with_colors(drawable, GetGC,
|
||||||
X+DCOrigin.X, Y+DCOrigin.Y+yOffset, UseFont, nil, nil);
|
X+DCOrigin.X, Y+DCOrigin.Y+yOffset, UseFont, nil, nil);
|
||||||
|
|
||||||
Result := True;
|
Result := True;
|
||||||
|
Loading…
Reference in New Issue
Block a user