Hi Daniel, Yes, the top of the MRU does always have the current document as soon as there is a .xoj file name available (i.e., either we opened an existing .xoj file, or it was created from scratch and saved to disk). So, all that should be needed in order to save the last page viewed is for close_journal() to update the page info for the first mru entry if ui.filename is non-NULL (perhaps after checking that the first MRU entry does match ui.filename if you're paranoid, but it should).
Ah, except on_fileQuit_activate() on on_winMain_delete_event() quit directly without passing through close_journal(). One approach is to also update the MRU page number at the end of main.c (just before save_mru_list() preferably); the other approach is to make fileQuit and winMain_delete call close_journal() and do a full cleanup of data structures instead of simply hanging up after ok_to_close(). (By the way, one could modify the MRU logic so that the filename also gets inserted into the MRU only when the file is discarded, rather than when it is opened or assigned a name -- so, at the same time that we update the page number in the MRU. This would have the advantage of consolidating the calls to update the MRU into a single place. One drawback is that I personally like the first MRU entry in the menus be the current file, which can be useful to revert all unsaved changes or refresh a PDF background that was modified externally just by typing alt+f u 1 -- but this is perhaps not crucial). (Note, the "refresh PDF" usage of the MRU, if it is used more widely than just by myself, pleads for the idea that we in fact may want to update the page number in the MRU continuously, perhaps at do_switch_page() if ui.filename is non-NULL ?) Denis On 12/09/2014 11:12 PM, dmg wrote: > On Tue, Dec 9, 2014 at 2:06 PM, D M German <d...@turingmachine.org> wrote: >> >> 2. When should the MRU be updated with the page number? The current >> document does not have an entry. I gets it when it is saved. so my gut >> feeling tells me when the xournal is saved. What do you think? > > > Oh, but then it will not be very usable if the file is never saved. Mmm. > I guess the top of the MRU should always have the current document > (unless it does not have a name yet). > The page should be updated when the file is disposed of, i guess. > Hopefully the saving of the MRU happens > after the file is disposed. > -- Denis Auroux UC Berkeley, Department of Mathematics aur...@math.berkeley.edu Institut Henri Poincare, Paris aur...@ihp.fr ------------------------------------------------------------------------------ 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