]> git.lyx.org Git - features.git/commitdiff
The 'bformat' introduction
authorAndré Pönitz <poenitz@gmx.net>
Tue, 13 May 2003 09:48:57 +0000 (09:48 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 13 May 2003 09:48:57 +0000 (09:48 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6953 a592a061-630c-0410-9148-cb99ea01b6c8

57 files changed:
src/BufferView.C
src/BufferView_pimpl.C
src/ChangeLog
src/CutAndPaste.C
src/LaTeX.C
src/LaTeXFeatures.C
src/ParagraphParameters.C
src/buffer.C
src/bufferlist.C
src/bufferparams.C
src/bufferview_funcs.C
src/converter.C
src/counters.C
src/debug.C
src/exporter.C
src/format.C
src/frontends/controllers/ChangeLog
src/frontends/controllers/ControlDocument.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSpellchecker.C
src/frontends/controllers/biblio.C
src/frontends/xforms/ChangeLog
src/frontends/xforms/FormDocument.C
src/frontends/xforms/FormGraphics.C
src/frontends/xforms/xforms_helpers.C
src/graphics/ChangeLog
src/graphics/PreviewLoader.C
src/importer.C
src/insets/ChangeLog
src/insets/insetcaption.C
src/insets/insetexternal.C
src/insets/insetfloat.C
src/insets/insetfloatlist.C
src/insets/insetgraphics.C
src/insets/insetinclude.C
src/insets/insetminipage.C
src/insets/insettabular.C
src/insets/insettext.C
src/insets/insetwrap.C
src/lyx_cb.C
src/lyx_main.C
src/lyxfont.C
src/lyxfunc.C
src/lyxvc.C
src/mathed/ChangeLog
src/mathed/formula.C
src/mathed/math_cursor.C
src/mathed/math_parser.C
src/paragraph.C
src/paragraph_funcs.C
src/support/ChangeLog
src/support/lstrings.C
src/support/lstrings.h
src/tabular.C
src/tabular_funcs.C
src/text2.C
src/text3.C

index 5e8763cfc0feb34f1df3749de5ffb0a341946d41..49a2ed934180c6a0770a01dca291d272084276f4 100644 (file)
@@ -44,7 +44,6 @@
 #include "support/lyxfunctional.h" // equal_1st_in_pair
 #include "support/types.h"
 #include "support/lyxalgo.h" // lyx_count
-#include "support/BoostFormat.h"
 
 #include <fstream>
 
@@ -293,14 +292,8 @@ bool BufferView::insertLyXFile(string const & filen)
 
        if (!fi.readable()) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The specified document\n%1$s\ncould not be read."));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The specified document\n");
-               text += file + _(" could not be read.");
-#endif
+               string const text =
+                       bformat(_("The specified document\n%1$s\ncould not be read."), file);
                Alert::error(_("Could not read document"), text);
                return false;
        }
@@ -310,14 +303,8 @@ bool BufferView::insertLyXFile(string const & filen)
        ifstream ifs(fname.c_str());
        if (!ifs) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not open the specified document\n%1$s."));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Could not open the specified document\n");
-               text += file + ".";
-#endif
+               string const text =
+                       bformat(_("Could not open the specified document\n"), file);
                Alert::error(_("Could not open file"), text);
                return false;
        }
index eafdf9d1377f1807c74930bda3497ae10a96cc6d..bb611da49130763c1f3a3f020c5368c70c3a1f5b 100644 (file)
@@ -19,6 +19,7 @@
 #include "gettext.h"
 #include "intl.h"
 #include "iterators.h"
+#include "Lsstream.h"
 #include "lyx_cb.h" // added for Dispatch functions
 #include "lyx_main.h"
 #include "lyxfind.h"
@@ -57,7 +58,6 @@
 
 #include <boost/bind.hpp>
 #include <boost/signals/connection.hpp>
-#include "support/BoostFormat.h"
 
 #include <unistd.h>
 #include <sys/wait.h>
@@ -621,15 +621,8 @@ void BufferView::Pimpl::savePosition(unsigned int i)
        saved_positions[i] = Position(buffer_->fileName(),
                                      bv_->text->cursor.par()->id(),
                                      bv_->text->cursor.pos());
-       if (i > 0) {
-               ostringstream str;
-#if USE_BOOST_FORMAT
-               str << boost::format(_("Saved bookmark %1$d")) % i;
-#else
-               str << _("Saved bookmark ") << i;
-#endif
-               owner_->message(STRCONV(str.str()));
-       }
+       if (i > 0)
+               owner_->message(bformat(_("Saved bookmark %1$s"), tostr(i)));
 }
 
 
@@ -657,15 +650,8 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
                             min(par->size(), saved_positions[i].par_pos));
 
        update(BufferView::SELECT);
-       if (i > 0) {
-               ostringstream str;
-#if USE_BOOST_FORMAT
-               str << boost::format(_("Moved to bookmark %1$d")) % i;
-#else
-               str << _("Moved to bookmark ") << i;
-#endif
-               owner_->message(STRCONV(str.str()));
-       }
+       if (i > 0)
+               owner_->message(bformat(_("Moved to bookmark %1$s"), tostr(i)));
 }
 
 
@@ -853,33 +839,13 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
        // necessary
        filename = FileSearch(string(), filename, "lyx");
 
-       string const disp_fn(MakeDisplayPath(filename));
-
-       ostringstream s1;
-#if USE_BOOST_FORMAT
-       s1 << boost::format(_("Inserting document %1$s...")) % disp_fn;
-#else
-       s1 << _("Inserting document ") << disp_fn << _("...");
-#endif
-       owner_->message(STRCONV(s1.str()));
+       string const disp_fn = MakeDisplayPath(filename);
+       owner_->message(bformat(_("Inserting document %1$s..."), disp_fn));
        bool const res = bv_->insertLyXFile(filename);
-       if (res) {
-               ostringstream str;
-#if USE_BOOST_FORMAT
-               str << boost::format(_("Document %1$s inserted.")) % disp_fn;
-#else
-               str << _("Document ") << disp_fn << _(" inserted.");
-#endif
-               owner_->message(STRCONV(str.str()));
-       } else {
-               ostringstream str;
-#if USE_BOOST_FORMAT
-               str << boost::format(_("Could not insert document %1$s")) % disp_fn;
-#else
-               str << _("Could not insert document ") << disp_fn;
-#endif
-               owner_->message(STRCONV(str.str()));
-       }
+       if (res) 
+               owner_->message(bformat(_("Document %1$s inserted."), disp_fn));
+       else 
+               owner_->message(bformat(_("Could not insert document %1$s"), disp_fn));
 }
 
 
index 18ecd46b8a6d233d88240e7e63fcf991c6cb5d58..91af4d567a220f3a935508e634d0186c6b0450f1 100644 (file)
@@ -1,4 +1,35 @@
 
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * BufferView.C:
+       * BufferView_pimpl.C:
+       * CutAndPaste.C:
+       * LaTeX.C:
+       * LaTeXFeatures.C:
+       * ParagraphParameters.C:
+       * buffer.C:
+       * bufferlist.C:
+       * bufferparams.C:
+       * bufferview_funcs.C:
+       * converter.C:
+       * counters.C:
+       * debug.C:
+       * exporter.C:
+       * format.C:
+       * importer.C:
+       * lyx_cb.C:
+       * lyx_main.C:
+       * lyxfont.C:
+       * lyxfunc.C:
+       * lyxvc.C:
+       * paragraph.C:
+       * paragraph_funcs.C:
+       * tabular.C:
+       * tabular_funcs.C:
+       * text2.C:
+       * text3.C:  boost::format -> bformat  all over the place
+
+
 2003-05-09 André Pönitz <poenitz@gmx.net>
 
        * LColor.[Ch]: Pimpl the #include <map> away
index fcf9f11c140f3d21fd5766fadf4d825170068283..10ba8fb70c668f17645c530f7a063e3ac38b8dc8 100644 (file)
 #include "ParagraphParameters.h"
 #include "lyxtext.h"
 #include "lyxcursor.h"
-#include "gettext.h"
 #include "iterators.h"
 #include "lyxtextclasslist.h"
 #include "undo_funcs.h"
+#include "gettext.h"
 #include "paragraph_funcs.h"
 #include "debug.h"
 
 #include "insets/inseterror.h"
 
-#include "support/BoostFormat.h"
 #include "support/LAssert.h"
+#include "support/lstrings.h"
 #include "support/limited_stack.h"
 
 using std::endl;
@@ -354,28 +354,12 @@ int CutAndPaste::SwitchLayoutsBetweenClasses(textclass_type c1,
 
                if (!hasLayout && name != tclass1.defaultLayoutName()) {
                        ++ret;
-#if USE_BOOST_FORMAT
-                       boost::format fmt(_("Layout had to be changed from\n"
-                                           "%1$s to %2$s\n"
-                                           "because of class conversion from\n"
-                                           "%3$s to %4$s"));
-                       fmt     % name
-                               % par->layout()->name()
-                               % tclass1.name()
-                               % tclass2.name();
-
-                       string const s = fmt.str();
-#else
-                       string const s = _("Layout had to be changed from\n")
-                               + name + _(" to ")
-                               + par->layout()->name()
-                               + _("\nbecause of class conversion from\n")
-                               + tclass1.name() + _(" to ")
-                               + tclass2.name();
-#endif
+                       string const s = bformat(
+                               _("Layout had to be changed from\n%1$s to %2$s\n"
+                               "because of class conversion from\n%3$s to %4$s"),
+                        name, par->layout()->name(), tclass1.name(), tclass2.name());
                        // To warn the user that something had to be done.
-                       InsetError * new_inset = new InsetError(s);
-                       par->insertInset(0, new_inset);
+                       par->insertInset(0, new InsetError(s));
                }
        }
        return ret;
index 59886c918c08b7f8f184080f8218c81be576d2f9..50ea8faa4bda3f4a9f8dd46905903068d23d3663 100644 (file)
@@ -28,7 +28,6 @@
 #include "support/path.h"
 
 #include <boost/regex.hpp>
-#include "support/BoostFormat.h"
 
 #include <fstream>
 #include <cstdio>  // sscanf
@@ -70,13 +69,8 @@ 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())));
+       string str = bformat(_("Waiting for LaTeX run number %1$s"), tostr(count));
+       lf->dispatch(FuncRequest(LFUN_MESSAGE, str));
 }
 
 
index 8f6dc0597cd30064e28ed85ce7432e8ec8b9c917..f79a7aa5e7a9cbfa4017f844b9204bf6b7d3189c 100644 (file)
@@ -19,6 +19,7 @@
 #include "language.h"
 #include "encoding.h"
 #include "LString.h"
+#include "Lsstream.h"
 
 #include "support/filetools.h"
 #include "support/lstrings.h"
index aca07b6b949e82f6cd67c0eeb0a44fe6801e52c3..6319f670054b10a555737573a681a571e99298e8 100644 (file)
@@ -10,6 +10,8 @@
 #include "gettext.h"
 #include "paragraph.h"
 #include "lyxtext.h"
