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>
* broken_headers.h: remove

View File

@ -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

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>
* 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
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;

View File

@ -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;
}

View File

@ -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;