LazReport, enable mixing round and squared corners in roundrect object, fix changing roundrect object properties in obj. insp. were not reflected in designer

git-svn-id: trunk@33903 -
This commit is contained in:
jesus 2011-12-02 08:31:09 +00:00
parent 7c2dbbb1e0
commit babc60c98f
15 changed files with 272 additions and 55 deletions

View File

@ -2217,6 +2217,10 @@ msgstr "Senkrecht,Waagerecht,Elliptisch,Rechteckig,Horiz.-Zentr.,Vert.-Zentr."
msgid "Variables ..."
msgstr "Variablen ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "RTF-Datei"

View File

@ -2206,6 +2206,10 @@ msgstr "Vertical,Horizontal,Elíptica,Rectángulo,Centro_Horiz.,Centro_Vert."
msgid "Variables ..."
msgstr ""
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr "Esquinas cuadradas"
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Archivo Rich Text"

View File

@ -2215,6 +2215,10 @@ msgstr "Vertical,Horizontal,Elliptique,Rectangle,Horiz._Centré,Vert._Centré"
msgid "Variables ..."
msgstr "Variables ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Fichier RTF"

View File

@ -2206,6 +2206,10 @@ msgstr "Vertical,Horizontal,Elliptic,Rectangle,Horiz._Center,Vert._Center"
msgid "Variables ..."
msgstr "Variabel ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "File Rich Text"

View File

@ -2208,6 +2208,10 @@ msgstr "Verticale, Orizzontale, Ellittico, Rettangolo, Centra_Orizz.Centra_Vert.
msgid "Variables ..."
msgstr "Variabili..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "File RTF"

View File

@ -2208,6 +2208,10 @@ msgstr "Vertikalus,Horizontalus,Elipsinis,Stačiakampis,Horizontalus_centras,Ver
msgid "Variables ..."
msgstr "Kintamieji..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Raiškiojo teksto failas"

View File

@ -2209,6 +2209,10 @@ msgstr ""
msgid "Variables ..."
msgstr "Zmienne..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Plik RTF"

View File

@ -2201,6 +2201,10 @@ msgstr ""
msgid "Variables ..."
msgstr ""
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr ""

View File

@ -2206,6 +2206,10 @@ msgstr "Vertical,Horizontal,Elíptico,Retângulo,Centro_Horiz.,Centro_Vert."
msgid "Variables ..."
msgstr "Variáveis ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Arquivo Rich Text"

View File

@ -2206,6 +2206,10 @@ msgstr "Vertical,Horizontal,Elíptico,Retângulo,Centro_Horiz.,Centro_Vert."
msgid "Variables ..."
msgstr "Variáveis ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Arquivo Rich Text"

View File

@ -2206,6 +2206,10 @@ msgstr "Вертикальный,Горизонтальный,Эллиптиче
msgid "Variables ..."
msgstr "Переменные..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Файл Rich Text"

View File

@ -2206,6 +2206,10 @@ msgstr "Вертикальний, Горизонтальний, Еліптичн
msgid "Variables ..."
msgstr "Змінні ..."
#: lr_const.sroundrectsqrcorners
msgid "Squared corners"
msgstr ""
#: lr_const.srtffile
msgid "Rich Text file"
msgstr "Файл Rich Text"

View File

@ -34,6 +34,7 @@ resourcestring
sRoundRectFormStyle='Style';
sRoundRectFormStyleDif='Vertical,Horizontal,Elliptic,Rectangle,Horiz._Center,Vert._Center';
sRoundRectFormHint='Click here to define the shadow color or gradian colors';
sRoundRectSqrCorners='Squared corners';
//--- PgoptForm resources -----------------------------------------------------
sPgoptFormCapt = 'Page options';

View File

