The Trunk: EToys-ul.279.mcz

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

The Trunk: EToys-ul.279.mcz

commits-2
Levente Uzonyi uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-ul.279.mcz

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

Name: EToys-ul.279
Author: ul
Time: 27 February 2017, 2:06:51.332279 am
UUID: 848b5ae7-df41-4c28-b99a-c19ff6ca7cb5
Ancestors: EToys-dtl.278

- omit ifAbsent from #index* sends when the default value 0 would used

=============== Diff against EToys-dtl.278 ===============

Item was changed:
  ----- Method: BookMorph>>pageNumberReport (in category '*Etoys-Squeakland-page controls') -----
  pageNumberReport
  "Answer a string representing the page number."
 
+ ^ (pages indexOf: currentPage) printString, '/', pages size printString!
- ^ (pages indexOf: currentPage ifAbsent: [0]) printString, '/', pages size printString!

Item was changed:
  ----- Method: CategoryViewer>>nextCategory (in category 'categories') -----
  nextCategory
  "Change the receiver to point at the category following the one currently seen"
 
  | aList anIndex newIndex already aChoice |
  aList := (scriptedPlayer categoriesForViewer: self) collect:
  [:aCatSymbol | self currentVocabulary categoryWordingAt: aCatSymbol].
 
  already := self outerViewer ifNil: [#()] ifNotNil: [self outerViewer categoriesCurrentlyShowing].
+ anIndex := aList indexOf: self currentCategory.
- anIndex := aList indexOf: self currentCategory ifAbsent: [0].
  newIndex := anIndex = aList size
  ifTrue: [1]
  ifFalse: [anIndex + 1].
  [already includes: (aChoice := aList at: newIndex)] whileTrue:
  [newIndex := (newIndex \\ aList size) + 1].
  self chooseCategoryWhoseTranslatedWordingIs: aChoice!

Item was changed:
  ----- Method: Debugger>>preDebugNotifierContentsFrom: (in category '*Etoys-Squeakland-initialize') -----
  preDebugNotifierContentsFrom: messageString
  | first second msg |
  ^ Preferences eToyFriendly
  ifFalse:
  [messageString]
  ifTrue:
  [
  msg := messageString.
  msg ifNil: [msg := ''].
  first := second := 0.
+ first := msg indexOf: $\.
+ first > 0 ifTrue: [second := msg indexOf: $\ startingAt: first + 1].
- first := msg indexOf: $\ ifAbsent: [0].
- first > 0 ifTrue: [second := msg indexOf: $\ startingAt: first + 1 ifAbsent: [0]].
  (first > 0 and: [second > 0]) ifTrue: [
  'An error has occurred in\{3} of {2}.\Fix your script(s), hit ''Abandon'' and try again.' translated withCRs format: {msg copyFrom: 1 to: first - 1. msg copyFrom: first + 1 to: second - 1. msg copyFrom: second + 1 to: msg size}
  ] ifFalse: [
  'An error has occurred; you should probably just hit ''abandon''.  Sorry!!' translated
  ]
  ] !

Item was changed:
  ----- Method: KedamaSetColorComponentTile>>line1: (in category 'initialization') -----
  line1: line1
 
  | chopped label label2 tail headIndex |
  (line1 select: [:e | e = $:]) size >= 2 ifTrue: [^ self].
  self removeAllMorphs.
+ headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space].
- headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space ifAbsent: [0]].
 
  chopped := line1 copyFrom: 1 to: headIndex - 1.
  tail := line1 copyFrom: chopped size + 2 to: line1 size.
  label := StringMorph contents: (chopped) translated font: ScriptingSystem fontForTiles.
  label2 := StringMorph contents: tail translated font: ScriptingSystem fontForTiles.
 
  self addMorphBack: label.
  self addMorphBack: patchTile.
  self addMorphBack: label2.
  !

Item was changed:
  ----- Method: KedamaSetPixelValueTile>>line1: (in category 'tile protocol') -----
  line1: line1
 
  | chopped label label2 tail headIndex |
  (line1 select: [:e | e = $:]) size >= 2 ifTrue: [^ self].
  self removeAllMorphs.
+ headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space].
- headIndex := line1 indexOf: $: ifAbsent: [line1 indexOf: Character space ifAbsent: [0]].
 
  chopped := line1 copyFrom: 1 to: headIndex - 1.
  tail := line1 copyFrom: chopped size + 2 to: line1 size.
  label := StringMorph contents: (chopped) font: ScriptingSystem fontForTiles.
  label2 := StringMorph contents: tail font: ScriptingSystem fontForTiles.
 
  self addMorphBack: label.
  self addMorphBack: patchTile.
  self addMorphBack: label2.
  !

