use boost::format

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@5694 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2002-11-21 18:33:09 +00:00
parent e27f7329c9
commit b016d9d773
37 changed files with 409 additions and 247 deletions

View File

@ -1,3 +1,10 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* boost/format/format_implementation.hpp (clear_bind): use
io::out_of_range
* boost/config/user.hpp (BOOST_FUNCTION_NO_DEPRECATED): define it.
2002-11-20 Lars Gullik Bjønnes <larsbj@birdstep.com>
* Boost.Format: add files so that this boost lib can be used.

View File

@ -69,4 +69,4 @@
#define BOOST_NO_EXCEPTIONS 1
#define BOOST_NO_WREGEX 1
#define BOOST_NO_WSTRING 1
#define BOOST_FUNCTION_NO_DEPRECATED 1

View File

@ -152,7 +152,7 @@ basic_format<Ch,Tr>& basic_format<Ch,Tr> ::clear_bind(int argN)
if(argN<1 || argN > num_args_ || bound_.size()==0 || !bound_[argN-1] )
{
if( exceptions() & out_of_range_bit )
boost::throw_exception(out_of_range()); // arg not in range.
boost::throw_exception(io::out_of_range()); // arg not in range.
else return *this;
}
bound_[argN-1]=false;

View File

@ -20,6 +20,7 @@ src/frontends/controllers/ControlGraphics.C
src/frontends/controllers/ControlInclude.C
src/frontends/controllers/ControlParagraph.C
src/frontends/controllers/ControlPreamble.C
src/frontends/controllers/ControlPrefs.C
src/frontends/controllers/ControlPrint.C
src/frontends/controllers/ControlSearch.C
src/frontends/controllers/ControlSpellchecker.C
@ -49,6 +50,7 @@ src/frontends/qt2/QExternal.C
src/frontends/qt2/QExternalDialog.C
src/frontends/qt2/QFloat.C
src/frontends/qt2/QGraphics.C
src/frontends/qt2/QGraphicsDialog.C
src/frontends/qt2/QInclude.C
src/frontends/qt2/QIndex.C
src/frontends/qt2/QLog.C
@ -59,12 +61,15 @@ src/frontends/qt2/QMinipage.C
src/frontends/qt2/QParagraph.C
src/frontends/qt2/QPreamble.C
src/frontends/qt2/QPreambleDialog.C
src/frontends/qt2/QPrefs.C
src/frontends/qt2/QPrefsDialog.C
src/frontends/qt2/QPrint.C
src/frontends/qt2/QRef.C
src/frontends/qt2/QSearch.C
src/frontends/qt2/QSendto.C
src/frontends/qt2/QShowFile.C
src/frontends/qt2/QSpellchecker.C
src/frontends/qt2/QTabular.C
src/frontends/qt2/QTabularCreate.C
src/frontends/qt2/QTexinfo.C
src/frontends/qt2/QThesaurus.C
@ -154,6 +159,7 @@ src/kbsequence.C
src/language.C
src/LaTeX.C
src/LColor.C
src/lengthcommon.C
src/LyXAction.C
src/lyx_cb.C
src/lyxfind.C

17
src/BoostFormat.h Normal file
View File

@ -0,0 +1,17 @@
// -*- C++ -*-
#ifndef LYX_BOOST_FORMAT_H
#define LYX_BOOST_FORMAT_H
#include <boost/format.hpp>
// Add explicit instantion
namespace boost
{
extern
template basic_format<char>;
} // namespace boost
#endif

View File

@ -64,6 +64,7 @@
#include <boost/bind.hpp>
#include <boost/signals/connection.hpp>
#include "BoostFormat.h"
#include <unistd.h>
#include <sys/wait.h>
@ -297,7 +298,7 @@ int BufferView::Pimpl::resizeCurrentBuffer()
// bv_->text->owner(bv_);
if (lyxerr.debugging())
textcache.show(lyxerr, "resizeCurrentBuffer");
buffer_->resizeInsets(bv_);
} else {
bv_->text = new LyXText(bv_);
@ -639,7 +640,7 @@ void BufferView::Pimpl::savePosition(unsigned int i)
bv_->text->cursor.pos());
if (i > 0) {
ostringstream str;
str << _("Saved bookmark") << ' ' << i;
str << boost::format(_("Saved bookmark %1$d")) % i;
owner_->message(STRCONV(str.str()));
}
}
@ -671,7 +672,7 @@ void BufferView::Pimpl::restorePosition(unsigned int i)
update(bv_->text, BufferView::SELECT | BufferView::FITCUR);
if (i > 0) {
ostringstream str;
str << _("Moved to bookmark") << ' ' << i;
str << boost::format(_("Moved to bookmark %1$d")) % i;
owner_->message(STRCONV(str.str()));
}
}
@ -879,19 +880,16 @@ void BufferView::Pimpl::MenuInsertLyXFile(string const & filen)
string const disp_fn(MakeDisplayPath(filename));
ostringstream s1;
s1 << _("Inserting document") << ' '
<< disp_fn << " ...";
s1 << boost::format(_("Inserting document %1$s ...")) % disp_fn;
owner_->message(STRCONV(s1.str()));
bool const res = bv_->insertLyXFile(filename);
if (res) {
ostringstream str;
str << _("Document") << ' ' << disp_fn
<< ' ' << _("inserted.");
str << boost::format(_("Document %1$s inserted.")) % disp_fn;
owner_->message(STRCONV(str.str()));
} else {
ostringstream str;
str << _("Could not insert document") << ' '
<< disp_fn;
str << boost::format(_("Could not insert document %1$s")) % disp_fn;
owner_->message(STRCONV(str.str()));
}
}

View File

@ -1,3 +1,46 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* lyxfunc.C (dispatch): use boost::format
(open): ditto
(doImport): ditto
* lyxfont.C (stateText): use boost::format
* lyx_main.C (LyX): use boost::format
(init): ditto
(queryUserLyXDir): ditto
(readRcFile): ditto
(parse_dbg): ditto
(typedef boost::function): use the recommened syntax.
* importer.C (Import): use boost::format
* debug.C (showLevel): use boost::format
* converter.C (view): use boost::format
(convert): ditto
(move): ditto
(scanLog): ditto
* bufferview_funcs.C (currentState): use boost::format
* bufferlist.C (emergencyWrite): use boost::format
* buffer.C (readLyXformat2): use boost::format
(parseSingleLyXformat2Token): ditto
* Makefile.am (lyx_SOURCES): add BoostFormat.h and boost-inst.C
* LaTeX.C (run): use boost::format
* Chktex.C (scanLogFile): use boost::format
* BufferView_pimpl.C (savePosition): use boost::format
(restorePosition): ditto
(MenuInsertLyXFile): ditto
* BoostFormat.h: help file for explicit instation.
2002-11-21 Dekel Tsur <dekelts@tau.ac.il>
* tabular.C (latex): Support for block alignment in fixed width
@ -8,7 +51,7 @@
* BufferView_pimpl.C:
* lyx_cb.C:
* lyxfunc.C: split filedialog into open/save
2002-11-08 Juergen Vigna <jug@sad.it>
* undo_funcs.C (textHandleUndo): fixed problems with undo introduced
@ -24,24 +67,24 @@
* paragraph.C:
* toc.h:
* toc.C: ParConstIterator, and use it (from Lars)
2002-11-07 Ben Stanley <bds02@uow.edu.au>
* lyxtextclass.[Ch]: revise and add doxygen comments
2002-11-07 John Levon <levon@movementarian.org>
* text.C: fix progress value for spellchecker
* text.C: fix progress value for spellchecker
* toc.C: fix navigate menu for insetwrap inside minipage
* paragraph_funcs.C: added FIXME for suspect code
2002-11-07 John Levon <levon@movementarian.org>
* BufferView_pimpl.C: fix redrawing of insets
on buffer switch
2002-11-05 Lars Gullik Bjønnes <larsbj@birdstep.com>
* text2.C (updateCounters): fix bug 668

