Am Samstag, 9. September 2006 20:07 schrieb Bo Peng: > > Please test. > > I do not know what is going on, but after I apply your patch, > > 1. open a new document > 2. insert displayed math, type in dd, insert label, > > the dialog can not get focus. I revert your patch and things go back > to normal. This is under linux, for 1.4.x.
There was a thinko in the patch. Can you please try this one? It works for me, but I do not understand why it worked without the patch, since the culprit was a break instead of a return statement. Georg
--- src/mathed/math_hullinset.C 2006-09-20 19:50:36.000000000 +0200 +++ src/mathed/math_hullinset.C 2006-09-25 22:08:37.000000000 +0200 @@ -1067,28 +1067,23 @@ void MathHullInset::doDispatch(LCursor & case LFUN_INSET_INSERT: { //lyxerr << "arg: " << cmd.argument << endl; string const name = cmd.getArg(0); - if (name == "label") { - InsetCommandParams p; - InsetCommandMailer::string2params(name, cmd.argument, p); - string str = p.getContents(); - recordUndoInset(cur); - row_type const r = (type_ == "multline") ? nrows() - 1 : cur.row(); - str = lyx::support::trim(str); - if (!str.empty()) - numbered(r, true); - string old = label(r); - if (str != old) { - cur.bv().buffer()->changeRefsIfUnique(old, str); - label(r, str); - } - break; + if (name != "label") { + MathGridInset::doDispatch(cur, cmd); + return; + } + InsetCommandParams p; + InsetCommandMailer::string2params(name, cmd.argument, p); + string str = p.getContents(); + recordUndoInset(cur); + row_type const r = (type_ == "multline") ? nrows() - 1 : cur.row(); + str = lyx::support::trim(str); + if (!str.empty()) + numbered(r, true); + string old = label(r); + if (str != old) { + cur.bv().buffer()->changeRefsIfUnique(old, str); + label(r, str); } - MathArray ar; - if (createMathInset_fromDialogStr(cmd.argument, ar)) { - recordUndo(cur); - cur.insert(ar); - } else - cur.undispatched(); break; } @@ -1151,15 +1146,11 @@ bool MathHullInset::getStatus(LCursor & 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") + return MathGridInset::getStatus(cur, cmd, status); + status.enabled(type_ != "simple"); + return true; case LFUN_TABULAR_FEATURE: { istringstream is(cmd.argument); string s; --- src/mathed/math_nestinset.C 2006-09-20 19:50:36.000000000 +0200 +++ src/mathed/math_nestinset.C 2006-09-25 22:08:38.000000000 +0200 @@ -902,6 +906,16 @@ 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; @@ -985,6 +1000,16 @@ case LFUN_INSERT_MATRIX: 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; + } + default: ret = false; break;