fpvviewer: Adapts to support the new background color

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2606 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2012-12-28 12:32:48 +00:00
parent eb0708fe6a
commit 39fc078e2e
2 changed files with 214 additions and 194 deletions

View File

@@ -9,70 +9,15 @@ object frmFPVViewer: TfrmFPVViewer
OnCreate = FormCreate
OnDestroy = FormDestroy
LCLVersion = '1.1'
object editFileName: TFileNameEdit
Left = 8
Height = 23
Top = 8
Width = 304
DialogOptions = []
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 1
MaxLength = 0
TabOrder = 0
end
object btnVisualize: TButton
Left = 8
Height = 25
Top = 40
Width = 96
Caption = 'Visualize'
OnClick = btnVisualizeClick
TabOrder = 1
end
object spinScale: TFloatSpinEdit
Left = 72
Height = 23
Top = 97
Width = 168
DecimalPlaces = 6
Increment = 0.1
MaxValue = 100
MinValue = 0
OnChange = spinScaleChange
TabOrder = 2
Value = 1
end
object Label1: TLabel
Left = 8
Height = 15
Top = 97
Width = 46
Caption = 'Scale by:'
ParentColor = False
end
object btnViewDXFTokens: TButton
Left = 112
Height = 25
Top = 41
Width = 128
Caption = 'View DXF Tokens'
OnClick = btnViewDXFTokensClick
TabOrder = 3
end
object notebook: TNotebook
AnchorSideRight.Control = Owner
AnchorSideRight.Side = asrBottom
AnchorSideBottom.Control = Owner
AnchorSideBottom.Side = asrBottom
Left = 0
Height = 448
Top = 152
Height = 424
Top = 176
Width = 485
PageIndex = 0
Anchors = [akTop, akLeft, akRight, akBottom]
TabOrder = 4
Align = alClient
Anchors = [akLeft, akBottom]
TabOrder = 0
TabStop = True
object pageViewer: TPage
end
@@ -109,131 +54,201 @@ object frmFPVViewer: TfrmFPVViewer
end
end
end
object buttonRenderingTest: TButton
Left = 256
Height = 25
Top = 41
Width = 96
Caption = 'Render Test'
OnClick = buttonRenderingTestClick
TabOrder = 5
end
object Button1: TButton
Left = 360
Height = 25
Top = 41
Width = 120
Caption = 'Convert to SVG'
OnClick = Button1Click
TabOrder = 6
end
object btnContourLines: TButton
Left = 256
Height = 25
Top = 97
Width = 224
Caption = 'Generate Contour Lines'
OnClick = btnContourLinesClick
TabOrder = 7
end
object Label2: TLabel
Left = 8
Height = 15
Top = 72
Width = 73
Caption = 'Y adjustment:'
ParentColor = False
end
object spinAdjustY: TSpinEdit
Left = 80
Height = 23
Top = 72
Width = 72
Increment = 100
MaxValue = 1000
MinValue = -1000
TabOrder = 8
end
object spinAdjustX: TSpinEdit
Left = 232
Height = 23
Top = 72
Width = 72
Increment = 50
MaxValue = 1000
MinValue = -1000
TabOrder = 9
end
object Label3: TLabel
Left = 160
Height = 15
Top = 72
Width = 73
Caption = 'X adjustment:'
ParentColor = False
end
object Button2: TButton
Left = 312
Height = 25
Top = 70
Width = 168
Caption = 'View FPVectorial Tokens'
OnClick = Button2Click
TabOrder = 10
end
object Label4: TLabel
Left = 9
Height = 15
Top = 126
Width = 128
Caption = 'Force encoding on read:'
ParentColor = False
end
object comboEncoding: TComboBox
Left = 144
Height = 23
Top = 126
Width = 128
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Read from the file'
'utf8'
'ansi'
'ucs2le'
'ucs2be'
'iso88591'
'iso88592'
'cp1250'
'cp1251'
'cp1252'
'cp1253'
'cp1254'
'cp1255'
'cp1256'
'cp1257'
'cp1258'
'cp437'
'cp850'
'cp852'
'cp866'
'cp874'
'cp936'
'cp950'
'cp949'
'cp932'
'koi8'
)
Style = csDropDownList
TabOrder = 11
Text = 'Read from the file'
end
object labelFileEncoding: TLabel
Left = 278
Height = 15
Top = 130
Width = 74
Caption = 'File encoding:'
ParentColor = False
object Panel1: TPanel
Left = 0
Height = 176
Top = 0
Width = 485
Align = alTop
ClientHeight = 176
ClientWidth = 485
TabOrder = 1
object editFileName: TFileNameEdit
Left = 8
Height = 23
Top = 8
Width = 304
DialogOptions = []
FilterIndex = 0
HideDirectories = False
ButtonWidth = 23
NumGlyphs = 1
MaxLength = 0
TabOrder = 0
end
object btnVisualize: TButton
Left = 8
Height = 25
Top = 40
Width = 96
Caption = 'Visualize'
OnClick = btnVisualizeClick
TabOrder = 1
end
object spinScale: TFloatSpinEdit
Left = 72
Height = 23
Top = 97
Width = 168
DecimalPlaces = 6
Increment = 0.1
MaxValue = 100
MinValue = 0
OnChange = spinScaleChange
TabOrder = 2
Value = 1
end
object Label1: TLabel
Left = 8
Height = 15
Top = 97
Width = 46
Caption = 'Scale by:'
ParentColor = False
end
object btnViewDXFTokens: TButton
Left = 112
Height = 25
Top = 41
Width = 128
Caption = 'View DXF Tokens'
OnClick = btnViewDXFTokensClick
TabOrder = 3
end
object buttonRenderingTest: TButton
Left = 256
Height = 25
Top = 41
Width = 96
Caption = 'Render Test'
OnClick = buttonRenderingTestClick
TabOrder = 4
end
object Button1: TButton
Left = 360
Height = 25
Top = 41
Width = 120
Caption = 'Convert to SVG'
OnClick = Button1Click
TabOrder = 5
end
object btnContourLines: TButton
Left = 256
Height = 25
Top = 97
Width = 224
Caption = 'Generate Contour Lines'
OnClick = btnContourLinesClick
TabOrder = 6
end
object Label2: TLabel
Left = 8
Height = 15
Top = 72
Width = 73
Caption = 'Y adjustment:'
ParentColor = False
end
object spinAdjustY: TSpinEdit
Left = 80
Height = 23
Top = 72
Width = 72
Increment = 100
MaxValue = 1000
MinValue = -1000
TabOrder = 7
end
object spinAdjustX: TSpinEdit
Left = 232
Height = 23
Top = 72
Width = 72
Increment = 50
MaxValue = 1000
MinValue = -1000
TabOrder = 8
end
object Label3: TLabel
Left = 160
Height = 15
Top = 72
Width = 73
Caption = 'X adjustment:'
ParentColor = False
end
object Button2: TButton
Left = 312
Height = 25
Top = 70
Width = 168
Caption = 'View FPVectorial Tokens'
OnClick = Button2Click
TabOrder = 9
end
object Label4: TLabel
Left = 9
Height = 15
Top = 126
Width = 128
Caption = 'Force encoding on read:'
ParentColor = False
end
object comboEncoding: TComboBox
Left = 144
Height = 23
Top = 126
Width = 128
ItemHeight = 15
ItemIndex = 0
Items.Strings = (
'Read from the file'
'utf8'
'ansi'
'ucs2le'
'ucs2be'
'iso88591'
'iso88592'
'cp1250'
'cp1251'
'cp1252'
'cp1253'
'cp1254'
'cp1255'
'cp1256'
'cp1257'
'cp1258'
'cp437'
'cp850'
'cp852'
'cp866'
'cp874'
'cp936'
'cp950'
'cp949'
'cp932'
'koi8'
)
Style = csDropDownList
TabOrder = 10
Text = 'Read from the file'
end
object labelFileEncoding: TLabel
Left = 278
Height = 15
Top = 130
Width = 74
Caption = 'File encoding:'
ParentColor = False
end
object checkForceWhiteBackground: TCheckBox
Left = 9
Height = 19
Top = 152
Width = 153
Caption = 'Force white background?'
TabOrder = 11
end
end
end

