From ce47eb4c28d696d950d335b70c5d53c54f9f941f Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sun, 2 Sep 2018 10:29:33 -0700 Subject: [PATCH 01/13] Doc'ing everywhere to fiddle w/ version # I forgot to make sure macos/Info.plist had the latest version # and release date, before tagging and releasing source code. Adding a checklist of places to double-check for properly-updated version #s and/or release dates. --- docs/RELEASE.txt | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 docs/RELEASE.txt 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 + From 1588c20b5b4b58dfeb4dda2e0457631e8f2fa74f Mon Sep 17 00:00:00 2001 From: dolphin6k Date: Sat, 15 Sep 2018 22:49:17 +0900 Subject: [PATCH 02/13] reverted to previous build environment. --- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Makefile b/Makefile index c1dc400ac..1277eb1b1 100644 --- a/Makefile +++ b/Makefile @@ -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); \ From c2be35f1bf54f0dee86897bd42c035a735ca99cc Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Sun, 23 Sep 2018 21:35:31 -0400 Subject: [PATCH 03/13] Verbose logging. Verbose logging adds metadata about when it is called and from where to every printf call. Enable it by uncommenting both DEBUG and VERBOSE defined constants in debug.h. --- src/debug.h | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/src/debug.h b/src/debug.h index 9c5ec37b3..5d5f62a5b 100644 --- a/src/debug.h +++ b/src/debug.h @@ -1 +1,19 @@ /* #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, %d @ %s", __FILE__, __LINE__, ctime(&now)); \ + printf(args); \ +} while(0) +#endif From 8d9e187cc9320666848463cb89d3fc5cfda90ab3 Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Mon, 24 Sep 2018 23:00:04 -0400 Subject: [PATCH 04/13] More debugging features, performance and macOS update. Added function name to the output of verbose logging. Verbose logging is the feature introduced in the previous git commit where a call to printf() automatically adds the source filename and line from where the printf() is called, and the runtime timestamp at which the call was made. Now this feature adds the functio name from which the printf() is called. This feature is enabled if and only if both DEBUG and VERBOSE are defined in debug.h and the source is compiled with GCC. Added a new macro DEBUG_PRINTF() that expands to printf() if and only if DEBUG is defined in debug.h. This feature works with verbose logging if VERBOSE is also defined and the source is compiled with GCC. Reduced the launch time. A user reported an issue with Tux Paint taking 7 minutes to launch; an investigation showed that launching Tux Paint with all stamps and the screen width set wide (~1500 pixels) can cause the slowdown during the progress bar drawing sequence because progress bar takes a long time to draw on screens with a wide screen, and it is called ~10 thousand times during the stamp loading process. The issue has been addressed by calling the progress bar less frequently. Updated the macOS build version and date, under which these features were tested. --- macos/Info.plist | 6 +++--- src/debug.h | 29 ++++++++++++++++++++++++++++- src/tuxpaint.c | 9 ++++++--- 3 files changed, 37 insertions(+), 7 deletions(-) diff --git a/macos/Info.plist b/macos/Info.plist index c6b496330..dcff783b5 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.23a, Copyright 2009-2018, Tux Paint Development Team CFBundleIconFile tuxpaint.icns CFBundleIdentifier @@ -19,10 +19,10 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.23 + 0.9.23a CFBundleSignature TXPT CFBundleVersion - 2018-09-01 + 2018-09-24 diff --git a/src/debug.h b/src/debug.h index 5d5f62a5b..6b90f5637 100644 --- a/src/debug.h +++ b/src/debug.h @@ -13,7 +13,34 @@ #define printf(args...) do { \ time_t now = time(NULL); \ - printf("\n### %s, %d @ %s", __FILE__, __LINE__, ctime(&now)); \ + 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 + diff --git a/src/tuxpaint.c b/src/tuxpaint.c index fd64d88ba..d0129e1a8 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -7419,7 +7419,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) @@ -7459,7 +7459,6 @@ static void loadstamp_callback(SDL_Surface * screen, /* Sort and iterate the file list: */ - qsort(files, i, sizeof *files, compare_ftw_str); while (i--) { @@ -7505,7 +7504,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)) From 33de9841c00ad696c0a2e7de2188eeceac27ef03 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Mon, 24 Sep 2018 22:15:38 -0700 Subject: [PATCH 05/13] 0.9.23a; doc: less hungry progress, verbose debug Documenting Mark Kim's recent changes: * Less CPU-hungry progress bar (during Stamp loading) * Verbose debugging options * (Also, mentioned debugging _at all_, in INSTALL.txt) Bumping version to 0.9.23a, to match the test build he's working on for macOS. --- Makefile | 4 ++-- docs/CHANGES.txt | 13 +++++++++++++ docs/en/ADVANCED-STAMPS-HOWTO.txt | 2 +- docs/en/EXTENDING.txt | 4 ++-- docs/en/FAQ.txt | 4 ++-- docs/en/INSTALL.txt | 9 ++++++++- docs/en/OPTIONS.txt | 4 ++-- docs/en/README.txt | 4 ++-- docs/en/html/ADVANCED-STAMPS-HOWTO.html | 2 +- docs/en/html/EXTENDING.html | 4 ++-- docs/en/html/FAQ.html | 4 ++-- docs/en/html/OPTIONS.html | 4 ++-- docs/en/html/README.html | 4 ++-- src/manpage/tuxpaint.1 | 4 ++-- tuxpaint.spec | 2 +- 15 files changed, 44 insertions(+), 24 deletions(-) diff --git a/Makefile b/Makefile index 1277eb1b1..c13a6da20 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 - September 24, 2018 # The version number, for release: -VER_VERSION:=0.9.23 +VER_VERSION:=0.9.23a 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 diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 5f5aef5f2..46a00ce40 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,6 +8,19 @@ http://www.tuxpaint.org/ $Id$ +2018.Sept.24 (0.9.23a) + * Bug Fixes + --------- + * Reduce launch time by calling progress bar less frequently + while loading stamps. + Mark K. Kim + + * Misc + ---- + * Verbose debugging, and "DEBUG_PRINTF()" macro now available; + see debugging options in INSTALL.txt. + Mark K. Kim + 2018.August.30 (0.9.23) * New tools --------- diff --git a/docs/en/ADVANCED-STAMPS-HOWTO.txt b/docs/en/ADVANCED-STAMPS-HOWTO.txt index 8759b4233..621ec2b8f 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.23a 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..89c0524bb 100644 --- a/docs/en/EXTENDING.txt +++ b/docs/en/EXTENDING.txt @@ -1,11 +1,11 @@ Tux Paint - version 0.9.23 + version 0.9.23a 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 - September 24, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/FAQ.txt b/docs/en/FAQ.txt index 139054267..45ac25c44 100644 --- a/docs/en/FAQ.txt +++ b/docs/en/FAQ.txt @@ -1,11 +1,11 @@ Tux Paint - version 0.9.23 + version 0.9.23a 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 - September 24, 2018 Drawing-related diff --git a/docs/en/INSTALL.txt b/docs/en/INSTALL.txt index e17d16d7d..3f1ffc374 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 - September 24, 2018 $Id$ @@ -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..07d1941f4 100644 --- a/docs/en/OPTIONS.txt +++ b/docs/en/OPTIONS.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23 + version 0.9.23a Options Documentation Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - August 28, 2018 + September 24, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/README.txt b/docs/en/README.txt index a6b42241d..48c96907c 100644 --- a/docs/en/README.txt +++ b/docs/en/README.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23 + version 0.9.23a 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 - September 24, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/html/ADVANCED-STAMPS-HOWTO.html b/docs/en/html/ADVANCED-STAMPS-HOWTO.html index 6c278d4ba..18c7cef00 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.23a
Advanced Stamps HOWTO diff --git a/docs/en/html/EXTENDING.html b/docs/en/html/EXTENDING.html index 775e092bb..c0cde1576 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.23a
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 - September 24, 2018


diff --git a/docs/en/html/FAQ.html b/docs/en/html/FAQ.html index d78d8516c..c61b9d8c9 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.23a
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 - September 24, 2018

Drawing-related

diff --git a/docs/en/html/OPTIONS.html b/docs/en/html/OPTIONS.html index 18e5bc14b..2df889111 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.23a

Options Documentation

@@ -19,7 +19,7 @@ version

Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/

-

August 28, 2018

+

September 24, 2018

diff --git a/docs/en/html/README.html b/docs/en/html/README.html index 1b85c9eab..457c8a53a 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.23a

A simple drawing program for children

@@ -22,7 +22,7 @@ version

June 14, 2002 - - August 28, 2018

+ September 24, 2018

diff --git a/src/manpage/tuxpaint.1 b/src/manpage/tuxpaint.1 index 4d53d2847..4c6bd06cf 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.23a" "Tux Paint" .SH NAME tuxpaint -- "Tux Paint", a drawing program for young children. diff --git a/tuxpaint.spec b/tuxpaint.spec index 17b4cfa6b..7bfcd58e5 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.23a Release: 1 Epoch: 1 License: GPL From be99eb3844cb3a17a7b130ba6b7331e3ea25dd48 Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Fri, 28 Sep 2018 23:24:56 -0400 Subject: [PATCH 06/13] Re-add print dialog access to macOS. 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. --- Makefile | 4 +- macos/Info.plist | 6 +- src/macos_print.h | 40 ++++++ src/macos_print.m | 330 ++++++++++++++++++++++++++++++++++++++++++++++ src/tuxpaint.c | 40 +++++- 5 files changed, 411 insertions(+), 9 deletions(-) create mode 100644 src/macos_print.h create mode 100644 src/macos_print.m diff --git a/Makefile b/Makefile index c13a6da20..70699ec30 100644 --- a/Makefile +++ b/Makefile @@ -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) diff --git a/macos/Info.plist b/macos/Info.plist index dcff783b5..270977726 100644 --- a/macos/Info.plist +++ b/macos/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable tuxpaint CFBundleGetInfoString - 0.9.23a, Copyright 2009-2018, Tux Paint Development Team + 0.9.23b, Copyright 2009-2018, Tux Paint Development Team CFBundleIconFile tuxpaint.icns CFBundleIdentifier @@ -19,10 +19,10 @@ CFBundlePackageType APPL CFBundleShortVersionString - 0.9.23a + 0.9.23b CFBundleSignature TXPT CFBundleVersion - 2018-09-24 + 2018-09-28 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/tuxpaint.c b/src/tuxpaint.c index d0129e1a8..43b85de6f 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -298,10 +298,22 @@ typedef struct safer_dirent #else /* __BEOS__ */ -/* Not Windows, not BeOS */ +/* Not BeOS */ + +#ifdef __APPLE__ + +/* Apple */ + +#include "macos_print.h" + +#else /* __APPLE__ */ + +/* Not Windows, not BeOS, not Apple */ #include "postscript_print.h" +#endif /* __APPLE__ */ + #endif /* __BEOS__ */ #else /* WIN32 */ @@ -1356,7 +1368,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__) +#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) #include #if !defined(PAPER_H) #error "---------------------------------------------------" @@ -2555,6 +2567,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 */ @@ -16293,7 +16313,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__) +#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__) const char *pcmd; FILE *pi; @@ -16345,6 +16365,18 @@ 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); + } + #endif #endif @@ -22100,7 +22132,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf) /* ================================================================================== */ -#if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__) +#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) /** * FIXME */ From 81ff7d3ae0f756e67897894ed6884bac97b4853f Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sun, 30 Sep 2018 19:55:43 -0700 Subject: [PATCH 07/13] Doc'ing return of Mac print dialog (See recent commit by Mark) --- docs/CHANGES.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 46a00ce40..cb19354f7 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,13 +8,19 @@ http://www.tuxpaint.org/ $Id$ -2018.Sept.24 (0.9.23a) +2018.Sept.30 (0.9.23a) * Bug Fixes --------- * 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 + * Misc ---- * Verbose debugging, and "DEBUG_PRINTF()" macro now available; From d2ef2e17d1962111d0f6f91394dce81e8706d48b Mon Sep 17 00:00:00 2001 From: Mark Kim Date: Sun, 7 Oct 2018 17:48:41 -0400 Subject: [PATCH 08/13] macOS 10.7 compatibility It's been reported that the latest version of Tux Paint does not run on macOS 10.7 (Lion). This change fixes the issue. BACKGROUND A user has reported Tux Paint 0.9.23 does not run on macOS 10.7. She also identified that the issue is due to a system library required by Tux Paint, /System/Library/Frameworks/CoreGraphics.framework does not exist on macOS 10.7 Some investigation revealed that CoreGraphics.framework is a library required by libSDL, and it exists under an alternate path in macOS 10.7, underneath /System/Library/Frameworks/ApplicationServices.framework/Frameworks/. CoreGraphics.framework also exists underneath this path in newer version of macOS as a symlink to the real directory as well, so the issue can be fixed by simply relinking SDL to use the old (compatible) path instead of the new (default) path to CoreGraphics.framework. This change adds the code such that, during the `make install` step to create TuxPaint.app, any library referencing CoreGraphics.framework is re-linked to the compatible path rather than the path that only exists on the newer version of macOS. For more information, see: https://stackoverflow.com/questions/20206985/xcode-linking-against-applicationservices-framework-with-sdk-10-9-causes-10-7 --- Makefile | 2 +- custom/macos.sh | 15 +++++++++++++++ macos/Info.plist | 6 +++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/Makefile b/Makefile index 70699ec30..c08be9e9e 100644 --- a/Makefile +++ b/Makefile @@ -9,7 +9,7 @@ # The version number, for release: -VER_VERSION:=0.9.23a +VER_VERSION:=0.9.23c 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 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/macos/Info.plist b/macos/Info.plist index 270977726..9deb9ab58 100644 --- a/macos/Info.plist +++ b/macos/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable tuxpaint CFBundleGetInfoString - 0.9.23b, 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.23b + 0.9.23c CFBundleSignature TXPT CFBundleVersion - 2018-09-28 + 2018-10-07 From b18911ea4a45cba617384a001c33c7eec64c27a8 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sun, 7 Oct 2018 15:53:48 -0700 Subject: [PATCH 09/13] Doc Mac OS X 10.7 fix; update docs to new vers. # Document Mark Kim's Mac OS X 10.7 fix. Update docs to new version number (0.9.23c). --- docs/CHANGES.txt | 12 +++++++++++- docs/en/ADVANCED-STAMPS-HOWTO.txt | 2 +- docs/en/EXTENDING.txt | 4 ++-- docs/en/FAQ.txt | 4 ++-- docs/en/OPTIONS.txt | 4 ++-- docs/en/README.txt | 4 ++-- docs/en/html/ADVANCED-STAMPS-HOWTO.html | 2 +- docs/en/html/EXTENDING.html | 4 ++-- docs/en/html/FAQ.html | 4 ++-- docs/en/html/OPTIONS.html | 4 ++-- docs/en/html/README.html | 4 ++-- src/manpage/tuxpaint.1 | 2 +- tuxpaint.spec | 2 +- 13 files changed, 31 insertions(+), 21 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index cb19354f7..8d23b77f9 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,9 +8,14 @@ http://www.tuxpaint.org/ $Id$ -2018.Sept.30 (0.9.23a) +2018.Oct.7 (0.9.23c) * 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 @@ -27,6 +32,11 @@ $Id$ 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/en/ADVANCED-STAMPS-HOWTO.txt b/docs/en/ADVANCED-STAMPS-HOWTO.txt index 621ec2b8f..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.23a + 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 89c0524bb..dee5cabe1 100644 --- a/docs/en/EXTENDING.txt +++ b/docs/en/EXTENDING.txt @@ -1,11 +1,11 @@ Tux Paint - version 0.9.23a + version 0.9.23c Extending Tux Paint Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - June 14, 2002 - September 24, 2018 + June 14, 2002 - October 7, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/FAQ.txt b/docs/en/FAQ.txt index 45ac25c44..a0e825557 100644 --- a/docs/en/FAQ.txt +++ b/docs/en/FAQ.txt @@ -1,11 +1,11 @@ Tux Paint - version 0.9.23a + version 0.9.23c Frequently Asked Questions Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - September 14, 2002 - September 24, 2018 + September 14, 2002 - October 7, 2018 Drawing-related diff --git a/docs/en/OPTIONS.txt b/docs/en/OPTIONS.txt index 07d1941f4..e48f4eb71 100644 --- a/docs/en/OPTIONS.txt +++ b/docs/en/OPTIONS.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23a + version 0.9.23c Options Documentation Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - September 24, 2018 + October 7, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/README.txt b/docs/en/README.txt index 48c96907c..535a93885 100644 --- a/docs/en/README.txt +++ b/docs/en/README.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23a + version 0.9.23c A simple drawing program for children Copyright 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - June 14, 2002 - September 24, 2018 + June 14, 2002 - October 7, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/html/ADVANCED-STAMPS-HOWTO.html b/docs/en/html/ADVANCED-STAMPS-HOWTO.html index 18c7cef00..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.23a +0.9.23c
Advanced Stamps HOWTO diff --git a/docs/en/html/EXTENDING.html b/docs/en/html/EXTENDING.html index c0cde1576..3e661142a 100644 --- a/docs/en/html/EXTENDING.html +++ b/docs/en/html/EXTENDING.html @@ -12,7 +12,7 @@ alt="Tux Paint">
version -0.9.23a +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 - September 24, 2018

