]> git.lyx.org Git - features.git/commitdiff
Add feedback in status bar when zooming
authorJean-Marc Lasgouttes <lasgouttes@lyx.org>
Mon, 18 Jul 2016 14:44:06 +0000 (16:44 +0200)
committerJean-Marc Lasgouttes <lasgouttes@lyx.org>
Tue, 19 Jul 2016 22:58:30 +0000 (00:58 +0200)
Moreover enforce better the lower limit of 10 and avoid overflow due
to unsigned int.

Fixes bug #10212.

(cherry picked from commit 8884c4044d7c1d29526aca7b0be1734231c89207)

src/LyXRC.cpp
src/frontends/qt4/GuiView.cpp
status.22x

index 8b7c3b3ec89756bdeda71245322239e9ec4cb39d..7696d0991fb2502d888c0183ee49d63c84605734 100644 (file)
@@ -604,6 +604,8 @@ LyXRC::ReturnValues LyXRC::read(Lexer & lexrc, bool check_format)
 
                case RC_SCREEN_ZOOM:
                        lexrc >> zoom;
+                       if (zoom < 10)
+                               zoom = 10;
                        break;
 
                case RC_GEOMETRY_SESSION:
index bb75daa1d93946d2e2bf5ede509321ae5b398a55..ba207f23d483247d8a848fb57435120b748ec2f3 100644 (file)
@@ -1988,6 +1988,8 @@ bool GuiView::getStatus(FuncRequest const & cmd, FuncStatus & flag)
 
        case LFUN_BUFFER_ZOOM_OUT:
                enable = doc_buffer && lyxrc.zoom > 10;
+               if (lyxrc.zoom <= 10)
+                       flag.message(_("Zoom level cannot be less than 10%."));
                break;
 
        case LFUN_BUFFER_ZOOM_IN:
@@ -3923,17 +3925,22 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        break;
 
                case LFUN_BUFFER_ZOOM_IN:
-               case LFUN_BUFFER_ZOOM_OUT:
+               case LFUN_BUFFER_ZOOM_OUT: {
+                       // use a signed temp to avoid overflow
+                       int zoom = lyxrc.zoom;
                        if (cmd.argument().empty()) {
                                if (cmd.action() == LFUN_BUFFER_ZOOM_IN)
-                                       lyxrc.zoom += 20;
+                                       zoom += 20;
                                else
-                                       lyxrc.zoom -= 20;
+                                       zoom -= 20;
                        } else
-                               lyxrc.zoom += convert<int>(cmd.argument());
+                               zoom += convert<int>(cmd.argument());
 
-                       if (lyxrc.zoom < 10)
-                               lyxrc.zoom = 10;
+                       if (zoom < 10)
+                               zoom = 10;
+                       lyxrc.zoom = zoom;
+
+                       dr.setMessage(bformat(_("Zoom level is now %1$d%"), lyxrc.zoom));
 
                        // The global QPixmapCache is used in GuiPainter to cache text
                        // painting so we must reset it.
@@ -3941,6 +3948,7 @@ void GuiView::dispatch(FuncRequest const & cmd, DispatchResult & dr)
                        guiApp->fontLoader().update();
                        lyx::dispatch(FuncRequest(LFUN_SCREEN_FONT_UPDATE));
                        break;
+               }
 
                case LFUN_VC_REGISTER:
                case LFUN_VC_RENAME:
index 772b504df5d539aee2c12fe7096d4804fbe6df60..64aedc88c40319b31e85bcb6a1a06d7f81245f7f 100644 (file)
@@ -20,6 +20,9 @@ What's new
 
 * USER INTERFACE
 
+* When changing zoom level, show current value in status bar (bug
+  10212).
+
 
 * DOCUMENTATION AND LOCALIZATION
 
@@ -42,7 +45,7 @@ What's new
 
 - Avoid crashing in release mode if we stumble across an unrealized font.
 
-- Fix display of citations with two authors. 
+- Fix display of citations with two authors.
 
 - Fix display of multi-author citations when the GUI language is not English.