Commit Graph
38 Commits
Author SHA1 Message Date
Vadim Shpakovski 639bee0e71 Remove warnings in Xcode 10.1 2019-02-27 17:16:32 +03:00
Craig Hockenberry 53186d9c74 Updates for NSAppearance 2019-02-27 17:16:32 +03:00
Pavel Kozarek 20416b0641 Swedish localization. 2018-06-11 11:48:14 +02:00
Victor b0dd8deed9 pt localization taking in consideration space constraints usually imposed by shortcut recording interfaces.
Also note that in the string: "… most shortcuts can be changed in the Keyboard & Mouse panel in System Preferences", the correct path should be Keyboard, as this pane has been split in two for a while on macOS.
2017-03-15 19:44:20 -04:00
Tony Arnold 5ef03d07de Set LD_RUNPATH_SEARCH_PATHS to more appropriate value 2016-12-07 22:37:24 +11:00
Tony Arnold 04a892f9ec Set DYLIB_INSTALL_NAME_BASE to @rpath 2016-12-07 22:32:35 +11:00
Tomáš Znamenáček 0d54ede869 Trying to fix conditional key mask definition on 10.12 2016-10-28 14:52:37 +02:00
Tomáš Znamenáček f12ed861b0 Use modern key mask constants instead of the ones deprecated in 10.12
See #99 for details.
2016-10-28 14:40:32 +02:00
Tomáš Znamenáček bf4329178d Update build warnings as suggested by Xcode 8 2016-10-28 13:10:58 +02:00
Vadim Shpakovski 928bbe25b4 Upgrade Projects to Xcode 7 2016-08-08 18:24:19 +03:00
radex 6233bfac56 Add ko, nl, pl, ru, es translations 2016-04-14 09:55:34 +02:00
Tomáš Znamenáček 69b0a06656 Added basic German localization to the demo project.
This makes it possible to test the German MASShortcut localization
on the demo project.
2016-02-10 19:13:53 +01:00
MichaelRow 8e14c20ca4 Simplified and traditional Chinese localizations. 2016-01-22 12:04:51 +08:00
shinya takahashi 09b7364130 Japanese localization 2015-10-14 18:44:06 +09:00
Tomáš Znamenáček 3cca4da610 Added basic localization for German, Spanish, French, Italian, and Japanese. 2015-09-10 09:24:41 +02:00
Tomáš Znamenáček 814934072a Added Czech localization. 2015-08-18 14:00:09 +02:00
Tomáš Znamenáček 6c4577199c Namespaced the testing build scheme name (Tests → MASShortcutTests). 2015-03-09 14:32:38 +01:00
Tom Brow d845d8cda9 module map 2015-03-08 15:12:27 -07:00
Tom Brow 2efd8d1dca DEFINES_MODULE = YES 2015-03-08 14:49:30 -07:00
Tomáš Znamenáček 27eace979e Added test for hotkeys and shortcut monitor. 2015-01-14 12:54:49 +01:00
Tomáš Znamenáček 86eff031bf Merge branch 'master' into legacy-osx-support.
Conflicts:
	CHANGES
2015-01-13 13:26:24 +01:00
Tomáš Znamenáček a045295531 Added shared Xcode schemes to help Travis with the build. 2015-01-13 09:21:58 +01:00
Tomáš Znamenáček 86a3231398 Added support for older OS X releases back to 10.6 included.
Apart from turning off Auto Layout for the Demo project, the only
thing remaining was several __weak qualifiers to prevent retain
cycles in blocks. I have replaced them with __unsafe_unretained
since __weak is not supported on 10.6. There should be no safety
concerns here, since we are certain the pointers will remain valid.
2015-01-12 17:10:20 +01:00
Vadim Shpakovski 0a0619461d Remove Xcode warnings and fix the hard-coded shortcut. 2015-01-09 22:04:10 +03:00
Tomáš Znamenáček 25d97b68c7 Removed an obsolete reference to the XCTest framework. 2015-01-09 12:58:06 +01:00
Tomáš Znamenáček 29cf3be3ad Treat build warnings as errors. 2015-01-07 16:26:49 +01:00
Tomáš Znamenáček 80808eb6d7 Updated header settings. 2015-01-07 15:42:22 +01:00
Tomáš Znamenáček 46aa323115 Added a simplified binding API for MASShortcutView.
This returns the associatedUserDefaultsKey property used in previous code
versions, only the implementation uses less magic.
2015-01-07 15:42:22 +01:00
Tomáš Znamenáček 942bbe849e Added a custom transformer to store shortcuts as dictionaries.
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).
2015-01-07 15:42:21 +01:00
Tomáš Znamenáček 444d1bccb9 Refactored the shortcut dispatcher and bindings to user defaults.
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.
2015-01-07 15:39:39 +01:00
Tomáš Znamenáček 90cf1f856c Organized classes into Xcode folders. 2015-01-07 15:27:51 +01:00
Tomáš Znamenáček 6383b05419 Introduced a standalone MASShortcutValidator class to validate shortcuts.
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.
2015-01-07 15:27:50 +01:00
Tomáš Znamenáček 1c801726d3 Converted keycode macros to plain functions.
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.
2015-01-07 15:05:12 +01:00
Tomáš Znamenáček 88392d1a69 Introduced a separate header file for keycode definitions. 2015-01-07 15:05:12 +01:00
Tomáš Znamenáček 42daeb6f12 Added a unit testing target. 2015-01-07 15:05:11 +01:00
Tomáš Znamenáček df1ae3ede0 Deleted an unneccessary prefix header for the framework target. 2015-01-07 15:05:11 +01:00
Tomáš Znamenáček 0b08de6415 Created an umbrella header.
Now you can just `#import <MASShortcut/Shortcut.h>`.
2015-01-07 15:05:11 +01:00
Tomáš Znamenáček 377b44220f Repackaged the code as a framework and included the demo.
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.
2015-01-07 15:05:11 +01:00