]> git.lyx.org Git - features.git/commitdiff
use boost::format
authorLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 21 Nov 2002 18:33:09 +0000 (18:33 +0000)
committerLars Gullik Bjønnes <larsbj@gullik.org>
Thu, 21 Nov 2002 18:33:09 +0000 (18:33 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5694 a592a061-630c-0410-9148-cb99ea01b6c8

37 files changed:
boost/ChangeLog
boost/boost/config/user.hpp
boost/boost/format/format_implementation.hpp
po/POTFILES.in
src/BoostFormat.h [new file with mode: 0644]
src/BufferView_pimpl.C
src/ChangeLog
src/Chktex.C
src/LaTeX.C
src/Makefile.am
src/boost-inst.C [new file with mode: 0644]
src/buffer.C
src/bufferlist.C
src/bufferview_funcs.C
src/converter.C
src/debug.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/biblio.C
src/frontends/qt2/ChangeLog
src/frontends/qt2/QVCLog.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/ColorHandler.C
src/frontends/xforms/FeedbackController.C
src/frontends/xforms/FormGraphics.C
src/importer.C
src/insets/ChangeLog
src/insets/insetcaption.C
src/insets/insetfloatlist.C
src/insets/insetgraphics.C
src/insets/insetparent.C
src/lyx_main.C
src/lyxfont.C
src/lyxfunc.C
src/mathed/ChangeLog
src/mathed/formulamacro.C
src/toc.C

index e73c3a53a0246bee5ae41cbde63a299a44181a1c..bd0b483b44d06e7da1888ccf96fd73417e12c139 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * boost/format/format_implementation.hpp (clear_bind): use
+       io::out_of_range 
+
+       * boost/config/user.hpp (BOOST_FUNCTION_NO_DEPRECATED): define it.
+
 2002-11-20  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * Boost.Format: add files so that this boost lib can be used.
index 897d5578a754108ba397677c5136b9ce211f7c60..1c786bb9c1e53511f2e03b61c252fa01d1efb5b8 100644 (file)
@@ -69,4 +69,4 @@
 #define BOOST_NO_EXCEPTIONS 1
 #define BOOST_NO_WREGEX 1
 #define BOOST_NO_WSTRING 1
-
+#define BOOST_FUNCTION_NO_DEPRECATED 1
index 4cf669145f168354a919f2cd502d2b201cd48c87..611e0959779488f5f95610465da24b217e76bfc2 100644 (file)
@@ -152,7 +152,7 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN)
     if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
       {
        if( exceptions() & out_of_range_bit )
-         boost::throw_exception(out_of_range()); // arg not in range.
+         boost::throw_exception(io::out_of_range()); // arg not in range.
        else return *this;
       }
     bound_[argN-1]=false;
index 4ca32d60c31cdd833b4e3ab505a4b65e11dd65e1..3553ffbe4db2c2ebc873b2ec2f8e64b44eefb000 100644 (file)
@@ -20,6 +20,7 @@ src/frontends/controllers/ControlGraphics.C
 src/frontends/controllers/ControlInclude.C
 src/frontends/controllers/ControlParagraph.C
 src/frontends/controllers/ControlPreamble.C
+src/frontends/controllers/ControlPrefs.C
 src/frontends/controllers/ControlPrint.C
 src/frontends/controllers/ControlSearch.C
 src/frontends/controllers/ControlSpellchecker.C
@@ -49,6 +50,7 @@ src/frontends/qt2/QExternal.C
 src/frontends/qt2/QExternalDialog.C
 src/frontends/qt2/QFloat.C
 src/frontends/qt2/QGraphics.C
+src/frontends/qt2/QGraphicsDialog.C
 src/frontends/qt2/QInclude.C
 src/frontends/qt2/QIndex.C
 src/frontends/qt2/QLog.C
@@ -59,12 +61,15 @@ src/frontends/qt2/QMinipage.C
 src/frontends/qt2/QParagraph.C
 src/frontends/qt2/QPreamble.C
 src/frontends/qt2/QPreambleDialog.C
+src/frontends/qt2/QPrefs.C
+src/frontends/qt2/QPrefsDialog.C
 src/frontends/qt2/QPrint.C
 src/frontends/qt2/QRef.C
 src/frontends/qt2/QSearch.C
 src/frontends/qt2/QSendto.C
 src/frontends/qt2/QShowFile.C
 src/frontends/qt2/QSpellchecker.C
+src/frontends/qt2/QTabular.C
 src/frontends/qt2/QTabularCreate.C
 src/frontends/qt2/QTexinfo.C
 src/frontends/qt2/QThesaurus.C
@@ -154,6 +159,7 @@ src/kbsequence.C
 src/language.C
 src/LaTeX.C
 src/LColor.C
+src/lengthcommon.C
 src/LyXAction.C
 src/lyx_cb.C
 src/lyxfind.C
diff --git a/src/BoostFormat.h b/src/BoostFormat.h
new file mode 100644 (file)
index 0000000..1f8defb
--- /dev/null
@@ -0,0 +1,17 @@
+// -*- C++ -*-
+#ifndef LYX_BOOST_FORMAT_H
+#define LYX_BOOST_FORMAT_H
+
+#include <boost/format.hpp>
+
+// Add explicit instantion
+
+namespace boost
+{
+
+  extern
+  template basic_format<char>;
+
+} // namespace boost
+
+#endif
index bf2e53f2c70f013e2ec2e3c6479e1c7b1a7c83a5..56a336081611386b24a2bc1de82fcd701d6e91f0 100644 (file)
@@ -64,6 +64,7 @@
 
 #include <boost/bind.hpp>
 #include <boost/signals/connection.hpp>
+#include "BoostFormat.h"
 
 #include <unistd.h>
 #include <sys/wait.h>
@@ -297,7 +298,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
                        //      bv_->text->owner(bv_);
                        if (lyxerr.debugging())
                                textcache.show(lyxerr, "resizeCurrentBuffer");
+
                        buffer_->resizeInsets(bv_);
                } else {
                        bv_->text = new LyXText(bv_);
@@ -639,7 +640,7 @@ void BufferView::Pimpl::savePosition(unsigned int i)
                                      bv_->text->cursor.pos());
        if (i > 0) {
                ostringstream str;
-               str << _("Saved bookmark") << ' ' << i;
+               str << boost::format(_("Saved bookmark %1$d")) % i;
                owner_->message(STRCONV(str.str()));
        }
 }
@@ -671,7 +672,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
        update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
        if (i > 0) {
                ostringstream str;
-               str << _("Moved to bookmark") << ' ' << i;
+               str << boost::format(_("Moved to bookmark %1$d")) % i;
                owner_->message(STRCONV(str.str()));
        }
 }
@@ -879,19 +880,16 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
        string const disp_fn(MakeDisplayPath(filename));
 
        ostringstream s1;
-       s1 << _("Inserting document") << ' '
-          << disp_fn << " ...";
+       s1 << boost::format(_("Inserting document %1$s ...")) % disp_fn;
        owner_->message(STRCONV(s1.str()));
        bool const res = bv_->insertLyXFile(filename);
        if (res) {
                ostringstream str;
-               str << _("Document") << ' ' << disp_fn
-                   << ' ' << _("inserted.");
+               str << boost::format(_("Document %1$s inserted.")) % disp_fn;
                owner_->message(STRCONV(str.str()));
        } else {
                ostringstream str;
-               str << _("Could not insert document") << ' '
-                   << disp_fn;
+               str << boost::format(_("Could not insert document %1$s")) % disp_fn;
                owner_->message(STRCONV(str.str()));
        }
 }
index 5877cb65c2ad49e9ea47e7406ad8793c8a89b89b..f62ffa2b330d6f6de2f069fb7c92b72fc29b9cc4 100644 (file)
@@ -1,3 +1,46 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * lyxfunc.C (dispatch): use boost::format
+       (open): ditto
+       (doImport): ditto
+
+       * lyxfont.C (stateText): use boost::format
+
+       * lyx_main.C (LyX): use boost::format
+       (init): ditto
+       (queryUserLyXDir): ditto
+       (readRcFile): ditto
+       (parse_dbg): ditto
+       (typedef boost::function): use the recommened syntax.
+
+       * importer.C (Import): use boost::format
+
+       * debug.C (showLevel): use boost::format
+
+       * converter.C (view): use boost::format
+       (convert): ditto
+       (move): ditto
+       (scanLog): ditto
+
+       * bufferview_funcs.C (currentState): use boost::format
+
+       * bufferlist.C (emergencyWrite): use boost::format
+
+       * buffer.C (readLyXformat2): use boost::format
+       (parseSingleLyXformat2Token): ditto
+
+       * Makefile.am (lyx_SOURCES): add BoostFormat.h and boost-inst.C
+
+       * LaTeX.C (run): use boost::format
+
+       * Chktex.C (scanLogFile): use boost::format
+
+       * BufferView_pimpl.C (savePosition): use boost::format
+       (restorePosition): ditto
+       (MenuInsertLyXFile): ditto
+
+       * BoostFormat.h: help file for explicit instation.
+
 2002-11-21  Dekel Tsur  <dekelts@tau.ac.il>
 
        * tabular.C (latex): Support for block alignment in fixed width
@@ -8,7 +51,7 @@
        * BufferView_pimpl.C:
        * lyx_cb.C:
        * lyxfunc.C: split filedialog into open/save
+
 2002-11-08  Juergen Vigna  <jug@sad.it>
 
        * undo_funcs.C (textHandleUndo): fixed problems with undo introduced
        * paragraph.C:
        * toc.h:
        * toc.C: ParConstIterator, and use it (from Lars)
+
 2002-11-07  Ben Stanley  <bds02@uow.edu.au>
 
        * lyxtextclass.[Ch]: revise and add doxygen comments
 
 2002-11-07  John Levon  <levon@movementarian.org>
 
-       * text.C: fix progress value for spellchecker 
+       * text.C: fix progress value for spellchecker
+
        * toc.C: fix navigate menu for insetwrap inside minipage
 
        * paragraph_funcs.C: added FIXME for suspect code
+
 2002-11-07  John Levon  <levon@movementarian.org>
 
        * BufferView_pimpl.C: fix redrawing of insets
          on buffer switch
+
 2002-11-05  Lars Gullik Bjønnes  <larsbj@birdstep.com>
 
        * text2.C (updateCounters): fix bug 668
index ac08ba8879172a190d4f1fdf97bc7b5747f7e03d..f9752dac258479543fee37734e9de278c9679aaf 100644 (file)
@@ -29,6 +29,8 @@
 #include "support/path.h"
 #include "support/lstrings.h"
 
+#include "BoostFormat.h"
+
 #include <fstream>
 
 using std::ifstream;
@@ -81,7 +83,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
                token = split(token, warning, ':');
 
                int lineno = lyx::atoi(line);
-               warno = _("ChkTeX warning id #") + warno;
+               warno = boost::io::str(boost::format(_("ChkTeX warning id # %1$d")) % warno);
                terr.insertError(lineno, warno, warning);
                ++retval;
        }
index a4d8ab4f50841e452b77b7fe174ca8cecda6c2df..7e1e9860af415c68e796ac9f5b12c2506147112a 100644 (file)
@@ -32,6 +32,7 @@
 #include "support/path.h"
 
 #include <boost/regex.hpp>
+#include "BoostFormat.h"
 
 #include <fstream>
 #include <cstdio>  // sscanf
@@ -202,7 +203,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
        lyxerr[Debug::LATEX] << "Run #" << count << endl;
        if (lfun) {
                ostringstream str;
-               str << _("LaTeX run number") << ' ' << count;
+               str << boost::format(_("LaTeX run number %1$d")) % count;
                lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
        }
 
@@ -287,7 +288,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                        << "Run #" << count << endl;
                if (lfun) {
                        ostringstream str;
-                       str << _("LaTeX run number") << ' ' << count;
+                       str << boost::format(_("LaTeX run number %1$d")) % count;
                        // check lyxstring string stream and gcc 3.1 before fixing
                        lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
                }
@@ -344,7 +345,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
                lyxerr[Debug::LATEX] << "Run #" << count << endl;
                if (lfun) {
                        ostringstream str;
-                       str << _("LaTeX run number") << ' ' << count;
+                       str << boost::format(_("LaTeX run number %1$d")) % count;
                        lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
                }
 
index 11f250b93347e415b5830dd16f5c0ff6a8a46ca0..8aff0349db79f902594db584dafba00757e1f2f7 100644 (file)
@@ -38,6 +38,7 @@ localedir = $(datadir)/locale
 BUILT_SOURCES = version.C
 
 lyx_SOURCES = \
+       BoostFormat.h \
        BufferView.C \
        BufferView.h \
        BufferView_pimpl.C \
@@ -89,6 +90,7 @@ lyx_SOURCES = \
        ToolbarDefaults.h \
        WordLangTuple.h \
        boost.C \
+       boost-inst.C \
        box.h \
        box.C \
        broken_headers.h \
diff --git a/src/boost-inst.C b/src/boost-inst.C
new file mode 100644 (file)
index 0000000..f090764
--- /dev/null
@@ -0,0 +1,13 @@
+#include <config.h>
+
+#include "BoostFormat.h"
+
+
+namespace boost
+{
+
+using boost::io::out_of_range_bit;
+
+template class basic_format<char>;
+
+} // namespace boost
index 5c07e74c5670af0ccdb2fc37800ec3f9dcd0cd16..4f5e71c5b9200679ae6848a881f4315d746666a7 100644 (file)
 
 #include <boost/bind.hpp>
 #include <boost/tuple/tuple.hpp>
+#include "BoostFormat.h"
 
 #include <fstream>
 #include <iomanip>
@@ -360,7 +361,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += _(" paragraphs");
                }
                Alert::alert(_("Textclass Loading Error!"), s,
-                          _("When reading " + fileName()));
+                          boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
        }
 
        if (unknown_tokens > 0) {
@@ -372,7 +373,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
                        s += _(" unknown tokens");
                }
                Alert::alert(_("Textclass Loading Error!"), s,
-                          _("When reading " + fileName()));
+                          boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
        }
 
        return the_end_read;
@@ -607,10 +608,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                if (pp.first) {
                        params.textclass = pp.second;
                } else {
-                       Alert::alert(string(_("Textclass error")),
-                               string(_("The document uses an unknown textclass \"")) +
-                               lex.getString() + string("\"."),
-                               string(_("LyX will not be able to produce output correctly.")));
+                       Alert::alert(_("Textclass error"),
+                               boost::io::str(boost::format(_("The document uses an unknown textclass \"%1$s\".")) % lex.getString()),
+                               _("LyX will not be able to produce output correctly."));
                        params.textclass = 0;
                }
                if (!params.getLyXTextClass().load()) {
@@ -620,8 +620,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                        // I can substitute but I don't see how I can
                        // stop loading... ideas??  ARRae980418
                        Alert::alert(_("Textclass Loading Error!"),
-                                  string(_("Can't load textclass ")) +
-                                  params.getLyXTextClass().name(),
+                                  boost::io::str(boost::format(_("Can't load textclass %1$s")) %
+                                  params.getLyXTextClass().name()),
                                   _("-- substituting default"));
                        params.textclass = 0;
                }
@@ -926,8 +926,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
                // This should be insurance for the future: (Asger)
                ++unknown_tokens;
                lex.eatLine();
-               string const s = _("Unknown token: ") + token
-                       + " " + lex.text()  + "\n";
+               string const s = boost::io::str(boost::format(_("Unknown token: %1$s %2$s\n")) % token
+                       % lex.text());
                // we can do this here this way because we're actually reading
                // the buffer and don't care about LyXText right now.
                InsetError * new_inset = new InsetError(s);
index fc7609c0f7c69fdfdd446244007f4efad624b5da..9adbf78831f7fd9b1d596d6aacc3e554ea57f1ff 100644 (file)
@@ -42,6 +42,7 @@
 #include "support/LAssert.h"
 
 #include <boost/bind.hpp>
