Forum moved here!

Home / More buttons on the Toolbar (Back, Forward etc.) [Rotate=now included]

rashkin

Hi sumtarapdf developer,

Could you add “Back” or “Forward” navigation button on toolbar?

Currently it’s incovenient, as to navigate back I must either do:

  1. Select menu “Go To” → “Back”.
    or
  2. Press “Alt + Left” shortcut.

By having back/forward button in toolbar it will be more convenient and faster as I can just left click the toolbar button.

SumatraPeter

A customizable toolbar has been requested probably a zillion times. Read this official response:

rashkin

What a disappointing response. Someone should make a fork with customizable toolbar.

kjk

Or contribute the code.

I’m not opposed to toolbar customizable via settings file. It’s just a lot of work that no-one did (or is planning to do, as far as I know).

z1148780

I’d love to see a simple rotate 90° right button at the main toolbar.
I know there is a keyboard shortcut but most users I know are not used to it and rotating a documents is an everyday task.
Thanks!

lumberjack

I’ll second this request. I recently switched to Sumatra but I’m frustrated by the lack of this basic function on the main toolbar.

GitHubRulesOK

[Later EDIT]
Note that much of the discussion on replacing Image based toolbar icons has now been made redundant in version 3.2 and later since the newer toolbar icons are SVG based and daily 9th feb 2021 pre-release includes Rotate Icons

Dare I mention :slight_smile: that until a custom menu plugin is added you could use third party apps such as barnacle

It was not too difficult to configure for SumatraPDF but it is takes some trial and error, worked well on XP, (blindingly fast) version 2.5 of SumatraPDF and it worked well with 3.1Zeniko build unknown how it behaves on newest windoze

Note It is more difficult to modify barnacle to work with a recent SumatraPDF 3+ (even with tabs off, and needs to be altered when tabs are on) without changing barnacles source code (as supplied with its app)

see Barnacle – Skrommel's One Hour Software

cniggeler

In Toolbar.cpp, after this line:
{10, IDM_FIND_MATCH, _TRN("Match Case"), 0},

add the following two lines:
{11, IDM_GOTO_NAV_BACK, _TRN("Navigate Back"), 0},
{12, IDM_GOTO_NAV_FORWARD, _TRN("Navigate Forward"), 0},

I don’t have Visual Studio 2015 or 2017, but viewing the code there already, I think it will be OK.

OP did not request customizable toolbar, just the addition of two items. As RE: linked response, there are actually only 7 functions on the toolbar so far (some of them are toggles (Zoom In/Out, Find Previous/Next)). So I disagree with the sentiment in the link that “Our current toolbar already is quite big.”

Thanks for considering!

GitHubRulesOK

actually 11 and 12 are “taken” so would need to be say 13 & 14
the code above only handles tooltip translation not the toolbar graphics logic e.g to when grey out or total length

cniggeler

Thanks for the pointer! Am using 13 and 14 as suggested. RE: graphics logic: in IsToolbarButtonEnabled() I have added:
case IDM_GOTO_NAV_FORWARD:
return win->ctrl->CanNavigate(1);
case IDM_GOTO_NAV_BACK:
return win->ctrl->CanNavigate(-1);
(sorry can’t get the above to indent using “preformatted text” - thought that preserved spaces?)

I have also cut/pasted the forward/backward arrows in toolbar_11.bmp to the end, put some gawdawful coloring on them so they look different (can always create professional icons later :wink: ). They are icons 13 and 14; I assume that’s why you suggested 13 and 14 for the indices above?

I am not sure about your reference to “total length”. What is missing there, and what else am I missing? Thanks!

GitHubRulesOK

I’m not a programmer by trade, so can easily critique not build :slight_smile:
the bright pink is I think for transparency since bmp format does not usually have it, Icons were from a variety of sources but you could look at the famfamfam.com ones as mentioned in source (some from silk set?)
I did not go through logic of buttons but there may be a var for combined total length, if that is the case and not increased they would be truncated?

cniggeler

I can’t find the definitions for BITMAP or GetObject(), so I don’t know whether there is a size issue or not. From what I see in toolbar_11.bmp, it could be the program assumes a fixed icon width, so as it loops for bmpIndex iterations, it grabs n pixels at a time.

GitHubRulesOK

@cniggeler
As you point out most of the icon handling seems dynamic (so should be self adjusting)

beware in Toolbar.cpp

599      // the name of the bitmap contains the number of icons so that after adding/removing 
…

later
620 // in Plugin mode, replace the Open with a Save As button
621 if (gPluginMode && size.dx / size.dy == 13) {
622 gToolbarButtons[0].bmpIndex = 12;

SumatraPeter

Yes, this OP did. What about all the others who have requested various other additions/modifications to the toolbar as well over the years? I see no reason to reject their demands and accede only to the ones made here, which is why a customizable toolbar would be the ideal solution for most everyone (if it is ever implemented, of course).

Meanwhile nothing stops anyone from compiling a custom version with their desired changes, as you seem to be doing.

Everyone has different ideas about what constitutes a good easy-to-use uncluttered UI. Perhaps the dev’s thoughts in this regard have changed over the years; perhaps they haven’t. The only way to satisfy the maximum number of people IMO is to provide a suitable level (too much is also bad/unmaintainable) of UI flexibility and customizability (toolbars, keyboard shortcuts etc.) Unfortunately no Sumatra-using programmer in all these years has come forth to contribute the required code. If you can go beyond implementing just these navigation buttons in your fork and do the needful, lots of users will be grateful, believe me.

GitHubRulesOK

[Later EDIT]
Note that much of the discussion on replacing Image based toolbar icons as below has now been made redundant in version 3.2 and later since the newer toolbar icons are SVG based

@ cniggeler
I note you hesitated to reply, SumatraPeter is correct that there have been many requests such as please just add 2 rotate buttons, toggle ui on/off, add more zoom such as 100 % button etc etc
a search on the old forum, this forum and the open/closed issues will give many such hits
I think you will find some of kjk s latest thoughts at https://github.com/sumatrapdfreader/sumatrapdf/issues/734

You may note he quotes different source for icons that may not be the ones initially used
however the other points to watch are transparency is “magenta” i.e. full red & blue (=zero green)
also from above note that icons count from base 0 so if you propose say 18 icons that would need toolbar_17.bmp

so a potential suggestion for “extension” is to first check for a file with such a name in the app folder (if not there use internal toolbar_11.bmp
subtract 11 thus in this case the counter would load another 6 icons and have a "customToolbar.txt"s file with the same number (e.g. 17 = + 6) extra keyboard commands ether in a form of keyboard parlance or a known list of internal program actions, although I guess they are unlikely to be the same or available at runtime (i.e. after compile) so think it would involve a subroutine for internaly mapping the external text to key codes and there may be a need to let user add tooltips instead of TRN phrase
< Ctr l> < Shift > - ; “Rotate &Left\tCtrl+Shift±”
< Ctrl > < Shift > + ; “Rotate &Right\tCtrl+Shift++”
< Alt > + Left ; “Navigate Back”
< Alt > + Right ; “Navigate Forward”
etc
etc

this approach throws up the issue that some commands such as Rotate should be ignored in the same way as MF_NOT_FOR_CHM | MF_NOT_FOR_EBOOK_UI
so I propose for now these extensions should be confined to “FixedUI” ONLY

A “bonus” (or possibly not :slight_smile: ) to this approach is that users can “skin” their own icons for the 12 standard ones, lets hope that they understand at present they could not change 16x16 pixels to 32x32 (or otherwise) without significant recoding of source, also for bounds checking it would need to be a limited number of icons to avoid exceeding boundaries

phumipat

I want to add rotate left or right in quick access toolbar.
How to add quick access toolbar?
I see Adobe reader can do. Thanks for your help.

GitHubRulesOK

NOTE today 9th Feb 2021 that 64bit daily pre-release now includes icons for rotate Top to Left (CCW) and Top to Right (CW)

Should eventually filter down to stable release, just don’t ask when.

Should only show up and work with all FixedUI pages including images and comic books.

Before someone says they don’t work for eBooks or Chm ensure you have either changed advanced settings for those to
UseFixedPageUI = true
or for ebooks ( and Chm) you can use Alt + D + T to Debug > Toggle ebook UI then R to refresh/reload current document (if you have several tabs open each may need a refresh)
image

If your looking for permanent rotate (edit/destruct) one or more PDF pages (not just the rotate view all) then see Please add Tool for Rotating Pages Permanently - #4 by GitHubRulesOK

GitHubRulesOK

The toolbar is already too full see the last icon is part missing and warning area is also missing. perhaps need to remove one icon ?

kjk

This is tracked by more/customizable toolbar buttons · Issue #1956 · sumatrapdfreader/sumatrapdf · GitHub

GitHubRulesOK

@vasmasal
Do not get me wrong your request is not unreasonable as many users want multiple rows of Tabs and or Icons, However the ethos of SumatraPDF has always been to minimalize all the surrounding slowdown clutter.

For example the designed removal of scrollbars on single page has always been a criticism by those who favour that extra distraction. I intentionally switched SumatraPDF setting to show in above post the right half view ALL icons, menu and tabs but SumatraPDF will default to only menu or tabs not both.