topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Friday December 13, 2024, 12:36 pm
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Last post Author Topic: N.A.N.Y. 2014 Submission: sumatra_earmarks  (Read 43734 times)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
N.A.N.Y. 2014 Submission: sumatra_earmarks
« on: October 26, 2013, 04:11 PM »
Use sumatra_earmarks to earmark any pdf page in SumatraPDF

sumatra_earmarks.png
Features
sumatra_earmark lets you earmark any pdf page in SumatraPDF
Each earmarked pdf page displays a blue square in the top right corner
Quickly toggle earmarks on/off with mouse or keyboard
Quicky jump to next/prev earmark page
Earmarks are autosaved to a textfile
Any pdf with at least one earmark shows a grey square in top right corner
Handy popup grid for quick jump to a specific earmark
Unique earmarks for different pdf files (based on file name)
The pdf files are not edited

Commands
Win+CapsLock = toggle earmark on/off for open pdf page
Win+PgUp/PgDn = jump to prev/next earmarked page in open pdf
Rightclick on blue/grey earmark square = toggle earmark on/off for open pdf page
Ctrl+Rightclick on blue/grey earmark square = popup grid for quick earmark jump
To customize hotkeys see tray icon menu

Download and details
http://nod5.dcmember...umatra_earmarks.html

v131120 new db format; works with pdf files with complex pagelabels (1,2,i,ii,iii,1.1,1.2,3,4,5...)
v131108 handles roman numeral pagenumbers; clarified help window
v131101 fixed mouse click bug (thanks you ewemoa!)
v131029b easier hotkey customization
v131029 reworked grid code; show current page below grid
v131028: earmark positioned next to scrollbar; trayicon menu; customize hotkeys (see tray menu)
v131026: first version

Please try it and report any bugs or issues.

Things to fix, features to maybe add:
- to fix: resize grid so all digits fit on different screen resolutions and scroll bar widths
« Last Edit: November 20, 2013, 02:53 PM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #1 on: October 26, 2013, 09:53 PM »
Was able to create a single earmark but a subsequent creation attempt lead to a crash of SumatraPDF -- but this was under Wine.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #2 on: October 27, 2013, 06:08 AM »
Hm, I wonder what the cause was. S_E saves each new bookmark to a .txt file database. It also tracks the pdf window position/title/pagenumber to overlay the bookmark correctly. I have never used autohotkey (or SumatraPDF) in Wine.
« Last Edit: October 27, 2013, 06:22 AM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #3 on: October 27, 2013, 10:31 PM »
Tested with more success via XP SP3.

Tried all of the shortcut keys with success :up:



In the test set up I see the little blue or grey rectangle covering the page-scrolling up arrow -- when I left click the square for a moment I see the scroll arrow and if I clickl soon enough the page scrolls a bit.  It doesn't seem easy to scroll by clicking on the up arrow while S_E is running.



Any chance of being able to configure the shortcut keys?  In my case I try not to have the Windows key be used for things outside of the system.



After control-right-clicking on the earmark square I see a little window with some numbers -- is there currently some way to tell which (if any) earmark might be closest to the page being currently displayed?

I think the page numbers are not being fully displayed here (e.g. for a two-digit page number I only fully see the first digit).

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #4 on: October 28, 2013, 04:52 PM »
Thanks for the feedback.

v131028: earmark positioned next to scrollbar; trayicon menu; customize hotkeys (see tray menu)

To fix: resize grid so all digits fit on different screen resolutions and scroll bar widths.

Not sure how yet. The grid is a listview control that I've fudged together. I need to resize it more exact or generate the grid some other way. Any ideas on how to best make a clickable grid resized to fit a variable array of data in autohotkey?
Was there a scrollbar in the popup where some digits where cut off? A screenshot would help.
« Last Edit: October 28, 2013, 04:58 PM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #5 on: October 28, 2013, 07:56 PM »
Some quick results with v131028:

  • full page numbers are seen via the "list of earmarks" window :) - still want a screenshot of old version in action?
  • earmark box now appears to the left of the scrollbox :up:

In my brief testing I noticed that clicking (left and right, and whether blue or grey) no longer toggles the earmark here -- though the shortcut key still works.



Haven't tried the customizing of the shortcut keys yet (hope to soon), but thanks for working on it!

