iOS port initial commit

Known Issues
------------
- No printing support.
- No typing support using the OS virtual keyboard.  iOS needs to be signalled
  to bring up the virtual keyboard when the text tool is active.  We also may
  need to do some finagling to make IM work with the virtual keyboard.
- OS language detection doesn't work yet.
- Quitting doesn't close the app.  It just displays a black screen until it is
  force-closed.
- Need to include cross-compilation instructions.

Possible Issues
---------------
- No text display.  This is likely an issue with how pango and related
  libraries were cross-compiled rather than an issue with Tux Paint code.  From
  the error output it appears to be a font rendering issue.
- SVG integration couldn't be tested because RSVG library has not yet be
  cross-compiled successfully.
- Only tested under the iOS Simulator (and not on an actual iOS device yet.)
This commit is contained in:
Mark Kim 2021-03-21 20:46:03 -04:00
parent efbdb54cce
commit 39cc096ece
16 changed files with 482 additions and 49 deletions

View file

@ -25,6 +25,7 @@
June 14, 2002 - March 8, 2021
*/
#include "platform.h"
/* (Note: VER_VERSION and VER_DATE are now handled by Makefile) */
@ -299,19 +300,25 @@ typedef struct safer_dirent
/* Not BeOS */
#ifdef __APPLE__
#if defined(__MACOS__)
/* Apple */
/* macOS */
#include "macos_print.h"
#else /* __APPLE__ */
#elif defined(__IOS__)
/* Not Windows, not BeOS, not Apple */
/* iOS */
#include "ios_print.h"
#else /* __MACOS__, __IOS__ */
/* Not Windows, not BeOS, not macOS, not iOS */
#include "postscript_print.h"
#endif /* __APPLE__ */
#endif /* __MACOS__, __IOS__ */
#endif /* __BEOS__ */
@ -358,8 +365,10 @@ static void mtw(wchar_t * wtok, char *tok)
#endif /* WIN32 */
#ifdef __APPLE__
#if defined(__MACOS__)
#include "macos.h"
#elif defined(__IOS__)
#include "ios.h"
#endif
#include <errno.h>
@ -17266,7 +17275,7 @@ void do_print(void)
SurfacePrint(save_canvas);
#elif defined(__APPLE__)
/* Mac OS X */
/* macOS, iOS */
int show = (want_alt_printcommand && !fullscreen);
const char *error = SurfacePrint(save_canvas, show);
@ -23362,7 +23371,7 @@ static void setup_config(char *argv[])
result = find_directory(B_USER_SETTINGS_DIRECTORY, volume, false, buffer, sizeof(buffer));
asprintf((char **)&savedir, "%s/%s", buffer, "TuxPaint");
#elif __APPLE__
savedir = strdup(macos_preferencesPath());
savedir = strdup(apple_preferencesPath());
#else
int tmp;
@ -23404,8 +23413,8 @@ static void setup_config(char *argv[])
/* BeOS: Use a "tuxpaint.cfg" file: */
strcpy(str, "tuxpaint.cfg"); /* safe; sufficient size */
#elif defined(__APPLE__)
/* Mac OS X: Use a "tuxpaint.cfg" file in the Tux Paint application support folder */
safe_snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_preferencesPath());
/* macOS, iOS: Use a "tuxpaint.cfg" file in the Tux Paint application support folder */
safe_snprintf(str, sizeof(str), "%s/tuxpaint.cfg", apple_preferencesPath());
#else
/* Linux and other Unixes: Use 'rc' style (~/.tuxpaintrc) */
@ -23434,9 +23443,9 @@ static void setup_config(char *argv[])
#elif defined(__APPLE__)
/* EP added this conditional section for Mac to fix
folder & extension inconsistency with Tux Paint Config application) */
/* Mac OS X: Use a "tuxpaint.cfg" file in the *global* Tux Paint
/* macOS, iOS: Use a "tuxpaint.cfg" file in the *global* Tux Paint
application support folder */
safe_snprintf(str, sizeof(str), "%s/tuxpaint.cfg", macos_globalPreferencesPath());
safe_snprintf(str, sizeof(str), "%s/tuxpaint.cfg", apple_globalPreferencesPath());
parse_file_options(&tmpcfg_sys, str);
#else
/* normally /etc/tuxpaint/tuxpaint.conf */
@ -23925,7 +23934,7 @@ static void chdir_to_binary(char *argv0)
char *app_path = strdup(argv0);
char *slash = strrchr(app_path, '/');
#if defined(__APPLE__)
#if defined(__MACOS__)
// On macOS, execution is deep inside the app bundle.
// E.g., "/Applications/TuxPaint.app/Contents/MacOS/tuxpaint"
// But we want to point somewhere higher up, say to "Contents", so we can access