Re-import exported files.
authorJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 14:51:55 +0000 (15:51 +0100)
committerJoe Wreschnig <joe.wreschnig@gmail.com>
Fri, 1 Mar 2013 14:51:55 +0000 (15:51 +0100)
ApplicationController.m
Config.m
ConfigsController.h
ConfigsController.m
English.lproj/MainMenu.xib
Enjoyable.xcodeproj/project.pbxproj
Enjoyable_Prefix.pch
NSError+Description.h [new file with mode: 0644]
NSError+Description.m [new file with mode: 0644]

index b86a5f2067f8ebc36e09e8bdc58bd90eda2b70ff..445456526329370a5b8f3f2fc9f6b66e65848003 100644 (file)
 - (IBAction)toggleActivity:(id)sender {
     BOOL sendRealEvents = !self.jsController.sendingRealEvents;
     self.jsController.sendingRealEvents = sendRealEvents;
-    activeButton.label = sendRealEvents ? @"Stop" : @"Start";
     activeButton.image = [NSImage imageNamed:sendRealEvents ? @"NSStopProgressFreestandingTemplate" : @"NSGoRightTemplate"];
     activeMenuItem.state = sendRealEvents;
 }
 
 - (NSInteger)firstConfigMenuIndex {
-    NSInteger count = dockMenuBase.numberOfItems;
-    for (int i = 0; i < count; ++i)
+    for (NSInteger i = dockMenuBase.numberOfItems - 1; i >= 0; --i)
         if ([dockMenuBase itemAtIndex:i].isSeparatorItem)
             return i + 1;
-    return count;
+    return dockMenuBase.numberOfItems;
 }
 
 - (void)configsChanged {
index a02c4ce55171ee20ca66a974162c8e733cfd1a08..55162b081baa3270f35037fe0c00caed42bd18e2 100644 (file)
--- a/Config.m
+++ b/Config.m
@@ -13,7 +13,7 @@
 
 - (id)initWithName:(NSString *)name {
     if ((self = [super init])) {
-        self.name = name;
+        self.name = name ? name : @"Untitled";
         _entries = [[NSMutableDictionary alloc] init];
     }
     return self;
index fac19725b3abfa35c854bc4fe49751d8f71f90dd..369d7f7cbba8e9e6e9ed1c381ceb7c7f26e64eff 100644 (file)
 @property (readonly) Config *currentConfig;
 @property (readonly) NSArray *configs;
 
+- (Config *)objectForKeyedSubscript:(NSString *)name;
+
+
 - (IBAction)addPressed:(id)sender;
 - (IBAction)removePressed:(id)sender;
+- (IBAction)importPressed:(id)sender;
 - (IBAction)exportPressed:(id)sender;
 - (void)activateConfig:(Config *)config;
 - (void)activateConfigForProcess:(NSString *)processName;
index 17cf8fd6a3a9547a11733b514fb48ec8344ba6ae..969398515b4a5d235e41d48da9dca73dd2035c14 100644 (file)
     }
 }
 