What do you think about providing a sample shortcut key configuration file (to be renamed by user)?  Perhaps this might be useful because: 1) presumably the example would be one that worked, and 2) may be it might be easier for people to modify something than to create from scratch.



I neglected to mention that I'm trying via VirtualBox 4.3.x and SumatraPDF 2.3.2.
« Last Edit: October 29, 2013, 05:20 PM by ewemoa, Reason: edited spelling error »

kyrathaba

  • N.A.N.Y. Organizer
  • Honorary Member
  • Joined in 2006
  • **
  • Posts: 3,200
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #6 on: October 29, 2013, 08:38 AM »
Nice idea!

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #7 on: October 29, 2013, 04:17 PM »
v131029 reworked grid code; show current page below grid
v131029b easier hotkey customization

ewemoa: I reworked the grid code. Does the grid look on your system like in the (new) example image on the download page?
edit: clicking customize hotkeys in tray menu now autogenerates the .ini and opens it with instructions and example included.

kyrathaba: thanks!
« Last Edit: October 29, 2013, 04:50 PM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #8 on: October 29, 2013, 05:46 PM »
Some quick feedback for v1310129b (fresh install):

  • So far control-right-clicking on the earmark box doesn't lead to a grid window appearing -- any chance of a (non-mouse-involved) hotkey to invoke this functionality?
  • RIght clicking the earmark box hasn't toggled the earmark box state yet (both left and right clicking do make the box display grey temporarily before reverting) -- should it?
  • Customizing of hotkeys via modifying the generated ini file works with a subsequent S_E restart -- how does the idea of an option to reload earmarks via its tray menu sound (or perhaps some kind of auto reloading based on ini file change...)?


Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #9 on: October 29, 2013, 06:49 PM »
- I have no clue why neither the ctrl+rclick nor rclick commands works on your system. I see no problem in the code. I hope someone with a non-virtualbox Windows jumps in and test runs it too. That way we'll see if the issues are virtualbox-specific.
- a grid hotkey wouldn't be of use since the grid will need a mouse click to jump to an earmark anyway (no way to key navigate with the grid construction I've used).
- Simply restarting S_E takes about as many/few clicks as clicking one more extra tray command. So I'll keep it as is.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #10 on: October 29, 2013, 07:12 PM »
Another data point - W7 via VirtualBox exhibits the same symptoms.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #11 on: October 29, 2013, 09:05 PM »
- I have no clue why neither the ctrl+rclick nor rclick commands works on your system. I see no problem in the code. I hope someone with a non-virtualbox Windows jumps in and test runs it too. That way we'll see if the issues are virtualbox-specific.
- a grid hotkey wouldn't be of use since the grid will need a mouse click to jump to an earmark anyway (no way to key navigate with the grid construction I've used).

I can appreciate the point about the non-mouse grid hotkey -- but its existence would help me to test as currently getting the grid to show up doesn't work here.

On second thought, is it not possible that one might want to just see the grid view but not click on it?  For example, to verify whether there are any earmarks or perhaps find out how many there are...

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #12 on: October 30, 2013, 12:15 PM »
I've tested version 131029b on A Windows 7 Home computer and also in Windows 8 in Virtualbox and all commands worked. I tested using the latest Sumatra version 2.4. Maybe the bug only appears on earlier Sumatra versions?

If there is at least one earmark then the grey square is shown all the time. But you're right that a user may want to only see what and how many earmarks they have. However once the "click bug" is killed ctrl+rclick will do that for all users.

Here is version 131029b but with F4 added as a hotkey to open the grid, for testing:
[removed]

I should add that I hesitate to add more things to the grid. First, the grid was an afterthought, my primary aim was/is something like the temporary line bookmarks in text editors like notepad++ and notepad2. Sumatra already supports bookmarks (embedded in the pdf files) and user set favorites (through the menu bar, saved by Sumatra). So I won't add e.g. naming of earmarks. The main goal is to let users jump between a modifiable set of pages much quicker compared to the multi step procedure of the favorites in Sumatra.

Time to say this also: I appreciate the feedback!
« Last Edit: November 01, 2013, 06:49 AM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #13 on: October 30, 2013, 10:11 PM »
Maybe the bug only appears on earlier Sumatra versions?

