Pop-up dialogs were causing current Text tool text to disappear until

click or type. Fixed.
Non-drawing tools (e.g., Open/Print/Quit) were causing current Text tool
text to render onto canvas. Fixed.
This commit is contained in:
William Kendrick 2007-05-06 16:04:14 +00:00
parent ea79d4fed2
commit 57d345458b
2 changed files with 67 additions and 19 deletions

View file

@ -16,6 +16,7 @@ $Id$
* Input Method Framework, with implementations of Korean (Hangul 2-Bul) * Input Method Framework, with implementations of Korean (Hangul 2-Bul)
and Japanese (Romanized Hiragana and Romanized Katakana) input methods. and Japanese (Romanized Hiragana and Romanized Katakana) input methods.
(Should be extensible to other languages.) (Should be extensible to other languages.)
(Addresses SourceForge Bug #1070414)
Mark K. Kim <mkkim214@gmail.com> Mark K. Kim <mkkim214@gmail.com>
* Stamps now supports SVG vector-based graphics! (Via Cairo library) * Stamps now supports SVG vector-based graphics! (Via Cairo library)
@ -27,6 +28,7 @@ $Id$
* Stamps now shown in groups. * Stamps now shown in groups.
FIXME: Finish! FIXME: Finish!
(Addresses SourceForge Feature Request #1070394)
* Bilinear interpolation (smoothing) is done to small bitmap (PNG) * Bilinear interpolation (smoothing) is done to small bitmap (PNG)
stamps when they are scaled up. stamps when they are scaled up.
@ -77,6 +79,14 @@ $Id$
---------- ----------
* Tux the Penguin sound effects were not working; fixed. * Tux the Penguin sound effects were not working; fixed.
* Text tool's text would be applied to canvas when clicking any tool
buttons. Fixed so that it is not applied when tool changes aren't
happening (e.g., Print, Quit, Open, Save).
* Text tool's text would disappear until you click or type,
after a dialog has been dismissed. Fixed.
(Addresses SourceForge.net Bug #1698855)
* No longer disabling screensaver (if the system's libSDL supports * No longer disabling screensaver (if the system's libSDL supports
it via "SDL_ALLOWSCREENSAVER" environment variable). it via "SDL_ALLOWSCREENSAVER" environment variable).

View file

@ -1212,12 +1212,12 @@ static void free_surface_array(SDL_Surface * surface_array[], int count);
// int fixed); // int fixed);
static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush); static void do_shape(int cx, int cy, int ox, int oy, int rotn, int use_brush);
static int rotation(int ctr_x, int ctr_y, int ox, int oy); static int rotation(int ctr_x, int ctr_y, int ox, int oy);
static int do_save(void); static int do_save(int tool);
static int do_png_save(FILE * fi, const char *const fname, static int do_png_save(FILE * fi, const char *const fname,
SDL_Surface * surf); SDL_Surface * surf);
static void get_new_file_id(void); static void get_new_file_id(void);
static int do_quit(void); static int do_quit(int tool);
void do_open(void); int do_open(void);
int do_slideshow(void); int do_slideshow(void);
void play_slideshow(int * selected, int num_selected, char * dirname, void play_slideshow(int * selected, int num_selected, char * dirname,
char **d_names, char **d_exts, int speed); char **d_names, char **d_exts, int speed);
@ -1654,7 +1654,7 @@ static void mainloop(void)
if (event.type == SDL_QUIT) if (event.type == SDL_QUIT)
{ {
done = do_quit(); done = do_quit(cur_tool);
} }
else if (event.type == SDL_ACTIVEEVENT) else if (event.type == SDL_ACTIVEEVENT)
{ {
@ -1675,7 +1675,7 @@ static void mainloop(void)
if (key == SDLK_ESCAPE && !disable_quit) if (key == SDLK_ESCAPE && !disable_quit)
{ {
done = do_quit(); done = do_quit(cur_tool);
} }
else if (key == SDLK_s && (mod & KMOD_ALT)) else if (key == SDLK_s && (mod & KMOD_ALT))
{ {
@ -1688,12 +1688,12 @@ static void mainloop(void)
else if (key == SDLK_ESCAPE && else if (key == SDLK_ESCAPE &&
(mod & KMOD_SHIFT) && (mod & KMOD_CTRL)) (mod & KMOD_SHIFT) && (mod & KMOD_CTRL))
{ {
done = do_quit(); done = do_quit(cur_tool);
} }
#ifdef WIN32 #ifdef WIN32
else if (key == SDLK_F4 && (mod & KMOD_ALT)) else if (key == SDLK_F4 && (mod & KMOD_ALT))
{ {
done = do_quit(); done = do_quit(cur_tool);
} }
#endif #endif
else if (key == SDLK_z && (mod & KMOD_CTRL) && !noshortcuts) else if (key == SDLK_z && (mod & KMOD_CTRL) && !noshortcuts)
@ -1734,7 +1734,11 @@ static void mainloop(void)
draw_colors(COLORSEL_CLOBBER_WIPE); draw_colors(COLORSEL_CLOBBER_WIPE);
draw_none(); draw_none();
do_open(); if (do_open() == 0)
{
if (cur_tool == TOOL_TEXT)
do_render_cur_text(0);
}
enable_avail_tools(); enable_avail_tools();
@ -1795,6 +1799,9 @@ static void mainloop(void)
else else
{ {
draw_tux_text(tool_tux[TUX_DEFAULT], TIP_NEW_ABORT, 1); draw_tux_text(tool_tux[TUX_DEFAULT], TIP_NEW_ABORT, 1);
if (cur_tool == TOOL_TEXT)
do_render_cur_text(0);
} }
draw_toolbar(); draw_toolbar();
@ -1805,7 +1812,7 @@ static void mainloop(void)
/* Ctrl-S - Save */ /* Ctrl-S - Save */
hide_blinking_cursor(); hide_blinking_cursor();
if (do_save()) if (do_save(cur_tool))
{ {
/* Only think it's been saved if it HAS been saved :^) */ /* Only think it's been saved if it HAS been saved :^) */
@ -1973,6 +1980,8 @@ static void mainloop(void)
do_prompt_image_flash(PROMPT_TIP_LEFTCLICK_TXT, do_prompt_image_flash(PROMPT_TIP_LEFTCLICK_TXT,
PROMPT_TIP_LEFTCLICK_YES, PROMPT_TIP_LEFTCLICK_YES,
"", img_mouse, img_mouse_click, NULL, 1); "", img_mouse, img_mouse_click, NULL, 1);
if (cur_tool == TOOL_TEXT)
do_render_cur_text(0);
} }
} }
else if ((event.type == SDL_MOUSEBUTTONDOWN || else if ((event.type == SDL_MOUSEBUTTONDOWN ||
@ -1991,9 +2000,13 @@ static void mainloop(void)
/* Allow middle/right-click on "Print", since [Alt]+click /* Allow middle/right-click on "Print", since [Alt]+click
on Mac OS X changes it from left click to middle! */ on Mac OS X changes it from left click to middle! */
/* Render any current text: */ /* Render any current text, if switching to a different
drawing tool: */
if (cur_tool == TOOL_TEXT && which != TOOL_TEXT) if (cur_tool == TOOL_TEXT && which != TOOL_TEXT &&
which != TOOL_NEW && which != TOOL_OPEN &&
which != TOOL_SAVE && which != TOOL_PRINT &&
which != TOOL_QUIT)
{ {
if (cursor_x != -1 && cursor_y != -1) if (cursor_x != -1 && cursor_y != -1)
{ {
@ -2159,7 +2172,11 @@ static void mainloop(void)
draw_colors(COLORSEL_CLOBBER_WIPE); draw_colors(COLORSEL_CLOBBER_WIPE);
draw_none(); draw_none();
do_open(); if (do_open() == 0)
{
if (old_tool == TOOL_TEXT)
do_render_cur_text(0);
}
enable_avail_tools(); enable_avail_tools();
@ -2186,7 +2203,7 @@ static void mainloop(void)
} }
else if (cur_tool == TOOL_SAVE) else if (cur_tool == TOOL_SAVE)
{ {
if (do_save()) if (do_save(old_tool))
{ {
been_saved = 1; been_saved = 1;
tool_avail[TOOL_SAVE] = 0; tool_avail[TOOL_SAVE] = 0;
@ -2230,6 +2247,9 @@ static void mainloop(void)
else else
{ {
draw_tux_text(tool_tux[TUX_DEFAULT], TIP_NEW_ABORT, 1); draw_tux_text(tool_tux[TUX_DEFAULT], TIP_NEW_ABORT, 1);
if (old_tool == TOOL_TEXT)
do_render_cur_text(0);
} }
cur_tool = old_tool; cur_tool = old_tool;
@ -2262,6 +2282,8 @@ static void mainloop(void)
last_print_time = cur_time; last_print_time = cur_time;
} }
if (old_tool == TOOL_TEXT)
do_render_cur_text(0);
} }
else else
{ {
@ -2270,6 +2292,8 @@ static void mainloop(void)
"", "",
img_printer_wait, NULL, NULL, img_printer_wait, NULL, NULL,
SND_NEGATIVE); SND_NEGATIVE);
if (old_tool == TOOL_TEXT)
do_render_cur_text(0);
} }
cur_tool = old_tool; cur_tool = old_tool;
@ -2278,7 +2302,7 @@ static void mainloop(void)
} }
else if (cur_tool == TOOL_QUIT) else if (cur_tool == TOOL_QUIT)
{ {
done = do_quit(); done = do_quit(old_tool);
cur_tool = old_tool; cur_tool = old_tool;
draw_toolbar(); draw_toolbar();
update_screen_rect(&r_tools); update_screen_rect(&r_tools);
@ -11774,7 +11798,7 @@ static int rotation(int ctr_x, int ctr_y, int ox, int oy)
/* Save the current image: */ /* Save the current image: */
static int do_save(void) static int do_save(int tool)
{ {
int res; int res;
char *fname; char *fname;
@ -11814,6 +11838,8 @@ static int do_save(void)
get_new_file_id(); get_new_file_id();
} }
if (tool == TOOL_TEXT)
do_render_cur_text(0);
} }
else else
{ {
@ -12266,7 +12292,7 @@ static void get_new_file_id(void)
/* Handle quitting (and prompting to save, if necessary!) */ /* Handle quitting (and prompting to save, if necessary!) */
static int do_quit(void) static int do_quit(int tool)
{ {
int done; int done;
@ -12278,7 +12304,7 @@ static int do_quit(void)
if (do_prompt(PROMPT_QUIT_SAVE_TXT, if (do_prompt(PROMPT_QUIT_SAVE_TXT,
PROMPT_QUIT_SAVE_YES, PROMPT_QUIT_SAVE_NO)) PROMPT_QUIT_SAVE_YES, PROMPT_QUIT_SAVE_NO))
{ {
if (do_save()) if (do_save(tool))
{ {
do_prompt(tool_tips[TOOL_SAVE], "OK", ""); do_prompt(tool_tips[TOOL_SAVE], "OK", "");
} }
@ -12290,6 +12316,11 @@ static int do_quit(void)
} }
} }
} }
else
{
if (tool == TOOL_TEXT)
do_render_cur_text(0);
}
return (done); return (done);
} }
@ -12306,7 +12337,7 @@ static int do_quit(void)
/* FIXME: This, and do_slideshow(), should be combined and modularized! */ /* FIXME: This, and do_slideshow(), should be combined and modularized! */
void do_open(void) int do_open(void)
{ {
SDL_Surface *img, *img1, *img2; SDL_Surface *img, *img1, *img2;
int things_alloced; int things_alloced;
@ -12330,6 +12361,9 @@ void do_open(void)
Uint32 last_click_time; Uint32 last_click_time;
int last_click_which, last_click_button; int last_click_which, last_click_button;
int places_to_look; int places_to_look;
int opened_something;
opened_something = 0;
do do
{ {
@ -13312,7 +13346,7 @@ void do_open(void)
img_tools[TOOL_SAVE], NULL, NULL, img_tools[TOOL_SAVE], NULL, NULL,
SND_AREYOUSURE)) SND_AREYOUSURE))
{ {
do_save(); do_save(TOOL_OPEN);
} }
} }
@ -13406,6 +13440,8 @@ void do_open(void)
tool_avail_bak[TOOL_UNDO] = 0; tool_avail_bak[TOOL_UNDO] = 0;
tool_avail_bak[TOOL_REDO] = 0; tool_avail_bak[TOOL_REDO] = 0;
opened_something = 1;
} }
} }
} }
@ -13441,6 +13477,8 @@ void do_open(void)
} }
} }
while (slideshow); while (slideshow);
return(opened_something);
} }