+#include "Lsstream.h"
+
 #include "frontends/LyXView.h"
 
 #include "support/lstrings.h"
index 731e538c1c756f3e3345ebea7db34efdbd7a957a..13c612024941acf0047a75f3d763bb673ad50ca8 100644 (file)
@@ -66,7 +66,6 @@
 
 #include <boost/bind.hpp>
 #include <boost/tuple/tuple.hpp>
-#include "support/BoostFormat.h"
 
 #include <fstream>
 #include <iomanip>
@@ -147,14 +146,8 @@ Buffer::~Buffer()
                users->buffer(0);
 
        if (!tmppath.empty() && destroyDir(tmppath) != 0) {
-#if USE_BOOST_FORMAT
-               boost::format fmt = _("Could not remove the temporary directory %1$s");
-               fmt % tmppath;
-               string msg = fmt.str();
-#else
-               string msg = _("Could not remove the temporary directory ") + tmppath;
-#endif
-               Alert::warning(_("Could not remove temporary directory"), msg);
+               Alert::warning(_("Could not remove temporary directory"), 
+                       bformat(_("Could not remove the temporary directory %1$s"), tmppath));
        }
 
        paragraphs.clear();
@@ -257,16 +250,9 @@ namespace {
 
 void unknownClass(string const & unknown)
 {
-       string msg =
-#if USE_BOOST_FORMAT
-               boost::io::str(boost::format(
-                       _("Using the default document class, because the "
-                       " class %1$s is unknown.")) % unknown);
-#else
-               _("Using the default document class, because the "
-               " class ") + unknown + (" is unknown.");
-#endif
-       Alert::warning(_("Unknown document class"), msg);
+       Alert::warning(_("Unknown document class"), 
+               bformat(_("Using the default document class, because the "
+                       " class %1$s is unknown."), unknown));
 }
 
 } // anon
@@ -321,16 +307,9 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
 
                if (!params.getLyXTextClass().load()) {
                        string theclass = params.getLyXTextClass().name();
-                       string msg =
-#if USE_BOOST_FORMAT
-                               boost::io::str(boost::format(
-                                       _("Using the default document class, because the "
-                                       " class %1$s could not be loaded.")) % theclass);
-#else
-                               _("Using the default document class, because the "
-                               " class ") + theclass + (" could not be loaded.");
-#endif
-                       Alert::error(_("Can't load document class"), msg);
+                       Alert::error(_("Can't load document class"), bformat(
+                                       "Using the default document class, because the "
+                                       " class %1$s could not be loaded.", theclass));
                        params.textclass = 0;
                }
        } else {
@@ -365,36 +344,22 @@ bool Buffer::readBody(LyXLex & lex, ParagraphList::iterator pit)
 
 
        if (unknown_tokens > 0) {
-#if USE_BOOST_FORMAT
                string s;
                if (unknown_tokens == 1) {
-                       boost::format fmt(_("Encountered one unknown token when reading the document %1$s."));
-                       fmt % fileName();
-                       s = fmt.str();
-               } else {
-                       boost::format fmt(_("Encountered %1$s unknown tokens when reading the document %2$s."));
-                       fmt % tostr(unknown_tokens);
-                       fmt % fileName();
-                       s = fmt.str();
-               }
-#else
-               string s = _("Encountered ");
-               if (unknown_tokens == 1) {
-                       s += _("one unknown token");
+                       s = bformat(_("Encountered one unknown token when reading "
+                               "the document %1$s."), fileName());
                } else {
-                       s += tostr(unknown_tokens);
-                       s += _(" unknown tokens");
+                       s = bformat(_("Encountered %1$s unknown tokens when reading "
+                               "the document %2$s."), tostr(unknown_tokens), fileName());
                }
                Alert::warning(_("Document format failure"), s);
-#endif
        }
 
        return the_end_read;
 }
 
 
-int
-Buffer::readParagraph(LyXLex & lex, string const & token,
+int Buffer::readParagraph(LyXLex & lex, string const & token,
                      ParagraphList & pars, ParagraphList::iterator & pit,
                      Paragraph::depth_type & depth)
 {
@@ -964,14 +929,7 @@ void Buffer::writeFileAscii(string const & fname, int linelen)
        ofstream ofs(fname.c_str());
        if (!ofs) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not save the document\n%1$s."));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Could not save the document\n");
-               text += file + ".";
-#endif
+               string text = bformat(_("Could not save the document\n%1$s."), file);
                Alert::error(_("Could not save document"), text);
                return;
        }
@@ -1001,14 +959,8 @@ void Buffer::makeLaTeXFile(string const & fname,
        ofstream ofs(fname.c_str());
        if (!ofs) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not open the specified document\n%1$s."));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Could not open the specified document\n");
-               text += file + ".";
-#endif
+               string text = bformat(_("Could not open the specified document\n%1$s."),
+                       file);
                Alert::error(_("Could not open file"), text);
                return;
        }
@@ -1167,14 +1119,8 @@ void Buffer::makeLinuxDocFile(string const & fname, bool nice, bool body_only)
 
        if (!ofs) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not save the specified document\n%1$s.\n"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Could not save the specified document\n");
-               text += file + _(".\n");
-#endif
+               string text = bformat(_("Could not save the specified document\n%1$s.\n"),
+                       file);
                Alert::error(_("Could not save document"), text);
                return;
        }
@@ -1630,14 +1576,8 @@ void Buffer::makeDocBookFile(string const & fname, bool nice, bool only_body)
        ofstream ofs(fname.c_str());
        if (!ofs) {
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not save the specified document\n%1$s.\n"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Could not save the specified document\n");
-               text += file + _(".\n");
-#endif
+               string text = bformat(_("Could not save the specified document\n%1$s.\n"),
+                       file);
                Alert::error(_("Could not save document"), text);
                return;
        }
index 8d7e790294720af072b341a8f6afe258f6c62a2d..e31060cff9aac4ba70e4b83c61fa5bafb3231108 100644 (file)
@@ -34,7 +34,6 @@
 #include "support/LAssert.h"
 
 #include <boost/bind.hpp>
-#include "support/BoostFormat.h"
 
 #include <cassert>
 #include <algorithm>
@@ -69,14 +68,8 @@ bool BufferList::quitWriteBuffer(Buffer * buf)
        else
                file = MakeDisplayPath(buf->fileName(), 30);
 
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("The document %1$s has unsaved changes.\n\nDo you want to save the document?"));
-       fmt % file;
-       string text = fmt.str();
-#else
-       string text = _("The document ");
-       text += file + _(" has unsaved changes.\n\nWhat do you want to do with it?");
-#endif
+       string text = bformat(_("The document %1$s has unsaved changes.\n\n"
+               "Do you want to save the document?"), file);
        int const ret = Alert::prompt(_("Save changed document?"),
                text, 0, 2, _("&Save Changes"), _("&Discard Changes"), _("&Cancel"));
 
@@ -178,14 +171,9 @@ bool BufferList::close(Buffer * buf, bool ask)
                fname = OnlyFilename(buf->fileName());
        else
                fname = MakeDisplayPath(buf->fileName(), 30);
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("The document %1$s has unsaved changes.\n\nDo you want to save the document?"));
-       fmt % fname;
-       string text = fmt.str();
-#else
-       string text = _("The document ");
-       text += fname + _(" has unsaved changes.\n\nWhat do you want to do with it?");
-#endif
+
+       string text = bformat(_("The document %1$s has unsaved changes.\n\n"
+               "Do you want to save the document?"), fname);
        int const ret = Alert::prompt(_("Save changed document?"),
                text, 0, 2, _("&Save Changes"), _("&Discard Changes"), _("&Cancel"));
 
@@ -274,15 +262,9 @@ void BufferList::emergencyWrite(Buffer * buf)
        string const doc = buf->isUnnamed()
                ? OnlyFilename(buf->fileName()) : buf->fileName();
 
-#if USE_BOOST_FORMAT
-       lyxerr << boost::format(_("LyX: Attempting to save document %1$s"))
-               % doc
-              << endl;
-#else
-       lyxerr << _("LyX: Attempting to save document ") << doc << endl;
-#endif
-       // We try to save three places:
+       lyxerr << bformat(_("LyX: Attempting to save document %1$s"), doc) << endl;
 
+       // We try to save three places:
        // 1) Same place as document. Unless it is an unnamed doc.
        if (!buf->isUnnamed()) {
                string s = buf->fileName();
@@ -335,14 +317,8 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
 
        if (!fileInfo2.exist()) {
                string const file = MakeDisplayPath(s, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The specified document\n%1$s\ncould not be read."));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The specified document\n");
-               text += file + _(" could not be read.");
-#endif
+               string text = bformat(_("The specified document\n%1$s"
+                       "\ncould not be read."),        file);
                Alert::error(_("Could not read document"), text);
                return 0;
        }
@@ -359,14 +335,8 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
                if (fileInfoE.getModificationTime()
                    > fileInfo2.getModificationTime()) {
                        string const file = MakeDisplayPath(s, 20);
-#if USE_BOOST_FORMAT
-                       boost::format fmt(_("An emergency save of the document %1$s exists.\n\nRecover emergency save?"));
-                       fmt % file;
-                       string text = fmt.str();
-#else
-                       string text = _("An emergency save of the document ");
-                       text += file + _(" exists.\n\nRecover emergency save?");
-#endif
+                       string text = bformat(_("An emergency save of the document %1$s exists.\n"
+                               "\nRecover emergency save?"), file);
                        int const ret = Alert::prompt(_("Load emergency save?"),
                                text, 0, 1, _("&Recover"), _("&Load Original"));
 
@@ -390,14 +360,8 @@ Buffer * BufferList::readFile(string const & s, bool ronly)
                        if (fileInfoA.getModificationTime()
                            > fileInfo2.getModificationTime()) {
                                string const file = MakeDisplayPath(s, 20);
-#if USE_BOOST_FORMAT
-                               boost::format fmt(_("The backup of the document %1$s is newer.\n\nLoad the backup instead?"));
-                               fmt % file;
-                               string text = fmt.str();
-#else
-                               string text = _("The backup of the document ");
-                               text += file + _(" is newer.\n\nLoad the backup instead?");
-#endif
+                               string text = bformat(_("The backup of the document %1$s is newer.\n\n" 
+                                       "Load the backup instead?"), file);
                                int const ret = Alert::prompt(_("Load backup?"),
                                        text, 0, 1, _("&Load backup"), _("Load &original"));
 
@@ -472,14 +436,8 @@ Buffer * BufferList::newFile(string const & name, string tname, bool isNamed)
                }
                if (!templateok) {
                        string const file = MakeDisplayPath(tname, 50);
-#if USE_BOOST_FORMAT
-                       boost::format fmt(_("The specified document template\n%1$s\ncould not be read."));
-                       fmt % file;
-                       string text = fmt.str();
-#else
-                       string text = _("The specified document template\n");
-                       text += file + _(" could not be read.");
-#endif
+                       string text  = bformat(_("The specified document template\n%1$s\n"
+                               "could not be read."), file);
                        Alert::error(_("Could not read template"), text);
                        // no template, start with empty buffer
                        b->paragraphs.push_back(new Paragraph);
@@ -514,14 +472,8 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
        // file already open?
        if (exists(s)) {
                string const file = MakeDisplayPath(s, 20);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The document %1$s is already loaded.\n\nDo you want to revert to the saved version?"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The document ");
-               text += file + _(" is already loaded.\n\nDo you want to revert to the saved version?");
-#endif
+               string text = bformat(_("The document %1$s is already loaded.\n\n"
+                       "Do you want to revert to the saved version?"), file);
                int const ret = Alert::prompt(_("Revert to saved document?"),
                        text, 0, 1,  _("&Revert"), _("&Switch to document"));
 
@@ -554,14 +506,8 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                string const file = MakeDisplayPath(s, 20);
                // Here we probably should run
                if (LyXVC::file_not_found_hook(s)) {
-#if USE_BOOST_FORMAT
-                       boost::format fmt(_("Do you want to retrieve the document %1$s from version control?"));
-                       fmt % file;
-                       string text = fmt.str();
-#else
-                       string text = _("Do you want to retrieve the document ");
-                       text += file + _(" from version control?");
-#endif
+                       string text = bformat(_("Do you want to retrieve the document"
+                               " %1$s from version control?"), file);
                        int const ret = Alert::prompt(_("Retrieve from version control?"),
                                text, 0, 1, _("&Retrieve"), _("&Cancel"));
 
@@ -574,14 +520,8 @@ Buffer * BufferList::loadLyXFile(string const & filename, bool tolastfiles)
                        }
                }
 
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The document %1$s does not yet exist.\n\nDo you want to create a new document?"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The document ");
-               text += file + _(" does not yet exist.\n\nDo you want to create a new document?");
-#endif
+               string text = bformat(_("The document %1$s does not yet exist.\n\n"
+                       "Do you want to create a new document?"), file);
                int const ret = Alert::prompt(_("Create new document?"),
                        text, 0, 1, _("&Create"), _("Cancel"));
 
index a58a8fdc07f2f49ed8451dfdf15e906709079d61..dded2ce1c888c70ca04433b8c2f5f301446995d2 100644 (file)
@@ -28,7 +28,6 @@
 #include "support/lyxlib.h"
 #include "support/lstrings.h"
 #include "support/types.h"
-#include "support/BoostFormat.h"
 
 #include "frontends/Alert.h"
 
@@ -97,12 +96,8 @@ string const BufferParams::readToken(LyXLex & lex, string const & token)
                        return classname;
                }
                if (!getLyXTextClass().isTeXClassAvailable()) {
-                       string msg =
-#if USE_BOOST_FORMAT
-                               boost::io::str(boost::format(_("The document uses a missing TeX class \"%1$s\".\n")) % classname);
-#else
-                               _("The document uses a missing TeX class ") + classname + ".\n";
-#endif
+                       string msg = bformat(_("The document uses a missing "
+                               "TeX class \"%1$s\".\n"), classname);
                        Alert::warning(_("Document class not available"),
                                       msg + _("LyX will not be able to produce output."));
                }
index a1782c0121d351f5c3f5fbe9a0a80bb5c7c0155e..df8af0248de5c7e856ae437694f0ebb3a597bf5d 100644 (file)
@@ -36,7 +36,6 @@
 
 #include "insets/updatableinset.h"
 
-#include "support/BoostFormat.h"
 
 namespace {
 
@@ -67,7 +66,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
           << "color " << font.color() << '\n'
           << "language " << lang << '\n'
           << "toggleall " << tostr(toggle);
-       data = os.str();
+       data = STRCONV(os.str());
        return true;
 }
 
@@ -76,7 +75,7 @@ bool font2string(LyXFont const & font, bool toggle, string & data)
 // If successful, returns true
 bool string2font(string const & data, LyXFont & font, bool & toggle)
 {
-       istringstream is(data);
+       istringstream is(STRCONV(data));
        LyXLex lex(0,0);
        lex.setStream(is);
 
@@ -320,22 +319,12 @@ string const currentState(BufferView * bv)
                buffer->params.getLyXTextClass().defaultfont();
        font.reduce(defaultfont);
 
-#if USE_BOOST_FORMAT
-       state << boost::format(_("Font: %1$s")) % font.stateText(&buffer->params);
-#else
-       state << _("Font: ") << font.stateText(&buffer->params);
-#endif
+       state << bformat(_("Font: %1$s"), font.stateText(&buffer->params));
 
        // The paragraph depth
        int depth = text->getDepth();
-       if (depth > 0) {
-#if USE_BOOST_FORMAT
-               state << boost::format(_(", Depth: %1$d")) % depth;
-#else
-               state << _(", Depth: ") << depth;
-#endif
-       }
-
+       if (depth > 0)
+               state << bformat(_(", Depth: %1$s"), tostr(depth));
 
        // The paragraph spacing, but only if different from
        // buffer spacing.
index bef488cf2e9ffff076eb3397d761cd5c01bd6bc9..04d296b45012ce24ae11f4f2ea61fce55a63ea99 100644 (file)
@@ -30,8 +30,6 @@
 #include "support/path.h"
 #include "support/systemcall.h"
 
-#include "support/BoostFormat.h"
-
 #include <cctype>
 
 #ifndef CXX_GLOBAL_CSTD
@@ -364,17 +362,11 @@ bool Converters::convert(Buffer const * buffer,
                                        Alert::error(_("Build errors"),
                                                _("There were errors during the build process."));
                                } else {
-#if USE_BOOST_FORMAT
 // FIXME: this should go out of here. For example, here we cannot say if
 // it is a document (.lyx) or something else. Same goes for elsewhere.
                                Alert::error(_("Cannot convert file"),
-                                       boost::io::str(boost::format(_("An error occurred whilst running %1$s"))
-                                       % command.substr(0, 50)));
-#else
-                               Alert::error(_("Cannot convert file"),
-                                       _("An error occurred whilst running ")
-                                       + command.substr(0, 50));
-#endif
+                                       bformat(_("An error occurred whilst running %1$s"),
+                                               command.substr(0, 50)));
                                }
                                return false;
                        }
@@ -396,14 +388,9 @@ bool Converters::convert(Buffer const * buffer,
                        string to = subst(conv.result_dir,
                                          token_base, to_base);
                        if (!lyx::rename(from, to)) {
-#if USE_BOOST_FORMAT
-                               Alert::error(_("Cannot convert file"),
-                                       boost::io::str(boost::format(_(
-                                       "Could not move a temporary file from %1$s to %2$s.")) % from % to));
-#else
                                Alert::error(_("Cannot convert file"),
-                                          _("Could not move a temporary file from ") + from + _(" to ") + to + ".");
-#endif
+                                       bformat(_("Could not move a temporary file from %1$s to %2$s."),
+                                               from, to));
                                return false;
                        }
                }
@@ -439,14 +426,9 @@ bool Converters::move(string const & from, string const & to, bool copy)
                                ? lyx::copy(from2, to2)
                                : lyx::rename(from2, to2);
                        if (!moved && no_errors) {
-#if USE_BOOST_FORMAT
-                               Alert::error(_("Cannot convert file"),
-                                       boost::io::str(boost::format(_(
-                                       "Could not move a temporary file from %1$s to %2$s.")) % from2 % to2));
-#else
                                Alert::error(_("Cannot convert file"),
-                                          _("Could not move a temporary file from ") + from2 + _(" to ") + to2 + ".");
-#endif
+                                       bformat(_("Could not move a temporary file from %1$s to %2$s."),
+                                               from2, to2));
                                no_errors = false;
                        }
                }
@@ -481,25 +463,11 @@ namespace {
 void alertErrors(string const & prog, int nr_errors)
 {
        string s;
-#if USE_BOOST_FORMAT
-       if (nr_errors == 1) {
-               boost::format fmt(_("One error detected when running %1$s.\n"));
-               fmt % prog;
-               s = fmt.str();
-       } else {
-               boost::format fmt(_("%1$s errors detected when running %2$s.\n"));
-               fmt % tostr(nr_errors);
-               fmt % prog;
-               s = fmt.str();
-       }
-#else
-       if (nr_errors == 1) {
-               s = _("One error detected");
-       } else {
-               s = tostr(nr_errors);
-               s += _(" errors detected.");
-       }
-#endif
+       if (nr_errors == 1)
+               s = bformat(_("One error detected when running %1$s.\n"), prog);
+       else
+               s = bformat(_("%1$s errors detected when running %2$s.\n"),
+                       prog, tostr(nr_errors));
        Alert::error(_("Errors found"), s);
 }
 
@@ -578,17 +546,8 @@ bool Converters::runLaTeX(Buffer const * buffer, string const & command)
 
        // check return value from latex.run().
        if ((result & LaTeX::NO_LOGFILE)) {
-               string str;
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("LaTeX did not run successfully. Additionally, LyX "
-                       "could not locate the LaTeX log %1$s."));
-               fmt % name;
-               str = fmt.str();
-#else
-               str += _("LaTeX did not run successfully. Additionally, LyX "
-                       "could not locate the LaTeX log ");
-               str += name + ".";
-#endif
+               string str = bformat(_("LaTeX did not run successfully. Additionally, LyX "
+                       "could not locate the LaTeX log %1$s."), name);
                Alert::error(_("LaTeX failed"), str);
        } else if ((result & LaTeX::ERRORS)) {
                alertErrors("LaTeX", latex.getNumErrors());
index 328a279efe5525c11fcc66383df34974f2069128..094dcd8bf7937e856de8730a8b1c33ab5186aaa9 100644 (file)
@@ -13,6 +13,7 @@
 
 #include "counters.h"
 #include "debug.h"
+#include "Lsstream.h"
 
 #include "support/lstrings.h"
 #include "support/LAssert.h"
index d3d672ea5f9eebf63cdf1e58432b9d99c716a06e..765fbdb6a6b0144b769b64643a376ce900e19355 100644 (file)
@@ -13,8 +13,6 @@
 #include "gettext.h"
 #include "support/lstrings.h"
 
-#include "support/BoostFormat.h"
-
 #include <iomanip>
 
 using std::ostream;
@@ -99,24 +97,15 @@ Debug::type Debug::value(string const & val)
 }
 
 
