mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-06-04 09:38:17 +02:00
fpvectorial: Improved visual test program (shows write/read test for both bottom/left and top/left coordinates)
git-svn-id: trunk@52902 -
This commit is contained in:
parent
66bd6bf419
commit
3846e84b9a
@ -1,33 +1,33 @@
|
||||
object MainForm: TMainForm
|
||||
Left = 335
|
||||
Height = 659
|
||||
Top = 155
|
||||
Width = 847
|
||||
Left = 307
|
||||
Height = 694
|
||||
Top = 164
|
||||
Width = 852
|
||||
Caption = 'Visual fpvectorial test'
|
||||
ClientHeight = 659
|
||||
ClientWidth = 847
|
||||
ClientHeight = 694
|
||||
ClientWidth = 852
|
||||
OnCreate = FormCreate
|
||||
OnDestroy = FormDestroy
|
||||
ShowHint = True
|
||||
LCLVersion = '1.7'
|
||||
object GbTree: TGroupBox
|
||||
Left = 4
|
||||
Height = 651
|
||||
Height = 686
|
||||
Top = 4
|
||||
Width = 299
|
||||
Width = 296
|
||||
Align = alClient
|
||||
BorderSpacing.Around = 4
|
||||
Caption = 'Test shapes and objects'
|
||||
ClientHeight = 631
|
||||
ClientWidth = 295
|
||||
ClientHeight = 666
|
||||
ClientWidth = 292
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object Tree: TTreeView
|
||||
Left = 4
|
||||
Height = 619
|
||||
Height = 654
|
||||
Top = 4
|
||||
Width = 287
|
||||
Width = 284
|
||||
Align = alClient
|
||||
BorderSpacing.Bottom = 4
|
||||
BorderSpacing.Around = 4
|
||||
@ -42,49 +42,49 @@ object MainForm: TMainForm
|
||||
end
|
||||
end
|
||||
object ScrollBox1: TScrollBox
|
||||
Left = 307
|
||||
Height = 659
|
||||
Left = 304
|
||||
Height = 694
|
||||
Top = 0
|
||||
Width = 540
|
||||
HorzScrollBar.Increment = 53
|
||||
HorzScrollBar.Page = 535
|
||||
Width = 548
|
||||
HorzScrollBar.Increment = 54
|
||||
HorzScrollBar.Page = 543
|
||||
HorzScrollBar.Smooth = True
|
||||
HorzScrollBar.Tracking = True
|
||||
VertScrollBar.Increment = 65
|
||||
VertScrollBar.Page = 652
|
||||
VertScrollBar.Increment = 62
|
||||
VertScrollBar.Page = 627
|
||||
VertScrollBar.Smooth = True
|
||||
VertScrollBar.Tracking = True
|
||||
Align = alRight
|
||||
BorderStyle = bsNone
|
||||
ClientHeight = 659
|
||||
ClientWidth = 540
|
||||
ClientHeight = 694
|
||||
ClientWidth = 548
|
||||
TabOrder = 1
|
||||
object AllTestsPanel: TPanel
|
||||
Left = 4
|
||||
Height = 644
|
||||
Height = 619
|
||||
Top = 4
|
||||
Width = 528
|
||||
Width = 536
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Around = 4
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 644
|
||||
ClientWidth = 528
|
||||
ClientHeight = 619
|
||||
ClientWidth = 536
|
||||
TabOrder = 0
|
||||
object gbRenderTest: TGroupBox
|
||||
AnchorSideLeft.Control = AllTestsPanel
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 283
|
||||
Height = 282
|
||||
Top = 0
|
||||
Width = 247
|
||||
Width = 255
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Right = 31
|
||||
Caption = 'Render test'
|
||||
ClientHeight = 263
|
||||
ClientWidth = 243
|
||||
ClientHeight = 262
|
||||
ClientWidth = 251
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
@ -92,7 +92,7 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 30
|
||||
Top = 2
|
||||
Width = 231
|
||||
Width = 239
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
@ -106,7 +106,7 @@ object MainForm: TMainForm
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 36
|
||||
Width = 223
|
||||
Width = 231
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 4
|
||||
@ -120,7 +120,7 @@ object MainForm: TMainForm
|
||||
Left = 16
|
||||
Height = 15
|
||||
Top = 55
|
||||
Width = 223
|
||||
Width = 231
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 16
|
||||
BorderSpacing.Top = 4
|
||||
@ -134,7 +134,7 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 74
|
||||
Width = 231
|
||||
Width = 239
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
@ -151,27 +151,28 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Side = asrBottom
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 4
|
||||
Height = 129
|
||||
Height = 128
|
||||
Top = 130
|
||||
Width = 112
|
||||
Width = 118
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 6
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Origin at bottom'
|
||||
ClientHeight = 109
|
||||
ClientWidth = 108
|
||||
Caption = 'Origin at BOTTOM'
|
||||
ClientHeight = 108
|
||||
ClientWidth = 114
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object BottomLeftPaintbox: TPaintBox
|
||||
AnchorSideLeft.Control = gbBottomLeft
|
||||
AnchorSideTop.Control = gbBottomLeft
|
||||
Left = 4
|
||||
Left = 6
|
||||
Height = 100
|
||||
Top = 3
|
||||
Top = 2
|
||||
Width = 100
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 6
|
||||
OnPaint = PaintBoxPaint
|
||||
@ -183,28 +184,29 @@ object MainForm: TMainForm
|
||||
AnchorSideTop.Control = gbBottomLeft
|
||||
AnchorSideBottom.Control = gbRenderTest
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 124
|
||||
Height = 129
|
||||
Left = 130
|
||||
Height = 128
|
||||
Top = 130
|
||||
Width = 112
|
||||
Width = 114
|
||||
Anchors = [akTop, akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Origin at top'
|
||||
ClientHeight = 109
|
||||
ClientWidth = 108
|
||||
Caption = 'Origin at TOP'
|
||||
ClientHeight = 108
|
||||
ClientWidth = 110
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
object TopLeftPaintbox: TPaintBox
|
||||
AnchorSideLeft.Control = gbTopLeft
|
||||
AnchorSideTop.Control = gbTopLeft
|
||||
Left = 4
|
||||
Left = 6
|
||||
Height = 100
|
||||
Top = 3
|
||||
Top = 2
|
||||
Width = 100
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 6
|
||||
OnPaint = PaintBoxPaint
|
||||
@ -235,13 +237,13 @@ object MainForm: TMainForm
|
||||
AnchorSideRight.Side = asrBottom
|
||||
AnchorSideBottom.Control = gbRenderTest
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 278
|
||||
Height = 283
|
||||
Left = 286
|
||||
Height = 282
|
||||
Top = 0
|
||||
Width = 250
|
||||
Anchors = [akTop, akLeft, akRight, akBottom]
|
||||
Caption = 'Reference image test'
|
||||
ClientHeight = 263
|
||||
ClientHeight = 262
|
||||
ClientWidth = 246
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
@ -295,28 +297,28 @@ object MainForm: TMainForm
|
||||
AnchorSideBottom.Control = gbReferenceImageTest
|
||||
AnchorSideBottom.Side = asrBottom
|
||||
Left = 4
|
||||
Height = 129
|
||||
Height = 128
|
||||
Top = 130
|
||||
Width = 112
|
||||
Width = 116
|
||||
Anchors = [akLeft, akBottom]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Bottom = 4
|
||||
Caption = 'Reference image'
|
||||
ClientHeight = 109
|
||||
ClientWidth = 108
|
||||
ClientHeight = 108
|
||||
ClientWidth = 112
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object RefImage: TImage
|
||||
AnchorSideTop.Control = GroupBox1
|
||||
Left = 4
|
||||
Left = 6
|
||||
Height = 100
|
||||
Top = 3
|
||||
Top = 2
|
||||
Width = 100
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 6
|
||||
BorderSpacing.Bottom = 6
|
||||
end
|
||||
end
|
||||
@ -328,15 +330,15 @@ object MainForm: TMainForm
|
||||
AnchorSideRight.Control = AllTestsPanel
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 0
|
||||
Height = 337
|
||||
Top = 307
|
||||
Width = 528
|
||||
Height = 313
|
||||
Top = 306
|
||||
Width = 536
|
||||
Anchors = [akTop, akLeft, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Top = 24
|
||||
Caption = 'Read/write test'
|
||||
ClientHeight = 317
|
||||
ClientWidth = 524
|
||||
ClientHeight = 293
|
||||
ClientWidth = 532
|
||||
Font.Style = [fsBold]
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
@ -344,7 +346,7 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 2
|
||||
Width = 508
|
||||
Width = 516
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
@ -358,125 +360,60 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 45
|
||||
Top = 72
|
||||
Width = 508
|
||||
Width = 516
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'If it does not click "View..." to open the image in an external viewer of the operating system. If the image is displayed correctly by the external viewer there is a bug in the file reader, otherwise the bug is in the writer.'
|
||||
Caption = 'If it does not click "Ext. viewer..." to open the image in an external viewer of the operating system. If the image is displayed correctly by the external viewer there is a bug in the file reader, otherwise the bug is in the writer.'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
object gbWMF: TGroupBox
|
||||
AnchorSideLeft.Control = gbSVG
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbSVG
|
||||
Left = 182
|
||||
Height = 157
|
||||
Top = 152
|
||||
Width = 169
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 9
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'wmf'
|
||||
ClientHeight = 137
|
||||
ClientWidth = 165
|
||||
ParentFont = False
|
||||
TabOrder = 0
|
||||
object BtnSaveAsWMF: TButton
|
||||
AnchorSideLeft.Control = gbWMF
|
||||
Left = 8
|
||||
Height = 25
|
||||
Top = 0
|
||||
Width = 89
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Save && load'
|
||||
OnClick = BtnSaveToFileClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object BtnViewWMF: TButton
|
||||
AnchorSideLeft.Control = BtnSaveAsWMF
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 101
|
||||
Height = 25
|
||||
Top = 0
|
||||
Width = 60
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'View...'
|
||||
OnClick = BtnViewImageClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object WMFPaintBox: TPaintBox
|
||||
AnchorSideLeft.Control = BtnSaveAsWMF
|
||||
AnchorSideTop.Control = BtnSaveAsWMF
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 100
|
||||
Top = 31
|
||||
Width = 100
|
||||
BorderSpacing.Bottom = 6
|
||||
OnPaint = PaintBoxPaint
|
||||
end
|
||||
end
|
||||
object gbSVG: TGroupBox
|
||||
object gbWRBottomLeft: TGroupBox
|
||||
AnchorSideLeft.Control = gbReadWriteTest
|
||||
AnchorSideTop.Control = RbWriteBottomLeftCoords
|
||||
AnchorSideTop.Control = CbFileFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 4
|
||||
Height = 157
|
||||
Top = 152
|
||||
Width = 169
|
||||
Height = 129
|
||||
Top = 156
|
||||
Width = 209
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'svg'
|
||||
ClientHeight = 137
|
||||
ClientWidth = 165
|
||||
Caption = 'Written with origin at BOTTOM'
|
||||
ClientHeight = 109
|
||||
ClientWidth = 205
|
||||
ParentFont = False
|
||||
TabOrder = 1
|
||||
object BtnSaveAsSvg: TButton
|
||||
AnchorSideLeft.Control = gbSVG
|
||||
Left = 8
|
||||
TabOrder = 0
|
||||
object BtnViewBottomLeft: TButton
|
||||
AnchorSideLeft.Control = WRBottomLeftPaintbox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = gbWRBottomLeft
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 114
|
||||
Height = 25
|
||||
Top = 0
|
||||
Width = 89
|
||||
Top = 42
|
||||
Width = 87
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Save && load'
|
||||
OnClick = BtnSaveToFileClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object BtnViewSVG: TButton
|
||||
AnchorSideLeft.Control = BtnSaveAsSvg
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
Left = 101
|
||||
Height = 25
|
||||
Top = 0
|
||||
Width = 60
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 4
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'View...'
|
||||
Caption = 'Ext viewer...'
|
||||
OnClick = BtnViewImageClick
|
||||
TabOrder = 1
|
||||
TabOrder = 0
|
||||
end
|
||||
object SVGPaintbox: TPaintBox
|
||||
AnchorSideLeft.Control = BtnSaveAsSvg
|
||||
AnchorSideTop.Control = BtnSaveAsSvg
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
object WRBottomLeftPaintbox: TPaintBox
|
||||
AnchorSideLeft.Control = gbWRBottomLeft
|
||||
AnchorSideTop.Control = gbWRBottomLeft
|
||||
Left = 6
|
||||
Height = 100
|
||||
Top = 31
|
||||
Top = 3
|
||||
Width = 100
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Bottom = 6
|
||||
OnPaint = PaintBoxPaint
|
||||
end
|
||||
@ -485,12 +422,12 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 30
|
||||
Top = 19
|
||||
Width = 508
|
||||
Width = 516
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 2
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'After clicking "Save && load" the image is written to file, and the file is opened and displayed in the box below.'
|
||||
Caption = 'After clicking "Save && load" both images (with bottom and top origin) are written to file and reloaded for display in the boxes below.'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
@ -499,45 +436,121 @@ object MainForm: TMainForm
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 53
|
||||
Width = 512
|
||||
Width = 520
|
||||
Align = alTop
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 4
|
||||
BorderSpacing.Right = 4
|
||||
Caption = 'This image must match the "Render test" image.'
|
||||
Caption = 'These images must match the "Render test" images.'
|
||||
Font.Style = [fsBold]
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
WordWrap = True
|
||||
end
|
||||
object RbWriteBottomLeftCoords: TRadioButton
|
||||
AnchorSideLeft.Control = LblReadWriteInstructions
|
||||
object CbFileFormat: TComboBox
|
||||
AnchorSideLeft.Control = Label1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = LblReadWriteInstructions
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 8
|
||||
Height = 19
|
||||
Left = 116
|
||||
Height = 23
|
||||
Top = 125
|
||||
Width = 191
|
||||
Width = 87
|
||||
BorderSpacing.Top = 8
|
||||
Caption = 'Use image with origin at bottom'
|
||||
Checked = True
|
||||
ItemHeight = 15
|
||||
ItemIndex = 0
|
||||
Items.Strings = (
|
||||
'svg'
|
||||
'wmf'
|
||||
)
|
||||
OnChange = CbFileFormatChange
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
TabStop = True
|
||||
Style = csDropDownList
|
||||
TabOrder = 1
|
||||
Text = 'svg'
|
||||
end
|
||||
object RbWriteTopLeftCoords: TRadioButton
|
||||
AnchorSideLeft.Control = RbWriteBottomLeftCoords
|
||||
object Label1: TLabel
|
||||
AnchorSideLeft.Control = LblReadWriteInstructions
|
||||
AnchorSideTop.Control = CbFileFormat
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 8
|
||||
Height = 15
|
||||
Top = 129
|
||||
Width = 100
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Right = 8
|
||||
Caption = 'File format for test:'
|
||||
ParentColor = False
|
||||
ParentFont = False
|
||||
end
|
||||
object BtnSaveToFiles: TButton
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = RbWriteBottomLeftCoords
|
||||
Left = 215
|
||||
Height = 19
|
||||
Top = 125
|
||||
Width = 256
|
||||
AnchorSideTop.Control = CbFileFormat
|
||||
AnchorSideTop.Side = asrCenter
|
||||
AnchorSideRight.Control = gbReadWriteTest
|
||||
AnchorSideRight.Side = asrBottom
|
||||
Left = 435
|
||||
Height = 25
|
||||
Top = 124
|
||||
Width = 89
|
||||
Anchors = [akTop, akRight]
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 16
|
||||
Caption = 'at top (Click "Save && load" after changing)'
|
||||
BorderSpacing.Right = 8
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Save && load'
|
||||
OnClick = BtnSaveToFilesClick
|
||||
ParentFont = False
|
||||
TabOrder = 2
|
||||
end
|
||||
object gbWRTopLeft: TGroupBox
|
||||
AnchorSideLeft.Control = gbWRBottomLeft
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = CbFileFormat
|
||||
AnchorSideTop.Side = asrBottom
|
||||
Left = 221
|
||||
Height = 129
|
||||
Top = 156
|
||||
Width = 212
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Top = 8
|
||||
BorderSpacing.Bottom = 8
|
||||
Caption = 'Written with origin at TOP'
|
||||
ClientHeight = 109
|
||||
ClientWidth = 208
|
||||
ParentFont = False
|
||||
TabOrder = 3
|
||||
object BtnViewTopLeft: TButton
|
||||
AnchorSideLeft.Control = WRTopLeftPaintbox
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = WRTopLeftPaintbox
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 114
|
||||
Height = 25
|
||||
Top = 41
|
||||
Width = 90
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
BorderSpacing.Right = 4
|
||||
BorderSpacing.Bottom = 6
|
||||
Caption = 'Ext. viewer...'
|
||||
OnClick = BtnViewImageClick
|
||||
TabOrder = 0
|
||||
end
|
||||
object WRTopLeftPaintbox: TPaintBox
|
||||
AnchorSideLeft.Control = gbWRTopLeft
|
||||
AnchorSideTop.Control = gbWRTopLeft
|
||||
Left = 6
|
||||
Height = 100
|
||||
Top = 3
|
||||
Width = 100
|
||||
BorderSpacing.Left = 6
|
||||
BorderSpacing.Top = 3
|
||||
BorderSpacing.Bottom = 6
|
||||
OnPaint = PaintBoxPaint
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -27,27 +27,28 @@ type
|
||||
AIntParam: Integer = MaxInt);
|
||||
end;
|
||||
|
||||
TRenderCoords = (rcBottomLeftCoords, rcTopLeftCoords);
|
||||
|
||||
{ TMainForm }
|
||||
|
||||
TMainForm = class(TForm)
|
||||
BtnSaveAsRef: TButton;
|
||||
BtnSaveAsWMF: TButton;
|
||||
BtnSaveAsSvg: TButton;
|
||||
BtnViewWMF: TButton;
|
||||
BtnViewSVG: TButton;
|
||||
gbWMF: TGroupBox;
|
||||
gbSVG: TGroupBox;
|
||||
BtnSaveToFiles: TButton;
|
||||
BtnViewBottomLeft: TButton;
|
||||
BtnViewTopLeft: TButton;
|
||||
CbFileFormat: TComboBox;
|
||||
gbWRBottomLeft: TGroupBox;
|
||||
gbRenderTest: TGroupBox;
|
||||
gbBottomLeft: TGroupBox;
|
||||
gbWRTopLeft: TGroupBox;
|
||||
gbTopLeft: TGroupBox;
|
||||
gbReferenceImageTest: TGroupBox;
|
||||
GroupBox1: TGroupBox;
|
||||
gbReadWriteTest: TGroupBox;
|
||||
GbTree: TGroupBox;
|
||||
Label1: TLabel;
|
||||
Label14: TLabel;
|
||||
LblBothImagesMustMatch1: TLabel;
|
||||
RbWriteBottomLeftCoords: TRadioButton;
|
||||
RbWriteTopLeftCoords: TRadioButton;
|
||||
RefImage: TImage;
|
||||
Label10: TLabel;
|
||||
Label11: TLabel;
|
||||
@ -60,14 +61,15 @@ type
|
||||
LblReadWriteInstructions: TLabel;
|
||||
BottomLeftPaintbox: TPaintBox;
|
||||
ScrollBox1: TScrollBox;
|
||||
WRTopLeftPaintbox: TPaintBox;
|
||||
TopLeftPaintbox: TPaintBox;
|
||||
SVGPaintbox: TPaintBox;
|
||||
WMFPaintBox: TPaintBox;
|
||||
WRBottomLeftPaintbox: TPaintBox;
|
||||
AllTestsPanel: TPanel;
|
||||
Tree: TTreeView;
|
||||
procedure BtnSaveToFileClick(Sender: TObject);
|
||||
procedure BtnSaveToFilesClick(Sender: TObject);
|
||||
procedure BtnSaveAsRefClick(Sender: TObject);
|
||||
procedure BtnViewImageClick(Sender: TObject);
|
||||
procedure CbFileFormatChange(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure FormDestroy(Sender: TObject);
|
||||
procedure PaintBoxPaint(Sender: TObject);
|
||||
@ -77,18 +79,20 @@ type
|
||||
|
||||
private
|
||||
{ private declarations }
|
||||
FDocTopLeft: TvVectorialDocument;
|
||||
FDocBottomLeft: TvVectorialDocument;
|
||||
FDocFromWMF: TvVectorialDocument;
|
||||
FDocFromSVG: TvVectorialDocument;
|
||||
procedure CreateDocument(var ADoc: TvVectorialDocument;
|
||||
var APage: TvVectorialPage; AUseTopLeftCoords: boolean);
|
||||
FDoc: array[TRenderCoords] of TvVectorialDocument;
|
||||
FDocFromWMF: array[TRenderCoords] of TvVectorialDocument;
|
||||
FDocFromSVG: array[TRenderCoords] of TvVectorialDocument;
|
||||
function GetFileFormat: TvVectorialFormat;
|
||||
function GetFileFormatExt: String;
|
||||
procedure Populate;
|
||||
procedure PrepareDoc(var ADoc: TvVectorialDocument; var APage: TvVectorialPage;
|
||||
AUseTopLeftCoords: boolean);
|
||||
procedure ReadIni;
|
||||
procedure ShowFileImage(AFilename: String);
|
||||
procedure ShowReadWriteTestImages;
|
||||
procedure ShowFileImage(AFilename: String; AUseTopLeftCoords: Boolean;
|
||||
APaintbox: TPaintbox);
|
||||
procedure ShowRefImageTest;
|
||||
procedure ShowRenderTestImages;
|
||||
procedure ShowWriteReadTestImages;
|
||||
procedure UpdateCmdStates;
|
||||
procedure WriteIni;
|
||||
|
||||
@ -176,10 +180,10 @@ begin
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if RenderParams = nil then
|
||||
exit;
|
||||
if FDocBottomLeft = nil then
|
||||
if FDoc[rcBottomLeftCoords] = nil then
|
||||
exit;
|
||||
|
||||
page := FDocBottomLeft.GetPageAsVectorial(0);
|
||||
page := FDoc[rcBottomLeftCoords].GetPageAsVectorial(0);
|
||||
|
||||
bmp := TBitmap.Create;
|
||||
try
|
||||
@ -205,7 +209,7 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.BtnSaveToFileClick(Sender: TObject);
|
||||
procedure TMainForm.BtnSaveToFilesClick(Sender: TObject);
|
||||
var
|
||||
fn: String;
|
||||
renderParams: TRenderParams;
|
||||
@ -213,32 +217,26 @@ var
|
||||
fmt: TvVectorialFormat;
|
||||
ext: String;
|
||||
begin
|
||||
if FDocBottomLeft = nil then
|
||||
exit;
|
||||
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if RenderParams = nil then
|
||||
exit;
|
||||
|
||||
if Sender = BtnSaveAsSVG then begin
|
||||
ext := 'svg';
|
||||
fmt := vfSVG;
|
||||
end else
|
||||
if Sender = BtnSaveAsWMF then begin
|
||||
ext := 'wmf';
|
||||
fmt := vfWindowsMetafileWMF;
|
||||
end else
|
||||
exit;
|
||||
|
||||
fmt := GetFileFormat;
|
||||
ext := GetFileFormatExt;
|
||||
folder := IMG_FOLDER + ext + PathDelim;
|
||||
fn := folder + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
ForceDirectory(folder);
|
||||
if RbWriteBottomLeftCoords.Checked then
|
||||
FDocBottomLeft.WriteToFile(fn, fmt)
|
||||
else if RbWriteTopLeftCoords.Checked then
|
||||
FDocTopLeft.WriteToFile(fn, fmt);
|
||||
|
||||
ShowFileImage(fn);
|
||||
if FDoc[rcBottomLeftCoords] <> nil then begin
|
||||
fn := folder + 'bl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
FDoc[rcBottomLeftCoords].WriteToFile(fn, fmt);
|
||||
ShowFileImage(fn, false, WRBottomLeftPaintbox);
|
||||
end;
|
||||
|
||||
if FDoc[rcTopLeftCoords] <> nil then begin
|
||||
fn := folder + 'tl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
FDoc[rcTopLeftCoords].WriteToFile(fn, fmt);
|
||||
ShowFileImage(fn, true, WRTopLeftPaintbox);
|
||||
end;
|
||||
|
||||
UpdateCmdStates;
|
||||
end;
|
||||
@ -247,30 +245,36 @@ procedure TMainForm.BtnViewImageClick(Sender: TObject);
|
||||
var
|
||||
fn: String;
|
||||
ext: String;
|
||||
folder: String;
|
||||
renderParams: TRenderParams;
|
||||
begin
|
||||
if Sender = BtnViewSVG then
|
||||
begin
|
||||
BtnSaveToFileClick(BtnSaveAsSVG);
|
||||
ext := 'svg';
|
||||
end else
|
||||
if Sender = BtnViewWMF then
|
||||
begin
|
||||
BtnSaveToFileClick(BtnSaveAsWMF);
|
||||
ext := 'wmf';
|
||||
end else
|
||||
exit;
|
||||
BtnSaveToFilesClick(nil);
|
||||
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if renderParams = nil then
|
||||
exit;
|
||||
|
||||
fn := IMG_FOLDER + ext + PathDelim + ChangeFileExt(renderParams.RefFile, '.'+ext);
|
||||
ext := GetFileFormatExt;
|
||||
folder := IMG_FOLDER + ext + PathDelim;
|
||||
|
||||
if Sender = BtnViewBottomLeft then
|
||||
fn := folder + 'bl_' + ChangeFileExt(renderParams.RefFile, '.' + ext)
|
||||
else if Sender = BtnViewTopLeft then
|
||||
fn := folder + 'tl_' + ChangeFileExt(renderParams.RefFile, '.' + ext)
|
||||
else
|
||||
raise Exception.Create('BtnViewImageClick: this sender is not supported.');
|
||||
|
||||
if FileExists(fn) then
|
||||
OpenDocument(fn);
|
||||
end;
|
||||
|
||||
procedure TMainForm.CreateDocument(var ADoc: TvVectorialDocument;
|
||||
procedure TMainForm.CbFileFormatChange(Sender: TObject);
|
||||
begin
|
||||
ShowWriteReadTestImages;
|
||||
UpdateCmdStates;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PrepareDoc(var ADoc: TvVectorialDocument;
|
||||
var APage: TvVectorialPage; AUseTopLeftCoords: boolean);
|
||||
var
|
||||
r: TvRectangle;
|
||||
@ -302,8 +306,9 @@ end;
|
||||
procedure TMainForm.FormCreate(Sender: TObject);
|
||||
begin
|
||||
RefImage.Hint := NOT_SAVED;
|
||||
SVGPaintbox.Hint := NOT_SAVED;
|
||||
WMFPaintbox.Hint := NOT_SAVED;
|
||||
WRBottomLeftPaintbox.Hint := NOT_SAVED;
|
||||
WRTopLeftPaintbox.Hint := NOT_SAVED;
|
||||
|
||||
ReadIni;
|
||||
Populate;
|
||||
TreeSelectionChanged(nil);
|
||||
@ -312,6 +317,7 @@ end;
|
||||
procedure TMainForm.FormDestroy(Sender: TObject);
|
||||
var
|
||||
parentnode, node: TTreeNode;
|
||||
rc: TRenderCoords;
|
||||
begin
|
||||
parentnode := Tree.Items.GetFirstNode;
|
||||
while parentnode <> nil do begin
|
||||
@ -323,30 +329,64 @@ begin
|
||||
parentnode := parentnode.GetNextSibling;
|
||||
end;
|
||||
|
||||
FreeAndNil(FDocBottomLeft);
|
||||
FreeAndNil(FDocTopLeft);
|
||||
FreeAndNil(FDocFromSVG);
|
||||
FreeAndNil(FDocFromWMF);
|
||||
for rc in TRenderCoords do begin
|
||||
FreeAndNil(FDoc[rc]);
|
||||
FreeAndNil(FDocFromSVG[rc]);
|
||||
FreeAndNil(FDocFromWMF[rc]);
|
||||
end;
|
||||
|
||||
WriteIni;
|
||||
end;
|
||||
|
||||
function TMainForm.GetFileFormat: TvVectorialFormat;
|
||||
begin
|
||||
case CbFileFormat.ItemIndex of
|
||||
0: Result := vfSVG;
|
||||
1: Result := vfWindowsMetafileWMF;
|
||||
else raise Exception.Create('Format not supported');
|
||||
end;
|
||||
end;
|
||||
|
||||
function TMainForm.GetFileFormatExt: String;
|
||||
begin
|
||||
case CbFileFormat.ItemIndex of
|
||||
0: Result := 'svg';
|
||||
1: Result := 'wmf';
|
||||
else raise Exception.Create('Format not supported');
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.PaintBoxPaint(Sender: TObject);
|
||||
var
|
||||
doc: TvVectorialDocument;
|
||||
page: TvVectorialPage;
|
||||
w, h: Integer;
|
||||
fmt: TvVectorialFormat;
|
||||
rc: TRenderCoords;
|
||||
begin
|
||||
if Sender = BottomLeftPaintbox then
|
||||
doc := FDocBottomLeft
|
||||
else if Sender = TopLeftPaintbox then
|
||||
doc := FDocTopLeft
|
||||
else if Sender = SVGPaintbox then
|
||||
doc := FDocFromSVG
|
||||
else if Sender = WMFPaintbox then
|
||||
doc := FDocFromWMF
|
||||
fmt := GetFileFormat;
|
||||
|
||||
if (Sender = BottomLeftPaintbox) or (Sender = WRBottomLeftPaintbox) then
|
||||
rc := rcBottomLeftCoords
|
||||
else
|
||||
exit;
|
||||
if (Sender = TopLeftPaintbox) or (Sender = WRTopLeftPaintbox) then
|
||||
rc := rcTopLeftCoords
|
||||
else
|
||||
raise Exception.Create('This sender is not supported here.');
|
||||
|
||||
doc := nil;
|
||||
if (Sender = BottomLeftPaintbox) or (Sender = TopLeftPaintbox) then
|
||||
doc := FDoc[rc]
|
||||
else
|
||||
if (Sender = WRBottomLeftPaintbox) or (Sender = WRTopLeftPaintbox) then
|
||||
case GetFileFormat of
|
||||
vfSVG:
|
||||
doc := FDocFromSVG[rc];
|
||||
vfWindowsMetafileWMF:
|
||||
doc := FDocFromWMF[rc];
|
||||
else
|
||||
raise Exception.Create('File format not supported.');
|
||||
end;
|
||||
|
||||
w := TPaintbox(Sender).Width;
|
||||
h := TPaintbox(Sender).Height;
|
||||
@ -425,21 +465,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q41.png', $0207));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q1.png', $0300));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q1r.png', $0300));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q12.png', $0301));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q12r.png', $0301));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q2.png', $0302));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q2r.png', $0302));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q23.png', $0303));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q23r.png', $0303));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q3.png', $0304));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q3r.png', $0304));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q34.png', $0305));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q34r.png', $0305));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q4.png', $0306));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q4r.png', $0306));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_cw_q41.png', $0307));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_cw_q41r.png', $0307));
|
||||
|
||||
node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2');
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I',
|
||||
@ -460,21 +500,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q41.png', $0007));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q1.png', $0100));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q1r.png', $0100));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q12.png', $0101));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q12r.png', $0101));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q2.png', $0102));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q2r.png', $0102));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q23.png', $0103));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q23r.png', $0103));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q3.png', $0104));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q3r.png', $0104));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q34.png', $0105));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q34r.png', $0105));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q4.png', $0106));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q4r.png', $0106));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_rev_ccw_q41.png', $0107));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ccw_q41r.png', $0107));
|
||||
|
||||
node1 := Tree.Items.AddChild(node0, 'elliptical');
|
||||
node := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2');
|
||||
@ -496,21 +536,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41.png', $1207));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q1.png', $1300));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q1r.png', $1300));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q12.png', $1301));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q12r.png', $1301));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q2.png', $1302));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q2r.png', $1302));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q23.png', $1303));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q23r.png', $1303));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q3.png', $1304));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q3r.png', $1304));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q34.png', $1305));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q34r.png', $1305));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q4.png', $1306));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q4r.png', $1306));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_cw_q41.png', $1307));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_cw_q41r.png', $1307));
|
||||
|
||||
node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2');
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I',
|
||||
@ -531,21 +571,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41.png', $1007));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q1.png', $1100));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q1r.png', $1100));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q12.png', $1101));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q12r.png', $1101));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q2.png', $1102));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q2r.png', $1102));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q23.png', $1103));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q23r.png', $1103));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q3.png', $1104));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q3r.png', $1104));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q34.png', $1105));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q34r.png', $1105));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q4.png', $1106));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q4r.png', $1106));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_rev_ccw_q41.png', $1107));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ell_ccw_q41r.png', $1107));
|
||||
|
||||
node1 := Tree.Items.AddChild(node0, 'elliptical, rotated 30deg');
|
||||
node := Tree.Items.AddChild(node1, 'clockwise from point 1 to point 2');
|
||||
@ -567,21 +607,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41.png', $2207));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q1.png', $2300));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q1r.png', $2300));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q12.png', $2301));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q12r.png', $2301));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q2.png', $2302));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q2r.png', $2302));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q23.png', $2303));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q23r.png', $2303));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q3.png', $2304));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q3r.png', $2304));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q34.png', $2305));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q34r.png', $2305));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q4.png', $2306));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q4r.png', $2306));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_cw_q41.png', $2307));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_cw_q41r.png', $2307));
|
||||
|
||||
node := Tree.Items.AddChild(node1, 'counter-clockwise from point 1 to point 2');
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I',
|
||||
@ -602,21 +642,21 @@ begin
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41.png', $2007));
|
||||
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q1.png', $2100));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q1r.png', $2100));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant I+II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q12.png', $2101));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q12r.png', $2101));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q2.png', $2102));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q2r.png', $2102));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant II+III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q23.png', $2103));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q23r.png', $2103));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q3.png', $2104));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q3r.png', $2104));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant III+IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q34.png', $2105));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q34r.png', $2105));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q4.png', $2106));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q4r.png', $2106));
|
||||
Tree.Items.AddChildObject(node, 'Quadrant IV+I, reverse',
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_rev_ccw_q41.png', $2107));
|
||||
TRenderParams.Create(@Render_Arc, 'arc_ellrot_ccw_q41r.png', $2107));
|
||||
|
||||
{ -----------------------------------------------}
|
||||
node0 := Tree.Items.AddChild(nil, 'Gradients');
|
||||
@ -1013,56 +1053,41 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ShowFileImage(AFilename: String);
|
||||
procedure TMainForm.ShowFileImage(AFilename: String; AUseTopLeftCoords: Boolean;
|
||||
APaintbox: TPaintbox);
|
||||
var
|
||||
ext: String;
|
||||
rc: TRenderCoords;
|
||||
begin
|
||||
if AUseTopLeftCoords then
|
||||
rc := rcTopLeftCoords else
|
||||
rc := rcBottomLeftCoords;
|
||||
|
||||
ext := Lowercase(ExtractFileExt(AFileName));
|
||||
if ext = '.svg' then begin
|
||||
FreeAndNil(FDocFromSVG);
|
||||
if FileExists(AFileName) then begin
|
||||
FDocFromSVG := TvVectorialDocument.Create;
|
||||
FDocFromSVG.ReadFromFile(AFileName);
|
||||
SVGPaintbox.Hint := AFilename;
|
||||
end else begin
|
||||
SVGPaintbox.Hint := NOT_SAVED;
|
||||
|
||||
if not FileExists(AFileName) then begin
|
||||
case ext of
|
||||
'.svg': FreeAndNil(FDocFromSVG[rc]);
|
||||
'.wmf': FreeAndNil(FDocFromWMF[rc]);
|
||||
else raise Exception.Create('File type not supported');
|
||||
end;
|
||||
SVGPaintbox.Invalidate;
|
||||
APaintbox.Hint := NOT_SAVED;
|
||||
APaintbox.Invalidate;
|
||||
exit;
|
||||
end;
|
||||
|
||||
if ext = '.svg' then begin
|
||||
FreeAndNil(FDocFromSVG[rc]);
|
||||
FDocFromSVG[rc] := TvVectorialDocument.Create;
|
||||
FDocFromSVG[rc].ReadFromFile(AFileName);
|
||||
end else
|
||||
if ext = '.wmf' then begin
|
||||
FreeAndNil(FDocFromWMF);
|
||||
if FileExists(AFileName) then begin
|
||||
FDocFromWMF := TvVectorialDocument.Create;
|
||||
FDocFromWMF.ReadFromFile(AFilename);
|
||||
WMFPaintBox.Hint := AFileName;
|
||||
end else begin
|
||||
WMFPaintBox.Hint := NOT_SAVED;
|
||||
end;
|
||||
WMFPaintBox.Invalidate;
|
||||
FreeAndNil(FDocFromWMF[rc]);
|
||||
FDocFromWMF[rc] := TvVectorialDocument.Create;
|
||||
FDocFromWMF[rc].ReadFromFile(AFilename);
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ShowReadWriteTestImages;
|
||||
var
|
||||
renderParams: TRenderParams;
|
||||
fn: String;
|
||||
begin
|
||||
if Tree.Selected = nil then
|
||||
exit;
|
||||
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if renderParams = nil then
|
||||
begin
|
||||
SVGPaintbox.Invalidate;
|
||||
WMFPaintbox.Invalidate;
|
||||
exit;
|
||||
end;
|
||||
|
||||
fn := IMG_FOLDER + 'svg' + PathDelim + ChangeFileExt(renderParams.RefFile, '.svg');
|
||||
ShowFileImage(fn);
|
||||
|
||||
fn := IMG_FOLDER + 'wmf' + PathDelim + ChangeFileExt(renderParams.RefFile, '.wmf');
|
||||
ShowFileImage(fn);
|
||||
APaintbox.Hint := AFileName;
|
||||
APaintBox.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ShowRefImageTest;
|
||||
@ -1107,22 +1132,56 @@ begin
|
||||
end;
|
||||
|
||||
// Render document with bottom/left origin
|
||||
CreateDocument(FDocBottomLeft, page, false);
|
||||
PrepareDoc(FDoc[rcBottomLeftCoords], page, false);
|
||||
renderParams.OnRender(page, renderParams.IntParam);
|
||||
BottomLeftPaintbox.Invalidate;
|
||||
|
||||
// Render document with top/left origin
|
||||
CreateDocument(FDocTopLeft, page, true);
|
||||
PrepareDoc(FDoc[rcTopLeftCoords], page, true);
|
||||
renderParams.OnRender(page, renderParams.IntParam);
|
||||
TopLeftPaintbox.Invalidate;
|
||||
end;
|
||||
|
||||
procedure TMainForm.ShowWriteReadTestImages;
|
||||
var
|
||||
renderParams: TRenderParams;
|
||||
folder: String;
|
||||
fn: String;
|
||||
ext: String;
|
||||
rc: TRenderCoords;
|
||||
begin
|
||||
for rc in TRenderCoords do begin
|
||||
FreeAndNil(FDocFromSVG[rc]);
|
||||
FreeAndNil(FDocFromWMF[rc]);
|
||||
end;
|
||||
|
||||
if Tree.Selected = nil then
|
||||
exit;
|
||||
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if renderParams = nil then
|
||||
begin
|
||||
WRBottomLeftPaintbox.Invalidate;
|
||||
WRTopLeftPaintbox.Invalidate;
|
||||
exit;
|
||||
end;
|
||||
|
||||
ext := GetFileFormatExt;
|
||||
folder := IMG_FOLDER + ext + PathDelim;
|
||||
|
||||
fn := folder + 'bl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
ShowFileImage(fn, false, WRBottomLeftPaintbox);
|
||||
|
||||
fn := folder + 'tl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
ShowFileImage(fn, true, WRTopLeftPaintbox);
|
||||
end;
|
||||
|
||||
procedure TMainForm.TreeSelectionChanged(Sender: TObject);
|
||||
begin
|
||||
UpdateCmdStates;
|
||||
ShowRenderTestImages;
|
||||
ShowRefImageTest;
|
||||
ShowReadWriteTestImages;
|
||||
ShowWriteReadTestImages;
|
||||
UpdateCmdStates;
|
||||
end;
|
||||
|
||||
procedure TMainForm.TreeCustomDrawItem(Sender: TCustomTreeView; Node: TTreeNode;
|
||||
@ -1136,26 +1195,30 @@ end;
|
||||
procedure TMainForm.UpdateCmdStates;
|
||||
var
|
||||
fn: String;
|
||||
folder: string;
|
||||
renderParams: TRenderParams;
|
||||
svgOK, wmfOK: boolean;
|
||||
ext: String;
|
||||
rc: TRenderCoords;
|
||||
rcOK: array[TRenderCoords] of boolean = (false, false);
|
||||
begin
|
||||
BtnSaveAsRef.Enabled := Tree.Selected <> nil;
|
||||
BtnSaveAsWMF.Enabled := Tree.Selected <> nil;
|
||||
BtnSaveAsSVG.Enabled := Tree.Selected <> nil;
|
||||
BtnSaveToFiles.Enabled := Tree.Selected <> nil;
|
||||
BtnViewBottomLeft.Enabled := Tree.Selected <> nil;
|
||||
BtnViewTopLeft.Enabled := Tree.Selected <> nil;
|
||||
|
||||
svgOK := false;
|
||||
wmfOK := false;
|
||||
if Tree.Selected <> nil then begin
|
||||
renderParams := TRenderParams(Tree.Selected.Data);
|
||||
if renderParams <> nil then begin
|
||||
fn := IMG_FOLDER + 'svg' + PathDelim + ChangeFileExt(renderParams.RefFile, '.svg');
|
||||
svgOK := FileExists(fn);
|
||||
fn := IMG_FOLDER + 'wmf' + PathDelim + ChangeFileExt(renderParams.RefFile, '.wmf');
|
||||
wmfOK := FileExists(fn);
|
||||
ext := GetFileFormatExt;
|
||||
folder := IMG_FOLDER + ext + PathDelim;
|
||||
fn := folder + 'bl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
rcOK[rcBottomLeftCoords] := FileExists(fn);
|
||||
fn := folder + 'tl_' + ChangeFileExt(renderParams.RefFile, '.' + ext);
|
||||
rcOK[rcTopLeftCoords] := FileExists(fn);
|
||||
end;
|
||||
end;
|
||||
BtnViewSVG.Enabled := svgOK;
|
||||
BtnViewWMF.Enabled := wmfOK;
|
||||
BtnViewBottomLeft.Enabled := rcOK[rcBottomLeftcoords];
|
||||
BtnViewTopLeft.Enabled := rcOK[rcTopLeftCoords];
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Loading…
Reference in New Issue
Block a user