Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1095.mcz ==================== Summary ==================== Name: Morphic-mt.1095 Author: mt Time: 31 March 2016, 1:04:44.478525 pm UUID: 277ef4bb-1fb5-40a2-b443-1d0555ebc707 Ancestors: Morphic-kfr.1094 Make it possible that new-style balloon morphs can appear also at the morph's center and not only close to the hand position. Also adds the possibility to open multiple balloon morphs at once via subsequent calls to Morph >> #showBalloon. =============== Diff against Morphic-kfr.1094 =============== Item was added: + ----- Method: BalloonMorph>>popUp (in category 'initialization') ----- + popUp + + | w worldBounds | + + target ifNil: [^ self]. + target isInWorld ifFalse: [^ self]. + + w := target world. + + self lock. + self fullBounds. "force layout" + self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber. + "So that if the translation below makes it overlap the receiver, it won't + interfere with the rootMorphsAt: logic and hence cause flashing. Without + this, flashing happens, believe me!!" + ((worldBounds := w bounds) containsRect: self bounds) ifFalse: + [self bounds: (self bounds translatedToBeWithin: worldBounds)]. + + self openInWorld. + w activeHand addBalloonHelp: self. + ! Item was changed: ----- Method: BalloonMorph>>popUpForHand: (in category 'initialization') ----- popUpForHand: aHand "Pop up the receiver as balloon help for the given hand" | worldBounds | self lock. self fullBounds. "force layout" self setProperty: #morphicLayerNumber toValue: self morphicLayerNumber. aHand world addMorphFront: self. "So that if the translation below makes it overlap the receiver, it won't interfere with the rootMorphsAt: logic and hence cause flashing. Without this, flashing happens, believe me!!" ((worldBounds := aHand world bounds) containsRect: self bounds) ifFalse: [self bounds: (self bounds translatedToBeWithin: worldBounds)]. + aHand resetBalloonHelp: self. - aHand balloonHelp: self. ! Item was added: + ----- Method: HandMorph>>addBalloonHelp: (in category 'balloon help') ----- + addBalloonHelp: aBalloonMorph + "Associate a new balloon morph with this hand." + + aBalloonMorph ifNotNil: [:m | self balloonHelpList add: m].! Item was removed: - ----- Method: HandMorph>>balloonHelp (in category 'balloon help') ----- - balloonHelp - "Return the balloon morph associated with this hand" - ^self valueOfProperty: #balloonHelpMorph! Item was removed: - ----- Method: HandMorph>>balloonHelp: (in category 'balloon help') ----- - balloonHelp: aBalloonMorph - "Return the balloon morph associated with this hand" - | oldHelp | - oldHelp := self balloonHelp. - oldHelp ifNotNil:[oldHelp delete]. - aBalloonMorph - ifNil:[self removeProperty: #balloonHelpMorph] - ifNotNil:[self setProperty: #balloonHelpMorph toValue: aBalloonMorph]! Item was added: + ----- Method: HandMorph>>balloonHelpList (in category 'balloon help') ----- + balloonHelpList + "Return all balloon morphs associated with this hand" + + ^ self + valueOfProperty: #balloonHelpMorphs + ifAbsentPut: [OrderedCollection new]! Item was changed: ----- Method: HandMorph>>deleteBalloonTarget: (in category 'balloon help') ----- deleteBalloonTarget: aMorph + "Delete any existing balloon help." - "Delete any existing balloon help. This is now done unconditionally, whether or not the morph supplied is the same as the current balloon target" + self balloonHelpList + do: [:ea | ea delete]; + removeAll.! - self balloonHelp: nil - - " | h | - h := self balloonHelp ifNil: [^ self]. - h balloonOwner == aMorph ifTrue: [self balloonHelp: nil]"! Item was added: + ----- Method: HandMorph>>resetBalloonHelp: (in category 'balloon help') ----- + resetBalloonHelp: aBalloonMorph + "Associate a new balloon morph with this hand. Remove all other ones." + + self + deleteBalloonTarget: nil; + addBalloonHelp: aBalloonMorph.! Item was added: + ----- Method: Morph>>showBalloon (in category 'halos and balloon help') ----- + showBalloon + + self showBalloon: self balloonText.! Item was changed: ----- Method: Morph>>showBalloon: (in category 'halos and balloon help') ----- showBalloon: msgString + "Pop up a balloon containing the given string." + + self isInWorld ifFalse: [^ self]. + (msgString isNil or: [msgString isEmpty]) ifTrue: [^ self]. + + (self balloonMorphClass + string: msgString + for: self balloonHelpAligner) + popUp.! - "Pop up a balloon containing the given string, - first removing any existing BalloonMorphs in the world." - | w | - self showBalloon: msgString hand: ((w := self world) ifNotNil:[w activeHand]).! Item was changed: ----- Method: Morph>>showBalloon:hand: (in category 'halos and balloon help') ----- showBalloon: msgString hand: aHand + "Pop up a balloon containing the given string. Note that any existing BalloonMorphs will be removed from the world." - "Pop up a balloon containing the given string, - first removing any existing BalloonMorphs in the world." + | balloon | + self isInWorld ifFalse: [^ self]. + + balloon := (self balloonMorphClass - | w balloon h | - (w := self world) ifNil: [^ self]. - h := aHand. - h ifNil:[ - h := w activeHand]. - balloon := self balloonMorphClass string: msgString + for: self balloonHelpAligner). + + balloon + popUpFor: self + hand: (aHand ifNil: [self world activeHand]).! - for: self balloonHelpAligner. - balloon popUpFor: self hand: h.! Item was added: + ----- Method: NewBalloonMorph>>popUp (in category 'initialization') ----- + popUp + "No tail. Centered in the balloon owner. Do not remove other balloon helps." + + | w | + self balloonOwner ifNil: [^ self]. + self balloonOwner isInWorld ifFalse: [^ self]. + + w := self balloonOwner world. + + self hasTail: false. + self center: self balloonOwner center. + self bounds: (self bounds translatedToBeWithin: w bounds). + + w activeHand addBalloonHelp: self. + self openInWorld.! Item was changed: ----- Method: NewBalloonMorph>>popUpAt:forHand: (in category 'initialization') ----- popUpAt: point forHand: aHand "Pop up the receiver as balloon help for the given hand" #(bottomLeft topLeft bottomRight topRight) detect: [:nextOrientation | | pointWithOffset | self orientation: nextOrientation. pointWithOffset := point + self tailOffset. self move: pointWithOffset. self bounds: (self bounds translatedToBeWithin: aHand world bounds). (self bounds perform: self orientation) = pointWithOffset] ifNone: ["Keep last try."]. aHand world addMorphFront: self. + aHand resetBalloonHelp: self.! - aHand balloonHelp: self.! Item was changed: + (PackageInfo named: 'Morphic') postscript: 'Editor initialize. + + SystemWindow allSubInstancesDo: [:ea | + ea paneMorphs do: #comeToFront. + ea labelArea comeToFront]. + + HandMorph allInstancesDo: [:hand | + hand removeProperty: #balloonHelpMorph].'! - (PackageInfo named: 'Morphic') postscript: 'Editor initialize.'! |
Free forum by Nabble | Edit this page |