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
This commit is contained in:
Jean-Marc Lasgouttes 2004-12-02 11:32:14 +00:00
parent 55069dd3ab
commit e78648a4f5
6 changed files with 42 additions and 12 deletions

View File

@ -1,3 +1,17 @@
2004-12-01 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* 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 <Georg.Baum@post.rwth-aachen.de>
* cursor.h (getStatus): add better comment from src/cursor.C
2004-11-30 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* text3.C (getStatus): return false when the lfun is not handled
2004-11-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org> 2004-11-29 Jean-Marc Lasgouttes <lasgouttes@lyx.org>
* broken_headers.h: remove * broken_headers.h: remove
@ -21,7 +35,7 @@
* bufferview_funcs.[Ch]: introduce coordOffset, getPos, status, * bufferview_funcs.[Ch]: introduce coordOffset, getPos, status,
CurStatus enum. CurStatus enum.
* coordcache.[Ch]: add paragraph cache and helpers * coordcache.[Ch]: add paragraph cache and helpers
* CursorSlice.[Ch]: rename CursorSlice::par to CursorSlice::pit, * CursorSlice.[Ch]: rename CursorSlice::par to CursorSlice::pit,

View File

@ -42,7 +42,12 @@ public:
void dispatch(FuncRequest const & cmd); void dispatch(FuncRequest const & cmd);
/// get the resut of the last dispatch /// get the resut of the last dispatch
DispatchResult result() const; 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); bool getStatus(FuncRequest const & cmd, FuncStatus & flag);
/// add a new cursor slice /// add a new cursor slice

View File

@ -1,3 +1,7 @@
2004-11-30 Georg Baum <Georg.Baum@post.rwth-aachen.de>
* insetbase.h (getStatus): add better comment from src/cursor.C
2004-11-26 Alfredo Braunstein <abraunst@lyx.org> 2004-11-26 Alfredo Braunstein <abraunst@lyx.org>
* insettabular.[Ch]: adjust, introduce "do not draw * insettabular.[Ch]: adjust, introduce "do not draw

View File

@ -79,9 +79,13 @@ public:
/// true for 'math' math inset, but not for e.g. mbox /// true for 'math' math inset, but not for e.g. mbox
virtual bool inMathed() const { return false; } virtual bool inMathed() const { return false; }
// the real dispatcher /// the real dispatcher
void dispatch(LCursor & cur, FuncRequest & cmd); 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, virtual bool getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & status) const; FuncStatus & status) const;

View File

@ -308,10 +308,11 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
return flag; return flag;
} }
// the default error message if we disable the command if (!flag.enabled()) {
flag.message(N_("Command disabled")); if (flag.message().empty())
if (!flag.enabled()) flag.message(N_("Command disabled"));
return flag; return flag;
}
// Check whether we need a buffer // Check whether we need a buffer
if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) { if (!lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer) && !buf) {
@ -523,7 +524,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
default: default:
if (!cur.getStatus(cmd, flag)) if (!cur.getStatus(cmd, flag))
flag = view()->getStatus(cmd); flag |= view()->getStatus(cmd);
} }
if (!enable) if (!enable)
@ -537,7 +538,10 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
flag.enabled(false); 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; return flag;
} }

View File

@ -1627,7 +1627,7 @@ void LyXText::dispatch(LCursor & cur, FuncRequest & cmd)
bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd, bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
FuncStatus & flag) const FuncStatus & flag) const
{ {
BOOST_ASSERT(cur.text() == this); BOOST_ASSERT(cur.text() == this);
LyXFont const & font = real_current_font; LyXFont const & font = real_current_font;
@ -1969,8 +1969,7 @@ bool LyXText::getStatus(LCursor & cur, FuncRequest const & cmd,
break; break;
default: default:
enable = false; return false;
break;
} }
flag.enabled(enable); flag.enabled(enable);
return true; return true;