'From Squeak3.2alpha of 2 October 2001 [latest update: #4519] on 16 November 2001 at 10:49:51 pm'! "Change Set: MorphicInMVCFixes Date: 16 November 2001 Author: Dan Ingalls Fixes a number of problems with morphic in an MVC window, to wit: 1. After using morphic in an MVC window, all request boxes and pop-up menus started appearing at the top left of the screen rather than where the mouse is. Due to ActiveHand global not being reset to nil when not in morphic. 2. MVC projects are now created with shared flaps suppressed. Therefore morphic applications opened with #openInWorld, and empty worlds now open without shared flaps. This is best for most morphic apps, but it can be overridded using the flaps control choice in the world menu of any embedded morphic world. 3. When you open a morphic world, you get a walkback if you try to open a viewer on any morph. Defined MVCWiWPasteUpMorph>>project. 4. When running morphic in an MVC window, ticking and display does not take place unless you are moving the mouse. Fixed by exiting from processEvents when no event is waiting. 5. Reframing now works with continuous stepping, and adjusts morphic interior appropriately. 6. If you click in the morphic world, and then go out to the world menu and open a browser, it shows up in the morphic world instead of MVC. Due to ActiveWorld global not being reset to nil when not in morphic. 7. When ticking did work in morphic windows, it was suspended when the mouse left the window, even though the window was still active. "! !HandMorph methodsFor: 'event handling' stamp: 'di 11/16/2001 14:15'! processEvents "Process user input events from the local input devices." | evt evtBuf type hadAny | ActiveEvent ifNotNil:[ "Meaning that we were invoked from within an event response. Make sure z-order is up to date" self mouseOverHandler processMouseOver: lastMouseEvent]. hadAny _ false. [(evtBuf _ Sensor nextEvent) == nil] whileFalse:[ evt _ nil. "for unknown event types" type _ evtBuf at: 1. (type = EventTypeMouse) ifTrue:[evt _ self generateMouseEvent: evtBuf]. (type = EventTypeKeyboard) ifTrue:[evt _ self generateKeyboardEvent: evtBuf]. (type = EventTypeDragDropFiles) ifTrue:[evt _ self generateDropFilesEvent: evtBuf]. "All other events are ignored" evt == nil ifTrue: [^ self]. "Finally, handle it" self handleEvent: evt. hadAny _ true. "For better user feedback, return immediately after a mouse event has been processed." evt isMouse ifTrue: [^ self]. ]. "note: if we come here we didn't have any mouse events" (mouseClickState notNil) ifTrue:[ "No mouse events during this cycle. Make sure click states time out accordingly" mouseClickState handleEvent: lastMouseEvent asMouseMove from: self]. hadAny ifFalse:[ "No pending events. Make sure z-order is up to date" self mouseOverHandler processMouseOver: lastMouseEvent. ].! ! !MVCWiWPasteUpMorph methodsFor: 'as yet unclassified' stamp: 'di 11/16/2001 09:42'! project ^ Project current! ! !MorphWorldController methodsFor: 'control sequence' stamp: 'di 11/16/2001 22:43'! controlLoop "Overridden to keep control active when the hand goes out of the view" | db | [self viewHasCursor "working in the window" or: [Sensor noButtonPressed "wandering with no button pressed" or: [model primaryHand submorphs size > 0 "dragging something outside"]]] whileTrue: "... in other words anything but clicking outside" [self controlActivity. "Check for reframing since we hold control here" db _ view superView displayBox. view superView controller checkForReframe. db = view superView displayBox ifFalse: [self controlInitialize "reframe world if bounds changed"]]. ! ! !MorphWorldController methodsFor: 'control sequence' stamp: 'di 11/16/2001 13:58'! controlTerminate "This window is becoming inactive; restore the normal cursor." Cursor normal show. ActiveWorld _ ActiveHand _ ActiveEvent _ nil! ! !Project methodsFor: 'project parameters' stamp: 'di 11/16/2001 21:08'! initializeProjectPreferences "Initialize the project's preferences from currently-prevailing preferences that are currently being held in projects in this system" projectPreferenceFlagDictionary _ Project current projectPreferenceFlagDictionary deepCopy. "Project overrides in the new project start out being the same set of overrides in the calling project" Preferences allPreferenceObjects do: "in case we missed some" [:aPreference | aPreference localToProject ifTrue: [(projectPreferenceFlagDictionary includesKey: aPreference name) ifFalse: [projectPreferenceFlagDictionary at: aPreference name put: aPreference preferenceValue]]]. self isMorphic ifFalse: [self flapsSuppressed: true]. (Project current projectParameterAt: #disabledGlobalFlapIDs ifAbsent: [nil]) ifNotNilDo: [:idList | self projectParameterAt: #disabledGlobalFlapIDs put: idList copy] ! ! !StandardSystemController methodsFor: 'borders' stamp: 'di 11/16/2001 22:22'! adjustWindowBorders | side noClickYet | noClickYet _ true. VBorderCursor showWhile: [ [side _ view displayBox sideNearestTo: sensor cursorPoint. self cursorOnBorder and: [(side = #left) | (side = #right) and: [noClickYet or: [sensor redButtonPressed]]]] whileTrue: [sensor redButtonPressed ifTrue: [noClickYet _ false. side = #left ifTrue: [view newFrame: [:f | f withLeft: sensor cursorPoint x]]. side = #right ifTrue: [view newFrame: [:f | f withRight: sensor cursorPoint x]]]. self interActivityPause]]. HBorderCursor showWhile: [ [side _ view displayBox sideNearestTo: sensor cursorPoint. self cursorOnBorder and: [(side = #top) | (side = #bottom) and: [noClickYet or: [sensor redButtonPressed]]]] whileTrue: [sensor redButtonPressed ifTrue: [noClickYet _ false. side = #top ifTrue: [view newFrame: [:f | f withTop: sensor cursorPoint y]]. side = #bottom ifTrue: [view newFrame: [:f | f withBottom: sensor cursorPoint y]]]. self interActivityPause]]! ! !StandardSystemController methodsFor: 'borders' stamp: 'di 11/16/2001 22:30'! checkForReframe | cp | view isCollapsed ifTrue: [^ self]. cp _ sensor cursorPoint. ((view closeBoxFrame expandBy: 2) containsPoint: cp) | ((view growBoxFrame expandBy: 2) containsPoint: cp) ifTrue: [^ self]. "Dont let reframe interfere with close/grow" self adjustWindowCorners. self cursorOnBorder ifFalse: [^ self]. ((view insetDisplayBox insetBy: 2@2) containsPoint: cp) ifFalse: [^ self adjustWindowBorders]. view subViews size <= 1 ifTrue: [^ self]. (view subviewWithLongestSide: [:s | ] near: cp) == nil ifFalse: [^ self adjustPaneBorders].! !