Community
    • Login

    show the current zoom

    Scheduled Pinned Locked Moved Notepad++ & Plugin Development
    28 Posts 9 Posters 8.8k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • conky77C
      conky77
      last edited by

      before creating an issue, I insert the request here.
      In Notepad++ is not easy to understand the current zoom and return to the original zoom(ctrl + / num look with a laptop is not always easy to press them). Very often I want to scroll 2 files with vertical scroll but they have different zooms: to set them with the same zoom is not easy

      52079437-afab-4c2b-80e0-c4a0a14dd3af-immagine.png

      in sql management studio you can show the current zoom and change it
      d43487f1-8425-42f9-ae92-c13c434fedba-immagine.png

      (Microsoft word show it in a different way)
      8330e4d1-bfa3-4dc1-812d-02b3dcc0894e-immagine.png

      Showing the zoom, the zoom-in and zoom-out buttons could be removed from the toolbar (in my opinion the toolbar is too busy).

      Apparently, in SSMS, all files have the same zoom: if you change the zoom of a window, all zooms change.
      Could be useful to create an option in order to choose if all windows have the same zoom or not

      PeterJonesP mkupperM 2 Replies Last reply Reply Quote 1
      • PeterJonesP
        PeterJones @conky77
        last edited by PeterJones

        @conky77 said in show the current zoom:

        before creating an issue, I insert the request here.

        You aren’t the first to talk about this. For example, here, which not only gives a history of discussions about the topic, but also links to the existing issue #8301

        conky77C 1 Reply Last reply Reply Quote 1
        • conky77C
          conky77 @PeterJones
          last edited by

          @PeterJones so only the request of synchronize the zoom between the 2 views is original, right?
          Do you suggest creating an issue only for this?

          PeterJonesP 1 Reply Last reply Reply Quote 0
          • PeterJonesP
            PeterJones @conky77
            last edited by PeterJones

            @conky77 ,

            Personally, I don’t see as much benefit from synchronizing the two as I do from showing the zoom to begin with. But if you want the feature to be able to synchronize the zoom, you would have to request it (or upvote an existing request).

            I didn’t fully search the forum for all mentions, nor did I check all open-or-closed issues. I would suggest doing a more thorough search than my 2 minutes of searching this forum before creating the new feature request.

            And it wouldn’t necessarily require the zoom level being visible; it could be a View menu entry, right below Synchronize Horizontal/Vertical Scrolling, called Synchronize View Zoom Level or similar – and whether or not the visible Zoom level is ever added to the interface, it could allow the Zoom to be the same in both Views.

            And if you want the Zoom level visible, I would suggest also commenting on #8301 – sometimes, Don uses the number of upvotes and/or comments on an issue as evidence that people really want it (though not always).

            1 Reply Last reply Reply Quote 1
            • Alan KilbornA
              Alan Kilborn
              last edited by Alan Kilborn

              IMO, don’t waste the space to always show the zoom level.

              Maybe a good idea is to add the zoom level to the View menu options that already exist, since that doesn’t seem to currently be shown.

              However, syncing zoom when synchronizing scrolling is a nice idea. It seems like it could be done automatically (e.g. when syncing is initiated, copy the zoom level from the active view tab to the inactive view tab)

              Alan KilbornA 1 Reply Last reply Reply Quote 1
              • mkupperM
                mkupper @conky77
                last edited by mkupper

                @conky77 While I agree that the zoom level should be visible I have some comments.

                1. The zoom levels are available in the config.xml file in the <GUIConfig name="ScintillaPrimaryView" line as zoom="0" and zoom2="0". zoom is the setting for the main view and zoom2 is the alternate view. Thus, you could close/exit Notepad++ and then inspect/fix your config.xml file.
                2. The zoom levels are a numeric integer that ranges from -10 to +20. Zero is the default that you get when you use Ctrl+/. Negative values are smaller and values above zero are larger.
                3. When Notepad++ starts the zoom levels are retrieved from the config.xml file snd simply passed on to Scintilla using _mainEditView.execute(SCI_SETZOOM, svp._zoom); and _subEditView.execute(SCI_SETZOOM, svp._zoom2);. When Notepad++ exits it retrieves the zoom levels from Scintilla and saves them in the config.xml file using svp._zoom = _mainEditView.execute(SCI_GETZOOM); and svp._zoom2 = _subEditView.execute(SCI_GETZOOM);. Thus, while there may be a desire to display the zoom as a percentage or text/font size those metrics are not available. Instead, we can only discover a number that ranges from -10 to +20 and know that zero is Notepad++'s default. Scintilla does not define the default value.

                To sum it up - You could get the zoom levels to match line up by exiting Notepad++ and then copying the zoom level from either zoom to zoom2 or copying the level the other way.

                1 Reply Last reply Reply Quote 2
                • Alan KilbornA
                  Alan Kilborn @Alan Kilborn
                  last edited by Alan Kilborn

                  I had said:

                  IMO, don’t waste the space to always show the zoom level.

                  I said this because most-everyone thinks it should be on the status bar.
                  I say, leave the status bar alone, it already has a lot of stuff on it – and the stuff there is “important”, much more so than a zoom-level that a user rarely changes.

                  OK, so what are some other options?

                  Well, there are currently two toolbar buttons dedicated to zoom – I forgot about that because why would anyone use them?: Ctrl+wheel does their functionality. Perhaps these two buttons could be replaced with a single control that would show the current zoom level (constantly) and also allow changing the value. One appeal of this is that no new screen space would be lost to something like this.

                  Another possibility would be to show the current zoom level on the View menu’s Zoom entry – instead of the text being Zoom >, it could be Zoom (current: +2) >. Sure, it isn’t constantly visible to a user this way, but it is only a single-keycombo press away.

                  PeterJonesP deleeleeD 2 Replies Last reply Reply Quote 3
                  • PeterJonesP
                    PeterJones @Alan Kilborn
                    last edited by

                    @Alan-Kilborn and others,

                    I don’t strongly see a need for seeing the zoom level on the status bar. However, lots of tools – including the browsers that ArkadiuszMichalski had shown, or VS – do show it (some taking up more space than others), so I can see why some users have just grown to expect it to be always visible. If it were on the status bar, I’d vote for as small as possible (just enough room for up to 100% to show, no extra up/down controls); but if one of the alternatives were possible, I’d probably prefer any of those to taking up more SB space.

                    If it were doable, I like the thought of replacing the toolbar zoom buttons with a fancy zoom-control with display and + and - as part of a unified control – I especially like the firefox screenshot shown here (stolen from the issue). However, I have a feeling that’s harder to implement than a simple statusbar. But maybe as a compromise, if it’s easier, just change the zoom-toolbar tooltip to show the current zoom level when you hover over those icons, so you can know where it’s at before clicking to zoom in or out.

                    Changing the Zoom-menu-label is an interesting idea, though it might be surprising to users, since nothing else changes the menu text like that. I know some menu entries have the blue selection ball on the left, so I know icons go there; could there be icons for the -10 to +20 range (either numbers, or some fuel-gage-looking thing, or something), and just have the right icon selected for that menu entry? I don’t know whether that’s harder or easier or just “differenter” to implement.

                    But the more I think about it, the more I like @conky77’s idea of being able to sync the zoom between the two tabs – whether the scrolling is synced or not, any use case where I can think of wanting to zoom one View when two are visible, I cannot think of why I wouldn’t also want to zoom the second View at the same time. If that option existed, either as a toggle in the top-level View menu, or in the View > Zoom submenu, or even in the Preferences, I have a feeling I’d end up leaving it on all the time, just for the ease of zooming.

                    1 Reply Last reply Reply Quote 1
                    • Alan KilbornA
                      Alan Kilborn
                      last edited by Alan Kilborn

                      Here’s a script implementation of my earlier idea, changing the View menu’s Zoom entry to show the current zoom level. When it is running, it looks like this:

                      c46a6cc4-cd5e-49f0-93e8-61f7ece3e63b-image.png

                      I call the script ZoomLevelInZoomsViewMenuText.py:

                      # -*- coding: utf-8 -*-
                      from __future__ import print_function
                      
                      #########################################
                      #
                      #  ZoomLevelInZoomsViewMenuText (ZLIZVMT)
                      #
                      #########################################
                      
                      # references:
                      #  https://community.notepad-plus-plus.org/topic/25844/show-the-current-zoom
                      #  for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript
                      
                      #-------------------------------------------------------------------------------
                      
                      from Npp import *
                      import sys
                      from ctypes import ( addressof, byref, create_unicode_buffer, sizeof, Structure, WinDLL, )
                      from ctypes.wintypes import ( HBITMAP, HMENU, LPVOID, LPWSTR, UINT, )
                      
                      #-------------------------------------------------------------------------------
                      
                      python3 = True if sys.version_info.major == 3 else False
                      
                      user32 = WinDLL('user32')
                      
                      MIIM_ID = 2
                      MIIM_STRING = 64
                      
                      class MENUITEMINFO(Structure):
                          _fields_ = [
                              ('cbSize', UINT),
                              ('fMask',  UINT),
                              ('fType',  UINT),
                              ('fState',  UINT),
                              ('wID',  UINT),
                              ('hSubMenu',  HMENU),
                              ('hbmpChecked',  HBITMAP),
                              ('hbmpUnchecked', HBITMAP),
                              ('dwItemData',  LPVOID),
                              ('dwTypeData',  LPWSTR),
                              ('cch',  UINT),
                              ('hbmpItem',  HBITMAP),
                          ]
                      
                      #-------------------------------------------------------------------------------
                      
                      class ZLIZVMT(object):
                      
                          def __init__(self):
                      
                              npp_main_menu = notepad.getMenuHandle(1)
                              self.npp_view_menu = user32.GetSubMenu(npp_main_menu, 3)  # File=0, Edit=1, Search=2, View=3, etc. (assume these won't ever change)
                              menu_items = user32.GetMenuItemCount(self.npp_view_menu)
                              size_ub = 256
                              ub = create_unicode_buffer(size_ub)
                              self.mii = MENUITEMINFO()
                              self.mii.cbSize = sizeof(self.mii)
                              self.mii.fMask = MIIM_ID | MIIM_STRING
                              self.mii.dwTypeData = addressof(ub)
                      
                              self.zoom_pos_on_parent_menu = None
                              for pos in range(menu_items):
                                  self.mii.cch = size_ub
                                  user32.GetMenuItemInfoW(self.npp_view_menu, pos, True, byref(self.mii))
                                  if 'Zoom' in self.mii.dwTypeData:
                                      self.zoom_pos_on_parent_menu = pos
                                      break
                              assert self.zoom_pos_on_parent_menu
                      
                              self.update_zooms_menu_text()  # put the current value in the menu item text
                      
                              editor.callback(self.zoom_callback, [SCINTILLANOTIFICATION.ZOOM])  # for when user switches zoom level
                              notepad.callback(self.bufferactivated_callback, [NOTIFICATION.BUFFERACTIVATED])  # for when switching from view0 to view1 or vice versa
                      
                          def update_zooms_menu_text(self):
                              text_to_set = 'Zoom (current level: {:+})'.format(editor.getZoom())
                              self.mii.cch = len(text_to_set)
                              self.mii.dwTypeData = text_to_set if python3 else unicode(text_to_set, 'utf-8')
                              user32.SetMenuItemInfoW(self.npp_view_menu, self.zoom_pos_on_parent_menu, True, byref(self.mii))
                      
                          def zoom_callback(self, args): self.update_zooms_menu_text()
                      
                          def bufferactivated_callback(self, args):  self.update_zooms_menu_text()
                      
                      #-------------------------------------------------------------------------------
                      
                      # to run via another file, e.g., (user) startup.py, put these lines (uncommented and unindented) in that file:
                      #  import ZoomLevelInZoomsViewMenuText
                      #  zlizvmt = ZoomLevelInZoomsViewMenuText.ZLIZVMT()
                      # also note: need to make sure that "Initialisation" for "Python Script Configuration" is set to "ATSTARTUP" and not "LAZY".
                      
                      if __name__ == '__main__':
                          try:
                              zlizvmt
                          except NameError:
                              zlizvmt = ZLIZVMT()
                      

                      So, as mentioned in a previous post, you can quickly check the current zoom level by pressing Alt+v (to drop the View menu down) and then when you’re done, hit Esc to close the dropped menu.

                      1 Reply Last reply Reply Quote 2
                      • Alan KilbornA Alan Kilborn referenced this topic on
                      • wonkawillyW
                        wonkawilly
                        last edited by

                        I’d like to have this feature too.
                        In my experience usually the zoom level is indicated in the status bar in most of the software I use.
                        Probably modern GUIs usually implement zoom commands in the status bar and so I suppose that users would look there at a glance and to have coherence in GUIs probably would like to have it there since it is always visible and of easy of access.
                        Since I have 24" screen I would not mind having it at the left or right side in the status bar, as shown in the Management Studio screenshot of the OP, or even as it was in Windows Word Pad fashon:
                        ef261565-06d4-417f-9e0f-70b305c2ea80-image.png
                        or MS Word’s or, to dedicate to it the less possible space, instead of having an horizontal zoom selector perhaps would work even better a vertical one as in the Windows volume slider:
                        d9d66b50-ce4e-4b67-840e-0938fa4b1249-image.png
                        Of course completed with the indication also expressed in numbers and maybe a button to reset to default/standard zoom level or to a user-settable-standard-default (I don’t know how to call it) zoom level, for the current file or for all opened files altogether .

                        Alan KilbornA 1 Reply Last reply Reply Quote 0
                        • Alan KilbornA
                          Alan Kilborn @wonkawilly
                          last edited by Alan Kilborn

                          @wonkawilly

                          Regarding 228% screenshot: Way too much statusbar space wasted on a feature that is not very useful (IMO).


                          OK, so just what are people zooming in/out for??
                          Do people not know how to set an appropriate (for them) font size?? And thus set-and-leave zoom level at zero? And thus, just forget about zoom level forevermore?

                          Snabel42S mkupperM 2 Replies Last reply Reply Quote 2
                          • Snabel42S
                            Snabel42 @Alan Kilborn
                            last edited by

                            @Alan-Kilborn a few different times I find myself adjusting zoom:

                            • Different DPI and resolution on different monitors (application window currently being on different monitors
                            • Content of the current text (Source code vs long form text etc)
                            • My morning eyesight vs evening eye sight (mine changes due to tiredness)
                            • Whether I prefer wearing glasses or not (changes with eye straing, lighting conditions etc

                            I would personally much prefer zoom level being quickly visible in the status bar. rather than setting a font size and leaving it at that.

                            1 Reply Last reply Reply Quote 1
                            • mkupperM
                              mkupper @Alan Kilborn
                              last edited by

                              @Alan-Kilborn said in show the current zoom:

                              OK, so just what are people zooming in/out for??
                              Do people not know how to set an appropriate (for them) font size?? And thus set-and-leave zoom level at zero? And thus, just forget about zoom level forevermore?

                              I zoom in, out, and reset several times a day. Sometimes I need to see the big picture and will zoom out. Other times I want to see a detail and so I zoom in. When dealing with code I like to be able to see the entire block or section I’m dealing with and will adjust the zoom as needed. I use both the mouse wheel and keyboard’s Ctrl+Num +-/ to zoom in/out/reset.

                              However, for Notepad++ I have never need to know the zoom level as a number or percentage as I adjust the zoom until it looks good.

                              Lately I have been troubleshooting a web site issue and have discovered that knowing the exact zoom level, or being able to set it to an exact number in Firefox is useful as I have been taking screen shots and then using them to show what has changed. 80% zoom happens to be the sweet spot.

                              However, I really don’t need to know that a number such as 80% is the sweet spot. For example, let’s say in Notepad++ I am taking advantage of page up/down to show different views or aspects of something. I flip up or down through the pages like a slide show. In that case there will be a zoom level that is the sweet spot for this particular file. All I’d do would be to add a note, Zoom +3 that reminds me that the desired sweet spot is achieved by resetting the zoom and then doing three up-ticks using Ctrl /+++.

                              Alan KilbornA 1 Reply Last reply Reply Quote 1
                              • Alan KilbornA
                                Alan Kilborn @mkupper
                                last edited by

                                @mkupper said in show the current zoom:

                                However, for Notepad++ I have never need to know the zoom level as a number or percentage as I adjust the zoom until it looks good.

                                I was going to reply to @Snabel42 's comments with something like this.
                                The key takeaway: Knowing the zoom level number doesn’t do much for you, just adjust until the text looks “good” to you (whatever that means).

                                Here’s another point, when people are saying program X, Y and Z all have zoom in their status bar: I’d say that other programs use % values for this, and Notepad++ doesn’t provide a nice % value for the setting. So, if all the clamorers for this in the status bar get it, they’ll then start complaining that it isn’t showing a percentage.

                                Snabel42S 1 Reply Last reply Reply Quote 1
                                • Snabel42S
                                  Snabel42 @Alan Kilborn
                                  last edited by Snabel42

                                  @Alan-Kilborn said in show the current zoom:

                                  @mkupper said in show the current zoom:

                                  However, for Notepad++ I have never need to know the zoom level as a number or percentage as I adjust the zoom until it looks good.

                                  I was going to reply to @Snabel42 's comments with something like this.
                                  The key takeaway: Knowing the zoom level number doesn’t do much for you, just adjust until the text looks “good” to you (whatever that means).

                                  I was thinking the same thing. And I do agree that a lot of the time knowing the exact value probably is not necessary. Yet I somehow find myself wanting to see it. Maybe habit from it being such a common mechanism in many other applications I use?

                                  I was also considering the previously mentioned feature of allowing zoom to be synced between multiple tabs shown side-by-side. Side-by-side comparison views of multiple tabs is one scenario where I’d normally find myself wanting to “see” the zoom. I can usually sync up the zoom manually, but usually by overshooting the zoom in one of the tabs, then adjusting back to match the second tab.

                                  If syncing was a feature, I suppose seeing the actual zoom value/level would be needed even less. But then again seeing the zoom would perhaps let the user know if zoom-syncing was currently enabled or not for the two visible tabs.

                                  Alan KilbornA 1 Reply Last reply Reply Quote 0
                                  • deleeleeD
                                    deleelee @Alan Kilborn
                                    last edited by

                                    @Alan-Kilborn said in show the current zoom:

                                    there are currently two toolbar buttons dedicated to zoom

                                    There are actually three buttons. Zoom in, zoom out, restore default zoom.

                                    Another possibility would be to have a toolbar button that shows the current zoom then users can decide if they want to use it or not.

                                    PeterJonesP 1 Reply Last reply Reply Quote 0
                                    • PeterJonesP
                                      PeterJones @deleelee
                                      last edited by PeterJones

                                      @deleelee ,

                                      There are three zoom actions. There are only two zoom buttons on the default toolbar.

                                      3221d929-1b04-4c4b-a9b7-487c1095f252-image.png

                                      You can examine the Online User Manual’s list of all the toolbar buttons to confirm this

                                      If you have a button on the toolbar for the restore-zoom, you probably added it with the Customize Toolbar plugin or another plugin.

                                      deleeleeD 1 Reply Last reply Reply Quote 3
                                      • deleeleeD
                                        deleelee @PeterJones
                                        last edited by deleelee

                                        @PeterJones said in show the current zoom:

                                        you probably added it with the Customize Toolbar plugin

                                        Oh lordy, you are correct. Sorry about that. I forgot that plugin came with toolbar buttons.

                                        1 Reply Last reply Reply Quote 0
                                        • Alan KilbornA
                                          Alan Kilborn @Snabel42
                                          last edited by

                                          @Snabel42 said in show the current zoom:

                                          I was also considering the previously mentioned feature of allowing zoom to be synced between multiple tabs shown side-by-side. Side-by-side comparison views of multiple tabs is one scenario where I’d normally find myself wanting to “see” the zoom. I can usually sync up the zoom manually, but usually by overshooting the zoom in one of the tabs, then adjusting back to match the second tab.

                                          Here’s a script that will keep the zoom levels for both views the same. I call the script ZoomLevelKeepBothViewsSynched.py.

                                          # -*- coding: utf-8 -*-
                                          from __future__ import print_function
                                          
                                          #########################################
                                          #
                                          #  ZoomLevelKeepBothViewsSynched (ZLKBVS)
                                          #
                                          #########################################
                                          
                                          # references:
                                          #  https://community.notepad-plus-plus.org/topic/25844
                                          #  for newbie info on PythonScripts, see https://community.notepad-plus-plus.org/topic/23039/faq-desk-how-to-install-and-run-a-script-in-pythonscript
                                          
                                          #-------------------------------------------------------------------------------
                                          
                                          from Npp import *
                                          
                                          #-------------------------------------------------------------------------------
                                          
                                          try:
                                              editor1.hwnd
                                          except AttributeError:
                                              # running PS2
                                              import ctypes
                                              user32 = ctypes.WinDLL('user32')
                                              notepad.hwnd = user32.FindWindowW(u'Notepad++', None)
                                              editor1.hwnd = user32.FindWindowExW(notepad.hwnd, None, u'Scintilla', None)
                                          
                                          assert editor1.hwnd
                                          
                                          #-------------------------------------------------------------------------------
                                          
                                          class ZLKBVS(object):
                                          
                                              def __init__(self):
                                                  editor.callback(self.zoom_callback, [SCINTILLANOTIFICATION.ZOOM])
                                                  self.zoom_callback( { 'hwndFrom' : editor } )
                                          
                                              def zoom_callback(self, args):
                                                  if not notepad.isSingleView():
                                                      other_editor = editor2 if args['hwndFrom'] == editor1.hwnd else editor1
                                                      this_editor = editor2 if other_editor == editor1 else editor1
                                                      other_editor.setZoom(this_editor.getZoom())
                                          
                                          #-------------------------------------------------------------------------------
                                          
                                          # to run via another file, e.g., (user) startup.py, put these lines (uncommented and unindented) in that file:
                                          #  import ZoomLevelKeepBothViewsSynched
                                          #  zlkbvs = ZoomLevelKeepBothViewsSynched.ZLKBVS()
                                          # also note: need to make sure that "Initialisation" for "Python Script Configuration" is set to "ATSTARTUP" and not "LAZY".
                                          
                                          if __name__ == '__main__':
                                              try:
                                                  zlkbvs
                                              except NameError:
                                                  zlkbvs = ZLKBVS()
                                          
                                          Andi KiisselA 1 Reply Last reply Reply Quote 4
                                          • Alan KilbornA Alan Kilborn referenced this topic on
                                          • Andi KiisselA
                                            Andi Kiissel @Alan Kilborn
                                            last edited by

                                            @Alan-Kilborn said in show the current zoom:

                                            Here’s a script that will keep the zoom levels for both views the same.

                                            These five rows in startup.py do the same thing for me:

                                            def syncZoomLevel(args):
                                                level = editor.getZoom()
                                                editor1.setZoom(level)
                                                editor2.setZoom(level)
                                            editor.callback(syncZoomLevel, [SCINTILLANOTIFICATION.ZOOM])
                                            
                                            
                                            PeterJonesP 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post
                                            The Community of users of the Notepad++ text editor.
                                            Powered by NodeBB | Contributors