Fix bug 2789 (as discussed)

* src/mathed/InsetMathHull.C
	(InsetMathHull::doDispatch): move code for ref insert to InsetMathNest 
	(InsetMathHull::getStatus): move code for ref insert to InsetMathNest

	* src/mathed/InsetMathNest.C
	(InsetMathNest::doDispatch): move code from InsetMathHull here
	(InsetMathNest::getStatus): move code from InsetMathHull here


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15189 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-09-30 17:17:31 +00:00
parent 6eab6ea732
commit deef368edc
2 changed files with 27 additions and 16 deletions

View File

@ -1105,13 +1105,8 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd)
} }
break; break;
} }
MathArray ar; InsetMathGrid::doDispatch(cur, cmd);
if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) { return;
recordUndo(cur);
cur.insert(ar);
} else
cur.undispatched();
break;
} }
case LFUN_MATH_EXTERN: case LFUN_MATH_EXTERN:
@ -1173,15 +1168,12 @@ bool InsetMathHull::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_LABEL_INSERT: case LFUN_LABEL_INSERT:
status.enabled(type_ != hullSimple); status.enabled(type_ != hullSimple);
return true; return true;
case LFUN_INSET_INSERT: { case LFUN_INSET_INSERT:
// Don't test createInsetMath_fromDialogStr(), since if (cmd.getArg(0) == "label") {
// getStatus is not called with a valid reference and the status.enabled(type_ != hullSimple);
// dialog would not be applyable. return true;
string const name = cmd.getArg(0);
status.enabled(name == "ref" ||
(name == "label" && type_ != hullSimple));
break;
} }
return InsetMathGrid::getStatus(cur, cmd, status);
case LFUN_TABULAR_FEATURE: { case LFUN_TABULAR_FEATURE: {
istringstream is(lyx::to_utf8(cmd.argument())); istringstream is(lyx::to_utf8(cmd.argument()));
string s; string s;

View File

@ -945,6 +945,16 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
break; break;
} }
case LFUN_INSET_INSERT: {
MathArray ar;
if (createInsetMath_fromDialogStr(lyx::to_utf8(cmd.argument()), ar)) {
recordUndo(cur);
cur.insert(ar);
} else
cur.undispatched();
break;
}
default: default:
InsetMathDim::doDispatch(cur, cmd); InsetMathDim::doDispatch(cur, cmd);
break; break;
@ -1029,6 +1039,15 @@ bool InsetMathNest::getStatus(LCursor & cur, FuncRequest const & cmd,
flag.enabled(currentMode() == MATH_MODE); flag.enabled(currentMode() == MATH_MODE);
break; break;
case LFUN_INSET_INSERT: {
// Don't test createMathInset_fromDialogStr(), since
// getStatus is not called with a valid reference and the
// dialog would not be applyable.
string const name = cmd.getArg(0);
flag.enabled(name == "ref");
break;
}
case LFUN_MATH_DELIM: case LFUN_MATH_DELIM:
case LFUN_MATH_BIGDELIM: case LFUN_MATH_BIGDELIM:
// Don't do this with multi-cell selections // Don't do this with multi-cell selections