From: John Levon Date: Sat, 8 Feb 2003 21:46:17 +0000 (+0000) Subject: consolidate some code into one function X-Git-Tag: 1.6.10~17582 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=84b3737805497500f37d4739551147fa43cf6ca8;p=lyx.git consolidate some code into one function git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6075 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 6c54f2a6e9..c07b42f6e6 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,7 @@ +2003-02-08 John Levon + + * LaTeX.C: consolidate code into showRunMessage() helper + 2003-02-08 John Levon * lyxfind.C: diff --git a/src/LaTeX.C b/src/LaTeX.C index 797b316b56..512fd4918c 100644 --- a/src/LaTeX.C +++ b/src/LaTeX.C @@ -70,6 +70,21 @@ using boost::cmatch; 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 */ @@ -141,7 +156,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) bool rerun = false; // rerun requested // 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. @@ -202,13 +217,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#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()))); + showRunMessage(lfun, count); } this->operator()(); @@ -291,14 +300,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#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()))); + showRunMessage(lfun, count); } this->operator()(); @@ -352,13 +354,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun) ++count; lyxerr[Debug::LATEX] << "Run #" << count << endl; if (lfun) { - ostringstream str; -#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()))); + showRunMessage(lfun, count); } this->operator()();