Mend color picker on label change; drop LOW_QUALITY_COLOR_SELECTOR

When selecting a label that has a color not found in the built-ins,
we change to the color picker; however, when rendering its button,
it looked wrong and would not fit to the right size (had 48x48
hard-coder in there, still!)  Instead, using `render_color_button()`
to just re-render it.

Also, dropping LOW_QUALITY_COLOR_SELECTOR which had been used by
some embedded platforms we don't seem to support any more (Nokia Maemo
and OLPC XO-1).
This commit is contained in:
Bill Kendrick 2023-06-19 12:02:01 -07:00
parent 20d45409ce
commit d4869ac062
12 changed files with 21 additions and 266 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and AUTHORS.txt)
https://tuxpaint.org/
2023.June.18 (0.9.31)
2023.June.19 (0.9.31)
* New Magic Tools:
----------------
* Loops - Draw loop-the-loops.
@ -110,6 +110,10 @@ https://tuxpaint.org/
(e.g., Windows)
Bill Kendrick <bill@newbreedsoftware.com>
* Mended bad rendering of color-picker (HSV palette) button when
selecting a Label text with a color not found in built-in colors.
Bill Kendrick <bill@newbreedsoftware.com>
* Localization Updates:
---------------------
* Russian translaton
@ -145,6 +149,9 @@ https://tuxpaint.org/
https://sourceforge.net/p/tuxpaint/bugs/278/
Bill Kendrick <bill@newbreedsoftware.com>
* Removed LOW_QUALITY_COLOR_SELECTOR compile-time option
Bill Kendrick <bill@newbreedsoftware.com>
2023.May.18 (0.9.30)
* Improvements to Stamp tool:
---------------------------

View file

@ -91,21 +91,6 @@ Interface Problems
"Low Quality Thumbnails" is probably enabled. See: "Stamp
thumbnails in the Stamp Selector look bad", above.
The color picker buttons are ugly squares, not pretty buttons!
Tux Paint was probably compiled with the nice looking color
selector buttons disabled. Run the command: "tuxpaint
--verbose-version" from a command line. If, amongst the other
output, you see the text: "Low Quality Color Selector enabled",
then this is what's happening.
To change this, you must rebuild Tux Paint from source. Be sure to
remove or comment out any line that says:
#define LOW_QUALITY_COLOR_SELECTOR
in the "tuxpaint.c" file in the "src" directory.
All of the text is in uppercase!
The "uppercase" option is on.

View file

@ -163,26 +163,6 @@
<dd>
"Low Quality Thumbnails" is probably enabled. See: "Stamp thumbnails in the Stamp Selector look bad", above. </dd>
<dt>
The color picker buttons are ugly squares, not pretty buttons! </dt>
<dd>
<p>
Tux Paint was probably compiled with the nice looking color selector buttons disabled. Run the command: "<code>tuxpaint --verbose-version</code>" from a command line. If, amongst the other output, you see the text: "Low Quality Color Selector enabled", then this is what's happening. </p>
<p>
To change this, you must rebuild Tux Paint from source. Be sure to remove or comment out any line that says: </p>
<blockquote>
<p>
<code>#define LOW_QUALITY_COLOR_SELECTOR</code>
</p>
</blockquote>
<p>
in the "tuxpaint.c" file in the "src" directory. </p>
</dd>
<dt>
All of the text is in uppercase! </dt>

View file

@ -91,21 +91,6 @@ Interface Problems
"Low Quality Thumbnails" is probably enabled. See: "Stamp
thumbnails in the Stamp Selector look bad", above.
The color picker buttons are ugly squares, not pretty buttons!
Tux Paint was probably compiled with the nice looking color
selector buttons disabled. Run the command: "tuxpaint
--verbose-version" from a command line. If, amongst the other
output, you see the text: "Low Quality Color Selector enabled",
then this is what's happening.
To change this, you must rebuild Tux Paint from source. Be sure to
remove or comment out any line that says:
#define LOW_QUALITY_COLOR_SELECTOR
in the "tuxpaint.c" file in the "src" directory.
All of the text is in uppercase!
The "uppercase" option is on.

