//
//  CodeController.m
//  Flash2
//
//  Created by Nicholas Matsakis on 4/2/08.
//  Copyright 2008 __MyCompanyName__. All rights reserved.
//

#import "CodeController.h"
#import "OxNSArrayController.h"

@implementation CodeController

- initWithManagedObjectContext:(NSManagedObjectContext *)managedObjectContext
                      language:(Language*)language
{
    if ((self = [super initWithWindowNibName:@"Code"])) {
        self.managedObjectContext = managedObjectContext;
        self.language = language;
        self.rootCategory = language.rootCategory;
    }
    return self;
}

@synthesize managedObjectContext = a_managedObjectContext;
@synthesize language = a_language;
@synthesize rootCategory = a_rootCategory;

- (NSArray*) sortByOrder {
    NSSortDescriptor *sort = [[NSSortDescriptor alloc] initWithKey:K_ORDER ascending:YES];
    return [NSArray arrayWithObject:sort];
}

- (IBAction) clearRelationship:(id)sender {
    CategoryMethod *cm = [m_categoryMethods selectedObject];
    cm.definesRelationship = nil;
}

- (NSFont*) codeFont {
    return [NSFont userFixedPitchFontOfSize:12.0];
}

@end
