-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
35 additions
and
28 deletions.
There are no files selected for viewing
63 changes: 35 additions & 28 deletions
63
packages/WindowAcrobatics-Core.package/PasteUpMorph.extension/instance/filterEvent.for..st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,39 @@ | ||
*WindowAcrobatics-Core-Events-override | ||
filterEvent: aKeyboardEvent for: anObject | ||
"Provide keyboard shortcuts." | ||
filterEvent: mouseOrKeyboardEvent for: anObject | ||
|
||
"Delegate keyboard shortcuts to my docking bars." | ||
self submorphsDo: [:ea | ea isDockingBar ifTrue: [ | ||
ea filterEvent: aKeyboardEvent for: anObject. "No support for converting events here!" | ||
aKeyboardEvent wasIgnored ifTrue: [^ aKeyboardEvent "early out"]]]. | ||
"1) Mouse shortcuts" | ||
mouseOrKeyboardEvent isMouse ifTrue: [ | ||
|
||
aKeyboardEvent isKeystroke | ||
ifFalse: [^ aKeyboardEvent]. | ||
|
||
aKeyboardEvent commandKeyPressed ifTrue: [ | ||
(WAHandler new handle: aKeyboardEvent) ifTrue: [^ aKeyboardEvent ignore "hit!"]. | ||
]. | ||
"Only accept mouse down, no up." | ||
mouseOrKeyboardEvent isMouseDown | ||
ifFalse: [^ mouseOrKeyboardEvent]. | ||
|
||
mouseOrKeyboardEvent blueButtonPressed | ||
ifTrue: [ self tryInvokeHalo: mouseOrKeyboardEvent] | ||
ifFalse: [mouseOrKeyboardEvent controlKeyPressed | ||
ifTrue: [self tryInvokeMetaMenu: mouseOrKeyboardEvent]]. | ||
|
||
^ mouseOrKeyboardEvent]. | ||
|
||
"2) Keyboard shortcuts" | ||
mouseOrKeyboardEvent commandKeyPressed ifTrue: [ | ||
(WAHandler new handle: mouseOrKeyboardEvent) | ||
ifTrue: [^ mouseOrKeyboardEvent ignore "hit!"]]. | ||
|
||
mouseOrKeyboardEvent isKeyboard ifTrue: [ | ||
|
||
aKeyboardEvent commandKeyPressed ifTrue: [ | ||
aKeyboardEvent keyCharacter caseOf: { | ||
[$R] -> [Utilities browseRecentSubmissions. Transcript show: 'Hello']. | ||
[$L] -> [self findAFileList: aKeyboardEvent]. | ||
[$O] -> [self findAMonticelloBrowser]. | ||
[$P] -> [self findAPreferencesPanel: aKeyboardEvent]. | ||
"[$Z] -> [ChangeList browseRecentLog]." | ||
[$]] -> [Smalltalk snapshot: true andQuit: false]. | ||
[$+] -> [Preferences increaseFontSize]. | ||
[$-] -> [Preferences decreaseFontSize]. | ||
[$=] -> [Preferences restoreDefaultFonts]. | ||
} otherwise: [^ aKeyboardEvent "no hit"]. | ||
|
||
^ aKeyboardEvent ignore "hit!"]. | ||
|
||
^ aKeyboardEvent "no hit" | ||
"Delegate keyboard shortcuts to my docking bars." | ||
self submorphsDo: [:ea | ea isDockingBar ifTrue: [ | ||
ea filterEvent: mouseOrKeyboardEvent for: anObject. "No support for converting events here!" | ||
mouseOrKeyboardEvent wasIgnored ifTrue: [^ mouseOrKeyboardEvent "early out"]]]. | ||
|
||
"Only accept key strokes as shortcuts, no down/up." | ||
mouseOrKeyboardEvent isKeystroke | ||
ifFalse: [^ mouseOrKeyboardEvent]. | ||
|
||
self tryInvokeKeyboardShortcut: mouseOrKeyboardEvent. | ||
|
||
^ mouseOrKeyboardEvent]. | ||
|
||
"Should not be necessary if this filter is correctly configured." | ||
^ mouseOrKeyboardEvent |