Permalink
Browse files

Improved `*` consistency and fixed `NSSplitViewDelegate` warning. Als…

…o switched to LLVM 1.7
  • Loading branch information...
soffes committed May 28, 2011
1 parent e45837b commit 1202ea22e6c48f93c98300fe73e5d6214a107acb
View
@@ -51,7 +51,7 @@ @implementation MDMissingDrawer
#pragma mark Class Methods
+ (MDSplitView *)makeSplitViewWithMainView:(NSView*)contentView sideView:(NSView*)sideView {
+ (MDSplitView *)makeSplitViewWithMainView:(NSView *)contentView sideView:(NSView *)sideView {
MDLog();
MDSplitView *splitView = [[MDSplitView alloc] initWithFrame:[contentView frame] mainView:contentView sideView:sideView];
[splitView setVertical:YES];
@@ -63,7 +63,7 @@ + (MDSplitView *)makeSplitViewWithMainView:(NSView*)contentView sideView:(NSView
- (id)initWithPlugInController:(id<TMPlugInController>)aController {
if (self = [super init]) {
MDLog("initializing 'MissingDrawer' plugin");
MDLog(@"initializing 'MissingDrawer' plugin");
[self _injectPluginMethods];
[[[NSApp mainWindow] windowController] MD_splitWindowIfNeeded];
[self _installMenuItems];
@@ -75,30 +75,30 @@ - (id)initWithPlugInController:(id<TMPlugInController>)aController {
#pragma mark Actions
- (void)toggleSplitViewLayout:(id)sender {
MDLog("Toggle Left/Right");
MDLog(@"Toggle Left/Right");
[[NSNotificationCenter defaultCenter] postNotificationName:@"MDToggleSplitViewLayout" object:nil];
}
#pragma mark Private Methods
- (void)_installMenuItems {
NSMenu* viewMenu = [[[NSApp mainMenu] itemWithTitle:@"View"] submenu];
NSMenu *viewMenu = [[[NSApp mainMenu] itemWithTitle:@"View"] submenu];
NSMenuItem* showHideDrawerMenuItem = nil;
NSMenuItem *showHideDrawerMenuItem = nil;
NSInteger drawerMenuItemIndex = 0;
MDSettings* settings = [MDSettings defaultSettings];
MDSettings *settings = [MDSettings defaultSettings];
for (NSMenuItem* menuItem in [viewMenu itemArray]) {
for (NSMenuItem *menuItem in [viewMenu itemArray]) {
if ([[menuItem title] isEqualToString:@"Show/Hide Project Drawer"]) {
showHideDrawerMenuItem = menuItem;
drawerMenuItemIndex = [[viewMenu itemArray] indexOfObject:menuItem];
}
}
NSMenuItem* drawerSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"Project Drawer" action:nil keyEquivalent:@""];
NSMenu* drawerMenu = [[NSMenu alloc] initWithTitle:@"Project Drawer"];
NSMenuItem *drawerSubmenuItem = [[NSMenuItem alloc] initWithTitle:@"Project Drawer" action:nil keyEquivalent:@""];
NSMenu *drawerMenu = [[NSMenu alloc] initWithTitle:@"Project Drawer"];
[drawerSubmenuItem setSubmenu:drawerMenu];
[drawerMenu addItem:settings.toggleSplitViewLayoutMenuItem];
[drawerMenu addItem:settings.focusSideViewMenuItem];
@@ -114,7 +114,7 @@ - (void)_installMenuItems {
- (void)_injectPluginMethods {
MDLog("swapping OakProjectController methods");
MDLog(@"swapping OakProjectController methods");
Class oakProjectController = NSClassFromString(@"OakProjectController");
swapInstanceMethods(oakProjectController, @selector(windowDidLoad), @selector(MD_repl_windowDidLoad));
View
@@ -31,13 +31,13 @@
@implementation MDResizer
- (void) mouseDown:(NSEvent *)theEvent {
MDLog("mouseDown in sliderImage");
MDLog(@"mouseDown in sliderImage");
[[[self superview] superview] mouseDown:theEvent];
}
- (void) mouseDragged:(NSEvent *)theEvent {
MDLog("mouseDragged in sliderImage");
MDLog(@"mouseDragged in sliderImage");
[[[self superview] superview] mouseDragged:theEvent];
}
View
@@ -50,7 +50,7 @@ @implementation MDSettings
@synthesize namedColors = _namedColors;
@synthesize terminalLauncherAppName = _terminalLauncherAppName;
NSColor* NSColorFromRGBString(NSString* colorString) {
NSColor *NSColorFromRGBString(NSString *colorString) {
// TODO: add named colors to dict in bundledDefaults
if([colorString isEqualToString:@"white"]) {
@@ -72,11 +72,11 @@ @implementation MDSettings
alpha:1];
}
NSString* NSColorToRGBString(NSColor* color) {
NSString *NSColorToRGBString(NSColor *color) {
return [NSString stringWithFormat:@"%f;%f;%f", [color redComponent], [color greenComponent], [color blueComponent]];
}
- (id) init {
- (id)init {
if ((self = [super init])) {
// self.sideViewLayout = NSRectFromCGRect(CGRectMake(0, 0, 135, 500)); -> {{0, 0}, {135, 500}}
@@ -85,7 +85,7 @@ - (id) init {
// self.bgColor = [NSColor colorWithCalibratedRed:0.871 green:0.894 blue:0.918 alpha:1.0];
// self.bgColorInactive = [NSColor colorWithDeviceRed:0.929 green:0.929 blue:0.929 alpha:1];
NSUserDefaults* defaults = [NSUserDefaults standardUserDefaults];
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
// initially register defaults from bundled defaultSettings.plist file
NSBundle *pluginBundle = [NSBundle bundleForClass:[self class]];
@@ -73,7 +73,7 @@ - (void)drawRect:(NSRect)rect {
#pragma mark Drawing
- (void)addToSuperview:(NSView*)superview {
NSScrollView* outlineView = nil;
NSScrollView *outlineView = nil;
int i, cnt;
BOOL showSidebarOnLeft = [[MDSettings defaultSettings] showSideViewOnLeft];
@@ -236,7 +236,7 @@ - (void)terminalButtonPressed:(id)sender {
}
for (NSDictionary *item in selectedItems) {
MDLog("[projectFileOutlineView selectedItems]: %@", item);
MDLog(@"[projectFileOutlineView selectedItems]: %@", item);
NSString *path = [item objectForKey:@"sourceDirectory"];
if (!path) {
path = [[item objectForKey:@"filename"] stringByDeletingLastPathComponent];
@@ -255,7 +255,7 @@ - (void)terminalButtonPressed:(id)sender {
return;
}
MDLog("script:\n%@", appleScriptCommand);
MDLog(@"script:\n%@", appleScriptCommand);
NSAppleScript *as = [[NSAppleScript alloc] initWithSource: appleScriptCommand];
[as executeAndReturnError:nil];
[as release];
View
@@ -56,7 +56,7 @@ - (CGFloat) dividerThickness {
- (void) drawDividerInRect:(NSRect)aRect {
[[NSColor colorWithDeviceWhite:.625 alpha:1] setFill];
[[NSColor colorWithDeviceWhite:0.625 alpha:1] setFill];
[NSBezierPath fillRect:aRect];
}
@@ -65,7 +65,11 @@ - (void) drawDividerInRect:(NSRect)aRect {
- (id)initWithFrame:(NSRect)frame mainView:(NSView *)aMainView sideView:(NSView *)aSideView {
if ((self = [super initWithFrame:frame])) {
#if MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_6
[self setDelegate:(id <NSSplitViewDelegate>)self];
#else
[self setDelegate:self];
#endif
_mainView = [aMainView retain];
_sideView = [aSideView retain];
@@ -105,7 +109,7 @@ - (void) focusSideView {
#pragma mark Drawing
- (void)toggleLayout {
MDLog("toggling views");
MDLog(@"toggling views");
NSView *leftView = [[[self subviews] objectAtIndex:0] retain];
[leftView removeFromSuperview];
[self addSubview:leftView];
@@ -121,10 +125,10 @@ - (IBAction)adjustSubviews:(id)sender {
#pragma mark Layout
- (void)windowWillCloseWillCall {
MDLog("windowWillCloseWillCall");
MDLog(@"windowWillCloseWillCall");
[[NSNotificationCenter defaultCenter] removeObserver:self];
if ([self.sideView frame].size.width <= 0) {
MDLog("save only when frame not collapsed");
MDLog(@"save only when frame not collapsed");
NSRect sideViewFrame = [self.sideView frame];
sideViewFrame.size.width = MIN_SIDEVIEW_WIDTH;
[self.sideView setFrame:sideViewFrame];
@@ -34,25 +34,24 @@
@implementation NSWindowController (MDAdditions)
- (void)MD_splitWindowIfNeeded {
NSWindow* window = [(NSWindowController*)self window];
NSWindow *window = [(NSWindowController *)self window];
if (window) {
NSView* contentView = [window contentView];
NSView *contentView = [window contentView];
if (contentView && ![contentView isKindOfClass:[MDSplitView class]]) {
// If a drawer is displayed by TextMate, replace the contentView
// with one that uses the MissingDrawer.
NSDrawer* drawer = [[window drawers] objectAtIndex:0];
if (drawer)
{
NSView* leftView = [[drawer contentView] retain];
NSDrawer *drawer = [[window drawers] objectAtIndex:0];
if (drawer) {
NSView *leftView = [[drawer contentView] retain];
[drawer setContentView:nil];
[window setContentView:nil];
MDSidebarBorderView* borderView = [[MDSidebarBorderView alloc] initWithFrame:[leftView frame]];
MDSidebarBorderView *borderView = [[MDSidebarBorderView alloc] initWithFrame:[leftView frame]];
[borderView addToSuperview:leftView];
MDSplitView* splitView = [MDMissingDrawer makeSplitViewWithMainView:contentView sideView:leftView];
MDLog("replacing current window with split view");
MDSplitView *splitView = [MDMissingDrawer makeSplitViewWithMainView:contentView sideView:leftView];
MDLog(@"replacing current window with split view");
[window setContentView:splitView];
[borderView release];
@@ -65,7 +64,7 @@ - (void)MD_splitWindowIfNeeded {
- (NSOutlineView *)MD_outlineView {
MDSplitView* contentView = (MDSplitView *)[[(NSWindowController *)self window] contentView];
MDSplitView *contentView = (MDSplitView *)[[(NSWindowController *)self window] contentView];
NSScrollView *scrollView = [[contentView.sideView subviews] objectAtIndex:0];
NSClipView *clipView = [[scrollView subviews] objectAtIndex:0];
return [[clipView subviews] lastObject];
@@ -69,23 +69,23 @@ - (void) MD_repl_windowWillClose:(NSNotification*)notification {
- (void) MD_repl_openProjectDrawer:(id)sender {
MDLog();
NSWindow* window = [(NSWindowController*)self window];
NSWindow *window = [(NSWindowController*)self window];
if ([[window contentView] isKindOfClass:[MDSplitView class]]) {
MDLog("panel exists and menu item was clicked");
MDLog(@"panel exists and menu item was clicked");
MDSplitView* contentView = (MDSplitView*)[window contentView];
MDSplitView *contentView = (MDSplitView *)[window contentView];
NSView* sideView = contentView.sideView; //[[contentView subviews]objectAtIndex:0];
NSView *sideView = contentView.sideView; //[[contentView subviews]objectAtIndex:0];
NSRect sideViewFrame = [sideView frame];
if (sideViewFrame.size.width == 0) {
MDLog("show hidden panel");
MDLog(@"show hidden panel");
[contentView restoreLayout];
[contentView adjustSubviews];
} else {
MDLog("hide visible panel");
MDLog(@"hide visible panel");
[contentView saveLayout];
sideViewFrame.size.width = 0;
[sideView setFrame:sideViewFrame];
@@ -100,11 +100,11 @@ - (void) MD_repl_revealInProject:(id)sender {
[self MD_repl_revealInProject:sender];
[self MD_repl_revealInProject:sender]; //TODO: twice?
NSWindow* window= [(NSWindowController*)self window];
NSView* contentView = [window contentView];
NSWindow *window = [(NSWindowController*)self window];
NSView *contentView = [window contentView];
if ([[contentView className] isEqualToString:@"MDSplitView"]) {
NSView* leftView = [[contentView subviews] objectAtIndex:0];
NSView *leftView = [[contentView subviews] objectAtIndex:0];
NSRect leftFrame = [leftView frame];
if (leftFrame.size.width == 0) {
[self MD_repl_openProjectDrawer:sender];
@@ -318,11 +318,13 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Other Sources/MissingDrawer_Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = "ENABLE_DEBUG_MODE=1";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO;
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.5;
PRODUCT_NAME = MissingDrawer;
SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
WRAPPER_EXTENSION = tmplugin;
ZERO_LINK = YES;
};
@@ -338,12 +340,14 @@
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = "Other Sources/MissingDrawer_Prefix.pch";
GCC_PREPROCESSOR_DEFINITIONS = "ENABLE_LOGS=0";
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_TYPECHECK_CALLS_TO_PRINTF = NO;
INFOPLIST_FILE = Resources/Info.plist;
INSTALL_PATH = "$(HOME)/Library/Bundles";
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = NO;
PRODUCT_NAME = MissingDrawer;
SDKROOT = /Developer/SDKs/MacOSX10.5.sdk;
SDKROOT = "$(DEVELOPER_SDK_DIR)/MacOSX10.6.sdk";
WRAPPER_EXTENSION = tmplugin;
};
name = Release;
@@ -27,15 +27,13 @@
//
#define _MDLog(fmt, args...) {\
NSString* __DEBUG_STRING_TO_LOG__ = [[NSString alloc] initWithFormat:@fmt, ##args];\
NSLog(__DEBUG_STRING_TO_LOG__);\
[__DEBUG_STRING_TO_LOG__ release];\
NSLog(fmt, ##args);\
}
#if ENABLE_DEBUG_MODE
#define MDLog(fmt, args...) _MDLog("%s(%i): " fmt, __FUNCTION__, __LINE__, ##args)
#define MDLog(fmt, args...) _MDLog(@"%s(%i): " fmt, __FUNCTION__, __LINE__, ##args)
#else
#define MDLog(fmt, args...)
#endif
#define MDLogError(fmt, args...) _MDLog("%s(%i): " fmt, __FUNCTION__, __LINE__, ##args)
#define MDLogError(fmt, args...) _MDLog(@"%s(%i): " fmt, __FUNCTION__, __LINE__, ##args)

0 comments on commit 1202ea2

Please sign in to comment.