-void Debug::showLevel(ostream & o, Debug::type level)
+void Debug::showLevel(ostream & os, Debug::type level)
 {
        // Show what features are traced
-       for (int i = 0 ; i < numErrorTags ; ++i) {
+       for (int i = 0; i < numErrorTags ; ++i) {
                if (errorTags[i].level != Debug::ANY
                    && errorTags[i].level != Debug::NONE
                    && errorTags[i].level & level) {
-#if USE_BOOST_FORMAT
-                       o << boost::format(
-                               _("Debugging `%1$s' (%2$s)"))
-                               % errorTags[i].name
-                               % _(errorTags[i].desc)
-                         << endl;
-#else
-                       o << _("Debugging `") << errorTags[i].name << "' ("
-                         << _(errorTags[i].desc) << ')'
-                         << endl;
-#endif
+                       os << bformat(_("Debugging `%1$s' (%2$s)"),
+                                       errorTags[i].name, _(errorTags[i].desc));
                }
        }
 }
@@ -124,7 +113,7 @@ void Debug::showLevel(ostream & o, Debug::type level)
 
 void Debug::showTags(ostream & os)
 {
-       for (int i = 0 ; i < numErrorTags ; ++i)
+       for (int i = 0; i < numErrorTags ; ++i)
                os << setw(7) << errorTags[i].level
                   << setw(10) << errorTags[i].name
                   << "  " << _(errorTags[i].desc) << '\n';
index 1882a89fe2d07d4c2dcb80c45496a10cb7d056f1..bd11cd235434d5955c5ecd70abc7c82549d78ba5 100644 (file)
 
 #include <config.h>
 
-#include <algorithm>
-
 #include "exporter.h"
 #include "buffer.h"
 #include "lyx_cb.h" //ShowMessage()
 #include "support/filetools.h"
-#include "support/BoostFormat.h"
 #include "lyxrc.h"
 #include "converter.h"
 #include "format.h"
@@ -24,6 +21,8 @@
 #include "gettext.h"
 #include "BufferView.h"
 
+#include <algorithm>
+
 using std::vector;
 using std::find;
 
@@ -59,16 +58,9 @@ bool Exporter::Export(Buffer * buffer, string const & format,
                        }
                }
                if (backend_format.empty()) {
-#if USE_BOOST_FORMAT
-// FIXME: better english ...
-                       Alert::error(_("Couldn't export file"),
-                                    boost::io::str(boost::format(_("No information for exporting the format %1$s."))
-                                  % formats.prettyName(format)));
-#else
                        Alert::error(_("Couldn't export file"),
-                                    _("No information for exporting the format ")
-                                    + formats.prettyName(format) + ".");
-#endif
+                               bformat(_("No information for exporting the format %1$s."),
+                                  formats.prettyName(format)));
                        return false;
                }
        } else
index 27b6d9d3f17eb5c1b5587af8d1c6d62ab20d2dcb..a7051ac443b202b3110210edeb399366144a4e65 100644 (file)
@@ -15,7 +15,6 @@
 #include "lyx_cb.h" // for ShowMessage() ... to be removed?
 #include "gettext.h"
 #include "LString.h"
-#include "support/BoostFormat.h"
 
 #include "frontends/Alert.h" //to be removed?
 
@@ -160,16 +159,10 @@ bool Formats::view(Buffer const * buffer, string const & filename,
        if (!format || format->viewer().empty()) {
 // I believe this is the wrong place to show alerts, it should be done by
 // the caller (this should be "utility" code
-#if USE_BOOST_FORMAT
                Alert::error(_("Cannot view file"),
-                            boost::io::str(boost::format(_("No information for viewing %1$s"))
-                          % prettyName(format_name)));
-#else
-               Alert::error(_("Cannot view file"),
-                            _("No information for viewing ")
-                            + prettyName(format_name));
-#endif
-                          return false;
+                       bformat(_("No information for viewing %1$s"),
+                               prettyName(format_name)));
+               return false;
        }
 
        string command = format->viewer();
@@ -201,15 +194,9 @@ bool Formats::view(Buffer const * buffer, string const & filename,
        int const res = one.startscript(Systemcall::DontWait, command);
 
        if (res) {
-#if USE_BOOST_FORMAT
-               Alert::error(_("Cannot view file"),
-                            boost::io::str(boost::format(_("An error occurred whilst running %1$s"))
-                          % command.substr(0, 50)));
-#else
                Alert::error(_("Cannot view file"),
-                            _("An error occurred whilst running ")
-                            + command.substr(0, 50));
-#endif
+                            bformat(_("An error occurred whilst running %1$s"),
+                              command.substr(0, 50)));
                return false;
        }
        return true;
index 7e77ca4e3741de7dd75fbf4bc8b52f4963d2d3a6..245ab25f1c5ccf962642e76b2769f231a1dce304 100644 (file)
@@ -1,3 +1,11 @@
+
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * ControlDocument.C:
+       * ControlPrint.C:
+       * ControlSpellchecker.C:
+       * biblio.C: boost::format -> bformat  all over the place
+
 2003-05-08  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * Makefile.am: better lib building
index 8684470c8b7852aa3061af6af40ce95accad31bb..36c92ed93e02861ab7affb905805fd8d46b85aa9 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <config.h>
 
-
 #include "BufferView.h"
 #include "ControlDocument.h"
 #include "ViewBase.h"
 #include "support/lstrings.h"
 #include "support/filetools.h"
 
-#include "support/BoostFormat.h"
-
 using std::endl;
 
 
 ControlDocument::ControlDocument(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d), bp_(0)
-{
-}
+{}
+
 
 ControlDocument::~ControlDocument()
 {}
@@ -129,31 +126,15 @@ void ControlDocument::classApply()
                return;
 
        string s;
-#if USE_BOOST_FORMAT
        if (ret == 1) {
-               boost::format fmt(_("One paragraph could not be converted\n"
-                       "into the document class %1$s."));
-               fmt % textclasslist[new_class].name();
-               s = fmt.str();
+               s = bformat(_("One paragraph could not be converted\n"
+                       "into the document class %1$s."),
+                       textclasslist[new_class].name());
        } else {
-               boost::format fmt(_("%1$s paragraphs could not be converted\n"
-                       "into the document class %2$s."));
-               fmt % tostr(ret);
-               fmt % textclasslist[new_class].name();
-               s = fmt.str();
+               s = bformat(_("%1$s paragraphs could not be converted\n"
+                       "into the document class %2$s."),
+                       textclasslist[new_class].name());
        }
-#else
-       if (ret == 1) {
-               s += _("One paragraph could not be converted\n"
-                       "into the document class ");
-               s += textclasslist[new_class].name() + ".";
-       } else {
-               s += tostr(ret);
-               s += _(" paragraphs could not be converted\n"
-                       "into the document class ");
-               s += textclasslist[new_class].name() + ".";
-       }
-#endif
        Alert::warning(_("Class conversion errors"), s);
 }
 
@@ -164,18 +145,9 @@ bool ControlDocument::loadTextclass(lyx::textclass_type tc) const
        if (success)
                return success;
 
-       string s;
-
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("The document could not be converted\n"
-                       "into the document class %1$s."));
-       fmt % textclasslist[tc].name();
-       s = fmt.str();
-#else
-       s += _("The document could not be converted\n"
-              "into the document class ");
-       s += textclasslist[tc].name() + ".";
-#endif
+       string s = bformat(_("The document could not be converted\n"
+                       "into the document class %1$s."),
+                       textclasslist[tc].name());
        Alert::error(_("Could not change class"), s);
 
        return success;
index 04128b71c4ba555f0ce2e9329cdb8765a21505b4..a039c7e0d496b4550ec1567f4be204a5ab9aa773 100644 (file)
@@ -29,7 +29,6 @@
 #include "support/filetools.h"
 #include "support/path.h"
 #include "support/systemcall.h"
-#include "support/BoostFormat.h"
 
 #include "debug.h" // for lyxerr
 
@@ -86,16 +85,9 @@ namespace {
 
 void showPrintError(string const & name)
 {
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not print the document %1$s.\n"
-                       "Check that your printer is set up correctly."));
-               fmt % MakeDisplayPath(name, 50);
-               string str = fmt.str();
-#else
-               string str = _("Could not print the document ");
-               str += MakeDisplayPath(name, 50);
-               str += _(".\nCheck that your printer is set up correctly.");
-#endif
+               string str = bformat(_("Could not print the document %1$s.\n"
+                       "Check that your printer is set up correctly."),
+                       MakeDisplayPath(name, 50));
                Alert::error(_("Print document failed"), str);
 }
 
index 4495b87375bf941a20955607992cacbead6779c3..74b749a0ef00826594c99b193912d47ffb50d72f 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "ControlSpellchecker.h"
 #include "ViewBase.h"
 #include "buffer.h"
 
 #include "frontends/Alert.h"
 
-#include "support/BoostFormat.h"
-
 using std::endl;
 
+
 ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
        : ControlDialogBD(lv, d),
          newval_(0.0), oldval_(0), newvalue_(0), count_(0)
@@ -221,22 +219,10 @@ void ControlSpellchecker::showSummary()
        }
 
        string message;
-
-#if USE_BOOST_FORMAT
-       if (count_ != 1) {
-               boost::format fmter(_("%1$d words checked."));
-               fmter % count_;
-               message += fmter.str();
-       } else {
-               message += _("One word checked.");
-       }
-#else
-       if (count_ != 1) {
-               message += tostr(count_) + _(" words checked.");
-       } else {
+       if (count_ != 1)
+               message = bformat(_("%1$s words checked."), tostr(count_));
+       else
                message = _("One word checked.");
-       }
-#endif
 
        view().hide();
        Alert::information(_("Spell-checking is complete"), message);
index 6efab20385a0fb3b2f558d02c5441e2afabe3c7e..56255fdfddbf1a9bf91c64c753e40c0e5ebd6b61 100644 (file)
 
 #include <config.h>
 
-
-#include "LString.h"
 #include "biblio.h"
 #include "gettext.h" // for _()
 #include "helper_funcs.h"
+#include "Lsstream.h"
+#include "LString.h"
+
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 
 #include <boost/regex.hpp>
-#include "support/BoostFormat.h"
 
 #include <algorithm>
 
@@ -92,26 +92,14 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
        if (authors.empty())
                return author;
 
-#if USE_BOOST_FORMAT
-       boost::format fmter("");
        if (authors.size() == 2)
-               fmter = boost::format(_("%1$s and %2$s"))
-                       % familyName(authors[0]) % familyName(authors[1]);
-       else if (authors.size() > 2)
-               fmter = boost::format(_("%1$s et al.")) % familyName(authors[0]);
-       else
-               fmter = boost::format("%1$s") % familyName(authors[0]);
-       return fmter.str();
-#else
-       string msg;
-       if (authors.size() == 2)
-               msg = familyName(authors[0]) + _(" and ") + familyName(authors[1]);
-       else if (authors.size() > 2)
-               msg = familyName(authors[0]) + _("et al.");
-       else
-               msg = familyName(authors[0]);
-       return msg;
-#endif
+               return bformat(_("%1$s and %2$s"),
+                       familyName(authors[0]), familyName(authors[1]));
+
+       if (authors.size() > 2)
+               return bformat(_("%1$s et al."), familyName(authors[0]));
+
+       return familyName(authors[0]);
 }
 
 
index 07332cfe9ec135cd0b75c7858af97bb8a6101cce..f19961df2c684abed2be85848807d3a201be8fa1 100644 (file)
@@ -1,3 +1,10 @@
+
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * FormDocument.C:
+       * FormGraphics.C:
+       * xforms_helpers.C:  boost::format -> bformat  all over the place
+
 2003-05-08  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * Makefile.am: better lib building