+#include "BoostFormat.h"
 
 #include <cassert>
 #include <algorithm>
@@ -308,8 +309,10 @@ void BufferList::emergencyWrite(Buffer * buf)
 
        string const doc = buf->isUnnamed()
                ? OnlyFilename(buf->fileName()) : buf->fileName();
-       lyxerr << _("LyX: Attempting to save document ") << doc << endl;
+
+       lyxerr << boost::format(_("LyX: Attempting to save document %1$s"))
+               % doc
+              << endl;
 
        // We try to save three places:
 
index 2cea22311554297077311928916bc06837e6e5f3..b7b0d17a7d894e02425fd4892dc823b19f64818c 100644 (file)
@@ -30,6 +30,8 @@
 
 #include "support/lstrings.h"
 
+#include "BoostFormat.h"
+
 void emph(BufferView * bv)
 {
        LyXFont font(LyXFont::ALL_IGNORE);
@@ -157,12 +159,12 @@ string const currentState(BufferView * bv)
                buffer->params.getLyXTextClass().defaultfont();
        font.reduce(defaultfont);
 
-       state << _("Font:") << ' ' << font.stateText(&buffer->params);
+       state << boost::format(_("Font: %1$s")) % font.stateText(&buffer->params);
 
        // The paragraph depth
        int depth = text->getDepth();
        if (depth > 0)
-               state << _(", Depth: ") << depth;
+               state << boost::format(_(", Depth: %1$d")) % depth;
 
        // The paragraph spacing, but only if different from
        // buffer spacing.
index df407c65ad08c6dc62628cacf4c557cfd4ec1b36..72517ce0d792982f2640d5f78821df472176ae50 100644 (file)
 #pragma implementation
 #endif
 
-#include <cctype>
-
 #include "converter.h"
 #include "lyxrc.h"
 #include "buffer.h"
 #include "bufferview_funcs.h"
 #include "LaTeX.h"
-#include "frontends/LyXView.h"
 #include "lyx_cb.h" // ShowMessage()
 #include "gettext.h"
 #include "BufferView.h"
 #include "debug.h"
 
 #include "frontends/Alert.h"
+#include "frontends/LyXView.h"
 
 #include "support/filetools.h"
 #include "support/lyxfunctional.h"
 #include "support/path.h"
 #include "support/systemcall.h"
 
+#include "BoostFormat.h"
+
+#include <cctype>
+
 #ifndef CXX_GLOBAL_CSTD
 using std::isdigit;
 #endif
@@ -176,8 +178,8 @@ bool Formats::view(Buffer const * buffer, string const & filename,
                format = getFormat(format->parentFormat());
        if (!format || format->viewer().empty()) {
                Alert::alert(_("Cannot view file"),
-                          _("No information for viewing ")
-                          + prettyName(format_name));
+                            boost::io::str(boost::format(_("No information for viewing %1$s"))
+                          % prettyName(format_name)));
                           return false;
        }
 
@@ -682,7 +684,7 @@ bool Converters::convert(Buffer const * buffer,
                                                   _("You should try to fix them."));
                                else
                                        Alert::alert(_("Cannot convert file"),
-                                                  "Error while executing",
+                                                  _("Error while executing"),
                                                   command.substr(0, 50));
                                return false;
                        }
@@ -705,7 +707,7 @@ bool Converters::convert(Buffer const * buffer,
                                          token_base, to_base);
                        if (!lyx::rename(from, to)) {
                                Alert::alert(_("Error while trying to move directory:"),
-                                          from, ("to ") + to);
+                                          from, boost::io::str(boost::format(_("to %1$s")) % to));
                                return false;
                        }
                }
@@ -741,7 +743,7 @@ bool Converters::move(string const & from, string const & to, bool copy)
                                : lyx::rename(from2, to2);
                        if (!moved && no_errors) {
                                Alert::alert(_("Error while trying to move file:"),
-                                          from2, _("to ") + to2);
+                                          from2, boost::io::str(boost::format(_("to %1$s")) % to2));
                                no_errors = false;
                        }
                }
@@ -827,7 +829,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
                }
                string head;
                split(command, head, ' ');
-               Alert::alert(_("There were errors during running of ") + head,
+               Alert::alert(boost::io::str(boost::format(_("There were errors during running of %1$s")) % head),
                           s, t);
                return false;
        } else if (result & LaTeX::NO_OUTPUT) {
index 8506660b23eec94add1689103ad05999c222a1ae..ffd83cfa833264842d9962c17a2e2e3226630b59 100644 (file)
 
 #include <config.h>
 
-#include <iomanip>
-
 #include "debug.h"
 #include "gettext.h"
 #include "support/lstrings.h"
 
+#include "BoostFormat.h"
+
+#include <iomanip>
+
 using std::ostream;
 using std::setw;
 using std::endl;
@@ -107,8 +109,11 @@ void Debug::showLevel(ostream & o, Debug::type level)
                if (errorTags[i].level != Debug::ANY
                    && errorTags[i].level != Debug::NONE
                    && errorTags[i].level & level)
-                       o << _("Debugging `") << errorTags[i].name
-                         << "' (" << _(errorTags[i].desc) << ')' << endl;
+                       o << boost::format(
+                               _("Debugging `%1$s' (%2$s)"))
+                               % errorTags[i].name
+                               % _(errorTags[i].desc)
+                         << endl;
 }
 
 
index 4d5882224969d7cf8b820ed6ca573dac1633def0..ad862f68b7ddb9868f85eeb8323f9e456c1ec934 100644 (file)
@@ -1,21 +1,27 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * biblio.C (getAbbreviatedAuthor): use boost::format
+
+       * ControlSpellchecker.C (clearParams): use boost::format
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * ControlMath.C: couple more manglings
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * ControlMath.h:
        * ControlMath.C: add find_xpm mangler
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * helper_funcs.C and users: specify save/open in file dialog
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * ControlPrefs.h:
        * ControlPrefs.C: use setParams()
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * ControlButtons.h: make OKButton() virtual for prefs
        * ControlPrefs.h:
        * ControlPrefs.C: updates for xforms port to MVC
 
-       * Makefile.am: 
+       * Makefile.am:
        * ControlTabular.h:
        * ControlTabular.C: add simple MVC port
+
 2002-11-14  Juergen Spitzmueller <j.spitzmueller@gmx.de>
 
        * ControlInclude.C: fix file format masks for qt's use
        * Makefile.am:
        * ControlPrefs.h:
        * ControlPrefs.C: add skeleton controller
+
 2002-11-12  John Levon  <levon@movementarian.org>
 
        * biblio.C: fix warnings
+
 2002-11-12  Angus Leeming  <leeming@lyx.org>
 
        * ControlSpellchecker.C (check): fix crash
index 61d36ad103db18bc9e67ef2c6d356a8de2272d56..c6ecafd5a78fe4166fa544220367dfc8dace9569 100644 (file)
 #include "language.h"
 #include "lyxrc.h"
 #include "lyxtext.h"
-#include "frontends/Alert.h"
-#include "support/lstrings.h"
 
 #include "ispell.h"
 #ifdef USE_PSPELL
 # include "pspell.h"
 #endif
 
+#include "frontends/Alert.h"
+
+#include "support/lstrings.h"
+
+#include "BoostFormat.h"
 
 ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d),