View File

@ -29,6 +29,8 @@
#include "support/path.h"
#include "support/lstrings.h"
#include "BoostFormat.h"
#include <fstream>
using std::ifstream;
@ -81,7 +83,7 @@ int Chktex::scanLogFile(TeXErrors & terr)
token = split(token, warning, ':');
int lineno = lyx::atoi(line);
warno = _("ChkTeX warning id #") + warno;
warno = boost::io::str(boost::format(_("ChkTeX warning id # %1$d")) % warno);
terr.insertError(lineno, warno, warning);
++retval;
}

View File

@ -32,6 +32,7 @@
#include "support/path.h"
#include <boost/regex.hpp>
#include "BoostFormat.h"
#include <fstream>
#include <cstdio> // sscanf
@ -202,7 +203,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
lyxerr[Debug::LATEX] << "Run #" << count << endl;
if (lfun) {
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
str << boost::format(_("LaTeX run number %1$d")) % count;
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
@ -287,7 +288,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
<< "Run #" << count << endl;
if (lfun) {
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
str << boost::format(_("LaTeX run number %1$d")) % count;
// check lyxstring string stream and gcc 3.1 before fixing
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}
@ -344,7 +345,7 @@ int LaTeX::run(TeXErrors & terr, LyXFunc * lfun)
lyxerr[Debug::LATEX] << "Run #" << count << endl;
if (lfun) {
ostringstream str;
str << _("LaTeX run number") << ' ' << count;
str << boost::format(_("LaTeX run number %1$d")) % count;
lfun->dispatch(FuncRequest(LFUN_MESSAGE, STRCONV(str.str())));
}

View File

@ -38,6 +38,7 @@ localedir = $(datadir)/locale
BUILT_SOURCES = version.C
lyx_SOURCES = \
BoostFormat.h \
BufferView.C \
BufferView.h \
BufferView_pimpl.C \
@ -89,6 +90,7 @@ lyx_SOURCES = \
ToolbarDefaults.h \
WordLangTuple.h \
boost.C \
boost-inst.C \
box.h \
box.C \
broken_headers.h \

13
src/boost-inst.C Normal file
View File

@ -0,0 +1,13 @@
#include <config.h>
#include "BoostFormat.h"
namespace boost
{
using boost::io::out_of_range_bit;
template class basic_format<char>;
} // namespace boost

View File

@ -100,6 +100,7 @@
#include <boost/bind.hpp>
#include <boost/tuple/tuple.hpp>
#include "BoostFormat.h"
#include <fstream>
#include <iomanip>
@ -360,7 +361,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
s += _(" paragraphs");
}
Alert::alert(_("Textclass Loading Error!"), s,
_("When reading " + fileName()));
boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
}
if (unknown_tokens > 0) {
@ -372,7 +373,7 @@ bool Buffer::readLyXformat2(LyXLex & lex, Paragraph * par)
s += _(" unknown tokens");
}
Alert::alert(_("Textclass Loading Error!"), s,
_("When reading " + fileName()));
boost::io::str(boost::format(_("When reading %1$s")) % fileName()));
}
return the_end_read;
@ -607,10 +608,9 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
if (pp.first) {
params.textclass = pp.second;
} else {
Alert::alert(string(_("Textclass error")),
string(_("The document uses an unknown textclass \"")) +
lex.getString() + string("\"."),
string(_("LyX will not be able to produce output correctly.")));
Alert::alert(_("Textclass error"),
boost::io::str(boost::format(_("The document uses an unknown textclass \"%1$s\".")) % lex.getString()),
_("LyX will not be able to produce output correctly."));
params.textclass = 0;
}
if (!params.getLyXTextClass().load()) {
@ -620,8 +620,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// I can substitute but I don't see how I can
// stop loading... ideas?? ARRae980418
Alert::alert(_("Textclass Loading Error!"),
string(_("Can't load textclass ")) +
params.getLyXTextClass().name(),
boost::io::str(boost::format(_("Can't load textclass %1$s")) %
params.getLyXTextClass().name()),
_("-- substituting default"));
params.textclass = 0;
}
@ -926,8 +926,8 @@ Buffer::parseSingleLyXformat2Token(LyXLex & lex, Paragraph *& par,
// This should be insurance for the future: (Asger)
++unknown_tokens;
lex.eatLine();
string const s = _("Unknown token: ") + token
+ " " + lex.text() + "\n";
string const s = boost::io::str(boost::format(_("Unknown token: %1$s %2$s\n")) % token
% lex.text());
// we can do this here this way because we're actually reading
// the buffer and don't care about LyXText right now.
InsetError * new_inset = new InsetError(s);

View File

@ -42,6 +42,7 @@
#include "support/LAssert.h"
#include <boost/bind.hpp>
#include "BoostFormat.h"
#include <cassert>
#include <algorithm>
@ -308,8 +309,10 @@ void BufferList::emergencyWrite(Buffer * buf)
string const doc = buf->isUnnamed()
? OnlyFilename(buf->fileName()) : buf->fileName();
lyxerr << _("LyX: Attempting to save document ") << doc << endl;
lyxerr << boost::format(_("LyX: Attempting to save document %1$s"))
% doc
<< endl;
// We try to save three places:

View File

@ -30,6 +30,8 @@
#include "support/lstrings.h"
#include "BoostFormat.h"
void emph(BufferView * bv)
{
LyXFont font(LyXFont::ALL_IGNORE);
@ -157,12 +159,12 @@ string const currentState(BufferView * bv)
buffer->params.getLyXTextClass().defaultfont();
font.reduce(defaultfont);
state << _("Font:") << ' ' << font.stateText(&buffer->params);
state << boost::format(_("Font: %1$s")) % font.stateText(&buffer->params);
// The paragraph depth
int depth = text->getDepth();
if (depth > 0)
state << _(", Depth: ") << depth;
state << boost::format(_(", Depth: %1$d")) % depth;
// The paragraph spacing, but only if different from
// buffer spacing.

View File

@ -14,26 +14,28 @@
#pragma implementation
#endif
#include <cctype>
#include "converter.h"
#include "lyxrc.h"
#include "buffer.h"
#include "bufferview_funcs.h"
#include "LaTeX.h"
#include "frontends/LyXView.h"
#include "lyx_cb.h" // ShowMessage()
#include "gettext.h"
#include "BufferView.h"
#include "debug.h"
#include "frontends/Alert.h"
#include "frontends/LyXView.h"
#include "support/filetools.h"
#include "support/lyxfunctional.h"
#include "support/path.h"
#include "support/systemcall.h"
#include "BoostFormat.h"
#include <cctype>
#ifndef CXX_GLOBAL_CSTD
using std::isdigit;
#endif
@ -176,8 +178,8 @@ bool Formats::view(Buffer const * buffer, string const & filename,
format = getFormat(format->parentFormat());
if (!format || format->viewer().empty()) {
Alert::alert(_("Cannot view file"),
_("No information for viewing ")
+ prettyName(format_name));
boost::io::str(boost::format(_("No information for viewing %1$s"))
% prettyName(format_name)));
return false;
}
@ -682,7 +684,7 @@ bool Converters::convert(Buffer const * buffer,
_("You should try to fix them."));
else
Alert::alert(_("Cannot convert file"),
"Error while executing",
_("Error while executing"),
command.substr(0, 50));
return false;
}
@ -705,7 +707,7 @@ bool Converters::convert(Buffer const * buffer,
token_base, to_base);
if (!lyx::rename(from, to)) {
Alert::alert(_("Error while trying to move directory:"),
from, ("to ") + to);
from, boost::io::str(boost::format(_("to %1$s")) % to));
return false;
}
}
@ -741,7 +743,7 @@ bool Converters::move(string const & from, string const & to, bool copy)
: lyx::rename(from2, to2);
if (!moved && no_errors) {
Alert::alert(_("Error while trying to move file:"),
from2, _("to ") + to2);
from2, boost::io::str(boost::format(_("to %1$s")) % to2));
no_errors = false;
}
}
@ -827,7 +829,7 @@ bool Converters::scanLog(Buffer const * buffer, string const & command,
}
string head;
split(command, head, ' ');
Alert::alert(_("There were errors during running of ") + head,
Alert::alert(boost::io::str(boost::format(_("There were errors during running of %1$s")) % head),
s, t);
return false;
} else if (result & LaTeX::NO_OUTPUT) {

View File

@ -13,12 +13,14 @@
#include <config.h>
#include <iomanip>
#include "debug.h"
#include "gettext.h"
#include "support/lstrings.h"
#include "BoostFormat.h"
#include <iomanip>
using std::ostream;
using std::setw;
using std::endl;
@ -107,8 +109,11 @@ void Debug::showLevel(ostream & o, Debug::type level)
if (errorTags[i].level != Debug::ANY
&& errorTags[i].level != Debug::NONE
&& errorTags[i].level & level)
o << _("Debugging `") << errorTags[i].name
<< "' (" << _(errorTags[i].desc) << ')' << endl;
o << boost::format(
_("Debugging `%1$s' (%2$s)"))
% errorTags[i].name
% _(errorTags[i].desc)
<< endl;
}