Upgraded SumatraPDF here to 2.4, but at least under VirtualBox-XP there was no difference.  Will try to investigate testing under other conditions.

If there is at least one earmark then the grey square is shown all the time.

Aha -- good to know!

Here is version 131029b but with F4 added as a hotkey to open the grid, for testing:
http://nod5.dcmember...tra_earmarks--F4.zip

Thanks!  Was able to see the grid -- the numbers seem to show up fully now  :up:

Also appreciate the simplicity of S_E -- thanks for the further thoughts regarding its design.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #14 on: October 30, 2013, 11:20 PM »
I just tested with Windows 7 Pro SP1 64-bit (not as a guest OS) and SumatraPDF 2.4 with similar results:

  • Control-right-click on earmark doesn't bring up a grid window
  • Right-clicking the earmark behaves in the same ineffective way as described before

Curious.

I wonder if there is some pilot error...

FWIW, I've also duplicated the phenomena on another machine though there it was also via VirtualBox.  One host OS was Arch Linux while the other was Windows 7.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #15 on: October 31, 2013, 03:31 AM »
Thanks. I think the issue is in the code making adjustments if a vertical scrollbar is present. Is the gray/blue square positioned over or to the left of the scrollbar? If to the left of the scrollbar, try doing a ctrl+right click the scrollbar up button instead. Does that cause the grid to display?

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #16 on: October 31, 2013, 06:35 AM »
Is the gray/blue square positioned over or to the left of the scrollbar? If to the left of the scrollbar, try doing a ctrl+right click the scrollbar up button instead. Does that cause the grid to display?

The earmark square appears to the left of the square with the up arrow (at the top of the scrollbar).

Tried ctrl-right-clicking the up arrow button/square, but no grid appeared.

FWIW, ordinary right-clicking the up arrow button/square didn't ultimately change the state of the earmark either.  (Ordinary right-clicking of the earmark box still causes the earmark box to disappear for a moment before reappearing.)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #17 on: October 31, 2013, 12:02 PM »
I changed the code that detects the rclick on the square. Test this:
[removed]
« Last Edit: November 01, 2013, 06:49 AM by Nod5 »

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #18 on: October 31, 2013, 07:20 PM »
An initial test produced results similar to before.

However, decided to try another PDF and the results were different.

An obvious difference between the tests was that for one the bookmarks view was showing and for the other it wasn't.

Toggling the bookmarks view off for the PDF I had been testing before gave different (successful) results.

Perhaps the visibility of the bookmarks view makes a difference?

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #19 on: November 01, 2013, 06:51 AM »
Aha! The click detection code didn't take bookmarks sidebar into account. Fixed in latest version.

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #20 on: November 01, 2013, 08:13 PM »
Feedback for v131101:

  • Toggling off the earmark works with right-clicking (both for bookmarks showing and not).
  • Toggling on an earmark works via the keyboard but if there is no grey earmark box showing (presumably because there are no earmarks yet) then right-clicking does not cause a blue earmark to appear (whether bookmarks are showing or not).  If a grey earmark box is showing, toggling via right-clicking seems to work.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #21 on: November 02, 2013, 04:15 AM »
That is exactly as planned. I set the mouse commands to work only if there is at least one earmark and a grey/blue square visible to avoid accidental earmarking. I'm glad things are working now. Thank you for the troubleshooting!

ewemoa

  • Honorary Member
  • Joined in 2008
  • **
  • Posts: 2,922
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #22 on: November 02, 2013, 07:13 AM »
Hmm.

Please consider changing the text that appears via the "how to use" menu item:
RightClick top right pdf corner = toggle earmark on|off for open pdf page

I believe reading that contributed to my expectation of the right-clicking working to set the first earmark even with no grey box.



...and I also hope the feature makes it into SumatraPDF ;)

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #23 on: November 02, 2013, 10:40 AM »
Yeah, that is a bit misleading in the help popup. Will update it for the next version. I've clarified on the download site and in the first post here.

Nod5

  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 1,169
    • View Profile
    • Donate to Member
Re: N.A.N.Y. 2014 Submission: sumatra_earmarks
« Reply #24 on: November 08, 2013, 01:18 PM »
New update
v131108 handles roman numeral pagenumbers; clarified help window
Background: I came across some pdf files with roman numerals in the first few pages which tripped up the next/prev jumping. Fixed now.