@ -1,7 +1,7 @@
object frRoundRectForm: TfrRoundRectForm
Left = 262
Left = 162
Height = 284
Top = 162
Top = 182
Width = 562
ActiveControl = panGrad
BorderStyle = bsDialog
@ -14,12 +14,12 @@ object frRoundRectForm: TfrRoundRectForm
OnKeyDown = FormKeyDown
OnShow = FormShow
Position = poScreenCenter
LCLVersion = '0.9.29'
LCLVersion = '0.9.31'
object lblSample: TLabel
Left = 360
Height = 15
Height = 14
Top = 8
Width = 44
Width = 35
Caption = 'Sample'
ParentColor = False
end
@ -44,7 +44,7 @@ object frRoundRectForm: TfrRoundRectForm
end
object imgSample: TImage
Left = 360
Height = 105
Height = 76
Top = 24
Width = 193
end
@ -100,9 +100,9 @@ object frRoundRectForm: TfrRoundRectForm
end
object cbGradian: TCheckBox
Left = 360
Height = 22
Top = 136
Width = 73
Height = 17
Top = 104
Width = 58
Caption = 'Gradian '
OnChange = cbGradianChange
OnClick = cbGradianClick
@ -110,43 +110,43 @@ object frRoundRectForm: TfrRoundRectForm
end
object panCurve: TPanel
Left = 360
Height = 117
Top = 160
Height = 149
Top = 128
Width = 197
BevelInner = bvRaised
BevelOuter = bvLowered
ClientHeight = 117
ClientHeight = 149
ClientWidth = 197
FullRepaint = False
TabOrder = 6
object lblSWidth: TLabel
Left = 9
Height = 15
Top = 41
Width = 114
Left = 12
Height = 14
Top = 36
Width = 93
Caption = 'Largeur de l''ombre '
ParentColor = False
end
object lblSColor: TLabel
Left = 8
Height = 15
Top = 67
Width = 49
Height = 14
Top = 103
Width = 41
Caption = 'Couleur '
ParentColor = False
end
object bcolor: TImage
Left = 128
Left = 136
Height = 25
Top = 64
Width = 57
Top = 100
Width = 49
OnClick = bColorClick
end
object cmShadow: TCheckBox
Left = 8
Height = 22
Top = 15
Width = 57
Height = 17
Top = 8
Width = 47
Caption = 'Curve'
Checked = True
OnClick = cmShadowClick
@ -155,8 +155,8 @@ object frRoundRectForm: TfrRoundRectForm
end
object sCurve: TEdit
Left = 136
Height = 20
Top = 12
Height = 21
Top = 8
Width = 49
OnChange = ShWidthChange
TabOrder = 1
@ -164,8 +164,8 @@ object frRoundRectForm: TfrRoundRectForm
end
object ShWidth: TEdit
Left = 136
Height = 20
Top = 37
Height = 21
Top = 33
Width = 49
OnChange = ShWidthChange
TabOrder = 2
@ -173,15 +173,55 @@ object frRoundRectForm: TfrRoundRectForm
end
object cbCadre: TCheckBox
Left = 8
Height = 22
Top = 90
Width = 108
Height = 17
Top = 126
Width = 87
Caption = 'Zone encadr e'
Checked = True
OnClick = cbCadreClick
State = cbChecked
TabOrder = 3
end
object lblSqrCorners: TLabel
Left = 13
Height = 14
Top = 68
Width = 65
Caption = 'lblSqrCorners'
ParentColor = False
end
object chkTL: TCheckBox
Left = 140
Height = 17
Top = 60
Width = 18
OnClick = chkTLClick
TabOrder = 4
end
object chkTR: TCheckBox
Left = 160
Height = 17
Top = 60
Width = 18
OnClick = chkTLClick
TabOrder = 5
end
object chkBL: TCheckBox
Left = 140
Height = 17
Top = 77
Width = 18
OnClick = chkTLClick
TabOrder = 6
end
object chkBR: TCheckBox
Left = 160
Height = 17
Top = 77
Width = 18
OnClick = chkTLClick
TabOrder = 7
end
end
object panGrad: TPanel
Left = 120
@ -196,9 +236,9 @@ object frRoundRectForm: TfrRoundRectForm
TabOrder = 7
object Label1: TLabel
Left = 8
Height = 15
Height = 14
Top = 77
Width = 54
Width = 45
Caption = 'End color'
ParentColor = False
end
@ -211,9 +251,9 @@ object frRoundRectForm: TfrRoundRectForm
end
object Label2: TLabel
Left = 8
Height = 15
Height = 14
Top = 49
Width = 61
Width = 51
Caption = 'Start color'
ParentColor = False
end
@ -227,18 +267,18 @@ object frRoundRectForm: TfrRoundRectForm
end
object Label3: TLabel
Left = 8
Height = 15
Height = 14
Top = 16
Width = 29
Width = 25
Caption = 'Style'
ParentColor = False
end
object cbStyle: TComboBox
Left = 64
Height = 29
Height = 21
Top = 12
Width = 121
ItemHeight = 0
ItemHeight = 13
Items.Strings = (
'Vertical'
'Horizontal'

View File

@ -53,8 +53,15 @@ type
wShadow : Integer; // Width of shadow
sCurve : Boolean; // RoundRect On/Off
wCurve : Integer; // Curve size
SqrTL : Boolean; // Squared top left corner
SqrBL : Boolean; // Squared bottom left corner
SqrBR : Boolean; // Squared bottom right corner
SqrTR : Boolean; // Squared top rigth corner
end;
TCorner = (ctTL,ctTR,ctBL,ctBR);
TCornerSet = set of TCorner;
{ TfrRoundRectView }
TfrRoundRectView = class(TfrMemoView)
@ -67,12 +74,21 @@ type
function GetShadowColor: TColor;
function GetShadowWidth: Integer;
function GetShowGrad: Boolean;
function GetSqrBottomLeft: boolean;
function GetSqrBottomRight: boolean;
function GetSqrTopLeft: boolean;
function GetSqrTopRight: boolean;
procedure SetGradStyle(const AValue: TGradientStyle);
procedure SetRoundRect(const AValue: boolean);
procedure SetRoundRectCurve(const AValue: Integer);
procedure SetShadowColor(const AValue: TColor);
procedure SetShadowWidth(const AValue: Integer);
procedure SetShowGrad(const AValue: Boolean);
procedure SetSqrBottomLeft(AValue: boolean);
procedure SetSqrBottomRight(AValue: boolean);
procedure SetSqrTopLeft(AValue: boolean);
procedure SetSqrTopRight(AValue: boolean);
function GetCorners: TCornerSet;
public
constructor Create; override;
procedure Assign(From: TfrView); override;
@ -91,10 +107,22 @@ type
property ShadowWidth : Integer read GetShadowWidth write SetShadowWidth;
property RoundRect : boolean read GetRoundRect write SetRoundRect;
property RoundRectCurve : Integer read GetRoundRectCurve write SetRoundRectCurve;
property SquaredTopLeft: boolean read GetSqrTopLeft write SetSqrTopLeft;
property SquaredBottomLeft: boolean read GetSqrBottomLeft write SetSqrBottomLeft;
property SquaredBottomRight: boolean read GetSqrBottomRight write SetSqrBottomRight;
property SquaredTopRight: boolean read GetSqrTopRight write SetSqrTopRight;
end;
// Editeur de propriétés
{ TfrRoundRectForm }
TfrRoundRectForm = class(TfrObjEditorForm)
chkTL: TCheckBox;
chkTR: TCheckBox;
chkBL: TCheckBox;
chkBR: TCheckBox;
lblSqrCorners: TLabel;
M1: TMemo;
Button5: TButton;
Button6: TButton;
@ -123,6 +151,7 @@ type
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure bColorClick(Sender: TObject);
procedure chkTLClick(Sender: TObject);
procedure ShWidthChange(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure cbCadreClick(Sender: TObject);
@ -141,6 +170,7 @@ type
procedure ChgColorButton(S: TObject; C: TColor);
procedure UpdateSample;
function GetCorners: TCornerSet;
public
{ Déclarations publiques }
procedure ShowEditor(t: TfrView); override;
@ -374,11 +404,7 @@ begin
end;
end;
type
TCorner = (ctTL,ctTR,ctBL,ctBR);
TCornerSet = set of TCorner;
procedure MixRoundRect(Canvas:TCanvas; X1, Y1, X2, Y2: integer; RX, RY: integer;
procedure MixedRoundRect(Canvas:TCanvas; X1, Y1, X2, Y2: integer; RX, RY: integer;
SqrCorners: TCornerSet);
var
Pts: PPoint;
@ -472,34 +498,103 @@ begin
Result:=fCadre.SGradian;
end;
function TfrRoundRectView.GetSqrBottomLeft: boolean;
begin
result := fCadre.SqrBL;
end;
function TfrRoundRectView.GetSqrBottomRight: boolean;
begin
result := fCadre.SqrBR;
end;
function TfrRoundRectView.GetSqrTopLeft: boolean;
begin
result := fCadre.SqrTL;
end;
function TfrRoundRectView.GetSqrTopRight: boolean;
begin
result := fCadre.SqrTR;
end;
procedure TfrRoundRectView.SetGradStyle(const AValue: TGradientStyle);
begin
BeforeChange;
fCadre.GradStyle:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetRoundRect(const AValue: boolean);
begin
BeforeChange;
fCadre.sCurve:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetRoundRectCurve(const AValue: Integer);
begin
BeforeChange;
fCadre.wCurve:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetShadowColor(const AValue: TColor);
begin
BeforeChange;
fCadre.SdColor:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetShadowWidth(const AValue: Integer);
begin
BeforeChange;
fCadre.wShadow:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetShowGrad(const AValue: Boolean);
begin
BeforeChange;
fCadre.SGradian:=aValue;
AfterChange;
end;
procedure TfrRoundRectView.SetSqrBottomLeft(AValue: boolean);
begin
BeforeChange;
fCadre.SqrBL:=AValue;
AfterChange;
end;
procedure TfrRoundRectView.SetSqrBottomRight(AValue: boolean);
begin
BeforeChange;
fCadre.SqrBR:=AValue;
AfterChange;
end;
procedure TfrRoundRectView.SetSqrTopLeft(AValue: boolean);
begin
BeforeChange;
fCadre.SqrTL:=AValue;
AfterChange;
end;
procedure TfrRoundRectView.SetSqrTopRight(AValue: boolean);
begin
BeforeChange;
fCadre.SqrTR:=AValue;
AfterChange;
end;
function TfrRoundRectView.GetCorners: TCornerSet;
begin
result := [];
if fCadre.SqrTL then Include(result, ctTL);
if fCadre.SqrBL then Include(result, ctBL);
if fCadre.SqrBR then Include(result, ctBR);
if fCadre.SqrTR then Include(result, ctTR);
end;
(********************************************************)
@ -519,6 +614,10 @@ begin
fCadre.wShadow := 6;
fCadre.sCurve := True;
fCadre.wCurve := 10;
fCadre.SqrTL := false;
fCadre.SqrBL := false;
fCadre.SqrBR := false;
fCadre.SqrTR := false;
finally
Endupdate;
end;
@ -552,6 +651,10 @@ begin
RestoreProperty('ShadowWidth',XML.GetValue(Path+'Data/ShadowWidth/Value',''));
RestoreProperty('RoundRect',XML.GetValue(Path+'Data/RoundRect/Value',''));
RestoreProperty('RoundRectCurve',XML.GetValue(Path+'Data/RoundRectCurve/Value',''));
RestoreProperty('SquaredTopLeft',XML.GetValue(Path+'Data/SquaredTopLeft/Value',''));
RestoreProperty('SquaredBottomLeft',XML.GetValue(Path+'Data/SquaredBottomLeft/Value',''));
RestoreProperty('SquaredBottomRight',XML.GetValue(Path+'Data/SquaredBottomRight/Value',''));
RestoreProperty('SquaredTopRight',XML.GetValue(Path+'Data/SquaredTopRight/Value',''));
end;
procedure TfrRoundRectView.SaveToXML(XML: TLrXMLConfig; const Path: String);
@ -564,8 +667,10 @@ begin
XML.SetValue(Path+'Data/ShadowWidth/Value', GetSaveProperty('ShadowWidth'));
XML.SetValue(Path+'Data/RoundRect/Value', GetSaveProperty('RoundRect'));
XML.SetValue(Path+'Data/RoundRectCurve/Value', GetSaveProperty('RoundRectCurve'));
XML.SetValue(Path+'Data/SquaredTopLeft/Value', GetSaveProperty('SquaredTopLeft'));
XML.SetValue(Path+'Data/SquaredBottomLeft/Value',GetSaveProperty('SquaredBottomLeft'));
XML.SetValue(Path+'Data/SquaredBottomRight/Value', GetSaveProperty('SquaredBottomRight'));
XML.SetValue(Path+'Data/SquaredTopRight/Value',GetSaveProperty('SquaredTopRight'));
end;
procedure TfrRoundRectView.CalcGaps;
@ -656,8 +761,7 @@ begin
if fCadre.sCurve then
begin
RoundRect(x + FSW, y + FSW, x + dx + 1, y + dy + 1, FCu, Fcu);
//MixRoundRect(Canvas, x + FSW, y + FSW, x + dx + 1, y + dy + 1, FCu, Fcu, [ctTL,ctBR]);
MixedRoundRect(Canvas, x + FSW, y + FSW, x + dx + 1, y + dy + 1, FCu, Fcu, GetCorners);
end
else
Rectangle(x + FSW, y + FSW, x + dx + 1, y + dy + 1);
@ -673,8 +777,7 @@ begin
Brush.Color := FillColor;
if fCadre.sCurve then
begin
RoundRect(x, y, x + dx + 1 - FSW, y + dy + 1 - FSW, FCu, Fcu);
//MixRoundRect(Canvas, x, y, x + dx + 1 - FSW, y + dy + 1 - FSW, FCu, Fcu,[ctTL,ctBR]);
MixedRoundRect(Canvas, x, y, x + dx + 1 - FSW, y + dy + 1 - FSW, FCu, Fcu, GetCorners);
end
else
Rectangle(x, y, x + dx + 1 - FSW, y + dy + 1 - FSW);
@ -706,6 +809,7 @@ begin
bColor3.Hint := bColor3.Hint;
BOk.Caption := sOk;
bCancel.Caption := sCancel;
lblSqrCorners.Caption := sRoundRectSqrCorners;
cbStyle.Items.CommaText := sRoundRectFormStyleDif;
for i := 0 to cbStyle.Items.Count - 1 do
@ -828,8 +932,8 @@ begin
CC.Brush.Color := fShadowColor;
if cmShadow.Checked then
CC.RoundRect(0 + FSW, 0 + FSW, imgSample.Width, imgSample.Height,
FCu, FCu)
MixedRoundRect(CC,0 + FSW, 0 + FSW, imgSample.Width, imgSample.Height,
FCu, FCu, GetCorners)
else
CC.Rectangle(0 + FSW, 0 + FSW, imgSample.Width, imgSample.Height);
@ -841,8 +945,8 @@ begin
CC.Brush.Color := fNormalColor;
if cmShadow.Checked then
CC.RoundRect(0, 0, imgSample.Width - FSW, imgSample.Height - FSW,
FCu, FCu)
MixedRoundRect(CC,0, 0, imgSample.Width - FSW, imgSample.Height - FSW,
FCu, FCu, GetCorners)
else
CC.Rectangle(0, 0, imgSample.Width - FSW, imgSample.Height - FSW);
end;
@ -851,6 +955,15 @@ begin
BM.Free;
end;
function TfrRoundRectForm.GetCorners: TCornerSet;
begin
result := [];
if chkTL.Checked then Include(result, ctTL);
if chkBL.Checked then Include(result, ctBL);
if chkBR.Checked then Include(result, ctBR);
if chkTR.Checked then Include(result, ctTR);
end;
procedure TfrRoundRectForm.bColorClick(Sender: TObject);
begin
if sender=nil then ;
@ -862,6 +975,12 @@ begin
end;
end;
procedure TfrRoundRectForm.chkTLClick(Sender: TObject);
begin
//
UpdateSample;
end;
procedure TfrRoundRectForm.ShWidthChange(Sender: TObject);
begin
if Sender is TEdit then
@ -933,6 +1052,10 @@ begin
cbCadre.Checked := (t.Frames<>[]);
cmShadow.Checked := fCadre.sCurve;
sCurve.Text := IntToStr(fCadre.wCurve);
chkTL.Checked := fCadre.SqrTL;
chkBL.Checked := fCadre.SqrBL;
chkBR.Checked := fCadre.SqrBR;
chkTR.Checked := fCadre.SqrTR;
end
else
begin //Gradian
@ -960,6 +1083,11 @@ begin
fCadre.wShadow := 6;
end;
fCadre.SqrTL := chkTL.Checked;
fCadre.SqrBL := chkBL.Checked;
fCadre.SqrBR := chkBR.Checked;
fCadre.SqrTR := chkTR.Checked;
fCadre.SGradian:=cbGradian.checked;
try