Andreas Raab uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-kb.244.mcz ==================== Summary ==================== Name: Morphic-kb.244 Author: kb Time: 21 November 2009, 7:06:52 am UUID: b1a32c90-059f-6d44-bf1e-d8f55b38d8b4 Ancestors: Morphic-kb.243 - Fixed glitches of MenuMorph and DockingBarMorph. Now menu items loose selection on mouse leave except when the mouse moves towards their submenu. Docking bar items loose selection only if another item is selected, or the docking bar looses focus. - Removed the border of the docking bar, and adapted DockingBarItemMorph >> adjacentTo to it. We need to recreate the DockingBarMorph for this to take effect. - Labels of the items in the Windows menu are contracted to 50 characters. =============== Diff against Morphic-kb.243 =============== Item was added: + ----- Method: DockingBarMorph>>mouseDown: (in category 'events-processing') ----- + mouseDown: evt + + (self fullContainsPoint: evt position) ifFalse: [ + self selectItem: nil event: evt. + evt hand releaseMouseFocus: self ]! Item was changed: ----- Method: TheWorldMainDockingBar>>createDockingBar (in category 'construction') ----- createDockingBar "Create a docking bar from the receiver's representation" | dockingBar | dockingBar := DockingBarMorph new adhereToTop; color: Preferences menuColor; gradientRamp: self gradientRamp; + autoGradient: ColorTheme current dockingBarAutoGradient; + borderWidth: 0. - autoGradient: ColorTheme current dockingBarAutoGradient. self fillDockingBar: dockingBar. ^ dockingBar! Item was added: + ----- Method: DockingBarItemMorph>>mouseLeaveDragging: (in category 'events') ----- + mouseLeaveDragging: evt ! Item was changed: ----- Method: MenuMorph>>handleMouseMove: (in category 'events') ----- handleMouseMove: evt " If the mouse moves over an item not selected, we try to set it as selected. If this happens depends on that the current selected item wants to release its selection. " self selectedItem ifNil: [ ^super handleMouseMove: evt ]. (self selectedItem containsPoint: evt position) ifTrue: [ ^super handleMouseMove: evt ]. self selectItem: ( self items detect: [ :each | each containsPoint: evt position ] + ifNone: [ nil ]) - ifNone: [ ^super handleMouseMove: evt ]) event: evt. super handleMouseMove: evt! Item was changed: ----- Method: MenuItemMorph>>mouseLeaveDragging: (in category 'events') ----- mouseLeaveDragging: evt "The mouse left the receiver. Do nothing if we're not in a 'valid menu transition', meaning that the current hand focus must be aimed at the owning menu." owner ifNil: [^self]. + evt hand mouseFocus == owner ifFalse: [ ^self ]. + lastMousePosition := evt position. + owner selectItem: nil event: evt! - evt hand mouseFocus == owner ifFalse: [^self]. - "If we have a submenu, make sure we've got some time to enter it before actually leaving the menu item" - subMenu isNil ifTrue: [ owner selectItem: nil event: evt ]! Item was changed: ----- Method: DockingBarItemMorph>>adjacentTo (in category 'selecting') ----- adjacentTo owner isFloating + ifTrue: [^ {self bounds bottomLeft + (4 @ 4)}]. - ifTrue: [^ {self bounds bottomLeft + (5 @ 5)}]. owner isAdheringToTop + ifTrue: [^ {self bounds bottomLeft + (4 @ 4)}]. - ifTrue: [^ {self bounds bottomLeft + (5 @ 5)}]. owner isAdheringToLeft + ifTrue: [^ {self bounds topRight + (4 @ 4)}]. - ifTrue: [^ {self bounds topRight + (5 @ 5)}]. owner isAdheringToBottom + ifTrue: [^ {self bounds topLeft + (4 @ 4)}]. - ifTrue: [^ {self bounds topLeft + (5 @ 5)}]. owner isAdheringToRight + ifTrue: [^ {self bounds topLeft + (4 @ -4)}]. - ifTrue: [^ {self bounds topLeft + (5 @ -5)}]. ^ {self bounds bottomLeft + (3 @ 5)}! Item was added: Item was changed: ----- Method: TheWorldMainDockingBar>>listWindowsOn: (in category 'submenu - windows') ----- listWindowsOn: menu | expanded | expanded := SystemWindow windowsIn: World satisfying: [ :w | w isCollapsed not ]. expanded ifEmpty: [ menu addItem: [ :item | item contents: 'No open Windows' translated; isEnabled: false ] ]. expanded do: [ :each | menu addItem: [ :item | item + contents: (each label contractTo: 50); - contents: each label; icon: (self colorIcon: each paneColor); subMenuUpdater: self selector: #windowMenuFor:on: arguments: { each }; action: [ each activateAndForceLabelToShow ] ] ].! Item was changed: ----- Method: MenuItemMorph>>deselect: (in category 'selecting') ----- deselect: evt self isSelected: false. + lastMousePosition := nil. subMenu ifNotNil: [ owner ifNotNil: [ owner activeSubmenu: nil ] ].! Item was changed: Item was changed: ----- Method: MenuMorph>>handleFocusEvent: (in category 'events') ----- handleFocusEvent: evt "Handle focus events. Valid menu transitions are determined based on the menu currently holding the focus after the mouse went down on one of its children." self processEvent: evt. "Need to handle keyboard input if we have the focus." evt isKeyboard ifTrue: [^ self handleEvent: evt]. "We need to handle button clicks outside and transitions to local popUps so throw away everything else" (evt isMouseOver or:[evt isMouse not]) ifTrue:[^self]. "What remains are mouse buttons and moves" evt isMove ifFalse:[^self handleEvent: evt]. "handle clicks outside by regular means" + "Now it's getting tricky. On #mouseMove we might transfer control to *either* the currently active submenu or the pop up owner, if any. Since the active sub menu is always displayed upfront check it first." + selectedItem ifNotNil: [ + (selectedItem activateSubmenu: evt) + ifTrue: [ ^self ] + ifFalse: [ + (self containsPoint: evt position) ifFalse: [ + self selectItem: nil event: evt ] ] ]. - "Now it's getting tricky. On #mouseMove we might transfer control to *either* the currently active submenu or the pop up owner, if any. Since the active sub menu is always displayed upfront check it first." - selectedItem ifNotNil:[(selectedItem activateSubmenu: evt) ifTrue:[^self]]. "Note: The following does not traverse upwards but it's the best I can do for now" popUpOwner ifNotNil:[(popUpOwner activateOwnerMenu: evt) ifTrue:[^self]].! |
Free forum by Nabble | Edit this page |