some cursor correctiosn when closing a collapsable inset

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8070 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2003-11-10 14:29:39 +00:00
parent de49e02934
commit 7915d583c2
3 changed files with 45 additions and 33 deletions

View File

@ -948,12 +948,25 @@ bool BufferView::Pimpl::workAreaDispatch(FuncRequest const & cmd)
if (res.update())
bv_->update();
res.update(false);
switch (res.val()) {
case FINISHED:
case FINISHED_RIGHT:
case FINISHED_UP:
case FINISHED_DOWN:
theTempCursor.pop();
bv_->cursor() = theTempCursor;
bv_->cursor().innerText()->setCursorFromCoordinates(cmd.x, cmd.y);
return true;
default:
lyxerr << "not dispatched by inner inset val: " << res.val() << endl;
break;
}
}
// otherwise set cursor to surrounding LyXText
if (!res.dispatched()) {
lyxerr << "cursor is: " << bv_->cursor() << endl;
lyxerr << "dispatching to surrounding LyXText "
lyxerr << "dispatching " << cmd1 << " to surrounding LyXText "
<< bv_->cursor().innerText() << endl;
bv_->cursor().innerText()->dispatch(cmd1);
//return DispatchResult(true, true);

View File

@ -25,8 +25,8 @@
the inset.
FINISHED_DOWN = FINISHED, but move the cursor DOWN from
the inset.
FINISHED_POP = FINISHED, but move the cursor DOWN from
the inset.
FINISHED_POP = FINISHED, but move the cursor out the inset
(possibly more than one level)
UNDISPATCHED = the action was not catched, it should be
dispatched by lower level insets
*/

View File

@ -192,43 +192,42 @@ FuncRequest InsetCollapsable::adjustCommand(FuncRequest const & cmd)
DispatchResult InsetCollapsable::lfunMouseRelease(FuncRequest const & cmd)
{
DispatchResult result(true, true);
BufferView * bv = cmd.view();
if (cmd.button() == mouse_button::button3) {
lyxerr << "InsetCollapsable::lfunMouseRelease 0" << endl;
if (hitButton(cmd))
showInsetDialog(bv);
} else {
if (collapsed_) {
lyxerr << "InsetCollapsable::lfunMouseRelease 1" << endl;
collapsed_ = false;
edit(bv, true);
bv->buffer()->markDirty();
bv->update();
return result;
}
if (hitButton(cmd)) {
if (collapsed_) {
lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl;
collapsed_ = false;
} else {
collapsed_ = true;
result.update(true);
result.val(FINISHED_RIGHT);
return result;
}
result.update(true);
bv->update();
bv->buffer()->markDirty();
} else if (!collapsed_ && cmd.y > button_dim.y2) {
lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl;
result = inset.dispatch(adjustCommand(cmd));
}
return DispatchResult(true, true);
}
lyxerr << "InsetCollapsable::lfunMouseRelease 4" << endl;
return result;
if (collapsed_) {
lyxerr << "InsetCollapsable::lfunMouseRelease 1" << endl;
collapsed_ = false;
edit(bv, true);
bv->buffer()->markDirty();
bv->update();
return DispatchResult(true, true);
}
if (hitButton(cmd)) {
if (!collapsed_) {
collapsed_ = true;
lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl;
bv->update();
return DispatchResult(false, FINISHED_RIGHT);
}
collapsed_ = false;
bv->update();
bv->buffer()->markDirty();
lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl;
} else if (!collapsed_ && cmd.y > button_dim.y2) {
lyxerr << "InsetCollapsable::lfunMouseRelease 4" << endl;
return inset.dispatch(adjustCommand(cmd));
}
lyxerr << "InsetCollapsable::lfunMouseRelease 5" << endl;
return DispatchResult(true, true);
}