Merge branch 'master' into sdl2.0

This commit is contained in:
Pere Pujal i Carabantes 2019-01-25 19:14:04 +01:00
commit 716e4ec55d
25 changed files with 765 additions and 166 deletions

View file

@ -4,12 +4,12 @@
# Various contributors (see AUTHORS.txt) # Various contributors (see AUTHORS.txt)
# http://www.tuxpaint.org/ # http://www.tuxpaint.org/
# June 14, 2002 - August 30, 2018 # June 14, 2002 - December 18, 2018
# The version number, for release: # The version number, for release:
VER_VERSION:=0.9.23 VER_VERSION:=0.9.24
ifdef SOURCE_DATE_EPOCH ifdef SOURCE_DATE_EPOCH
VER_DATE=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u "+%Y-%m-%d") VER_DATE=$(shell date -u -d "@$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u -r "$(SOURCE_DATE_EPOCH)" "+%Y-%m-%d" 2>/dev/null || date -u "+%Y-%m-%d")
else else
@ -90,7 +90,7 @@ linux_BUNDLE:=
BUNDLE:=$($(OS)_BUNDLE) BUNDLE:=$($(OS)_BUNDLE)
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o
osx_ARCH_LIBS:=obj/postscript_print.o obj/macos.o osx_ARCH_LIBS:=src/macos_print.m obj/macos.o
beos_ARCH_LIBS:=obj/BeOS_print.o beos_ARCH_LIBS:=obj/BeOS_print.o
linux_ARCH_LIBS:=obj/postscript_print.o linux_ARCH_LIBS:=obj/postscript_print.o
ARCH_LIBS:=$($(OS)_ARCH_LIBS) ARCH_LIBS:=$($(OS)_ARCH_LIBS)
@ -116,7 +116,7 @@ FRIBIDI_LIB:=$(shell $(PKG_CONFIG) --libs fribidi)
FRIBIDI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags fribidi) FRIBIDI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags fribidi)
windows_ARCH_LINKS:=-lintl $(PNG) -lzdll -lwinspool -lshlwapi $(FRIBIDI_LIB) -liconv windows_ARCH_LINKS:=-lintl $(PNG) -lzdll -lwinspool -lshlwapi $(FRIBIDI_LIB) -liconv
osx_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB) osx_ARCH_LINKS:=$(FRIBIDI_LIB)
beos_ARCH_LINKS:=-lintl $(PNG) -lz -lbe -lnetwork -liconv $(FRIBIDI_LIB) $(PAPER_LIB) $(STDC_LIB) beos_ARCH_LINKS:=-lintl $(PNG) -lz -lbe -lnetwork -liconv $(FRIBIDI_LIB) $(PAPER_LIB) $(STDC_LIB)
linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB) linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS) ARCH_LINKS:=$($(OS)_ARCH_LINKS)
@ -877,7 +877,7 @@ install-dlls:
@cp `which libgcc_s_dw2-1.dll` $(BIN_PREFIX) @cp `which libgcc_s_dw2-1.dll` $(BIN_PREFIX)
@cp `which libstdc++-6.dll` $(BIN_PREFIX) @cp `which libstdc++-6.dll` $(BIN_PREFIX)
@cp `which libfribidi-0.dll` $(BIN_PREFIX) @cp `which libfribidi-0.dll` $(BIN_PREFIX)
@cp `which libwinpthread-1.dll` $(BIN_PREFIX) @cp `which libpthread-2.dll` $(BIN_PREFIX)
@if [ "x$(BDIST_WIN9X)" == "x" ]; then \ @if [ "x$(BDIST_WIN9X)" == "x" ]; then \
cp `which libxml2-2.dll` $(BIN_PREFIX); \ cp `which libxml2-2.dll` $(BIN_PREFIX); \
cp `which libcairo-2.dll` $(BIN_PREFIX); \ cp `which libcairo-2.dll` $(BIN_PREFIX); \

View file

