Skip to content

Commit

Permalink
Make cut and paste work in the Settings window.
Browse files Browse the repository at this point in the history
No more typing in passwords; yay. See
http://www.shipsomecode.com/software/enabling-keyboard-shortcuts-with-nsstatusitems/
for background on the solution.
  • Loading branch information
precipice committed Jul 27, 2011
1 parent 497206d commit 6c39e0d
Show file tree
Hide file tree
Showing 3 changed files with 199 additions and 7 deletions.
1 change: 1 addition & 0 deletions Dragon's Breath/DBStatusMenu.h
Expand Up @@ -26,6 +26,7 @@
<DBStatusFeedDelegate, DBGameDelegate, DBPreferencesDelegate,
GrowlApplicationBridgeDelegate> {
IBOutlet NSMenu *statusMenu;
IBOutlet NSMenu *editMenu;
NSStatusItem *statusItem;
NSImage *statusImage;
NSImage *statusHighlightImage;
Expand Down
1 change: 1 addition & 0 deletions Dragon's Breath/DBStatusMenu.m
Expand Up @@ -31,6 +31,7 @@ - (void)awakeFromNib {

[statusItem setMenu:statusMenu];
[statusMenu setAutoenablesItems:NO];
[NSApp setMainMenu:editMenu];

// Listen for events when the computer wakes from sleep, which otherwise
// throws off the refresh schedule.
Expand Down
204 changes: 197 additions & 7 deletions Dragon's Breath/en.lproj/MainMenu.xib
Expand Up @@ -150,6 +150,69 @@
<object class="NSCustomObject" id="181977964">
<string key="NSClassName">DBStatusMenu</string>
</object>
<object class="NSMenu" id="78137932">
<string key="NSTitle"/>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMenu" id="46729224">
<string key="NSTitle"/>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="1004523886">
<reference key="NSMenu" ref="46729224"/>
<string key="NSTitle">Edit</string>
<string key="NSKeyEquiv"/>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="634942898"/>
<reference key="NSMixedImage" ref="747417796"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="454940245">
<string key="NSTitle">Edit</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="124229534">
<reference key="NSMenu" ref="454940245"/>
<string key="NSTitle">Cut</string>
<string key="NSKeyEquiv">x</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="634942898"/>
<reference key="NSMixedImage" ref="747417796"/>
</object>
<object class="NSMenuItem" id="691643899">
<reference key="NSMenu" ref="454940245"/>
<string key="NSTitle">Copy</string>
<string key="NSKeyEquiv">c</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="634942898"/>
<reference key="NSMixedImage" ref="747417796"/>
</object>
<object class="NSMenuItem" id="873376803">
<reference key="NSMenu" ref="454940245"/>
<string key="NSTitle">Paste</string>
<string key="NSKeyEquiv">v</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="634942898"/>
<reference key="NSMixedImage" ref="747417796"/>
</object>
<object class="NSMenuItem" id="987498006">
<reference key="NSMenu" ref="454940245"/>
<string key="NSTitle">Select All</string>
<string key="NSKeyEquiv">a</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="634942898"/>
<reference key="NSMixedImage" ref="747417796"/>
</object>
</object>
</object>
</object>
</object>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
Expand Down Expand Up @@ -218,6 +281,46 @@
</object>
<int key="connectionID">559</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">copy:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="691643899"/>
</object>
<int key="connectionID">691</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">cut:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="124229534"/>
</object>
<int key="connectionID">692</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">paste:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="873376803"/>
</object>
<int key="connectionID">697</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">selectAll:</string>
<reference key="source" ref="1014"/>
<reference key="destination" ref="987498006"/>
</object>
<int key="connectionID">710</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">editMenu</string>
<reference key="source" ref="181977964"/>
<reference key="destination" ref="46729224"/>
</object>
<int key="connectionID">720</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
Expand Down Expand Up @@ -329,6 +432,64 @@
<reference key="object" ref="848429245"/>
<reference key="parent" ref="845255305"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">560</int>
<reference key="object" ref="78137932"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">640</int>
<reference key="object" ref="46729224"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1004523886"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">644</int>
<reference key="object" ref="1004523886"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="454940245"/>
</object>
<reference key="parent" ref="46729224"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">645</int>
<reference key="object" ref="454940245"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="124229534"/>
<reference ref="691643899"/>
<reference ref="873376803"/>
<reference ref="987498006"/>
</object>
<reference key="parent" ref="1004523886"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">649</int>
<reference key="object" ref="124229534"/>
<reference key="parent" ref="454940245"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">650</int>
<reference key="object" ref="691643899"/>
<reference key="parent" ref="454940245"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">651</int>
<reference key="object" ref="873376803"/>
<reference key="parent" ref="454940245"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">654</int>
<reference key="object" ref="987498006"/>
<reference key="parent" ref="454940245"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
Expand All @@ -352,6 +513,10 @@
<string>553.IBPluginDependency</string>
<string>554.IBPluginDependency</string>
<string>555.IBPluginDependency</string>
<string>560.IBPluginDependency</string>
<string>640.IBPluginDependency</string>
<string>644.IBPluginDependency</string>
<string>645.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
Expand All @@ -372,6 +537,10 @@
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
Expand All @@ -386,7 +555,7 @@
<reference key="dict.values" ref="0"/>
</object>
<nil key="sourceID"/>
<int key="maxID">559</int>
<int key="maxID">720</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
Expand Down Expand Up @@ -448,14 +617,35 @@
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<string key="NS.key.0">statusMenu</string>
<string key="NS.object.0">NSMenu</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>editMenu</string>
<string>statusMenu</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>NSMenu</string>
<string>NSMenu</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<string key="NS.key.0">statusMenu</string>
<object class="IBToOneOutletInfo" key="NS.object.0">
<string key="name">statusMenu</string>
<string key="candidateClassName">NSMenu</string>
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>editMenu</string>
<string>statusMenu</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">editMenu</string>
<string key="candidateClassName">NSMenu</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">statusMenu</string>
<string key="candidateClassName">NSMenu</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
Expand Down

0 comments on commit 6c39e0d

Please sign in to comment.