'From Squeak3.3alpha of 12 January 2002 [latest update: #4784] on 4 March 2002 at 1:50:06 am'! "Change Set: rectangleFixes-jb.cs Date: 24 February 2002 Author: Jim Benson Restart event queue when done polling sensor during rectangle dragging and resizing"! !EventSensor methodsFor: 'mouse' stamp: 'jlb 2/24/2002 10:57'! createMouseEvent "create and return a new mouse event from the current mouse position; this is useful for restarting normal event queue processing after manual polling" | buttons modifiers pos mapped eventBuffer | eventBuffer _ Array new: 8. buttons _ self primMouseButtons. pos _ self primMousePt. modifiers _ buttons bitShift: -3. buttons _ buttons bitAnd: 7. mapped _ self mapButtons: buttons modifiers: modifiers. eventBuffer at: 1 put: (EventSensorConstants at: #EventTypeMouse); at: 2 put: Time millisecondClockValue; at: 3 put: pos x; at: 4 put: pos y; at: 5 put: mapped; at: 6 put: modifiers. ^ eventBuffer! ! !Rectangle methodsFor: 'transforming' stamp: 'jlb 2/24/2002 11:05'! newRectButtonPressedDo: newRectBlock "Track the outline of a new rectangle until mouse button changes. newFrameBlock produces each new rectangle from the previous. Only tracks while mouse is down." | rect newRect buttonNow aHand | buttonNow _ Sensor anyButtonPressed. rect _ self. Display border: rect width: 2 rule: Form reverse fillColor: Color gray. [buttonNow] whileTrue: [Processor yield. buttonNow _ Sensor anyButtonPressed. newRect _ newRectBlock value: rect. newRect = rect ifFalse: [Display border: rect width: 2 rule: Form reverse fillColor: Color gray. Display border: newRect width: 2 rule: Form reverse fillColor: Color gray. rect _ newRect]]. Display border: rect width: 2 rule: Form reverse fillColor: Color gray. " pay the price for reading the sensor directly ; get this party started " Smalltalk isMorphic ifTrue: [aHand _ World activeHand. aHand newMouseFocus: nil; showTemporaryCursor: nil; flushEvents]. Sensor processEvent: Sensor createMouseEvent. ^ rect! ! !Rectangle methodsFor: 'transforming' stamp: 'jlb 2/24/2002 11:31'! newRectFrom: newRectBlock "Track the outline of a new rectangle until mouse button changes. newFrameBlock produces each new rectangle from the previous" | rect newRect buttonStart buttonNow aHand | buttonStart _ buttonNow _ Sensor anyButtonPressed. rect _ self. Display border: rect width: 2 rule: Form reverse fillColor: Color gray. [buttonNow == buttonStart] whileTrue: [Processor yield. buttonNow _ Sensor anyButtonPressed. newRect _ newRectBlock value: rect. newRect = rect ifFalse: [Display border: rect width: 2 rule: Form reverse fillColor: Color gray. Display border: newRect width: 2 rule: Form reverse fillColor: Color gray. rect _ newRect]]. Display border: rect width: 2 rule: Form reverse fillColor: Color gray. " pay the price for reading the sensor directly ; get this party started " Smalltalk isMorphic ifTrue: [aHand _ World activeHand. aHand newMouseFocus: nil; showTemporaryCursor: nil; flushEvents]. Sensor processEvent: Sensor createMouseEvent. ^ rect! !