[Pkg] The Trunk: Morphic-mt.1474.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Jan 9 08:00:43 UTC 2019
Marcel Taeumel uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-mt.1474.mcz
==================== Summary ====================
Name: Morphic-mt.1474
Author: mt
Time: 9 January 2019, 9:00:34.991737 am
UUID: 14bd0540-84ba-480a-9878-754c07a26db5
Ancestors: Morphic-tpr.1473
Clean-up and bug fixes in resize grips. See http://forum.world.st/Please-Review-Some-updates-for-resize-grips-td5092584.html
=============== Diff against Morphic-tpr.1473 ===============
Item was changed:
+ (PackageInfo named: 'Morphic') preamble: '"Disable deprecation warnings to avoid hick-ups."
+ Deprecation showDeprecationWarnings: false.'!
- (PackageInfo named: 'Morphic') preamble: 'SimpleBorder allSubInstancesDo: [ :each |
- (each instVarNamed: #width) ifNil: [ each instVarNamed: #width put: 0 ].
- (each instVarNamed: #color) ifNil: [ each instVarNamed: #color put: Color transparent ].
- (each instVarNamed: #baseColor) ifNil: [ each instVarNamed: #baseColor put: Color transparent ] ].'!
Item was changed:
Morph subclass: #AbstractResizerMorph
+ instanceVariableNames: 'handleColor handleInset lastMouse showHandle'
+ classVariableNames: 'GripThickness HandleLength'
- instanceVariableNames: 'dotColor handleColor lastMouse'
- classVariableNames: ''
poolDictionaries: ''
category: 'Morphic-Windows'!
!AbstractResizerMorph commentStamp: 'jmv 1/29/2006 17:15' prior: 0!
I am the superclass of a hierarchy of morph specialized in allowing the user to resize or rearrange windows and panes.!
Item was changed:
+ ----- Method: AbstractResizerMorph class>>gripThickness (in category 'preferences') -----
- ----- Method: AbstractResizerMorph class>>gripThickness (in category 'constants') -----
gripThickness
"A number in pixels that encodes the area were the user can target splitters or edge grips."
+ <preference: 'Grip Thickness'
+ category: 'windows'
+ description: 'A number in pixels that encodes the area were the user can target splitters or edge grips such as in application windows. Bigger grips make it easier to click on them.'
+ type: #Number>
+
+ ^ GripThickness ifNil: [4]!
- ^ 4!
Item was added:
+ ----- Method: AbstractResizerMorph class>>gripThickness: (in category 'preferences') -----
+ gripThickness: anInteger
+
+ GripThickness := anInteger.
+ Project current restoreDisplay.
+
+ self flag: #todo. "mt: Update existing grips. This is challenging because it interferes with ProportionalLayoutPolicy, which is tricky to refresh from here for arbitrary morphs."!
Item was added:
+ ----- Method: AbstractResizerMorph class>>handleLength (in category 'preferences') -----
+ handleLength
+
+ <preference: 'Handle Length'
+ category: 'windows'
+ description: 'AThe size of a grip handle if shown. Can be interpreted as width or height, depending of the resizer orientation. Does not affect the clickable area. See grip thickness for that.'
+ type: #Number>
+
+ ^ HandleLength ifNil: [25]!
Item was added:
+ ----- Method: AbstractResizerMorph class>>handleLength: (in category 'preferences') -----
+ handleLength: anInteger
+
+ HandleLength := anInteger.
+ Project current restoreDisplay.
+
+ self flag: #todo. "mt: Update existing grips. This is challenging because it interferes with ProportionalLayoutPolicy, which is tricky to refresh from here for arbitrary morphs."!
Item was removed:
- ----- Method: AbstractResizerMorph>>dotColor (in category 'as yet unclassified') -----
- dotColor
-
- ^ dotColor ifNil: [self setDefaultColors. dotColor]!
Item was changed:
----- Method: AbstractResizerMorph>>handleColor (in category 'accessing') -----
handleColor
+ "Either use my handle color if set up or derive the handle color from my owner's color if I have an owner."
+
+ ^ (handleColor notNil or: [self owner isNil])
+ ifTrue: [handleColor ifNil: [Color black]]
+ ifFalse: [(self userInterfaceTheme resizerColorModifier ifNil: [ [:c | c muchDarker] ])
+ value: (self owner color isTransparent ifTrue: [Color white] ifFalse: [self owner color]) ]!
-
- ^ handleColor ifNil: [self setDefaultColors. handleColor]!
Item was added:
+ ----- Method: AbstractResizerMorph>>handleColor: (in category 'accessing') -----
+ handleColor: aColor
+
+ handleColor := aColor.
+ self changed.!
Item was added:
+ ----- Method: AbstractResizerMorph>>handleInset (in category 'accessing') -----
+ handleInset
+
+ ^ handleInset ifNil: [1]!
Item was added:
+ ----- Method: AbstractResizerMorph>>handleInset: (in category 'accessing') -----
+ handleInset: anInteger
+
+ handleInset := anInteger.
+ self changed.!
Item was removed:
- ----- Method: AbstractResizerMorph>>isCursorOverHandle (in category 'testing') -----
- isCursorOverHandle
-
- ^ true!
Item was changed:
----- Method: AbstractResizerMorph>>mouseDown: (in category 'event handling') -----
mouseDown: anEvent
+ self referencePoint: anEvent position.!
- lastMouse := anEvent cursorPoint!
Item was changed:
----- Method: AbstractResizerMorph>>mouseEnter: (in category 'event handling') -----
mouseEnter: anEvent
+ anEvent hand showTemporaryCursor: self resizeCursor.!
- self isCursorOverHandle ifTrue:
- [self setInverseColors.
- self changed.
- anEvent hand showTemporaryCursor: self resizeCursor]!
Item was changed:
----- Method: AbstractResizerMorph>>mouseLeave: (in category 'event handling') -----
mouseLeave: anEvent
+ anEvent hand showTemporaryCursor: nil.!
- anEvent hand showTemporaryCursor: nil.
- self setDefaultColors.
- self changed!
Item was added:
+ ----- Method: AbstractResizerMorph>>referencePoint (in category 'accessing') -----
+ referencePoint
+
+ ^ lastMouse!
Item was changed:
----- Method: AbstractResizerMorph>>resizeCursor (in category 'accessing') -----
resizeCursor
+ "The cursor shape I will set to the hand on hovering."
+
+ self subclassResponsibility.!
-
- self subclassResponsibility!
Item was changed:
+ ----- Method: AbstractResizerMorph>>setDefaultColors (in category 'initialization') -----
- ----- Method: AbstractResizerMorph>>setDefaultColors (in category 'private') -----
setDefaultColors
+ "handleColor := Color lightGray lighter lighter.
+ dotColor := Color gray lighter"!
- handleColor := Color lightGray lighter lighter.
- dotColor := Color gray lighter!
Item was changed:
+ ----- Method: AbstractResizerMorph>>setInverseColors (in category 'initialization') -----
- ----- Method: AbstractResizerMorph>>setInverseColors (in category 'private') -----
setInverseColors
+ "handleColor := Color lightGray.
+ dotColor := Color white"!
- handleColor := Color lightGray.
- dotColor := Color white!
Item was added:
+ ----- Method: AbstractResizerMorph>>showHandle (in category 'accessing') -----
+ showHandle
+
+ ^ showHandle ifNil: [false]!
Item was added:
+ ----- Method: AbstractResizerMorph>>showHandle: (in category 'accessing') -----
+ showHandle: aBoolean
+
+ showHandle := aBoolean.
+ self changed.!
Item was changed:
----- Method: BorderGripMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ self orientation = #vertical ifTrue: [
+ aCanvas
+ fillRoundRect: (((self width @ (self height * 0.25 min: self class handleLength)) center: self center) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor)].
+ self orientation = #horizontal ifTrue: [
+ aCanvas
+ fillRoundRect: ((((self width * 0.25 min: self class handleLength) @ self height) center: self center) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor)] ].!
- "aCanvas fillRectangle: self bounds color: Color red" "for debugging"
- !
Item was added:
+ ----- Method: BorderGripMorph>>handleInset (in category 'accessing') -----
+ handleInset
+
+ ^ (handleInset notNil or: [self owner isNil])
+ ifTrue: [handleInset ifNil: [2]]
+ ifFalse: [(self owner borderWidth max: 1) * 2]!
Item was added:
+ ----- Method: BorderGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ super layoutProportionallyIn: cellBounds.
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct properties at this time."
+ self orientation = #vertical ifTrue: [
+ self width: self class gripThickness + (self owner borderWidth * 2)].
+ self orientation = #horizontal ifTrue: [
+ self height: self class gripThickness + (self owner borderWidth * 2)].
+ !
Item was added:
+ ----- Method: BorderGripMorph>>orientation (in category 'accessing') -----
+ orientation
+ "#vertical or #horizontal"
+
+ self subclassResponsibility.!
Item was removed:
- ----- Method: BorderGripMorph>>setDefaultColors (in category 'private') -----
- setDefaultColors!
Item was removed:
- ----- Method: BorderGripMorph>>setInverseColors (in category 'private') -----
- setInverseColors!
Item was added:
+ ----- Method: BorderGripMorph>>showHandle (in category 'accessing') -----
+ showHandle
+
+ ^ showHandle ifNil: [
+ self flag: #migration. "mt: Can be simplified with a later update."
+ (self class respondsTo: #drawEdgeResizeHandles)
+ ifTrue: [self class drawEdgeResizeHandles]
+ ifFalse: [false]]!
Item was changed:
----- Method: BottomGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin corner: oldBounds corner + (0 @ delta y))!
Item was changed:
----- Method: BottomGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (0 @ 1 corner: 1 @ 1)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: (0 @ 0 negated corner: 0@ self defaultHeight)!
Item was added:
+ ----- Method: BottomGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ super layoutProportionallyIn: cellBounds.
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self bottom: owner bottom.!
Item was added:
+ ----- Method: BottomGripMorph>>orientation (in category 'accessing') -----
+ orientation
+
+ ^ #horizontal!
Item was changed:
----- Method: BottomLeftGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner + (0 @ delta y))!
Item was removed:
- ----- Method: BottomLeftGripMorph>>borderOffset (in category 'private') -----
- borderOffset
- |width|
- width :=SystemWindow borderWidth +1.
- ^self handleOrigin + (width @ width negated)!
Item was added:
+ ----- Method: BottomLeftGripMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ aCanvas
+ fillRoundRect: ((self topLeft + (self handleInset @ self handleInset negated) extent: self class gripThickness @ self height) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).
+ aCanvas
+ fillRoundRect: ((self bottomLeft + (self handleInset @ (self handleInset negated + self class gripThickness negated)) extent: self width @ self class gripThickness) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).]!
Item was changed:
----- Method: BottomLeftGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (0 @ 1 corner: 0 @ 1)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: (self class gripThickness negated @ (self defaultHeight negated + self class gripThickness)
- corner: 0 @ 0)!
Item was removed:
- ----- Method: BottomLeftGripMorph>>handleOrigin (in category 'private') -----
- handleOrigin
- ^25 at 0!
Item was added:
+ ----- Method: BottomLeftGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self bottomLeft: owner bottomLeft.!
Item was changed:
----- Method: BottomRightGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin corner: oldBounds corner + delta)!
Item was removed:
- ----- Method: BottomRightGripMorph>>borderOffset (in category 'private') -----
- borderOffset
- |width|
- width :=SystemWindow borderWidth +1.
- ^self handleOrigin - (width asPoint)!
Item was added:
+ ----- Method: BottomRightGripMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ aCanvas
+ fillRoundRect: ((self topRight + ((self handleInset negated + self class gripThickness negated) @ self handleInset negated) extent: self class gripThickness @ self height) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).
+ aCanvas
+ fillRoundRect: ((self bottomLeft + (self handleInset negated @ (self handleInset negated + self class gripThickness negated)) extent: self width @ self class gripThickness) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).]!
Item was changed:
----- Method: BottomRightGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (1 @ 1 corner: 1 @ 1)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: ((self defaultWidth negated + self class gripThickness) @ (self defaultHeight negated + self class gripThickness)
- corner: 0 at 0)!
Item was removed:
- ----- Method: BottomRightGripMorph>>handleOrigin (in category 'private') -----
- handleOrigin
- ^0 at 0!
Item was added:
+ ----- Method: BottomRightGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self bottomRight: owner bottomRight.!
Item was changed:
AbstractResizerMorph subclass: #CornerGripMorph
instanceVariableNames: 'target'
+ classVariableNames: 'DrawCornerResizeHandles DrawEdgeResizeHandles'
- classVariableNames: 'ActiveForm DrawCornerResizeHandles PassiveForm'
poolDictionaries: ''
category: 'Morphic-Windows'!
!CornerGripMorph commentStamp: 'jmv 1/29/2006 17:15' prior: 0!
I am the superclass of a hierarchy of morph specialized in allowing the user to resize windows.!
Item was removed:
- ----- Method: CornerGripMorph class>>activeColor (in category 'handle settings') -----
- activeColor
- <preference: 'Corner Grip highlight color'
- category: 'colors'
- description: 'The highlight-color of window corners'
- type: #Color>
- ^(self activeForm colorAt: 24 at 24) alpha: 1!
Item was removed:
- ----- Method: CornerGripMorph class>>activeColor: (in category 'handle settings') -----
- activeColor: aColor
- |canvas|
- canvas := self initializeActiveForm getCanvas.
- canvas
- privatePort fillPattern: aColor;
- combinationRule: Form rgbMul;
- fillRect: (self activeForm boundingBox) offset: 0 at 0.
-
- !
Item was removed:
- ----- Method: CornerGripMorph class>>activeForm (in category 'accessing') -----
- activeForm
- ^ActiveForm ifNil: [self initializeActiveForm]!
Item was removed:
- ----- Method: CornerGripMorph class>>defaultForm (in category 'class initialization') -----
(excessive size, no diff calculated)
Item was removed:
- ----- Method: CornerGripMorph class>>defaultFormFromFileNamed: (in category 'handle settings') -----
- defaultFormFromFileNamed: aString
- "If you dislike the alpha scale of the default handle, use this method to install a new one.
- File should be in a readable image format, and contain a 48x48 32bit radial gradient with color white.
- Use passiveColor: / activeColor: to change them after file is loaded, see initialize for an example"
-
- |sourceStream|
- sourceStream := WriteStream on: String new.
- sourceStream nextPutAll: 'defaultForm';
- nextPut: Character cr;
- nextPut: Character cr;
- nextPut: $^;
- nextPut: $(;
- nextPutAll: (ImageReadWriter formFromFileNamed: aString) storeString;
- nextPut: $).
- self class compile: sourceStream contents.!
Item was added:
+ ----- Method: CornerGripMorph class>>drawEdgeResizeHandles (in category 'preferences') -----
+ drawEdgeResizeHandles
+ <preference: 'Draw Edge Resize Handles'
+ category: 'windows'
+ description: 'Set whether the resize handles on windows should be drawn on the window frame. This does not enable nor disable the resizing function.'
+ type: #Boolean>
+ ^ DrawEdgeResizeHandles ifNil: [ false ]!
Item was added:
+ ----- Method: CornerGripMorph class>>drawEdgeResizeHandles: (in category 'preferences') -----
+ drawEdgeResizeHandles: aBoolean
+
+ DrawEdgeResizeHandles := aBoolean.
+ Project current restoreDisplay.!
Item was removed:
- ----- Method: CornerGripMorph class>>initialize (in category 'class initialization') -----
- initialize
- "CornerGripMorph initialize"
-
- super initialize.
- self initializeActiveForm.
- self initializePassiveForm.
- self activeColor: Color orange.!
Item was removed:
- ----- Method: CornerGripMorph class>>initializeActiveForm (in category 'class initialization') -----
- initializeActiveForm
-
- ^ActiveForm := self defaultForm!
Item was removed:
- ----- Method: CornerGripMorph class>>initializePassiveForm (in category 'class initialization') -----
- initializePassiveForm
-
- ^PassiveForm := self defaultForm!
Item was removed:
- ----- Method: CornerGripMorph class>>passiveColor (in category 'handle settings') -----
- passiveColor
- <preference: 'Corner Grip color'
- category: 'colors'
- description: 'The default color of window corners'
- type: #Color>
- ^(self passiveForm colorAt: 24 at 24) alpha: 1!
Item was removed:
- ----- Method: CornerGripMorph class>>passiveColor: (in category 'handle settings') -----
- passiveColor: aColor
- | canvas |
- canvas := self initializePassiveForm getCanvas.
- canvas privatePort fillPattern: aColor;
- combinationRule: Form rgbMul;
- fillRect: self passiveForm boundingBox offset: 0 @ 0.
- self
- allSubInstancesDo: [:each | each setDefaultColors; changed]!
Item was removed:
- ----- Method: CornerGripMorph class>>passiveForm (in category 'accessing') -----
- passiveForm
- ^PassiveForm ifNil: [self initializePassiveForm]!
Item was removed:
- ----- Method: CornerGripMorph>>activeForm (in category 'private') -----
- activeForm
- ^self clipForm: self class activeForm!
Item was removed:
- ----- Method: CornerGripMorph>>alphaHandle (in category 'drawing') -----
- alphaHandle
-
- handleColor ifNil: [handleColor := self passiveForm].
- "The following line is only needed on first load, so existing windows don't blow up from the new handles.
- Can safely be deleted along with this comment in a later update"
- (handleColor class == Form)
- ifFalse: [handleColor := self passiveForm].
- ^handleColor
-
-
- !
Item was removed:
- ----- Method: CornerGripMorph>>borderOffset (in category 'private') -----
- borderOffset
- "The offset from my corner to where the border starts"
- ^self subclassResponsibility!
Item was removed:
- ----- Method: CornerGripMorph>>clipForm: (in category 'private') -----
- clipForm: aHandle
- |cutArea|
- "This doesn't really needs to be done every draw, but only if border width changes.
- In that case,, we'd have to install a newly initialized one anyways, so the current method will fail.
- Good enough for now though."
- cutArea := self transparentRectangle.
- aHandle getCanvas image: cutArea
- at: self borderOffset
- sourceRect: cutArea boundingBox
- rule: Form and.
- ^aHandle
-
- !
Item was changed:
----- Method: CornerGripMorph>>defaultHeight (in category 'accessing') -----
defaultHeight
+ ^ self class handleLength!
- ^ self class gripThickness * 6!
Item was changed:
----- Method: CornerGripMorph>>defaultWidth (in category 'accessing') -----
defaultWidth
+ ^ self class handleLength!
- ^ self class gripThickness * 6!
Item was changed:
----- Method: CornerGripMorph>>drawOn: (in category 'drawing') -----
drawOn: aCanvas
+ "self showHandle
- self drawCornerResizeHandles
ifTrue: [
bounds := self bounds.
aCanvas
+ translucentImage: self alphaHandle
+ at: self topLeft
+ sourceRect: (self handleOrigin + (1 at 1) extent: self extent)]"!
- translucentImage: (self alphaHandle)
- at: (bounds origin )
- sourceRect: (self handleOrigin extent: bounds extent)]!
Item was added:
+ ----- Method: CornerGripMorph>>handleInset (in category 'accessing') -----
+ handleInset
+
+ ^ (handleInset notNil or: [self owner isNil])
+ ifTrue: [handleInset ifNil: [1]]
+ ifFalse: [self owner borderWidth max: 1]!
Item was removed:
- ----- Method: CornerGripMorph>>handleOrigin (in category 'private') -----
- handleOrigin
- "The handles origin is the offset into the alphaForm"
- ^self subclassResponsibility!
Item was changed:
----- Method: CornerGripMorph>>initialize (in category 'initialization') -----
initialize
+
super initialize.
+ self extent: self defaultWidth @ self defaultHeight.
+ self layoutFrame: self gripLayoutFrame.!
- self extent: self defaultWidth+2 @ (self defaultHeight+2).
- self layoutFrame: self gripLayoutFrame!
Item was changed:
----- Method: CornerGripMorph>>mouseDown: (in category 'event handling') -----
mouseDown: anEvent
+ "Disable drop shadow to improve performance while resizing."
- "Disable drop shadow to improve performance."
super mouseDown: anEvent.
+ self target ifNil: [^ self].
+ self target fastFramingOn ifFalse: [
- target ifNil: [^ self].
- target fastFramingOn ifFalse: [
self setProperty: #targetHadDropShadow toValue: target hasDropShadow.
+ self target hasDropShadow: false].!
- target hasDropShadow: false].!
Item was changed:
----- Method: CornerGripMorph>>mouseMove: (in category 'event handling') -----
mouseMove: anEvent
+
| delta |
+ self target ifNil: [^ self].
+ self target fastFramingOn
+ ifTrue: [delta := self target doFastWindowReframe: self ptName]
- target ifNil: [^ self].
- target fastFramingOn
- ifTrue: [delta := target doFastWindowReframe: self ptName]
ifFalse: [
+ delta := self referencePoint ifNil: [0 at 0] ifNotNil: [anEvent position - self referencePoint].
+ self referencePoint: anEvent position.
- delta := lastMouse ifNil: [0 at 0] ifNotNil: [anEvent cursorPoint - lastMouse].
- lastMouse := anEvent cursorPoint.
self apply: delta.
self bounds: (self bounds origin + delta extent: self bounds extent)].!
Item was changed:
----- Method: CornerGripMorph>>mouseUp: (in category 'event handling') -----
mouseUp: anEvent
+ "Restore target drop shadow if there was one. See #mouseDown:."
+
+ self target ifNil: [^ self].
+ self target fastFramingOn ifFalse: [
+ (self valueOfProperty: #targetHadDropShadow ifAbsent: [false]) ifTrue: [self target hasDropShadow: true].
-
- target ifNil: [^ self].
- target fastFramingOn ifFalse: [
- (self valueOfProperty: #targetHadDropShadow ifAbsent: [false]) ifTrue: [target hasDropShadow: true].
self removeProperty: #targetHadDropShadow].!
Item was removed:
- ----- Method: CornerGripMorph>>passiveForm (in category 'private') -----
- passiveForm
- ^self clipForm: self class passiveForm!
Item was removed:
- ----- Method: CornerGripMorph>>setDefaultColors (in category 'private') -----
- setDefaultColors
-
- handleColor := self passiveForm.!
Item was removed:
- ----- Method: CornerGripMorph>>setInverseColors (in category 'private') -----
- setInverseColors
- handleColor := self activeForm.!
Item was added:
+ ----- Method: CornerGripMorph>>showHandle (in category 'accessing') -----
+ showHandle
+
+ ^ showHandle ifNil: [self class drawCornerResizeHandles]!
Item was added:
+ ----- Method: CornerGripMorph>>target (in category 'accessing') -----
+ target
+
+ ^ target!
Item was changed:
+ ----- Method: CornerGripMorph>>target: (in category 'accessing') -----
- ----- Method: CornerGripMorph>>target: (in category 'accessing-backstop') -----
target: aMorph
target := aMorph!
Item was removed:
- ----- Method: CornerGripMorph>>transparentRectangle (in category 'private') -----
- transparentRectangle
- "This could be a class var, provided either bounds of grips does not change, or one ensures a new one is installed when such an event occurs"
- ^Form extent: self bounds extent depth: 32!
Item was changed:
----- Method: FillInTheBlankMorph>>setQuery:initialAnswer:answerExtent:acceptOnCR: (in category 'initialization') -----
setQuery: queryString initialAnswer: initialAnswer answerExtent: answerExtent acceptOnCR: acceptBoolean
| text |
result := initialAnswer.
done := false.
self paneMorph removeAllMorphs.
self title: 'Input Requested' translated.
self message: queryString.
text := self createTextPaneAcceptOnCR: acceptBoolean.
self paneMorph addMorphBack: text.
self paneMorph
wantsPaneSplitters: true;
addCornerGrips.
+ self paneMorph grips do: [:ea | ea showHandle: true].
- self paneMorph grips do: [:ea | ea drawCornerResizeHandles: true].
self paneMorph extent: ((initialAnswer asText asMorph extent + (20 at 10) max: answerExtent) min: 500 at 500).
self setDefaultParameters.!
Item was changed:
----- Method: LeftGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin + (delta x @ 0) corner: oldBounds corner)!
Item was changed:
----- Method: LeftGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (0 @ 0 corner: 0 @ 1)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: (self defaultWidth negated @ 0 corner: 0 @ 0)!
Item was added:
+ ----- Method: LeftGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ super layoutProportionallyIn: cellBounds.
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self left: owner left.
+
+ self top: owner top.
+ self height: owner height.!
Item was added:
+ ----- Method: LeftGripMorph>>orientation (in category 'accessing') -----
+ orientation
+
+ ^ #vertical!
Item was changed:
AbstractResizerMorph subclass: #ProportionalSplitterMorph
+ instanceVariableNames: 'leftOrTop rightOrBottom splitsTopAndBottom traceMorph movements'
- instanceVariableNames: 'leftOrTop rightOrBottom splitsTopAndBottom oldColor traceMorph handle movements'
classVariableNames: 'SmartHorizontalSplitters SmartVerticalSplitters'
poolDictionaries: ''
category: 'Morphic-Windows'!
!ProportionalSplitterMorph commentStamp: 'jmv 1/29/2006 17:16' prior: 0!
I am the morph the user grabs to adjust pane splitters.!
Item was changed:
----- Method: ProportionalSplitterMorph class>>fastSplitterResize (in category 'preferences') -----
fastSplitterResize
+ ^ Preferences fastDragWindowForMorphic!
- ^ Preferences fastDragWindowForMorphic.!
Item was added:
+ ----- Method: ProportionalSplitterMorph class>>showSplitterHandles: (in category 'preferences') -----
+ showSplitterHandles: aBoolean
+
+ Preferences setPreference: #showSplitterHandles toValue: aBoolean.
+ Project current restoreDisplay.!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>addLeftOrTop: (in category 'initialization') -----
- ----- Method: ProportionalSplitterMorph>>addLeftOrTop: (in category 'controlled morphs') -----
addLeftOrTop: aMorph
leftOrTop add: aMorph!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>addRightOrBottom: (in category 'initialization') -----
- ----- Method: ProportionalSplitterMorph>>addRightOrBottom: (in category 'controlled morphs') -----
addRightOrBottom: aMorph
rightOrBottom add: aMorph.
!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>balanceOffsets (in category 'events') -----
- ----- Method: ProportionalSplitterMorph>>balanceOffsets (in category 'layout') -----
balanceOffsets
| fdx fdy |
(self hasProperty: #fullDelta) ifFalse: [^ self].
fdx := (self valueOfProperty: #fullDelta) x.
fdy := (self valueOfProperty: #fullDelta) y.
self layoutFrame hasFixedHeight ifTrue: [
| otop obot ctop cbot topf |
otop := (owner submorphs detect: [:m |
m layoutFrame topFraction isZero] ifNone: [^ self]) in: [:tm |
tm top - (tm layoutFrame topOffset ifNil: [0])].
obot := (owner submorphs detect: [:m |
m layoutFrame bottomFraction = 1] ifNone: [^ self]) in: [:tm |
tm bottom - (tm layoutFrame bottomOffset ifNil: [0])].
ctop := (self layoutFrame topFraction * (obot - otop)) rounded
+ otop + (self layoutFrame topOffset ifNil: [0]).
cbot := (self layoutFrame bottomFraction * (obot - otop)) rounded
+ otop + (self layoutFrame bottomOffset ifNil: [0]).
topf := self layoutFrame topFraction.
self layoutFrame topFraction: ((ctop + cbot) * 0.5 - otop) / (obot - otop) asFloat.
self layoutFrame bottomFraction: self layoutFrame topFraction.
self layoutFrame topOffset: self layoutFrame topOffset - fdy.
self layoutFrame bottomOffset: self layoutFrame bottomOffset - fdy.
(leftOrTop copy union: rightOrBottom) do: [:m |
(m layoutFrame topFraction closeTo: topf) ifTrue: [
m layoutFrame topFraction: self layoutFrame topFraction.
m layoutFrame topOffset: m layoutFrame topOffset - fdy].
(m layoutFrame bottomFraction closeTo: topf) ifTrue: [
m layoutFrame bottomFraction: self layoutFrame topFraction.
m layoutFrame bottomOffset: m layoutFrame bottomOffset - fdy]]] .
self layoutFrame hasFixedWidth ifTrue: [
| oleft oright cleft cright leftf |
oleft := (owner submorphs detect: [:m |
m layoutFrame leftFraction isZero] ifNone: [^ self]) in: [:tm |
tm left - (tm layoutFrame leftOffset ifNil: [0])].
oright := (owner submorphs detect: [:m |
m layoutFrame rightFraction = 1] ifNone: [^ self]) in: [:tm |
tm right - (tm layoutFrame rightOffset ifNil: [0])].
cleft := (self layoutFrame leftFraction * (oright - oleft)) rounded
+ oleft + (self layoutFrame leftOffset ifNil: [0]).
cright := (self layoutFrame rightFraction * (oright - oleft)) rounded
+ oleft + (self layoutFrame rightOffset ifNil: [0]).
leftf := self layoutFrame leftFraction.
self layoutFrame leftFraction: ((cleft + cright) * 0.5 - oleft) / (oright - oleft) asFloat.
self layoutFrame rightFraction: self layoutFrame leftFraction.
self layoutFrame leftOffset: self layoutFrame leftOffset - fdx.
self layoutFrame rightOffset: self layoutFrame rightOffset - fdx.
(leftOrTop copy union: rightOrBottom) do: [:m |
(m layoutFrame leftFraction closeTo: leftf) ifTrue: [
m layoutFrame leftFraction: self layoutFrame leftFraction.
m layoutFrame leftOffset: m layoutFrame leftOffset - fdx].
(m layoutFrame rightFraction closeTo: leftf) ifTrue: [
m layoutFrame rightFraction: self layoutFrame leftFraction.
m layoutFrame rightOffset: m layoutFrame rightOffset - fdx.]]] .
self removeProperty: #fullDelta.
owner layoutChanged
!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>beSplitsLeftAndRight (in category 'initialization') -----
- ----- Method: ProportionalSplitterMorph>>beSplitsLeftAndRight (in category 'direction') -----
beSplitsLeftAndRight
splitsTopAndBottom := false.
self
hResizing: #rigid;
vResizing: #spaceFill.
self width: self class gripThickness.!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>beSplitsTopAndBottom (in category 'initialization') -----
- ----- Method: ProportionalSplitterMorph>>beSplitsTopAndBottom (in category 'direction') -----
beSplitsTopAndBottom
splitsTopAndBottom := true.
self
vResizing: #rigid;
hResizing: #spaceFill.
self height: self class gripThickness.!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>bordersOn: (in category 'queries - controlled morphs') -----
- ----- Method: ProportionalSplitterMorph>>bordersOn: (in category 'controlled morphs') -----
bordersOn: aMorph
"Answer true if the aMorph is one of my neighbours."
^ (leftOrTop includes: aMorph) or: [rightOrBottom includes: aMorph]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>bottomBoundary (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>bottomBoundary (in category 'boundaries') -----
bottomBoundary
"Answert the bottommost x position the receiver could be moved."
| splitter morphs |
splitter := self splitterBelow.
morphs := self commonNeighbours: rightOrBottom with: splitter.
^ (splitter
ifNil: [owner isSystemWindow ifTrue: [owner panelRect bottom]
ifFalse: [owner innerBounds bottom]]
ifNotNil: [splitter top])
- (self minimumHeightOf: morphs)!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>canEncroachWhiteSpaceOf: (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>canEncroachWhiteSpaceOf: (in category 'layout') -----
canEncroachWhiteSpaceOf: morphs
^ morphs allSatisfy: [ : each | each canBeEncroached ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>charactersOccludedIn: (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>charactersOccludedIn: (in category 'layout') -----
charactersOccludedIn: aCollection
^ aCollection
inject: 0
into:
[ : sum : each | sum +
(each isMorphicModel
ifTrue: [ each charactersOccluded ]
ifFalse: [ 0 ]) ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>commonNeighbours:with: (in category 'queries - controlled morphs') -----
- ----- Method: ProportionalSplitterMorph>>commonNeighbours:with: (in category 'controlled morphs') -----
commonNeighbours: morphs with: aProportionalSplitterMorphOrNil
"Answer the subset of morphs which is also confined by aProportionalSplitterMorphOrNil."
^ aProportionalSplitterMorphOrNil isNil
ifTrue: [morphs]
ifFalse: [morphs select: [ :which |
aProportionalSplitterMorphOrNil bordersOn: which]]!
Item was added:
+ ----- Method: ProportionalSplitterMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ self splitsLeftAndRight ifTrue: [
+ aCanvas
+ fillRoundRect: (((self width - (self handleInset * 2) max: 1) @ (self height * 0.25 min: self class handleLength)) center: self center)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor)].
+ self splitsTopAndBottom ifTrue: [
+ aCanvas
+ fillRoundRect: (((self width * 0.25 min: self class handleLength) @ (self height - (self handleInset * 2) max: 1)) center: self center)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor)] ].!
Item was removed:
- ----- Method: ProportionalSplitterMorph>>getOldColor (in category 'displaying') -----
- getOldColor
- ^ oldColor ifNil: [Color transparent]!
Item was removed:
- ----- Method: ProportionalSplitterMorph>>handleRect (in category 'displaying') -----
- handleRect
-
- ^ Rectangle
- center: self bounds center
- extent: (self splitsTopAndBottom
- ifTrue: [self handleSize transposed]
- ifFalse: [self handleSize])!
Item was removed:
- ----- Method: ProportionalSplitterMorph>>handleSize (in category 'displaying') -----
- handleSize
-
- ^ self class gripThickness @ 30!
Item was changed:
----- Method: ProportionalSplitterMorph>>initialize (in category 'initialization') -----
initialize
super initialize.
self beSplitsLeftAndRight.
leftOrTop := OrderedCollection new.
rightOrBottom := OrderedCollection new.
+ self initializeMovements.!
- Preferences showSplitterHandles
- ifTrue: [
- handle := CircleMorph new
- borderWidth: 0;
- extent: 4 at 4;
- yourself.
- handle fillStyle: ((GradientFillStyle
- ramp: {0.0 -> Color veryVeryLightGray muchLighter.
- 1.0 -> Color veryVeryLightGray darker})
- origin: handle topLeft;
- direction: 0 @ handle bounds extent y;
- normal: handle bounds extent x @ 0;
- radial: false;
- yourself).
- self addMorphCentered: handle].
- self initializeMovements!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>initializeMovements (in category 'smart splitters') -----
- ----- Method: ProportionalSplitterMorph>>initializeMovements (in category 'initialization') -----
initializeMovements
movements := OrderedCollection new: 3 withAll: 0!
Item was removed:
- ----- Method: ProportionalSplitterMorph>>isCursorOverHandle (in category 'testing') -----
- isCursorOverHandle
- ^ self class showSplitterHandles not or: [self handleRect containsPoint: ActiveHand cursorPoint]!
Item was removed:
- ----- Method: ProportionalSplitterMorph>>layoutChanged (in category 'layout') -----
- layoutChanged
-
- super layoutChanged.
- handle ifNotNil: [handle position: self bounds center - (2 at 2)]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>leftBoundary (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>leftBoundary (in category 'boundaries') -----
leftBoundary
"Answer the leftmost y position the receiver could be moved."
| splitter morphs |
splitter := self splitterLeft.
morphs := self commonNeighbours: leftOrTop with: splitter.
^ (splitter
ifNil: [owner isSystemWindow ifTrue: [owner panelRect left]
ifFalse: [owner innerBounds left]]
ifNotNil: [splitter right])
+ (self minimumWidthOf: morphs)!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>leftRightImbalance (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>leftRightImbalance (in category 'layout') -----
leftRightImbalance
"First check if I find myself out of range due to user having reduced size of parent."
^ self left < self leftBoundary "too far left"
ifTrue: [ self leftBoundary-self left ]
ifFalse:
[ self right > self rightBoundary "too far right"
ifTrue: [ self rightBoundary-self right ]
ifFalse: [ self occlusionDifference ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>minimumHeightOf: (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>minimumHeightOf: (in category 'boundaries') -----
minimumHeightOf: aCollection
"Answer the minimum height needed to display any of the morphs in aCollection.
See ProportionalLayout >> #minExtentOf:in:."
^ aCollection inject: 0 into: [ :height :morph |
| minHeight |
minHeight := morph minHeight.
"morph layoutFrame ifNotNil: [:frame |
minHeight := frame minHeightFrom: minHeight]."
minHeight + self height max: height]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>minimumWidthOf: (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>minimumWidthOf: (in category 'boundaries') -----
minimumWidthOf: aCollection
"Answer the minimum width needed to display any of the morphs in aCollection.
See ProportionalLayout >> #minExtentOf:in:."
^ aCollection inject: 0 into: [ :width :morph |
| minWidth |
minWidth := morph minWidth.
"morph layoutFrame ifNotNil: [:frame |
minWidth := frame minWidthFrom: minWidth]."
minWidth + self width max: width]!
Item was changed:
----- Method: ProportionalSplitterMorph>>mouseDown: (in category 'events') -----
mouseDown: anEvent
"If the user manually drags me, don't override him with auto positioning."
self setProperty: #fullDelta toValue: 0 at 0.
anEvent redButtonChanged
ifTrue: [ self withSiblingSplittersDo: [ : each | each stopStepping ] ]
ifFalse:
[ anEvent shiftPressed
ifTrue: [ self startStepping ]
ifFalse:
[ self startStepping.
self withSiblingSplittersDo: [ : each | each startStepping ] ] ].
+
- (self class showSplitterHandles not and: [ self bounds containsPoint: anEvent cursorPoint ]) ifTrue:
- [ oldColor := self color.
- self color: Color black ].
^ super mouseDown: anEvent!
Item was changed:
----- Method: ProportionalSplitterMorph>>mouseUp: (in category 'events') -----
mouseUp: anEvent
(self bounds containsPoint: anEvent cursorPoint) ifFalse: [ anEvent hand showTemporaryCursor: nil ].
self class fastSplitterResize ifTrue: [ self updateFromEvent: anEvent ].
traceMorph ifNotNil:
[ traceMorph delete.
traceMorph := nil ].
+
- self color: self getOldColor.
"balanceOffsets currently disrupts Smart Splitter behavior."
(ProportionalSplitterMorph smartVerticalSplitters or: [ ProportionalSplitterMorph smartHorizontalSplitters ]) ifFalse: [ self balanceOffsets ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>movements (in category 'smart splitters') -----
- ----- Method: ProportionalSplitterMorph>>movements (in category 'layout') -----
movements
"Used to track my pattern of movement for the last 3 steps to fix the twitching."
"Lazy-init for now for smooth transition -- want to convert this back to direct-var access after a few months."
^ movements ifNil: [ self initializeMovements. movements ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>normalizedX: (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>normalizedX: (in category 'boundaries') -----
normalizedX: x
^ (x max: self leftBoundary) min: self rightBoundary!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>normalizedY: (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>normalizedY: (in category 'boundaries') -----
normalizedY: y
^ (y max: self topBoundary) min: self bottomBoundary!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>occlusionDifference (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>occlusionDifference (in category 'events') -----
occlusionDifference
^ (self charactersOccludedIn: leftOrTop) - (self charactersOccludedIn: rightOrBottom)!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>proposedCorrectionWouldCauseFocusChange: (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>proposedCorrectionWouldCauseFocusChange: (in category 'layout') -----
proposedCorrectionWouldCauseFocusChange: correction
^ Preferences mouseOverForKeyboardFocus and:
[ | edge | splitsTopAndBottom
ifTrue:
[ edge := correction positive
ifTrue: [ self bottom + 3 ]
ifFalse: [ self top - 3 ].
self activeHand position y
inRangeOf: edge
and: edge + correction ]
ifFalse:
[ edge := correction positive
ifTrue: [ self right ]
ifFalse: [ self left ].
self activeHand position x
inRangeOf: edge
and: edge + correction ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>reduceLeftRightImbalance (in category 'smart splitters') -----
- ----- Method: ProportionalSplitterMorph>>reduceLeftRightImbalance (in category 'layout') -----
reduceLeftRightImbalance
| correction |
correction := self leftRightImbalance.
correction abs > 1
ifTrue:
[ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse:
[ self repositionBy:
(correction abs > 4
ifTrue: [ correction sign * 2 @ 0 ]
ifFalse: [ correction sign @ 0 ]) ] ]
ifFalse:
[ self class smartVerticalSplitters ifFalse: [ self stopStepping ] ].
^ correction!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>reduceTopBottomImbalance (in category 'smart splitters') -----
- ----- Method: ProportionalSplitterMorph>>reduceTopBottomImbalance (in category 'layout') -----
reduceTopBottomImbalance
| correction |
(correction := self topBottomCorrection) isZero
ifTrue:
[ self class smartHorizontalSplitters ifFalse: [ self stopStepping ] ]
ifFalse:
[ (self proposedCorrectionWouldCauseFocusChange: correction) ifFalse: [ self repositionBy: 0 @ correction ] ].
^ correction!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>repositionBy: (in category 'events') -----
- ----- Method: ProportionalSplitterMorph>>repositionBy: (in category 'layout') -----
repositionBy: delta
| selfTop selfBottom selfLeft selfRight |
self setProperty: #fullDelta toValue: ((self valueOfProperty: #fullDelta) ifNil: [0 at 0]) + delta.
leftOrTop do:
[ : each | | firstRight firstBottom firstLeft firstTop |
firstRight := each layoutFrame rightOffset ifNil: [ 0 ].
firstBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
each layoutFrame rightOffset: firstRight + delta x.
each layoutFrame bottomOffset: firstBottom + delta y.
each layoutFrame hasFixedHeight ifTrue: [
firstTop := each layoutFrame topOffset ifNil: [ 0 ].
each layoutFrame topOffset: firstTop + delta y ].
each layoutFrame hasFixedWidth ifTrue: [
firstLeft := each layoutFrame leftOffset ifNil: [ 0 ].
each layoutFrame leftOffset: firstLeft + delta x. ] ].
rightOrBottom do:
[ : each | | secondLeft secondTop secondRight secondBottom |
secondLeft := each layoutFrame leftOffset ifNil: [ 0 ].
secondTop := each layoutFrame topOffset ifNil: [ 0 ].
each layoutFrame leftOffset: secondLeft + delta x.
each layoutFrame topOffset: secondTop + delta y.
each layoutFrame hasFixedHeight ifTrue: [
secondBottom := each layoutFrame bottomOffset ifNil: [ 0 ].
each layoutFrame bottomOffset: secondBottom + delta y. ].
each layoutFrame hasFixedWidth ifTrue: [
secondRight := each layoutFrame rightOffset ifNil: [ 0 ].
each layoutFrame rightOffset: secondRight + delta x. ] ].
selfTop := self layoutFrame topOffset ifNil: [ 0 ].
selfBottom := self layoutFrame bottomOffset ifNil: [ 0 ].
selfLeft := self layoutFrame leftOffset ifNil: [ 0 ].
selfRight := self layoutFrame rightOffset ifNil: [ 0 ].
self layoutFrame
topOffset: selfTop + delta y ;
bottomOffset: selfBottom + delta y ;
leftOffset: selfLeft + delta x ;
rightOffset: selfRight + delta x.
self owner layoutChanged.
self movements removeFirst; add: (splitsTopAndBottom ifTrue: [ delta y sign ] ifFalse: [ delta x sign ])!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>resizeCursor (in category 'accessing') -----
- ----- Method: ProportionalSplitterMorph>>resizeCursor (in category 'displaying') -----
resizeCursor
^ Cursor resizeForEdge: (splitsTopAndBottom
ifTrue: [#top]
ifFalse: [#left])
!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>rightBoundary (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>rightBoundary (in category 'boundaries') -----
rightBoundary
"Answer the rightmost x position the receiver could be moved to."
| splitter morphs |
splitter := self splitterRight.
morphs := self commonNeighbours: rightOrBottom with: splitter.
^ (splitter
ifNil: [owner isSystemWindow ifTrue: [owner panelRect right]
ifFalse: [owner innerBounds right]]
ifNotNil: [splitter left])
- (self minimumWidthOf: morphs)!
Item was added:
+ ----- Method: ProportionalSplitterMorph>>showHandle (in category 'accessing') -----
+ showHandle
+
+ ^ showHandle ifNil: [self class showSplitterHandles]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>siblingSplittersDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>siblingSplittersDo: (in category 'adjacent splitters') -----
siblingSplittersDo: aBlock
owner ifNotNil:
[ owner submorphsDo:
[ : each | ((each isKindOf: self class) and:
[ self splitsTopAndBottom = each splitsTopAndBottom and: [ each ~= self ] ]) ifTrue: [ aBlock value: each ] ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitsLeftAndRight (in category 'testing') -----
- ----- Method: ProportionalSplitterMorph>>splitsLeftAndRight (in category 'direction') -----
splitsLeftAndRight
^ self splitsTopAndBottom not!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitsTopAndBottom (in category 'testing') -----
- ----- Method: ProportionalSplitterMorph>>splitsTopAndBottom (in category 'direction') -----
splitsTopAndBottom
^ splitsTopAndBottom!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitterAbove (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splitterAbove (in category 'adjacent splitters') -----
splitterAbove
| immediatelyAbove |
immediatelyAbove := nil.
self siblingSplittersDo:
[ : each | "Splitter y's map 0 at the bottom."
each y > self y ifTrue:
[ immediatelyAbove
ifNil: [ immediatelyAbove := each ]
ifNotNil:
[ each y < immediatelyAbove y ifTrue: [ immediatelyAbove := each ] ] ] ].
^ immediatelyAbove!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitterBelow (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splitterBelow (in category 'adjacent splitters') -----
splitterBelow
| immediatelyBelow |
immediatelyBelow := nil.
self siblingSplittersDo:
[ : each | each y < self y ifTrue:
[ immediatelyBelow
ifNil: [ immediatelyBelow := each ]
ifNotNil:
[ each y > immediatelyBelow y ifTrue: [ immediatelyBelow := each ] ] ] ].
^ immediatelyBelow!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitterLeft (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splitterLeft (in category 'adjacent splitters') -----
splitterLeft
| immediateLeft |
immediateLeft := nil.
self siblingSplittersDo:
[ : each | each x < self x ifTrue:
[ immediateLeft
ifNil: [ immediateLeft := each ]
ifNotNil:
[ each x > immediateLeft x ifTrue: [ immediateLeft := each ] ] ] ].
^ immediateLeft!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splitterRight (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splitterRight (in category 'adjacent splitters') -----
splitterRight
| immediateRight |
immediateRight := nil.
self siblingSplittersDo:
[ : each | each x > self x ifTrue:
[ immediateRight
ifNil: [ immediateRight := each ]
ifNotNil:
[ each x < immediateRight x ifTrue: [ immediateRight := each ] ] ] ].
^ immediateRight!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splittersAboveDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splittersAboveDo: (in category 'adjacent splitters') -----
splittersAboveDo: aBlock
self splitterAbove ifNotNil:
[ : splitter | aBlock value: splitter.
splitter splittersAboveDo: aBlock ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splittersBelowDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splittersBelowDo: (in category 'adjacent splitters') -----
splittersBelowDo: aBlock
self splitterBelow ifNotNil:
[ : splitter | aBlock value: splitter.
splitter splittersBelowDo: aBlock ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splittersLeftDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splittersLeftDo: (in category 'adjacent splitters') -----
splittersLeftDo: aBlock
self splitterLeft ifNotNil:
[ : splitter | aBlock value: splitter.
splitter splittersLeftDo: aBlock ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>splittersRightDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>splittersRightDo: (in category 'adjacent splitters') -----
splittersRightDo: aBlock
self splitterRight ifNotNil:
[ : splitter | aBlock value: splitter.
splitter splittersRightDo: aBlock ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>step (in category 'smart splitters - stepping') -----
- ----- Method: ProportionalSplitterMorph>>step (in category 'events') -----
step
splitsTopAndBottom
ifTrue: [ self reduceTopBottomImbalance ]
ifFalse:
[ self reduceLeftRightImbalance abs > 1 ifTrue:
[ self splittersLeftDo:
[ : splitter | splitter reduceLeftRightImbalance ].
self splittersRightDo:
[ : splitter | splitter reduceLeftRightImbalance ] ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>stepTime (in category 'smart splitters - stepping') -----
- ----- Method: ProportionalSplitterMorph>>stepTime (in category 'events') -----
stepTime
"When a splitter finds itself in the right place, let it rest for about 3 seconds to avoid performance impacts of constant, rapid stepping."
| pause |
pause := 3000. "Frozen image when atRandom failed due to lock on its Mutex."
^ ({#(1 -1 1 ). #(-1 1 -1 )} includes: self movements asArray)
ifTrue: [ pause "don't twitch" ]
ifFalse:
[ splitsTopAndBottom
ifTrue:
[ self topBottomCorrection isZero
ifTrue: [ pause ]
ifFalse: [ 0 ] ]
ifFalse:
[ self leftRightImbalance abs > 1
ifTrue: [ ">1 rather than 0 to discourage one-off twitching"
0 ]
ifFalse: [ pause ] ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>stopStepping (in category 'smart splitters - stepping') -----
- ----- Method: ProportionalSplitterMorph>>stopStepping (in category 'events') -----
stopStepping
super stopStepping.
(self class smartVerticalSplitters or: [ self class smartHorizontalSplitters ]) ifFalse: [ self balanceOffsets ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>topBottomCorrection (in category 'smart splitters - queries') -----
- ----- Method: ProportionalSplitterMorph>>topBottomCorrection (in category 'layout') -----
topBottomCorrection
^ self top < self topBoundary
ifTrue: [ self topBoundary - self top ]
ifFalse:
[ self bottom > (self bottomBoundary)
ifTrue: [ self bottomBoundary - self bottom ]
ifFalse:
[ | wsAbove wsBelow |
wsAbove := self canEncroachWhiteSpaceOf: leftOrTop.
wsBelow := self canEncroachWhiteSpaceOf: rightOrBottom.
wsAbove
ifTrue:
[ wsBelow
ifTrue:
[ self splitterBelow
ifNil: [0]
ifNotNil: [ : below | below reduceTopBottomImbalance min: 0 ] ]
ifFalse: [ (self top > self topBoundary) ifTrue: [-2] ifFalse: [0] ] ]
ifFalse:
[ wsBelow
ifTrue: [ (self bottom < self bottomBoundary) ifTrue: [2] ifFalse: [0] ]
ifFalse:
[ self splitterBelow
ifNil: [0]
ifNotNil: [ : below | below reduceTopBottomImbalance max: 0 ] ] ] ] ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>topBoundary (in category 'queries - geometry') -----
- ----- Method: ProportionalSplitterMorph>>topBoundary (in category 'boundaries') -----
topBoundary
"Answer the topmost x position the receiver could be moved to."
| splitter morphs |
splitter := self splitterAbove.
morphs := self commonNeighbours: leftOrTop with: splitter.
^ (splitter
ifNil: [owner isSystemWindow ifTrue: [owner panelRect top]
ifFalse: [owner innerBounds top]]
ifNotNil: [splitter bottom])
+ (self minimumHeightOf: morphs)!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>wantsSteps (in category 'smart splitters - stepping') -----
- ----- Method: ProportionalSplitterMorph>>wantsSteps (in category 'events') -----
wantsSteps
^ splitsTopAndBottom
ifTrue: [ self class smartHorizontalSplitters ]
ifFalse: [ self class smartVerticalSplitters ]!
Item was changed:
+ ----- Method: ProportionalSplitterMorph>>withSiblingSplittersDo: (in category 'queries - adjacent splitters') -----
- ----- Method: ProportionalSplitterMorph>>withSiblingSplittersDo: (in category 'adjacent splitters') -----
withSiblingSplittersDo: aBlock
aBlock value: self.
self siblingSplittersDo: aBlock!
Item was changed:
----- Method: RightGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin corner: oldBounds corner + (delta x @ 0))!
Item was changed:
----- Method: RightGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (1 @ 0 corner: 1 @ 1)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: (0 @ self defaultHeight negated corner: self defaultWidth @ 0)!
Item was added:
+ ----- Method: RightGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ super layoutProportionallyIn: cellBounds.
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self right: owner right.
+
+ self top: owner top.
+ self height: owner height.!
Item was added:
+ ----- Method: RightGripMorph>>orientation (in category 'accessing') -----
+ orientation
+
+ ^ #vertical!
Item was changed:
----- Method: TopGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin + (0 @ delta y) corner: oldBounds corner)!
Item was changed:
----- Method: TopGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (0 @ 0 corner: 1 @ 0)
+ offsets: (0 @ 0 corner: 0@ 0)!
- offsets: (0 @ (-40 - self defaultHeight) corner: 0@ 0)!
Item was added:
+ ----- Method: TopGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ super layoutProportionallyIn: cellBounds.
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self top: owner top.!
Item was added:
+ ----- Method: TopGripMorph>>orientation (in category 'accessing') -----
+ orientation
+
+ ^ #horizontal!
Item was changed:
----- Method: TopLeftGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin + delta corner: oldBounds corner)!
Item was removed:
- ----- Method: TopLeftGripMorph>>borderOffset (in category 'private') -----
- borderOffset
- |width|
- width :=SystemWindow borderWidth +1.
- ^self handleOrigin + width asPoint!
Item was added:
+ ----- Method: TopLeftGripMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ aCanvas
+ fillRoundRect: ((self topLeft + self handleInset asPoint extent: self class gripThickness @ self height) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).
+ aCanvas
+ fillRoundRect: ((self topLeft + self handleInset asPoint extent: self width @ self class gripThickness) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).
+
+
+ ].!
Item was removed:
- ----- Method: TopLeftGripMorph>>handleOrigin (in category 'private') -----
- handleOrigin
- ^25 at 25!
Item was changed:
----- Method: TopLeftGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self topLeft: owner topLeft.!
- layoutProportionallyIn: newBounds
- | b |
- b := owner bounds.
- self bounds: (b topLeft extent: self extent)
- !
Item was changed:
+ ----- Method: TopLeftGripMorph>>ptName (in category 'accessing') -----
- ----- Method: TopLeftGripMorph>>ptName (in category 'target resize') -----
ptName
^#topLeft!
Item was changed:
----- Method: TopRightGripMorph>>apply: (in category 'target resize') -----
apply: delta
| oldBounds |
+ oldBounds := self target bounds.
+ self target
- oldBounds := target bounds.
- target
bounds: (oldBounds origin + (0 at delta y) corner: oldBounds corner + (delta x @ 0))!
Item was removed:
- ----- Method: TopRightGripMorph>>borderOffset (in category 'private') -----
- borderOffset
- |width|
- width :=SystemWindow borderWidth +1 .
- ^self handleOrigin + ( width negated @ (width) )!
Item was added:
+ ----- Method: TopRightGripMorph>>drawOn: (in category 'drawing') -----
+ drawOn: aCanvas
+
+ super drawOn: aCanvas.
+
+ self showHandle ifTrue: [
+ aCanvas
+ fillRoundRect: ((self topRight + ((self handleInset negated + self class gripThickness negated) @ self handleInset) extent: self class gripThickness @ self height) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).
+ aCanvas
+ fillRoundRect: ((self topLeft + (self handleInset negated @ self handleInset) extent: self width @ self class gripThickness) insetBy: self handleInset)
+ radius: 3
+ fillStyle: (SolidFillStyle color: self handleColor).]!
Item was changed:
----- Method: TopRightGripMorph>>gripLayoutFrame (in category 'accessing') -----
gripLayoutFrame
^ LayoutFrame
fractions: (1 @ 0 corner: 1 @ 0)
+ offsets: (0 @ 0 corner: 0 @ 0)!
- offsets: (0 @ 0 corner: 0 @ 0)!
Item was removed:
- ----- Method: TopRightGripMorph>>handleOrigin (in category 'private') -----
- handleOrigin
- ^0 at 25!
Item was changed:
----- Method: TopRightGripMorph>>layoutProportionallyIn: (in category 'layout') -----
+ layoutProportionallyIn: cellBounds
+
+ self flag: #workaround. "mt: We cannot know that our owner has always the correct new bounds at this time."
+ self topRight: owner topRight.!
- layoutProportionallyIn: newBounds
- | b |
- b := owner bounds.
-
- self bounds: (b right - self width @ b top extent: self extent)
- !
Item was changed:
+ (PackageInfo named: 'Morphic') postscript: '"Migrate all open resizers."
+ AbstractResizerMorph allSubInstancesDo: [:ea |
+ ea handleColor isColor ifFalse: [ea handleColor: nil].
+ ea removeAllMorphs].
+
+ "Re-enable deprecation warnings in Trunk."
+ Deprecation showDeprecationWarnings: true.'!
- (PackageInfo named: 'Morphic') postscript: 'SmalltalkEditor initializeShiftCmdKeyShortcuts'!
More information about the Packages
mailing list