| Age | Commit message (Collapse) | Author | 
|---|
|  | This adds a really simple API to set up some bindings without having
to keep a binder instance around by hand. If somebody wants to, it’s
not a problem to allocate a separate instance and have precise control
over its lifetime. | 
|  | This makes it possible to make a difference between “shortcut not
set, use default” and “shortcut set to none”. | 
|  |  | 
|  |  | 
|  | The MASDictionaryTransformer class is used to save shortcuts to
user defaults (and load them back) using a simple dictionary. The
value stored in the user defaults looks like this:
$ defaults read com.shpakovski.mac.Demo
{
    MASDemoShortcut =     {
        keyCode = 15;
        modifierFlags = 1048576;
    };
    …
}
This storage format has got the distinct advantage of being compatible
with the format used by Shortcut Recorder. In order to use it, you
have to set proper binding options for MASShortcutBinder and the
recorder control (MASShortcutView). | 
|  | This makes it possible to customize the way the shortcuts are stored
in user defaults. The default options call for the keyed archiver
transformer, deserializing the shortcuts from NSData. | 
|  | There can only be one Carbon event handler, so it doesn’t make sense
to create multiple instances of the shortcut monitor. | 
|  | The “appearance” property didn’t play nice with auto-synthesizing,
not really sure why. | 
|  | This is a big change that was hard to split into smaller commits. There’s now
a new class to bind shortcuts to actions, a new class to bind user defaults’
keys to actions, and a new way to associate user defaults with the recorder
control (MASShortcutView). I have also updated the demo app to go with the
changes.
The new class to associate shortcuts with actions is called MASShortcutMonitor.
It wraps the Carbon hotkey magic and offers a simple interface to add a
shortcut along with a block that should be run when the shortcut is pressed.
It’s the lowest-level interface.
Since the usual requirement is to store the shortcuts into user defaults,
there’s also a higher-level interface offered by the MASShortcutBinder class.
That takes a defaults key and associates it with a block. When the shortcut
stored under the defaults key changes, the binder automatically switches to the
new shortcut. The class is a wrapper built atop of the previous one, the
MASShortcutMonitor – it simply adds, updates and removes shortcuts as the
user defaults change.
I have removed the special user defaults integration code from the recorder
control (MASShortcutView) and replaced it with a small Cocoa Bindings shim.
This means that in order to keep the recorder control in sync with the defaults
you just have to call the usual bind:toObject:withKeyPath:options: method,
like this:
[_shortcutView bind:MASShortcutBinding
    toObject:[NSUserDefaultsController sharedUserDefaultsController]
    withKeyPath[@"values.ExampleDefaultsKey"
    options:@{NSValueTransformerNameBindingOption:NSKeyedUnarchiveFromDataTransformerName}];
That’s more verbose than the previous solution, but it’s much cleaner and can
be swept under a convenience call if needed. I might also add a dictionaryValue
property later that would make it possible to bind the value to user defaults
directly, without a transformer, and would enable backward compatibility with
Shortcut Recorder. | 
|  | It’s not needed now the class is effectively immutable. | 
|  | Shortcuts are equal if and only if their key codes and modifier flags are. | 
|  | A shortcut is a good value type, it makes good sense to represent it
using an immutable object like NSNumber or NSString. | 
|  | This makes it possible to use shortcuts as collection keys. | 
|  |  | 
|  | Using NSKeyedUnarchiver and NSKeyedArchiver directly is almost the
same amount of typing and it’s much clearer what goes on. | 
|  | Forgot one `instancetype`, added `static` to NSString constants,
removed unneccessary @synthesize directives. | 
|  | It was never used and the recording can already be cancelled by Esc. | 
|  |  | 
|  | It’s a natural simplification of the MASShortcut class. All MASShortcutView
objects use a shared validator by default, but can be reconfigured to use a
different validator if needed through the shortcutValidator property. | 
|  | Plain functions are less prone to bugs, the compiler understands
them better and can offer better error messages, and plain functions
can be refactored more easily. | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | Now you can just `#import <MASShortcut/Shortcut.h>`. | 
|  | Packaging the code as a framework is mostly just a formality. It doesn’t
really change much, it just turns the code into a regular component.
What it does change is that the code now has its own Xcode settings,
which could make compatibility easier in the long run.
Including the demo in the main repository makes it easier to hack on
the library, since you can try the changes immediately. It also shows
how to bundle the framework into an app that uses it. | 
|  | Flat button style | 
|  |  | 
|  | Hides the button border and background; good for placing several shortcut buttons into a table view. | 
|  | Fix "Parse issue: Semicolon before method body is ignored" | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | Implemented initWithCoder: to fix #44 | 
|  |  | 
|  |  | 
|  |  | 
|  |  | 
|  | allow [MODIFIER]+ESC shortcuts | 
|  | only naked ESC without modifiers should cancel editing
http://discuss.binaryage.com/t/cant-change-activation-key-to-control-esc
tested in TotalTerminal codebase | 
|  | Fixed compiling with projects that don't use a precompiled header. | 
|  | Create MASShortcut.podspec for CocoaPods | 
|  |  | 
|  |  | 
|  | Replace deprecated NSRunCriticalAlertPanel with NSAlert | 
|  | - Now using modern API
- The dialog is now shown as a modal sheet, which suits better
- The alert style is changed to NSWarningAlertStyle,
- NSCriticalAlertStyle was not required | 
|  | Fixed string literal warning |