From: Jean-Marc Lasgouttes Date: Thu, 2 Dec 2004 11:32:14 +0000 (+0000) Subject: fix recent bug where too many lfuns got disabled;fix minibuffer message when a comman... X-Git-Tag: 1.6.10~14772 X-Git-Url: https://git.lyx.org/gitweb/?a=commitdiff_plain;h=e78648a4f5d59f07896880f5042f2e6ba4d92ad7;p=lyx.git fix recent bug where too many lfuns got disabled;fix minibuffer message when a command is disabled git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@9330 a592a061-630c-0410-9148-cb99ea01b6c8 --- diff --git a/src/ChangeLog b/src/ChangeLog index 44351a0565..0d6ed80ef7 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,17 @@ +2004-12-01 Jean-Marc Lasgouttes + + * lyxfunc.C (getStatus): do not lose previous information when + calling BufferView::getStatus; do not set a default "Command + disabled" message at the beginning, but just before returning. + +2004-11-30 Georg Baum + + * cursor.h (getStatus): add better comment from src/cursor.C + +2004-11-30 Jean-Marc Lasgouttes + + * text3.C (getStatus): return false when the lfun is not handled + 2004-11-29 Jean-Marc Lasgouttes * broken_headers.h: remove @@ -21,7 +35,7 @@ * bufferview_funcs.[Ch]: introduce coordOffset, getPos, status, CurStatus enum. - + * coordcache.[Ch]: add paragraph cache and helpers * CursorSlice.[Ch]: rename CursorSlice::par to CursorSlice::pit, diff --git a/src/cursor.h b/src/cursor.h index 01c4d82432..fa90fd6ad9 100644 --- a/src/cursor.h +++ b/src/cursor.h @@ -42,7 +42,12 @@ public: void dispatch(FuncRequest const & cmd); /// get the resut of the last dispatch DispatchResult result() const; - /// are we willing to handle this event? + /** + * \returns true if this function made a definitive decision on + * whether the inset at this cursor position wants to handle the + * request \p cmd or not. The result of this decision is put into + * \p status. + */ bool getStatus(FuncRequest const & cmd, FuncStatus & flag); /// add a new cursor slice diff --git a/src/insets/ChangeLog b/src/insets/ChangeLog index 8757cc1f9f..7dad33cc99 100644 --- a/src/insets/ChangeLog +++ b/src/insets/ChangeLog @@ -1,3 +1,7 @@ +2004-11-30 Georg Baum + + * insetbase.h (getStatus): add better comment from src/cursor.C + 2004-11-26 Alfredo Braunstein * insettabular.[Ch]: adjust, introduce "do not draw diff --git a/src/insets/insetbase.h b/src/insets/insetbase.h index 431d75c5b7..dd79ee93e5 100644 --- a/src/insets/insetbase.h +++ b/src/insets/insetbase.h @@ -79,9 +79,13 @@ public: /// true for 'math' math inset, but not for e.g. mbox virtual bool inMathed() const { return false; } - // the real dispatcher + /// the real dispatcher void dispatch(LCursor & cur, FuncRequest & cmd); - /// do we want to handle this event? + /** + * \returns true if this function made a definitive decision on + * whether the inset wants to handle the request \p cmd or not. + * The result of this decision is put into \p status. + */ virtual bool getStatus(LCursor & cur, FuncRequest const & cmd, FuncStatus & status) const; diff --git a/src/lyxfunc.C b/src/lyxfunc.C index 56a79f8ab6..1e08a9708f 100644 --- a/src/lyxfunc.C +++ b/src/lyxfunc.C @@ -308,10 +308,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const return flag; } - // the default error message if we disable the command - flag.message(N_("Command disabled")); - if (!flag.enabled()) + if (!flag.enabled()) { + if (flag.message().empty()) + flag.message(N_("Command disabled")); return flag; + } // Check whether we need a buffer if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) { @@ -523,7 +524,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const default: if (!cur.getStatus(cmd, flag)) - flag = view()->getStatus(cmd); + flag |= view()->getStatus(cmd); } if (!enable) @@ -537,7 +538,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const flag.enabled(false); } - //lyxerr << "LyXFunc::getStatus: got: " << flag.enabled() << endl; + // the default error message if we disable the command + if (!flag.enabled() && flag.message().empty()) + flag.message(N_("Command disabled")); + return flag; } diff --git a/src/text3.C b/src/text3.C index 11f4588bff..5f37f7de5b 100644 --- a/src/text3.C +++ b/src/text3.C @@ -1627,7 +1627,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd) bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, - FuncStatus & flag) const + FuncStatus & flag) const { BOOST_ASSERT(cur.text() == this); LyXFont const & font = real_current_font; @@ -1969,8 +1969,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, break; default: - enable = false; - break; + return false; } flag.enabled(enable); return true;