+

June 14, 2002 - October 7, 2018


diff --git a/docs/en/html/FAQ.html b/docs/en/html/FAQ.html index c61b9d8c9..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.23a +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 - September 24, 2018

+

September 14, 2002 - October 7, 2018

Drawing-related

diff --git a/docs/en/html/OPTIONS.html b/docs/en/html/OPTIONS.html index 2df889111..ab1356cd7 100644 --- a/docs/en/html/OPTIONS.html +++ b/docs/en/html/OPTIONS.html @@ -11,7 +11,7 @@ alink="#FF00FF"> version -0.9.23a +0.9.23c

Options Documentation

@@ -19,7 +19,7 @@ version

Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/

-

September 24, 2018

+

October 7, 2018

diff --git a/docs/en/html/README.html b/docs/en/html/README.html index 457c8a53a..f22e38cd6 100644 --- a/docs/en/html/README.html +++ b/docs/en/html/README.html @@ -12,7 +12,7 @@ alt="Tux Paint">
version -0.9.23a +0.9.23c

A simple drawing program for children

@@ -22,7 +22,7 @@ version

June 14, 2002 - - September 24, 2018

+ October 7, 2018

diff --git a/src/manpage/tuxpaint.1 b/src/manpage/tuxpaint.1 index 4c6bd06cf..6c1df5f09 100644 --- a/src/manpage/tuxpaint.1 +++ b/src/manpage/tuxpaint.1 @@ -1,5 +1,5 @@ .\" tuxpaint.1 - 2018.09.24 -.TH TUXPAINT 1 "24 September 2018" "0.9.23a" "Tux Paint" +.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/tuxpaint.spec b/tuxpaint.spec index 7bfcd58e5..5905bd327 100644 --- a/tuxpaint.spec +++ b/tuxpaint.spec @@ -1,6 +1,6 @@ Summary: A drawing program for young children Name: tuxpaint -Version: 0.9.23a +Version: 0.9.23c Release: 1 Epoch: 1 License: GPL From 32cf7679a92e05201f975d25e47ebdfefbd4d8d2 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Sat, 8 Dec 2018 10:32:47 -0800 Subject: [PATCH 10/13] Updated link to MinGW/MSYS docs They're in a new location over on John P.'s website (should we purhapse integrate them into Tux Paint proper?) (h/t sechidis & whoever on #tux4kids IRC channel who helped them) --- docs/CHANGES.txt | 5 +++++ docs/en/INSTALL.txt | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 8d23b77f9..4d579060e 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -26,6 +26,11 @@ $Id$ or configure Tux Paint to always bring up the dialog upon print. Mark K. Kim + * Documentation updates + --------------------- + * Mended link to MinGW/MSYS instructions at John Popplewell's website. + (h/t "sechidis") + * Misc ---- * Verbose debugging, and "DEBUG_PRINTF()" macro now available; diff --git a/docs/en/INSTALL.txt b/docs/en/INSTALL.txt index 3f1ffc374..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 - September 24, 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. From 268e213e6dac8f93afa4fdcae22458d073f18131 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 18 Dec 2018 21:56:05 -0800 Subject: [PATCH 11/13] Bump to 0.9.24; improve usage output Bumping to 0.9.24; going to add a new feature momentarily. Improved usage output (e.g., that of "tuxpaint --help"); broke the options into groups that match the tabs in Tux Paint Config., added some missing options. --- Makefile | 4 +- docs/CHANGES.txt | 4 +- docs/en/README.txt | 4 +- docs/en/html/README.html | 4 +- src/tuxpaint.c | 139 +++++++++++++++++++++------------------ 5 files changed, 84 insertions(+), 71 deletions(-) diff --git a/Makefile b/Makefile index c08be9e9e..e3fc13b3e 100644 --- a/Makefile +++ b/Makefile @@ -4,12 +4,12 @@ # Various contributors (see AUTHORS.txt) # http://www.tuxpaint.org/ -# June 14, 2002 - September 24, 2018 +# June 14, 2002 - December 18, 2018 # The version number, for release: -VER_VERSION:=0.9.23c +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 diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index 4d579060e..be38d57ed 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -8,7 +8,7 @@ http://www.tuxpaint.org/ $Id$ -2018.Oct.7 (0.9.23c) +2018.Dec.18 (0.9.24) * Bug Fixes --------- * Correct issue that prevented Tux Paint from lauching on Mac OS X 10.7. @@ -31,6 +31,8 @@ $Id$ * 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; diff --git a/docs/en/README.txt b/docs/en/README.txt index 535a93885..ae4278609 100644 --- a/docs/en/README.txt +++ b/docs/en/README.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23c + 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 - October 7, 2018 + June 14, 2002 - December 18, 2018 ---------------------------------------------------------------------- diff --git a/docs/en/html/README.html b/docs/en/html/README.html index f22e38cd6..5e09968cc 100644 --- a/docs/en/html/README.html +++ b/docs/en/html/README.html @@ -12,7 +12,7 @@ alt="Tux Paint">
version -0.9.23c +0.9.24

