[Pharo-project] Keymapping Questions
Where can I find documentation on Keymapping (if it exists)? Here are the basics I have so far: * the available set of shortcuts is per-class * a shortcut is created by creating a builder method (similar to World Menu registration) annotated with <keymap> * shortcuts are grouped into categories * categories (not individual shortcuts) are attached to Morph classes via KMBuilder>>attachShortcutCategory:to: * the system is updated when "KMPragmaKeymapBuilder uniqueInstance" resets itself via #reset (but see problems below) Questions: * What is the purpose of naming shortcuts? * Why are shortcuts held by categories as named entries and separately as keymaps? There seems to be a problem with updating shortcuts (esp. changing existing ones): * It seems that when an existing named shortcut is modified, eventually KMShortcut>>shortcutHasChangedIn:by: is called, but this method does nothing, so the shortcut never gets updated. Why is this? It seems like a bug. * When a <keymap> method is saved in OB, KMPragmaKeymapBuilder>>reset is called twice - once via AnnouncementSubscription>>deliver:, and once via KMPragmaKeymapBuilder>>event: * Because KMRepository class>>reset is never called, it becomes very dirty if shortcuts are repeatedly edited. For example, create a shortcut named "myShortcut" with Cmd+D in Category "Test", now change its name and accept the code. You will have two shortcuts with the same key combination. Now change to Cmd+E and accept again. You will have three shortcuts, even though you have only one specified in your builder method... So it seems to me to keep integrity in the shortcuts, either: * "KMRepository reset" when anything is changed, and start from scratch * or, improve KMPragmaKeymapBuilder>>reset's ability to keep the system clean. Sean -- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3990667.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
I found another bug - creating a shortcut with no modifiers e.g. "$c asShortcut" fires on c, shift-c, cmd-c... -- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3990743.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
This should not happen in the bleeding edge :) On Fri, Nov 4, 2011 at 1:34 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
I found another bug - creating a shortcut with no modifiers e.g. "$c asShortcut" fires on c, shift-c, cmd-c...
-- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3990743.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Guillermo Polito wrote:
This should not happen in the bleeding edge :)
Yes, I updated to bleedingEdge and this is fixed. I will keep playing... -- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3993303.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
On Fri, Nov 4, 2011 at 1:16 PM, Sean P. DeNigris <sean@clipperadams.com>wrote:
Where can I find documentation on Keymapping (if it exists)?
Hmmm, If you load the #bleedingEdge (which is pretty stable right now), there are several examples in the categories: Keymapping-Morph Keymapping-Editors Keymapping-Tools ... Also, most of the classes have comments, but I think I have to review them so far :).
Here are the basics I have so far: * the available set of shortcuts is per-class * a shortcut is created by creating a builder method (similar to World Menu registration) annotated with <keymap> * shortcuts are grouped into categories * categories (not individual shortcuts) are attached to Morph classes via KMBuilder>>attachShortcutCategory:to: * the system is updated when "KMPragmaKeymapBuilder uniqueInstance" resets itself via #reset (but see problems below)
Questions: * What is the purpose of naming shortcuts?
Hmm, mainly, to bind a shortcut to a setting. And nothing else by now... So I use it as a kind of id :/. Maybe someone has a better approach... I was about to review it with Mariano tomorrow.
* Why are shortcuts held by categories as named entries and separately as keymaps?
This is an idea I took from the original keymappings. I classify shortcuts in categories so you can: - attach a category to a specific class (letting its instances handle those keymaps) - attach a category to a specific instance (the same as above but in the instance level :) ) You can also attach a single shortcut in a morph like: someMorph on: aShortcut do: [ some task ] But this last (lets say) *annonimous* shortcut, can't be put into a setting.
There seems to be a problem with updating shortcuts (esp. changing existing ones): * It seems that when an existing named shortcut is modified, eventually KMShortcut>>shortcutHasChangedIn:by: is called, but this method does nothing, so the shortcut never gets updated. Why is this? It seems like a bug.
Hmm, strange. There are two implementations of this method in my image. One in KMShortcut and one in KMNoShortcut, one does nothing (on purpose with a comment :P) but the other has an implementation :/...
* When a <keymap> method is saved in OB, KMPragmaKeymapBuilder>>reset is called twice - once via AnnouncementSubscription>>deliver:, and once via KMPragmaKeymapBuilder>>event:
Hmm, I didn't knew this one :)
* Because KMRepository class>>reset is never called, it becomes very dirty if shortcuts are repeatedly edited. For example, create a shortcut named "myShortcut" with Cmd+D in Category "Test", now change its name and accept the code. You will have two shortcuts with the same key combination. Now change to Cmd+E and accept again. You will have three shortcuts, even though you have only one specified in your builder method...
So it seems to me to keep integrity in the shortcuts, either: * "KMRepository reset" when anything is changed, and start from scratch * or, improve KMPragmaKeymapBuilder>>reset's ability to keep the system clean.
I did it on purpose right now. The problem with resetting the KMContainer, is that you lose the customizations you did in the settings right now. Thinking aloud, maybe It would be good to provide two resets: - shallow reset. That resets the shortcuts but tries to remember the customizations done in the settings. This one can be done every time you modify a <keymap> annotated method. - deep reset. That just resets everything. You have to know that you are loosing everything here :). Thanks for the feedback :) Guille
Sean
-- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3990667.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Guillermo Polito wrote:
- shallow reset. That resets the shortcuts but tries to remember the customizations done in the settings. This one can be done every time you modify a <keymap> annotated method.
Thinking about this further, one of the purposes of revamping shortcuts was to remove hard-coding, so e.g. I can use my own custom shortcut to open the system browser. So the annotated builder methods are all really just defaults, to be changed on the fly as desired. As such, I think the right move is do nothing when the <keymap>s are modified. Then, all that would be needed is the deep reset, which would reset everything in the system back to defaults. Guillermo Polito wrote:
Hmmm, If you load the #bleedingEdge (which is pretty stable right now), there are several examples in the categories:
Okay, I see. All the class-side #buildXxx: methods annotated with <keymap> Guillermo Polito wrote:
Hmm, mainly, to bind a shortcut to a setting. And nothing else by now... So I use it as a kind of id :/. Maybe someone has a better approach... I was about to review it with Mariano tomorrow.
I wasn't criticizing, just learning :) Guillermo Polito wrote:
But this last (lets say) *annonimous* shortcut, can't be put into a setting.
That seems to make sense. Guillermo Polito wrote:
Hmm, strange. There are two implementations of this method in my image. One in KMShortcut and one in KMNoShortcut, one does nothing (on purpose with a comment :P) but the other has an implementation :/...
I may not be understanding correctly, but they seem backwards (i.e. NoShortcut is doing something and Shortcut is not). Although (see below)... Guillermo Polito wrote:
Thanks for the feedback :)
Thanks for all your hard work on an essential feature. -- View this message in context: http://forum.world.st/Keymapping-Questions-tp3990667p3993554.html Sent from the Pharo Smalltalk mailing list archive at Nabble.com.
Sean P. DeNigris wrote:
Guillermo Polito wrote:
Hmm, strange. There are two implementations of this method in my image. One in KMShortcut and one in KMNoShortcut, one does nothing (on purpose with a comment :P) but the other has an implementation :/...
I may not be understanding correctly, but they seem backwards (i.e. NoShortcut is doing something and Shortcut is not). Although (see below)...
Haha! You are right :). Since I introduced the concept of defaultShortcuts vs current shortcuts, that was meaningless! I only had to replace the defaultShortcut without doing any of that. Thanks! Guille, hungry of feedback :)
participants (2)
-
Guillermo Polito -
Sean P. DeNigris