View File

@ -1,21 +1,27 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* biblio.C (getAbbreviatedAuthor): use boost::format
* ControlSpellchecker.C (clearParams): use boost::format
2002-11-20 John Levon <levon@movementarian.org>
* ControlMath.C: couple more manglings
2002-11-20 John Levon <levon@movementarian.org>
* ControlMath.h:
* ControlMath.C: add find_xpm mangler
2002-11-17 John Levon <levon@movementarian.org>
* helper_funcs.C and users: specify save/open in file dialog
2002-11-15 John Levon <levon@movementarian.org>
* ControlPrefs.h:
* ControlPrefs.C: use setParams()
2002-11-15 John Levon <levon@movementarian.org>
* ControlButtons.h: make OKButton() virtual for prefs
@ -23,10 +29,10 @@
* ControlPrefs.h:
* ControlPrefs.C: updates for xforms port to MVC
* Makefile.am:
* Makefile.am:
* ControlTabular.h:
* ControlTabular.C: add simple MVC port
2002-11-14 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ControlInclude.C: fix file format masks for qt's use
@ -36,11 +42,11 @@
* Makefile.am:
* ControlPrefs.h:
* ControlPrefs.C: add skeleton controller
2002-11-12 John Levon <levon@movementarian.org>
* biblio.C: fix warnings
2002-11-12 Angus Leeming <leeming@lyx.org>
* ControlSpellchecker.C (check): fix crash

View File

@ -22,14 +22,17 @@
#include "language.h"
#include "lyxrc.h"
#include "lyxtext.h"
#include "frontends/Alert.h"
#include "support/lstrings.h"
#include "ispell.h"
#ifdef USE_PSPELL
# include "pspell.h"
#endif
#include "frontends/Alert.h"
#include "support/lstrings.h"
#include "BoostFormat.h"
ControlSpellchecker::ControlSpellchecker(LyXView & lv, Dialogs & d)
: ControlDialogBD(lv, d),
@ -42,25 +45,25 @@ void ControlSpellchecker::setParams()
{
if (speller_)
return;
// create spell object
string tmp;
#ifdef USE_PSPELL
if (lyxrc.use_pspell) {
tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : buffer()->params.language->code();
speller_ = new PSpell(buffer()->params, tmp);
} else {
#endif
tmp = (lyxrc.isp_use_alt_lang) ?
lyxrc.isp_alt_lang : buffer()->params.language->lang();
speller_ = new ISpell(buffer()->params, tmp);
#ifdef USE_PSPELL
}
#endif
if (lyxrc.isp_use_alt_lang) {
Language const * lang = languages.getLanguage(tmp);
if (lang)
@ -68,7 +71,7 @@ void ControlSpellchecker::setParams()
} else {
rtl_ = buffer()->params.language->RightToLeft();
}
if (!speller_->error().empty()) {
emergency_exit_ = true;
Alert::alert("The spellchecker has failed", speller_->error());
@ -189,15 +192,14 @@ void ControlSpellchecker::clearParams()
if (speller_->alive()) {
speller_->close();
message_ = tostr(count_);
if (count_ != 1) {
message_ += _(" words checked.");
} else {
message_ += _(" word checked.");
}
message_ = "\n" + message_;
message_ = _("Spellchecking completed! ") + message_;
boost::format fmter("");
if (count_ != 1) {
fmter = boost::format(_("Spellchecking completed!\n%1$d words checked."));
} else {
fmter = boost::format(_("Spellchecking completed!\n%1$d word checked."));
}
message_ = boost::io::str(fmter % count_);
} else {
message_ = speller_->error();
speller_->cleanUp();

View File

@ -23,6 +23,7 @@
#include "support/LAssert.h"
#include <boost/regex.hpp>
#include "BoostFormat.h"
#include <algorithm>
@ -94,13 +95,15 @@ string const getAbbreviatedAuthor(InfoMap const & map, string const & key)
if (authors.empty())
return author;
author = familyName(authors[0]);
boost::format fmter("");
if (authors.size() == 2)
author += _(" and ") + familyName(authors[1]);
fmter = boost::format(_("%1$s and %2$s"))
% familyName(authors[0]) % familyName(authors[1]);
else if (authors.size() > 2)
author += _(" et al.");
return author;
fmter = boost::format(_("%1$s et al.")) % familyName(authors[0]);
else
fmter = boost::format("%1$s") % familyName(authors[0]);
return boost::io::str(fmter);
}
@ -244,16 +247,16 @@ namespace {
string const escape_special_chars(string const & expr)
{
// Search for all chars '.|*?+(){}[^$]\'
// Note that '[', ']' and '\' must be escaped.
// Note that '[' and '\' must be escaped.
// This is a limitation of boost::regex, but all other chars in BREs
// are assumed literal.
boost::RegEx reg("[.|*?+(){}^$\\[\\]\\\\]");
boost::RegEx reg("[].|*?+(){}^$\\[\\\\]");
// $& is a perl-like expression that expands to all of the current match
// The '$' must be prefixed with the escape character '\' for
// boost to treat it as a literal.
// Thus, to prefix a matched expression with '\', we use:
string const fmt("\\\\$&");
string const fmt("\\\\$&");
return reg.Merge(expr, fmt);
}

View File

@ -1,17 +1,21 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* QVCLog.C (update_contents): use boost::format
2002-11-21 John Levon <levon@movementarian.org>
* qscreen.C: show content pane cursor even when
focus is on dialog, command buffer etc.
2002-11-20 John Levon <levon@movementarian.org>
* QMathDialog.C: don't pass empty commands to math
on menu tear-off
2002-11-20 John Levon <levon@movementarian.org>
* QLPopupMenu.C: only check .disabled() on Commands
2002-11-20 Jean-Marc Lasgouttes <Jean-Marc.Lasgouttes@inria.fr>
* QLPopupMenu.C (getLabel): show labels for menu entries
@ -21,27 +25,27 @@
2002-11-20 John Levon <levon@movementarian.org>
* ui/QDelimiterDialog.ui: geometry fix
2002-11-20 John Levon <levon@movementarian.org>
* Toolbar_pimpl.C:
* QDelimiterDialog.C:
* QMathDialog.C: use find_xpm to mangle name
2002-11-20 John Levon <levon@movementarian.org>
* QDelimiterDialog.h:
* QDelimiterDialog.C: fix delimiter connect()
2002-11-20 John Levon <levon@movementarian.org>
* QDocument.C:
* QDocumentDialog.C: fix my sillies
2002-11-20 John Levon <levon@movementarian.org>
* QLPainter.C: use realColor not color for the font
2002-11-18 John Levon <levon@movementarian.org>
* Makefile.am:
@ -49,10 +53,10 @@
* qfontexample.C:
* QPrefs.C:
* QPrefsDialog.h:
* QPrefsDialog.C:
* QPrefsDialog.C:
* ui/QPrefScreenFontsModule.ui: show an example
of the chosen font
2002-11-18 John Levon <levon@movementarian.org>
* ui/Makefile.am:
@ -61,7 +65,7 @@
* Makefile.am: define no translation
* QDocument.C: avoid QBloatList
2002-11-17 John Levon <levon@movementarian.org>
* ui/QPrefScreenFontsModule.ui:
@ -70,34 +74,34 @@
* QPrefs.C: use font families properly
* qfont_loader.C: and obey them
2002-11-17 John Levon <levon@movementarian.org>
* QPrefsDialog.C: partial fonts fix
2002-11-17 John Levon <levon@movementarian.org>
* QPrefsDialog.h:
* QPrefsDialog.C: implement browse slots. Also
try to do something with fonts for Qt 3 (untested)
2002-11-17 John Levon <levon@movementarian.org>
* QGraphics.C: some fixes from Herbert & me
2002-11-15 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* FileDialog.C: fix empty mask string
* FileDialog.C: fix empty mask string
2002-11-17 John Levon <levon@movementarian.org>
* QLImage.C: implement monochrome, and fake grayscale
2002-11-17 John Levon <levon@movementarian.org>
* qfont_loader.h:
* qfont_loader.C: fix totally broken update code
2002-11-17 John Levon <levon@movementarian.org>
* Makefile.am:
@ -107,22 +111,22 @@
* QPrefs.C:
* QPrefsDialog.h:
* QPrefsDialog.C: implement colors. We're done !
2002-11-17 John Levon <levon@movementarian.org>
* FileDialog.C: split into open/save so open
no longer says "Save" !
2002-11-17 John Levon <levon@movementarian.org>
* QPrefsDialog.h:
* QPrefsDialog.C: implement converters
2002-11-17 John Levon <levon@movementarian.org>
* QPrefsDialog.C:
* QPrefs.C: implement formats
2002-11-17 John Levon <levon@movementarian.org>
* fontloader.C: disable crashing code for now
@ -130,43 +134,43 @@
* QPrefs.h:
* QPrefs.C:
* QPrefsDialog.C: implement most prefs load/save
2002-11-17 John Levon <levon@movementarian.org>
* ui/QPref*:
* QPrefsDialog.C:
* QPrefs.C: more work
2002-11-15 Edwin Leuven <leuven@fee.uva.nl>
* QTabular.C: compile fixes
2002-11-15 Edwin Leuven <leuven@fee.uva.nl>
* ui/QTabularDialog.ui: some relabelling
2002-11-15 John Levon <levon@movementarian.org>
* QPrefs.h:
* QPrefs.C: some update() work
2002-11-15 John Levon <levon@movementarian.org>
* QPrefs.C: add #if 0 xforms code for working on
* QTabular.C: remove some handled #if 0 code
2002-11-15 John Levon <levon@movementarian.org>
* qsetborder.h:
* qsetborder.C: fix ws
2002-11-15 John Levon <levon@movementarian.org>
* QTabularDialog.h:
* QTabularDialog.C:
* QTabular.C: add some stuff
2002-11-15 John Levon <levon@movementarian.org>
* Makefile.dialogs:
@ -179,19 +183,19 @@
* QTabular.C:
* QTabularDialog.h:
* QTabularDialog.C: add skeleton
2002-11-14 John Levon <levon@movementarian.org>
* ui/QTabularDialog.ui: label for cell pos
2002-11-13 Herbert Voss <voss@perce.de>
* QBibtex.C: (apply, isValid) small changes
2002-11-13 John Levon <levon@movementarian.org>
* all pref files: make the stack work
2002-11-13 John Levon <levon@movementarian.org>
* Dialogs.C:
@ -202,7 +206,7 @@
* QPrefs.C:
* QPrefsDialog.h:
* QPrefsDialog.C: add skeleton dialog
2002-11-13 John Levon <levon@movementarian.org>
* ui/QBibtexDialog.ui: add some change_adaptors()
@ -210,11 +214,11 @@
* QBibtex.C: fix duplicate entries in style CB, and
alphasort it again, but still allow empty/user-defined
style
2002-11-12 Herbert Voss <voss@perce.de>
* QBibtex.[Ch]: fix bugs in the apply-part
* QBibtex.[Ch]: fix bugs in the apply-part
2002-11-13 John Levon <levon@movementarian.org>
* QDocument.h:
@ -223,7 +227,7 @@
* QDocumentDialog.C:
* ui/QDocumentDialog.ui:
* ui/BulletsModuleBase.ui: some UI fixes
2002-11-12 Edwin Leuven <leuven@fee.uva.nl>
* QDocumentDialog.C: enable apply on change
@ -243,7 +247,7 @@
2002-11-12 Edwin Leuven <leuven@fee.uva.nl>
* QBrowseBox: Juergen Spitzmueller's mouse focus fix
2002-11-08 Edwin Leuven <leuven@fee.uva.nl>
* Dialogs2.C: compile fix
@ -257,7 +261,7 @@
* ui/BulletsModuleBase.ui: idem
* ui/QTabularDialog.ui: new tabular dialog
* qsetborder.[Ch]: new small qt widget to set table borders
2002-11-08 Dekel Tsur <dekelts@tau.ac.il>
* lyx_gui.C:
@ -267,34 +271,34 @@
* ui/QIncludeDialog.ui:
* QInclude.C: fix setting of combobox
2002-11-07 John Levon <levon@movementarian.org>
* ui/QPref*: add initial prefs ui from Juergen S
2002-11-27 Juergen Spitzmueller <j.spitzmueller@gmx.de>
* ui/QDocument.ui:
* QDocumentDialog.C:
* QDocument.[Ch]:
* QDocument.[Ch]:
Implement "Save as default" and "Use class defaults"
* QDocumentDialog.C: Fix dialog update on class change
implement lyxrc.auto_reset_options
2002-11-07 John Levon <levon@movementarian.org>
* QGraphics.[Ch]:
* QGraphicsDialog.[Ch]:
* ui/QGraphicsDialog.ui: various fixes so it actually
* QGraphics.[Ch]:
* QGraphicsDialog.[Ch]:
* ui/QGraphicsDialog.ui: various fixes so it actually
works
2002-11-01 Herbert Voss <voss@perce.de>
* QGraphics.[Ch]:
* QGraphicsDialog.[Ch]:
* ui/QGraphicsDialog.ui: get scale/rotate working
* QGraphics.[Ch]:
* QGraphicsDialog.[Ch]:
* ui/QGraphicsDialog.ui: get scale/rotate working
2002-11-04 Angus Leeming <leeming@lyx.org>
* QGraphics.C (update_contents): controller.getUnits() ->

View File

@ -26,6 +26,8 @@
#include <qtextview.h>
#include <qpushbutton.h>
#include "BoostFormat.h"
typedef Qt2CB<ControlVCLog, Qt2DB<QVCLogDialog> > base_class;
@ -45,7 +47,7 @@ void QVCLog::build_dialog()
void QVCLog::update_contents()
{
dialog_->setCaption(string(_("Version control log for ") + controller().getBufferFileName()).c_str());
dialog_->setCaption(boost::io::str(boost::format(_("Version control log for %1$s")) % controller().getBufferFileName()).c_str());
dialog_->vclogTV->setText("");

View File

@ -1,3 +1,11 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* FormGraphics.C (build): use boost::format
* FeedbackController.C (postMessage): use boost::format
* ColorHandler.C (getGCForeground): use boost::format
2002-11-21 Angus Leeming <leeming@lyx.org>
* forms/fdfix.sh: Don't use "if [ $? -ne 0 ]; then..."
@ -7,7 +15,7 @@
2002-11-20 Angus Leeming <leeming@lyx.org>
* forms/fdfix.sh:
* forms/fdfix.sh:
* forms/fdfixh.sed: strengthen the sed in the sed script and further
beautify the contents of the resultant .h file.
@ -40,7 +48,7 @@
2002-11-17 John Levon <levon@movementarian.org>
* FileDialog.C: open/save name change
2002-11-15 John Levon <levon@movementarian.org>
* Dialogs2.C:
@ -53,7 +61,7 @@
* forms/form_tabular.fd: port tabular and prefs to MVC
* FormBase.h: make hide() virtual for prefs
2002-11-08 Angus Leeming <leeming@lyx.org>
* xforms_resize.[Ch]: sigh. Hack the "get scaling" part of
@ -86,10 +94,10 @@
a clean way.
2002-10-31 Herbert Voss <voss@perce.de>
* FormGraphics.C (build, apply): get the rotate-list from the
controller
* FormGraphics.C (build, apply): get the rotate-list from the
controller
2002-11-04 Angus Leeming <leeming@lyx.org>
* FormGraphics.C (build): Use frnt::getBBUnits().

View File

@ -19,10 +19,11 @@
#include "gettext.h"
#include "debug.h"
#include <boost/scoped_array.hpp>
#include "BoostFormat.h"
#include <cmath>
#include <boost/scoped_array.hpp>
#ifndef CXX_GLOBAL_CSTD
using std::pow;
#endif
@ -37,7 +38,7 @@ LyXColorHandler::LyXColorHandler()
drawable = XCreatePixmap(display,
RootWindow(display, fl_screen),
10, 10, fl_get_visual_depth());
colormap = fl_state[fl_get_vclass()].colormap;
// Clear the GC cache
for (int i = 0; i <= LColor::ignore; ++i) {
@ -85,24 +86,23 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
// Look up the RGB values for the color, and an approximate
// color that we can hope to get on this display.
if (XLookupColor(display, colormap, s.c_str(), &xcol, &ccol) == 0) {
lyxerr << _("LyX: Unknown X11 color ") << s
<< _(" for ") << lcolor.getGUIName(c) << '\n'
<< _(" Using black instead, sorry!") << endl;
lyxerr << boost::format(_("LyX: Unknown X11 color %1$s for %2$s\n"
" Using black instead, sorry!"))
% s % lcolor.getGUIName(c) << endl;
unsigned long bla = BlackPixel(display,
DefaultScreen(display));
val.foreground = bla;
// Try the exact RGB values first, then the approximate.
} else if (XAllocColor(display, colormap, &xcol) != 0) {
if (lyxerr.debugging(Debug::GUI)) {
lyxerr << _("LyX: X11 color ") << s
<< _(" allocated for ")
<< lcolor.getGUIName(c) << endl;
lyxerr << boost::format(_("LyX: X11 color %1$s allocated for %2$s"))
% s % lcolor.getGUIName(c)
<< endl;
}
val.foreground = xcol.pixel;
} else if (XAllocColor(display, colormap, &ccol)) {
lyxerr << _("LyX: Using approximated X11 color ") << s
<< _(" allocated for ")
<< lcolor.getGUIName(c) << endl;
lyxerr << boost::format(_("LyX: Using approximated X11 color %1$s allocated for %2$s"))
% s % lcolor.getGUIName(c) << endl;
val.foreground = xcol.pixel;
} else {
// Here we are traversing the current colormap to find
@ -141,24 +141,28 @@ GC LyXColorHandler::getGCForeground(LColor::color c)
closest_pixel = t;
}
}
lyxerr << _("LyX: Couldn't allocate '") << s
<< _("' for ") << lcolor.getGUIName(c)
<< _(" with (r,g,b)=(")
<< xcol.red << "," << xcol.green << ","
<< xcol.blue << ").\n"
<< _(" Using closest allocated "
"color with (r,g,b)=(")
<< cmap[closest_pixel].red << ","
<< cmap[closest_pixel].green << ","
<< cmap[closest_pixel].blue << _(") instead.\n")
<< _("Pixel [") << closest_pixel << _("] is used.")
lyxerr << boost::format(
_("LyX: Couldn't allocate '%1$s' for %2$s"
" with (r,g,b)=(%3$d,%4$d,%5$d).\n"
" Using closest allocated color"
" with (r,g,b)=(%6$d,%7$d,%8$d) instead.\n"
"Pixel [%9$d] is used."))
% s
% lcolor.getGUIName(c)
% xcol.red % xcol.green % xcol.blue
% cmap[closest_pixel].red
% cmap[closest_pixel].green
% cmap[closest_pixel].blue
% closest_pixel
<< endl;
val.foreground = cmap[closest_pixel].pixel;
}
val.function = GXcopy;
return colorGCcache[c] = XCreateGC(display, drawable,
GCForeground | GCFunction, &val);
GCForeground | GCFunction, &val);
}
@ -169,7 +173,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
//if (lyxerr.debugging()) {
// lyxerr << "Painter drawable: " << drawable() << endl;
//}
int index = lw + (ls << 1) + (c << 6);
LineGCCache::iterator it = lineGCcache.find(index);
@ -178,7 +182,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
XGCValues val;
XGetGCValues(display, getGCForeground(c), GCForeground, &val);
switch (lw) {
case Painter::line_thin:
val.line_width = 0;
@ -187,7 +191,7 @@ GC LyXColorHandler::getGCLinepars(Painter::line_style ls,
val.line_width = 2;
break;
}
switch (ls) {
case Painter::line_solid:
val.line_style = LineSolid;
@ -234,8 +238,8 @@ void LyXColorHandler::updateColor (LColor::color c)
Painter::line_width(lw), c);
}
}
}
//
boost::scoped_ptr<LyXColorHandler> lyxColorHandler;

