Skip to content

Commit

Permalink
Lowercase .tpx default, open both on GTK2
Browse files Browse the repository at this point in the history
  • Loading branch information
krystophny committed Feb 19, 2019
1 parent d5b3f82 commit 8bddd5e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 32 deletions.
2 changes: 1 addition & 1 deletion src/ClpbrdOp.pas
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ procedure Import_MetafileFromClipboard(const Drawing: TDrawing2D);
MF.Assign(Clipboard);
EMF_Import.LoadFromMF(MF);
EMF_Import.ParseEmf;
// TpX_Loader.XMLDoc.Save('--.TpX');
// TpX_Loader.XMLDoc.Save('--.tpx');
finally
MF.Free;
EMF_Import.Free;
Expand Down
4 changes: 2 additions & 2 deletions src/Drawings.pas
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ interface
DottedSize_Default: TRealType = 0.5;
DashSize_Default: TRealType = 1;
FontName_Default: string = 'Times New Roman';
TeXCenterFigure_Default: Boolean = True;
TeXFigure_Default: TeXFigureEnvKind = fig_figure;
TeXCenterFigure_Default: Boolean = False;
TeXFigure_Default: TeXFigureEnvKind = fig_none;
LineWidthBase_Default: TRealType = 0.3;
Border_Default: TRealType = 2;
PicMagnif_Default: TRealType = 1;
Expand Down
33 changes: 11 additions & 22 deletions src/Modes.pas
Original file line number Diff line number Diff line change
Expand Up @@ -836,27 +836,16 @@ procedure TTpXMode.DlgOpenDrawing;
try
OpenDialog.FilterIndex := OpenDialog_FilterIndex;
if PsToEditPath <> '' then
OpenDialog.Filter :=
{$IFDEF VER140}
'All supported formats|*.TpX;*.emf;*.wmf;*.svg;*.svgz;*.eps;*.ps;*.pdf'
{$ELSE}
'All supported formats|*.TpX;*.emf;*.svg;*.svgz;*.eps;*.ps;*.pdf'
{$ENDIF}
else
OpenDialog.Filter :=
{$IFDEF VER140}
'All supported formats|*.TpX;*.emf;*.wmf;*.svg;*.svgz';
{$ELSE}
'All supported formats|*.TpX;*.emf;*.svg;*.svgz';
{$ENDIF}
OpenDialog.Filter := OpenDialog.Filter +
'|TpX drawing|*.TpX' +
{$IFDEF VER140}
'|Windows (Enhanced) Metafiles (*.emf,*.wmf)|*.emf;*.wmf' +
OpenDialog.Filter :=
{$IFDEF LCLGtk2} // TODO: add case-insensitive variant for all file types
'All supported formats|*.[Tt][Pp][Xx];*.emf;*.wmf;*.svg;*.svgz;*.eps;*.ps;*.pdf'+
'|TpX drawing|*.[Tt][Pp][Xx]'+
{$ELSE}
'|Windows Enhanced Metafiles (*.emf)|*.emf' +
'All supported formats|*.tpx;*.emf;*.wmf;*.svg;*.svgz;*.eps;*.ps;*.pdf'+
'|TpX drawing|*.tpx'+
{$ENDIF}
'|Scalable Vector Graphics (*.svg;*.svgz)|*.svg;*.svgz';
'|Windows (Enhanced) Metafiles (*.emf,*.wmf)|*.emf;*.wmf' +
'|Scalable Vector Graphics (*.svg;*.svgz)|*.svg;*.svgz';
if PsToEditPath <> '' then
OpenDialog.Filter := OpenDialog.Filter +
'|Encapsulated Postscript (*.eps)|*.eps' +
Expand All @@ -875,8 +864,8 @@ procedure TTpXMode.DlgOpenDrawing;

procedure TTpXMode.DoSaveDrawing(FileName: string);
begin
if not SameText(ExtractFileExt(FileName), '.TpX') then
FileName := ChangeFileExt(FileName, '.TpX');
if not SameText(ExtractFileExt(FileName), '.tpx') then
FileName := ChangeFileExt(FileName, '.tpx');
Drawing.FileName := FileName;
StoreToFile_TpX(Drawing, FileName, False);
MainForm.Caption := ExtractFileName(Drawing.FileName);
Expand All @@ -886,7 +875,7 @@ procedure TTpXMode.DoSaveDrawing(FileName: string);
end;

const
Save_Filter_Str = 'TpX drawing|*.TpX'
Save_Filter_Str = 'TpX drawing|*.tpx'
+ '|Scalable vector graphics (SVG)|*.svg'
+ '|Enhanced metafile (EMF)|*.emf'
+ '|Encapsulated PostScript (EPS)|*.eps'
Expand Down
6 changes: 3 additions & 3 deletions src/Output.pas
Original file line number Diff line number Diff line change
Expand Up @@ -2292,8 +2292,8 @@ function CheckCommandLine: Boolean;
try
if Ext = '' then
begin
Ext := '.TpX';
FileName := ChangeFileExt(FileName, '.TpX');
Ext := '.tpx';
FileName := ChangeFileExt(FileName, '.tpx');
end;
Loader.LoadFromFile(FileName);
finally
Expand Down Expand Up @@ -2326,7 +2326,7 @@ function CheckCommandLine: Boolean;
SetOutputFormats(OutputFormats, ADrawing);
if (OutputFile = '') or (OutputFile = '$Default') or
(Ext = '') then
OutputFile := ChangeFileExt(FileName, '.TpX');
OutputFile := ChangeFileExt(FileName, '.tpx');
ADrawing.FileName := OutputFile;
StoreToFile_TpX(ADrawing, OutputFile, False);
end;
Expand Down
6 changes: 3 additions & 3 deletions src/Preview.pas
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ function Run_LaTeX_Temp(const Drawing: TDrawing2D;
TempDir, TempTpX, TempTeX, TempTeXLog: string;
LatexCompPath: string;
const
TempTpX0 = '(tpx)TpX.TpX';
TempTpX0 = '(tpx)TpX.tpx';
begin
Result := False;
TempDir := GetTempDir;
Expand Down Expand Up @@ -385,7 +385,7 @@ procedure View_Source(const Drawing: TDrawing2D);
DlgResult: Word;
ShowCurrent: Boolean;
const
TempTpX0 = '(tpx)TpX.TpX';
TempTpX0 = '(tpx)TpX.tpx';
begin
ShowCurrent := Drawing.FileName = Drawing_NewFileName;
if (not ShowCurrent) and Drawing.History.IsChanged then
Expand Down Expand Up @@ -433,7 +433,7 @@ procedure StoreToFile_PreviewSource(
TpXFileName: string;
begin
TpXFileName := ExtractFilePath(FileName)
+ ChangeFileExt(ExtractFileName(FileName), '') + '(TpX).TpX';
+ ChangeFileExt(ExtractFileName(FileName), '') + '(TpX).tpx';
WritePreviewSource(
Drawing, PreviewKind, False, FileName, TpXFileName);
end;
Expand Down
2 changes: 1 addition & 1 deletion src/Settings0.pas
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ procedure LoadSettings_Ex(MainForm: TMainForm);
{$IFDEF VER140}
SettingsList.Add(
TTpXExtAssocOption.Create('ExtAssoc', nil,
'Associate ".TpX" extension with TpX'));
'Associate ".tpx" extension with TpX'));
{$ENDIF}
SettingsList.AddBoolean('ShowGrid',
@(MainForm.LocalView.ShowGrid), 'Show grid');
Expand Down

0 comments on commit 8bddd5e

Please sign in to comment.