+- (void)importPressed:(id)sender {
+    NSOpenPanel *panel = [NSOpenPanel openPanel];
+    panel.allowedFileTypes = @[ @"enjoyable", @"json", @"txt" ];
+    if ([panel runModal] == NSFileHandlingPanelOKButton) {
+        NSError *error;
+        NSInputStream *stream = [NSInputStream inputStreamWithURL:panel.URL];
+        [stream open];
+        NSDictionary *serialization = !error
+            ? [NSJSONSerialization JSONObjectWithStream:stream options:0 error:&error]
+            : nil;
+        [stream close];
+        
+        if (!([serialization isKindOfClass:[NSDictionary class]]
+              && serialization[@"entries"])) {
+            error = [NSError errorWithDomain:@"Enjoyable"
+                                        code:0
+                                 description:@"This isn't a valid mapping file."];
+        }
+        
+        
+        if (!error) {
+            NSDictionary *entries = serialization[@"entries"];
+            Config *cfg = [[Config alloc] initWithName:serialization[@"name"]];
+            Config *mergeInto = self[cfg.name];
+            BOOL conflict = NO;
+            for (id key in entries) {
+                cfg.entries[key] = [Target targetDeserialize:entries[key]
+                                                    withConfigs:_configs];
+                if (mergeInto.entries[key])
+                    conflict = YES;
+            }
+            
+            if (conflict) {
+                NSAlert *conflictAlert = [[NSAlert alloc] init];
+                conflictAlert.messageText = @"Replace existing mappings?";
+                conflictAlert.informativeText =
+                    [NSString stringWithFormat:
+                     @"This file contains inputs you've already mapped in \"%@\". Do you "
+                     @"want to merge them and replace your existing mappings, or import this "
+                     @"as a separate mapping?", cfg.name];
+                [conflictAlert addButtonWithTitle:@"Merge"];
+                [conflictAlert addButtonWithTitle:@"Cancel"];
+                [conflictAlert addButtonWithTitle:@"New Mapping"];
+                NSInteger res = [conflictAlert runModal];
+                if (res == NSAlertSecondButtonReturn)
+                    return;
+                else if (res == NSAlertThirdButtonReturn)
+                    mergeInto = nil;
+            }
+            
+            if (mergeInto) {
+                [mergeInto.entries addEntriesFromDictionary:cfg.entries];
+                cfg = mergeInto;
+            } else {
+                [_configs addObject:cfg];
+                [tableView reloadData];
+            }
+
+            [self save];
+            [(ApplicationController *)[[NSApplication sharedApplication] delegate] configsChanged];
+            [self activateConfig:cfg];
+            [targetController loadCurrent];
+            
+            if (conflict && !mergeInto) {
+                [tableView selectRowIndexes:[NSIndexSet indexSetWithIndex:_configs.count - 1] byExtendingSelection:NO];
+                [tableView editColumn:0 row:_configs.count - 1 withEvent:nil select:YES];
+            }
+        }
+        
+        if (error)
+            [[NSAlert alertWithError:error] runModal];
+    }
+}
+
 - (void)exportPressed:(id)sender {
     NSSavePanel *panel = [NSSavePanel savePanel];
     panel.allowedFileTypes = @[ @"enjoyable" ];
index 056a907b7256a6ecc3bc700a2d720118edb2487b..9c7050aa2f059d9e817b124811d7223517abc275 100644 (file)
@@ -35,8 +35,6 @@
                        <string>NSToolbar</string>
                        <string>NSToolbarFlexibleSpaceItem</string>
                        <string>NSToolbarItem</string>
-                       <string>NSToolbarSeparatorItem</string>
-                       <string>NSToolbarSpaceItem</string>
                        <string>NSView</string>
                        <string>NSWindowTemplate</string>
                </array>
                                        </object>
                                        <object class="NSMenuItem" id="379814623">
                                                <reference key="NSMenu" ref="649796088"/>
-                                               <string key="NSTitle">Configurations</string>
+                                               <string key="NSTitle">Mappings</string>
                                                <string key="NSKeyEquiv"/>
                                                <int key="NSKeyEquivModMask">1048576</int>
                                                <int key="NSMnemonicLoc">2147483647</int>
                                                <reference key="NSMixedImage" ref="502551668"/>
                                                <string key="NSAction">submenuAction:</string>
                                                <object class="NSMenu" key="NSSubmenu" id="720053764">
-                                                       <string key="NSTitle">Configurations</string>
+                                                       <string key="NSTitle">Mappings</string>
                                                        <array class="NSMutableArray" key="NSMenuItems">
                                                                <object class="NSMenuItem" id="632598200">
                                                                        <reference key="NSMenu" ref="720053764"/>
-                                                                       <string key="NSTitle">Enable mapping</string>
-                                                                       <string key="NSKeyEquiv">.</string>
+                                                                       <string key="NSTitle">Enable</string>
+                                                                       <string key="NSKeyEquiv">r</string>
+                                                                       <int key="NSKeyEquivModMask">1048576</int>
+                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                       <reference key="NSOnImage" ref="35465992"/>
+                                                                       <reference key="NSMixedImage" ref="502551668"/>
+                                                               </object>
+                                                               <object class="NSMenuItem" id="580069611">
+                                                                       <reference key="NSMenu" ref="720053764"/>
+                                                                       <bool key="NSIsDisabled">YES</bool>
+                                                                       <bool key="NSIsSeparator">YES</bool>
+                                                                       <string key="NSTitle"/>
+                                                                       <string key="NSKeyEquiv"/>
+                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                       <reference key="NSOnImage" ref="35465992"/>
+                                                                       <reference key="NSMixedImage" ref="502551668"/>
+                                                               </object>
+                                                               <object class="NSMenuItem" id="914355947">
+                                                                       <reference key="NSMenu" ref="720053764"/>
+                                                                       <string key="NSTitle">List</string>
+                                                                       <string key="NSKeyEquiv">l</string>
+                                                                       <int key="NSKeyEquivModMask">1048576</int>
+                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                       <reference key="NSOnImage" ref="35465992"/>
+                                                                       <reference key="NSMixedImage" ref="502551668"/>
+                                                               </object>
+                                                               <object class="NSMenuItem" id="187155117">
+                                                                       <reference key="NSMenu" ref="720053764"/>
+                                                                       <string key="NSTitle">Import...</string>
+                                                                       <string key="NSKeyEquiv">o</string>
+                                                                       <int key="NSKeyEquivModMask">1048576</int>
+                                                                       <int key="NSMnemonicLoc">2147483647</int>
+                                                                       <reference key="NSOnImage" ref="35465992"/>
+                                                                       <reference key="NSMixedImage" ref="502551668"/>
+                                                               </object>
+                                                               <object class="NSMenuItem" id="888617891">
+                                                                       <reference key="NSMenu" ref="720053764"/>
+                                                                       <string key="NSTitle">Export...</string>
+                                                                       <string key="NSKeyEquiv">s</string>
                                                                        <int key="NSKeyEquivModMask">1048576</int>
                                                                        <int key="NSMnemonicLoc">2147483647</int>
                                                                        <reference key="NSOnImage" ref="35465992"/>
                                                        <object class="NSMutableString" key="NSToolbarItemIdentifier">
                                                                <characters key="NS.bytes">42CA6E7F-AC4A-4681-98B6-B9901269E463</characters>
                                                        </object>
-                                                       <string key="NSToolbarItemLabel">Start</string>
+                                                       <string key="NSToolbarItemLabel"/>
                                                        <string key="NSToolbarItemPaletteLabel">Start/Stop</string>
                                                        <string key="NSToolbarItemToolTip"/>
                                                        <nil key="NSToolbarItemView"/>
                                                        <bool key="NSToolbarIsUserRemovable">YES</bool>
                                                        <int key="NSToolbarItemVisibilityPriority">0</int>
                                                </object>
-                                               <object class="NSToolbarItem" key="EC49C240-1D96-41C2-AD75-D75EEB29EDEA" id="504390900">
+                                               <object class="NSToolbarItem" key="A03535DA-B573-44B2-86A0-5E261E68FC16" id="504390900">
                                                        <object class="NSMutableString" key="NSToolbarItemIdentifier">
-                                                               <characters key="NS.bytes">EC49C240-1D96-41C2-AD75-D75EEB29EDEA</characters>
+                                                               <characters key="NS.bytes">A03535DA-B573-44B2-86A0-5E261E68FC16</characters>
                                                        </object>
-                                                       <string key="NSToolbarItemLabel">Configurations</string>
+                                                       <string key="NSToolbarItemLabel"/>
                                                        <string key="NSToolbarItemPaletteLabel">Configurations</string>
                                                        <string key="NSToolbarItemToolTip"/>
                                                        <nil key="NSToolbarItemView"/>
                                                        <object class="NSCustomResource" key="NSToolbarItemImage">
                                                                <string key="NSClassName">NSImage</string>
-                                                               <string key="NSResourceName">NSMultipleDocuments</string>
+                                                               <string key="NSResourceName">NSListViewTemplate</string>
                                                        </object>
                                                        <nil key="NSToolbarItemTarget"/>
                                                        <nil key="NSToolbarItemAction"/>
                                                                <reference key="NSMixedImage" ref="502551668"/>
                                                        </object>
                                                </object>
-                                               <object class="NSToolbarSeparatorItem" key="NSToolbarSeparatorItem" id="430749933">
-                                                       <string key="NSToolbarItemIdentifier">NSToolbarSeparatorItem</string>
-                                                       <string key="NSToolbarItemLabel"/>
-                                                       <string key="NSToolbarItemPaletteLabel">Separator</string>
-                                                       <nil key="NSToolbarItemToolTip"/>
-                                                       <nil key="NSToolbarItemView"/>
-                                                       <nil key="NSToolbarItemImage"/>
-                                                       <nil key="NSToolbarItemTarget"/>
-                                                       <nil key="NSToolbarItemAction"/>
-                                                       <string key="NSToolbarItemMinSize">{12, 5}</string>
-                                                       <string key="NSToolbarItemMaxSize">{12, 1000}</string>
-                                                       <bool key="NSToolbarItemEnabled">YES</bool>
-                                                       <bool key="NSToolbarItemAutovalidates">YES</bool>
-                                                       <int key="NSToolbarItemTag">-1</int>
-                                                       <bool key="NSToolbarIsUserRemovable">YES</bool>
-                                                       <int key="NSToolbarItemVisibilityPriority">0</int>
-                                                       <object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
-                                                               <bool key="NSIsDisabled">YES</bool>
-                                                               <bool key="NSIsSeparator">YES</bool>
-                                                               <string key="NSTitle"/>
-                                                               <string key="NSKeyEquiv"/>
-                                                               <int key="NSKeyEquivModMask">1048576</int>
-                                                               <int key="NSMnemonicLoc">2147483647</int>
-                                                               <reference key="NSOnImage" ref="35465992"/>
-                                                               <reference key="NSMixedImage" ref="502551668"/>
-                                                       </object>
-                                               </object>
-                                               <object class="NSToolbarSpaceItem" key="NSToolbarSpaceItem" id="466904997">
-                                                       <string key="NSToolbarItemIdentifier">NSToolbarSpaceItem</string>
-                                                       <string key="NSToolbarItemLabel"/>
-                                                       <string key="NSToolbarItemPaletteLabel">Space</string>
-                                                       <nil key="NSToolbarItemToolTip"/>
-                                                       <nil key="NSToolbarItemView"/>
-                                                       <nil key="NSToolbarItemImage"/>
-                                                       <nil key="NSToolbarItemTarget"/>
-                                                       <nil key="NSToolbarItemAction"/>
-                                                       <string key="NSToolbarItemMinSize">{32, 5}</string>
-                                                       <string key="NSToolbarItemMaxSize">{32, 32}</string>
-                                                       <bool key="NSToolbarItemEnabled">YES</bool>
-                                                       <bool key="NSToolbarItemAutovalidates">YES</bool>
-                                                       <int key="NSToolbarItemTag">-1</int>
-                                                       <bool key="NSToolbarIsUserRemovable">YES</bool>
-                                                       <int key="NSToolbarItemVisibilityPriority">0</int>
-                                                       <object class="NSMenuItem" key="NSToolbarItemMenuFormRepresentation">
-                                                               <bool key="NSIsDisabled">YES</bool>
-                                                               <bool key="NSIsSeparator">YES</bool>
-                                                               <string key="NSTitle"/>
-                                                               <string key="NSKeyEquiv"/>
-                                                               <int key="NSKeyEquivModMask">1048576</int>
-                                                               <int key="NSMnemonicLoc">2147483647</int>
-                                                               <reference key="NSOnImage" ref="35465992"/>
-                                                               <reference key="NSMixedImage" ref="502551668"/>
-                                                       </object>
-                                               </object>
                                        </dictionary>
                                        <array key="NSToolbarIBAllowedItems">
-                                               <reference ref="504390900"/>
                                                <reference ref="992952969"/>
-                                               <reference ref="430749933"/>
-                                               <reference ref="466904997"/>
+                                               <reference ref="504390900"/>
                                                <reference ref="658903347"/>
                                        </array>
-                                       <array key="NSToolbarIBDefaultItems">
-                                               <reference ref="504390900"/>
+                                       <array class="NSMutableArray" key="NSToolbarIBDefaultItems">
                                                <reference ref="992952969"/>
                                                <reference ref="658903347"/>
+                                               <reference ref="504390900"/>
                                        </array>
                                        <array key="NSToolbarIBSelectableItems" id="0"/>
                                </object>
                                <reference key="NSNextResponder"/>
                                <int key="NSvFlags">256</int>
                                <array class="NSMutableArray" key="NSSubviews">
-                                       <object class="NSButton" id="349018835">
-                                               <reference key="NSNextResponder" ref="671181514"/>
-                                               <int key="NSvFlags">297</int>
-                                               <string key="NSFrame">{{226, 1}, {82, 32}}</string>
-                                               <reference key="NSSuperview" ref="671181514"/>
-                                               <reference key="NSWindow"/>
-                                               <reference key="NSNextKeyView"/>
-                                               <string key="NSReuseIdentifierKey">_NS:9</string>
-                                               <bool key="NSEnabled">YES</bool>
-                                               <object class="NSButtonCell" key="NSCell" id="664919868">
-                                                       <int key="NSCellFlags">-2080374784</int>
-                                                       <int key="NSCellFlags2">134217728</int>
-                                                       <string key="NSContents">Export</string>
-                                                       <reference key="NSSupport" ref="45863614"/>
-                                                       <string key="NSCellIdentifier">_NS:9</string>
-                                                       <reference key="NSControlView" ref="349018835"/>
-                                                       <int key="NSButtonFlags">-2034876416</int>
-                                                       <int key="NSButtonFlags2">129</int>
-                                                       <string key="NSAlternateContents"/>
-                                                       <string key="NSKeyEquivalent"/>
-                                                       <int key="NSPeriodicDelay">400</int>
-                                                       <int key="NSPeriodicInterval">75</int>
-                                               </object>
-                                               <bool key="NSAllowsLogicalLayoutDirection">NO</bool>
-                                       </object>
                                        <object class="NSScrollView" id="443618264">
                                                <reference key="NSNextResponder" ref="671181514"/>
                                                <int key="NSvFlags">274</int>
                                                <string key="NSFrame">{{57, 4}, {39, 28}}</string>
                                                <reference key="NSSuperview" ref="671181514"/>
                                                <reference key="NSWindow"/>
-                                               <reference key="NSNextKeyView" ref="349018835"/>
+                                               <reference key="NSNextKeyView"/>
                                                <bool key="NSEnabled">YES</bool>
                                                <object class="NSButtonCell" key="NSCell" id="1008023024">
                                                        <int key="NSCellFlags">603979776</int>
                                        </object>
                                        <int key="connectionID">498</int>
                                </object>
+                               <object class="IBConnectionRecord">
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">toggle:</string>
+                                               <reference key="source" ref="314955046"/>
+                                               <reference key="destination" ref="914355947"/>
+                                       </object>
+                                       <int key="connectionID">811</int>
+                               </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
                                                <string key="label">delegate</string>
                                        <object class="IBActionConnection" key="connection">
                                                <string key="label">exportPressed:</string>
                                                <reference key="source" ref="468285243"/>
-                                               <reference key="destination" ref="349018835"/>
+                                               <reference key="destination" ref="888617891"/>
                                        </object>
-                                       <int key="connectionID">784</int>
+                                       <int key="connectionID">815</int>
                                </object>
                                <object class="IBConnectionRecord">
-                                       <object class="IBOutletConnection" key="connection">
-                                               <string key="label">exportButton</string>
+                                       <object class="IBActionConnection" key="connection">
+                                               <string key="label">importPressed:</string>
                                                <reference key="source" ref="468285243"/>
-                                               <reference key="destination" ref="349018835"/>
+                                               <reference key="destination" ref="187155117"/>
                                        </object>
-                                       <int key="connectionID">785</int>
+                                       <int key="connectionID">816</int>
                                </object>
                                <object class="IBConnectionRecord">
                                        <object class="IBOutletConnection" key="connection">
                                                <array class="NSMutableArray" key="children">
                                                        <reference ref="632598200"/>
                                                        <reference ref="773548144"/>
+                                                       <reference ref="914355947"/>
+                                                       <reference ref="580069611"/>
+                                                       <reference ref="888617891"/>
+                                                       <reference ref="187155117"/>
                                                </array>
                                                <reference key="parent" ref="379814623"/>
                                        </object>
                                                        <reference ref="861276216"/>
                                                        <reference ref="456935010"/>
                                                        <reference ref="443618264"/>
-                                                       <reference ref="349018835"/>
                                                </array>
                                                <reference key="parent" ref="0"/>
                                                <string key="objectName">Drawer Content View</string>
                                                <int key="objectID">487</int>
                                                <reference key="object" ref="1043384830"/>
                                                <array class="NSMutableArray" key="children">
-                                                       <reference ref="430749933"/>
-                                                       <reference ref="466904997"/>
-                                                       <reference ref="658903347"/>
                                                        <reference ref="504390900"/>
                                                        <reference ref="992952969"/>
+                                                       <reference ref="658903347"/>
                                                </array>
                                                <reference key="parent" ref="808667431"/>
                                        </object>
-                                       <object class="IBObjectRecord">
-                                               <int key="objectID">490</int>
-                                               <reference key="object" ref="430749933"/>
-                                               <reference key="parent" ref="1043384830"/>
-                                       </object>
-                                       <object class="IBObjectRecord">
-                                               <int key="objectID">492</int>
-                                               <reference key="object" ref="466904997"/>
-                                               <reference key="parent" ref="1043384830"/>
-                                       </object>
-                                       <object class="IBObjectRecord">
-                                               <int key="objectID">493</int>
-                                               <reference key="object" ref="658903347"/>
-                                               <reference key="parent" ref="1043384830"/>
-                                       </object>
                                        <object class="IBObjectRecord">
                                                <int key="objectID">495</int>
                                                <reference key="object" ref="504390900"/>
                                                <reference key="parent" ref="606740242"/>
                                        </object>
                                        <object class="IBObjectRecord">
-                                               <int key="objectID">782</int>
-                                               <reference key="object" ref="349018835"/>
-                                               <array class="NSMutableArray" key="children">
-                                                       <reference ref="664919868"/>
-                                               </array>
-                                               <reference key="parent" ref="671181514"/>
+                                               <int key="objectID">790</int>
+                                               <reference key="object" ref="658903347"/>
+                                               <reference key="parent" ref="1043384830"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">810</int>
+                                               <reference key="object" ref="914355947"/>
+                                               <reference key="parent" ref="720053764"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">812</int>
+                                               <reference key="object" ref="580069611"/>
+                                               <reference key="parent" ref="720053764"/>
+                                       </object>
+                                       <object class="IBObjectRecord">
+                                               <int key="objectID">813</int>
+                                               <reference key="object" ref="888617891"/>
+                                               <reference key="parent" ref="720053764"/>
                                        </object>
                                        <object class="IBObjectRecord">
-                                               <int key="objectID">783</int>
-                                               <reference key="object" ref="664919868"/>
-                                               <reference key="parent" ref="349018835"/>
+                                               <int key="objectID">814</int>
+                                               <reference key="object" ref="187155117"/>
+                                               <reference key="parent" ref="720053764"/>
                                        </object>
                                </array>
                        </object>
                                <string key="479.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="482.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="487.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                               <string key="490.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                               <string key="492.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                               <string key="493.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="495.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="507.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <integer value="1" key="755.IBNSSegmentedControlInspectorSelectedSegmentMetadataKey"/>
                                <string key="755.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="778.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                               <string key="782.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
-                               <string key="783.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+                               <string key="790.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="81.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+                               <string key="810.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+                               <string key="812.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+                               <string key="813.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+                               <string key="814.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="83.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                                <string key="92.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
                        </dictionary>
                        <nil key="activeLocalization"/>
                        <dictionary class="NSMutableDictionary" key="localizations"/>
                        <nil key="sourceID"/>
-                       <int key="maxID">785</int>
+                       <int key="maxID">816</int>
                </object>
                <object class="IBClassDescriber" key="IBDocument.Classes">
                        <array class="NSMutableArray" key="referencedPartialClassDescriptions">
                                        <dictionary class="NSMutableDictionary" key="actions">
                                                <string key="addPressed:">id</string>
                                                <string key="exportPressed:">id</string>
+                                               <string key="importPressed:">id</string>
                                                <string key="removePressed:">id</string>
                                        </dictionary>
                                        <dictionary class="NSMutableDictionary" key="actionInfosByName">
                                                        <string key="name">exportPressed:</string>
                                                        <string key="candidateClassName">id</string>
                                                </object>
+                                               <object class="IBActionInfo" key="importPressed:">
+                                                       <string key="name">importPressed:</string>
+                                                       <string key="candidateClassName">id</string>
+                                               </object>
                                                <object class="IBActionInfo" key="removePressed:">
                                                        <string key="name">removePressed:</string>
                                                        <string key="candidateClassName">id</string>
                <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
                        <string key="NSAddTemplate">{8, 8}</string>
                        <string key="NSGoRightTemplate">{9, 9}</string>
+                       <string key="NSListViewTemplate">{11, 10}</string>
                        <string key="NSMenuCheckmark">{11, 11}</string>
                        <string key="NSMenuMixedState">{10, 3}</string>
-                       <string key="NSMultipleDocuments">{32, 32}</string>
                        <string key="NSRadioButton">{16, 15}</string>
                        <string key="NSRemoveTemplate">{8, 8}</string>
                </dictionary>
index aac549497198cb68070e979d9031a20c7459ab19..2c79e25662df490ceeae90fc24735ae8e48b624f 100644 (file)
@@ -33,6 +33,7 @@
                D5F809710FB093400006A4DE /* TargetConfig.m in Sources */ = {isa = PBXBuildFile; fileRef = D5F809700FB093400006A4DE /* TargetConfig.m */; };
                D5F80A9D0FB0A2FF0006A4DE /* icon.icns in Resources */ = {isa = PBXBuildFile; fileRef = D5617A080FAEAF8300928B3A /* icon.icns */; };
                EE1D7C9216E01E7000B000EB /* NSView+FirstResponder.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */; };