@@ -42,25 +45,25 @@ void ControlSpellchecker::setParams()
 {
        if (speller_)
                return;
-       
+
        // create spell object
        string tmp;
 #ifdef USE_PSPELL
        if (lyxrc.use_pspell) {
                tmp = (lyxrc.isp_use_alt_lang) ?
                        lyxrc.isp_alt_lang : buffer()->params.language->code();
-               
+
                speller_ = new PSpell(buffer()->params, tmp);
        } else {
 #endif
                tmp = (lyxrc.isp_use_alt_lang) ?
                        lyxrc.isp_alt_lang : buffer()->params.language->lang();
-               
+
                speller_ = new ISpell(buffer()->params, tmp);
 #ifdef USE_PSPELL
        }
 #endif
-       
+
        if (lyxrc.isp_use_alt_lang) {
                Language const * lang = languages.getLanguage(tmp);
                if (lang)
@@ -68,7 +71,7 @@ void ControlSpellchecker::setParams()
        } else {
                rtl_ = buffer()->params.language->RightToLeft();
        }
-       
+
        if (!speller_->error().empty()) {
                emergency_exit_ = true;
                Alert::alert("The spellchecker has failed", speller_->error());
@@ -189,15 +192,14 @@ void ControlSpellchecker::clearParams()
 
        if (speller_->alive()) {
                speller_->close();
-               message_ = tostr(count_);
+
+               boost::format fmter("");
                if (count_ != 1) {
-                       message_ += _(" words checked.");
+                       fmter = boost::format(_("Spellchecking completed!\n%1$d words checked."));
                } else {
-                       message_ += _(" word checked.");
+                       fmter = boost::format(_("Spellchecking completed!\n%1$d word checked."));
                }
-               message_ = "\n" + message_;
-               message_ = _("Spellchecking completed! ") + message_;
-
+               message_ = boost::io::str(fmter % count_);
        } else {
                message_ = speller_->error();
                speller_->cleanUp();
index edbae55c0ef54dcab5071fcd526c5bcb6eac04fe..08daff759c5a01a15778c7552a4b26d12fe5afcd 100644 (file)
@@ -23,6 +23,7 @@
 #include "support/LAssert.h"
 
 #include <boost/regex.hpp>
+#include "BoostFormat.h"
 
 #include <algorithm>
 
@@ -94,13 +95,15 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
        if (authors.empty())
                return author;
 
-       author = familyName(authors[0]);
+       boost::format fmter("");
        if (authors.size() == 2)
-               author += _(" and ") + familyName(authors[1]);
+               fmter = boost::format(_("%1$s and %2$s"))
+                       % familyName(authors[0]) % familyName(authors[1]);
        else if (authors.size() > 2)
-               author += _(" et al.");
-
-       return author;
+               fmter = boost::format(_("%1$s et al.")) % familyName(authors[0]);
+       else
+               fmter = boost::format("%1$s") % familyName(authors[0]);
+       return boost::io::str(fmter);
 }
 
 
@@ -244,16 +247,16 @@ namespace {
 string const escape_special_chars(string const & expr)
 {
        // Search for all chars '.|*?+(){}[^$]\'
-       // Note that '[', ']' and '\' must be escaped.
+       // Note that '[' and '\' must be escaped.
        // This is a limitation of boost::regex, but all other chars in BREs
        // are assumed literal.
-        boost::RegEx reg("[.|*?+(){}^$\\[\\]\\\\]");
+       boost::RegEx reg("[].|*?+(){}^$\\[\\\\]");
 
        // $& is a perl-like expression that expands to all of the current match
        // The '$' must be prefixed with the escape character '\' for
        // boost to treat it as a literal.
        // Thus, to prefix a matched expression with '\', we use:
-        string const fmt("\\\\$&");
+       string const fmt("\\\\$&");
 
        return reg.Merge(expr, fmt);
 }
index 2c4746a77ffd766f4447aa25e8e3750b7c0945dd..9fd7a8df72fea5e6303bdc5a53a9249919d85be2 100644 (file)
@@ -1,17 +1,21 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * QVCLog.C (update_contents): use boost::format
+
 2002-11-21  John Levon  <levon@movementarian.org>
 
        * qscreen.C: show content pane cursor even when
          focus is on dialog, command buffer etc.
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * QMathDialog.C: don't pass empty commands to math
          on menu tear-off
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * QLPopupMenu.C: only check .disabled() on Commands
+
 2002-11-20  Jean-Marc Lasgouttes  <Jean-Marc.Lasgouttes@inria.fr>
 
        * QLPopupMenu.C (getLabel): show labels for menu entries
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * ui/QDelimiterDialog.ui: geometry fix
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * Toolbar_pimpl.C:
        * QDelimiterDialog.C:
        * QMathDialog.C: use find_xpm to mangle name
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * QDelimiterDialog.h:
        * QDelimiterDialog.C: fix delimiter connect()
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * QDocument.C:
        * QDocumentDialog.C: fix my sillies
+
 2002-11-20  John Levon  <levon@movementarian.org>
 
        * QLPainter.C: use realColor not color for the font
+
 2002-11-18  John Levon  <levon@movementarian.org>
 
        * Makefile.am:
        * qfontexample.C:
        * QPrefs.C:
        * QPrefsDialog.h:
-       * QPrefsDialog.C: 
+       * QPrefsDialog.C:
        * ui/QPrefScreenFontsModule.ui: show an example
          of the chosen font
+
 2002-11-18  John Levon  <levon@movementarian.org>
 
        * ui/Makefile.am:
@@ -61,7 +65,7 @@
        * Makefile.am: define no translation
 
        * QDocument.C: avoid QBloatList
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * ui/QPrefScreenFontsModule.ui:
        * QPrefs.C: use font families properly
 
        * qfont_loader.C: and obey them
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QPrefsDialog.C: partial fonts fix
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QPrefsDialog.h:
        * QPrefsDialog.C: implement browse slots. Also
          try to do something with fonts for Qt 3 (untested)
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QGraphics.C: some fixes from Herbert & me
+
 2002-11-15  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
-       * FileDialog.C: fix empty mask string
+
+       * FileDialog.C: fix empty mask string
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QLImage.C: implement monochrome, and fake grayscale
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * qfont_loader.h:
        * qfont_loader.C: fix totally broken update code
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * Makefile.am:
        * QPrefs.C:
        * QPrefsDialog.h:
        * QPrefsDialog.C: implement colors. We're done !
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * FileDialog.C:  split into open/save so open
          no longer says "Save" !
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QPrefsDialog.h:
        * QPrefsDialog.C: implement converters
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * QPrefsDialog.C:
        * QPrefs.C: implement formats
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * fontloader.C: disable crashing code for now
        * QPrefs.h:
        * QPrefs.C:
        * QPrefsDialog.C: implement most prefs load/save
+
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * ui/QPref*:
        * QPrefsDialog.C:
        * QPrefs.C: more work
+
 2002-11-15  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QTabular.C: compile fixes
-       
+
 2002-11-15  Edwin Leuven  <leuven@fee.uva.nl>
 
        * ui/QTabularDialog.ui: some relabelling
-       
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * QPrefs.h:
        * QPrefs.C: some update() work
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * QPrefs.C: add #if 0 xforms code for working on
 
        * QTabular.C: remove some handled #if 0 code
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * qsetborder.h:
        * qsetborder.C: fix ws
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * QTabularDialog.h:
        * QTabularDialog.C:
        * QTabular.C: add some stuff
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * Makefile.dialogs:
        * QTabular.C:
        * QTabularDialog.h:
        * QTabularDialog.C: add skeleton
+
 2002-11-14  John Levon  <levon@movementarian.org>
 
        * ui/QTabularDialog.ui: label for cell pos
+
 2002-11-13  Herbert Voss  <voss@perce.de>
-  
+
        * QBibtex.C: (apply, isValid) small changes
-  
+
 2002-11-13  John Levon  <levon@movementarian.org>
 
        * all pref files: make the stack work
-        
+
 2002-11-13  John Levon  <levon@movementarian.org>
 
        * Dialogs.C:
        * QPrefs.C:
        * QPrefsDialog.h:
        * QPrefsDialog.C: add skeleton dialog
+
 2002-11-13  John Levon  <levon@movementarian.org>
 
        * ui/QBibtexDialog.ui: add some change_adaptors()
        * QBibtex.C: fix duplicate entries in style CB, and
          alphasort it again, but still allow empty/user-defined
          style
+
 2002-11-12  Herbert Voss  <voss@perce.de>
-  
-       * QBibtex.[Ch]: fix bugs in the apply-part
-  
+
+       * QBibtex.[Ch]: fix bugs in the apply-part
+
 2002-11-13  John Levon  <levon@movementarian.org>
 
        * QDocument.h:
        * QDocumentDialog.C:
        * ui/QDocumentDialog.ui:
        * ui/BulletsModuleBase.ui: some UI fixes
+
 2002-11-12  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QDocumentDialog.C: enable apply on change
 2002-11-12  Edwin Leuven  <leuven@fee.uva.nl>
 
        * QBrowseBox: Juergen Spitzmueller's mouse focus fix
-       
+
 2002-11-08  Edwin Leuven  <leuven@fee.uva.nl>
 
        * Dialogs2.C: compile fix
        * ui/BulletsModuleBase.ui: idem
        * ui/QTabularDialog.ui: new tabular dialog
        * qsetborder.[Ch]: new small qt widget to set table borders
-       
+
 2002-11-08  Dekel Tsur  <dekelts@tau.ac.il>
 
        * lyx_gui.C:
 
        * ui/QIncludeDialog.ui:
        * QInclude.C: fix setting of combobox
+
 2002-11-07  John Levon  <levon@movementarian.org>
 
        * ui/QPref*: add initial prefs ui from Juergen S
+
 2002-11-27  Juergen Spitzmueller  <j.spitzmueller@gmx.de>
 
        * ui/QDocument.ui:
        * QDocumentDialog.C:
-       * QDocument.[Ch]: 
+       * QDocument.[Ch]:
        Implement "Save as default" and "Use class defaults"
-       
+
        * QDocumentDialog.C: Fix dialog update on class change
        implement lyxrc.auto_reset_options
 
 2002-11-07  John Levon  <levon@movementarian.org>
 
-       * QGraphics.[Ch]:
-       * QGraphicsDialog.[Ch]:
-       * ui/QGraphicsDialog.ui: various fixes so it actually
+       * QGraphics.[Ch]:
+       * QGraphicsDialog.[Ch]:
+       * ui/QGraphicsDialog.ui: various fixes so it actually
        works
+
 2002-11-01  Herbert Voss  <voss@perce.de>
-       * QGraphics.[Ch]:
-       * QGraphicsDialog.[Ch]:
-       * ui/QGraphicsDialog.ui: get scale/rotate working
+
+       * QGraphics.[Ch]:
+       * QGraphicsDialog.[Ch]:
+       * ui/QGraphicsDialog.ui: get scale/rotate working
+
 2002-11-04  Angus Leeming  <leeming@lyx.org>
 
        * QGraphics.C (update_contents): controller.getUnits() ->
index 2d9592096fcb17ecb5cfc9f702afbd2a070f0af2..c4f93e6a6b820fe4f3f5e802f0b5bcd2e69a3a11 100644 (file)
@@ -26,6 +26,8 @@
 #include <qtextview.h>
 #include <qpushbutton.h>
 
+#include "BoostFormat.h"
+
 typedef Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> > base_class;
 
 
@@ -45,7 +47,7 @@ void QVCLog::build_dialog()
 
 void QVCLog::update_contents()
 {
-       dialog_->setCaption(string(_("Version control log for ") + controller().getBufferFileName()).c_str());
+       dialog_->setCaption(boost::io::str(boost::format(_("Version control log for %1$s")) % controller().getBufferFileName()).c_str());
 
        dialog_->vclogTV->setText("");
 
index ac4a9719d3aad9c753843d8ee92a2b7c5d626517..47a3c48e4fa9b65f4a0e38089af3c04cdd574270 100644 (file)
@@ -1,3 +1,11 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * FormGraphics.C (build): use boost::format
+
+       * FeedbackController.C (postMessage): use boost::format
+
+       * ColorHandler.C (getGCForeground): use boost::format
+
 2002-11-21  Angus Leeming  <leeming@lyx.org>
 
        * forms/fdfix.sh: Don't use "if [ $? -ne 0 ]; then..."
@@ -7,7 +15,7 @@
 
 2002-11-20  Angus Leeming  <leeming@lyx.org>
 
-       * forms/fdfix.sh: 
+       * forms/fdfix.sh:
        * forms/fdfixh.sed: strengthen the sed in the sed script and further
        beautify the contents of the resultant .h file.
 
@@ -40,7 +48,7 @@
 2002-11-17  John Levon  <levon@movementarian.org>
 
        * FileDialog.C: open/save name change
+
 2002-11-15  John Levon  <levon@movementarian.org>
 
        * Dialogs2.C:
@@ -53,7 +61,7 @@
        * forms/form_tabular.fd: port tabular and prefs to MVC
 
        * FormBase.h: make hide() virtual for prefs
+
 2002-11-08  Angus Leeming  <leeming@lyx.org>
 
        * xforms_resize.[Ch]: sigh. Hack the "get scaling" part of
        a clean way.
 
 2002-10-31  Herbert Voss  <voss@perce.de>
-       * FormGraphics.C (build, apply): get the rotate-list from the 
-       controller
+
+       * FormGraphics.C (build, apply): get the rotate-list from the
+       controller
+
 2002-11-04  Angus Leeming  <leeming@lyx.org>
 
        * FormGraphics.C (build): Use frnt::getBBUnits().
index 9180008b055051650829668d4bd164caf040caf1..c8fcc55ddddcd5c4e28f1f476c95dcebab14fb80 100644 (file)
 #include "gettext.h"
 #include "debug.h"
 
+#include <boost/scoped_array.hpp>
+#include "BoostFormat.h"
+
 #include <cmath>
 
-#include <boost/scoped_array.hpp>
 #ifndef CXX_GLOBAL_CSTD
 using std::pow;
 #endif
@@ -37,7 +38,7 @@ LyXColorHandler::LyXColorHandler()
        drawable = XCreatePixmap(display,
                                 RootWindow(display, fl_screen),
                                 10, 10, fl_get_visual_depth());
-       
+
        colormap = fl_state[fl_get_vclass()].colormap;
        // Clear the GC cache
        for (int i = 0; i <= LColor::ignore; ++i) {
@@ -85,24 +86,23 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
        // Look up the RGB values for the color, and an approximate
        // color that we can hope to get on this display.
        if (XLookupColor(display, colormap, s.c_str(), &xcol, &ccol) == 0) {
-               lyxerr << _("LyX: Unknown X11 color ") << s
-                      << _(" for ") << lcolor.getGUIName(c) << '\n'
-                      << _("     Using black instead, sorry!") << endl;
+               lyxerr << boost::format(_("LyX: Unknown X11 color %1$s for %2$s\n"
+                                         "     Using black instead, sorry!"))
+                       % s % lcolor.getGUIName(c) << endl;
                unsigned long bla = BlackPixel(display,
                                               DefaultScreen(display));
                val.foreground = bla;
        // Try the exact RGB values first, then the approximate.
        } else if (XAllocColor(display, colormap, &xcol) != 0) {
                if (lyxerr.debugging(Debug::GUI)) {
-                       lyxerr << _("LyX: X11 color ") << s
-                              << _(" allocated for ")
-                              << lcolor.getGUIName(c) << endl;
+                       lyxerr << boost::format(_("LyX: X11 color %1$s allocated for %2$s"))
+                               % s % lcolor.getGUIName(c)
+                              << endl;
                }
                val.foreground = xcol.pixel;
        } else if (XAllocColor(display, colormap, &ccol)) {
-               lyxerr << _("LyX: Using approximated X11 color ") << s
-                      << _(" allocated for ")
-                      << lcolor.getGUIName(c) << endl;
+               lyxerr << boost::format(_("LyX: Using approximated X11 color %1$s allocated for %2$s"))
+                       % s % lcolor.getGUIName(c) << endl;
                val.foreground = xcol.pixel;
        } else {
                // Here we are traversing the current colormap to find
@@ -141,24 +141,28 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
                                closest_pixel = t;
                        }
                }
-               lyxerr << _("LyX: Couldn't allocate '") << s
-                      << _("' for ") << lcolor.getGUIName(c)
-                      << _(" with (r,g,b)=(")
-                      << xcol.red << "," << xcol.green << ","
-                      << xcol.blue << ").\n"
-                      << _("     Using closest allocated "
-                           "color with (r,g,b)=(")
-                      << cmap[closest_pixel].red << ","
-                      << cmap[closest_pixel].green << ","
-                      << cmap[closest_pixel].blue << _(") instead.\n")
-                      << _("Pixel [") << closest_pixel << _("] is used.")
+
+               lyxerr << boost::format(
+                       _("LyX: Couldn't allocate '%1$s' for %2$s"
+                         " with (r,g,b)=(%3$d,%4$d,%5$d).\n"
+                         "     Using closest allocated color"
+                         " with (r,g,b)=(%6$d,%7$d,%8$d) instead.\n"
+                         "Pixel [%9$d] is used."))
+                       % s
+                       % lcolor.getGUIName(c)
+                       % xcol.red % xcol.green % xcol.blue
+                       % cmap[closest_pixel].red
+                       % cmap[closest_pixel].green
+                       % cmap[closest_pixel].blue
+                       % closest_pixel
                       << endl;
+
                val.foreground = cmap[closest_pixel].pixel;
        }
 
        val.function = GXcopy;
        return colorGCcache[c] = XCreateGC(display, drawable,
-                                   GCForeground | GCFunction, &val);
+                                          GCForeground | GCFunction, &val);
 }
 
 
@@ -169,7 +173,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
        //if (lyxerr.debugging()) {
        //      lyxerr << "Painter drawable: " << drawable() << endl;
        //}
-       
+
        int index = lw + (ls << 1) + (c << 6);
 
        LineGCCache::iterator it = lineGCcache.find(index);
@@ -178,7 +182,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
 
        XGCValues val;
        XGetGCValues(display, getGCForeground(c), GCForeground, &val);
-       
+
        switch (lw) {
        case Painter::line_thin:
                val.line_width = 0;
@@ -187,7 +191,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
                val.line_width = 2;
                break;
        }
-       
+
        switch (ls) {
        case Painter::line_solid:
                val.line_style = LineSolid;
@@ -234,8 +238,8 @@ void LyXColorHandler::updateColor (LColor::color c)
                                              Painter::line_width(lw), c);
                        }
                }
