Missing wxUSE_... flags and source cleaning.
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@35305 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -1826,7 +1826,7 @@ void HTMLOnMacro(int macroId, int no_args, bool start)
|
|||||||
static bool CheckTypeRef()
|
static bool CheckTypeRef()
|
||||||
{
|
{
|
||||||
wxString typeDecl = GetArgData();
|
wxString typeDecl = GetArgData();
|
||||||
if( !typeDecl.IsEmpty() ) {
|
if( !typeDecl.empty() ) {
|
||||||
typeDecl.Replace(wxT("\\"),wxT(""));
|
typeDecl.Replace(wxT("\\"),wxT(""));
|
||||||
wxString label = typeDecl;
|
wxString label = typeDecl;
|
||||||
label.Replace(wxT("const"),wxT(""));
|
label.Replace(wxT("const"),wxT(""));
|
||||||
@@ -2247,7 +2247,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
|
|||||||
if (imageFile)
|
if (imageFile)
|
||||||
delete[] imageFile;
|
delete[] imageFile;
|
||||||
imageFile = NULL;
|
imageFile = NULL;
|
||||||
if (!f.IsEmpty())
|
if (!f.empty())
|
||||||
{
|
{
|
||||||
imageFile = copystring(f);
|
imageFile = copystring(f);
|
||||||
}
|
}
|
||||||
@@ -3040,7 +3040,7 @@ bool HTMLGo(void)
|
|||||||
tableVerticalLineRight = false;
|
tableVerticalLineRight = false;
|
||||||
noColumns = 0;
|
noColumns = 0;
|
||||||
|
|
||||||
if (InputFile && OutputFile)
|
if (!InputFile.empty() && !OutputFile.empty())
|
||||||
{
|
{
|
||||||
// Do some HTML-specific transformations on all the strings,
|
// Do some HTML-specific transformations on all the strings,
|
||||||
// recursively
|
// recursively
|
||||||
@@ -3243,7 +3243,6 @@ bool HTMLGo(void)
|
|||||||
GenerateHTMLWorkshopFiles(FileRoot);
|
GenerateHTMLWorkshopFiles(FileRoot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -521,7 +521,7 @@ void OutputNumberStyle(wxChar *numberStyle)
|
|||||||
* Write a Windows help project file
|
* Write a Windows help project file
|
||||||
*/
|
*/
|
||||||
|
|
||||||
bool WriteHPJ(wxChar *filename)
|
bool WriteHPJ(const wxString& filename)
|
||||||
{
|
{
|
||||||
wxChar hpjFilename[256];
|
wxChar hpjFilename[256];
|
||||||
wxChar helpFile[50];
|
wxChar helpFile[50];
|
||||||
@@ -545,7 +545,7 @@ bool WriteHPJ(wxChar *filename)
|
|||||||
helpTitle = _T("Untitled");
|
helpTitle = _T("Untitled");
|
||||||
|
|
||||||
wxString thePath = wxPathOnly(InputFile);
|
wxString thePath = wxPathOnly(InputFile);
|
||||||
if (thePath.IsEmpty())
|
if (thePath.empty())
|
||||||
thePath = _T(".");
|
thePath = _T(".");
|
||||||
wxFprintf(fd, _T("[OPTIONS]\n"));
|
wxFprintf(fd, _T("[OPTIONS]\n"));
|
||||||
wxFprintf(fd, _T("BMROOT=%s ; Assume that bitmaps are where the source is\n"), thePath.c_str());
|
wxFprintf(fd, _T("BMROOT=%s ; Assume that bitmaps are where the source is\n"), thePath.c_str());
|
||||||
@@ -5170,7 +5170,7 @@ bool RTFGo(void)
|
|||||||
inVerbatim = false;
|
inVerbatim = false;
|
||||||
browseId = 0;
|
browseId = 0;
|
||||||
|
|
||||||
if (InputFile && OutputFile)
|
if (!InputFile.empty() && !OutputFile.empty())
|
||||||
{
|
{
|
||||||
// Do some RTF-specific transformations on all the strings,
|
// Do some RTF-specific transformations on all the strings,
|
||||||
// recursively
|
// recursively
|
||||||
|
@@ -430,7 +430,7 @@ bool readInVerbatim = false; // Within a verbatim, but not nec. verbatiminput
|
|||||||
|
|
||||||
unsigned long leftCurly = 0;
|
unsigned long leftCurly = 0;
|
||||||
unsigned long rightCurly = 0;
|
unsigned long rightCurly = 0;
|
||||||
static wxString currentFileName = _T("");
|
static wxString currentFileName = wxEmptyString;
|
||||||
|
|
||||||
bool read_a_line(wxChar *buf)
|
bool read_a_line(wxChar *buf)
|
||||||
{
|
{
|
||||||
@@ -693,7 +693,7 @@ bool read_a_line(wxChar *buf)
|
|||||||
|
|
||||||
wxString actualFile = TexPathList.FindValidPath(fileName);
|
wxString actualFile = TexPathList.FindValidPath(fileName);
|
||||||
currentFileName = actualFile;
|
currentFileName = actualFile;
|
||||||
if (actualFile == _T(""))
|
if (actualFile.empty())
|
||||||
{
|
{
|
||||||
wxString errBuf;
|
wxString errBuf;
|
||||||
errBuf.Printf(_T("Could not find file: %s"),fileName);
|
errBuf.Printf(_T("Could not find file: %s"),fileName);
|
||||||
@@ -767,7 +767,7 @@ bool read_a_line(wxChar *buf)
|
|||||||
return read_a_line(buf);
|
return read_a_line(buf);
|
||||||
|
|
||||||
wxString actualFile = TexPathList.FindValidPath(fileNameStr);
|
wxString actualFile = TexPathList.FindValidPath(fileNameStr);
|
||||||
if (actualFile == _T(""))
|
if (actualFile.empty())
|
||||||
{
|
{
|
||||||
wxChar buf2[400];
|
wxChar buf2[400];
|
||||||
wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str());
|
wxSnprintf(buf2, sizeof(buf2), _T("%s.tex"), fileNameStr.c_str());
|
||||||
@@ -775,7 +775,7 @@ bool read_a_line(wxChar *buf)
|
|||||||
}
|
}
|
||||||
currentFileName = actualFile;
|
currentFileName = actualFile;
|
||||||
|
|
||||||
if (actualFile == _T(""))
|
if (actualFile.empty())
|
||||||
{
|
{
|
||||||
wxString errBuf;
|
wxString errBuf;
|
||||||
errBuf.Printf(_T("Could not find file: %s"),fileName);
|
errBuf.Printf(_T("Could not find file: %s"),fileName);
|
||||||
@@ -1663,7 +1663,7 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
|
|||||||
return pos;
|
return pos;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TexLoadFile(wxChar *filename)
|
bool TexLoadFile(const wxString& filename)
|
||||||
{
|
{
|
||||||
static wxChar *line_buffer;
|
static wxChar *line_buffer;
|
||||||
stopRunning = false;
|
stopRunning = false;
|
||||||
@@ -3460,12 +3460,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
|
|||||||
wxChar fileBuf[300];
|
wxChar fileBuf[300];
|
||||||
wxStrcpy(fileBuf, bibFile);
|
wxStrcpy(fileBuf, bibFile);
|
||||||
wxString actualFile = TexPathList.FindValidPath(fileBuf);
|
wxString actualFile = TexPathList.FindValidPath(fileBuf);
|
||||||
if (actualFile == _T(""))
|
if (actualFile.empty())
|
||||||
{
|
{
|
||||||
wxStrcat(fileBuf, _T(".bib"));
|
wxStrcat(fileBuf, _T(".bib"));
|
||||||
actualFile = TexPathList.FindValidPath(fileBuf);
|
actualFile = TexPathList.FindValidPath(fileBuf);
|
||||||
}
|
}
|
||||||
if (actualFile != _T(""))
|
if (!actualFile.empty())
|
||||||
{
|
{
|
||||||
if (!ReadBib((wxChar*) (const wxChar*) actualFile))
|
if (!ReadBib((wxChar*) (const wxChar*) actualFile))
|
||||||
{
|
{
|
||||||
@@ -3714,4 +3714,3 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
|
|||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -145,7 +145,7 @@ extern wxHashTable MacroDefs;
|
|||||||
extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex
|
extern wxStringList IgnorableInputFiles; // Ignorable \input files, e.g. psbox.tex
|
||||||
|
|
||||||
bool read_a_line(wxChar *buf);
|
bool read_a_line(wxChar *buf);
|
||||||
bool TexLoadFile(wxChar *filename);
|
bool TexLoadFile(const wxString& filename);
|
||||||
int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,
|
int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,
|
||||||
wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
|
wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
|
||||||
int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,
|
int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,
|
||||||
|
@@ -49,6 +49,8 @@
|
|||||||
#endif
|
#endif
|
||||||
#endif // !NO_GUI
|
#endif // !NO_GUI
|
||||||
|
|
||||||
|
#include "wx/utils.h"
|
||||||
|
|
||||||
#if wxUSE_IOSTREAMH
|
#if wxUSE_IOSTREAMH
|
||||||
#include <iostream.h>
|
#include <iostream.h>
|
||||||
#include <fstream.h>
|
#include <fstream.h>
|
||||||
@@ -114,8 +116,8 @@ FILE *Subsubsections = NULL;
|
|||||||
FILE *Popups = NULL;
|
FILE *Popups = NULL;
|
||||||
FILE *WinHelpContentsFile = NULL;
|
FILE *WinHelpContentsFile = NULL;
|
||||||
|
|
||||||
wxChar *InputFile = NULL;
|
wxString InputFile;
|
||||||
wxChar *OutputFile = NULL;
|
wxString OutputFile;
|
||||||
wxChar *MacroFile = copystring(_T("tex2rtf.ini"));
|
wxChar *MacroFile = copystring(_T("tex2rtf.ini"));
|
||||||
|
|
||||||
wxChar *FileRoot = NULL;
|
wxChar *FileRoot = NULL;
|
||||||
@@ -168,14 +170,14 @@ bool MyApp::OnInit()
|
|||||||
// Read input/output files
|
// Read input/output files
|
||||||
if (argc > 1)
|
if (argc > 1)
|
||||||
{
|
{
|
||||||
if (argv[1][0] != '-')
|
if (argv[1][0] != _T('-'))
|
||||||
{
|
{
|
||||||
InputFile = argv[1];
|
InputFile = argv[1];
|
||||||
n ++;
|
n ++;
|
||||||
|
|
||||||
if (argc > 2)
|
if (argc > 2)
|
||||||
{
|
{
|
||||||
if (argv[2][0] != '-')
|
if (argv[2][0] != _T('-'))
|
||||||
{
|
{
|
||||||
OutputFile = argv[2];
|
OutputFile = argv[2];
|
||||||
n ++;
|
n ++;
|
||||||
@@ -185,7 +187,7 @@ bool MyApp::OnInit()
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef NO_GUI
|
#ifdef NO_GUI
|
||||||
if (!InputFile || !OutputFile)
|
if (InputFile.empty() || OutputFile.empty())
|
||||||
{
|
{
|
||||||
wxSTD cout << "Tex2RTF: input or output file is missing.\n";
|
wxSTD cout << "Tex2RTF: input or output file is missing.\n";
|
||||||
ShowOptions();
|
ShowOptions();
|
||||||
@@ -193,11 +195,11 @@ bool MyApp::OnInit()
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (InputFile)
|
if (!InputFile.empty())
|
||||||
{
|
{
|
||||||
TexPathList.EnsureFileAccessible(InputFile);
|
TexPathList.EnsureFileAccessible(InputFile);
|
||||||
}
|
}
|
||||||
if (!InputFile || !OutputFile)
|
if (InputFile.empty() || OutputFile.empty())
|
||||||
isInteractive = true;
|
isInteractive = true;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
@@ -333,7 +335,7 @@ bool MyApp::OnInit()
|
|||||||
// TODO: uncomment this when we have tex2rtf.xpm
|
// TODO: uncomment this when we have tex2rtf.xpm
|
||||||
frame->SetIcon(wxICON(tex2rtf));
|
frame->SetIcon(wxICON(tex2rtf));
|
||||||
|
|
||||||
if (InputFile)
|
if (!InputFile.empty())
|
||||||
{
|
{
|
||||||
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
|
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF [%s]"), wxFileNameFromPath(InputFile));
|
||||||
frame->SetTitle(buf);
|
frame->SetTitle(buf);
|
||||||
@@ -384,7 +386,7 @@ bool MyApp::OnInit()
|
|||||||
menuBar->Append(help_menu, _T("&Help"));
|
menuBar->Append(help_menu, _T("&Help"));
|
||||||
|
|
||||||
frame->SetMenuBar(menuBar);
|
frame->SetMenuBar(menuBar);
|
||||||
frame->textWindow = new wxTextCtrl(frame, wxID_ANY, _T(""), wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE);
|
frame->textWindow = new wxTextCtrl(frame, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxTE_READONLY|wxTE_MULTILINE);
|
||||||
|
|
||||||
(*frame->textWindow) << _T("Welcome to Tex2RTF.\n");
|
(*frame->textWindow) << _T("Welcome to Tex2RTF.\n");
|
||||||
// ShowOptions();
|
// ShowOptions();
|
||||||
@@ -393,7 +395,7 @@ bool MyApp::OnInit()
|
|||||||
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
|
#if wxUSE_MS_HTML_HELP && !defined(__WXUNIVERSAL__)
|
||||||
HelpInstance = new wxCHMHelpController;
|
HelpInstance = new wxCHMHelpController;
|
||||||
#else
|
#else
|
||||||
HelpInstance = new wxHtmlHelpController;
|
HelpInstance = new wxHelpController;
|
||||||
#endif
|
#endif
|
||||||
HelpInstance->Initialize(_T("tex2rtf"));
|
HelpInstance->Initialize(_T("tex2rtf"));
|
||||||
#endif // wxUSE_HELP
|
#endif // wxUSE_HELP
|
||||||
@@ -707,8 +709,9 @@ void MyFrame::OnSetOutput(wxCommandEvent& WXUNUSED(event))
|
|||||||
|
|
||||||
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxString s = wxFileSelector(_T("Save text to file"), _T(""), _T(""), _T("txt"), _T("*.txt"));
|
#if wxUSE_FILEDLG
|
||||||
if (s != _T(""))
|
wxString s = wxFileSelector(_T("Save text to file"), wxEmptyString, wxEmptyString, _T("txt"), _T("*.txt"));
|
||||||
|
if (!s.empty())
|
||||||
{
|
{
|
||||||
textWindow->SaveFile(s);
|
textWindow->SaveFile(s);
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
@@ -717,12 +720,13 @@ void MyFrame::OnSaveFile(wxCommandEvent& WXUNUSED(event))
|
|||||||
frame->SetStatusText(buf, 0);
|
frame->SetStatusText(buf, 0);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnViewOutput(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnViewOutput(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
ChooseOutputFile();
|
ChooseOutputFile();
|
||||||
if (OutputFile && wxFileExists(OutputFile))
|
if (!OutputFile.empty() && wxFileExists(OutputFile))
|
||||||
{
|
{
|
||||||
textWindow->LoadFile(OutputFile);
|
textWindow->LoadFile(OutputFile);
|
||||||
wxChar buf[300];
|
wxChar buf[300];
|
||||||
@@ -735,7 +739,7 @@ void MyFrame::OnViewOutput(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
ChooseInputFile();
|
ChooseInputFile();
|
||||||
if (InputFile && wxFileExists(InputFile))
|
if (!InputFile.empty() && wxFileExists(InputFile))
|
||||||
{
|
{
|
||||||
textWindow->LoadFile(InputFile);
|
textWindow->LoadFile(InputFile);
|
||||||
wxChar buf[300];
|
wxChar buf[300];
|
||||||
@@ -748,6 +752,7 @@ void MyFrame::OnViewLatex(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
textWindow->Clear();
|
textWindow->Clear();
|
||||||
|
#if wxUSE_FILEDLG
|
||||||
wxString s = wxFileSelector(_T("Choose custom macro file"), wxPathOnly(MacroFile), wxFileNameFromPath(MacroFile), _T("ini"), _T("*.ini"));
|
wxString s = wxFileSelector(_T("Choose custom macro file"), wxPathOnly(MacroFile), wxFileNameFromPath(MacroFile), _T("ini"), _T("*.ini"));
|
||||||
if (!s.empty() && wxFileExists(s))
|
if (!s.empty() && wxFileExists(s))
|
||||||
{
|
{
|
||||||
@@ -755,6 +760,7 @@ void MyFrame::OnLoadMacros(wxCommandEvent& WXUNUSED(event))
|
|||||||
ReadCustomMacros((wxChar *)s.c_str());
|
ReadCustomMacros((wxChar *)s.c_str());
|
||||||
ShowCustomMacros();
|
ShowCustomMacros();
|
||||||
}
|
}
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void MyFrame::OnShowMacros(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnShowMacros(wxCommandEvent& WXUNUSED(event))
|
||||||
@@ -768,8 +774,8 @@ void MyFrame::OnModeRTF(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
convertMode = TEX_RTF;
|
convertMode = TEX_RTF;
|
||||||
winHelp = false;
|
winHelp = false;
|
||||||
InputFile = NULL;
|
InputFile = wxEmptyString;
|
||||||
OutputFile = NULL;
|
OutputFile = wxEmptyString;
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText(_T("In linear RTF mode."), 1);
|
SetStatusText(_T("In linear RTF mode."), 1);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -779,8 +785,8 @@ void MyFrame::OnModeWinHelp(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
convertMode = TEX_RTF;
|
convertMode = TEX_RTF;
|
||||||
winHelp = true;
|
winHelp = true;
|
||||||
InputFile = NULL;
|
InputFile = wxEmptyString;
|
||||||
OutputFile = NULL;
|
OutputFile = wxEmptyString;
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText(_T("In WinHelp RTF mode."), 1);
|
SetStatusText(_T("In WinHelp RTF mode."), 1);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -790,8 +796,8 @@ void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
convertMode = TEX_HTML;
|
convertMode = TEX_HTML;
|
||||||
winHelp = false;
|
winHelp = false;
|
||||||
InputFile = NULL;
|
InputFile = wxEmptyString;
|
||||||
OutputFile = NULL;
|
OutputFile = wxEmptyString;
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText(_T("In HTML mode."), 1);
|
SetStatusText(_T("In HTML mode."), 1);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -800,8 +806,8 @@ void MyFrame::OnModeHTML(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnModeXLP(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
convertMode = TEX_XLP;
|
convertMode = TEX_XLP;
|
||||||
InputFile = NULL;
|
InputFile = wxEmptyString;
|
||||||
OutputFile = NULL;
|
OutputFile = wxEmptyString;
|
||||||
#if wxUSE_STATUSBAR
|
#if wxUSE_STATUSBAR
|
||||||
SetStatusText(_T("In XLP mode."), 1);
|
SetStatusText(_T("In XLP mode."), 1);
|
||||||
#endif // wxUSE_STATUSBAR
|
#endif // wxUSE_STATUSBAR
|
||||||
@@ -850,22 +856,15 @@ void MyFrame::OnHelp(wxCommandEvent& WXUNUSED(event))
|
|||||||
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
void MyFrame::OnAbout(wxCommandEvent& WXUNUSED(event))
|
||||||
{
|
{
|
||||||
wxChar buf[300];
|
wxChar buf[300];
|
||||||
#ifdef __WIN32__
|
wxString platform = wxGetOsDescription();
|
||||||
wxChar *platform = _T(" (32-bit)");
|
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF Version %.2f %s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2005"), versionNo, platform.c_str());
|
||||||
#else
|
|
||||||
#ifdef __WXMSW__
|
|
||||||
wxChar *platform = _T(" (16-bit)");
|
|
||||||
#else
|
|
||||||
wxChar *platform = _T("");
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
wxSnprintf(buf, sizeof(buf), _T("Tex2RTF Version %.2f%s\nLaTeX to RTF, WinHelp, and HTML Conversion\n\n(c) Julian Smart, George Tasker and others, 1999-2002"), versionNo, platform);
|
|
||||||
wxMessageBox(buf, _T("About Tex2RTF"));
|
wxMessageBox(buf, _T("About Tex2RTF"));
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChooseInputFile(bool force)
|
void ChooseInputFile(bool force)
|
||||||
{
|
{
|
||||||
if (force || !InputFile)
|
#if wxUSE_FILEDLG
|
||||||
|
if (force || InputFile.empty())
|
||||||
{
|
{
|
||||||
wxString s = wxFileSelector(_T("Choose LaTeX input file"), wxPathOnly(InputFile), wxFileNameFromPath(InputFile), _T("tex"), _T("*.tex"));
|
wxString s = wxFileSelector(_T("Choose LaTeX input file"), wxPathOnly(InputFile), wxFileNameFromPath(InputFile), _T("tex"), _T("*.tex"));
|
||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
@@ -876,14 +875,17 @@ void ChooseInputFile(bool force)
|
|||||||
passNumber = 1;
|
passNumber = 1;
|
||||||
errorCount = 0;
|
errorCount = 0;
|
||||||
|
|
||||||
InputFile = copystring(s);
|
InputFile = s;
|
||||||
wxString str = wxFileNameFromPath(InputFile);
|
wxString str = wxFileNameFromPath(InputFile);
|
||||||
wxString buf;
|
wxString buf;
|
||||||
buf.Printf(_T("Tex2RTF [%s]"), str.c_str());
|
buf.Printf(_T("Tex2RTF [%s]"), str.c_str());
|
||||||
frame->SetTitle((wxChar *)buf.c_str());
|
frame->SetTitle((wxChar *)buf.c_str());
|
||||||
OutputFile = NULL;
|
OutputFile = wxEmptyString;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxUnusedVar(force);
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
|
|
||||||
void ChooseOutputFile(bool force)
|
void ChooseOutputFile(bool force)
|
||||||
@@ -892,9 +894,9 @@ void ChooseOutputFile(bool force)
|
|||||||
wxChar wildBuf[10];
|
wxChar wildBuf[10];
|
||||||
wxStrcpy(wildBuf, _T("*."));
|
wxStrcpy(wildBuf, _T("*."));
|
||||||
wxString path;
|
wxString path;
|
||||||
if (OutputFile)
|
if (!OutputFile.empty())
|
||||||
path = wxPathOnly(OutputFile);
|
path = wxPathOnly(OutputFile);
|
||||||
else if (InputFile)
|
else if (!InputFile.empty())
|
||||||
path = wxPathOnly(InputFile);
|
path = wxPathOnly(InputFile);
|
||||||
|
|
||||||
switch (convertMode)
|
switch (convertMode)
|
||||||
@@ -918,13 +920,17 @@ void ChooseOutputFile(bool force)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (force || !OutputFile)
|
#if wxUSE_FILEDLG
|
||||||
|
if (force || OutputFile.empty())
|
||||||
{
|
{
|
||||||
wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile),
|
wxString s = wxFileSelector(_T("Choose output file"), path, wxFileNameFromPath(OutputFile),
|
||||||
extensionBuf, wildBuf);
|
extensionBuf, wildBuf);
|
||||||
if (!s.empty())
|
if (!s.empty())
|
||||||
OutputFile = copystring(s);
|
OutputFile = s;
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
wxUnusedVar(force);
|
||||||
|
#endif // wxUSE_FILEDLG
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -935,7 +941,7 @@ bool Go(void)
|
|||||||
ChooseOutputFile();
|
ChooseOutputFile();
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (!InputFile || !OutputFile || stopRunning)
|
if (InputFile.empty() || OutputFile.empty() || stopRunning)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#ifndef NO_GUI
|
#ifndef NO_GUI
|
||||||
@@ -952,7 +958,7 @@ bool Go(void)
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Find extension-less filename
|
// Find extension-less filename
|
||||||
wxStrcpy(FileRoot, OutputFile);
|
wxStrcpy(FileRoot, OutputFile.c_str());
|
||||||
StripExtension(FileRoot);
|
StripExtension(FileRoot);
|
||||||
|
|
||||||
if (truncateFilenames && convertMode == TEX_HTML)
|
if (truncateFilenames && convertMode == TEX_HTML)
|
||||||
@@ -989,7 +995,7 @@ bool Go(void)
|
|||||||
|
|
||||||
bool success = false;
|
bool success = false;
|
||||||
|
|
||||||
if (InputFile && OutputFile)
|
if (!InputFile.empty() && !OutputFile.empty())
|
||||||
{
|
{
|
||||||
if (!wxFileExists(InputFile))
|
if (!wxFileExists(InputFile))
|
||||||
{
|
{
|
||||||
@@ -1269,8 +1275,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
|
|||||||
bool hasArg = (wxStrlen(secondArg) > 0);
|
bool hasArg = (wxStrlen(secondArg) > 0);
|
||||||
if (wxStrcmp(firstArg, _T("INPUT")) == 0 && hasArg)
|
if (wxStrcmp(firstArg, _T("INPUT")) == 0 && hasArg)
|
||||||
{
|
{
|
||||||
if (InputFile) delete[] InputFile;
|
InputFile = secondArg;
|
||||||
InputFile = copystring(secondArg);
|
|
||||||
if (frame)
|
if (frame)
|
||||||
{
|
{
|
||||||
wxChar buf[100];
|
wxChar buf[100];
|
||||||
@@ -1281,8 +1286,7 @@ bool Tex2RTFConnection::OnExecute(const wxString& WXUNUSED(topic), wxChar *data,
|
|||||||
}
|
}
|
||||||
else if (wxStrcmp(firstArg, _T("OUTPUT")) == 0 && hasArg)
|
else if (wxStrcmp(firstArg, _T("OUTPUT")) == 0 && hasArg)
|
||||||
{
|
{
|
||||||
if (OutputFile) delete[] OutputFile;
|
OutputFile = secondArg;
|
||||||
OutputFile = copystring(secondArg);
|
|
||||||
}
|
}
|
||||||
else if (wxStrcmp(firstArg, _T("GO")) == 0)
|
else if (wxStrcmp(firstArg, _T("GO")) == 0)
|
||||||
{
|
{
|
||||||
|
@@ -150,8 +150,8 @@ extern FILE *Sections;
|
|||||||
extern FILE *Subsections;
|
extern FILE *Subsections;
|
||||||
extern FILE *Subsubsections;
|
extern FILE *Subsubsections;
|
||||||
|
|
||||||
extern wxChar *InputFile;
|
extern wxString InputFile;
|
||||||
extern wxChar *OutputFile;
|
extern wxString OutputFile;
|
||||||
extern wxChar *MacroFile;
|
extern wxChar *MacroFile;
|
||||||
|
|
||||||
extern wxChar *FileRoot;
|
extern wxChar *FileRoot;
|
||||||
|
@@ -1142,7 +1142,7 @@ bool XLPGo(void)
|
|||||||
{
|
{
|
||||||
xlpBlockId = 0;
|
xlpBlockId = 0;
|
||||||
|
|
||||||
if (InputFile && OutputFile)
|
if (!InputFile.empty() && !OutputFile.empty())
|
||||||
{
|
{
|
||||||
Contents = wxFopen(TmpContentsName, _T("w"));
|
Contents = wxFopen(TmpContentsName, _T("w"));
|
||||||
Chapters = wxFopen(_T("chapters.xlp"), _T("w"));
|
Chapters = wxFopen(_T("chapters.xlp"), _T("w"));
|
||||||
@@ -1213,4 +1213,3 @@ bool XLPGo(void)
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user