View File

@ -3,7 +3,7 @@
* This file is part of LyX, the document processor.
* Licence details can be found in the file COPYING.
*
* \author Angus Leeming
* \author Angus Leeming
*
* Full author contact details are available in file CREDITS
*/
@ -24,6 +24,9 @@
#include "gettext.h" // _()
#include "xforms_helpers.h" // formatted
#include "support/LAssert.h"
#include "BoostFormat.h"
#include FORMS_H_LOCATION
FeedbackController::FeedbackController()
@ -110,7 +113,7 @@ void FeedbackController::PrehandlerCB(FL_OBJECT * ob, int event, int key)
fl_get_winorigin(folder->window,
&(folder->x), &(folder->y));
}
}
if (message_widget_) {
@ -162,14 +165,13 @@ void FeedbackController::postMessage(string const & message)
{
lyx::Assert(message_widget_);
string str;
if (warning_posted_)
str = _("WARNING! ") + message;
else
str = message;
boost::format fmter = warning_posted_ ?
boost::format(_("WARNING! %1$s")) :
boost::format("%1$s");
int const width = message_widget_->w - 10;
str = formatted(str, width, FL_NORMAL_SIZE);
string const str = formatted(boost::io::str(fmter % message),
width, FL_NORMAL_SIZE);
fl_set_object_label(message_widget_, str.c_str());
FL_COLOR const label_color = warning_posted_ ? FL_RED : FL_LCOL;

View File

@ -39,6 +39,8 @@
#include "support/lyxlib.h" // for float_equal
#include "support/filetools.h" // for MakeAbsPath etc
#include "BoostFormat.h"
#include FORMS_H_LOCATION
using std::endl;
@ -89,7 +91,7 @@ void FormGraphics::build()
file_.reset(build_graphics_file(this));
// disable for read-only documents
bc().addReadOnly(file_->button_browse);
bc().addReadOnly(file_->button_browse);
bc().addReadOnly(file_->check_aspectratio);
bc().addReadOnly(file_->check_draft);
bc().addReadOnly(file_->check_nounzip);
@ -116,12 +118,12 @@ void FormGraphics::build()
// width default is scaling: use unsigned float filter
fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);
fl_set_input_maxchars(file_->input_height, SIZE_MAXDIGITS);
string const display_List =
_("Default|Monochrome|Grayscale|Color|Do not display");
fl_addto_choice(file_->choice_display, display_List.c_str());
string const width_list = _("Scale%%|") + choice_Length_All;
string const width_list = boost::io::str(boost::format(_("Scale%%|%1$s")) % choice_Length_All);
fl_addto_choice(file_->choice_width, width_list.c_str());
fl_addto_choice(file_->choice_height, choice_Length_All.c_str());
@ -145,8 +147,8 @@ void FormGraphics::build()
tooltips().init(file_->input_height, str);
str = _("Select unit for height.");
tooltips().init(file_->choice_height, str);
str = _("Do not distort the image. "
"Keep image within \"width\" by \"height\" and obey "
str = _("Do not distort the image. "
"Keep image within \"width\" by \"height\" and obey "
"aspect ratio.");
tooltips().init(file_->check_aspectratio, str);
str = _("Pass a filename like \"file.eps.gz\" to the LaTeX output. "
@ -239,7 +241,7 @@ void FormGraphics::build()
// set up the tooltips for the extra section
str = _("Insert the rotation angle in degrees. "
"Positive value rotates anti-clockwise, "
"Positive value rotates anti-clockwise, "
"negative value clockwise.");
tooltips().init(extra_->input_rotate_angle, str);
str = _("Insert the point of origin for rotation.");
@ -249,7 +251,7 @@ void FormGraphics::build()
str = _("Insert the optional subfigure caption.");
tooltips().init(extra_->input_subcaption, str);
str = _("Add any additional latex option, which is defined in the "
"graphicx-package and not mentioned in the gui's tabfolders.");
"graphicx-package and not mentioned in the gui's tabfolders.");
tooltips().init(extra_->input_special, str);
// add the different tabfolders
@ -286,7 +288,7 @@ void FormGraphics::apply()
if (igp.lyxscale == 0) {
igp.lyxscale = 100;
}
switch (fl_get_choice(file_->choice_display)) {
case 5:
igp.display = grfx::NoDisplay;
@ -325,7 +327,7 @@ void FormGraphics::apply()
// the bb section
if (!controller().bbChanged) {
// don't write anything
// don't write anything
igp.bb.erase();
} else {
// allow length + unit input only for x1 input field
@ -375,7 +377,7 @@ void FormGraphics::apply()
bb += "0";
else
bb += getLengthFromWidgets(bbox_->input_bb_y1,
bbox_->choice_bb_units);
bbox_->choice_bb_units);
igp.bb = bb;
}
@ -383,7 +385,7 @@ void FormGraphics::apply()
// the extra section
igp.rotateAngle = strToDbl(getString(extra_->input_rotate_angle));
// map angle into -360 (clock-wise) to +360 (counter clock-wise)
while (igp.rotateAngle <= -360.0) {
igp.rotateAngle += 360.0;
@ -452,7 +454,7 @@ void FormGraphics::update() {
bool const disable_height = !lyx::float_equal(igp.scale, 0.0, 0.05);
setEnabled(file_->input_height, !disable_height);
setEnabled(file_->choice_height, !disable_height);
fl_set_button(file_->check_aspectratio, igp.keepAspectRatio);
fl_set_button(file_->check_draft, igp.draft);
fl_set_button(file_->check_nounzip, igp.noUnzip);
@ -579,7 +581,7 @@ ButtonPolicy::SMInput FormGraphics::input(FL_OBJECT * ob, long)
bool const scaling = fl_get_choice(file_->choice_width) == 1;
setEnabled(file_->input_height, !scaling);
setEnabled(file_->choice_height, !scaling);
// allow only integer intput for scaling; float otherwise
if (scaling) {
fl_set_input_filter(file_->input_width, fl_unsigned_float_filter);

View File

@ -14,8 +14,6 @@
#pragma implementation
#endif
#include <algorithm>
#include "importer.h"
#include "converter.h"
#include "frontends/LyXView.h"
@ -27,6 +25,10 @@
#include "gettext.h"
#include "BufferView.h"
#include "BoostFormat.h"
#include <algorithm>
using std::vector;
using std::find;
@ -39,7 +41,7 @@ bool Importer::Import(LyXView * lv, string const & filename,
{
string const displaypath = MakeDisplayPath(filename);
ostringstream s1;
s1 << _("Importing") << ' ' << displaypath << "...";
s1 << boost::format(_("Importing %1$s...")) % displaypath;
lv->message(STRCONV(s1.str()));
string const lyxfile = ChangeExtension(filename, ".lyx");
@ -59,8 +61,8 @@ bool Importer::Import(LyXView * lv, string const & filename,
}
if (loader_format.empty()) {
Alert::alert(_("Cannot import file"),
_("No information for importing from ")
+ formats.prettyName(format));
boost::io::str(boost::format(_("No information for importing from %1$s"))
% formats.prettyName(format)));
return false;
}
} else

View File

@ -1,3 +1,14 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* insetparent.C (getScreenLabel): use boost::format
* insetgraphics.C (prepareFile): use boost::format
(ascii): ditto
* insetfloatlist.C (latex): use boost::format
* insetcaption.C (draw): use boost::format
2002-11-21 Dekel Tsur <dekelts@tau.ac.il>
* insettabular.C (tabularFeatures): Support for block alignment in fixed width

View File

@ -25,6 +25,8 @@
#include "gettext.h"
#include "support/lstrings.h"
#include "BoostFormat.h"
using std::ostream;
using std::endl;
@ -86,10 +88,10 @@ void InsetCaption::draw(BufferView * bv, LyXFont const & f,
// Discover the number...
// ...
string const num = "#";
string const num("#");
// Generate the label
string const label = _(fl) + " " + num + ":";
string const label = boost::io::str(boost::format("%1$s %2$s:") % _(fl) % num);
Painter & pain = bv->painter();
int const w = font_metrics::width(label, f);

View File

@ -25,6 +25,7 @@
#include "gettext.h"
#include "debug.h"
#include "BoostFormat.h"
using std::ostream;
using std::endl;
@ -124,8 +125,11 @@ int InsetFloatList::latex(Buffer const * buf, ostream & os, bool, bool) const
<< cit->second.listName() << "}\n";
}
} else {
os << "%%\\listof{" << getCmdName() << "}{"
<< _("List of ") << cit->second.name() << "}\n";
os << "%%\\listof{"
<< getCmdName()
<< "}{"
<< boost::format(_("List of %1$s")) % cit->second.name()
<< "}\n";
}
return 1;
}

View File

@ -92,6 +92,7 @@ TODO
#include <boost/weak_ptr.hpp>
#include <boost/bind.hpp>
#include <boost/signals/trackable.hpp>
#include "BoostFormat.h"
#include <algorithm> // For the std::max
@ -666,8 +667,8 @@ string const InsetGraphics::prepareFile(Buffer const * buf) const
one.startscript(Systemcall::Wait, command);
if (!IsFileReadable(ChangeExtension(outfile_base, to)))
Alert::alert(_("Cannot convert Image (not existing file?)"),
_("No information for converting from ")
+ from + _(" to ") + to);
boost::io::str(boost::format(_("No information for converting from %1$s to %2$s"))
% from % to));
}
return RemoveExtension(temp_file);
@ -756,7 +757,9 @@ int InsetGraphics::ascii(Buffer const *, ostream & os, int) const
// 1. Convert file to ascii using gifscii
// 2. Read ascii output file and add it to the output stream.
// at least we send the filename
os << '<' << _("Graphic file:") << params().filename << ">\n";
os << '<'
<< boost::format(_("Graphic file: %1$s")) % params().filename
<< ">\n";
return 0;
}

