]> git.lyx.org Git - lyx.git/blobdiff - src/mathed/InsetMathHull.C
Fix bug 2789 (as discussed)
[lyx.git] / src / mathed / InsetMathHull.C
index 08d9d147a06f5246ab40e2b88e570f43db63de5e..cdcaa57a23c89db9cb4ea96820d51197501e1420 100644 (file)
@@ -50,9 +50,6 @@
 #include "insets/render_preview.h"
 #include "insets/insetlabel.h"
 
-#include "frontends/Dialogs.h"
-#include "frontends/LyXView.h"
-
 #include "graphics/PreviewImage.h"
 #include "graphics/PreviewLoader.h"
 
@@ -1081,7 +1078,7 @@ void InsetMathHull::doDispatch(LCursor & cur, FuncRequest & cmd)
                string const data = InsetCommandMailer::params2string("label", p);
 
                if (cmd.argument().empty())
-                       cur.bv().owner()->getDialogs().show("label", data, 0);
+                       cur.bv().showInsetDialog("label", data, 0);
                else {
                        FuncRequest fr(LFUN_INSET_INSERT, data);
                        dispatch(cur, fr);
@@ -1108,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:
@@ -1176,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;
@@ -1264,7 +1253,7 @@ void InsetMathHull::mutateToText()
                view_->getIntl()->getTransManager().TranslateAndInsert(*cit, lt);
 
        // remove ourselves
-       //view_->owner()->dispatch(LFUN_ESCAPE);
+       //theApp->lyxFunc().dispatch(LFUN_ESCAPE);
 #endif
 }