Updating to master 2019/6/6

This commit is contained in:
Pere Pujal i Carabantes 2019-06-06 20:22:55 +02:00
commit 4d3ef642da
22 changed files with 2104 additions and 1960 deletions

View file

@ -2,13 +2,13 @@ CHANGES.txt for Tux Paint
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2018 Copyright (c) 2002-2019
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
http://www.tuxpaint.org/ http://www.tuxpaint.org/
$Id$ $Id$
2018.Dec.18 (0.9.24) 2019.Apr.3 (0.9.24)
* Bug Fixes * Bug Fixes
--------- ---------
* Correct issue that prevented Tux Paint from lauching on Mac OS X 10.7. * Correct issue that prevented Tux Paint from lauching on Mac OS X 10.7.
@ -34,6 +34,14 @@ $Id$
Use "--newcolorslast" option. Use "--newcolorslast" option.
(Suggested by Bernard Verhaeghe) (Suggested by Bernard Verhaeghe)
* Recognize signals (SIGUSR1 and SIGUSR2) on POSIX systems,
which causes Tux Paint to quit, first saving the current drawing
(if unsaved) (like "--autosave"), either saving a new image
(like "--saveovernew") (via SIGUSR1), or overwritting the current
drawing (like "--saveover") (via SIGUSR2).
(Thanks to Flavio Airundo for the idea; closes
https://sourceforge.net/p/tuxpaint/feature-requests/188/)
* Documentation updates * Documentation updates
--------------------- ---------------------
* Mended link to MinGW/MSYS instructions at John Popplewell's website. * Mended link to MinGW/MSYS instructions at John Popplewell's website.
@ -41,6 +49,10 @@ $Id$
* Improved and expanded usage info (e.g., "tuxpaint --help" output) * Improved and expanded usage info (e.g., "tuxpaint --help" output)
* Documentation on POSIX signals recognized by Tux Paint (e.g.,
the new "SIGUSR1" & "SIGUSR2") added to a new doc file,
"SIGNALS.txt".
* Misc * Misc
---- ----
* Verbose debugging, and "DEBUG_PRINTF()" macro now available; * Verbose debugging, and "DEBUG_PRINTF()" macro now available;

View file

@ -3,22 +3,22 @@
A simple drawing program for children A simple drawing program for children
Copyright 2002-2018 by various contributors; see AUTHORS.txt Copyright 2002-2019 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
June 14, 2002 - December 18, 2018 June 14, 2002 - April 3, 2019
---------------------------------------------------------------------- ----------------------------------------------------------------------
+------------------------------------------------------------------------+ +-------------------------------------------+
|Table of Contents | |Table of Contents |
|------------------------------------------------------------------------| |-------------------------------------------|
| * About | | * About |
| * Using Tux Paint | | * Using Tux Paint |
| * Loading Other Pictures into Tux Paint | | * Loading Other Pictures into Tux Paint |
| * Further Reading | | * Further Reading |
| * How to Get Help | | * How to Get Help |
+------------------------------------------------------------------------+ +-------------------------------------------+
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -876,6 +876,8 @@ Doing it Manually
Notes on creating PNG format bitmapped images for use in Tux Paint. Notes on creating PNG format bitmapped images for use in Tux Paint.
* SVG.txt * SVG.txt
Notes on creating SVG format vector images for use in Tux Paint. Notes on creating SVG format vector images for use in Tux Paint.
* SIGNALS.txt
Information about POSIX signals Tux Paint responds to.
---------------------------------------------------------------------- ----------------------------------------------------------------------

50
docs/en/SIGNALS.txt Normal file
View file

@ -0,0 +1,50 @@
SIGNALS.txt for Tux Paint
Tux Paint - A simple drawing program for children.
Copyright 2019 by Bill Kendrick and others
bill@newbreedsoftware.com
http://www.tuxpaint.org/
April 3, 2019
Tux Paint responds to the following signals (which can be
sent to the program's process via `kill` or `killall`, for
example).
* SIGTERM (also, [Ctrl]+[C] from a terminal running "tuxpaint")
Tux Paint responds as if the "Quit" button were pressed,
or the desktop environment was told to close Tux Paint
(e.g., by clicking a window close button, or pressing
[Alt]+[F4] on most systems).
From the main interface, Tux Paint will prompt whether or
not you wish to quit, and (unless overridden by "--autosave")
if you'd like to save the current drawing (if unsaved),
and if so, and it's a modified version of an existing drawing
(unless overridden by "--saveover" or "--saveovernew"),
whether or not to overwrite the existing drawing, or save
to a new file.
From other parts of the interface, the signal is currently
interpreted as a request to go back (e.g., from the
"New" dialog back to the main interface), as if a "Back"
button in Tux Paint were clicked, or the [Esc] key pressed.
* SIGUSR1 & SIGUSR2
Tux Paint responds by setting its "--autosave" option, and either
"--saveovernew" (for SIGUSR1) or "--saveover" (for SIGUSR2),
and sending itself a SIGTERM signal.
So, from the main interface, Tux Paint should quit almost immediately,
with no questions asked.
From other parts of the interface, unfortunately, Tux Paint
will go back one level in the interface. Therefore, at this time,
it may be necessary to send this signal to Tux Paint a few times,
for it to quit completely.
e.g., `killall -s SIGUSR1 tuxpaint`

View file

@ -17,12 +17,12 @@ version
</h1> </h1>
<h3>A simple drawing program for children</h3> <h3>A simple drawing program for children</h3>
<p>Copyright 2002-2018 by various contributors; see AUTHORS.txt<br> <p>Copyright 2002-2019 by various contributors; see AUTHORS.txt<br>
<a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p> <a href="http://www.tuxpaint.org/">http://www.tuxpaint.org/</a></p>
<p>June 14, 2002 - <p>June 14, 2002 -
December 18, 2018</p> April 3, 2019</p>
</center> </center>
@ -1159,6 +1159,9 @@ version
<li><a href="../SVG.txt">SVG.txt</a><br> <li><a href="../SVG.txt">SVG.txt</a><br>
Notes on creating SVG format vector images for use in Tux&nbsp;Paint. Notes on creating SVG format vector images for use in Tux&nbsp;Paint.
<li><a href="../SIGNALS.txt">SIGNALS.txt</a><br>
Information about POSIX signals Tux&nbsp;Paint responds to.
</ul> </ul>
</blockquote> </blockquote>

1
magic/docs/.indent.pro vendored Symbolic link
View file

@ -0,0 +1 @@
../../src/.indent.pro

View file

@ -303,7 +303,8 @@ void example_shutdown(magic_api * api)
// Affect the canvas on click: // Affect the canvas on click:
void example_click(magic_api * api, int which, int mode, void
example_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect) SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
{ {
// In our case, a single click (which is also the start of a drag!) // In our case, a single click (which is also the start of a drag!)
@ -319,7 +320,8 @@ void example_click(magic_api * api, int which, int mode,
// Affect the canvas on drag: // Affect the canvas on drag:
void example_drag(magic_api * api, int which, SDL_Surface * canvas, void
example_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect) SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
{ {
// Call Tux Paint's "line()" function. // Call Tux Paint's "line()" function.
@ -380,7 +382,8 @@ void example_drag(magic_api * api, int which, SDL_Surface * canvas,
// Affect the canvas on release: // Affect the canvas on release:
void example_release(magic_api * api, int which, void
example_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect) SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
{ {
// Neither of our effects do anything special when the mouse is released // Neither of our effects do anything special when the mouse is released

1
osk/.indent.pro vendored Symbolic link
View file

@ -0,0 +1 @@
../src/.indent.pro

View file

@ -39,11 +39,11 @@
class PrintView:public BView class PrintView:public BView
{ {
public: public:
PrintView( BBitmap *bitmap) PrintView(BBitmap * bitmap):BView(bitmap->Bounds(), "TuxPaint Print", B_FOLLOW_NONE, B_WILL_DRAW)
: BView( bitmap->Bounds(), "TuxPaint Print", B_FOLLOW_NONE, B_WILL_DRAW)
{ {
b = bitmap; b = bitmap;
}; };
~PrintView() ~PrintView()
{ {
delete b; delete b;
@ -110,6 +110,7 @@ int IsPrinterAvailable( void )
DIR *d; DIR *d;
struct dirent *f = NULL; struct dirent *f = NULL;
int num_files = 0; int num_files = 0;
d = opendir("/boot/home/config/settings/printers"); d = opendir("/boot/home/config/settings/printers");
if (d != NULL) if (d != NULL)
{ {
@ -125,12 +126,16 @@ int IsPrinterAvailable( void )
int SurfacePrint(SDL_Surface * surf) int SurfacePrint(SDL_Surface * surf)
{ {
BWindow *window = new BWindow( BRect( 0, 0, surf->w, surf->h), "TuxPaint Print", B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL, B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS); BWindow *window =
new BWindow(BRect(0, 0, surf->w, surf->h), "TuxPaint Print", B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);
PrintView *view = new PrintView(SurfaceToBBitmap(surf)); PrintView *view = new PrintView(SurfaceToBBitmap(surf));
window->AddChild(view); window->AddChild(view);
window->Run(); window->Run();
BPrintJob job("TuxPaint"); BPrintJob job("TuxPaint");
if (job.ConfigPage() == B_OK) if (job.ConfigPage() == B_OK)
{ {
if (job.ConfigJob() == B_OK) if (job.ConfigJob() == B_OK)

View file

@ -44,7 +44,6 @@
#define DEBUG_PRINTF(...) #define DEBUG_PRINTF(...)
#endif #endif
#ifdef __ANDROID__ #ifdef __ANDROID__
#include <android/log.h> #include <android/log.h>
#define LOG_TAG "TuxPaint" #define LOG_TAG "TuxPaint"

View file

@ -1003,7 +1003,9 @@ static void mysetenv(const char *name, const char *value)
* @param loc Locale * @param loc Locale
* @return The Y-nudge value for font rendering in the language. * @return The Y-nudge value for font rendering in the language.
*/ */
/* *INDENT-OFF* */
static int set_current_language(const char *restrict locale_choice) MUST_CHECK; static int set_current_language(const char *restrict locale_choice) MUST_CHECK;
/* *INDENT-ON* */
static int set_current_language(const char *restrict loc) static int set_current_language(const char *restrict loc)
{ {

View file

@ -16,13 +16,16 @@ const char* macos_fontsPath()
{ {
static char *p = NULL; static char *p = NULL;
if(!p) { if (!p)
{
const char *home = getenv("HOME"); const char *home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1); p = malloc(strlen(home) + strlen(MACOS_FONTS_PATH) + 1);
if(p) sprintf(p, MACOS_FONTS_PATH, getenv("HOME")); if (p)
else perror("macos_fontsPath"); sprintf(p, MACOS_FONTS_PATH, getenv("HOME"));
else
perror("macos_fontsPath");
} }
return p; return p;
@ -36,13 +39,16 @@ const char* macos_preferencesPath()
{ {
static char *p = NULL; static char *p = NULL;
if(!p) { if (!p)
{
const char *home = getenv("HOME"); const char *home = getenv("HOME");
p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1); p = malloc(strlen(home) + strlen(MACOS_PREFERENCES_PATH) + 1);
if(p) sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME")); if (p)
else perror("macos_preferencesPath"); sprintf(p, MACOS_PREFERENCES_PATH, getenv("HOME"));
else
perror("macos_preferencesPath");
} }
return p; return p;

View file

@ -55,7 +55,8 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
if (!mute && use_sound && s != SND_NONE) if (!mute && use_sound && s != SND_NONE)
{ {
#ifdef DEBUG #ifdef DEBUG
printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ", sounds[s]); printf("playsound #%d in channel %d, pos (%d,%d), %soverride, ptr=%p\n", s, chan, x, y, override ? "" : "no ",
sounds[s]);
fflush(stdout); fflush(stdout);
#endif #endif
if (override || !Mix_Playing(chan)) if (override || !Mix_Playing(chan))

View file

@ -306,8 +306,10 @@ int do_ps_save(FILE * fi,
child_pid = pclose(fi); child_pid = pclose(fi);
#ifdef DEBUG #ifdef DEBUG
printf("pclose returned %d\n", child_pid); fflush(stdout); printf("pclose returned %d\n", child_pid);
printf("errno = %d\n", errno); fflush(stdout); fflush(stdout);
printf("errno = %d\n", errno);
fflush(stdout);
#endif #endif
if (child_pid < 0 || (errno != 0 && errno != EAGAIN)) if (child_pid < 0 || (errno != 0 && errno != EAGAIN))
@ -324,14 +326,25 @@ int do_ps_save(FILE * fi,
w = waitpid(child_pid, &status, 0); w = waitpid(child_pid, &status, 0);
#ifdef DEBUG #ifdef DEBUG
if (w == -1) { perror("waitpid"); exit(EXIT_FAILURE); } if (w == -1)
if (WIFEXITED(status)) { {
perror("waitpid");
exit(EXIT_FAILURE);
}
if (WIFEXITED(status))
{
printf("exited, status=%d\n", WEXITSTATUS(status)); printf("exited, status=%d\n", WEXITSTATUS(status));
} else if (WIFSIGNALED(status)) { }
else if (WIFSIGNALED(status))
{
printf("killed by signal %d\n", WTERMSIG(status)); printf("killed by signal %d\n", WTERMSIG(status));
} else if (WIFSTOPPED(status)) { }
else if (WIFSTOPPED(status))
{
printf("stopped by signal %d\n", WSTOPSIG(status)); printf("stopped by signal %d\n", WSTOPSIG(status));
} else if (WIFCONTINUED(status)) { }
else if (WIFCONTINUED(status))
{
printf("continued\n"); printf("continued\n");
} }
#endif #endif

View file

@ -3,7 +3,7 @@
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
Copyright (c) 2002-2018 Copyright (c) 2002-2019
by various contributors; see AUTHORS.txt by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
June 14, 2002 - December 18, 2018 June 14, 2002 - April 3, 2019
*/ */
@ -38,6 +38,8 @@
/* Color depth for Tux Paint to run in, and store canvases in: */ /* Color depth for Tux Paint to run in, and store canvases in: */
/* *INDENT-OFF* */
#if defined(NOKIA_770) #if defined(NOKIA_770)
#define VIDEO_BPP 16 #define VIDEO_BPP 16
#endif #endif
@ -53,17 +55,14 @@
#define VIDEO_BPP 32 /* might be fastest, if conversion funcs removed */ #define VIDEO_BPP 32 /* might be fastest, if conversion funcs removed */
#endif #endif
/* #define CORNER_SHAPES *//* need major work! */ /* #define CORNER_SHAPES *//* need major work! */
/* Method for printing images: */ /* Method for printing images: */
#define PRINTMETHOD_PS /* Direct to PostScript */ #define PRINTMETHOD_PS /* Direct to PostScript */
/*#define PRINTMETHOD_PNM_PS *//* Output PNM, assuming it gets printed */ /*#define PRINTMETHOD_PNM_PS *//* Output PNM, assuming it gets printed */
/*#define PRINTMETHOD_PNG_PNM_PS *//* Output PNG, assuming it gets printed */ /*#define PRINTMETHOD_PNG_PNM_PS *//* Output PNG, assuming it gets printed */
#define MAX_PATH 256 #define MAX_PATH 256
/* Compile-time options: */ /* Compile-time options: */
@ -111,6 +110,8 @@
#define TPAINT_AMASK 0x000000ff #define TPAINT_AMASK 0x000000ff
#endif #endif
/* *INDENT-ON* */
static unsigned draw_colors(unsigned action); static unsigned draw_colors(unsigned action);
@ -579,7 +580,9 @@ static void mtw(wchar_t * wtok, char *tok)
int TP_EventFilter(void *data, const SDL_Event * event); int TP_EventFilter(void *data, const SDL_Event * event);
/* *INDENT-OFF* */
/* #define fmemopen_alternative *//* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */ /* #define fmemopen_alternative *//* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
/* *INDENT-ON* */
#if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__) /* MINGW/MSYS, NetBSD, and MacOSX need it, at least for now */ #if defined (WIN32) || defined (__APPLE__) || defined(__NetBSD__) || defined(__sun) || defined(__ANDROID__) /* MINGW/MSYS, NetBSD, and MacOSX need it, at least for now */
#define fmemopen_alternative #define fmemopen_alternative
@ -707,7 +710,10 @@ typedef struct
Uint8 rows, cols; Uint8 rows, cols;
} grid_dims; } grid_dims;
/* *INDENT-OFF* */
/* static SDL_Rect r_screen; *//* was 640x480 @ 0,0 -- but this isn't so useful */ /* static SDL_Rect r_screen; *//* was 640x480 @ 0,0 -- but this isn't so useful */
/* *INDENT-ON* */
static SDL_Rect r_canvas; /* was 448x376 @ 96,0 */ static SDL_Rect r_canvas; /* was 448x376 @ 96,0 */
static SDL_Rect r_tools; /* was 96x336 @ 0,40 */ static SDL_Rect r_tools; /* was 96x336 @ 0,40 */
static SDL_Rect r_sfx; static SDL_Rect r_sfx;
@ -734,7 +740,9 @@ static grid_dims gd_tools; /* was 2x7 */
static grid_dims gd_sfx; static grid_dims gd_sfx;
static grid_dims gd_toolopt; /* was 2x7 */ static grid_dims gd_toolopt; /* was 2x7 */
/* *INDENT-OFF* */
/* static grid_dims gd_open; *//* was 4x4 */ /* static grid_dims gd_open; *//* was 4x4 */
/* *INDENT-ON* */
static grid_dims gd_colors; /* was 17x1 */ static grid_dims gd_colors; /* was 17x1 */
#define HEIGHTOFFSET (((WINDOW_HEIGHT - 480) / 48) * 48) #define HEIGHTOFFSET (((WINDOW_HEIGHT - 480) / 48) * 48)
@ -1287,6 +1295,7 @@ static int disable_save;
static int ok_to_use_lockfile = 1; static int ok_to_use_lockfile = 1;
static int start_blank; static int start_blank;
static int autosave_on_quit; static int autosave_on_quit;
static int no_prompt_on_quit = 0;
static int dont_do_xor; static int dont_do_xor;
static int dont_load_stamps; static int dont_load_stamps;
@ -2060,7 +2069,8 @@ static void get_new_file_id(void);
static int do_quit(int tool); static int do_quit(int tool);
static int do_open(void); static int do_open(void);
static int do_new_dialog(void); static int do_new_dialog(void);
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette); static int do_new_dialog_add_colors(SDL_Surface * *thumbs, int num_files, int *d_places, char * *d_names,
char * *d_exts, int *white_in_palette);
static int do_color_picker(void); static int do_color_picker(void);
static int do_color_sel(void); static int do_color_sel(void);
static int do_slideshow(void); static int do_slideshow(void);
@ -6672,6 +6682,7 @@ void show_usage(int exitcode)
{ {
FILE *f = exitcode ? stderr : stdout; FILE *f = exitcode ? stderr : stdout;
/* *INDENT-OFF* */
fprintf(f, fprintf(f,
"\n" "\n"
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n" "Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
@ -6757,6 +6768,7 @@ void show_usage(int exitcode)
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */ /* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
"\n", "\n",
progname); progname);
/* *INDENT-ON* */
} }
@ -7822,7 +7834,8 @@ static void loadstamp_callback(SDL_Surface * screen,
* Showing the progress bar across the screen can be CPU-intensive, so * Showing the progress bar across the screen can be CPU-intensive, so
* update infrequently. * update infrequently.
*/ */
if((i % 32) == 0) show_progress_bar(screen); if ((i % 32) == 0)
show_progress_bar(screen);
if (dotext > files[i].str && !strcasecmp(dotext, ext) if (dotext > files[i].str && !strcasecmp(dotext, ext)
&& (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname)) && (dotext - files[i].str + 1 + dirlen < (int)(sizeof fname))
@ -8019,13 +8032,23 @@ static int generate_fontconfig_cache(void *vp)
((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : 0) ((c) >= 'a' && (c) <= 'f') ? ((c) - 'a' + 10) : 0)
#ifndef WIN32 #ifndef WIN32
/**
* FIXME
*/
static void signal_handler(int sig) static void signal_handler(int sig)
{ {
(void)sig;
// It is not legal to call printf or most other functions here! // It is not legal to call printf or most other functions here!
if (sig == SIGUSR1 || sig == SIGUSR2)
{
autosave_on_quit = 1;
no_prompt_on_quit = 1;
if (sig == SIGUSR1)
{
promptless_save = SAVE_OVER_NO;
}
else
{
promptless_save = SAVE_OVER_ALWAYS;
}
raise(SIGTERM);
}
} }
#endif #endif
@ -12218,11 +12241,13 @@ static int do_prompt_image_flash_snd(const char *const text,
int valhat_x, valhat_y, hatmotioner; int valhat_x, valhat_y, hatmotioner;
#ifdef DEBUG #ifdef DEBUG
if(snd >= 0) { if (snd >= 0)
{
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]); printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
fflush(stdout); fflush(stdout);
} }
else { else
{
printf("Prompt without sound\n"); printf("Prompt without sound\n");
fflush(stdout); fflush(stdout);
} }
@ -13939,12 +13964,11 @@ static void do_png_embed_data(png_structp png_ptr)
for (x = 0; x < current_node->save_width; x++) for (x = 0; x < current_node->save_width; x++)
for (y = 0; y < current_node->save_height; y++) for (y = 0; y < current_node->save_height; y++)
{ {
pix = /* *INDENT-OFF* */
getpixels[current_node->label_node_surface->format->BytesPerPixel] (current_node-> pix = getpixels[current_node->label_node_surface->format->BytesPerPixel](current_node->label_node_surface, x, y);
label_node_surface, x, y); /* *INDENT-ON* */
SDL_GetRGBA(pix, current_label_node->label_node_surface->format, &r, &g, &b, &a); SDL_GetRGBA(pix, current_label_node->label_node_surface->format, &r, &g, &b, &a);
fwrite(&a, alpha_size, 1, lfi); fwrite(&a, alpha_size, 1, lfi);
} }
SDL_UnlockSurface(current_node->label_node_surface); SDL_UnlockSurface(current_node->label_node_surface);
fprintf(lfi, "\n\n"); fprintf(lfi, "\n\n");
@ -14179,9 +14203,16 @@ static int do_quit(int tool)
{ {
int done, tmp_tool; int done, tmp_tool;
if (!no_prompt_on_quit)
{
done = do_prompt_snd(PROMPT_QUIT_TXT, done = do_prompt_snd(PROMPT_QUIT_TXT,
PROMPT_QUIT_YES, PROMPT_QUIT_NO, SND_AREYOUSURE, PROMPT_QUIT_YES, PROMPT_QUIT_NO, SND_AREYOUSURE,
(TOOL_QUIT % 2) * 48 + 24, (TOOL_QUIT / 2) * 48 + 40 + 24); (TOOL_QUIT % 2) * 48 + 24, (TOOL_QUIT / 2) * 48 + 40 + 24);
}
else
{
done = 1;
}
if (done && !been_saved && !disable_save) if (done && !been_saved && !disable_save)
{ {
@ -19017,7 +19048,7 @@ static int do_new_dialog(void)
int last_click_which, last_click_button; int last_click_which, last_click_button;
int places_to_look; int places_to_look;
int tot; int tot;
int first_starter, first_template; int first_color, first_starter, first_template;
int white_in_palette; int white_in_palette;
int val_x, val_y, motioner; int val_x, val_y, motioner;
int valhat_x, valhat_y, hatmotioner; int valhat_x, valhat_y, hatmotioner;
@ -19159,7 +19190,9 @@ static int do_new_dialog(void)
white_in_palette = -1; white_in_palette = -1;
if (!new_colors_last) { if (!new_colors_last)
{
first_color = 0;
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette); num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
} }
@ -19466,7 +19499,9 @@ static int do_new_dialog(void)
/* Throw the color palette at the end (alternative option): */ /* Throw the color palette at the end (alternative option): */
if (new_colors_last) { if (new_colors_last)
{
first_color = num_files;
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette); num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
} }
@ -19474,6 +19509,8 @@ static int do_new_dialog(void)
#ifdef DEBUG #ifdef DEBUG
printf("%d files and colors were found!\n", num_files); printf("%d files and colors were found!\n", num_files);
#endif #endif
printf("first_color = %d\nfirst_starter = %d\nfirst_template = %d\nnum_files = %d\n\n", first_color, first_starter,
first_template, num_files);
/* Let user choose a color or image: */ /* Let user choose a color or image: */
@ -19931,7 +19968,8 @@ static int do_new_dialog(void)
label_node_to_edit = NULL; label_node_to_edit = NULL;
have_to_rec_label_node = FALSE; have_to_rec_label_node = FALSE;
if (which >= first_starter && (first_template == -1 || which < first_template)) if (which >= first_starter && (first_template == -1 || which < first_template)
&& (!new_colors_last || which < first_color))
{ {
/* Load a starter: */ /* Load a starter: */
@ -19990,7 +20028,7 @@ static int do_new_dialog(void)
SDL_BlitSurface(img_starter, NULL, canvas, NULL); SDL_BlitSurface(img_starter, NULL, canvas, NULL);
} }
} }
else if (first_template != -1 && which >= first_template) else if (first_template != -1 && which >= first_template && (!new_colors_last || which < first_color))
{ {
/* Load a template: */ /* Load a template: */
@ -20055,6 +20093,8 @@ static int do_new_dialog(void)
starter_personal = 0; starter_personal = 0;
starter_modified = 0; starter_modified = 0;
which = which - first_color;
/* Launch color picker if they chose that: */ /* Launch color picker if they chose that: */
if (which == NUM_COLORS - 1) if (which == NUM_COLORS - 1)
@ -20134,7 +20174,9 @@ static int do_new_dialog(void)
normally appears at the beginning (above Starts & Templates), normally appears at the beginning (above Starts & Templates),
but may be placed at the end with the "--newcolorslast" option. but may be placed at the end with the "--newcolorslast" option.
*/ */
static int do_new_dialog_add_colors(SDL_Surface * * thumbs, int num_files, int * d_places, char * * d_names, char * * d_exts, int * white_in_palette) { static int do_new_dialog_add_colors(SDL_Surface * *thumbs, int num_files, int *d_places, char * *d_names,
char * *d_exts, int *white_in_palette)
{
int j; int j;
int added; int added;
Uint8 r, g, b; Uint8 r, g, b;
@ -24835,6 +24877,10 @@ static void setup(void)
instead of 'Ok') */ instead of 'Ok') */
signal(SIGPIPE, signal_handler); signal(SIGPIPE, signal_handler);
/* Set up signal for no-questions-asked remote closing of app */
signal(SIGUSR1, signal_handler);
signal(SIGUSR2, signal_handler);
#endif #endif
} }

View file

@ -47,6 +47,7 @@ DIR * opendir(const char *pSpec)
char pathname[MAX_PATH + 2]; char pathname[MAX_PATH + 2];
DIR *pDir = calloc(1, sizeof(DIR)); DIR *pDir = calloc(1, sizeof(DIR));
if (!pDir) if (!pDir)
return NULL; return NULL;
strcpy(pathname, pSpec); strcpy(pathname, pSpec);

View file

@ -72,5 +72,3 @@ typedef int (*selectCB) (const struct dirent *);
typedef int (*comparCB) (const void *, const void *); typedef int (*comparCB) (const void *, const void *);
extern int alphasort(const void *a, const void *b); extern int alphasort(const void *a, const void *b);
extern int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar); extern int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar);

1
win32/.indent.pro vendored Symbolic link
View file

@ -0,0 +1 @@
../src/.indent.pro