View File

@ -27,6 +27,8 @@
#include "buffer.h"
#include "gettext.h"
#include "BoostFormat.h"
using std::ostream;
@ -40,12 +42,12 @@ InsetParent::InsetParent(InsetCommandParams const & p, Buffer const & bf, bool)
string const InsetParent::getScreenLabel(Buffer const *) const
{
return string(_("Parent:")) + getContents();
return boost::io::str(boost::format(_("Parent: %1$s")) % getContents());
}
void InsetParent::edit(BufferView * bv, int, int, mouse_button::state)
{
{
bv->owner()->dispatch(FuncRequest(LFUN_CHILDOPEN, getContents()));
}

View File

@ -42,6 +42,7 @@
#include "frontends/Alert.h"
#include "frontends/lyx_gui.h"
#include "BoostFormat.h"
#include <boost/function.hpp>
#include <cstdlib>
@ -100,9 +101,7 @@ LyX::LyX(int & argc, char * argv[])
// other than documents
for (int argi = 1; argi < argc ; ++argi) {
if (argv[argi][0] == '-') {
lyxerr << _("Wrong command line option `")
<< argv[argi]
<< _("'. Exiting.") << endl;
lyxerr << boost::format(_("Wrong command line option `%1$s'. Exiting.")) % argv[argi] << endl;
exit(1);
}
}
@ -354,8 +353,7 @@ void LyX::init(bool gui)
<< "Giving up." << endl;
exit(1);
}
lyxerr << _("Using built-in default ")
<< LYX_DIR << _(" but expect problems.")
lyxerr << boost::format(_("Using built-in default %1$s but expect problems.")) % LYX_DIR
<< endl;
} else {
lyxerr << _("Expect problems.") << endl;
@ -604,14 +602,13 @@ void LyX::queryUserLyXDir(bool explicit_userdir)
return;
}
lyxerr << _("LyX: Creating directory ") << user_lyxdir
<< _(" and running configure...") << endl;
lyxerr << boost::format(_("LyX: Creating directory %1$s and running configure...")) % user_lyxdir << endl;
if (!createDirectory(user_lyxdir, 0755)) {
// Failed, let's use $HOME instead.
user_lyxdir = GetEnvPath("HOME");
lyxerr << _("Failed. Will use ") << user_lyxdir
<< _(" instead.") << endl;
lyxerr << boost::format(_("Failed. Will use %1$s instead.")) % user_lyxdir
<< endl;
return;
}
@ -632,7 +629,7 @@ bool LyX::readRcFile(string const & name)
<< " in " << lyxrc_path << endl;
if (lyxrc.read(lyxrc_path) < 0) {
Alert::alert(_("LyX Warning!"),
_("Error while reading ") + lyxrc_path + ".",
boost::io::str(boost::format(_("Error while reading %1$s.")) % lyxrc_path),
_("Using built-in defaults."));
return false;
}
@ -736,7 +733,7 @@ bool is_gui = true;
string batch;
/// return the the number of arguments consumed
typedef boost::function<int, string const &, string const &> cmd_helper;
typedef boost::function<int(string const &, string const &)> cmd_helper;
int parse_dbg(string const & arg, string const &)
{
@ -745,7 +742,7 @@ int parse_dbg(string const & arg, string const &)
Debug::showTags(lyxerr);
exit(0);
}
lyxerr << _("Setting debug level to ") << arg << endl;
lyxerr << boost::format(_("Setting debug level to %1$s")) % arg << endl;
lyxerr.level(Debug::value(arg));
Debug::showLevel(lyxerr, lyxerr.level());
return 1;

