From 10d11e18db9d1261ba6c91ce086fbf755448a83b Mon Sep 17 00:00:00 2001 From: wkendrick Date: Fri, 24 Jun 2011 15:49:25 +0000 Subject: Getting 'saveover...' options working as they used to, under the new gperf stuff. Showing a warning when using save-related options when "nosave" is set. (SourceForge Bug #3327493) --- diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 1c8e620..b030eb0 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -6,9 +6,9 @@ Copyright (c) 2002-2011 by Bill Kendrick and others bill@newbreedsoftware.com http://www.tuxpaint.org/ -$Id: CHANGES.txt,v 1.781 2011/06/17 01:37:53 wkendrick Exp $ +$Id: CHANGES.txt,v 1.782 2011/06/24 15:49:25 wkendrick Exp $ -2011.June.16 (0.9.22) +2011.June.24 (0.9.22) * New Tools: ---------- @@ -155,6 +155,9 @@ $Id: CHANGES.txt,v 1.781 2011/06/17 01:37:53 wkendrick Exp $ * Other Improvements: ------------------- + * Showing a warning when using save-related options when "nosave" is set. + (SourceForge Bug #3327493) + * Quicker prompt window pop-up animation. * Left/Right Stamp navigation buttons are purple, like the other (up/down) diff --git a/src/parse.gperf b/src/parse.gperf index df5ef71..fac111e 100644 --- a/src/parse.gperf +++ b/src/parse.gperf @@ -132,9 +132,9 @@ printdelay, MULTI(print_delay) quit, NEGBOOL(disable_quit) save, NEGBOOL(disable_save) savedir, MULTI(savedir) -saveover, MULTI(promptless_save) -saveoverask, MULTI(promptless_save) -saveovernew, MULTI(promptless_save) +saveover, POSBOOL(_promptless_save_over) +saveoverask, POSBOOL(_promptless_save_over_ask) +saveovernew, POSBOOL(_promptless_save_over_new) shortcuts, NEGBOOL(noshortcuts) showcursor, NEGBOOL(hide_cursor) simpleshapes, POSBOOL(simple_shapes) diff --git a/src/parse.h b/src/parse.h index eda5777..bd60219 100644 --- a/src/parse.h +++ b/src/parse.h @@ -42,7 +42,10 @@ struct cfginfo const char *parsertmp_windowsize; const char *print_delay; const char *printcommand; - const char *promptless_save; +// const char *promptless_save; + const char *_promptless_save_over; + const char *_promptless_save_over_new; + const char *_promptless_save_over_ask; const char *rotate_orientation; const char *savedir; const char *simple_shapes; diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 376f354..84ba43e 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -22,7 +22,7 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA (See COPYING.txt) - June 14, 2002 - May 25, 2011 + June 14, 2002 - June 24, 2011 */ @@ -557,6 +557,7 @@ FILE * my_fmemopen(unsigned char * data, size_t size, const char * mode) enum { + SAVE_OVER_UNSET = -1, SAVE_OVER_PROMPT, SAVE_OVER_ALWAYS, SAVE_OVER_NO @@ -1006,7 +1007,10 @@ static int mousekey_right; static int button_down; static int scrolling; -static int promptless_save = SAVE_OVER_PROMPT; +static int promptless_save = SAVE_OVER_UNSET; +static int _promptless_save_over, + _promptless_save_over_ask, + _promptless_save_over_new; static int disable_quit; static int noshortcuts; @@ -21376,6 +21380,9 @@ static void setup_config(char *argv[]) SETBOOL(wheely); SETBOOL(mouseaccessibility); SETBOOL(onscreen_keyboard); + SETBOOL(_promptless_save_over); + SETBOOL(_promptless_save_over_new); + SETBOOL(_promptless_save_over_ask); #undef SETBOOL if(tmpcfg.parsertmp_windowsize) @@ -21472,6 +21479,19 @@ static void setup_config(char *argv[]) } joystick_maxsteps = strtof(tmpcfg.joystick_maxsteps, NULL); } + + + printf("\n\nPromptless save:\nask: %d\nnew: %d\nover: %d\n\n", _promptless_save_over_ask, _promptless_save_over_new, _promptless_save_over); + + if (_promptless_save_over_ask) { + promptless_save = SAVE_OVER_PROMPT; + } else if (_promptless_save_over_new) { + promptless_save = SAVE_OVER_NO; + } else if (_promptless_save_over) { + promptless_save = SAVE_OVER_ALWAYS; + } + + } @@ -22851,9 +22871,6 @@ int main(int argc, char *argv[]) chdir_to_binary(argv[0]); setup_config(argv); - - - CLOCK_ASM(time2); #ifdef FORKED_FONTS // must start ASAP, but depends on locale which in turn needs the config @@ -22866,6 +22883,18 @@ int main(int argc, char *argv[]) #endif #endif + /* Warnings to satisfy SF.net Bug #3327493 -bjk 2011.06.24 */ + if (disable_save && autosave_on_quit) { + fprintf(stderr, "Warning: Autosave requested, but saving is disabled.\n"); + } + if (disable_save && (promptless_save != SAVE_OVER_UNSET)) { + fprintf(stderr, "Warning: Save-over option specified, but saving is disabled.\n"); + } + + if (promptless_save == SAVE_OVER_UNSET) { + promptless_save = SAVE_OVER_PROMPT; + } + /* Set up! */ setup(); -- cgit v0.9.1