#include "support/lyxfunctional.h" // equal_1st_in_pair
#include "support/types.h"
#include "support/lyxalgo.h" // lyx_count
-#include "support/BoostFormat.h"
#include <fstream>
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;
}
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;
}
#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"
#include <boost/bind.hpp>
#include <boost/signals/connection.hpp>
-#include "support/BoostFormat.h"
#include <unistd.h>
#include <sys/wait.h>
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)));
}
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)));
}
// 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));
}
+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
#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;
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;
#include "support/path.h"
#include <boost/regex.hpp>
-#include "support/BoostFormat.h"
#include <fstream>
#include <cstdio> // sscanf
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));
}
#include "language.h"
#include "encoding.h"
#include "LString.h"
+#include "Lsstream.h"
#include "support/filetools.h"
#include "support/lstrings.h"
#include "gettext.h"
#include "paragraph.h"
#include "lyxtext.h"
+#include "Lsstream.h"
+
#include "frontends/LyXView.h"
#include "support/lstrings.h"
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
-#include "support/BoostFormat.h"
#include <fstream>
#include <iomanip>
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();
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
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 {
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)
{
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;
}
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;
}
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;
}
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;
}
#include "support/LAssert.h"
#include <boost/bind.hpp>
-#include "support/BoostFormat.h"
#include <cassert>
#include <algorithm>
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"));
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"));
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();
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;
}
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"));
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"));
}
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);
// 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"));
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"));
}
}
-#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"));
#include "support/lyxlib.h"
#include "support/lstrings.h"
#include "support/types.h"
-#include "support/BoostFormat.h"
#include "frontends/Alert.h"
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."));
}
#include "insets/updatableinset.h"
-#include "support/BoostFormat.h"
namespace {
<< "color " << font.color() << '\n'
<< "language " << lang << '\n'
<< "toggleall " << tostr(toggle);
- data = os.str();
+ data = STRCONV(os.str());
return true;
}
// 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);
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.
#include "support/path.h"
#include "support/systemcall.h"
-#include "support/BoostFormat.h"
-
#include <cctype>
#ifndef CXX_GLOBAL_CSTD
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;
}
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;
}
}
? 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;
}
}
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);
}
// 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());
#include "counters.h"
#include "debug.h"
+#include "Lsstream.h"
#include "support/lstrings.h"
#include "support/LAssert.h"
#include "gettext.h"
#include "support/lstrings.h"
-#include "support/BoostFormat.h"
-
#include <iomanip>
using std::ostream;
}
-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));
}
}
}
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';
#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"
#include "gettext.h"
#include "BufferView.h"
+#include <algorithm>
+
using std::vector;
using std::find;
}
}
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
#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?
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();
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;
+
+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
#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()
{}
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);
}
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;
#include "support/filetools.h"
#include "support/path.h"
#include "support/systemcall.h"
-#include "support/BoostFormat.h"
#include "debug.h" // for lyxerr
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);
}
#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)
}
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);
#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>
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]);
}
+
+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
} 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
_("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());
#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;
+
+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.
#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"
#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);
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");
}
}
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
+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>
#include <config.h>
-
#include "insetcaption.h"
#include "frontends/Painter.h"
#include "frontends/font_metrics.h"
#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"
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);
#include <config.h>
-
#include "insetexternal.h"
#include "ExternalTemplate.h"
#include "BufferView.h"
#include "gettext.h"
#include "debug.h"
#include "lyxlex.h"
+#include "Lsstream.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
*
* Full author contact details are available in file CREDITS
*/
-#include <config.h>
+#include <config.h>
#include "insetfloat.h"
#include "insettext.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxtext.h"
+#include "Lsstream.h"
#include "support/LOstream.h"
#include "support/lstrings.h"
*
* 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;
InsetFloatList::InsetFloatList()
: InsetCommand(InsetCommandParams())
-{
-}
+{}
InsetFloatList::InsetFloatList(string const & type)
<< 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;
}
#include <config.h>
-
#include "insets/insetgraphics.h"
#include "insets/insetgraphicsParams.h"
#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"
// 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;
}
*
* Full author contact details are available in file CREDITS
*/
-#include <config.h>
+#include <config.h>
#include "insetinclude.h"
#include "buffer.h"
#include "LaTeXFeatures.h"
#include "lyxlex.h"
#include "lyxrc.h"
+#include "Lsstream.h"
#include "frontends/Dialogs.h"
#include "frontends/LyXView.h"
#include <config.h>
-
#include "insetminipage.h"
#include "insettext.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxtext.h"
+#include "Lsstream.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
#include <config.h>
-
#include "insettabular.h"
#include "insettext.h"
#include "ParagraphParameters.h"
#include "undo_funcs.h"
#include "WordLangTuple.h"
+#include "Lsstream.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
#include <config.h>
-
#include "insettext.h"
#include "buffer.h"
#include "sgml.h"
#include "rowpainter.h"
#include "insetnewline.h"
+#include "Lsstream.h"
#include "frontends/Alert.h"
#include "frontends/Dialogs.h"
#include "lyxfont.h"
#include "lyxlex.h"
#include "lyxtext.h"
+#include "Lsstream.h"
#include "frontends/LyXView.h"
#include "frontends/Dialogs.h"
#include "lyxtext.h"
#include "gettext.h"
#include "BufferView.h"
+#include "Lsstream.h"
#include "insets/insetlabel.h"
#include "support/systemcall.h"
#include "support/lstrings.h"
-#include "support/BoostFormat.h"
-
#include <fstream>
#include <algorithm>
#include <utility>
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"));
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"));
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);
}
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();
}
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();
}
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();
}
#include "frontends/Alert.h"
#include "frontends/lyx_gui.h"
-#include "support/BoostFormat.h"
#include <boost/function.hpp>
#include <cstdlib>
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);
}
// 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);
}
}
<< "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;
}
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;
}
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 <<
#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;
/// 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()), ", ");
}
#include "support/path.h"
#include "support/lyxfunctional.h"
-#include "support/BoostFormat.h"
-
#include <ctime>
#include <clocale>
#include <cstdlib>
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;
}
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;
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"));
<< 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;
}
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;
}
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);
}
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,
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"));
#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() !
*/
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"));
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"));
+
+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]:
#include "math_support.h"
#include "math_mathmlstream.h"
#include "textpainter.h"
+#include "Lsstream.h"
#include "BufferView.h"
#include "gettext.h"
#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"
#include <config.h>
-
#include "math_parser.h"
#include "math_inset.h"
#include "math_arrayinset.h"
#include "ref_inset.h"
#include "lyxlex.h"
+#include "Lsstream.h"
#include "debug.h"
#include "support/LAssert.h"
#include "support/lstrings.h"
#include "gettext.h"
#include "changes.h"
#include "paragraph_funcs.h"
+#include "Lsstream.h"
#include "insets/insetbibitem.h"
#include "insets/insetoptarg.h"
#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"
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;
+
+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
#include "lstrings.h"
#include "LAssert.h"
#include "debug.h"
+#include "BoostFormat.h"
#include <boost/regex.hpp>
#include <boost/tokenizer.hpp>
}
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
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
#include "support/LAssert.h"
#include "frontends/Alert.h"
#include "gettext.h"
+#include "Lsstream.h"
#include "tabular_funcs.h"
#include "lyxlex.h"
return write_attribute(name, value.asString());
}
+
string const tostr(LyXAlignment const & num)
{
switch (num) {
#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"
#include "support/textutils.h"
#include "support/lstrings.h"
-#include "support/BoostFormat.h"
#include <boost/tuple/tuple.hpp>
using std::vector;
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;
#include "insets/insetnewline.h"
#include "undo_funcs.h"
#include "text_funcs.h"
+#include "Lsstream.h"
#include <ctime>
#include <clocale>