mirror of
https://git.lyx.org/repos/lyx.git
synced 2025-01-21 23:09:40 +00:00
The 'bformat' introduction
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@6953 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
69cb723040
commit
d31244b5e2
@ -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;
|
||||
}
|
||||
|
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -17,17 +17,17 @@
|
||||
#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;
|
||||
|
10
src/LaTeX.C
10
src/LaTeX.C
@ -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));
|
||||
}
|
||||
|
||||
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include "language.h"
|
||||
#include "encoding.h"
|
||||
#include "LString.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "support/filetools.h"
|
||||
#include "support/lstrings.h"
|
||||
|
@ -10,6 +10,8 @@
|
||||
#include "gettext.h"
|
||||
#include "paragraph.h"
|
||||
#include "lyxtext.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
|
100
src/buffer.C
100
src/buffer.C
@ -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();
|
||||
s = bformat(_("Encountered one unknown token when reading "
|
||||
"the document %1$s."), fileName());
|
||||
} 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");
|
||||
} 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;
|
||||
}
|
||||
|
102
src/bufferlist.C
102
src/bufferlist.C
@ -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"));
|
||||
|
||||
|
@ -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."));
|
||||
}
|
||||
|
@ -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.
|
||||
|
@ -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());
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "counters.h"
|
||||
#include "debug.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "support/lstrings.h"
|
||||
#include "support/LAssert.h"
|
||||
|
21
src/debug.C
21
src/debug.C
@ -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';
|
||||
|
@ -10,13 +10,10 @@
|
||||
|
||||
#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
|
||||
|
23
src/format.C
23
src/format.C
@ -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;
|
||||
|
@ -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
|
||||
|
@ -11,7 +11,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "ControlDocument.h"
|
||||
#include "ViewBase.h"
|
||||
@ -33,15 +32,13 @@
|
||||
#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;
|
||||
|
@ -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);
|
||||
}
|
||||
|
||||
|
@ -10,7 +10,6 @@
|
||||
|
||||
#include <config.h>
|
||||
|
||||
|
||||
#include "ControlSpellchecker.h"
|
||||
#include "ViewBase.h"
|
||||
#include "buffer.h"
|
||||
@ -32,10 +31,9 @@
|
||||
|
||||
#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);
|
||||
|
@ -11,16 +11,16 @@
|
||||
|
||||
#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]);
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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());
|
||||
|
@ -10,24 +10,24 @@
|
||||
|
||||
#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;
|
||||
|
@ -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.
|
||||
|
@ -16,10 +16,10 @@
|
||||
#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"
|
||||
|
||||
|
@ -23,13 +23,12 @@
|
||||
#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
|
||||
|
@ -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>
|
||||
|
@ -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);
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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/BoostFormat.h"
|
||||
#include "support/lstrings.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()
|
||||
os << "%%\\listof{" << getCmdName() << "}{"
|
||||
<< bformat(_("List of %1$s"), cit->second.name())
|
||||
<< "}\n";
|
||||
#else
|
||||
os << "%%\\listof{"
|
||||
<< getCmdName()
|
||||
<< "}{"
|
||||
<< _("List of ") << cit->second.name()
|
||||
<< "}\n";
|
||||
#endif
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -23,6 +23,7 @@
|
||||
#include "lyxfont.h"
|
||||
#include "lyxlex.h"
|
||||
#include "lyxtext.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "frontends/LyXView.h"
|
||||
#include "frontends/Dialogs.h"
|
||||
|
63
src/lyx_cb.C
63
src/lyx_cb.C
@ -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();
|
||||
}
|
||||
|
@ -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 <<
|
||||
|
@ -18,11 +18,10 @@
|
||||
#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()), ", ");
|
||||
}
|
||||
|
||||
|
||||
|
109
src/lyxfunc.C
109
src/lyxfunc.C
@ -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"));
|
||||
|
||||
|
24
src/lyxvc.C
24
src/lyxvc.C
@ -13,13 +13,13 @@
|
||||
|
||||
#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"));
|
||||
|
||||
|
@ -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]:
|
||||
|
@ -27,6 +27,7 @@
|
||||
#include "math_support.h"
|
||||
#include "math_mathmlstream.h"
|
||||
#include "textpainter.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include "BufferView.h"
|
||||
#include "gettext.h"
|
||||
|
@ -18,11 +18,11 @@
|
||||
#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"
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
@ -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"
|
||||
|
||||
|
@ -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) {
|
||||
|
15
src/text2.C
15
src/text2.C
@ -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;
|
||||
|
@ -36,6 +36,7 @@
|
||||
#include "insets/insetnewline.h"
|
||||
#include "undo_funcs.h"
|
||||
#include "text_funcs.h"
|
||||
#include "Lsstream.h"
|
||||
|
||||
#include <ctime>
|
||||
#include <clocale>
|
||||
|
Loading…
x
Reference in New Issue
Block a user