[squeak-dev] The Trunk: Morphic-nice.284.mcz

commits at source.squeak.org commits at source.squeak.org
Sun Jan 3 14:45:04 UTC 2010


Nicolas Cellier uploaded a new version of Morphic to project The Trunk:
http://source.squeak.org/trunk/Morphic-nice.284.mcz

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

Name: Morphic-nice.284
Author: nice
Time: 3 January 2010, 3:44:17 am
UUID: 8c0a0ffb-a89c-4076-95ce-4d17dd09bfc0
Ancestors: Morphic-ar.283

move #basicType to EToys
remove some #or:or: #and:and: sends

=============== Diff against Morphic-ar.283 ===============

Item was changed:
  ----- Method: PolygonMorph>>addHandles (in category 'editing') -----
  addHandles
  	"Put moving handles at the vertices. Put adding handles at
  	edge midpoints.
  	Moving over adjacent vertex and dropping will delete a
  	vertex. "
  	| tri |
  	self removeHandles.
  	handles := OrderedCollection new.
  	tri := Array
  				with: 0 @ -4
  				with: 4 @ 3
  				with: -3 @ 3.
  	vertices
  		withIndexDo: [:vertPt :vertIndex | 
  			| handle |
  			handle := EllipseMorph
  						newBounds: (Rectangle center: vertPt extent: 8 @ 8)
  						color: (self handleColorAt: vertIndex) .
  			handle
  				on: #mouseMove
  				send: #dragVertex:event:fromHandle:
  				to: self
  				withValue: vertIndex.
  			handle
  				on: #mouseUp
  				send: #dropVertex:event:fromHandle:
  				to: self
  				withValue: vertIndex.
  				handle
  				on: #click
  				send: #clickVertex:event:fromHandle:
  				to: self
  				withValue: vertIndex.
  			self addMorph: handle.
  			handles addLast: handle.
  			(closed
  					or: [1 = vertices size
  						"Give a small polygon a chance to grow. 
+ 						-wiz"
+ 					or: [vertIndex < vertices size]])
- 						-wiz"]
- 					or: [vertIndex < vertices size])
  				ifTrue: [| newVert |
  					newVert := PolygonMorph
  								vertices: (tri
  										collect: [:p | p + (vertPt
  													+ (vertices atWrap: vertIndex + 1) // 2)])
  								color: Color green
  								borderWidth: 1
  								borderColor: Color black.
  					newVert
  						on: #mouseDown
  						send: #newVertex:event:fromHandle:
  						to: self
  						withValue: vertIndex.
  					self addMorph: newVert.
  					handles addLast: newVert]].
  	self isCurvy
  		ifTrue: [self updateHandles; layoutChanged].
  	self changed!

Item was changed:
  ----- Method: MenuIcons class>>importIconNamed: (in category 'import/export') -----
  importIconNamed: aString
  	"self importIconNamed: 'Icons16:appearanceIcon'"
  
  	
  	| writer image stream |
  	writer := GIFReadWriter on: (FileStream fileNamed: aString, '.gif').
+ 	image := [ writer nextImage]	
- 	[ image := writer nextImage]	
  		ensure: [writer close].
  	stream := ReadWriteStream on: (String new).
  	stream nextPutAll: aString ; cr.
  	stream nextPutAll: (self methodStart: aString).
  	image storeOn: stream.
  	stream nextPutAll: self methodEnd.
  	MenuIcons class compile: stream contents classified: 'accessing - icons' notifying: nil.
  	^ stream contents!

Item was changed:
  ----- Method: MenuMorph>>drawOn: (in category 'drawing') -----
  drawOn: aCanvas 
  	"Draw the menu. Add keyboard-focus feedback if appropriate"
  
  	super drawOn: aCanvas.
  
  	(ActiveHand notNil
+ 			and: [ActiveHand keyboardFocus == self
+ 			and: [self rootMenu hasProperty: #hasUsedKeyboard]])
- 			and: [ActiveHand keyboardFocus == self]
- 			and: [self rootMenu hasProperty: #hasUsedKeyboard])
  		ifTrue: [
  			aCanvas
  				frameAndFillRectangle: self innerBounds
  				fillColor: Color transparent
  				borderWidth: Preferences menuBorderWidth
  				borderColor: Preferences keyboardFocusColor
  		].
  !

Item was changed:
  ----- Method: DockingBarMorph>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  	"private - set the default parameter using Preferences as the inspiration source"
  	| colorFromMenu worldColor menuColor menuBorderColor |
  	colorFromMenu := Preferences menuColorFromWorld
+ 				and: [Display depth > 4
+ 				and: [(worldColor := self currentWorld color) isColor]].
- 				and: [Display depth > 4]
- 				and: [(worldColor := self currentWorld color) isColor].
  	""
  	menuColor := colorFromMenu
  				ifTrue: [worldColor luminance > 0.7
  						ifTrue: [worldColor mixed: 0.85 with: Color black]
  						ifFalse: [worldColor mixed: 0.4 with: Color white]]
  				ifFalse: [Preferences menuColor].
  	""
  	menuBorderColor := Preferences menuAppearance3d
  				ifTrue: [#raised]
  				ifFalse: [colorFromMenu
  						ifTrue: [worldColor muchDarker]
  						ifFalse: [Preferences menuBorderColor]].
  	""
  	self
  		setColor: menuColor
  		borderWidth: Preferences menuBorderWidth
  		borderColor: menuBorderColor!

Item was changed:
  ----- Method: Morph>>addYellowButtonMenuItemsTo:event: (in category 'menu') -----
  addYellowButtonMenuItemsTo: aMenu event: evt 
  	"Populate aMenu with appropriate menu items for a  
  	yellow-button (context menu) click."
  	aMenu defaultTarget: self.
  	""
  	Preferences noviceMode
  		ifFalse: [aMenu addStayUpItem].
  	""
  	self addModelYellowButtonItemsTo: aMenu event: evt.
  	""
  	Preferences generalizedYellowButtonMenu
  		ifFalse: [^ self].
  	""
  	Preferences cmdGesturesEnabled
  		ifTrue: [""
  			aMenu addLine.
  			aMenu add: 'inspect' translated action: #inspect].
  	""
  	aMenu addLine.
  	self world selectedObject == self
  		ifTrue: [aMenu add: 'deselect' translated action: #removeHalo]
  		ifFalse: [aMenu add: 'select' translated action: #addHalo].
  	""
  	(self isWorldMorph
+ 			or: [self mustBeBackmost
+ 			or: [self wantsToBeTopmost]])
- 			or: [self mustBeBackmost]
- 			or: [self wantsToBeTopmost])
  		ifFalse: [""
  			aMenu addLine.
  			aMenu add: 'send to back' translated action: #goBehind.
  			aMenu add: 'bring to front' translated action: #comeToFront.
  			self addEmbeddingMenuItemsTo: aMenu hand: evt hand].
  	""
  	self isWorldMorph
  		ifFalse: [""
  	Smalltalk
  		at: #NCAAConnectorMorph
  		ifPresent: [:connectorClass | 
  			aMenu addLine.
  			aMenu add: 'connect to' translated action: #startWiring.
  			aMenu addLine].
  	""
  
  			self isFullOnScreen
  				ifFalse: [aMenu add: 'move onscreen' translated action: #goHome]].
  	""
  	Preferences noviceMode
  		ifFalse: [""
  			self addLayoutMenuItems: aMenu hand: evt hand.
  			(owner notNil
  					and: [owner isTextMorph])
  				ifTrue: [self addTextAnchorMenuItems: aMenu hand: evt hand]].
  	""
  	self isWorldMorph
  		ifFalse: [""
  			aMenu addLine.
  			self addToggleItemsToHaloMenu: aMenu].
  	""
  	aMenu addLine.
  	self isWorldMorph
  		ifFalse: [aMenu add: 'copy to paste buffer' translated action: #copyToPasteBuffer:].
  	(self allStringsAfter: nil) isEmpty
  		ifFalse: [aMenu add: 'copy text' translated action: #clipText].
  	""
  	self addExportMenuItems: aMenu hand: evt hand.
  	""
  	(Preferences noviceMode not
  			and: [self isWorldMorph not])
  		ifTrue: [""
  			aMenu addLine.
  			aMenu add: 'adhere to edge...' translated action: #adhereToEdge].
  	""
  	self addCustomMenuItems: aMenu hand: evt hand!

Item was changed:
  ----- Method: FillInTheBlankMorph>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  	"change the receiver's appareance parameters"
  
  	| colorFromMenu worldColor menuColor |
  
  	colorFromMenu := Preferences menuColorFromWorld
+ 									and: [Display depth > 4
+ 									and: [(worldColor := self currentWorld color) isColor]].
- 									and: [Display depth > 4]
- 									and: [(worldColor := self currentWorld color) isColor].
  
  	menuColor := colorFromMenu
  						ifTrue: [worldColor luminance > 0.7
  										ifTrue: [worldColor mixed: 0.85 with: Color black]
  										ifFalse: [worldColor mixed: 0.4 with: Color white]]
  						ifFalse: [Preferences menuColor].
  
  	self color: menuColor.
  	self borderWidth: Preferences menuBorderWidth.
  
  	Preferences menuAppearance3d ifTrue: [
  		self borderStyle: BorderStyle thinGray.
  		self
  			addDropShadow;
  			shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666);
  			shadowOffset: 1 @ 1
  	]
  	ifFalse: [
  		| menuBorderColor |
  		menuBorderColor := colorFromMenu
  										ifTrue: [worldColor muchDarker]
  										ifFalse: [Preferences menuBorderColor].
  		self borderColor: menuBorderColor.
  	].
  
  
  	self layoutInset: 3.
  !

Item was changed:
  ----- Method: PasteUpMorph>>mouseDown: (in category 'event handling') -----
  mouseDown: evt
  	"Handle a mouse down event."
  	| grabbedMorph handHadHalos |
  
  	(Preferences generalizedYellowButtonMenu
  			and: [evt yellowButtonPressed])
  		ifTrue: [^ self yellowButtonActivity: evt shiftPressed].
  
  	grabbedMorph := self morphToGrab: evt.
  	grabbedMorph ifNotNil:[
  		grabbedMorph isSticky ifTrue:[^self].
  		self isPartsBin ifFalse:[^evt hand grabMorph: grabbedMorph].
  		grabbedMorph := grabbedMorph partRepresented duplicate.
  		grabbedMorph restoreSuspendedEventHandler.
  		(grabbedMorph fullBounds containsPoint: evt position) 
  			ifFalse:[grabbedMorph position: evt position].
  		"Note: grabbedMorph is ownerless after duplicate so use #grabMorph:from: instead"
  		^ evt hand grabMorph: grabbedMorph from: self].
  
  	(super handlesMouseDown: evt)
  		ifTrue:[^super mouseDown: evt].
  
  	handHadHalos := evt hand halo notNil.
  
  	evt hand removeHalo. "shake off halos"
  	evt hand releaseKeyboardFocus. "shake of keyboard foci"
  
  	self submorphs
  		select:[:each | each hasProperty: #morphHierarchy]
  		thenDo:[:each | each delete].
  
  	Preferences noviceMode
  		ifTrue:[
  			self submorphs
  				select:[:each | (each isKindOf: MenuMorph) and:[each stayUp not]]
  				thenDo:[:each | each delete].
  		].
  
  	(evt shiftPressed not
+ 			and:[ self isWorldMorph not 
+ 			and:[ self wantsEasySelection not ]])
- 			and:[ self isWorldMorph not ]
- 			and:[ self wantsEasySelection not ])
  	ifTrue:[
  		"explicitly ignore the event if we're not the world and we'll not select,
  		so that we could be picked up if need be"
  		evt wasHandled: false.
  		^ self.
  	].
  
  	( evt shiftPressed or: [ self wantsEasySelection ] ) ifTrue:[
  		"We'll select on drag, let's decide what to do on click"
  		| clickSelector |
  
  		clickSelector := nil.
  
  		evt shiftPressed ifTrue:[
  			clickSelector := #findWindow:.
  		]
  		ifFalse:[
  			self isWorldMorph ifTrue:[
  				clickSelector := handHadHalos
  										ifTrue: [ #delayedInvokeWorldMenu: ]
  										ifFalse: [ #invokeWorldMenu: ]
  			]
  		].
  
  		evt hand 
  				waitForClicksOrDrag: self 
  				event: evt 
  				selectors: { clickSelector. nil. nil. #dragThroughOnDesktop: }
  				threshold: 5.
  	]
  	ifFalse:[
  		"We wont select, just bring world menu if I'm the world"
  		self isWorldMorph ifTrue:[
  			handHadHalos
  				ifTrue: [ self delayedInvokeWorldMenu: evt ]
  				ifFalse: [ self invokeWorldMenu: evt ]
  		]
  	].
  !

Item was changed:
  ----- Method: ProportionalSplitterMorph>>siblingSplitters (in category 'as yet unclassified') -----
  siblingSplitters
  
+ 	^ self owner submorphsSatisfying: [:each | (each isKindOf: self class) and: [self splitsTopAndBottom = each splitsTopAndBottom and: [each ~= self]]]!
- 	^ self owner submorphsSatisfying: [:each | (each isKindOf: self class) and: [self splitsTopAndBottom = each splitsTopAndBottom] and: [each ~= self]]!

Item was changed:
  ----- Method: MenuIcons class>>importAllIconNamed: (in category 'import/export') -----
  importAllIconNamed: aString
  	"self importIconNamed: 'Icons16:appearanceIcon'"
  
  	
  	| writer image stream |
  	writer := GIFReadWriter on: (FileStream fileNamed: aString, '.gif').
+ 	image := [ writer nextImage]	
- 	[ image := writer nextImage]	
  		ensure: [writer close].
  	stream := ReadWriteStream on: (String new).
  	stream nextPutAll: aString ; cr.
  	stream nextPutAll: (self methodStart: aString).
  	image storeOn: stream.
  	stream nextPutAll: self methodEnd.
  	^ stream contents!

Item was changed:
  ----- Method: SystemProgressMorph>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  	"change the receiver's appareance parameters"
  
  	| colorFromMenu worldColor menuColor |
  
  	colorFromMenu := Preferences menuColorFromWorld
+ 									and: [Display depth > 4
+ 									and: [(worldColor := self currentWorld color) isColor]].
- 									and: [Display depth > 4]
- 									and: [(worldColor := self currentWorld color) isColor].
  
  	menuColor := colorFromMenu
  						ifTrue: [worldColor luminance > 0.7
  										ifTrue: [worldColor mixed: 0.85 with: Color black]
  										ifFalse: [worldColor mixed: 0.4 with: Color white]]
  						ifFalse: [Preferences menuColor].
  
  	self color: menuColor.
  	
  	Preferences roundedMenuCorners
  		ifTrue: [self useRoundedCorners].
  	self borderWidth: Preferences menuBorderWidth.
  
  	Preferences menuAppearance3d ifTrue: [
  		self borderStyle: BorderStyle thinGray.
  		self
  			addDropShadow;
  			shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666);
  			shadowOffset: 1 @ 1
  	]
  	ifFalse: [
  		| menuBorderColor |
  		menuBorderColor := colorFromMenu
  										ifTrue: [worldColor muchDarker]
  										ifFalse: [Preferences menuBorderColor].
  		self borderColor: menuBorderColor.
  	].
  
  	self
  		updateColor: self
  		color: self color
  		intensity: 1.!

Item was changed:
  ----- Method: MorphListItemWrapper>>contents (in category 'accessing') -----
  contents
  	"Answer the receiver's contents"
  
  	| tentative submorphs |
  	tentative := item submorphs
  				collect: [:each | each renderedMorph].
  
  	submorphs := Preferences noviceMode
+ 				ifTrue: [
- 				ifTrue: [""
  					tentative
+ 						reject: [:each |
- 						reject: [:each | ""
  							each isSystemWindow
+ 								or: [each isDockingBar
+ 								or: [(each isKindOf: HaloMorph)
+ 								or: [(each hasProperty: #morphHierarchy)
+ 								or: [each isFlapOrTab
+ 								or: [each isObjectsTool]]]]]]]
+ 				ifFalse: [
- 								or: [each isDockingBar]
- 								or: [each isKindOf: HaloMorph]
- 								or: [each hasProperty: #morphHierarchy]
- 								or: [each isFlapOrTab]
- 								or: [each isObjectsTool]]]
- 				ifFalse: [""
  					tentative
  						reject: [:each | each isKindOf: HaloMorph]].
  
  	^ submorphs
  		collect: [:each | self class with: each]!

Item was changed:
  ----- Method: MenuMorph>>setDefaultParameters (in category 'initialization') -----
  setDefaultParameters
  	"change the receiver's appareance parameters"
  
  	| colorFromMenu worldColor menuColor |
  	
  	colorFromMenu := Preferences menuColorFromWorld
+ 									and: [Display depth > 4
+ 									and: [(worldColor := self currentWorld color) isColor]].
- 									and: [Display depth > 4]
- 									and: [(worldColor := self currentWorld color) isColor].
  
  	menuColor := colorFromMenu
  						ifTrue: [worldColor luminance > 0.7
  										ifTrue: [worldColor mixed: 0.85 with: Color black]
  										ifFalse: [worldColor mixed: 0.4 with: Color white]]
  						ifFalse: [Preferences menuColor].
  
  	self color: menuColor.
  	self borderWidth: Preferences menuBorderWidth.
  
  	Preferences menuAppearance3d ifTrue: [
  		self borderStyle: BorderStyle thinGray.
  		self
  			addDropShadow;
  			shadowColor: (TranslucentColor r: 0.0 g: 0.0 b: 0.0 alpha: 0.666);
  			shadowOffset: 1 @ 1
  	]
  	ifFalse: [
  		| menuBorderColor |
  		menuBorderColor := colorFromMenu
  										ifTrue: [worldColor muchDarker]
  										ifFalse: [Preferences menuBorderColor].
  		self borderColor: menuBorderColor.
  	].
  
  
  	self layoutInset: 3.
  !

Item was removed:
- ----- Method: SketchMorph>>basicType (in category 'testing') -----
- basicType
- 	"Answer a symbol representing the inherent type I hold"
- 
- 	"Number String Boolean player collection sound color etc"
- 	^ #Image!

Item was removed:
- ----- Method: TextMorph>>basicType (in category 'testing') -----
- basicType
- 	"Answer a symbol representing the inherent type I hold"
- 
- 	"Number String Boolean player collection sound color etc"
- 	^ #Text!

Item was removed:
- ----- Method: ImageMorph>>basicType (in category 'testing') -----
- basicType
- 	"Answer a symbol representing the inherent type I hold"
- 
- 	"Number String Boolean player collection sound color etc"
- 	^ #Image!




More information about the Squeak-dev mailing list