The Trunk: Tools-cmm.245.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

The Trunk: Tools-cmm.245.mcz

commits-2
Chris Muller uploaded a new version of Tools to project The Trunk:
http://source.squeak.org/trunk/Tools-cmm.245.mcz

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

Name: Tools-cmm.245
Author: cmm
Time: 15 June 2010, 3:50:40.945 pm
UUID: 5023b81d-4fb8-4776-966b-ca5c956cc74a
Ancestors: Tools-cmm.244

Fixed World Menu | open... | file....

=============== Diff against Tools-cmm.244 ===============

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.
  [ true ] whileTrue:
  [to := (from + nLinesPer) min: nLines.
+ subset := (allLabels copyFrom: from to: to) asOrderedCollection.
- 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 allowKeyboard: aBoolean.
  index = 1
  ifTrue: [from := to + 1.
  from > nLines ifTrue: [ from := 1 ]]
  ifFalse: [index = 0 ifTrue: [^ 0].
  ^ from + index - 2]]!