Colors may now be overridden using the "colorfile" option.
This commit is contained in:
parent
4da9ae7c25
commit
dc459535a7
8 changed files with 238 additions and 34 deletions
|
|
@ -60,6 +60,10 @@ $Id$
|
|||
* Stamps may now include a second sound effect, used as a spoken
|
||||
description.
|
||||
(stampname_desc.ogg or .wav and localized stampname_desc_ll.ogg or .wav)
|
||||
|
||||
* The color palette may now be overridden by creating a text file
|
||||
containing color descriptions, and using the "colorfile" option.
|
||||
|
||||
|
||||
* Tool improvements:
|
||||
------------------------
|
||||
|
|
@ -95,7 +99,6 @@ $Id$
|
|||
* Kuro Neko ("Black Cat") (animated, directional)
|
||||
(Based on the cat from 'xneko' by Masayuki Koba)
|
||||
|
||||
|
||||
* New Starter Images:
|
||||
-------------------
|
||||
* Shipwreck
|
||||
|
|
|
|||
|
|
@ -315,6 +315,27 @@ Windows Users
|
|||
starts up, rather than loading the last image that was being
|
||||
edited.
|
||||
|
||||
colorfile=FILENAME
|
||||
|
||||
You may override Tux Paint's default color palette by creating a
|
||||
plain ASCII text file that describes the colors you want, and
|
||||
pointing to that file using the colorfile option.
|
||||
|
||||
The file should list one color per line. Colors are defined in
|
||||
terms of their Red, Green and Blue values, each from 0 (off) to
|
||||
255 (brightest). (For more information, try Wikipedia's "RGB
|
||||
color model" article.)
|
||||
|
||||
Colors may be listed using three decimal numbers (e.g.,
|
||||
"255 64 128") or a 6- or 3-digit-long hexadecimal 'triplet'
|
||||
(e.g., "#ff4080" or "#F48"). Note: You must separate decimal
|
||||
values with spaces, and begin hexadecimal values with a
|
||||
pound/number-sign character ("#").
|
||||
|
||||
After the color definition (on the same line) you may enter text
|
||||
to describe the color. Tux will display this text when the color
|
||||
is clicked. (For example, "#FFF White as snow.")
|
||||
|
||||
lang=LANGUAGE
|
||||
|
||||
Run Tux Paint in one of the supported languages. Possible choice
|
||||
|
|
|
|||
|
|
@ -9,7 +9,7 @@
|
|||
bill@newbreedsoftware.com
|
||||
http://www.newbreedsoftware.com/tuxpaint/
|
||||
|
||||
June 14, 2002 - August 27, 2006
|
||||
June 14, 2002 - September 9, 2006
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
|
|
@ -165,6 +165,9 @@ Main Screen
|
|||
[Colors - Black, White, Red, Pink, Orange, Yellow, Green, Cyan, Blue, Purple,
|
||||
Brown, Grey]
|
||||
|
||||
(NOTE: You can define your own colors for Tux Paint. See the
|
||||
"Options" documentation.)
|
||||
|
||||
Bottom: Help Area
|
||||
|
||||
At the very bottom of the screen, Tux, the Linux Penguin,
|
||||
|
|
|
|||
|
|
@ -389,6 +389,31 @@ New Breed Software</p>
|
|||
This causes Tux Paint to display a blank canvas when it first
|
||||
starts up, rather than loading the last image that was being edited.
|
||||
</dd>
|
||||
|
||||
<dt><code><b>colorfile=<i>FILENAME</i></b></code></dt>
|
||||
<dd>
|
||||
<p>You may override Tux Paint's default color palette by creating
|
||||
a plain ASCII text file that describes the colors you want, and
|
||||
pointing to that file using the <code>colorfile</code> option.</p>
|
||||
|
||||
<p>The file should list one color per line. Colors are defined in
|
||||
terms of their Red, Green and Blue values, each from 0 (off) to 255
|
||||
(brightest). (For more information, try Wikipedia's
|
||||
"<a href="http://en.wikipedia.org/wiki/Rgb">RGB color model</a>"
|
||||
article.)</p>
|
||||
|
||||
<p>Colors may be listed using three decimal numbers (e.g.,
|
||||
"<code>255 64 128</code>") or a 6- or 3-digit-long hexadecimal
|
||||
'triplet' (e.g., "<code>#ff4080</code>" or "<code>#F48</code>").
|
||||
Note: You must separate decimal values with spaces, and begin
|
||||
hexadecimal values with a pound/number-sign character
|
||||
("<code>#</code>").</p>
|
||||
|
||||
<p>After the color definition (on the same line) you may enter text to
|
||||
describe the color. Tux will display this text when the color is
|
||||
clicked. (For example,
|
||||
"<code>#FFF White as snow.</code>")</p>
|
||||
</dd>
|
||||
|
||||
<dt><code><b>lang=<i>LANGUAGE</i></b></code></dt>
|
||||
<dd>
|
||||
|
|
|
|||
|
|
@ -23,7 +23,7 @@ New Breed Software</p>
|
|||
<p><a href="mailto:bill@newbreedsoftware.com">bill@newbreedsoftware.com</a><br>
|
||||
<a href="http://www.newbreedsoftware.com/tuxpaint/">http://www.newbreedsoftware.com/tuxpaint/</a></p>
|
||||
|
||||
<p>June 14, 2002 - August 27, 2006</p>
|
||||
<p>June 14, 2002 - September 9, 2006</p>
|
||||
</center>
|
||||
|
||||
<hr size=2 noshade>
|
||||
|
|
@ -169,8 +169,8 @@ New Breed Software</p>
|
|||
<blockquote>
|
||||
<p>When Tux Paint first loads, a title/credits screen will appear.</p>
|
||||
|
||||
<center><img src="images/tuxpaint-title.jpg" width=324 height=254
|
||||
alt="[Title Screenshot]"></center>
|
||||
<p align=center><img src="images/tuxpaint-title.jpg" width=324 height=254
|
||||
alt="[Title Screenshot]"></p>
|
||||
|
||||
<p>Once loading is complete, press a key or click on the mouse to continue.
|
||||
(Or, after about 30 seconds, the title screen will go away
|
||||
|
|
@ -189,9 +189,9 @@ New Breed Software</p>
|
|||
<dd>
|
||||
<p>The toolbar contains the drawing and editing controls.</p>
|
||||
|
||||
<center><img src="images/tools.jpg" width=324 height=254
|
||||
<p align=center><img src="images/tools.jpg" width=324 height=254
|
||||
alt="[Tools: Paint, Stamp, Lines, Shapes, Text, Magic, Undo, Redo,
|
||||
Eraser, New, Open, Save, Print, Quit]"></center>
|
||||
Eraser, New, Open, Save, Print, Quit]"></p>
|
||||
</dd>
|
||||
|
||||
<dt>Middle: Drawing Canvas</dt>
|
||||
|
|
@ -199,8 +199,8 @@ New Breed Software</p>
|
|||
<p>The largest part of the screen, in the center, is the drawing
|
||||
canvas. This is, obviously, where you draw!</p>
|
||||
|
||||
<center><img src="images/canvas.jpg" width=324 height=254
|
||||
alt="[(Canvas)]"></center>
|
||||
<p align=center><img src="images/canvas.jpg" width=324 height=254
|
||||
alt="[(Canvas)]"></p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
|
@ -211,8 +211,8 @@ New Breed Software</p>
|
|||
the various brushes available. When the Rubber Stamp tool
|
||||
is selected, it shows the different shapes you can use.</p>
|
||||
|
||||
<center><img src="images/selector.jpg" width=324 height=254
|
||||
alt="[Selectors - Brushes, Letters, Shapes, Stamps]"></center>
|
||||
<p align=center><img src="images/selector.jpg" width=324 height=254
|
||||
alt="[Selectors - Brushes, Letters, Shapes, Stamps]"></p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
|
@ -221,9 +221,13 @@ New Breed Software</p>
|
|||
<p>A palette of available colors are shown near the bottom of the
|
||||
screen.</p>
|
||||
|
||||
<center><img src="images/colors.jpg" width=324 height=254
|
||||
<p align=center><img src="images/colors.jpg" width=324 height=254
|
||||
alt="[Colors - Black, White, Red, Pink, Orange, Yellow, Green, Cyan,
|
||||
Blue, Purple, Brown, Grey]"></center>
|
||||
Blue, Purple, Brown, Grey]"></p>
|
||||
|
||||
<p>(NOTE: You can define your own colors for Tux Paint.
|
||||
See the "<a href="OPTIONS.html"><i>Options</i></a>"
|
||||
documentation.)</p>
|
||||
</dd>
|
||||
|
||||
|
||||
|
|
@ -232,10 +236,10 @@ New Breed Software</p>
|
|||
<p>At the very bottom of the screen, Tux, the Linux Penguin,
|
||||
provides tips and other information while you draw.</p>
|
||||
|
||||
<center><img src="images/tips.jpg" width=324 height=254
|
||||
<p align=center><img src="images/tips.jpg" width=324 height=254
|
||||
alt="(For example: 'Pick a shape. Click to pick the center, drag, then
|
||||
let go when it is the size you want. Move around to rotate it, and
|
||||
click to draw it.)"></center>
|
||||
click to draw it.)"></p>
|
||||
</dd>
|
||||
</dl>
|
||||
</blockquote>
|
||||
|
|
@ -264,8 +268,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/ex_paint.png" width=120 height=95
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/ex_paint.png" width=120 height=95
|
||||
alt=""></p>
|
||||
|
||||
<hr size=1>
|
||||
</dd>
|
||||
|
|
@ -297,8 +301,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/ex_stamps.png" width=182 height=156
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/ex_stamps.png" width=182 height=156
|
||||
alt=""></p>
|
||||
|
||||
<hr size=1>
|
||||
</dd>
|
||||
|
|
@ -320,8 +324,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/ex_lines.png" width=76 height=103
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/ex_lines.png" width=76 height=103
|
||||
alt=""></p>
|
||||
|
||||
<hr size=1>
|
||||
</dd>
|
||||
|
|
@ -364,8 +368,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/ex_shapes.png" width=177 height=104
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/ex_shapes.png" width=177 height=104
|
||||
alt=""></p>
|
||||
|
||||
<hr size=1>
|
||||
</dd>
|
||||
|
|
@ -387,8 +391,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/ex_text.png" width=139 height=69
|
||||
alt=""></center>
|
||||
<p aling=center><img src="images/ex_text.png" width=139 height=69
|
||||
alt=""></p>
|
||||
|
||||
<hr size=1>
|
||||
</dd>
|
||||
|
|
@ -590,8 +594,8 @@ New Breed Software</p>
|
|||
|
||||
<br clear=all>
|
||||
|
||||
<center><img src="images/open_dialog.jpg" width=194 height=152
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/open_dialog.jpg" width=194 height=152
|
||||
alt=""></p>
|
||||
|
||||
<p>Click a picture to select it, then...</p>
|
||||
|
||||
|
|
@ -688,8 +692,8 @@ New Breed Software</p>
|
|||
whether you want to save over the old version, or create a new
|
||||
entry (a new file).</p>
|
||||
|
||||
<center><img src="images/saveover.png" width=177 height=110
|
||||
alt=""></center>
|
||||
<p align=center><img src="images/saveover.png" width=177 height=110
|
||||
alt=""></p>
|
||||
|
||||
<p>(NOTE: If either the "<code>saveover</code>" or
|
||||
"<code>saveovernew</code>" options are set, it won't ask before saving
|
||||
|
|
|
|||
|
|
@ -28,6 +28,8 @@
|
|||
*/
|
||||
|
||||
|
||||
#ifndef COLORS_H
|
||||
#define COLORS_H
|
||||
|
||||
/* What colors are available: */
|
||||
|
||||
|
|
@ -98,3 +100,8 @@ const char *const default_color_names[NUM_DEFAULT_COLORS] = {
|
|||
gettext_noop("Tan!"),
|
||||
gettext_noop("Beige!")
|
||||
};
|
||||
|
||||
char colorfile[256];
|
||||
|
||||
#endif /* COLORS_H */
|
||||
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ tuxpaint -- A drawing program for young children.
|
|||
[\-\-saveover]
|
||||
[\-\-saveovernew]
|
||||
[\-\-nosave]
|
||||
[\-\-colorfile \fIFILE\fP]
|
||||
|
||||
.TP 9
|
||||
.B tuxpaint
|
||||
|
|
@ -252,6 +253,14 @@ When you start \fITux Paint\fP, it loads the last image that was being worked
|
|||
on. The \fI\-\-startblank\fP option disables this, so it always starts with
|
||||
a blank canvas. The default behavior is \fI\-\-startlast\fP.
|
||||
|
||||
.TP 8
|
||||
.B \-\-colorfile \fIFILE\fP
|
||||
This option allows you to override the default color palette in \fITux Paint\fP
|
||||
and replace it with your own. The file should be a plain ASCII text file
|
||||
containing one color description per line. Colors may be in decimal or
|
||||
6- or 3-digit hexadecimal, and followed by a description. (For example,
|
||||
"\fI#000 Black\fP" and "\fI255 192 64 Orange\fP".)
|
||||
|
||||
.SH OPTIONS - LANGUAGE
|
||||
.l
|
||||
Various parts of \fITux Paint\fP have been translated into numerous languages.
|
||||
|
|
@ -469,7 +478,7 @@ welsh | cymraeg
|
|||
.PD
|
||||
|
||||
.TP 8
|
||||
.B \-\- lang help
|
||||
.B \-\-lang help
|
||||
Display a lists of all supported languages.
|
||||
|
||||
.SH OPTIONS - MISCELLANEOUS
|
||||
|
|
|
|||
140
src/tuxpaint.c
140
src/tuxpaint.c
|
|
@ -5194,6 +5194,7 @@ static void show_usage(FILE * f, char *prg)
|
|||
" %s [--altprintmod | --altprintalways | --altprintnever]\n"
|
||||
" %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
|
||||
" %s [--nosysconfig] [--nolockfile]\n"
|
||||
" %s [--colorfile FILE]\n"
|
||||
/* " %s [--record FILE | --playback FILE]\n" */
|
||||
"\n",
|
||||
prg, prg,
|
||||
|
|
@ -5203,7 +5204,7 @@ static void show_usage(FILE * f, char *prg)
|
|||
#ifdef WIN32
|
||||
blank,
|
||||
#endif
|
||||
blank, blank, blank, blank, blank);
|
||||
blank, blank, blank, blank, blank, blank);
|
||||
|
||||
free(blank);
|
||||
}
|
||||
|
|
@ -5711,6 +5712,10 @@ static int load_user_fonts_stub(void *vp)
|
|||
#endif
|
||||
|
||||
|
||||
#define hex2dec(c) (((c) >= '0' && (c) <= '9') ? ((c) - '0') : \
|
||||
((c) >= 'A' && (c) <= 'F') ? ((c) - 'A' + 10) : \
|
||||
((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : 0)
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
/* Setup: */
|
||||
|
||||
|
|
@ -5819,6 +5824,7 @@ static void setup(int argc, char *argv[])
|
|||
playing = 0;
|
||||
ok_to_use_lockfile = 1;
|
||||
start_blank = 0;
|
||||
colorfile[0] = '\0';
|
||||
|
||||
|
||||
#ifdef __BEOS__
|
||||
|
|
@ -5964,6 +5970,22 @@ static void setup(int argc, char *argv[])
|
|||
{
|
||||
noshortcuts = 0;
|
||||
}
|
||||
else if (strcmp(argv[i], "--colorfile") == 0)
|
||||
{
|
||||
if (i < argc - 1)
|
||||
{
|
||||
strcpy(colorfile, argv[i + 1]);
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Forgot to specify the file name! */
|
||||
|
||||
fprintf(stderr, "%s takes an argument\n", argv[i]);
|
||||
show_usage(stderr, (char *) getfilename(argv[0]));
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
else if (argv[i][0] == '-' && argv[i][1] == '-' && argv[i][2] >= '1'
|
||||
&& argv[i][2] <= '9')
|
||||
{
|
||||
|
|
@ -6443,11 +6465,117 @@ static void setup(int argc, char *argv[])
|
|||
|
||||
/* Load colors, or use default ones: */
|
||||
|
||||
if (0 == 1)
|
||||
if (colorfile[0] != '\0')
|
||||
{
|
||||
/* FIXME: Allow loading colors from file: */
|
||||
fi = fopen(colorfile, "r");
|
||||
if (fi == NULL)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"\nWarning, could not open color file. Using defaults.\n");
|
||||
perror(colorfile);
|
||||
colorfile[0] = '\0';
|
||||
}
|
||||
else
|
||||
{
|
||||
int max = 0, per = 5;
|
||||
char str[80], tmp_str[80];
|
||||
int count;
|
||||
|
||||
NUM_COLORS = 0;
|
||||
|
||||
do
|
||||
{
|
||||
fgets(str, sizeof(str), fi);
|
||||
|
||||
if (!feof(fi))
|
||||
{
|
||||
if (NUM_COLORS + 1 > max)
|
||||
{
|
||||
color_hexes = realloc(color_hexes, sizeof(Uint8 *) * (max + per));
|
||||
color_names = realloc(color_names, sizeof(char *) * (max + per));
|
||||
|
||||
for (i = max; i < max + per; i++)
|
||||
color_hexes[i] = malloc(sizeof(Uint8) * 3);
|
||||
|
||||
max = max + per;
|
||||
}
|
||||
|
||||
while (str[strlen(str) - 1] == '\n' ||
|
||||
str[strlen(str) - 1] == '\r')
|
||||
str[strlen(str) - 1] = '\0';
|
||||
|
||||
if (str[0] == '#')
|
||||
{
|
||||
/* Hex form */
|
||||
|
||||
sscanf(str + 1, "%s %n", tmp_str, &count);
|
||||
|
||||
if (strlen(tmp_str) == 6)
|
||||
{
|
||||
/* Byte (#rrggbb) form */
|
||||
|
||||
color_hexes[NUM_COLORS][0] =
|
||||
(hex2dec(tmp_str[0]) << 4) + hex2dec(tmp_str[1]);
|
||||
color_hexes[NUM_COLORS][1] =
|
||||
(hex2dec(tmp_str[2]) << 4) + hex2dec(tmp_str[3]);
|
||||
color_hexes[NUM_COLORS][2] =
|
||||
(hex2dec(tmp_str[4]) << 4) + hex2dec(tmp_str[5]);
|
||||
|
||||
color_names[NUM_COLORS] = strdup(str + count);
|
||||
NUM_COLORS++;
|
||||
}
|
||||
else if (strlen(tmp_str) == 3)
|
||||
{
|
||||
/* Nybble (#rgb) form */
|
||||
|
||||
color_hexes[NUM_COLORS][0] = (hex2dec(tmp_str[0]) << 4);;
|
||||
color_hexes[NUM_COLORS][1] = (hex2dec(tmp_str[1]) << 4);;
|
||||
color_hexes[NUM_COLORS][2] = (hex2dec(tmp_str[2]) << 4);;
|
||||
|
||||
color_names[NUM_COLORS] = strdup(str + count);
|
||||
NUM_COLORS++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Assume int form */
|
||||
|
||||
if (sscanf(str, "%hu %hu %hu %n",
|
||||
(short unsigned int *) &(color_hexes[NUM_COLORS][0]),
|
||||
(short unsigned int *) &(color_hexes[NUM_COLORS][1]),
|
||||
(short unsigned int *) &(color_hexes[NUM_COLORS][2]),
|
||||
&count) >= 3)
|
||||
{
|
||||
color_names[NUM_COLORS] = strdup(str + count);
|
||||
NUM_COLORS++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
while (!feof(fi));
|
||||
|
||||
if (NUM_COLORS < 2)
|
||||
{
|
||||
fprintf(stderr,
|
||||
"\nWarning, not enough colors in color file. Using defaults.\n");
|
||||
fprintf(stderr, "%s\n", colorfile);
|
||||
colorfile[0] = '\0';
|
||||
|
||||
for (i = 0; i < NUM_COLORS; i++)
|
||||
{
|
||||
free(color_names[i]);
|
||||
free(color_hexes[i]);
|
||||
}
|
||||
|
||||
free(color_names);
|
||||
free(color_hexes);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
/* Use default, if no file specified (or trouble opening it) */
|
||||
|
||||
if (colorfile[0] == '\0')
|
||||
{
|
||||
NUM_COLORS = NUM_DEFAULT_COLORS;
|
||||
|
||||
|
|
@ -14786,6 +14914,10 @@ static void parse_options(FILE * fi)
|
|||
{
|
||||
set_langstr(str + 5);
|
||||
}
|
||||
else if (strstr(str, "colorfile=") == str)
|
||||
{
|
||||
strcpy(colorfile, str + 10);
|
||||
}
|
||||
else if (strstr(str, "printdelay=") == str)
|
||||
{
|
||||
sscanf(str + 11, "%d", &print_delay);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue