Updating to master 2019/6/6
This commit is contained in:
commit
4d3ef642da
22 changed files with 2104 additions and 1960 deletions
|
|
@ -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;
|
||||||
|
|
|
||||||
|
|
@ -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 |
|
||||||
+------------------------------------------------------------------------+
|
+-------------------------------------------+
|
||||||
|
|
||||||
----------------------------------------------------------------------
|
----------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
@ -97,8 +97,8 @@ Loading Tux Paint
|
||||||
|
|
||||||
Windows Users
|
Windows Users
|
||||||
|
|
||||||
[Icon]
|
[Icon]
|
||||||
Tux Paint
|
Tux Paint
|
||||||
|
|
||||||
If you installed Tux Paint on your computer using the
|
If you installed Tux Paint on your computer using the
|
||||||
'Tux Paint Installer,' it will have asked you whether you wanted a
|
'Tux Paint Installer,' it will have asked you whether you wanted a
|
||||||
|
|
@ -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
50
docs/en/SIGNALS.txt
Normal 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`
|
||||||
|
|
||||||
|
|
@ -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 Paint.
|
Notes on creating SVG format vector images for use in Tux Paint.
|
||||||
|
|
||||||
|
<li><a href="../SIGNALS.txt">SIGNALS.txt</a><br>
|
||||||
|
Information about POSIX signals Tux Paint responds to.
|
||||||
|
|
||||||
</ul>
|
</ul>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|
||||||
|
|
|
||||||
1
magic/docs/.indent.pro
vendored
Symbolic link
1
magic/docs/.indent.pro
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../../src/.indent.pro
|
||||||
|
|
@ -303,8 +303,9 @@ 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
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
example_click(magic_api * api, int which, int mode,
|
||||||
|
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!)
|
||||||
// is identical to what dragging does, but just at one point, rather
|
// is identical to what dragging does, but just at one point, rather
|
||||||
|
|
@ -319,8 +320,9 @@ 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
|
||||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
|
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)
|
||||||
{
|
{
|
||||||
// Call Tux Paint's "line()" function.
|
// Call Tux Paint's "line()" function.
|
||||||
//
|
//
|
||||||
|
|
@ -380,8 +382,9 @@ 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
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
example_release(magic_api * api, int which,
|
||||||
|
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
|
||||||
// from a click or click-and-drag, so there's no code here...
|
// from a click or click-and-drag, so there's no code here...
|
||||||
|
|
|
||||||
1
osk/.indent.pro
vendored
Symbolic link
1
osk/.indent.pro
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../src/.indent.pro
|
||||||
3410
osk/keysymdef.h
3410
osk/keysymdef.h
File diff suppressed because it is too large
Load diff
|
|
@ -21,7 +21,7 @@
|
||||||
|
|
||||||
$Id$
|
$Id$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Jan. 17, 2003 */
|
/* Jan. 17, 2003 */
|
||||||
|
|
||||||
#include "BeOS_print.h"
|
#include "BeOS_print.h"
|
||||||
|
|
@ -36,117 +36,122 @@
|
||||||
#include "string.h"
|
#include "string.h"
|
||||||
|
|
||||||
|
|
||||||
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;
|
||||||
};
|
};
|
||||||
void Draw( BRect updateRect)
|
void Draw(BRect updateRect)
|
||||||
{
|
{
|
||||||
DrawBitmap( b);
|
DrawBitmap(b);
|
||||||
}
|
}
|
||||||
private:
|
private:
|
||||||
BBitmap *b;
|
BBitmap * b;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
BBitmap *SurfaceToBBitmap( SDL_Surface *surf)
|
BBitmap *SurfaceToBBitmap(SDL_Surface * surf)
|
||||||
{
|
{
|
||||||
BBitmap *bitmap = new BBitmap( BRect( 0, 0, surf->w, surf->h), B_RGBA32);
|
BBitmap *bitmap = new BBitmap(BRect(0, 0, surf->w, surf->h), B_RGBA32);
|
||||||
SDL_PixelFormat pixfmt;
|
SDL_PixelFormat pixfmt;
|
||||||
SDL_Surface *surf32;
|
SDL_Surface *surf32;
|
||||||
Uint8 *src,*dst;
|
Uint8 *src, *dst;
|
||||||
Uint32 linesize;
|
Uint32 linesize;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
memset( &pixfmt, 0, sizeof(pixfmt) );
|
memset(&pixfmt, 0, sizeof(pixfmt));
|
||||||
pixfmt.palette = NULL;
|
pixfmt.palette = NULL;
|
||||||
pixfmt.BitsPerPixel = 32;
|
pixfmt.BitsPerPixel = 32;
|
||||||
pixfmt.BytesPerPixel= 4;
|
pixfmt.BytesPerPixel = 4;
|
||||||
pixfmt.Rmask = 0x00FF0000;
|
pixfmt.Rmask = 0x00FF0000;
|
||||||
pixfmt.Gmask = 0x0000FF00;
|
pixfmt.Gmask = 0x0000FF00;
|
||||||
pixfmt.Bmask = 0x000000FF;
|
pixfmt.Bmask = 0x000000FF;
|
||||||
pixfmt.Amask = 0xFF000000;
|
pixfmt.Amask = 0xFF000000;
|
||||||
pixfmt.Rshift = 16;
|
pixfmt.Rshift = 16;
|
||||||
pixfmt.Gshift = 8;
|
pixfmt.Gshift = 8;
|
||||||
pixfmt.Bshift = 0;
|
pixfmt.Bshift = 0;
|
||||||
pixfmt.Ashift = 24;
|
pixfmt.Ashift = 24;
|
||||||
pixfmt.Rloss = 0;
|
pixfmt.Rloss = 0;
|
||||||
pixfmt.Gloss = 0;
|
pixfmt.Gloss = 0;
|
||||||
pixfmt.Bloss = 0;
|
pixfmt.Bloss = 0;
|
||||||
pixfmt.Aloss = 0;
|
pixfmt.Aloss = 0;
|
||||||
pixfmt.colorkey = 0;
|
pixfmt.colorkey = 0;
|
||||||
pixfmt.alpha = 0;
|
pixfmt.alpha = 0;
|
||||||
|
|
||||||
surf32 = SDL_ConvertSurface( surf, &pixfmt, SDL_SWSURFACE );
|
surf32 = SDL_ConvertSurface(surf, &pixfmt, SDL_SWSURFACE);
|
||||||
|
|
||||||
linesize = surf32->w*sizeof(Uint32);
|
linesize = surf32->w * sizeof(Uint32);
|
||||||
dst = (Uint8*)bitmap->Bits();
|
dst = (Uint8 *) bitmap->Bits();
|
||||||
src = (Uint8*)surf32->pixels;
|
src = (Uint8 *) surf32->pixels;
|
||||||
for ( i = 0; i < surf32->h; i++ )
|
for (i = 0; i < surf32->h; i++)
|
||||||
{
|
{
|
||||||
memcpy( dst, src, linesize );
|
memcpy(dst, src, linesize);
|
||||||
src += surf32->pitch-4;
|
src += surf32->pitch - 4;
|
||||||
dst += linesize;
|
dst += linesize;
|
||||||
}
|
}
|
||||||
|
|
||||||
SDL_FreeSurface( surf32 ); /* Free temp surface */
|
SDL_FreeSurface(surf32); /* Free temp surface */
|
||||||
|
|
||||||
return bitmap;
|
return bitmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int IsPrinterAvailable( void )
|
int IsPrinterAvailable(void)
|
||||||
{
|
{
|
||||||
// this code is a little hack, i don't like such hardcoded things
|
// this code is a little hack, i don't like such hardcoded things
|
||||||
// but i have no choice ;]
|
// but i have no choice ;]
|
||||||
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");
|
|
||||||
if( d != NULL)
|
d = opendir("/boot/home/config/settings/printers");
|
||||||
{
|
if (d != NULL)
|
||||||
while( (f = readdir(d)) != NULL)
|
{
|
||||||
num_files++;
|
while ((f = readdir(d)) != NULL)
|
||||||
closedir( d);
|
num_files++;
|
||||||
if( num_files > 2)
|
closedir(d);
|
||||||
return 1;
|
if (num_files > 2)
|
||||||
}
|
return 1;
|
||||||
return 0;
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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 =
|
||||||
PrintView *view = new PrintView( SurfaceToBBitmap( surf));
|
new BWindow(BRect(0, 0, surf->w, surf->h), "TuxPaint Print", B_NO_BORDER_WINDOW_LOOK, B_NORMAL_WINDOW_FEEL,
|
||||||
window->AddChild(view);
|
B_NOT_MOVABLE | B_NOT_CLOSABLE | B_NOT_ZOOMABLE | B_NOT_RESIZABLE | B_AVOID_FRONT | B_AVOID_FOCUS);
|
||||||
window->Run();
|
PrintView *view = new PrintView(SurfaceToBBitmap(surf));
|
||||||
|
|
||||||
BPrintJob job("TuxPaint");
|
window->AddChild(view);
|
||||||
if( job.ConfigPage() == B_OK)
|
window->Run();
|
||||||
{
|
|
||||||
if( job.ConfigJob() == B_OK)
|
|
||||||
{
|
|
||||||
job.BeginJob();
|
|
||||||
if( job.CanContinue())
|
|
||||||
{
|
|
||||||
job.DrawView(view, BRect( 0, 0, surf->w, surf->h), BPoint( 0, 0));
|
|
||||||
job.SpoolPage();
|
|
||||||
}
|
|
||||||
if( job.CanContinue())
|
|
||||||
job.CommitJob();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BMessenger( window).SendMessage( B_QUIT_REQUESTED);
|
BPrintJob job("TuxPaint");
|
||||||
|
|
||||||
return 0;
|
if (job.ConfigPage() == B_OK)
|
||||||
|
{
|
||||||
|
if (job.ConfigJob() == B_OK)
|
||||||
|
{
|
||||||
|
job.BeginJob();
|
||||||
|
if (job.CanContinue())
|
||||||
|
{
|
||||||
|
job.DrawView(view, BRect(0, 0, surf->w, surf->h), BPoint(0, 0));
|
||||||
|
job.SpoolPage();
|
||||||
|
}
|
||||||
|
if (job.CanContinue())
|
||||||
|
job.CommitJob();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BMessenger(window).SendMessage(B_QUIT_REQUESTED);
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -32,11 +32,11 @@
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
extern int SurfacePrint(SDL_Surface * surf);
|
extern int SurfacePrint(SDL_Surface * surf);
|
||||||
extern int IsPrinterAvailable();
|
extern int IsPrinterAvailable();
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* __BEOS_PRINT__ */
|
#endif /* __BEOS_PRINT__ */
|
||||||
|
|
|
||||||
|
|
@ -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"
|
||||||
|
|
|
||||||
|
|
@ -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)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
8
src/im.c
8
src/im.c
|
|
@ -1006,7 +1006,7 @@ static int im_event_zh_tw(IM_DATA * im, SDL_Event event)
|
||||||
/* Left-Alt & Right-Alt mapped to mode-switch */
|
/* Left-Alt & Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
case SDLK_LALT:
|
case SDLK_LALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1229,7 +1229,7 @@ static int im_event_th(IM_DATA * im, SDL_Event event)
|
||||||
|
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1449,7 +1449,7 @@ static int im_event_ja(IM_DATA * im, SDL_Event event)
|
||||||
|
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
@ -1699,7 +1699,7 @@ static int im_event_ko(IM_DATA * im, SDL_Event event)
|
||||||
/* Right-Alt mapped to mode-switch */
|
/* Right-Alt mapped to mode-switch */
|
||||||
case SDLK_LALT:
|
case SDLK_LALT:
|
||||||
case SDLK_RALT:
|
case SDLK_RALT:
|
||||||
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
cm.section = ((cm.section + 1) % SEC_TOTAL); /* Change section */
|
||||||
im_softreset(im); /* Soft reset */
|
im_softreset(im); /* Soft reset */
|
||||||
|
|
||||||
/* Set tip text */
|
/* Set tip text */
|
||||||
|
|
|
||||||
40
src/macos.c
40
src/macos.c
|
|
@ -12,18 +12,21 @@
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_fontsPath()
|
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;
|
||||||
}
|
}
|
||||||
|
|
@ -32,18 +35,21 @@ const char* macos_fontsPath()
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_preferencesPath()
|
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;
|
||||||
}
|
}
|
||||||
|
|
@ -52,7 +58,7 @@ const char* macos_preferencesPath()
|
||||||
/**
|
/**
|
||||||
* FIXME
|
* FIXME
|
||||||
*/
|
*/
|
||||||
const char* macos_globalPreferencesPath()
|
const char *macos_globalPreferencesPath()
|
||||||
{
|
{
|
||||||
return MACOS_GLOBAL_PREFERENCES_PATH;
|
return MACOS_GLOBAL_PREFERENCES_PATH;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,9 +1,9 @@
|
||||||
#ifndef __MACOS_H__
|
#ifndef __MACOS_H__
|
||||||
#define __MACOS_H__
|
#define __MACOS_H__
|
||||||
|
|
||||||
const char* macos_fontsPath();
|
const char *macos_fontsPath();
|
||||||
const char* macos_preferencesPath();
|
const char *macos_preferencesPath();
|
||||||
const char* macos_globalPreferencesPath();
|
const char *macos_globalPreferencesPath();
|
||||||
|
|
||||||
|
|
||||||
#endif /* __MACOS_H__ */
|
#endif /* __MACOS_H__ */
|
||||||
|
|
|
||||||
|
|
@ -37,4 +37,4 @@ int DisplayPageSetup(const SDL_Surface * surface);
|
||||||
}
|
}
|
||||||
|
|
||||||
-@end
|
-@end
|
||||||
#endif /* OBJECTIVEC */
|
#endif /* OBJECTIVEC */
|
||||||
|
|
|
||||||
|
|
@ -55,8 +55,9 @@ 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 ",
|
||||||
fflush(stdout);
|
sounds[s]);
|
||||||
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
if (override || !Mix_Playing(chan))
|
if (override || !Mix_Playing(chan))
|
||||||
{
|
{
|
||||||
|
|
@ -96,8 +97,8 @@ void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255-dist)-left);
|
printf("Panning of sound #%d in channel %d, left=%d, right=%d\n", s, chan, left, (255 - dist) - left);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
Mix_SetPanning(chan, left, (255 - dist) - left);
|
Mix_SetPanning(chan, left, (255 - dist) - left);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -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,15 +326,26 @@ 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)) {
|
{
|
||||||
printf("exited, status=%d\n", WEXITSTATUS(status));
|
perror("waitpid");
|
||||||
} else if (WIFSIGNALED(status)) {
|
exit(EXIT_FAILURE);
|
||||||
printf("killed by signal %d\n", WTERMSIG(status));
|
}
|
||||||
} else if (WIFSTOPPED(status)) {
|
if (WIFEXITED(status))
|
||||||
printf("stopped by signal %d\n", WSTOPSIG(status));
|
{
|
||||||
} else if (WIFCONTINUED(status)) {
|
printf("exited, status=%d\n", WEXITSTATUS(status));
|
||||||
printf("continued\n");
|
}
|
||||||
|
else if (WIFSIGNALED(status))
|
||||||
|
{
|
||||||
|
printf("killed by signal %d\n", WTERMSIG(status));
|
||||||
|
}
|
||||||
|
else if (WIFSTOPPED(status))
|
||||||
|
{
|
||||||
|
printf("stopped by signal %d\n", WSTOPSIG(status));
|
||||||
|
}
|
||||||
|
else if (WIFCONTINUED(status))
|
||||||
|
{
|
||||||
|
printf("continued\n");
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
||||||
144
src/tuxpaint.c
144
src/tuxpaint.c
|
|
@ -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
|
||||||
|
|
@ -47,22 +49,19 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef VIDEO_BPP
|
#ifndef VIDEO_BPP
|
||||||
/*# define VIDEO_BPP 15 *//* saves memory */
|
/*# define VIDEO_BPP 15 *//* saves memory */
|
||||||
/*# define VIDEO_BPP 16 *//* causes discoloration */
|
/*# define VIDEO_BPP 16 *//* causes discoloration */
|
||||||
/*# define VIDEO_BPP 24 *//* compromise */
|
/*# define VIDEO_BPP 24 *//* compromise */
|
||||||
#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
|
||||||
|
|
||||||
|
|
@ -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);
|
||||||
|
|
||||||
|
|
||||||
/* #define fmemopen_alternative *//* Uncomment this to test the fmemopen alternative in systems were fmemopen exists */
|
/* *INDENT-OFF* */
|
||||||
|
/* #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;
|
||||||
|
|
||||||
/* static SDL_Rect r_screen; *//* was 640x480 @ 0,0 -- but this isn't so useful */
|
/* *INDENT-OFF* */
|
||||||
|
/* 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 */
|
||||||
|
|
||||||
/* static grid_dims gd_open; *//* was 4x4 */
|
/* *INDENT-OFF* */
|
||||||
|
/* 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* */
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -7819,10 +7831,11 @@ static void loadstamp_callback(SDL_Surface * screen,
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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,14 +12241,16 @@ 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]);
|
{
|
||||||
fflush(stdout);
|
printf("Prompt and play sound #%d: %s\n", snd, sound_fnames[snd]);
|
||||||
}
|
fflush(stdout);
|
||||||
else {
|
}
|
||||||
printf("Prompt without sound\n");
|
else
|
||||||
fflush(stdout);
|
{
|
||||||
}
|
printf("Prompt without sound\n");
|
||||||
|
fflush(stdout);
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
val_x = val_y = motioner = 0;
|
val_x = val_y = motioner = 0;
|
||||||
|
|
@ -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;
|
||||||
|
|
||||||
done = do_prompt_snd(PROMPT_QUIT_TXT,
|
if (!no_prompt_on_quit)
|
||||||
PROMPT_QUIT_YES, PROMPT_QUIT_NO, SND_AREYOUSURE,
|
{
|
||||||
(TOOL_QUIT % 2) * 48 + 24, (TOOL_QUIT / 2) * 48 + 40 + 24);
|
done = do_prompt_snd(PROMPT_QUIT_TXT,
|
||||||
|
PROMPT_QUIT_YES, PROMPT_QUIT_NO, SND_AREYOUSURE,
|
||||||
|
(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,9 +19190,11 @@ static int do_new_dialog(void)
|
||||||
|
|
||||||
white_in_palette = -1;
|
white_in_palette = -1;
|
||||||
|
|
||||||
if (!new_colors_last) {
|
if (!new_colors_last)
|
||||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
{
|
||||||
}
|
first_color = 0;
|
||||||
|
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||||
|
}
|
||||||
|
|
||||||
first_starter = num_files;
|
first_starter = num_files;
|
||||||
first_template = -1; /* In case there are none... */
|
first_template = -1; /* In case there are none... */
|
||||||
|
|
@ -19466,14 +19499,18 @@ 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)
|
||||||
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
{
|
||||||
}
|
first_color = num_files;
|
||||||
|
num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,16 +1,16 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* For Win32 that lacks Unix direct support. */
|
/* For Win32 that lacks Unix direct support. */
|
||||||
/* - avoids including "windows.h" */
|
/* - avoids including "windows.h" */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2002 John Popplewell */
|
/* Copyright (c) 2002 John Popplewell */
|
||||||
/* john@johnnypops.demon.co.uk */
|
/* john@johnnypops.demon.co.uk */
|
||||||
/* */
|
/* */
|
||||||
/* Version 1.0.1 - fixed bug in opendir() */
|
/* Version 1.0.1 - fixed bug in opendir() */
|
||||||
/* Version 1.0.0 - initial version */
|
/* Version 1.0.0 - initial version */
|
||||||
/* */
|
/* */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
This program is free software; you can redistribute it and/or modify
|
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
|
it under the terms of the GNU General Public License as published by
|
||||||
|
|
@ -25,14 +25,14 @@
|
||||||
You should have received a copy of the GNU General Public License
|
You should have received a copy of the GNU General Public License
|
||||||
along with this program; if not, write to the Free Software
|
along with this program; if not, write to the Free Software
|
||||||
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
|
|
||||||
#include "win32_dirent.h"
|
#include "win32_dirent.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
|
|
@ -42,11 +42,12 @@
|
||||||
* @param pSpec Path of directory to open
|
* @param pSpec Path of directory to open
|
||||||
* @return Opened directory, or NULL on failure
|
* @return Opened directory, or NULL on failure
|
||||||
*/
|
*/
|
||||||
DIR * opendir(const char *pSpec)
|
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);
|
||||||
|
|
@ -65,7 +66,7 @@ DIR * opendir(const char *pSpec)
|
||||||
*
|
*
|
||||||
* @param pDir Opened directory to close.
|
* @param pDir Opened directory to close.
|
||||||
*/
|
*/
|
||||||
void closedir(DIR * pDir)
|
void closedir(DIR * pDir)
|
||||||
{
|
{
|
||||||
assert(pDir != NULL);
|
assert(pDir != NULL);
|
||||||
free(pDir);
|
free(pDir);
|
||||||
|
|
@ -77,15 +78,15 @@ void closedir(DIR * pDir)
|
||||||
* @param pDir Opened directory from which to read.
|
* @param pDir Opened directory from which to read.
|
||||||
* @return The next entry from the directory
|
* @return The next entry from the directory
|
||||||
*/
|
*/
|
||||||
struct dirent *readdir(struct DIR *pDir)
|
struct dirent *readdir(struct DIR *pDir)
|
||||||
{
|
{
|
||||||
assert(pDir != NULL);
|
assert(pDir != NULL);
|
||||||
if (pDir->hFind)
|
if (pDir->hFind)
|
||||||
|
|
||||||
{
|
{
|
||||||
strcpy(pDir->de.d_name, (const char *)pDir->wfd.cFileName);
|
strcpy(pDir->de.d_name, (const char *)pDir->wfd.cFileName);
|
||||||
if (!FindNextFile(pDir->hFind, &pDir->wfd))
|
if (!FindNextFile(pDir->hFind, &pDir->wfd))
|
||||||
|
|
||||||
{
|
{
|
||||||
FindClose(pDir->hFind);
|
FindClose(pDir->hFind);
|
||||||
pDir->hFind = NULL;
|
pDir->hFind = NULL;
|
||||||
|
|
@ -104,7 +105,7 @@ struct dirent *readdir(struct DIR *pDir)
|
||||||
* filename of dir entry 'a' is found, respectively, to be less than,
|
* filename of dir entry 'a' is found, respectively, to be less than,
|
||||||
* to match, or be greater than that of 'b'.
|
* to match, or be greater than that of 'b'.
|
||||||
*/
|
*/
|
||||||
int alphasort(const void *a, const void *b)
|
int alphasort(const void *a, const void *b)
|
||||||
{
|
{
|
||||||
return (strcmp((*(const struct dirent **)a)->d_name, (*(const struct dirent **)b)->d_name));
|
return (strcmp((*(const struct dirent **)a)->d_name, (*(const struct dirent **)b)->d_name));
|
||||||
}
|
}
|
||||||
|
|
@ -118,7 +119,7 @@ int alphasort(const void *a, const void *b)
|
||||||
* @param entry The directory entry to add to 'namelist'
|
* @param entry The directory entry to add to 'namelist'
|
||||||
* @return New count of items, or -1 on error (e.g., failed malloc())
|
* @return New count of items, or -1 on error (e.g., failed malloc())
|
||||||
*/
|
*/
|
||||||
static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
||||||
{
|
{
|
||||||
int size;
|
int size;
|
||||||
struct dirent *block;
|
struct dirent *block;
|
||||||
|
|
@ -144,9 +145,9 @@ static int addToList(int i, struct dirent ***namelist, struct dirent *entry)
|
||||||
* @param compar Callback for sorting items in the list (via qsort()).
|
* @param compar Callback for sorting items in the list (via qsort()).
|
||||||
* @return Count of items, or -1 on error.
|
* @return Count of items, or -1 on error.
|
||||||
*/
|
*/
|
||||||
int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar)
|
int scandir(const char *dir, struct dirent ***namelist, selectCB select, comparCB compar)
|
||||||
{
|
{
|
||||||
DIR * pDir;
|
DIR *pDir;
|
||||||
int count;
|
int count;
|
||||||
struct dirent *entry;
|
struct dirent *entry;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,13 +1,13 @@
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* */
|
/* */
|
||||||
/* For Win32 that lacks Unix direct support. */
|
/* For Win32 that lacks Unix direct support. */
|
||||||
/* - avoids including "windows.h" */
|
/* - avoids including "windows.h" */
|
||||||
/* */
|
/* */
|
||||||
/* Copyright (c) 2002 John Popplewell */
|
/* Copyright (c) 2002 John Popplewell */
|
||||||
/* john@johnnypops.demon.co.uk */
|
/* john@johnnypops.demon.co.uk */
|
||||||
/* */
|
/* */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* $Id$ */
|
/* $Id$ */
|
||||||
typedef long BOOL;
|
typedef long BOOL;
|
||||||
typedef unsigned int DWORD;
|
typedef unsigned int DWORD;
|
||||||
typedef wchar_t TCHAR;
|
typedef wchar_t TCHAR;
|
||||||
|
|
@ -17,12 +17,12 @@ typedef void *HANDLE;
|
||||||
#define MAX_PATH 256
|
#define MAX_PATH 256
|
||||||
#define INVALID_HANDLE_VALUE ((HANDLE)(-1))
|
#define INVALID_HANDLE_VALUE ((HANDLE)(-1))
|
||||||
#define WINAPI __stdcall
|
#define WINAPI __stdcall
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DWORD dwLowDateTime;
|
DWORD dwLowDateTime;
|
||||||
DWORD dwHighDateTime;
|
DWORD dwHighDateTime;
|
||||||
} FILETIME;
|
} FILETIME;
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
DWORD dwFileAttributes;
|
DWORD dwFileAttributes;
|
||||||
FILETIME ftCreationTime;
|
FILETIME ftCreationTime;
|
||||||
|
|
@ -40,26 +40,26 @@ typedef struct
|
||||||
#define FindFirstFile FindFirstFileA
|
#define FindFirstFile FindFirstFileA
|
||||||
#define FindNextFile FindNextFileA
|
#define FindNextFile FindNextFileA
|
||||||
#define FindClose FindClose
|
#define FindClose FindClose
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
|
|
||||||
#endif /* */
|
#endif /* */
|
||||||
extern HANDLE WINAPI FindFirstFile(const char *, WIN32_FIND_DATA *);
|
extern HANDLE WINAPI FindFirstFile(const char *, WIN32_FIND_DATA *);
|
||||||
extern BOOL WINAPI FindNextFile(HANDLE, WIN32_FIND_DATA *);
|
extern BOOL WINAPI FindNextFile(HANDLE, WIN32_FIND_DATA *);
|
||||||
extern BOOL WINAPI FindClose(HANDLE);
|
extern BOOL WINAPI FindClose(HANDLE);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
#endif /* */
|
#endif /* */
|
||||||
struct dirent
|
struct dirent
|
||||||
{
|
{
|
||||||
char d_name[MAX_PATH];
|
char d_name[MAX_PATH];
|
||||||
};
|
};
|
||||||
typedef struct
|
typedef struct
|
||||||
{
|
{
|
||||||
WIN32_FIND_DATA wfd;
|
WIN32_FIND_DATA wfd;
|
||||||
HANDLE hFind;
|
HANDLE hFind;
|
||||||
|
|
@ -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
1
win32/.indent.pro
vendored
Symbolic link
|
|
@ -0,0 +1 @@
|
||||||
|
../src/.indent.pro
|
||||||
Loading…
Add table
Add a link
Reference in a new issue