Slowly - slowly getting there.
? doit.sh
Index: BufferView_pimpl.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/BufferView_pimpl.C,v
retrieving revision 1.448
diff -u -p -r1.448 BufferView_pimpl.C
--- BufferView_pimpl.C 29 Oct 2003 10:47:11 -0000 1.448
+++ BufferView_pimpl.C 29 Oct 2003 12:52:28 -0000
@@ -1279,7 +1279,7 @@ bool BufferView::Pimpl::dispatch(FuncReq
break;
default:
- return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_));
+ return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DISPATCHED;
} // end of switch
return true;
Index: cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/cursor.C,v
retrieving revision 1.5
diff -u -p -r1.5 cursor.C
--- cursor.C 29 Oct 2003 12:18:06 -0000 1.5
+++ cursor.C 29 Oct 2003 12:52:28 -0000
@@ -30,17 +30,17 @@ DispatchResult Cursor::dispatch(FuncRequ
for (int i = data_.size() - 1; i >= 0; --i) {
lyxerr << "trying to dispatch to inset" << data_[i].inset_ << endl;
DispatchResult res = data_[i].inset_->dispatch(cmd);
- lyxerr << " result: " << result << endl;
+ lyxerr << " result: " << res.val() << endl;
if (res == DISPATCHED) {
- update();
+ //update();
return DISPATCHED;
}
-
+
if (res == DISPATCHED_NOUPDATE)
return DISPATCHED;
- lyxerr << "# unhandled result: " << res << endl;
+ lyxerr << "# unhandled result: " << res.val() << endl;
}
return UNDISPATCHED;
}
Index: dispatchresult.h
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/dispatchresult.h,v
retrieving revision 1.1
diff -u -p -r1.1 dispatchresult.h
--- dispatchresult.h 29 Oct 2003 10:47:12 -0000 1.1
+++ dispatchresult.h 29 Oct 2003 12:52:28 -0000
@@ -36,7 +36,7 @@ enum dispatch_result_t {
FINISHED_RIGHT,
FINISHED_UP,
FINISHED_DOWN,
- DISPATCHED_POP
+ FINISHED_POP
};
/** \c DispatchResult is a wrapper for dispatch_result_t.
@@ -44,12 +44,36 @@ enum dispatch_result_t {
* having to expose insetbase.h.
*/
class DispatchResult {
- dispatch_result_t val_;
public:
DispatchResult()
: val_(UNDISPATCHED) {}
DispatchResult(dispatch_result_t val) : val_(val) {}
- operator dispatch_result_t() const{ return val_; }
+ dispatch_result_t val() const { return val_; }
+private:
+ dispatch_result_t val_;
};
+
+
+inline
+bool operator==(DispatchResult const & lhs, DispatchResult const & rhs)
+{
+ return lhs.val() == rhs.val();
+}
+
+
+inline
+bool operator!=(DispatchResult const & lhs, DispatchResult const & rhs)
+{
+ return !(lhs == rhs);
+}
+
+
+// This operator is temporary, will be removed with the introduction of
+// a status field in DispatchResult.
+inline
+bool operator>=(DispatchResult const & lhs, DispatchResult const & rhs)
+{
+ return lhs.val() >= rhs.val();
+}
#endif // DISPATCH_RESULT_H
Index: insets/insettabular.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettabular.C,v
retrieving revision 1.356
diff -u -p -r1.356 insettabular.C
--- insets/insettabular.C 29 Oct 2003 10:47:18 -0000 1.356
+++ insets/insettabular.C 29 Oct 2003 12:52:29 -0000
@@ -598,18 +598,18 @@ void InsetTabular::lfunMousePress(FuncRe
bool InsetTabular::lfunMouseRelease(FuncRequest const & cmd)
{
- bool ret = false;
+ DispatchResult ret = UNDISPATCHED;
if (the_locking_inset) {
FuncRequest cmd1 = cmd;
cmd1.x -= inset_x;
cmd1.y -= inset_y;
ret = the_locking_inset->dispatch(cmd1);
}
- if (cmd.button() == mouse_button::button3 && !ret) {
+ if (cmd.button() == mouse_button::button3 && ret == UNDISPATCHED) {
InsetTabularMailer(*this).showDialog(cmd.view());
return true;
}
- return ret;
+ return ret >= DISPATCHED;
}
@@ -1111,7 +1111,7 @@ InsetTabular::priv_dispatch(FuncRequest
}
break;
}
- if (result < FINISHED) {
+ if (!(result >= FINISHED)) {
if (!the_locking_inset && bv->fitCursor())
updateLocal(bv);
} else
Index: insets/insettext.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/insets/insettext.C,v
retrieving revision 1.515
diff -u -p -r1.515 insettext.C
--- insets/insettext.C 29 Oct 2003 10:47:19 -0000 1.515
+++ insets/insettext.C 29 Oct 2003 12:52:30 -0000
@@ -547,7 +547,7 @@ bool InsetText::lfunMouseRelease(FuncReq
no_selection = true;
if (the_locking_inset)
- return the_locking_inset->dispatch(cmd1);
+ return the_locking_inset->dispatch(cmd1) >= DISPATCHED;
int tmp_x = cmd.x;
int tmp_y = cmd.y + dim_.asc - bv->top_y();
@@ -557,7 +557,7 @@ bool InsetText::lfunMouseRelease(FuncReq
// We still need to deal properly with the whole relative vs.
// absolute mouse co-ords thing in a realiable, sensible way
- bool ret = inset->dispatch(cmd1);
+ bool ret = inset->dispatch(cmd1) >= DISPATCHED;
updateLocal(bv, false);
return ret;
}
@@ -687,7 +687,7 @@ InsetText::priv_dispatch(FuncRequest con
return result;
}
if (result >= FINISHED) {
- switch (result) {
+ switch (result.val()) {
case FINISHED_RIGHT:
moveRightIntern(bv, false, false);
result = DISPATCHED;
Index: mathed/math_cursor.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_cursor.C,v
retrieving revision 1.364
diff -u -p -r1.364 math_cursor.C
--- mathed/math_cursor.C 29 Oct 2003 10:47:19 -0000 1.364
+++ mathed/math_cursor.C 29 Oct 2003 12:52:30 -0000
@@ -1439,7 +1439,7 @@ DispatchResult MathCursor::dispatch(Func
CursorPos & pos = Cursor_[i];
DispatchResult res = pos.inset_->dispatch(cmd, pos.idx_, pos.pos_);
if (res != UNDISPATCHED) {
- if (res == DISPATCHED_POP) {
+ if (res == FINISHED_POP) {
Cursor_.shrink(i + 1);
selClear();
}
Index: mathed/math_gridinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_gridinset.C,v
retrieving revision 1.127
diff -u -p -r1.127 math_gridinset.C
--- mathed/math_gridinset.C 29 Oct 2003 10:47:21 -0000 1.127
+++ mathed/math_gridinset.C 29 Oct 2003 12:52:30 -0000
@@ -1072,12 +1072,12 @@ DispatchResult MathGridInset::priv_dispa
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
- return DISPATCHED_POP;
+ return FINISHED_POP;
case LFUN_CELL_SPLIT:
//recordUndo(bv, Undo::ATOMIC);
splitCell(idx, pos);
- return DISPATCHED_POP;
+ return FINISHED_POP;
case LFUN_BREAKLINE: {
//recordUndo(bv, Undo::INSERT);
@@ -1096,7 +1096,7 @@ DispatchResult MathGridInset::priv_dispa
pos = cell(idx).size();
//mathcursor->normalize();
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
case LFUN_TABULAR_FEATURE: {
@@ -1153,7 +1153,7 @@ DispatchResult MathGridInset::priv_dispa
else
return UNDISPATCHED;
lyxerr << "returning DISPATCHED_POP" << endl;
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
case LFUN_PASTE: {
@@ -1184,7 +1184,7 @@ DispatchResult MathGridInset::priv_dispa
for (col_type c = 0; c < grid.ncols(); ++c)
cell(i).append(grid.cell(grid.index(r, c)));
}
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
default:
Index: mathed/math_hullinset.C
===================================================================
RCS file: /usr/local/lyx/cvsroot/lyx-devel/src/mathed/math_hullinset.C,v
retrieving revision 1.98
diff -u -p -r1.98 math_hullinset.C
--- mathed/math_hullinset.C 29 Oct 2003 10:47:21 -0000 1.98
+++ mathed/math_hullinset.C 29 Oct 2003 12:52:30 -0000
@@ -782,7 +782,7 @@ DispatchResult MathHullInset::priv_dispa
mutate("eqnarray");
idx = 1;
pos = 0;
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
return MathGridInset::priv_dispatch(cmd, idx, pos);
@@ -837,7 +837,7 @@ DispatchResult MathHullInset::priv_dispa
case LFUN_MATH_EXTERN:
doExtern(cmd, idx, pos);
- return DISPATCHED_POP;
+ return FINISHED_POP;
case LFUN_MATH_MUTATE: {
lyxerr << "Hull: MUTATE: " << cmd.argument << endl;
@@ -849,14 +849,14 @@ DispatchResult MathHullInset::priv_dispa
idx = nargs() - 1;
if (pos > cell(idx).size())
pos = cell(idx).size();
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
case LFUN_MATH_DISPLAY: {
mutate(type_ == "simple" ? "equation" : "simple");
idx = 0;
pos = cell(idx).size();
- return DISPATCHED_POP;
+ return FINISHED_POP;
}
default:
--
Lgb