diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index ec5126c4d..6ca95e63a 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -15,6 +15,12 @@ $Id$
-----------------------
* Mouse cursor can be hidden (e.g., using "--hidecursor"), useful on
touchscreen devices like tablet PCs or the Nokia Mameo devices.
+ (Addresses SourceForge RFE #1673344)
+
+ * Added an "autosave" option that assumes you wish to save the current
+ picture during Quit. (Additionally, after saving during Quit or Open,
+ it no longer shows 'success' pop-up that must be dismissed.)
+ (Addresses SourceForge RFE #1680500)
* Tool Improvements:
------------------
diff --git a/docs/OPTIONS.txt b/docs/OPTIONS.txt
index 32e59a848..4a7c880fa 100644
--- a/docs/OPTIONS.txt
+++ b/docs/OPTIONS.txt
@@ -333,6 +333,11 @@ Windows Users
situations where the program is only being used for fun, or in a
test environment.
+ autosave=yes
+
+ This prevents Tux Paint from asking whether you want to save the current
+ picture when quitting, and assumes you do.
+
startblank=yes
This causes Tux Paint to display a blank canvas when it first
starts up, rather than loading the last image that was being
@@ -569,6 +574,7 @@ Windows Users
--saveover
--saveovernew
--nosave
+ --autosave
--lang LANGUAGE
These enable or correspond to the configuration file options
described above.
@@ -599,6 +605,7 @@ Windows Users
--mouse
--saveoverask
--save
+ --noautosave
These options can be used to override any settings made in the
configuration file. (If the option isn't set in the
configuration file(s), no overriding option is necessary.)
diff --git a/docs/html/OPTIONS.html b/docs/html/OPTIONS.html
index 8c30cae3d..c747d9586 100644
--- a/docs/html/OPTIONS.html
+++ b/docs/html/OPTIONS.html
@@ -413,6 +413,12 @@ New Breed Software
fun, or in a test environment.
+ autosave=yes
+
+ This prevents Tux Paint from asking whether you want to save
+ the current picture when quitting, and assumes you do.
+
+
startblank=yes
This causes Tux Paint to display a blank canvas when it first
@@ -886,6 +892,7 @@ New Breed Software
--saveover
--saveovernew
--nosave
+ --autosave
--lang LANGUAGE
@@ -919,6 +926,7 @@ New Breed Software
--mouse
--saveoverask
--save
+ --noautosave
These options can be used to override any settings made in
diff --git a/src/manpage/tuxpaint.1 b/src/manpage/tuxpaint.1
index a1debd32d..8d8481e63 100644
--- a/src/manpage/tuxpaint.1
+++ b/src/manpage/tuxpaint.1
@@ -36,6 +36,7 @@ tuxpaint -- A drawing program for young children.
[\-\-saveover]
[\-\-saveovernew]
[\-\-nosave]
+[\-\-autosave]
[\-\-colorfile \fIFILE\fP]
.TP 9
@@ -261,6 +262,11 @@ The \fInosave\fP option disables \fITux Paint's\fP ability to save files.
This can be used in situations where the program is only being used for
fun, or in a test environment.
+.TP 8
+.B \-\-autosave \-\-noautosave
+The \fIautosave\fP option prevents \fITux Paint\fP from asking whether you
+want to save the current picture when quitting, and assumes you do.
+
.TP 8
.B \-\-startblank \-\-startlast
When you start \fITux Paint\fP, it loads the last image that was being worked
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index de0805162..ccd0f2a57 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -808,7 +808,7 @@ static int fullscreen, native_screensize, disable_quit, simple_shapes,
no_button_distinction,
mirrorstamps, disable_stamp_controls, disable_save, ok_to_use_lockfile,
alt_print_command_default, scrolling = 0,
- start_blank;
+ start_blank, autosave_on_quit;
static int want_alt_printcommand;
static int starter_mirrored, starter_flipped, starter_personal;
static int recording, playing;
@@ -1213,7 +1213,7 @@ static void free_surface_array(SDL_Surface * surface_array[], int count);
// int fixed);
static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush);
static int rotation(int ctr_x, int ctr_y, int ox, int oy);
-static int do_save(int tool);
+static int do_save(int tool, int dont_show_success_results);
static int do_png_save(FILE * fi, const char *const fname,
SDL_Surface * surf);
static void get_new_file_id(void);
@@ -1813,7 +1813,7 @@ static void mainloop(void)
/* Ctrl-S - Save */
hide_blinking_cursor();
- if (do_save(cur_tool))
+ if (do_save(cur_tool, 0))
{
/* Only think it's been saved if it HAS been saved :^) */
@@ -2204,7 +2204,7 @@ static void mainloop(void)
}
else if (cur_tool == TOOL_SAVE)
{
- if (do_save(old_tool))
+ if (do_save(old_tool, 0))
{
been_saved = 1;
tool_avail[TOOL_SAVE] = 0;
@@ -5326,7 +5326,8 @@ static void show_usage(FILE * f, char *prg)
" %s [--nostampcontrols | --stampcontrols]\n"
" %s [--mirrorstamps | --dontmirrorstamps]\n"
" %s [--saveoverask | --saveover | --saveovernew]\n"
- " %s [--nosave | --save]\n" " %s [--savedir DIRECTORY]\n"
+ " %s [--nosave | --save] [--autosave | --noautosave]\n"
+ " %s [--savedir DIRECTORY]\n"
#ifdef WIN32
" %s [--printcfg | --noprintcfg]\n"
#endif
@@ -6066,6 +6067,7 @@ static void setup(int argc, char *argv[])
#endif
only_uppercase = 0;
promptless_save = SAVE_OVER_PROMPT;
+ autosave_on_quit = 0;
alt_print_command_default = ALTPRINT_MOD;
disable_quit = 0;
disable_save = 0;
@@ -6341,6 +6343,14 @@ static void setup(int argc, char *argv[])
{
promptless_save = SAVE_OVER_NO;
}
+ else if (strcmp(argv[i], "--autosave") == 0)
+ {
+ autosave_on_quit = 1;
+ }
+ else if (strcmp(argv[i], "--noautosave") == 0)
+ {
+ autosave_on_quit = 0;
+ }
else if (strcmp(argv[i], "--altprintnever") == 0)
{
alt_print_command_default = ALTPRINT_NEVER;
@@ -11842,7 +11852,7 @@ static int rotation(int ctr_x, int ctr_y, int ox, int oy)
/* Save the current image: */
-static int do_save(int tool)
+static int do_save(int tool, int dont_show_success_results)
{
int res;
char *fname;
@@ -12098,8 +12108,12 @@ static int do_save(int tool)
/* All happy! */
playsound(screen, 0, SND_SAVE, 1, SNDPOS_CENTER, SNDDIST_NEAR);
- draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1);
- do_setcursor(cursor_arrow);
+
+ if (!dont_show_success_results)
+ {
+ draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1);
+ do_setcursor(cursor_arrow);
+ }
return 1;
}
@@ -12345,12 +12359,14 @@ static int do_quit(int tool)
if (done && !been_saved && !disable_save)
{
- if (do_prompt(PROMPT_QUIT_SAVE_TXT,
+ if (autosave_on_quit ||
+ do_prompt(PROMPT_QUIT_SAVE_TXT,
PROMPT_QUIT_SAVE_YES, PROMPT_QUIT_SAVE_NO))
{
- if (do_save(tool))
+ if (do_save(tool, 1))
{
- do_prompt(tool_tips[TOOL_SAVE], "OK", "");
+ // Don't bug user about successful save when quitting -bjk 2007.05.15
+ // do_prompt(tool_tips[TOOL_SAVE], "OK", "");
}
else
{
@@ -13390,7 +13406,7 @@ int do_open(void)
img_tools[TOOL_SAVE], NULL, NULL,
SND_AREYOUSURE))
{
- do_save(TOOL_OPEN);
+ do_save(TOOL_OPEN, 1);
}
}
@@ -15564,6 +15580,14 @@ static void parse_options(FILE * fi)
{
promptless_save = SAVE_OVER_NO;
}
+ else if (strcmp(str, "autosave=yes") == 0)
+ {
+ autosave_on_quit = 1;
+ }
+ else if (strcmp(str, "autosave=no") == 0)
+ {
+ autosave_on_quit = 0;
+ }
else if (strcmp(str, "altprint=always") == 0)
{
alt_print_command_default = ALTPRINT_ALWAYS;