A simple drawing program for children

@@ -22,7 +22,7 @@ version

June 14, 2002 - - October 7, 2018

+ December 18, 2018

diff --git a/src/tuxpaint.c b/src/tuxpaint.c index 43b85de6f..4656ae421 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 */ @@ -6395,80 +6395,91 @@ 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" + "\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__) - " %s [--papersize PAPERSIZE | --papersize help]\n" + " [--printcommand=COMMAND]\n" + " [--altprintcommand=COMMAND]\n" + " [--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" + " 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, 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__) - blank, -#endif - blank, blank, blank, blank, blank, blank, blank, blank, blank, blank); - - free(blank); + progname); } From 5d9ceca076c736eccc82161717886ffd240a5c01 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 18 Dec 2018 22:37:03 -0800 Subject: [PATCH 12/13] "New colors last"; place colors at end of New New option to place color palette items at the end of the "New" dialog, rather than at the beginning. Useful for when users would want to pick from a set of Starters and/or Templates, e.g., in a school or museum environment. Available via command-line option "--newcolorslast", and config file setting "newcolorslast=yes". (And anti-option to override config file settings, "--newcolorsfirst" and "...=no", which represents the original behavior, which continues to be the default). Suggested by Bernard Verhaeghe. --- docs/CHANGES.txt | 8 ++ docs/en/OPTIONS.txt | 10 ++- docs/en/html/OPTIONS.html | 12 ++- src/parse.gperf | 2 + src/parse.h | 1 + src/tuxpaint-completion.bash | 3 + src/tuxpaint.c | 152 +++++++++++++++++++++-------------- 7 files changed, 122 insertions(+), 66 deletions(-) diff --git a/docs/CHANGES.txt b/docs/CHANGES.txt index be38d57ed..939227de7 100644 --- a/docs/CHANGES.txt +++ b/docs/CHANGES.txt @@ -26,6 +26,14 @@ $Id$ 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. diff --git a/docs/en/OPTIONS.txt b/docs/en/OPTIONS.txt index e48f4eb71..88f707e7b 100644 --- a/docs/en/OPTIONS.txt +++ b/docs/en/OPTIONS.txt @@ -1,12 +1,12 @@ Tux Paint - version 0.9.23c + version 0.9.24 Options Documentation Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt http://www.tuxpaint.org/ - October 7, 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/html/OPTIONS.html b/docs/en/html/OPTIONS.html index ab1356cd7..e01243862 100644 --- a/docs/en/html/OPTIONS.html +++ b/docs/en/html/OPTIONS.html @@ -11,7 +11,7 @@ alink="#FF00FF"> version -0.9.23c +0.9.24

