diff --git a/applications/fpvviewer/fpvv_mainform.lfm b/applications/fpvviewer/fpvv_mainform.lfm index d041ee0af..2b17bb057 100644 --- a/applications/fpvviewer/fpvv_mainform.lfm +++ b/applications/fpvviewer/fpvv_mainform.lfm @@ -1,8 +1,87 @@ -object Form1: TForm1 - Left = 349 - Height = 240 - Top = 171 - Width = 320 - Caption = 'Form1' +object frmFPVViewer: TfrmFPVViewer + Left = 234 + Height = 433 + Top = 172 + Width = 342 + Caption = 'frmFPVViewer' + ClientHeight = 433 + ClientWidth = 342 LCLVersion = '0.9.31' + object editFileName: TFileNameEdit + Left = 8 + Height = 25 + Top = 8 + Width = 304 + DialogOptions = [] + FilterIndex = 0 + HideDirectories = False + ButtonWidth = 23 + NumGlyphs = 0 + 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 = 25 + Top = 72 + Width = 64 + Increment = 1 + MaxValue = 100 + MinValue = 0 + TabOrder = 2 + Value = 1 + end + object Label1: TLabel + Left = 8 + Height = 18 + Top = 79 + Width = 61 + Caption = 'Scale by:' + ParentColor = False + end + object imageView: TImage + Left = 11 + Height = 296 + Top = 128 + Width = 325 + end + object Label2: TLabel + Left = 8 + Height = 18 + Top = 104 + Width = 82 + Caption = 'Start Pos X:' + ParentColor = False + end + object spinStartX: TSpinEdit + Left = 98 + Height = 25 + Top = 99 + Width = 46 + TabOrder = 3 + end + object spinStartY: TSpinEdit + Left = 240 + Height = 25 + Top = 99 + Width = 50 + TabOrder = 4 + end + object Label3: TLabel + Left = 152 + Height = 18 + Top = 104 + Width = 79 + Caption = 'Start Pos Y:' + ParentColor = False + end end diff --git a/applications/fpvviewer/fpvv_mainform.pas b/applications/fpvviewer/fpvv_mainform.pas index 24af93956..de5766cb2 100644 --- a/applications/fpvviewer/fpvv_mainform.pas +++ b/applications/fpvviewer/fpvv_mainform.pas @@ -1,14 +1,28 @@ -unit fpvv_mainform; +unit fpvv_mainform; {$mode objfpc}{$H+} interface uses - Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs; + Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, EditBtn, + StdCtrls, Spin, ExtCtrls; type - TForm1 = class(TForm) + + { TfrmFPVViewer } + + TfrmFPVViewer = class(TForm) + btnVisualize: TButton; + editFileName: TFileNameEdit; + imageView: TImage; + Label2: TLabel; + Label3: TLabel; + spinStartX: TSpinEdit; + spinStartY: TSpinEdit; + spinScale: TFloatSpinEdit; + Label1: TLabel; + procedure btnVisualizeClick(Sender: TObject); private { private declarations } public @@ -16,11 +30,36 @@ type end; var - Form1: TForm1; + frmFPVViewer: TfrmFPVViewer; implementation +uses + fpvectorial, cdrvectorialreader, svgvectorialwriter, pdfvectorialreader, + dxfvectorialreader, + fpvtocanvas; + {$R *.lfm} +{ TfrmFPVViewer } + +procedure TfrmFPVViewer.btnVisualizeClick(Sender: TObject); +var + Vec: TvVectorialDocument; +begin + // First check the in input + //if not CheckInput() then Exit; + + Vec := TvVectorialDocument.Create; + try + Vec.ReadFromFile(editFileName.FileName, vfDXF); + imageView.Canvas.Brush.Color := clWhite; + imageView.Canvas.FillRect(0, 0, imageView.Width, imageView.Height); + DrawFPVectorialToCanvas(Vec, imageView.Canvas, spinStartX.Value, spinStartY.Value, spinScale.Value, spinScale.Value); + finally + Vec.Free; + end; +end; + end. diff --git a/applications/fpvviewer/fpvviewer.lpi b/applications/fpvviewer/fpvviewer.lpi index b63b082db..ecd7f5aa2 100644 --- a/applications/fpvviewer/fpvviewer.lpi +++ b/applications/fpvviewer/fpvviewer.lpi @@ -34,30 +34,207 @@ - + - + - + - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/applications/fpvviewer/fpvviewer.lpr b/applications/fpvviewer/fpvviewer.lpr index 830a81bcf..d0081b499 100644 --- a/applications/fpvviewer/fpvviewer.lpr +++ b/applications/fpvviewer/fpvviewer.lpr @@ -14,7 +14,7 @@ uses begin Application.Initialize; - Application.CreateForm(TForm1, Form1); + Application.CreateForm(TfrmFPVViewer, frmFPVViewer); Application.Run; end.