-
 }
 
+
 //
 boost::scoped_ptr<LyXColorHandler> lyxColorHandler;
index 0f453cb4bb3e9075a9baad97d8e48ee39cb33abc..8dd43fe95017ebfebd61a6bc4591854f63fa43e5 100644 (file)
@@ -3,7 +3,7 @@
  * This file is part of LyX, the document processor.
  * Licence details can be found in the file COPYING.
  *
- * \author Angus Leeming 
+ * \author Angus Leeming
  *
  * Full author contact details are available in file CREDITS
  */
@@ -24,6 +24,9 @@
 #include "gettext.h"        // _()
 #include "xforms_helpers.h" // formatted
 #include "support/LAssert.h"
+
+#include "BoostFormat.h"
+
 #include FORMS_H_LOCATION
 
 FeedbackController::FeedbackController()
@@ -110,7 +113,7 @@ void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key)
                        fl_get_winorigin(folder->window,
                                         &(folder->x), &(folder->y));
                }
-               
+
        }
 
        if (message_widget_) {
@@ -162,14 +165,13 @@ void FeedbackController::postMessage(string const & message)
 {
        lyx::Assert(message_widget_);
 
-       string str;
-       if (warning_posted_)
-               str = _("WARNING! ") + message;
-       else
-               str = message;
+       boost::format fmter = warning_posted_ ?
+               boost::format(_("WARNING! %1$s")) :
+               boost::format("%1$s");
 
        int const width = message_widget_->w - 10;
-       str = formatted(str, width, FL_NORMAL_SIZE);
+       string const str = formatted(boost::io::str(fmter % message),
+                                    width, FL_NORMAL_SIZE);
 
        fl_set_object_label(message_widget_, str.c_str());
        FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;
index 40dcb9ecb5e38913314ae0fd9572c240dfbb200d..0878f073a28caa608fb8bce2c264d212eba24525 100644 (file)
@@ -39,6 +39,8 @@
 #include "support/lyxlib.h"  // for float_equal
 #include "support/filetools.h"  // for MakeAbsPath etc
 
+#include "BoostFormat.h"
+
 #include FORMS_H_LOCATION
 
 using std::endl;
@@ -89,7 +91,7 @@ void FormGraphics::build()
        file_.reset(build_graphics_file(this));
 
        // disable for read-only documents
-       bc().addReadOnly(file_->button_browse);   
+       bc().addReadOnly(file_->button_browse);
        bc().addReadOnly(file_->check_aspectratio);
        bc().addReadOnly(file_->check_draft);
        bc().addReadOnly(file_->check_nounzip);
@@ -116,12 +118,12 @@ void FormGraphics::build()
        // width default is scaling: use unsigned float filter
        fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
        fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
-       
+
        string const display_List =
                _("Default|Monochrome|Grayscale|Color|Do not display");
        fl_addto_choice(file_->choice_display, display_List.c_str());
-       
-       string const width_list = _("Scale%%|") + choice_Length_All;
+
+       string const width_list = boost::io::str(boost::format(_("Scale%%|%1$s")) % choice_Length_All);
        fl_addto_choice(file_->choice_width, width_list.c_str());
 
        fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
@@ -145,8 +147,8 @@ void FormGraphics::build()
        tooltips().init(file_->input_height, str);
        str = _("Select unit for height.");
        tooltips().init(file_->choice_height, str);
-       str = _("Do not distort the image. " 
-                "Keep image within \"width\" by \"height\" and obey "
+       str = _("Do not distort the image. "
+               "Keep image within \"width\" by \"height\" and obey "
                "aspect ratio.");
        tooltips().init(file_->check_aspectratio, str);
        str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
@@ -239,7 +241,7 @@ void FormGraphics::build()
 
        // set up the tooltips for the extra section
        str = _("Insert the rotation angle in degrees. "
-               "Positive value rotates anti-clockwise, "
+               "Positive value rotates anti-clockwise, "
                "negative value clockwise.");
        tooltips().init(extra_->input_rotate_angle, str);
        str = _("Insert the point of origin for rotation.");
@@ -249,7 +251,7 @@ void FormGraphics::build()
        str = _("Insert the optional subfigure caption.");
        tooltips().init(extra_->input_subcaption, str);
        str = _("Add any additional latex option, which is defined in the "
-                "graphicx-package and not mentioned in the gui's tabfolders.");
+               "graphicx-package and not mentioned in the gui's tabfolders.");
        tooltips().init(extra_->input_special, str);
 
        // add the different tabfolders
@@ -286,7 +288,7 @@ void FormGraphics::apply()
        if (igp.lyxscale == 0) {
                igp.lyxscale = 100;
        }
-       
+
        switch (fl_get_choice(file_->choice_display)) {
        case 5:
                igp.display = grfx::NoDisplay;
@@ -325,7 +327,7 @@ void FormGraphics::apply()
 
        // the bb section
        if (!controller().bbChanged) {
-               // don't write anything         
+               // don't write anything
                igp.bb.erase();
        } else {
                // allow length + unit input only for x1 input field
@@ -375,7 +377,7 @@ void FormGraphics::apply()
                        bb += "0";
                else
                        bb += getLengthFromWidgets(bbox_->input_bb_y1,
-                                                  bbox_->choice_bb_units); 
+                                                  bbox_->choice_bb_units);
 
                igp.bb = bb;
        }
@@ -383,7 +385,7 @@ void FormGraphics::apply()
 
        // the extra section
        igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
-       
+
        // map angle into -360 (clock-wise) to +360 (counter clock-wise)
        while (igp.rotateAngle <= -360.0) {
                igp.rotateAngle += 360.0;
@@ -452,7 +454,7 @@ void FormGraphics::update() {
        bool const disable_height = !lyx::float_equal(igp.scale, 0.0, 0.05);
        setEnabled(file_->input_height, !disable_height);
        setEnabled(file_->choice_height, !disable_height);
-       
+
        fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
        fl_set_button(file_->check_draft, igp.draft);
        fl_set_button(file_->check_nounzip, igp.noUnzip);
@@ -579,7 +581,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
                bool const scaling = fl_get_choice(file_->choice_width) == 1;
                setEnabled(file_->input_height, !scaling);
                setEnabled(file_->choice_height, !scaling);
-               
+
                // allow only integer intput for scaling; float otherwise
                if (scaling) {
                        fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
index 03eb4002b92be0dc35a300a86a8c16468c248f9c..1a11197aa0c7ba69bc531b2c5b497b6aa1aa1661 100644 (file)
@@ -14,8 +14,6 @@
 #pragma implementation
 #endif
 
-#include <algorithm>
-
 #include "importer.h"
 #include "converter.h"
 #include "frontends/LyXView.h"
 #include "gettext.h"
 #include "BufferView.h"
 
+#include "BoostFormat.h"
+
+#include <algorithm>
+
 using std::vector;
 using std::find;
 
@@ -39,7 +41,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
 {
        string const displaypath = MakeDisplayPath(filename);
        ostringstream s1;
-       s1 << _("Importing") << ' ' << displaypath << "...";
+       s1 << boost::format(_("Importing %1$s...")) % displaypath;
        lv->message(STRCONV(s1.str()));
 
        string const lyxfile = ChangeExtension(filename, ".lyx");
@@ -59,8 +61,8 @@ bool Importer::Import(LyXView * lv, string const & filename,
                }
                if (loader_format.empty()) {
                        Alert::alert(_("Cannot import file"),
-                                  _("No information for importing from ")
-                                  + formats.prettyName(format));
+                                    boost::io::str(boost::format(_("No information for importing from %1$s"))
+                                  % formats.prettyName(format)));
                        return false;
                }
        } else
index 3b59b6bd2f84564720bb37b75ed779fed6c5d1b3..085a5ed14674b53fc6f49453b03adac4b169aa3f 100644 (file)
@@ -1,3 +1,14 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * insetparent.C (getScreenLabel): use boost::format
+
+       * insetgraphics.C (prepareFile): use boost::format
+       (ascii): ditto
+
+       * insetfloatlist.C (latex): use boost::format
+
+       * insetcaption.C (draw): use boost::format
+
 2002-11-21  Dekel Tsur  <dekelts@tau.ac.il>
 
        * insettabular.C (tabularFeatures): Support for block alignment in fixed width
index 39691f7d6aebd4c3ed0244f8415233f41fc9df48..354d31540c10192852f7b858a1b4ee86fd1606f4 100644 (file)
@@ -25,6 +25,8 @@
 #include "gettext.h"
 #include "support/lstrings.h"
 
+#include "BoostFormat.h"
+
 using std::ostream;
 using std::endl;
 
@@ -86,10 +88,10 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
 
        // Discover the number...
        // ...
-       string const num = "#";
+       string const num("#");
 
        // Generate the label
-       string const label = _(fl) + " " + num + ":";
+       string const label = boost::io::str(boost::format("%1$s %2$s:") % _(fl) % num);
 
        Painter & pain = bv->painter();
        int const w = font_metrics::width(label, f);
index 36102f2d635fb168df6577915c39c61e8064623e..526d85c7079c79877352089c916e060949c18b02 100644 (file)
@@ -25,6 +25,7 @@
 #include "gettext.h"
 #include "debug.h"
 
+#include "BoostFormat.h"
 
 using std::ostream;
 using std::endl;
@@ -124,8 +125,11 @@ int InsetFloatList::latex(Buffer const * buf, ostream & os, bool, bool) const
                           << cit->second.listName() << "}\n";
                }
        } else {
-               os << "%%\\listof{" << getCmdName() << "}{"
-                  << _("List of ") << cit->second.name() << "}\n";
+               os << "%%\\listof{"
+                  << getCmdName()
+                  << "}{"
+                  << boost::format(_("List of %1$s")) % cit->second.name()
+                  << "}\n";
        }
        return 1;
 }
index cbcd6c8d208d29bf7cdf274cdb64c8031004d644..01b82f4e9942de7940f8570e0aaa5b599b106093 100644 (file)
@@ -92,6 +92,7 @@ TODO
 #include <boost/weak_ptr.hpp>
 #include <boost/bind.hpp>
 #include <boost/signals/trackable.hpp>
+#include "BoostFormat.h"
 
 #include <algorithm> // For the std::max
 
@@ -666,8 +667,8 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
                one.startscript(Systemcall::Wait, command);
                if (!IsFileReadable(ChangeExtension(outfile_base, to)))
                        Alert::alert(_("Cannot convert Image (not existing file?)"),
-                               _("No information for converting from ")
-                               + from + _(" to ") + to);
+                                    boost::io::str(boost::format(_("No information for converting from %1$s to %2$s"))
+                               % from % to));
        }
 
        return RemoveExtension(temp_file);
