consolidate some code into one function

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6075 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
John Levon 2003-02-08 21:46:17 +00:00
parent ae87b94515
commit 84b3737805
2 changed files with 23 additions and 23 deletions

View File

@ -1,3 +1,7 @@
2003-02-08 John Levon <levon@movementarian.org>
* LaTeX.C: consolidate code into showRunMessage() helper
2003-02-08 John Levon <levon@movementarian.org> 2003-02-08 John Levon <levon@movementarian.org>
* lyxfind.C: * lyxfind.C:

View File

@ -70,6 +70,21 @@ using boost::cmatch;
extern BufferList bufferlist; extern BufferList bufferlist;
namespace {
void showRunMessage(LyXFunc * lf, unsigned int count)
{
ostringstream str;
#if USE_BOOST_FORMAT
str << boost::format(_("Waiting for LaTeX run number %1$d")) % count;
#else
str << _("Waiting for LaTeX run number ") << count;
#endif
lf->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
};
/* /*
* CLASS TEXERRORS * CLASS TEXERRORS
*/ */
@ -141,7 +156,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
bool rerun = false; // rerun requested bool rerun = false; // rerun requested
// The class LaTeX does not know the temp path. // The class LaTeX does not know the temp path.
bufferlist.updateIncludedTeXfiles(lyx::getcwd()); //GetCWD()); bufferlist.updateIncludedTeXfiles(lyx::getcwd());
// Never write the depfile if an error was encountered. // Never write the depfile if an error was encountered.
@ -202,13 +217,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
++count; ++count;
lyxerr[Debug::LATEX] << "Run #" << count << endl; lyxerr[Debug::LATEX] << "Run #" << count << endl;
if (lfun) { if (lfun) {
ostringstream str; showRunMessage(lfun, count);
#if USE_BOOST_FORMAT
str << boost::format(_("LaTeX run number %1$d")) % count;
#else
str << _("LaTeX run number ") << count;
#endif
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
} }
this->operator()(); this->operator()();
@ -291,14 +300,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
lyxerr[Debug::LATEX] lyxerr[Debug::LATEX]
<< "Run #" << count << endl; << "Run #" << count << endl;
if (lfun) { if (lfun) {
ostringstream str; showRunMessage(lfun, count);
#if USE_BOOST_FORMAT
str << boost::format(_("LaTeX run number %1$d")) % count;
#else
str << _("LaTeX run number ") << count;
#endif
// check lyxstring string stream and gcc 3.1 before fixing
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
} }
this->operator()(); this->operator()();
@ -352,13 +354,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
++count; ++count;
lyxerr[Debug::LATEX] << "Run #" << count << endl; lyxerr[Debug::LATEX] << "Run #" << count << endl;
if (lfun) { if (lfun) {
ostringstream str; showRunMessage(lfun, count);
#if USE_BOOST_FORMAT
str << boost::format(_("LaTeX run number %1$d")) % count;
#else
str << _("LaTeX run number ") << count;
#endif
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
} }
this->operator()(); this->operator()();