View file

@ -163,26 +163,6 @@
<dd>
"Low Quality Thumbnails" is probably enabled. See: "Stamp thumbnails in the Stamp Selector look bad", above. </dd>
<dt>
The color picker buttons are ugly squares, not pretty buttons! </dt>
<dd>
<p>
Tux Paint was probably compiled with the nice looking color selector buttons disabled. Run the command: "<code>tuxpaint --verbose-version</code>" from a command line. If, amongst the other output, you see the text: "Low Quality Color Selector enabled", then this is what's happening. </p>
<p>
To change this, you must rebuild Tux Paint from source. Be sure to remove or comment out any line that says: </p>
<blockquote>
<p>
<code>#define LOW_QUALITY_COLOR_SELECTOR</code>
</p>
</blockquote>
<p>
in the "tuxpaint.c" file in the "src" directory. </p>
</dd>
<dt>
All of the text is in uppercase! </dt>

View file

@ -100,23 +100,6 @@ Problèmes d'interface
"Les vignettes de tampon dans le sélecteur de tampon ne sont pas
jolies", ci-dessus.
Les boutons du sélecteur de couleurs sont des carrés affreux, pas de jolis
boutons !
Tux Paint a probablement été compilé avec les jolis boutons de
sélection de couleur désactivés. Exécutez la commande: "tuxpaint
--verbose-version" à partir d'une ligne de commande. Si, parmi les
résultats, vous voyez le texte: "Low Quality Color Selector
enabled", c'est ce qui se passe.
Pour changer cela, vous devez reconstruire Tux Paint à partir des
sources. Assurez-vous de supprimer ou de commenter toute ligne qui
dit :
#define LOW_QUALITY_COLOR_SELECTOR
dans le fichier "tuxpaint.c" du répertoire "src".
Tout le texte est en majuscule !
L'option "majuscule" est activée.

View file

@ -163,26 +163,6 @@
<dd>
"Miniatures de faible qualité" a été probablement activé. Voir: "Les vignettes de tampon dans le sélecteur de tampon ne sont pas jolies", ci-dessus. </dd>
<dt>
Les boutons du sélecteur de couleurs sont des carrés affreux, pas de jolis boutons ! </dt>
<dd>
<p>
Tux Paint a probablement été compilé avec les jolis boutons de sélection de couleur désactivés. Exécutez la commande: "<code>tuxpaint --verbose-version</code>" à partir d'une ligne de commande. Si, parmi les résultats, vous voyez le texte: "Low Quality Color Selector enabled", c'est ce qui se passe. </p>
<p>
Pour changer cela, vous devez reconstruire Tux Paint à partir des sources. Assurez-vous de supprimer ou de commenter toute ligne qui dit : </p>
<blockquote>
<p>
<code>#define LOW_QUALITY_COLOR_SELECTOR</code>
</p>
</blockquote>
<p>
dans le fichier "tuxpaint.c" du répertoire "src". </p>
</dd>
<dt>
Tout le texte est en majuscule ! </dt>

View file

@ -96,21 +96,6 @@ Problemas de interface
calidade». Vexa: «As miniaturas dos selos no selector de selos
vense mal», arriba.
Os botóns de selección de cores son cadrados feos, e non botóns bonitos.
Tux Paint probabelmente compilado desactivando os fermosos botóns
de selección de cor. Executa a orde: «tuxpaint --verbose-version»
dende unha liña de ordes. Se, entre outras saídas, ves o texto:
«Low Quality Color Selector enabled», entón é isto o que está a
suceder.
Para cambialo, debe volver compilar Tux Paint dende o código
fonte. Asegúrese de eliminar ou comentar calquera liña que diga:
#define LOW_QUALITY_COLOR_SELECTOR
no ficheiro «tuxpaint.c» no directorio «src».
Todo o texto está en maiúscula.
Está activada a opción «maiúsculas».

View file

