Mac OS X updates: Fontconfig configuration files (fonts.conf, fonts.dtd) are now installed upon first launch. Added dialog box requesting user to wait while font cache is being built. Improved "About Tux Paint" dialog box. Added experimental speech synthesis support. Updated developer Read Me.
This commit is contained in:
parent
4e3d46bf74
commit
12e3dcaf7f
15 changed files with 1254 additions and 30 deletions
|
|
@ -12,12 +12,18 @@
|
|||
<string>com.newbreedsoftware.tuxpaint</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>Tux Paint</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>0.9.18</string>
|
||||
<key>CFBundleGetInfoString</key>
|
||||
<string>0.9.18, Copyright 2007, Tux Paint Development Team</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>TXPT</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2006-10-18</string>
|
||||
<string>2007-12-17</string>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>SDLMain</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
|
|
|
|||
|
|
@ -1,10 +1,9 @@
|
|||
Tux Paint Xcode 2.4 Project
|
||||
notes by Martin Fuhrer <mfuhrer@alumni.ucalgary.ca>
|
||||
|
||||
This Tux Paint project file is located in a folder titled "macosx", which should in turn be placed in the root folder of the Tux Paint source code distribution. The project will then be able to access all the source code files. You will require Mac OS X 10.4 and XCode 2.4 or later to build this project.
|
||||
|
||||
This XCode project has been configured under the assumption that you have certain libraries and files installed in particular locations under Mac OS X. This file indicates what you must install, and where these items go. Some of the libraries are installed via the Fink package manager, which can be downloaded from <fink.sourceforge.net>
|
||||
This Tux Paint project file is located in a folder titled "macosx", which should in turn be placed in the root folder of the Tux Paint source code distribution. The project will then be able to access all the source code files. You will require at least Mac OS X 10.4 and XCode 2.4 to build this project.
|
||||
|
||||
This XCode project has been configured under the assumption that you have certain libraries and files installed in particular locations under Mac OS X. This documentation indicates what you must install, and where these items go. Some of the libraries can be installed via the MacPorts <www.macports.org> or Fink <fink.sourceforge.net> package managers. At the time of writing, MacPorts can install one additional required library (SDL Pango) that is not available in Fink, so I have written this document with MacPorts in mind. Several libraries are either misconfigured (with regards to building Tux Paint) or unavailable in MacPorts and Fink, and need to be configured, compiled, and installed manually. You will also need to create the following "sandbox" directory where you will build and store these libraries: /Users/Shared/tuxpaint
|
||||
|
||||
-- SDL --
|
||||
|
||||
|
|
@ -18,14 +17,112 @@ SDL_ttf.framework
|
|||
You can obtain the frameworks from the SDL website <www.libsdl.org> These frameworks contain both header files and libraries, and are copied into the Frameworks directory of the Tux Paint application bundle.
|
||||
|
||||
|
||||
-- PNG, Internationalization, and Character Set Conversion Libraries --
|
||||
-- Installing Libraries via MacPorts --
|
||||
|
||||
Install the PNG (libpng.a), GNU internationalization (libintl.a), and character set conversion (libiconv.dylib) libraries via Fink. By default, Fink will place the libraries in /sw/lib. These libraries will be statically linked into the Tux Paint binary.
|
||||
The following libraries can be installed via MacPorts.
|
||||
|
||||
Library Install location
|
||||
|
||||
GNU Internationalization: /opt/local/lib/libintl.a
|
||||
PNG: /opt/local/lib/libpng.a
|
||||
XML Parser: /opt/local/lib/libexpat.a
|
||||
Freetype: /opt/local/lib/libfreetype.a
|
||||
Cairo Vector Graphics: /opt/local/lib/libcairo.a
|
||||
SDL Pango: /opt/local/lib/libSDL_Pango.o
|
||||
|
||||
The following MacPorts command will install all these libraries in one shot:
|
||||
% sudo port install libsdl_pango
|
||||
|
||||
Copy all the static libraries listed above into the /Users/Shared/tuxpaint/lib directory, where the XCode project will find them. By keeping the static libraries in a separate directory, we will ensure that Tux Paint will not link against other dynamic libraries in /opt/local/lib (a problematic scenario if you wish to distribute your compiled version of Tux Paint to friends who most likely don't have these dynamic libraries installed). These libraries will be statically linked into the Tux Paint binary.
|
||||
|
||||
|
||||
-- Installing Libraries Manually --
|
||||
|
||||
The following libraries require manual compilation and installation.
|
||||
|
||||
Library Install location
|
||||
|
||||
XML Font Configuration: /Users/Shared/tuxpaint/lib/libfontconfig.a
|
||||
GLib: /Users/Shared/tuxpaint/lib/libglib-2.0.a
|
||||
/Users/Shared/tuxpaint/lib/libgobject-2.0.a
|
||||
/Users/Shared/tuxpaint/lib/libgmodule-2.0.a
|
||||
Pango: /Users/Shared/tuxpaint/lib/libpango-1.0.a
|
||||
/Users/Shared/tuxpaint/lib/libpangoft2-1.0.a
|
||||
SVG Scalable Vector Graphics: /Users/Shared/tuxpaint/lib/libsvg.a
|
||||
SVG Cairo: /Users/Shared/tuxpaint/lib/libsvg-cairo.a
|
||||
|
||||
We will compile our libraries inside the "src" directory: /Users/Shared/tuxpaint/src
|
||||
and install the libraries in the "lib" directory: /Users/Shared/tuxpaint/lib
|
||||
|
||||
XML Font Configuration:
|
||||
|
||||
This library will already have been built and installed by MacPorts, but will not have been properly configured for Tux Paint. We need to reconfigure and build Fontconfig as follows:
|
||||
|
||||
% cd /Users/Shared/tuxpaint/src
|
||||
% cp /opt/local/var/macports/distfiles/fontconfig/fontconfig*.tar.gz .
|
||||
% tar xzf fontconfig*.tar.gz
|
||||
% cd fontconfig*
|
||||
% sudo port deactivte fontconfig
|
||||
% ./configure --prefix=/Users/Shared/tuxpaint --enable-static --disable-shared --disable-docs --with-confdir=/Library/Application Support/TuxPaint/fontconfig/fonts --with-cache-dir=/Library/Application Support/TuxPaint/fontconfig/cache CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
|
||||
% make install
|
||||
% sudo port activate fontconfig
|
||||
|
||||
GLib:
|
||||
|
||||
MacPorts only installs the dynamic libraries for GLib. We need to reconfigure and build GLib with static libraries enabled as follows:
|
||||
|
||||
% cd /Users/Shared/tuxpaint/src
|
||||
% cp /opt/local/var/macports/distfiles/fontconfig/fontconfig*.tar.gz .
|
||||
% tar xzf fontconfig*.tar.gz
|
||||
% cd fontconfig*
|
||||
% sudo port deactivate glib
|
||||
% ./configure --prefix=/Users/Shared/tuxpaint --enable-static CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib
|
||||
% make install
|
||||
% sudo port activate glib
|
||||
|
||||
Pango:
|
||||
|
||||
MacPorts only installs the dynamic libraries for Pango. We need to reconfigure and build Pango with static libraries enabled as follows:
|
||||
|
||||
% cd /Users/Shared/tuxpaint/src
|
||||
% cp /opt/local/var/macports/distfiles/pango/pango*.tar.bz2 .
|
||||
% bunzip2 pango*.tar.bz2
|
||||
% tar xf pango*.tar
|
||||
% cd pango*
|
||||
% sudo port deactivate pango
|
||||
% ./configure --prefix=/Users/Shared/tuxpaint --enable-static CPPFLAGS=-I/opt/local/include LDFLAGS=-L/opt/local/lib --with-included-modules=yes --with-dynamic-modules=no --disable-shared
|
||||
% make install
|
||||
% find . -name "*.a" -exec cp {} /Users/Shared/tuxpaint/lib/ \;
|
||||
% sudo port activate pango
|
||||
|
||||
SVG Scalable Vector Graphics:
|
||||
|
||||
Neither MacPorts nor Fink build and install the SVG library. You can retrieve sources from CVS via:
|
||||
http://webcvs.cairographics.org/libsvg/
|
||||
|
||||
Assuming you place the sources in /Users/Shared/tuxpaint/src/libsvg, you can configure and build SVG as follows:
|
||||
|
||||
% cd /Users/Shared/tuxpaint/src/libsvg
|
||||
% ./autogen.sh
|
||||
% ./configure --prefix=/Users/Shared/tuxpaint LIBSVG_CFLAGS=-I/usr/include LIBSVG_LIBS=-L/usr/lib --disable-shared
|
||||
% make install
|
||||
|
||||
SVG Cairo:
|
||||
|
||||
Neither MacPorts nor Fink build and install the SVG Cairo library. You can retrieve sources from CVS via:
|
||||
http://webcvs.cairographics.org/libsvg-cairo/
|
||||
|
||||
Assuming you place the sources in /Users/Shared/tuxpaint/src/libsvg-cairo, you can configure and build SVG Cairo as follows:
|
||||
|
||||
% cd /Users/Shared/tuxpaint/src/libsvg-cairo
|
||||
% ./autogen.sh
|
||||
% ./configure --prefix=/Users/Shared/tuxpaint LIBSVG_CAIRO_CFLAGS=-I/Users/Shared/tuxpaint/include LIBSVG_CAIRO_LIBS=-L/Users/Shared/tuxpaint/lib --disable-shared
|
||||
% make install
|
||||
|
||||
|
||||
-- Universal and Cross Development --
|
||||
|
||||
Tux Paint can be built for PowerPC, Intel, or both (as a universal binary). Since Tux Paint depends on a number of libraries, these libraries must also be built for the same platform(s) for which you wish to build Tux Paint. The latest versions of the SDL frameworks are universal binary and work fine regardless what platform(s) you want to build for. On the other hand, when Fink installs the PNG, internationalization, and character set conversion libraries, they are built only for the platform you are currently using. If you want to build a universal binary of Tux Paint, you will need to manually compile these libraries as universal binaries (see http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html for further information) and update the library paths (click on a library in Archives and choose File > Get Info).
|
||||
Tux Paint can be built for PowerPC, Intel, or both (as a universal binary). Since Tux Paint depends on a number of libraries, these libraries must also be built for the same platform(s) for which you wish to build Tux Paint. The latest versions of the SDL frameworks are universal binary and work fine regardless what platform(s) you want to build for. On the other hand, the libraries installed via MacPorts are built only for the platform you are currently using (MacPorts offers a universal build option, but in practise this fails for most libraries). If you want to build a universal binary of Tux Paint, you will need to manually compile these libraries as universal binaries (see http://developer.apple.com/documentation/Porting/Conceptual/PortingUnix/compiling/chapter_4_section_3.html for further information) and update the library paths (click on a library in Archives and choose File > Get Info).
|
||||
|
||||
To set the target platform for your build:
|
||||
1) Choose Project > Edit Active Target 'Tux Paint'
|
||||
|
|
@ -34,7 +131,7 @@ To set the target platform for your build:
|
|||
4) Select the "Architectures" setting and click the Edit button.
|
||||
5) Select PowerPC, Intel, or both.
|
||||
|
||||
In order to allow the Tux Paint application to run on older versions of Mac OS X, it is necessary to compile and link against an older version of the Mac OS X SDK (eg. Mac OS X 10.2.8) using an older version of gcc (eg. gcc 3.3). Various versions of the Mac OS X SDKs and gcc can be installed from the XCode Installation DVD or disk image. Note that any libraries Tux Paint links against (eg. libraries installed by Fink) should also be compiled and linked against the same SDK, using the same version of gcc. Universal binary and Intel applications must be compiled using gcc 4.0 and the Mac OS X 10.4u SDK.
|
||||
In order to allow the Tux Paint application to run on older versions of Mac OS X, it is necessary to compile and link against an older version of the Mac OS X SDK (eg. Mac OS X 10.2.8) using an older version of gcc (eg. gcc 3.3). Various versions of the Mac OS X SDKs and gcc can be installed from the XCode Installation DVD or disk image. Note that any libraries Tux Paint links against (eg. libraries installed by MacPorts) should also be compiled and linked against the same SDK, using the same version of gcc. Universal binary and Intel applications must be compiled using at least gcc 4.0 and the Mac OS X 10.4(u) SDK.
|
||||
|
||||
To set the desired Mac OS X SDK:
|
||||
1) Choose Project > Edit Project Settings
|
||||
|
|
|
|||
|
|
@ -10,11 +10,21 @@
|
|||
//#define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_2
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "TransparentTextView.h"
|
||||
|
||||
@interface SDLMain : NSObject
|
||||
{
|
||||
IBOutlet NSPanel *messagePanel;
|
||||
IBOutlet NSTextField *messageText;
|
||||
IBOutlet NSTextField *messageStatus;
|
||||
IBOutlet NSProgressIndicator *messageProgress;
|
||||
IBOutlet NSWindow *aboutWindow;
|
||||
IBOutlet NSTextField *appnameText;
|
||||
IBOutlet NSTextField *versionText;
|
||||
IBOutlet TransparentTextView *acknowledgmentsText;
|
||||
}
|
||||
|
||||
- (IBAction)onAbout:(id)sender;
|
||||
- (IBAction)onNew:(id)sender;
|
||||
- (IBAction)onOpen:(id)sender;
|
||||
- (IBAction)onSave:(id)sender;
|
||||
|
|
@ -29,4 +39,7 @@
|
|||
- (void) sendSDLControlShiftKeystroke:(int)key;
|
||||
- (void) setupBridge;
|
||||
|
||||
- (void) displayMessage:(NSString*)message andStatus:(NSString*)status withProgressIndicator:(BOOL)progress;
|
||||
- (void) hideMessage;
|
||||
|
||||
@end
|
||||
|
|
|
|||
163
macosx/SDLMain.m
163
macosx/SDLMain.m
|
|
@ -11,6 +11,7 @@
|
|||
#import <unistd.h>
|
||||
|
||||
#import "macosx_print.h"
|
||||
#import "message.h"
|
||||
#import "wrapperdata.h"
|
||||
|
||||
/* For some reaon, Apple removed setAppleMenu from the headers in 10.4,
|
||||
|
|
@ -46,6 +47,7 @@ static BOOL gFinderLaunch;
|
|||
static BOOL gCalledAppMainline = FALSE;
|
||||
|
||||
WrapperData macosx;
|
||||
SDLMain *sdlMain;
|
||||
|
||||
static NSString *getApplicationName(void)
|
||||
{
|
||||
|
|
@ -70,6 +72,11 @@ static NSString *getApplicationName(void)
|
|||
@end
|
||||
#endif
|
||||
|
||||
/* Category for NSFileManager */
|
||||
@interface NSFileManager (CreateDirectoryRecursively)
|
||||
- (BOOL)createDirectoryRecursively:(NSString *)path attributes:(NSDictionary *)attributes;
|
||||
@end
|
||||
|
||||
@interface SDLApplication : NSApplication
|
||||
@end
|
||||
|
||||
|
|
@ -82,7 +89,9 @@ static NSString *getApplicationName(void)
|
|||
if (NSKeyDown == [anEvent type] || NSKeyUp == [anEvent type])
|
||||
{
|
||||
if( ( [anEvent modifierFlags] & NSCommandKeyMask ) == 0 )
|
||||
{
|
||||
return; // do not intercept keystrokes intended for SDL layer
|
||||
}
|
||||
}
|
||||
}
|
||||
[super sendEvent: anEvent];
|
||||
|
|
@ -131,6 +140,9 @@ static NSString *getApplicationName(void)
|
|||
|
||||
path = [@"~/Library/Application Support/TuxPaint" stringByExpandingTildeInPath];
|
||||
[path getCString:(macosx.preferencesPath)];
|
||||
|
||||
path = @"/Library/Application Support/TuxPaint";
|
||||
[path getCString:(macosx.globalPreferencesPath)];
|
||||
}
|
||||
|
||||
-(void) fontsPath;
|
||||
|
|
@ -147,21 +159,53 @@ static NSString *getApplicationName(void)
|
|||
/* The main class of the application, the application's delegate */
|
||||
@implementation SDLMain
|
||||
|
||||
- (IBAction) onAbout:(id)sender
|
||||
{
|
||||
NSBundle *mainBundle = [NSBundle mainBundle];
|
||||
NSDictionary *bundleInfo = [mainBundle infoDictionary];
|
||||
NSMutableString *string;
|
||||
NSMutableAttributedString *attributedString;
|
||||
NSMutableDictionary *attributes;
|
||||
|
||||
/* string attributes */
|
||||
NSMutableParagraphStyle *paragraphStyle = [[NSParagraphStyle defaultParagraphStyle] mutableCopy];
|
||||
[paragraphStyle setAlignment:NSCenterTextAlignment];
|
||||
attributes = [NSMutableDictionary dictionary];
|
||||
[attributes setObject:[NSFont boldSystemFontOfSize:12] forKey:NSFontAttributeName];
|
||||
[attributes setObject:paragraphStyle forKey:NSParagraphStyleAttributeName];
|
||||
[paragraphStyle release];
|
||||
|
||||
/* display Tux Paint */
|
||||
string = [bundleInfo objectForKey:@"CFBundleName"];
|
||||
attributedString = [[NSAttributedString alloc] initWithString:string attributes:attributes];
|
||||
[appnameText setAttributedStringValue:attributedString];
|
||||
[attributedString release];
|
||||
|
||||
/* display version */
|
||||
string = [NSMutableString stringWithString:@"Version "];
|
||||
[string appendString:[bundleInfo objectForKey:@"CFBundleShortVersionString"]];
|
||||
[string appendString:@" ("];
|
||||
[string appendString:[bundleInfo objectForKey:@"CFBundleVersion"]];
|
||||
[string appendString:@")"];
|
||||
[versionText setStringValue:string];
|
||||
|
||||
/* display credits */
|
||||
NSString *filePath = [mainBundle pathForResource:@"credits" ofType:@"txt"];
|
||||
string = [NSString stringWithContentsOfFile:filePath];
|
||||
[attributes setObject:[NSFont systemFontOfSize:10] forKey:NSFontAttributeName];
|
||||
attributedString = [[NSMutableAttributedString alloc] initWithString:string attributes:attributes];
|
||||
[[acknowledgmentsText textStorage] setAttributedString:attributedString];
|
||||
[attributedString release];
|
||||
[acknowledgmentsText activateURLs];
|
||||
[acknowledgmentsText setEditable:NO];
|
||||
|
||||
[aboutWindow makeKeyAndOrderFront:sender];
|
||||
}
|
||||
|
||||
|
||||
- (IBAction) onNew:(id)sender
|
||||
{
|
||||
[self sendSDLControlKeystroke:SDLK_n];
|
||||
/*
|
||||
[NSApp beginSheet:nameWindow
|
||||
modalForWindow:[NSApp mainWindow]
|
||||
modalDelegate:nil
|
||||
didEndSelector:nil
|
||||
contextInfo:nil];
|
||||
|
||||
[NSApp runModalForWindow:nameWindow];
|
||||
|
||||
[NSApp endSheet:nameWindow];
|
||||
[nameWindow orderOut:self];
|
||||
*/
|
||||
}
|
||||
|
||||
- (IBAction) onOpen:(id)sender
|
||||
|
|
@ -246,6 +290,24 @@ static NSString *getApplicationName(void)
|
|||
}
|
||||
}
|
||||
|
||||
- (void) displayMessage:(NSString*)message andStatus:(NSString*)status withProgressIndicator:(BOOL)progress
|
||||
{
|
||||
[messageText setStringValue:message];
|
||||
[messageStatus setStringValue:status];
|
||||
[messagePanel makeKeyAndOrderFront:nil];
|
||||
if (progress)
|
||||
{
|
||||
[messageProgress setUsesThreadedAnimation:YES];
|
||||
[messageProgress startAnimation:nil];
|
||||
}
|
||||
}
|
||||
|
||||
- (void) hideMessage
|
||||
{
|
||||
[messageProgress stopAnimation:nil];
|
||||
[messagePanel close];
|
||||
}
|
||||
|
||||
#if SDL_USE_NIB_FILE
|
||||
|
||||
/* Fix menu to contain the real app name instead of "SDL App" */
|
||||
|
|
@ -268,7 +330,7 @@ static NSString *getApplicationName(void)
|
|||
if ([menuItem hasSubmenu])
|
||||
[self fixMenu:[menuItem submenu] withAppName:appName];
|
||||
}
|
||||
[ aMenu sizeToFit ];
|
||||
[aMenu sizeToFit];
|
||||
}
|
||||
|
||||
#else
|
||||
|
|
@ -419,6 +481,40 @@ static void CustomApplicationMain (argc, argv)
|
|||
[bridge preferencesPath];
|
||||
}
|
||||
|
||||
/* Install any required files from app bundle to destination */
|
||||
- (void) installFiles
|
||||
{
|
||||
NSFileManager *fileManager = [NSFileManager defaultManager];
|
||||
NSBundle *bundle = [NSBundle mainBundle];
|
||||
BOOL fileExists = NO;
|
||||
|
||||
NSString *globalPreferencesPath = [NSString stringWithCString:(macosx.globalPreferencesPath)];
|
||||
NSString *fontsPath = [globalPreferencesPath stringByAppendingString:@"/fontconfig/fonts"];
|
||||
NSString *cachePath = [globalPreferencesPath stringByAppendingString:@"/fontconfig/cache"];
|
||||
NSString *fontsConfInstalledPath = [fontsPath stringByAppendingString:@"/fonts.conf"];
|
||||
NSString *fontsDtdInstalledPath = [fontsPath stringByAppendingString:@"/fonts.dtd"];
|
||||
NSString *fontsConfBundlePath = [bundle pathForResource:@"fonts" ofType:@"conf"];
|
||||
NSString *fontsDtdBundlePath = [bundle pathForResource:@"fonts" ofType:@"dtd"];
|
||||
|
||||
fileExists = [fileManager fileExistsAtPath:fontsConfInstalledPath];
|
||||
if (!fileExists) {
|
||||
[fileManager createDirectoryRecursively:fontsPath attributes:nil];
|
||||
[fileManager copyPath:fontsConfBundlePath toPath:fontsConfInstalledPath handler:nil];
|
||||
}
|
||||
|
||||
fileExists = [fileManager fileExistsAtPath:fontsDtdInstalledPath];
|
||||
if (!fileExists) {
|
||||
[fileManager createDirectoryRecursively:fontsPath attributes:nil];
|
||||
[fileManager copyPath:fontsDtdBundlePath toPath:fontsDtdInstalledPath handler:nil];
|
||||
}
|
||||
|
||||
fileExists = [fileManager fileExistsAtPath:cachePath];
|
||||
if (fileExists)
|
||||
macosx.buildingFontCache = 0;
|
||||
else
|
||||
macosx.buildingFontCache = 1;
|
||||
}
|
||||
|
||||
/*
|
||||
* Catch document open requests...this lets us notice files when the app
|
||||
* was launched by double-clicking a document, or when a document was
|
||||
|
|
@ -467,6 +563,13 @@ static void CustomApplicationMain (argc, argv)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
- (BOOL)textView:(NSTextView*)textView clickedOnLink:(id)link atIndex:(unsigned)charIndex
|
||||
{
|
||||
BOOL success;
|
||||
success = [[NSWorkspace sharedWorkspace] openURL: link];
|
||||
return success;
|
||||
}
|
||||
|
||||
/* Called when the internal event loop has just started running */
|
||||
- (void) applicationDidFinishLaunching: (NSNotification *) note
|
||||
{
|
||||
|
|
@ -477,6 +580,9 @@ static void CustomApplicationMain (argc, argv)
|
|||
|
||||
/* Set up Cocoa to SDL bridge */
|
||||
[self setupBridge];
|
||||
|
||||
/* Install any required files */
|
||||
[self installFiles];
|
||||
|
||||
/* Set the working directory to the .app's parent directory */
|
||||
[self setupWorkingDirectory:gFinderLaunch];
|
||||
|
|
@ -485,7 +591,8 @@ static void CustomApplicationMain (argc, argv)
|
|||
/* Set the main menu to contain the real app name instead of "SDL App" */
|
||||
[self fixMenu:[NSApp mainMenu] withAppName:getApplicationName()];
|
||||
#endif
|
||||
|
||||
sdlMain = self;
|
||||
|
||||
/* Hand off to main application code */
|
||||
gCalledAppMainline = TRUE;
|
||||
status = SDL_main (gArgc, gArgv);
|
||||
|
|
@ -535,7 +642,35 @@ static void CustomApplicationMain (argc, argv)
|
|||
|
||||
@end
|
||||
|
||||
@implementation NSFileManager (CreateDirectoryRecursively)
|
||||
|
||||
- (BOOL)createDirectoryRecursively:(NSString *)path attributes:(NSDictionary *)attributes
|
||||
{
|
||||
BOOL isDir = TRUE;
|
||||
BOOL fileExists;
|
||||
|
||||
fileExists = [self fileExistsAtPath:path isDirectory:&isDir];
|
||||
if (isDir) {
|
||||
if (fileExists) {
|
||||
/* directory exists */
|
||||
return TRUE;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* create directory */
|
||||
NSString *parentDirectory = [path stringByDeletingLastPathComponent];
|
||||
[self createDirectoryRecursively:parentDirectory attributes:attributes];
|
||||
return [self createDirectoryAtPath:path attributes:attributes];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* desired directory path is blocked by a file */
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
#ifdef main
|
||||
# undef main
|
||||
|
|
|
|||
32
macosx/TransparentTextView.h
Normal file
32
macosx/TransparentTextView.h
Normal file
|
|
@ -0,0 +1,32 @@
|
|||
//
|
||||
// TransparentTextView.h
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Martin Fuhrer on Wed Dec 12 2007.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@interface TransparentTextView : NSTextView
|
||||
{
|
||||
}
|
||||
|
||||
- (void)activateURLs;
|
||||
|
||||
@end
|
||||
92
macosx/TransparentTextView.m
Normal file
92
macosx/TransparentTextView.m
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
//
|
||||
// TransparentTextView.m
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Martin Fuhrer on Wed Dec 12 2007.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#import "TransparentTextView.h"
|
||||
|
||||
@implementation TransparentTextView
|
||||
|
||||
- (void)drawViewBackgroundInRect:(NSRect)rect
|
||||
{
|
||||
}
|
||||
|
||||
- (BOOL)isOpaque
|
||||
{
|
||||
return NO;
|
||||
}
|
||||
|
||||
- (void)activateURLs
|
||||
{
|
||||
NSTextStorage* textStorage = [self textStorage];
|
||||
NSString* string = [textStorage string];
|
||||
NSRange searchRange = NSMakeRange(0, [string length]);
|
||||
NSRange foundRange;
|
||||
|
||||
[textStorage beginEditing];
|
||||
do
|
||||
{
|
||||
// assume that all URLs are enclosed between < >
|
||||
foundRange = [string rangeOfString:@"<" options:0 range:searchRange];
|
||||
|
||||
if (foundRange.length > 0) //Did we find a URL?
|
||||
{
|
||||
NSURL* theURL;
|
||||
NSMutableString* theURLString;
|
||||
NSDictionary* linkAttributes;
|
||||
NSRange endOfURLRange, range;
|
||||
|
||||
// restrict the searchRange so that it won't find the same string again
|
||||
searchRange.location = foundRange.location + foundRange.length;
|
||||
searchRange.length = [string length] - searchRange.location;
|
||||
|
||||
// assume the URL ends with >
|
||||
endOfURLRange = [string rangeOfString:@">" options:0 range:searchRange];
|
||||
|
||||
// set foundRange's length to the length of the URL
|
||||
foundRange.location++;
|
||||
foundRange.length = endOfURLRange.location - foundRange.location;
|
||||
|
||||
// grab the URL from the text and format it properly
|
||||
range = [[string substringWithRange:foundRange] rangeOfString:@"@"];
|
||||
if (range.length > 0)
|
||||
theURLString = [NSMutableString stringWithString:@"mailto:"];
|
||||
else
|
||||
theURLString = [NSMutableString stringWithString:@"http://"];
|
||||
[theURLString appendString:[string substringWithRange:foundRange]];
|
||||
|
||||
// generate URL
|
||||
theURL = [NSURL URLWithString:theURLString];
|
||||
|
||||
// make the link attributes
|
||||
linkAttributes = [NSDictionary dictionaryWithObjectsAndKeys: theURL, NSLinkAttributeName,
|
||||
[NSColor blueColor], NSForegroundColorAttributeName, nil];
|
||||
|
||||
// apply those attributes to the URL in the text
|
||||
[textStorage addAttributes:linkAttributes range:foundRange];
|
||||
}
|
||||
}
|
||||
while (foundRange.length != 0); //repeat the do block until it no longer finds anything
|
||||
|
||||
[textStorage endEditing];
|
||||
}
|
||||
|
||||
@end
|
||||
11
macosx/credits.txt
Normal file
11
macosx/credits.txt
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
(c) 2007 Tux Paint Development Team
|
||||
|
||||
Website:
|
||||
<www.tuxpaint.org>
|
||||
|
||||
Mac OS X build:
|
||||
Martin Fuhrer <mfuhrer@gmail.com>
|
||||
|
||||
Universal binary made possible with assistance from:
|
||||
Carlo Gandolfi <www.freesmug.org>
|
||||
Douglas Barbieri
|
||||
318
macosx/fonts.conf
Normal file
318
macosx/fonts.conf
Normal file
|
|
@ -0,0 +1,318 @@
|
|||
<?xml version="1.0"?>
|
||||
<!DOCTYPE fontconfig SYSTEM "fonts.dtd">
|
||||
<!-- /etc/fonts.conf file to configure system font access -->
|
||||
<fontconfig>
|
||||
|
||||
<!--
|
||||
The intent of this standard configuration file is to be adequate for
|
||||
most environments. If you have a reasonably normal environment and
|
||||
have found problems with this configuration, they are probably
|
||||
things that others will also want fixed. Please send any suggested
|
||||
changes to fonts@xfree86.org so that future releases can include
|
||||
such changes.
|
||||
|
||||
Note that the normal 'make install' procedure for XFree86 is to
|
||||
replace any existing fonts.conf file with the new version. Place
|
||||
any local customizations in local.conf which this file references.
|
||||
|
||||
Keith Packard
|
||||
-->
|
||||
|
||||
<!-- Font directory list configured on Sun Sep 14 17:12:54 PDT 2003 -->
|
||||
|
||||
<dir>/Library/Fonts</dir>
|
||||
<dir>/Network/Library/Fonts</dir>
|
||||
<dir>/System/Library/Fonts</dir>
|
||||
<dir>/usr/X11R6/lib/X11/fonts/Type1</dir>
|
||||
<dir>/usr/X11R6/lib/X11/fonts/TTF</dir>
|
||||
<dir>/usr/share/fonts</dir>
|
||||
<dir>~/Library/Fonts</dir>
|
||||
<dir>~/.fonts</dir>
|
||||
|
||||
<cache>~/.fontconfig</cache>
|
||||
<!--
|
||||
Enable sub-pixel rendering
|
||||
<match target="font">
|
||||
<test qual="all" name="rgba">
|
||||
<const>unknown</const>
|
||||
</test>
|
||||
<edit name="rgba" mode="assign"><const>rgb</const></edit>
|
||||
</match>
|
||||
-->
|
||||
|
||||
<!--
|
||||
Accept deprecated 'mono' alias, replacing it with 'monospace'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>mono</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign">
|
||||
<string>monospace</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Accept alternate 'sans serif' spelling, replacing it with 'sans-serif'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>sans serif</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign">
|
||||
<string>sans-serif</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Accept deprecated 'sans' alias, replacing it with 'sans-serif'
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="any" name="family">
|
||||
<string>sans</string>
|
||||
</test>
|
||||
<edit name="family" mode="assign">
|
||||
<string>sans-serif</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Mark common families with their generics so we'll get
|
||||
something reasonable
|
||||
-->
|
||||
|
||||
<!--
|
||||
Serif faces
|
||||
-->
|
||||
<alias>
|
||||
<family>Times</family>
|
||||
<family>Times New Roman</family>
|
||||
<family>Nimbus Roman No9 L</family>
|
||||
<family>Luxi Serif</family>
|
||||
<family>Kochi Mincho</family>
|
||||
<family>AR PL SungtiL GB</family>
|
||||
<family>AR PL Mingti2L Big5</family>
|
||||
<family>Baekmuk Batang</family>
|
||||
<default><family>serif</family></default>
|
||||
</alias>
|
||||
<!--
|
||||
Sans-serif faces
|
||||
-->
|
||||
<alias>
|
||||
<family>Lucida Grande</family>
|
||||
<family>Geneva</family>
|
||||
<family>Helvetica</family>
|
||||
<family>Arial</family>
|
||||
<family>Verdana</family>
|
||||
<family>Nimbus Sans L</family>
|
||||
<family>Luxi Sans</family>
|
||||
<family>Osaka</family>
|
||||
<family>Kochi Gothic</family>
|
||||
<family>AR PL KaitiM GB</family>
|
||||
<family>AR PL KaitiM Big5</family>
|
||||
<family>Baekmuk Dotum</family>
|
||||
<family>SimSun</family>
|
||||
<default><family>sans-serif</family></default>
|
||||
</alias>
|
||||
<!--
|
||||
Monospace faces
|
||||
-->
|
||||
<alias>
|
||||
<family>Monaco</family>
|
||||
<family>Courier</family>
|
||||
<family>Courier New</family>
|
||||
<family>Andale Mono</family>
|
||||
<family>Luxi Mono</family>
|
||||
<family>Nimbus Mono L</family>
|
||||
<family>NSimSun</family>
|
||||
<default><family>monospace</family></default>
|
||||
</alias>
|
||||
<!--
|
||||
If the font still has no generic name, add sans-serif
|
||||
-->
|
||||
<match target="pattern">
|
||||
<test qual="all" name="family" compare="not_eq">
|
||||
<string>sans-serif</string>
|
||||
</test>
|
||||
<test qual="all" name="family" compare="not_eq">
|
||||
<string>serif</string>
|
||||
</test>
|
||||
<test qual="all" name="family" compare="not_eq">
|
||||
<string>monospace</string>
|
||||
</test>
|
||||
<edit name="family" mode="append_last">
|
||||
<string>sans-serif</string>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<!--
|
||||
Load per-user customization file
|
||||
-->
|
||||
<include ignore_missing="yes">~/.fonts.conf</include>
|
||||
|
||||
<!--
|
||||
Load local system customization file
|
||||
-->
|
||||
<include ignore_missing="yes">local.conf</include>
|
||||
|
||||
<!--
|
||||
Alias well known font names to available TrueType fonts
|
||||
-->
|
||||
<alias>
|
||||
<family>Times</family>
|
||||
<accept><family>Times New Roman</family></accept>
|
||||
</alias>
|
||||
<alias>
|
||||
<family>Helvetica</family>
|
||||
<accept><family>Verdana</family></accept>
|
||||
</alias>
|
||||
<alias>
|
||||
<family>Arial</family>
|
||||
<accept><family>Verdana</family></accept>
|
||||
</alias>
|
||||
<alias>
|
||||
<family>Courier</family>
|
||||
<accept><family>Courier New</family></accept>
|
||||
</alias>
|
||||
|
||||
<!--
|
||||
Provide required aliases for standard names
|
||||
-->
|
||||
<alias>
|
||||
<family>serif</family>
|
||||
<prefer>
|
||||
<family>Times New Roman</family>
|
||||
<family>Nimbus Roman No9 L</family>
|
||||
<family>Luxi Serif</family>
|
||||
<family>Times</family>
|
||||
<family>Kochi Mincho</family>
|
||||
<family>AR PL SungtiL GB</family>
|
||||
<family>AR PL Mingti2L Big5</family>
|
||||
<family>Baekmuk Batang</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
<alias>
|
||||
<family>sans-serif</family>
|
||||
<prefer>
|
||||
<family>Lucida Grande</family>
|
||||
<family>Geneva</family>
|
||||
<family>Verdana</family>
|
||||
<family>Nimbus Sans L</family>
|
||||
<family>Luxi Sans</family>
|
||||
<family>Arial</family>
|
||||
<family>Helvetica</family>
|
||||
<family>Kochi Gothic</family>
|
||||
<family>Osaka</family>
|
||||
<family>AR PL KaitiM GB</family>
|
||||
<family>AR PL KaitiM Big5</family>
|
||||
<family>Baekmuk Dotum</family>
|
||||
<family>SimSun</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
<alias>
|
||||
<family>monospace</family>
|
||||
<prefer>
|
||||
<family>Monaco</family>
|
||||
<family>Andale Mono</family>
|
||||
<family>Courier New</family>
|
||||
<family>Luxi Mono</family>
|
||||
<family>Nimbus Mono L</family>
|
||||
<family>Kochi Gothic</family>
|
||||
<family>AR PL KaitiM GB</family>
|
||||
<family>Baekmuk Dotum</family>
|
||||
</prefer>
|
||||
</alias>
|
||||
|
||||
<!--
|
||||
Artificial oblique for fonts without an italic or oblique version
|
||||
-->
|
||||
|
||||
<match target="font">
|
||||
<!-- check to see if the font is roman -->
|
||||
<test name="slant">
|
||||
<const>roman</const>
|
||||
</test>
|
||||
<!-- check to see if the pattern requested non-roman -->
|
||||
<test target="pattern" name="slant" compare="not_eq">
|
||||
<const>roman</const>
|
||||
</test>
|
||||
<!-- multiply the matrix to slant the font -->
|
||||
<edit name="matrix" mode="assign">
|
||||
<times>
|
||||
<name>matrix</name>
|
||||
<matrix><double>1</double><double>.2</double>
|
||||
<double>0</double><double>1</double>
|
||||
</matrix>
|
||||
</times>
|
||||
</edit>
|
||||
<!-- pretend the font is oblique now -->
|
||||
<edit name="slant" mode="assign">
|
||||
<const>oblique</const>
|
||||
</edit>
|
||||
</match>
|
||||
|
||||
<config>
|
||||
<!--
|
||||
These are the default Unicode chars that are expected to be blank
|
||||
in fonts. All other blank chars are assumed to be broken and
|
||||
won't appear in the resulting charsets
|
||||
-->
|
||||
<blank>
|
||||
<int>0x0020</int> <!-- SPACE -->
|
||||
<int>0x00a0</int> <!-- NO-BREAK SPACE -->
|
||||
<int>0x00ad</int> <!-- SOFT HYPHEN -->
|
||||
<int>0x115f</int> <!-- HANGUL CHOSEONG FILLER -->
|
||||
<int>0x1160</int> <!-- HANGUL JUNGSEONG FILLER -->
|
||||
<int>0x1680</int> <!-- OGHAM SPACE MARK -->
|
||||
<int>0x2000</int> <!-- EN QUAD -->
|
||||
<int>0x2001</int> <!-- EM QUAD -->
|
||||
<int>0x2002</int> <!-- EN SPACE -->
|
||||
<int>0x2003</int> <!-- EM SPACE -->
|
||||
<int>0x2004</int> <!-- THREE-PER-EM SPACE -->
|
||||
<int>0x2005</int> <!-- FOUR-PER-EM SPACE -->
|
||||
<int>0x2006</int> <!-- SIX-PER-EM SPACE -->
|
||||
<int>0x2007</int> <!-- FIGURE SPACE -->
|
||||
<int>0x2008</int> <!-- PUNCTUATION SPACE -->
|
||||
<int>0x2009</int> <!-- THIN SPACE -->
|
||||
<int>0x200a</int> <!-- HAIR SPACE -->
|
||||
<int>0x200b</int> <!-- ZERO WIDTH SPACE -->
|
||||
<int>0x200c</int> <!-- ZERO WIDTH NON-JOINER -->
|
||||
<int>0x200d</int> <!-- ZERO WIDTH JOINER -->
|
||||
<int>0x200e</int> <!-- LEFT-TO-RIGHT MARK -->
|
||||
<int>0x200f</int> <!-- RIGHT-TO-LEFT MARK -->
|
||||
<int>0x2028</int> <!-- LINE SEPARATOR -->
|
||||
<int>0x2029</int> <!-- PARAGRAPH SEPARATOR -->
|
||||
<int>0x202a</int> <!-- LEFT-TO-RIGHT EMBEDDING -->
|
||||
<int>0x202b</int> <!-- RIGHT-TO-LEFT EMBEDDING -->
|
||||
<int>0x202c</int> <!-- POP DIRECTIONAL FORMATTING -->
|
||||
<int>0x202d</int> <!-- LEFT-TO-RIGHT OVERRIDE -->
|
||||
<int>0x202e</int> <!-- RIGHT-TO-LEFT OVERRIDE -->
|
||||
<int>0x202f</int> <!-- NARROW NO-BREAK SPACE -->
|
||||
<int>0x205f</int> <!-- MEDIUM MATHEMATICAL SPACE -->
|
||||
<int>0x2060</int> <!-- WORD JOINER -->
|
||||
<int>0x2061</int> <!-- FUNCTION APPLICATION -->
|
||||
<int>0x2062</int> <!-- INVISIBLE TIMES -->
|
||||
<int>0x2063</int> <!-- INVISIBLE SEPARATOR -->
|
||||
<int>0x206A</int> <!-- INHIBIT SYMMETRIC SWAPPING -->
|
||||
<int>0x206B</int> <!-- ACTIVATE SYMMETRIC SWAPPING -->
|
||||
<int>0x206C</int> <!-- INHIBIT ARABIC FORM SHAPING -->
|
||||
<int>0x206D</int> <!-- ACTIVATE ARABIC FORM SHAPING -->
|
||||
<int>0x206E</int> <!-- NATIONAL DIGIT SHAPES -->
|
||||
<int>0x206F</int> <!-- NOMINAL DIGIT SHAPES -->
|
||||
<int>0x3000</int> <!-- IDEOGRAPHIC SPACE -->
|
||||
<int>0x3164</int> <!-- HANGUL FILLER -->
|
||||
<int>0xfeff</int> <!-- ZERO WIDTH NO-BREAK SPACE -->
|
||||
<int>0xffa0</int> <!-- HALFWIDTH HANGUL FILLER -->
|
||||
<int>0xfff9</int> <!-- INTERLINEAR ANNOTATION ANCHOR -->
|
||||
<int>0xfffa</int> <!-- INTERLINEAR ANNOTATION SEPARATOR -->
|
||||
<int>0xfffa</int> <!-- INTERLINEAR ANNOTATION TERMINATOR -->
|
||||
</blank>
|
||||
<!--
|
||||
Rescan configuration every 30 seconds when FcFontSetList is called
|
||||
-->
|
||||
<rescan>
|
||||
<int>30</int>
|
||||
</rescan>
|
||||
</config>
|
||||
|
||||
</fontconfig>
|
||||
222
macosx/fonts.dtd
Normal file
222
macosx/fonts.dtd
Normal file
|
|
@ -0,0 +1,222 @@
|
|||
<!-- This is the Document Type Definition for font configuration files -->
|
||||
<!ELEMENT fontconfig (dir |
|
||||
cache |
|
||||
cachedir |
|
||||
include |
|
||||
config |
|
||||
selectfont |
|
||||
match |
|
||||
alias)* >
|
||||
|
||||
<!--
|
||||
Add a directory that provides fonts
|
||||
-->
|
||||
<!ELEMENT dir (#PCDATA)>
|
||||
<!ATTLIST dir xml:space (default|preserve) 'preserve'>
|
||||
|
||||
<!--
|
||||
Define the per-user file that holds cache font information.
|
||||
|
||||
If the filename begins with '~', it is replaced with the users
|
||||
home directory path.
|
||||
-->
|
||||
<!ELEMENT cache (#PCDATA)>
|
||||
<!ATTLIST cache xml:space (default|preserve) 'preserve'>
|
||||
|
||||
<!--
|
||||
Add a directory that is searched for font cache files.
|
||||
These hold per-directory cache data and are searched in
|
||||
order for each directory. When writing cache files, the first
|
||||
directory which allows the cache file to be created is used.
|
||||
|
||||
A leading '~' in a directory name is replaced with the users
|
||||
home directory path.
|
||||
-->
|
||||
<!ELEMENT cachedir (#PCDATA)>
|
||||
<!ATTLIST cachedir xml:space (default|preserve) 'preserve'>
|
||||
|
||||
<!--
|
||||
Reference another configuration file; note that this
|
||||
is another complete font configuration file and not
|
||||
just a file included by the XML parser.
|
||||
|
||||
Set 'ignore_missing' to 'yes' if errors are to be ignored.
|
||||
|
||||
If the filename begins with '~', it is replaced with the users
|
||||
home directory path.
|
||||
-->
|
||||
<!ELEMENT include (#PCDATA)>
|
||||
<!ATTLIST include
|
||||
ignore_missing (no|yes) "no"
|
||||
xml:space (default|preserve) "preserve">
|
||||
|
||||
<!--
|
||||
Global library configuration data
|
||||
-->
|
||||
<!ELEMENT config (blank|rescan)*>
|
||||
|
||||
<!--
|
||||
Specify the set of Unicode encoding values which
|
||||
represent glyphs that are allowed to contain no
|
||||
data. With this list, fontconfig can examine
|
||||
fonts for broken glyphs and eliminate them from
|
||||
the set of valid Unicode chars. This idea
|
||||
was borrowed from Mozilla
|
||||
-->
|
||||
<!ELEMENT blank (int)*>
|
||||
|
||||
<!--
|
||||
Aliases are just a special case for multiple match elements
|
||||
|
||||
They are syntactically equivalent to:
|
||||
|
||||
<match>
|
||||
<test name="family">
|
||||
<string value=[family]/>
|
||||
</test>
|
||||
<edit name="family" mode="prepend">
|
||||
<string value=[prefer]/>
|
||||
...
|
||||
</edit>
|
||||
<edit name="family" mode="append">
|
||||
<string value=[accept]/>
|
||||
...
|
||||
</edit>
|
||||
<edit name="family" mode="append_last">
|
||||
<string value=[default]/>
|
||||
...
|
||||
</edit>
|
||||
</match>
|
||||
-->
|
||||
<!--
|
||||
Periodically rescan the font configuration and
|
||||
directories to synch internal state with filesystem
|
||||
-->
|
||||
<!ELEMENT rescan (int)>
|
||||
|
||||
<!--
|
||||
Edit list of available fonts at startup/reload time
|
||||
-->
|
||||
<!ELEMENT selectfont (rejectfont | acceptfont)* >
|
||||
|
||||
<!ELEMENT rejectfont (glob | pattern)*>
|
||||
|
||||
<!ELEMENT acceptfont (glob | pattern)*>
|
||||
|
||||
<!ELEMENT glob (#PCDATA)>
|
||||
|
||||
<!ELEMENT pattern (patelt)*>
|
||||
|
||||
<!ENTITY % constant 'int|double|string|matrix|bool|charset|const'>
|
||||
|
||||
<!ELEMENT patelt (%constant;)*>
|
||||
<!ATTLIST patelt
|
||||
name CDATA #REQUIRED>
|
||||
|
||||
<!ELEMENT alias (family*, prefer?, accept?, default?)>
|
||||
<!ELEMENT prefer (family)*>
|
||||
<!ELEMENT accept (family)*>
|
||||
<!ELEMENT default (family)*>
|
||||
<!ELEMENT family (#PCDATA)>
|
||||
<!ATTLIST family xml:space (default|preserve) 'preserve'>
|
||||
|
||||
<!ENTITY % expr 'int|double|string|matrix|bool|charset
|
||||
|name|const
|
||||
|or|and|eq|not_eq|less|less_eq|more|more_eq|contains|not_contains
|
||||
|plus|minus|times|divide|not|if|floor|ceil|round|trunc'>
|
||||
|
||||
<!--
|
||||
Match and edit patterns.
|
||||
|
||||
If 'target' is 'pattern', execute the match before selecting a font.
|
||||
if 'target' is 'font', execute the match on the result of a font
|
||||
selection.
|
||||
-->
|
||||
<!ELEMENT match (test*, edit*)>
|
||||
<!ATTLIST match
|
||||
target (pattern|font|scan) "pattern">
|
||||
|
||||
<!--
|
||||
Match a field in a pattern
|
||||
|
||||
if 'qual' is 'any', then the match succeeds if any value in the field matches.
|
||||
if 'qual' is 'all', then the match succeeds only if all values match.
|
||||
if 'qual' is 'first', then the match succeeds only if the first value matches.
|
||||
if 'qual' is 'not_first', then the match succeeds only if any value other than
|
||||
the first matches.
|
||||
For match elements with target=font, if test 'target' is 'pattern',
|
||||
then the test is applied to the pattern used in matching rather than
|
||||
to the resulting font.
|
||||
|
||||
Match elements with target=scan are applied as fonts are scanned.
|
||||
They edit the pattern generated from the scanned font and affect
|
||||
what the fontconfig database contains.
|
||||
-->
|
||||
<!ELEMENT test (%expr;)*>
|
||||
<!ATTLIST test
|
||||
qual (any|all|first|not_first) "any"
|
||||
name CDATA #REQUIRED
|
||||
target (pattern|font|default) "default"
|
||||
compare (eq|not_eq|less|less_eq|more|more_eq|contains|not_contains) "eq">
|
||||
|
||||
<!--
|
||||
Edit a field in a pattern
|
||||
|
||||
The enclosed values are used together to edit the list of values
|
||||
associated with 'name'.
|
||||
|
||||
If 'name' matches one of those used in a test element for this match element:
|
||||
if 'mode' is 'assign', replace the matched value.
|
||||
if 'mode' is 'assign_replace', replace all of the values
|
||||
if 'mode' is 'prepend', insert before the matched value
|
||||
if 'mode' is 'append', insert after the matched value
|
||||
if 'mode' is 'prepend_first', insert before all of the values
|
||||
if 'mode' is 'append_last', insert after all of the values
|
||||
If 'name' doesn't match any of those used in a test element:
|
||||
if 'mode' is 'assign' or 'assign_replace, replace all of the values
|
||||
if 'mode' is 'prepend' or 'prepend_first', insert before all of the values
|
||||
if 'mode' is 'append' or 'append_last', insert after all of the values
|
||||
-->
|
||||
<!ELEMENT edit (%expr;)*>
|
||||
<!ATTLIST edit
|
||||
name CDATA #REQUIRED
|
||||
mode (assign|assign_replace|prepend|append|prepend_first|append_last) "assign"
|
||||
binding (weak|strong|same) "weak">
|
||||
|
||||
<!--
|
||||
Elements of expressions follow
|
||||
-->
|
||||
<!ELEMENT int (#PCDATA)>
|
||||
<!ATTLIST int xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT double (#PCDATA)>
|
||||
<!ATTLIST double xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT string (#PCDATA)>
|
||||
<!ATTLIST string xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT matrix (double,double,double,double)>
|
||||
<!ELEMENT bool (#PCDATA)>
|
||||
<!ELEMENT charset (#PCDATA)>
|
||||
<!ATTLIST charset xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT name (#PCDATA)>
|
||||
<!ATTLIST name xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT const (#PCDATA)>
|
||||
<!ATTLIST const xml:space (default|preserve) 'preserve'>
|
||||
<!ELEMENT or (%expr;)*>
|
||||
<!ELEMENT and (%expr;)*>
|
||||
<!ELEMENT eq ((%expr;), (%expr;))>
|
||||
<!ELEMENT not_eq ((%expr;), (%expr;))>
|
||||
<!ELEMENT less ((%expr;), (%expr;))>
|
||||
<!ELEMENT less_eq ((%expr;), (%expr;))>
|
||||
<!ELEMENT more ((%expr;), (%expr;))>
|
||||
<!ELEMENT more_eq ((%expr;), (%expr;))>
|
||||
<!ELEMENT contains ((%expr;), (%expr;))>
|
||||
<!ELEMENT not_contains ((%expr;), (%expr;))>
|
||||
<!ELEMENT plus (%expr;)*>
|
||||
<!ELEMENT minus (%expr;)*>
|
||||
<!ELEMENT times (%expr;)*>
|
||||
<!ELEMENT divide (%expr;)*>
|
||||
<!ELEMENT not (%expr;)>
|
||||
<!ELEMENT if ((%expr;), (%expr;), (%expr;))>
|
||||
<!ELEMENT floor (%expr;)>
|
||||
<!ELEMENT ceil (%expr;)>
|
||||
<!ELEMENT round (%expr;)>
|
||||
<!ELEMENT trunc (%expr;)>
|
||||
27
macosx/message.h
Normal file
27
macosx/message.h
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
//
|
||||
// message.h
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Martin Fuhrer on Sat Dec 8 2007.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#define MSG_FONT_CACHE 1
|
||||
|
||||
void displayMessage( int msgId );
|
||||
void hideMessage();
|
||||
55
macosx/message.m
Normal file
55
macosx/message.m
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
//
|
||||
// message.m
|
||||
// Tux Paint
|
||||
//
|
||||
// Created by Martin Fuhrer on Sat Dec 8 2007.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#import "SDLMain.h"
|
||||
#import "message.h"
|
||||
|
||||
extern SDLMain* sdlMain;
|
||||
|
||||
void displayMessage( int msgId )
|
||||
{
|
||||
NSString *message = nil;
|
||||
NSString *status = nil;
|
||||
|
||||
if( sdlMain == nil )
|
||||
return;
|
||||
|
||||
switch( msgId )
|
||||
{
|
||||
case( MSG_FONT_CACHE ):
|
||||
message = @"I'm currently fishing for fonts on your Mac. This may take me a minute, as I'd much rather be feeding on fish from the sea.";
|
||||
status = @"Status: Caching fonts (this only needs to be done once)...";
|
||||
[sdlMain displayMessage:message andStatus:status withProgressIndicator:YES];
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void hideMessage()
|
||||
{
|
||||
if( sdlMain == nil )
|
||||
return;
|
||||
|
||||
[sdlMain hideMessage];
|
||||
}
|
||||
25
macosx/speech.h
Normal file
25
macosx/speech.h
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
//
|
||||
// speech.h
|
||||
// TuxPaint
|
||||
//
|
||||
// Created by Martin Fuhrer on 13/12/07.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
void speak_string(const wchar_t *str);
|
||||
|
||||
51
macosx/speech.m
Normal file
51
macosx/speech.m
Normal file
|
|
@ -0,0 +1,51 @@
|
|||
//
|
||||
// speech.m
|
||||
// TuxPaint
|
||||
//
|
||||
// Created by Martin Fuhrer on 13/12/07.
|
||||
// Copyright (c) 2007 Martin Fuhrer.
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import "speech.h"
|
||||
#import "i18n.h"
|
||||
|
||||
void speak_string(const wchar_t *widecharString)
|
||||
{
|
||||
char multibyteString[1024];
|
||||
NSString *string = [NSString string];
|
||||
|
||||
// speech synthesizer can pronounce only English phonemes and syllables
|
||||
int lang = get_current_language();
|
||||
if( lang != LANG_EN && lang != LANG_EN_GB && lang != LANG_EN_ZA )
|
||||
return;
|
||||
|
||||
NSArray *voices = [NSSpeechSynthesizer availableVoices];
|
||||
NSSpeechSynthesizer *synthesizer = [[NSSpeechSynthesizer alloc] init];
|
||||
|
||||
wcstombs(multibyteString,widecharString,sizeof(multibyteString));
|
||||
if( [string respondsToSelector:@selector(string:stringWithCString:encoding:)] )
|
||||
string = [NSString stringWithCString:multibyteString encoding:NSUTF8StringEncoding];
|
||||
else
|
||||
string = [NSString stringWithCString:multibyteString];
|
||||
|
||||
// speak string using a random voice
|
||||
[synthesizer setVoice:[voices objectAtIndex:rand()%[voices count]]];
|
||||
[synthesizer startSpeakingString:string];
|
||||
[synthesizer release];
|
||||
}
|
||||
138
macosx/tp_magic_api.h
Normal file
138
macosx/tp_magic_api.h
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
#ifndef TP_MAGIC_API_H
|
||||
#define TP_MAGIC_API_H
|
||||
|
||||
#include "SDL.h"
|
||||
#include "SDL_mixer.h"
|
||||
|
||||
|
||||
/* min() and max() variable comparisons: */
|
||||
|
||||
#ifdef __GNUC__
|
||||
// This version has strict type checking for safety.
|
||||
// See the "unnecessary" pointer comparison. (from Linux)
|
||||
#define min(x,y) ({ \
|
||||
typeof(x) _x = (x); \
|
||||
typeof(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x < _y ? _x : _y; })
|
||||
#define max(x,y) ({ \
|
||||
typeof(x) _x = (x); \
|
||||
typeof(y) _y = (y); \
|
||||
(void) (&_x == &_y); \
|
||||
_x > _y ? _x : _y; })
|
||||
#else
|
||||
#define min(a,b) (((a) < (b)) ? (a) : (b))
|
||||
#define max(a,b) (((a) > (b)) ? (a) : (b))
|
||||
#endif
|
||||
|
||||
|
||||
/* clamp() returns 'value', unless it's less than 'lo' or greater than 'hi',
|
||||
in which cases it returns 'lo' or 'hi', respectively: */
|
||||
|
||||
#define clamp(lo,value,hi) (min(max(value,lo),hi))
|
||||
|
||||
|
||||
/* Flags you can send to 'special_notify' */
|
||||
|
||||
/* The image has been mirrored (so starter should be, too) */
|
||||
/* (as of API version 0x00000001) */
|
||||
|
||||
#define SPECIAL_MIRROR 0x0001
|
||||
|
||||
/* The image has been flipped (so starter should be, too) */
|
||||
/* (as of API version 0x00000001) */
|
||||
#define SPECIAL_FLIP 0x0002
|
||||
|
||||
|
||||
typedef struct magic_api_t {
|
||||
/* A string containing the current version of Tux Paint (e.g., "0.9.18") */
|
||||
char * tp_version;
|
||||
|
||||
/* A string containing Tux Paint's data directory
|
||||
(e.g., "/usr/local/share/tuxpaint/") */
|
||||
char * data_directory;
|
||||
|
||||
/* Call to have Tux Paint draw (and animate) its progress bar */
|
||||
void (*update_progress_bar)(void);
|
||||
|
||||
/* Call to request special events; see "SPECIAL_..." flags, above */
|
||||
void (*special_notify)(int);
|
||||
|
||||
/* Converts an RGB byte to a linear float */
|
||||
float (*sRGB_to_linear)(Uint8);
|
||||
|
||||
/* Converts a linear float to an RGB byte */
|
||||
Uint8 (*linear_to_sRGB)(float);
|
||||
|
||||
/* Returns whether an (x,y) location is within a circle of a particular
|
||||
radius (centered around the origin: (0,0)); useful for creating tools
|
||||
that have a circular 'brush' */
|
||||
int (*in_circle)(int,int,int);
|
||||
|
||||
/* Receives an SDL pixel value from the surface at an (x,y) location;
|
||||
use "SDL_GetRGB()" to convert the Uint32 into a Uint8 RGB values;
|
||||
NOTE: Use SDL_LockSurface() on the surface before doing (a batch of)
|
||||
this call! Use SDL_UnlockSurface() when you're done.
|
||||
SDL_MustLockSurface() can tell you whether a surface needs to be locked. */
|
||||
Uint32 (*getpixel)(SDL_Surface *, int, int);
|
||||
|
||||
/* Assigns an SDL pixel value on a surface at an (x,y) location;
|
||||
use "SDL_MapRGB()" to convert a triplet of Uint8 RGB values to a Uint32;
|
||||
NOTE: Use SDL_LockSurface() on the surface before doing (a batch of)
|
||||
this call! Use SDL_UnlockSurface() when you're done.
|
||||
SDL_MustLockSurface() can tell you whether a surface needs to be locked. */
|
||||
void (*putpixel)(SDL_Surface *, int, int, Uint32);
|
||||
|
||||
/* Asks Tux Paint to play a sound (one loaded via SDL_mixer library);
|
||||
the first value is for left/right panning (0 is left, 128 is center,
|
||||
255 is right); the second value is for total volume (0 is off, 255 is
|
||||
loudest) */
|
||||
void (*playsound)(Mix_Chunk *, int, int);
|
||||
|
||||
/* Asks Tux Paint to stop playing the sound played by 'playsound()' */
|
||||
void (*stopsound)(void);
|
||||
|
||||
/* Asks Tux Paint to calculate a line between (x1,y1) and (x2,y2);
|
||||
every 'step' iterations, it will call your callback function
|
||||
(which must accept a 'magic_api *' Magic API pointer and 'which' integer
|
||||
for which tool is being used, the 'last' and current ('canvas')
|
||||
SDL_Surfaces, and an (x,y) position) */
|
||||
void (*line)(void *, int, SDL_Surface *, SDL_Surface *, int, int, int, int, int, void (*)(void *, int, SDL_Surface *, SDL_Surface *, int, int));
|
||||
|
||||
/* Returns whether the mouse button is down */
|
||||
int (*button_down)(void);
|
||||
|
||||
/* Converts RGB bytes into HSV floats */
|
||||
void (*rgbtohsv)(Uint8, Uint8, Uint8, float *, float *, float *);
|
||||
|
||||
/* Converts HSV floats into RGB bytes */
|
||||
void (*hsvtorgb)(float, float, float, Uint8 *, Uint8 *, Uint8 *);
|
||||
|
||||
/* Holds Tux Paint's canvas dimensions */
|
||||
int canvas_w;
|
||||
int canvas_h;
|
||||
|
||||
/* Returns a new surface containing the scaled contents of an input
|
||||
surface, scaled to, at maximum, w x h dimensions
|
||||
(keeping aspect ratio, if requested; check the return surface's
|
||||
'w' and 'h' elements to confirm the actual size) */
|
||||
SDL_Surface * (*scale)(SDL_Surface *, int, int, int);
|
||||
|
||||
/* Returns whether a particular position of the canvas has been labeled
|
||||
as 'touched,' since the mouse was first clicked; this function ALSO
|
||||
assigns the position as touched, until the next time the mouse is
|
||||
clicked; useful for not applying the same effect from 'last' to 'canvas'
|
||||
more than once per click-and-drag sequence */
|
||||
Uint8 (*touched)(int, int);
|
||||
} magic_api;
|
||||
|
||||
|
||||
/* The version of the Tux Paint Magic tool API you are being compiled
|
||||
against. Your 'XYZ_api_version()' should return this value.
|
||||
If Tux Paint deems you compatible, it will call your 'XYZ_init()' (etc.)
|
||||
and you will be active. */
|
||||
|
||||
#define TP_MAGIC_API_VERSION 0x00000001
|
||||
|
||||
#endif
|
||||
|
||||
|
|
@ -14,14 +14,16 @@
|
|||
|
||||
struct WrapperDataStruct
|
||||
{
|
||||
char dataPath[2048]; // path to data folder inside Tux Paint application bundle
|
||||
char preferencesPath[2048]; // path to the user's Tux Paint preferences folder
|
||||
char fontsPath[2048]; // path to the user's fonts folder
|
||||
int foundSDL; // was SDL.framework found?
|
||||
int foundSDL_image; // was SDL_image.framework found?
|
||||
int foundSDL_mixer; // was SDL_mixer.framework found?
|
||||
int cocoaKeystrokes; // should keystrokes be intercepted by Cocoa wrapper?
|
||||
int menuAction; // was the action initiated by a Mac OS X menu selection?
|
||||
char dataPath[2048]; // path to data folder inside Tux Paint application bundle
|
||||
char preferencesPath[2048]; // path to the user's Tux Paint preferences folder
|
||||
char globalPreferencesPath[2048]; // path to all users' Tux Paint preferences folder
|
||||
char fontsPath[2048]; // path to the user's fonts folder
|
||||
int buildingFontCache; // is the FontConfig font cache currently being built?
|
||||
int foundSDL; // was SDL.framework found?
|
||||
int foundSDL_image; // was SDL_image.framework found?
|
||||
int foundSDL_mixer; // was SDL_mixer.framework found?
|
||||
int cocoaKeystrokes; // should keystrokes be intercepted by Cocoa wrapper?
|
||||
int menuAction; // was the action initiated by a Mac OS X menu selection?
|
||||
};
|
||||
|
||||
typedef struct WrapperDataStruct WrapperData;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue