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

View File

@ -945,6 +945,16 @@ void InsetMathNest::doDispatch(LCursor & cur, FuncRequest & cmd)
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:
InsetMathDim::doDispatch(cur, cmd);
break;
@ -1029,6 +1039,15 @@ bool InsetMathNest::getStatus(LCursor & cur, FuncRequest const & cmd,
flag.enabled(currentMode() == MATH_MODE);
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_BIGDELIM:
// Don't do this with multi-cell selections