Merge branch 'master' into sdl2.0
This commit is contained in:
commit
41015efc73
19 changed files with 249 additions and 198 deletions
|
|
@ -1,7 +1,7 @@
|
|||
# Tuxpaint japanese translation.
|
||||
# Copyright (C) 2017 Bill Kendrick
|
||||
# This file is distributed under the same license as the Tuxpaint package.
|
||||
# TOYAMA Shin-ichi <shin1@wmail.plala.or.jp>, 2005-2017.
|
||||
# TOYAMA Shin-ichi <dolphin6k@wmail.plala.or.jp>, 2005-2017.
|
||||
#
|
||||
msgid ""
|
||||
msgstr ""
|
||||
|
|
@ -9,8 +9,8 @@ msgstr ""
|
|||
"Report-Msgid-Bugs-To: \n"
|
||||
"POT-Creation-Date: 2022-02-10 01:02-0800\n"
|
||||
"PO-Revision-Date: 2022-02-04 17:06+0900\n"
|
||||
"Last-Translator: Shin-ichi TOYAMA <shin1@wmail.plala.or.jp>\n"
|
||||
"Language-Team: japanese <shin1@wmail.plala.or.jp>\n"
|
||||
"Last-Translator: Shin-ichi TOYAMA <dolphin6k@wmail.plala.or.jp>\n"
|
||||
"Language-Team: japanese <dolphin6k@wmail.plala.or.jp>\n"
|
||||
"Language: ja\n"
|
||||
"MIME-Version: 1.0\n"
|
||||
"Content-Type: text/plain; charset=UTF-8\n"
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
# if successful
|
||||
#
|
||||
# for Tux Paint
|
||||
# by TOYAMA Shin-ichi <shin1@wmail.plala.or.jp>
|
||||
# by TOYAMA Shin-ichi <dolphin6k@wmail.plala.or.jp>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
|
|
|||
277
src/tuxpaint.c
277
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 - March 2, 2022
|
||||
June 14, 2002 - March 16, 2022
|
||||
*/
|
||||
|
||||
#include "platform.h"
|
||||
|
|
@ -363,9 +363,9 @@ extern int win32_trash(const char *path);
|
|||
#undef iswprint
|
||||
int iswprint(wchar_t wc)
|
||||
{
|
||||
WORD t;
|
||||
GetStringTypeW(CT_CTYPE1, &wc, 1, &t);
|
||||
return (t & C1_DEFINED) && !(t & C1_CNTRL);
|
||||
WORD t;
|
||||
GetStringTypeW(CT_CTYPE1, &wc, 1, &t);
|
||||
return (t & C1_DEFINED) && !(t & C1_CNTRL);
|
||||
}
|
||||
|
||||
#endif /* WIN32 */
|
||||
|
|
@ -2129,6 +2129,7 @@ static int do_new_dialog_add_colors(SDL_Surface * *thumbs, int num_files, int *d
|
|||
static int do_color_picker(void);
|
||||
static void draw_color_picker_crosshairs(int color_picker_left, int color_picker_top, int color_picker_val_left, int color_picker_val_top);
|
||||
static void draw_color_picker_values(int l, int t);
|
||||
static void draw_color_picker_palette_and_values(int color_picker_left, int color_picker_top, int color_picker_val_left, int color_picker_val_top);
|
||||
static void render_color_picker_palette(void);
|
||||
static int do_color_sel(int temp_mode);
|
||||
static int do_color_mix(void);
|
||||
|
|
@ -4146,7 +4147,7 @@ static void mainloop(void)
|
|||
/* Shape controls! */
|
||||
shape_mode = which;
|
||||
draw_shapes();
|
||||
update_screen_rect(&r_toolopt);
|
||||
update_screen_rect(&r_toolopt);
|
||||
draw_tux_text(TUX_GREAT, shapemode_tips[shape_mode], 1);
|
||||
playsound(screen, 0, SND_CLICK, 0, SNDPOS_RIGHT, SNDDIST_NEAR);
|
||||
update_screen_rect(&r_tuxarea);
|
||||
|
|
@ -5887,6 +5888,8 @@ static void mainloop(void)
|
|||
}
|
||||
else if (HIT(r_toolopt))
|
||||
{
|
||||
int control_rows = 0, num_places;
|
||||
|
||||
/* mouse cursor code
|
||||
WARNING: this must be kept in sync with the mouse-click
|
||||
and mouse-click code. (it isn't, currently!) */
|
||||
|
|
@ -5901,35 +5904,35 @@ static void mainloop(void)
|
|||
}
|
||||
|
||||
/* This if/if/if block is awful -bjk 2022.01.19 */
|
||||
int control_rows = 0;
|
||||
if (cur_tool == TOOL_STAMP && !disable_stamp_controls)
|
||||
control_rows = 3;
|
||||
control_rows = 3;
|
||||
|
||||
if (cur_tool == TOOL_LABEL)
|
||||
{
|
||||
control_rows = 1;
|
||||
control_rows = 1;
|
||||
if (!disable_stamp_controls)
|
||||
control_rows = 3;
|
||||
control_rows = 3;
|
||||
}
|
||||
|
||||
if (cur_tool == TOOL_TEXT && !disable_stamp_controls)
|
||||
control_rows = 2;
|
||||
control_rows = 2;
|
||||
if (cur_tool == TOOL_MAGIC)
|
||||
{
|
||||
control_rows = 1;
|
||||
control_rows = 1;
|
||||
if (!disable_magic_controls)
|
||||
control_rows = 2;
|
||||
}
|
||||
if (cur_tool == TOOL_SHAPES && !disable_shape_controls)
|
||||
control_rows = 1;
|
||||
control_rows = 1;
|
||||
if ((cur_tool == TOOL_BRUSH || cur_tool == TOOL_LINES) && !disable_brushspacing)
|
||||
control_rows = 1;
|
||||
control_rows = 1;
|
||||
|
||||
int num_places = buttons_tall * gd_toolopt.cols - control_rows * gd_toolopt.cols;
|
||||
num_places = buttons_tall * gd_toolopt.cols - control_rows * gd_toolopt.cols;
|
||||
|
||||
if (num_things > num_places)
|
||||
{
|
||||
/* Are there scroll buttons? */
|
||||
num_places = num_places - gd_toolopt.cols; /* Two scroll buttons occupy one row */
|
||||
num_places = num_places - gd_toolopt.cols; /* Two scroll buttons occupy one row */
|
||||
if (event.button.y < r_ttoolopt.h + img_scroll_up->h)
|
||||
{
|
||||
/* Up button; is it available? */
|
||||
|
|
@ -9807,9 +9810,6 @@ static void draw_fonts(void)
|
|||
dest.x = WINDOW_WIDTH - r_ttoolopt.w;
|
||||
dest.y = r_ttoolopt.h + off_y + (((most - gd_toolopt.cols) / gd_toolopt.cols + TOOLOFFSET / gd_toolopt.cols) * button_h);
|
||||
|
||||
/* if (!disable_stamp_controls)
|
||||
dest.y = dest.y - (button_h * 2); */
|
||||
|
||||
if (font_scroll < num_font_families - (most - gd_toolopt.cols) - TOOLOFFSET)
|
||||
{
|
||||
SDL_BlitSurface(img_scroll_down, NULL, screen, &dest);
|
||||
|
|
@ -10428,7 +10428,7 @@ static void draw_shapes(void)
|
|||
SDL_BlitSurface(img_shapes[shape], NULL, screen, &dest);
|
||||
|
||||
dest.x = ((i % 2) * button_w) + (4 * button_w) / ORIGINAL_BUTTON_SIZE + WINDOW_WIDTH - r_ttoolopt.w + ((40 * button_w) / ORIGINAL_BUTTON_SIZE - img_shape_names[shape]->w) / 2;
|
||||
dest.y = ((i / 2) * button_h) + r_ttoolopt.h + (4 * button_h) / ORIGINAL_BUTTON_SIZE + ((44 * button_h) / ORIGINAL_BUTTON_SIZE - img_shape_names[shape]->h) + off_y;
|
||||
dest.y = ((i / 2) * button_h) + r_ttoolopt.h + (4 * button_h) / ORIGINAL_BUTTON_SIZE + ((44 * button_h) / ORIGINAL_BUTTON_SIZE - img_shape_names[shape]->h) + off_y;
|
||||
|
||||
SDL_BlitSurface(img_shape_names[shape], NULL, screen, &dest);
|
||||
}
|
||||
|
|
@ -10727,7 +10727,7 @@ static void draw_fills(void)
|
|||
SDL_BlitSurface(img_fills[i], NULL, screen, &dest);
|
||||
|
||||
dest.x = ((i % 2) * button_w) + (4 * button_w) / ORIGINAL_BUTTON_SIZE + WINDOW_WIDTH - r_ttoolopt.w + ((40 * button_w) / ORIGINAL_BUTTON_SIZE - img_fill_names[i]->w) / 2;
|
||||
dest.y = ((i / 2) * button_h) + r_ttoolopt.h + (4 * button_h) / ORIGINAL_BUTTON_SIZE + ((44 * button_h) / ORIGINAL_BUTTON_SIZE - img_fill_names[i]->h) + off_y;
|
||||
dest.y = ((i / 2) * button_h) + r_ttoolopt.h + (4 * button_h) / ORIGINAL_BUTTON_SIZE + ((44 * button_h) / ORIGINAL_BUTTON_SIZE - img_fill_names[i]->h) + off_y;
|
||||
|
||||
SDL_BlitSurface(img_fill_names[i], NULL, screen, &dest);
|
||||
}
|
||||
|
|
@ -13665,9 +13665,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
SDL_Delay(1);
|
||||
|
||||
if (w == r_ttools.w - 2)
|
||||
{
|
||||
SDL_BlitSurface(backup, NULL, screen, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
SDL_FreeSurface(backup);
|
||||
|
|
@ -13696,7 +13694,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
dest.y = 94 / button_scale + r_ttools.w / button_scale - (w - 4) + i + PROMPTOFFSETY;
|
||||
dest.w = (PROMPT_W - r_ttools.w * 2) + (w - 4) * 2;
|
||||
dest.h = (w - 4) * 2;
|
||||
dest.y = canvas->h / 2 - dest.h / 2 + i + 2;
|
||||
dest.y = canvas->h / 2 - dest.h / 2 + i + 2;
|
||||
SDL_BlitSurface(alpha_surf, NULL, screen, &dest);
|
||||
}
|
||||
|
||||
|
|
@ -13911,14 +13909,14 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
if (event.button.x >= btn_left && event.button.x < btn_left + img_yes->w)
|
||||
{
|
||||
if (event.button.y >= dest_back.y + dest_back.h - 4 - button_h - 4 - button_h &&
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h - 4 - button_h + img_yes->h)
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h - 4 - button_h + img_yes->h)
|
||||
{
|
||||
ans = 1;
|
||||
done = 1;
|
||||
}
|
||||
else if (strlen(btn_no) != 0 &&
|
||||
event.button.y >= dest_back.y + dest_back.h - 4 - button_h &&
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h + img_no->h)
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h + img_no->h)
|
||||
{
|
||||
ans = 0;
|
||||
done = 1;
|
||||
|
|
@ -13933,7 +13931,7 @@ static int do_prompt_image_flash_snd(const char *const text,
|
|||
event.button.y < dest_back.y + dest_back.h - 4 - button_h - 4 - button_h + img_yes->h) ||
|
||||
(strlen(btn_no) != 0 &&
|
||||
event.button.y >= dest_back.y + dest_back.h - 4 - button_h &&
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h + img_no->h)))
|
||||
event.button.y < dest_back.y + dest_back.h - 4 - button_h + img_no->h)))
|
||||
{
|
||||
do_setcursor(cursor_hand);
|
||||
}
|
||||
|
|
@ -14847,7 +14845,7 @@ static int do_save(int tool, int dont_show_success_results, int autosave)
|
|||
PROMPT_SAVE_OVER_NO,
|
||||
img_save_over, NULL, NULL, SND_AREYOUSURE,
|
||||
(TOOL_SAVE % 2) * button_w + button_w / 2,
|
||||
(TOOL_SAVE / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll) == 0)
|
||||
(TOOL_SAVE / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll) == 0)
|
||||
{
|
||||
/* No - Let's save a new picture! */
|
||||
|
||||
|
|
@ -15370,13 +15368,13 @@ static void do_png_embed_data(png_structp png_ptr)
|
|||
{
|
||||
#ifdef WIN32
|
||||
wtmpchar = current_node->save_texttool_str[i];
|
||||
nbtmpstr = WideCharToMultiByte(CP_UTF8, 0, &wtmpchar, 1, tmpstr, 16, NULL, NULL);
|
||||
tmpstr[nbtmpstr] = '\0';
|
||||
nbtmpstr = WideCharToMultiByte(CP_UTF8, 0, &wtmpchar, 1, tmpstr, 16, NULL, NULL);
|
||||
tmpstr[nbtmpstr] = '\0';
|
||||
fprintf(lfi, "%s", tmpstr);
|
||||
#elif defined(__ANDROID__)
|
||||
fprintf(lfi, "%d ", (int)current_node->save_texttool_str[i]);
|
||||
#else
|
||||
fprintf(lfi, "%lc", (wint_t) current_node->save_texttool_str[i]);
|
||||
fprintf(lfi, "%lc", (wint_t) current_node->save_texttool_str[i]);
|
||||
#endif
|
||||
}
|
||||
fprintf(lfi, "\n");
|
||||
|
|
@ -15657,7 +15655,7 @@ static int do_quit(int tool)
|
|||
done = do_prompt_snd(PROMPT_QUIT_TXT,
|
||||
PROMPT_QUIT_YES, PROMPT_QUIT_NO, SND_AREYOUSURE,
|
||||
(TOOL_QUIT % 2) * button_w + button_w / 2,
|
||||
(TOOL_QUIT / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll);
|
||||
(TOOL_QUIT / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -16062,8 +16060,8 @@ static int do_open(void)
|
|||
{
|
||||
do_prompt_snd(PROMPT_OPEN_NOFILES_TXT, PROMPT_OPEN_NOFILES_YES, "",
|
||||
SND_YOUCANNOT,
|
||||
(TOOL_OPEN % 2) * button_w + button_w / 2,
|
||||
(TOOL_OPEN / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols);
|
||||
(TOOL_OPEN % 2) * button_w + button_w / 2,
|
||||
(TOOL_OPEN / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -16523,7 +16521,7 @@ static int do_open(void)
|
|||
event.button.x < (WINDOW_WIDTH - r_ttoolopt.w)) ||
|
||||
(event.button.x >= (WINDOW_WIDTH - r_ttoolopt.w - button_w - button_w - button_w) &&
|
||||
event.button.x < (WINDOW_WIDTH - button_w - r_ttoolopt.w) &&
|
||||
/* Both "Erase" and "Export" only work on our own files... */
|
||||
/* Both "Erase" and "Export" only work on our own files... */
|
||||
d_places[which] != PLACE_STARTERS_DIR &&
|
||||
d_places[which] != PLACE_PERSONAL_STARTERS_DIR)) &&
|
||||
event.button.y >= (button_h * buttons_tall + r_ttools.h) - button_h &&
|
||||
|
|
@ -16699,7 +16697,7 @@ static int do_open(void)
|
|||
do_prompt_snd(PROMPT_PICT_EXPORT_FAILED_TXT, PROMPT_EXPORT_YES, "", SND_YOUCANNOT, screen->w / 2, screen->h / 2);
|
||||
|
||||
draw_tux_text(TUX_BORED, instructions, 1);
|
||||
update_list = 1;
|
||||
update_list = 1;
|
||||
}
|
||||
}
|
||||
while (!done);
|
||||
|
|
@ -17505,18 +17503,18 @@ static int do_slideshow(void)
|
|||
playsound(screen, 1, SND_CLICK, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
|
||||
|
||||
if (num_selected < 2)
|
||||
{
|
||||
/* None selected? Too dangerous to automatically select all (like we do for slideshow playback).
|
||||
Only 1 selected? No point in saving as GIF.
|
||||
{
|
||||
/* None selected? Too dangerous to automatically select all (like we do for slideshow playback).
|
||||
Only 1 selected? No point in saving as GIF.
|
||||
*/
|
||||
freeme = textdir(gettext_noop("Select 2 or more drawings to turn into an animated GIF."));
|
||||
draw_tux_text(TUX_BORED, freeme, 1);
|
||||
free(freeme);
|
||||
|
||||
control_drawtext_timer(2000, instructions, 0); /* N.B. It will draw instructions, regardless */
|
||||
}
|
||||
else
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
export_successful = export_gif(selected, num_selected, dirname, d_names, d_exts, speed);
|
||||
|
||||
/* Redraw entire screen, after export: */
|
||||
|
|
@ -17538,7 +17536,7 @@ static int do_slideshow(void)
|
|||
SDL_Flip(screen);
|
||||
|
||||
update_list = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (event.button.x >= (WINDOW_WIDTH - r_ttoolopt.w - button_w) &&
|
||||
event.button.x < (WINDOW_WIDTH - r_ttoolopt.w) &&
|
||||
|
|
@ -17666,8 +17664,8 @@ static int do_slideshow(void)
|
|||
{
|
||||
draw_tux_text(TUX_BORED, instructions, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (motioner | hatmotioner)
|
||||
|
|
@ -18319,7 +18317,7 @@ static void print_image(void)
|
|||
PROMPT_PRINT_NOW_NO,
|
||||
img_printer, NULL, NULL, SND_AREYOUSURE,
|
||||
(TOOL_PRINT % 2) * button_w + button_w / 2,
|
||||
(TOOL_PRINT / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll))
|
||||
(TOOL_PRINT / 2) * button_h + r_ttools.h + button_h / 2 - tool_scroll * button_h / gd_tools.cols + scroll))
|
||||
{
|
||||
do_print();
|
||||
|
||||
|
|
@ -22337,9 +22335,6 @@ static int do_color_sel(int temp_mode)
|
|||
/**
|
||||
* Display a large prompt, allowing the user to pick a
|
||||
* color from a large palette.
|
||||
*
|
||||
* FIXME: Various options here would be helpful
|
||||
* (RGB, HSV, color wheel, etc.) -bjk 2022.01.25
|
||||
*/
|
||||
static int do_color_picker(void)
|
||||
{
|
||||
|
|
@ -22368,6 +22363,7 @@ static int do_color_picker(void)
|
|||
val_x = val_y = motioner = 0;
|
||||
valhat_x = valhat_y = hatmotioner = 0;
|
||||
int old_cp_x, old_cp_y, old_cp_v;
|
||||
int last_motion_within_val_slider;
|
||||
|
||||
/* Remember old choices, in case we hit [Back] */
|
||||
old_cp_x = color_picker_x;
|
||||
|
|
@ -22435,7 +22431,7 @@ static int do_color_picker(void)
|
|||
for (i = 8; i > 0; i = i - 2)
|
||||
{
|
||||
dest.x = r_final.x + i - 4;
|
||||
dest.y = r_final.y + i - 4;
|
||||
dest.y = r_final.y + i - 4;
|
||||
dest.w = r_final.w + 8;
|
||||
dest.h = r_final.h + 16;
|
||||
|
||||
|
|
@ -22554,7 +22550,7 @@ static int do_color_picker(void)
|
|||
done = 0;
|
||||
chose = 0;
|
||||
x = y = 0;
|
||||
SDL_WarpMouse(back_left + button_w / 2, back_top - button_w / 2);
|
||||
last_motion_within_val_slider = 0;
|
||||
|
||||
do
|
||||
{
|
||||
|
|
@ -22625,7 +22621,7 @@ static int do_color_picker(void)
|
|||
event.button.y <= color_picker_val_top + img_color_picker_val->h)
|
||||
{
|
||||
/* Picked a value from the slider */
|
||||
|
||||
|
||||
y = event.button.y - color_picker_val_top;
|
||||
color_picker_v = y;
|
||||
|
||||
|
|
@ -22643,26 +22639,7 @@ static int do_color_picker(void)
|
|||
|
||||
|
||||
/* Redraw hue/sat palette, and val slider, and redraw crosshairs */
|
||||
draw_color_picker_values(color_picker_val_left, color_picker_val_top);
|
||||
|
||||
dest.x = color_picker_left;
|
||||
dest.y = color_picker_top;
|
||||
SDL_BlitSurface(img_color_picker, NULL, screen, &dest);
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
|
||||
draw_color_picker_crosshairs(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
|
||||
|
||||
dest.x = color_picker_val_left;
|
||||
dest.y = color_picker_val_top;
|
||||
dest.w = img_back->w;
|
||||
dest.h = img_color_picker_val->h;
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
|
||||
dest.x = color_picker_left;
|
||||
dest.y = color_picker_top;
|
||||
dest.w = img_color_picker->w;
|
||||
dest.h = img_color_picker->h;
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
draw_color_picker_palette_and_values(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
|
||||
}
|
||||
else if (event.button.x >= done_left &&
|
||||
event.button.x < done_left + img_yes->w &&
|
||||
|
|
@ -22685,21 +22662,29 @@ static int do_color_picker(void)
|
|||
}
|
||||
else if (event.type == SDL_MOUSEMOTION)
|
||||
{
|
||||
if (event.button.x >= color_picker_left &&
|
||||
event.button.x < color_picker_left + img_color_picker->w &&
|
||||
event.button.y >= color_picker_top && event.button.y < color_picker_top + img_color_picker->h)
|
||||
if (event.button.x >= color_picker_val_left &&
|
||||
event.button.y >= color_picker_val_top &&
|
||||
event.button.x <= color_picker_val_left + img_back->w &&
|
||||
event.button.y <= color_picker_val_top + img_color_picker_val->h)
|
||||
{
|
||||
/* Hovering over the colors! */
|
||||
int tmp_color_picker_v;
|
||||
|
||||
do_setcursor(cursor_pipette);
|
||||
/* Hovering over a value from the slider */
|
||||
|
||||
y = event.button.y - color_picker_val_top;
|
||||
tmp_color_picker_v = color_picker_v;
|
||||
color_picker_v = y;
|
||||
|
||||
/* Re-render the palette with the new value */
|
||||
render_color_picker_palette();
|
||||
color_picker_v = tmp_color_picker_v;
|
||||
|
||||
/* Show a big solid example of the color: */
|
||||
|
||||
x = event.button.x - color_picker_left;
|
||||
y = event.button.y - color_picker_top;
|
||||
|
||||
SDL_GetRGB(getpixel_img_color_picker(img_color_picker, x, y), img_color_picker->format, &r, &g, &b);
|
||||
SDL_GetRGB(getpixel_img_color_picker(img_color_picker, color_picker_x, color_picker_y), img_color_picker->format, &r, &g, &b);
|
||||
|
||||
dest.x = color_example_dest.x + color_example_dest.w / 4;
|
||||
dest.y = color_example_dest.y + color_example_dest.h / 4;
|
||||
|
|
@ -22709,32 +22694,73 @@ static int do_color_picker(void)
|
|||
SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, r, g, b));
|
||||
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
|
||||
|
||||
/* Redraw hue/sat palette, and val slider, and redraw crosshairs */
|
||||
draw_color_picker_palette_and_values(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
|
||||
|
||||
last_motion_within_val_slider = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Revert to current color picker color */
|
||||
if (last_motion_within_val_slider)
|
||||
{
|
||||
render_color_picker_palette();
|
||||
draw_color_picker_palette_and_values(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
|
||||
last_motion_within_val_slider = 0;
|
||||
}
|
||||
|
||||
SDL_GetRGB(getpixel_img_color_picker(img_color_picker, color_picker_x, color_picker_y),
|
||||
img_color_picker->format, &r, &g, &b);
|
||||
if (event.button.x >= color_picker_left &&
|
||||
event.button.x < color_picker_left + img_color_picker->w &&
|
||||
event.button.y >= color_picker_top && event.button.y < color_picker_top + img_color_picker->h)
|
||||
{
|
||||
/* Hovering over the colors! */
|
||||
|
||||
SDL_FillRect(screen, &color_example_dest, SDL_MapRGB(screen->format, r, g, b));
|
||||
do_setcursor(cursor_pipette);
|
||||
|
||||
SDL_UpdateRect(screen,
|
||||
color_example_dest.x, color_example_dest.y,
|
||||
color_example_dest.w, color_example_dest.h);
|
||||
|
||||
/* Change cursor to arrow (or hand, if over Back or Done): */
|
||||
/* Show a big solid example of the color: */
|
||||
|
||||
if (event.button.x >= back_left &&
|
||||
event.button.x < back_left + img_back->w &&
|
||||
event.button.y >= back_top && event.button.y < back_top + img_back->h)
|
||||
do_setcursor(cursor_hand);
|
||||
else if (event.button.x >= done_left &&
|
||||
event.button.x < done_left + img_yes->w &&
|
||||
event.button.y >= done_top && event.button.y < done_top + img_yes->h)
|
||||
do_setcursor(cursor_hand);
|
||||
x = event.button.x - color_picker_left;
|
||||
y = event.button.y - color_picker_top;
|
||||
|
||||
SDL_GetRGB(getpixel_img_color_picker(img_color_picker, x, y), img_color_picker->format, &r, &g, &b);
|
||||
|
||||
dest.x = color_example_dest.x + color_example_dest.w / 4;
|
||||
dest.y = color_example_dest.y + color_example_dest.h / 4;
|
||||
dest.w = color_example_dest.w / 2;
|
||||
dest.h = color_example_dest.h / 2;
|
||||
|
||||
SDL_FillRect(screen, &dest, SDL_MapRGB(screen->format, r, g, b));
|
||||
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
}
|
||||
else
|
||||
do_setcursor(cursor_arrow);
|
||||
{
|
||||
/* Revert to current color picker color */
|
||||
|
||||
SDL_GetRGB(getpixel_img_color_picker(img_color_picker, color_picker_x, color_picker_y),
|
||||
img_color_picker->format, &r, &g, &b);
|
||||
|
||||
SDL_FillRect(screen, &color_example_dest, SDL_MapRGB(screen->format, r, g, b));
|
||||
|
||||
SDL_UpdateRect(screen,
|
||||
color_example_dest.x, color_example_dest.y,
|
||||
color_example_dest.w, color_example_dest.h);
|
||||
|
||||
/* Change cursor to arrow (or hand, if over Back or Done): */
|
||||
|
||||
if (event.button.x >= back_left &&
|
||||
event.button.x < back_left + img_back->w &&
|
||||
event.button.y >= back_top && event.button.y < back_top + img_back->h)
|
||||
do_setcursor(cursor_hand);
|
||||
else if (event.button.x >= done_left &&
|
||||
event.button.x < done_left + img_yes->w &&
|
||||
event.button.y >= done_top && event.button.y < done_top + img_yes->h)
|
||||
do_setcursor(cursor_hand);
|
||||
else
|
||||
do_setcursor(cursor_arrow);
|
||||
}
|
||||
}
|
||||
|
||||
oldpos_x = event.motion.x;
|
||||
|
|
@ -22792,6 +22818,31 @@ static int do_color_picker(void)
|
|||
}
|
||||
|
||||
|
||||
static void draw_color_picker_palette_and_values(int color_picker_left, int color_picker_top, int color_picker_val_left, int color_picker_val_top) {
|
||||
SDL_Rect dest;
|
||||
|
||||
draw_color_picker_values(color_picker_val_left, color_picker_val_top);
|
||||
|
||||
dest.x = color_picker_left;
|
||||
dest.y = color_picker_top;
|
||||
SDL_BlitSurface(img_color_picker, NULL, screen, &dest);
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
|
||||
draw_color_picker_crosshairs(color_picker_left, color_picker_top, color_picker_val_left, color_picker_val_top);
|
||||
|
||||
dest.x = color_picker_val_left;
|
||||
dest.y = color_picker_val_top;
|
||||
dest.w = img_back->w;
|
||||
dest.h = img_color_picker_val->h;
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
|
||||
dest.x = color_picker_left;
|
||||
dest.y = color_picker_top;
|
||||
dest.w = img_color_picker->w;
|
||||
dest.h = img_color_picker->h;
|
||||
SDL_UpdateRect(screen, dest.x, dest.y, dest.w, dest.h);
|
||||
}
|
||||
|
||||
static void render_color_picker_palette(void)
|
||||
{
|
||||
int x, y;
|
||||
|
|
@ -22807,7 +22858,7 @@ static void render_color_picker_palette(void)
|
|||
((float) x / ((float) img_color_picker->w)),
|
||||
1.0 - (((float) color_picker_v) / ((float) img_color_picker_val->h)),
|
||||
&r, &g, &b);
|
||||
putpixel(img_color_picker, x, y,
|
||||
putpixel(img_color_picker, x, y,
|
||||
SDL_MapRGBA(img_color_picker->format, r, g, b, 255));
|
||||
}
|
||||
}
|
||||
|
|
@ -23045,7 +23096,7 @@ static int do_color_mix(void)
|
|||
for (i = 8; i > 0; i = i - 2)
|
||||
{
|
||||
dest.x = r_final.x + i - 4;
|
||||
dest.y = r_final.y + i - 4;
|
||||
dest.y = r_final.y + i - 4;
|
||||
dest.w = r_final.w + 8;
|
||||
dest.h = r_final.h + 16;
|
||||
|
||||
|
|
@ -23378,7 +23429,7 @@ static int do_color_mix(void)
|
|||
if (!Mix_Playing(0))
|
||||
{
|
||||
eraser_sound = (eraser_sound + 1) % 2;
|
||||
|
||||
|
||||
playsound(screen, 0, SND_ERASER1 + eraser_sound, 0, SNDPOS_CENTER, SNDDIST_NEAR);
|
||||
}
|
||||
}
|
||||
|
|
@ -24625,12 +24676,12 @@ static void load_info_about_label_surface(FILE * lfi)
|
|||
size_t diff, i;
|
||||
|
||||
wtmpstr = malloc(1024);
|
||||
diff = new_node->save_texttool_len - nwchar;
|
||||
diff = new_node->save_texttool_len - nwchar;
|
||||
|
||||
for (i = 0; i < diff; i++)
|
||||
wtmpstr[i] = L' ';
|
||||
|
||||
for (i = 0; i <= nwchar; i++)
|
||||
for (i = 0; i <= nwchar; i++)
|
||||
wtmpstr[i + diff] = new_node->save_texttool_str[i];
|
||||
|
||||
memcpy(new_node->save_texttool_str, wtmpstr, sizeof(wchar_t) * (new_node->save_texttool_len + 1));
|
||||
|
|
@ -29038,7 +29089,7 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
|
|||
/* FIXME Abort? */
|
||||
}
|
||||
|
||||
/* Record the raw RGB into a big strip, to be quantized and sliced later */
|
||||
/* Record the raw RGB into a big strip, to be quantized and sliced later */
|
||||
for (y = 0; y < overall_h; y++) {
|
||||
for (x = 0; x < overall_w; x++) {
|
||||
SDL_GetRGBA(getpixels[screen->format->BytesPerPixel](screen, x, y), screen->format, &r, &g, &b, &a);
|
||||
|
|
@ -29051,7 +29102,7 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
|
|||
}
|
||||
|
||||
SDL_Flip(screen);
|
||||
done = export_gif_monitor_events();
|
||||
done = export_gif_monitor_events();
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -29060,17 +29111,17 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
|
|||
/* Quantize to max 256 (8bpp) colors and generate a suitable palette */
|
||||
liq_handle = liq_attr_create();
|
||||
input_image = liq_image_create_rgba(liq_handle, bitmap, overall_w, num_selected * overall_h, 0);
|
||||
liq_set_max_colors(liq_handle, 256);
|
||||
liq_set_max_colors(liq_handle, 256);
|
||||
|
||||
show_progress_bar(screen);
|
||||
done = export_gif_monitor_events();
|
||||
done = export_gif_monitor_events();
|
||||
|
||||
#if LIQ_VERSION >= 20800
|
||||
qtiz_status = liq_image_quantize(input_image, liq_handle, &quantization_result);
|
||||
done = (qtiz_status != LIQ_OK);
|
||||
qtiz_status = liq_image_quantize(input_image, liq_handle, &quantization_result);
|
||||
done = (qtiz_status != LIQ_OK);
|
||||
#else
|
||||
quantization_result = liq_quantize_image(liq_handle, input_image);
|
||||
done = (quantization_result == NULL);
|
||||
quantization_result = liq_quantize_image(liq_handle, input_image);
|
||||
done = (quantization_result == NULL);
|
||||
#endif
|
||||
if (!done) {
|
||||
// Use libimagequant to make new image pixels from the palette
|
||||
|
|
@ -29082,7 +29133,7 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
|
|||
palette = liq_get_palette(quantization_result);
|
||||
free(bitmap);
|
||||
|
||||
for (j = 0; j < (int) palette->count; j++) {
|
||||
for (j = 0; j < (int) palette->count; j++) {
|
||||
gif_palette[j * 3 + 0] = palette->entries[j].r;
|
||||
gif_palette[j * 3 + 1] = palette->entries[j].g;
|
||||
gif_palette[j * 3 + 2] = palette->entries[j].b;
|
||||
|
|
@ -29104,22 +29155,22 @@ static int export_gif(int *selected, int num_selected, char *dirname, char **d_n
|
|||
ge_add_frame(gif, gif_speed);
|
||||
|
||||
show_progress_bar(screen);
|
||||
done = export_gif_monitor_events();
|
||||
done = export_gif_monitor_events();
|
||||
}
|
||||
|
||||
/* Close the GIF */
|
||||
ge_close_gif(gif);
|
||||
} else {
|
||||
fprintf(stderr, "Quantization failed\n");
|
||||
done = 1;
|
||||
}
|
||||
done = 1;
|
||||
}
|
||||
|
||||
if (done)
|
||||
{
|
||||
/* Aborted; discard the partially-saved GIF */
|
||||
unlink(gif_fname);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue