The Trunk: Morphic-eem.1339.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Morphic-eem.1339.mcz

commits-2
Eliot Miranda uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-eem.1339.mcz

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

Name: Morphic-eem.1339
Author: eem
Time: 1 June 2017, 12:13:06.49427 pm
UUID: 8669e171-73c5-4778-aa28-4a4812dca47d
Ancestors: Morphic-eem.1338

Changes harvested from Terf:
Add nClicks capture and access for MouseMenuEvents (the Cog VMs have produced this info by virtue of originating at Qwaq).

Break an Etoys dependency in adding halos to morphs.

Minor otimization to transforms in FrmCanvas; no need to set cellSize more than once.

=============== Diff against Morphic-eem.1338 ===============

Item was changed:
  ----- Method: FormCanvas>>transformBy:clippingTo:during:smoothing: (in category 'drawing-support') -----
  transformBy: aDisplayTransform clippingTo: aClipRect during: aBlock smoothing: cellSize
 
  "Note: This method has been originally copied from TransformationMorph."
  | innerRect patchRect sourceQuad warp start subCanvas |
  (aDisplayTransform isPureTranslation) ifTrue:[
  ^aBlock value: (self copyOffset: aDisplayTransform offset negated truncated
  clipRect: aClipRect)
  ].
  "Prepare an appropriate warp from patch to innerRect"
  innerRect := aClipRect.
  patchRect := (aDisplayTransform globalBoundsToLocal: innerRect) truncated.
  sourceQuad := (aDisplayTransform sourceQuadFor: innerRect)
  collect: [:p | p - patchRect topLeft].
  warp := self warpFrom: sourceQuad toRect: innerRect.
+ warp cellSize: cellSize.
 
  "Render the submorphs visible in the clipping rectangle, as patchForm"
  start := (self depth = 1 and: [self isShadowDrawing not])
  "If this is true B&W, then we need a first pass for erasure."
  ifTrue: [1] ifFalse: [2].
  start to: 2 do:
  [:i | "If i=1 we first make a shadow and erase it for opaque whites in B&W"
  subCanvas := self class extent: patchRect extent depth: self depth.
  i=1 ifTrue: [subCanvas shadowColor: Color black.
  warp combinationRule: Form erase]
  ifFalse: [self isShadowDrawing ifTrue:
  [subCanvas shadowColor: self shadowColor].
  warp combinationRule: (self depth = 32
  ifTrue: [Form blendAlphaScaled]
  ifFalse: [Form paint])].
  subCanvas
  translateBy: patchRect topLeft negated
  during: aBlock.
+ warp sourceForm: subCanvas form; warpBits.
- warp sourceForm: subCanvas form; cellSize: cellSize; warpBits.
  warp sourceForm: nil.  subCanvas := nil "release space for next loop"]
  !

Item was changed:
  ----- Method: HandMorph>>generateMouseEvent: (in category 'private events') -----
  generateMouseEvent: evtBuf
  "Generate the appropriate mouse event for the given raw event buffer"
 
  | position buttons modifiers type trail stamp oldButtons evtChanged |
  evtBuf first = lastEventBuffer first
  ifTrue:
  ["Workaround for Mac VM bug, *always* generating 3 events on clicks"
 
  evtChanged := false.
  3 to: evtBuf size
  do: [:i | (lastEventBuffer at: i) = (evtBuf at: i) ifFalse: [evtChanged := true]].
  evtChanged ifFalse: [^nil]].
  stamp := evtBuf second.
  stamp = 0 ifTrue: [stamp := Time eventMillisecondClock].
  position := evtBuf third @ evtBuf fourth.
  buttons := evtBuf fifth.
  modifiers := evtBuf sixth.
 
  type := buttons = 0
  ifTrue:[
  lastEventBuffer fifth = 0
  ifTrue: [#mouseMove] "this time no button and previously no button .. just mouse move"
  ifFalse: [#mouseUp] "this time no button but previously some button ... therefore button was released"
  ]
  ifFalse:[
  buttons = lastEventBuffer fifth
  ifTrue: [#mouseMove] "button states are the same .. now and past .. therfore a mouse movement"
  ifFalse: [ "button states are different .. button was pressed or released"
  buttons > lastEventBuffer fifth
  ifTrue: [#mouseDown]
  ifFalse:[#mouseUp].
  ].
  ].
  buttons := buttons bitOr: (modifiers bitShift: 3).
  oldButtons := lastEventBuffer fifth
  bitOr: (lastEventBuffer sixth bitShift: 3).
  lastEventBuffer := evtBuf.
  type == #mouseMove
  ifTrue:
  [trail := self mouseTrailFrom: evtBuf.
  ^MouseMoveEvent new
  setType: type
  startPoint: (self position)
  endPoint: trail last
  trail: trail
  buttons: buttons
  hand: self
  stamp: stamp].
  ^MouseButtonEvent new
  setType: type
  position: position
  which: (oldButtons bitXor: buttons)
  buttons: buttons
+ nClicks: (evtBuf seventh ifNil: [0])
  hand: self
  stamp: stamp!

Item was changed:
  ----- Method: Morph>>addStandardHaloMenuItemsTo:hand: (in category 'menus') -----
  addStandardHaloMenuItemsTo: aMenu hand: aHandMorph
  "Add standard halo items to the menu"
 
+ | unlockables etoysLoaded |
- | unlockables |
 
  self isWorldMorph ifTrue:
  [^ self addWorldHaloMenuItemsTo: aMenu hand: aHandMorph].
 
  self mustBeBackmost ifFalse:
  [aMenu add: 'send to back' translated action: #goBehind.
  aMenu add: 'bring to front' translated action: #comeToFront.
  self addEmbeddingMenuItemsTo: aMenu hand: aHandMorph.
  aMenu addLine].
 
  self addFillStyleMenuItems: aMenu hand: aHandMorph.
  self addBorderStyleMenuItems: aMenu hand: aHandMorph.
  self addDropShadowMenuItems: aMenu hand: aHandMorph.
  self addLayoutMenuItems: aMenu hand: aHandMorph.
  self addHaloActionsTo: aMenu.
  owner isTextMorph ifTrue:[self addTextAnchorMenuItems: aMenu hand: aHandMorph].
  aMenu addLine.
  self addToggleItemsToHaloMenu: aMenu.
  aMenu addLine.
  self addCopyItemsTo: aMenu.
+ etoysLoaded := Morph includesSelector: #addPlayerItemsTo:.
+ etoysLoaded ifTrue: [self addPlayerItemsTo: aMenu].
- self addPlayerItemsTo: aMenu.
  self addExportMenuItems: aMenu hand: aHandMorph.
+ etoysLoaded ifTrue: [self addStackItemsTo: aMenu].
- self addStackItemsTo: aMenu.
  self addMiscExtrasTo: aMenu.
  Preferences noviceMode ifFalse:
  [self addDebuggingItemsTo: aMenu hand: aHandMorph].
 
  aMenu addLine.
  aMenu defaultTarget: self.
 
  aMenu addLine.
 
  unlockables := self submorphs select:
  [:m | m isLocked].
  unlockables size = 1 ifTrue:
  [aMenu
  add: ('unlock "{1}"' translated format: unlockables first externalName)
  action: #unlockContents].
  unlockables size > 1 ifTrue:
  [aMenu add: 'unlock all contents' translated action: #unlockContents.
  aMenu add: 'unlock...' translated action: #unlockOneSubpart].
 
  aMenu defaultTarget: aHandMorph.
  !

Item was changed:
  MouseEvent subclass: #MouseButtonEvent
+ instanceVariableNames: 'whichButton nClicks'
- instanceVariableNames: 'whichButton'
  classVariableNames: ''
  poolDictionaries: ''
  category: 'Morphic-Events'!

Item was added:
+ ----- Method: MouseButtonEvent>>nClicks (in category 'accessing') -----
+ nClicks
+ ^nClicks ifNil: [0]!

Item was added:
+ ----- Method: MouseButtonEvent>>nClicks: (in category 'accessing') -----
+ nClicks: n
+ nClicks := n!

Item was added:
+ ----- Method: MouseButtonEvent>>setType:position:which:buttons:nClicks:hand:stamp: (in category 'private') -----
+ setType: evtType position: evtPos which: button buttons: evtButtons nClicks: numClicks  hand: evtHand stamp: stamp
+ type := evtType.
+ position := evtPos.
+ buttons := evtButtons.
+ nClicks := numClicks.
+ source := evtHand.
+ wasHandled := false.
+ whichButton := button.
+ timeStamp := stamp!