@ -52,6 +52,21 @@ for i in "$BINARY" $LIBS $LIBDIR/*; do
n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'` n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'`
install_name_tool -change "$j" "$n" "$i" install_name_tool -change "$j" "$n" "$i"
done done
# libSDL links to /System/Library/Frameworks/CoreGraphics.framework by
# default on newer versions of macOS, but this library is located under
# /System/Library/Frameworks/ApplicationServices.framework/Frameworks
# instead in macOS 10.7, and is a symlink to its real location in later
# versions of macOS. For compatibility reasons, we tell libSDL to link to
# the former location instead. See here for more information:
#
# https://stackoverflow.com/questions/20206985/xcode-linking-against-applicationservices-framework-with-sdk-10-9-causes-10-7
#
if [ `otool -L "$i" | grep -c '^\t\/System\/Library\/Frameworks\/CoreGraphics\.framework\/Versions\/A\/CoreGraphics'` -gt 0 ]; then
defaultlib="/System/Library/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics"
compatlib="/System/Library/Frameworks/ApplicationServices.framework/Frameworks/CoreGraphics.framework/Versions/A/CoreGraphics"
install_name_tool -change "$defaultlib" "$compatlib" "$i"
fi
done done
# Some libraries require config files, so copy those... # Some libraries require config files, so copy those...

View file

@ -8,6 +8,50 @@ http://www.tuxpaint.org/
$Id$ $Id$
2018.Dec.18 (0.9.24)
* Bug Fixes
---------
* Correct issue that prevented Tux Paint from lauching on Mac OS X 10.7.
(See https://sourceforge.net/p/tuxpaint/tuxpaint/ci/d2ef2e17d1962111d0f6f91394dce81e8706d48b/
and https://stackoverflow.com/questions/20206985/xcode-linking-against-applicationservices-framework-with-sdk-10-9-causes-10-7)
Mark K. Kim <mkkim214@gmail.com>
* Reduce launch time by calling progress bar less frequently
while loading stamps.
Mark K. Kim <mkkim214@gmail.com>
* Ability to bring up the print dialog from the macOS build was
removed in Tux Paint 0.9.23 to support the new build mechanism.
It has been re-added. To access it, option-click the print icon,
or configure Tux Paint to always bring up the dialog upon print.
Mark K. Kim <mkkim214@gmail.com>
* Other Improvements
------------------
* Added ability to move color palette options to the end of
the New dialog, for situations where users are meant to start
drawings with specific Starters or Templates.
Use "--newcolorslast" option.
(Suggested by Bernard Verhaeghe)
* Documentation updates
---------------------
* Mended link to MinGW/MSYS instructions at John Popplewell's website.
(h/t "sechidis")
* Improved and expanded usage info (e.g., "tuxpaint --help" output)
* Misc
----
* Verbose debugging, and "DEBUG_PRINTF()" macro now available;
see debugging options in INSTALL.txt.
Mark K. Kim <mkkim214@gmail.com>
* Notes:
------
* 0.9.23a & 0.9.23b were test versions for macOS that Mark produced
and sent to individual users for testing.
2018.August.30 (0.9.23) 2018.August.30 (0.9.23)
* New tools * New tools
--------- ---------

26
docs/RELEASE.txt Normal file
View file

@ -0,0 +1,26 @@
Release checklist for Tux Paint
Places to make sure version # and release date gets updated, prior to
cutting a release (tagging in the source code repository, and running
"make release" to roll a .tar.gz source tarball).
* Makefile
* Build description files:
* tuxpaint.spec (RPM package)
* macos/Info.plist (macOS build)
* Documentation
(For HTML variants, be sure to run "make" in "docs/", to
produce plaintext alternatives!)
* docs/CHANGES.txt
* docs/en/html/README.html
* docs/en/html/FAQ.html
* docs/en/html/OPTIONS.html
* docs/en/html/EXTENDING.html
* docs/en/html/ADVANCED-STAMPS-HOWTO.html
* Manual page (manpage)
* src/manpage/tuxpaint.1

View file

@ -1,5 +1,5 @@
Tux Paint Tux Paint
version 0.9.23 version 0.9.23c
Advanced Stamps HOWTO Advanced Stamps HOWTO
Copyright 2006-2008 by Albert Cahalan for the Tux Paint project Copyright 2006-2008 by Albert Cahalan for the Tux Paint project

View file

@ -1,11 +1,11 @@
Tux Paint Tux Paint
version 0.9.23 version 0.9.23c
Extending Tux Paint Extending Tux Paint
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
June 14, 2002 - August 28, 2018 June 14, 2002 - October 7, 2018
---------------------------------------------------------------------- ----------------------------------------------------------------------

View file

@ -1,11 +1,11 @@
Tux Paint Tux Paint
version 0.9.23 version 0.9.23c
Frequently Asked Questions Frequently Asked Questions
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
September 14, 2002 - August 28, 2018 September 14, 2002 - October 7, 2018
Drawing-related Drawing-related

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2018
Various contributors (see below, and AUTHORS.txt) Various contributors (see below, and AUTHORS.txt)
http://www.tuxpaint.org/ http://www.tuxpaint.org/
June 27, 2002 - August 19, 2018 June 27, 2002 - December 8, 2018
$Id$ $Id$
@ -175,7 +175,7 @@ Compiling and Installation:
upon. John Popplewell put together some instructions for doing that upon. John Popplewell put together some instructions for doing that
here: here:
http://johnnypops.demon.co.uk/mingw/index.html http://www.johnnypops.co.uk/tuxpaint/
Read the relevant notes if building for Win9X/ME. Read the relevant notes if building for Win9X/ME.
@ -367,6 +367,13 @@ Compiling and Installation:
a complete list. a complete list.
Debugging:
----------
Debugging (to stdout, e.g. terminal, or to a "stdout.txt" file, on Windows)
can be enabled by setting "DEBUG" (and, if verbose logging is wanted,
"VERBOSE") #define's in src/debug.h.
Uninstalling Tux Paint: Uninstalling Tux Paint:
----------------------- -----------------------
Windows Windows

View file

@ -1,12 +1,12 @@
Tux Paint Tux Paint
version 0.9.23 version 0.9.24
Options Documentation Options Documentation
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
August 28, 2018 December 18, 2018
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -358,6 +358,10 @@ Windows Users
Disables the Label tool: the tool that allows text entry which Disables the Label tool: the tool that allows text entry which
can be edited later. can be edited later.
newcolorslast=yes
Places the blank color options in the New dialog at the end,
so that any Starters and/or Templates are shown first.
mirrorstamps=yes mirrorstamps=yes
For stamps that can be mirrored, this option sets them to For stamps that can be mirrored, this option sets them to
@ -980,6 +984,7 @@ Windows Users
--nostampcontrols --nostampcontrols
--nomagiccontrols --nomagiccontrols
--nolabel --nolabel
--newcolorslast
--mouse-accessibility --mouse-accessibility
--onscreen-keyboard --onscreen-keyboard
--onscreen-keyboard-layout --onscreen-keyboard-layout
@ -1050,6 +1055,7 @@ Windows Users
--stampcontrols --stampcontrols
--magiccontrols --magiccontrols
--label --label
--newcolorsfirst
--nosysfonts --nosysfonts
--currentlocalefont --currentlocalefont
--dontmirrorstamps --dontmirrorstamps

View file

@ -1,12 +1,12 @@
Tux Paint Tux Paint
version 0.9.23 version 0.9.24
A simple drawing program for children A simple drawing program for children
Copyright 2002-2018 by various contributors; see AUTHORS.txt Copyright 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/ http://www.tuxpaint.org/
June 14, 2002 - August 28, 2018 June 14, 2002 - December 18, 2018
---------------------------------------------------------------------- ----------------------------------------------------------------------

View file

@ -11,7 +11,7 @@ alink="#FF00FF">
alt="Tux&nbsp;Paint"><br> alt="Tux&nbsp;Paint"><br>
version version
0.9.23 0.9.23c
<br> <br>
Advanced Stamps HOWTO</h1> Advanced Stamps HOWTO</h1>

View file

@ -12,7 +12,7 @@ alt="Tux&nbsp;Paint"><br>
version version
0.9.23 0.9.23c
<br> <br>
Extending Tux Paint</h1> Extending Tux Paint</h1>
@ -20,7 +20,7 @@ Extending Tux Paint</h1>
<p>Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt<br/> <p>Copyright (c) 2002-2018 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 - August 28, 2018</p> <p>June 14, 2002 - October 7, 2018</p>
</center> </center>
<hr size=2 noshade> <hr size=2 noshade>

View file

@ -11,7 +11,7 @@ alink="#FF00FF">
alt="Tux&nbsp;Paint"><br> alt="Tux&nbsp;Paint"><br>
version version
0.9.23 0.9.23c
<br> <br>
Frequently Asked Questions</h1> Frequently Asked Questions</h1>
@ -19,7 +19,7 @@ Frequently Asked Questions</h1>
<p>Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt<br/> <p>Copyright (c) 2002-2018 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>September 14, 2002 - August 28, 2018</p> <p>September 14, 2002 - October 7, 2018</p>
</center> </center>
<h2>Drawing-related</h2> <h2>Drawing-related</h2>

View file

@ -11,7 +11,7 @@ alink="#FF00FF">
version version
0.9.23 0.9.24
</h1> </h1>
<h2>Options Documentation</h2> <h2>Options Documentation</h2>
@ -19,7 +19,7 @@ version
<p>Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt<br/> <p>Copyright (c) 2002-2018 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>August 28, 2018</p> <p>December 18, 2018</p>
</center> </center>
@ -465,6 +465,12 @@ version
which can be edited later. which can be edited later.
</dd> </dd>
<dt><code><b>newcolorslast=yes</b></code></dt>
<dd>
Places the blank color options in the <b>New</b> dialog at the end,
so that any Starters and/or Templates are shown first.
</dd>
<dt><code><b>mirrorstamps=yes</b></code></dt> <dt><code><b>mirrorstamps=yes</b></code></dt>
<dd> <dd>
<p>For stamps that can be mirrored, this option sets them to their <p>For stamps that can be mirrored, this option sets them to their
@ -1545,6 +1551,7 @@ version
--nostampcontrols<br> --nostampcontrols<br>
--nomagiccontrols<br> --nomagiccontrols<br>
--nolabel<br> --nolabel<br>
--newcolorslast<br>
--mouse-accessibility<br> --mouse-accessibility<br>
--onscreen-keyboard<br> --onscreen-keyboard<br>
--onscreen-keyboard-layout<br> --onscreen-keyboard-layout<br>
@ -1618,6 +1625,7 @@ version
--stampcontrols<br> --stampcontrols<br>
--magiccontrols<br> --magiccontrols<br>
--label<br> --label<br>
--newcolorsfirst<br>
--nosysfonts<br> --nosysfonts<br>
--currentlocalefont<br> --currentlocalefont<br>
--dontmirrorstamps<br> --dontmirrorstamps<br>

View file

@ -12,7 +12,7 @@ alt="Tux&nbsp;Paint"><br>
version version
0.9.23 0.9.24
</h1> </h1>
<h3>A simple drawing program for children</h3> <h3>A simple drawing program for children</h3>
@ -22,7 +22,7 @@ version
<p>June 14, 2002 - <p>June 14, 2002 -
August 28, 2018</p> December 18, 2018</p>
</center> </center>

View file

@ -7,7 +7,7 @@
<key>CFBundleExecutable</key> <key>CFBundleExecutable</key>
<string>tuxpaint</string> <string>tuxpaint</string>
<key>CFBundleGetInfoString</key> <key>CFBundleGetInfoString</key>
<string>0.9.23, Copyright 2009-2018, Tux Paint Development Team</string> <string>0.9.23c, Copyright 2009-2018, Tux Paint Development Team</string>
<key>CFBundleIconFile</key> <key>CFBundleIconFile</key>
<string>tuxpaint.icns</string> <string>tuxpaint.icns</string>
<key>CFBundleIdentifier</key> <key>CFBundleIdentifier</key>
@ -19,10 +19,10 @@
<key>CFBundlePackageType</key> <key>CFBundlePackageType</key>
<string>APPL</string> <string>APPL</string>
<key>CFBundleShortVersionString</key> <key>CFBundleShortVersionString</key>
<string>0.9.23</string> <string>0.9.23c</string>
<key>CFBundleSignature</key> <key>CFBundleSignature</key>
<string>TXPT</string> <string>TXPT</string>
<key>CFBundleVersion</key> <key>CFBundleVersion</key>
<string>2018-09-01</string> <string>2018-10-07</string>
</dict> </dict>
</plist> </plist>

View file

@ -1,4 +1,49 @@
#define DEBUG #define DEBUG
#define VERBOSE
/*
* Enable verbose logging if requested on platforms that support it.
*
* Verbose logging adds metadata to printf, including the source file location
* from where printf was called and the time it was called at runtime.
*/
#if defined(DEBUG) && defined(VERBOSE) && defined(__GNUC__)
#include <stdio.h>
#include <time.h>
#define printf(args...) do { \
time_t now = time(NULL); \
printf("\n### %s, line %d in %s() @ %s", __FILE__, __LINE__, __FUNCTION__, ctime(&now)); \
printf(args); \
} while(0)
#endif
/*
* Define a convenience macro DEBUG_PRINTF(). This macro resolves to printf()
* if and only if DEBUG is enabled, otherwise resolves to nothing. In other
* words,
*
* DEBUG_PRINTF("Hello, world!\n");
*
* ... is equivalent to:
*
* #if defined(DEBUG)
* printf("Hello, world!\n");
* #endif
*
* (To be precise, the semicolon falls outside of the #if test, but an empty
* semicolon resolves to nothing in standard C.)
*
* If VERBOSE logging is enabled, DEBUG_PRINTF should resolve to the verbose
* version of printf() defined earlier in this file.
*/
#if defined(DEBUG)
#define DEBUG_PRINTF(...) printf(__VA_ARGS__)
#else
#define DEBUG_PRINTF(...)
#endif
#ifdef __ANDROID__ #ifdef __ANDROID__
#include <android/log.h> #include <android/log.h>

