]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
fix arabtex-related problems (bug 1225 and bug 1404)
[lyx.git] / src / lyxfunc.C
index 550b627fe36e52f3ea21f3050d2a624bc33db691..244a858dbca70488982b1fd23ae0c899a75d5db6 100644 (file)
@@ -430,6 +430,13 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
 
+       case LFUN_DIALOG_UPDATE: {
+               string const name = cmd.getArg(0);
+               if (!buf)
+                       enable = name == "prefs";
+               break;
+       }
+
        case LFUN_MENUNEW:
        case LFUN_MENUNEWTMPLT:
        case LFUN_WORDFINDFORWARD:
@@ -459,7 +466,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_GOTO_PARAGRAPH:
        case LFUN_DIALOG_SHOW_NEW_INSET:
        case LFUN_DIALOG_SHOW_NEXT_INSET:
-       case LFUN_DIALOG_UPDATE:
        case LFUN_DIALOG_HIDE:
        case LFUN_DIALOG_DISCONNECT_INSET:
        case LFUN_CHILDOPEN:
@@ -477,6 +483,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
        case LFUN_SET_COLOR:
        case LFUN_MESSAGE:
        case LFUN_EXTERNAL_EDIT:
+       case LFUN_GRAPHICS_EDIT:
        case LFUN_ALL_INSETS_TOGGLE:
        case LFUN_LANGUAGE_BUFFER:
        case LFUN_TEXTCLASS_APPLY:
@@ -488,7 +495,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
 
        default:
-               
+
                cur.getStatus(cmd, flag);
                if (!flag.enabled())
                        flag = view()->getStatus(cmd);
@@ -505,6 +512,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                flag.enabled(false);
        }
 
+       //lyxerr << "LyXFunc::getStatus: got: " << flag.enabled() << endl;
        return flag;
 }
 
@@ -562,7 +570,7 @@ void loadTextclass(string const & name)
                Alert::error(_("Could not change class"), s);
        }
 }
+
 } //namespace anon
 
 
@@ -579,6 +587,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
        dispatch_buffer.erase();
        selection_possible = false;
 
+       bool update = true;
+
        // We cannot use this function here
        if (!getStatus(cmd).enabled()) {
                lyxerr[Debug::ACTION] << "LyXFunc::dispatch: "
@@ -621,6 +631,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        break;
 
                case LFUN_EXEC_COMMAND:
+                       owner->getToolbar().display("minibuffer", true);
                        owner->focus_command_buffer();
                        break;
 
@@ -1115,6 +1126,8 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                                inset->dispatch(view()->cursor(), fr);
                        } else if (name == "paragraph") {
                                dispatch(FuncRequest(LFUN_PARAGRAPH_UPDATE));
+                       } else if (name == "prefs") {
+                               owner->getDialogs().update(name, string());
                        }
                        break;
                }
@@ -1189,7 +1202,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
 
                case LFUN_SAVEPREFERENCES: {
                        Path p(user_lyxdir());
-                       lyxrc.write("preferences");
+                       lyxrc.write("preferences", false);
                        break;
                }
 
@@ -1249,8 +1262,9 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                        break;
                }
 
-               case LFUN_BREAKLINE: {
-#warning swallow 'Return' if the minibuffer is focused. But how?
+               case LFUN_GRAPHICS_EDIT: {
+                       FuncRequest fr(action, argument);
+                       InsetGraphics().dispatch(view()->cursor(), fr);
                        break;
                }
 
@@ -1342,27 +1356,30 @@ void LyXFunc::dispatch(FuncRequest const & cmd, bool verbose)
                case LFUN_LYXRC_APPLY: {
                        istringstream ss(argument);
                        bool const success = lyxrc.read(ss) == 0;
-                       
+
                        if (!success) {
                                lyxerr << "Warning in LFUN_LYXRC_APPLY!\n"
                                       << "Unable to read lyxrc data"
                                       << endl;
                        }
                        break;
-               } 
+               }
 
                default: {
+                       update = false;
                        DispatchResult res = view()->cursor().dispatch(cmd);
-                       if (!res.dispatched());
-                               view()->dispatch(cmd);
+                       if (res.dispatched())
+                               update |= res.update();
+                       else
+                               update |= view()->dispatch(cmd);
+
                        break;
                }
                }
 
                if (view()->available()) {
-                       view()->fitCursor();
-                       view()->update();
-                       view()->cursor().updatePos();
+                       if (view()->fitCursor() || update)
+                               view()->update();
                        // if we executed a mutating lfun, mark the buffer as dirty
                        if (getStatus(cmd).enabled()
                                        && !lyxaction.funcHasFlag(cmd.action, LyXAction::NoBuffer)