LCL-GTK3: Simplify property access. Issue #36463, patch from CudaText man.

git-svn-id: trunk@62428 -
This commit is contained in:
juha 2019-12-21 08:54:59 +00:00
parent 9aaa7c7143
commit 64abb45aee
2 changed files with 15 additions and 83 deletions

View File

@ -193,15 +193,8 @@ type
FvClipRect: TRect; FvClipRect: TRect;
FCurrentPen: TGtk3Pen; FCurrentPen: TGtk3Pen;
FBkMode: Integer; FBkMode: Integer;
function GetBkMode: Integer;
function getBrush: TGtk3Brush;
function GetFont: TGtk3Font;
function GetOffset: TPoint; function GetOffset: TPoint;
function getPen: TGtk3Pen;
function GetvImage: TGtk3Image;
procedure SetBkMode(AValue: Integer);
procedure setBrush(AValue: TGtk3Brush); procedure setBrush(AValue: TGtk3Brush);
procedure SetCurrentTextColor(AValue: TColorRef);
procedure SetFont(AValue: TGtk3Font); procedure SetFont(AValue: TGtk3Font);
procedure SetOffset(AValue: TPoint); procedure SetOffset(AValue: TPoint);
procedure setPen(AValue: TGtk3Pen); procedure setPen(AValue: TGtk3Pen);
@ -260,29 +253,25 @@ type
function MoveTo(const X, Y: Integer; OldPoint: PPoint): Boolean; function MoveTo(const X, Y: Integer; OldPoint: PPoint): Boolean;
function SetClipRegion(ARgn: TGtk3Region): Integer; function SetClipRegion(ARgn: TGtk3Region): Integer;
procedure SetSourceColor(AColor: TColor); procedure SetSourceColor(AColor: TColor);
procedure SetCurrentBrush(ABrush: TGtk3Brush);
procedure SetCurrentFont(AFont: TGtk3Font);
procedure SetCurrentPen(APen: TGtk3Pen);
procedure SetCurrentImage(AImage: TGtk3Image);
procedure SetImage(AImage: TGtk3Image); procedure SetImage(AImage: TGtk3Image);
function ResetClip: Integer; function ResetClip: Integer;
procedure TranslateCairoToDevice; procedure TranslateCairoToDevice;
procedure Translate(APoint: TPoint); procedure Translate(APoint: TPoint);
property BkMode: Integer read GetBkMode write SetBkMode; property BkMode: Integer read FBkMode write FBkMode;
property CanRelease: Boolean read FCanRelease write FCanRelease; property CanRelease: Boolean read FCanRelease write FCanRelease;
property CurrentBrush: TGtk3Brush read FCurrentBrush; property CurrentBrush: TGtk3Brush read FCurrentBrush write FCurrentBrush;
property CurrentFont: TGtk3Font read FCurrentFont; property CurrentFont: TGtk3Font read FCurrentFont write FCurrentFont;
property CurrentImage: TGtk3Image read FCurrentImage; property CurrentImage: TGtk3Image read FCurrentImage write FCurrentImage;
property CurrentPen: TGtk3Pen read FCurrentPen; property CurrentPen: TGtk3Pen read FCurrentPen write FCurrentPen;
property CurrentRegion: TGtk3Region read FCurrentRegion; property CurrentRegion: TGtk3Region read FCurrentRegion;
property CurrentTextColor: TColorRef read FCurrentTextColor write SetCurrentTextColor; property CurrentTextColor: TColorRef read FCurrentTextColor write FCurrentTextColor;
property Offset: TPoint read GetOffset write SetOffset; property Offset: TPoint read GetOffset write SetOffset;
property OwnsSurface: Boolean read FOwnsSurface; property OwnsSurface: Boolean read FOwnsSurface;
property vBrush: TGtk3Brush read getBrush write setBrush; property vBrush: TGtk3Brush read FBrush write setBrush;
property vClipRect: TRect read FvClipRect write FvClipRect; property vClipRect: TRect read FvClipRect write FvClipRect;
property vFont: TGtk3Font read GetFont write SetFont; property vFont: TGtk3Font read FFont write SetFont;
property vImage: TGtk3Image read GetvImage write SetvImage; property vImage: TGtk3Image read FvImage write SetvImage;
property vPen: TGtk3Pen read getPen write setPen; property vPen: TGtk3Pen read FPen write setPen;
end; end;
function CheckBitmap(const ABitmap: HBITMAP; const AMethodName: String; function CheckBitmap(const ABitmap: HBITMAP; const AMethodName: String;
@ -934,21 +923,6 @@ end;
{ TGtk3DeviceContext } { TGtk3DeviceContext }
function TGtk3DeviceContext.getBrush: TGtk3Brush;
begin
Result := FBrush;
end;
function TGtk3DeviceContext.GetBkMode: Integer;
begin
Result := FBkMode;
end;
function TGtk3DeviceContext.GetFont: TGtk3Font;
begin
Result := FFont;
end;
function TGtk3DeviceContext.GetOffset: TPoint; function TGtk3DeviceContext.GetOffset: TPoint;
var var
dx,dy: Double; dx,dy: Double;
@ -957,21 +931,6 @@ begin
Result := Point(Round(dx), Round(dy)); Result := Point(Round(dx), Round(dy));
end; end;
function TGtk3DeviceContext.getPen: TGtk3Pen;
begin
Result := FPen;
end;
function TGtk3DeviceContext.GetvImage: TGtk3Image;
begin
Result := FvImage;
end;
procedure TGtk3DeviceContext.SetBkMode(AValue: Integer);
begin
FBkMode := AValue;
end;
procedure TGtk3DeviceContext.setBrush(AValue: TGtk3Brush); procedure TGtk3DeviceContext.setBrush(AValue: TGtk3Brush);
begin begin
if Assigned(FBrush) then if Assigned(FBrush) then
@ -979,12 +938,6 @@ begin
FBrush := AValue; FBrush := AValue;
end; end;
procedure TGtk3DeviceContext.SetCurrentTextColor(AValue: TColorRef);
begin
if FCurrentTextColor=AValue then Exit;
FCurrentTextColor:=AValue;
end;
procedure TGtk3DeviceContext.SetFont(AValue: TGtk3Font); procedure TGtk3DeviceContext.SetFont(AValue: TGtk3Font);
begin begin
if Assigned(FFont) then if Assigned(FFont) then
@ -1053,7 +1006,6 @@ begin
AFont := FCurrentFont AFont := FCurrentFont
else else
AFont := FFont; AFont := FFont;
end; end;
procedure TGtk3DeviceContext.ApplyPen; procedure TGtk3DeviceContext.ApplyPen;
@ -1702,7 +1654,7 @@ begin
begin begin
ATempBrush := FCurrentBrush; ATempBrush := FCurrentBrush;
fBkMode := OPAQUE; fBkMode := OPAQUE;
SetCurrentBrush(TGtk3Brush(ABrush)); CurrentBrush:= TGtk3Brush(ABrush);
end; end;
applyBrush; applyBrush;
@ -1715,7 +1667,7 @@ begin
cairo_stroke(Widget); cairo_stroke(Widget);
if ABrush <> 0 then if ABrush <> 0 then
SetCurrentBrush(ATempBrush); CurrentBrush:= ATempBrush;
finally finally
cairo_restore(Widget); cairo_restore(Widget);
end; end;
@ -1924,26 +1876,6 @@ begin
cairo_set_source_rgb(Widget, R, G, B); cairo_set_source_rgb(Widget, R, G, B);
end; end;
procedure TGtk3DeviceContext.SetCurrentBrush(ABrush: TGtk3Brush);
begin
FCurrentBrush := ABrush;
end;
procedure TGtk3DeviceContext.SetCurrentFont(AFont: TGtk3Font);
begin
FCurrentFont := AFont;
end;
procedure TGtk3DeviceContext.SetCurrentPen(APen: TGtk3Pen);
begin
FCurrentPen := APen;
end;
procedure TGtk3DeviceContext.SetCurrentImage(AImage: TGtk3Image);
begin
FCurrentImage := AImage;
end;
procedure TGtk3DeviceContext.SetImage(AImage: TGtk3Image); procedure TGtk3DeviceContext.SetImage(AImage: TGtk3Image);
var var
APixBuf: PGdkPixbuf; APixBuf: PGdkPixbuf;

View File

@ -3481,18 +3481,18 @@ begin
begin begin
// DebugLn('TGtk3WidgetSet.SelectObject PEN '); // DebugLn('TGtk3WidgetSet.SelectObject PEN ');
Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentPen); Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentPen);
TGtk3DeviceContext(DC).SetCurrentPen(TGtk3Pen(GDIObj)); TGtk3DeviceContext(DC).CurrentPen:= TGtk3Pen(GDIObj);
end else end else
if TObject(GDIObj) is TGtk3Brush then if TObject(GDIObj) is TGtk3Brush then
begin begin
Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentBrush); Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentBrush);
// DebugLn('TGtk3WidgetSet.SelectObject BRUSH ',dbgHex(Result),' ',TimeToStr(Now())); // DebugLn('TGtk3WidgetSet.SelectObject BRUSH ',dbgHex(Result),' ',TimeToStr(Now()));
TGtk3DeviceContext(DC).SetCurrentBrush(TGtk3Brush(GDIObj)); TGtk3DeviceContext(DC).CurrentBrush:= TGtk3Brush(GDIObj);
end else end else
if TObject(GDIObj) is TGtk3Font then if TObject(GDIObj) is TGtk3Font then
begin begin
Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentFont); Result := HGDIOBJ(TGtk3DeviceContext(DC).CurrentFont);
TGtk3DeviceContext(DC).SetCurrentFont(TGtk3Font(GDIObj)); TGtk3DeviceContext(DC).CurrentFont:= TGtk3Font(GDIObj);
// DebugLn('TGtk3WidgetSet.SelectObject Font '); // DebugLn('TGtk3WidgetSet.SelectObject Font ');
end else end else
if TObject(GDIObj) is TGtk3Region then if TObject(GDIObj) is TGtk3Region then