Trying again...

This commit is contained in:
Mark K. Kim 2017-11-27 01:02:41 -05:00
parent ea7f013d0d
commit 472bf79bb9
10 changed files with 122 additions and 89 deletions

View file

@ -68,7 +68,7 @@ beos_MIMESET_CMD:=mimeset -f tuxpaint
MIMESET_CMD:=$($(OS)_MIMESET_CMD) MIMESET_CMD:=$($(OS)_MIMESET_CMD)
windows_SO_TYPE:=dll windows_SO_TYPE:=dll
osx_SO_TYPE:=bundle osx_SO_TYPE:=dylib
beos_SO_TYPE:=so beos_SO_TYPE:=so
linux_SO_TYPE:=so linux_SO_TYPE:=so
SO_TYPE:=$($(OS)_SO_TYPE) SO_TYPE:=$($(OS)_SO_TYPE)
@ -79,12 +79,32 @@ LIBMINGW:=$($(OS)_LIBMINGW)
windows_EXE_EXT:=.exe windows_EXE_EXT:=.exe
EXE_EXT:=$($(OS)_EXE_EXT) EXE_EXT:=$($(OS)_EXE_EXT)
windows_BUNDLE:=
osx_BUNDLE=./TuxPaint.app
beos_BUNDLE:=
linux_BUNDLE:=
BUNDLE:=$($(OS)_BUNDLE)
windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o windows_ARCH_LIBS:=obj/win32_print.o obj/resource.o
osx_ARCH_LIBS:=obj/postscript_print.o osx_ARCH_LIBS:=obj/postscript_print.o obj/macos.o
beos_ARCH_LIBS:=obj/BeOS_print.o beos_ARCH_LIBS:=obj/BeOS_print.o
linux_ARCH_LIBS:=obj/postscript_print.o linux_ARCH_LIBS:=obj/postscript_print.o
ARCH_LIBS:=$($(OS)_ARCH_LIBS) ARCH_LIBS:=$($(OS)_ARCH_LIBS)
windows_ARCH_CFLAGS:=
# osx_ARCH_CFLAGS:=-isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-deprecated-declarations -Wno-missing-braces -Wno-parentheses-equality -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-missing-prototypes -Wno-incompatible-function-pointer-types -Wno-format -Wno-bitwise-op-parentheses -Wno-strict-prototypes -Wno-sign-compare -Wno-\#warnings -Wno-ignored-optimization-argument -Wno-implicit-function-declaration -Wno-tautological-pointer-compare -Wno-self-assign -Wno-absolute-value
osx_ARCH_CFLAGS:=-DHAVE_STRCASESTR -isystem /opt/local/include -Wno-unused-variable -Wno-unused-function -Wno-unused-parameter -Wno-unused-result -Wno-sign-compare -Wno-ignored-optimization-argument -Wno-deprecated-declarations -Wno-absolute-value -Wno-missing-prototypes -Wno-cast-align -Wno-incompatible-pointer-types-discards-qualifiers -Wno-incompatible-function-pointer-types -Wno-bitwise-op-parentheses -Wno-format -Wno-implicit-function-declaration -Wno-self-assign -Wno-parentheses-equality -Wno-strict-prototypes
beos_ARCH_CFLAGS:=
linux_ARCH_CFLAGS:=
ARCH_CFLAGS:=$($(OS)_ARCH_CFLAGS)
windows_ARCH_LDFLAGS:=
osx_ARCH_LDFLAGS:=-L/opt/local/lib
beos_ARCH_LDFLAGS:=
linux_ARCH_LDFLAGS:=
ARCH_LDFLAGS:=$($(OS)_ARCH_LDFLAGS)
LDFLAGS:=$(ARCH_LDFLAGS)
PAPER_LIB:=$(call linktest,-lpaper,) PAPER_LIB:=$(call linktest,-lpaper,)
PNG:=$(call linktest,-lpng,) PNG:=$(call linktest,-lpng,)
PNG:=$(if $(PNG),$(PNG),$(call linktest,-lpng12,)) PNG:=$(if $(PNG),$(PNG),$(call linktest,-lpng12,))
@ -99,23 +119,26 @@ linux_ARCH_LINKS:=$(PAPER_LIB) $(FRIBIDI_LIB)
ARCH_LINKS:=$($(OS)_ARCH_LINKS) ARCH_LINKS:=$($(OS)_ARCH_LINKS)
windows_ARCH_HEADERS:=src/win32_print.h windows_ARCH_HEADERS:=src/win32_print.h
osx_ARCH_HEADERS:= osx_ARCH_HEADERS:=src/macos.h
beos_ARCH_HEADERS:=src/BeOS_print.h beos_ARCH_HEADERS:=src/BeOS_print.h
linux_ARCH_HEADERS:= linux_ARCH_HEADERS:=
ARCH_HEADERS:=$($(OS)_ARCH_HEADERS) ARCH_HEADERS:=$($(OS)_ARCH_HEADERS)
# Where things will go when ultimately installed: # Where things will go when ultimately installed:
# For macOS, the prefix is relative to DESTDIR.
windows_PREFIX:=/usr/local windows_PREFIX:=/usr/local
osx_PREFIX:=/usr/local osx_PREFIX:=Resources
beos_PREFIX=$(shell finddir B_APPS_DIRECTORY)/TuxPaint beos_PREFIX=$(shell finddir B_APPS_DIRECTORY)/TuxPaint
linux_PREFIX:=/usr/local linux_PREFIX:=/usr/local
PREFIX:=$($(OS)_PREFIX) PREFIX:=$($(OS)_PREFIX)
# Root directory to place files when creating packages. # Root directory to place files when creating packages.
# PKG_ROOT is the old name for this, and should be undefined. # PKG_ROOT is the old name for this, and should be undefined.
# macOS is set up as a bundle, with all files under 'Contents'.
# "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad! # "TuxPaint-1" is the OLPC XO name. Installing to ./ is bad!
ifeq ($(PREFIX),./) ifeq ($(OS),osx)
DESTDIR:=$(BUNDLE)/Contents/
else ifeq ($(PREFIX),./)
DESTDIR:=TuxPaint-1 DESTDIR:=TuxPaint-1
else else
DESTDIR:=$(PKG_ROOT) DESTDIR:=$(PKG_ROOT)
@ -217,6 +240,8 @@ hack:
@echo 'SDL_LIBS is' $(SDL_LIBS) @echo 'SDL_LIBS is' $(SDL_LIBS)
@echo 'SDL_CFLAGS is' $(SDL_CFLAGS) @echo 'SDL_CFLAGS is' $(SDL_CFLAGS)
@echo 'SVG_CFLAGS is' $(SVG_CFLAGS) @echo 'SVG_CFLAGS is' $(SVG_CFLAGS)
@echo 'PAPER_LIB is' $(PAPER_LIB)
@echo 'PNG is' $(PNG)
@echo 'LDFLAGS is' $(LDFLAGS) @echo 'LDFLAGS is' $(LDFLAGS)
@echo 'CFLAGS is' $(CFLAGS) @echo 'CFLAGS is' $(CFLAGS)
@echo 'CPPFLAGS is' $(CPPFLAGS) @echo 'CPPFLAGS is' $(CPPFLAGS)
@ -232,7 +257,8 @@ CFLAGS:=$(CPPFLAGS) $(OPTFLAGS) -W -Wall -fno-common -ffloat-store \
-Wbad-function-cast -Wwrite-strings \ -Wbad-function-cast -Wwrite-strings \
-Waggregate-return \ -Waggregate-return \
-Wstrict-prototypes -Wmissing-prototypes \ -Wstrict-prototypes -Wmissing-prototypes \
$(shell src/test-option.sh -Wstrict-aliasing=2) $(shell src/test-option.sh -Wstrict-aliasing=2) \
$(ARCH_CFLAGS)
DEFS:=-DVER_DATE=\"$(VER_DATE)\" -DVER_VERSION=\"$(VER_VERSION)\" \ DEFS:=-DVER_DATE=\"$(VER_DATE)\" -DVER_VERSION=\"$(VER_VERSION)\" \
-DDATA_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DATA_PREFIX))/\" \ -DDATA_PREFIX=\"$(patsubst $(DESTDIR)%,%,$(DATA_PREFIX))/\" \
@ -433,7 +459,7 @@ trans:
###### ######
windows_ARCH_INSTALL:= windows_ARCH_INSTALL:=
osx_ARCH_INSTALL:= osx_ARCH_INSTALL:=install-bundlefiles
beos_ARCH_INSTALL:=install-haiku beos_ARCH_INSTALL:=install-haiku
linux_ARCH_INSTALL:=install-gnome install-kde install-kde-icons linux_ARCH_INSTALL:=install-gnome install-kde install-kde-icons
ARCH_INSTALL:=$($(OS)_ARCH_INSTALL) ARCH_INSTALL:=$($(OS)_ARCH_INSTALL)
@ -455,11 +481,18 @@ install: install-bin install-data install-man install-doc \
@echo @echo
@echo "--------------------------------------------------------------" @echo "--------------------------------------------------------------"
@echo @echo
@echo "All done! Now (preferably NOT as 'root' superuser)," @if [ "x$(OS)" == "xosx" ]; then \
@echo "you can type the command 'tuxpaint' to run the program!!!" echo "All done! Now you can double click $(BUNDLE) to run the"; \
@echo echo "program!!!"; \
@echo "For more information, see the 'tuxpaint' man page," echo; \
@echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt" echo "For more information, see $(DOC_PREFIX)/README.txt"; \
else \
echo "All done! Now (preferably NOT as 'root' superuser),"; \
echo "you can type the command 'tuxpaint' to run the program!!!"; \
echo; \
echo "For more information, see the 'tuxpaint' man page,"; \
echo "run 'tuxpaint --usage' or see $(DOC_PREFIX)/README.txt"; \
fi
@echo @echo
@echo "Visit Tux Paint's home page for more information, updates" @echo "Visit Tux Paint's home page for more information, updates"
@echo "and to learn how you can help out!" @echo "and to learn how you can help out!"
@ -558,6 +591,7 @@ clean:
@if [ -d starters/.thumbs ]; then rmdir starters/.thumbs; fi @if [ -d starters/.thumbs ]; then rmdir starters/.thumbs; fi
@-rm -f templates/.thumbs/*.png @-rm -f templates/.thumbs/*.png
@if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi @if [ -d templates/.thumbs ]; then rmdir templates/.thumbs; fi
@-if [ "x$(BUNDLE)" != "x" ]; then rm -rf $(BUNDLE); fi
@echo @echo
# "make uninstall" should remove the various parts from their # "make uninstall" should remove the various parts from their
@ -602,6 +636,9 @@ uninstall: uninstall-i18n
-rm -r $(INCLUDE_PREFIX)/tuxpaint -rm -r $(INCLUDE_PREFIX)/tuxpaint
-rm $(BIN_PREFIX)/tp-magic-config -rm $(BIN_PREFIX)/tp-magic-config
-rm -r $(DEVDOC_PREFIX) -rm -r $(DEVDOC_PREFIX)
-if [ "x$(BUNDLE)" != "x" ]; then \
rm -rf $(BUNDLE); \
fi
# Install default config file: # Install default config file:
@ -976,6 +1013,20 @@ install-man:
@chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tp-magic-config.1.gz @chmod a+rx,g-w,o-w $(MAN_PREFIX)/man1/tp-magic-config.1.gz
# Install the support files for macOS application bundle
.PHONY: install-bundlefiles
install-bundlefiles:
@echo
@echo "...Installing App Bundle Support Files..."
@mkdir -p $(BUNDLE)/Contents/MacOS
@mkdir -p $(BUNDLE)/Contents/Resources
@mkdir -p $(BUNDLE)/Contents/lib
@cp -p tuxpaint $(BUNDLE)/Contents/MacOS
@cp -p macos/PkgInfo $(BUNDLE)/Contents
@cp -p macos/Info.plist $(BUNDLE)/Contents
@cp -p macos/tuxpaint.icns $(BUNDLE)/Contents/Resources
@custom/macos.sh
# Build the program! # Build the program!
@ -1026,7 +1077,7 @@ obj/tuxpaint.o: src/tuxpaint.c \
obj/parse.c: obj/parse_step1.c obj/parse.c: obj/parse_step1.c
@echo @echo
@echo "...Generating the command-line and config file parser (STEP 2)..." @echo "...Generating the command-line and config file parser (STEP 2)..."
@sed -r -e 's/^const struct/static const struct/' -e 's/_GNU/_TUX/' obj/parse_step1.c > obj/parse.c @sed -e 's/^const struct/static const struct/' -e 's/_GNU/_TUX/' obj/parse_step1.c > obj/parse.c
obj/parse_step1.c: src/parse.gperf obj/parse_step1.c: src/parse.gperf
@echo @echo
@ -1129,6 +1180,12 @@ obj/postscript_print.o: src/postscript_print.c Makefile \
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \ @$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/postscript_print.c -o obj/postscript_print.o -c src/postscript_print.c -o obj/postscript_print.o
obj/macos.o: src/macos.c src/macos.h src/debug.h
@echo
@echo "...Compiling macOS support..."
@$(CC) $(CFLAGS) $(DEBUG_FLAGS) $(SDL_CFLAGS) $(DEFS) \
-c src/macos.c -o obj/macos.o
obj/resource.o: win32/resources.rc win32/resource.h obj/resource.o: win32/resources.rc win32/resource.h
@echo @echo
@echo "...Compiling win32 resources..." @echo "...Compiling win32 resources..."
@ -1172,14 +1229,14 @@ MAGIC_SDL_LIBS:=-L/usr/local/lib $(LIBMINGW) $(shell $(PKG_CONFIG) $(SDL_PCNAME)
MAGIC_ARCH_LINKS:=-lintl $(PNG) MAGIC_ARCH_LINKS:=-lintl $(PNG)
windows_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS) windows_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS)
osx_PLUGIN_LIBS:= osx_PLUGIN_LIBS:=$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS)
beos_PLUGIN_LIBS:="$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS) $(MAGIC_SDL_CPPFLAGS)" beos_PLUGIN_LIBS:="$(MAGIC_SDL_LIBS) $(MAGIC_ARCH_LINKS) $(MAGIC_SDL_CPPFLAGS)"
linux_PLUGIN_LIBS:= linux_PLUGIN_LIBS:=
PLUGIN_LIBS:=$($(OS)_PLUGIN_LIBS) PLUGIN_LIBS:=$($(OS)_PLUGIN_LIBS)
#MAGIC_CFLAGS:=-g3 -O2 -fvisibility=hidden -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/ #MAGIC_CFLAGS:=-g3 -O2 -fvisibility=hidden -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/
MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/ MAGIC_CFLAGS:=-g3 -O2 -fno-common -W -Wstrict-prototypes -Wmissing-prototypes -Wall $(MAGIC_SDL_CPPFLAGS) -Isrc/ $(ARCH_CFLAGS)
SHARED_FLAGS:=-shared -fpic -Wl,--warn-shared-textrel SHARED_FLAGS:=-shared -fpic
MAGIC_C:=$(wildcard magic/src/*.c) MAGIC_C:=$(wildcard magic/src/*.c)
MAGIC_SO:=$(patsubst magic/src/%.c,magic/%.$(SO_TYPE),$(MAGIC_C)) MAGIC_SO:=$(patsubst magic/src/%.c,magic/%.$(SO_TYPE),$(MAGIC_C))

View file

@ -1,10 +1,8 @@
Tux Paint Customization Tux Paint Customization
//EP added in 0.9.22 the customization process, custom folder and its files
This folder allows for customization of Tux Paint. One example is adding resources such as fonts, stamps, starters... This folder allows for customization of Tux Paint. One example is adding resources such as fonts, stamps, starters...
On Mac OS X, at the very end of build in Xcode, a build phase looks for macosx.sh script in this folder. If found, it is run, otherwise no customization is done. On Mac OS X, at the very end of the build, macos.sh script in this folder is run.
On Windows, the win32.bat in this folder has to be run manually. At some point, a calling to the script could be integrated in the build process so as to be run automatically, just like it is on Mac OS X (see above). On Windows, the win32.bat in this folder has to be run manually. At some point, a calling to the script could be integrated in the build process so as to be run automatically, just like it is on Mac OS X (see above).

View file

@ -1053,6 +1053,9 @@ $Id$
* Mac OS X coding and builds * Mac OS X coding and builds
Martin Fuhrer <mfuhrer@users.sourceforge.net> Martin Fuhrer <mfuhrer@users.sourceforge.net>
Darrell Walisser <walisser@mac.com> [retired] Darrell Walisser <walisser@mac.com> [retired]
Eric Poncet <http://www.linguasoft.com/>
Harvey Ginter <harveyginter@gmail.com>
Mark K. Kim <mkkim214@gmail.com>
* Maemo (Nokia 770 and N880) coding and builds * Maemo (Nokia 770 and N880) coding and builds
Alessandro Pasotti <apasotti@gmail.com> Alessandro Pasotti <apasotti@gmail.com>

View file

@ -101,6 +101,11 @@ $Id$
the wrong(lossy) way, the program will crash the wrong(lossy) way, the program will crash
(SF.net Bug #210) (SF.net Bug #210)
* Ports
-----
* Rewrite the build system to be more Linux-like, with no XCode IDE.
Mark K. Kim <mkkim214@gmail.com>
* Other Improvements: * Other Improvements:
------------------- -------------------
* Reformatted source code via GNU Indent tool; should * Reformatted source code via GNU Indent tool; should

View file

@ -126,7 +126,7 @@ Loading Tux Paint
Mac OS X Users Mac OS X Users
Simply double-click the "Tux Paint" icon. Simply double-click the "TuxPaint.app" icon.
---------------------------------------------------------------------- ----------------------------------------------------------------------
@ -591,17 +591,17 @@ Available Tools
Printer Settings Printer Settings
(Windows and Mac OS X) (Windows)
By default, Tux Paint simply prints to the By default, Tux Paint simply prints to the
default printer with default settings when the default printer with default settings when the
'Print' button is pushed. 'Print' button is pushed.
However, if you hold the [Alt] (or [Option]) However, if you hold the [Alt] key on the
key on the keyboard while pushing the button, keyboard while pushing the button, as long as
as long as you're not in fullscreen mode, your you're not in fullscreen mode, your operating
operating system's printer dialog will appear, system's printer dialog will appear, where you
where you can change the settings. can change the settings.
You can have the printer configuration changes You can have the printer configuration changes
stored by using the "printcfg" option, either stored by using the "printcfg" option, either
@ -743,7 +743,7 @@ Available Tools
Mac OS X Mac OS X
Inside the user's "Library" folder: Inside the user's "Library" folder:
"/Users/(user name)/Library/Application "/Users/(user name)/Library/Application
Support/Tux Paint/saved/" Support/TuxPaint/saved/"
Linux/Unix Linux/Unix
Inside a hidden ".tuxpaint" directory, in the user's home Inside a hidden ".tuxpaint" directory, in the user's home

View file

@ -37,6 +37,14 @@ As of this writing, the required libraries are:
Tux Paint. Tux Paint.
*** WARNING ***
---------------
Having any UNIX-like toolset installed on your Mac besides MacPorts and
XCode, such as Fink or Brew, will prevent your app bundle from being
portable. Be sure Fink and Brew are not accessible from your build
environment.
HOW TO BUILD HOW TO BUILD
------------ ------------
Simply, run: Simply, run:

View file

@ -67,16 +67,15 @@
#include "win32_print.h" #include "win32_print.h"
#endif #endif
#ifdef __APPLE__
#include "macos.h"
#endif
#ifdef __HAIKU__ #ifdef __HAIKU__
#include <FindDirectory.h> #include <FindDirectory.h>
#include <fs_info.h> #include <fs_info.h>
#endif #endif
#ifdef __APPLE__
#include "wrapperdata.h"
extern WrapperData macosx;
#endif
/* system fonts that cause TTF_OpenFont to crash */ /* system fonts that cause TTF_OpenFont to crash */
static const char *problemFonts[] = { static const char *problemFonts[] = {
"/Library/Fonts//AppleMyungjo.ttf", "/Library/Fonts//AppleMyungjo.ttf",
@ -217,7 +216,7 @@ TuxPaint_Font *load_locale_font(TuxPaint_Font * fallback, int size)
if (!ret) if (!ret)
{ {
snprintf(str, sizeof(str), "%s/%s.ttf", macosx.fontsPath, lang_prefix); snprintf(str, sizeof(str), "%s/%s.ttf", macos_fontsPath(), lang_prefix);
ret = TuxPaint_Font_OpenFont("", str, size); ret = TuxPaint_Font_OpenFont("", str, size);
} }
#endif #endif
@ -1001,7 +1000,7 @@ static void loadfonts(SDL_Surface * screen, const char *const dir)
#elif defined(__APPLE__) #elif defined(__APPLE__)
loadfonts(screen, "/System/Library/Fonts"); loadfonts(screen, "/System/Library/Fonts");
loadfonts(screen, "/Library/Fonts"); loadfonts(screen, "/Library/Fonts");
loadfonts(screen, macosx.fontsPath); loadfonts(screen, macos_fontsPath());
loadfonts(screen, "/usr/share/fonts"); loadfonts(screen, "/usr/share/fonts");
loadfonts(screen, "/usr/X11R6/lib/X11/fonts"); loadfonts(screen, "/usr/X11R6/lib/X11/fonts");
#elif defined(__sun__) #elif defined(__sun__)

View file

@ -1108,9 +1108,6 @@ int setup_i18n(const char *restrict lang, const char *restrict locale)
if (lang) if (lang)
locale = language_to_locale(lang); locale = language_to_locale(lang);
#ifdef __APPLE__
patch_i18n(locale); //EP
#endif
return set_current_language(locale); return set_current_language(locale);
} }

View file

@ -1,6 +1,3 @@
#ifdef __APPLE__
#include "patch.h" //EP
#endif
#include "onscreen_keyboard.h" #include "onscreen_keyboard.h"
//#define DEBUG_OSK_COMPOSEMAP //#define DEBUG_OSK_COMPOSEMAP

View file

@ -298,26 +298,10 @@ typedef struct safer_dirent
#else /* __BEOS__ */ #else /* __BEOS__ */
/* Not BeOS */ /* Not Windows, not BeOS */
#ifdef __APPLE__
/* Apple */
#include "macosx_print.h"
#include "message.h"
#include "speech.h"
#include "wrapperdata.h"
extern WrapperData macosx;
#else /* __APPLE__ */
/* Not Windows, not BeOS, not Apple */
#include "postscript_print.h" #include "postscript_print.h"
#endif /* __APPLE__ */
#endif /* __BEOS__ */ #endif /* __BEOS__ */
#else /* WIN32 */ #else /* WIN32 */
@ -360,6 +344,10 @@ static void mtw(wchar_t * wtok, char *tok)
#endif /* WIN32 */ #endif /* WIN32 */
#ifdef __APPLE__
#include "macos.h"
#endif
#include <errno.h> #include <errno.h>
#include <sys/stat.h> #include <sys/stat.h>
@ -1280,7 +1268,7 @@ enum
static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */ static magic_api *magic_api_struct; /* Pointer to our internal functions; passed to shared object's functions when we call them */
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) #if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
#include <paper.h> #include <paper.h>
#if !defined(PAPER_H) #if !defined(PAPER_H)
#error "---------------------------------------------------" #error "---------------------------------------------------"
@ -2495,14 +2483,6 @@ static void mainloop(void)
magic_switchin(canvas); magic_switchin(canvas);
} }
#ifdef __APPLE__
else if (key == SDLK_p && (mod & KMOD_CTRL) && (mod & KMOD_SHIFT) && !noshortcuts)
{
/* Ctrl-Shft-P - Page Setup */
if (!disable_print)
DisplayPageSetup(canvas);
}
#endif
else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts) else if (key == SDLK_p && (mod & KMOD_CTRL) && !noshortcuts)
{ {
/* Ctrl-P - Print */ /* Ctrl-P - Print */
@ -15899,7 +15879,7 @@ void do_print(void)
SDL_BlitSurface(canvas, NULL, save_canvas, NULL); SDL_BlitSurface(canvas, NULL, save_canvas, NULL);
SDL_BlitSurface(label, NULL, save_canvas, NULL); SDL_BlitSurface(label, NULL, save_canvas, NULL);
#if !defined(WIN32) && !defined(__BEOS__) && !defined(__APPLE__) && !defined(__HAIKU__) #if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
const char *pcmd; const char *pcmd;
FILE *pi; FILE *pi;
@ -15951,18 +15931,6 @@ void do_print(void)
/* BeOS */ /* BeOS */
SurfacePrint(save_canvas); SurfacePrint(save_canvas);
#elif defined(__APPLE__)
/* Mac OS X */
int show = ((want_alt_printcommand || macosx.menuAction) && !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
#endif #endif
@ -21531,7 +21499,7 @@ void load_embedded_data(char *fname, SDL_Surface * org_surf)
/* ================================================================================== */ /* ================================================================================== */
#if !defined(WIN32) && !defined(__APPLE__) && !defined(__BEOS__) && !defined(__HAIKU__) #if !defined(WIN32) && !defined(__BEOS__) && !defined(__HAIKU__)
static void show_available_papersizes(int exitcode) static void show_available_papersizes(int exitcode)
{ {
FILE *fi = exitcode ? stderr : stdout; FILE *fi = exitcode ? stderr : stdout;
@ -21762,7 +21730,7 @@ static void setup_config(char *argv[])
result = find_directory(B_USER_DIRECTORY, volume, false, buffer, sizeof(buffer)); result = find_directory(B_USER_DIRECTORY, volume, false, buffer, sizeof(buffer));
asprintf((char **)&savedir, "%s/%s", buffer, "TuxPaint"); asprintf((char **)&savedir, "%s/%s", buffer, "TuxPaint");
#elif __APPLE__ #elif __APPLE__
savedir = strdup(macosx.preferencesPath); savedir = strdup(macos_preferencesPath());
#else #else
int tmp; int tmp;
tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint"); tmp = asprintf((char **)&savedir, "%s/%s", home, ".tuxpaint");
@ -21784,7 +21752,7 @@ static void setup_config(char *argv[])
strcpy(str, "tuxpaint.cfg"); strcpy(str, "tuxpaint.cfg");
#elif defined(__APPLE__) #elif defined(__APPLE__)
/* Mac OS X: Use a "tuxpaint.cfg" file in the Tux Paint application support folder */ /* Mac OS X: Use a "tuxpaint.cfg" file in the Tux Paint application support folder */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.preferencesPath); snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_preferencesPath());
#else #else
/* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */ /* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */
@ -21815,7 +21783,7 @@ static void setup_config(char *argv[])
folder & extension inconsistency with Tux Paint Config application) */ folder & extension inconsistency with Tux Paint Config application) */
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint /* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
application support folder */ application support folder */
snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macosx.globalPreferencesPath); snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_globalPreferencesPath());
parse_file_options(&tmpcfg_sys, str); parse_file_options(&tmpcfg_sys, str);
#else #else
/* normally /etc/tuxpaint/tuxpaint.conf */ /* normally /etc/tuxpaint/tuxpaint.conf */
@ -22277,10 +22245,11 @@ static void chdir_to_binary(char *argv0)
char *slash = strrchr(app_path, '/'); char *slash = strrchr(app_path, '/');
#if defined(__APPLE__) #if defined(__APPLE__)
/* EP added to fix 10.9 issue of current directory set by Finder // On macOS, execution is deep inside the app bundle.
to something else than folder where app bundle resides */ // E.g., "/Applications/TuxPaint.app/Contents/MacOS/tuxpaint"
/* typical path of app's binary on Mac OS : /Applications/Tux Paint.app/Contents/MacOS/Tux Paint */ // But we want to point somewhere higher up, say to "Contents", so we can access
int levels = 3; /* we need to back up 3 levels */ // the resources in Resources folder. So move up one level.
int levels = 1; /* we need to back up 1 level */
while ((levels-- > 0) && (slash)) while ((levels-- > 0) && (slash))
{ {