]> git.lyx.org Git - features.git/commitdiff
Fix bugs 1720 (almost) and 2877
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 9 Nov 2006 14:56:57 +0000 (14:56 +0000)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Thu, 9 Nov 2006 14:56:57 +0000 (14:56 +0000)
* src/funcrequest.h: split UI enum into MENU and TOOLBAR

* src/lyxfunc.C (getStatus): disable menu entries that need a
buffer when window does not have focus (bug 1720)
(dispatch, sendDispatchMessage): properly redraw toolbar after each
action (bug 2877).

* src/frontends/Toolbars.C (layoutSelected):
* src/MenuBackend.C (MenuItem):
* src/ToolbarBackend.C (add): adapt to FuncRequest change.

git-svn-id: svn://svn.lyx.org/lyx/lyx-devel/trunk@15825 a592a061-630c-0410-9148-cb99ea01b6c8

src/MenuBackend.C
src/ToolbarBackend.C
src/frontends/Toolbars.C
src/funcrequest.h
src/lyxfunc.C

index 51b33c36eae04d0da8e5c7606d8e37bb4a7553fe..5e078de9dba82b7695dbd10208463bbd22c5a865 100644 (file)
@@ -107,7 +107,7 @@ MenuItem::MenuItem(Kind kind, docstring const & label,
                   FuncRequest const & func, bool optional)
        : kind_(kind), label_(label), func_(func), optional_(optional)
 {
-       func_.origin = FuncRequest::UI;
+       func_.origin = FuncRequest::MENU;
 }
 
 
index f2dd5d8a26ad361283204cf8fee9e09680ae9602..970829b1aa285dd0f0666597eba8a525ce29b2c1 100644 (file)
@@ -212,7 +212,7 @@ void ToolbarBackend::add(Toolbar & tb,
                         FuncRequest const & func, docstring const & tooltip)
 {
        tb.items.push_back(make_pair(func, tooltip));
-       tb.items.back().first.origin = FuncRequest::UI;
+       tb.items.back().first.origin = FuncRequest::TOOLBAR;
 }
 
 
index 6d644be4c3e1a0946923a1b7894d33cb11ac7634..71cd21489196e01e3884b5b80980c346fa4c1c5c 100644 (file)
@@ -333,7 +333,7 @@ void layoutSelected(LyXView & lv, string const & name)
                // Yes, the lyx::to_utf8(_()) is correct
                if (lyx::to_utf8(_(itname)) == name) {
                        FuncRequest const func(LFUN_LAYOUT, itname,
-                                              FuncRequest::UI);
+                                              FuncRequest::TOOLBAR);
                        lv.dispatch(func);
                        return;
                }
index ba1c343c4fb4d26c396f8ab75425edc439c8dd6b..118e4f45bfdeeccdbf12463affa64794dcbc40b8 100644 (file)
@@ -32,7 +32,8 @@ public:
        /// Where the request came from
        enum Origin {
                INTERNAL,
-               UI, // The menu or the toolbar
+               MENU, // A menu entry
+               TOOLBAR, // A toolbar icon
                KEYBOARD, // a keyboard binding
                COMMANDBUFFER
        };
index 280468715793dc6363ff5bcd1857825e9bca1684..6f9d361354b72574057f2f892dc142e27d466f24 100644 (file)
@@ -377,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();
@@ -1737,26 +1737,20 @@ void LyXFunc::dispatch(FuncRequest const & cmd)
                        }
                }
        }
-       if (!quitting)
+       if (!quitting) {
+               lyx_view_->updateMenubar();
+               lyx_view_->updateToolbars();
                // FIXME UNICODE: _() does not support anything but ascii.
                // Do we need a to_ascii() method?
                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) {