Back to index

python3.2  3.2.2
Public Member Functions | Protected Attributes
MyDocument Class Reference

#import <MyDocument.h>

Inheritance diagram for MyDocument:
Inheritance graph
[legend]
Collaboration diagram for MyDocument:
Collaboration graph
[legend]

List of all members.

Public Member Functions

(IBAction) - do_run:
(IBAction) - do_cancel:
(IBAction) - do_reset:
(IBAction) - do_apply:
(void- controlTextDidChange:
(id) - init [implementation]
(NSString *) - windowNibName [implementation]
(void- close [implementation]
(void- load_defaults [implementation]
(void- update_display [implementation]
(void- update_settings [implementation]
(BOOL- run [implementation]
(void- windowControllerDidLoadNib: [implementation]
(NSData *) - dataRepresentationOfType: [implementation]
(BOOL- readFromFile:ofType: [implementation]
(NSString *) - interpreter
(BOOL- honourhashbang
(BOOL- debug
(BOOL- verbose
(BOOL- inspect
(BOOL- optimize
(BOOL- nosite
(BOOL- tabs
(NSString *) - others
(BOOL- with_terminal
(NSString *) - scriptargs

Protected Attributes

IBOutlet NSTextField * interpreter
IBOutlet NSButton * honourhashbang
IBOutlet NSButton * debug
IBOutlet NSButton * verbose
IBOutlet NSButton * inspect
IBOutlet NSButton * optimize
IBOutlet NSButton * nosite
IBOutlet NSButton * tabs
IBOutlet NSTextField * others
IBOutlet NSButton * with_terminal
IBOutlet NSTextField * scriptargs
IBOutlet NSTextField * commandline
NSString * script
NSString * filetype
FileSettingssettings

Detailed Description

Definition at line 14 of file MyDocument.h.


Member Function Documentation

- (void) close [implementation]

Definition at line 36 of file MyDocument.m.

{
    NSApplication *app = [NSApplication sharedApplication];
    [super close];
    if ([[app delegate] shouldTerminate])
        [app terminate: self];
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) controlTextDidChange: (NSNotification *)  aNotification

Definition at line 169 of file MyDocument.m.

                            :(NSNotification *)aNotification
{
    [self update_settings];
    [self update_display];
};

Here is the call graph for this function:

- (NSData *) dataRepresentationOfType: (NSString *)  aType [implementation]

Definition at line 100 of file MyDocument.m.

                                    :(NSString *)aType
{
    // Insert code here to write your document from the given data.  You can also choose to override -fileWrapperRepresentationOfType: or -writeToFile:ofType: instead.
    return nil;
}
- (BOOL) debug
- (IBAction) do_apply: (id)  sender

Definition at line 149 of file MyDocument.m.

                    :(id)sender
{
    [self update_settings];
    [self update_display];
}

Here is the call graph for this function:

- (IBAction) do_cancel: (id)  sender

Definition at line 137 of file MyDocument.m.

                     :(id)sender
{
    [self close];
}

Here is the call graph for this function:

- (IBAction) do_reset: (id)  sender

Definition at line 143 of file MyDocument.m.

                    :(id)sender
{
    [settings reset];
    [self update_display];
}

Here is the call graph for this function:

- (IBAction) do_run: (id)  sender

Definition at line 129 of file MyDocument.m.

                  :(id)sender
{
    [self update_settings];
    [self update_display];
    if ([self run])
        [self close];
}

Here is the call graph for this function:

- (id) init [implementation]

Definition at line 15 of file MyDocument.m.

{
    self = [super init];
    if (self) {
    
        // Add your subclass-specific initialization here.
        // If an error occurs here, send a [self dealloc] message and return nil.
        script = [@"<no script>.py" retain];
        filetype = [@"Python Script" retain];
        settings = NULL;
    }
    return self;
}
- (NSString *) interpreter
- (void) load_defaults [implementation]

Definition at line 44 of file MyDocument.m.

{
//    if (settings) [settings release];
    settings = [FileSettings newSettingsForFileType: filetype];
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (BOOL) nosite
- (NSString *) others
- (BOOL) readFromFile: (NSString *)  fileName
ofType: (NSString *)  type 
[implementation]

Definition at line 106 of file MyDocument.m.

                    :(NSString *)fileName ofType:(NSString *)type;
{
    // Insert code here to read your document from the given data.  You can also choose to override -loadFileWrapperRepresentation:ofType: or -readFromFile:ofType: instead.
    BOOL show_ui;
    
    // ask the app delegate whether we should show the UI or not. 
    show_ui = [[[NSApplication sharedApplication] delegate] shouldShowUI];
    [script release];
    script = [fileName retain];
    [filetype release];
    filetype = [type retain];
//    if (settings) [settings release];
    settings = [FileSettings newSettingsForFileType: filetype];
    if (show_ui) {
        [self update_display];
        return YES;
    } else {
        [self run];
       [self performSelector:@selector(close) withObject:nil afterDelay:0.0];
        return YES;
    }
}

Here is the call graph for this function:

- (BOOL) run [implementation]

Definition at line 74 of file MyDocument.m.

{
    const char *cmdline;
    int sts;
    
     cmdline = [[settings commandLineForScript: script] cString];
   if ([settings with_terminal]) {
        sts = doscript(cmdline);
    } else {
        sts = system(cmdline);
    }
    if (sts) {
        NSLog(@"Exit status: %d\n", sts);
        return NO;
    }
    return YES;
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (NSString *) scriptargs

Reimplemented in PreferencesWindowController.

- (BOOL) tabs
- (void) update_display [implementation]

Definition at line 50 of file MyDocument.m.

{
//    [[self window] setTitle: script];
    
    [interpreter setStringValue: [settings interpreter]];
    [honourhashbang setState: [settings honourhashbang]];
    [debug setState: [settings debug]];
    [verbose setState: [settings verbose]];
    [inspect setState: [settings inspect]];
    [optimize setState: [settings optimize]];
    [nosite setState: [settings nosite]];
    [tabs setState: [settings tabs]];
    [others setStringValue: [settings others]];
    [scriptargs setStringValue: [settings scriptargs]];
    [with_terminal setState: [settings with_terminal]];
    
    [commandline setStringValue: [settings commandLineForScript: script]];
}

Here is the call graph for this function:

Here is the caller graph for this function:

- (void) update_settings [implementation]

Definition at line 69 of file MyDocument.m.

{
    [settings updateFromSource: self];
}

Here is the call graph for this function:

Here is the caller graph for this function:

Here is the caller graph for this function:

- (void) windowControllerDidLoadNib: (NSWindowController *)  aController [implementation]

Definition at line 92 of file MyDocument.m.

                                  :(NSWindowController *) aController
{
    [super windowControllerDidLoadNib:aController];
    // Add any code here that need to be executed once the windowController has loaded the document's window.
    [self load_defaults];
    [self update_display];
}

Here is the call graph for this function:

- (NSString *) windowNibName [implementation]

Definition at line 29 of file MyDocument.m.

{
    // Override returning the nib file name of the document
    // If you need to use a subclass of NSWindowController or if your document supports multiple NSWindowControllers, you should remove this method and override -makeWindowControllers instead.
    return @"MyDocument";
}

Here is the caller graph for this function:


Member Data Documentation

- (IBOutlet NSTextField*) commandline [protected]

Definition at line 28 of file MyDocument.h.

- (BOOL) debug [protected]

Definition at line 19 of file MyDocument.h.

- (NSString*) filetype [protected]

Definition at line 31 of file MyDocument.h.

- (BOOL) honourhashbang [protected]

Definition at line 18 of file MyDocument.h.

- (BOOL) inspect [protected]

Definition at line 21 of file MyDocument.h.

- (NSString *) interpreter [protected]

Definition at line 17 of file MyDocument.h.

- (BOOL) nosite [protected]

Definition at line 23 of file MyDocument.h.

- (BOOL) optimize [protected]

Definition at line 22 of file MyDocument.h.

- (NSString *) others [protected]

Definition at line 25 of file MyDocument.h.

- (NSString*) script [protected]

Definition at line 30 of file MyDocument.h.

- (NSString *) scriptargs [protected]

Definition at line 27 of file MyDocument.h.

- (FileSettings*) settings [protected]

Definition at line 32 of file MyDocument.h.

- (BOOL) tabs [protected]

Definition at line 24 of file MyDocument.h.

- (BOOL) verbose [protected]

Definition at line 20 of file MyDocument.h.

- (BOOL) with_terminal [protected]

Definition at line 26 of file MyDocument.h.


The documentation for this class was generated from the following files: