Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Squashed commit of the following:

commit 772c503
Author: Brett Terpstra <me@brettterpstra.com>
Date:   Fri May 20 00:20:44 2011 -0500

    Random license update.

commit 3c82201
Author: Brett Terpstra <me@brettterpstra.com>
Date:   Thu May 19 23:30:09 2011 -0500

    Cleaning up some loose ends; removing some now-unnecessary functions.

    Signed-off-by: Brett Terpstra <me@brettterpstra.com>

commit ba60478
Author: Brett Terpstra <me@brettterpstra.com>
Date:   Thu May 19 22:48:33 2011 -0500

    Pretty close to implementing the ODBEditor method for external editing.

Signed-off-by: Brett Terpstra <me@brettterpstra.com>
  • Loading branch information...
commit 60664fa7cb35a7c6806e7883c8b3e759e7a0c5a1 1 parent 8db9db8
@ttscoff authored
Showing with 3,117 additions and 1,314 deletions.
  1. +1 −0  AppController.h
  2. +91 −85 AppController.m
  3. +58 −32 English.lproj/MainMenu.xib
  4. +165 −217 English.lproj/Preferences.xib
  5. +77 −0 ExternalEditorListController.h
  6. +442 −0 ExternalEditorListController.m
  7. +17 −11 GlobalPrefs.h
  8. +45 −60 GlobalPrefs.m
  9. +10 −11 LabelColumnCell.m
  10. +18 −9 LabelsListController.h
  11. +78 −9 LabelsListController.m
  12. +38 −0 Notation.xcodeproj/project.pbxproj
  13. +31 −15 NotationController.m
  14. +21 −16 NoteObject.h
  15. +111 −106 NoteObject.m
  16. +17 −14 NotesTableView.h
  17. +82 −53 NotesTableView.m
  18. +2 −0  ODBEditor/LICENSE.txt
  19. +8 −0 ODBEditor/NSAppleEventDescriptor-Extensions.h
  20. +16 −0 ODBEditor/NSAppleEventDescriptor-Extensions.m
  21. +58 −0 ODBEditor/ODBEditor.h
  22. +398 −0 ODBEditor/ODBEditor.m
  23. +33 −0 ODBEditor/ODBEditorSuite.h
  24. +4 −1 PrefsWindowController.h
  25. +19 −46 PrefsWindowController.m
  26. +2 −0  PreviewController.m
  27. +60 −0 TemporaryFileCachePreparer.h
  28. +278 −0 TemporaryFileCachePreparer.m
  29. +15 −10 UnifiedCell.h
  30. +37 −47 UnifiedCell.m
  31. +134 −1 de.lproj/MainMenu.xib
  32. +161 −189 de.lproj/Preferences.xib
  33. +134 −2 fr.lproj/MainMenu.xib
  34. +161 −189 fr.lproj/Preferences.xib
  35. +134 −2 pt.lproj/MainMenu.xib
  36. +161 −189 pt.lproj/Preferences.xib
