From 1100b762845e26ef525bc91decb5b23caeed930f Mon Sep 17 00:00:00 2001 From: William Kendrick Date: Sun, 15 Jun 2003 02:05:13 +0000 Subject: [PATCH] Added "--nostamps" to disable Stamp tool. (Speeds up loading; reduces RAM) --- docs/CHANGES.txt | 5 +++ docs/FAQ.txt | 30 ++++++++++++- docs/README.txt | 9 ++++ docs/html/README.html | 10 +++++ src/tuxpaint.c | 97 ++++++++++++++++++++++++++----------------- 5 files changed, 112 insertions(+), 39 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 90853187a..833f3fcd9 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -64,6 +64,11 @@ http://www.newbreedsoftware.com/tuxpaint/ * Added a set of square brushes (similar to the various round ones). + * Added "--nostamps" option to disable stamp tool. + (When it's not needed, they just take time to load, and RAM to store.) + + * Added missing "--nosysconfig" to "--help" usage output. + 2003.February.22 (0.9.10) * UTF-8 stamp descriptions word-wrap around spaces. diff --git a/docs/FAQ.txt b/docs/FAQ.txt index 119691003..6f2243801 100644 --- a/docs/FAQ.txt +++ b/docs/FAQ.txt @@ -6,7 +6,7 @@ Copyright 2003 by Bill Kendrick bill@newbreedsoftware.com http://www.newbreedsoftware.com/tuxpaint/ -September 14, 2002 - January 5, 2003 +September 14, 2002 - June 14, 2003 Frequently Asked Questions: @@ -35,7 +35,8 @@ Frequently Asked Questions: #define LOW_QUALITY_FLOOD_FILL in the "tuxpaint.c" file in the "src" directory. - + + Stamp outlines are always rectangles ------------------------------------ Tux Paint was built with low-quality (but faster) stamp outlines. @@ -48,6 +49,31 @@ Frequently Asked Questions: in the "tuxpaint.c" file in the "src" directory. + The Rubber Stamp tool is greyed out! + ------------------------------------ + This means that Tux Paint either couldn't find any stamp images, + or was asked not to load them. + + If you installed Tux Paint, but did not install the separate, + optional "Stamps" collection, quit Tux Paint and install it now. + It should be available from the same place you got the main + Tux Paint program. + + If you don't want to install the default collection of stamps, + you can just create your own. See the README documentation for + more on creating PNG image files, TXT text description files, + WAV sound files, and DAT text data files that make up stamps. + + Finally, if you install the stamps, and think they should be loading, + check to see that the "nostamps" option isn't being set. + (Either via a "--nostamps" option to Tux Paint's command line, or + "nostamps=yes" in the configuration file.) + + If so, either change/remove the "nostamps" option, or you can + override it with "--stamps" on the command line or + "nostamps=no" or "stamps=yes" in a configuration file. + + Interface Problems ------------------ Stamp thumbnails in the Stamp Selector look bad diff --git a/docs/README.txt b/docs/README.txt index 3e5c32b2a..848acc472 100644 --- a/docs/README.txt +++ b/docs/README.txt @@ -274,6 +274,15 @@ Options This can help when Tux Paint is run on very slow computers, or displayed on a remote X-Window display. + nostamps=yes + + This option tells Tux Paint to not load any rubber stamp + images, which in turn ends up disabling the Stamps tool. + + This can speed up Tux Paint when it first loads up, and + reduce memory usage while it's running. Of course, no + stamps will be available at all. + savedir DIRECTORY Use this option to change where Tux Paint saves pictures. diff --git a/docs/html/README.html b/docs/html/README.html index 32533838c..569af45b5 100644 --- a/docs/html/README.html +++ b/docs/html/README.html @@ -368,6 +368,16 @@ New Breed Software

or displayed on a remote X-Window display.

+
nostamps=yes
+
+

This option tells Tux Paint to not load any rubber stamp + images, which in turn ends up disabling the Stamps tool.

+ +

This can speed up Tux Paint when it first loads up, + and reduce memory usage while it's running. Of course, no stamps + will be available at all.

+
+
savedir DIRECTORY