@@ -756,7 +757,9 @@ int InsetGraphics::ascii(Buffer const *, ostream & os, int) const
        // 1. Convert file to ascii using gifscii
        // 2. Read ascii output file and add it to the output stream.
        // at least we send the filename
-       os << '<' << _("Graphic file:") << params().filename << ">\n";
+       os << '<'
+          << boost::format(_("Graphic file: %1$s")) % params().filename
+          << ">\n";
        return 0;
 }
 
index 2620275fe04cad374d63605b73521bd0b6b1e4b0..96244473a795f838ba768d972c4345df68a86167 100644 (file)
@@ -27,6 +27,8 @@
 #include "buffer.h"
 #include "gettext.h"
 
+#include "BoostFormat.h"
+
 using std::ostream;
 
 
@@ -40,12 +42,12 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
 
 string const InsetParent::getScreenLabel(Buffer const *) const
 {
-       return string(_("Parent:")) + getContents();
+       return boost::io::str(boost::format(_("Parent: %1$s")) % getContents());
 }
 
 
 void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
-{    
+{
        bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
 }
 
index 61efafa627321354eaa2a5d44611b255d895275a..f2ba793780e5d841aae7f0e3d6b4bce0db7e88d6 100644 (file)
@@ -42,6 +42,7 @@
 #include "frontends/Alert.h"
 #include "frontends/lyx_gui.h"
 
+#include "BoostFormat.h"
 #include <boost/function.hpp>
 
 #include <cstdlib>
@@ -100,9 +101,7 @@ LyX::LyX(int & argc, char * argv[])
        // other than documents
        for (int argi = 1; argi < argc ; ++argi) {
                if (argv[argi][0] == '-') {
-                       lyxerr << _("Wrong command line option `")
-                              << argv[argi]
-                              << _("'. Exiting.") << endl;
+                       lyxerr << boost::format(_("Wrong command line option `%1$s'. Exiting.")) % argv[argi] << endl;
                        exit(1);
                }
        }
@@ -354,8 +353,7 @@ void LyX::init(bool gui)
                                        << "Giving up." << endl;
                                exit(1);
                        }
