[Pkg] The Trunk: Morphic-nice.439.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jun 11 20:19:26 UTC 2010


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

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

Name: Morphic-nice.439
Author: nice
Time: 11 June 2010, 10:18:01.35 pm
UUID: 5b1dcbd2-5f22-0146-8ff3-3ff65d40984e
Ancestors: Morphic-cmm.438

Use String>>lines to handle any case of in image LF leakage

=============== Diff against Morphic-cmm.438 ===============

Item was changed:
  ----- Method: MVCMenuMorph class>>from:title: (in category 'instance creation') -----
  from: aPopupMenu title: titleStringOrNil
  	"Answer a MenuMorph constructed from the given PopUpMenu. Used to simulate MVC-style menus in a Morphic-only world."
  
  	| menu items lines selections labelString j |
  	menu := self new.
  	titleStringOrNil ifNotNil: [
  		titleStringOrNil isEmpty ifFalse: [menu addTitle: titleStringOrNil]].
  	labelString := aPopupMenu labelString.
+ 	items := labelString asString lines.
- 	items := labelString asString findTokens: String cr.
  	labelString isText ifTrue:
  		["Pass along text emphasis if present"
  		j := 1.
  		items := items collect:
  			[:item | | emphasis |
  			j := labelString asString findString: item startingAt: j.
  			emphasis := TextEmphasis new emphasisCode: (labelString emphasisAt: j).
  			item asText addAttribute: emphasis]].
  	lines := aPopupMenu lineArray.
  	lines ifNil: [lines := #()].
  	menu cancelValue: 0.
  	menu defaultTarget: menu.
  	selections := (1 to: items size) asArray.
  	1 to: items size do: [:i |
  		menu add: (items at: i) selector: #selectMVCItem: argument: (selections at: i).
  		(lines includes: i) ifTrue: [menu addLine]].
  	^ menu
  !

Item was changed:
  ----- Method: MenuMorph>>labels:lines:selections: (in category 'construction') -----
  labels: labelList lines: linesArray selections: selectionsArray 
  	"This method allows the receiver to accept old-style SelectionMenu creation messages. It should be used only for backward compatibility during the MVC-to-Morphic transition. New code should be written using the other menu construction protocol such as addList:."
  
  	"Labels can be either a sting with embedded crs, or a collection of strings."
  
  	| labelArray |
  	labelArray := (labelList isString) 
+ 				ifTrue: [labelList lines]
- 				ifTrue: [labelList findTokens: String cr]
  				ifFalse: [labelList]. 
  	1 to: labelArray size
  		do: 
  			[:i | 
  			self add: (labelArray at: i) action: (selectionsArray at: i).
  			(linesArray includes: i) ifTrue: [self addLine]]!



More information about the Packages mailing list