]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
redraw fix 1.
[lyx.git] / src / lyxfunc.C
index 13ec8c88e7fe3a5d293309d9373cf5a13a4fbe31..d1d920895f6c30ff25165657037550bbfdb3a041 100644 (file)
@@ -471,7 +471,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                break;
        }
        case LFUN_MATH_VALIGN:
-               if (mathcursor && mathcursor->formula()->getType() != LM_OT_SIMPLE) {
+               if (mathcursor && mathcursor->formula()->hullType() != "simple") {
                        char align = mathcursor->valign();
                        if (align == '\0') {
                                disable = true;
@@ -491,7 +491,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                break;
 
        case LFUN_MATH_HALIGN:
-               if (mathcursor && mathcursor->formula()->getType() != LM_OT_SIMPLE) {
+               if (mathcursor && mathcursor->formula()->hullType() != "simple") {
                        char align = mathcursor->halign();
                        if (align == '\0') {
                                disable = true;
@@ -511,28 +511,9 @@ FuncStatus LyXFunc::getStatus(kb_action action,
                break;
 
        case LFUN_MATH_MUTATE:
-               if (tli && (tli->lyxCode() == Inset::MATH_CODE)) {
-                       MathInsetTypes type = mathcursor->formula()->getType();
-                       if (argument == "inline") {
-                               flag.setOnOff(type == LM_OT_SIMPLE);
-                       } else if (argument == "display") {
-                               flag.setOnOff(type == LM_OT_EQUATION);
-                       } else if (argument == "eqnarray") {
-                               flag.setOnOff(type == LM_OT_EQNARRAY);
-                       } else if (argument == "align") {
-                               flag.setOnOff(type == LM_OT_ALIGN);
-                       } else if (argument == "alignat") {
-                               flag.setOnOff(type == LM_OT_ALIGNAT);
-                       } else if (argument == "xalignat") {
-                               flag.setOnOff(type == LM_OT_XALIGNAT);
-                       } else if (argument == "xxalignat") {
-                               flag.setOnOff(type == LM_OT_XXALIGNAT);
-                       } else if (argument == "none") {
-                               flag.setOnOff(type == LM_OT_NONE);
-                       } else {
-                               disable = true;
-                       }
-               } else
+               if (tli && (tli->lyxCode() == Inset::MATH_CODE))
+                       flag.setOnOff(mathcursor->formula()->hullType() == argument);
+               else
                        disable = true;
                break;
 
@@ -552,7 +533,7 @@ FuncStatus LyXFunc::getStatus(kb_action action,
        case LFUN_MATH_COLUMN_INSERT:
        case LFUN_MATH_COLUMN_DELETE:
                disable = !mathcursor || !mathcursor->halign() ||
-                       mathcursor->formula()->getType() == LM_OT_SIMPLE;
+                       mathcursor->formula()->hullType() == "simple";
                break;
 
        default:
@@ -1412,11 +1393,11 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                        owner->view()->buffer(bufferlist.loadLyXFile(s));
                }
 
-               // Set the cursor
                owner->view()->setCursorFromRow(row);
 
-               // Recenter screen
                owner->view()->center();
+               // see BufferView_pimpl::center() 
+               owner->view()->updateScrollbar();
        }
        break;
 
@@ -1446,8 +1427,9 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                owner->view()->setState();
                owner->showState();
 
-               // Recenter screen
                owner->view()->center();
+               // see BufferView_pimpl::center() 
+               owner->view()->updateScrollbar();
        }
        break;
 
@@ -1572,7 +1554,7 @@ string const LyXFunc::dispatch(kb_action action, string argument)
        case LFUN_SEQUENCE:
        {
                // argument contains ';'-terminated commands
-               while (argument.find(';') != string::npos) {
+               while (!argument.empty()) {
                        string first;
                        argument = split(argument, first, ';');
                        verboseDispatch(first, false);
@@ -1634,8 +1616,13 @@ string const LyXFunc::dispatch(kb_action action, string argument)
                lyxColorHandler->updateColor(lcolor.getFromLyXName(lyx_name));
 
                if (graphicsbg_changed) {
+#ifdef WITH_WARNINGS
+#warning FIXME!! The graphics cache no longer has a changeDisplay method.
+#endif
+#if 0
                        grfx::GCache & gc = grfx::GCache::get();
                        gc.changeDisplay(true);
+#endif
                }
 
                owner->view()->repaint();