[squeak-dev] The Inbox: Morphic-ct.1617.mcz

Thiede, Christoph Christoph.Thiede at student.hpi.uni-potsdam.de
Sun Jan 12 12:45:52 UTC 2020


Hm, the diff looks weird again. Did I make some mistake or is this some issue with the "diff server" (unknowing any details on how this online stuff works)? Chris, could you maybe enlighten me? :)

Best,
Christoph
________________________________
Von: Squeak-dev <squeak-dev-bounces at lists.squeakfoundation.org> im Auftrag von commits at source.squeak.org <commits at source.squeak.org>
Gesendet: Sonntag, 12. Januar 2020 03:34:33
An: squeak-dev at lists.squeakfoundation.org
Betreff: [squeak-dev] The Inbox: Morphic-ct.1617.mcz

Christoph Thiede uploaded a new version of Morphic to project The Inbox:
http://source.squeak.org/inbox/Morphic-ct.1617.mcz

==================== Summary ====================

Name: Morphic-ct.1617
Author: ct
Time: 12 January 2020, 3:34:20.453555 am
UUID: d75dd5ad-8420-c443-9314-c01d96409fae
Ancestors: Morphic-tpr.1616

Fixes #applyUserInterfaceTheme on SystemProgressMorph really!

Explanation: Resetting the ProgressMorph from the class side is definively bad, because it deletes the progress morph if currently visible. The current instance-side implementation was not reliable either, because if the UniqueInstance is not in world, it cannot apply the new UI theme. Thus we need to override #canApplyUserInterfaceTheme from Morph.

This commit replaces Morphic-ct.1615. See also: http://forum.world.st/SystemProgressMorph-applyUserInterfaceTheme-td5108129.html

=============== Diff against Morphic-tpr.1616 ===============

Item was added:
+ ----- Method: AlternatePluggableListMorphOfMany>>mouseLeaveDragging: (in category 'event handling') -----
+ mouseLeaveDragging: anEvent
+        "Dragging means changing the list's multi-selection state. Thus, there is no support for drag-and-drop of elements within a selection."
+
+        self hoverRow: nil.
+        self resetPotentialDropRow.!

Item was changed:
  ----- Method: FontChooserTool>>selectedPointSizeIndex: (in category 'point size') -----
  selectedPointSizeIndex: anIndex

         anIndex = 0 ifTrue: [^self].
         pointSize := (self pointSizeList at: anIndex) withBlanksTrimmed asNumber.
+        self changed: #selectedPointSizeIndex.
         self changed: #pointSizeList.
         self changed: #contents.!

Item was changed:
  Morph subclass: #HandMorph
+        instanceVariableNames: 'mouseFocus keyboardFocus eventListeners mouseListeners keyboardListeners eventCaptureFilters mouseCaptureFilters keyboardCaptureFilters mouseClickState mouseOverHandler mouseWheelState lastMouseEvent targetOffset damageRecorder cacheCanvas cachedCanvasHasHoles temporaryCursor temporaryCursorOffset hardwareCursor hasChanged savedPatch userInitials lastEventBuffer genieGestureProcessor keyboardInterpreter'
+        classVariableNames: 'CompositionWindowManager DoubleClickTime DragThreshold EventStats NewEventRules NormalCursor PasteBuffer SendMouseWheelToKeyboardFocus ShowEvents SynthesizeMouseWheelEvents'
-        instanceVariableNames: 'mouseFocus keyboardFocus eventListeners mouseListeners keyboardListeners eventCaptureFilters mouseCaptureFilters keyboardCaptureFilters mouseClickState mouseOverHandler targetOffset lastMouseEvent damageRecorder cacheCanvas cachedCanvasHasHoles temporaryCursor temporaryCursorOffset hardwareCursor hasChanged savedPatch userInitials lastEventBuffer genieGestureProcessor keyboardInterpreter'
-        classVariableNames: 'CompositionWindowManager DoubleClickTime DragThreshold EventStats MinimalWheelDelta NewEventRules NormalCursor PasteBuffer SendMouseWheelToKeyboardFocus ShowEvents SynthesizeMouseWheelEvents'
         poolDictionaries: 'EventSensorConstants'
         category: 'Morphic-Kernel'!

  !HandMorph commentStamp: '<historical>' prior: 0!
  The cursor may be thought of as the HandMorph.  The hand's submorphs hold anything being carried by dragging.

  There is some minimal support for multiple hands in the same world.!

Item was removed:
- ----- Method: HandMorph class>>minimumWheelDelta (in category 'preferences') -----
- minimumWheelDelta
-        <preference: 'Minimal Mouse Wheel Scroll Delta'
-                categoryList: #(Morphic mouse)
-                description: 'Answer the minimal scroll increment taken into account
- Defaults to 120, corresponding to a single mouse wheel notch.
- Use a lower value (20) if wanting smoother scrolling with trackpads.'
-                type: #Number>
-        ^MinimalWheelDelta ifNil: [120].!

Item was removed:
- ----- Method: HandMorph class>>minimumWheelDelta: (in category 'preferences') -----
- minimumWheelDelta: anInteger
-        MinimalWheelDelta := anInteger ifNotNil: [anInteger clampLow: 20 high: 120]!

Item was changed:
  ----- Method: HandMorph>>generateMouseWheelEvent: (in category 'private events') -----
  generateMouseWheelEvent: evtBuf
         "Generate the appropriate mouse wheel event for the given raw event buffer"

+        | buttons modifiers deltaX deltaY stamp |
-        | buttons modifiers deltaX deltaY stamp nextEvent |
         stamp := evtBuf second.
         stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
         deltaX := evtBuf third.
         deltaY := evtBuf fourth.
+        modifiers := evtBuf fifth.
+        buttons := (modifiers bitShift: 3) bitOr: (lastMouseEvent buttons bitAnd: 7).
-        buttons := evtBuf fifth.
-        modifiers := evtBuf sixth.
-        [(deltaX abs + deltaY abs < self class minimumWheelDelta)
-                        and: [(nextEvent := Sensor peekEvent) notNil
-                        and: [nextEvent first = evtBuf first
-                        and: [nextEvent fifth = evtBuf fifth
-                        and: [nextEvent sixth = evtBuf sixth]
-                        and: [nextEvent third isZero = evtBuf third isZero "both horizontal or vertical"]]]]]
-                whileTrue:
-                        ["nextEvent is similar.  Remove it from the queue, and check the next."
-                        nextEvent := Sensor nextEvent.
-                        deltaX := deltaX + nextEvent third.
-                        deltaY := deltaY + nextEvent fourth].
         ^ MouseWheelEvent new
                 setType: #mouseWheel
                 position: self position
                 delta: deltaX at deltaY
+                direction: 2r0000
                 buttons: buttons
                 hand: self
                 stamp: stamp!

Item was changed:
  ----- Method: HandMorph>>handleEvent: (in category 'events-processing') -----
  handleEvent: unfilteredEvent

         | filteredEvent |
         owner ifNil: [^ unfilteredEvent  "not necessary but good style -- see Morph >> #handleEvent:"].

         self logEvent: unfilteredEvent.

         "Mouse-over events occur really, really, really often. They are kind of the heart beat of the Morphic UI process."
         unfilteredEvent isMouseOver ifTrue: [^ self sendMouseEvent: unfilteredEvent].

         self showEvent: unfilteredEvent.
         self sendListenEvents: unfilteredEvent.

         filteredEvent := self sendFilterEventCapture: unfilteredEvent for: nil.
         "filteredEvent := unfilteredEvent" " <-- use this to disable global capture filters"

         filteredEvent wasIgnored ifTrue: [
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         filteredEvent isWindowEvent ifTrue: [
                 self sendEvent: filteredEvent focus: nil.
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         filteredEvent isKeyboard ifTrue:[
                 self sendKeyboardEvent: filteredEvent.
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         filteredEvent isDropEvent ifTrue:[
                 self sendEvent: filteredEvent focus: nil.
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         filteredEvent isMouse ifFalse: [
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         " ********** MOUSE EVENT *********** "

         lastMouseEvent := filteredEvent.

         "Check for pending drag or double click operations."
         mouseClickState ifNotNil:[
                 (mouseClickState handleEvent: filteredEvent from: self) ifFalse:[
                         "Possibly dispatched #click: or something and will not re-establish otherwise"
                         self mouseOverHandler processMouseOver: lastMouseEvent.
                         ^ filteredEvent]].

         filteredEvent isMouseWheel ifTrue: [
+                mouseWheelState ifNil: [mouseWheelState := MouseWheelState new].
+                mouseWheelState handleEvent: filteredEvent from: self.
-                self class sendMouseWheelToKeyboardFocus
-                        ifFalse: [self sendMouseEvent: filteredEvent]
-                        ifTrue: [self sendEvent: filteredEvent focus: self keyboardFocus clear: [self keyboardFocus: nil]].
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         filteredEvent isMove ifTrue:[
                 self position: filteredEvent position.
                 self sendMouseEvent: filteredEvent.
                 self mouseOverHandler processMouseOver: lastMouseEvent.
                 ^ filteredEvent].

         "Issue a synthetic move event if we're not at the position of the event"
         filteredEvent position = self position
                 ifFalse: [self moveToEvent: filteredEvent].

         "Drop submorphs on button events"
         self hasSubmorphs
                 ifTrue:[self dropMorphs: filteredEvent]
                 ifFalse:[self sendMouseEvent: filteredEvent].

         self mouseOverHandler processMouseOver: lastMouseEvent.
         ^ filteredEvent "not necessary but good style -- see Morph >> #handleEvent:"    !

Item was removed:
- ----- Method: MouseWheelEvent>>setDirection (in category 'initialization') -----
- setDirection
-        delta x > 0 ifTrue: [self setWheelRight].
-        delta x < 0 ifTrue: [self setWheelLeft].
-
-        delta y > 0 ifTrue: [self setWheelUp].
-        delta y < 0 ifTrue: [self setWheelDown].!

Item was removed:
- ----- Method: MouseWheelEvent>>setType:position:delta:buttons:hand:stamp: (in category 'private') -----
- setType: evtType position: evtPos delta: evtDelta buttons: evtButtons hand: evtHand stamp: stamp
-        type := evtType.
-        position := evtPos.
-        buttons := evtButtons.
-        source := evtHand.
-        wasHandled := false.
-        direction := 2r0000.
-        delta := evtDelta.
-        timeStamp := stamp.
-        self setDirection!

Item was added:
+ Object subclass: #MouseWheelState
+        instanceVariableNames: 'currentDelta'
+        classVariableNames: ''
+        poolDictionaries: ''
+        category: 'Morphic-Events'!

Item was added:
+ ----- Method: MouseWheelState>>handleEvent:from: (in category 'event processing') -----
+ handleEvent: aMouseWheelEvent from: aHand
+        "Every 120 units, raise the wheel flags for convenient mouse wheel programming. We choose not to send multiple mouse-wheel events for multiples of 120 because applications can always react to the actual delta values if they want to do more scrolling or zooming."
+
+        | sign |
+        currentDelta := currentDelta + aMouseWheelEvent wheelDelta.
+
+        sign := currentDelta sign.
+        currentDelta := currentDelta abs.
+
+        (currentDelta x // 120) > 0 ifTrue: [
+                sign x = 1
+                        ifTrue: [aMouseWheelEvent setWheelRight]
+                        ifFalse: [aMouseWheelEvent setWheelLeft]].
+
+        (currentDelta y // 120) > 0 ifTrue: [
+                sign y = 1
+                        ifTrue: [aMouseWheelEvent setWheelUp]
+                        ifFalse: [aMouseWheelEvent setWheelDown]].
+
+        currentDelta := currentDelta \\ 120.
+        currentDelta := currentDelta * sign.
+
+        "Finally, send the event."
+        HandMorph sendMouseWheelToKeyboardFocus
+                ifFalse: [aHand sendMouseEvent: aMouseWheelEvent]
+                ifTrue: [aHand sendEvent: aMouseWheelEvent focus: aHand keyboardFocus clear: [aHand keyboardFocus: nil]].
+ !

Item was added:
+ ----- Method: MouseWheelState>>initialize (in category 'initialize-release') -----
+ initialize
+
+        super initialize.
+        currentDelta := 0 at 0.!

Item was changed:
  ----- Method: PluggableListMorph>>mouseUp: (in category 'event handling') -----
  mouseUp: event

         | row |
         model okToChange ifFalse: [^ self].
+        (self containsPoint: event position) ifFalse: [^ self].

         row := self rowAtLocation: event position.
         row = self selectionIndex
                 ifTrue: [(autoDeselect ifNil: [true]) ifTrue: [row = 0 ifFalse: [self changeModelSelection: 0] ]]
                 ifFalse: [self changeModelSelection: (self modelIndexFor: row)].

         event hand newKeyboardFocus: self.
         hasFocus := true.
         Cursor normal show.!

Item was changed:
  ----- Method: ScrollPane>>mouseWheel: (in category 'event handling') -----
  mouseWheel: evt

+        evt isWheelUp ifTrue: [scrollBar scrollUp: 3].
+        evt isWheelDown ifTrue: [scrollBar scrollDown: 3].!
-        evt isWheelUp ifTrue: [scrollBar scrollUp: (3 * evt wheelDelta y abs // 120 max: 1)].
-        evt isWheelDown ifTrue: [scrollBar scrollDown: (3 * evt wheelDelta y abs // 120 max: 1)].
-        evt isWheelLeft ifTrue: [hScrollBar scrollUp: (3 * evt wheelDelta x abs // 120 max: 1)].
-        evt isWheelRight ifTrue: [hScrollBar scrollDown: (3 * evt wheelDelta x abs // 120 max: 1)].!

Item was changed:
  ----- Method: StringMorph>>contents: (in category 'accessing') -----
  contents: newContents

         newContents isText
                 ifTrue: [^ self initializeFromText: newContents].

         contents = newContents
+                ifTrue: [^ self "No substantive change."].
-                ifTrue: [^ self "no substantive change"].

         contents := newContents.
+        self changed. "New contents need to be drawn."
+
+        self fitContents. "Resize if necessary."!
-
-        self fitContents.!

Item was changed:
  ----- Method: StringMorph>>fitContents (in category 'layout') -----
  fitContents

+        self extent: self measureContents.!
-        | newBounds boundsChanged |
-        newBounds := self measureContents.
-        boundsChanged := bounds extent ~= newBounds.
-        self extent: newBounds.         "default short-circuits if bounds not changed"
-        boundsChanged ifFalse: [self changed]!

Item was removed:
- ----- Method: SystemProgressMorph class>>applyUserInterfaceTheme (in category 'preferences') -----
- applyUserInterfaceTheme
-
-        self reset.!

Item was added:
+ ----- Method: SystemProgressMorph>>canApplyUserInterfaceTheme (in category 'updating') -----
+ canApplyUserInterfaceTheme
+
+        ^ true!

Item was changed:
  ----- Method: UpdatingStringMorph>>fitContents (in category 'layout') -----
  fitContents
+        "Overridden to respect minimum and maximum widfth."
+
-
         | newExtent |
+        newExtent :=  self measureContents.
+        self extent: ((newExtent x max: self minimumWidth) min: self maximumWidth) @ newExtent y.!
-        newExtent := self measureContents.
-        newExtent := ((newExtent x max: self minimumWidth) min: self maximumWidth) @ newExtent y.
-        (self extent = newExtent) ifFalse:
-                [self extent: newExtent.
-                self changed]
- !

Item was changed:
  ----- Method: UpdatingStringMorph>>updateContentsFrom: (in category 'stepping') -----
  updateContentsFrom: aValue
         self growable
                 ifTrue:
+                        [self contentsFitted: aValue]
-                        [self contents: aValue]
                 ifFalse:
                         [self contentsClipped: aValue]!


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.squeakfoundation.org/pipermail/squeak-dev/attachments/20200112/6d3c5229/attachment.html>


More information about the Squeak-dev mailing list