<< | Page list | >>
Open/close groups of files with a single name
1. Named Sessions
As in KATE (KDE Advanced Text Editor), a group of logically-related documents (as decided by the user) can be assigned a single name. This group can be opened or closed by issuing the same command to the group name as opposed to each individual member document. The documents need not be master/children - in fact this feature would work best for loosely-related documents because master documents can already open child documents and that interface is very intuitive.
1.1 Use case
- User starts LyX and begins copy-pasting material from a group of reports into one master document - a research paper. These form a logical group and LyX can, right now (v1.6), open them all *if* these were the last files that were open the last time I used LyX. Suppose that was indeed the case.
- User finishes work on the research paper and decides to pull up another group of documents related to a petition she's writing. Right now, she'd have to,
- close-all
- open each petition-related lyx doc one by one
- Instead, if she could group these files into a lyx-document session named "Petition", then she could choose this session (say from the file menu), and LyX would close all open files that are not part of the Petition session and open the others that are. With one command she has just opened the set of documents that she'd like to work with.
1.2 GUI Description
New Sessions
item in top-level application menu with the following structure:
Sessions
-
New
- Dialog to enter a new name for the set of current open documents
-
Open...
- Close all documents and show dialog that lists previously created sessions (click opens)
-
Open Recent >
- List most recently used sessions
-
Save
- Update the document membership of the current session to include only those that are currently open
-
Save as...
- Copy session to one with a new name (to permit incremental modification)
-
Manage...
- Open a dialog listing available sessions and basic membership info. Allow renaming, deletion etc.
1.3 Implementation notes
- A document can belong to any number of sessions
- LyX starts up with a session named (Null) with no members
- Any files opened are added as members
Sessions->Save
will prompt for name if session name is (Null)
- Use QSettings to store info in platform-independent way
- Reconcile feature to last-session-info in LyX->Preferences->Look & Feel->User Interface
- Deleting a session should not delete member documents/files
- Should sessions allow some kind of meta-info?
- When application is closed, user should be prompted for saving changes to session membership
- The current Session class could be refitted to perform the open/close and as a guide for what info to save
- Code to open child documents from the master could be used to open/close groups of files
2. Simplified implementation
- Provide command-line option to set suffix of
~/.lyx/session
file. Example: lyx --session-name foo
will use session in file ~/.lyx/session.foo
or ~/.lyx/sessions/foo
. This should be very cheap to implement and will cover most of the use-cases. Menu items and additional user interface can be implemented later. However it would be nice to have at least "Save session as..." option in the menu.
3. Alternatives
- How about programming "named session" management as a separate application communicating via the lyx server?
- The Jed text editor <http://www.jedsoft.org/jed/> has "local recent file lists" instead of named sessions:
- The File>Recent Files menu has a toggle "Use (local|global) filelist" and a "Clear cache" item.
- The local filelist is stored as .jedrecent in the pwd. This file is removed if it is empty when lyx closes.
- A configuration variable sets the preferred list to one of "global", "local if present" or "local".
- So, instead of saving a named session, the user would start LyX in a "project dir" and create a local recent file list by File>Recent>Use local list.
- Instead of using a named session, the user would start LyX from the "project dir" and use File>Recent as usual.
4. Categories
Category: LyX 2_1