diff --git a/applications/fpvviewer/fpvv_mainform.lfm b/applications/fpvviewer/fpvv_mainform.lfm index 584bf7a74..4790140cd 100644 --- a/applications/fpvviewer/fpvv_mainform.lfm +++ b/applications/fpvviewer/fpvv_mainform.lfm @@ -1,10 +1,10 @@ object frmFPVViewer: TfrmFPVViewer Left = 322 - Height = 538 + Height = 600 Top = 143 Width = 485 Caption = 'Free Pascal Vectorial Viewer' - ClientHeight = 538 + ClientHeight = 600 ClientWidth = 485 OnCreate = FormCreate OnDestroy = FormDestroy @@ -67,10 +67,10 @@ object frmFPVViewer: TfrmFPVViewer AnchorSideBottom.Control = Owner AnchorSideBottom.Side = asrBottom Left = 0 - Height = 410 - Top = 128 + Height = 448 + Top = 152 Width = 485 - PageIndex = 1 + PageIndex = 0 Anchors = [akTop, akLeft, akRight, akBottom] TabOrder = 4 TabStop = True @@ -78,11 +78,15 @@ object frmFPVViewer: TfrmFPVViewer end object pageTreeData: TPage object TokensTreeView: TTreeView + AnchorSideTop.Control = btnSearchInTokens + AnchorSideTop.Side = asrBottom Left = 0 Height = 378 Top = 32 Width = 485 Align = alBottom + Anchors = [akTop, akLeft, akRight, akBottom] + BorderSpacing.Top = 7 DefaultItemHeight = 18 TabOrder = 0 end @@ -177,4 +181,59 @@ object frmFPVViewer: TfrmFPVViewer 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 + end end diff --git a/applications/fpvviewer/fpvv_mainform.pas b/applications/fpvviewer/fpvv_mainform.pas index 457148f76..74bdeea65 100644 --- a/applications/fpvviewer/fpvv_mainform.pas +++ b/applications/fpvviewer/fpvv_mainform.pas @@ -21,10 +21,13 @@ type Button2: TButton; btnSearchInTokens: TButton; buttonRenderingTest: TButton; + comboEncoding: TComboBox; editSearchInTokens: TEdit; editFileName: TFileNameEdit; Label2: TLabel; Label3: TLabel; + Label4: TLabel; + labelFileEncoding: TLabel; notebook: TNotebook; pageViewer: TPage; pageTreeData: TPage; @@ -84,8 +87,16 @@ begin Vec := TvVectorialDocument.Create; try + // If we desire, force a encoding for the read operation + if comboEncoding.ItemIndex > 0 then + Vec.ForcedEncodingOnRead := comboEncoding.Text + else Vec.ForcedEncodingOnRead := ''; + Vec.ReadFromFile(editFileName.FileName); + // Show document properties + labelFileEncoding.Caption := 'File encoding: ' + Vec.Encoding; + // We need to be robust, because sometimes the document size won't be given // also give up drawing everything if we need more then 4MB of RAM for the image // and also give some space in the image to allow for negative coordinates