Options Documentation

@@ -19,7 +19,7 @@ version

Copyright (c) 2002-2018 by various contributors; see AUTHORS.txt
http://www.tuxpaint.org/

-

October 7, 2018

+

December 18, 2018

@@ -447,6 +447,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 @@ -1527,6 +1533,7 @@ version --nostampcontrols
--nomagiccontrols
--nolabel
+ --newcolorslast
--mouse-accessibility
--onscreen-keyboard
--onscreen-keyboard-layout
@@ -1600,6 +1607,7 @@ version --stampcontrols
--magiccontrols
--label
+ --newcolorsfirst
--nosysfonts
--currentlocalefont
--dontmirrorstamps
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 4656ae421..c0c9e33a1 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -1203,6 +1203,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; @@ -1958,6 +1959,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); @@ -6395,7 +6397,6 @@ void show_version(int details) void show_usage(int exitcode) { FILE *f = exitcode ? stderr : stdout; - unsigned i; fprintf(f, "\n" @@ -6430,6 +6431,7 @@ void show_usage(int exitcode) " [--nostampcontrols | --stampcontrols]\n" " [--nomagiccontrols | --magiccontrols]\n" " [--nolabel | --label]\n" + " [--newcolorsfirst | --newcolorslast]\n" "\n" " Languages:\n" " [--lang LANGUAGE | --locale LOCALE | --lang help]\n" @@ -18586,8 +18588,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; @@ -18683,7 +18683,12 @@ static int do_new_dialog(void) /* (Re)allocate space for the information about these files: */ - tot = num_files_in_dirs + NUM_COLORS; + tot = num_files_in_dirs; + + /* And colors... */ + if (!new_colors_last) { + tot += NUM_COLORS; + } thumbs = (SDL_Surface * *)malloc(sizeof(SDL_Surface *) * tot); d_places = (int *)malloc(sizeof(int) * tot); @@ -18696,66 +18701,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... */ @@ -19058,10 +19010,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 @@ -19705,6 +19662,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 */ @@ -22492,6 +22519,7 @@ application support folder */ SETBOOL(keymouse); SETBOOL(mirrorstamps); SETBOOL(native_screensize); + SETBOOL(new_colors_last); SETBOOL(no_button_distinction); SETBOOL(no_fancy_cursors); SETBOOL(no_system_fonts); From f3965941aad0f020d4cf161859fb2b762b7e2f83 Mon Sep 17 00:00:00 2001 From: Bill Kendrick Date: Tue, 18 Dec 2018 22:45:52 -0800 Subject: [PATCH 13/13] Mend alloc bug introduced testing 'New colors last' Didn't mean to stop alloc'ing space for the colors! --- src/tuxpaint.c | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/src/tuxpaint.c b/src/tuxpaint.c index c0c9e33a1..6c6cff461 100644 --- a/src/tuxpaint.c +++ b/src/tuxpaint.c @@ -18682,13 +18682,10 @@ static int do_new_dialog(void) /* (Re)allocate space for the information about these files: */ - tot = num_files_in_dirs; /* And colors... */ - if (!new_colors_last) { - tot += NUM_COLORS; - } + tot += NUM_COLORS; thumbs = (SDL_Surface * *)malloc(sizeof(SDL_Surface *) * tot); d_places = (int *)malloc(sizeof(int) * tot);