View File

@@ -6,7 +6,7 @@ interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, EditBtn,
StdCtrls, Spin, ExtCtrls, ComCtrls, Grids, Math,
StdCtrls, Spin, ExtCtrls, ComCtrls, Grids, ColorBox, Math,
fpvv_drawer, fpimage, fpcanvas, coreconrec;
type
@@ -14,16 +14,18 @@ type
{ TfrmFPVViewer }
TfrmFPVViewer = class(TForm)
btnVisualize: TButton;
btnViewDXFTokens: TButton;
Button1: TButton;
btnContourLines: TButton;
Button2: TButton;
btnSearchInTokens: TButton;
btnViewDXFTokens: TButton;
btnVisualize: TButton;
Button1: TButton;
Button2: TButton;
buttonRenderingTest: TButton;
checkForceWhiteBackground: TCheckBox;
comboEncoding: TComboBox;
editSearchInTokens: TEdit;
editFileName: TFileNameEdit;
editSearchInTokens: TEdit;
Label1: TLabel;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
@@ -31,10 +33,10 @@ type
notebook: TNotebook;
pageViewer: TPage;
pageTreeData: TPage;
spinAdjustY: TSpinEdit;
Panel1: TPanel;
spinAdjustX: TSpinEdit;
spinAdjustY: TSpinEdit;
spinScale: TFloatSpinEdit;
Label1: TLabel;
TokensTreeView: TTreeView;
procedure btnContourLinesClick(Sender: TObject);
procedure btnSearchInTokensClick(Sender: TObject);
@@ -115,6 +117,9 @@ begin
Drawer.Drawing.Canvas.Brush.Color := clWhite;
Drawer.Drawing.Canvas.Brush.Style := bsSolid;
Drawer.Drawing.Canvas.FillRect(0, 0, Drawer.Drawing.Width, Drawer.Drawing.Height);
if checkForceWhiteBackground.Checked then Vec.GetPage(0).BackgroundColor := colWhite;
if not checkForceWhiteBackground.Checked then
Vec.GetPage(0).DrawBackground(Drawer.Drawing.Canvas);
DrawFPVectorialToCanvas(
Vec.GetPage(0),
Drawer.Drawing.Canvas,