From 9860bb1ef1e55b583c62fa42f4a506336a0fd13b Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 10 Feb 2013 12:22:05 +0000 Subject: [PATCH] lcl: using fpcanvas EndCap git-svn-id: trunk@40239 - --- components/synedit/syngutterchanges.pas | 2 +- ide/syncolorattribeditor.pas | 2 +- ideintf/objectinspector.pp | 2 +- lcl/graphics.pp | 21 ++++++++++++++++++++- lcl/include/pen.inc | 15 +++++++++++---- 5 files changed, 34 insertions(+), 8 deletions(-) diff --git a/components/synedit/syngutterchanges.pas b/components/synedit/syngutterchanges.pas index e45a4852a7..209f5122a9 100644 --- a/components/synedit/syngutterchanges.pas +++ b/components/synedit/syngutterchanges.pas @@ -5,7 +5,7 @@ unit SynGutterChanges; interface uses - Classes, Graphics, LCLType, LCLIntf, SynGutterBase; + Classes, FPCanvas, Graphics, LCLType, LCLIntf, SynGutterBase; type { TSynGutterChanges } diff --git a/ide/syncolorattribeditor.pas b/ide/syncolorattribeditor.pas index 650d46b172..3da0635660 100644 --- a/ide/syncolorattribeditor.pas +++ b/ide/syncolorattribeditor.pas @@ -11,7 +11,7 @@ uses SynGutterChanges, SynEditMouseCmds, SynEditHighlighter, SynTextDrawer, DividerBevel, Laz2_XMLCfg, EditorOptions, IDEOptionsIntf, editor_general_options, IDEImagesIntf, LazarusIDEStrConsts, IDEProcs, typinfo, - LazConf, types, math; + LazConf, types, math, FPCanvas; type diff --git a/ideintf/objectinspector.pp b/ideintf/objectinspector.pp index 3a7a7ecf76..e96d3c86a8 100644 --- a/ideintf/objectinspector.pp +++ b/ideintf/objectinspector.pp @@ -36,7 +36,7 @@ uses // IMPORTANT: the object inspector is a tool and can be used in other programs // too. Don't put Lazarus IDE specific things here. // FCL - SysUtils, Types, Classes, TypInfo, contnrs, + SysUtils, Types, Classes, TypInfo, contnrs, FPCanvas, // LCL InterfaceBase, Forms, Buttons, Graphics, GraphType, LCLProc, StdCtrls, LCLType, LCLIntf, Controls, ComCtrls, ExtCtrls, LMessages, LResources, diff --git a/lcl/graphics.pp b/lcl/graphics.pp index ab9b6e1b49..d686bfc8ce 100644 --- a/lcl/graphics.pp +++ b/lcl/graphics.pp @@ -36,6 +36,11 @@ interface {$DEFINE HasFPCanvas1} {$ENDIF} +{$IF FPC_FULLVERSION>=20701} +{$DEFINE HasFPEndCap} +{$ENDIF} + + uses SysUtils, Math, Types, Classes, Contnrs, FPCAdds, LCLversion, FileUtil, @@ -168,6 +173,10 @@ const bsCross = FPCanvas.bsCross; bsDiagCross = FPCanvas.bsDiagCross; + pecRound = FPCanvas.pecRound; + pecSquare = FPCanvas.pecSquare; + pecFlat = FPCanvas.pecFlat; + type TFillStyle = TGraphicsFillStyle; TFillMode = (fmAlternate, fmWinding); @@ -573,11 +582,15 @@ type TPenMode = TFPPenMode; // pen end caps. valid only for geometric pens + {$IFDEF HasFPEndCap} + TPenEndCap = TFPPenEndCap; + {$ELSE} TPenEndCap = ( pecRound, pecSquare, pecFlat ); + {$ENDIF} // join style. valid only for geometric pens TPenJoinStyle = ( @@ -614,7 +627,9 @@ type TPen = class(TFPCustomPen) private FColor: TColor; + {$IFNDEF HasFPEndCap} FEndCap: TPenEndCap; + {$ENDIF} FCosmetic: Boolean; FJoinStyle: TPenJoinStyle; FPattern: TPenPattern; @@ -633,7 +648,7 @@ type procedure SetColor(const NewColor: TColor; const NewFPColor: TFPColor); virtual; procedure SetFPColor(const AValue: TFPColor); override; procedure SetColor(Value: TColor); - procedure SetEndCap(const AValue: TPenEndCap); + procedure SetEndCap(AValue: TPenEndCap); {$IFDEF HasFPEndCap}override;{$ENDIF} procedure SetJoinStyle(const AValue: TPenJoinStyle); procedure SetMode(Value: TPenMode); override; procedure SetStyle(Value: TPenStyle); override; @@ -650,7 +665,11 @@ type published property Color: TColor read FColor write SetColor default clBlack; property Cosmetic: Boolean read FCosmetic write SetCosmetic default True; + {$IFDEF HasFPEndCap} + property EndCap default pecRound; + {$ELSE} property EndCap: TPenEndCap read FEndCap write SetEndCap default pecRound; + {$ENDIF} property JoinStyle: TPenJoinStyle read FJoinStyle write SetJoinStyle default pjsRound; property Mode default pmCopy; property Style default psSolid; diff --git a/lcl/include/pen.inc b/lcl/include/pen.inc index fa3005eccc..bf99d82f27 100644 --- a/lcl/include/pen.inc +++ b/lcl/include/pen.inc @@ -214,10 +214,13 @@ constructor TPen.Create; begin inherited Create; DelayAllocate := True; - FEndCap := pecRound; FJoinStyle := pjsRound; FCosmetic := True; - FPattern := nil; + {$IFDEF HasFPEndCap} + inherited SetEndCap(pecRound); + {$ELSE} + FEndCap := pecRound; + {$ENDIF} inherited SetWidth(1); inherited SetStyle(psSolid); inherited SetMode(pmCopy); @@ -446,12 +449,16 @@ begin end; end; -procedure TPen.SetEndCap(const AValue: TPenEndCap); +procedure TPen.SetEndCap(AValue: TPenEndCap); begin if EndCap <> AValue then begin FreeReference; + {$IFDEF HasFPEndCap} + inherited SetEndCap(AValue); + {$ELSE} FEndCap := AValue; + {$ENDIF} Changed; end; end; @@ -504,7 +511,7 @@ begin FreeReference; inherited DoCopyProps(From); FCosmetic := APen.Cosmetic; - FEndCap := APen.EndCap; + EndCap := APen.EndCap; FJoinStyle := APen.JoinStyle; //TODO: query new parameters Changed;