Short(cut) time
Yesterday and the day before i had planned to cross MercuryMover's new shortcut editor off of my todo list. As man plans, software laughs. Fear not loyal reader, for yesterday i solved the major technical problem. Before i give you the slightly technical answer, let me provide an introduction for those of you new to the Helium Foot blog. Here at Helium Foot Software, we're working on v2.0 of our flagship (and for now, only) product called MercuryMover. MercuryMover enables you to move and resize the windows on your Mac from your keyboard.
For the last few years hooking up a user interface to your Mac app's preferences has been pretty trivial thanks to Cocoa Bindings. In short, bindings provide the glue between your interface and your data (whether that data is in some persistent store such as your preferences or is just your applications's model). Unfortunately, my case is not exactly textbook since MercuryMover ships as a Preference Pane that is hosted by System Preferences. Thus, when i try to bind to my preferences, i'm bound to the preferences for System Preferences (would you prefer that i write about something else??). The solution was to create a proxy object that hosts an array of all of the Shortcuts. This array is both backed by MercuryMover's preferences and also bound to the Preference Pane. This lets the Preference Pane display the shortcut information as stored in the preferences file, and also persist changes to the same. Eagle eyed (kv) observers will note that this will keep information in sync only in one direction (from the Preference Pane to the preferences file) but not vice versa. Since the MercuryMover agent that actually moves and resizes the windows can also create shortcuts, i have said agent posting a notification via the NSDistributedNotificationCenter which the Preference Pane listens for and updates itself accordingly.
For those of you keeping score at home, here's where we stand in our run up to the v2.0 beta:
- New pop-in/pop-out animations
- cool display when shortcut is saved
- Add shortcut editor to preference pane
- fix window along the left or bottom edge +/= key unexpected behavior
- change demo so that it is based on a number of uses, not a number of days
- give pref pane a once over
- change "Advanced" tab to "Keys" and list undo, redo, center and maximize
- set the copyright year automatically at build time
- Give EULA a once over
- run through clang
Up today: Finish the shortcut editor and fix the maximize/center bugs.