diff --git a/Makefile b/Makefile
index 83e3ea168..dc131750e 100644
--- a/Makefile
+++ b/Makefile
@@ -4,12 +4,12 @@
# Various contributors (see AUTHORS.txt)
# http://www.tuxpaint.org/
-# June 14, 2002 - August 30, 2018
+# June 14, 2002 - December 18, 2018
# The version number, for release:
-VER_VERSION:=0.9.23
+VER_VERSION:=0.9.24
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")
else
@@ -90,7 +90,7 @@ linux_BUNDLE:=
BUNDLE:=$($(OS)_BUNDLE)
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
linux_ARCH_LIBS:=obj/postscript_print.o
ARCH_LIBS:=$($(OS)_ARCH_LIBS)
@@ -116,7 +116,7 @@ FRIBIDI_LIB:=$(shell $(PKG_CONFIG) --libs fribidi)
FRIBIDI_CFLAGS:=$(shell $(PKG_CONFIG) --cflags fribidi)
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)
linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS)
@@ -877,7 +877,7 @@ install-dlls:
@cp `which libgcc_s_dw2-1.dll` $(BIN_PREFIX)
@cp `which libstdc++-6.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 \
cp `which libxml2-2.dll` $(BIN_PREFIX); \
cp `which libcairo-2.dll` $(BIN_PREFIX); \
diff --git a/custom/macos.sh b/custom/macos.sh
index f0e31e915..b0a9325aa 100755
--- a/custom/macos.sh
+++ b/custom/macos.sh
@@ -52,6 +52,21 @@ for i in "$BINARY" $LIBS $LIBDIR/*; do
n=`echo "$j" | sed 's/^[/]opt[/]local[/]/@executable_path\/..\//'`
install_name_tool -change "$j" "$n" "$i"
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
# Some libraries require config files, so copy those...
diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt
index 3e704a12b..e6bef8716 100644
--- a/docs/CHANGES.txt
+++ b/docs/CHANGES.txt
@@ -8,6 +8,50 @@ http://www.tuxpaint.org/
$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
+
+ * Reduce launch time by calling progress bar less frequently
+ while loading stamps.
+ Mark K. Kim
+
+ * 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
+
+ * 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
+
+ * 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)
* New tools
---------
diff --git a/docs/RELEASE.txt b/docs/RELEASE.txt
new file mode 100644
index 000000000..f4ec34219
--- /dev/null
+++ b/docs/RELEASE.txt
@@ -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
+
diff --git a/docs/en/ADVANCED-STAMPS-HOWTO.txt b/docs/en/ADVANCED-STAMPS-HOWTO.txt
index 8759b4233..b5d2e214c 100644
--- a/docs/en/ADVANCED-STAMPS-HOWTO.txt
+++ b/docs/en/ADVANCED-STAMPS-HOWTO.txt
@@ -1,5 +1,5 @@
Tux Paint
- version 0.9.23
+ version 0.9.23c
Advanced Stamps HOWTO
Copyright 2006-2008 by Albert Cahalan for the Tux Paint project
diff --git a/docs/en/EXTENDING.txt b/docs/en/EXTENDING.txt
index 89583194f..dee5cabe1 100644
--- a/docs/en/EXTENDING.txt
+++ b/docs/en/EXTENDING.txt
@@ -1,11 +1,11 @@
Tux Paint
- version 0.9.23
+ version 0.9.23c
Extending Tux Paint
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
- June 14, 2002 - August 28, 2018
+ June 14, 2002 - October 7, 2018
----------------------------------------------------------------------
diff --git a/docs/en/FAQ.txt b/docs/en/FAQ.txt
index 139054267..a0e825557 100644
--- a/docs/en/FAQ.txt
+++ b/docs/en/FAQ.txt
@@ -1,11 +1,11 @@
Tux Paint
- version 0.9.23
+ version 0.9.23c
Frequently Asked Questions
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
- September 14, 2002 - August 28, 2018
+ September 14, 2002 - October 7, 2018
Drawing-related
diff --git a/docs/en/INSTALL.txt b/docs/en/INSTALL.txt
index e17d16d7d..055b15407 100644
--- a/docs/en/INSTALL.txt
+++ b/docs/en/INSTALL.txt
@@ -6,7 +6,7 @@ Copyright (c) 2002-2018
Various contributors (see below, and AUTHORS.txt)
http://www.tuxpaint.org/
-June 27, 2002 - August 19, 2018
+June 27, 2002 - December 8, 2018
$Id$
@@ -175,7 +175,7 @@ Compiling and Installation:
upon. John Popplewell put together some instructions for doing that
here:
- http://johnnypops.demon.co.uk/mingw/index.html
+ http://www.johnnypops.co.uk/tuxpaint/
Read the relevant notes if building for Win9X/ME.
@@ -367,6 +367,13 @@ Compiling and Installation:
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:
-----------------------
Windows
diff --git a/docs/en/OPTIONS.txt b/docs/en/OPTIONS.txt
index dbfe55d72..88f707e7b 100644
--- a/docs/en/OPTIONS.txt
+++ b/docs/en/OPTIONS.txt
@@ -1,12 +1,12 @@
Tux Paint
- version 0.9.23
+ version 0.9.24
Options Documentation
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
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
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
For stamps that can be mirrored, this option sets them to
@@ -980,6 +984,7 @@ Windows Users
--nostampcontrols
--nomagiccontrols
--nolabel
+ --newcolorslast
--mouse-accessibility
--onscreen-keyboard
--onscreen-keyboard-layout
@@ -1050,6 +1055,7 @@ Windows Users
--stampcontrols
--magiccontrols
--label
+ --newcolorsfirst
--nosysfonts
--currentlocalefont
--dontmirrorstamps
diff --git a/docs/en/README.txt b/docs/en/README.txt
index a6b42241d..ae4278609 100644
--- a/docs/en/README.txt
+++ b/docs/en/README.txt
@@ -1,12 +1,12 @@
Tux Paint
- version 0.9.23
+ version 0.9.24
A simple drawing program for children
Copyright 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
- June 14, 2002 - August 28, 2018
+ June 14, 2002 - December 18, 2018
----------------------------------------------------------------------
diff --git a/docs/en/html/ADVANCED-STAMPS-HOWTO.html b/docs/en/html/ADVANCED-STAMPS-HOWTO.html
index 6c278d4ba..8caa9cd17 100644
--- a/docs/en/html/ADVANCED-STAMPS-HOWTO.html
+++ b/docs/en/html/ADVANCED-STAMPS-HOWTO.html
@@ -11,7 +11,7 @@ alink="#FF00FF">
alt="Tux Paint">
version
-0.9.23
+0.9.23c
Advanced Stamps HOWTO
diff --git a/docs/en/html/EXTENDING.html b/docs/en/html/EXTENDING.html
index 775e092bb..3e661142a 100644
--- a/docs/en/html/EXTENDING.html
+++ b/docs/en/html/EXTENDING.html
@@ -12,7 +12,7 @@ alt="Tux Paint">
version
-0.9.23
+0.9.23c
Extending Tux Paint
@@ -20,7 +20,7 @@ Extending Tux Paint
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
-June 14, 2002 - August 28, 2018
+June 14, 2002 - October 7, 2018
diff --git a/docs/en/html/FAQ.html b/docs/en/html/FAQ.html
index d78d8516c..f9df6ef88 100644
--- a/docs/en/html/FAQ.html
+++ b/docs/en/html/FAQ.html
@@ -11,7 +11,7 @@ alink="#FF00FF">
alt="Tux Paint">
version
-0.9.23
+0.9.23c
Frequently Asked Questions
@@ -19,7 +19,7 @@ Frequently Asked Questions
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
-September 14, 2002 - August 28, 2018
+September 14, 2002 - October 7, 2018
Drawing-related
diff --git a/docs/en/html/OPTIONS.html b/docs/en/html/OPTIONS.html
index 6a2266a5b..2937ad71c 100644
--- a/docs/en/html/OPTIONS.html
+++ b/docs/en/html/OPTIONS.html
@@ -11,7 +11,7 @@ alink="#FF00FF">
version
-0.9.23
+0.9.24
Options Documentation
@@ -19,7 +19,7 @@ version
Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/
-August 28, 2018
+December 18, 2018
@@ -465,6 +465,12 @@ version
which 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
For stamps that can be mirrored, this option sets them to their
@@ -1545,6 +1551,7 @@ version
--nostampcontrols
--nomagiccontrols
--nolabel
+ --newcolorslast
--mouse-accessibility
--onscreen-keyboard
--onscreen-keyboard-layout
@@ -1618,6 +1625,7 @@ version
--stampcontrols
--magiccontrols
--label
+ --newcolorsfirst
--nosysfonts
--currentlocalefont
--dontmirrorstamps
diff --git a/docs/en/html/README.html b/docs/en/html/README.html
index 1b85c9eab..5e09968cc 100644
--- a/docs/en/html/README.html
+++ b/docs/en/html/README.html
@@ -12,7 +12,7 @@ alt="Tux Paint">
version
-0.9.23
+0.9.24
A simple drawing program for children
@@ -22,7 +22,7 @@ version
June 14, 2002 -
- August 28, 2018
+ December 18, 2018
diff --git a/macos/Info.plist b/macos/Info.plist
index c6b496330..9deb9ab58 100644
--- a/macos/Info.plist
+++ b/macos/Info.plist
@@ -7,7 +7,7 @@
CFBundleExecutable
tuxpaint
CFBundleGetInfoString
- 0.9.23, Copyright 2009-2018, Tux Paint Development Team
+ 0.9.23c, Copyright 2009-2018, Tux Paint Development Team
CFBundleIconFile
tuxpaint.icns
CFBundleIdentifier
@@ -19,10 +19,10 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 0.9.23
+ 0.9.23c
CFBundleSignature
TXPT
CFBundleVersion
- 2018-09-01
+ 2018-10-07
diff --git a/src/debug.h b/src/debug.h
index 9edd5945a..7a31a7319 100644
--- a/src/debug.h
+++ b/src/debug.h
@@ -1,4 +1,49 @@
#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
+#include
+
+#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__
#include
diff --git a/src/macos_print.h b/src/macos_print.h
new file mode 100644
index 000000000..7c0a2aaaa
--- /dev/null
+++ b/src/macos_print.h
@@ -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 */
diff --git a/src/macos_print.m b/src/macos_print.m
new file mode 100644
index 000000000..9038ea76c
--- /dev/null
+++ b/src/macos_print.m
@@ -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
+
+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;
+}
+
diff --git a/src/manpage/tuxpaint.1 b/src/manpage/tuxpaint.1
index 4d53d2847..6c1df5f09 100644
--- a/src/manpage/tuxpaint.1
+++ b/src/manpage/tuxpaint.1
@@ -1,5 +1,5 @@
-.\" tuxpaint.1 - 2018.08.19
-.TH TUXPAINT 1 "19 August 2018" "0.9.23" "Tux Paint"
+.\" tuxpaint.1 - 2018.09.24
+.TH TUXPAINT 1 "24 September 2018" "0.9.23c" "Tux Paint"
.SH NAME
tuxpaint -- "Tux Paint", a drawing program for young children.
diff --git a/src/parse.gperf b/src/parse.gperf
index 1e7c7151b..25b4fb014 100644
--- a/src/parse.gperf
+++ b/src/parse.gperf
@@ -123,6 +123,8 @@ mirrorstamps, POSBOOL(mirrorstamps)
mixedcase, NEGBOOL(only_uppercase)
mouse, NEGBOOL(keymouse)
native, POSBOOL(native_screensize)
+newcolorsfirst, NEGBOOL(new_colors_last)
+newcolorslast, POSBOOL(new_colors_last)
orient, MULTI(rotate_orientation)
outlines, NEGBOOL(dont_do_xor)
papersize, MULTI(papersize)
diff --git a/src/parse.h b/src/parse.h
index fd124f991..65e58b073 100644
--- a/src/parse.h
+++ b/src/parse.h
@@ -28,6 +28,7 @@ struct cfginfo
const char *keymouse;
const char *mirrorstamps;
const char *native_screensize;
+ const char *new_colors_last;
const char *no_button_distinction;
const char *no_fancy_cursors;
const char *no_system_fonts;
diff --git a/src/tuxpaint-completion.bash b/src/tuxpaint-completion.bash
index 14405aabe..63c7511b4 100644
--- a/src/tuxpaint-completion.bash
+++ b/src/tuxpaint-completion.bash
@@ -8,6 +8,8 @@
# FIXME: See http://www.debian-administration.org/articles/316 for an intro
# 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 &&
_tuxpaint()
{
@@ -41,6 +43,7 @@ _tuxpaint()
--nobuttondistinction --buttondistinction \
--outlines --nooutlines \
--stamps --nostamps \
+ --newcolorsfirst --newcolorslast \
--sysfonts --nosysfonts \
--nostampcontrols --stampcontrols \
--nomagiccontrols --magiccontrols \
diff --git a/src/tuxpaint.c b/src/tuxpaint.c
index 082c74c48..09b2f28af 100644
--- a/src/tuxpaint.c
+++ b/src/tuxpaint.c
@@ -22,7 +22,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
- June 14, 2002 - August 28, 2018
+ June 14, 2002 - December 18, 2018
*/
@@ -302,6 +302,17 @@ typedef struct safer_dirent
#else /* __BEOS__ */
+/* Not BeOS */
+
+#ifdef __APPLE__
+
+/* Apple */
+
+#include "macos_print.h"
+
+#else /* __APPLE__ */
+
+/* Not Windows, not BeOS, not Apple */
#ifdef __ANDROID__
#define AUTOSAVE_GOING_BACKGROUND
@@ -310,12 +321,14 @@ typedef struct safer_dirent
#else
-/* Not Windows, not BeOS, not Android */
+/* Not Windows, not BeOS, not Apple, not Android*/
#include "postscript_print.h"
#endif /* __ANDROID__ */
+#endif /* __APPLE__ */
+
#endif /* __BEOS__ */
#else /* WIN32 */
@@ -1280,6 +1293,7 @@ static int dont_load_stamps;
static int mirrorstamps;
static int disable_stamp_controls;
static int stamp_size_override = -1;
+static int new_colors_last;
#ifdef NOKIA_770
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 */
-#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
+#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) && !defined(__ANDROID__)
#include
#if !defined(PAPER_H)
#error "---------------------------------------------------"
@@ -2046,6 +2060,7 @@ static void get_new_file_id(void);
static int do_quit(int tool);
static int do_open(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_sel(void);
static int do_slideshow(void);
@@ -2716,6 +2731,14 @@ static void mainloop(void)
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)
{
/* Ctrl-P - Print */
@@ -6648,80 +6671,92 @@ void show_version(int details)
void show_usage(int exitcode)
{
FILE *f = exitcode ? stderr : stdout;
- char *blank;
- unsigned i;
-
- blank = strdup(progname);
-
- for (i = 0; i < strlen(blank); i++)
- blank[i] = ' ';
fprintf(f,
"\n"
"Usage: %s {--usage | --help | --version | --verbose-version | --copying}\n"
"\n"
- " %s [--windowed | --fullscreen]\n"
- " %s [--WIDTHxHEIGHT | --native]\n"
- " %s [--disablescreensaver | --allowscreensaver ]\n"
- " %s [--orient=landscape | --orient=portrait]\n"
- " %s [--startblank | --startlast]\n"
- " %s [--sound | --nosound]\n"
- " %s [--quit | --noquit]\n"
- " %s [--print | --noprint]\n"
- " %s [--complexshapes | --simpleshapes]\n"
- " %s [--mixedcase | --uppercase]\n"
- " %s [--fancycursors | --nofancycursors]\n"
- " %s [--hidecursor | --showcursor]\n"
- " %s [--mouse | --keyboard]\n"
- " %s [--dontgrab | --grab]\n"
- " %s [--noshortcuts | --shortcuts]\n"
- " %s [--wheelmouse | --nowheelmouse]\n"
- " %s [--nobuttondistinction | --buttondistinction]\n"
- " %s [--outlines | --nooutlines]\n"
- " %s [--stamps | --nostamps]\n"
- " %s [--sysfonts | --nosysfonts]\n"
- " %s [--nostampcontrols | --stampcontrols]\n"
- " %s [--nomagiccontrols | --magiccontrols]\n"
- " %s [--nolabel | --label]\n"
- " %s [--mirrorstamps | --dontmirrorstamps]\n"
- " %s [--stampsize=[0-10] | --stampsize=default]\n"
- " %s [--saveoverask | --saveover | --saveovernew]\n"
- " %s [--nosave | --save]\n"
- " %s [--autosave | --noautosave]\n" " %s [--savedir DIRECTORY]\n" " %s [--datadir DIRECTORY]\n"
+ " Config:\n"
+ " [--nosysconfig]\n"
+ "\n"
+ " Video/Sound:\n"
+ " [--windowed | --fullscreen]\n"
+ " [--WIDTHxHEIGHT | --native]\n"
+ " [--orient=landscape | --orient=portrait]\n"
+ " [--disablescreensaver | --allowscreensaver ]\n"
+ " [--sound | --nosound]\n"
+ " [--colorfile FILE]\n"
+ "\n"
+ " Mouse/Keyboard:\n"
+ " [--fancycursors | --nofancycursors]\n"
+ " [--hidecursor | --showcursor]\n"
+ " [--noshortcuts | --shortcuts]\n"
+ " [--dontgrab | --grab]\n"
+ " [--wheelmouse | --nowheelmouse]\n"
+ " [--nobuttondistinction | --buttondistinction]\n"
+ "\n"
+ " Simplification:\n"
+ " [--complexshapes | --simpleshapes]\n"
+ " [--outlines | --nooutlines]\n"
+ " [--mixedcase | --uppercase]\n"
+ " [--stampsize=[0-10] | --stampsize=default]\n"
+ " [--quit | --noquit]\n"
+ " [--stamps | --nostamps]\n"
+ " [--nostampcontrols | --stampcontrols]\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__)
- " %s [--printcfg | --noprintcfg]\n"
+ " [--printcfg | --noprintcfg]\n"
#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;
#ifdef DEBUG
/* FIXME: Stderr instead of stdout? */
- printf("loadstamp_callback: %s\n", dir);
+ printf("loadstamp_callback (%d): %s\n", i, dir);
#endif
if (num_stamps[stamp_group] > 0)
@@ -7738,7 +7773,6 @@ static void loadstamp_callback(SDL_Surface * screen,
/* Sort and iterate the file list: */
-
qsort(files, i, sizeof *files, compare_ftw_str);
while (i--)
{
@@ -7784,7 +7818,11 @@ static void loadstamp_callback(SDL_Surface * screen,
}
#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)
&& (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(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;
FILE *pi;
@@ -16738,6 +16776,17 @@ void do_print(void)
/* BeOS */
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__)
@@ -18969,8 +19018,6 @@ static int do_new_dialog(void)
int places_to_look;
int tot;
int first_starter, first_template;
- int added;
- Uint8 r, g, b;
int white_in_palette;
int val_x, val_y, motioner;
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: */
+ 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);
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);
- /* Throw the color palette at the beginning: */
+ /* Throw the color palette at the beginning (default): */
white_in_palette = -1;
- 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++;
- }
- }
+ if (!new_colors_last) {
+ num_files = do_new_dialog_add_colors(thumbs, num_files, d_places, d_names, d_exts, &white_in_palette);
+ }
first_starter = num_files;
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
- printf("%d files were found!\n", num_files);
+ printf("%d files and colors were found!\n", num_files);
#endif
@@ -20129,6 +20130,76 @@ static int do_new_dialog(void)
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
*/
@@ -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
*/
@@ -22946,6 +23017,7 @@ static void setup_config(char *argv[])
SETBOOL(keymouse);
SETBOOL(mirrorstamps);
SETBOOL(native_screensize);
+ SETBOOL(new_colors_last);
SETBOOL(no_button_distinction);
SETBOOL(no_fancy_cursors);
SETBOOL(no_system_fonts);
diff --git a/tuxpaint.spec b/tuxpaint.spec
index 17b4cfa6b..5905bd327 100644
--- a/tuxpaint.spec
+++ b/tuxpaint.spec
@@ -1,6 +1,6 @@
Summary: A drawing program for young children
Name: tuxpaint
-Version: 0.9.23
+Version: 0.9.23c
Release: 1
Epoch: 1
License: GPL