Item was changed:
  ----- Method: Morph>>reassessBackgroundShape (in category '*Etoys-card in a stack') -----
  reassessBackgroundShape
  "A change has been made which may affect the instance structure of the Card uniclass that holds the instance state, which can also be thought of as the 'card data'."
 
  "Caution: still to be done: the mechanism so that when a new instance variable is added, it gets initialized in all subinstances of the receiver's player, which are the cards of this shape.  One needs to take into account here the instance variable names coming in; those that are unchanged should keep their values, but those that have newly arrived should obtain their default values from the morphs on whose behalf they are being maintained in the model"
 
  | requestedName |
  self isStackBackground ifFalse: [^Beeper beep]. "bulletproof against deconstruction"
  Cursor wait showWhile:
  [ | variableDocks takenNames sepDataMorphs sorted existing |variableDocks := OrderedCollection new. "This will be stored in the uniclass's
  class-side inst var #variableDocks"
  takenNames := OrderedCollection new.
  sepDataMorphs := OrderedCollection new. "fields, holders of per-card data"
  self submorphs do:
  [:aMorph |
  aMorph renderedMorph holdsSeparateDataForEachInstance
  ifTrue: [sepDataMorphs add: aMorph renderedMorph]
  ifFalse:
  ["look for buried fields, inside a frame"
 
  aMorph renderedMorph isShared
  ifTrue:
  [aMorph allMorphs do:
  [:mm |
  mm renderedMorph holdsSeparateDataForEachInstance
  ifTrue: [sepDataMorphs add: mm renderedMorph]]]]].
  sorted := SortedCollection new
  sortBlock: [:a :b | (a valueOfProperty: #cardInstance) notNil]. "puts existing ones first"
  sorted addAll: sepDataMorphs.
  sorted do:
  [:aMorph | | docks |
  docks := aMorph variableDocks.
  "Each morph can request multiple variables.  
  This complicates matters somewhat but creates a generality for Fabrk-like uses.
  Each spec is an instance of VariableDock, and it provides a point of departure
  for the negotiation between the PasteUp and its constitutent morphs"
  docks do:
  [:aVariableDock | | uniqueName |
  uniqueName := self player
  uniqueInstanceVariableNameLike: (requestedName := aVariableDock
  variableName)
  excluding: takenNames.
  uniqueName ~= requestedName
  ifTrue:
  [aVariableDock variableName: uniqueName.
  aMorph noteNegotiatedName: uniqueName for: requestedName].
  takenNames add: uniqueName].
  variableDocks addAll: docks].
  existing := self player class instVarNames.
  variableDocks := (variableDocks asSortedCollection:
  [:dock1 :dock2 | | name2 name1 |
  name1 := dock1 variableName.
  name2 := dock2 variableName.
+ (existing indexOf: name1)
- (existing indexOf: name1 ifAbsent: [0])
  < (existing indexOf: name2 ifAbsent: [variableDocks size])])
  asOrderedCollection.
  self player class setNewInstVarNames: (variableDocks
  collect: [:info | info variableName asString]).
  "NB: sets up accessors, and removes obsolete ones"
  self player class newVariableDocks: variableDocks]!

Item was changed:
  ----- Method: QuickGuideMorph>>jPegOutDir: (in category 'write web pages') -----
  jPegOutDir: fileDir
  "Write the current page of the current Guide as an image file on the directory"
  "Does it need to be showing?"
 
  | fName gn num qgh bk |
 
  qgh := self submorphOfClass: QuickGuideHolderMorph.
  bk := qgh submorphOfClass: BookMorph.
+ num := (bk pages indexOf: bk currentPage) printString.
- num := (bk pages indexOf: bk currentPage ifAbsent: [0]) printString.
  gn := qgh guideName.
  fName := fileDir pathName, fileDir pathNameDelimiter asString, gn, '-', num, '.jpg'.
  currentPage imageForm writeJPEGfileNamed: fName.
  "need to go deeper??"
  ^ ''!

Item was changed:
  ----- Method: StackMorph>>cardNumberOf: (in category 'accessing') -----
  cardNumberOf: aPlayer
  "Answer the card-number of the given player, in the which-card-of-the-stack sense."
 
+ ^ self cards identityIndexOf: aPlayer!
- ^ self cards identityIndexOf: aPlayer ifAbsent: [0]!