40
src/macos_print.h Normal file
View file

@ -0,0 +1,40 @@
//
// macosx_print.h
// Tux Paint
//
// Created by Darrell Walisser on Sat Mar 15 2003.
// Modified by Martin Fuhrer 2007.
// Copyright (c) 2007 Darrell Walisser, Martin Fuhrer. All rights reserved.
// $Id$
//
// 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// (See COPYING.txt)
//
#include "SDL.h"
const char *SurfacePrint(SDL_Surface * surface, int showDialog);
int DisplayPageSetup(const SDL_Surface * surface);
#ifdef OBJECTIVEC
@interface PrintSheetController:NSObject
{
bool displayPrintSetupSheet;
bool displayPrintSheet;
}
-@end
#endif /* OBJECTIVEC */

330
src/macos_print.m Normal file
View file

@ -0,0 +1,330 @@
//
// macos_print.m
// Tux Paint
//
// Created by Darrell Walisser on Sat Mar 15 2003.
// Modified by Martin Fuhrer 2007.
// Modified by Mark Kim 2018.
// Copyright (c) 2018 Darrell Walisser, Martin Fuhrer, Mark Kim.
//
// 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
// the Free Software Foundation; either version 2 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
// (See COPYING.txt)
//
// $Id$
//
#import "macos_print.h"
#import <Cocoa/Cocoa.h>
struct {
int cocoaKeystrokes; // should keystrokes be intercepted by Cocoa wrapper?
} macos;
NSData* printData = nil;
// this object presents the image to the printing layer
@interface ImageView : NSView
{
NSImage* _image;
}
- (void) setImage:(NSImage*)image;
@end
@implementation ImageView
- (void) setImage:(NSImage*)image
{
_image = [ image retain ];
}
- (void) drawRect:(NSRect)rect
{
[ _image compositeToPoint: NSMakePoint( 0, 0 ) operation: NSCompositeCopy ];
}
- (BOOL) scalesWhenResized
{
return YES;
}
@end
// this object waits for the print dialog to go away
@interface ModalDelegate : NSObject
{
BOOL _complete;
BOOL _wasOK;
}
- (id) init;
- (BOOL) wait;
- (void) reset;
- (BOOL) wasOK;
@end
@implementation ModalDelegate
- (id) init
{
self = [ super init ];
_complete = NO;
_wasOK = NO;
return self;
}
- (BOOL) wait
{
while (!_complete) {
NSEvent *event;
event = [ NSApp nextEventMatchingMask:NSAnyEventMask
untilDate:[ NSDate distantFuture ]
inMode: NSDefaultRunLoopMode dequeue:YES ];
[ NSApp sendEvent:event ];
}
return [ self wasOK ];
}
- (void) reset
{
_complete = NO;
_wasOK = NO;
}
- (BOOL) wasOK
{
return _wasOK;
}
- (void)printDidRun:(NSPrintOperation *)printOperation
success:(BOOL)success contextInfo:(void *)contextInfo
{
_complete = YES;
_wasOK = success;
}
- (void)pageLayoutEnded:(NSPageLayout *)pageLayout
returnCode:(int)returnCode contextInfo:(void *)contextInfo
{
_complete = YES;
_wasOK = returnCode == NSOKButton;
}
@end
static NSImage* CreateImage( SDL_Surface *surface )
{
NSBitmapImageRep* imageRep;
NSSize imageSize;
NSImage* image;
SDL_Surface* surface32RGBA;
// convert surface to 32bit RGBA
#ifdef BIG_ENDIAN_ARCH
surface32RGBA = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h,
32, 0xff<<24, 0xff<<16, 0xff<<8, 0xff<<0 );
#else
surface32RGBA = SDL_CreateRGBSurface( SDL_SWSURFACE, surface->w, surface->h,
32, 0xff<<0, 0xff<<8, 0xff<<16, 0xff<<24 );
#endif
if( surface32RGBA == NULL ) {
NSLog (@"CreateImage: Cannot allocate conversion surface");
return nil;
}
SDL_BlitSurface( surface, NULL, surface32RGBA, NULL );
// convert surface to an NSBitmapImageRep
imageRep = [ [ NSBitmapImageRep alloc]
initWithBitmapDataPlanes:(unsigned char **)&surface32RGBA->pixels
pixelsWide:surface->w
pixelsHigh:surface->h
bitsPerSample:8
samplesPerPixel:4
hasAlpha:YES
isPlanar:NO
colorSpaceName:NSDeviceRGBColorSpace
bytesPerRow:surface->w * 4
bitsPerPixel:32 ];
if( imageRep == nil ) {
NSLog (@"CreateImage: Could not create image representation.");
return nil;
}
imageSize = NSMakeSize( surface->w, surface->h );
image = [ [ NSImage alloc ] initWithSize:imageSize ];
if( image == nil ) {
NSLog (@"CreateImage: Could not allocate image");
return nil;
}
[ image addRepresentation:imageRep ];
[ image setScalesWhenResized:YES ];
[ image setDataRetained:YES ];
[ image autorelease ];
[ imageRep release ];
free( surface32RGBA );
return image;
}
void DefaultPrintSettings( const SDL_Surface *surface, NSPrintInfo *printInfo )
{
if( surface->w > surface->h )
[ printInfo setOrientation:NSLandscapeOrientation ];
else
[ printInfo setOrientation:NSPortraitOrientation ];
[ printInfo setHorizontallyCentered:true ];
[ printInfo setVerticallyCentered:true ];
[ printInfo setVerticalPagination:NSFitPagination ];
[ printInfo setHorizontalPagination:NSFitPagination ];
}
NSPrintInfo* LoadPrintInfo( const SDL_Surface *surface )
{
NSUserDefaults* standardUserDefaults;
NSPrintInfo* printInfo;
NSData* printData = nil;
static BOOL firstTime = YES;
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
if( standardUserDefaults )
printData = [ standardUserDefaults dataForKey:@"PrintInfo" ];
if( printData )
printInfo = (NSPrintInfo*)[ NSUnarchiver unarchiveObjectWithData:printData ];
else
{
printInfo = [ NSPrintInfo sharedPrintInfo ];
if( firstTime == YES )
{
DefaultPrintSettings( surface, printInfo );
firstTime = NO;
}
}
return printInfo;
}
void SavePrintInfo( NSPrintInfo* printInfo )
{
NSUserDefaults* standardUserDefaults;
NSData* printData = nil;
printData = [ NSArchiver archivedDataWithRootObject:printInfo ];
standardUserDefaults = [ NSUserDefaults standardUserDefaults ];
if( standardUserDefaults )
[ standardUserDefaults setObject:printData forKey:@"PrintInfo" ];
}
int DisplayPageSetup( const SDL_Surface * surface )
{
NSPageLayout* pageLayout;
NSPrintInfo* printInfo;
ModalDelegate* delegate;
BOOL result;
macos.cocoaKeystrokes = 1;
printInfo = LoadPrintInfo( surface );
delegate = [ [ [ ModalDelegate alloc ] init ] autorelease ];
pageLayout = [ NSPageLayout pageLayout ];
[ pageLayout beginSheetWithPrintInfo:printInfo
modalForWindow:[ NSApp mainWindow ]
delegate:delegate
didEndSelector:@selector(pageLayoutEnded:returnCode:contextInfo:)
contextInfo:nil ];
result = [ delegate wait ];
SavePrintInfo( printInfo );
macos.cocoaKeystrokes = 0;
return (int)( result );
}
const char* SurfacePrint( SDL_Surface *surface, int showDialog )
{
NSImage* image;
ImageView* printView;
NSWindow* printWindow;
NSPrintOperation* printOperation;
NSPrintInfo* printInfo;
ModalDelegate* delegate;
BOOL ok = YES;
// check if printers are available
NSArray* printerNames = [NSPrinter printerNames];
if( [printerNames count] == 0 && !showDialog)
return "No printer is available. Run Tux Paint in window mode (not fullscreen), and select File > Print... to choose a printer.";
// create image for surface
image = CreateImage( surface );
if( image == nil )
return "Could not create a print image.";
// create print control objects
printInfo = LoadPrintInfo( surface );
NSRect pageRect = [ printInfo imageablePageBounds ];
NSSize pageSize = pageRect.size;
NSPoint pageOrigin = pageRect.origin;
[ printInfo setTopMargin:pageOrigin.y ];
[ printInfo setLeftMargin:pageOrigin.x ];
[ printInfo setRightMargin:pageOrigin.x ];
[ printInfo setBottomMargin:pageOrigin.y ];
float surfaceRatio = (float)( surface->w ) / (float)( surface->h );
float pageRatio = pageSize.width / pageSize.height;
NSSize imageSize = pageSize;
if( pageRatio > surfaceRatio ) // wide page
imageSize.width = surface->w * pageSize.height / surface->h;
else // tall page
imageSize.height = surface->h * pageSize.width / surface->w;
// create print view
printView = [ [ [ ImageView alloc ] initWithFrame: NSMakeRect( 0, 0, imageSize.width, imageSize.height ) ] autorelease ];
if (printView == nil)
return "Could not create a print view.";
[ image setSize:imageSize ];
[ printView setImage:image ];
// run printing
printOperation = [ NSPrintOperation printOperationWithView:printView printInfo:printInfo ];
[ printOperation setShowsPrintPanel:showDialog ]; //EP replaced setShowPanels by setShowsPrintPanel
macos.cocoaKeystrokes = 1;
delegate = [ [ [ ModalDelegate alloc ] init ] autorelease ];
[ printOperation runOperationModalForWindow:[ NSApp mainWindow ]
delegate:delegate didRunSelector:@selector(printDidRun:success:contextInfo:) contextInfo:nil ];
ok = [ delegate wait ];
macos.cocoaKeystrokes = 0;
SavePrintInfo( printInfo );
[ image release ];
return NULL;
}

