Hi Denis,

 Denis> Hi Daniel,
 Denis> Yes, the top of the MRU does always have the current document as soon 
as 
 Denis> there is a .xoj file name available (i.e., either we opened an existing 
 Denis> .xoj file, or it was created from scratch and saved to disk).  So, all 
 Denis> that should be needed in order to save the last page viewed is for 
 Denis> close_journal() to update the page info for the first mru entry if 
 Denis> ui.filename is non-NULL (perhaps after checking that the first MRU 
entry 
 Denis> does match ui.filename if you're paranoid, but it should).

Done. 

 Denis> Ah, except on_fileQuit_activate() on on_winMain_delete_event() quit 
 Denis> directly without passing through close_journal(). One approach is to 
 Denis> also update the MRU page number at the end of main.c (just before 
 Denis> save_mru_list() preferably); the other approach is to make fileQuit and 
 Denis> winMain_delete call close_journal() and do a full cleanup of data 
 Denis> structures instead of simply hanging up after ok_to_close().

done.

 Denis> (By the way, one could modify the MRU logic so that the filename also 
 Denis> gets inserted into the MRU only when the file is discarded, rather than 
 Denis> when it is opened or assigned a name -- so, at the same time that we 
 Denis> update the page number in the MRU. This would have the advantage of 
 Denis> consolidating the calls to update the MRU into a single place. One 
 Denis> drawback is that I personally like the first MRU entry in the menus be 
 Denis> the current file, which can be useful to revert all unsaved changes or 
 Denis> refresh a PDF background that was modified externally just by typing 
 Denis> alt+f u 1 -- but this is perhaps not crucial). (Note, the "refresh PDF" 
 Denis> usage of the MRU, if it is used more widely than just by myself, pleads 
 Denis> for the idea that we in fact may want to update the page number in the 
 Denis> MRU continuously, perhaps at do_switch_page() if ui.filename is 
non-NULL ?)

we can change it if you want.

I have added something extra. I copied the way evince saves metadata in
the file itself using gvfs (well, not quite; it is saved in a file in
the homedirectory but that is gvfs, not evince). If you using Linux try
opening a PDF file with evince and then run this command:

gvfs-info -a "metadata::*" <filename>

you will see something like this:

dmg@yttrium:~/git.w/xournal/xournal/src$ gvfs-info -a "metadata::*" 
~/Dropbox/review/2014/conf/conf2015_submission_328.pdf
uri: file:///home/dmg/Dropbox/review/2014/conf/conf2015_submission_328.pdf
attributes:
  metadata::evince::page: 4
  metadata::evince::dual-page-odd-left: 0
  metadata::evince::window_height: 1097
  metadata::evince::zoom: 2.3936547231795959
  metadata::evince::sizing_mode: free
  metadata::evince::sidebar_page: thumbnails
  metadata::evince::window_width: 1864
  metadata::evince::sidebar_size: 178
  metadata::evince::dual-page: 0
  metadata::evince::window_x: 2181
  metadata::evince::window_y: 341
  metadata::evince::window_maximized: 0
  metadata::evince::inverted-colors: 0
  metadata::evince::continuous: 1
  metadata::evince::sidebar_visibility: 0
  metadata::evince::fullscreen: 0

I copied the code from Evince and now xournal saves the current page:

dmg@yttrium:~/git.w/xournal/xournal/src$ gvfs-info -a "metadata::*" 
/home/dmg/Dropbox/review/2014/saner/saner2015_submission_58.pdf.xoj 
uri: file:///home/dmg/Dropbox/review/2014/saner/saner2015_submission_58.pdf.xoj
attributes:
  metadata::xournal::currentPage: 8

theoretically we could save other metadata, but that is up for
discussion.

This does not work under windows nor OSX, but the logic is robust enough
to simply be ignored in an OS that does not support gvfs.

Denis, if you use Linux, I think you will like it. It is basically the
logic we discussed (saving the last page accessed) without altering the
xournal file. One thing we could do is to add a flag so this is saved
only when the user wants it (and none by default).

But there is one message that i get every time I open a xournal that has
annotations and I want to jump to a different page (see attachment):
"Save this version and delete auto-save?" But I have autosave enabled,
so I still dont' know where this message comes from.

The code is in github. This branch is based on upstream, so it should be 
mergeable.

https://github.com/dmgerman/xournal/tree/mru


--dmg


--
Daniel M. German                  ""
                                   
http://turingmachine.org/
http://silvernegative.com/
dmg (at) uvic (dot) ca
replace (at) with @ and (dot) with .

 
------------------------------------------------------------------------------
Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
from Actuate! Instantly Supercharge Your Business Reports and Dashboards
with Interactivity, Sharing, Native Excel Exports, App Integration & more
Get technology previously reserved for billion-dollar corporations, FREE
http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
_______________________________________________
Xournal-devel mailing list
Xournal-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/xournal-devel

Reply via email to