more cursor dispatch

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8396 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
André Pönitz 2004-02-03 17:12:34 +00:00
parent 905dd033d3
commit 62e4adaef2
2 changed files with 9 additions and 14 deletions

View File

@ -79,17 +79,15 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
{ {
//lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl; //lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
FuncRequest cmd = cmd0; FuncRequest cmd = cmd0;
for (current_ = cursor_.size() - 1; current_ >= 1; --current_) {
for (int i = cursor_.size() - 1; i >= 1; --i) { lyxerr << "trying to dispatch to inset " << inset() << endl;
current_ = i;
CursorSlice const & citem = cursor_[i];
lyxerr << "trying to dispatch to inset " << citem.inset_ << endl;
DispatchResult res = inset()->dispatch(*this, cmd); DispatchResult res = inset()->dispatch(*this, cmd);
if (res.dispatched()) { if (res.dispatched()) {
lyxerr << " successfully dispatched to inset " << citem.inset_ << endl; lyxerr << " successfully dispatched to inset " << inset() << endl;
return DispatchResult(true, true); return DispatchResult(true, true);
} }
// remove one level of cursor // "Mutate" the request for semi-handled requests that need
// additional handling in outer levels.
switch (res.val()) { switch (res.val()) {
case FINISHED: case FINISHED:
cmd = FuncRequest(LFUN_FINISHED_LEFT); cmd = FuncRequest(LFUN_FINISHED_LEFT);
@ -104,15 +102,16 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
cmd = FuncRequest(LFUN_FINISHED_DOWN); cmd = FuncRequest(LFUN_FINISHED_DOWN);
break; break;
default: default:
lyxerr << "not handled on level " << i << " val: " << res.val() << endl; //lyxerr << "not handled on level " << current_
// << " val: " << res.val() << endl;
break; break;
} }
} }
current_ = 0; BOOST_ASSERT(current_ == 0);
lyxerr << "trying to dispatch to main text " << bv_->text() lyxerr << "trying to dispatch to main text " << bv_->text()
<< " with cursor: " << *this << endl; << " with cursor: " << *this << endl;
DispatchResult res = bv_->text()->dispatch(*this, cmd); DispatchResult res = bv_->text()->dispatch(*this, cmd);
lyxerr << " result: " << res.val() << endl; //lyxerr << " result: " << res.val() << endl;
return res; return res;
} }

View File

@ -137,7 +137,6 @@ int InsetCollapsable::height_collapsed() const
void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
{ {
//lyxerr << "InsetCollapsable::metrics: width: " << mi.base.textwidth << endl;
if (status_ == Inlined) { if (status_ == Inlined) {
inset.metrics(mi, dim); inset.metrics(mi, dim);
} else { } else {
@ -150,7 +149,6 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
} }
} }
dim_ = dim; dim_ = dim;
//lyxerr << "InsetCollapsable::metrics: dim.wid: " << dim.wid << endl;
} }
@ -217,8 +215,6 @@ InsetCollapsable::lfunMouseRelease(LCursor & cur, FuncRequest const & cmd)
if (hitButton(cmd)) { if (hitButton(cmd)) {
lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl; lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl;
setStatus(Collapsed); setStatus(Collapsed);
// drop one level
cur.bv().cursor() = cur;
return DispatchResult(false, FINISHED_RIGHT); return DispatchResult(false, FINISHED_RIGHT);
} }
lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl; lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl;