
When working with computer applications it is wise to save your work often.
The Save file menu option saves the current user data in the application to the original file. But this is no use when you want to maintain a version of the file to compare against, which is a helpful if the edits after the save don't produce the required result.
The Save As... file option provides the ability to save the current user data to a new file, while leaving the original version of the file unaltered. After the file is saved the new file name (the intended draft or back-up file), becomes the working version in the application. And this is the problem of using the Save As... file menu feature to make back-up or draft files, because it is intended to make a copy of the file for use in its own right, not for making a file containing a draft or back-up copy of the user's data that can be reverted to, or compared against.
Problems with using Save As... to make draft or back-up copies of user data include,
To work-around the problems of the File > Save As... function as a back-up tool, the user must save their changes, then "save as..." their changes, then (optionally) close the current version of the data file, (save as... changes the current working file), then re-open the saved version of the file to make it the working version.
However, with my File > Save To... function, as the user edits the data in the application they can save the current data to a new draft or back-up file, e.g. myfile-bck1.ods, myfile rev 2.cpp, myfile r3.png etc. but then continue working on the file that was originally loaded.
The continuation of the Save To... file menu feature, is the Save To Draft file menu feature. When the user uses this feature, a file is created with either of the following automatically generated version identifiers appended to the root file name,
The user can select the version identifier type and for the sequential number option, they can specify additional text to be included with the version number, e.g. Rn, Revn, bckn etc.
This page contains the following information on this "Tarsier Tool",
User Guide
Revision History
Software for Download
Source Code
Licensing
Technical Support
This example uses a simple text editor application to demonstrate the file save to functionality.
Using the File > New menu item to create a new file or the File > Open menu item to open an existing file.
After editing the File > Save menu item is used to save the user's data to a file, e.g. myfile.txt.
After further editing the File > Save As... menu item and dialog box are used to save the user's data to a new file, e.g. myfile-bck0.txt.
If the data in the file is used in an another application, for example the file is a program source file or the file is used in a web page, the current version of the data, i.e. the example file myfile-bck0.txt, would not be used, but rather the original file, (in this case myfile.txt), would still be referenced by the application, until that application's configuration is edited, which is a time-wasting and error prone activity, especially if (wisely) frequent back-ups are made.
After major changes are made, if the data is saved using File > Save instead of File > Save As..., then the data in the back-up version is over-written. This results in a lot of wasted work if the changes don't work and the now over-written back-up version has to be restored!
However, using my File > Save To... menu item and dialog box the user's data to a new file, e.g. myfile-bck1.txt the user can save the current data in the application to a new draft or back-up file and the original data file remains in use. As the original data file remains in use in the application, a File > Save will save user data to it, not to the previously created draft or back-up file. Therefore there is no longer the danger of accidentally over-writing a draft or back-up file.
A final File > Save of the working version ensures that the original file contains the final version of the user's data, which ensures the user's latest data will be used by applications that are using the data contained in the file.
The directory contents after using several save tos to create draft or back-up files. A final save has saved the original file as the most recent.
This example uses a simple text editor application to demonstrate the file save functionality.
Using the Edit > Preferences or Tools > Options dialog box, (as applicable to the operating system you're using), the user specifies whether the version identifier automatically appended to the root (original) file name is;
When using a sequential number, the user can specify the,
After opening (File > Open menu item) an existing file or creating a new one, (File > New menu item),
this will be the original or root file name and will be used as the root of the file names automatically generated by the File > Save To Draft function.
As the user edits the data in the application they can save the current data to a new draft or back-up file with a single click of the File > Save To Draft function. The automatically generated addition to the root file name is generated based on the rules selected in the Preferences or Options dialog box, but the original data file remains in use. As the original data file remains in use in the application, a File > Save will save user data to it, not to the previously created draft or back-up file. Therefore there is no longer the danger of accidentally over-writing a draft or back-up file.
A final File > Save of the working version ensures that the original file contains the final version of the user's data, which ensures the user's latest data will be used by applications that are using the data contained in the file.
The directory contents after using several save to drafts to create back-up files with a version identifier automatically added. A final save has saved the original file as the most recent.
I need to create menu icons for Save To... and Save To Draft, but have no artistic skill.
The code for this Tarsier Tool is an example to demonstrate the concept of the Save To... file menu function and the Save To Draft file menu function and associated Preferences or Options dialog box. It was used to generate the above application screen shots. This Tarsier Tool (code) is not a library, so you'll need to customise the code for your application, programming language or GUI API.
This Tarsier Tool is written in C++ and uses the wxWidgets API, (revision 2.8.10). I use wxWidgets because when I started writing GUI apps. its licence permitted applications developed using it to be used for commercial purposes without requiring a fee, whereas Qt required a license fee.
I find the wxWidgets API easy to use and so I hope you'll be able to copy the code and implement the Save To... and / or Save To Draft file menu functions easily in your application.
The example application was compiled and tested using gcc version 4.4.1 on Ubuntu 9.10.
To review or use this Tarsier Tool, use the following procedure.
Once the application files have been extracted use your favourite editor or IDE to view them and incorporate them into your application. Refer to the Source Code section for details of the key classes used to implement the Save To... file menu function and the Save To Draft file menu function and associated Preferences or Options dialog box.
If you want to run the example application, you will need to install and configure wxWidgets on your system if it is not already installed. You will then need to edit the make file to reference your wxWidgets build, (described in the above link).
The demonstration code referenced in the previous section contains the source code for this Tarsier Tool.
Key item of the code is the FileNameManager class.
The class maintains a copy of the main (or root) file name in use, which must be updated during file open, file new and file save as events. For the save to event, the class is used to store the the main (or root) file name, while the normal save as dialog box and actions are used to save the current data to the user specified file.
For the save to draft events, the class uses the main (or root) file name to obtain the draft file name. For the current date and time option, this will be the main (or root) file name with the current time and date appended. For the sequential number option, the directory containing the file will be searched for previous draft files and the class will provide the main (or root) file name with the new highest revision number appended.
The class functions are as follows.
The OptionDialog class creates an options dialog box with a single tab to provide the options for the save to draft function. You will need to add the options tab on this tab to your application's option or preferences dialog.
The user options set in the OptionDialog class are communicated to the FileNameManager class in my application in the UserOptions class, which stores the specified user option names and values in an STL Map.
The FileNameManager class does not use the UserOptions class directly, making it easier for you to change the communication method. However, note that there is a run-time linking between the OptionDialog class and the FileNameManager class in the names used to store the options. While simplifying the class structure, this removes compile time checking of the link, e.g. the application uses the text num-sys-sel to communicate number system selected by the user in the OptionsDialog to the FileNameManager class. If you change the text in the OptionDialog class, but not where the value is looked up and passed to the FileNameManager class, then the application will still compile, but will not work.
The C++ classes in the application are as follows.
This "Tariser Tool" is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. There is no license fee for personal use of this tool. However, if you are using this software within software that you are developing and intend to sell, please e-mail me for details of the license fee.
There are no FAQ for this "Tarsier Tool".
If you have a question, please e-mail it to me. Please ensure that you identify that the question is about my Save To... File Menu Function (TT10-001) "Tarsier Tool".
If you suspect a bug in this "Tarsier Tool" please e-mail me a description.
Please ensure you identify that the bug report is about my Save To... File Menu Function (TT10-001) "Tarsier Tool", the compiler and the operating system in the e-mail and include as much detail as possible; including a simple example application is always helpful! But make sure it does not contain proprietary or confidential information.