-                       lyxerr << _("Using built-in default ")
-                              << LYX_DIR << _(" but expect problems.")
+                       lyxerr << boost::format(_("Using built-in default %1$s but expect problems.")) % LYX_DIR
                               << endl;
                } else {
                        lyxerr << _("Expect problems.") << endl;
@@ -604,14 +602,13 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
                return;
        }
 
-       lyxerr << _("LyX: Creating directory ") << user_lyxdir
-              << _(" and running configure...") << endl;
+       lyxerr << boost::format(_("LyX: Creating directory %1$s and running configure...")) % user_lyxdir << endl;
 
        if (!createDirectory(user_lyxdir, 0755)) {
                // Failed, let's use $HOME instead.
                user_lyxdir = GetEnvPath("HOME");
-               lyxerr << _("Failed. Will use ") << user_lyxdir
-                      << _(" instead.") << endl;
+               lyxerr << boost::format(_("Failed. Will use %1$s instead.")) % user_lyxdir
+                      << endl;
                return;
        }
 
@@ -632,7 +629,7 @@ bool LyX::readRcFile(string const & name)
                                    << " in " << lyxrc_path << endl;
                if (lyxrc.read(lyxrc_path) < 0) {
                        Alert::alert(_("LyX Warning!"),
-                                  _("Error while reading ") + lyxrc_path + ".",
+                                  boost::io::str(boost::format(_("Error while reading %1$s.")) % lyxrc_path),
                                   _("Using built-in defaults."));
                        return false;
                }
@@ -736,7 +733,7 @@ bool is_gui = true;
 string batch;
 
 /// return the the number of arguments consumed
-typedef boost::function<int, string const &, string const &> cmd_helper;
+typedef boost::function<int(string const &, string const &)> cmd_helper;
 
 int parse_dbg(string const & arg, string const &)
 {
@@ -745,7 +742,7 @@ int parse_dbg(string const & arg, string const &)
                Debug::showTags(lyxerr);
                exit(0);
        }
-       lyxerr << _("Setting debug level to ") << arg << endl;
+       lyxerr << boost::format(_("Setting debug level to %1$s")) % arg << endl;
        lyxerr.level(Debug::value(arg));
        Debug::showLevel(lyxerr, lyxerr.level());
        return 1;
index 5a11937436819b30783bbafc5945b5078e765239..e834421a8981a859eefd4edfabde706598c52ebc 100644 (file)
@@ -26,6 +26,8 @@
 #include "support/lstrings.h"
 #include "bufferparams.h" // stateText
 
+#include "BoostFormat.h"
+
 using std::ostream;
 using std::endl;
 
@@ -525,22 +527,24 @@ string const LyXFont::stateText(BufferParams * params) const
        if (color() != LColor::inherit)
                ost << lcolor.getGUIName(color()) << ", ";
        if (emph() != INHERIT)
-               ost << _("Emphasis ")
-                   << _(GUIMiscNames[emph()]) << ", ";
+               ost << boost::format(_("Emphasis %1$s, "))
+                       % _(GUIMiscNames[emph()]);
        if (underbar() != INHERIT)
-               ost << _("Underline ")
-                   << _(GUIMiscNames[underbar()]) << ", ";
+               ost << boost::format(_("Underline %1$s, "))
+                       % _(GUIMiscNames[underbar()]);
        if (noun() != INHERIT)
-               ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
+               ost << boost::format(_("Noun %1$s, "))
+                       % _(GUIMiscNames[noun()]);
        if (bits == inherit)
                ost << _("Default") << ", ";
        if (!params || (language() != params->language))
-               ost << _("Language: ") << _(language()->display()) << ", ";
+               ost << boost::format(_("Language: %1$s, "))
+                       % _(language()->display());
        if (number() != OFF)
-               ost << _("  Number ") << _(GUIMiscNames[number()]);
+               ost << boost::format(_("  Number %1$s"))
+                       % _(GUIMiscNames[number()]);
 
-       string buf(STRCONV(ost.str()));
-       buf = rtrim(buf, ", ");
+       string const buf = rtrim(STRCONV(ost.str()), ", ");
        return buf;
 }
 
index 79fd0e8efdb87447aad0372c99e30d8d06ed4514..7f463b56c5f0ac6333128a937e2d1dfcb17f7eee 100644 (file)
@@ -69,6 +69,8 @@
 #include "support/path.h"
 #include "support/lyxfunctional.h"
 
+#include "BoostFormat.h"
+
 #include <ctime>
 #include <clocale>
 #include <cstdlib>
@@ -946,8 +948,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
        case LFUN_MENUWRITE:
                if (!owner->buffer()->isUnnamed()) {
                        ostringstream s1;
-                       s1 << _("Saving document") << ' '
-                          << MakeDisplayPath(owner->buffer()->fileName() + "...");
+                       s1 << boost::format(_("Saving document %1$s..."))
+                          % MakeDisplayPath(owner->buffer()->fileName());
                        owner->message(STRCONV(s1.str()));
                        MenuWrite(view(), owner->buffer());
                        s1 << _(" done.");
@@ -1104,8 +1106,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                        break;
                }
                ostringstream str;
-               str << _("Opening help file") << ' '
-                   << MakeDisplayPath(fname) << "...";
+               str << boost::format(_("Opening help file %1$s..."))
+                   % MakeDisplayPath(fname);
                owner->message(STRCONV(str.str()));
                view()->buffer(bufferlist.loadLyXFile(fname, false));
                owner->allowInput();
@@ -1435,11 +1437,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                         x11_name != lcolor.getX11Name(LColor::graphicsbg));
 
                if (!lcolor.setColor(lyx_name, x11_name)) {
-                       static string const err1 (N_("Set-color \""));
-                       static string const err2 (
-                               N_("\" failed - color is undefined "
-                                  "or may not be redefined"));
-                       setErrorMessage(_(err1) + lyx_name + _(err2));
+                       setErrorMessage(boost::io::str(boost::format(_("Set-color \"%1$s\" failed - color is undefined or may not be redefined")) % lyx_name));
+
                        break;
                }
 
@@ -1673,7 +1672,7 @@ void LyXFunc::open(string const & fname)
        }
 
        ostringstream str;
-       str << _("Opening document") << ' ' << disp_fn << "...";
+       str << boost::format(_("Opening document %1$s...")) % disp_fn;
 
        owner->message(STRCONV(str.str()));
 
@@ -1681,9 +1680,9 @@ void LyXFunc::open(string const & fname)
        ostringstream str2;
        if (openbuf) {
                view()->buffer(openbuf);
-               str2 << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
+               str2 << boost::format(_("Document %1$s opened.")) % disp_fn;
        } else {
-               str2 << _("Could not open document") << ' ' << disp_fn;
+               str2 << boost::format(_("Could not open document %1$s")) % disp_fn;
        }
        owner->message(STRCONV(str2.str()));
 }
@@ -1708,8 +1707,7 @@ void LyXFunc::doImport(string const & argument)
                                initpath = trypath;
                }
 
-               string const text = _("Select ") + formats.prettyName(format)
-                       + _(" file to import");
+               string const text = boost::io::str(boost::format(_("Select %1$s file to import")) % formats.prettyName(format));
 
                FileDialog fileDlg(owner, text,
                        LFUN_IMPORT,
index fd0f18097b08e60ded1f3f3adf9830e192a6dc5f..6211f70198115a2e18b1961600a27a54f2864cc9 100644 (file)
@@ -1,3 +1,7 @@
+2002-11-21  Lars Gullik Bjønnes  <larsbj@birdstep.com>
+
+       * formulamacro.C (prefix): use boost::format
+
 2002-11-04  Dekel Tsur  <dekelts@tau.ac.il>
 
        * formulabase.C (lfunMouseRelease): Do not make the buffer dirty
index 8bc0531c0b544ece3105c86647c31e6fe82979eb..a4473a9847e7d4f0115bdd6dfbbef3d4857668c5 100644 (file)
@@ -40,6 +40,8 @@
 
 #include "Lsstream.h"
 
+#include "BoostFormat.h"
+
 using std::ostream;
 
 extern MathCursor * mathcursor;
@@ -126,7 +128,7 @@ void InsetFormulaMacro::read(std::istream & is)
 
 string InsetFormulaMacro::prefix() const
 {
-       return string(" ") + _("Macro: ") + getInsetName() + ": ";
+       return boost::io::str(boost::format(_(" Macro: %1$s: ")) % getInsetName());
 }
 
 
index e33f4098dfb1aa7b31e54f14ca688f01943d60e4..15f2481d922546448f2c5439e619115f79adc461 100644 (file)
--- a/src/toc.C
+++ b/src/toc.C
@@ -79,9 +79,8 @@ TocList const getTocList(Buffer const * buf)
        ParConstIterator pit = buf->par_iterator_begin();
        ParConstIterator end = buf->par_iterator_end();
        for (; pit != end; ++pit) {
                Paragraph const * par = *pit;
+
 #ifdef WITH_WARNINGS
 #warning bogus type (Lgb)
 #endif