]> git.lyx.org Git - features.git/commitdiff
more cursor dispatch
authorAndré Pönitz <poenitz@gmx.net>
Tue, 3 Feb 2004 17:12:34 +0000 (17:12 +0000)
committerAndré Pönitz <poenitz@gmx.net>
Tue, 3 Feb 2004 17:12:34 +0000 (17:12 +0000)
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8396 a592a061-630c-0410-9148-cb99ea01b6c8

src/cursor.C
src/insets/insetcollapsable.C

index cf691e41d4d9759d350535236bbc709935f65a9f..244329093a47b6767712911872b37073c39bc487 100644 (file)
@@ -79,17 +79,15 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
 {
        //lyxerr << "\nLCursor::dispatch: cmd: " << cmd0 << endl << *this << endl;
        FuncRequest cmd = cmd0;
-
-       for (int i = cursor_.size() - 1; i >= 1; --i) {
-               current_ = i;
-               CursorSlice const & citem = cursor_[i];
-               lyxerr << "trying to dispatch to inset " << citem.inset_ << endl;
+       for (current_ = cursor_.size() - 1; current_ >= 1; --current_) {
+               lyxerr << "trying to dispatch to inset " << inset() << endl;
                DispatchResult res = inset()->dispatch(*this, cmd);
                if (res.dispatched()) {
-                       lyxerr << " successfully dispatched to inset " << citem.inset_ << endl;
+                       lyxerr << " successfully dispatched to inset " << inset() << endl;
                        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()) {
                        case FINISHED:
                                cmd = FuncRequest(LFUN_FINISHED_LEFT);
@@ -104,15 +102,16 @@ DispatchResult LCursor::dispatch(FuncRequest const & cmd0)
                                cmd = FuncRequest(LFUN_FINISHED_DOWN);
                                break;
                        default:
-                               lyxerr << "not handled on level " << i << " val: " << res.val() << endl;
+                               //lyxerr << "not handled on level " << current_
+                               //      << " val: " << res.val() << endl;
                                break;
                }
        }
-       current_ = 0;
+       BOOST_ASSERT(current_ == 0);
        lyxerr << "trying to dispatch to main text " << bv_->text()
                << " with cursor: " << *this << endl;
        DispatchResult res = bv_->text()->dispatch(*this, cmd);
-       lyxerr << "   result: " << res.val() << endl;
+       //lyxerr << "   result: " << res.val() << endl;
        return res;
 }
 
index fa2e8585258ea99cfbe8b4028633488edfe501c9..59857a0a1bb1ef63b29663450ebaf7715080ac89 100644 (file)
@@ -137,7 +137,6 @@ int InsetCollapsable::height_collapsed() const
 
 void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
 {
-       //lyxerr << "InsetCollapsable::metrics:  width: " << mi.base.textwidth << endl;
        if (status_ == Inlined) {
                inset.metrics(mi, dim);
        } else {
@@ -150,7 +149,6 @@ void InsetCollapsable::metrics(MetricsInfo & mi, Dimension & dim) const
                }
        }
        dim_ = dim;
-       //lyxerr << "InsetCollapsable::metrics:  dim.wid: " << dim.wid << endl;
 }
 
 
@@ -217,8 +215,6 @@ InsetCollapsable::lfunMouseRelease(LCursor & cur, FuncRequest const & cmd)
                if (hitButton(cmd)) {
                        lyxerr << "InsetCollapsable::lfunMouseRelease 2" << endl;
                        setStatus(Collapsed);
-                       // drop one level
-                       cur.bv().cursor() = cur;
                        return DispatchResult(false, FINISHED_RIGHT);
                }
                lyxerr << "InsetCollapsable::lfunMouseRelease 3" << endl;