index d55286f6f805376617bc199b9845bc7843ef17e8..f5b4c1b2b98f6df470fda915ba10a3e39746d85b 100644 (file)
@@ -141,7 +141,8 @@ void FormDocument::build()
                } else {
                        string item =
 #if USE_BOOST_FORMAT
-                               boost::io::str(boost::format(_("Unavailable: %1$s")) % tit->description());
+                               STRCONV(boost::io::str(boost::format(_("Unavailable: %1$s"))
+                                       % tit->description()));
 #else
                                _("Unavailable: ") + tit->description();
 #endif
index 8cbdc638a2e315f832f2ee085b53faa348cab746..37a32f274beb158fe7d5b74ef8b906802e8306bc 100644 (file)
@@ -126,12 +126,7 @@ void FormGraphics::build()
                _("Default|Monochrome|Grayscale|Color|Do not display");
        fl_addto_choice(file_->choice_display, display_List.c_str());
 
-#if USE_BOOST_FORMAT
-       string const width_list = boost::io::str(boost::format(_("Scale%%%%|%1$s")) % choice_Length_All);
-#else
-       // xgettext:no-c-format
-       string const width_list = _("Scale%%|") + choice_Length_All;
-#endif
+       string const width_list = bformat(_("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());
index f3f7c4b9bcb5be4ea7e19a38a0e0445aff4c5bce..015ce28740e3fc61391c892f25434635ef492a2e 100644 (file)
 
 #include <config.h>
 
-
 #include "xforms_helpers.h"
 
 #include "lyxlex.h"
 #include "gettext.h"
 #include "lyxlength.h"
 #include "lyxgluelength.h"
+#include "Lsstream.h"
 
 #include "support/LAssert.h"
 #include "support/FileInfo.h"
 #include "support/filetools.h"
 #include "support/lstrings.h" // frontStrip, strip
 
-#include <fstream>
-
 #include FORMS_H_LOCATION
 #include "combox.h"
 
+#include <fstream>
+
 using std::ofstream;
 using std::pair;
 using std::vector;
index 69316d549bb0a963494690cfa2a5c865d0bcace8..c32c13c3018efc6e754869a1ee68d8523f68fa49 100644 (file)
@@ -1,3 +1,8 @@
+
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * PreviewLoader.C:  boost::format -> bformat 
+
 2003-04-15  Angus Leeming  <leeming@lyx.org>
 
        * GraphicsConverter.C: #include lstrings.h.
index 7e8015f069e124948779b82d00b3058a510ec51e..75d6faf587152176b07f1d9c80ce4f3d4554f9bd 100644 (file)
 #include "buffer.h"
 #include "converter.h"
 #include "format.h"
-
 #include "debug.h"
 #include "lyxrc.h"
 #include "LColor.h"
+#include "Lsstream.h"
 
 #include "insets/inset.h"
 
index 50601b456c929c2ef92e9ac58631208cff9ef544..d79ed4be5f1826344a142e5107c934f11c44fa83 100644 (file)
 #include "gettext.h"
 #include "BufferView.h"
 
-#include "support/BoostFormat.h"
-
 #include <algorithm>
 
 using std::vector;
 using std::find;
 
+
 extern BufferList bufferlist;
 extern void InsertAsciiFile(BufferView *, string const &, bool);
 
@@ -38,13 +37,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
                      string const & format)
 {
        string const displaypath = MakeDisplayPath(filename);
-       ostringstream s1;
-#if USE_BOOST_FORMAT
-       s1 << boost::format(_("Importing %1$s...")) % displaypath;
-#else
-       s1 << _("Importing ") << displaypath << _("...");
-#endif
-       lv->message(STRCONV(s1.str()));
+       lv->message(bformat(_("Importing %1$s..."), displaypath));
 
        string const lyxfile = ChangeExtension(filename, ".lyx");
 
@@ -62,16 +55,9 @@ bool Importer::Import(LyXView * lv, string const & filename,
                        }
                }
                if (loader_format.empty()) {
-#if USE_BOOST_FORMAT
-// FIXME: better english ...
-                       Alert::error(_("Couldn't import file"),
-                                    boost::io::str(boost::format(_("No information for importing the format %1$s."))
-                                  % formats.prettyName(format)));
-#else
                        Alert::error(_("Couldn't import file"),
-                                    _("No information for importing the format ")
-                                    + formats.prettyName(format) + ".");
-#endif
+                                    bformat(_("No information for importing the format %1$s."),
+                                        formats.prettyName(format)));
                        return false;
                }
        } else
index 53af3d06707cd9f336f435b92d64dd872864be65..c5337e68273005ae64878f0cd59d694be5f38613 100644 (file)
@@ -1,4 +1,18 @@
 
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * insetcaption.C:
+       * insetexternal.C:
+       * insetfloat.C:
+       * insetfloatlist.C:
+       * insetgraphics.C:
+       * insetinclude.C:
+       * insetminipage.C:
+       * insetminipage.C:
+       * insettabular.C:
+       * insettext.C:
+       * insetwwrap.C:  boost::format -> bformat  all over the place
+
 2003-05-05 André Pönitz <poenitz@gmx.net>
 
        * insettext.h: add missing #include <map>
index 236017a9c67ce1a565f83eac66f0815e35f5707b..36ba68968634b188ae68220af36be9662bba1cd0 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "insetcaption.h"
 #include "frontends/Painter.h"
 #include "frontends/font_metrics.h"
@@ -21,6 +20,7 @@
 #include "insets/insetwrap.h"
 #include "debug.h"
 #include "gettext.h"
+#include "Lsstream.h"
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 #include "support/BoostFormat.h"
@@ -92,18 +92,10 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
        string const fl = i2 ? floats.getType(type).name() : N_("Float");
 
        // Discover the number...
-       // ...
-       string const num("#");
+       string const num = "#";
 
-#if USE_BOOST_FORMAT
-       // Generate the label
-       boost::format frm("%1$s %2$s:");
-       frm % _(fl) % num;
-       string const label = frm.str();
-#else
        // Generate the label
-       string const label = _(fl) + ' ' + num + ':';
-#endif
+       string const label = bformat("%1$s %2$s:", _(fl), num);
        Painter & pain = bv->painter();
        int const w = font_metrics::width(label, f);
        pain.text(int(x), baseline, label, f);
index 82db5c2ce48a71551e866c7e7ea46cec9fc26b5c..cfafab15e6de9f8862a0d0a95a700858430ce847 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "insetexternal.h"
 #include "ExternalTemplate.h"
 #include "BufferView.h"
@@ -21,6 +20,7 @@
 #include "gettext.h"
 #include "debug.h"
 #include "lyxlex.h"
+#include "Lsstream.h"
 
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
index 93a5dd0a97c15763863bbdcf3105ec48dfcc546b..ab78bdb83ed16585d1de69fc57fdd9529d4d0fd8 100644 (file)
@@ -8,8 +8,8 @@
  *
  * Full author contact details are available in file CREDITS
  */
-#include <config.h>
 
+#include <config.h>
 
 #include "insetfloat.h"
 #include "insettext.h"
@@ -26,6 +26,7 @@
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "lyxtext.h"
+#include "Lsstream.h"
 
 #include "support/LOstream.h"
 #include "support/lstrings.h"
index 3df488deb3ada0c903675a2581c34040081b0d90..32779cf7712fd487a332d2529f4cfa72908b5c2c 100644 (file)
@@ -7,22 +7,24 @@
  *
  * Full author contact details are available in file CREDITS
  */
-#include <config.h>
 
+#include <config.h>
 
 #include "insetfloatlist.h"
 #include "FloatList.h"
 #include "LaTeXFeatures.h"
 #include "lyxlex.h"
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
 #include "BufferView.h"
 #include "buffer.h"
 #include "toc.h"
 #include "gettext.h"
 #include "debug.h"
+#include "Lsstream.h"
+
+#include "support/lstrings.h"
 
-#include "support/BoostFormat.h"
+#include "frontends/Dialogs.h"
+#include "frontends/LyXView.h"
 
 using std::ostream;
 using std::endl;
@@ -30,8 +32,7 @@ using std::endl;
 
 InsetFloatList::InsetFloatList()
        : InsetCommand(InsetCommandParams())
-{
-}
+{}
 
 
 InsetFloatList::InsetFloatList(string const & type)
@@ -130,19 +131,9 @@ int InsetFloatList::latex(Buffer const * buf, ostream & os, bool, bool) const
                           << cit->second.listName() << "}\n";
                }
        } else {
-#if USE_BOOST_FORMAT
-               os << "%%\\listof{"
-                  << getCmdName()
-                  << "}{"
-                  << boost::format(_("List of %1$s")) % cit->second.name()
-                  << "}\n";
-#else
-               os << "%%\\listof{"
-                  << getCmdName()
-                  << "}{"
-                  << _("List of ") << cit->second.name()
+               os << "%%\\listof{" << getCmdName() << "}{"
+                  << bformat(_("List of %1$s"), cit->second.name())
                   << "}\n";
-#endif
        }
        return 1;
 }
index 4582781cfe1a804dd870a5638d5b7083ae9b5620..88907ea3b834c7d5453eaafdb5db79fa9196dc13 100644 (file)
@@ -52,7 +52,6 @@ TODO
 
 #include <config.h>
 
-
 #include "insets/insetgraphics.h"
 #include "insets/insetgraphicsParams.h"
 
@@ -71,8 +70,9 @@ TODO
 #include "LaTeXFeatures.h"
 #include "lyxlex.h"
 #include "lyxrc.h"
-#include "frontends/lyx_gui.h"
+#include "Lsstream.h"
 
+#include "frontends/lyx_gui.h"
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
 #include "frontends/font_metrics.h"
@@ -798,15 +798,7 @@ 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
-#if USE_BOOST_FORMAT
-       os << '<'
-          << boost::format(_("Graphics file: %1$s")) % params().filename
-          << ">\n";
-#else
-       os << '<'
-          << _("Graphics file: ") << params().filename
-          << ">\n";
-#endif
+       os << '<' << bformat(_("Graphics file: %1$s"), params().filename) << ">\n";
        return 0;
 }
 
index 90ed386307fe34a2871ed650d723084021360a02..2d52f64fb0f74519d6565e5345d4d84949f0e9a3 100644 (file)
@@ -7,8 +7,8 @@
  *
  * Full author contact details are available in file CREDITS
  */
-#include <config.h>
 
+#include <config.h>
 
 #include "insetinclude.h"
 #include "buffer.h"
@@ -20,6 +20,7 @@
 #include "LaTeXFeatures.h"
 #include "lyxlex.h"
 #include "lyxrc.h"
+#include "Lsstream.h"
 
 #include "frontends/Dialogs.h"
 #include "frontends/LyXView.h"
index a5046430b6d360260d1011c3f4941be7ac362cb9..540ff456b879ec8610951b0f9758de0858dbb94a 100644 (file)
@@ -11,7 +11,6 @@
 
 #include <config.h>
 
-
 #include "insetminipage.h"
 #include "insettext.h"
 
@@ -22,6 +21,7 @@
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "lyxtext.h"
+#include "Lsstream.h"
 
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
index 155d53fad2091d19d71a52e41f005d717c228452..f78d4becc8bf1940f0a5796cb040bdb3b4b311f4 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "insettabular.h"
 #include "insettext.h"
 
@@ -30,6 +29,7 @@
 #include "ParagraphParameters.h"
 #include "undo_funcs.h"
 #include "WordLangTuple.h"
+#include "Lsstream.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
index 93af59c7d3958202f7d3ba0ff9c33f80e3d706aa..5752747bfb47af0260223d9faef4f4e2ba4716aa 100644 (file)
@@ -10,7 +10,6 @@
 
 #include <config.h>
 
-
 #include "insettext.h"
 
 #include "buffer.h"
@@ -38,6 +37,7 @@
 #include "sgml.h"
 #include "rowpainter.h"
 #include "insetnewline.h"
+#include "Lsstream.h"
 
 #include "frontends/Alert.h"
 #include "frontends/Dialogs.h"
index 11c3417182ae9d14bfd15df9541182c712d157b9..9068d7c53e8347eab70540c1793b09c49b099c1c 100644 (file)
@@ -23,6 +23,7 @@
 #include "lyxfont.h"
 #include "lyxlex.h"
 #include "lyxtext.h"
+#include "Lsstream.h"
 
 #include "frontends/LyXView.h"
 #include "frontends/Dialogs.h"
index 0b944b6d01e9ddd0f23664abf2d5ef46339aba04..63e7aa4a9b24f43dad330ea68bbb9d49efe1d943 100644 (file)
@@ -21,6 +21,7 @@
 #include "lyxtext.h"
 #include "gettext.h"
 #include "BufferView.h"
+#include "Lsstream.h"
 
 #include "insets/insetlabel.h"
 
@@ -36,8 +37,6 @@
 #include "support/systemcall.h"
 #include "support/lstrings.h"
 
-#include "support/BoostFormat.h"
-
 #include <fstream>
 #include <algorithm>
 #include <utility>
@@ -87,14 +86,8 @@ bool MenuWrite(BufferView * bv, Buffer * buffer)
 
        string const file = MakeDisplayPath(buffer->fileName(), 30);
 
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("The document %1$s could not be saved.\n\nDo you want to rename the document and try again?"));
-       fmt % file;
-       string text = fmt.str();
-#else
-       string text = _("The document ");
-       text += file + _(" could not be saved.\n\nDo you want to rename the document and try again?");
-#endif
+       string text = bformat(_("The document %1$s could not be saved.\n\n"
+               "Do you want to rename the document and try again?"), file);
        int const ret = Alert::prompt(_("Rename and save?"),
                text, 0, 1, _("&Rename"), _("&Cancel"));
 
@@ -145,15 +138,8 @@ bool WriteAs(BufferView * bv, Buffer * buffer, string const & filename)
        FileInfo const myfile(fname);
        if (myfile.isOK()) {
                string const file = MakeDisplayPath(fname, 30);
-
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The document %1$s already exists.\n\nDo you want to over-write that document?"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The document ");
-               text += file + _(" already exists.\n\nDo you want to over-write that document?");
-#endif
+               string text = bformat(_("The document %1$s already exists.\n\n"
+                       "Do you want to over-write that document?"), file);
                int const ret = Alert::prompt(_("Over-write document?"),
                        text, 0, 1, _("&Over-write"), _("&Cancel"));
 
@@ -200,13 +186,8 @@ void QuitLyX()
        lyxerr[Debug::INFO] << "Deleting tmp dir " << system_tempdir << endl;
 
        if (destroyDir(system_tempdir) != 0) {
-#if USE_BOOST_FORMAT
-               boost::format fmt = _("Could not remove the temporary directory %1$s");
-               fmt % system_tempdir;
-               string msg = fmt.str();
-#else
-               string msg = _("Could not remove the temporary directory ") + system_tempdir;
-#endif
+               string msg = bformat(_("Could not remove the temporary directory %1$s"),
+                       system_tempdir);
                Alert::warning(_("Could not remove temporary directory"), msg);
        }
 
@@ -238,11 +219,7 @@ private:
 
 int AutoSaveBuffer::start()
 {
-#if USE_BOOST_FORMAT
-       command_ = boost::io::str(boost::format(_("Auto-saving %1$s")) % fname_);
-#else
-       command_ = _("Auto-saving ") + fname_;
-#endif
+       command_ = bformat(_("Auto-saving %1$s"), fname_);
        return runNonBlocking();
 }
 
@@ -404,16 +381,8 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
        if (!fi.readable()) {
                string const error = strerror(errno);
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not read the specified document\n%1$s\ndue to the error: %2$s"));
-               fmt % file;
-               fmt % error;
-               string text = fmt.str();
-#else
-               string text = _("Could not read the specified document\n");
-               text += file + _(" due to the error: ");
-               text += error;
-#endif
+               string const text = bformat(_("Could not read the specified document\n"
+                       "%1$s\ndue to the error: %2$s"), file, error);
                Alert::error(_("Could not read file"), text);
                return string();
        }
@@ -422,16 +391,8 @@ string getContentsOfAsciiFile(BufferView * bv, string const & f, bool asParagrap
        if (!ifs) {
                string const error = strerror(errno);
                string const file = MakeDisplayPath(fname, 50);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Could not open the specified document\n%1$s\ndue to the error: %2$s"));
-               fmt % file;
-               fmt % error;
-               string text = fmt.str();
-#else
-               string text = _("Could not open the specified document\n");
-               text += file + _(" due to the error: ");
-               text += error;
-#endif
+               string const text = bformat(_("Could not open the specified document\n"
+                       "%1$s\ndue to the error: %2$s"), file, error);
                Alert::error(_("Could not open file"), text);
                return string();
        }
index d365a0d2803ababe5f342db13f9c976b1fb92df2..18b69a1629ddf1d8cc40151671f7e242f41134d5 100644 (file)
@@ -39,7 +39,6 @@
 #include "frontends/Alert.h"
 #include "frontends/lyx_gui.h"
 
-#include "support/BoostFormat.h"
 #include <boost/function.hpp>
 
 #include <cstdlib>
@@ -78,16 +77,9 @@ namespace {
 
 void showFileError(string const & error)
 {
-#if USE_BOOST_FORMAT
        Alert::warning(_("Could not read configuration file"),
-                  boost::io::str(boost::format(
-                  _("Error while reading the configuration file\n%1$s.\n"
-                    "Please check your installation.")) % error));
-#else
-       Alert::warning(_("Could not read configuration file"),
-                  string(_("Error while reading the configuration file\n"))
-                  + error + _(".\nPlease check your installation."));
-#endif
+                  bformat(_("Error while reading the configuration file\n%1$s.\n"
+                    "Please check your installation."), error));
        exit(EXIT_FAILURE);
 }
 
@@ -116,15 +108,8 @@ LyX::LyX(int & argc, char * argv[])
        // other than documents
        for (int argi = 1; argi < argc ; ++argi) {
                if (argv[argi][0] == '-') {
-#if USE_BOOST_FORMAT
-                       lyxerr << boost::format(_("Wrong command line option `%1$s'. Exiting."))
-                               % argv[argi]
-                              << endl;
-#else
-                       lyxerr << _("Wrong command line option `")
-                              << argv[argi] << _("'. Exiting.")
-                              << endl;
-#endif
+                       lyxerr << bformat(_("Wrong command line option `%1$s'. Exiting."),
+                               argv[argi]) << endl;
                        exit(1);
                }
        }
@@ -375,16 +360,8 @@ void LyX::init(bool gui)
                                        << "Giving up." << endl;
                                exit(1);
                        }
-#if USE_BOOST_FORMAT
-                       lyxerr << boost::format(_("Using built-in default %1$s"
-                                                 " but expect problems."))
-                               % static_cast<char *>(LYX_DIR)
-                              << endl;
-#else
-                       lyxerr << _("Using built-in default ") << LYX_DIR
-                              << _(" but expect problems.")
-                              << endl;
-#endif
+                       lyxerr << bformat(_("Using built-in default %1$s but expect problems."),
+                               static_cast<char *>(LYX_DIR)) << endl;
                } else {
                        lyxerr << _("Expect problems.") << endl;
                }
@@ -616,29 +593,14 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
 
        first_start = !explicit_userdir;
 
-#if USE_BOOST_FORMAT
-       lyxerr << boost::format(_("LyX: Creating directory %1$s"
-                                 " and running configure..."))
-               % user_lyxdir
-              << endl;
-#else
-       lyxerr << _("LyX: Creating directory ") << user_lyxdir
-              << _(" and running configure...")
-              << endl;
-#endif
+       lyxerr << bformat(_("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");
-#if USE_BOOST_FORMAT
-               lyxerr << boost::format(_("Failed. Will use %1$s instead."))
-                       % user_lyxdir
-                      << endl;
-#else
-               lyxerr << _("Failed. Will use ") << user_lyxdir <<
-                       _(" instead.")
-                      << endl;
-#endif
+               lyxerr << bformat(_("Failed. Will use %1$s instead."),
+                       user_lyxdir) << endl;
                return;
        }
 
@@ -788,19 +750,14 @@ int parse_dbg(string const & arg, string const &)
                Debug::showTags(lyxerr);
                exit(0);
        }
-#if USE_BOOST_FORMAT
-       lyxerr << boost::format(_("Setting debug level to %1$s"))
-               % arg
-              << endl;
-#else
-       lyxerr << _("Setting debug level to ") << arg << endl;
-#endif
+       lyxerr << bformat(_("Setting debug level to %1$s"), arg) << endl;
 
        lyxerr.level(Debug::value(arg));
        Debug::showLevel(lyxerr, lyxerr.level());
        return 1;
 }
 
+
 int parse_help(string const &, string const &)
 {
        lyxerr <<
index 861f939f2969939d1c7009042a8ebc82357d0092..517eb897d8580f2dca527fc8f6af4684eb4920c9 100644 (file)
 #include "lyxrc.h"
 #include "lyxlex.h"
 #include "language.h"
+#include "Lsstream.h"
 #include "support/lstrings.h"
 #include "bufferparams.h" // stateText
 
-#include "support/BoostFormat.h"
-
 using std::ostream;
 using std::endl;
 
@@ -510,62 +509,30 @@ bool LyXFont::resolved() const
 /// Build GUI description of font state
 string const LyXFont::stateText(BufferParams * params) const
 {
-       ostringstream ost;
+       ostringstream os;
        if (family() != INHERIT_FAMILY)
-               ost << _(GUIFamilyNames[family()]) << ", ";
+               os << _(GUIFamilyNames[family()]) << ", ";
        if (series() != INHERIT_SERIES)
-               ost << _(GUISeriesNames[series()]) << ", ";
+               os << _(GUISeriesNames[series()]) << ", ";
        if (shape() != INHERIT_SHAPE)
-               ost << _(GUIShapeNames[shape()]) << ", ";
+               os << _(GUIShapeNames[shape()]) << ", ";
        if (size() != INHERIT_SIZE)
-               ost << _(GUISizeNames[size()]) << ", ";
+               os << _(GUISizeNames[size()]) << ", ";
        if (color() != LColor::inherit)
-               ost << lcolor.getGUIName(color()) << ", ";
-       if (emph() != INHERIT) {
-#if USE_BOOST_FORMAT
-               ost << boost::format(_("Emphasis %1$s, "))
-                       % _(GUIMiscNames[emph()]);
-#else
-               ost << _("Emphasis ") << _(GUIMiscNames[emph()]) << ", ";
-#endif
-       }
-       if (underbar() != INHERIT) {
-#if USE_BOOST_FORMAT
-               ost << boost::format(_("Underline %1$s, "))
-                       % _(GUIMiscNames[underbar()]);
-#else
-               ost << _("Underline ") << _(GUIMiscNames[underbar()]) << ", ";
-#endif
-       }
-       if (noun() != INHERIT) {
-#if USE_BOOST_FORMAT
-               ost << boost::format(_("Noun %1$s, "))
-                       % _(GUIMiscNames[noun()]);
-#else
-               ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
-#endif
-       }
+               os << lcolor.getGUIName(color()) << ", ";
+       if (emph() != INHERIT)
+               os << bformat(_("Emphasis %1$s, "), _(GUIMiscNames[emph()]));
+       if (underbar() != INHERIT)
+               os << bformat(_("Underline %1$s, "), _(GUIMiscNames[underbar()]));
+       if (noun() != INHERIT)
+               os << bformat(_("Noun %1$s, "), _(GUIMiscNames[noun()]));
        if (bits == inherit)
-               ost << _("Default") << ", ";
-       if (!params || (language() != params->language)) {
-#if USE_BOOST_FORMAT
-               ost << boost::format(_("Language: %1$s, "))
-                       % _(language()->display());
-#else
-               ost << _("Language: ") << _(language()->display()) << ", ";
-#endif
-       }
-       if (number() != OFF) {
-#if USE_BOOST_FORMAT
-               ost << boost::format(_("  Number %1$s"))
-                       % _(GUIMiscNames[number()]);
-#else
-               ost << _("  Number ") << _(GUIMiscNames[number()]);
-#endif
-       }
-
-       string const buf = rtrim(STRCONV(ost.str()), ", ");
-       return buf;
+               os << _("Default") << ", ";
+       if (!params || (language() != params->language))
+               os << bformat(_("Language: %1$s, "), _(language()->display()));
+       if (number() != OFF)
+               os << bformat(_("  Number %1$s"), _(GUIMiscNames[number()]));
+       return rtrim(STRCONV(os.str()), ", ");
 }
 
 
index 57c86892d143af3b285db06b02337c906fd1a467..1ce5d3adb1a0afde10c09f54c8b2fe0740a0ef85 100644 (file)
@@ -66,8 +66,6 @@
 #include "support/path.h"
 #include "support/lyxfunctional.h"
 
-#include "support/BoostFormat.h"
-
 #include <ctime>
 #include <clocale>
 #include <cstdlib>
@@ -773,15 +771,7 @@ void LyXFunc::dispatch(string const & s, bool verbose)
        int const action = lyxaction.LookupFunc(s);
 
        if (action == LFUN_UNKNOWN_ACTION) {
-#if USE_BOOST_FORMAT
-boost::format fmt(_("Unknown function (%1$s)"));
-fmt % s;
-owner->message(fmt.str());
-#else
-               string const msg = string(_("Unknown function ("))
-                       + s + ')';
-               owner->message(msg);
-#endif
+               owner->message(bformat(_("Unknown function (%1$s)"), s));
                return;
        }
 
@@ -1051,19 +1041,11 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
 
        case LFUN_MENUWRITE:
                if (!owner->buffer()->isUnnamed()) {
-                       ostringstream s1;
-#if USE_BOOST_FORMAT
-                       s1 << boost::format(_("Saving document %1$s..."))
-                          % MakeDisplayPath(owner->buffer()->fileName());
-#else
-                       s1 << _("Saving document ")
-                          << MakeDisplayPath(owner->buffer()->fileName())
-                          << _("...");
-#endif
-                       owner->message(STRCONV(s1.str()));
+                       string const str = bformat(_("Saving document %1$s..."),
+                          MakeDisplayPath(owner->buffer()->fileName()));
+                       owner->message(str);
                        MenuWrite(view(), owner->buffer());
-                       s1 << _(" done.");
-                       owner->message(STRCONV(s1.str()));
+                       owner->message(str + _(" done."));
                } else
                        WriteAs(view(), owner->buffer());
                break;
@@ -1074,14 +1056,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
 
        case LFUN_MENURELOAD: {
                string const file = MakeDisplayPath(view()->buffer()->fileName(), 20);
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Any changes will be lost. Are you sure you want to revert to the saved version of the document %1$s?"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("Any changes will be lost. Are you sure you want to revert to the saved version of the document");
-               text += file + _("?");
-#endif
+               string text = bformat(_("Any changes will be lost. Are you sure "
+                       "you want to revert to the saved version of the document %1$s?"), file);
                int const ret = Alert::prompt(_("Revert to saved document?"),
                        text, 0, 1, _("&Revert"), _("&Cancel"));
 
@@ -1216,15 +1192,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                               << arg << "'. Bad installation?" << endl;
                        break;
                }
-               ostringstream str;
-#if USE_BOOST_FORMAT
-               str << boost::format(_("Opening help file %1$s..."))
-                   % MakeDisplayPath(fname);
-#else
-               str << _("Opening help file ")
-                   << MakeDisplayPath(fname) << _("...");
-#endif
-               owner->message(STRCONV(str.str()));
+               owner->message(bformat(_("Opening help file %1$s..."),
+                       MakeDisplayPath(fname)));
                view()->buffer(bufferlist.loadLyXFile(fname, false));
                break;
        }
@@ -1568,20 +1537,10 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
                         x11_name != lcolor.getX11Name(LColor::graphicsbg));
 
                if (!lcolor.setColor(lyx_name, x11_name)) {
-#if USE_BOOST_FORMAT
                        setErrorMessage(
-                               boost::io::str(
-                                       boost::format(
-                                               _("Set-color \"%1$s\" failed "
+                               bformat(_("Set-color \"%1$s\" failed "
                                                  "- color is undefined or "
-                                                 "may not be redefined"))
-                                       % lyx_name));
-#else
-                       setErrorMessage(_("Set-color ") + lyx_name
-                                       + _(" failed - color is undefined"
-                                           " or may not be redefined"));
-#endif
-
+                                                 "may not be redefined"), lyx_name));
                        break;
                }
 
@@ -1821,33 +1780,17 @@ void LyXFunc::open(string const & fname)
                return;
        }
 
-       ostringstream str;
-#if USE_BOOST_FORMAT
-       str << boost::format(_("Opening document %1$s...")) % disp_fn;
-#else
-       str << _("Opening document ") << disp_fn << _("...");
-#endif
-
-       owner->message(STRCONV(str.str()));
+       owner->message(bformat(_("Opening document %1$s..."), disp_fn));
 
        Buffer * openbuf = bufferlist.loadLyXFile(filename);
-       ostringstream str2;
+       string str2;
        if (openbuf) {
                view()->buffer(openbuf);
-#if USE_BOOST_FORMAT
-               str2 << boost::format(_("Document %1$s opened.")) % disp_fn;
-#else
-               str2 << _("Document ") << disp_fn << _(" opened.");
-#endif
+               str2 = bformat(_("Document %1$s opened."), disp_fn);
        } else {
-#if USE_BOOST_FORMAT
-               str2 << boost::format(_("Could not open document %1$s"))
-                       % disp_fn;
-#else
-               str2 << _("Could not open document ") << disp_fn;
-#endif
+               str2 = bformat(_("Could not open document %1$s"), disp_fn);
        }
-       owner->message(STRCONV(str2.str()));
+       owner->message(str2);
 }
 
 
@@ -1870,14 +1813,8 @@ void LyXFunc::doImport(string const & argument)
                                initpath = trypath;
                }
 
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Select %1$s file to import"));
-               fmt % formats.prettyName(format);
-               string const text = fmt.str();
-#else
-               string const text = _("Select ") + formats.prettyName(format)
-                       + _(" file to import");;
-#endif
+               string const text = bformat(_("Select %1$s file to import"),
+                       formats.prettyName(format));
 
                FileDialog fileDlg(text,
                        LFUN_IMPORT,
@@ -1924,14 +1861,8 @@ void LyXFunc::doImport(string const & argument)
        if (FileInfo(lyxfile, true).exist() && filename != lyxfile) {
                string const file = MakeDisplayPath(lyxfile, 30);
 
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("The document %1$s already exists.\n\nDo you want to over-write that document?"));
-               fmt % file;
-               string text = fmt.str();
-#else
-               string text = _("The document ");
-               text += file + _(" already exists.\n\nDo you want to over-write that document?");
-#endif
+               string text = bformat(_("The document %1$s already exists.\n\n"
+                       "Do you want to over-write that document?"), file);
                int const ret = Alert::prompt(_("Over-write document?"),
                        text, 0, 1, _("&Over-write"), _("&Cancel"));
 
index e798317e6134975bf19c3af3360f9f1e80d837eb..3e09e77d346b5bfffffb89b72d1d2d5a636558dd 100644 (file)
 
 #include "support/filetools.h"
 #include "support/lyxlib.h"
-#include "support/BoostFormat.h"
 
 #include <unistd.h>
 
 using std::endl;
 using std::pair;
 
+
 /* WARNING: Several of the vcs-> methods end up
  * deleting this object via BufferView::reload() !
  */
@@ -80,14 +80,8 @@ bool LyXVC::ensureClean()
                return true;
 
        string const file = MakeDisplayPath(owner_->fileName(), 30);
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("The document %1$s has unsaved changes.\n\nDo you want to save the document?"));
-       fmt % file;
-       string text = fmt.str();
-#else
-       string text = _("The document ");
-       text += file + _(" has unsaved changes.\n\nDo you want to save the document?");
-#endif
+       string text = bformat(_("The document %1$s has unsaved changes.\n\n"
+               "Do you want to save the document?"), file);
        int const ret = Alert::prompt(_("Save changed document?"),
                text, 0, 1, _("&Save"), _("&Cancel"));
 
@@ -193,15 +187,9 @@ void LyXVC::revert()
        lyxerr[Debug::LYXVC] << "LyXVC: revert" << endl;
 
        string const file = MakeDisplayPath(owner_->fileName(), 20);
-#if USE_BOOST_FORMAT
-       boost::format fmt(_("Reverting to the stored version of the document %1$s will "
-                       "lose all current changes.\n\nDo you want to revert to the saved version?"));
-       fmt % file;
-       string text = fmt.str();
-#else
-       string text = _("Reverting to the stored version of the document ");
-       text += file + _(" will lose all current changes.\n\nDo you want to revert to the saved version?");
-#endif
+       string text = bformat(_("Reverting to the stored version of the "
+               "document %1$s will lose all current changes.\n\n"
+               "Do you want to revert to the saved version?"), file);
        int const ret = Alert::prompt(_("Revert to stored version of document?"),
                text, 0, 1, _("&Revert"), _("&Cancel"));
 