View File

@ -26,6 +26,8 @@
#include "support/lstrings.h"
#include "bufferparams.h" // stateText
#include "BoostFormat.h"
using std::ostream;
using std::endl;
@ -525,22 +527,24 @@ string const LyXFont::stateText(BufferParams * params) const
if (color() != LColor::inherit)
ost << lcolor.getGUIName(color()) << ", ";
if (emph() != INHERIT)
ost << _("Emphasis ")
<< _(GUIMiscNames[emph()]) << ", ";
ost << boost::format(_("Emphasis %1$s, "))
% _(GUIMiscNames[emph()]);
if (underbar() != INHERIT)
ost << _("Underline ")
<< _(GUIMiscNames[underbar()]) << ", ";
ost << boost::format(_("Underline %1$s, "))
% _(GUIMiscNames[underbar()]);
if (noun() != INHERIT)
ost << _("Noun ") << _(GUIMiscNames[noun()]) << ", ";
ost << boost::format(_("Noun %1$s, "))
% _(GUIMiscNames[noun()]);
if (bits == inherit)
ost << _("Default") << ", ";
if (!params || (language() != params->language))
ost << _("Language: ") << _(language()->display()) << ", ";
ost << boost::format(_("Language: %1$s, "))
% _(language()->display());
if (number() != OFF)
ost << _(" Number ") << _(GUIMiscNames[number()]);
ost << boost::format(_(" Number %1$s"))
% _(GUIMiscNames[number()]);
string buf(STRCONV(ost.str()));
buf = rtrim(buf, ", ");
string const buf = rtrim(STRCONV(ost.str()), ", ");
return buf;
}

