Fix bug 2789 (as discussed)

* src/mathed/math_hullinset.C
	(MathHullInset::doDispatch): move code for ref insert to MathNestInset 
	(MathHullInset::getStatus): move code for ref insert to MathNestInset

	* src/mathed/math_nestinset.C
	(MathNestInset::doDispatch): move code from MathHullInset here
	(MathNestInset::getStatus): move code from MathHullInset here


git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/branches/BRANCH_1_4_X@15901 a592a061-630c-0410-9148-cb99ea01b6c8
This commit is contained in:
Georg Baum 2006-11-13 14:25:55 +00:00
parent c9b04ce446
commit 0914aa347e
3 changed files with 29 additions and 16 deletions

View File

@ -1083,13 +1083,8 @@ void MathHullInset::doDispatch(LCursor & cur, FuncRequest & cmd)
}
break;
}
MathArray ar;
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
recordUndo(cur);
cur.insert(ar);
} else
cur.undispatched();
break;
MathGridInset::doDispatch(cur, cmd);
return;
}
case LFUN_MATH_EXTERN:
@ -1151,15 +1146,12 @@ bool MathHullInset::getStatus(LCursor & cur, FuncRequest const & cmd,
case LFUN_INSERT_LABEL:
status.enabled(type_ != "simple");
return true;
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);
status.enabled(name == "ref" ||
(name == "label" && type_ != "simple"));
break;
}
case LFUN_INSET_INSERT:
if (cmd.getArg(0) == "label") {
status.enabled(type_ != "simple");
return true;
}
return MathGridInset::getStatus(cur, cmd, status);
case LFUN_TABULAR_FEATURE: {
istringstream is(cmd.argument);
string s;

View File

@ -931,6 +931,16 @@ void MathNestInset::doDispatch(LCursor & cur, FuncRequest & cmd)
break;
}
case LFUN_INSET_INSERT: {
MathArray ar;
if (createMathInset_fromDialogStr(cmd.argument, ar)) {
recordUndo(cur);
cur.insert(ar);
} else
cur.undispatched();
break;
}
default:
MathDimInset::doDispatch(cur, cmd);
break;
@ -1015,6 +1025,15 @@ bool MathNestInset::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

View File

@ -99,6 +99,8 @@ What's new
- Make all the operations that require walking over all insets faster.
- Fix insertion position for cross-reference in superscript (bug 2789)
* Build/installation: