Skip to content
Browse files

added Delete menu item

  • Loading branch information...
1 parent 1b97828 commit ec7929229bea688a2e0311018791ad914a995c0c @mattrajca mattrajca committed Feb 25, 2013
Showing with 75 additions and 16 deletions.
  1. +60 −15 English.lproj/PXPatternEditor.xib
  2. +15 −1 Pixen Application/Tools/Patterns/PXPatternEditorController.m
View
75 English.lproj/PXPatternEditor.xib
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="8.00">
<data>
- <int key="IBDocument.SystemTarget">1060</int>
+ <int key="IBDocument.SystemTarget">1080</int>
<string key="IBDocument.SystemVersion">12C3012</string>
<string key="IBDocument.InterfaceBuilderVersion">3084</string>
<string key="IBDocument.AppKitVersion">1187.34</string>
@@ -17,6 +17,8 @@
<string>NSCollectionViewItem</string>
<string>NSCustomObject</string>
<string>NSCustomView</string>
+ <string>NSMenu</string>
+ <string>NSMenuItem</string>
<string>NSScrollView</string>
<string>NSScroller</string>
<string>NSSplitView</string>
@@ -289,7 +291,7 @@
<reference key="NSWindow"/>
<reference key="NSNextKeyView" ref="214384056"/>
</object>
- <string key="NSScreenRect">{{0, 0}, {2560, 1418}}</string>
+ <string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{10000000000000, 10000000000000}</string>
<string key="NSFrameAutosaveName">PatternEditor</string>
<bool key="NSAutorecalculatesContentBorderThicknessMinY">NO</bool>
@@ -299,6 +301,25 @@
<object class="NSCollectionViewItem" id="1062859766">
<string key="NSNibName">PXPatternItem</string>
</object>
+ <object class="NSMenu" id="700044385">
+ <string key="NSTitle"/>
+ <array class="NSMutableArray" key="NSMenuItems">
+ <object class="NSMenuItem" id="103169189">
+ <reference key="NSMenu" ref="700044385"/>
+ <string key="NSTitle">Delete...</string>
+ <string key="NSKeyEquiv"/>
+ <int key="NSMnemonicLoc">2147483647</int>
+ <object class="NSCustomResource" key="NSOnImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuCheckmark</string>
+ </object>
+ <object class="NSCustomResource" key="NSMixedImage">
+ <string key="NSClassName">NSImage</string>
+ <string key="NSResourceName">NSMenuMixedState</string>
+ </object>
+ </object>
+ </array>
+ </object>
</array>
<object class="IBObjectContainer" key="IBDocument.Objects">
<array class="NSMutableArray" key="connectionRecords">
@@ -343,6 +364,14 @@
<int key="connectionID">64</int>
</object>
<object class="IBConnectionRecord">
+ <object class="IBActionConnection" key="connection">
+ <string key="label">deletePattern:</string>
+ <reference key="source" ref="1001"/>
+ <reference key="destination" ref="103169189"/>
+ </object>
+ <int key="connectionID">70</int>
+ </object>
+ <object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="866328524"/>
@@ -358,6 +387,14 @@
</object>
<int key="connectionID">23</int>
</object>
+ <object class="IBConnectionRecord">
+ <object class="IBOutletConnection" key="connection">
+ <string key="label">menu</string>
+ <reference key="source" ref="866328524"/>
+ <reference key="destination" ref="700044385"/>
+ </object>
+ <int key="connectionID">69</int>
+ </object>
</array>
<object class="IBMutableOrderedSet" key="objectRecords">
<array key="orderedObjects">
@@ -495,6 +532,19 @@
<reference key="object" ref="638439009"/>
<reference key="parent" ref="1065111099"/>
</object>
+ <object class="IBObjectRecord">
+ <int key="objectID">65</int>
+ <reference key="object" ref="700044385"/>
+ <array class="NSMutableArray" key="children">
+ <reference ref="103169189"/>
+ </array>
+ <reference key="parent" ref="0"/>
+ </object>
+ <object class="IBObjectRecord">
+ <int key="objectID">66</int>
+ <reference key="object" ref="103169189"/>
+ <reference key="parent" ref="700044385"/>
+ </object>
</array>
</object>
<dictionary class="NSMutableDictionary" key="flattenedProperties">
@@ -532,12 +582,14 @@
<string key="48.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="5.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="6.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="65.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
+ <string key="66.IBPluginDependency">com.apple.InterfaceBuilder.CocoaPlugin</string>
</dictionary>
<dictionary class="NSMutableDictionary" key="unlocalizedProperties"/>
<nil key="activeLocalization"/>
<dictionary class="NSMutableDictionary" key="localizations"/>
<nil key="sourceID"/>
- <int key="maxID">64</int>
+ <int key="maxID">70</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<array class="NSMutableArray" key="referencedPartialClassDescriptions">
@@ -617,19 +669,12 @@
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
- <real value="1060" key="NS.object.0"/>
- </object>
- <object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
- <string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
- <real value="4000" key="NS.object.0"/>
- </object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
- <object class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
- <string key="NS.key.0">NSAddTemplate</string>
- <string key="NS.object.0">{8, 8}</string>
- </object>
+ <dictionary class="NSMutableDictionary" key="IBDocument.LastKnownImageSizes">
+ <string key="NSAddTemplate">{8, 8}</string>
+ <string key="NSMenuCheckmark">{11, 11}</string>
+ <string key="NSMenuMixedState">{10, 3}</string>
+ </dictionary>
</data>
</archive>
View
16 Pixen Application/Tools/Patterns/PXPatternEditorController.m
@@ -158,7 +158,16 @@ - (void)reloadPatterns
_loadedPatterns = YES;
}
-- (void)deleteKeyPressedInCollectionView:(NSCollectionView *)view
+- (BOOL)validateMenuItem:(NSMenuItem *)menuItem
+{
+ if ([menuItem action] == @selector(deletePattern:)) {
+ return [_patternsController selectionIndex] != NSNotFound;
+ }
+
+ return NO;
+}
+
+- (IBAction)deletePattern:(id)sender
{
if ([_patternsController selectionIndex] == NSNotFound)
return;
@@ -178,6 +187,11 @@ - (void)deleteKeyPressedInCollectionView:(NSCollectionView *)view
contextInfo:nil];
}
+- (void)deleteKeyPressedInCollectionView:(NSCollectionView *)view
+{
+ [self deletePattern:view];
+}
+
- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context
{
if ([keyPath isEqualToString:@"selectionIndexes"]) {

0 comments on commit ec79292

Please sign in to comment.
Something went wrong with that request. Please try again.