]> git.lyx.org Git - lyx.git/blobdiff - src/lyxfunc.C
remove obsolete FIXMEs
[lyx.git] / src / lyxfunc.C
index 44c8419bd317ee0958a20850e135d7065ca02568..dbda91f6c8d513a28b6d636f8e9c8cf4dddacc09 100644 (file)
@@ -352,6 +352,18 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                flag.message(from_utf8(N_("Exiting")));
                flag.enabled(true);
                return flag;
+       } else if (cmd.action == LFUN_BOOKMARK_GOTO) {
+               // bookmarks can be valid even if there is no opened buffer
+               flag.enabled(LyX::ref().session().bookmarks().isValid(convert<unsigned int>(to_utf8(cmd.argument()))));
+               return flag;
+       } else if (cmd.action == LFUN_BOOKMARK_CLEAR) {
+               flag.enabled(LyX::ref().session().bookmarks().size() > 0);
+               return flag;
+       } else if (cmd.action == LFUN_TOOLBAR_TOGGLE_STATE) {
+               ToolbarBackend::Flags flags = lyx_view_->getToolbarState(to_utf8(cmd.argument()));
+               if (!(flags & ToolbarBackend::AUTO))
+                       flag.setOnOff(flags & ToolbarBackend::ON);
+               return flag;
        }
 
        LCursor & cur = view()->cursor();
@@ -365,7 +377,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
           http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
        */
        Buffer * buf;
-       if (cmd.origin == FuncRequest::UI && !lyx_view_->hasFocus())
+       if (cmd.origin == FuncRequest::MENU && !lyx_view_->hasFocus())
                buf = 0;
        else
                buf = lyx_view_->buffer();
@@ -565,6 +577,7 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                break;
        }
 
+
        // this one is difficult to get right. As a half-baked
        // solution, we consider only the first action of the sequence
        case LFUN_COMMAND_SEQUENCE: {
@@ -630,19 +643,6 @@ FuncStatus LyXFunc::getStatus(FuncRequest const & cmd) const
                // these are handled in our dispatch()
                break;
 
-       // FIXME: will move to the front of this function when SWITCH_TO_BUFFER
-       // is valid for a newly created window 
-       case LFUN_BOOKMARK_GOTO:
-               // bookmarks can be valid even if there is no opened buffer
-               flag.enabled(LyX::ref().session().bookmarks().isValid(convert<unsigned int>(to_utf8(cmd.argument()))));
-               break;
-
-       // FIXME: will move to the front of this function when SWITCH_TO_BUFFER
-       // is valid for a newly created window 
-       case LFUN_BOOKMARK_CLEAR:
-               flag.enabled(LyX::ref().session().bookmarks().size() > 0);
-               break;
-
        default:
                if (!getLocalStatus(cur, cmd, flag))
                        flag = view()->getStatus(cmd);
@@ -1252,6 +1252,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                            name == "bibtex" ||
                            name == "index" ||
                            name == "label" ||
+                           name == "nomenclature" ||
                            name == "ref" ||
                            name == "toc" ||
                            name == "url") {
@@ -1683,8 +1684,6 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        // open may fail, so we need to test it again
                        if (theBufferList().exists(bm.filename)) {
                                // if the current buffer is not that one, switch to it.
-                               // FIXME: swtich buffer to a newly created window will crash lyx
-                               // because of invalid view.
                                if (lyx_view_->buffer()->fileName() != bm.filename)
                                        dispatch(FuncRequest(LFUN_BUFFER_SWITCH, bm.filename));
                                // BOOST_ASSERT(lyx_view_->buffer()->fileName() != bm.filename);
@@ -1697,6 +1696,10 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        LyX::ref().session().bookmarks().clear();
                        break;
 
+               case LFUN_TOOLBAR_TOGGLE_STATE:
+                       lyx_view_->toggleToolbarState(argument);
+                       break;
+
                default: {
                        BOOST_ASSERT(lyx_view_);
                        view()->cursor().dispatch(cmd);
@@ -1719,7 +1722,7 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                                needSecondUpdate = view()->fitCursor();
 
                        if (needSecondUpdate || updateFlags != Update::None) {
-                               view()->buffer()->changed();
+                               view()->buffer()->changed(updateFlags & Update::SinglePar);
                        }
                        lyx_view_->updateStatusBar();
 
@@ -1734,26 +1737,18 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        }
                }
        }
-       if (!quitting)
-               // FIXME UNICODE: _() does not support anything but ascii.
-               // Do we need a to_ascii() method?
+       if (!quitting) {
+               lyx_view_->updateMenubar();
+               lyx_view_->updateToolbars();
                sendDispatchMessage(getMessage(), cmd);
+       }
 }
 
 
 void LyXFunc::sendDispatchMessage(docstring const & msg, FuncRequest const & cmd)
 {
-       /* When an action did not originate from the UI/kbd, it makes
-        * sense to avoid updating the GUI. It turns out that this
-        * fixes bug 1941, for reasons that are described here:
-        * http://bugzilla.lyx.org/show_bug.cgi?id=1941#c4
-        */
-       if (cmd.origin != FuncRequest::INTERNAL) {
-               lyx_view_->updateMenubar();
-               lyx_view_->updateToolbars();
-       }
-
-       const bool verbose = (cmd.origin == FuncRequest::UI
+       const bool verbose = (cmd.origin == FuncRequest::MENU
+                             || cmd.origin == FuncRequest::TOOLBAR
                              || cmd.origin == FuncRequest::COMMANDBUFFER);
 
        if (cmd.action == LFUN_SELF_INSERT || !verbose) {