View File

@ -69,6 +69,8 @@
#include "support/path.h"
#include "support/lyxfunctional.h"
#include "BoostFormat.h"
#include <ctime>
#include <clocale>
#include <cstdlib>
@ -946,8 +948,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
case LFUN_MENUWRITE:
if (!owner->buffer()->isUnnamed()) {
ostringstream s1;
s1 << _("Saving document") << ' '
<< MakeDisplayPath(owner->buffer()->fileName() + "...");
s1 << boost::format(_("Saving document %1$s..."))
% MakeDisplayPath(owner->buffer()->fileName());
owner->message(STRCONV(s1.str()));
MenuWrite(view(), owner->buffer());
s1 << _(" done.");
@ -1104,8 +1106,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
break;
}
ostringstream str;
str << _("Opening help file") << ' '
<< MakeDisplayPath(fname) << "...";
str << boost::format(_("Opening help file %1$s..."))
% MakeDisplayPath(fname);
owner->message(STRCONV(str.str()));
view()->buffer(bufferlist.loadLyXFile(fname, false));
owner->allowInput();
@ -1435,11 +1437,8 @@ void LyXFunc::dispatch(FuncRequest const & ev, bool verbose)
x11_name != lcolor.getX11Name(LColor::graphicsbg));
if (!lcolor.setColor(lyx_name, x11_name)) {
static string const err1 (N_("Set-color \""));
static string const err2 (
N_("\" failed - color is undefined "
"or may not be redefined"));
setErrorMessage(_(err1) + lyx_name + _(err2));
setErrorMessage(boost::io::str(boost::format(_("Set-color \"%1$s\" failed - color is undefined or may not be redefined")) % lyx_name));
break;
}
@ -1673,7 +1672,7 @@ void LyXFunc::open(string const & fname)
}
ostringstream str;
str << _("Opening document") << ' ' << disp_fn << "...";
str << boost::format(_("Opening document %1$s...")) % disp_fn;
owner->message(STRCONV(str.str()));
@ -1681,9 +1680,9 @@ void LyXFunc::open(string const & fname)
ostringstream str2;
if (openbuf) {
view()->buffer(openbuf);
str2 << _("Document") << ' ' << disp_fn << ' ' << _("opened.");
str2 << boost::format(_("Document %1$s opened.")) % disp_fn;
} else {
str2 << _("Could not open document") << ' ' << disp_fn;
str2 << boost::format(_("Could not open document %1$s")) % disp_fn;
}
owner->message(STRCONV(str2.str()));
}
@ -1708,8 +1707,7 @@ void LyXFunc::doImport(string const & argument)
initpath = trypath;
}
string const text = _("Select ") + formats.prettyName(format)
+ _(" file to import");
string const text = boost::io::str(boost::format(_("Select %1$s file to import")) % formats.prettyName(format));
FileDialog fileDlg(owner, text,
LFUN_IMPORT,

View File

@ -1,3 +1,7 @@
2002-11-21 Lars Gullik Bjønnes <larsbj@birdstep.com>
* formulamacro.C (prefix): use boost::format
2002-11-04 Dekel Tsur <dekelts@tau.ac.il>
* formulabase.C (lfunMouseRelease): Do not make the buffer dirty

View File

@ -40,6 +40,8 @@
#include "Lsstream.h"
#include "BoostFormat.h"
using std::ostream;
extern MathCursor * mathcursor;
@ -126,7 +128,7 @@ void InsetFormulaMacro::read(std::istream & is)
string InsetFormulaMacro::prefix() const
{
return string(" ") + _("Macro: ") + getInsetName() + ": ";
return boost::io::str(boost::format(_(" Macro: %1$s: ")) % getInsetName());
}

View File

@ -79,9 +79,8 @@ TocList const getTocList(Buffer const * buf)
ParConstIterator pit = buf->par_iterator_begin();
ParConstIterator end = buf->par_iterator_end();
for (; pit != end; ++pit) {
Paragraph const * par = *pit;
#ifdef WITH_WARNINGS
#warning bogus type (Lgb)
#endif