have row information on state line + one more bformat variant

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@7663 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Lars Gullik Bjønnes 2003-09-04 14:33:16 +00:00
parent 781e0ef62e
commit 2faa06b829
5 changed files with 28 additions and 0 deletions

View File

@ -10,6 +10,10 @@
up the dialogs. Cursor has to be in front of the inset (i.e.
start of row) for this to function.
2003-09-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* bufferview_funcs.C (currentState): output row information
2003-09-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* bufferview_funcs.C (currentState): output paragraph position

View File

@ -364,6 +364,8 @@ string const currentState(BufferView * bv)
#ifdef DEVEL_VERSION
state << _(", Paragraph: ") << text->cursor.par()->id();
state << _(", Position: ") << text->cursor.pos();
RowList::iterator rit = text->cursorRow();
state << bformat(_(", Row b:%1$d e:%2$d"), rit->pos(), rit->end());
state << _(", Inset: ") <<
(text->cursor.par()->inInset() ? text->cursor.par()->inInset()->id() : -1);
#endif

View File

@ -1,3 +1,7 @@
2003-09-04 Lars Gullik Bjønnes <larsbj@lyx.org>
* lstrings.[Ch] (bformat): add a variant taking two ints.
2003-09-04 Angus Leeming <leeming@lyx.org>
* filetools.h:

View File

@ -627,6 +627,12 @@ string bformat(string const & fmt, string const & arg1, string const & arg2)
}
string bformat(string const & fmt, int arg1, int arg2)
{
return STRCONV((boost::format(STRCONV(fmt)) % arg1 % arg2).str());
}
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3)
{
@ -671,6 +677,16 @@ string bformat(string const & fmt, string const & arg1, string const & arg2)
}
string bformat(string const & fmt, int arg1, int arg2)
{
Assert(contains(fmt, "%1$d"));
Assert(contains(fmt, "%2$d"));
string str = subst(fmt, "%1$d", arg1);
str = subst(str, "%2$d", arg2);
return subst(str, "%%", "%");
}
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3)
{

View File

@ -206,6 +206,8 @@ string const getStringFromVector(std::vector<string> const & vec,
string bformat(string const & fmt, string const & arg1);
// arguments %1$s and %2$s
string bformat(string const & fmt, string const & arg1, string const & arg2);
// arguments %1$d and %2$d
string bformat(string const & fmt, int arg1, int arg2);
// arguments %1$s and %2$s and %3$s
string bformat(string const & fmt, string const & arg1, string const & arg2,
string const & arg3);