Disable and check properly the math numbering functions.

* InsetMathHull.cpp (getStatus): disable LFUN_MATH_NUMBER and LFUN_MATH_NONUMBER
	when the equation is not in display mode; add a checkbox as needed.
	(doDispatch): no need to test for dispatch() anymore.

	* InsetMathNest.cpp (getStatus): LFUN_MATH_NUMBER and LFUN_MATH_NONUMBER are not 
	handled by this class.


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@22350 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Jean-Marc Lasgouttes 2008-01-03 17:31:12 +00:00
parent ed2b1631db
commit c3ec9ddda0
2 changed files with 32 additions and 26 deletions

View File

@ -1050,30 +1050,28 @@ void InsetMathHull::doDispatch(Cursor & cur, FuncRequest & cmd)
InsetMathGrid::doDispatch(cur, cmd);
break;
case LFUN_MATH_NUMBER:
case LFUN_MATH_NUMBER: {
//lyxerr << "toggling all numbers" << endl;
if (display()) {
cur.recordUndoInset();
bool old = numberedType();
if (type_ == hullMultline)
numbered(nrows() - 1, !old);
else
for (row_type row = 0; row < nrows(); ++row)
numbered(row, !old);
cur.message(old ? _("No number") : _("Number"));
}
cur.recordUndoInset();
bool old = numberedType();
if (type_ == hullMultline)
numbered(nrows() - 1, !old);
else
for (row_type row = 0; row < nrows(); ++row)
numbered(row, !old);
cur.message(old ? _("No number") : _("Number"));
break;
}
case LFUN_MATH_NONUMBER:
if (display()) {
cur.recordUndoInset();
row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
bool old = numbered(r);
cur.message(old ? _("No number") : _("Number"));
numbered(r, !old);
}
case LFUN_MATH_NONUMBER: {
cur.recordUndoInset();
row_type r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
bool old = numbered(r);
cur.message(old ? _("No number") : _("Number"));
numbered(r, !old);
break;
}
case LFUN_LABEL_INSERT: {
cur.recordUndoInset();
@ -1166,17 +1164,27 @@ bool InsetMathHull::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_FINISHED_FORWARD:
case LFUN_UP:
case LFUN_DOWN:
status.enabled(true);
return true;
case LFUN_NEW_LINE:
case LFUN_MATH_NUMBER:
case LFUN_MATH_NONUMBER:
case LFUN_MATH_EXTERN:
case LFUN_MATH_MUTATE:
case LFUN_MATH_DISPLAY:
// we handle these
status.enabled(true);
return true;
case LFUN_MATH_NUMBER:
// FIXME: what is the right test, this or the one of
// LABEL_INSERT?
status.enabled(display());
status.setOnOff(numberedType());
return true;
case LFUN_MATH_NONUMBER: {
// FIXME: what is the right test, this or the one of
// LABEL_INSERT?
status.enabled(display());
row_type const r = (type_ == hullMultline) ? nrows() - 1 : cur.row();
status.setOnOff(numbered(r));
return true;
}
case LFUN_LABEL_INSERT:
status.enabled(type_ != hullSimple);
return true;

View File

@ -1141,8 +1141,6 @@ bool InsetMathNest::getStatus(Cursor & cur, FuncRequest const & cmd,
case LFUN_MATH_SIZE:
case LFUN_MATH_SPACE:
case LFUN_MATH_LIMITS:
case LFUN_MATH_NONUMBER:
case LFUN_MATH_NUMBER:
case LFUN_MATH_EXTERN:
flag.enabled(true);
break;