annotate Mac/PythonLauncher/PreferencesWindowController.m @ 58765:2ba7677bfa95 legacy-trunk

testCopysign was defined twice in test_math; combine the definitions
author Mark Dickinson <dickinsm@gmail.com>
date Sat, 06 Feb 2010 23:11:25 +0000
parents 1cb2ece4b9e1
children 5d41ebc79738
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
1 #import "PreferencesWindowController.h"
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
2
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
3 @implementation PreferencesWindowController
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
4
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
5 + getPreferencesWindow
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
6 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
7 static PreferencesWindowController *_singleton;
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
8
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
9 if (!_singleton)
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
10 _singleton = [[PreferencesWindowController alloc] init];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
11 [_singleton showWindow: _singleton];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
12 return _singleton;
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
13 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
14
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
15 - (id) init
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
16 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
17 self = [self initWithWindowNibName: @"PreferenceWindow"];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
18 return self;
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
19 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
20
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
21 - (void)load_defaults
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
22 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
23 NSString *title = [filetype titleOfSelectedItem];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
24
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
25 settings = [FileSettings getDefaultsForFileType: title];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
26 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
27
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
28 - (void)update_display
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
29 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
30 // [[self window] setTitle: script];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
31
32714
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
32 [interpreter reloadData];
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
33 [interpreter setStringValue: [settings interpreter]];
27913
cdb1abc1b409 Optionally honour #! paths in scripts. Fixes #676358.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26806
diff changeset
34 [honourhashbang setState: [settings honourhashbang]];
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
35 [debug setState: [settings debug]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
36 [verbose setState: [settings verbose]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
37 [inspect setState: [settings inspect]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
38 [optimize setState: [settings optimize]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
39 [nosite setState: [settings nosite]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
40 [tabs setState: [settings tabs]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
41 [others setStringValue: [settings others]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
42 [with_terminal setState: [settings with_terminal]];
29570
1aa9057c38b4 Added a field that allows the user to set sys.argv-style arguments
Jack Jansen <jack.jansen@cwi.nl>
parents: 27913
diff changeset
43 // Not scriptargs, it isn't for preferences
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
44
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
45 [commandline setStringValue: [settings commandLineForScript: @"<your script here>"]];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
46 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
47
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
48 - (void) windowDidLoad
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
49 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
50 [super windowDidLoad];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
51 [self load_defaults];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
52 [self update_display];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
53 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
54
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
55 - (void)update_settings
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
56 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
57 [settings updateFromSource: self];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
58 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
59
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
60 - (IBAction)do_filetype:(id)sender
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
61 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
62 [self load_defaults];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
63 [self update_display];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
64 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
65
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
66 - (IBAction)do_reset:(id)sender
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
67 {
26398
a0d752be5577 Lots of restructuring, mostly suggested by Bill Bumgarner. Main
Jack Jansen <jack.jansen@cwi.nl>
parents: 24426
diff changeset
68 [settings reset];
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
69 [self update_display];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
70 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
71
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
72 - (IBAction)do_apply:(id)sender
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
73 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
74 [self update_settings];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
75 [self update_display];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
76 }
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
77
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
78 // FileSettingsSource protocol
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
79 - (NSString *) interpreter { return [interpreter stringValue];};
27913
cdb1abc1b409 Optionally honour #! paths in scripts. Fixes #676358.
Jack Jansen <jack.jansen@cwi.nl>
parents: 26806
diff changeset
80 - (BOOL) honourhashbang { return [honourhashbang state]; };
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
81 - (BOOL) debug { return [debug state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
82 - (BOOL) verbose { return [verbose state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
83 - (BOOL) inspect { return [inspect state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
84 - (BOOL) optimize { return [optimize state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
85 - (BOOL) nosite { return [nosite state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
86 - (BOOL) tabs { return [tabs state];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
87 - (NSString *) others { return [others stringValue];};
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
88 - (BOOL) with_terminal { return [with_terminal state];};
29570
1aa9057c38b4 Added a field that allows the user to set sys.argv-style arguments
Jack Jansen <jack.jansen@cwi.nl>
parents: 27913
diff changeset
89 - (NSString *) scriptargs { return @"";};
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
90
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
91 // Delegates
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
92 - (void)controlTextDidChange:(NSNotification *)aNotification
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
93 {
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
94 [self update_settings];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
95 [self update_display];
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
96 };
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
97
26806
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
98 // NSComboBoxDataSource protocol
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
99 - (unsigned int)comboBox:(NSComboBox *)aComboBox indexOfItemWithStringValue:(NSString *)aString
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
100 {
32714
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
101 NSArray *interp_list = [settings interpreters];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
102 unsigned int rv = [interp_list indexOfObjectIdenticalTo: aString];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
103 return rv;
26806
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
104 }
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
105
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
106 - (id)comboBox:(NSComboBox *)aComboBox objectValueForItemAtIndex:(int)index
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
107 {
32714
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
108 NSArray *interp_list = [settings interpreters];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
109 id rv = [interp_list objectAtIndex: index];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
110 return rv;
26806
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
111 }
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
112
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
113 - (int)numberOfItemsInComboBox:(NSComboBox *)aComboBox
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
114 {
32714
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
115 NSArray *interp_list = [settings interpreters];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
116 int rv = [interp_list count];
17406543f15b The interpreter popup was never filled with any data, fixed.
Jack Jansen <jack.jansen@cwi.nl>
parents: 29570
diff changeset
117 return rv;
26806
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
118 }
b204b4a72b4e Changed the input field for the interpreter to use (in the preferences
Jack Jansen <jack.jansen@cwi.nl>
parents: 26398
diff changeset
119
24426
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
120
9afac0dd6b6e First stab at the launcher application. This will be run when the user
Jack Jansen <jack.jansen@cwi.nl>
parents:
diff changeset
121 @end