@ -163,26 +163,6 @@
<dd>
Probabelmente estea activada a opción «Miniaturas de baixa calidade». Vexa: «As miniaturas dos selos no selector de selos vense mal», arriba. </dd>
<dt>
Os botóns de selección de cores son cadrados feos, e non botóns bonitos. </dt>
<dd>
<p>
Tux Paint probabelmente compilado desactivando os fermosos botóns de selección de cor. Executa a orde: «<code>tuxpaint --verbose-version</code>» dende unha liña de ordes. Se, entre outras saídas, ves o texto: «Low Quality Color Selector enabled», entón é isto o que está a suceder. </p>
<p>
Para cambialo, debe volver compilar Tux Paint dende o código fonte. Asegúrese de eliminar ou comentar calquera liña que diga: </p>
<blockquote>
<p>
<code>#define LOW_QUALITY_COLOR_SELECTOR</code>
</p>
</blockquote>
<p>
no ficheiro «tuxpaint.c» no directorio «src». </p>
</dd>
<dt>
Todo o texto está en maiúscula. </dt>

View file

@ -91,21 +91,6 @@ Interface Problems
"Low Quality Thumbnails" is probably enabled. See: "Stamp
thumbnails in the Stamp Selector look bad", above.
The color picker buttons are ugly squares, not pretty buttons!
Tux Paint was probably compiled with the nice looking color
selector buttons disabled. Run the command: "tuxpaint
--verbose-version" from a command line. If, amongst the other
output, you see the text: "Low Quality Color Selector enabled",
then this is what's happening.
To change this, you must rebuild Tux Paint from source. Be sure to
remove or comment out any line that says:
#define LOW_QUALITY_COLOR_SELECTOR
in the "tuxpaint.c" file in the "src" directory.
All of the text is in uppercase!
The "uppercase" option is on.

View file

@ -163,26 +163,6 @@
<dd>
"Low Quality Thumbnails" is probably enabled. See: "Stamp thumbnails in the Stamp Selector look bad", above. </dd>
<dt>
The color picker buttons are ugly squares, not pretty buttons! </dt>
<dd>
<p>
Tux Paint was probably compiled with the nice looking color selector buttons disabled. Run the command: "<code>tuxpaint --verbose-version</code>" from a command line. If, amongst the other output, you see the text: "Low Quality Color Selector enabled", then this is what's happening. </p>
<p>
To change this, you must rebuild Tux Paint from source. Be sure to remove or comment out any line that says: </p>
<blockquote>
<p>
<code>#define LOW_QUALITY_COLOR_SELECTOR</code>
</p>
</blockquote>
<p>
in the "tuxpaint.c" file in the "src" directory. </p>
</dd>
<dt>
All of the text is in uppercase! </dt>

View file

@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
June 14, 2002 - June 18, 2023
June 14, 2002 - June 19, 2023
*/
#include "platform.h"
@ -76,7 +76,6 @@
#else
/* #define DEBUG_MALLOC */
/* #define LOW_QUALITY_THUMBNAILS */
/* #define LOW_QUALITY_COLOR_SELECTOR */
/* #define LOW_QUALITY_STAMP_OUTLINE */
/* #define NO_PROMPT_SHADOWS */
/* #define USE_HWSURFACE */
@ -1941,12 +1940,8 @@ static SDL_Surface *img_tux[NUM_TIP_TUX];
static SDL_Surface *img_mouse, *img_mouse_click;
#ifdef LOW_QUALITY_COLOR_SELECTOR
static SDL_Surface *img_paintcan;
#else
static SDL_Surface **img_color_btns;
static SDL_Surface *img_color_btn_off;
#endif
static int colors_are_selectable;
@ -7880,16 +7875,10 @@ void show_version(int details)
printf(" High Quality Thumbnails enabled (not LOW_QUALITY_THUMBNAILS)\n");
#endif
#ifdef LOW_QUALITY_COLOR_SELECTOR
printf(" Low Quality Color Selector enabled (LOW_QUALITY_COLOR_SELECTOR)\n");
#else
printf(" Hight Quality Color Selector enabled (not LOW_QUALITY_COLOR_SELECTOR)\n");
#endif
#ifdef LOW_QUALITY_STAMP_OUTLINE
printf(" Low Quality Stamp Outline enabled (LOW_QUALITY_STAMP_OUTLINE)\n");
#else
printf(" Hight Quality Stamp Outline enabled (not LOW_QUALITY_STAMP_OUTLINE)\n");
printf(" High Quality Stamp Outline enabled (not LOW_QUALITY_STAMP_OUTLINE)\n");
#endif
#ifdef NO_PROMPT_SHADOWS
@ -10228,24 +10217,8 @@ static unsigned draw_colors(unsigned action)
{
dest.x = r_colors.x + i % gd_colors.cols * color_button_w;
dest.y = r_colors.y + i / gd_colors.cols * color_button_h;
#ifndef LOW_QUALITY_COLOR_SELECTOR
SDL_BlitSurface((colors_state == COLORSEL_ENABLE)
? img_color_btns[i + (i == cur_color) * NUM_COLORS] : img_color_btn_off, NULL, screen, &dest);
#else
dest.w = color_button_w;
dest.h = color_button_h;
if (colors_state == COLORSEL_ENABLE)
SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, color_hexes[i][0], color_hexes[i][1], color_hexes[i][2]));
else
SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, 240, 240, 240));
if (i == cur_color && colors_state == COLORSEL_ENABLE)
{
dest.y += 4;
SDL_BlitSurface(img_paintcan, NULL, screen, &dest);
}
#endif
}
update_screen_rect(&r_colors);
@ -15128,12 +15101,8 @@ static void cleanup(void)
free_surface_array(undo_bufs, NUM_UNDO_BUFS);
#ifdef LOW_QUALITY_COLOR_SELECTOR
free_surface(&img_paintcan);
#else
free_surface_array(img_color_btns, NUM_COLORS * 2);
free(img_color_btns);
#endif
if (onscreen_keyboard)
{
@ -16418,9 +16387,7 @@ static void do_png_embed_data(png_structp png_ptr)
for (x = 0; x < current_node->save_width; x++)
for (y = 0; y < current_node->save_height; y++)
{
/* *INDENT-OFF* */
pix = getpixels[current_node->label_node_surface->format->BytesPerPixel](current_node->label_node_surface, x, y);
/* *INDENT-ON* */
pix = getpixels[current_node->label_node_surface->format->BytesPerPixel](current_node->label_node_surface, x, y);
SDL_GetRGBA(pix, current_label_node->label_node_surface->format, &r, &g, &b, &a);
fwrite(&a, alpha_size, 1, lfi);
}
@ -26180,9 +26147,7 @@ static struct label_node *search_label_list(struct label_node **ref_head, Uint16
struct label_node *tmp_node = NULL;
unsigned u;
int done = SDL_FALSE;
Uint8 r, g, b, a;
int i, j, k;
int k;
if (*ref_head == NULL)
return (NULL);
@ -26242,45 +26207,16 @@ static struct label_node *search_label_list(struct label_node **ref_head, Uint16
if (k == COLOR_PICKER)
{
/* If the label's color is not one of the built-ins,
set the color picker to the label's color, and
make the color picker be the currently-selected color */
cur_color = COLOR_PICKER;
select_color = COLOR_PICKER;
color_hexes[select_color][0] = tmp_node->save_color.r;
color_hexes[select_color][1] = tmp_node->save_color.g;
color_hexes[select_color][2] = tmp_node->save_color.b;
SDL_LockSurface(img_color_btns[COLOR_PICKER]);
SDL_LockSurface(img_color_btns[COLOR_PICKER + NUM_COLORS]);
for (j = 0; j < 48 /* 48 */ ; j++)
{
for (i = 0; i < 48; i++)
{
SDL_GetRGBA(getpixels[img_paintwell->format->BytesPerPixel]
(img_paintwell, i, j), img_paintwell->format, &r, &g, &b, &a);
if (a == 255)
{
putpixels[img_color_btns[COLOR_PICKER]->format->BytesPerPixel]
(img_color_btns[COLOR_PICKER], i, j,
SDL_MapRGB(img_color_btns[COLOR_PICKER]->format,
tmp_node->save_color.r, tmp_node->save_color.g, tmp_node->save_color.b));
putpixels[img_color_btns[COLOR_PICKER + NUM_COLORS]->format->BytesPerPixel] (img_color_btns[COLOR_PICKER +
NUM_COLORS],
i, j,
SDL_MapRGB(img_color_btns
[COLOR_PICKER +
NUM_COLORS]->
format,
tmp_node->
save_color.r,
tmp_node->
save_color.g,
tmp_node->
save_color.b));
}
}
}
SDL_UnlockSurface(img_color_btns[COLOR_PICKER]);
SDL_UnlockSurface(img_color_btns[COLOR_PICKER + NUM_COLORS]);
render_color_button(COLOR_PICKER, img_color_picker_thumb, NULL);
draw_colors(COLORSEL_CLOBBER);
render_brush(); /* FIXME: render_brush should be called at the start of Brush and Line tools? */
}
@ -29055,18 +28991,14 @@ static void setup(void)
int scale;
int canvas_width, canvas_height;
int win_x = SDL_WINDOWPOS_UNDEFINED, win_y = SDL_WINDOWPOS_UNDEFINED;
#ifndef LOW_QUALITY_COLOR_SELECTOR
int x, y;
SDL_Surface *tmp_btn_up;
SDL_Surface *tmp_btn_down;
Uint8 r, g, b;
#endif
SDL_Surface *tmp_imgcurup, *tmp_imgcurdown;
Uint32 init_flags;
char tmp_str[128];
SDL_Surface *img1;
Uint32(*getpixel_tmp_btn_up) (SDL_Surface *, int, int);
Uint32(*getpixel_tmp_btn_down) (SDL_Surface *, int, int);
Uint32(*getpixel_img_paintwell) (SDL_Surface *, int, int);
@ -29926,10 +29858,6 @@ static void setup(void)
img_color_mix = loadimagerb(DATA_PREFIX "images/ui/cmix.png");
img_color_grab = loadimagerb(DATA_PREFIX "images/ui/color_grab.png");
#ifdef LOW_QUALITY_COLOR_SELECTOR
img_paintcan = loadimage(DATA_PREFIX "images/ui/paintcan.png");
#endif
if (onscreen_keyboard)
{
img_oskdel = loadimagerb(DATA_PREFIX "images/ui/osk_delete.png");
@ -30114,8 +30042,6 @@ static void setup(void)
/* Generate color selection buttons: */
#ifndef LOW_QUALITY_COLOR_SELECTOR
/* Create appropriately-shaped buttons: */
img1 = loadimage(DATA_PREFIX "images/ui/paintwell.png");
img_paintwell = thumbnail(img1, color_button_w, color_button_h, 0);
@ -30161,10 +30087,9 @@ static void setup(void)
getpixel_img_paintwell = getpixels[img_paintwell->format->BytesPerPixel];
for (y = 0; y < tmp_btn_up->h /* 48 */ ; y++)
for (y = 0; y < tmp_btn_up->h; y++)
{
for (x = 0; x < tmp_btn_up->w /* (WINDOW_WIDTH - r_ttoolopt.w) / NUM_COLORS */ ;
x++)
for (x = 0; x < tmp_btn_up->w; x++)
{
double ru, gu, bu, rd, gd, bd, aa;
Uint8 a;
@ -30198,7 +30123,7 @@ static void setup(void)
(img_color_picker_thumb, x, y));
}
if (i < COLOR_PICKER || a == 255)
if (i < COLOR_PICKER || a == 0)
{
putpixels[img_color_btns[i]->format->BytesPerPixel]
(img_color_btns[i], x, y,
@ -30222,6 +30147,7 @@ static void setup(void)
}
}
/* Apply icons on top of the color buttons that have them */
for (i = 0; i < NUM_COLORS * 2; i++)
{
SDL_UnlockSurface(img_color_btns[i]);
@ -30250,8 +30176,6 @@ static void setup(void)
SDL_FreeSurface(tmp_btn_up);
SDL_FreeSurface(tmp_btn_down);
#endif
create_button_labels();
/* Resize any icons if the text we just rendered was too wide,
@ -30334,6 +30258,7 @@ static void setup(void)
#endif
}
/* ================================================================================== */
/**