index 2123e7680de120cbef1a68c4ee24783dac656e72..27b91ba08672ac04092b319567798b8ee796e9f3 100644 (file)
@@ -1,3 +1,10 @@
+
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * formula.C:
+       * math_parser.C:
+       * math_cursor.C: boost::format -> bformat  all over the place
+
 2003-05-06  Ling Li  <ling@caltech.edu>
  
        * Makefile, math_makeboxinset.[Ch]:
index 1e1f4beda3f2eac2c2006f99f7c2e4d18a830727..99adbf7d2fa5545e0aa3ba0b58056e2f767d553a 100644 (file)
@@ -27,6 +27,7 @@
 #include "math_support.h"
 #include "math_mathmlstream.h"
 #include "textpainter.h"
+#include "Lsstream.h"
 
 #include "BufferView.h"
 #include "gettext.h"
index 1a8dfeca8dab9064f7ae45c0b4c83bb3f26a68e3..0ae4239153c7ccf7d7e634010664f9b3b045e06b 100644 (file)
 #include <config.h>
 #include <lyxrc.h>
 
-
 #include "support/lstrings.h"
 #include "support/LAssert.h"
 #include "support/limited_stack.h"
 #include "debug.h"
+#include "Lsstream.h"
 #include "frontends/Painter.h"
 #include "math_cursor.h"
 #include "formulabase.h"
index 2d150149b8fe12753e22c24592e5b2da5dbffa28..51fb4f9558624ff11a8b1d557adaf0ce39dda3ad 100644 (file)
@@ -32,7 +32,6 @@ following hack as starting point to write some macros:
 
 #include <config.h>
 
-
 #include "math_parser.h"
 #include "math_inset.h"
 #include "math_arrayinset.h"
@@ -63,6 +62,7 @@ following hack as starting point to write some macros:
 #include "ref_inset.h"
 
 #include "lyxlex.h"
+#include "Lsstream.h"
 #include "debug.h"
 #include "support/LAssert.h"
 #include "support/lstrings.h"
index f55e38e9dc2b7bdf8a78c72c4d7d6f351e83d73f..321c50bd223aa3d0f1dd78529ad53c8fc9b2b155 100644 (file)
@@ -25,6 +25,7 @@
 #include "gettext.h"
 #include "changes.h"
 #include "paragraph_funcs.h"
+#include "Lsstream.h"
 
 #include "insets/insetbibitem.h"
 #include "insets/insetoptarg.h"
index 6b27301b8d31232a68f9b80882345487f3d2c4a4..ca99e26a538716bf02e80b3e8ddc8dd99a2f48fa 100644 (file)
@@ -21,8 +21,8 @@
 #include "encoding.h"
 #include "lyxrc.h"
 #include "lyxlex.h"
-#include "support/BoostFormat.h"
 #include "factory.h"
+#include "Lsstream.h"
 #include "support/lstrings.h"
 #include "insets/insetoptarg.h"
 #include "insets/insetcommandparams.h"
@@ -968,34 +968,25 @@ int readParToken(Buffer & buf, Paragraph & par, LyXLex & lex, string const & tok
                change = Change(Change::UNCHANGED);
        } else if (token == "\\change_inserted") {
                lex.nextToken();
-               istringstream istr(lex.getString());
+               istringstream is(STRCONV(lex.getString()));
                int aid;
                lyx::time_type ct;
-               istr >> aid;
-               istr >> ct;
+               is >> aid >> ct;
                change = Change(Change::INSERTED, bp.author_map[aid], ct);
        } else if (token == "\\change_deleted") {
                lex.nextToken();
-               istringstream istr(lex.getString());
+               istringstream is(STRCONV(lex.getString()));
                int aid;
                lyx::time_type ct;
-               istr >> aid;
-               istr >> ct;
+               is >> aid >> ct;
                change = Change(Change::DELETED, bp.author_map[aid], ct);
        } else {
                lex.eatLine();
-#if USE_BOOST_FORMAT
-               boost::format fmt(_("Unknown token: %1$s %2$s\n"));
-               fmt % token % lex.getString();
-               string const s = fmt.str();
-#else
-               string const s = _("Unknown token: ") + token
-                       + ' ' + lex.getString() + '\n';
-#endif
+               string const s = bformat(_("Unknown token: %1$s %2$s\n"),
+                       token, lex.getString());
                // we can do this here this way because we're actually reading
                // the buffer and don't care about LyXText right now.
-               InsetError * inset = new InsetError(s);
-               par.insertInset(par.size(), inset, font);
+               par.insertInset(par.size(), new InsetError(s), font);
                return 1;
        }
        return 0;
index 66008b983b7c3cb320c10df3e04870cb87366d34..05ceca3811690eb79faaf4e5739feec43cd049f4 100644 (file)
@@ -1,3 +1,8 @@
+
+2003-05-12 André Pönitz <poenitz@gmx.net>
+
+       * lstrings.[Ch]: bformat() as wrappre around boost::format
+
 2003-05-06  Lars Gullik Bjønnes  <larsbj@gullik.net>
 
        * limited_stack.h: Change some comments, simplify a couple of
index 75cbc7a949b0258709cfb8295f2e1db6d7daab97..9321eac15755cf9d7cbbbb4f9de00f6b7dfbe1de 100644 (file)
@@ -15,6 +15,7 @@
 #include "lstrings.h"
 #include "LAssert.h"
 #include "debug.h"
+#include "BoostFormat.h"
 
 #include <boost/regex.hpp>
 #include <boost/tokenizer.hpp>
@@ -670,3 +671,60 @@ string const getStringFromVector(vector<string> const & vec,
        }
        return str;
 }
+
+
+#if USE_BOOST_FORMAT
+
+string bformat(char const * fmt, string const & arg1)
+{
+       return STRCONV((boost::format(fmt) % STRCONV(arg1)).str());
+}
+
+
+string bformat(char const * fmt, string const & arg1, string const & arg2)
+{
+       return STRCONV((boost::format(fmt) % STRCONV(arg1) % STRCONV(arg2)).str());
+}
+
+string bformat(char const * fmt, string const & arg1, string const & arg2,
+       string const & arg3, string const & arg4)
+{
+       return STRCONV((boost::format(fmt) % STRCONV(arg1) % STRCONV(arg2)
+               % STRCONV(arg3) % STRCONV(arg4)).str());
+}
+
+#else 
+
+string bformat(char const * fmt, string const & arg1)
+{
+       Assert(contains(fmt, "%1$s"));
+       string const str = subst(fmt, "%1$s", arg1);
+       return subst(str, "%%", "%");
+}
+
+
+string bformat(char const * fmt, string const & arg1, string const & arg2)
+{
+       Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%2$s"));
+       string str = subst(fmt, "%1$s", arg1);
+       str = subst(str, "%2$s", arg2);
+       return subst(str, "%%", "%");
+}
+
+
+string bformat(char const * fmt, string const & arg1, string const & arg2,
+       string const & arg3, string const & arg4)
+{
+       Assert(contains(fmt, "%1$s"));
+       Assert(contains(fmt, "%2$s"));
+       Assert(contains(fmt, "%3$s"));
+       Assert(contains(fmt, "%4$s"));
+       string str = subst(fmt, "%1$s", arg1);
+       str = subst(str, "%2$s", arg2);
+       str = subst(str, "%3$s", arg3);
+       str = subst(str, "%4$s", arg4);
+       return subst(str, "%%", "%");
+}
+
+#endif
index 7c84d472b881b44bb6d2c23461229ee3a3fd44fc..51dc20ad91136ecb7dde44084f735799bad83b75 100644 (file)
@@ -241,4 +241,15 @@ std::vector<string> const getVectorFromString(string const & str,
 string const getStringFromVector(std::vector<string> const & vec,
                                 string const & delim = ",");
 
+// wrapper around boost::format using one argument %1$s
+string bformat(char const * fmt, string const & arg1);
+// arguments %1$s and %2$s
+string bformat(char const * fmt, string const & arg1, string const & arg2);
+// arguments %1$s and %2$s and %3$s
+string bformat(char const * fmt, string const & arg1, string const & arg2,
+               string const & arg3);
+// arguments %1$s and %2$s and %3$s and %4$s
+string bformat(char const * fmt, string const & arg1, string const & arg2,
+               string const & arg3, string const & arg4);
+
 #endif
index 6ae8ab1c518f5fcc62f470ea466ba4485af17184..91a51ecca38ef997b4a3d3e5bd7b5c21a1c03fde 100644 (file)
@@ -30,6 +30,7 @@
 #include "support/LAssert.h"
 #include "frontends/Alert.h"
 #include "gettext.h"
+#include "Lsstream.h"
 #include "tabular_funcs.h"
 #include "lyxlex.h"
 
index 919e09143ea08799c99c9f981416af39f7398726..c3c2d7d19923b50273f03780bcfd5452249241d0 100644 (file)
@@ -58,6 +58,7 @@ string const write_attribute(string const & name, LyXLength const & value)
        return write_attribute(name, value.asString());
 }
 
+
 string const tostr(LyXAlignment const & num)
 {
        switch (num) {
index 2580ec7c6b1e5168c7b80ad0b48864bb786527fe..eaf7008f93847921c42b7bb53673ce56ad2d85b5 100644 (file)
@@ -12,7 +12,9 @@
 
 #include "lyxtext.h"
 #include "LString.h"
+#include "Lsstream.h"
 #include "paragraph.h"
+#include "funcrequest.h"
 #include "frontends/LyXView.h"
 #include "undo_funcs.h"
 #include "buffer.h"
@@ -40,7 +42,6 @@
 #include "support/textutils.h"
 #include "support/lstrings.h"
 
-#include "support/BoostFormat.h"
 #include <boost/tuple/tuple.hpp>
 
 using std::vector;
@@ -1188,17 +1189,7 @@ void LyXText::setCounter(Buffer const * buf, ParagraphList::iterator pit)
                                textclass.counters().step(fl.type());
 
                                // Doesn't work... yet.
-#if USE_BOOST_FORMAT
-                               s = boost::io::str(boost::format(_("%1$s #:")) % buf->B_(fl.name()));
-                               // s << boost::format(_("%1$s %1$d:")
-                               //        % fl.name()
-                               //        % buf->counters().value(fl.name());
-#else
-                               ostringstream o;
-                               //o << fl.name() << ' ' << buf->counters().value(fl.name()) << ":";
-                               o << buf->B_(fl.name()) << " #:";
-                               s = STRCONV(o.str());
-#endif
+                               s = bformat(_("%1$s #:"), buf->B_(fl.name()));
                        } else {
                                // par->SetLayout(0);
                                // s = layout->labelstring;
index ff12e1fcb6bda77e34c5838ac477e9bd4ecf2a32..f6f1e44b31ee163303ff65aa04ec5e12cf175633 100644 (file)
@@ -36,6 +36,7 @@
 #include "insets/insetnewline.h"
 #include "undo_funcs.h"
 #include "text_funcs.h"
+#include "Lsstream.h"
 
 #include <ctime>
 #include <clocale>