Cursor.st
changeset 2474 bddae0850c56
parent 2473 2d4b51e6eb48
child 2482 7e1e4eaa5ce6
equal deleted inserted replaced
2473:2d4b51e6eb48 2474:bddae0850c56
  2730 
  2730 
  2731 newOn:aDevice
  2731 newOn:aDevice
  2732     "create a new Cursor representing the same cursor as
  2732     "create a new Cursor representing the same cursor as
  2733      myself on aDevice. Dont search the lobby."
  2733      myself on aDevice. Dont search the lobby."
  2734 
  2734 
  2735     |newCursor id sF mF w h|
  2735     |newCursor id sF mF w h deviceSf deviceMf|
  2736 
  2736 
  2737     "ask that device for the cursor"
  2737     "ask that device for the cursor"
  2738     shape notNil ifTrue:[
  2738     shape notNil ifTrue:[
  2739         id := aDevice createCursorShape:shape.
  2739         id := aDevice createCursorShape:shape.
  2740         id isNil ifTrue:[
  2740         id isNil ifTrue:[
  2742             ^ self
  2742             ^ self
  2743         ].
  2743         ].
  2744     ] ifFalse:[
  2744     ] ifFalse:[
  2745         aDevice needDeviceFormsForCursor ifTrue:[
  2745         aDevice needDeviceFormsForCursor ifTrue:[
  2746             sourceForm notNil ifTrue:[
  2746             sourceForm notNil ifTrue:[
  2747                 sF := sourceForm asFormOn:aDevice.
  2747                 sF := deviceSf := sourceForm asFormOn:aDevice.
  2748             ].
  2748             ].
  2749             maskForm notNil ifTrue:[
  2749             maskForm notNil ifTrue:[
  2750                 mF := maskForm asFormOn:aDevice.
  2750                 mF := deviceMf := maskForm asFormOn:aDevice.
  2751             ] ifFalse:[
  2751             ] ifFalse:[
  2752                 mF := sF
  2752                 mF := sF
  2753             ].
  2753             ].
  2754             (sF notNil and:[mF notNil]) ifTrue:[
       
  2755                 device == aDevice ifTrue:[
       
  2756                     sourceForm := sF.
       
  2757                     maskForm := mF.
       
  2758                 ]
       
  2759             ].
       
  2760         ] ifFalse:[
  2754         ] ifFalse:[
  2761             sourceForm notNil ifTrue:[
  2755             sourceForm notNil ifTrue:[
  2762                 sF := sourceForm bits
  2756                 sF := sourceForm bits.
       
  2757                 deviceSf := sourceForm.
  2763             ].
  2758             ].
  2764             maskForm notNil ifTrue:[
  2759             maskForm notNil ifTrue:[
  2765                 mF := maskForm bits.
  2760                 mF := maskForm bits.
       
  2761                 deviceMf := maskForm.
  2766             ] ifFalse:[
  2762             ] ifFalse:[
  2767                 mF := sF
  2763                 mF := sF
  2768             ].
  2764             ].
  2769         ].
  2765         ].
  2770         (sF isNil or:[mF isNil]) ifTrue:[
  2766         (sF isNil or:[mF isNil]) ifTrue:[
  2793 
  2789 
  2794     device isNil ifTrue:[
  2790     device isNil ifTrue:[
  2795         "receiver was not associated - do it now"
  2791         "receiver was not associated - do it now"
  2796         device := aDevice.
  2792         device := aDevice.
  2797         cursorId := id.
  2793         cursorId := id.
       
  2794         sourceForm := deviceSf.
       
  2795         maskForm := deviceMf.
  2798 
  2796 
  2799         "must re-register, the old registration had a nil cursorId in it"
  2797         "must re-register, the old registration had a nil cursorId in it"
  2800         Lobby registerChange:self.
  2798         Lobby registerChange:self.
  2801         ^ self
  2799         ^ self
  2802     ].
  2800     ].
  2804     "receiver was already associated to another device - need a new cursor"
  2802     "receiver was already associated to another device - need a new cursor"
  2805     newCursor := self class basicNew.
  2803     newCursor := self class basicNew.
  2806     shape notNil ifTrue:[
  2804     shape notNil ifTrue:[
  2807         newCursor setShape:shape.
  2805         newCursor setShape:shape.
  2808     ] ifFalse:[
  2806     ] ifFalse:[
  2809         newCursor setSourceForm:sourceForm
  2807         newCursor setSourceForm:deviceSf
  2810                        maskForm:maskForm
  2808                        maskForm:deviceMf
  2811                            hotX:hotX
  2809                            hotX:hotX
  2812                            hotY:hotY
  2810                            hotY:hotY
  2813     ].
  2811     ].
  2814     newCursor setDevice:aDevice id:id.
  2812     newCursor setDevice:aDevice id:id.
  2815     Lobby register:newCursor.
  2813     Lobby register:newCursor.
  2858 ! !
  2856 ! !
  2859 
  2857 
  2860 !Cursor class methodsFor:'documentation'!
  2858 !Cursor class methodsFor:'documentation'!
  2861 
  2859 
  2862 version
  2860 version
  2863     ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.63 1999-02-25 23:26:53 cg Exp $'
  2861     ^ '$Header: /cvs/stx/stx/libview/Cursor.st,v 1.64 1999-02-25 23:40:14 cg Exp $'
  2864 ! !
  2862 ! !
  2865 Cursor initialize!
  2863 Cursor initialize!