Skip to content

Commit

Permalink
Merge c6a340d into 1308e85
Browse files Browse the repository at this point in the history
  • Loading branch information
LinqLover committed May 18, 2019
2 parents 1308e85 + c6a340d commit 7a60e4f
Showing 1 changed file with 35 additions and 28 deletions.
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

0 comments on commit 7a60e4f

Please sign in to comment.