mirror of
https://git.lyx.org/repos/lyx.git
synced 2024-11-22 18:08:10 +00:00
more dispatch work
git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@8001 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
parent
fa7aa5c7d9
commit
1d7a715329
@ -38,6 +38,9 @@ src/frontends/controllers/helper_funcs.C
|
||||
src/frontends/gnome/GLog.C
|
||||
src/frontends/gtk/Dialogs.C
|
||||
src/frontends/gtk/GBC.h
|
||||
src/frontends/gtk/GMathPanel.C
|
||||
src/frontends/gtk/GTableCreate.C
|
||||
src/frontends/gtk/GUrl.C
|
||||
src/frontends/qt2/Alert_pimpl.C
|
||||
src/frontends/qt2/BulletsModule.C
|
||||
src/frontends/qt2/Dialogs.C
|
||||
@ -162,6 +165,7 @@ src/insets/insetmarginal.C
|
||||
src/insets/insetminipage.C
|
||||
src/insets/insetnote.C
|
||||
src/insets/insetoptarg.C
|
||||
src/insets/insetpagebreak.C
|
||||
src/insets/insetref.C
|
||||
src/insets/insettabular.C
|
||||
src/insets/insettext.C
|
||||
|
@ -1279,7 +1279,7 @@ bool BufferView::Pimpl::dispatch(FuncRequest const & ev_in)
|
||||
break;
|
||||
|
||||
default:
|
||||
return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_));
|
||||
return bv_->getLyXText()->dispatch(FuncRequest(ev, bv_)) >= DISPATCHED;
|
||||
} // end of switch
|
||||
|
||||
return true;
|
||||
|
@ -1,17 +1,28 @@
|
||||
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* text3.C:
|
||||
* text2.C:
|
||||
* text.C:
|
||||
* lyxtext.h:
|
||||
* lyxfunc.C:
|
||||
* cursor.C:
|
||||
* dispatchresult.h: rename DISPATCHED_POP to FINISHED_POP, remove
|
||||
operator dispatch_result_t, and operators for == != and >=
|
||||
|
||||
* cursor.C (dispatch): adjust for operator dispatch_result_t
|
||||
removal. comment out call to update
|
||||
|
||||
* BufferView_pimpl.C (dispatch): dont implicit covert to bool
|
||||
|
||||
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* text3.C:
|
||||
* text2.C:
|
||||
* text.C:
|
||||
* lyxtext.h:
|
||||
* lyxfunc.C:
|
||||
* cursor.C:
|
||||
* BufferView_pimpl.C: dispatch_result -> DispatchResult changes.
|
||||
(dispatch):
|
||||
|
||||
* dispatchresult.h: new file, DispatchResult broken out of
|
||||
insets/insetbase.h
|
||||
insets/insetbase.h
|
||||
|
||||
* Makefile.am (lyx_SOURCES): add dispatchresult.h
|
||||
* Makefile.am (lyx_SOURCES): add dispatchresult.h
|
||||
|
||||
2003-10-28 Alfredo Braunstein <abraunst@libero.it>
|
||||
|
||||
|
@ -30,17 +30,17 @@ DispatchResult Cursor::dispatch(FuncRequest const & cmd)
|
||||
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: " << res << endl;
|
||||
lyxerr << " result: " << res.val() << endl;
|
||||
|
||||
if (res == DISPATCHED) {
|
||||
//update();
|
||||
return DISPATCHED;
|
||||
}
|
||||
|
||||
|
||||
if (res == DISPATCHED_NOUPDATE)
|
||||
return DISPATCHED;
|
||||
|
||||
lyxerr << "# unhandled result: " << res << endl;
|
||||
lyxerr << "# unhandled result: " << res.val() << endl;
|
||||
}
|
||||
return UNDISPATCHED;
|
||||
}
|
||||
|
@ -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
|
||||
|
@ -1,5 +1,12 @@
|
||||
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* insettext.C (lfunMouseRelease): dont use implicit conversion to bool
|
||||
(priv_dispatch): adjust for operator dispatch_result_t removal
|
||||
|
||||
* insettabular.C (lfunMouseRelease): put the result of a dispatch
|
||||
in a DispatchResult, adjust accordingly.
|
||||
(priv_dispatch): use strange >= construct... (will be removed later)
|
||||
|
||||
* most insets: dispatch_result -> DispatchResult
|
||||
|
||||
* insetbase.h: move DispatchResult out to dispatchresult.h
|
||||
|
@ -598,18 +598,18 @@ void InsetTabular::lfunMousePress(FuncRequest const & cmd)
|
||||
|
||||
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 const & cmd,
|
||||
}
|
||||
break;
|
||||
}
|
||||
if (result < FINISHED) {
|
||||
if (!(result >= FINISHED)) {
|
||||
if (!the_locking_inset && bv->fitCursor())
|
||||
updateLocal(bv);
|
||||
} else
|
||||
|
@ -547,7 +547,7 @@ bool InsetText::lfunMouseRelease(FuncRequest const & cmd)
|
||||
|
||||
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(FuncRequest const & cmd)
|
||||
|
||||
// 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 const & cmd,
|
||||
return result;
|
||||
}
|
||||
if (result >= FINISHED) {
|
||||
switch (result) {
|
||||
switch (result.val()) {
|
||||
case FINISHED_RIGHT:
|
||||
moveRightIntern(bv, false, false);
|
||||
result = DISPATCHED;
|
||||
|
@ -1,5 +1,9 @@
|
||||
2003-10-29 Lars Gullik Bjønnes <larsbj@gullik.net>
|
||||
|
||||
* math_hullinset.C (priv_dispatch):
|
||||
* math_gridinset.C (priv_dispatch):
|
||||
* math_cursor.C (dispatch): DISPATCHED_POP -> FINISHED_POP
|
||||
|
||||
* math_scriptinset.h: change dispatch to priv_dispatch and make it
|
||||
protected
|
||||
|
||||
|
@ -1439,7 +1439,7 @@ DispatchResult MathCursor::dispatch(FuncRequest const & cmd)
|
||||
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();
|
||||
}
|
||||
|
@ -1072,12 +1072,12 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
|
||||
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_dispatch(FuncRequest const & cmd,
|
||||
pos = cell(idx).size();
|
||||
|
||||
//mathcursor->normalize();
|
||||
return DISPATCHED_POP;
|
||||
return FINISHED_POP;
|
||||
}
|
||||
|
||||
case LFUN_TABULAR_FEATURE: {
|
||||
@ -1153,7 +1153,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
|
||||
else
|
||||
return UNDISPATCHED;
|
||||
lyxerr << "returning DISPATCHED_POP" << endl;
|
||||
return DISPATCHED_POP;
|
||||
return FINISHED_POP;
|
||||
}
|
||||
|
||||
case LFUN_PASTE: {
|
||||
@ -1184,7 +1184,7 @@ DispatchResult MathGridInset::priv_dispatch(FuncRequest const & cmd,
|
||||
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:
|
||||
|
@ -782,7 +782,7 @@ DispatchResult MathHullInset::priv_dispatch
|
||||
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_dispatch
|
||||
|
||||
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_dispatch
|
||||
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:
|
||||
|
Loading…
Reference in New Issue
Block a user