[squeak-dev] The Trunk: Tools-ul.362.mcz

commits at source.squeak.org commits at source.squeak.org
Sat Jun 18 08:59:05 UTC 2011


Levente Uzonyi uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-ul.362.mcz

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

Name: Tools-ul.362
Author: ul
Time: 17 June 2011, 4:47:46.657 pm
UUID: dca67278-49f2-c84d-888c-4321feb2d38b
Ancestors: Tools-ul.361

- Use #repeat instead of [ true ] whileTrue and friends.
- Use #displayProgressFrom:to:during: instead of #displayProgressAt:from:to:during:.

=============== Diff against Tools-ul.361 ===============

Item was changed:
  ----- Method: ChangeList>>scanFile:from:to: (in category 'scanning') -----
  scanFile: aFile from: startPosition to: stopPosition
  	
  	file := aFile.
  	changeList := OrderedCollection new.
  	list := OrderedCollection new.
  	listIndex := 0.
  	file position: startPosition.
  'Scanning ', aFile localName, '...'
+ 	displayProgressFrom: startPosition to: stopPosition
- 	displayProgressAt: Sensor cursorPoint
- 	from: startPosition to: stopPosition
  	during: [:bar | | prevChar itemPosition item |
  	[file position < stopPosition]
  		whileTrue:
  		[bar value: file position.
  		[file atEnd not and: [file peek isSeparator]]
  				whileTrue: [prevChar := file next].
  		(file peekFor: $!!)
  		ifTrue:
  			[(prevChar = Character cr or: [prevChar = Character lf])
  				ifTrue: [self scanCategory]]
  		ifFalse:
  			[itemPosition := file position.
  			item := file nextChunk.
  			file skipStyleChunk.
  			item size > 0 ifTrue:
  				[self addItem: (ChangeRecord new file: file position: itemPosition type: #doIt)
  					text: 'do it: ' , (item contractTo: 50)]]]].
  	listSelections := Array new: list size withAll: false!

Item was changed:
  ----- Method: PopUpMenu>>startUpSegmented:withCaption:at: (in category 'basic control sequence') -----
  startUpSegmented: segmentHeight withCaption: captionOrNil at: location
  	"This menu is too big to fit comfortably on the screen.
  	Break it up into smaller chunks, and manage the relative indices.
  	Inspired by a special-case solution by Reinier van Loon."
  "
  (PopUpMenu labels: (String streamContents: [:s | 1 to: 100 do: [:i | s print: i; cr]. s skip: -1])
  		lines: (5 to: 100 by: 5)) startUpWithCaption: 'Give it a whirl...'.
  "
  	| nLines nLinesPer allLabels from to subset subLines index |
  	frame ifNil: [self computeForm].
  	allLabels := labelString lines.
  	nLines := allLabels size.
  	lineArray ifNil: [lineArray := Array new].
  	nLinesPer := segmentHeight // marker height - 3.
  	from := 1.
+ 	[to := (from + nLinesPer) min: nLines.
+ 	subset := allLabels copyFrom: from to: to.
+ 	subset add: (to = nLines ifTrue: ['start over...' translated] ifFalse: ['more...' translated])
+ 		before: subset first.
+ 	subLines := lineArray select: [:n | n >= from] thenCollect: [:n | n - (from-1) + 1].
+ 	subLines := (Array with: 1) , subLines.
+ 	index := (PopUpMenu labels: subset asStringWithCr lines: subLines)
+ 				startUpWithCaption: captionOrNil at: location.
+ 	index = 1
+ 		ifTrue: [from := to + 1.
+ 				from > nLines ifTrue: [ from := 1 ]]
+ 		ifFalse: [index = 0 ifTrue: [^ 0].
+ 				^ from + index - 2]] repeat!
- 	[ true ] whileTrue:
- 		[to := (from + nLinesPer) min: nLines.
- 		subset := allLabels copyFrom: from to: to.
- 		subset add: (to = nLines ifTrue: ['start over...' translated] ifFalse: ['more...' translated])
- 			before: subset first.
- 		subLines := lineArray select: [:n | n >= from] thenCollect: [:n | n - (from-1) + 1].
- 		subLines := (Array with: 1) , subLines.
- 		index := (PopUpMenu labels: subset asStringWithCr lines: subLines)
- 					startUpWithCaption: captionOrNil at: location.
- 		index = 1
- 			ifTrue: [from := to + 1.
- 					from > nLines ifTrue: [ from := 1 ]]
- 			ifFalse: [index = 0 ifTrue: [^ 0].
- 					^ from + index - 2]]!

Item was changed:
  ----- Method: PopUpMenu>>startUpSegmented:withCaption:at:allowKeyboard: (in category 'basic control sequence') -----
  startUpSegmented: segmentHeight withCaption: captionOrNil at: location allowKeyboard: aBoolean
  	"This menu is too big to fit comfortably on the screen.
  	Break it up into smaller chunks, and manage the relative indices.
  	Inspired by a special-case solution by Reinier van Loon.  The boolean parameter indicates whether the menu should be given keyboard focus (if in morphic)"
  
  "
  (PopUpMenu labels: (String streamContents: [:s | 1 to: 100 do: [:i | s print: i; cr]. s skip: -1])
  		lines: (5 to: 100 by: 5)) startUpWithCaption: 'Give it a whirl...'.
  "
  	| nLines nLinesPer allLabels from to subset subLines index |
  	frame ifNil: [self computeForm].
  	allLabels := labelString lines.
  	nLines := allLabels size.
  	lineArray ifNil: [lineArray := Array new].
  	nLinesPer := segmentHeight // marker height - 3.
  	from := 1.
+ 	[to := (from + nLinesPer) min: nLines.
+ 	subset := (allLabels copyFrom: from to: to) asOrderedCollection.
+ 	subset add: (to = nLines ifTrue: ['start over...' translated] ifFalse: ['more...' translated])
+ 		before: subset first.
+ 	subLines := lineArray select: [:n | n >= from] thenCollect: [:n | n - (from-1) + 1].
+ 	subLines := (Array with: 1) , subLines.
+ 	index := (PopUpMenu labels: subset asStringWithCr lines: subLines)
+ 				startUpWithCaption: captionOrNil at: location allowKeyboard: aBoolean.
+ 	index = 1
+ 		ifTrue: [from := to + 1.
+ 				from > nLines ifTrue: [ from := 1 ]]
+ 		ifFalse: [index = 0 ifTrue: [^ 0].
+ 				^ from + index - 2]] repeat!
- 	[ true ] whileTrue:
- 		[to := (from + nLinesPer) min: nLines.
- 		subset := (allLabels copyFrom: from to: to) asOrderedCollection.
- 		subset add: (to = nLines ifTrue: ['start over...' translated] ifFalse: ['more...' translated])
- 			before: subset first.
- 		subLines := lineArray select: [:n | n >= from] thenCollect: [:n | n - (from-1) + 1].
- 		subLines := (Array with: 1) , subLines.
- 		index := (PopUpMenu labels: subset asStringWithCr lines: subLines)
- 					startUpWithCaption: captionOrNil at: location allowKeyboard: aBoolean.
- 		index = 1
- 			ifTrue: [from := to + 1.
- 					from > nLines ifTrue: [ from := 1 ]]
- 			ifFalse: [index = 0 ifTrue: [^ 0].
- 					^ from + index - 2]]!




More information about the Squeak-dev mailing list