View
1  AppController.h
@@ -136,6 +136,7 @@ void outletObjectAwoke(id sender);
- (IBAction)copyNoteLink:(id)sender;
- (IBAction)exportNote:(id)sender;
- (IBAction)revealNote:(id)sender;
+- (IBAction)editNoteExternally:(id)sender;
- (IBAction)printNote:(id)sender;
- (IBAction)tagNote:(id)sender;
- (IBAction)importNotes:(id)sender;
View
176 AppController.m
@@ -28,6 +28,7 @@
#import "NSFileManager_NV.h"
#import "EncodingsManager.h"
#import "ExporterManager.h"
+#import "ExternalEditorListController.h"
#import "NSData_transformations.h"
#import "BufferUtils.h"
#import "LinkingEditor.h"
@@ -342,16 +343,11 @@ - (void)runDelayedUIActionsAfterLaunch {
}
}
// add elasticthreads' menuitems
- NSMenuItem *theMenuItem = [[[NSMenuItem alloc] initWithTitle:@"Open Note in TextEdit"
- action:@selector(openFileInEditor:) keyEquivalent:@"O"] autorelease];
- if ([prefsController textEditor]) {
- [theMenuItem setTitle:[@"Open Note in " stringByAppendingString:[prefsController textEditor]]];
- }
+ NSMenuItem *theMenuItem = [[[NSMenuItem alloc] init] autorelease];
[theMenuItem setTarget:self];
NSMenu *notesMenu = [[[NSApp mainMenu] itemWithTag:NOTES_MENU_ID] submenu];
- [notesMenu insertItem:theMenuItem atIndex:9];
theMenuItem = [theMenuItem copy];
- [statBarMenu insertItem:theMenuItem atIndex:4];
+// [statBarMenu insertItem:theMenuItem atIndex:4];
[theMenuItem release];
//theMenuItem = [[viewMenu itemWithTag:801] copy];
//[statBarMenu insertItem:theMenuItem atIndex:11];
@@ -637,19 +633,12 @@ - (BOOL)validateMenuItem:(NSMenuItem*)menuItem {
} else if (selector == @selector(fixFileEncoding:)) {
return (currentNote != nil && storageFormatOfNote(currentNote) == PlainTextFormat && ![currentNote contentsWere7Bit]);
+ } else if (selector == @selector(editNoteExternally:)) {
+ return (numberSelected > 0) && [[menuItem representedObject] canEditAllNotes:[notationController notesAtIndexes:[notesTableView selectedRowIndexes]]];
}
-
return YES;
}
-/*
- - (void)menuNeedsUpdate:(NSMenu *)menu {
- NSLog(@"mama needs update: %@", [menu title]);
-
- NSArray *selectedNotes = [notationController notesAtIndexes:[notesTableView selectedRowIndexes]];
- [selectedNotes setURLsInNotesForMenu:menu];
- }*/
-
- (void)updateNoteMenus {
NSMenu *notesMenu = [[[NSApp mainMenu] itemWithTag:NOTES_MENU_ID] submenu];
@@ -661,6 +650,7 @@ - (void)updateNoteMenus {
NSLocalizedString(@"Delete", nil), trailingQualifier]];
}
+ [notesMenu setSubmenu:[[ExternalEditorListController sharedInstance] addEditNotesMenu] forItem:[notesMenu itemWithTag:88]];
NSMenu *viewMenu = [[[NSApp mainMenu] itemWithTag:VIEW_MENU_ID] submenu];
menuIndex = [viewMenu indexOfItemWithTarget:notesTableView andAction:@selector(toggleNoteBodyPreviews:)];
@@ -861,6 +851,22 @@ - (IBAction)revealNote:(id)sender {
[[NSWorkspace sharedWorkspace] selectFile:path inFileViewerRootedAtPath:@""];
}
+- (IBAction)editNoteExternally:(id)sender {
+ ExternalEditor *ed = [sender representedObject];
+ if ([ed isKindOfClass:[ExternalEditor class]]) {
+ NSIndexSet *indexes = [notesTableView selectedRowIndexes];
+ if (kCGEventFlagMaskAlternate == (CGEventSourceFlagsState(kCGEventSourceStateCombinedSessionState) & NSDeviceIndependentModifierFlagsMask)) {
+ //allow changing the default editor directly from Notes menu
+ [[ExternalEditorListController sharedInstance] setDefaultEditor:ed];
+ }
+ //force-write any queued changes to disk in case notes are being stored as separate files which might be opened directly by the method below
+ [notationController synchronizeNoteChanges:nil];
+ [[notationController notesAtIndexes:indexes] makeObjectsPerformSelector:@selector(editExternallyUsingEditor:) withObject:ed];
+ } else {
+ NSBeep();
+ }
+}
+
- (IBAction)printNote:(id)sender {
NSIndexSet *indexes = [notesTableView selectedRowIndexes];
@@ -2955,75 +2961,75 @@ - (IBAction)toggleWordCount:(id)sender{
}
- (void)flagsChanged:(NSEvent *)theEvent{
- if (ModFlagger>=0) {
- if (([theEvent keyCode]==58)||([theEvent keyCode]==61)) {
- if (([theEvent modifierFlags]==524576)||([theEvent modifierFlags]==524608)) { //option down
- modifierTimer = [[NSTimer scheduledTimerWithTimeInterval:0.65
- target:self
- selector:@selector(updateModifier:)
- userInfo:@"option"
- repeats:NO] retain];
- }else if ([theEvent modifierFlags]==256) { //option up
-
- if (modifierTimer) {
- if ([modifierTimer isValid]) {
- [modifierTimer invalidate];
- }else {
- [self performSelector:@selector(popWordCount:) withObject:NO afterDelay:0.35];
- }
- modifierTimer = nil;
- [modifierTimer release];
- }
- ModFlagger = 0;
-
- }
- }else if (([theEvent keyCode]==59)||([theEvent keyCode]==62)) {
- if (([theEvent modifierFlags]==262401)||([theEvent modifierFlags]==270592)) { //control down
- modifierTimer = [[NSTimer scheduledTimerWithTimeInterval:0.70
- target:self
- selector:@selector(updateModifier:)
- userInfo:@"control"
- repeats:NO] retain];
-
- }else if ([theEvent modifierFlags]==256) { //control up
-
- if (modifierTimer) {
- if ([modifierTimer isValid]) {
- [modifierTimer invalidate];
- }else {
- [self performSelector:@selector(popPreview:) withObject:NO afterDelay:0.46];
- }
- modifierTimer = nil;
- [modifierTimer release];
- }
- ModFlagger = 0;
- }
- }else if ([theEvent modifierFlags]==256) {
- ModFlagger = 0;
- if (modifierTimer) {
- if ([modifierTimer isValid]) {
- [modifierTimer invalidate];
- }
- modifierTimer = nil;
- [modifierTimer release];
- }
-
- }else {
- ModFlagger = -1;
- if (modifierTimer) {
- if ([modifierTimer isValid]) {
- [modifierTimer invalidate];
- }
- modifierTimer = nil;
- [modifierTimer release];
- }
- NSTimer *disTimer = [NSTimer scheduledTimerWithTimeInterval:0.2f
- target:self
- selector:@selector(disableKeyMasks:)
- userInfo:@"commandorshift"
- repeats:NO];
- }
- }
+// if (ModFlagger>=0) {
+// if (([theEvent keyCode]==58)||([theEvent keyCode]==61)) {
+// if (([theEvent modifierFlags]==524576)||([theEvent modifierFlags]==524608)) { //option down
+// modifierTimer = [[NSTimer scheduledTimerWithTimeInterval:0.65
+// target:self
+// selector:@selector(updateModifier:)
+// userInfo:@"option"
+// repeats:NO] retain];
+// }else if ([theEvent modifierFlags]==256) { //option up
+//
+// if (modifierTimer) {
+// if ([modifierTimer isValid]) {
+// [modifierTimer invalidate];
+// }else {
+// [self performSelector:@selector(popWordCount:) withObject:NO afterDelay:0.35];
+// }
+// modifierTimer = nil;
+// [modifierTimer release];
+// }
+// ModFlagger = 0;
+//
+// }
+// }else if (([theEvent keyCode]==59)||([theEvent keyCode]==62)) {
+// if (([theEvent modifierFlags]==262401)||([theEvent modifierFlags]==270592)) { //control down
+// modifierTimer = [[NSTimer scheduledTimerWithTimeInterval:0.70
+// target:self
+// selector:@selector(updateModifier:)
+// userInfo:@"control"
+// repeats:NO] retain];
+//
+// }else if ([theEvent modifierFlags]==256) { //control up
+//
+// if (modifierTimer) {
+// if ([modifierTimer isValid]) {
+// [modifierTimer invalidate];
+// }else {
+// [self performSelector:@selector(popPreview:) withObject:NO afterDelay:0.46];
+// }
+// modifierTimer = nil;
+// [modifierTimer release];
+// }
+// ModFlagger = 0;
+// }
+// }else if ([theEvent modifierFlags]==256) {
+// ModFlagger = 0;
+// if (modifierTimer) {
+// if ([modifierTimer isValid]) {
+// [modifierTimer invalidate];
+// }
+// modifierTimer = nil;
+// [modifierTimer release];
+// }
+//
+// }else {
+// ModFlagger = -1;
+// if (modifierTimer) {
+// if ([modifierTimer isValid]) {
+// [modifierTimer invalidate];
+// }
+// modifierTimer = nil;
+// [modifierTimer release];
+// }
+// NSTimer *disTimer = [NSTimer scheduledTimerWithTimeInterval:0.2f
+// target:self
+// selector:@selector(disableKeyMasks:)
+// userInfo:@"commandorshift"
+// repeats:NO];
+// }
+// }
}
- (void)updateModifier:(NSTimer*)theTimer{
View
90 English.lproj/MainMenu.xib
@@ -342,6 +342,15 @@
<reference key="NSOnImage" ref="838981797"/>
<reference key="NSMixedImage" ref="795901623"/>
</object>
+ <object class="NSMenuItem" id="778642567">
+ <reference key="NSMenu" ref="611381463"/>
+ <string key="NSTitle">Edit With</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="838981797"/>
+ <reference key="NSMixedImage" ref="795901623"/>
+ <int key="NSTag">88</int>
+ </object>
<object class="NSMenuItem" id="146877096">
<reference key="NSMenu" ref="611381463"/>
<bool key="NSIsDisabled">YES</bool>
@@ -1516,7 +1525,7 @@
</object>
<string key="NSWindowContentMinSize">{213, 107}</string>
<object class="NSView" key="NSWindowView" id="514982605">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1525,6 +1534,7 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{240, 12}, {99, 32}}</string>
<reference key="NSSuperview" ref="514982605"/>
+ <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="529370907">
<int key="NSCellFlags">67239424</int>
@@ -1570,6 +1580,7 @@
</object>
</object>
<string key="NSFrame">{{7, 11}, {353, 106}}</string>
+ <reference key="NSSuperview"/>
<reference key="NSNextKeyView" ref="801718804"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1920, 1058}}</string>
@@ -1897,16 +1908,18 @@
</object>
</object>
<object class="NSCustomView" id="697106815">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">268</int>
<string key="NSFrameSize">{163, 96}</string>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView"/>
<string key="NSClassName">StatusItemView</string>
</object>
<object class="NSUserDefaultsController" id="713534407">
<bool key="NSSharedInstance">YES</bool>
</object>
<object class="NSScrollView" id="26511639">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1918,32 +1931,9 @@
<object class="NSTextView" id="633888970">
<reference key="NSNextResponder" ref="572834572"/>
<int key="NSvFlags">2322</int>
- <object class="NSMutableSet" key="NSDragTypes">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSArray" key="set.sortedObjects">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <string>Apple HTML pasteboard type</string>
- <string>Apple PDF pasteboard type</string>
- <string>Apple PICT pasteboard type</string>
- <string>Apple PNG pasteboard type</string>
- <string>Apple URL pasteboard type</string>
- <string>CorePasteboardFlavorType 0x6D6F6F76</string>
- <string>NSColor pasteboard type</string>
- <string>NSFilenamesPboardType</string>
- <string>NSStringPboardType</string>
- <string>NeXT Encapsulated PostScript v1.2 pasteboard type</string>
- <string>NeXT RTFD pasteboard type</string>
- <string>NeXT Rich Text Format v1.0 pasteboard type</string>
- <string>NeXT TIFF v4.0 pasteboard type</string>
- <string>NeXT font pasteboard type</string>
- <string>NeXT ruler pasteboard type</string>
- <string>WebURLsWithTitlesPboardType</string>
- <string>public.url</string>
- </object>
- </object>
<string key="NSFrameSize">{399, 14}</string>
<reference key="NSSuperview" ref="572834572"/>
- <reference key="NSNextKeyView" ref="965568530"/>
+ <reference key="NSNextKeyView" ref="540470833"/>
<object class="NSTextContainer" key="NSTextContainer" id="721568932">
<object class="NSLayoutManager" key="NSLayoutManager">
<object class="NSTextStorage" key="NSTextStorage">
@@ -2034,6 +2024,7 @@
<int key="NSvFlags">-2147479296</int>
<string key="NSFrame">{{384, 0}, {15, 304}}</string>
<reference key="NSSuperview" ref="26511639"/>
+ <reference key="NSNextKeyView"/>
<int key="NSArrowsLoc">2</int>
<reference key="NSTarget" ref="26511639"/>
<string key="NSAction">_doScroller:</string>
@@ -2054,14 +2045,15 @@
</object>
</object>
<string key="NSFrameSize">{399, 304}</string>
- <reference key="NSNextKeyView" ref="572834572"/>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="965568530"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="540470833"/>
<reference key="NSHScroller" ref="965568530"/>
<reference key="NSContentView" ref="572834572"/>
</object>
<object class="NSScrollView" id="1012988132">
- <nil key="NSNextResponder"/>
+ <reference key="NSNextResponder"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -2075,7 +2067,7 @@
<int key="NSvFlags">4352</int>
<string key="NSFrameSize">{399, 136}</string>
<reference key="NSSuperview" ref="313519754"/>
- <reference key="NSNextKeyView" ref="902416422"/>
+ <reference key="NSNextKeyView" ref="64005823"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTableHeaderView" key="NSHeaderView" id="379318512">
<reference key="NSNextResponder" ref="643799251"/>
@@ -2134,6 +2126,7 @@
<int key="NSvFlags">-2147483392</int>
<string key="NSFrame">{{383, 17}, {15, 135}}</string>
<reference key="NSSuperview" ref="1012988132"/>
+ <reference key="NSNextKeyView"/>
<int key="NSArrowsLoc">2</int>
<reference key="NSTarget" ref="1012988132"/>
<string key="NSAction">_doScroller:</string>
@@ -2168,7 +2161,8 @@
<reference ref="952725328"/>
</object>
<string key="NSFrameSize">{399, 153}</string>
- <reference key="NSNextKeyView" ref="313519754"/>
+ <reference key="NSSuperview"/>
+ <reference key="NSNextKeyView" ref="902416422"/>
<int key="NSsFlags">528</int>
<reference key="NSVScroller" ref="64005823"/>
<reference key="NSHScroller" ref="902416422"/>
@@ -3454,6 +3448,7 @@
<reference ref="991469842"/>
<reference ref="363678532"/>
<reference ref="856091411"/>
+ <reference ref="778642567"/>
</object>
<reference key="parent" ref="524646565"/>
</object>
@@ -4542,6 +4537,14 @@
<reference key="object" ref="368268865"/>
<reference key="parent" ref="404670816"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">1298</int>
+ <reference key="object" ref="778642567"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ </object>
+ <reference key="parent" ref="611381463"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -4728,6 +4731,7 @@
<string>129.ImportedFromIB2</string>
<string>1292.IBPluginDependency</string>
<string>1293.IBPluginDependency</string>
+ <string>1298.IBPluginDependency</string>
<string>130.IBPluginDependency</string>
<string>130.ImportedFromIB2</string>
<string>131.IBPluginDependency</string>
@@ -5115,6 +5119,7 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
@@ -5325,7 +5330,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">1297</int>
+ <int key="maxID">1300</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -5340,9 +5345,11 @@
<string>bringFocusToControlField:</string>
<string>copyNoteLink:</string>
<string>deleteNote:</string>
+ <string>editNoteExternally:</string>
<string>exportNote:</string>
<string>fieldAction:</string>
<string>importNotes:</string>
+ <string>lockPreview:</string>
<string>multiTag:</string>
<string>openFileInEditor:</string>
<string>printNote:</string>
@@ -5398,6 +5405,8 @@
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@@ -5407,9 +5416,11 @@
<string>bringFocusToControlField:</string>
<string>copyNoteLink:</string>
<string>deleteNote:</string>
+ <string>editNoteExternally:</string>
<string>exportNote:</string>
<string>fieldAction:</string>
<string>importNotes:</string>
+ <string>lockPreview:</string>
<string>multiTag:</string>
<string>openFileInEditor:</string>
<string>printNote:</string>
@@ -5449,6 +5460,10 @@
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">editNoteExternally:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">exportNote:</string>
<string key="candidateClassName">id</string>
</object>
@@ -5461,6 +5476,10 @@
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">lockPreview:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">multiTag:</string>
<string key="candidateClassName">id</string>
</object>
@@ -5560,6 +5579,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>editorStatusView</string>
<string>field</string>
+ <string>lockNoteItem</string>
<string>mainView</string>
<string>multiMarkdownPreview</string>
<string>notesScrollView</string>
@@ -5581,6 +5601,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>EmptyView</string>
<string>DualField</string>
+ <string>NSMenuItem</string>
<string>ETContentView</string>
<string>NSMenuItem</string>
<string>AugmentedScrollView</string>
@@ -5605,6 +5626,7 @@
<bool key="EncodedWithXMLCoder">YES</bool>
<string>editorStatusView</string>
<string>field</string>
+ <string>lockNoteItem</string>
<string>mainView</string>
<string>multiMarkdownPreview</string>
<string>notesScrollView</string>
@@ -5633,6 +5655,10 @@
<string key="candidateClassName">DualField</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">lockNoteItem</string>
+ <string key="candidateClassName">NSMenuItem</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">mainView</string>
<string key="candidateClassName">ETContentView</string>
</object>
View
382 English.lproj/Preferences.xib
@@ -12,26 +12,24 @@
</object>
<object class="NSArray" key="IBDocument.IntegratedClassDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
- <string>NSColorWell</string>
- <string>NSMenu</string>
- <string>NSSliderCell</string>
+ <string>NSUserDefaultsController</string>
+ <string>NSPopUpButton</string>
<string>NSButton</string>
- <string>NSCustomObject</string>
- <string>NSSlider</string>
- <string>NSCustomView</string>
- <string>NSComboBox</string>
- <string>NSComboBoxCell</string>
- <string>NSTextField</string>
- <string>NSWindowTemplate</string>
+ <string>NSMenu</string>
<string>NSTextFieldCell</string>
<string>NSButtonCell</string>
+ <string>NSMenuItem</string>
<string>NSBox</string>
+ <string>NSColorWell</string>
+ <string>NSMatrix</string>
+ <string>NSSlider</string>
+ <string>NSSliderCell</string>
+ <string>NSCustomView</string>
+ <string>NSCustomObject</string>
<string>NSView</string>
+ <string>NSWindowTemplate</string>
+ <string>NSTextField</string>
<string>NSPopUpButtonCell</string>
- <string>NSUserDefaultsController</string>
- <string>NSPopUpButton</string>
- <string>NSMenuItem</string>
- <string>NSMatrix</string>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -78,7 +76,7 @@
<string key="NSMaxSize">{1e+13, 1e+13}</string>
</object>
<object class="NSCustomView" id="100704436">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -87,7 +85,6 @@
<int key="NSvFlags">12</int>
<string key="NSFrame">{{0, 39}, {368, 5}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="280907432"/>
<string key="NSOffsets">{0, 0}</string>
<object class="NSTextFieldCell" key="NSTitleCell">
@@ -123,8 +120,6 @@
<int key="NSvFlags">268</int>
<string key="NSFrame">{{160, 15}, {192, 14}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="24271187">
<int key="NSCellFlags">68288064</int>
@@ -140,7 +135,7 @@
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
- <object class="NSColor" key="NSColor" id="132395203">
+ <object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
@@ -161,7 +156,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{34, 9}, {121, 25}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="480533249"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="215970085">
@@ -186,7 +180,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{32, 48}, {269, 18}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="832099316"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="234587349">
@@ -215,7 +208,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{68, 239}, {101, 17}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="322900519"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="598445152">
@@ -233,7 +225,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{171, 233}, {95, 26}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="219220134"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="933745253">
@@ -326,7 +317,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{32, 97}, {242, 18}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="544789630"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="903663296">
@@ -350,7 +340,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{32, 72}, {223, 18}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="214966460"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="496193447">
@@ -374,7 +363,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{32, 160}, {286, 18}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="910223464"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="1005942939">
@@ -398,7 +386,6 @@
<int key="NSvFlags">-2147483384</int>
<string key="NSFrame">{{271, 237}, {61, 22}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="611244316"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1063105384">
@@ -423,7 +410,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{8, 195}, {161, 20}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="111263789"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="141230478">
@@ -441,7 +427,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{174, 196}, {89, 22}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="199418142"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1011807716">
@@ -461,7 +446,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{265, 188}, {73, 32}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1035229297"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="100529637">
@@ -486,7 +470,6 @@
<int key="NSvFlags">264</int>
<string key="NSFrame">{{49, 121}, {286, 33}}</string>
<reference key="NSSuperview" ref="100704436"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="438472363"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="11227258">
@@ -505,14 +488,12 @@
</object>
</object>
<string key="NSFrameSize">{368, 277}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="672108815"/>
<string key="NSClassName">NSView</string>
<string key="NSExtension">NSResponder</string>
</object>
<object class="NSCustomView" id="476135578">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -521,7 +502,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{17, 368}, {154, 17}}</string>
<reference key="NSSuperview" ref="476135578"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="584055073"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="71700142">
@@ -539,7 +519,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrame">{{173, 362}, {178, 26}}</string>
<reference key="NSSuperview" ref="476135578"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="688377042"/>
<bool key="NSEnabled">YES</bool>
<object class="NSPopUpButtonCell" key="NSCell" id="407500784">
@@ -609,8 +588,6 @@
<int key="NSvFlags">256</int>
<string key="NSFrameSize">{368, 346}</string>
<reference key="NSSuperview" ref="476135578"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<object class="NSMutableString" key="NSClassName">
<characters key="NS.bytes">NSView</characters>
</object>
@@ -618,8 +595,6 @@
</object>
</object>
<string key="NSFrameSize">{368, 406}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1008640992"/>
<object class="NSMutableString" key="NSClassName">
<characters key="NS.bytes">NSView</characters>
@@ -631,6 +606,74 @@
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
+ <object class="NSPopUpButton" id="285458724">
+ <reference key="NSNextResponder" ref="718780854"/>
+ <int key="NSvFlags">268</int>
+ <string key="NSFrame">{{153, 15}, {194, 26}}</string>
+ <reference key="NSSuperview" ref="718780854"/>
+ <reference key="NSWindow"/>
+ <reference key="NSNextKeyView"/>
+ <bool key="NSEnabled">YES</bool>
+ <object class="NSPopUpButtonCell" key="NSCell" id="446692414">
+ <int key="NSCellFlags">-2076049856</int>
+ <int key="NSCellFlags2">2048</int>
+ <reference key="NSSupport" ref="1025468811"/>
+ <reference key="NSControlView" ref="285458724"/>
+ <int key="NSButtonFlags">109199615</int>
+ <int key="NSButtonFlags2">129</int>
+ <string key="NSAlternateContents"/>
+ <string key="NSKeyEquivalent"/>
+ <int key="NSPeriodicDelay">400</int>
+ <int key="NSPeriodicInterval">75</int>
+ <object class="NSMenuItem" key="NSMenuItem" id="797422718">
+ <reference key="NSMenu" ref="662703423"/>
+ <string key="NSTitle">Item 1</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <int key="NSState">1</int>
+ <reference key="NSOnImage" ref="419608986"/>
+ <reference key="NSMixedImage" ref="48108379"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="446692414"/>
+ </object>
+ <bool key="NSMenuItemRespectAlignment">YES</bool>
+ <object class="NSMenu" key="NSMenu" id="662703423">
+ <string key="NSTitle">OtherViews</string>
+ <object class="NSMutableArray" key="NSMenuItems">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="797422718"/>
+ <object class="NSMenuItem" id="640105610">
+ <reference key="NSMenu" ref="662703423"/>
+ <string key="NSTitle">Item 2</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="419608986"/>
+ <reference key="NSMixedImage" ref="48108379"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="446692414"/>
+ </object>
+ <object class="NSMenuItem" id="328341973">
+ <reference key="NSMenu" ref="662703423"/>
+ <string key="NSTitle">Item 3</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSKeyEquivModMask">1048576</int>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <reference key="NSOnImage" ref="419608986"/>
+ <reference key="NSMixedImage" ref="48108379"/>
+ <string key="NSAction">_popUpItemAction:</string>
+ <reference key="NSTarget" ref="446692414"/>
+ </object>
+ </object>
+ <reference key="NSMenuFont" ref="1025468811"/>
+ </object>
+ <int key="NSPreferredEdge">1</int>
+ <bool key="NSUsesItemFromMenu">YES</bool>
+ <bool key="NSAltersState">YES</bool>
+ <int key="NSArrowPosition">2</int>
+ </object>
+ </object>
<object class="NSTextField" id="1029052702">
<reference key="NSNextResponder" ref="718780854"/>
<int key="NSvFlags">264</int>
@@ -655,7 +698,7 @@
<string key="NSFrame">{{17, 22}, {134, 17}}</string>
<reference key="NSSuperview" ref="718780854"/>
<reference key="NSWindow"/>
- <reference key="NSNextKeyView" ref="320247454"/>
+ <reference key="NSNextKeyView" ref="285458724"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="160647788">
<int key="NSCellFlags">67239424</int>
@@ -671,100 +714,6 @@
<reference key="NSTextColor" ref="914546308"/>
</object>
</object>
- <object class="NSComboBox" id="320247454">
- <reference key="NSNextResponder" ref="718780854"/>
- <int key="NSvFlags">268</int>
- <string key="NSFrame">{{166, 16}, {178, 26}}</string>
- <reference key="NSSuperview" ref="718780854"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSComboBoxCell" key="NSCell" id="626709383">
- <int key="NSCellFlags">74579521</int>
- <int key="NSCellFlags2">272630784</int>
- <string key="NSContents"/>
- <reference key="NSSupport" ref="1025468811"/>
- <reference key="NSControlView" ref="320247454"/>
- <bool key="NSDrawsBackground">YES</bool>
- <reference key="NSBackgroundColor" ref="1065250142"/>
- <reference key="NSTextColor" ref="914546308"/>
- <int key="NSVisibleItemCount">5</int>
- <bool key="NSHasVerticalScroller">YES</bool>
- <reference key="NSDelegate" ref="320247454"/>
- <object class="NSComboTableView" key="NSTableView" id="159071582">
- <reference key="NSNextResponder"/>
- <int key="NSvFlags">274</int>
- <string key="NSFrameSize">{15, 0}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
- <bool key="NSEnabled">YES</bool>
- <object class="NSMutableArray" key="NSTableColumns">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <object class="NSTableColumn">
- <integer value="0" key="NSIdentifier"/>
- <double key="NSWidth">12</double>
- <double key="NSMinWidth">10</double>
- <double key="NSMaxWidth">1000</double>
- <object class="NSTableHeaderCell" key="NSHeaderCell">
- <int key="NSCellFlags">75628032</int>
- <int key="NSCellFlags2">0</int>
- <string key="NSContents"/>
- <object class="NSFont" key="NSSupport">
- <string key="NSName">LucidaGrande</string>
- <double key="NSSize">12</double>
- <int key="NSfFlags">16</int>
- </object>
- <object class="NSColor" key="NSBackgroundColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC4zMzMzMzI5ODU2AA</bytes>
- </object>
- <reference key="NSTextColor" ref="387543538"/>
- </object>
- <object class="NSTextFieldCell" key="NSDataCell">
- <int key="NSCellFlags">338820672</int>
- <int key="NSCellFlags2">1024</int>
- <reference key="NSSupport" ref="1025468811"/>
- <reference key="NSControlView" ref="159071582"/>
- <bool key="NSDrawsBackground">YES</bool>
- <object class="NSColor" key="NSBackgroundColor" id="676502428">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">controlBackgroundColor</string>
- <reference key="NSColor" ref="132395203"/>
- </object>
- <reference key="NSTextColor" ref="914546308"/>
- </object>
- <int key="NSResizingMask">3</int>
- <bool key="NSIsResizeable">YES</bool>
- <reference key="NSTableView" ref="159071582"/>
- </object>
- </object>
- <double key="NSIntercellSpacingWidth">3</double>
- <double key="NSIntercellSpacingHeight">2</double>
- <reference key="NSBackgroundColor" ref="676502428"/>
- <object class="NSColor" key="NSGridColor">
- <int key="NSColorSpace">6</int>
- <string key="NSCatalogName">System</string>
- <string key="NSColorName">gridColor</string>
- <object class="NSColor" key="NSColor">
- <int key="NSColorSpace">3</int>
- <bytes key="NSWhite">MC41AA</bytes>
- </object>
- </object>
- <double key="NSRowHeight">19</double>
- <string key="NSAction">tableViewAction:</string>
- <int key="NSTvFlags">-767524864</int>
- <reference key="NSDelegate" ref="626709383"/>
- <reference key="NSDataSource" ref="626709383"/>
- <reference key="NSTarget" ref="626709383"/>
- <int key="NSColumnAutoresizingStyle">1</int>
- <int key="NSDraggingSourceMaskForLocal">15</int>
- <int key="NSDraggingSourceMaskForNonLocal">0</int>
- <bool key="NSAllowsTypeSelect">YES</bool>
- <int key="NSTableViewDraggingDestinationStyle">0</int>
- </object>
- </object>
- </object>
<object class="NSMatrix" id="1041678375">
<reference key="NSNextResponder" ref="718780854"/>
<int key="NSvFlags">264</int>
@@ -1259,7 +1208,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string key="NSExtension">NSResponder</string>
</object>
<object class="NSCustomView" id="113051861">
- <reference key="NSNextResponder"/>
+ <nil key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
@@ -1268,7 +1217,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{92, 78}, {172, 18}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1065364316"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="240461858">
@@ -1292,7 +1240,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{95, 98}, {169, 18}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="35055039"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="805277808">
@@ -1316,8 +1263,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{346, 22}, {38, 13}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
- <reference key="NSNextKeyView"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="701250644">
<int key="NSCellFlags">67239424</int>
@@ -1334,7 +1279,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{317, 22}, {36, 13}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="308093778"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="338470066">
@@ -1352,7 +1296,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{50, 20}, {149, 17}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="362040419"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="654990342">
@@ -1370,7 +1313,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{200, 20}, {113, 15}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="12489117"/>
<bool key="NSEnabled">YES</bool>
<object class="NSSliderCell" key="NSCell" id="146573636">
@@ -1393,7 +1335,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{50, 45}, {212, 17}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="191747856"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="23747647">
@@ -1411,7 +1352,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{259, 43}, {22, 18}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="61723147"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="718377012">
@@ -1434,7 +1374,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{35, 130}, {326, 14}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="62508865"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="106052185">
@@ -1452,7 +1391,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">268</int>
<string key="NSFrame">{{115, 229}, {130, 18}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="1054467971"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="82739852">
@@ -1476,7 +1414,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{35, 275}, {76, 20}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="126674627"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="294412381">
@@ -1494,7 +1431,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{315, 268}, {72, 32}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="636447885"/>
<bool key="NSEnabled">YES</bool>
<object class="NSButtonCell" key="NSCell" id="826576078">
@@ -1519,7 +1455,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">266</int>
<string key="NSFrame">{{116, 275}, {197, 23}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="134866422"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="73989760">
@@ -1544,7 +1479,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{151, 156}, {94, 17}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="832564280"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="128876516">
@@ -1571,7 +1505,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
<string key="NSFrame">{{251, 152}, {52, 24}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="25363412"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSIsBordered">YES</bool>
@@ -1582,7 +1515,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="NSvFlags">264</int>
<string key="NSFrame">{{122, 188}, {123, 17}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="401313623"/>
<bool key="NSEnabled">YES</bool>
<object class="NSTextFieldCell" key="NSCell" id="1023010529">
@@ -1609,7 +1541,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
<string key="NSFrame">{{251, 184}, {52, 24}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="325769847"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSIsBordered">YES</bool>
@@ -1629,7 +1560,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
<string key="NSFrame">{{251, 226}, {52, 24}}</string>
<reference key="NSSuperview" ref="113051861"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="605940815"/>
<bool key="NSEnabled">YES</bool>
<bool key="NSIsBordered">YES</bool>
@@ -1640,8 +1570,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
</object>
<string key="NSFrameSize">{420, 319}</string>
- <reference key="NSSuperview"/>
- <reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="887798228"/>
<string key="NSClassName">NSView</string>
<string key="NSExtension">NSResponder</string>
@@ -2030,22 +1958,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<int key="connectionID">451</int>
</object>
<object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">appList</string>
- <reference key="source" ref="689725671"/>
- <reference key="destination" ref="320247454"/>
- </object>
- <int key="connectionID">462</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBOutletConnection" key="connection">
- <string key="label">delegate</string>
- <reference key="source" ref="320247454"/>
- <reference key="destination" ref="689725671"/>
- </object>
- <int key="connectionID">464</int>
- </object>
- <object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">toggleKeepsTextWidthInWindow:</string>
<reference key="source" ref="689725671"/>
@@ -2072,26 +1984,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<object class="IBConnectionRecord">
<object class="IBBindingConnection" key="connection">
<string key="label">hidden: values.TextEditor</string>
- <reference key="source" ref="320247454"/>
- <reference key="destination" ref="546969263"/>
- <object class="NSNibBindingConnector" key="connector">
- <reference key="NSSource" ref="320247454"/>
- <reference key="NSDestination" ref="546969263"/>
- <string key="NSLabel">hidden: values.TextEditor</string>
- <string key="NSBinding">hidden</string>
- <string key="NSKeyPath">values.TextEditor</string>
- <object class="NSDictionary" key="NSOptions">
- <string key="NS.key.0">NSValueTransformerName</string>
- <string key="NS.object.0">NSIsNil</string>
- </object>
- <int key="NSNibBindingConnectorVersion">2</int>
- </object>
- </object>
- <int key="connectionID">500</int>
- </object>
- <object class="IBConnectionRecord">
- <object class="IBBindingConnection" key="connection">
- <string key="label">hidden: values.TextEditor</string>
<reference key="source" ref="996712024"/>
<reference key="destination" ref="546969263"/>
<object class="NSNibBindingConnector" key="connector">
@@ -2317,6 +2209,22 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
<int key="connectionID">560</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">externalEditorMenuButton</string>
+ <reference key="source" ref="689725671"/>
+ <reference key="destination" ref="285458724"/>
+ </object>
+ <int key="connectionID">567</int>
+ </object>
+ <object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">changedExternalEditorsMenu:</string>
+ <reference key="source" ref="689725671"/>
+ <reference key="destination" ref="285458724"/>
+ </object>
+ <int key="connectionID">568</int>
+ </object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
@@ -2530,10 +2438,10 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<reference ref="848921188"/>
<reference ref="1029052702"/>
<reference ref="607793662"/>
- <reference ref="320247454"/>
<reference ref="996712024"/>
<reference ref="637771913"/>
<reference ref="1000773588"/>
+ <reference ref="285458724"/>
</object>
<reference key="parent" ref="237022847"/>
<string key="objectName">editing view</string>
@@ -2952,20 +2860,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<reference key="parent" ref="237022847"/>
</object>
<object class="IBObjectRecord">
- <int key="objectID">452</int>
- <reference key="object" ref="320247454"/>
- <object class="NSMutableArray" key="children">
- <bool key="EncodedWithXMLCoder">YES</bool>
- <reference ref="626709383"/>
- </object>
- <reference key="parent" ref="718780854"/>
- </object>
- <object class="IBObjectRecord">
- <int key="objectID">453</int>
- <reference key="object" ref="626709383"/>
- <reference key="parent" ref="320247454"/>
- </object>
- <object class="IBObjectRecord">
<int key="objectID">454</int>
<reference key="object" ref="996712024"/>
<object class="NSMutableArray" key="children">
@@ -3246,6 +3140,50 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<reference key="object" ref="240461858"/>
<reference key="parent" ref="35055039"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">561</int>
+ <reference key="object" ref="285458724"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="446692414"/>
+ </object>
+ <reference key="parent" ref="718780854"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">562</int>
+ <reference key="object" ref="446692414"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="662703423"/>
+ </object>
+ <reference key="parent" ref="285458724"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">563</int>
+ <reference key="object" ref="662703423"/>
+ <object class="NSMutableArray" key="children">
+ <bool key="EncodedWithXMLCoder">YES</bool>
+ <reference ref="797422718"/>
+ <reference ref="640105610"/>
+ <reference ref="328341973"/>
+ </object>
+ <reference key="parent" ref="446692414"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">564</int>
+ <reference key="object" ref="797422718"/>
+ <reference key="parent" ref="662703423"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">565</int>
+ <reference key="object" ref="640105610"/>
+ <reference key="parent" ref="662703423"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">566</int>
+ <reference key="object" ref="328341973"/>
+ <reference key="parent" ref="662703423"/>
+ </object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
@@ -3440,9 +3378,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>441.IBViewBoundsToFrameTransform</string>
<string>442.IBPluginDependency</string>
<string>443.IBPluginDependency</string>
- <string>452.IBPluginDependency</string>
- <string>452.IBViewBoundsToFrameTransform</string>
- <string>453.IBPluginDependency</string>
<string>454.IBPluginDependency</string>
<string>454.IBViewBoundsToFrameTransform</string>
<string>455.IBPluginDependency</string>
@@ -3499,6 +3434,8 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>552.IBPluginDependency</string>
<string>552.IBViewBoundsToFrameTransform</string>
<string>553.IBPluginDependency</string>
+ <string>561.IBPluginDependency</string>
+ <string>562.IBPluginDependency</string>
<string>6.IBPluginDependency</string>
<string>6.ImportedFromIB2</string>
</object>
@@ -3740,11 +3677,6 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<object class="NSAffineTransform">
- <bytes key="NSTransformStruct">P4AAAL+AAABDKQAAwhQAAA</bytes>
- </object>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
- <object class="NSAffineTransform">
<bytes key="NSTransformStruct">P4AAAL+AAABBoAAAwggAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
@@ -3824,6 +3756,8 @@ SW5jLiwgMjAwNQAAAAA</bytes>
</object>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
</object>
</object>
@@ -3839,7 +3773,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<reference key="dict.values" ref="237022847"/>
</object>
<nil key="sourceID"/>
- <int key="maxID">560</int>
+ <int key="maxID">568</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -4218,6 +4152,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>changedAltRows:</string>
<string>changedAutoSuggestLinks:</string>
<string>changedBackgroundTextColorWell:</string>
+ <string>changedExternalEditorsMenu:</string>
<string>changedForegroundTextColorWell:</string>
<string>changedHighlightSearchTerms:</string>
<string>changedMakeURLsClickable:</string>
@@ -4267,6 +4202,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>id</string>
<string>id</string>
<string>id</string>
+ <string>id</string>
</object>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
@@ -4277,6 +4213,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>changedAltRows:</string>
<string>changedAutoSuggestLinks:</string>
<string>changedBackgroundTextColorWell:</string>
+ <string>changedExternalEditorsMenu:</string>
<string>changedForegroundTextColorWell:</string>
<string>changedHighlightSearchTerms:</string>
<string>changedMakeURLsClickable:</string>
@@ -4318,6 +4255,10 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string key="candidateClassName">id</string>
</object>
<object class="IBActionInfo">
+ <string key="name">changedExternalEditorsMenu:</string>
+ <string key="candidateClassName">id</string>
+ </object>
+ <object class="IBActionInfo">
<string key="name">changedForegroundTextColorWell:</string>
<string key="candidateClassName">id</string>
</object>
@@ -4418,6 +4359,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>confirmDeletionButton</string>
<string>databaseView</string>
<string>editingView</string>
+ <string>externalEditorMenuButton</string>
<string>folderLocationsMenuButton</string>
<string>fontsColorsView</string>
<string>foregroundColorWell</string>
@@ -4456,6 +4398,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>NSView</string>
<string>NSView</string>
<string>NSPopUpButton</string>
+ <string>NSPopUpButton</string>
<string>NSView</string>
<string>NSColorWell</string>
<string>NSView</string>
@@ -4495,6 +4438,7 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string>confirmDeletionButton</string>
<string>databaseView</string>
<string>editingView</string>
+ <string>externalEditorMenuButton</string>
<string>folderLocationsMenuButton</string>
<string>fontsColorsView</string>
<string>foregroundColorWell</string>
@@ -4566,6 +4510,10 @@ SW5jLiwgMjAwNQAAAAA</bytes>
<string key="candidateClassName">NSView</string>
</object>
<object class="IBToOneOutletInfo">
+ <string key="name">externalEditorMenuButton</string>
+ <string key="candidateClassName">NSPopUpButton</string>
+ </object>
+ <object class="IBToOneOutletInfo">
<string key="name">folderLocationsMenuButton</string>
<string key="candidateClassName">NSPopUpButton</string>
</object>
View
77 ExternalEditorListController.h
@@ -0,0 +1,77 @@
+//
+// ExternalEditorListController.h
+// Notation
+//
+// Created by Zachary Schneirov on 3/14/11.
+
+/*Copyright (c) 2010, Zachary Schneirov. All rights reserved.
+ This file is part of Notational Velocity.
+
+ Notational Velocity 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.
+
+ Notational Velocity 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 Notational Velocity. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#import <Cocoa/Cocoa.h>
+
+extern NSString *ExternalEditorsChangedNotification;
+
+@class NoteObject;
+
+@interface ExternalEditor : NSObject {
+
+ BOOL installCheckFailed;
+ NSImage *iconImg;
+ NSString *bundleIdentifier;
+ NSURL *resolvedURL;
+ NSString *displayName;
+ NSMutableDictionary *knownPathExtensions;
+}
+
+- (id)initWithBundleID:(NSString*)aBundleIdentifier resolvedURL:(NSURL*)aURL;
+- (BOOL)canEditNoteDirectly:(NoteObject*)aNote;
+- (BOOL)canEditAllNotes:(NSArray*)notes;
+- (NSImage*)iconImage;
+- (NSURL*)resolvedURL;
+- (NSString*)displayName;
+- (BOOL)isInstalled;
+- (BOOL)isODBEditor;
+- (NSString*)bundleIdentifier;
+
+@end
+
+@interface ExternalEditorListController : NSObject {
+
+ NSMutableArray *userEditorList;
+ NSArray *ODBEditorList;
+ ExternalEditor *defaultEditor;
+
+ NSMutableSet *editNotesMenus, *editorPrefsMenus;
+
+ NSMutableArray *_installedODBEditors;
+}
+- (id)initWithUserDefaults;
++ (ExternalEditorListController*)sharedInstance;
+- (void)addUserEditorFromDialog:(id)sender;
+- (void)resetUserEditors:(id)sender;
+- (void)_initDefaults;
+- (NSArray*)_installedODBEditors;
+- (BOOL)editorIsMember:(ExternalEditor*)anEditor;
++ (NSSet*)ODBAppIdentifiers;
+- (NSArray*)userEditorIdentifiers;
+- (NSMenu*)addEditorPrefsMenu;
+- (NSMenu*)addEditNotesMenu;
+- (void)menusChanged;
+- (void)_updateMenu:(NSMenu*)theMenu;
+- (ExternalEditor*)defaultExternalEditor;
+- (void)setDefaultEditor:(id)anEditor;
+@end
View
442 ExternalEditorListController.m
@@ -0,0 +1,442 @@
+//
+// ExternalEditorListController.m
+// Notation
+//
+// Created by Zachary Schneirov on 3/14/11.
+
+/*Copyright (c) 2010, Zachary Schneirov. All rights reserved.
+ This file is part of Notational Velocity.
+
+ Notational Velocity 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.
+
+ Notational Velocity 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 Notational Velocity. If not, see <http://www.gnu.org/licenses/>. */
+
+
+#import "ExternalEditorListController.h"
+#import "NoteObject.h"
+#import "NotationController.h"
+#import "NotationPrefs.h"
+#import "NSBezierPath_NV.h"
+
+static NSString *UserEEIdentifiersKey = @"UserEEIdentifiers";
+static NSString *DefaultEEIdentifierKey = @"DefaultEEIdentifier";
+NSString *ExternalEditorsChangedNotification = @"ExternalEditorsChanged";
+
+@implementation ExternalEditor
+
+- (id)initWithBundleID:(NSString*)aBundleIdentifier resolvedURL:(NSURL*)aURL {
+ if ([self init]) {
+ bundleIdentifier = [aBundleIdentifier retain];
+ resolvedURL = [aURL retain];
+
+ NSAssert(resolvedURL || bundleIdentifier, @"the bundle identifier and URL cannot both be nil");
+ if (!bundleIdentifier) {
+ if (!(bundleIdentifier = [[[NSBundle bundleWithPath:[aURL path]] bundleIdentifier] copy])) {
+ NSLog(@"initWithBundleID:resolvedURL: URL does not seem to point to a valid bundle");
+ return nil;
+ }
+ }
+ }
+ return self;
+}
+
+- (BOOL)canEditNoteDirectly:(NoteObject*)aNote {
+ NSAssert(aNote != nil, @"aNote is nil");
+
+ //for determining whether this potentially non-ODB-editor can open a non-plain-text file
+ //process: does pathExtension key exist in knownPathExtensions dict?
+ //if not, check this path extension w/ launch services
+ //then add a corresponding YES/NO NSNumber value to the knownPathExtensions dict
+
+ //but first, this editor can't handle any path if it's not actually installed
+ if (![self isInstalled]) return NO;
+
+ //and if this note isn't actually stored in a separate file, then obviously it can't be opened directly
+ if ([[aNote delegate] currentNoteStorageFormat] == SingleDatabaseFormat) return NO;
+
+ //and if aNote is in plaintext format and this editor is ODB-capable, then it should also be a general-purpose texteditor
+ //conversely ODB editors should never be allowed to open non-plain-text documents; for some reason LSCanURLAcceptURL claims they can do that
+ //one exception known: writeroom can edit rich-text documents
+ if ([self isODBEditor] && ![bundleIdentifier hasPrefix:@"com.hogbaysoftware.WriteRoom"]) {
+ return storageFormatOfNote(aNote) == PlainTextFormat;
+ }
+
+ if (!knownPathExtensions) knownPathExtensions = [NSMutableDictionary new];
+ NSString *extension = [[filenameOfNote(aNote) pathExtension] lowercaseString];
+ NSNumber *canHandleNumber = [knownPathExtensions objectForKey:extension];
+
+ if (!canHandleNumber) {
+ NSString *path = [aNote noteFilePath];
+
+ Boolean canAccept = false;
+ OSStatus err = LSCanURLAcceptURL((CFURLRef)[NSURL fileURLWithPath:path], (CFURLRef)[self resolvedURL], kLSRolesEditor, kLSAcceptAllowLoginUI, &canAccept);
+ if (noErr != err) {
+ NSLog(@"LSCanURLAcceptURL '%@' err: %d", path, err);
+ }
+ [knownPathExtensions setObject:[NSNumber numberWithBool:(BOOL)canAccept] forKey:extension];
+
+ return (BOOL)canAccept;
+ }
+
+ return [canHandleNumber boolValue];
+}
+
+- (BOOL)canEditAllNotes:(NSArray*)notes {
+ NSUInteger i = 0;
+ for (i=0; i<[notes count]; i++) {
+ if (![self isODBEditor] && ![self canEditNoteDirectly:[notes objectAtIndex:i]])
+ return NO;
+ }
+ return YES;
+}
+
+- (NSImage*)iconImage {
+ if (!iconImg) {
+ FSRef appRef;
+ if (CFURLGetFSRef((CFURLRef)[self resolvedURL], &appRef))
+ iconImg = [[NSImage smallIconForFSRef:&appRef] retain];
+ }
+ return iconImg;
+}
+
+- (NSString*)displayName {
+ if (!displayName) {
+ LSCopyDisplayNameForURL((CFURLRef)[self resolvedURL], (CFStringRef*)&displayName);
+ }
+ return displayName;
+}
+
+- (NSURL*)resolvedURL {
+ if (!resolvedURL && !installCheckFailed) {
+
+ OSStatus err = LSFindApplicationForInfo(kLSUnknownCreator, (CFStringRef)bundleIdentifier, NULL, NULL, (CFURLRef*)&resolvedURL);
+
+ if (kLSApplicationNotFoundErr == err) {
+ installCheckFailed = YES;
+ } else if (noErr != err) {
+ NSLog(@"LSFindApplicationForInfo error for bundle identifier '%@': %d", bundleIdentifier, err);
+ }
+ }
+ return resolvedURL;
+}
+
+- (BOOL)isInstalled {
+ return [self resolvedURL] != nil;
+}
+
+- (BOOL)isODBEditor {
+ return [[ExternalEditorListController ODBAppIdentifiers] containsObject:bundleIdentifier];
+}
+
+- (NSString*)bundleIdentifier {
+ return bundleIdentifier;
+}
+
+- (NSString*)description {
+ return [bundleIdentifier stringByAppendingFormat:@" (URL: %@)", resolvedURL];
+}
+
+- (NSUInteger)hash {
+ return [bundleIdentifier hash];
+}
+- (BOOL)isEqual:(id)otherEntry {
+ return [[otherEntry bundleIdentifier] isEqualToString:bundleIdentifier];
+}
+- (NSComparisonResult)compareDisplayName:(ExternalEditor *)otherEd {
+ return [[self displayName] caseInsensitiveCompare:[otherEd displayName]];
+}
+
+
+- (void)dealloc {
+ [knownPathExtensions release];
+ [bundleIdentifier release];
+ [displayName release];
+ [resolvedURL release];
+ [iconImg release];
+ [super dealloc];
+}
+
+
+@end
+
+@implementation ExternalEditorListController
+
+static ExternalEditorListController* sharedInstance = nil;
+
++ (ExternalEditorListController*)sharedInstance {
+ if (sharedInstance == nil)
+ sharedInstance = [[ExternalEditorListController alloc] initWithUserDefaults];
+ return sharedInstance;
+}
+
++ (id)allocWithZone:(NSZone *)zone {
+ if (sharedInstance == nil) {
+ sharedInstance = [super allocWithZone:zone];
+ return sharedInstance; // assignment and return on first allocation
+ }
+ return nil; // on subsequent allocation attempts return nil
+}
+
+- (id)initWithUserDefaults {
+ if ([self init]) {
+ //TextEdit is not an ODB editor, but can be used to open files directly
+ [[NSUserDefaults standardUserDefaults] registerDefaults:
+ [NSDictionary dictionaryWithObject:[NSArray arrayWithObject:@"com.apple.TextEdit"] forKey:UserEEIdentifiersKey]];
+
+ [self _initDefaults];
+ }
+ return self;
+}
+
+- (id)init {
+ if ([super init]) {
+
+ userEditorList = [[NSMutableArray alloc] init];
+ }
+ return self;
+}
+
+- (void)_initDefaults {
+ NSArray *userIdentifiers = [[NSUserDefaults standardUserDefaults] arrayForKey:UserEEIdentifiersKey];
+
+ NSUInteger i = 0;
+ for (i=0; i<[userIdentifiers count]; i++) {
+ ExternalEditor *ed = [[ExternalEditor alloc] initWithBundleID:[userIdentifiers objectAtIndex:i] resolvedURL:nil];
+ [userEditorList addObject:ed];
+ [ed release];
+ }
+
+ //initialize the default editor if one has not already been set or if the identifier was somehow lost from the list
+ if (![self editorIsMember:[self defaultExternalEditor]] || ![[self defaultExternalEditor] isInstalled]) {
+ if ([[self _installedODBEditors] count]) {
+ [self setDefaultEditor:[[self _installedODBEditors] lastObject]];
+ }
+ }
+}
+
+- (NSArray*)_installedODBEditors {
+ if (!_installedODBEditors) {
+ _installedODBEditors = [[NSMutableArray alloc] initWithCapacity:5];
+
+ NSArray *ODBApps = [[[self class] ODBAppIdentifiers] allObjects];
+ NSUInteger i = 0;
+ for (i=0; i<[ODBApps count]; i++) {
+ ExternalEditor *ed = [[ExternalEditor alloc] initWithBundleID:[ODBApps objectAtIndex:i] resolvedURL:nil];
+ if ([ed isInstalled]) {
+ [_installedODBEditors addObject:ed];
+ }
+ [ed release];
+ }
+ [_installedODBEditors sortUsingSelector:@selector(compareDisplayName:)];
+ }
+ return _installedODBEditors;
+}
+
++ (NSSet*)ODBAppIdentifiers {
+ static NSSet *_ODBAppIdentifiers = nil;
+ if (!_ODBAppIdentifiers)
+ _ODBAppIdentifiers = [[NSSet alloc] initWithObjects:
+ @"de.codingmonkeys.SubEthaEdit", @"com.barebones.bbedit", @"com.barebones.textwrangler",
+ @"com.macromates.textmate", @"com.transtex.texeditplus", @"jp.co.artman21.JeditX", @"org.gnu.Aquamacs",
+ @"org.smultron.Smultron", @"com.peterborgapps.Smultron", @"org.fraise.Fraise", @"com.aynimac.CotEditor", @"com.macrabbit.cssedit",
+ @"com.talacia.Tag", @"org.skti.skEdit", @"com.cgerdes.ji", @"com.optima.PageSpinner", @"com.hogbaysoftware.WriteRoom",
+ @"com.hogbaysoftware.WriteRoom.mac", @"org.vim.MacVim", @"com.forgedit.ForgEdit", @"com.tacosw.TacoHTMLEdit", @"com.macrabbit.espresso", nil];
+ return _ODBAppIdentifiers;
+}
+
+- (void)addUserEditorFromDialog:(id)sender {
+
+ //always send menuChanged notification because this class is the target of its menus,
+ //so the notification is the only way to maintain a consistent selected item in PrefsWindowController
+ [self performSelector:@selector(menusChanged) withObject:nil afterDelay:0.0];
+
+ NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+ [openPanel setResolvesAliases:YES];
+ [openPanel setAllowsMultipleSelection:NO];
+
+ if ([openPanel runModalForDirectory:@"/Applications" file:nil types:[NSArray arrayWithObject:@"app"]] == NSOKButton) {
+ if (![openPanel filename]) goto errorReturn;
+ NSURL *appURL = [NSURL fileURLWithPath:[openPanel filename]];
+ if (!appURL) goto errorReturn;
+
+ ExternalEditor *ed = [[ExternalEditor alloc] initWithBundleID:nil resolvedURL:appURL];
+ if (!ed) goto errorReturn;
+
+ //check against lists of all known editors, installed or not
+ if (![self editorIsMember:ed]) {
+ [userEditorList addObject:ed];
+ [[NSUserDefaults standardUserDefaults] setObject:[self userEditorIdentifiers] forKey:UserEEIdentifiersKey];
+ }
+
+ [self setDefaultEditor:ed];
+ }
+ return;
+errorReturn:
+ NSBeep();
+ NSLog(@"Unable to add external editor");
+}
+
+- (void)resetUserEditors:(id)sender {
+ [userEditorList removeAllObjects];
+
+ [[NSUserDefaults standardUserDefaults] removeObjectForKey:UserEEIdentifiersKey];
+
+ [self _initDefaults];
+
+ [self menusChanged];
+}
+
+- (NSArray*)userEditorIdentifiers {
+ //for storing in nsuserdefaults
+ //extract bundle identifiers
+
+ NSMutableArray *array = [NSMutableArray arrayWithCapacity:[userEditorList count]];
+ NSUInteger i = 0;
+ for (i=0; i<[userEditorList count]; i++) {
+ [array addObject:[[userEditorList objectAtIndex:i] bundleIdentifier]];
+ }
+
+ return array;
+}
+
+
+- (BOOL)editorIsMember:(ExternalEditor*)anEditor {
+ //does the editor exist in any of the lists?
+ return [userEditorList containsObject:anEditor] || [[ExternalEditorListController ODBAppIdentifiers] containsObject:[anEditor bundleIdentifier]];
+}
+
+- (NSMenu*)addEditorPrefsMenu {
+ if (!editorPrefsMenus) editorPrefsMenus = [NSMutableSet new];
+ NSMenu *aMenu = [[NSMenu alloc] initWithTitle:@"External Editors Menu"];
+ [aMenu setAutoenablesItems:NO];
+ [aMenu setDelegate:self];
+ [editorPrefsMenus addObject:[aMenu autorelease]];
+ [self _updateMenu:aMenu];
+ return aMenu;
+}
+
+- (NSMenu*)addEditNotesMenu {
+ if (!editNotesMenus) editNotesMenus = [NSMutableSet new];
+ NSMenu *aMenu = [[NSMenu alloc] initWithTitle:@"Edit Note Menu"];
+ [aMenu setAutoenablesItems:YES];
+ [aMenu setDelegate:self];
+ [editNotesMenus addObject:[aMenu autorelease]];
+ [self _updateMenu:aMenu];
+ return aMenu;
+}
+
+- (void)menusChanged {
+
+ [editNotesMenus makeObjectsPerformSelector:@selector(_updateMenuForEEListController:) withObject:self];
+ [editorPrefsMenus makeObjectsPerformSelector:@selector(_updateMenuForEEListController:) withObject:self];
+ [[NSNotificationCenter defaultCenter] postNotification:[NSNotification notificationWithName:ExternalEditorsChangedNotification object:self]];
+}
+
+- (void)_updateMenu:(NSMenu*)theMenu {
+ //for allowing the user to configure external editors in the preferences window
+
+ if (IsSnowLeopardOrLater) {
+ [theMenu performSelector:@selector(removeAllItems)];
+ } else {
+ while ([theMenu numberOfItems])
+ [theMenu removeItemAtIndex:0];
+ }
+
+ BOOL isPrefsMenu = [editorPrefsMenus containsObject:theMenu];
+ BOOL didAddItem = NO;
+ NSMutableArray *editors = [NSMutableArray arrayWithArray:[self _installedODBEditors]];
+ [editors addObjectsFromArray:[userEditorList filteredArrayUsingPredicate:[NSPredicate predicateWithFormat:@"isInstalled == YES"]]];
+ [editors sortUsingSelector:@selector(compareDisplayName:)];
+
+ NSUInteger i = 0;
+ for (i=0; i<[editors count]; i++) {
+ ExternalEditor *ed = [editors objectAtIndex:i];
+
+ //change action SEL based on whether this is coming from Notes menu or preferences window
+ NSMenuItem *theMenuItem = isPrefsMenu ?
+ [[[NSMenuItem alloc] initWithTitle:[ed displayName] action:@selector(setDefaultEditor:) keyEquivalent:@""] autorelease] :
+ [[[NSMenuItem alloc] initWithTitle:[ed displayName] action:@selector(editNoteExternally:) keyEquivalent:@""] autorelease];
+
+ if (!isPrefsMenu && [[self defaultExternalEditor] isEqual:ed]) {
+ [theMenuItem setKeyEquivalent:@"E"];
+ [theMenuItem setKeyEquivalentModifierMask: NSCommandKeyMask | NSShiftKeyMask];
+ }
+ //PrefsWindowController maintains default-editor selection by updating on ExternalEditorsChangedNotification
+
+ [theMenuItem setTarget: isPrefsMenu ? self : [NSApp delegate]];
+