[ANN][KeyBinder] New KeyBinder release on SqueakMap

Hernan Tylim htylim at yahoo.com.ar
Mon Aug 16 23:00:53 UTC 2004


Hi Steven, 

	The answer is absolutely.

	KeyBinder was builded because it was fun but mainly because I
wanted to see if the changes to HandMorph were ok and I think that they
are.

	So I would really like to see this changes (the one I am
attaching) being incorporated to Keymapper and have in this way global
keybindings as we have today the paragraph keybindings.

Regards,
Hernán

> -----Original Message-----
> From: squeak-dev-bounces at lists.squeakfoundation.org 
> [mailto:squeak-dev-bounces at lists.squeakfoundation.org] On 
> Behalf Of Steven Swerling
> Sent: Monday, August 16, 2004 4:24 PM
> To: The general-purpose Squeak developers list
> Subject: Re: [ANN][KeyBinder] New KeyBinder release on SqueakMap
> 
> 
> Hi Hernan,
> 
> This is a very nice solution for global keybindings. Any interest in 
> merging it with parts of the KeyMapping package to enable multi-key 
> keybindings?
> 
> Steve S
> 
> Hernan Tylim wrote:
> > Hi, 
> > 	Thanks to Jon Hylands invaluable help I announce you a new
> > release of KeyBinder on SqueakMap.
> > 
> > This version is now ready for massive use and I invite you 
> to do so. If
> > you install KeyBinder you will find:
> > 
> > - A very simple and minimalist GUI for creating, editing 
> and removing
> > custom key-bindings.
> > - A couple of Key-Bindings examples which you can use as 
> guide to create
> > your owns.
> > - A visual WindowSwitcher like the Task Switcher on 
> Windows. This one is
> > installed as default on the <cmd>-W keystroke. To use it just press
> > <cmd>-W and hold the <cmd> key as you do with the alt-tab 
> on windows.
> > 
> > I hope you like it and have fun with it, I had fun making it.
> > 
> > Regards, 
> > Hernán 
> > 
> > 
> > 
> 
> 
-------------- next part --------------
'From Squeak3.7gamma of ''17 July 2004'' [latest update: #5985] on 9 August 2004 at 7:56:10 pm'!
"Change Set:		MultipleFocusHolder-hpt
Date:			9 August 2004
Author:			Hernan Tylim

This changesets does the simplest modifications to HandMorph for it to support various focus holders.

The important changes are:

* addiionalKeyboardFocuses instance variable was added with its getter and setter methods.

* HandMorph>>sendKeyboardEvent: was changed to traverse the list of keyboard focus holders and call HandMorph>>sendEvent:focus:clear: to each one of them.

* HandMorph>>sendEvent:focus:clear: was changed to preserve the 'wasHandled' status of the event, before that info were lost because the Event instance were copied before passed to the Morph. 
"!

Morph subclass: #HandMorph
	instanceVariableNames: 'mouseFocus keyboardFocus eventListeners mouseListeners keyboardListeners mouseClickState mouseOverHandler lastMouseEvent targetOffset damageRecorder cacheCanvas cachedCanvasHasHoles temporaryCursor temporaryCursorOffset hasChanged savedPatch userInitials lastEventBuffer genieGestureProcessor additionalKeyboardFocuses '
	classVariableNames: 'DoubleClickTime EventStats NewEventRules NormalCursor PasteBuffer ShowEvents '
	poolDictionaries: 'EventSensorConstants'
	category: 'Morphic-Kernel'!

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/8/2004 01:52'!
addAdditionalKeyboardFocus: aMorph
	(self additionalKeyboardFocuses includes: aMorph)
		ifFalse: [self additionalKeyboardFocuses addFirst: aMorph]! !

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/7/2004 23:47'!
additionalKeyboardFocuses
	^additionalKeyboardFocuses ifNil: [additionalKeyboardFocuses _ OrderedCollection new].! !

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/8/2004 00:12'!
clearFocusHolder: aMorph
	self keyboardFocus == aMorph
		ifTrue: 	[^self keyboardFocus: nil].
	(self additionalKeyboardFocuses includes: aMorph)
		ifTrue: [self removeAdditionalKeyboardFocus: aMorph].! !

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/7/2004 23:48'!
fullKeyboardFocuses
	^self additionalKeyboardFocuses copyWith: self keyboardFocus.! !

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/7/2004 23:43'!
keyboardFocuses
	keyboardFocuses ifNil: [keyboardFocuses := OrderedCollection new].
	^keyboardFocuses! !

!HandMorph methodsFor: 'focus handling' stamp: 'hpt 8/7/2004 23:49'!
removeAdditionalKeyboardFocus: aMorph
	self additionalKeyboardFocuses remove: aMorph! !

!HandMorph methodsFor: 'private events' stamp: 'hpt 8/8/2004 01:18'!
sendFocusEvent: anEvent to: focusHolder clear: aBlock
	"Send the event to the morph currently holding the focus"
	| result w e |
	w _ focusHolder world ifNil:[^ aBlock value].
	w becomeActiveDuring:[
		ActiveHand _ self.
		ActiveEvent _ anEvent.
		e _ (anEvent transformedBy: (focusHolder transformedFrom: self)).
		result _ focusHolder handleFocusEvent: e	.
		anEvent wasHandled: e wasHandled.
	].
	^result! !

!HandMorph methodsFor: 'private events' stamp: 'hpt 8/8/2004 01:09'!
sendKeyboardEvent: anEvent
	"Send the event to the morph currently holding the focus, or if none to the owner of the hand."

	self fullKeyboardFocuses do: [:focusHolder |
		"(anEvent keyCharacter = $\) ifTrue: [self halt]."
		anEvent wasHandled
			ifFalse: [self sendEvent: anEvent focus: focusHolder clear:[self clearFocusHolder: focusHolder]]].! !

Morph subclass: #HandMorph
	instanceVariableNames: 'mouseFocus keyboardFocus eventListeners mouseListeners keyboardListeners mouseClickState mouseOverHandler lastMouseEvent targetOffset damageRecorder cacheCanvas cachedCanvasHasHoles temporaryCursor temporaryCursorOffset hasChanged savedPatch userInitials lastEventBuffer genieGestureProcessor additionalKeyboardFocuses'
	classVariableNames: 'DoubleClickTime EventStats NewEventRules NormalCursor PasteBuffer ShowEvents'
	poolDictionaries: 'EventSensorConstants'
	category: 'Morphic-Kernel'!


More information about the Squeak-dev mailing list