]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathNest.C
Support lgathered and rgathered math environments
[lyx.git] / src / mathed / InsetMathNest.C
index bf374d358138ba7a65633c56a6a89a1f26620055..1a0bbb8d2beaf4768b37333063191799ca5bad3e 100644 (file)
 
 #include "support/lstrings.h"
 
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
+#include "frontends/Application.h"
 #include "frontends/Painter.h"
 #include "frontends/Selection.h"
 #include "frontends/nullpainter.h"
 
+//#include "bufferlist.h"
+#include "funcrequest.h"
+#include "lyxserver.h"
+#include "lyxsocket.h"
+
 #include <sstream>
 
 using lyx::cap::copySelection;
@@ -941,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;
@@ -1025,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