fpvviewer: Adds a new button to show the page border, requires lazarus rev 44400 plus

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2903 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
sekelsenmat
2014-03-10 21:49:26 +00:00
parent 19bb4e4d40
commit a05c182b2c
3 changed files with 37 additions and 19 deletions

View File

@ -82,7 +82,7 @@ object frmFPVViewer: TfrmFPVViewer
TabOrder = 1 TabOrder = 1
object editFileName: TFileNameEdit object editFileName: TFileNameEdit
Left = 8 Left = 8
Height = 23 Height = 22
Top = 8 Top = 8
Width = 304 Width = 304
DialogOptions = [] DialogOptions = []
@ -104,7 +104,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinScale: TFloatSpinEdit object spinScale: TFloatSpinEdit
Left = 72 Left = 72
Height = 23 Height = 16
Top = 97 Top = 97
Width = 168 Width = 168
DecimalPlaces = 6 DecimalPlaces = 6
@ -117,9 +117,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label1: TLabel object Label1: TLabel
Left = 8 Left = 8
Height = 15 Height = 16
Top = 97 Top = 97
Width = 46 Width = 55
Caption = 'Scale by:' Caption = 'Scale by:'
ParentColor = False ParentColor = False
end end
@ -161,15 +161,15 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label2: TLabel object Label2: TLabel
Left = 8 Left = 8
Height = 15 Height = 16
Top = 72 Top = 72
Width = 73 Width = 88
Caption = 'Y adjustment:' Caption = 'Y adjustment:'
ParentColor = False ParentColor = False
end end
object spinAdjustY: TSpinEdit object spinAdjustY: TSpinEdit
Left = 80 Left = 80
Height = 23 Height = 16
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 100 Increment = 100
@ -180,7 +180,7 @@ object frmFPVViewer: TfrmFPVViewer
end end
object spinAdjustX: TSpinEdit object spinAdjustX: TSpinEdit
Left = 232 Left = 232
Height = 23 Height = 16
Top = 72 Top = 72
Width = 72 Width = 72
Increment = 50 Increment = 50
@ -191,9 +191,9 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label3: TLabel object Label3: TLabel
Left = 160 Left = 160
Height = 15 Height = 16
Top = 72 Top = 72
Width = 73 Width = 88
Caption = 'X adjustment:' Caption = 'X adjustment:'
ParentColor = False ParentColor = False
end end
@ -208,18 +208,18 @@ object frmFPVViewer: TfrmFPVViewer
end end
object Label4: TLabel object Label4: TLabel
Left = 9 Left = 9
Height = 15 Height = 16
Top = 126 Top = 126
Width = 128 Width = 153
Caption = 'Force encoding on read:' Caption = 'Force encoding on read:'
ParentColor = False ParentColor = False
end end
object comboEncoding: TComboBox object comboEncoding: TComboBox
Left = 144 Left = 144
Height = 23 Height = 20
Top = 126 Top = 126
Width = 128 Width = 128
ItemHeight = 15 ItemHeight = 0
ItemIndex = 0 ItemIndex = 0
Items.Strings = ( Items.Strings = (
'Read from the file' 'Read from the file'
@ -255,22 +255,22 @@ object frmFPVViewer: TfrmFPVViewer
end end
object labelFileEncoding: TLabel object labelFileEncoding: TLabel
Left = 278 Left = 278
Height = 15 Height = 16
Top = 130 Top = 130
Width = 74 Width = 88
Caption = 'File encoding:' Caption = 'File encoding:'
ParentColor = False ParentColor = False
end end
object checkForceWhiteBackground: TCheckBox object checkForceWhiteBackground: TCheckBox
Left = 9 Left = 9
Height = 19 Height = 18
Top = 152 Top = 152
Width = 153 Width = 178
Caption = 'Force white background?' Caption = 'Force white background?'
TabOrder = 11 TabOrder = 11
end end
object buttonViewDebugInfo: TButton object buttonViewDebugInfo: TButton
Left = 256 Left = 344
Height = 17 Height = 17
Top = 153 Top = 153
Width = 131 Width = 131
@ -296,5 +296,13 @@ object frmFPVViewer: TfrmFPVViewer
OnClick = buttonAdjustClick OnClick = buttonAdjustClick
TabOrder = 14 TabOrder = 14
end end
object checkShowPage: TCheckBox
Left = 216
Height = 18
Top = 152
Width = 87
Caption = 'Show Page'
TabOrder = 15
end
end end
end end

View File

@ -27,6 +27,7 @@ type
buttonAdjust: TButton; buttonAdjust: TButton;
buttonViewDebugInfo: TButton; buttonViewDebugInfo: TButton;
buttonRenderingTest: TButton; buttonRenderingTest: TButton;
checkShowPage: TCheckBox;
checkForceWhiteBackground: TCheckBox; checkForceWhiteBackground: TCheckBox;
comboEncoding: TComboBox; comboEncoding: TComboBox;
editFileName: TFileNameEdit; editFileName: TFileNameEdit;
@ -97,6 +98,7 @@ const
var var
Vec: TvVectorialDocument; Vec: TvVectorialDocument;
CanvasSize: TPoint; CanvasSize: TPoint;
lCurPage: TvVectorialPage;
begin begin
// First check the in input // First check the in input
if editFileName.FileName = '' then Exit; // silent exit in this simple case if editFileName.FileName = '' then Exit; // silent exit in this simple case
@ -137,6 +139,13 @@ begin
if checkForceWhiteBackground.Checked then Vec.GetPageAsVectorial(0).BackgroundColor := colWhite; if checkForceWhiteBackground.Checked then Vec.GetPageAsVectorial(0).BackgroundColor := colWhite;
if not checkForceWhiteBackground.Checked then if not checkForceWhiteBackground.Checked then
Vec.GetPageAsVectorial(0).DrawBackground(Drawer.Drawing.Canvas); Vec.GetPageAsVectorial(0).DrawBackground(Drawer.Drawing.Canvas);
if checkShowPage.Checked then
Vec.GetPageAsVectorial(0).RenderPageBorder(
Drawer.Drawing.Canvas,
FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosX,
Drawer.Drawing.Height - FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosY,
spinScale.Value,
-1 * spinScale.Value);
Vec.GetPageAsVectorial(0).Render( Vec.GetPageAsVectorial(0).Render(
Drawer.Drawing.Canvas, Drawer.Drawing.Canvas,
FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosX, FPVVIEWER_SPACE_FOR_NEGATIVE_COORDS + Drawer.PosX,
@ -306,6 +315,7 @@ procedure TfrmFPVViewer.Button2Click(Sender: TObject);
var var
Vec: TvVectorialDocument; Vec: TvVectorialDocument;
i: Integer; i: Integer;
lCurPage: TvVectorialPage;
begin begin
// First check the in input // First check the in input
//if not CheckInput() then Exit; //if not CheckInput() then Exit;

Binary file not shown.