Issue 2451: Make Algernon work in Pharo 1.1

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Issue 2451: Make Algernon work in Pharo 1.1

Guillermo Polito
Hi, i was looking at this issue and I have some questions :):

- There are some changes to HandMorph in a changeset hardcoded in the ConfigurationOfAlgernon.  As Mariano said here (http://forum.world.st/Putting-Algernon-and-WorkingSet-in-a-Dev-image-td1295930.html#a1295941)  "The main change does the simples modifications to HandMorph for it to support various focus holders".  Is it safe to integrate it in Pharo?  If so, should it be integrated in the core Morph package?   The changeset is the following:

 '''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''!
'

It should be nice someone who knows well morphic checks it.

Cheers,
Guille

_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2451: Make Algernon work in Pharo 1.1

Mariano Martinez Peck
Hi Guille. Yes, some months ago I discovered that changeset. I separated it, saved into a .ch, loaded it into a PharoCore clean image and I tried to understood it.
My knoweldege about Morhpic is very limited, but the changed looked of for me.

What would be cool is to commit to inbox such changes. Create an issue like "support various focus holders for HandMorph "
Then, send a separated mail about this changes and get feedback. If agree, we can integrate it in the core. With this, at least Algernon doesn't have to do such hack.

I also asked this to Romian as he was developing WorkingSet and the problem was that you couldn't have both at the same time because of the shortcuts. These changes may solve that. Although he didn't have time to look at it.

Cheers

Mariano

On Mon, Jun 7, 2010 at 5:54 AM, Guillermo Polito <[hidden email]> wrote:
Hi, i was looking at this issue and I have some questions :):

- There are some changes to HandMorph in a changeset hardcoded in the ConfigurationOfAlgernon.  As Mariano said here (http://forum.world.st/Putting-Algernon-and-WorkingSet-in-a-Dev-image-td1295930.html#a1295941)  "The main change does the simples modifications to HandMorph for it to support various focus holders".  Is it safe to integrate it in Pharo?  If so, should it be integrated in the core Morph package?   The changeset is the following:

 '''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''!
'

It should be nice someone who knows well morphic checks it.

Cheers,
Guille


_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project
Reply | Threaded
Open this post in threaded view
|

Re: Issue 2451: Make Algernon work in Pharo 1.1

Mariano Martinez Peck
Sorry I forget to send the thread:

http://forum.world.st/Putting-Algernon-and-WorkingSet-in-a-Dev-image-td1295930.html#a2068260

Cheers

Mariano

On Mon, Jun 7, 2010 at 9:33 AM, Mariano Martinez Peck <[hidden email]> wrote:
Hi Guille. Yes, some months ago I discovered that changeset. I separated it, saved into a .ch, loaded it into a PharoCore clean image and I tried to understood it.
My knoweldege about Morhpic is very limited, but the changed looked of for me.

What would be cool is to commit to inbox such changes. Create an issue like "support various focus holders for HandMorph "
Then, send a separated mail about this changes and get feedback. If agree, we can integrate it in the core. With this, at least Algernon doesn't have to do such hack.

I also asked this to Romian as he was developing WorkingSet and the problem was that you couldn't have both at the same time because of the shortcuts. These changes may solve that. Although he didn't have time to look at it.

Cheers

Mariano


On Mon, Jun 7, 2010 at 5:54 AM, Guillermo Polito <[hidden email]> wrote:
Hi, i was looking at this issue and I have some questions :):

- There are some changes to HandMorph in a changeset hardcoded in the ConfigurationOfAlgernon.  As Mariano said here (http://forum.world.st/Putting-Algernon-and-WorkingSet-in-a-Dev-image-td1295930.html#a1295941)  "The main change does the simples modifications to HandMorph for it to support various focus holders".  Is it safe to integrate it in Pharo?  If so, should it be integrated in the core Morph package?   The changeset is the following:

 '''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''!
'

It should be nice someone who knows well morphic checks it.

Cheers,
Guille



_______________________________________________
Pharo-project mailing list
[hidden email]
http://lists.gforge.inria.fr/cgi-bin/mailman/listinfo/pharo-project