View file

@ -1,5 +1,5 @@
.\" tuxpaint.1 - 2018.08.19 .\" tuxpaint.1 - 2018.09.24
.TH TUXPAINT 1 "19 August 2018" "0.9.23" "Tux Paint" .TH TUXPAINT 1 "24 September 2018" "0.9.23c" "Tux Paint"
.SH NAME .SH NAME
tuxpaint -- "Tux Paint", a drawing program for young children. tuxpaint -- "Tux Paint", a drawing program for young children.

View file

@ -123,6 +123,8 @@ mirrorstamps, POSBOOL(mirrorstamps)
mixedcase, NEGBOOL(only_uppercase) mixedcase, NEGBOOL(only_uppercase)
mouse, NEGBOOL(keymouse) mouse, NEGBOOL(keymouse)
native, POSBOOL(native_screensize) native, POSBOOL(native_screensize)
newcolorsfirst, NEGBOOL(new_colors_last)
newcolorslast, POSBOOL(new_colors_last)
orient, MULTI(rotate_orientation) orient, MULTI(rotate_orientation)
outlines, NEGBOOL(dont_do_xor) outlines, NEGBOOL(dont_do_xor)
papersize, MULTI(papersize) papersize, MULTI(papersize)

View file

@ -28,6 +28,7 @@ struct cfginfo
const char *keymouse; const char *keymouse;
const char *mirrorstamps; const char *mirrorstamps;
const char *native_screensize; const char *native_screensize;
const char *new_colors_last;
const char *no_button_distinction; const char *no_button_distinction;
const char *no_fancy_cursors; const char *no_fancy_cursors;
const char *no_system_fonts; const char *no_system_fonts;

