New: XcodeCapp 3, a major overhaul.
- Updated project to Xcode 4. - Reorganized files into preferred Xcode 4 hierarchy. - Updated code to use properties. - Eliminated unused/redundant code. - Significantly optimized project scans. - Added support for outlets, actions and resources in user frameworks. - Now using bindings throughout. - New application icon, Retina ready. - New status menu icons. - Reorganized menu. - Added Preferences… menu item. - Parsing errors and nib2cib errors are actually logged to the errors panel now. - When an error occurs, the errors panel automatically opens, unless the "Automatically open Errors & Warnings panel" preference is off. - Double-clicking an error or selecting an error and clicking Open opens the error in the preferred editor for .j files (or Xcode for .xibs). The cursor jumps to the offending line in the following editors: Sublime Text, TextWrangler, BBEdit, TextMate, Chocolate, MacVim. - The Errors panel now remembers its position/size. - When a project is loaded, the errors panel is cleared. - When a file is modified, any pre-existing errors for that file are removed. - Updated to Growl framework 2.0.1. - If Notification Center is available (OS X 10.8+), that is used instead of Growl. - .xcodecapp-ignore now supports ignoring a directory by suffixing the name with "/". - .xcodecapp-ignore now supports include expressions prefixed with "!". - Significantly optimized filename matching against ignored paths. - .XcodeSupport has been renamed XcodeSupport to make it visible, so that trashing it is easier if things get out of sync. - The template Xcode project now contains no frameworks or targets, so Xcode does not show any warnings or errors, and the user cannot accidentally try to build. - Removing a file now removes the file from the Xcode project. - Shadow files replace forward slash with U+2215 (DIVISION SLASH), which looks like forward slash but is a character that is extremely unlikely to be in a filename.
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <CoreServices/CoreServices.h>
|
||||
|
||||
#import "TNXcodeCapp.h"
|
||||
|
||||
@interface AppController : NSObject <NSApplicationDelegate, NSMenuDelegate>
|
||||
|
||||
@property (strong) IBOutlet NSMenu *statusMenu;
|
||||
@property (assign) IBOutlet NSMenuItem *menuItemHistory;
|
||||
@property (assign) IBOutlet NSMenuItem *menuItemOpenInXcode;
|
||||
@property (assign) IBOutlet NSMenuItem *menuItemListen;
|
||||
|
||||
@property (strong) IBOutlet NSPanel *aboutWindow;
|
||||
@property (strong) IBOutlet NSWindow *preferencesWindow;
|
||||
|
||||
@property (strong) IBOutlet NSWindow *helpWindow;
|
||||
@property (assign) IBOutlet NSTextView *helpTextView;
|
||||
|
||||
@property (strong) IBOutlet NSUserDefaultsController *preferencesController;
|
||||
@property (strong) IBOutlet TNXcodeCapp *xcc;
|
||||
|
||||
+ (AppController *)sharedAppController;
|
||||
|
||||
- (IBAction)listenToProject:(id)aSender;
|
||||
- (IBAction)openInXcode:(id)aSender;
|
||||
- (IBAction)openHelp:(id)aSender;
|
||||
- (IBAction)openAbout:(id)aSender;
|
||||
|
||||
@end
|
||||
|
||||
@@ -0,0 +1,338 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
|
||||
#import <AppKit/NSApplication.h>
|
||||
|
||||
#import "AppController.h"
|
||||
#import "TNXcodeCapp.h"
|
||||
#import "UserDefaults.h"
|
||||
|
||||
#include "macros.h"
|
||||
|
||||
|
||||
const NSInteger kHelpMenuItemTag = 7;
|
||||
|
||||
AppController *SharedAppControllerInstance = nil;
|
||||
|
||||
|
||||
@interface AppController ()
|
||||
|
||||
@property BOOL supportsFileModeListening;
|
||||
@property (nonatomic) NSImage *iconActive;
|
||||
@property (nonatomic) NSImage *iconInactive;
|
||||
@property (nonatomic) NSImage *iconWorking;
|
||||
@property (nonatomic) NSMenu *menuHistory;
|
||||
@property NSStatusItem *statusItem;
|
||||
|
||||
@end
|
||||
|
||||
|
||||
@implementation AppController
|
||||
|
||||
+ (AppController *)sharedAppController
|
||||
{
|
||||
return SharedAppControllerInstance;
|
||||
}
|
||||
|
||||
#pragma mark - Initialization
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
SharedAppControllerInstance = self;
|
||||
|
||||
[self registerDefaults];
|
||||
|
||||
self.statusItem = [[NSStatusBar systemStatusBar] statusItemWithLength:NSVariableStatusItemLength];
|
||||
self.statusItem.menu = self.statusMenu;
|
||||
self.statusItem.image = self.iconInactive;
|
||||
self.statusItem.highlightMode = YES;
|
||||
self.statusItem.length = self.iconInactive.size.width + 8; // Add some space around the icon
|
||||
self.statusMenu.delegate = self;
|
||||
self.helpTextView.textContainerInset = NSMakeSize(10.0, 10.0);
|
||||
|
||||
if ([[NSUserDefaults standardUserDefaults] boolForKey:kDefaultFirstLaunch])
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setBool:NO forKey:kDefaultFirstLaunch];
|
||||
[self openHelp:self];
|
||||
}
|
||||
|
||||
NSNotificationCenter *defaultCenter = [NSNotificationCenter defaultCenter];
|
||||
|
||||
[defaultCenter addObserver:self selector:@selector(XcodeCappConversionDidStart:) name:XCCConversionDidStartNotification object:self.xcc];
|
||||
[defaultCenter addObserver:self selector:@selector(XcodeCappConversionDidStop:) name:XCCConversionDidStopNotification object:self.xcc];
|
||||
[defaultCenter addObserver:self selector:@selector(XcodeCappDidPopulateProject:) name:XCCDidPopulateProjectNotification object:self.xcc];
|
||||
[defaultCenter addObserver:self selector:@selector(XcodeCappListeningDidStart:) name:XCCListeningDidStartNotification object:self.xcc];
|
||||
|
||||
[self pruneProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
}
|
||||
|
||||
- (void)applicationDidFinishLaunching:(NSNotification *)notification
|
||||
{
|
||||
[self.xcc start];
|
||||
}
|
||||
|
||||
/*!
|
||||
Register default values for preferences
|
||||
*/
|
||||
- (void)registerDefaults
|
||||
{
|
||||
NSDictionary *appDefaults = @{
|
||||
kDefaultLastEventId: [NSNumber numberWithUnsignedLongLong:kFSEventStreamEventIdSinceNow],
|
||||
kDefaultFirstLaunch: @YES,
|
||||
kDefaultXCCAPIMode: [NSNumber numberWithInt:kXCCAPIModeAuto],
|
||||
kDefaultXCCReactMode: @YES,
|
||||
kDefaultXCCReopenLastProject: @YES,
|
||||
kDefaultXCCAutoOpenErrorsPanel: @YES,
|
||||
kDefaultXCCProjectHistory: [NSArray new]
|
||||
};
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];
|
||||
}
|
||||
|
||||
- (void)pruneProjectHistory
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableArray *projectHistory = [[defaults arrayForKey:kDefaultXCCProjectHistory] mutableCopy];
|
||||
NSFileManager *fm = [NSFileManager new];
|
||||
|
||||
for (NSInteger i = projectHistory.count - 1; i >= 0; --i)
|
||||
{
|
||||
if (![fm fileExistsAtPath:projectHistory[i]])
|
||||
[projectHistory removeObjectAtIndex:i];
|
||||
}
|
||||
|
||||
[defaults setObject:projectHistory forKey:kDefaultXCCProjectHistory];
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Properties
|
||||
|
||||
- (NSImage *)iconActive
|
||||
{
|
||||
if (!_iconActive)
|
||||
_iconActive = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"icon-active.png"]];
|
||||
|
||||
return _iconActive;
|
||||
}
|
||||
|
||||
- (NSImage *)iconInactive
|
||||
{
|
||||
if (!_iconInactive)
|
||||
_iconInactive = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"icon-inactive.png"]];
|
||||
|
||||
return _iconInactive;
|
||||
}
|
||||
|
||||
- (NSImage *)iconWorking
|
||||
{
|
||||
if (!_iconWorking)
|
||||
_iconWorking = [[NSImage alloc] initWithContentsOfFile:[[NSBundle mainBundle] pathForImageResource:@"icon-working.png"]];
|
||||
|
||||
return _iconWorking;
|
||||
}
|
||||
|
||||
- (NSMenu *)menuHistory
|
||||
{
|
||||
if (!_menuHistory)
|
||||
{
|
||||
_menuHistory = [NSMenu new];
|
||||
_menuHistory.autoenablesItems = NO;
|
||||
self.menuItemHistory.submenu = _menuHistory;
|
||||
}
|
||||
|
||||
return _menuHistory;
|
||||
}
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Notification handlers
|
||||
|
||||
/*!
|
||||
Clean up when the application stops.
|
||||
It will stop the FSEvent listener, and store the last event id.
|
||||
*/
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)app
|
||||
{
|
||||
[self.xcc stop];
|
||||
|
||||
return NSTerminateNow;
|
||||
}
|
||||
|
||||
- (void)XcodeCappConversionDidStart:(NSNotification *)aNotification
|
||||
{
|
||||
self.statusItem.image = self.iconWorking;
|
||||
}
|
||||
|
||||
- (void)XcodeCappConversionDidStop:(NSNotification *)aNotification
|
||||
{
|
||||
if (!self.xcc.isLoadingProject)
|
||||
self.statusItem.image = self.iconActive;
|
||||
}
|
||||
|
||||
- (void)XcodeCappDidPopulateProject:(NSNotification *)aNotification
|
||||
{
|
||||
}
|
||||
|
||||
- (void)XcodeCappListeningDidStart:(NSNotification *)aNotification
|
||||
{
|
||||
self.statusItem.image = self.iconActive;
|
||||
self.menuItemListen.title = [NSString stringWithFormat:@"Stop Listening to “%@”", self.xcc.currentProjectPath.lastPathComponent];
|
||||
self.menuItemListen.action = @selector(stopListening:);
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Utilities
|
||||
|
||||
- (void)updateHistoryMenu
|
||||
{
|
||||
[self.menuHistory removeAllItems];
|
||||
NSArray *projectHistory = [[NSUserDefaults standardUserDefaults] arrayForKey:kDefaultXCCProjectHistory];
|
||||
|
||||
for (NSString *path in projectHistory)
|
||||
{
|
||||
NSMenuItem *item = [self.menuHistory addItemWithTitle:path.lastPathComponent action:@selector(switchToProject:) keyEquivalent:@""];
|
||||
[item setEnabled:YES];
|
||||
item.representedObject = path;
|
||||
}
|
||||
|
||||
[self.menuHistory addItem:[NSMenuItem separatorItem]];
|
||||
[self.menuHistory addItemWithTitle:@"Clear history" action:@selector(clearProjectHistory:) keyEquivalent:@""];
|
||||
|
||||
self.menuItemHistory.enabled = [projectHistory count] > 0;
|
||||
}
|
||||
|
||||
|
||||
#pragma mark -
|
||||
#pragma mark Actions
|
||||
|
||||
- (IBAction)listenToProject:(id)aSender
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
|
||||
NSOpenPanel *openPanel = [NSOpenPanel openPanel];
|
||||
openPanel.title = @"Choose Cappuccino Project";
|
||||
openPanel.canChooseDirectories = YES;
|
||||
openPanel.canCreateDirectories = YES;
|
||||
openPanel.canChooseFiles = NO;
|
||||
|
||||
if ([openPanel runModal] != NSFileHandlingPanelOKButton)
|
||||
return;
|
||||
|
||||
NSString *projectPath = [[openPanel.URLs[0] path] stringByStandardizingPath];
|
||||
[self listenToProjectAtPath:projectPath];
|
||||
}
|
||||
|
||||
- (void)listenToProjectAtPath:(NSString *)path
|
||||
{
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
NSMutableArray *projectHistory = [[defaults arrayForKey:kDefaultXCCProjectHistory] mutableCopy];
|
||||
|
||||
if ([projectHistory containsObject:path])
|
||||
[projectHistory removeObject:path];
|
||||
|
||||
[projectHistory insertObject:path atIndex:0];
|
||||
|
||||
[defaults setObject:projectHistory forKey:kDefaultXCCProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
|
||||
[self stopListening:self];
|
||||
[self.xcc listenToProjectAtPath:path];
|
||||
}
|
||||
|
||||
- (void)stopListening:(id)aSender
|
||||
{
|
||||
[self.xcc stop];
|
||||
|
||||
self.statusItem.image = self.iconInactive;
|
||||
self.menuItemListen.title = @"Listen to Project…";
|
||||
self.menuItemListen.action = @selector(listenToProject:);
|
||||
|
||||
[[NSUserDefaults standardUserDefaults] removeObjectForKey:kDefaultLastOpenedPath];
|
||||
}
|
||||
|
||||
- (void)switchToProject:(id)aSender
|
||||
{
|
||||
NSString *projectPath = [aSender representedObject];
|
||||
|
||||
[self stopListening:aSender];
|
||||
[self listenToProjectAtPath:projectPath];
|
||||
}
|
||||
|
||||
- (void)clearProjectHistory:(id)aSender
|
||||
{
|
||||
[[NSUserDefaults standardUserDefaults] setObject:[NSArray array] forKey:kDefaultXCCProjectHistory];
|
||||
[self updateHistoryMenu];
|
||||
}
|
||||
|
||||
- (IBAction)openInXcode:(id)aSender
|
||||
{
|
||||
if (!self.xcc.currentProjectPath)
|
||||
return;
|
||||
|
||||
DLog(@"Opening Xcode project at: %@", self.xcc.XcodeSupportProjectURL.path);
|
||||
system([[NSString stringWithFormat:@"open \"%@\"", self.xcc.XcodeSupportProjectURL.path] UTF8String]);
|
||||
}
|
||||
|
||||
- (IBAction)openHelp:(id)aSender
|
||||
{
|
||||
[self.helpTextView readRTFDFromFile:[[NSBundle mainBundle] pathForResource:@"help" ofType:@"rtfd"]];
|
||||
|
||||
[self openWindow:self.helpWindow centered:YES];
|
||||
}
|
||||
|
||||
- (IBAction)openAbout:(id)aSender
|
||||
{
|
||||
[self openWindow:self.aboutWindow centered:YES];
|
||||
}
|
||||
|
||||
- (IBAction)openPreferences:(id)aSender
|
||||
{
|
||||
[self openWindow:self.preferencesWindow centered:NO];
|
||||
}
|
||||
|
||||
- (void)openWindow:(NSWindow *)aWindow centered:(BOOL)shouldBeCentered
|
||||
{
|
||||
[[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
|
||||
|
||||
if (shouldBeCentered)
|
||||
[aWindow center];
|
||||
|
||||
[aWindow makeKeyAndOrderFront:nil];
|
||||
}
|
||||
|
||||
|
||||
#pragma mark - Delegates
|
||||
|
||||
- (BOOL)validateMenuItem:(NSMenuItem *)aMenuItem
|
||||
{
|
||||
if (aMenuItem == self.menuItemListen)
|
||||
return !!self.xcc.currentProjectPath;
|
||||
|
||||
return YES;
|
||||
}
|
||||
|
||||
#pragma mark - Private Helpers
|
||||
|
||||
- (NSString *)bundleVersion
|
||||
{
|
||||
return [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,40 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef xcodecapp_cocoa_FSEventCallback_h
|
||||
#define xcodecapp_cocoa_FSEventCallback_h
|
||||
|
||||
#import "TNXcodeCapp.h"
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED <= MAC_OS_X_VERSION_10_6
|
||||
# define kFSEventStreamCreateFlagFileEvents 0x00000010
|
||||
# define kFSEventStreamEventFlagItemIsFile 0x00010000
|
||||
# define kFSEventStreamEventFlagItemRemoved 0x00000200
|
||||
# define kFSEventStreamEventFlagItemCreated 0x00000200
|
||||
# define kFSEventStreamEventFlagItemModified 0x00001000
|
||||
# define kFSEventStreamEventFlagItemInodeMetaMod 0x00000400
|
||||
# define kFSEventStreamEventFlagItemRenamed 0x00000800
|
||||
# define kFSEventStreamEventFlagItemFinderInfoMod 0x00002000
|
||||
# define kFSEventStreamEventFlagItemChangeOwner 0x00004000
|
||||
# define kFSEventStreamEventFlagItemXattrMod 0x00008000
|
||||
#endif
|
||||
|
||||
void fsevents_callback(ConstFSEventStreamRef, void*, size_t, void*, const FSEventStreamEventFlags*, const FSEventStreamEventId*);
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,115 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import "AppController.h"
|
||||
#import "FSEventCallback.h"
|
||||
#import "macros.h"
|
||||
|
||||
void fsevents_callback(ConstFSEventStreamRef streamRef,
|
||||
void *userData,
|
||||
size_t numEvents,
|
||||
void *eventPaths,
|
||||
const FSEventStreamEventFlags eventFlags[],
|
||||
const FSEventStreamEventId eventIds[])
|
||||
{
|
||||
TNXcodeCapp *xcc = (__bridge TNXcodeCapp *)userData;
|
||||
NSArray *paths = (__bridge NSArray *)eventPaths;
|
||||
BOOL usingFileBasedListening = [xcc supportsFileBasedListening];
|
||||
|
||||
for (size_t i = 0; i < numEvents; ++i)
|
||||
{
|
||||
[xcc updateLastEventId:eventIds[i]];
|
||||
|
||||
FSEventStreamEventFlags flags = eventFlags[i];
|
||||
NSString *path = [[paths objectAtIndex:i] stringByStandardizingPath];
|
||||
|
||||
if (usingFileBasedListening)
|
||||
{
|
||||
if ([xcc pathMatchesIgnoredPaths:path])
|
||||
continue;
|
||||
|
||||
if ((flags & kFSEventStreamEventFlagItemIsFile) &&
|
||||
!([xcc isXibFile:path] || [xcc isObjjFile:path] || [xcc isXCCIgnoreFile:path]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Events are not so reliable. For example, moving a folder to the trash is not
|
||||
// a deletion. In order to simplify the code, we simply tidy up the project when we receive
|
||||
// an event.
|
||||
[xcc tidyShadowedFiles];
|
||||
|
||||
BOOL isDirectory = NO;
|
||||
BOOL exists = [[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory];
|
||||
|
||||
if (isDirectory)
|
||||
continue;
|
||||
|
||||
if (!exists)
|
||||
{
|
||||
DLog(@"File removed: %@", path);
|
||||
[xcc handleFileRemovalAtPath:path];
|
||||
}
|
||||
else
|
||||
{
|
||||
DLog(@"File modified/added: %@", path);
|
||||
[xcc handleFileModificationAtPath:path notify:YES];
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
// We should drop support for Snow Leopard soon.
|
||||
|
||||
BOOL isDirectory = NO;
|
||||
[[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory];
|
||||
|
||||
// If for some reasons the path is not a directory,
|
||||
// we don't want to deal with it in this mode.
|
||||
if (!isDirectory)
|
||||
continue;
|
||||
|
||||
[xcc tidyShadowedFiles];
|
||||
|
||||
NSFileManager *fm = [NSFileManager defaultManager];
|
||||
NSArray *subpaths = [fm contentsOfDirectoryAtPath:path error:NULL];
|
||||
|
||||
for (NSString *subpath in subpaths)
|
||||
{
|
||||
NSString *fullPath = [path stringByAppendingPathComponent:subpath];
|
||||
|
||||
if ([xcc pathMatchesIgnoredPaths:fullPath] ||
|
||||
!([xcc isXibFile:fullPath] || [xcc isObjjFile:fullPath] || [xcc isXCCIgnoreFile:fullPath]))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
NSDate *lastModifiedDate = [xcc lastModificationDateForPath:fullPath];
|
||||
NSDictionary *fileAttributes = [fm attributesOfItemAtPath:fullPath error:nil];
|
||||
NSDate *fileModDate = [fileAttributes objectForKey:NSFileModificationDate];
|
||||
|
||||
if ([fileModDate compare:lastModifiedDate] == NSOrderedDescending)
|
||||
{
|
||||
[xcc updateLastModificationDate:fileModDate forPath:fullPath];
|
||||
[xcc handleFileModificationAtPath:fullPath notify:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[xcc updateUserDefaultsWithLastEventId];
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>TicketVersion</key>
|
||||
<integer>1</integer>
|
||||
<key>AllNotifications</key>
|
||||
<array>
|
||||
<string>DefaultNotifications</string>
|
||||
</array>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Growl
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Headers
|
||||
@@ -0,0 +1 @@
|
||||
Versions/Current/Resources
|
||||
@@ -0,0 +1,5 @@
|
||||
#include <Growl/GrowlDefines.h>
|
||||
|
||||
#ifdef __OBJC__
|
||||
# include <Growl/GrowlApplicationBridge.h>
|
||||
#endif
|
||||
@@ -0,0 +1,567 @@
|
||||
//
|
||||
// GrowlApplicationBridge.h
|
||||
// Growl
|
||||
//
|
||||
// Created by Evan Schoenberg on Wed Jun 16 2004.
|
||||
// Copyright 2004-2006 The Growl Project. All rights reserved.
|
||||
//
|
||||
|
||||
/*!
|
||||
* @header GrowlApplicationBridge.h
|
||||
* @abstract Defines the GrowlApplicationBridge class.
|
||||
* @discussion This header defines the GrowlApplicationBridge class as well as
|
||||
* the GROWL_PREFPANE_BUNDLE_IDENTIFIER constant.
|
||||
*/
|
||||
|
||||
#ifndef __GrowlApplicationBridge_h__
|
||||
#define __GrowlApplicationBridge_h__
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <AppKit/AppKit.h>
|
||||
#import <Growl/GrowlDefines.h>
|
||||
|
||||
//Forward declarations
|
||||
@protocol GrowlApplicationBridgeDelegate;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @class GrowlApplicationBridge
|
||||
* @abstract A class used to interface with Growl.
|
||||
* @discussion This class provides a means to interface with Growl.
|
||||
*
|
||||
* Currently it provides a way to detect if Growl is installed and launch the
|
||||
* GrowlHelperApp if it's not already running.
|
||||
*/
|
||||
@interface GrowlApplicationBridge : NSObject {
|
||||
|
||||
}
|
||||
|
||||
/*!
|
||||
* @method isGrowlInstalled
|
||||
* @abstract Detects whether Growl is installed.
|
||||
* @discussion Determines if the Growl prefpane and its helper app are installed.
|
||||
* @result this method will forever return YES.
|
||||
*/
|
||||
+ (BOOL) isGrowlInstalled __attribute__((deprecated));
|
||||
|
||||
/*!
|
||||
* @method isGrowlRunning
|
||||
* @abstract Detects whether GrowlHelperApp is currently running.
|
||||
* @discussion Cycles through the process list to find whether GrowlHelperApp is running and returns its findings.
|
||||
* @result Returns YES if GrowlHelperApp is running, NO otherwise.
|
||||
*/
|
||||
+ (BOOL) isGrowlRunning;
|
||||
|
||||
|
||||
/*!
|
||||
* @method isMistEnabled
|
||||
* @abstract Gives the caller a fairly good indication of whether or not built-in notifications(Mist) will be used.
|
||||
* @discussion since this call makes use of isGrowlRunning it is entirely possible for this value to change between call and
|
||||
* executing a notification dispatch
|
||||
* @result Returns YES if Growl isn't reachable and the developer has not opted-out of
|
||||
* Mist and the user hasn't set the global mist enable key to false.
|
||||
*/
|
||||
+ (BOOL)isMistEnabled;
|
||||
|
||||
/*!
|
||||
* @method setShouldUseBuiltInNotifications
|
||||
* @abstract opt-out mechanism for the mist notification style in the event growl can't be reached.
|
||||
* @discussion if growl is unavailable due to not being installed or as a result of being turned off then
|
||||
* this option can enable/disable a built-in fire and forget display style
|
||||
* @param should Specifies whether or not the developer wants to opt-in (default) or opt out
|
||||
* of the built-in Mist style in the event Growl is unreachable.
|
||||
*/
|
||||
+ (void)setShouldUseBuiltInNotifications:(BOOL)should;
|
||||
|
||||
/*!
|
||||
* @method shouldUseBuiltInNotifications
|
||||
* @abstract returns the current opt-in state of the framework's use of the Mist display style.
|
||||
* @result Returns NO if the developer opt-ed out of Mist, the default value is YES.
|
||||
*/
|
||||
+ (BOOL)shouldUseBuiltInNotifications;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @method setGrowlDelegate:
|
||||
* @abstract Set the object which will be responsible for providing and receiving Growl information.
|
||||
* @discussion This must be called before using GrowlApplicationBridge.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate protocol are required
|
||||
* and return the basic information needed to register with Growl.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate_InformalProtocol
|
||||
* informal protocol are individually optional. They provide a greater
|
||||
* degree of interaction between the application and growl such as informing
|
||||
* the application when one of its Growl notifications is clicked by the user.
|
||||
*
|
||||
* The methods in the GrowlApplicationBridgeDelegate_Installation_InformalProtocol
|
||||
* informal protocol are individually optional and are only applicable when
|
||||
* using the Growl-WithInstaller.framework which allows for automated Growl
|
||||
* installation.
|
||||
*
|
||||
* When this method is called, data will be collected from inDelegate, Growl
|
||||
* will be launched if it is not already running, and the application will be
|
||||
* registered with Growl.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is already installed
|
||||
* but this copy of the framework has an updated version of Growl, the user
|
||||
* will be prompted to update automatically.
|
||||
*
|
||||
* @param inDelegate The delegate for the GrowlApplicationBridge. It must conform to the GrowlApplicationBridgeDelegate protocol.
|
||||
*/
|
||||
+ (void) setGrowlDelegate:(id<GrowlApplicationBridgeDelegate>)inDelegate;
|
||||
|
||||
/*!
|
||||
* @method growlDelegate
|
||||
* @abstract Return the object responsible for providing and receiving Growl information.
|
||||
* @discussion See setGrowlDelegate: for details.
|
||||
* @result The Growl delegate.
|
||||
*/
|
||||
+ (id<GrowlApplicationBridgeDelegate>) growlDelegate;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:
|
||||
* @abstract Send a Growl notification.
|
||||
* @discussion This is the preferred means for sending a Growl notification.
|
||||
* The notification name and at least one of the title and description are
|
||||
* required (all three are preferred). All other parameters may be
|
||||
* <code>nil</code> (or 0 or NO as appropriate) to accept default values.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is not installed the
|
||||
* user will be prompted to install Growl. If the user cancels, this method
|
||||
* will have no effect until the next application session, at which time when
|
||||
* it is called the user will be prompted again. The user is also given the
|
||||
* option to not be prompted again. If the user does choose to install Growl,
|
||||
* the requested notification will be displayed once Growl is installed and
|
||||
* running.
|
||||
*
|
||||
* @param title The title of the notification displayed to the user.
|
||||
* @param description The full description of the notification displayed to the user.
|
||||
* @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
|
||||
* @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
|
||||
* @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
|
||||
* @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
|
||||
* @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
|
||||
*/
|
||||
+ (void) notifyWithTitle:(NSString *)title
|
||||
description:(NSString *)description
|
||||
notificationName:(NSString *)notifName
|
||||
iconData:(NSData *)iconData
|
||||
priority:(signed int)priority
|
||||
isSticky:(BOOL)isSticky
|
||||
clickContext:(id)clickContext;
|
||||
|
||||
/*!
|
||||
* @method notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:identifier:
|
||||
* @abstract Send a Growl notification.
|
||||
* @discussion This is the preferred means for sending a Growl notification.
|
||||
* The notification name and at least one of the title and description are
|
||||
* required (all three are preferred). All other parameters may be
|
||||
* <code>nil</code> (or 0 or NO as appropriate) to accept default values.
|
||||
*
|
||||
* If using the Growl-WithInstaller framework, if Growl is not installed the
|
||||
* user will be prompted to install Growl. If the user cancels, this method
|
||||
* will have no effect until the next application session, at which time when
|
||||
* it is called the user will be prompted again. The user is also given the
|
||||
* option to not be prompted again. If the user does choose to install Growl,
|
||||
* the requested notification will be displayed once Growl is installed and
|
||||
* running.
|
||||
*
|
||||
* @param title The title of the notification displayed to the user.
|
||||
* @param description The full description of the notification displayed to the user.
|
||||
* @param notifName The internal name of the notification. Should be human-readable, as it will be displayed in the Growl preference pane.
|
||||
* @param iconData <code>NSData</code> object to show with the notification as its icon. If <code>nil</code>, the application's icon will be used instead.
|
||||
* @param priority The priority of the notification. The default value is 0; positive values are higher priority and negative values are lower priority. Not all Growl displays support priority.
|
||||
* @param isSticky If YES, the notification will remain on screen until clicked. Not all Growl displays support sticky notifications.
|
||||
* @param clickContext A context passed back to the Growl delegate if it implements -(void)growlNotificationWasClicked: and the notification is clicked. Not all display plugins support clicking. The clickContext must be plist-encodable (completely of <code>NSString</code>, <code>NSArray</code>, <code>NSNumber</code>, <code>NSDictionary</code>, and <code>NSData</code> types).
|
||||
* @param identifier An identifier for this notification. Notifications with equal identifiers are coalesced.
|
||||
*/
|
||||
+ (void) notifyWithTitle:(NSString *)title
|
||||
description:(NSString *)description
|
||||
notificationName:(NSString *)notifName
|
||||
iconData:(NSData *)iconData
|
||||
priority:(signed int)priority
|
||||
isSticky:(BOOL)isSticky
|
||||
clickContext:(id)clickContext
|
||||
identifier:(NSString *)identifier;
|
||||
|
||||
/*! @method notifyWithDictionary:
|
||||
* @abstract Notifies using a userInfo dictionary suitable for passing to
|
||||
* <code>NSDistributedNotificationCenter</code>.
|
||||
* @param userInfo The dictionary to notify with.
|
||||
* @discussion Before Growl 0.6, your application would have posted
|
||||
* notifications using <code>NSDistributedNotificationCenter</code> by
|
||||
* creating a userInfo dictionary with the notification data. This had the
|
||||
* advantage of allowing you to add other data to the dictionary for programs
|
||||
* besides Growl that might be listening.
|
||||
*
|
||||
* This method allows you to use such dictionaries without being restricted
|
||||
* to using <code>NSDistributedNotificationCenter</code>. The keys for this dictionary
|
||||
* can be found in GrowlDefines.h.
|
||||
*/
|
||||
+ (void) notifyWithDictionary:(NSDictionary *)userInfo;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registerWithDictionary:
|
||||
* @abstract Register your application with Growl without setting a delegate.
|
||||
* @discussion When you call this method with a dictionary,
|
||||
* GrowlApplicationBridge registers your application using that dictionary.
|
||||
* If you pass <code>nil</code>, GrowlApplicationBridge will ask the delegate
|
||||
* (if there is one) for a dictionary, and if that doesn't work, it will look
|
||||
* in your application's bundle for an auto-discoverable plist.
|
||||
* (XXX refer to more information on that)
|
||||
*
|
||||
* If you pass a dictionary to this method, it must include the
|
||||
* <code>GROWL_APP_NAME</code> key, unless a delegate is set.
|
||||
*
|
||||
* This method is mainly an alternative to the delegate system introduced
|
||||
* with Growl 0.6. Without a delegate, you cannot receive callbacks such as
|
||||
* <code>-growlIsReady</code> (since they are sent to the delegate). You can,
|
||||
* however, set a delegate after registering without one.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
*/
|
||||
+ (BOOL) registerWithDictionary:(NSDictionary *)regDict;
|
||||
|
||||
/*! @method reregisterGrowlNotifications
|
||||
* @abstract Reregister the notifications for this application.
|
||||
* @discussion This method does not normally need to be called. If your
|
||||
* application changes what notifications it is registering with Growl, call
|
||||
* this method to have the Growl delegate's
|
||||
* <code>-registrationDictionaryForGrowl</code> method called again and the
|
||||
* Growl registration information updated.
|
||||
*
|
||||
* This method is now implemented using <code>-registerWithDictionary:</code>.
|
||||
*/
|
||||
+ (void) reregisterGrowlNotifications;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method setWillRegisterWhenGrowlIsReady:
|
||||
* @abstract Tells GrowlApplicationBridge to register with Growl when Growl
|
||||
* launches (or not).
|
||||
* @discussion When Growl has started listening for notifications, it posts a
|
||||
* <code>GROWL_IS_READY</code> notification on the Distributed Notification
|
||||
* Center. GrowlApplicationBridge listens for this notification, using it to
|
||||
* perform various tasks (such as calling your delegate's
|
||||
* <code>-growlIsReady</code> method, if it has one). If this method is
|
||||
* called with <code>YES</code>, one of those tasks will be to reregister
|
||||
* with Growl (in the manner of <code>-reregisterGrowlNotifications</code>).
|
||||
*
|
||||
* This attribute is automatically set back to <code>NO</code> (the default)
|
||||
* after every <code>GROWL_IS_READY</code> notification.
|
||||
* @param flag <code>YES</code> if you want GrowlApplicationBridge to register with
|
||||
* Growl when next it is ready; <code>NO</code> if not.
|
||||
*/
|
||||
+ (void) setWillRegisterWhenGrowlIsReady:(BOOL)flag;
|
||||
|
||||
/*! @method willRegisterWhenGrowlIsReady
|
||||
* @abstract Reports whether GrowlApplicationBridge will register with Growl
|
||||
* when Growl next launches.
|
||||
* @result <code>YES</code> if GrowlApplicationBridge will register with Growl
|
||||
* when next it posts GROWL_IS_READY; <code>NO</code> if not.
|
||||
*/
|
||||
+ (BOOL) willRegisterWhenGrowlIsReady;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registrationDictionaryFromDelegate
|
||||
* @abstract Asks the delegate for a registration dictionary.
|
||||
* @discussion If no delegate is set, or if the delegate's
|
||||
* <code>-registrationDictionaryForGrowl</code> method returns
|
||||
* <code>nil</code>, this method returns <code>nil</code>.
|
||||
*
|
||||
* This method does not attempt to clean up the dictionary in any way - for
|
||||
* example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
|
||||
* will be missing it too. Use <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:]</code> or
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
|
||||
* to fill in missing keys.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryFromDelegate;
|
||||
|
||||
/*! @method registrationDictionaryFromBundle:
|
||||
* @abstract Looks in a bundle for a registration dictionary.
|
||||
* @discussion This method looks in a bundle for an auto-discoverable
|
||||
* registration dictionary file using <code>-[NSBundle
|
||||
* pathForResource:ofType:]</code>. If it finds one, it loads the file using
|
||||
* <code>+[NSDictionary dictionaryWithContentsOfFile:]</code> and returns the
|
||||
* result.
|
||||
*
|
||||
* If you pass <code>nil</code> as the bundle, the main bundle is examined.
|
||||
*
|
||||
* This method does not attempt to clean up the dictionary in any way - for
|
||||
* example, if it is missing the <code>GROWL_APP_NAME</code> key, the result
|
||||
* will be missing it too. Use <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:]</code> or
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* registrationDictionaryByFillingInDictionary:restrictToKeys:]</code> to try
|
||||
* to fill in missing keys.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryFromBundle:(NSBundle *)bundle;
|
||||
|
||||
/*! @method bestRegistrationDictionary
|
||||
* @abstract Obtains a registration dictionary, filled out to the best of
|
||||
* GrowlApplicationBridge's knowledge.
|
||||
* @discussion This method creates a registration dictionary as best
|
||||
* GrowlApplicationBridge knows how.
|
||||
*
|
||||
* First, GrowlApplicationBridge contacts the Growl delegate (if there is
|
||||
* one) and gets the registration dictionary from that. If no such dictionary
|
||||
* was obtained, GrowlApplicationBridge looks in your application's main
|
||||
* bundle for an auto-discoverable registration dictionary file. If that
|
||||
* doesn't exist either, this method returns <code>nil</code>.
|
||||
*
|
||||
* Second, GrowlApplicationBridge calls
|
||||
* <code>+registrationDictionaryByFillingInDictionary:</code> with whatever
|
||||
* dictionary was obtained. The result of that method is the result of this
|
||||
* method.
|
||||
*
|
||||
* GrowlApplicationBridge uses this method when you call
|
||||
* <code>+setGrowlDelegate:</code>, or when you call
|
||||
* <code>+registerWithDictionary:</code> with <code>nil</code>.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @result A registration dictionary.
|
||||
*/
|
||||
+ (NSDictionary *) bestRegistrationDictionary;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*! @method registrationDictionaryByFillingInDictionary:
|
||||
* @abstract Tries to fill in missing keys in a registration dictionary.
|
||||
* @discussion This method examines the passed-in dictionary for missing keys,
|
||||
* and tries to work out correct values for them. As of 0.7, it uses:
|
||||
*
|
||||
* Key Value
|
||||
* --- -----
|
||||
* <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code>
|
||||
* <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application.
|
||||
* <code>GROWL_APP_LOCATION</code> The location of the application.
|
||||
* <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code>
|
||||
*
|
||||
* Keys are only filled in if missing; if a key is present in the dictionary,
|
||||
* its value will not be changed.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @param regDict The dictionary to fill in.
|
||||
* @result The dictionary with the keys filled in. This is an autoreleased
|
||||
* copy of <code>regDict</code>.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
|
||||
|
||||
/*! @method registrationDictionaryByFillingInDictionary:restrictToKeys:
|
||||
* @abstract Tries to fill in missing keys in a registration dictionary.
|
||||
* @discussion This method examines the passed-in dictionary for missing keys,
|
||||
* and tries to work out correct values for them. As of 0.7, it uses:
|
||||
*
|
||||
* Key Value
|
||||
* --- -----
|
||||
* <code>GROWL_APP_NAME</code> <code>CFBundleExecutableName</code>
|
||||
* <code>GROWL_APP_ICON_DATA</code> The data of the icon of the application.
|
||||
* <code>GROWL_APP_LOCATION</code> The location of the application.
|
||||
* <code>GROWL_NOTIFICATIONS_DEFAULT</code> <code>GROWL_NOTIFICATIONS_ALL</code>
|
||||
*
|
||||
* Only those keys that are listed in <code>keys</code> will be filled in.
|
||||
* Other missing keys are ignored. Also, keys are only filled in if missing;
|
||||
* if a key is present in the dictionary, its value will not be changed.
|
||||
*
|
||||
* This method was introduced in Growl.framework 0.7.
|
||||
* @param regDict The dictionary to fill in.
|
||||
* @param keys The keys to fill in. If <code>nil</code>, any missing keys are filled in.
|
||||
* @result The dictionary with the keys filled in. This is an autoreleased
|
||||
* copy of <code>regDict</code>.
|
||||
*/
|
||||
+ (NSDictionary *) registrationDictionaryByFillingInDictionary:(NSDictionary *)regDict restrictToKeys:(NSSet *)keys;
|
||||
|
||||
/*! @brief Tries to fill in missing keys in a notification dictionary.
|
||||
* @param notifDict The dictionary to fill in.
|
||||
* @return The dictionary with the keys filled in. This will be a separate instance from \a notifDict.
|
||||
* @discussion This function examines the \a notifDict for missing keys, and
|
||||
* tries to get them from the last known registration dictionary. As of 1.1,
|
||||
* the keys that it will look for are:
|
||||
*
|
||||
* \li <code>GROWL_APP_NAME</code>
|
||||
* \li <code>GROWL_APP_ICON_DATA</code>
|
||||
*
|
||||
* @since Growl.framework 1.1
|
||||
*/
|
||||
+ (NSDictionary *) notificationDictionaryByFillingInDictionary:(NSDictionary *)regDict;
|
||||
|
||||
+ (NSDictionary *) frameworkInfoDictionary;
|
||||
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
*@method growlURLSchemeAvailable
|
||||
*@abstract Lets the app know whether growl:// is registered on the system, used for certain methods below this
|
||||
*@return Returns whether growl:// is registered on the system
|
||||
*@discussion Methods such as openGrowlPreferences rely on the growl:// URL scheme to function
|
||||
* Further, this method can provide a check on whether Growl is installed,
|
||||
* however, the framework will not be relying on this method for choosing when/how to notify,
|
||||
* and it is not recommended that the app rely on it for other than whether to use growl:// methods
|
||||
*@since Growl.framework 1.4
|
||||
*/
|
||||
+ (BOOL) isGrowlURLSchemeAvailable;
|
||||
|
||||
/*!
|
||||
* @method openGrowlPreferences:
|
||||
* @abstract Open Growl preferences, optionally to this app's settings, growl:// method
|
||||
* @param showApp Whether to show the application's settings, otherwise just opens to the last position
|
||||
* @return Return's whether opening the URL was succesfull or not.
|
||||
* @discussion Will launch if Growl is installed, but not running, and open the preferences window
|
||||
* Uses growl:// URL scheme
|
||||
* @since Growl.framework 1.4
|
||||
*/
|
||||
+ (BOOL) openGrowlPreferences:(BOOL)showApp;
|
||||
|
||||
@end
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
#pragma mark -
|
||||
|
||||
/*!
|
||||
* @protocol GrowlApplicationBridgeDelegate
|
||||
* @abstract Required protocol for the Growl delegate.
|
||||
* @discussion The methods in this protocol are optional and are called
|
||||
* automatically as needed by GrowlApplicationBridge. See
|
||||
* <code>+[GrowlApplicationBridge setGrowlDelegate:]</code>.
|
||||
* See also <code>GrowlApplicationBridgeDelegate_InformalProtocol</code>.
|
||||
*/
|
||||
|
||||
@protocol GrowlApplicationBridgeDelegate <NSObject>
|
||||
|
||||
@optional
|
||||
|
||||
/*!
|
||||
* @method registrationDictionaryForGrowl
|
||||
* @abstract Return the dictionary used to register this application with Growl.
|
||||
* @discussion The returned dictionary gives Growl the complete list of
|
||||
* notifications this application will ever send, and it also specifies which
|
||||
* notifications should be enabled by default. Each is specified by an array
|
||||
* of <code>NSString</code> objects.
|
||||
*
|
||||
* For most applications, these two arrays can be the same (if all sent
|
||||
* notifications should be displayed by default).
|
||||
*
|
||||
* The <code>NSString</code> objects of these arrays will correspond to the
|
||||
* <code>notificationName:</code> parameter passed in
|
||||
* <code>+[GrowlApplicationBridge
|
||||
* notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:]</code> calls.
|
||||
*
|
||||
* The dictionary should have the required key object pairs:
|
||||
* key: GROWL_NOTIFICATIONS_ALL object: <code>NSArray</code> of <code>NSString</code> objects
|
||||
* key: GROWL_NOTIFICATIONS_DEFAULT object: <code>NSArray</code> of <code>NSString</code> objects
|
||||
*
|
||||
* The dictionary may have the following key object pairs:
|
||||
* key: GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES object: <code>NSDictionary</code> of key: notification name object: human-readable notification name
|
||||
*
|
||||
* You do not need to implement this method if you have an auto-discoverable
|
||||
* plist file in your app bundle. (XXX refer to more information on that)
|
||||
*
|
||||
* @result The <code>NSDictionary</code> to use for registration.
|
||||
*/
|
||||
- (NSDictionary *) registrationDictionaryForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationNameForGrowl
|
||||
* @abstract Return the name of this application which will be used for Growl bookkeeping.
|
||||
* @discussion This name is used both internally and in the Growl preferences.
|
||||
*
|
||||
* This should remain stable between different versions and incarnations of
|
||||
* your application.
|
||||
* For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and
|
||||
* "SurfWriter Lite" are not.
|
||||
*
|
||||
* You do not need to implement this method if you are providing the
|
||||
* application name elsewhere, meaning in an auto-discoverable plist file in
|
||||
* your app bundle (XXX refer to more information on that) or in the result
|
||||
* of -registrationDictionaryForGrowl.
|
||||
*
|
||||
* @result The name of the application using Growl.
|
||||
*/
|
||||
- (NSString *) applicationNameForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationIconForGrowl
|
||||
* @abstract Return the <code>NSImage</code> to treat as the application icon.
|
||||
* @discussion The delegate may optionally return an <code>NSImage</code>
|
||||
* object to use as the application icon. If this method is not implemented,
|
||||
* {{{-applicationIconDataForGrowl}}} is tried. If that method is not
|
||||
* implemented, the application's own icon is used. Neither method is
|
||||
* generally needed.
|
||||
* @result The <code>NSImage</code> to treat as the application icon.
|
||||
*/
|
||||
- (NSImage *) applicationIconForGrowl;
|
||||
|
||||
/*!
|
||||
* @method applicationIconDataForGrowl
|
||||
* @abstract Return the <code>NSData</code> to treat as the application icon.
|
||||
* @discussion The delegate may optionally return an <code>NSData</code>
|
||||
* object to use as the application icon; if this is not implemented, the
|
||||
* application's own icon is used. This is not generally needed.
|
||||
* @result The <code>NSData</code> to treat as the application icon.
|
||||
* @deprecated In version 1.1, in favor of {{{-applicationIconForGrowl}}}.
|
||||
*/
|
||||
- (NSData *) applicationIconDataForGrowl;
|
||||
|
||||
/*!
|
||||
* @method growlIsReady
|
||||
* @abstract Informs the delegate that Growl has launched.
|
||||
* @discussion Informs the delegate that Growl (specifically, the
|
||||
* GrowlHelperApp) was launched successfully. The application can take actions
|
||||
* with the knowledge that Growl is installed and functional.
|
||||
*/
|
||||
- (void) growlIsReady;
|
||||
|
||||
/*!
|
||||
* @method growlNotificationWasClicked:
|
||||
* @abstract Informs the delegate that a Growl notification was clicked.
|
||||
* @discussion Informs the delegate that a Growl notification was clicked. It
|
||||
* is only sent for notifications sent with a non-<code>nil</code>
|
||||
* clickContext, so if you want to receive a message when a notification is
|
||||
* clicked, clickContext must not be <code>nil</code> when calling
|
||||
* <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
|
||||
* @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
|
||||
*/
|
||||
- (void) growlNotificationWasClicked:(id)clickContext;
|
||||
|
||||
/*!
|
||||
* @method growlNotificationTimedOut:
|
||||
* @abstract Informs the delegate that a Growl notification timed out.
|
||||
* @discussion Informs the delegate that a Growl notification timed out. It
|
||||
* is only sent for notifications sent with a non-<code>nil</code>
|
||||
* clickContext, so if you want to receive a message when a notification is
|
||||
* clicked, clickContext must not be <code>nil</code> when calling
|
||||
* <code>+[GrowlApplicationBridge notifyWithTitle: description:notificationName:iconData:priority:isSticky:clickContext:]</code>.
|
||||
* @param clickContext The clickContext passed when displaying the notification originally via +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:].
|
||||
*/
|
||||
- (void) growlNotificationTimedOut:(id)clickContext;
|
||||
|
||||
|
||||
/*!
|
||||
* @method hasNetworkClientEntitlement
|
||||
* @abstract Used only in sandboxed situations since we don't know whether the app has com.apple.security.network.client entitlement
|
||||
* @discussion GrowlDelegate calls to find out if we have the com.apple.security.network.client entitlement,
|
||||
* since we can't find this out without hitting the sandbox. We only call it if we detect that the application is sandboxed.
|
||||
*/
|
||||
- (BOOL) hasNetworkClientEntitlement;
|
||||
|
||||
@end
|
||||
|
||||
#pragma mark -
|
||||
|
||||
#endif /* __GrowlApplicationBridge_h__ */
|
||||
@@ -0,0 +1,386 @@
|
||||
//
|
||||
// GrowlDefines.h
|
||||
//
|
||||
|
||||
#ifndef _GROWLDEFINES_H
|
||||
#define _GROWLDEFINES_H
|
||||
|
||||
#ifdef __OBJC__
|
||||
#define XSTR(x) (@x)
|
||||
#else
|
||||
#define XSTR CFSTR
|
||||
#endif
|
||||
|
||||
/*! @header GrowlDefines.h
|
||||
* @abstract Defines all the notification keys.
|
||||
* @discussion Defines all the keys used for registration with Growl and for
|
||||
* Growl notifications.
|
||||
*
|
||||
* Most applications should use the functions or methods of Growl.framework
|
||||
* instead of posting notifications such as those described here.
|
||||
* @updated 2004-01-25
|
||||
*/
|
||||
|
||||
// UserInfo Keys for Registration
|
||||
#pragma mark UserInfo Keys for Registration
|
||||
|
||||
/*! @group Registration userInfo keys */
|
||||
/* @abstract Keys for the userInfo dictionary of a GROWL_APP_REGISTRATION distributed notification.
|
||||
* @discussion The values of these keys describe the application and the
|
||||
* notifications it may post.
|
||||
*
|
||||
* Your application must register with Growl before it can post Growl
|
||||
* notifications (and have them not be ignored). However, as of Growl 0.6,
|
||||
* posting GROWL_APP_REGISTRATION notifications directly is no longer the
|
||||
* preferred way to register your application. Your application should instead
|
||||
* use Growl.framework's delegate system.
|
||||
* See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for
|
||||
* more information.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_APP_NAME
|
||||
* @abstract The name of your application.
|
||||
* @discussion The name of your application. This should remain stable between
|
||||
* different versions and incarnations of your application.
|
||||
* For example, "SurfWriter" is a good app name, whereas "SurfWriter 2.0" and
|
||||
* "SurfWriter Lite" are not.
|
||||
*/
|
||||
#define GROWL_APP_NAME XSTR("ApplicationName")
|
||||
/*! @defined GROWL_APP_ID
|
||||
* @abstract The bundle identifier of your application.
|
||||
* @discussion The bundle identifier of your application. This key should
|
||||
* be unique for your application while there may be several applications
|
||||
* with the same GROWL_APP_NAME.
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_APP_ID XSTR("ApplicationId")
|
||||
/*! @defined GROWL_APP_ICON_DATA
|
||||
* @abstract The image data for your application's icon.
|
||||
* @discussion Image data representing your application's icon. This may be
|
||||
* superimposed on a notification icon as a badge, used as the notification
|
||||
* icon when a notification-specific icon is not supplied, or ignored
|
||||
* altogether, depending on the display. Must be in a format supported by
|
||||
* NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_APP_ICON_DATA XSTR("ApplicationIcon")
|
||||
/*! @defined GROWL_NOTIFICATIONS_DEFAULT
|
||||
* @abstract The array of notifications to turn on by default.
|
||||
* @discussion These are the names of the notifications that should be enabled
|
||||
* by default when your application registers for the first time. If your
|
||||
* application reregisters, Growl will look here for any new notification
|
||||
* names found in GROWL_NOTIFICATIONS_ALL, but ignore any others.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_DEFAULT XSTR("DefaultNotifications")
|
||||
/*! @defined GROWL_NOTIFICATIONS_ALL
|
||||
* @abstract The array of all notifications your application can send.
|
||||
* @discussion These are the names of all of the notifications that your
|
||||
* application may post. See GROWL_NOTIFICATION_NAME for a discussion of good
|
||||
* notification names.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_ALL XSTR("AllNotifications")
|
||||
/*! @defined GROWL_NOTIFICATIONS_HUMAN_READABLE_DESCRIPTIONS
|
||||
* @abstract A dictionary of human-readable names for your notifications.
|
||||
* @discussion By default, the Growl UI will display notifications by the names given in GROWL_NOTIFICATIONS_ALL
|
||||
* which correspond to the GROWL_NOTIFICATION_NAME. This dictionary specifies the human-readable name to display.
|
||||
* The keys of the dictionary are GROWL_NOTIFICATION_NAME strings; the objects are the human-readable versions.
|
||||
* For any GROWL_NOTIFICATION_NAME not specific in this dictionary, the GROWL_NOTIFICATION_NAME will be displayed.
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES XSTR("HumanReadableNames")
|
||||
/*! @defined GROWL_NOTIFICATIONS_DESCRIPTIONS
|
||||
* @abstract A dictionary of descriptions of _when_ each notification occurs
|
||||
* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are
|
||||
* descriptions of _when_ each notification occurs, such as "You received a new mail message" or
|
||||
* "A file finished downloading".
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_DESCRIPTIONS XSTR("NotificationDescriptions")
|
||||
/*! @defined GROWL_NOTIFICATIONS_ICONS
|
||||
* @abstract A dictionary of icons for each notification
|
||||
* @discussion This is an NSDictionary whose keys are GROWL_NOTIFICATION_NAME strings and whose objects are
|
||||
* icons for each notification, for GNTP spec
|
||||
*
|
||||
* This key is optional.
|
||||
*/
|
||||
#define GROWL_NOTIFICATIONS_ICONS XSTR("NotificationIcons")
|
||||
|
||||
/*! @defined GROWL_TICKET_VERSION
|
||||
* @abstract The version of your registration ticket.
|
||||
* @discussion Include this key in a ticket plist file that you put in your
|
||||
* application bundle for auto-discovery. The current ticket version is 1.
|
||||
*/
|
||||
#define GROWL_TICKET_VERSION XSTR("TicketVersion")
|
||||
// UserInfo Keys for Notifications
|
||||
#pragma mark UserInfo Keys for Notifications
|
||||
|
||||
/*! @group Notification userInfo keys */
|
||||
/* @abstract Keys for the userInfo dictionary of a GROWL_NOTIFICATION distributed notification.
|
||||
* @discussion The values of these keys describe the content of a Growl
|
||||
* notification.
|
||||
*
|
||||
* Not all of these keys are supported by all displays. Only the name, title,
|
||||
* and description of a notification are universal. Most of the built-in
|
||||
* displays do support all of these keys, and most other visual displays
|
||||
* probably will also. But, as of 0.6, the Log, MailMe, and Speech displays
|
||||
* support only textual data.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_NAME
|
||||
* @abstract The name of the notification.
|
||||
* @discussion The name of the notification. Note that if you do not define
|
||||
* GROWL_NOTIFICATIONS_HUMAN_READABLE_NAMES when registering your ticket originally this name
|
||||
* will the one displayed within the Growl preference pane and should be human-readable.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_NAME XSTR("NotificationName")
|
||||
/*! @defined GROWL_NOTIFICATION_TITLE
|
||||
* @abstract The title to display in the notification.
|
||||
* @discussion The title of the notification. Should be very brief.
|
||||
* The title usually says what happened, e.g. "Download complete".
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_TITLE XSTR("NotificationTitle")
|
||||
/*! @defined GROWL_NOTIFICATION_DESCRIPTION
|
||||
* @abstract The description to display in the notification.
|
||||
* @discussion The description should be longer and more verbose than the title.
|
||||
* The description usually tells the subject of the action,
|
||||
* e.g. "Growl-0.6.dmg downloaded in 5.02 minutes".
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_DESCRIPTION XSTR("NotificationDescription")
|
||||
/*! @defined GROWL_NOTIFICATION_ICON
|
||||
* @discussion Image data for the notification icon. Image data must be in a format
|
||||
* supported by NSImage, such as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_ICON_DATA XSTR("NotificationIcon")
|
||||
/*! @defined GROWL_NOTIFICATION_APP_ICON
|
||||
* @discussion Image data for the application icon, in case GROWL_APP_ICON does
|
||||
* not apply for some reason. Image data be in a format supported by NSImage, such
|
||||
* as TIFF, PNG, GIF, JPEG, BMP, PICT, or PDF.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_APP_ICON_DATA XSTR("NotificationAppIcon")
|
||||
/*! @defined GROWL_NOTIFICATION_PRIORITY
|
||||
* @discussion The priority of the notification as an integer number from
|
||||
* -2 to +2 (+2 being highest).
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_PRIORITY XSTR("NotificationPriority")
|
||||
/*! @defined GROWL_NOTIFICATION_STICKY
|
||||
* @discussion A Boolean number controlling whether the notification is sticky.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_STICKY XSTR("NotificationSticky")
|
||||
/*! @defined GROWL_NOTIFICATION_CLICK_CONTEXT
|
||||
* @abstract Identifies which notification was clicked.
|
||||
* @discussion An identifier for the notification for clicking purposes.
|
||||
*
|
||||
* This will be passed back to the application when the notification is
|
||||
* clicked. It must be plist-encodable (a data, dictionary, array, number, or
|
||||
* string object), and it should be unique for each notification you post.
|
||||
* A good click context would be a UUID string returned by NSProcessInfo or
|
||||
* CFUUID.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_CLICK_CONTEXT XSTR("NotificationClickContext")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_IDENTIFIER
|
||||
* @abstract An identifier for the notification for coalescing purposes.
|
||||
* Notifications with the same identifier fall into the same class; only
|
||||
* the last notification of a class is displayed on the screen. If a
|
||||
* notification of the same class is currently being displayed, it is
|
||||
* replaced by this notification.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_IDENTIFIER XSTR("GrowlNotificationIdentifier")
|
||||
|
||||
/*! @defined GROWL_APP_PID
|
||||
* @abstract The process identifier of the process which sends this
|
||||
* notification. If this field is set, the application will only receive
|
||||
* clicked and timed out notifications which originate from this process.
|
||||
*
|
||||
* Optional.
|
||||
*/
|
||||
#define GROWL_APP_PID XSTR("ApplicationPID")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_PROGRESS
|
||||
* @abstract If this key is set, it should contain a double value wrapped
|
||||
* in a NSNumber which describes some sort of progress (from 0.0 to 100.0).
|
||||
* If this is key is not set, no progress bar is shown.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_PROGRESS XSTR("NotificationProgress")
|
||||
|
||||
/*! @defined GROWL_NOTIFICATION_ALREADY_SHOWN
|
||||
* @abstract If this key is set, it should contain a bool value wrapped
|
||||
* in a NSNumber which describes whether the notification has
|
||||
* already been displayed, for instance by built in Notification
|
||||
* Center support. This value can be used to allow display
|
||||
* plugins to skip a notification, while still allowing Growl
|
||||
* actions to run on them.
|
||||
*
|
||||
* Optional. Not supported by all display plugins.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION_ALREADY_SHOWN XSTR("AlreadyShown")
|
||||
|
||||
|
||||
// Notifications
|
||||
#pragma mark Notifications
|
||||
|
||||
/*! @group Notification names */
|
||||
/* @abstract Names of distributed notifications used by Growl.
|
||||
* @discussion These are notifications used by applications (directly or
|
||||
* indirectly) to interact with Growl, and by Growl for interaction between
|
||||
* its components.
|
||||
*
|
||||
* Most of these should no longer be used in Growl 0.6 and later, in favor of
|
||||
* Growl.framework's GrowlApplicationBridge APIs.
|
||||
*/
|
||||
|
||||
/*! @defined GROWL_APP_REGISTRATION
|
||||
* @abstract The distributed notification for registering your application.
|
||||
* @discussion This is the name of the distributed notification that can be
|
||||
* used to register applications with Growl.
|
||||
*
|
||||
* The userInfo dictionary for this notification can contain these keys:
|
||||
* <ul>
|
||||
* <li>GROWL_APP_NAME</li>
|
||||
* <li>GROWL_APP_ICON_DATA</li>
|
||||
* <li>GROWL_NOTIFICATIONS_ALL</li>
|
||||
* <li>GROWL_NOTIFICATIONS_DEFAULT</li>
|
||||
* </ul>
|
||||
*
|
||||
* No longer recommended as of Growl 0.6. An alternate method of registering
|
||||
* is to use Growl.framework's delegate system.
|
||||
* See +[GrowlApplicationBridge setGrowlDelegate:] or Growl_SetDelegate for
|
||||
* more information.
|
||||
*/
|
||||
#define GROWL_APP_REGISTRATION XSTR("GrowlApplicationRegistrationNotification")
|
||||
/*! @defined GROWL_APP_REGISTRATION_CONF
|
||||
* @abstract The distributed notification for confirming registration.
|
||||
* @discussion The name of the distributed notification sent to confirm the
|
||||
* registration. Used by the Growl preference pane. Your application probably
|
||||
* does not need to use this notification.
|
||||
*/
|
||||
#define GROWL_APP_REGISTRATION_CONF XSTR("GrowlApplicationRegistrationConfirmationNotification")
|
||||
/*! @defined GROWL_NOTIFICATION
|
||||
* @abstract The distributed notification for Growl notifications.
|
||||
* @discussion This is what it all comes down to. This is the name of the
|
||||
* distributed notification that your application posts to actually send a
|
||||
* Growl notification.
|
||||
*
|
||||
* The userInfo dictionary for this notification can contain these keys:
|
||||
* <ul>
|
||||
* <li>GROWL_NOTIFICATION_NAME (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_TITLE (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_DESCRIPTION (required)</li>
|
||||
* <li>GROWL_NOTIFICATION_ICON</li>
|
||||
* <li>GROWL_NOTIFICATION_APP_ICON</li>
|
||||
* <li>GROWL_NOTIFICATION_PRIORITY</li>
|
||||
* <li>GROWL_NOTIFICATION_STICKY</li>
|
||||
* <li>GROWL_NOTIFICATION_CLICK_CONTEXT</li>
|
||||
* <li>GROWL_APP_NAME (required)</li>
|
||||
* </ul>
|
||||
*
|
||||
* No longer recommended as of Growl 0.6. Three alternate methods of posting
|
||||
* notifications are +[GrowlApplicationBridge notifyWithTitle:description:notificationName:iconData:priority:isSticky:clickContext:],
|
||||
* Growl_NotifyWithTitleDescriptionNameIconPriorityStickyClickContext, and
|
||||
* Growl_PostNotification.
|
||||
*/
|
||||
#define GROWL_NOTIFICATION XSTR("GrowlNotification")
|
||||
/*! @defined GROWL_PING
|
||||
* @abstract A distributed notification to check whether Growl is running.
|
||||
* @discussion This is used by the Growl preference pane. If it receives a
|
||||
* GROWL_PONG, the preference pane takes this to mean that Growl is running.
|
||||
*/
|
||||
#define GROWL_PING XSTR("Honey, Mind Taking Out The Trash")
|
||||
/*! @defined GROWL_PONG
|
||||
* @abstract The distributed notification sent in reply to GROWL_PING.
|
||||
* @discussion GrowlHelperApp posts this in reply to GROWL_PING.
|
||||
*/
|
||||
#define GROWL_PONG XSTR("What Do You Want From Me, Woman")
|
||||
/*! @defined GROWL_IS_READY
|
||||
* @abstract The distributed notification sent when Growl starts up.
|
||||
* @discussion GrowlHelperApp posts this when it has begin listening on all of
|
||||
* its sources for new notifications. GrowlApplicationBridge (in
|
||||
* Growl.framework), upon receiving this notification, reregisters using the
|
||||
* registration dictionary supplied by its delegate.
|
||||
*/
|
||||
#define GROWL_IS_READY XSTR("Lend Me Some Sugar; I Am Your Neighbor!")
|
||||
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX
|
||||
* @abstract Part of the name of the distributed notification sent when a supported notification is clicked.
|
||||
* @discussion When a Growl notification with a click context is clicked on by
|
||||
* the user, Growl posts a distributed notification whose name is in the format:
|
||||
* [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX]
|
||||
* The GrowlApplicationBridge responds to this notification by calling a callback in its delegate.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_CLICKED_SUFFIX XSTR("GrowlClicked!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX
|
||||
* @abstract Part of the name of the distributed notification sent when a supported notification times out without being clicked.
|
||||
* @discussion When a Growl notification with a click context times out, Growl posts a distributed notification
|
||||
* whose name is in the format:
|
||||
* [NSString stringWithFormat:@"%@-%d-%@", appName, pid, GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX]
|
||||
* The GrowlApplicationBridge responds to this notification by calling a callback in its delegate.
|
||||
* NOTE: The user may have actually clicked the 'close' button; this triggers an *immediate* time-out of the notification.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_TIMED_OUT_SUFFIX XSTR("GrowlTimedOut!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON
|
||||
* @abstract The distributed notification sent when the Notification Center support is toggled on in Growl 2.0
|
||||
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
|
||||
* to inform all running apps that they should now speak to Notification Center directly.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_ON XSTR("GrowlNotificationCenterOn!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF
|
||||
* @abstract The distributed notification sent when the Notification Center support is toggled off in Growl 2.0
|
||||
* @discussion When the user enables Notification Center support in Growl 2.0, this notification is sent
|
||||
* to inform all running apps that they should no longer speak to Notification Center directly.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_OFF XSTR("GrowlNotificationCenterOff!")
|
||||
|
||||
/*! @defined GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY
|
||||
* @abstract The distributed notification sent by an application to query Growl 2.0's notification center support.
|
||||
* @discussion When an app starts up, it will send this query to get Growl 2.0 to spit out whether notification
|
||||
* center support is on or off.
|
||||
*/
|
||||
#define GROWL_DISTRIBUTED_NOTIFICATION_NOTIFICATIONCENTER_QUERY XSTR("GrowlNotificationCenterYN?")
|
||||
|
||||
|
||||
/*! @group Other symbols */
|
||||
/* Symbols which don't fit into any of the other categories. */
|
||||
|
||||
/*! @defined GROWL_KEY_CLICKED_CONTEXT
|
||||
* @abstract Used internally as the key for the clickedContext passed over DNC.
|
||||
* @discussion This key is used in GROWL_NOTIFICATION_CLICKED, and contains the
|
||||
* click context that was supplied in the original notification.
|
||||
*/
|
||||
#define GROWL_KEY_CLICKED_CONTEXT XSTR("ClickedContext")
|
||||
/*! @defined GROWL_REG_DICT_EXTENSION
|
||||
* @abstract The filename extension for registration dictionaries.
|
||||
* @discussion The GrowlApplicationBridge in Growl.framework registers with
|
||||
* Growl by creating a file with the extension of .(GROWL_REG_DICT_EXTENSION)
|
||||
* and opening it in the GrowlHelperApp. This happens whether or not Growl is
|
||||
* running; if it was stopped, it quits immediately without listening for
|
||||
* notifications.
|
||||
*/
|
||||
#define GROWL_REG_DICT_EXTENSION XSTR("growlRegDict")
|
||||
|
||||
|
||||
#define GROWL_POSITION_PREFERENCE_KEY @"GrowlSelectedPosition"
|
||||
|
||||
#define GROWL_PLUGIN_CONFIG_ID XSTR("GrowlPluginConfigurationID")
|
||||
|
||||
#endif //ndef _GROWLDEFINES_H
|
||||
@@ -0,0 +1,40 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>12C60</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>Growl</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.growl.growlframework</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>FMWK</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>2.0.1</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>GRRR</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>2.0.1</string>
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>4G2008a</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>GM</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>12C37</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx10.8</string>
|
||||
<key>DTXcode</key>
|
||||
<string>0452</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>4G2008a</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>GrowlApplicationBridge</string>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>Resources/Info.plist</key>
|
||||
<data>
|
||||
VZb3f8My4te/5JwcjfvotgCXTAs=
|
||||
</data>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>^Resources/</key>
|
||||
<true/>
|
||||
<key>^Resources/.*\.lproj/</key>
|
||||
<dict>
|
||||
<key>optional</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1000</real>
|
||||
</dict>
|
||||
<key>^Resources/.*\.lproj/locversion.plist$</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>1100</real>
|
||||
</dict>
|
||||
<key>^version.plist$</key>
|
||||
<true/>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
@@ -0,0 +1 @@
|
||||
A
|
||||
@@ -0,0 +1,34 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>English</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>${EXECUTABLE_NAME}</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>XcodeCapp.icns</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.cappuccino.xcodecapp</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleName</key>
|
||||
<string>${PRODUCT_NAME}</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>3.0</string>
|
||||
<key>CFBundleSignature</key>
|
||||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3.0.0</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSUIElement</key>
|
||||
<true/>
|
||||
<key>NSMainNibFile</key>
|
||||
<string>MainMenu</string>
|
||||
<key>NSPrincipalClass</key>
|
||||
<string>NSApplication</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
After Width: | Height: | Size: 26 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 874 B |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 83 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 2.5 KiB |
|
After Width: | Height: | Size: 8.2 KiB |
|
After Width: | Height: | Size: 270 KiB |
|
After Width: | Height: | Size: 944 KiB |
@@ -0,0 +1,166 @@
|
||||
{\rtf1\ansi\ansicpg1252\cocoartf1187
|
||||
{\fonttbl\f0\fnil\fcharset0 LucidaGrande;\f1\fswiss\fcharset0 Helvetica;\f2\fmodern\fcharset0 Courier;
|
||||
}
|
||||
{\colortbl;\red255\green255\blue255;}
|
||||
\margl1440\margr1440\vieww16380\viewh15560\viewkind0
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0\b\fs36 \cf0 XcodeCapp Help
|
||||
\b0 \
|
||||
\
|
||||
|
||||
\b\fs24 What is XcodeCapp?\
|
||||
|
||||
\b0\fs36 \
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\fs24 \cf0 One of Cappuccino\'92s greatest features is the ability to use Xcode 4 to create the user interface for your web applications. Xcode creates .xib files which then must be converted by the command line utility
|
||||
\b nib2cib
|
||||
\b0 to .cib files for use with Cappuccino. But beginning with Xcode 4, there is no way to directly create outlets and actions without editing Objective-C header files.\
|
||||
\
|
||||
XcodeCapp acts as a bridge between Xcode and Cappuccino. It performs two main functions:\
|
||||
\
|
||||
\'95 Reads your source files when they are modified and automatically creates outlets and actions in the .xib file.\
|
||||
\'95 Automatically converts .xib files to .cib files when the .xib file is modified.\
|
||||
\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\b \cf0 Using XcodeCapp
|
||||
\b0 \
|
||||
\
|
||||
XcodeCapp is very easy to use and requires very little user interaction. When you build Cappuccino with jake, it will create a symlink to the XcodeCapp application in your Applications folder. Launch XcodeCapp from there and the XcodeCapp icon will appear in your menu bar. Clicking on the icon will display the XcodeCapp menu:\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f1 \cf0 {{\NeXTGraphic menu1.png \width4220 \height3440
|
||||
}¬}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\
|
||||
\
|
||||
If this is the first time you have run XcodeCapp, or if you were not listening to a project when XcodeCapp was last quit, you need to choose a Cappuccino project. Select "Listen to Project\'85\'94, and a folder chooser will appear. Navigate to the root folder of your project \'97 the one that contains index.html and Jakefile \'97 and click Open.\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
\cf0 \
|
||||
Once you select a project, XcodeCapp will import your project and create a hidden folder called \'93.XcodeSupport\'94 in the root project directory. This folder contains files built by XcodeCapp that it needs to perform its magic, so you should never directly modify those files. You will probably want to ignore this folder in your IDE and source code management system as well.\
|
||||
\
|
||||
After XcodeCapp has imported a project, it will listen to changes in the following files anywhere in the project:\
|
||||
\
|
||||
\'95 *.xib \'96 Interface Builder files\
|
||||
\'95 *.j - Objective-J source\
|
||||
\'95 .xcodecapp-ignore - specifies files XcodeCapp should ignore\
|
||||
\
|
||||
Any time these files are modified, XcodeCapp will process the files and show a Growl notification when the processing is done.\
|
||||
\
|
||||
\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\b \cf0 Declaring Outlets and Actions\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\b0 \cf0 \
|
||||
The most important function XcodeCapp performs is to create outlets and actions for use with Interface Builder. You create outlets by prefixing them in your source files with
|
||||
\b @outlet
|
||||
\b0 or
|
||||
\b IBOutlet
|
||||
\b0 . For example, in the class below, there are seven outlets defined:\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f1 \cf0 {{\NeXTGraphic outlets.png \width10580 \height4580
|
||||
}¬}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
\cf0 Similarly, you declare actions by declaring the return type of the method to be
|
||||
\b @action
|
||||
\b0 or
|
||||
\b IBAction
|
||||
\b0 . For example, the following method can serve as an action for a control:\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f1 \cf0 {{\NeXTGraphic action.png \width14180 \height2440
|
||||
}¬}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
\cf0 \
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\b \cf0 Editing XIBs\
|
||||
\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
|
||||
\b0 \cf0 XcodeCapp creates an Xcode 4 project that allows you to edit your project\'92s xibs. To open the project, click on the XcodeCapp menu and select \'93Open Project in Xcode\'94.\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
\cf0 \
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f1 \cf0 {{\NeXTGraphic menu2.png \width5220 \height3480
|
||||
}¬}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\
|
||||
Once the Xcode project is open, you can edit your xibs with the interface builder. All of the outlets and actions you declared in your source will be available in interface builder for connection to views. For example, the InfoPanelController shown above would have these outlets in interface builder:\
|
||||
\pard\tx566\tx1133\tx1700\tx2267\tx2834\tx3401\tx3968\tx4535\tx5102\tx5669\tx6236\tx6803\pardirnatural
|
||||
\cf0 \
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f1 \cf0 {{\NeXTGraphic outlets2.png \width8040 \height4160
|
||||
}¬}\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\b \cf0 Ignoring Files and Folders\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\b0 \cf0 To have XcodeCapp ignore files and folders, create a file in the root project directory named \'93.xcodecapp-ignore\'94, and enter one line for each pattern you would like to ignore. Patterns may use \'93*\'94 as a wildcard to match zero or more characters (it is
|
||||
\b not
|
||||
\b0 a shell glob) and are matched against the
|
||||
\b absolute
|
||||
\b0 path of the file or folder, so in most cases your patterns should begin with \'93*\'94. To safely match a folder name, the pattern should be
|
||||
\f2 */<name>/*
|
||||
\f0 , where
|
||||
\f2 name
|
||||
\f0 is the name of the folder.\
|
||||
\
|
||||
For example, to ignore the \'93Modules\'94 directory and the xib file \'93foo.xib\'94 in your project, enter these lines in .xcodecapp-ignore:\
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f2 \cf0 */Modules/*\
|
||||
*/foo.xib
|
||||
\f0 \
|
||||
\
|
||||
Note that in addition to whatever patterns you specify (if any), XcodeCapp
|
||||
\b always
|
||||
\b0 ignores the following patterns:\
|
||||
\
|
||||
|
||||
\f2 */.git/*\
|
||||
*/.svn/*\
|
||||
*/.hg/*\
|
||||
*/Frameworks/*\
|
||||
*/.XcodeSupport/*\
|
||||
*/Build/*\
|
||||
*/NS_*.j\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\f0 \cf0 \
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\b \cf0 Credits
|
||||
\fs28 \
|
||||
\
|
||||
\pard\tx560\tx1120\tx1680\tx2240\tx2800\tx3360\tx3920\tx4480\tx5040\tx5600\tx6160\tx6720\pardirnatural
|
||||
|
||||
\b0\fs24 \cf0 XcodeCapp was originally written by Francisco Tolmasky.\
|
||||
The Cocoa port was written by Antoine Mercadal with contributions from Aparajita Fishman.\
|
||||
XcodeCapp (Cocoa version, formerly known as XcodeCapp-cocoa) was originally built for the Archipel Project (archipelproject.org) and is now part of Cappuccino.}
|
||||
|
After Width: | Height: | Size: 18 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 24 KiB |
|
After Width: | Height: | Size: 19 KiB |
|
After Width: | Height: | Size: 20 KiB |
|
After Width: | Height: | Size: 612 B |
|
After Width: | Height: | Size: 618 B |
|
After Width: | Height: | Size: 618 B |
@@ -0,0 +1,72 @@
|
||||
// !$*UTF8*$!
|
||||
{
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 46;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXFileReference section */
|
||||
E164FE29172185F500263CE3 /* Resources */ = {isa = PBXFileReference; lastKnownFileType = folder; path = Resources; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
|
||||
/* Begin PBXGroup section */
|
||||
E164FE221721857400263CE3 = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
E164FE29172185F500263CE3 /* Resources */,
|
||||
);
|
||||
sourceTree = "<group>";
|
||||
};
|
||||
/* End PBXGroup section */
|
||||
|
||||
/* Begin PBXProject section */
|
||||
E164FE231721857400263CE3 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0460;
|
||||
};
|
||||
buildConfigurationList = E164FE261721857400263CE3 /* Build configuration list for PBXProject "Cappuccino" */;
|
||||
compatibilityVersion = "Xcode 3.2";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
en,
|
||||
);
|
||||
mainGroup = E164FE221721857400263CE3;
|
||||
projectDirPath = "";
|
||||
projectRoot = "";
|
||||
targets = (
|
||||
);
|
||||
};
|
||||
/* End PBXProject section */
|
||||
|
||||
/* Begin XCBuildConfiguration section */
|
||||
E164FE271721857400263CE3 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
E164FE281721857400263CE3 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
/* End XCBuildConfiguration section */
|
||||
|
||||
/* Begin XCConfigurationList section */
|
||||
E164FE261721857400263CE3 /* Build configuration list for PBXProject "Cappuccino" */ = {
|
||||
isa = XCConfigurationList;
|
||||
buildConfigurations = (
|
||||
E164FE271721857400263CE3 /* Debug */,
|
||||
E164FE281721857400263CE3 /* Release */,
|
||||
);
|
||||
defaultConfigurationIsVisible = 0;
|
||||
defaultConfigurationName = Release;
|
||||
};
|
||||
/* End XCConfigurationList section */
|
||||
};
|
||||
rootObject = E164FE231721857400263CE3 /* Project object */;
|
||||
}
|
||||
@@ -1,16 +1,16 @@
|
||||
# Copyright 2012 Calvin Rien
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
# A pbxproj file is an OpenStep format plist
|
||||
# {} represents dictionary of key=value pairs delimited by ;
|
||||
@@ -143,39 +143,39 @@ class PBXFileReference(PBXType):
|
||||
self.build_phase = None
|
||||
|
||||
types = {
|
||||
'.a':('archive.ar', 'PBXFrameworksBuildPhase'),
|
||||
'.app': ('wrapper.application', None),
|
||||
'.s': ('sourcecode.asm', 'PBXSourcesBuildPhase'),
|
||||
'.c': ('sourcecode.c.c', 'PBXSourcesBuildPhase'),
|
||||
'.cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase'),
|
||||
'.framework': ('wrapper.framework','PBXFrameworksBuildPhase'),
|
||||
'.h': ('sourcecode.c.h', None),
|
||||
'.icns': ('image.icns','PBXResourcesBuildPhase'),
|
||||
'.m': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'),
|
||||
'.j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'),
|
||||
'.mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase'),
|
||||
'.nib': ('wrapper.nib', 'PBXResourcesBuildPhase'),
|
||||
'.plist': ('text.plist.xml', 'PBXResourcesBuildPhase'),
|
||||
'.json': ('text.json', 'PBXResourcesBuildPhase'),
|
||||
'.png': ('image.png', 'PBXResourcesBuildPhase'),
|
||||
'.rtf': ('text.rtf', 'PBXResourcesBuildPhase'),
|
||||
'.tiff': ('image.tiff', 'PBXResourcesBuildPhase'),
|
||||
'.txt': ('text', 'PBXResourcesBuildPhase'),
|
||||
'.xcodeproj': ('wrapper.pb-project', None),
|
||||
'.xib': ('file.xib', 'PBXResourcesBuildPhase'),
|
||||
'.strings': ('text.plist.strings', 'PBXResourcesBuildPhase'),
|
||||
'.bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase'),
|
||||
'.dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase')
|
||||
'.a':('archive.ar', 'PBXFrameworksBuildPhase'),
|
||||
'.app': ('wrapper.application', None),
|
||||
'.s': ('sourcecode.asm', 'PBXSourcesBuildPhase'),
|
||||
'.c': ('sourcecode.c.c', 'PBXSourcesBuildPhase'),
|
||||
'.cpp': ('sourcecode.cpp.cpp', 'PBXSourcesBuildPhase'),
|
||||
'.framework': ('wrapper.framework','PBXFrameworksBuildPhase'),
|
||||
'.h': ('sourcecode.c.h', None),
|
||||
'.icns': ('image.icns','PBXResourcesBuildPhase'),
|
||||
'.m': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'),
|
||||
'.j': ('sourcecode.c.objc', 'PBXSourcesBuildPhase'),
|
||||
'.mm': ('sourcecode.cpp.objcpp', 'PBXSourcesBuildPhase'),
|
||||
'.nib': ('wrapper.nib', 'PBXResourcesBuildPhase'),
|
||||
'.plist': ('text.plist.xml', 'PBXResourcesBuildPhase'),
|
||||
'.json': ('text.json', 'PBXResourcesBuildPhase'),
|
||||
'.png': ('image.png', 'PBXResourcesBuildPhase'),
|
||||
'.rtf': ('text.rtf', 'PBXResourcesBuildPhase'),
|
||||
'.tiff': ('image.tiff', 'PBXResourcesBuildPhase'),
|
||||
'.txt': ('text', 'PBXResourcesBuildPhase'),
|
||||
'.xcodeproj': ('wrapper.pb-project', None),
|
||||
'.xib': ('file.xib', 'PBXResourcesBuildPhase'),
|
||||
'.strings': ('text.plist.strings', 'PBXResourcesBuildPhase'),
|
||||
'.bundle': ('wrapper.plug-in', 'PBXResourcesBuildPhase'),
|
||||
'.dylib': ('compiled.mach-o.dylib', 'PBXFrameworksBuildPhase')
|
||||
}
|
||||
|
||||
trees = [
|
||||
'<absolute>',
|
||||
'<group>',
|
||||
'BUILT_PRODUCTS_DIR',
|
||||
'DEVELOPER_DIR',
|
||||
'SDKROOT',
|
||||
'SOURCE_ROOT',
|
||||
]
|
||||
'<absolute>',
|
||||
'<group>',
|
||||
'BUILT_PRODUCTS_DIR',
|
||||
'DEVELOPER_DIR',
|
||||
'SDKROOT',
|
||||
'SOURCE_ROOT',
|
||||
]
|
||||
|
||||
def guess_file_type(self):
|
||||
self.remove('explicitFileType')
|
||||
@@ -355,6 +355,10 @@ class PBXVariantGroup(PBXType):
|
||||
pass
|
||||
|
||||
|
||||
class PBXTargetDependency(PBXType):
|
||||
pass
|
||||
|
||||
|
||||
class PBXBuildPhase(PBXType):
|
||||
def add_build_file(self, bf):
|
||||
if bf.get('isa') != 'PBXBuildFile':
|
||||
@@ -590,7 +594,7 @@ class XcodeProject(PBXDict):
|
||||
if b.add_library_search_paths(paths, recursive):
|
||||
self.modified = True
|
||||
|
||||
# TODO: need to return value if project has been modified
|
||||
# TODO: need to return value if project has been modified
|
||||
|
||||
def get_obj(self, id):
|
||||
return self.objects.get(id)
|
||||
@@ -600,36 +604,36 @@ class XcodeProject(PBXDict):
|
||||
|
||||
def get_files_by_os_path(self, os_path, tree='SOURCE_ROOT'):
|
||||
files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference'
|
||||
and f.get('path') == os_path
|
||||
and f.get('sourceTree') == tree]
|
||||
and f.get('path') == os_path
|
||||
and f.get('sourceTree') == tree]
|
||||
|
||||
return files
|
||||
|
||||
def get_files_by_name(self, name, parent=None):
|
||||
if parent:
|
||||
files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference'
|
||||
and f.get(name) == name
|
||||
and parent.has_child(f)]
|
||||
and f.get(name) == name
|
||||
and parent.has_child(f)]
|
||||
else:
|
||||
files = [f for f in self.objects.values() if f.get('isa') == 'PBXFileReference'
|
||||
and f.get(name) == name]
|
||||
and f.get(name) == name]
|
||||
|
||||
return files
|
||||
|
||||
def get_build_files(self, id):
|
||||
files = [f for f in self.objects.values() if f.get('isa') == 'PBXBuildFile'
|
||||
and f.get('fileRef') == id]
|
||||
and f.get('fileRef') == id]
|
||||
|
||||
return files
|
||||
|
||||
def get_groups_by_name(self, name, parent=None):
|
||||
if parent:
|
||||
groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup'
|
||||
and g.get_name() == name
|
||||
and parent.has_child(g)]
|
||||
and g.get_name() == name
|
||||
and parent.has_child(g)]
|
||||
else:
|
||||
groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup'
|
||||
and g.get_name() == name]
|
||||
and g.get_name() == name]
|
||||
|
||||
return groups
|
||||
|
||||
@@ -662,7 +666,7 @@ class XcodeProject(PBXDict):
|
||||
path = os.path.abspath(path)
|
||||
|
||||
groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup'
|
||||
and os.path.abspath(g.get('path','/dev/null')) == path]
|
||||
and os.path.abspath(g.get('path','/dev/null')) == path]
|
||||
|
||||
return groups
|
||||
|
||||
@@ -739,9 +743,9 @@ class XcodeProject(PBXDict):
|
||||
continue
|
||||
|
||||
kwds = {
|
||||
'create_build_files': create_build_files,
|
||||
'parent': grp,
|
||||
'name': f
|
||||
'create_build_files': create_build_files,
|
||||
'parent': grp,
|
||||
'name': f
|
||||
}
|
||||
|
||||
f_path = os.path.join(grp_path, f)
|
||||
@@ -812,12 +816,12 @@ class XcodeProject(PBXDict):
|
||||
results.append(build_file)
|
||||
|
||||
if abs_path and tree == 'SOURCE_ROOT' and os.path.isfile(abs_path)\
|
||||
and file_ref.build_phase == 'PBXFrameworksBuildPhase':
|
||||
and file_ref.build_phase == 'PBXFrameworksBuildPhase':
|
||||
library_path = os.path.join('$(SRCROOT)', os.path.split(f_path)[0])
|
||||
self.add_library_search_paths([library_path], recursive=False)
|
||||
|
||||
if abs_path and tree == 'SOURCE_ROOT' and not os.path.isfile(abs_path)\
|
||||
and file_ref.build_phase == 'PBXFrameworksBuildPhase':
|
||||
and file_ref.build_phase == 'PBXFrameworksBuildPhase':
|
||||
|
||||
framework_path = os.path.join('$(SRCROOT)', os.path.split(f_path)[0])
|
||||
self.add_framework_search_paths([framework_path,'$(inherited)'], recursive=False)
|
||||
@@ -849,12 +853,24 @@ class XcodeProject(PBXDict):
|
||||
if(not os.path.exists(finalLib)):
|
||||
os.symlink(srcLib, finalLib);
|
||||
|
||||
|
||||
def remove_group(self, grp):
|
||||
pass
|
||||
|
||||
def remove_file(self, id):
|
||||
pass
|
||||
def remove_file(self, id, recursive=True):
|
||||
if not PBXType.IsGuid(id):
|
||||
id = id.id
|
||||
|
||||
if id in self.objects:
|
||||
self.objects.remove(id)
|
||||
|
||||
if recursive:
|
||||
groups = [g for g in self.objects.values() if g.get('isa') == 'PBXGroup']
|
||||
|
||||
for group in groups:
|
||||
if id in group['children']:
|
||||
group.remove_child(id)
|
||||
|
||||
self.modified = True
|
||||
|
||||
def move_file(self, id, dest_grp=None):
|
||||
pass
|
||||
@@ -1023,11 +1039,11 @@ class XcodeProject(PBXDict):
|
||||
|
||||
for f in v:
|
||||
filerefs.extend([fr.id for fr in self.objects.values() if fr.get('isa') == 'PBXFileReference'
|
||||
and fr.get('name') == f])
|
||||
and fr.get('name') == f])
|
||||
|
||||
|
||||
buildfiles = [bf for bf in self.objects.values() if bf.get('isa') == 'PBXBuildFile'
|
||||
and bf.get('fileRef') in filerefs]
|
||||
and bf.get('fileRef') in filerefs]
|
||||
|
||||
for bf in buildfiles:
|
||||
if bf.add_compiler_flag(k):
|
||||
@@ -1137,26 +1153,30 @@ class XcodeProject(PBXDict):
|
||||
#root.remove('objects') #remove it to avoid problems
|
||||
|
||||
sections = [
|
||||
('PBXBuildFile',False),
|
||||
('PBXCopyFilesBuildPhase',True),
|
||||
('PBXFileReference',False),
|
||||
('PBXFrameworksBuildPhase',True),
|
||||
('PBXGroup',True),
|
||||
('PBXNativeTarget',True),
|
||||
('PBXProject',True),
|
||||
('PBXResourcesBuildPhase',True),
|
||||
('PBXShellScriptBuildPhase',True),
|
||||
('PBXSourcesBuildPhase',True),
|
||||
('XCBuildConfiguration',True),
|
||||
('XCConfigurationList',True)]
|
||||
('PBXBuildFile',False),
|
||||
('PBXCopyFilesBuildPhase',True),
|
||||
('PBXFileReference',False),
|
||||
('PBXFrameworksBuildPhase',True),
|
||||
('PBXGroup',True),
|
||||
('PBXNativeTarget',True),
|
||||
('PBXProject',True),
|
||||
('PBXResourcesBuildPhase',True),
|
||||
('PBXShellScriptBuildPhase',True),
|
||||
('PBXSourcesBuildPhase',True),
|
||||
('XCBuildConfiguration',True),
|
||||
('XCConfigurationList',True),
|
||||
('PBXTargetDependency', True),
|
||||
('PBXVariantGroup', True),
|
||||
('PBXReferenceProxy', True),
|
||||
('PBXContainerItemProxy', True)]
|
||||
|
||||
for section in sections: #iterate over the sections
|
||||
for section in sections: #iterate over the sections
|
||||
if(self.sections.get(section[0]) == None):
|
||||
continue;
|
||||
|
||||
out.write('\n/* Begin %s section */'%section[0]);
|
||||
self.sections.get(section[0]).sort(cmp=lambda x,y: cmp(x[0],y[0]))
|
||||
#if(self.sections.get(section[0])=='PBXGroup' and ): //add the patch to add the missing but existing files.
|
||||
#if(self.sections.get(section[0])=='PBXGroup' and ): //add the patch to add the missing but existing files.
|
||||
|
||||
for pair in self.sections.get(section[0]):
|
||||
key = pair[0]
|
||||
@@ -1206,7 +1226,7 @@ class XcodeProject(PBXDict):
|
||||
out.write('"'+XcodeProject.addslashes(root)+'"')
|
||||
if(root in self.uuids):
|
||||
out.write(" /* "+self.uuids[root]+" */");
|
||||
|
||||
|
||||
@classmethod
|
||||
def getJSONFromXML(cls, root):
|
||||
result = ''
|
||||
@@ -1232,7 +1252,7 @@ class XcodeProject(PBXDict):
|
||||
for child in root.childNodes:
|
||||
if child.nodeType != Node.ELEMENT_NODE:
|
||||
continue;
|
||||
|
||||
|
||||
if(i>0):
|
||||
result += ","
|
||||
result += XcodeProject.getJSONFromXML(child);
|
||||
@@ -1242,28 +1262,28 @@ class XcodeProject(PBXDict):
|
||||
data = '""'
|
||||
for node in root.childNodes:
|
||||
if node.nodeType == node.TEXT_NODE:
|
||||
data = '"'+XcodeProject.addslashes(node.data).replace('\n','\\n')+'"'
|
||||
data = '"'+XcodeProject.addslashes(node.data).replace('\n','\\n').replace('\\\'', '\'')+'"'
|
||||
break
|
||||
result += data
|
||||
return result;
|
||||
|
||||
|
||||
@classmethod
|
||||
def Load(cls, path):
|
||||
cls.plutil_path = os.path.join(os.path.split(__file__)[0], 'plutil')
|
||||
|
||||
|
||||
if not os.path.isfile(XcodeProject.plutil_path):
|
||||
cls.plutil_path = 'plutil'
|
||||
|
||||
|
||||
if subprocess.call([XcodeProject.plutil_path,'-lint','-s',path]):
|
||||
print 'ERROR: not a valid .pbxproj file'
|
||||
return None
|
||||
|
||||
|
||||
# load project by converting to JSON and parse
|
||||
p = subprocess.Popen([XcodeProject.plutil_path, '-convert', 'xml1', '-o', '-', path], stdout=subprocess.PIPE)
|
||||
rawXML = p.communicate()[0]
|
||||
|
||||
|
||||
xml = parseString(rawXML);
|
||||
jsonStr = XcodeProject.getJSONFromXML(xml.getElementsByTagName('dict')[0]);
|
||||
|
||||
|
||||
tree = json.loads(jsonStr)
|
||||
return XcodeProject(tree, path)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* parser.j
|
||||
*
|
||||
* Created by Francisco Tolmasky.
|
||||
* Modified by Antoine Mercadal, with great help of Martin Carlberg
|
||||
* Modified by Antoine Mercadal, with great help from Martin Carlberg
|
||||
* Copyright 2008-2013, 280 North, Inc.
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
@@ -23,7 +23,9 @@
|
||||
@import <Foundation/Foundation.j>
|
||||
|
||||
var FILE = require("file"),
|
||||
OS = require("os");
|
||||
OS = require("os"),
|
||||
|
||||
SLASH_REPLACEMENT = "∕"; // DIVISION SLASH, Unicode: U+2215
|
||||
|
||||
// Debug function to print some JS objects
|
||||
function dump(obj)
|
||||
@@ -35,22 +37,23 @@ function raise(pos, message)
|
||||
{
|
||||
var syntaxError = new SyntaxError(message);
|
||||
syntaxError.line = pos.line;
|
||||
syntaxError.column = pos.column;
|
||||
syntaxError.lineStart = pos.lineStart;
|
||||
syntaxError.lineEnd = pos.lineEnd;
|
||||
|
||||
throw syntaxError;
|
||||
}
|
||||
|
||||
var hasWarnings = false,
|
||||
errors = [],
|
||||
xcc = ObjectiveJ.acorn.walk.make(
|
||||
{
|
||||
ClassDeclarationStatement: function(node, st, c)
|
||||
{
|
||||
if (node.categoryname)
|
||||
{
|
||||
print("Line " + node.loc.start.line + ", " + node.loc.source);
|
||||
print("Categories are not supported yet. Ignoring it.");
|
||||
[errors addObject:@{
|
||||
@"message": "Categories are not supported yet, ignoring it.",
|
||||
@"path": node.loc.source,
|
||||
@"line": node.loc.start.line
|
||||
}];
|
||||
hasWarnings = true;
|
||||
return;
|
||||
}
|
||||
@@ -135,18 +138,25 @@ function compile(node, state, visitor)
|
||||
c(node, state);
|
||||
};
|
||||
|
||||
function shadowBaseNameForPath(path)
|
||||
{
|
||||
// strip the extension and replace slashes
|
||||
return path.substring(0, path.length - 2).replace(/[/]/g, SLASH_REPLACEMENT);
|
||||
}
|
||||
|
||||
function main(args)
|
||||
{
|
||||
try
|
||||
{
|
||||
var fileURL = new CFURL(args[1]),
|
||||
outputBaseURL = new CFURL(args[2]),
|
||||
outputHeaderURL = new CFURL(outputBaseURL.path() + ".h"),
|
||||
outputSourceURL = new CFURL(outputBaseURL.path() + ".m"),
|
||||
outputDirectory = args[2],
|
||||
baseFilename = shadowBaseNameForPath(fileURL.path()),
|
||||
outputHeaderURL = new CFURL([outputDirectory stringByAppendingPathComponent:baseFilename + ".h"]),
|
||||
outputImplementationURL = new CFURL([outputDirectory stringByAppendingPathComponent:baseFilename + ".m"]),
|
||||
source = FILE.read(fileURL, { charset: "UTF-8" }),
|
||||
flags = ObjectiveJ.Preprocessor.Flags.IncludeDebugSymbols | ObjectiveJ.Preprocessor.Flags.IncludeTypeSignatures,
|
||||
tokens = ObjectiveJ.acorn.parse(source, { locations:true, sourceFile:fileURL.path() }),
|
||||
sourceFile = fileURL.path(),
|
||||
tokens = ObjectiveJ.acorn.parse(source, { locations:true, sourceFile:sourceFile }),
|
||||
classesInformation = [],
|
||||
ObjectiveCSource = "",
|
||||
ObjectiveCHeader = "";
|
||||
@@ -158,54 +168,65 @@ function main(args)
|
||||
ObjectiveCHeader +=
|
||||
"#import <Foundation/Foundation.h>\n" +
|
||||
"#import <Cocoa/Cocoa.h>\n" +
|
||||
"#import \"xcc_general_include.h\"\n\n";
|
||||
'#import "xcc_general_include.h"\n';
|
||||
|
||||
ObjectiveCSource += "#import \"" + outputHeaderURL.lastPathComponent() + "\"\n\n";
|
||||
ObjectiveCSource += "#import \"" + outputHeaderURL.lastPathComponent() + "\"\n";
|
||||
|
||||
// Traverse each found classes
|
||||
classesInformation.forEach(function(aClass)
|
||||
{
|
||||
// add new class definition
|
||||
ObjectiveCHeader += "@interface " + aClass.name + " : " + NSCompatibleClassName(aClass.superClass) + "\n\n";
|
||||
ObjectiveCHeader += [CPString stringWithFormat:@"\n@interface %@ : %@", aClass.name, NSCompatibleClassName(aClass.superClass)];
|
||||
|
||||
// add each outlet in header
|
||||
if (aClass.outlets.length > 0)
|
||||
ObjectiveCHeader += "\n";
|
||||
|
||||
// Add each outlets in header
|
||||
aClass.outlets.forEach(function(anOutlet)
|
||||
{
|
||||
ObjectiveCHeader += "@property (assign) IBOutlet " + NSCompatibleClassName(anOutlet.type, YES) + " " + anOutlet.name + ";\n";
|
||||
ObjectiveCHeader += [CPString stringWithFormat:@"\n@property (assign) IBOutlet %@ %@;", NSCompatibleClassName(anOutlet.type, YES), anOutlet.name];
|
||||
});
|
||||
|
||||
ObjectiveCHeader += "\n";
|
||||
if (aClass.actions.length > 0)
|
||||
ObjectiveCHeader += "\n";
|
||||
|
||||
// Add each actions in header
|
||||
// add each action in header
|
||||
aClass.actions.forEach(function(anAction)
|
||||
{
|
||||
ObjectiveCHeader += "- (IBAction)" + anAction.name + ":(" + anAction.arguments[0].type + ")" + anAction.arguments[0].name + ";\n";
|
||||
ObjectiveCHeader += [CPString stringWithFormat:@"\n- (IBAction)%@:(%@)%@;", anAction.name, anAction.arguments[0].type, anAction.arguments[0].name];
|
||||
});
|
||||
|
||||
ObjectiveCHeader += "\n@end\n\n\n";
|
||||
if (aClass.outlets.length > 0 || aClass.actions.length > 0)
|
||||
ObjectiveCHeader += "\n";
|
||||
|
||||
ObjectiveCHeader += "\n@end\n";
|
||||
|
||||
// fill up the implementation file
|
||||
ObjectiveCSource += "@implementation " + aClass.name + "\n@end\n\n";
|
||||
ObjectiveCSource += "\n@implementation " + aClass.name + "\n@end\n";
|
||||
});
|
||||
|
||||
// write files
|
||||
if (ObjectiveCSource.length)
|
||||
FILE.write(outputSourceURL, ObjectiveCSource, { charset:"UTF-8" });
|
||||
if (ObjectiveCSource.length)
|
||||
FILE.write(outputImplementationURL, ObjectiveCSource, { charset:"UTF-8" });
|
||||
|
||||
if (ObjectiveCHeader.length)
|
||||
FILE.write(outputHeaderURL, ObjectiveCHeader, { charset:"UTF-8" });
|
||||
if (ObjectiveCHeader.length)
|
||||
FILE.write(outputHeaderURL, ObjectiveCHeader, { charset:"UTF-8" });
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
if (e instanceof SyntaxError)
|
||||
print("Line " + e.line + ", " + fileURL.path());
|
||||
|
||||
print(e.name + ": " + e.message);
|
||||
OS.exit(1);
|
||||
[errors addObject:@{
|
||||
@"message": e.message,
|
||||
@"path": sourceFile,
|
||||
@"line": e.line
|
||||
}];
|
||||
}
|
||||
|
||||
if (hasWarnings)
|
||||
OS.exit(2);
|
||||
if ([errors count])
|
||||
{
|
||||
var plist = [CPPropertyListSerialization dataFromPropertyList:errors format:CPPropertyListXMLFormat_v1_0];
|
||||
|
||||
print([plist rawString]);
|
||||
OS.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
function NSCompatibleClassName(aClassName, asPointer)
|
||||
|
||||
@@ -4,40 +4,64 @@ import re
|
||||
import sys
|
||||
from mod_pbxproj import XcodeProject
|
||||
|
||||
XCODESUPPORTFOLDER = ".XcodeSupport"
|
||||
XCODE_SUPPORT_FOLDER = "XcodeSupport"
|
||||
SLASH_REPLACEMENT = u"∕" # DIVISION SLASH Unicode U+2215
|
||||
STRING_RE = re.compile(ur"^\s*<string>(.*)</string>\s*$", re.MULTILINE)
|
||||
FRAMEWORKS_RE = re.compile(ur"^(.+/Frameworks/Debug/([^/]+))/.+$")
|
||||
XCC_GENERAL_INCLUDE = u"xcc_general_include.h"
|
||||
|
||||
|
||||
def update_general_include(project, projectBasePath):
|
||||
xcc_general_include_file = os.path.join(projectBasePath, XCODESUPPORTFOLDER, u"xcc_general_include.h")
|
||||
def update_general_include(project, projectBasePath, shadowGroup):
|
||||
xcc_general_include_path = os.path.join(projectBasePath, XCODE_SUPPORT_FOLDER, XCC_GENERAL_INCLUDE)
|
||||
content = u""
|
||||
|
||||
for file in os.listdir(os.path.join(projectBasePath, XCODESUPPORTFOLDER)):
|
||||
if file.endswith(".h"):
|
||||
content += u'#include "{0}"\n'.format(os.path.basename(unicode(file)))
|
||||
for path in os.listdir(os.path.join(projectBasePath, XCODE_SUPPORT_FOLDER)):
|
||||
filename = unicode(os.path.basename(path))
|
||||
|
||||
f = open(xcc_general_include_file, "w")
|
||||
if filename.endswith(".h") and filename != XCC_GENERAL_INCLUDE:
|
||||
content += u'#include "{0}"\n'.format(filename)
|
||||
|
||||
f = open(xcc_general_include_path, "w")
|
||||
f.write(content.encode("utf-8"))
|
||||
f.close()
|
||||
|
||||
if len(project.get_files_by_os_path(os.path.join(XCODESUPPORTFOLDER, os.path.basename(xcc_general_include_file)))) == 0:
|
||||
project.add_file(xcc_general_include_file, parent=shadowGroup)
|
||||
if len(project.get_files_by_os_path(os.path.join(XCODE_SUPPORT_FOLDER, XCC_GENERAL_INCLUDE))) == 0:
|
||||
project.add_file(xcc_general_include_path, parent=shadowGroup)
|
||||
|
||||
def add_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationFilePath, sourcePath, projectBasePath):
|
||||
project.add_file(shadowHeaderPath, parent=shadowGroup)
|
||||
project.add_file(shadowImplementationFilePath, parent=shadowGroup)
|
||||
def file_with_path(path, projectPath, project):
|
||||
relPath = os.path.relpath(path, projectPath)
|
||||
|
||||
if sourcePath in project.get_files_by_os_path(os.path.relpath(sourcePath, projectBasePath)):
|
||||
return
|
||||
for fileRef in [f for f in project.objects.values() if f.get("isa") == "PBXFileReference"]:
|
||||
filePath = path if fileRef.get("sourceTree") == "<absolute>" else relPath
|
||||
|
||||
project.add_file(sourcePath, parent=sourceGroup)
|
||||
if fileRef.get("path") == filePath:
|
||||
return fileRef
|
||||
|
||||
def remove_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationFilePath, sourcePath, projectBasePath):
|
||||
project.remove_file(os.path.join(XCODESUPPORTFOLDER, os.path.basename(shadowHeaderPath)), parent=shadowGroup)
|
||||
project.remove_file(os.path.join(XCODESUPPORTFOLDER, os.path.basename(shadowImplementationFilePath)), parent=shadowGroup)
|
||||
project.remove_file(os.path.relpath(sourcePath, projectBasePath), parent=sourceGroup)
|
||||
return None
|
||||
|
||||
def add_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationPath, sourcePath, projectBasePath):
|
||||
# Shadow files are always project-relative
|
||||
if not file_with_path(shadowHeaderPath, projectBasePath, project):
|
||||
project.add_file(shadowHeaderPath, parent=shadowGroup, tree="SOURCE_ROOT", create_build_files=False)
|
||||
|
||||
if not file_with_path(shadowImplementationPath, projectBasePath, project):
|
||||
project.add_file(shadowImplementationPath, parent=shadowGroup, tree="SOURCE_ROOT", create_build_files=False)
|
||||
|
||||
# If the file is within the project directory, the file reference will be project-relative, otherwise absolute
|
||||
if sourcePath.startswith(projectBasePath):
|
||||
tree = "SOURCE_ROOT"
|
||||
else:
|
||||
tree = "<absolute>"
|
||||
|
||||
if not file_with_path(sourcePath, projectBasePath, project):
|
||||
project.add_file(sourcePath, parent=sourceGroup, tree=tree, create_build_files=False)
|
||||
|
||||
def remove_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationPath, sourcePath, projectBasePath):
|
||||
for path in (shadowHeaderPath, shadowImplementationPath, sourcePath):
|
||||
fileRef = file_with_path(path, projectBasePath, project)
|
||||
|
||||
if fileRef:
|
||||
project.remove_file(fileRef)
|
||||
|
||||
def xml_converter(matchObj):
|
||||
return "<string>{0}</string>".format(matchObj.group(1).encode('ascii', 'xmlcharrefreplace'))
|
||||
@@ -66,6 +90,10 @@ def add_framework_resources(project, resourcesPath):
|
||||
framework = os.path.basename(os.path.dirname(resourcesPath))
|
||||
files[0]['name'] = framework + " Resources"
|
||||
|
||||
def save_project(project, pbxPath):
|
||||
project.save()
|
||||
convert_unicode_to_xml(pbxPath)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
||||
@@ -76,10 +104,10 @@ if __name__ == "__main__":
|
||||
projectSourcePath = unicode(sys.argv[3])
|
||||
sourcePath = os.path.realpath(projectSourcePath)
|
||||
|
||||
shadowBasePath = os.path.join(projectBasePath, ".XcodeSupport")
|
||||
shadowBasename = os.path.splitext(sourcePath)[0].replace(u"/", SLASH_REPLACEMENT)
|
||||
shadowHeaderPath = os.path.join(shadowBasePath, shadowBasename + ".h")
|
||||
shadowImplementationPath = os.path.join(shadowBasePath, shadowBasename + ".m")
|
||||
shadowBasePath = os.path.join(projectBasePath, XCODE_SUPPORT_FOLDER)
|
||||
shadowBaseName = os.path.splitext(sourcePath)[0].replace(u"/", SLASH_REPLACEMENT)
|
||||
shadowHeaderPath = os.path.join(shadowBasePath, shadowBaseName + ".h")
|
||||
shadowImplementationPath = os.path.join(shadowBasePath, shadowBaseName + ".m")
|
||||
projectName = os.path.basename(projectBasePath)
|
||||
pbxPath = os.path.join(projectBasePath, projectName + ".xcodeproj", "project.pbxproj")
|
||||
|
||||
@@ -88,11 +116,11 @@ if __name__ == "__main__":
|
||||
shadowGroup = project.get_or_create_group("Classes")
|
||||
sourceGroup = project.get_or_create_group("Sources")
|
||||
|
||||
files = project.get_files_by_os_path(os.path.join(XCODESUPPORTFOLDER, os.path.basename(shadowHeaderPath)))
|
||||
|
||||
if action == "add":
|
||||
if len(files) == 0:
|
||||
update_general_include(project, projectBasePath)
|
||||
fileRef = file_with_path(shadowHeaderPath, projectBasePath, project)
|
||||
|
||||
if not fileRef:
|
||||
update_general_include(project, projectBasePath, shadowGroup)
|
||||
add_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationPath, sourcePath, projectBasePath)
|
||||
|
||||
match = FRAMEWORKS_RE.match(projectSourcePath)
|
||||
@@ -104,10 +132,9 @@ if __name__ == "__main__":
|
||||
if os.path.isdir(resourcesPath):
|
||||
add_framework_resources(project, resourcesPath)
|
||||
|
||||
project.save()
|
||||
convert_unicode_to_xml(pbxPath)
|
||||
save_project(project, pbxPath)
|
||||
|
||||
elif action == "remove" and len(files) == 1:
|
||||
update_general_include(project, projectBasePath)
|
||||
elif action == "remove":
|
||||
update_general_include(project, projectBasePath, shadowGroup)
|
||||
remove_file(project, shadowGroup, sourceGroup, shadowHeaderPath, shadowImplementationPath, sourcePath, projectBasePath)
|
||||
project.save()
|
||||
save_project(project, pbxPath)
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Antoine Mercadal (<primalmotion@archipelproject.org>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#import <Growl/Growl.h>
|
||||
|
||||
enum XCCAPIMode {
|
||||
kXCCAPIModeAuto = 0,
|
||||
kXCCAPIModeFile,
|
||||
kXCCAPIModeFolder
|
||||
};
|
||||
|
||||
extern NSString * const XCCDidPopulateProjectNotification;
|
||||
extern NSString * const XCCConversionDidStartNotification;
|
||||
extern NSString * const XCCConversionDidStopNotification;
|
||||
extern NSString * const XCCListeningDidStartNotification;
|
||||
|
||||
|
||||
@interface TNXcodeCapp : NSObject <NSTableViewDelegate, GrowlApplicationBridgeDelegate>
|
||||
|
||||
@property NSURL* XcodeSupportProjectURL;
|
||||
@property NSString* currentProjectPath;
|
||||
@property NSString* currentAPIMode;
|
||||
@property BOOL supportsFileBasedListening;
|
||||
@property BOOL reactToInodeModification;
|
||||
@property BOOL isListening;
|
||||
@property BOOL supportsFileLevelAPI;
|
||||
@property BOOL isUsingFileLevelAPI;
|
||||
@property BOOL isLoadingProject;
|
||||
@property NSMutableArray* errorList;
|
||||
|
||||
@property (unsafe_unretained) IBOutlet NSTableView *errorTable;
|
||||
@property (strong) IBOutlet NSPanel *errorsPanel;
|
||||
@property (strong) IBOutlet NSArrayController *errorListController;
|
||||
|
||||
- (IBAction)openErrorsPanel:(id)sender;
|
||||
- (IBAction)clearErrors:(id)sender;
|
||||
- (IBAction)openErrorInEditor:(id)sender;
|
||||
- (void)start;
|
||||
- (void)stop;
|
||||
- (void)listenToProjectAtPath:(NSString *)path;
|
||||
- (void)updateLastEventId:(uint64_t)eventId;
|
||||
- (BOOL)pathMatchesIgnoredPaths:(NSString*)aPath;
|
||||
- (BOOL)isObjjFile:(NSString *)path;
|
||||
- (BOOL)isXibFile:(NSString *)path;
|
||||
- (BOOL)isXCCIgnoreFile:(NSString *)path;
|
||||
- (void)tidyShadowedFiles;
|
||||
- (void)handleFileModificationAtPath:(NSString*)path notify:(BOOL)shouldNotify;
|
||||
- (void)handleFileRemovalAtPath:(NSString*)path;
|
||||
- (void)updateUserDefaultsWithLastEventId;
|
||||
|
||||
@end
|
||||
|
||||
@interface TNXcodeCapp (SnowLeopard)
|
||||
|
||||
- (void)updateLastModificationDate:(NSDate *)date forPath:(NSString *)path;
|
||||
- (NSDate *)lastModificationDateForPath:(NSString *)path;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// UserDefaults.h
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Aparajita on 4/9/13.
|
||||
//
|
||||
//
|
||||
|
||||
#ifndef XcodeCapp_UserDefaults_h
|
||||
#define XcodeCapp_UserDefaults_h
|
||||
|
||||
#import <Foundation/NSString.h>
|
||||
|
||||
extern NSString * const kDefaultLastEventId;
|
||||
extern NSString * const kDefaultFirstLaunch;
|
||||
extern NSString * const kDefaultXCCAPIMode;
|
||||
extern NSString * const kDefaultXCCReactMode;
|
||||
extern NSString * const kDefaultXCCReopenLastProject;
|
||||
extern NSString * const kDefaultXCCAutoOpenErrorsPanel;
|
||||
extern NSString * const kDefaultXCCProjectHistory;
|
||||
extern NSString * const kDefaultLastOpenedPath;
|
||||
extern NSString * const kDefaultPathModificationDates;
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,20 @@
|
||||
//
|
||||
// UserDefaults.m
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Aparajita on 4/9/13.
|
||||
//
|
||||
//
|
||||
|
||||
#include "UserDefaults.h"
|
||||
|
||||
|
||||
NSString * const kDefaultLastEventId = @"lastEventId";
|
||||
NSString * const kDefaultFirstLaunch = @"FirstLaunch";
|
||||
NSString * const kDefaultXCCAPIMode = @"XCCAPIMode";
|
||||
NSString * const kDefaultXCCReactMode = @"XCCReactMode";
|
||||
NSString * const kDefaultXCCReopenLastProject = @"XCCReopenLastProject";
|
||||
NSString * const kDefaultXCCAutoOpenErrorsPanel = @"XCCAutoOpenErrorsPanel";
|
||||
NSString * const kDefaultXCCProjectHistory = @"XCCProjectHistory";
|
||||
NSString * const kDefaultLastOpenedPath = @"LastOpenedPath";
|
||||
NSString * const kDefaultPathModificationDates = @"pathModificationDates";
|
||||
@@ -0,0 +1,7 @@
|
||||
//
|
||||
// Prefix header for all source files of the 'XcodeCapp' target in the 'XcodeCapp' project
|
||||
//
|
||||
|
||||
#ifdef __OBJC__
|
||||
#import <Cocoa/Cocoa.h>
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
/* Localized versions of Info.plist keys */
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/*
|
||||
* This file is a part of program XcodeCapp
|
||||
* Copyright (C) 2011 Aparajita Fishman (<aparajita@aparajitaworld.com>)
|
||||
*
|
||||
* 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 3 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, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef xcodecapp_cocoa_macros_h
|
||||
#define xcodecapp_cocoa_macros_h
|
||||
|
||||
#if DEBUG
|
||||
# define DLog(fmt, ...) NSLog((fmt), ##__VA_ARGS__)
|
||||
#else
|
||||
# define DLog(...)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,14 @@
|
||||
//
|
||||
// main.m
|
||||
// XcodeCapp
|
||||
//
|
||||
// Created by Aparajita on 4/18/13.
|
||||
// Copyright (c) 2013 Cappuccino Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
return NSApplicationMain(argc, (const char **)argv);
|
||||
}
|
||||