Sumatra PDF is a PDF, ePub, MOBI, CHM, XPS, DjVu, CBZ, CBR reader for Windows

Add more buttons to the Toolbar (Rotate, Back, Forward etc.)

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.

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

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

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).

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!

1 Like

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.

[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

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 dificult to configure for SumatraPDF but it is takes some trial and error, below it is tested on XP, (blindingly fast) unknown how it behaves on newer windoze that was a later version 2.5 of SumatraPDF and it works well with 3.1Zeniko build
It is more difficult to modify banacle to work with a recent SumatraPDF 3+ (even with tabs off) without changing barnacles source code (as supplied with its app)

see https://www.dcmembers.com/skrommel/download/barnacle/

untitled

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!

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

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!

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?

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.

@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;

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.

[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

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.