+               EE1D7C9616E0ECCF00B000EB /* NSError+Description.m in Sources */ = {isa = PBXBuildFile; fileRef = EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -88,6 +89,8 @@
                D5F809700FB093400006A4DE /* TargetConfig.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TargetConfig.m; sourceTree = "<group>"; };
                EE1D7C9016E01E7000B000EB /* NSView+FirstResponder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSView+FirstResponder.h"; sourceTree = "<group>"; };
                EE1D7C9116E01E7000B000EB /* NSView+FirstResponder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSView+FirstResponder.m"; sourceTree = "<group>"; };
+               EE1D7C9416E0ECCF00B000EB /* NSError+Description.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = "NSError+Description.h"; sourceTree = "<group>"; };
+               EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = "NSError+Description.m"; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
                29B97315FDCFA39411CA2CEA /* Other Sources */ = {
                        isa = PBXGroup;
                        children = (
+                               EE1D7C9416E0ECCF00B000EB /* NSError+Description.h */,
+                               EE1D7C9516E0ECCF00B000EB /* NSError+Description.m */,
                                32CA4F630368D1EE00C91783 /* Enjoyable_Prefix.pch */,
                                29B97316FDCFA39411CA2CEA /* main.m */,
                                EE1D7C9016E01E7000B000EB /* NSView+FirstResponder.h */,
                                8BEFAD9C15C46BFF00823AEC /* TargetMouseScroll.m in Sources */,
                                8BEFADA015C476DC00823AEC /* TargetToggleMouseScope.m in Sources */,
                                EE1D7C9216E01E7000B000EB /* NSView+FirstResponder.m in Sources */,
+                               EE1D7C9616E0ECCF00B000EB /* NSError+Description.m in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 1f44b2f4160004ee1978cddd087b5a9b4c63032c..86806fe7a8da8652f62dc0c8b7c6fa3335d2b47d 100644 (file)
@@ -9,3 +9,4 @@
 #import <IOKit/hid/IOHIDLib.h>
 
 #import "NSView+FirstResponder.h"
+#import "NSError+Description.h"
diff --git a/NSError+Description.h b/NSError+Description.h
new file mode 100644 (file)
index 0000000..a722e9e
--- /dev/null
@@ -0,0 +1,9 @@
+#import <Foundation/Foundation.h>
+
+@interface NSError (Description)
+
++ (NSError *)errorWithDomain:(NSString *)domain
+                        code:(NSInteger)code
+                 description:(NSString *)description;
+
+@end
diff --git a/NSError+Description.m b/NSError+Description.m
new file mode 100644 (file)
index 0000000..126bb17
--- /dev/null
@@ -0,0 +1,13 @@
+#import "NSError+Description.h"
+
+@implementation NSError (Description)
+
++ (NSError *)errorWithDomain:(NSString *)domain
+                        code:(NSInteger)code
+                 description:(NSString *)description {
+    NSDictionary *errorDict = @{ NSLocalizedDescriptionKey : description };
+    return [NSError errorWithDomain:domain code:code userInfo:errorDict];
+
+}
+
+@end