lcl: using fpcanvas EndCap

git-svn-id: trunk@40239 -
This commit is contained in:
mattias 2013-02-10 12:22:05 +00:00
parent b4a29891b3
commit 9860bb1ef1
5 changed files with 34 additions and 8 deletions

View File

@ -5,7 +5,7 @@ unit SynGutterChanges;
interface
uses
Classes, Graphics, LCLType, LCLIntf, SynGutterBase;
Classes, FPCanvas, Graphics, LCLType, LCLIntf, SynGutterBase;
type
{ TSynGutterChanges }

View File

@ -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

View File

@ -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,

View File

@ -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;

View File

@ -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;