View file

@ -8,6 +8,8 @@
# FIXME: See http://www.debian-administration.org/articles/316 for an intro # FIXME: See http://www.debian-administration.org/articles/316 for an intro
# to how we should be doing this... -bjk 2009.09.09 # to how we should be doing this... -bjk 2009.09.09
# FIXME: Use the source to list all of the available options -bjk 2018.12.18
have tuxpaint && have tuxpaint &&
_tuxpaint() _tuxpaint()
{ {
@ -41,6 +43,7 @@ _tuxpaint()
--nobuttondistinction --buttondistinction \ --nobuttondistinction --buttondistinction \
--outlines --nooutlines \ --outlines --nooutlines \
--stamps --nostamps \ --stamps --nostamps \
--newcolorsfirst --newcolorslast \
--sysfonts --nosysfonts \ --sysfonts --nosysfonts \
--nostampcontrols --stampcontrols \ --nostampcontrols --stampcontrols \
--nomagiccontrols --magiccontrols \ --nomagiccontrols --magiccontrols \

View file

@ -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 - August 28, 2018 June 14, 2002 - December 18, 2018
*/ */
@ -302,6 +302,17 @@ typedef struct safer_dirent
#else /* __BEOS__ */ #else /* __BEOS__ */
/* Not BeOS */
#ifdef __APPLE__
/* Apple */
#include "macos_print.h"
#else /* __APPLE__ */
/* Not Windows, not BeOS, not Apple */
#ifdef __ANDROID__ #ifdef __ANDROID__
#define AUTOSAVE_GOING_BACKGROUND #define AUTOSAVE_GOING_BACKGROUND
@ -310,12 +321,14 @@ typedef struct safer_dirent
#else #else
/* Not Windows, not BeOS, not Android */ /* Not Windows, not BeOS, not Apple, not Android*/
#include "postscript_print.h" #include "postscript_print.h"
#endif /* __ANDROID__ */ #endif /* __ANDROID__ */
#endif /* __APPLE__ */
#endif /* __BEOS__ */ #endif /* __BEOS__ */
#else /* WIN32 */ #else /* WIN32 */
@ -1280,6 +1293,7 @@ static int dont_load_stamps;
static int mirrorstamps; static int mirrorstamps;
static int disable_stamp_controls; static int disable_stamp_controls;
static int stamp_size_override = -1; static int stamp_size_override = -1;
static int new_colors_last;
#ifdef NOKIA_770 #ifdef NOKIA_770
static int simple_shapes = 1; static int simple_shapes = 1;
@ -1450,7 +1464,7 @@ enum
static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */ static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__) #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
#include <paper.h> #include <paper.h>
#if !defined(PAPER_H) #if !defined(PAPER_H)
#error "---------------------------------------------------" #error "---------------------------------------------------"
@ -2046,6 +2060,7 @@ 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_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);
@ -2716,6 +2731,14 @@ static void mainloop(void)
magic_switchin(canvas); magic_switchin(canvas);
} }
#ifdef __APPLE__
else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && !noshortcuts)
{
/* Ctrl-Shft-P - Page Setup */
if (!disable_print)
DisplayPageSetup(canvas);
}
#endif
else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts) else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts)
{ {
/* Ctrl-P - Print */ /* Ctrl-P - Print */
@ -6648,80 +6671,92 @@ void show_version(int details)
void show_usage(int exitcode) void show_usage(int exitcode)
{ {
FILE *f = exitcode ? stderr : stdout; FILE *f = exitcode ? stderr : stdout;
char *blank;
unsigned i;
blank = strdup(progname);
for (i = 0; i < strlen(blank); i++)
blank[i] = ' ';
fprintf(f, fprintf(f,
"\n" "\n"
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n" "Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
"\n" "\n"
" %s [--windowed | --fullscreen]\n" " Config:\n"
" %s [--WIDTHxHEIGHT | --native]\n" " [--nosysconfig]\n"
" %s [--disablescreensaver | --allowscreensaver ]\n" "\n"
" %s [--orient=landscape | --orient=portrait]\n" " Video/Sound:\n"
" %s [--startblank | --startlast]\n" " [--windowed | --fullscreen]\n"
" %s [--sound | --nosound]\n" " [--WIDTHxHEIGHT | --native]\n"
" %s [--quit | --noquit]\n" " [--orient=landscape | --orient=portrait]\n"
" %s [--print | --noprint]\n" " [--disablescreensaver | --allowscreensaver ]\n"
" %s [--complexshapes | --simpleshapes]\n" " [--sound | --nosound]\n"
" %s [--mixedcase | --uppercase]\n" " [--colorfile FILE]\n"
" %s [--fancycursors | --nofancycursors]\n" "\n"
" %s [--hidecursor | --showcursor]\n" " Mouse/Keyboard:\n"
" %s [--mouse | --keyboard]\n" " [--fancycursors | --nofancycursors]\n"
" %s [--dontgrab | --grab]\n" " [--hidecursor | --showcursor]\n"
" %s [--noshortcuts | --shortcuts]\n" " [--noshortcuts | --shortcuts]\n"
" %s [--wheelmouse | --nowheelmouse]\n" " [--dontgrab | --grab]\n"
" %s [--nobuttondistinction | --buttondistinction]\n" " [--wheelmouse | --nowheelmouse]\n"
" %s [--outlines | --nooutlines]\n" " [--nobuttondistinction | --buttondistinction]\n"
" %s [--stamps | --nostamps]\n" "\n"
" %s [--sysfonts | --nosysfonts]\n" " Simplification:\n"
" %s [--nostampcontrols | --stampcontrols]\n" " [--complexshapes | --simpleshapes]\n"
" %s [--nomagiccontrols | --magiccontrols]\n" " [--outlines | --nooutlines]\n"
" %s [--nolabel | --label]\n" " [--mixedcase | --uppercase]\n"
" %s [--mirrorstamps | --dontmirrorstamps]\n" " [--stampsize=[0-10] | --stampsize=default]\n"
" %s [--stampsize=[0-10] | --stampsize=default]\n" " [--quit | --noquit]\n"
" %s [--saveoverask | --saveover | --saveovernew]\n" " [--stamps | --nostamps]\n"
" %s [--nosave | --save]\n" " [--nostampcontrols | --stampcontrols]\n"
" %s [--autosave | --noautosave]\n" " %s [--savedir DIRECTORY]\n" " %s [--datadir DIRECTORY]\n" " [--nomagiccontrols | --magiccontrols]\n"
" [--nolabel | --label]\n"
" [--newcolorsfirst | --newcolorslast]\n"
"\n"
" Languages:\n"
" [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
" [--mirrorstamps | --dontmirrorstamps]\n"
" [--sysfonts | --nosysfonts]\n"
" [--currentlocalefont | --alllocalefonts]\n"
"\n"
" Printing:\n"
" [--print | --noprint]\n"
" [--printdelay=SECONDS]\n"
" [--altprintmod | --altprintalways | --altprintnever]\n"
#if defined(WIN32) || defined(__APPLE__) #if defined(WIN32) || defined(__APPLE__)
" %s [--printcfg | --noprintcfg]\n" " [--printcfg | --noprintcfg]\n"
#endif #endif
" %s [--printdelay=SECONDS]\n" " %s [--altprintmod | --altprintalways | --altprintnever]\n"
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
" %s [--papersize PAPERSIZE | --papersize help]\n"
#endif
" %s [--lang LANGUAGE | --locale LOCALE | --lang help]\n"
" %s [--nosysconfig]\n"
" %s [--nolockfile]\n"
" %s [--colorfile FILE]\n"
" %s [--mouse-accessibility]\n"
" %s [--onscreen-keyboard]\n"
" %s [--joystick-dev N] (default=0)\n"
" %s [--joystick-slowness N] (0-500; default value is 15)\n"
" %s [--joystick-threshold N] (0-32766; default value is 3200)\n"
" %s [--joystick-maxsteps N] (1-7; default value is 7)\n"
"\n",
progname, progname,
blank, blank, blank, blank,
blank, blank, blank, blank,
blank, blank, blank, blank,
blank, blank, blank, blank,
blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank, blank,
#ifdef WIN32
blank,
#endif
blank, blank,
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
blank,
#endif
blank, blank, blank, blank, blank, blank, blank, blank, blank, blank);
free(blank); #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
" [--printcommand=COMMAND]\n"
" [--altprintcommand=COMMAND]\n"
" [--papersize PAPERSIZE | --papersize help]\n"
#endif
"\n"
" Saving:\n"
" [--saveoverask | --saveover | --saveovernew]\n"
" [--startblank | --startlast]\n"
" [--savedir DIRECTORY]\n"
" [--nosave | --save]\n"
" [--autosave | --noautosave]\n"
"\n"
" Data:\n"
" [--nolockfile]\n"
" [--datadir DIRECTORY]\n"
"\n"
" Accessibility:\n"
" [--mouse-accessibility]\n"
" [--mouse | --keyboard]\n"
" [--onscreen-keyboard]\n"
" [--onscreen-keyboard-layout=LAYOUT]\n"
" [--onscreen-keyboard-disable-change]\n"
"\n"
" Joystick:\n"
" [--joystick-dev N] (default=0)\n"
" [--joystick-slowness N] (0-500; default value is 15)\n"
" [--joystick-threshold N] (0-32766; default value is 3200)\n"
" [--joystick-maxsteps N] (1-7; default value is 7)\n"
" [--joystick-hat-slowness N] (0-500; default value is 15)\n"
" [--joystick-hat-timeout N] (0-3000; default value is 1000)\n"
" [--joystick-buttons-ignore=BUTTON1,BUTTON2,...]\n"
" [--joystick-btn-COMMAND=BUTTON]\n"
/* FIXME: "--joystick-btn-help" to list available commands, like "--lang help" */
"\n",
progname);
} }
@ -7698,7 +7733,7 @@ static void loadstamp_callback(SDL_Surface * screen,
(void)locale; (void)locale;
#ifdef DEBUG #ifdef DEBUG
/* FIXME: Stderr instead of stdout? */ /* FIXME: Stderr instead of stdout? */
printf("loadstamp_callback: %s\n", dir); printf("loadstamp_callback (%d): %s\n", i, dir);
#endif #endif
if (num_stamps[stamp_group] > 0) if (num_stamps[stamp_group] > 0)
@ -7738,7 +7773,6 @@ static void loadstamp_callback(SDL_Surface * screen,
/* Sort and iterate the file list: */ /* Sort and iterate the file list: */
qsort(files, i, sizeof *files, compare_ftw_str); qsort(files, i, sizeof *files, compare_ftw_str);
while (i--) while (i--)
{ {
@ -7784,7 +7818,11 @@ static void loadstamp_callback(SDL_Surface * screen,
} }
#endif #endif
show_progress_bar(screen); /*
* Showing the progress bar across the screen can be CPU-intensive, so
* update infrequently.
*/
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))
@ -16686,7 +16724,7 @@ void do_print(void)
SDL_BlitSurface(canvas, NULL, save_canvas, NULL); SDL_BlitSurface(canvas, NULL, save_canvas, NULL);
SDL_BlitSurface(label, NULL, save_canvas, NULL); SDL_BlitSurface(label, NULL, save_canvas, NULL);
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__) #if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__) && !defined(__ANDROID__)
const char *pcmd; const char *pcmd;
FILE *pi; FILE *pi;
@ -16738,6 +16776,17 @@ void do_print(void)
/* BeOS */ /* BeOS */
SurfacePrint(save_canvas); SurfacePrint(save_canvas);
#elif defined(__APPLE__)
/* Mac OS X */
int show = (want_alt_printcommand && !fullscreen);
const char *error = SurfacePrint(save_canvas, show);
if (error)
{
fprintf(stderr, "Cannot print: %s\n", error);
do_prompt_snd(error, PROMPT_PRINT_YES, "", SND_TUXOK, 0, 0);
}
#elif defined(__ANDROID__) #elif defined(__ANDROID__)
@ -18969,8 +19018,6 @@ static int do_new_dialog(void)
int places_to_look; int places_to_look;
int tot; int tot;
int first_starter, first_template; int first_starter, first_template;
int added;
Uint8 r, g, b;
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;
@ -19092,8 +19139,10 @@ static int do_new_dialog(void)
/* (Re)allocate space for the information about these files: */ /* (Re)allocate space for the information about these files: */
tot = num_files_in_dirs;
tot = num_files_in_dirs + NUM_COLORS; /* And colors... */
tot += NUM_COLORS;
thumbs = (SDL_Surface * *)malloc(sizeof(SDL_Surface *) * tot); thumbs = (SDL_Surface * *)malloc(sizeof(SDL_Surface *) * tot);
d_places = (int *)malloc(sizeof(int) * tot); d_places = (int *)malloc(sizeof(int) * tot);
@ -19106,66 +19155,13 @@ static int do_new_dialog(void)
qsort(fs, num_files_in_dirs, sizeof(struct dirent2), (int (*)(const void *, const void *))compare_dirent2s); qsort(fs, num_files_in_dirs, sizeof(struct dirent2), (int (*)(const void *, const void *))compare_dirent2s);
/* Throw the color palette at the beginning: */ /* Throw the color palette at the beginning (default): */
white_in_palette = -1; white_in_palette = -1;
for (j = -1; j < NUM_COLORS; j++) if (!new_colors_last) {
{ num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
added = 0; }
if (j < NUM_COLORS - 1)
{
if (j == -1 || /* (short circuit) */
color_hexes[j][0] != 255 || /* Ignore white, we'll have already added it */
color_hexes[j][1] != 255 || color_hexes[j][2] != 255)
{
/* Palette colors: */
thumbs[num_files] = SDL_CreateRGBSurface(screen->flags,
THUMB_W - 20, THUMB_H - 20,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask, screen->format->Bmask, 0);
if (thumbs[num_files] != NULL)
{
if (j == -1)
{
r = g = b = 255; /* White */
}
else
{
r = color_hexes[j][0];
g = color_hexes[j][1];
b = color_hexes[j][2];
}
SDL_FillRect(thumbs[num_files], NULL, SDL_MapRGB(thumbs[num_files]->format, r, g, b));
added = 1;
}
}
else
{
white_in_palette = j;
}
}
else
{
/* Color picker: */
thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0);
added = 1;
}
if (added)
{
d_places[num_files] = PLACE_COLOR_PALETTE;
d_names[num_files] = NULL;
d_exts[num_files] = NULL;
num_files++;
}
}
first_starter = num_files; first_starter = num_files;
first_template = -1; /* In case there are none... */ first_template = -1; /* In case there are none... */
@ -19468,10 +19464,15 @@ static int do_new_dialog(void)
} }
} }
/* Throw the color palette at the end (alternative option): */
if (new_colors_last) {
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 were found!\n", num_files); printf("%d files and colors were found!\n", num_files);
#endif #endif
@ -20129,6 +20130,76 @@ static int do_new_dialog(void)
return (which != -1); return (which != -1);
} }
/* Add colors to the "New" dialog's list of choices;
normally appears at the beginning (above Starts & Templates),
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) {
int j;
int added;
Uint8 r, g, b;
for (j = -1; j < NUM_COLORS; j++)
{
added = 0;
if (j < NUM_COLORS - 1)
{
if (j == -1 || /* (short circuit) */
color_hexes[j][0] != 255 || /* Ignore white, we'll have already added it */
color_hexes[j][1] != 255 || color_hexes[j][2] != 255)
{
/* Palette colors: */
thumbs[num_files] = SDL_CreateRGBSurface(screen->flags,
THUMB_W - 20, THUMB_H - 20,
screen->format->BitsPerPixel,
screen->format->Rmask,
screen->format->Gmask, screen->format->Bmask, 0);
if (thumbs[num_files] != NULL)
{
if (j == -1)
{
r = g = b = 255; /* White */
}
else
{
r = color_hexes[j][0];
g = color_hexes[j][1];
b = color_hexes[j][2];
}
SDL_FillRect(thumbs[num_files], NULL, SDL_MapRGB(thumbs[num_files]->format, r, g, b));
added = 1;
}
}
else
{
*white_in_palette = j;
}
}
else
{
/* Color picker: */
thumbs[num_files] = thumbnail(img_color_picker, THUMB_W - 20, THUMB_H - 20, 0);
added = 1;
}
if (added)
{
d_places[num_files] = PLACE_COLOR_PALETTE;
d_names[num_files] = NULL;
d_exts[num_files] = NULL;
num_files++;
}
}
return num_files;
}
/** /**
* FIXME * FIXME
*/ */
@ -22582,7 +22653,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
/* ================================================================================== */ /* ================================================================================== */
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__) #if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
/** /**
* FIXME * FIXME
*/ */
@ -22946,6 +23017,7 @@ static void setup_config(char *argv[])
SETBOOL(keymouse); SETBOOL(keymouse);
SETBOOL(mirrorstamps); SETBOOL(mirrorstamps);
SETBOOL(native_screensize); SETBOOL(native_screensize);
SETBOOL(new_colors_last);
SETBOOL(no_button_distinction); SETBOOL(no_button_distinction);
SETBOOL(no_fancy_cursors); SETBOOL(no_fancy_cursors);
SETBOOL(no_system_fonts); SETBOOL(no_system_fonts);

View file

@ -1,6 +1,6 @@
Summary: A drawing program for young children Summary: A drawing program for young children
Name: tuxpaint Name: tuxpaint
Version: 0.9.23 Version: 0.9.23c
Release: 1 Release: 1
Epoch: 1 Epoch: 1
License: GPL License: GPL