On Tue, Oct 02, 2007 at 08:06:36PM +0200, Andre Poenitz wrote: > On Tue, Oct 02, 2007 at 08:34:35PM +0300, Martin Vermeer wrote: > > Well, the attached patch enables inset dissolving in mathed. (I'm sure > > I overlooked all kinds of things.) > > > > It would be trivial to put the insertion of the most popular colour into > > mathed on the menu tree. > > > > - Martin > > > > > Index: InsetMathNest.cpp > > =================================================================== > > --- InsetMathNest.cpp (revision 20634) > > +++ InsetMathNest.cpp (working copy) > > @@ -1003,7 +1003,9 @@ > > cur.undispatched(); > > break; > > } > > - > > + case LFUN_INSET_DISSOLVE: > > + if (!cur[(cur.depth() - 2)].text()) > > + cur.pullArg(); > > default: > > InsetMath::doDispatch(cur, cmd); > > break; > > Looks a bit brutish as it assumes e.g. that no math inset is text, which > might not be true with real math text. What about > > case LFUN_INSET_DISSOLVE: > if (!asHullInset()) > cur.pullArg(); > > And maybe even a 'break;' afterwards.
Like attached, including the recording/undo thing. Do we want this? Improves the dissolve discoverability. And do we want math colours on the menu tree? About changing colours in math, that remains the same as before: delete old, insert new. Same as with fonts (where sometimes I would have liked a more direct redefinition path, textbf -> mathbf for instance). I don't suppose this is easily changed. - Martin
Index: InsetMathNest.cpp =================================================================== --- InsetMathNest.cpp (revision 20634) +++ InsetMathNest.cpp (working copy) @@ -1003,6 +1003,12 @@ cur.undispatched(); break; } + case LFUN_INSET_DISSOLVE: + if (!asHullInset()) { + recordUndoInset(cur, Undo::ATOMIC); + cur.pullArg(); + } + break; default: InsetMath::doDispatch(cur, cmd); @@ -1112,6 +1118,10 @@ flag.enabled(false); break; + case LFUN_INSET_DISSOLVE: + flag.enabled(!asHullInset()); + break; + default: ret = false; break;