Skip to content

Commit 07307c9

Browse files
committed
Input handling
1 parent 2c22eb4 commit 07307c9

File tree

1 file changed

+48
-3
lines changed

1 file changed

+48
-3
lines changed

source/GM-TE/GMTEEditor.class.st

Lines changed: 48 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -373,7 +373,7 @@ GMTEEditor >> brushButtons: anObject [
373373

374374
{
375375
#category : #building,
376-
#'squeak_changestamp' : 'TW 7/9/2024 18:15'
376+
#'squeak_changestamp' : 'mcjj 7/10/2024 16:51'
377377
}
378378
GMTEEditor >> buildWith: builder [
379379
"builds the editor with ToolBuilder"
@@ -393,7 +393,7 @@ GMTEEditor >> buildWith: builder [
393393
self createInspectorSpecWithBuilder: builder};
394394
closeAction: #onClose;
395395
minimumExtent: GMTEEditor editorMinimumExtent).
396-
396+
397397
self commandBar: (newMorph submorphNamed: 'command bar').
398398
"self commandBar vResizing: #rigid."
399399
self tileStore: (newMorph submorphNamed: 'tile store').
@@ -422,7 +422,8 @@ GMTEEditor >> buildWith: builder [
422422

423423
self
424424
initializeDefaultTileMapMatrix;
425-
associatedMorph: newMorph.
425+
associatedMorph: newMorph;
426+
setupInputHandlingFor: newMorph.
426427

427428
^ newMorph
428429
]
@@ -967,6 +968,15 @@ GMTEEditor >> disableSingleLayerButtons [
967968
GMTEEditor singleLayerActionNames do: [:aString | (self associatedMorph submorphNamed: aString) enabled: false ]
968969
]
969970

971+
{
972+
#category : #'input handling',
973+
#'squeak_changestamp' : 'mcjj 7/10/2024 16:47'
974+
}
975+
GMTEEditor >> dropKeyboardFocus: anEvent [
976+
977+
anEvent hand releaseKeyboardFocus: self associatedMorph
978+
]
979+
970980
{
971981
#category : #'as yet unclassified',
972982
#'squeak_changestamp' : 'TW 6/25/2024 17:51'
@@ -1096,6 +1106,15 @@ GMTEEditor >> getGridWidthAsString [
10961106
^ self getGridWidth asString
10971107
]
10981108

1109+
{
1110+
#category : #'input handling',
1111+
#'squeak_changestamp' : 'mcjj 7/10/2024 16:46'
1112+
}
1113+
GMTEEditor >> getKeyboardFocus: anEvent [
1114+
1115+
anEvent hand newKeyboardFocus: self associatedMorph
1116+
]
1117+
10991118
{
11001119
#category : #'layer manipulation',
11011120
#'squeak_changestamp' : 'TW 6/23/2024 21:50'
@@ -1163,6 +1182,18 @@ GMTEEditor >> getTileRatioAsString [
11631182
^ self getTileRatio asString
11641183
]
11651184

1185+
{
1186+
#category : #'input handling',
1187+
#'squeak_changestamp' : 'mcjj 7/10/2024 16:49'
1188+
}
1189+
GMTEEditor >> handleKeyStroke: anEvent [
1190+
1191+
| keyValue |
1192+
keyValue := anEvent key.
1193+
Transcript show: keyValue
1194+
"keyValue = $A"
1195+
]
1196+
11661197
{
11671198
#category : #'menu button functions',
11681199
#'squeak_changestamp' : 'TW 6/23/2024 20:09'
@@ -1985,6 +2016,20 @@ GMTEEditor >> settingsMenu [
19852016
builder open: aMenuSpec
19862017
]
19872018

2019+
{
2020+
#category : #'input handling',
2021+
#'squeak_changestamp' : 'mcjj 7/10/2024 16:49'
2022+
}
2023+
GMTEEditor >> setupInputHandlingFor: aMorph [
2024+
2025+
aMorph
2026+
on: #mouseMove send: #getKeyboardFocus: to: self;
2027+
on: #mouseLeave send: #dropKeyboardFocus: to: self;
2028+
on: #keyStroke send: #handleKeyStroke: to: self.
2029+
2030+
aMorph eventHandler wantsEveryMouseMove: true
2031+
]
2032+
19882033
{
19892034
#category : #'layer manipulation',
19902035
#'squeak_changestamp' : 'jj 6/22/2024 21:43'

0 commit comments

Comments
 (0)