commit 03684ae05e3487f563800b58979d730bd881f159
Author: Scott Kostyshak <[email protected]>
Date:   Tue Jul 19 01:44:39 2016 -0400

    Improve status check of LFUN_BUFFER_ZOOM_{OUT,IN}
    
    buffer-zoom-out can actually zoom in (by giving a positive number as
    the argument), so it should only be disabled at the minimum zoom
    level if it is indeed zooming out.
    
    Similarly, buffer-zoom-in can zoom out, so it should be disabled if
    the user is at the minimum zoom and it is called to zoom out.
    
    This commit amends 8884c404.
---
 src/frontends/qt4/GuiView.cpp |   18 +++++++++++-------
 1 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/src/frontends/qt4/GuiView.cpp b/src/frontends/qt4/GuiView.cpp
index 925dfec..c74163a 100644
--- a/src/frontends/qt4/GuiView.cpp
+++ b/src/frontends/qt4/GuiView.cpp
@@ -1993,15 +1993,19 @@ bool GuiView::getStatus(FuncRequest const & cmd, 
FuncStatus & flag)
                break;
 
        case LFUN_BUFFER_ZOOM_OUT:
-               enable = doc_buffer && lyxrc.zoom > 10;
-               if (lyxrc.zoom <= 10)
+       case LFUN_BUFFER_ZOOM_IN: {
+               // only diff between these two is that the default for ZOOM_OUT
+               // is a neg. number
+               bool const neg_zoom =
+                       convert<int>(cmd.argument()) < 0 ||
+                       (cmd.action() == LFUN_BUFFER_ZOOM_OUT && 
cmd.argument().empty());
+               if (lyxrc.zoom <= 10 && neg_zoom) {
                        flag.message(_("Zoom level cannot be less than 10%."));
+                       enable = false;
+               } else
+                       enable = doc_buffer;
                break;
-
-       case LFUN_BUFFER_ZOOM_IN:
-               enable = doc_buffer != 0;
-               break;
-
+       }
        case LFUN_BUFFER_MOVE_NEXT:
        case LFUN_BUFFER_MOVE_PREVIOUS:
                // we do not cycle when moving

Reply via email to