From 67a1d35c1a1538cf918ebe4bdfa258b958107207 Mon Sep 17 00:00:00 2001 From: wp Date: Mon, 19 Apr 2021 21:11:37 +0000 Subject: [PATCH] TAChart: Refactor charteditor demo. git-svn-id: trunk@65025 - --- .../tachart/demo/charteditor/ceaxisdlg.lfm | 543 +++++------------- .../tachart/demo/charteditor/ceaxisdlg.pas | 160 +++++- .../tachart/demo/charteditor/cebrushframe.pas | 2 +- .../tachart/demo/charteditor/cefontframe.lfm | 174 +++--- .../tachart/demo/charteditor/cefontframe.pas | 5 +- .../tachart/demo/charteditor/celegenddlg.lfm | 53 +- .../tachart/demo/charteditor/celegenddlg.pas | 20 +- .../tachart/demo/charteditor/cepenframe.lfm | 1 + .../tachart/demo/charteditor/cepenframe.pas | 2 +- .../ceshapebrushpenmarginsframe.lfm | 129 ++--- .../ceshapebrushpenmarginsframe.pas | 59 +- .../demo/charteditor/cetitlefootdlg.lfm | 157 ++--- .../demo/charteditor/cetitlefootdlg.pas | 58 +- 13 files changed, 607 insertions(+), 756 deletions(-) diff --git a/components/tachart/demo/charteditor/ceaxisdlg.lfm b/components/tachart/demo/charteditor/ceaxisdlg.lfm index fdf8d14175..1367e38b5d 100644 --- a/components/tachart/demo/charteditor/ceaxisdlg.lfm +++ b/components/tachart/demo/charteditor/ceaxisdlg.lfm @@ -1,12 +1,13 @@ object AxisEditor: TAxisEditor - Left = 662 - Height = 487 - Top = 270 - Width = 548 + Left = 931 + Height = 524 + Top = 284 + Width = 535 ActiveControl = cbShow Caption = 'Axis title editor' - ClientHeight = 487 - ClientWidth = 548 + ClientHeight = 524 + ClientWidth = 535 + OnActivate = FormActivate OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy @@ -16,29 +17,29 @@ object AxisEditor: TAxisEditor object PageControl: TPageControl AnchorSideTop.Side = asrBottom Left = 6 - Height = 408 + Height = 445 Top = 33 - Width = 536 - ActivePage = pgTitle + Width = 523 + ActivePage = pgGrid Align = alClient BorderSpacing.Left = 6 BorderSpacing.Right = 6 - TabIndex = 0 + TabIndex = 2 TabOrder = 1 object pgTitle: TTabSheet Caption = 'Title' - ClientHeight = 380 - ClientWidth = 528 + ClientHeight = 417 + ClientWidth = 515 object TitleMemoPanel: TPanel - Left = 6 - Height = 159 - Top = 6 - Width = 516 + Left = 8 + Height = 190 + Top = 8 + Width = 499 Align = alClient - BorderSpacing.Around = 6 + BorderSpacing.Around = 8 BevelOuter = bvNone - ClientHeight = 159 - ClientWidth = 516 + ClientHeight = 190 + ClientWidth = 499 TabOrder = 0 object lblTitle: TLabel AnchorSideLeft.Control = TitleMemoPanel @@ -60,9 +61,9 @@ object AxisEditor: TAxisEditor AnchorSideBottom.Control = TitleMemoPanel AnchorSideBottom.Side = asrBottom Left = 0 - Height = 138 + Height = 169 Top = 21 - Width = 516 + Width = 499 Anchors = [akTop, akLeft, akRight, akBottom] BorderSpacing.Top = 4 OnChange = mmoTitleChange @@ -74,7 +75,7 @@ object AxisEditor: TAxisEditor AnchorSideTop.Side = asrCenter AnchorSideRight.Control = TitleMemoPanel AnchorSideRight.Side = asrBottom - Left = 462 + Left = 445 Height = 19 Top = 0 Width = 54 @@ -88,15 +89,15 @@ object AxisEditor: TAxisEditor end end object TitleParamsPanel: TPanel - Left = 6 + Left = 8 Height = 203 - Top = 171 - Width = 516 + Top = 206 + Width = 499 Align = alBottom - BorderSpacing.Around = 6 + BorderSpacing.Around = 8 BevelOuter = bvNone ClientHeight = 203 - ClientWidth = 516 + ClientWidth = 499 TabOrder = 1 object rgTitleAlignment: TRadioGroup AnchorSideLeft.Control = TitleParamsPanel @@ -106,12 +107,13 @@ object AxisEditor: TAxisEditor Left = 0 Height = 51 Top = 0 - Width = 249 + Width = 240 Anchors = [akTop, akLeft, akRight] AutoFill = True - BorderSpacing.InnerBorder = 6 + AutoSize = True Caption = 'Alignment' - ChildSizing.LeftRightSpacing = 6 + ChildSizing.LeftRightSpacing = 16 + ChildSizing.TopBottomSpacing = 6 ChildSizing.HorizontalSpacing = 16 ChildSizing.EnlargeHorizontal = crsHomogenousChildResize ChildSizing.EnlargeVertical = crsHomogenousChildResize @@ -120,7 +122,7 @@ object AxisEditor: TAxisEditor ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 3 ClientHeight = 31 - ClientWidth = 245 + ClientWidth = 236 Columns = 3 ItemIndex = 0 Items.Strings = ( @@ -139,38 +141,11 @@ object AxisEditor: TAxisEditor Left = 0 Height = 104 Top = 59 - Width = 249 + Width = 240 Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 8 - Caption = 'Font' - ClientHeight = 84 - ClientWidth = 245 + Caption = 'gbTitleFont' TabOrder = 1 - inline TitleFontFrame: TFontFrame - Left = 8 - Height = 76 - Width = 229 - Align = alClient - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 76 - ClientWidth = 229 - inherited cmbFontName: TComboBox - AnchorSideLeft.Control = TitleFontFrame - AnchorSideTop.Control = TitleFontFrame - AnchorSideRight.Control = TitleFontFrame - Width = 229 - end - inherited cbFontColor: TColorButton - AnchorSideRight.Control = TitleFontFrame - Left = 197 - end - inherited cbBold: TCheckBox - AnchorSideLeft.Control = TitleFontFrame - end - end end object gbTitleShapeBrushPenMargins: TGroupBox AnchorSideLeft.Control = Bevel1 @@ -178,59 +153,19 @@ object AxisEditor: TAxisEditor AnchorSideTop.Control = rgTitleAlignment AnchorSideRight.Control = TitleParamsPanel AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = TitleParamsPanel AnchorSideBottom.Side = asrBottom - Left = 267 - Height = 203 + Left = 258 + Height = 163 Top = 0 - Width = 249 - Anchors = [akTop, akLeft, akRight, akBottom] - Caption = 'Title background' - ClientHeight = 183 - ClientWidth = 245 + Width = 241 + Anchors = [akTop, akLeft, akRight] + Caption = 'gbTitleShapeBrushPenMargins' TabOrder = 3 - inline TitleShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame - Left = 8 - Height = 175 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 175 - inherited cmbShape: TComboBox - AnchorSideLeft.Control = TitleShapeBrushPenMarginsFrame - AnchorSideTop.Control = TitleShapeBrushPenMarginsFrame - AnchorSideRight.Control = TitleShapeBrushPenMarginsFrame - end - inherited gbBackground: TGroupBox - AnchorSideLeft.Control = TitleShapeBrushPenMarginsFrame - end - inherited gbBorder: TGroupBox - AnchorSideRight.Control = TitleShapeBrushPenMarginsFrame - end - inherited gbMargins: TGroupBox - AnchorSideBottom.Control = TitleShapeBrushPenMarginsFrame - Height = 83 - ClientHeight = 63 - inherited seBottomMargin: TSpinEdit - Top = 32 - end - inherited seLeftMargin: TSpinEdit - Top = 16 - end - inherited seRightMargin: TSpinEdit - Top = 16 - end - inherited Bevel2: TBevel - Height = 1 - end - end - end end object Bevel1: TBevel AnchorSideLeft.Control = TitleParamsPanel AnchorSideLeft.Side = asrCenter - Left = 249 + Left = 240 Height = 50 Top = 32 Width = 18 @@ -242,21 +177,24 @@ object AxisEditor: TAxisEditor AnchorSideTop.Side = asrCenter Left = 0 Height = 15 - Top = 175 + Top = 183 Width = 45 Caption = 'Distance' FocusControl = seTitleDistance ParentColor = False end object seTitleDistance: TSpinEdit + AnchorSideLeft.Control = lblTitleDistance + AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = gbTitleFont AnchorSideTop.Side = asrBottom - Left = 72 + Left = 53 Height = 23 - Top = 171 + Top = 179 Width = 58 Alignment = taRightJustify - BorderSpacing.Top = 8 + BorderSpacing.Left = 8 + BorderSpacing.Top = 16 OnChange = seTitleDistanceChange TabOrder = 2 end @@ -264,23 +202,23 @@ object AxisEditor: TAxisEditor end object pgLabels: TTabSheet Caption = 'Labels' - ClientHeight = 380 - ClientWidth = 540 + ClientHeight = 417 + ClientWidth = 515 object gbAxisRange: TGroupBox AnchorSideLeft.Control = pgLabels AnchorSideTop.Control = pgLabels AnchorSideRight.Control = Bevel2 - Left = 6 + Left = 8 Height = 150 - Top = 6 - Width = 256 + Top = 8 + Width = 241 Anchors = [akTop, akLeft, akRight] AutoSize = True - BorderSpacing.Left = 6 - BorderSpacing.Top = 6 + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 Caption = 'Axis limits' ClientHeight = 130 - ClientWidth = 252 + ClientWidth = 237 TabOrder = 0 object lblAutomatic: TLabel AnchorSideLeft.Control = gbAxisRange @@ -330,7 +268,7 @@ object AxisEditor: TAxisEditor Left = 129 Height = 23 Top = 29 - Width = 99 + Width = 84 Alignment = taRightJustify Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 24 @@ -348,7 +286,7 @@ object AxisEditor: TAxisEditor Left = 129 Height = 23 Top = 60 - Width = 99 + Width = 84 Alignment = taRightJustify Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 8 @@ -373,136 +311,49 @@ object AxisEditor: TAxisEditor object gbLabelFont: TGroupBox AnchorSideLeft.Control = Bevel2 AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = gbAxisRange AnchorSideRight.Control = pgLabels AnchorSideRight.Side = asrBottom - Left = 278 + Left = 265 Height = 104 Top = 8 - Width = 254 + Width = 242 Anchors = [akTop, akLeft, akRight] BorderSpacing.Right = 8 - Caption = 'Label font' - ClientHeight = 84 - ClientWidth = 250 + Caption = 'gbLabelFont' TabOrder = 3 - inline LabelFontFrame: TFontFrame - Left = 8 - Height = 84 - Width = 234 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - ClientHeight = 84 - ClientWidth = 234 - inherited cmbFontName: TComboBox - AnchorSideLeft.Control = LabelFontFrame - AnchorSideTop.Control = LabelFontFrame - AnchorSideRight.Control = LabelFontFrame - Width = 234 - end - inherited cbFontColor: TColorButton - AnchorSideRight.Control = LabelFontFrame - Left = 202 - end - inherited cbBold: TCheckBox - AnchorSideLeft.Control = LabelFontFrame - BorderSpacing.Bottom = 6 - end - inherited seOrientation: TSpinEdit - Alignment = taRightJustify - end - end end object gbShapeFillBorder: TGroupBox AnchorSideLeft.Control = Bevel2 AnchorSideLeft.Side = asrBottom - Left = 278 - Height = 236 - Top = 136 - Width = 267 - Caption = 'Label background' - ClientHeight = 216 - ClientWidth = 263 + AnchorSideTop.Control = gbLabelFont + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = gbLabelFont + AnchorSideRight.Side = asrBottom + Left = 265 + Height = 266 + Top = 128 + Width = 242 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 16 + Caption = 'gbShapeFillBorder' TabOrder = 4 - inline LabelShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame - Left = 8 - Height = 208 - Width = 247 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 208 - ClientWidth = 247 - inherited cmbShape: TComboBox - AnchorSideLeft.Control = LabelShapeBrushPenMarginsFrame - AnchorSideTop.Control = LabelShapeBrushPenMarginsFrame - AnchorSideRight.Control = LabelShapeBrushPenMarginsFrame - Width = 247 - end - inherited gbBackground: TGroupBox - AnchorSideLeft.Control = LabelShapeBrushPenMarginsFrame - Width = 116 - ClientWidth = 112 - inherited cbFillColor: TColorButton - Left = 72 - end - end - inherited gbBorder: TGroupBox - AnchorSideRight.Control = LabelShapeBrushPenMarginsFrame - Left = 131 - Width = 116 - ClientWidth = 112 - inherited cbBorderColor: TColorButton - Left = 74 - end - end - inherited gbMargins: TGroupBox - AnchorSideBottom.Control = LabelShapeBrushPenMarginsFrame - Height = 116 - Width = 247 - ClientHeight = 96 - ClientWidth = 243 - inherited seTopMargin: TSpinEdit - Left = 96 - end - inherited seBottomMargin: TSpinEdit - Left = 96 - Top = 65 - end - inherited seLeftMargin: TSpinEdit - Left = 38 - Top = 33 - end - inherited seRightMargin: TSpinEdit - Left = 154 - Top = 33 - end - inherited Bevel2: TBevel - Left = 96 - Height = 34 - end - end - inherited Bevel1: TBevel - Left = 123 - end - end end object gbLabels: TGroupBox AnchorSideLeft.Control = gbAxisRange AnchorSideTop.Control = gbAxisRange AnchorSideTop.Side = asrBottom AnchorSideRight.Control = Bevel2 - Left = 6 + Left = 8 Height = 113 - Top = 166 - Width = 256 + Top = 168 + Width = 241 Anchors = [akTop, akLeft, akRight] AutoSize = True BorderSpacing.Top = 10 Caption = 'Labels' ClientHeight = 93 - ClientWidth = 252 + ClientWidth = 237 TabOrder = 1 object cbLabelsVisible: TCheckBox AnchorSideLeft.Control = gbLabels @@ -527,7 +378,7 @@ object AxisEditor: TAxisEditor Left = 96 Height = 23 Top = 27 - Width = 140 + Width = 125 Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 35 BorderSpacing.Top = 6 @@ -555,8 +406,9 @@ object AxisEditor: TAxisEditor Left = 96 Height = 23 Top = 58 - Width = 66 + Width = 68 Alignment = taRightJustify + Anchors = [akTop, akLeft, akRight] BorderSpacing.Bottom = 12 OnChange = seLabelDistanceChange TabOrder = 2 @@ -577,7 +429,7 @@ object AxisEditor: TAxisEditor object Bevel2: TBevel AnchorSideLeft.Control = pgLabels AnchorSideLeft.Side = asrCenter - Left = 262 + Left = 249 Height = 50 Top = 280 Width = 16 @@ -589,25 +441,30 @@ object AxisEditor: TAxisEditor AnchorSideTop.Side = asrBottom AnchorSideRight.Control = gbLabels AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = gbShapeFillBorder AnchorSideBottom.Side = asrBottom - Left = 6 - Height = 83 - Top = 289 - Width = 256 - Anchors = [akTop, akLeft, akRight, akBottom] + Left = 8 + Height = 88 + Top = 291 + Width = 241 + Anchors = [akTop, akLeft, akRight] + AutoSize = True BorderSpacing.Top = 10 + BorderSpacing.Bottom = 8 Caption = 'Ticks' - ClientHeight = 63 - ClientWidth = 252 + ClientHeight = 68 + ClientWidth = 237 TabOrder = 2 object seTickLength: TSpinEdit + AnchorSideLeft.Control = lblTickLength + AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = gbTicks - Left = 96 + Left = 99 Height = 23 Top = 2 - Width = 66 + Width = 68 Alignment = taRightJustify + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 16 BorderSpacing.Top = 2 OnChange = seTickLengthChange TabOrder = 0 @@ -616,12 +473,14 @@ object AxisEditor: TAxisEditor AnchorSideLeft.Control = seTickLength AnchorSideTop.Control = seTickLength AnchorSideTop.Side = asrBottom - Left = 96 + Left = 99 Height = 23 Top = 33 - Width = 66 + Width = 68 Alignment = taRightJustify + Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 8 + BorderSpacing.Bottom = 12 OnChange = seTickInnerLengthChange TabOrder = 1 end @@ -650,9 +509,8 @@ object AxisEditor: TAxisEditor end object cbTickColor: TColorButton AnchorSideTop.Side = asrCenter - AnchorSideRight.Control = LabelShapeBrushPenMarginsFrame.gbBackground AnchorSideRight.Side = asrBottom - Left = 200 + Left = 185 Height = 25 Top = 20 Width = 32 @@ -667,140 +525,72 @@ object AxisEditor: TAxisEditor end object pgGrid: TTabSheet Caption = 'Grid' - ClientHeight = 380 - ClientWidth = 540 + ClientHeight = 417 + ClientWidth = 515 object gbGrid: TGroupBox AnchorSideLeft.Control = pgGrid AnchorSideTop.Control = pgGrid AnchorSideRight.Control = gbFrame AnchorSideRight.Side = asrBottom - Left = 16 + Left = 8 Height = 115 - Top = 16 - Width = 280 - Anchors = [akTop, akLeft, akRight] - AutoSize = True - BorderSpacing.Left = 16 - BorderSpacing.Top = 16 + Top = 8 + Width = 277 + BorderSpacing.Left = 8 + BorderSpacing.Top = 8 Caption = 'Grid lines' ClientHeight = 95 - ClientWidth = 276 + ClientWidth = 273 + Constraints.MinWidth = 277 TabOrder = 0 object cbGridVisible: TCheckBox - AnchorSideLeft.Control = gbGrid - AnchorSideTop.Control = gbGrid Left = 16 Height = 19 Top = 8 - Width = 54 + Width = 241 + Align = alTop BorderSpacing.Left = 16 BorderSpacing.Top = 8 - Caption = 'Visible' - OnChange = cbGridVisibleChange - TabOrder = 0 - end - inline GridPenFrame: TPenFrame - AnchorSideLeft.Control = cbGridVisible - AnchorSideTop.Control = cbGridVisible - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = gbGrid - AnchorSideRight.Side = asrBottom - Left = 16 - Height = 52 - Top = 35 - Width = 244 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 - ClientHeight = 52 - ClientWidth = 244 - TabOrder = 1 - inherited cbPenStyle: TChartComboBox - AnchorSideTop.Control = GridPenFrame - Width = 160 - end - inherited lblPenStyle: TLabel - AnchorSideLeft.Control = GridPenFrame - end - inherited cbPenWidth: TChartComboBox - Width = 160 - end - inherited cbPenColor: TColorButton - AnchorSideRight.Control = GridPenFrame - Left = 213 - end - inherited Bevel1: TBevel - Left = 208 - end + Caption = 'Visible' + OnChange = cbGridVisibleChange + TabOrder = 0 end end end object pgLine: TTabSheet Caption = 'Line' - ClientHeight = 380 - ClientWidth = 540 + ClientHeight = 417 + ClientWidth = 515 object gbFrame: TGroupBox AnchorSideLeft.Control = pgLine AnchorSideTop.Control = pgLine + AnchorSideRight.Control = gbArrow Left = 8 Height = 119 Top = 8 - Width = 288 + Width = 277 + Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 8 BorderSpacing.Top = 8 - Caption = 'Frame' + Caption = 'gbFrame' ClientHeight = 99 - ClientWidth = 284 + ClientWidth = 273 TabOrder = 0 object cbFrameVisible: TCheckBox - AnchorSideLeft.Control = gbFrame - AnchorSideTop.Control = gbFrame Left = 16 Height = 19 Top = 8 - Width = 54 + Width = 241 + Align = alTop BorderSpacing.Left = 16 BorderSpacing.Top = 8 - Caption = 'Visible' - OnChange = cbFrameVisibleChange - TabOrder = 0 - end - inline FramePenFrame: TPenFrame - AnchorSideLeft.Control = cbFrameVisible - AnchorSideTop.Control = cbFrameVisible - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = gbFrame - AnchorSideRight.Side = asrBottom - Left = 16 - Height = 52 - Top = 35 - Width = 252 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 - ClientHeight = 52 - ClientWidth = 252 - TabOrder = 1 - inherited cbPenStyle: TChartComboBox - AnchorSideTop.Control = FramePenFrame - Width = 167 - end - inherited lblPenStyle: TLabel - AnchorSideLeft.Control = FramePenFrame - end - inherited cbPenWidth: TChartComboBox - Width = 167 - end - inherited cbPenColor: TColorButton - AnchorSideRight.Control = nil - Left = 220 - Anchors = [akTop] - end - inherited Bevel1: TBevel - Left = 215 - end + Caption = 'Visible' + OnChange = cbFrameVisibleChange + TabOrder = 0 end end object gbAxisLine: TGroupBox @@ -810,78 +600,47 @@ object AxisEditor: TAxisEditor AnchorSideRight.Control = gbFrame AnchorSideRight.Side = asrBottom Left = 8 - Height = 115 + Height = 137 Top = 143 - Width = 288 + Width = 277 Anchors = [akTop, akLeft, akRight] - AutoSize = True BorderSpacing.Top = 16 - Caption = 'Axis line' - ClientHeight = 95 - ClientWidth = 284 + Caption = 'gbAxisLine' + ClientHeight = 117 + ClientWidth = 273 TabOrder = 1 object cbAxisLineVisible: TCheckBox - AnchorSideLeft.Control = gbAxisLine - AnchorSideTop.Control = gbAxisLine Left = 16 Height = 19 Top = 8 - Width = 54 + Width = 241 + Align = alTop BorderSpacing.Left = 16 BorderSpacing.Top = 8 - Caption = 'Visible' - OnChange = cbAxisLineVisibleChange - TabOrder = 0 - end - inline AxisLinePenFrame: TPenFrame - AnchorSideLeft.Control = cbAxisLineVisible - AnchorSideTop.Control = cbAxisLineVisible - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = gbAxisLine - AnchorSideRight.Side = asrBottom - Left = 16 - Height = 52 - Top = 35 - Width = 252 - Anchors = [akTop, akLeft, akRight] - BorderSpacing.Top = 8 BorderSpacing.Right = 16 BorderSpacing.Bottom = 8 - ClientHeight = 52 - ClientWidth = 252 - TabOrder = 1 - inherited cbPenStyle: TChartComboBox - AnchorSideTop.Control = AxisLinePenFrame - Width = 168 - end - inherited lblPenStyle: TLabel - AnchorSideLeft.Control = AxisLinePenFrame - end - inherited cbPenWidth: TChartComboBox - Width = 168 - end - inherited cbPenColor: TColorButton - AnchorSideRight.Control = AxisLinePenFrame - Left = 221 - end - inherited Bevel1: TBevel - Left = 216 - end + Caption = 'Visible' + OnChange = cbAxisLineVisibleChange + TabOrder = 0 end end object gbArrow: TGroupBox AnchorSideLeft.Control = gbFrame AnchorSideLeft.Side = asrBottom AnchorSideTop.Control = gbFrame - Left = 320 + AnchorSideRight.Control = pgLine + AnchorSideRight.Side = asrBottom + Left = 309 Height = 156 Top = 8 - Width = 187 + Width = 200 + Anchors = [akTop, akRight] AutoSize = True BorderSpacing.Left = 24 + BorderSpacing.Right = 6 Caption = 'Arrow' ClientHeight = 136 - ClientWidth = 183 + ClientWidth = 196 TabOrder = 2 object cbArrowVisible: TCheckBox AnchorSideLeft.Control = gbArrow @@ -937,7 +696,7 @@ object AxisEditor: TAxisEditor Left = 101 Height = 23 Top = 35 - Width = 66 + Width = 79 Alignment = taRightJustify BorderSpacing.Left = 24 BorderSpacing.Top = 8 @@ -954,7 +713,7 @@ object AxisEditor: TAxisEditor Left = 101 Height = 23 Top = 66 - Width = 66 + Width = 79 Alignment = taRightJustify Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 8 @@ -970,7 +729,7 @@ object AxisEditor: TAxisEditor Left = 101 Height = 23 Top = 97 - Width = 66 + Width = 79 Alignment = taRightJustify Anchors = [akTop, akLeft, akRight] BorderSpacing.Top = 8 @@ -985,12 +744,12 @@ object AxisEditor: TAxisEditor Left = 0 Height = 33 Top = 0 - Width = 548 + Width = 535 Align = alTop AutoSize = True BevelOuter = bvNone ClientHeight = 33 - ClientWidth = 548 + ClientWidth = 535 TabOrder = 0 object cbShow: TCheckBox AnchorSideLeft.Control = PanelTop @@ -1012,8 +771,8 @@ object AxisEditor: TAxisEditor object ButtonPanel: TButtonPanel Left = 6 Height = 34 - Top = 447 - Width = 536 + Top = 484 + Width = 523 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True OKButton.OnClick = OKButtonClick diff --git a/components/tachart/demo/charteditor/ceaxisdlg.pas b/components/tachart/demo/charteditor/ceaxisdlg.pas index 47737fb8b7..9efab44cbf 100644 --- a/components/tachart/demo/charteditor/ceaxisdlg.pas +++ b/components/tachart/demo/charteditor/ceaxisdlg.pas @@ -18,7 +18,6 @@ type TAxisEditor = class(TForm) ButtonPanel: TButtonPanel; - GridPenFrame: TPenFrame; Bevel1: TBevel; Bevel2: TBevel; Bevel3: TBevel; @@ -38,7 +37,6 @@ type cbFrameVisible: TCheckBox; cbArrowVisible: TCheckBox; edLabelFormat: TEdit; - AxisLinePenFrame: TPenFrame; gbAxisLine: TGroupBox; gbGrid: TGroupBox; gbTitleFont: TGroupBox; @@ -58,7 +56,6 @@ type lblTitleDistance: TLabel; lblTickLength: TLabel; lblTickInnerLength: TLabel; - FramePenFrame: TPenFrame; seTickLength: TSpinEdit; seTickInnerLength: TSpinEdit; seTitleDistance: TSpinEdit; @@ -67,8 +64,6 @@ type seArrowLength: TSpinEdit; seArrowWidth: TSpinEdit; pgGrid: TTabSheet; - TitleFontFrame: TFontFrame; - LabelFontFrame: TFontFrame; gbAxisRange: TGroupBox; lblLabelFormat: TLabel; PanelTop: TPanel; @@ -77,8 +72,6 @@ type lblAutomatic: TLabel; lblTitle: TLabel; mmoTitle: TMemo; - LabelShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame; - TitleShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame; TitleMemoPanel: TPanel; PageControl: TPageControl; TitleParamsPanel: TPanel; @@ -98,6 +91,7 @@ type procedure cbTickColorColorChanged(Sender: TObject); procedure cbTitleVisibleChange(Sender: TObject); procedure edLabelFormatEditingDone(Sender: TObject); + procedure FormActivate(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -119,13 +113,22 @@ type FAxis: TChartAxis; FOKClicked: Boolean; FSavedAxis: TChartAxis; + FTitleFontFrame: TFontFrame; + FTitleShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame; + FLabelFontFrame: TFontFrame; + FGridPenFrame: TPenFrame; + FFramePenFrame: TPenFrame; + FAxisLinePenFrame: TPenFrame; + FLabelShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame; function GetAlignment(AItemIndex: Integer): TAlignment; function GetAlignmentIndex(AValue: TAlignment): Integer; function GetPage: TAxisEditorPage; procedure SetPage(AValue: TAxisEditorPage); procedure ChangedHandler(Sender: TObject); + procedure LabelChangedHandler(Sender: TObject); procedure LabelFontChangedHandler(Sender: TObject); procedure LabelShapeChangedHandler(AShape: TChartLabelShape); + procedure TitleChangedHandler(Sender: TObject); procedure TitleFontChangedHandler(Sender: TObject); procedure TitleShapeChangedHandler(AShape: TChartLabelShape); protected @@ -144,7 +147,7 @@ implementation {$R *.lfm} uses - ceUtils; + Math, ceUtils; procedure TAxisEditor.cbAutoMaxChange(Sender: TObject); begin @@ -214,6 +217,21 @@ begin end; end; +procedure TAxisEditor.FormActivate(Sender: TObject); +begin + Constraints.MinWidth := Max(gbTitleShapeBrushPenMargins.Width, gbTitleFont.Width) * 2 + Bevel1.Width + + TitleMemoPanel.BorderSpacing.Around*2 + + PageControl.BorderSpacing.Left + PageControl.BorderSpacing.Right; + + Constraints.MinHeight := gbTicks.Top + gbTicks.Height + gbTicks.BorderSpacing.Bottom + + PageControl.Height - PageControl.ClientHeight + + PanelTop.Height + + ButtonPanel.Height + ButtonPanel.BorderSpacing.Around * 2; + + Width := 1; // Enforce constraints + Height := 1; +end; + procedure TAxisEditor.FormCloseQuery(Sender: TObject; var CanClose: boolean); begin if not CanClose then exit; @@ -226,20 +244,91 @@ end; procedure TAxisEditor.FormCreate(Sender: TObject); begin + // Insert frames at runtime - this makes life much easier... + FTitleFontFrame := TFontFrame.Create(self); + FTitleFontFrame.Parent := gbTitleFont; + FTitleFontFrame.Name := ''; + FTitleFontFrame.Align := alClient; + FTitleFontFrame.BorderSpacing.Left := 8; + FTitleFontFrame.BorderSpacing.Right := 8; + FTitleFontFrame.OnChange := @TitleFontChangedHandler; + gbTitleFont.AutoSize := true; + gbTitleFont.Caption := 'Font'; + + FTitleShapeBrushPenMarginsFrame := TShapeBrushPenMarginsFrame.Create(self); + FTitleShapeBrushPenMarginsFrame.Parent := gbTitleShapeBrushPenMargins; + FTitleShapeBrushPenMarginsFrame.Name := ''; + FTitleShapeBrushPenMarginsFrame.BorderSpacing.Left := 8; + FTitleShapeBrushPenMarginsFrame.BorderSpacing.Right := 8; + FTitleShapeBrushPenMarginsFrame.BorderSpacing.Bottom := 8; + FTitleShapeBrushPenMarginsFrame.OnChange := @TitleChangedHandler; + FTitleShapeBrushPenMarginsFrame.OnShapeChange := @TitleShapeChangedHandler; + FTitleShapeBrushPenMarginsFrame.AutoSize := true; + gbTitleShapeBrushPenMargins.AutoSize := true; + gbTitleShapeBrushPenMargins.Caption := 'Title background'; + + FLabelFontFrame := TFontFrame.Create(self); + FLabelFontFrame.Parent := gbLabelFont; + FLabelFontFrame.Name := ''; + FLabelFontFrame.Align := alClient; + FLabelFontFrame.BorderSpacing.Left := 8; + FLabelFontFrame.BorderSpacing.Right := 8; + FLabelFontFrame.OnChange := @LabelFontChangedHandler; + gbLabelFont.AutoSize := true; + gbLabelFont.Caption := 'Label font'; + + FLabelShapeBrushPenMarginsFrame := TShapeBrushPenMarginsFrame.Create(self); + FLabelShapeBrushPenMarginsFrame.Parent := gbShapeFillBorder; + FLabelShapeBrushPenMarginsFrame.Name := ''; + FLabelShapeBrushPenMarginsFrame.Align := alClient; + FLabelShapeBrushPenMarginsFrame.BorderSpacing.Left := 8; + FLabelShapeBrushPenMarginsFrame.BorderSpacing.Right := 8; + FLabelShapeBrushPenMarginsFrame.BorderSpacing.Bottom := 8; + FLabelShapeBrushPenMarginsFrame.OnChange := @LabelChangedHandler; + FLabelShapeBrushPenMarginsFrame.OnShapeChange := @LabelShapeChangedHandler; + FLabelShapeBrushPenMarginsFrame.AutoSize := true; + gbShapeFillBorder.AutoSize := true; + gbShapeFillBorder.Caption := 'Label background'; + + FGridPenFrame := TPenFrame.Create(Self); + FGridPenFrame.Parent := gbGrid; + FGridPenFrame.Name := ''; + FGridPenFrame.Align := alTop; + FGridPenFrame.Top := 1000; + FGridPenFrame.BorderSpacing.Left := 16; + FGridPenFrame.BorderSpacing.Right := 16; + FGridPenFrame.BorderSpacing.Bottom := 16; + FGridPenFrame.OnChange := @ChangedHandler; + gbGrid.AutoSize := true; + gbGrid.Caption := 'Grid lines'; + + FFramePenFrame := TPenFrame.Create(Self); + FFramePenFrame.Parent := gbFrame; + FFramePenFrame.Name := ''; + FFramePenFrame.Align := alTop; + FFramePenFrame.Top := 1000; + FFramePenFrame.BorderSpacing.Left := 16; + FFramePenFrame.BorderSpacing.Right := 16; + FFramePenFrame.BorderSpacing.Bottom := 16; + FFramePenFrame.OnChange := @ChangedHandler; + gbFrame.AutoSize := true; + gbFrame.Caption := 'Frame'; + + FAxisLinePenFrame := TPenFrame.Create(Self); + FAxisLinePenFrame.Parent := gbAxisLine; + FAxisLinePenFrame.Name := ''; + FAxisLinePenFrame.Align := alTop; + FAxisLinePenFrame.Top := 1000; + FAxisLinePenFrame.BorderSpacing.Left := 16; + FAxisLinePenFrame.BorderSpacing.Right := 16; + FAxisLinePenFrame.BorderSpacing.Bottom := 16; + FAxisLinePenFrame.OnChange := @ChangedHandler; + gbAxisLine.AutoSize := true; + gbAxisLine.Caption := 'Axis line'; + BoldHeaders(self); - TitleShapeBrushPenMarginsFrame.OnChange := @ChangedHandler; - TitleShapeBrushPenMarginsFrame.OnShapeChange := @TitleShapeChangedHandler; - TitleFontFrame.OnChange := @TitleFontChangedHandler; - - LabelShapeBrushPenMarginsFrame.OnChange := @ChangedHandler; - LabelShapeBrushPenMarginsFrame.OnShapeChange := @LabelShapeChangedHandler; - LabelFontFrame.OnChange := @LabelFontChangedHandler; - - FramePenFrame.OnChange := @ChangedHandler; - AxisLinePenFrame.OnChange := @ChangedHandler; - - GridPenFrame.OnChange := @ChangedHandler; + TitleParamsPanel.AutoSize := true; end; procedure TAxisEditor.FormDestroy(Sender: TObject); @@ -250,6 +339,8 @@ end; procedure TAxisEditor.FormShow(Sender: TObject); begin FOKClicked := false; + FTitleShapeBrushPenMarginsFrame.AutoSize := false; + FTitleShapeBrushPenMarginsFrame.Align := alClient; end; function TAxisEditor.GetAlignment(AItemIndex: Integer): TAlignment; @@ -281,6 +372,11 @@ begin ModalResult := mrYesToAll; end; +procedure TAxisEditor.LabelChangedHandler(Sender: TObject); +begin + GetChart.Invalidate; +end; + procedure TAxisEditor.LabelFontChangedHandler(Sender: TObject); begin GetChart.Invalidate; @@ -319,11 +415,13 @@ begin // Page "Title" cbTitleVisible.Checked := Axis.Title.Visible; mmoTitle.Lines.Text := Axis.Title.Caption; + mmoTitle.Font := Axis.Title.LabelFont; + mmoTitle.Font.Orientation := 0; // Memo has horizontal text only with Axis.Title do begin rgTitleAlignment.ItemIndex := GetAlignmentIndex(Alignment); seTitleDistance.Value := Distance; - TitleFontFrame.Prepare(LabelFont, true); - TitleShapeBrushPenMarginsFrame.Prepare(Shape, LabelBrush, Frame, Margins); + FTitleFontFrame.Prepare(LabelFont, true); + FTitleShapeBrushPenMarginsFrame.Prepare(Shape, LabelBrush, Frame, Margins); end; // Page "Labels" @@ -339,18 +437,19 @@ begin seLabelDistance.Value := Distance; cbLabelsVisible.Checked := Visible; edLabelFormat.Text := Format; - LabelFontFrame.Prepare(LabelFont, true); - LabelShapeBrushPenMarginsFrame.Prepare(Shape, LabelBrush, Frame, Margins); + FLabelFontFrame.Prepare(LabelFont, true); + FLabelShapeBrushPenMarginsFrame.Prepare(Shape, LabelBrush, Frame, Margins); end; // Page "Grid" - GridPenFrame.Prepare(FAxis.Grid); + cbGridVisible.Checked := FAxis.Grid.EffVisible; + FGridPenFrame.Prepare(FAxis.Grid); // Page "Line" cbFrameVisible.Checked := GetChart.Frame.EffVisible; - FramePenFrame.Prepare(GetChart.Frame); + FFramePenFrame.Prepare(GetChart.Frame); cbAxisLineVisible.Checked := FAxis.AxisPen.EffVisible; - AxisLinePenFrame.Prepare(FAxis.AxisPen); + FAxisLinePenFrame.Prepare(FAxis.AxisPen); cbArrowVisible.Checked := FAxis.Arrow.Visible; seArrowBaseLength.Value := FAxis.Arrow.BaseLength; seArrowLength.Value := FAxis.Arrow.Length; @@ -412,9 +511,16 @@ begin PageControl.ActivePageIndex := ord(AValue); end; +procedure TAxisEditor.TitleChangedHandler(Sender: TObject); +begin + mmoTitle.Color := FAxis.Title.LabelBrush.Color; + GetChart.Invalidate; +end; + procedure TAxisEditor.TitleFontChangedHandler(Sender: TObject); begin mmoTitle.Font.Assign(FAxis.Title.LabelFont); + mmoTitle.Font.Orientation := 0; end; procedure TAxisEditor.TitleShapeChangedHandler(AShape: TChartLabelShape); diff --git a/components/tachart/demo/charteditor/cebrushframe.pas b/components/tachart/demo/charteditor/cebrushframe.pas index 5f36bc4144..ea814a9747 100644 --- a/components/tachart/demo/charteditor/cebrushframe.pas +++ b/components/tachart/demo/charteditor/cebrushframe.pas @@ -60,7 +60,7 @@ end; procedure TBrushFrame.Prepare(ABrush: TBrush); begin FBrush := ABrush; - cbBrushColor.ButtonColor := ABrush.Color; + cbBrushColor.ButtonColor := ColorToRGB(ABrush.Color); cbBrushStyle.BrushStyle := ABrush.Style; end; diff --git a/components/tachart/demo/charteditor/cefontframe.lfm b/components/tachart/demo/charteditor/cefontframe.lfm index c3acfd2c03..62b5bdc89b 100644 --- a/components/tachart/demo/charteditor/cefontframe.lfm +++ b/components/tachart/demo/charteditor/cefontframe.lfm @@ -1,10 +1,10 @@ object FontFrame: TFontFrame Left = 0 - Height = 75 + Height = 84 Top = 0 - Width = 250 - ClientHeight = 75 - ClientWidth = 250 + Width = 301 + ClientHeight = 84 + ClientWidth = 301 TabOrder = 0 DesignLeft = 332 DesignTop = 128 @@ -16,51 +16,20 @@ object FontFrame: TFontFrame Left = 0 Height = 23 Top = 0 - Width = 250 + Width = 301 Anchors = [akTop, akLeft, akRight] ItemHeight = 15 OnChange = cmbFontNameChange Style = csDropDownList TabOrder = 0 end - object cmbFontSize: TComboBox - AnchorSideTop.Control = cbFontColor - AnchorSideTop.Side = asrCenter - AnchorSideRight.Side = asrBottom - Left = 0 - Height = 23 - Top = 30 - Width = 94 - BorderSpacing.Right = 6 - ItemHeight = 15 - OnChange = cmbFontSizeChange - Style = csDropDownList - TabOrder = 1 - end - object cbFontColor: TColorButton - AnchorSideTop.Control = cmbFontName - AnchorSideTop.Side = asrBottom - AnchorSideRight.Control = Owner - AnchorSideRight.Side = asrBottom - AnchorSideBottom.Side = asrBottom - Left = 218 - Height = 25 - Top = 29 - Width = 32 - Anchors = [akTop, akRight] - BorderSpacing.Top = 6 - BorderWidth = 2 - ButtonColorSize = 16 - ButtonColor = clBlack - OnColorChanged = cbFontColorColorChanged - end object cbBold: TCheckBox AnchorSideLeft.Control = Owner - AnchorSideTop.Control = cmbFontSize + AnchorSideTop.Control = Panel2 AnchorSideTop.Side = asrBottom Left = 0 Height = 19 - Top = 59 + Top = 60 Width = 45 BorderSpacing.Top = 6 BorderSpacing.Bottom = 8 @@ -68,7 +37,7 @@ object FontFrame: TFontFrame Font.Style = [fsBold] OnChange = cbBoldChange ParentFont = False - TabOrder = 3 + TabOrder = 1 end object cbItalic: TCheckBox AnchorSideLeft.Control = cbBold @@ -76,14 +45,14 @@ object FontFrame: TFontFrame AnchorSideTop.Control = cbBold Left = 53 Height = 19 - Top = 59 + Top = 60 Width = 45 BorderSpacing.Left = 8 Caption = 'Italic' Font.Style = [fsItalic] OnChange = cbItalicChange ParentFont = False - TabOrder = 4 + TabOrder = 2 end object cbUnderline: TCheckBox AnchorSideLeft.Control = cbItalic @@ -92,7 +61,7 @@ object FontFrame: TFontFrame AnchorSideRight.Side = asrBottom Left = 106 Height = 19 - Top = 59 + Top = 60 Width = 78 BorderSpacing.Left = 8 BorderSpacing.Right = 6 @@ -100,35 +69,98 @@ object FontFrame: TFontFrame Font.Style = [fsUnderline] OnChange = cbUnderlineChange ParentFont = False - TabOrder = 5 + TabOrder = 3 end - object lblOrientation: TLabel - AnchorSideLeft.Control = cmbFontSize - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = cbFontColor - AnchorSideTop.Side = asrCenter - Left = 106 - Height = 15 - Top = 34 - Width = 31 - BorderSpacing.Left = 12 - Caption = 'Angle' - FocusControl = seOrientation - ParentColor = False - end - object seOrientation: TSpinEdit - AnchorSideLeft.Control = lblOrientation - AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = cbFontColor - AnchorSideTop.Side = asrCenter - Left = 143 - Height = 23 - Top = 30 - Width = 58 - BorderSpacing.Left = 6 - MaxValue = 360 - MinValue = -360 - OnChange = seOrientationChange - TabOrder = 2 + object Panel2: TPanel + AnchorSideLeft.Control = Owner + AnchorSideTop.Control = cmbFontName + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Owner + AnchorSideRight.Side = asrBottom + Left = 0 + Height = 31 + Top = 23 + Width = 301 + Anchors = [akTop, akLeft, akRight] + BevelOuter = bvNone + ChildSizing.EnlargeHorizontal = crsHomogenousSpaceResize + ChildSizing.ShrinkHorizontal = crsHomogenousSpaceResize + ChildSizing.ControlsPerLine = 3 + ClientHeight = 31 + ClientWidth = 301 + TabOrder = 4 + object cmbFontSize: TComboBox + AnchorSideLeft.Control = Panel2 + AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = Panel1 + Left = 0 + Height = 23 + Top = 6 + Width = 144 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Right = 16 + ItemHeight = 15 + OnChange = cmbFontSizeChange + Style = csDropDownList + TabOrder = 0 + end + object Panel1: TPanel + AnchorSideRight.Control = cbFontColor + Left = 160 + Height = 23 + Top = 6 + Width = 97 + Anchors = [akTop, akRight] + AutoSize = True + BorderSpacing.Right = 16 + BevelOuter = bvNone + ClientHeight = 23 + ClientWidth = 97 + TabOrder = 1 + object lblOrientation: TLabel + AnchorSideLeft.Control = Panel1 + AnchorSideTop.Control = seOrientation + AnchorSideTop.Side = asrCenter + Left = 0 + Height = 15 + Top = 4 + Width = 31 + Caption = 'Angle' + FocusControl = seOrientation + ParentColor = False + end + object seOrientation: TSpinEdit + AnchorSideLeft.Control = lblOrientation + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = Panel1 + AnchorSideTop.Side = asrCenter + Left = 39 + Height = 23 + Top = 0 + Width = 58 + BorderSpacing.Left = 8 + MaxValue = 360 + MinValue = -360 + OnChange = seOrientationChange + TabOrder = 0 + end + end + object cbFontColor: TColorButton + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = Panel2 + AnchorSideRight.Side = asrBottom + AnchorSideBottom.Side = asrBottom + Left = 273 + Height = 23 + Top = 6 + Width = 28 + Anchors = [akTop, akRight] + BorderSpacing.Top = 6 + BorderWidth = 2 + ButtonColorSize = 16 + ButtonColor = clBlack + Margin = 2 + OnColorChanged = cbFontColorColorChanged + end end end diff --git a/components/tachart/demo/charteditor/cefontframe.pas b/components/tachart/demo/charteditor/cefontframe.pas index fe31582d5e..76472fb19f 100644 --- a/components/tachart/demo/charteditor/cefontframe.pas +++ b/components/tachart/demo/charteditor/cefontframe.pas @@ -5,7 +5,8 @@ unit ceFontFrame; interface uses - Classes, SysUtils, Graphics, Forms, Controls, StdCtrls, Dialogs, Spin; + Classes, SysUtils, Graphics, Forms, Controls, StdCtrls, Dialogs, Spin, + ExtCtrls; type @@ -19,6 +20,8 @@ type cmbFontName: TComboBox; cmbFontSize: TComboBox; lblOrientation: TLabel; + Panel1: TPanel; + Panel2: TPanel; seOrientation: TSpinEdit; procedure cbBoldChange(Sender: TObject); procedure cbFontColorColorChanged(Sender: TObject); diff --git a/components/tachart/demo/charteditor/celegenddlg.lfm b/components/tachart/demo/charteditor/celegenddlg.lfm index 1f024e4d13..7d6cf55dc9 100644 --- a/components/tachart/demo/charteditor/celegenddlg.lfm +++ b/components/tachart/demo/charteditor/celegenddlg.lfm @@ -2,12 +2,12 @@ object LegendEditor: TLegendEditor Left = 978 Height = 396 Top = 169 - Width = 553 + Width = 590 ActiveControl = cbShow BorderStyle = bsDialog Caption = 'Legend editor' ClientHeight = 396 - ClientWidth = 553 + ClientWidth = 590 OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy @@ -18,7 +18,7 @@ object LegendEditor: TLegendEditor Left = 6 Height = 34 Top = 356 - Width = 541 + Width = 578 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True OKButton.OnClick = OKButtonClick @@ -36,13 +36,13 @@ object LegendEditor: TLegendEditor Left = 8 Height = 309 Top = 39 - Width = 537 + Width = 574 Align = alClient AutoSize = True BorderSpacing.Around = 8 BevelOuter = bvNone ClientHeight = 309 - ClientWidth = 537 + ClientWidth = 574 TabOrder = 1 object gbBackground: TGroupBox AnchorSideLeft.Control = gbAlignment @@ -149,45 +149,8 @@ object LegendEditor: TLegendEditor Width = 216 Anchors = [akTop, akLeft, akBottom] BorderSpacing.Left = 20 - Caption = 'Font' - ClientHeight = 92 - ClientWidth = 212 + Caption = 'gbFont' TabOrder = 1 - inline FontFrame1: TFontFrame - Left = 8 - Height = 84 - Width = 196 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 84 - ClientWidth = 196 - inherited cmbFontName: TComboBox - AnchorSideLeft.Control = FontFrame1 - AnchorSideTop.Control = FontFrame1 - AnchorSideRight.Control = FontFrame1 - Width = 196 - end - inherited cbFontColor: TColorButton - AnchorSideRight.Control = FontFrame1 - Left = 164 - end - inherited cbBold: TCheckBox - AnchorSideLeft.Control = FontFrame1 - end - inherited lblOrientation: TLabel - Left = 110 - Anchors = [akTop] - Visible = False - end - inherited seOrientation: TSpinEdit - Left = 147 - Width = 26 - Alignment = taRightJustify - Visible = False - end - end end object gbAlignment: TGroupBox AnchorSideLeft.Control = ParamsPanel @@ -538,12 +501,12 @@ object LegendEditor: TLegendEditor Left = 0 Height = 31 Top = 0 - Width = 553 + Width = 590 Align = alTop AutoSize = True BevelOuter = bvNone ClientHeight = 31 - ClientWidth = 553 + ClientWidth = 590 TabOrder = 0 object cbShow: TCheckBox Left = 8 diff --git a/components/tachart/demo/charteditor/celegenddlg.pas b/components/tachart/demo/charteditor/celegenddlg.pas index a4a140fcad..58cd51696a 100644 --- a/components/tachart/demo/charteditor/celegenddlg.pas +++ b/components/tachart/demo/charteditor/celegenddlg.pas @@ -24,7 +24,6 @@ type cbInverted: TCheckBox; cbUseSideBar: TCheckBox; cbItemFillOrder: TComboBox; - FontFrame1: TFontFrame; gbBackground: TGroupBox; gbBorder: TGroupBox; gbFont: TGroupBox; @@ -75,6 +74,7 @@ type FLegend: TChartLegend; FSavedLegend: TChartLegend; FOKClicked: Boolean; + FFontFrame: TFontFrame; procedure ChangedHandler(Sender: TObject); function GetAlignment: TLegendAlignment; procedure SetAlignment(AValue: TLegendAlignment); @@ -163,8 +163,18 @@ end; procedure TLegendEditor.FormCreate(Sender: TObject); begin + FFontFrame := TFontFrame.Create(self); + FFontFrame.Parent := gbFont; + FFontFrame.Name := ''; + FFontFrame.Align := alClient; + FFontFrame.BorderSpacing.Left := 8; + FFontFrame.BorderSpacing.Right := 8; + FFontFrame.AutoSize := true; + FFontFrame.OnChange := @ChangedHandler; + gbFont.AutoSize := true; + gbFont.Caption := 'Font'; + BoldHeaders(Self); - FontFrame1.OnChange := @ChangedHandler; end; procedure TLegendEditor.FormDestroy(Sender: TObject); @@ -270,10 +280,10 @@ begin SetAlignment(ALegend.Alignment); cbFilled.Checked := ALegend.BackgroundBrush.Style <> bsClear; - cbFillColor.Selected := ALegend.BackgroundBrush.Color; + cbFillColor.Selected := ColorToRGB(ALegend.BackgroundBrush.Color); cbShowBorder.Checked := (ALegend.Frame.Style <> psClear) and ALegend.Frame.Visible; - cbBorderColor.Selected := ALegend.Frame.Color; + cbBorderColor.Selected := ColorToRGB(ALegend.Frame.Color); seMarginX.Value := ALegend.MarginX; seMarginY.Value := ALegend.MarginY; @@ -285,7 +295,7 @@ begin seSpacing.Value := ALegend.Spacing; cbItemFillOrder.ItemIndex := ord(ALegend.ItemFillOrder); - FontFrame1.Prepare(ALegend.Font, false); + FFontFrame.Prepare(ALegend.Font, false); end; end. diff --git a/components/tachart/demo/charteditor/cepenframe.lfm b/components/tachart/demo/charteditor/cepenframe.lfm index d6953970e3..d4741a456a 100644 --- a/components/tachart/demo/charteditor/cepenframe.lfm +++ b/components/tachart/demo/charteditor/cepenframe.lfm @@ -83,6 +83,7 @@ object PenFrame: TPenFrame BorderWidth = 2 ButtonColorSize = 16 ButtonColor = clBlack + Margin = 2 OnColorChanged = cbPenColorColorChanged end object Bevel1: TBevel diff --git a/components/tachart/demo/charteditor/cepenframe.pas b/components/tachart/demo/charteditor/cepenframe.pas index 9fa3bff6d6..c448a07226 100644 --- a/components/tachart/demo/charteditor/cepenframe.pas +++ b/components/tachart/demo/charteditor/cepenframe.pas @@ -76,7 +76,7 @@ begin FPen := APen; cbPenStyle.PenStyle := FPen.Style; cbPenWidth.PenWidth := FPen.Width; - cbPenColor.ButtonColor := FPen.Color; + cbPenColor.ButtonColor := ColorToRGB(FPen.Color); end; end. diff --git a/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.lfm b/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.lfm index 12d805dd41..34d88eb1d1 100644 --- a/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.lfm +++ b/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.lfm @@ -1,11 +1,10 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame Left = 0 - Height = 187 + Height = 237 Top = 0 - Width = 230 - ClientHeight = 187 - ClientWidth = 230 - Constraints.MinWidth = 230 + Width = 263 + ClientHeight = 237 + ClientWidth = 263 TabOrder = 0 DesignLeft = 1498 DesignTop = 388 @@ -18,7 +17,7 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame Left = 0 Height = 23 Top = 0 - Width = 230 + Width = 263 Anchors = [akTop, akLeft, akRight] Enabled = False ItemHeight = 15 @@ -42,27 +41,31 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Side = asrBottom Left = 0 - Height = 53 + Height = 54 Top = 31 - Width = 108 + Width = 124 Anchors = [akTop, akLeft, akRight] + AutoSize = True BorderSpacing.Top = 8 BorderSpacing.Right = 8 Caption = 'Background' - ClientHeight = 33 - ClientWidth = 104 + ClientHeight = 34 + ClientWidth = 120 TabOrder = 1 object cbFilled: TCheckBox AnchorSideLeft.Control = gbBackground AnchorSideTop.Control = cbFillColor AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = cbFillColor Left = 10 Height = 19 Top = 3 - Width = 48 + Width = 62 + Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 10 BorderSpacing.Top = 6 - BorderSpacing.Bottom = 10 + BorderSpacing.Right = 8 + BorderSpacing.Bottom = 12 Caption = 'Filled' OnChange = cbFilledChange TabOrder = 0 @@ -71,16 +74,18 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideTop.Control = gbBackground AnchorSideRight.Control = gbBackground AnchorSideRight.Side = asrBottom - Left = 64 + Left = 80 Height = 25 Top = 0 Width = 32 Anchors = [akTop, akRight] + BorderSpacing.Left = 8 BorderSpacing.Right = 8 BorderSpacing.Bottom = 8 BorderWidth = 2 ButtonColorSize = 16 ButtonColor = clBlack + Margin = 2 Visible = False OnColorChanged = cbFillColorColorChanged end @@ -92,29 +97,31 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideRight.Side = asrBottom AnchorSideBottom.Control = gbBackground AnchorSideBottom.Side = asrBottom - Left = 123 - Height = 53 + Left = 139 + Height = 54 Top = 31 - Width = 107 + Width = 124 Anchors = [akTop, akLeft, akRight, akBottom] AutoSize = True BorderSpacing.Left = 8 Caption = 'Border' - ClientHeight = 33 - ClientWidth = 103 + ClientHeight = 34 + ClientWidth = 120 TabOrder = 2 object cbShowBorder: TCheckBox AnchorSideLeft.Control = gbBorder AnchorSideTop.Control = cbBorderColor AnchorSideTop.Side = asrCenter + AnchorSideRight.Control = cbBorderColor Left = 10 Height = 19 Top = 3 - Width = 54 + Width = 68 + Anchors = [akTop, akLeft, akRight] BorderSpacing.Left = 10 BorderSpacing.Top = 6 - BorderSpacing.Bottom = 10 - Caption = 'Visible' + BorderSpacing.Bottom = 12 + Caption = 'Visible ' OnChange = cbShowBorderChange TabOrder = 0 end @@ -122,16 +129,18 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideTop.Control = gbBorder AnchorSideRight.Control = gbBorder AnchorSideRight.Side = asrBottom - Left = 65 + Left = 82 Height = 25 Top = 0 Width = 30 Anchors = [akTop, akRight] + BorderSpacing.Left = 4 BorderSpacing.Right = 8 BorderSpacing.Bottom = 8 BorderWidth = 2 ButtonColorSize = 16 ButtonColor = clBlack + Margin = 2 Visible = False OnColorChanged = cbBorderColorColorChanged end @@ -142,60 +151,41 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideTop.Side = asrBottom AnchorSideRight.Control = gbBorder AnchorSideRight.Side = asrBottom - AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 0 - Height = 95 - Top = 92 - Width = 230 - Anchors = [akTop, akLeft, akRight, akBottom] + Height = 97 + Top = 93 + Width = 263 + Anchors = [akTop, akLeft, akRight] + AutoSize = True BorderSpacing.Top = 8 Caption = 'Margins' - ClientHeight = 75 - ClientWidth = 226 + ClientHeight = 77 + ClientWidth = 259 TabOrder = 3 object seTopMargin: TSpinEdit AnchorSideLeft.Control = gbMargins AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = gbMargins - Left = 88 + Left = 104 Height = 23 Top = 0 Width = 50 Alignment = taRightJustify - BorderSpacing.Bottom = 4 OnChange = seTopMarginChange TabOrder = 0 end - object seBottomMargin: TSpinEdit - AnchorSideLeft.Control = gbMargins - AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = Bevel2 - AnchorSideTop.Side = asrBottom - AnchorSideBottom.Control = gbMargins - AnchorSideBottom.Side = asrBottom - Left = 88 - Height = 23 - Top = 44 - Width = 50 - Alignment = taRightJustify - Anchors = [akLeft, akBottom] - BorderSpacing.Top = 4 - BorderSpacing.Bottom = 8 - OnChange = seBottomMarginChange - TabOrder = 3 - end object seLeftMargin: TSpinEdit - AnchorSideTop.Control = Bevel2 - AnchorSideTop.Side = asrCenter + AnchorSideTop.Control = seTopMargin + AnchorSideTop.Side = asrBottom AnchorSideRight.Control = seTopMargin - Left = 30 + Left = 46 Height = 23 - Top = 22 + Top = 23 Width = 50 Alignment = taRightJustify Anchors = [akTop, akRight] - BorderSpacing.Top = 4 + BorderSpacing.Left = 32 BorderSpacing.Right = 8 OnChange = seLeftMarginChange TabOrder = 1 @@ -203,30 +193,33 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame object seRightMargin: TSpinEdit AnchorSideLeft.Control = seTopMargin AnchorSideLeft.Side = asrBottom - AnchorSideTop.Control = Bevel2 - AnchorSideTop.Side = asrCenter - Left = 146 + AnchorSideTop.Control = seTopMargin + AnchorSideTop.Side = asrBottom + Left = 162 Height = 23 - Top = 22 + Top = 23 Width = 50 Alignment = taRightJustify BorderSpacing.Left = 8 - BorderSpacing.Top = 4 + BorderSpacing.Right = 32 OnChange = seRightMarginChange TabOrder = 2 end - object Bevel2: TBevel + object seBottomMargin: TSpinEdit AnchorSideLeft.Control = gbMargins AnchorSideLeft.Side = asrCenter - AnchorSideTop.Control = seTopMargin + AnchorSideTop.Control = seLeftMargin AnchorSideTop.Side = asrBottom - AnchorSideBottom.Control = seBottomMargin - Left = 88 - Height = 13 - Top = 27 + AnchorSideBottom.Control = gbMargins + AnchorSideBottom.Side = asrBottom + Left = 104 + Height = 23 + Top = 46 Width = 50 - Anchors = [akTop, akLeft, akBottom] - Shape = bsSpacer + Alignment = taRightJustify + BorderSpacing.Bottom = 8 + OnChange = seBottomMarginChange + TabOrder = 3 end end object Bevel1: TBevel @@ -234,7 +227,7 @@ object ShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame AnchorSideLeft.Side = asrCenter AnchorSideTop.Control = cmbShape AnchorSideTop.Side = asrBottom - Left = 115 + Left = 131 Height = 50 Top = 23 Width = 1 diff --git a/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.pas b/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.pas index 3d09e8beee..45f34855c1 100644 --- a/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.pas +++ b/components/tachart/demo/charteditor/ceshapebrushpenmarginsframe.pas @@ -6,7 +6,7 @@ interface uses Classes, SysUtils, Graphics, Forms, Controls, StdCtrls, Dialogs, Spin, ExtCtrls, - TATextElements; + TATypes, TATextElements; type @@ -16,7 +16,6 @@ type TShapeBrushPenMarginsFrame = class(TFrame) Bevel1: TBevel; - Bevel2: TBevel; cbBorderColor: TColorButton; cbFillColor: TColorButton; cbFilled: TCheckBox; @@ -42,17 +41,18 @@ type FOnChange: TNotifyEvent; FOnShapeChange: TShapeChangeEvent; FBrush: TBrush; - FPen: TPen; + FPen: TChartPen; FMargins: TChartLabelMargins; FShape: TChartLabelShape; + FLockEvents: Integer; procedure DoChanged; procedure DoShapeChanged(AShape: TChartLabelShape); procedure UpdateControls; public constructor Create(AOwner: TComponent); override; procedure GetData(out AShape: TChartLabelShape; ABrush: TBrush; - APen: TPen; AMargins: TChartLabelMargins); - procedure Prepare(AShape: TChartLabelShape; ABrush: TBrush; APen: TPen; + APen: TChartPen; AMargins: TChartLabelMargins); + procedure Prepare(AShape: TChartLabelShape; ABrush: TBrush; APen: TChartPen; AMargins: TChartLabelMargins); property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnShapeChange: TShapeChangeEvent read FOnShapeChange write FOnShapeChange; @@ -78,7 +78,7 @@ end; procedure TShapeBrushPenMarginsFrame.cbBorderColorColorChanged(Sender: TObject); begin FPen.Color := cbBorderColor.ButtonColor; - if FPen.Style <> psClear then +// if FPen.Style <> psClear then DoChanged; end; @@ -102,25 +102,27 @@ end; procedure TShapeBrushPenMarginsFrame.cbShowBorderChange(Sender: TObject); begin - if cbShowBorder.Checked then FPen.Style := psSolid else FPen.Style := psClear; + FPen.Visible := cbShowBorder.Checked; + if FPen.Visible and (FPen.Style = psClear) then FPen.Style := psSolid; UpdateControls; DoChanged; end; +procedure TShapeBrushPenMarginsFrame.cmbShapeChange(Sender: TObject); +begin + DoShapeChanged(TChartLabelShape(cmbShape.ItemIndex)); +end; + procedure TShapeBrushPenMarginsFrame.DoChanged; begin - if Assigned(FOnChange) then FOnChange(Self); + if (FLockEvents = 0) and Assigned(FOnChange) then + FOnChange(Self); end; procedure TShapeBrushPenMarginsFrame.DoShapeChanged(AShape: TChartLabelShape); begin - if Assigned(FOnShapeChange) then FOnShapeChange(AShape); -end; - -procedure TShapeBrushPenMarginsFrame.cmbShapeChange(Sender: TObject); -begin - FShape := TChartLabelShape(cmbShape.ItemIndex); - DoShapeChanged(FShape); + if (FLockEvents = 0) and Assigned(FOnShapeChange) then + FOnShapeChange(AShape); end; procedure TShapeBrushPenMarginsFrame.seBottomMarginChange(Sender: TObject); @@ -148,13 +150,17 @@ begin end; procedure TShapeBrushPenMarginsFrame.GetData(out AShape: TChartLabelShape; - ABrush: TBrush; APen: TPen; AMargins: TChartLabelMargins); + ABrush: TBrush; APen: TChartPen; AMargins: TChartLabelMargins); begin AShape := TChartLabelShape(cmbShape.ItemIndex); - if cbFilled.Checked then ABrush.Style := bsSolid else ABrush.Style := bsClear; - ABrush.Color := cbFillColor.ButtonColor; - if cbShowBorder.Checked then APen.Style := psSolid else APen.Style := psClear; - APen.Color := cbBorderColor.ButtonColor; + if HandleAllocated then + begin + if cbFilled.Checked then ABrush.Style := bsSolid else ABrush.Style := bsClear; + ABrush.Color := cbFillColor.ButtonColor; + APen.Visible := cbShowBorder.Checked; + APen.Style := psSolid; + APen.Color := cbBorderColor.ButtonColor; + end; AMargins.Top := seTopMargin.Value; AMargins.Left := seLeftMargin.Value; AMargins.Right := seRightMargin.Value; @@ -162,21 +168,26 @@ begin end; procedure TShapeBrushPenMarginsFrame.Prepare(AShape: TChartLabelShape; - ABrush: TBrush; APen: TPen; AMargins: TChartLabelMargins); + ABrush: TBrush; APen: TChartPen; AMargins: TChartLabelMargins); begin + inc(FLockEvents); FShape := AShape; FBrush := ABrush; FPen := APen; FMargins := AMargins; cmbShape.ItemIndex := ord(AShape); cbFilled.Checked := ABrush.Style <> bsClear; - cbFillColor.ButtonColor := ABrush.Color; - cbShowBorder.Checked := APen.Style <> psClear; - cbBorderColor.ButtonColor := APen.Color; + cbFillColor.ButtonColor := ColorToRGB(ABrush.Color); + cbShowBorder.Checked := APen.EffVisible; + if APen.Color = clDefault then + cbBorderColor.ButtonColor := ColorToRGB(clWindowText) + else + cbBorderColor.ButtonColor := ColorToRGB(APen.Color); seTopMargin.Value := AMargins.Top; seLeftMargin.Value := AMargins.Left; seRightMargin.Value := AMargins.Right; seBottomMargin.Value := AMargins.Bottom; + dec(FLockEvents); end; procedure TShapeBrushPenMarginsFrame.UpdateControls; diff --git a/components/tachart/demo/charteditor/cetitlefootdlg.lfm b/components/tachart/demo/charteditor/cetitlefootdlg.lfm index 1e408db673..bf6f588712 100644 --- a/components/tachart/demo/charteditor/cetitlefootdlg.lfm +++ b/components/tachart/demo/charteditor/cetitlefootdlg.lfm @@ -1,12 +1,13 @@ object TitleFootEditor: TTitleFootEditor Left = 608 - Height = 467 + Height = 357 Top = 235 Width = 561 ActiveControl = cbShow Caption = 'Title/footer editor' - ClientHeight = 467 + ClientHeight = 357 ClientWidth = 561 + OnActivate = FormActivate OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnDestroy = FormDestroy @@ -16,7 +17,7 @@ object TitleFootEditor: TTitleFootEditor object ButtonPanel: TButtonPanel Left = 6 Height = 34 - Top = 427 + Top = 317 Width = 549 OKButton.Name = 'OKButton' OKButton.DefaultCaption = True @@ -33,13 +34,13 @@ object TitleFootEditor: TTitleFootEditor end object ParamsPanel: TPanel Left = 8 - Height = 219 - Top = 200 + Height = 187 + Top = 122 Width = 545 Align = alBottom BorderSpacing.Around = 8 BevelOuter = bvNone - ClientHeight = 219 + ClientHeight = 187 ClientWidth = 545 TabOrder = 2 object rgAlignment: TRadioGroup @@ -47,21 +48,23 @@ object TitleFootEditor: TTitleFootEditor AnchorSideTop.Control = ParamsPanel AnchorSideBottom.Side = asrBottom Left = 0 - Height = 52 + Height = 51 Top = 0 - Width = 264 - Anchors = [akTop, akLeft, akBottom] + Width = 211 AutoFill = True + AutoSize = True Caption = 'Alignment' - ChildSizing.LeftRightSpacing = 6 - ChildSizing.EnlargeHorizontal = crsHomogenousChildResize - ChildSizing.EnlargeVertical = crsHomogenousChildResize + ChildSizing.LeftRightSpacing = 16 + ChildSizing.TopBottomSpacing = 6 + ChildSizing.HorizontalSpacing = 16 + ChildSizing.EnlargeHorizontal = crsScaleChilds + ChildSizing.EnlargeVertical = crsScaleChilds ChildSizing.ShrinkHorizontal = crsScaleChilds ChildSizing.ShrinkVertical = crsScaleChilds ChildSizing.Layout = cclLeftToRightThenTopToBottom ChildSizing.ControlsPerLine = 3 - ClientHeight = 32 - ClientWidth = 260 + ClientHeight = 31 + ClientWidth = 207 Columns = 3 ItemIndex = 0 Items.Strings = ( @@ -73,125 +76,49 @@ object TitleFootEditor: TTitleFootEditor TabOrder = 0 end object gbShapeBrushPenMargins: TGroupBox - Left = 288 - Height = 216 + AnchorSideLeft.Control = rgAlignment + AnchorSideLeft.Side = asrBottom + AnchorSideTop.Control = rgAlignment + AnchorSideRight.Control = ParamsPanel + AnchorSideRight.Side = asrBottom + Left = 235 + Height = 168 Top = 0 - Width = 255 + Width = 310 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Left = 24 Caption = 'Title/footer background' - ClientHeight = 196 - ClientWidth = 251 TabOrder = 2 - inline ShapeBrushPenMarginsFrame1: TShapeBrushPenMarginsFrame - Left = 8 - Height = 188 - Width = 235 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 188 - ClientWidth = 235 - inherited cmbShape: TComboBox - AnchorSideLeft.Control = ShapeBrushPenMarginsFrame1 - AnchorSideTop.Control = ShapeBrushPenMarginsFrame1 - AnchorSideRight.Control = ShapeBrushPenMarginsFrame1 - Width = 235 - end - inherited gbBackground: TGroupBox - AnchorSideLeft.Control = ShapeBrushPenMarginsFrame1 - Width = 110 - ClientWidth = 106 - inherited cbFillColor: TColorButton - Left = 66 - end - end - inherited gbBorder: TGroupBox - AnchorSideRight.Control = ShapeBrushPenMarginsFrame1 - Left = 125 - Width = 110 - ClientWidth = 106 - inherited cbBorderColor: TColorButton - Left = 68 - end - end - inherited gbMargins: TGroupBox - AnchorSideBottom.Control = ShapeBrushPenMarginsFrame1 - Height = 96 - Width = 235 - ClientHeight = 76 - ClientWidth = 231 - inherited seTopMargin: TSpinEdit - Left = 90 - end - inherited seBottomMargin: TSpinEdit - Left = 90 - Top = 45 - end - inherited seLeftMargin: TSpinEdit - Left = 32 - Top = 23 - end - inherited seRightMargin: TSpinEdit - Left = 148 - Top = 23 - end - inherited Bevel2: TBevel - Left = 90 - Height = 14 - end - end - inherited Bevel1: TBevel - Left = 117 - end - end end object gbFont: TGroupBox + AnchorSideLeft.Control = rgAlignment + AnchorSideTop.Control = rgAlignment + AnchorSideTop.Side = asrBottom + AnchorSideRight.Control = rgAlignment + AnchorSideRight.Side = asrBottom Left = 0 - Height = 106 - Top = 88 - Width = 264 + Height = 61 + Top = 75 + Width = 211 + Anchors = [akTop, akLeft, akRight] + BorderSpacing.Top = 24 Caption = 'Font' - ClientHeight = 86 - ClientWidth = 260 TabOrder = 1 - inline FontFrame1: TFontFrame - Left = 8 - Height = 78 - Width = 244 - Align = alClient - BorderSpacing.Left = 8 - BorderSpacing.Right = 8 - BorderSpacing.Bottom = 8 - ClientHeight = 78 - ClientWidth = 244 - inherited cmbFontName: TComboBox - AnchorSideLeft.Control = FontFrame1 - AnchorSideTop.Control = FontFrame1 - AnchorSideRight.Control = FontFrame1 - Width = 244 - end - inherited cbFontColor: TColorButton - AnchorSideRight.Control = FontFrame1 - Left = 212 - end - inherited cbBold: TCheckBox - AnchorSideLeft.Control = FontFrame1 - end - end end end object MemoPanel: TPanel + AnchorSideTop.Side = asrBottom Left = 8 - Height = 159 + Height = 81 Top = 33 Width = 545 Align = alClient BorderSpacing.Left = 8 BorderSpacing.Right = 8 BevelOuter = bvNone - ClientHeight = 159 + ClientHeight = 81 ClientWidth = 545 - Constraints.MinHeight = 100 + Constraints.MinHeight = 80 TabOrder = 1 object lblText: TLabel AnchorSideLeft.Control = MemoPanel @@ -212,7 +139,7 @@ object TitleFootEditor: TTitleFootEditor AnchorSideBottom.Control = MemoPanel AnchorSideBottom.Side = asrBottom Left = 0 - Height = 140 + Height = 62 Top = 19 Width = 545 Anchors = [akTop, akLeft, akRight, akBottom] diff --git a/components/tachart/demo/charteditor/cetitlefootdlg.pas b/components/tachart/demo/charteditor/cetitlefootdlg.pas index ff88774229..bef596e76a 100644 --- a/components/tachart/demo/charteditor/cetitlefootdlg.pas +++ b/components/tachart/demo/charteditor/cetitlefootdlg.pas @@ -16,7 +16,6 @@ type TTitleFootEditor = class(TForm) ButtonPanel: TButtonPanel; cbShow: TCheckBox; - FontFrame1: TFontFrame; gbShapeBrushPenMargins: TGroupBox; gbFont: TGroupBox; lblText: TLabel; @@ -25,8 +24,8 @@ type PanelTop: TPanel; ParamsPanel: TPanel; rgAlignment: TRadioGroup; - ShapeBrushPenMarginsFrame1: TShapeBrushPenMarginsFrame; procedure cbShowChange(Sender: TObject); + procedure FormActivate(Sender: TObject); procedure FormCloseQuery(Sender: TObject; var CanClose: boolean); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -37,10 +36,13 @@ type private FTitle: TChartTitle; FSavedTitle: TChartTitle; + FFontFrame: TFontFrame; + FShapeBrushPenMarginsFrame: TShapeBrushPenMarginsFrame; FOKClicked: boolean; procedure ChangedHandler(Sender: TObject); function GetAlignment: TAlignment; procedure SetAlignment(AValue: TAlignment); + procedure ShapeChangedHandler(AShape: TChartLabelShape); protected function GetChart: TChart; public @@ -69,6 +71,21 @@ begin gbFont.Visible := cbShow.Checked; end; +procedure TTitleFootEditor.FormActivate(Sender: TObject); +begin + Constraints.MinHeight := PanelTop.Height + + MemoPanel.Constraints.MinHeight + + ParamsPanel.Height + ParamsPanel.BorderSpacing.Around*2 + + ButtonPanel.Height + ButtonPanel.BorderSpacing.Around*2; + + Constraints.MinWidth := gbFont.Width + + gbShapeBrushPenMargins.Width + gbShapeBrushPenMargins.BorderSpacing.Left + + ParamsPanel.BorderSpacing.Around * 2; + + Width := 1; // Enforce the constraints. + Height := 1; +end; + procedure TTitleFootEditor.ChangedHandler(Sender: TObject); begin GetChart.Invalidate; @@ -88,9 +105,30 @@ end; procedure TTitleFootEditor.FormCreate(Sender: TObject); begin + // Insert frames at runtime - this makes life much easier... + FFontFrame := TFontFrame.Create(self); + FFontFrame.Parent := gbFont; + FFontFrame.Align := alClient; + FFontFrame.BorderSpacing.Left := 8; + FFontFrame.BorderSpacing.Right := 8; + FFontFrame.BorderSpacing.Bottom := 0;//8; + FFontFrame.OnChange := @ChangedHandler; + gbFont.AutoSize := true; + + FShapeBrushPenMarginsFrame := TShapeBrushPenMarginsFrame.Create(self); + FShapeBrushPenMarginsFrame.Parent := gbShapeBrushPenMargins; + FShapeBrushPenMarginsFrame.Align := alClient; + FShapeBrushPenMarginsFrame.BorderSpacing.Left := 8; + FShapeBrushPenMarginsFrame.BorderSpacing.Right := 8; + FShapeBrushPenMarginsFrame.BorderSpacing.Bottom := 8; + FShapeBrushPenMarginsFrame.Constraints.MinWidth := 230; + FShapeBrushPenMarginsFrame.OnChange := @ChangedHandler; + FShapeBrushPenMarginsFrame.OnShapeChange := @ShapeChangedHandler; + gbShapeBrushPenMargins.AutoSize := true; + BoldHeaders(Self); - FontFrame1.OnChange := @ChangedHandler; - ShapeBrushPenMarginsFrame1.OnChange := @ChangedHandler; + + ParamsPanel.AutoSize := true; end; procedure TTitleFootEditor.FormDestroy(Sender: TObject); @@ -100,12 +138,14 @@ end; procedure TTitleFootEditor.FormShow(Sender: TObject); begin + (* if cbShow.Checked then begin AutoSize := true; Constraints.MinWidth := Width; Constraints.MinHeight := Height; AutoSize := false; end; + *) end; procedure TTitleFootEditor.mmoTextChange(Sender: TObject); @@ -145,8 +185,9 @@ begin SetAlignment(ATitle.Alignment); mmoText.Font.Assign(ATitle.Font); - FontFrame1.Prepare(ATitle.Font, false); - ShapeBrushPenMarginsFrame1.Prepare(ATitle.Shape, ATitle.Brush, ATitle.Frame, ATitle.Margins); + mmoText.Font.Orientation := 0; + FFontFrame.Prepare(ATitle.Font, false); + FShapeBrushPenMarginsFrame.Prepare(ATitle.Shape, ATitle.Brush, ATitle.Frame, ATitle.Margins); end; procedure TTitleFootEditor.rgAlignmentClick(Sender: TObject); @@ -161,5 +202,10 @@ begin rgAlignment.ItemIndex := ALIGNMENTS[AValue]; end; +procedure TTitleFootEditor.ShapeChangedHandler(AShape: TChartLabelShape); +begin + FTitle.Shape := AShape; +end; + end.