More accurate toc navigation (LFUN_PARAGRAPH_GOTO).

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@24798 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Abdelrazak Younes 2008-05-16 12:48:13 +00:00
parent fc22b68e37
commit 2dfc84a22c
3 changed files with 7 additions and 7 deletions

View File

@ -1055,7 +1055,8 @@ bool BufferView::dispatch(FuncRequest const & cmd)
}
case LFUN_PARAGRAPH_GOTO: {
int const id = convert<int>(to_utf8(cmd.argument()));
int const id = convert<int>(cmd.getArg(0));
int const pos = convert<int>(cmd.getArg(1));
int i = 0;
for (Buffer * b = &buffer_; i == 0 || b != &buffer_;
b = theBufferList().next(b)) {
@ -1072,6 +1073,7 @@ bool BufferView::dispatch(FuncRequest const & cmd)
if (b == &buffer_) {
// Set the cursor
dit.pos() = pos;
setCursor(dit);
processUpdateFlags(Update::Force | Update::FitCursor);
} else {

View File

@ -76,7 +76,9 @@ docstring const TocItem::asString() const
FuncRequest TocItem::action() const
{
return FuncRequest(LFUN_PARAGRAPH_GOTO, convert<string>(id()));
string const arg = convert<string>(dit_.paragraph().id())
+ ' ' + convert<string>(dit_.pos());
return FuncRequest(LFUN_PARAGRAPH_GOTO, arg);
}

View File

@ -219,13 +219,9 @@ void TocModels::goTo(int type, QModelIndex const & index) const
}
LASSERT(type >= 0 && type < int(models_.size()), /**/);
TocIterator const it = models_[type]->tocIterator(index);
LYXERR(Debug::GUI, "TocModels::goTo " << it->str());
string const tmp = convert<string>(it->id());
dispatch(FuncRequest(LFUN_PARAGRAPH_GOTO, tmp));
dispatch(it->action());
}