Use this option to change where Tux Paint saves pictures. diff --git a/src/tuxpaint.c b/src/tuxpaint.c index f0b4fdd2a..29b551bd5 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -327,7 +327,7 @@ int use_sound, fullscreen, disable_quit, simple_shapes, language, disable_print, print_delay, only_uppercase, promptless_save, grab_input, wheely, no_fancy_cursors, keymouse, mouse_x, mouse_y, mousekey_up, mousekey_down, mousekey_left, mousekey_right, - dont_do_xor, use_print_config; + dont_do_xor, use_print_config, dont_load_stamps; int WINDOW_WIDTH, WINDOW_HEIGHT; char * printcommand; int prog_bar_ctr; @@ -3275,15 +3275,17 @@ void show_usage(FILE * f, char * prg) "Usage: %s {--usage | --help | --version | --copying}\n" " %s [--fullscreen] [--800x600] [--nosound] [--noquit] [--noprint]\n" " [--simpleshapes] [--uppercase] [--grab] [--nowheelmouse]\n" - " [--nofancycursors] [--keyboard] [--nooutlines]\n" + " [--nofancycursors] [--keyboard] [--nooutlines] [--nostamps]\n" " [--savedir DIRECTORY] [--saveover] [--saveovernew]\n" " %s [--windowed] [--640x480] [--sound] [--quit] [--print]\n" " [--complexshapes] [--mixedcase] [--dontgrab] [--wheelmouse]\n" - " [--fancycursors] [--mouse] [--outlines]\n" + " [--fancycursors] [--mouse] [--outlines] [--stamps]\n" " [--saveoverask]\n" " %s [--printcfg | --noprintcfg] (Windows only)\n" " %s [--printdelay=SECONDS]\n" - " [--lang LANGUAGE | --locale LOCALE]\n\n" + " [--lang LANGUAGE | --locale LOCALE]\n" + " %s [--nosysconfig]\n" + "\n" "LANGUAGE may be one of:\n" " english american-english\n" " brazilian brazilian-portuguese portugues-brazilian\n" @@ -3313,7 +3315,7 @@ void show_usage(FILE * f, char * prg) " spanish espanol\n" " swedish svenska\n" " turkish\n\n", - prg, prg, prg, prg, prg); + prg, prg, prg, prg, prg, prg); } @@ -3377,6 +3379,7 @@ void setup(int argc, char * argv[]) promptless_save = SAVE_OVER_PROMPT; disable_quit = 0; disable_print = 0; + dont_load_stamps = 0; print_delay = 0; printcommand = "pngtopnm | pnmtops | lpr"; langstr = NULL; @@ -3564,6 +3567,14 @@ void setup(int argc, char * argv[]) { disable_quit = 0; } + else if (strcmp(argv[i], "--nostamps") == 0) + { + dont_load_stamps = 1; + } + else if (strcmp(argv[i], "--stamps") == 0) + { + dont_load_stamps = 0; + } else if (strcmp(argv[i], "--noprint") == 0 || strcmp(argv[i], "-p") == 0) { disable_print = 1; @@ -4402,51 +4413,54 @@ void setup(int argc, char * argv[]) /* Load stamps: */ + if (dont_load_stamps == 0) + { #ifndef NOSOUND - loadarbitrary(img_stamps, txt_stamps, inf_stamps, snd_stamps, &num_stamps, 0, - MAX_STAMPS, DATA_PREFIX "stamps", 0, -1, -1); + loadarbitrary(img_stamps, txt_stamps, inf_stamps, snd_stamps, &num_stamps, + 0, MAX_STAMPS, DATA_PREFIX "stamps", 0, -1, -1); #else - loadarbitrary(img_stamps, txt_stamps, inf_stamps, &num_stamps, 0, - MAX_STAMPS, DATA_PREFIX "stamps", 0, -1, -1); + loadarbitrary(img_stamps, txt_stamps, inf_stamps, &num_stamps, + 0, MAX_STAMPS, DATA_PREFIX "stamps", 0, -1, -1); #endif - homedirdir = get_fname("stamps"); + homedirdir = get_fname("stamps"); #ifndef NOSOUND - loadarbitrary(img_stamps, txt_stamps, inf_stamps, snd_stamps, - &num_stamps, num_stamps, - MAX_STAMPS, homedirdir, 0, -1, -1); + loadarbitrary(img_stamps, txt_stamps, inf_stamps, snd_stamps, + &num_stamps, num_stamps, + MAX_STAMPS, homedirdir, 0, -1, -1); #else - loadarbitrary(img_stamps, txt_stamps, inf_stamps, &num_stamps, num_stamps, - MAX_STAMPS, homedirdir, 0, -1, -1); + loadarbitrary(img_stamps, txt_stamps, inf_stamps, &num_stamps, num_stamps, + MAX_STAMPS, homedirdir, 0, -1, -1); #endif - if (num_stamps == 0) - { - fprintf(stderr, - "\nWarning: No stamps found in " DATA_PREFIX "stamps/\n" - "or %s\n\n", homedirdir); - } - - free(homedirdir); - - - /* Create stamp thumbnails: */ - - for (i = 0; i < num_stamps; i++) - { - if (img_stamps[i]->w > 40 || - img_stamps[i]->h > 40) + if (num_stamps == 0) { - img_stamp_thumbs[i] = thumbnail(img_stamps[i], 40, 40, 1); - } - else - { - img_stamp_thumbs[i] = NULL; + fprintf(stderr, + "\nWarning: No stamps found in " DATA_PREFIX "stamps/\n" + "or %s\n\n", homedirdir); } - show_progress_bar(); + free(homedirdir); + + + /* Create stamp thumbnails: */ + + for (i = 0; i < num_stamps; i++) + { + if (img_stamps[i]->w > 40 || + img_stamps[i]->h > 40) + { + img_stamp_thumbs[i] = thumbnail(img_stamps[i], 40, 40, 1); + } + else + { + img_stamp_thumbs[i] = NULL; + } + + show_progress_bar(); + } } @@ -10557,6 +10571,15 @@ void parse_options(FILE * fi) { disable_print = 0; } + else if (strcmp(str, "nostamps=yes") == 0) + { + dont_load_stamps = 1; + } + else if (strcmp(str, "nostamps=no") == 0 || + strcmp(str, "stamps=yes") == 0) + { + dont_load_stamps = 0; + } else if (strcmp(str, "nosound=yes") == 0) { use_sound = 0;