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)
This commit is contained in:
William Kendrick 2011-06-24 15:49:25 +00:00
parent 3d50141723
commit fe56c473a5
4 changed files with 45 additions and 10 deletions

View file

@ -8,7 +8,7 @@ http://www.tuxpaint.org/
$Id$ $Id$
2011.June.16 (0.9.22) 2011.June.24 (0.9.22)
* New Tools: * New Tools:
---------- ----------
@ -155,6 +155,9 @@ $Id$
* Other Improvements: * Other Improvements:
------------------- -------------------
* Showing a warning when using save-related options when "nosave" is set.
(SourceForge Bug #3327493)
* Quicker prompt window pop-up animation. * Quicker prompt window pop-up animation.
* Left/Right Stamp navigation buttons are purple, like the other (up/down) * Left/Right Stamp navigation buttons are purple, like the other (up/down)

View file

@ -132,9 +132,9 @@ printdelay, MULTI(print_delay)
quit, NEGBOOL(disable_quit) quit, NEGBOOL(disable_quit)
save, NEGBOOL(disable_save) save, NEGBOOL(disable_save)
savedir, MULTI(savedir) savedir, MULTI(savedir)
saveover, MULTI(promptless_save) saveover, POSBOOL(_promptless_save_over)
saveoverask, MULTI(promptless_save) saveoverask, POSBOOL(_promptless_save_over_ask)
saveovernew, MULTI(promptless_save) saveovernew, POSBOOL(_promptless_save_over_new)
shortcuts, NEGBOOL(noshortcuts) shortcuts, NEGBOOL(noshortcuts)
showcursor, NEGBOOL(hide_cursor) showcursor, NEGBOOL(hide_cursor)
simpleshapes, POSBOOL(simple_shapes) simpleshapes, POSBOOL(simple_shapes)

View file

@ -42,7 +42,10 @@ struct cfginfo
const char *parsertmp_windowsize; const char *parsertmp_windowsize;
const char *print_delay; const char *print_delay;
const char *printcommand; 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 *rotate_orientation;
const char *savedir; const char *savedir;
const char *simple_shapes; const char *simple_shapes;

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (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 enum
{ {
SAVE_OVER_UNSET = -1,
SAVE_OVER_PROMPT, SAVE_OVER_PROMPT,
SAVE_OVER_ALWAYS, SAVE_OVER_ALWAYS,
SAVE_OVER_NO SAVE_OVER_NO
@ -1006,7 +1007,10 @@ static int mousekey_right;
static int button_down; static int button_down;
static int scrolling; 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 disable_quit;
static int noshortcuts; static int noshortcuts;
@ -21376,6 +21380,9 @@ static void setup_config(char *argv[])
SETBOOL(wheely); SETBOOL(wheely);
SETBOOL(mouseaccessibility); SETBOOL(mouseaccessibility);
SETBOOL(onscreen_keyboard); SETBOOL(onscreen_keyboard);
SETBOOL(_promptless_save_over);
SETBOOL(_promptless_save_over_new);
SETBOOL(_promptless_save_over_ask);
#undef SETBOOL #undef SETBOOL
if(tmpcfg.parsertmp_windowsize) if(tmpcfg.parsertmp_windowsize)
@ -21472,6 +21479,19 @@ static void setup_config(char *argv[])
} }
joystick_maxsteps = strtof(tmpcfg.joystick_maxsteps, NULL); 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]); chdir_to_binary(argv[0]);
setup_config(argv); setup_config(argv);
CLOCK_ASM(time2); CLOCK_ASM(time2);
#ifdef FORKED_FONTS #ifdef FORKED_FONTS
// must start ASAP, but depends on locale which in turn needs the config // 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
#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! */ /* Set up! */
setup(); setup();