Tim Felgentreff uploaded a new version of EToys to project The Trunk:
http://source.squeak.org/trunk/EToys-tfel.235.mcz ==================== Summary ==================== Name: EToys-tfel.235 Author: tfel Time: 20 September 2016, 10:40:06.499404 am UUID: 4c293f06-9bcb-5348-844b-76cc91922065 Ancestors: EToys-bf.234 - begin removal of old Kedama classes, to eventually replace everything with Kedama2 - move SugarLauncher code that needs Dbus into SugarDBus package - remove unused BooleanPreferenceView and HaloThemePrefernceView classes - remove unused MorphicGamesInfo class - remove old Utilities methods that got moved into McmUpdater and re-added by the merge heuristic =============== Diff against EToys-bf.234 =============== Item was removed: - PreferenceView subclass: #BooleanPreferenceView - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Etoys-Squeakland-System-Support'! - - !BooleanPreferenceView commentStamp: '<historical>' prior: 0! - I am responsible for building the visual representation of a preference that accepts true and false values! Item was removed: - ----- Method: BooleanPreferenceView class>>handlesPanel: (in category 'view registry') ----- - handlesPanel: aPreferencePanel - ^aPreferencePanel isKindOf: PreferencesPanel! Item was removed: - ----- Method: BooleanPreferenceView class>>initialize (in category 'class initialization') ----- - initialize - PreferenceViewRegistry ofBooleanPreferences register: self.! Item was removed: - ----- Method: BooleanPreferenceView class>>unload (in category 'class initialization') ----- - unload - PreferenceViewRegistry ofBooleanPreferences unregister: self.! Item was removed: - ----- Method: BooleanPreferenceView>>offerPersistenceMenu (in category 'user interface') ----- - offerPersistenceMenu - | aMenu | - Preferences ensurePersistedPreferencesAccessible - ifFalse: [^self]. - aMenu := MenuMorph new defaultTarget: self preference. - aMenu addTitle: self preference name. - aMenu addUpdating: #isEnabledOnStartupString target: self preference selector: #persistValue: argumentList: {true}. - aMenu addUpdating: #isDisabledOnStartupString target: self preference selector: #persistValue: argumentList: {false}. - aMenu addUpdating: #isNotSetOnStartupString target: self preference selector: #persistValue: argumentList: {nil}. - aMenu popUpInWorld! Item was removed: - ----- Method: BooleanPreferenceView>>offerPreferenceNameMenu:with:in: (in category 'user interface') ----- - offerPreferenceNameMenu: aPanel with: ignored1 in: ignored2 - "the user clicked on a preference name -- put up a menu" - - | aMenu | - ActiveHand showTemporaryCursor: nil. - aMenu := MenuMorph new defaultTarget: self preference. - aMenu addTitle: self preference name. - - (Preferences okayToChangeProjectLocalnessOf: self preference name) ifTrue: - [aMenu addUpdating: #isProjectLocalString target: self preference action: #toggleProjectLocalness. - aMenu balloonTextForLastItem: 'Some preferences are best applied uniformly to all projects, and others are best set by each individual project. If this item is checked, then this preference will be printed in bold and will have a separate value for each project' translated]. - - aMenu add: 'browse senders' translated target: self systemNavigation selector: #browseAllCallsOn: argument: self preference name. - aMenu balloonTextForLastItem: 'This will open a method-list browser on all methods that the send the preference "' translated, self preference name, '".'. - aMenu add: 'show category...' translated target: aPanel selector: #findCategoryFromPreference: argument: self preference name. - aMenu balloonTextForLastItem: 'Allows you to find out which category, or categories, this preference belongs to.' translated. - - Smalltalk isMorphic ifTrue: - [aMenu add: 'hand me a button for this preference' translated target: self selector: #tearOffButton. - aMenu balloonTextForLastItem: 'Will give you a button that governs this preference, which you may deposit wherever you wish' translated]. - - aMenu add: 'copy this name to clipboard' translated target: self preference selector: #copyName. - aMenu balloonTextForLastItem: 'Copy the name of the preference to the text clipboard, so that you can paste into code somewhere' translated. - aMenu add: 'set automatically on startup...' translated target: self selector: #offerPersistenceMenu. - aMenu balloonTextForLastItem: 'Store a value for this preference on file. On startup, it will be automatically restored.' translated. - - aMenu popUpInWorld! Item was removed: - ----- Method: BooleanPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') ----- - representativeButtonWithColor: aColor inPanel: aPreferencesPanel - "Return a button that controls the setting of prefSymbol. It will keep up to date even if the preference value is changed in a different place" - - | outerButton aButton str miniWrapper | - - outerButton := AlignmentMorph newRow height: 24. - outerButton color: (aColor ifNil: [Color r: 0.645 g: 1.0 b: 1.0]). - outerButton hResizing: (aPreferencesPanel ifNil: [#shrinkWrap] ifNotNil: [#spaceFill]). - outerButton vResizing: #shrinkWrap. - outerButton addMorph: (aButton := UpdatingThreePhaseButtonMorph checkBox). - aButton - target: self preference; - actionSelector: #togglePreferenceValue; - getSelector: #preferenceValue. - - outerButton addTransparentSpacerOfSize: (2 @ 0). - str := StringMorph contents: self preference name font: Preferences standardButtonFont. - - self preference localToProject ifTrue: - [str emphasis: 1]. - - miniWrapper := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap. - miniWrapper layoutInset: 0. - miniWrapper beTransparent addMorphBack: str lock. - aPreferencesPanel - ifNotNil: "We're in a Preferences panel" - [miniWrapper on: #mouseDown send: #offerPreferenceNameMenu:with:in: to: self withValue: aPreferencesPanel. - miniWrapper on: #mouseEnter send: #menuButtonMouseEnter: to: miniWrapper. - miniWrapper on: #mouseLeave send: #menuButtonMouseLeave: to: miniWrapper. - miniWrapper setBalloonText: 'Click here for a menu of options regarding this preference. Click on the checkbox to the left to toggle the setting of this preference' translated] - - ifNil: "We're a naked button, not in a panel" - [miniWrapper setBalloonText: self preference helpString translated; setProperty: #balloonTarget toValue: aButton]. - - outerButton addMorphBack: miniWrapper. - outerButton setNameTo: self preference name. - - aButton setBalloonText: self preference helpString. - - ^ outerButton - ! Item was removed: - PreferenceView subclass: #HaloThemePreferenceView - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Etoys-Squeakland-System-Support'! - - !HaloThemePreferenceView commentStamp: '<historical>' prior: 0! - I am responsible for building the view for the preference that choose the halo theme! Item was removed: - ----- Method: HaloThemePreferenceView class>>handlesPanel: (in category 'view registry') ----- - handlesPanel: aPreferencePanel - ^aPreferencePanel isKindOf: PreferencesPanel! Item was removed: - ----- Method: HaloThemePreferenceView class>>initialize (in category 'class initialization') ----- - initialize - "adding the halo theme preference to Preferences and registering myself as its view" - PreferenceViewRegistry ofHaloThemePreferences register: self. - Preferences - addPreference: #haloTheme - categories: {#halos} - default: #iconicHaloSpecifications - balloonHelp: '' - projectLocal: false - changeInformee: nil - changeSelector: nil - viewRegistry: PreferenceViewRegistry ofHaloThemePreferences.! Item was removed: - ----- Method: HaloThemePreferenceView class>>unload (in category 'class initialization') ----- - unload - PreferenceViewRegistry ofHaloThemePreferences unregister: self.! Item was removed: - ----- Method: HaloThemePreferenceView>>haloThemeRadioButtons (in category 'user interface') ----- - haloThemeRadioButtons - "Answer a column of butons representing the choices of halo theme" - - | buttonColumn aRow aRadioButton aStringMorph | - buttonColumn := AlignmentMorph newColumn beTransparent. - #('iconic' 'classic' 'simple' 'custom') translatedNoop. - #( (iconicHaloSpecifications iconic iconicHalosInForce 'circular halos with icons inside') - (classicHaloSpecs classic classicHalosInForce 'plain circular halos') - (simpleFullHaloSpecifications simple simpleHalosInForce 'fewer, larger halos') - (customHaloSpecs custom customHalosInForce 'customizable halos')) translatedNoop do: - - [:quad | - aRow := AlignmentMorph newRow beTransparent. - aRow addMorph: (aRadioButton := UpdatingThreePhaseButtonMorph radioButton). - aRadioButton target: Preferences. - aRadioButton setBalloonText: quad fourth translated. - aRadioButton actionSelector: #installHaloTheme:. - aRadioButton getSelector: quad third. - aRadioButton arguments: (Array with: quad first). - aRow addTransparentSpacerOfSize: (4 @ 0). - aRow addMorphBack: (aStringMorph := StringMorph contents: quad second asString translated). - aStringMorph setBalloonText: quad fourth translated. - buttonColumn addMorphBack: aRow]. - ^ buttonColumn - - "(Preferences preferenceAt: #haloTheme) view tearOffButton"! Item was removed: - ----- Method: HaloThemePreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') ----- - representativeButtonWithColor: aColor inPanel: aPreferencesPanel - | outerButton editButton | - editButton := SimpleButtonMorph new - target: Preferences; - color: Color transparent; - actionSelector: #editCustomHalos; - label: 'Edit custom halos' translated; - setBalloonText: 'Click here to edit the method that defines the custom halos' translated. - - outerButton := AlignmentMorph newColumn. - outerButton - color: (aColor ifNil: [Color r: 0.645 g: 1.0 b: 1.0]); - hResizing: (aPreferencesPanel ifNil: [#shrinkWrap] ifNotNil: [#spaceFill]); - vResizing: #shrinkWrap; - addTransparentSpacerOfSize: (0@4); - addMorphBack: self haloThemeRadioButtons; - addTransparentSpacerOfSize: (0@4); - addMorphBack: editButton. - - ^outerButton. - - "(Preferences preferenceAt: #haloTheme) view tearOffButton" ! Item was removed: - ----- Method: KedamaExamplerPlayer>>copyAllMethodsAgain (in category 'debug support') ----- - copyAllMethodsAgain - - | c result | - c := turtles class. - result := (ClassBuilder new) - name: c name - inEnvironment: c environment - subclassOf: c superclass - type: c typeOfClass - instanceVariableNames: KedamaTurtleVectorPlayer instanceVariablesString - classVariableNames: KedamaTurtleVectorPlayer classVariablesString - poolDictionaries: KedamaTurtleVectorPlayer sharedPoolsString - category: c category. - turtles class copyAllCategoriesUnobtrusivelyFrom: KedamaTurtleVectorPlayer. - sequentialStub ifNotNil: [sequentialStub class copyAllCategoriesUnobtrusivelyFrom: KedamaSequenceExecutionStub]. - ! Item was removed: - ----- Method: KedamaExamplerPlayer>>createTurtles (in category 'subclass players management') ----- - createTurtles - - turtles := self class createTurtleSubclass new. - turtles kedamaWorld: kedamaWorld. - turtles exampler: self. - ^ turtles. - ! Item was added: + ----- Method: KedamaSequenceExecutionStub class>>isSystemDefined (in category 'as yet unclassified') ----- + isSystemDefined + ^ name endsWithDigit not! Item was added: + ----- Method: KedamaSequenceExecutionStub class>>isUniClass (in category 'as yet unclassified') ----- + isUniClass + + ^ self ~~ self officialClass! Item was removed: - ----- Method: KedamaTurtleMorph class>>copyAllMethodsAgain (in category 'scripting') ----- - copyAllMethodsAgain - " - KedamaTurtleMorph copyAllMethodsAgain. - " - KedamaTurtleMorph allInstancesDo: [:e | e player ifNotNil: [e player copyAllMethodsAgain]]. - ! Item was removed: - KedamaExamplerPlayer subclass: #KedamaTurtleVectorPlayer - instanceVariableNames: 'exampler info types arrays deletingIndex whoTable whoTableBase whoTableValid turtlesMap turtleMapValid lastWho lastWhoStub' - classVariableNames: '' - poolDictionaries: '' - category: 'Etoys-StarSqueak'! Item was removed: - ----- Method: KedamaTurtleVectorPlayer class>>officialClass (in category 'all') ----- - officialClass - - ^ KedamaTurtleVectorPlayer - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>aTurtleAtX:y: (in category 'turtle map') ----- - aTurtleAtX: xPos y: yPos - - | w x y index who stub | - turtleMapValid ifFalse: [ - self makeTurtlesMap. - ]. - - w := kedamaWorld dimensions x. - x := xPos truncated. - y := yPos truncated. - x < 0 ifTrue: [^ nil]. - x >= w ifTrue: [^ nil]. - y < 0 ifTrue: [^ nil]. - y >= kedamaWorld dimensions y ifTrue: [^ nil]. - index := (w * y) + x + 1. - who := turtlesMap at: index. - who = 0 ifTrue: [^ nil]. - who = lastWho ifTrue: [^ lastWhoStub]. - stub := exampler clonedSequentialStub. - stub who: who. - lastWho := who. - ^ lastWhoStub := stub. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>addInstanceVarNamed:withValue: (in category 'player protocol') ----- - addInstanceVarNamed: aName withValue: aValue - - | newArray | - (aValue isKindOf: Number) ifTrue: [ - newArray := KedamaFloatArray new: self size. - ]. - (aValue isKindOf: Color) ifTrue: [ - newArray := WordArray new: self size. - ]. - (aValue isKindOf: Player) ifTrue: [ - newArray := Array new: self size. - ]. - - arrays := arrays, newArray. - info at: aName asSymbol put: arrays size. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>addInstanceVarVectorNamed:withValue: (in category 'player protocol') ----- - addInstanceVarVectorNamed: aName withValue: aValue - - | newArray | - newArray := KedamaFloatArray new: self size. - arrays := arrays, (Array with: newArray). - newArray atAllPut: aValue. - info at: aName asSymbol put: arrays size. - types at: arrays size put: #Number. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>addTurtlesCount:ofPrototype:for:positionAndColorArray: (in category 'add turtles') ----- - addTurtlesCount: count ofPrototype: prototype for: aKedamaWorld positionAndColorArray: positionAndColorArray - - | oldCount | - oldCount := self size. - info associationsDo: [:assoc | | defaultValue index newArray array | - index := info at: assoc key. - array := arrays at: (info at: assoc key). - defaultValue := prototype at: index. - newArray := array class new: count. - (#(who x y heading color normal) includes: assoc key) ifFalse: [ - newArray atAllPut: defaultValue. - ]. - assoc key = #x ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray first startingAt: 1]. - assoc key = #y ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray second startingAt: 1]. - assoc key = #color ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray third startingAt: 1]. - assoc key = #heading ifTrue: [newArray atAllPut: 1.57079631 "Float pi / 2.0"]. - assoc key = #normal ifTrue: [newArray atAllPut: 1.57079631 "Float pi / 2.0"]. - - arrays at: (assoc value) put: array, newArray. - ]. - - #(who) do: [:name | - self setInitialValueOf: name from: oldCount + 1 to: self size for: aKedamaWorld. - ]. - whoTableValid := false. - turtleMapValid := false. - - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>addTurtlesCount:ofPrototype:for:randomize: (in category 'add turtles') ----- - addTurtlesCount: count ofPrototype: prototype for: aKedamaWorld randomize: randomizeFlag - - | oldCount | - oldCount := self size. - info associationsDo: [:assoc | | array defaultValue newArray index | - index := info at: assoc key. - array := arrays at: index. - defaultValue := prototype at: index. - newArray := array class new: count. - newArray atAllPut: defaultValue. - arrays at: index put: (array, newArray). - ]. - - self setInitialValueOf: #who from: oldCount + 1 to: self size for: aKedamaWorld. - - randomizeFlag ifTrue: [ - #(x y heading) do: [:name | - self setInitialValueOf: name from: oldCount + 1 to: self size for: aKedamaWorld. - ]. - ]. - whoTableValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>arrayForType: (in category 'private') ----- - arrayForType: typeName - - | newArray | - (typeName = #Number) ifTrue: [ - newArray := KedamaFloatArray new: self size. - ]. - (typeName = #Color) ifTrue: [ - newArray := WordArray new: self size. - ]. - (typeName = #Boolean) ifTrue: [ - newArray := ByteArray new: self size. - ]. - - newArray ifNil: [ - newArray := Array new: self size. - ]. - - ^ newArray. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>arrays (in category 'accessing') ----- - arrays - - ^ arrays. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>basicGetAngleTo: (in category 'player commands') ----- - basicGetAngleTo: players - - | ret p xArray yArray result | - players isCollection ifFalse: [ - p := players - ]. - xArray := arrays at: 2. - yArray := arrays at: 3. - result := KedamaFloatArray new: self size. - 1 to: self size do: [:index | - players isCollection ifTrue: [ - p := players at: index. - ]. - ret := ((p getX - (xArray at: index))@(p getY - (yArray at: index))) theta radiansToDegrees + 90.0. - ret > 360.0 ifTrue: [ret := ret - 360.0]. - result at: index put: ret. - ]. - ^ result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>basicGetDistanceTo: (in category 'player commands') ----- - basicGetDistanceTo: players - - | p xArray yArray result | - players isCollection ifFalse: [ - p := players - ]. - xArray := arrays at: 2. - yArray := arrays at: 3. - result := KedamaFloatArray new: self size. - 1 to: self size do: [:index | - players isCollection ifTrue: [ - p := players at: index. - ]. - result at: index put: ((p getX - (xArray at: index)) squared + (p getY - (yArray at: index)) squared) sqrt. - - ]. - ^ result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>basicMakeTurtlesMap (in category 'turtle map') ----- - basicMakeTurtlesMap - - | x y xArray yArray width height mapIndex whoArray | - xArray := arrays at: 2. - yArray := arrays at: 3. - whoArray := arrays at: 1. - width := kedamaWorld dimensions x. - height := kedamaWorld dimensions y. - turtlesMap atAllPut: 0. - - 1 to: self size do: [:index | - x := (xArray at: index) truncated. - y := (yArray at: index) truncated. - mapIndex := (width * y) + x + 1. - (0 < mapIndex and: [mapIndex <= turtlesMap size]) ifTrue: [ - turtlesMap at: mapIndex put: (whoArray at: index). - ]. - ]. - - turtleMapValid := true. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>color: (in category 'player commands') ----- - color: c - - c isColor ifTrue: [ - self setColorVarAt: 5 put: ((c pixelValueForDepth: 32) bitAnd: 16rFFFFFF). - ] ifFalse: [ - self setColorVarAt: 5 put: c. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>colorFromPatch: (in category 'player commands') ----- - colorFromPatch: aPatch - - | xArray yArray cArray patch | - xArray := arrays at: 2. - yArray := arrays at: 3. - cArray := arrays at: 5. - patch := aPatch costume renderedMorph. - 1 to: self size do: [:i | - cArray at: i put: ((patch pixelAtX: (xArray at: i) y: (yArray at: i)) bitAnd: 16rFFFFFF). - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>colorToPatch: (in category 'player commands') ----- - colorToPatch: aPatch - - | xArray yArray cArray patch | - xArray := arrays at: 2. - yArray := arrays at: 3. - cArray := arrays at: 5. - patch := aPatch costume renderedMorph. - 1 to: self size do: [:i | - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: (cArray at: i). - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>compileAllAccessors (in category 'player protocol') ----- - compileAllAccessors - - info keys do: [:k | - (#(who x y heading color visible) includes: k) ifFalse: [ - self compileVectorInstVarAccessorsFor: k. - ]. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>compileVectorInstVarAccessorsFor: (in category 'player protocol') ----- - compileVectorInstVarAccessorsFor: varName - - | nameString index type setPhrase | - nameString := varName asString capitalized. - index := info at: varName asSymbol. - self class compileSilently: ('get', nameString, ' - ^ ', '(arrays at: ', index printString, ')') - classified: 'access'. - - type := types at: index. - type = #Number ifTrue: [ - setPhrase := 'setNumberVarAt:'. - ]. - type = #Boolean ifTrue: [ - setPhrase := 'setBooleanVarAt:'. - ]. - type = #Color ifTrue: [ - setPhrase := 'setColorVarAt:'. - ]. - setPhrase ifNil: [setPhrase := 'setObjectVarAt:']. - - self class compileSilently: ('set', nameString, ': xxxArg - self ', setPhrase, index printString, ' put: xxxArg') - classified: 'access'! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>delete (in category 'deleting') ----- - delete - - exampler := nil. - arrays := nil. - whoTable := nil. - turtlesMap := nil. - self class removeFromSystem: false. - self becomeForward: UnscriptedPlayer new - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>deleteTurtleID: (in category 'player commands') ----- - deleteTurtleID: who - - | whoArray whoIndex | - whoArray := arrays at: 1. - whoIndex := whoArray indexOf: who ifAbsent: [^ self]. - deletingIndex := whoIndex - 1. - arrays withIndexDo: [:array :index | | newArray | - newArray := (array copyFrom: 1 to: whoIndex - 1), (array copyFrom: whoIndex + 1 to: array size). - arrays at: index put: newArray. - ]. - whoTableValid := false. - turtleMapValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>doCommand: (in category 'command execution') ----- - doCommand: aBlock - - ^ aBlock value: self. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>doDieCommand: (in category 'command execution') ----- - doDieCommand: aBlock - - ^ exampler doDieCommand: aBlock. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>doExamplerCommand: (in category 'command execution') ----- - doExamplerCommand: aBlock - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>doSequentialCommand: (in category 'command execution') ----- - doSequentialCommand: aBlock - - ^ exampler doSequentialCommand: aBlock. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>drawOn: (in category 'displaying') ----- - drawOn: aForm - - | xArray yArray colorArray visibleArray bits x y visible bitsIndex dimX dimY ret | - xArray := arrays at: 2. - yArray := arrays at: 3. - colorArray := arrays at: 5. - visibleArray := arrays at: 6. - bits := aForm bits. - dimX := aForm width. - dimY := aForm height. - - ret := self primDrawOn: bits destWidth: dimX destHeight: dimY xArray: xArray yArray: yArray colorArray: colorArray visibleArray: visibleArray. - ret ifNotNil: [^ self]. - - 1 to: self size do: [:index | - x := (xArray at: index) truncated. - y := (yArray at: index) truncated. - visible := (visibleArray at: index) ~= 0. - (visible and: [((x >= 0) and: [y >= 0]) and: [(x < dimX) and: [y < dimY]]]) ifTrue: [ - bitsIndex := ((y * dimX) + x) + 1. - bits at: bitsIndex put: (colorArray at: index). - ]. - ]. - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>exampler: (in category 'accessing') ----- - exampler: e - - exampler := e. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>forward: (in category 'player commands') ----- - forward: val - - exampler getGrouped ifFalse: [ - self primForwardXArray: (arrays at: 2) yArray: (arrays at: 3) headingArray: (arrays at: 4) value: (val isNumber ifTrue: [val asFloat] ifFalse: [val]) destWidth: kedamaWorld wrapX asFloat destHeight: kedamaWorld wrapY asFloat leftEdgeMode: kedamaWorld leftEdgeModeMnemonic rightEdgeMode: kedamaWorld rightEdgeModeMnemonic topEdgeMode: kedamaWorld topEdgeModeMnemonic bottomEdgeMode: kedamaWorld bottomEdgeModeMnemonic. - ] ifTrue: [ - self groupForward: val - ]. - turtleMapValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getAngleTo: (in category 'player commands') ----- - getAngleTo: players - - | p xArray yArray result pX pY xy | - players isCollection ifFalse: [ - p := players - ]. - xArray := arrays at: 2. - yArray := arrays at: 3. - result := KedamaFloatArray new: self size. - players isCollection ifTrue: [ - pX := KedamaFloatArray new: players size. - pY := KedamaFloatArray new: players size. - 1 to: players size do: [:i | - xy := (players at: i) getXAndY. - pX at: i put: xy x. - pY at: i put: xy y. - ]. - ] ifFalse: [ - xy := p getXAndY. - pX := xy x. - pY := xy y. - ]. - ^ self primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result. - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getBlueComponentIn: (in category 'player commands') ----- - getBlueComponentIn: aPatch - - | pix xArray yArray patch w | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - w := WordArray new: self size. - 1 to: self size do: [:i | - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - w at: i put: (pix bitAnd: 16rFF). - ]. - ^ w. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getBooleanVarAt: (in category 'accessing - private') ----- - getBooleanVarAt: index - - ^ arrays at: index. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getColor (in category 'player commands') ----- - getColor - - ^ self getVarAt: 5. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getColorVarAt: (in category 'accessing - private') ----- - getColorVarAt: index - - ^ (arrays at: index) collect: [:c | Color colorFromPixelValue: c depth: 32]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getDistanceTo: (in category 'player commands') ----- - getDistanceTo: players - - | p xArray yArray result pX pY xy | - players isCollection ifFalse: [ - p := players - ]. - xArray := arrays at: 2. - yArray := arrays at: 3. - result := KedamaFloatArray new: self size. - players isCollection ifTrue: [ - pX := KedamaFloatArray new: players size. - pY := KedamaFloatArray new: players size. - 1 to: players size do: [:i | - xy := (players at: i) getXAndY. - pX at: i put: xy x. - pY at: i put: xy y. - ]. - ] ifFalse: [ - xy := p getXAndY. - pX := xy x. - pY := xy y. - ]. - ^ self primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getGreenComponentIn: (in category 'player commands') ----- - getGreenComponentIn: aPatch - - | pix xArray yArray patch w | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - w := WordArray new: self size. - 1 to: self size do: [:i | - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - w at: i put: ((pix bitShift: -8) bitAnd: 16rFF). - ]. - ^ w. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getGrouped (in category 'player commands') ----- - getGrouped - - ^ exampler getGrouped. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getHeading (in category 'player commands') ----- - getHeading - - | heading result ret | - heading := (arrays at: 4). - result := KedamaFloatArray new: heading size. - ret := self primGetHeading: heading into: result. - ret ifNotNil: [^ result]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getNormal (in category 'player commands') ----- - getNormal - - | result ret normal | - normal := (arrays at: 7). - result := KedamaFloatArray new: normal size. - ret := self primGetHeading: normal into: result. - ret ifNotNil: [^ result]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getPatchValueIn: (in category 'player commands') ----- - getPatchValueIn: aPatch - - | w patch xArray yArray | - w := WordArray new: self size. - patch := aPatch costume renderedMorph. - xArray := arrays at: 2. - yArray := arrays at: 3. - patch pixelsAtXArray: xArray yArray: yArray into: w. - ^ w. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getRedComponentIn: (in category 'player commands') ----- - getRedComponentIn: aPatch - - | pix xArray yArray patch w | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - w := WordArray new: self size. - 1 to: self size do: [:i | - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - w at: i put: ((pix bitShift: -16) bitAnd: 16rFF). - ]. - ^ w. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getTurtleAt: (in category 'player commands') ----- - getTurtleAt: aPlayer - - | xy | - aPlayer isCollection ifTrue: [ - self error: 'should not happen'. - ]. - xy := aPlayer getXAndY. - ^ (self aTurtleAtX: xy x y: xy y) ifNil: [^ aPlayer]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getTurtleOf: (in category 'player commands') ----- - getTurtleOf: aBreedPlayer - - | xy | - aBreedPlayer isCollection ifTrue: [ - "self error: 'should not happen'." - ^ aBreedPlayer. - ]. - xy := aBreedPlayer getXAndY. - ^ (self aTurtleAtX: xy x y: xy y) ifNil: [^ aBreedPlayer]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getTurtleVisible (in category 'player commands') ----- - getTurtleVisible - - ^ (turtles arrays at: 6) collect: [:t | t = 1]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getUphillIn: (in category 'player commands') ----- - getUphillIn: aPatch - - | xArray yArray headingArray result patch | - xArray := arrays at: 2. - yArray := arrays at: 3. - headingArray := arrays at: 4. - result := KedamaFloatArray new: self size. - patch := aPatch costume renderedMorph. - 1 to: self size do: [:index | - result at: index put: (patch - uphillForTurtleX: (xArray at: index) - turtleY: (yArray at: index) - turtleHeading: (headingArray at: index)). - ]. - ^ result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getVarAt: (in category 'accessing - private') ----- - getVarAt: index - - ^ arrays at: index. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getX (in category 'player commands') ----- - getX - - | xArray | - exampler getGrouped ifFalse: [ - ^ arrays at: 2. - ] ifTrue: [ - xArray := arrays at: 2. - xArray size = 0 ifTrue: [^ exampler getX]. - ^ xArray first. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>getY (in category 'player commands') ----- - getY - - | yArray | - exampler getGrouped ifFalse: [ - ^ arrays at: 3. - ] ifTrue: [ - yArray := arrays at: 3. - yArray size = 0 ifTrue: [^ exampler getY]. - ^ yArray first. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>groupForward: (in category 'private') ----- - groupForward: dist - - | x y headingRadians | - self size = 0 ifTrue: [^ self]. - - x := (arrays at: 2) first. - y := (arrays at: 3) first. - headingRadians := (arrays at: 4) first. - self groupSetX: (x + (dist asFloat * headingRadians cos)). - self groupSetY: (y - (dist asFloat * headingRadians sin)). - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>groupSetX: (in category 'private') ----- - groupSetX: val - - | xArray headingArray origX origHeading leftEdgeMode rightEdgeMode newArray wrapX minX maxX | - self size = 0 ifTrue: [^ self]. - xArray := arrays at: 2. - headingArray := arrays at: 4. - - origX := xArray first. - origHeading := headingArray first. - - leftEdgeMode := kedamaWorld leftEdgeModeMnemonic. - rightEdgeMode := kedamaWorld rightEdgeModeMnemonic. - - newArray := xArray collect: [:e | e + val - origX]. - wrapX := kedamaWorld wrapX. - minX := newArray min. - maxX := newArray max. - ((minX < 0.0) not and: [(maxX >= wrapX) not]) ifTrue: [ - arrays at: 2 put: newArray. - ^ self. - ]. - - minX < 0.0 ifTrue: [ - leftEdgeMode = 1 ifTrue: [ - newArray withIndexDo: [:e :i | - e < 0.0 ifTrue: [newArray at: i put: e + wrapX]. - ]. - ]. - leftEdgeMode = 2 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - minX. - ]. - ]. - leftEdgeMode = 3 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e + (minX * -2.0). - ]. - ]. - ]. - - maxX >= wrapX ifTrue: [ - rightEdgeMode = 1 ifTrue: [ - newArray withIndexDo: [:e :i | - e >= wrapX ifTrue: [newArray at: i put: e - wrapX]. - ]. - ]. - rightEdgeMode = 2 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - (maxX - wrapX) - 2.35099e-038. - ]. - ]. - rightEdgeMode = 3 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - ((maxX - wrapX) * 2.0) - 2.35099e-038. - ]. - ]. - ]. - - arrays at: 2 put: newArray. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>groupSetY: (in category 'private') ----- - groupSetY: val - - | yArray headingArray origY origHeading topEdgeMode bottomEdgeMode newArray wrapY minY maxY | - self size = 0 ifTrue: [^ self]. - yArray := arrays at: 3. - headingArray := arrays at: 4. - - origY := yArray first. - origHeading := headingArray first. - - topEdgeMode := kedamaWorld topEdgeModeMnemonic. - bottomEdgeMode := kedamaWorld bottomEdgeModeMnemonic. - - newArray := yArray collect: [:e | e + val - origY]. - wrapY := kedamaWorld wrapY. - minY := newArray min. - maxY := newArray max. - ((minY < 0.0) not and: [(maxY >= wrapY) not]) ifTrue: [ - arrays at: 3 put: newArray. - ^ self. - ]. - - minY < 0.0 ifTrue: [ - topEdgeMode = 1 ifTrue: [ - newArray withIndexDo: [:e :i | - e < 0.0 ifTrue: [newArray at: i put: e + wrapY]. - ]. - ]. - topEdgeMode = 2 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - minY. - ]. - ]. - topEdgeMode = 3 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e + (minY * -2.0). - ]. - ]. - ]. - - maxY >= wrapY ifTrue: [ - bottomEdgeMode = 1 ifTrue: [ - newArray withIndexDo: [:e :i | - e >= wrapY ifTrue: [newArray at: i put: e - wrapY]. - ]. - ]. - bottomEdgeMode = 2 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - (maxY - wrapY) - 2.35099e-038. - ]. - ]. - bottomEdgeMode = 3 ifTrue: [ - newArray withIndexDo: [:e :i | - newArray at: i put: e - ((maxY - wrapY) * 2.0) - 2.35099e-038. - ]. - ]. - ]. - - arrays at: 3 put: newArray. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>heading (in category 'player commands') ----- - heading - - ^ self getHeading. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>heading: (in category 'player commands') ----- - heading: degrees - - | deg | - deg := degrees isNumber ifTrue: [degrees asFloat] ifFalse: [degrees]. - self primSetHeading: (arrays at: 4) from: deg. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>hide (in category 'player commands') ----- - hide - - (arrays at: 6) atAllPut: 0. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>indexOf: (in category 'enumeration') ----- - indexOf: who - - | whoArray | - whoTableValid ifTrue: [^ whoTable at: (who - whoTableBase)]. - - whoArray := arrays at: 1. - - whoArray size = 0 ifTrue: [^ 0]. - - whoTableBase := whoArray first - 1. - whoTable := WordArray new: whoArray last - whoTableBase. - 1 to: whoArray size do: [:w | - whoTable at: (whoArray at: w) - whoTableBase put: w. - ]. - whoTableValid := true. - - ^ whoTable at: (who - whoTableBase). - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>info (in category 'accessing') ----- - info - - ^ info. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>initialize (in category 'initialization') ----- - initialize - - super initialize. - info := IdentityDictionary new. - info at: #who put: 1. - info at: #x put: 2. - info at: #y put: 3. - info at: #heading put: 4. - info at: #color put: 5. - info at: #visible put: 6. - info at: #normal put: 7. - - arrays := Array new: 7. - arrays at: (info at: #who) put: (WordArray new: 0). - arrays at: (info at: #x) put: (KedamaFloatArray new: 0). - arrays at: (info at: #y) put: (KedamaFloatArray new: 0). - arrays at: (info at: #heading) put: (KedamaFloatArray new: 0). - arrays at: (info at: #color) put: (WordArray new: 0). - arrays at: (info at: #visible) put: (ByteArray new: 0). - arrays at: (info at: #normal) put: (KedamaFloatArray new: 0). - - types := Array new: 64. - - types at: 1 put: #Integer. - types at: 2 put: #Number. - types at: 3 put: #Number. - types at: 4 put: #Number. - types at: 5 put: #Color. - types at: 6 put: #Boolean. - types at: 7 put: #Number. - - whoTableValid := false. - turtleMapValid := false. - - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>initializeDeletingIndex (in category 'enumeration') ----- - initializeDeletingIndex - - deletingIndex := 0. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>instSize (in category 'accessing') ----- - instSize - - ^ arrays size. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>invalidateTurtleMap (in category 'turtle map') ----- - invalidateTurtleMap - - turtleMapValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>makePrototypeFromFirstInstance (in category 'add turtles') ----- - makePrototypeFromFirstInstance - - ^ (1 to: arrays size) collect: [:index | - (arrays at: index) first - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>makeTurtlesMap (in category 'turtle map') ----- - makeTurtlesMap - - | xArray yArray width height whoArray ret | - xArray := arrays at: 2. - yArray := arrays at: 3. - whoArray := arrays at: 1. - width := kedamaWorld dimensions x. - height := kedamaWorld dimensions y. - turtlesMap ifNil: [turtlesMap := WordArray new: width * height]. - - ret := self primMakeTurtlesMap: turtlesMap whoArray: whoArray xArray: xArray yArray: yArray width: width height: height. - - ret ifNil: [self basicMakeTurtlesMap]. - - turtleMapValid := true. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>nextDeletingIndex (in category 'enumeration') ----- - nextDeletingIndex - - ^ deletingIndex := deletingIndex + 1. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>normal: (in category 'player commands') ----- - normal: degrees - - | deg | - deg := degrees isNumber ifTrue: [degrees asFloat] ifFalse: [degrees]. - self primSetHeading: (arrays at: 7) from: deg. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>noteRenameOf:to:inPlayer: (in category 'player protocol') ----- - noteRenameOf: oldSlotName to: newSlotName inPlayer: aPlayer - - self compileAllAccessors - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primDrawOn:destWidth:destHeight:xArray:yArray:colorArray:visibleArray: (in category 'primitives') ----- - primDrawOn: destBits destWidth: destWidth destHeight: destHeight xArray: xArray yArray: yArray colorArray: colorArray visibleArray: visibleArray - - | x y visible bitsIndex | - <primitive: 'drawTurtlesInArray' module: 'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #drawTurtlesInArray." - - 1 to: xArray size do: [:i | - x := (xArray at: i) asInteger. - y := (yArray at: i) asInteger. - visible := (visibleArray at: i). - (visible ~= 0 and: [((x >= 0) and: [y >= 0]) and: [(x < destWidth) and: [y < destHeight]]]) ifTrue: [ - bitsIndex := ((y * destWidth) + x) + 1. - destBits at: bitsIndex put: (colorArray at: i). - ] - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primForwardXArray:yArray:headingArray:value:destWidth:destHeight:leftEdgeMode:rightEdgeMode:topEdgeMode:bottomEdgeMode: (in category 'primitives') ----- - primForwardXArray: xArray yArray: yArray headingArray: headingArray value: v destWidth: destWidth destHeight: destHeight leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode - - | dist newX newY | - <primitive: 'primTurtlesForward' module: 'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #primTurtlesForward." - - 1 to: xArray size do: [:i | - v isCollection ifTrue: [ - dist := (v at: i) asFloat. - ] ifFalse: [ - dist := v asFloat. - ]. - newX := (xArray at: i) + (dist * (headingArray at: i) cos). - newY := (yArray at: i) - (dist * (headingArray at: i) sin). - KedamaMorph scalarXAt: i xArray: xArray headingArray: headingArray value: newX destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode. - KedamaMorph scalarYAt: i yArray: yArray headingArray: headingArray value: newY destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primGetAngleToX:toY:xArray:yArray:resultInto: (in category 'primitives') ----- - primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result - - | ppx ppy x y ret | - <primitive: 'vectorGetAngleTo' module:'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #vectorGetAngleTo." - - ppx := pX. - ppy := pY. - 1 to: result size do: [:index | - pX isCollection ifTrue: [ - ppx := pX at: index. - ppy := pY at: index. - ]. - x := ppx - (xArray at: index). - y := ppy - (yArray at: index). - ret := (x@y) theta radiansToDegrees + 90.0. - ret > 360.0 ifTrue: [ret := ret - 360.0]. - result at: index put: ret. - ]. - ^ result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primGetDistanceToX:toY:xArray:yArray:resultInto: (in category 'primitives') ----- - primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result - - | ppx ppy | - <primitive: 'vectorGetDistanceTo' module:'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #vectorGetDistanceTo." - - ppx := pX. - ppy := pY. - 1 to: result size do: [:index | - pX isCollection ifTrue: [ - ppx := pX at: index. - ppy := pY at: index. - ]. - result at: index put: ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt. - - ]. - ^ result. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primGetHeading:into: (in category 'primitives') ----- - primGetHeading: headingArray into: resultArray - - | heading | - <primitive: 'getHeadingArrayInto' module:'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #getHeadingArrayInto." - - 1 to: headingArray size do: [:i | - heading := headingArray at: i. - heading := heading / 0.0174532925199433. - heading := 90.0 - heading. - heading > 0.0 ifFalse: [heading := heading + 360.0]. - resultArray at: i put: heading. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primMakeTurtlesMap:whoArray:xArray:yArray:width:height: (in category 'primitives') ----- - primMakeTurtlesMap: map whoArray: whoArray xArray: xArray yArray: yArray width: w height: h - - <primitive: 'makeTurtlesMap' module: 'KedamaPlugin'> - ^ nil. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primRandomRange:from:to:intoFloatArray:factor: (in category 'primitives') ----- - primRandomRange: range from: from to: to intoFloatArray: aFloatArray factor: factor - - <primitive: 'randomIntoFloatArray' module: 'KedamaPlugin'> - - from to: to do: [:index | - aFloatArray at: index put: (kedamaWorld random: range) asFloat * factor. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primRandomRange:from:to:intoIntegerArray:factor: (in category 'primitives') ----- - primRandomRange: range from: from to: to intoIntegerArray: anIntegerArray factor: factor - - <primitive: 'randomIntoIntegerArray' module: 'KedamaPlugin'> - - from to: to do: [:index | - anIntegerArray at: index put: ((kedamaWorld random: range) asFloat * factor) asInteger. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primSetHeading:from: (in category 'primitives') ----- - primSetHeading: headingArray from: val - - | heading | - <primitive: 'setHeadingArrayFrom' module:'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #setHeadingArrayFrom." - - val isCollection ifFalse: [ - heading := val asFloat. - heading := KedamaMorph degreesToRadians: heading. - ]. - - 1 to: headingArray size do: [:i | - val isCollection ifTrue: [ - heading := val at: i. - heading := KedamaMorph degreesToRadians: heading. - ]. - headingArray at: i put: heading. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primSetX:headingArray:value:destWidth:leftEdgeMode:rightEdgeMode: (in category 'primitives') ----- - primSetX: xArray headingArray: headingArray value: v destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode - - | val newX | - <primitive: 'turtlesSetX' module: 'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #turtlesSetX." - - v isCollection ifFalse: [ - val := v asFloat. - ]. - - 1 to: xArray size do: [:i | - v isCollection ifTrue: [ - newX := v at: i. - ] ifFalse: [ - newX := val. - ]. - KedamaMorph scalarXAt: i xArray: xArray headingArray: headingArray value: newX destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode. - ]. - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>primSetY:headingArray:value:destHeight:topEdgeMode:bottomEdgeMode: (in category 'primitives') ----- - primSetY: yArray headingArray: headingArray value: v destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode - - | val newY | - <primitive: 'turtlesSetY' module: 'KedamaPlugin'> - "^ KedamaPlugin doPrimitive: #turtlesSetY." - - v isCollection ifFalse: [ - val := v asFloat. - ]. - - 1 to: yArray size do: [:i | - v isCollection ifTrue: [ - newY := v at: i. - ] ifFalse: [ - newY := val. - ]. - KedamaMorph scalarYAt: i yArray: yArray headingArray: headingArray value: newY destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>removeSlotNamed: (in category 'player protocol') ----- - removeSlotNamed: aSlotName - - | index newArrays | - self basicRemoveSlotNamed: aSlotName. - index := info at: aSlotName asSymbol ifAbsent: [^ self]. - newArrays := (arrays copyFrom: 1 to: index - 1), (arrays copyFrom: index + 1 to: arrays size). - types replaceFrom: index to: types size with: types startingAt: index + 1. - - info removeKey: aSlotName asSymbol. - arrays := newArrays. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>removeVectorSlotNamed: (in category 'player protocol') ----- - removeVectorSlotNamed: aSlotName - - | index newArrays | - index := info at: aSlotName asSymbol ifAbsent: [^ self]. - newArrays := (arrays copyFrom: 1 to: index - 1), (arrays copyFrom: index + 1 to: arrays size). - types replaceFrom: index to: types size - 1 with: types startingAt: index + 1. - - info removeKey: aSlotName asSymbol. - arrays := newArrays. - self compileAllAccessors. - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>renameVectorSlot:newSlotName: (in category 'player protocol') ----- - renameVectorSlot: oldSlotName newSlotName: newSlotName - - | index | - index := info at: oldSlotName asSymbol ifAbsent: [^ self]. - info removeKey: oldSlotName asSymbol. - info at: newSlotName put: index. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setBlueComponentIn:to: (in category 'player commands') ----- - setBlueComponentIn: aPatch to: value - - | xArray yArray patch component | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - value isCollection ifFalse: [ - component := value asInteger bitAnd: 16rFF. - ]. - (1 to: self size) do: [:i | | pix | - value isCollection ifTrue: [ - component := (value at: i) asInteger bitAnd: 16rFF. - ]. - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - pix := (pix bitAnd: 16rFFFF00) bitOr: component. - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setBooleanVarAt:put: (in category 'accessing - private') ----- - setBooleanVarAt: index put: v - - (v == true or: [v == false]) ifTrue: [ - (arrays at: index) atAllPut: (v == true ifTrue: [1] ifFalse: [0]). - ^ self. - ]. - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setColor: (in category 'player commands') ----- - setColor: color - - ^ self color: color. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setColorVarAt:put: (in category 'accessing - private') ----- - setColorVarAt: index put: cPixel - - cPixel isNumber ifTrue: [ - (arrays at: index) atAllPut: cPixel. - ^ self. - ]. - - (arrays at: index) replaceFrom: 1 to: cPixel size with: cPixel startingAt: 1. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setGreenComponentIn:to: (in category 'player commands') ----- - setGreenComponentIn: aPatch to: value - - | xArray yArray patch component | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - value isCollection ifFalse: [ - component := (value asInteger bitAnd: 16rFF) bitShift: 8. - ]. - (1 to: self size) do: [:i | | pix | - value isCollection ifTrue: [ - component := ((value at: i) asInteger bitAnd: 16rFF) bitShift: 8. - ]. - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - pix := (pix bitAnd: 16rFF00FF) bitOr: component. - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setHeading: (in category 'player commands') ----- - setHeading: degrees - - ^ self heading: degrees. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setInitialValueOf:from:to:for: (in category 'player commands') ----- - setInitialValueOf: name from: from to: to for: aKedamaWorld - - | array max | - array := arrays at: (info at: name). - name = #who ifTrue: [ - from to: to do: [:index | - array at: index put: (aKedamaWorld nextTurtleID). - ]. - ^ self. - ]. - name = #x ifTrue: [ - max := aKedamaWorld dimensions x * 100. - self primRandomRange: max from: from to: to intoFloatArray: array factor: 0.01. - ^ self. - ]. - name = #y ifTrue: [ - max := aKedamaWorld dimensions y * 100. - self primRandomRange: max from: from to: to intoFloatArray: array factor: 0.01. - ^ self. - ]. - name = #heading ifTrue: [ - self primRandomRange: 36000 from: from to: to intoFloatArray: array factor: (0.01 * 0.0174532925199433). - ^ self. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setNormal: (in category 'player commands') ----- - setNormal: degrees - - ^ self normal: degrees. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setNumberVarAt:put: (in category 'accessing - private') ----- - setNumberVarAt: index put: v - - v isNumber ifTrue: [ - (arrays at: index) atAllPut: v. - ^ self. - ]. - (v isMemberOf: KedamaFloatArray) ifTrue: [ - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. - ^ self. - ]. - (v isMemberOf: WordArray) ifTrue: [ - v primAddScalar: v and: 0.0 into: (arrays at: index). - ^ self. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setObjectVarAt:put: (in category 'accessing - private') ----- - setObjectVarAt: index put: v - - (v isKindOf: Array) ifFalse: [ - (arrays at: index) atAllPut: v. - ^ self. - ]. - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setPatchValueIn:to: (in category 'player commands') ----- - setPatchValueIn: aPatch to: value - - | xArray yArray patchMorph | - xArray := arrays at: 2. - yArray := arrays at: 3. - patchMorph := aPatch costume renderedMorph. - patchMorph setPixelsAtXArray: xArray yArray: yArray value: value. - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setRedComponentIn:to: (in category 'player commands') ----- - setRedComponentIn: aPatch to: value - - | xArray yArray patch component | - xArray := arrays at: 2. - yArray := arrays at: 3. - patch := aPatch costume renderedMorph. - value isCollection ifFalse: [ - component := (value asInteger bitAnd: 16rFF) bitShift: 16. - ]. - (1 to: self size) do: [:i | | pix | - value isCollection ifTrue: [ - component := ((value at: i) asInteger bitAnd: 16rFF) bitShift: 16. - ]. - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). - pix := (pix bitAnd: 16r00FFFF) bitOr: component. - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setTurtleVisible: (in category 'player commands') ----- - setTurtleVisible: aBooleanArray - - 1 to: self size do: [:i | - (turtles arrays at: 6) at: i put: ((aBooleanArray at: i) ifTrue: [1] ifFalse: [0]). - ]. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setTurtlesCount:prototype:for:randomize: (in category 'add turtles') ----- - setTurtlesCount: count prototype: prototype for: aKedamaWorld randomize: rondomizeFlag - - | anInteger | - anInteger := count. - count < 0 ifTrue: [anInteger := 0]. - - self size > anInteger ifTrue: [ - info associationsDo: [:assoc | | array | - array := (arrays at: assoc value). - array := array copyFrom: 1 to: anInteger. - arrays at: assoc value put: array. - ]. - turtleMapValid := false. - whoTableValid := false. - ]. - - self size < anInteger ifTrue: [ - self addTurtlesCount: (anInteger - self size) ofPrototype: prototype for: aKedamaWorld randomize: rondomizeFlag. - turtleMapValid := false. - whoTableValid := false. - - ]. - - - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setVectorSlotTypeFor:typeChosen: (in category 'player protocol') ----- - setVectorSlotTypeFor: slotName typeChosen: typeChosen - - | index initVar | - index := info at: slotName asSymbol. - index = 0 ifTrue: [^ self]. - - initVar := self initialValueForSlotOfType: typeChosen. - - types at: index put: typeChosen. - - self compileAllAccessors. - arrays at: index put: (self arrayForType: typeChosen). - self perform: ('set', slotName capitalized, ':') asSymbol with: initVar. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setX: (in category 'player commands') ----- - setX: v - - exampler getGrouped ifFalse: [ - self - primSetX: (arrays at: 2) - headingArray: (arrays at: 4) - value: (v isNumber ifTrue: [v asFloat] ifFalse: [v]) - destWidth: kedamaWorld wrapX - leftEdgeMode: kedamaWorld leftEdgeModeMnemonic - rightEdgeMode: kedamaWorld rightEdgeModeMnemonic. - ] ifTrue: [ - self groupSetX: v - ]. - turtleMapValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>setY: (in category 'player commands') ----- - setY: v - - exampler getGrouped ifFalse: [ - self - primSetY: (arrays at: 3) - headingArray: (arrays at: 4) - value: (v isNumber ifTrue: [v asFloat] ifFalse: [v]) - destHeight: kedamaWorld wrapY - topEdgeMode: kedamaWorld topEdgeModeMnemonic - bottomEdgeMode: kedamaWorld bottomEdgeModeMnemonic. - ] ifTrue: [ - self groupSetY: v. - ]. - turtleMapValid := false. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>show (in category 'player commands') ----- - show - - (arrays at: 6) atAllPut: 1. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>size (in category 'accessing') ----- - size - - ^ arrays first size. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>turn: (in category 'player commands') ----- - turn: degrees - "Turn by the given number of degrees." - - self heading: (self heading + degrees). - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>types (in category 'accessing') ----- - types - - ^ types. - ! Item was removed: - ----- Method: KedamaTurtleVectorPlayer>>useKedamaFloatArray (in category 'private') ----- - useKedamaFloatArray - - - arrays withIndexDo: [:array :index | | newArray | - (array isMemberOf: FloatArray) ifTrue: [ - newArray := KedamaFloatArray new: array size. - newArray replaceFrom: 1 to: array size with: array startingAt: 1. - arrays at: index put: newArray. - ]. - ]. - ! Item was removed: - PackageInfo subclass: #MorphicGamesInfo - instanceVariableNames: '' - classVariableNames: '' - poolDictionaries: '' - category: 'Etoys-Squeakland-Morphic-Games'! - - !MorphicGamesInfo commentStamp: 'asm 7/5/2003 15:59' prior: 0! - to create the package: - - in a 5325 image - -file in SARBuilder - - SARPackageDumper fileOutPackageNamed: 'Morphic-Games' - as: (FileDirectory default nextNameFor: 'Morphic-Games' extension: 'sar')! Item was removed: - ----- Method: MorphicGamesInfo>>changesText (in category 'introspection') ----- - changesText - ^' - version 6: included Rick McGeer''s Chess Castling Fix - version 5: included Atomic (some changes were needed to make it work in 3.7) and some Babel stuff - version 4: includes Andreas Raab''s rewrite of ChessConstants as declarative pool (update 5325) - version 3: -added one change by the KCP team - -Chess its playing again - version 2: applied changes by the MCP team'! Item was removed: - ----- Method: MorphicGamesInfo>>postscriptText (in category 'introspection') ----- - postscriptText - "Executed after load" - ^ 'Utilities informUser: ''Generating Games thumbnails in PartsBin, please wait...'' during: [ - PartsBin clearThumbnailCache. - PartsBin cacheAllThumbnails. - ]. - "End ', self packageName, '"'! Item was removed: - ----- Method: MorphicGamesInfo>>readmeText (in category 'introspection') ----- - readmeText - ^'Morphic-Games has the games that were in the image before 3.6: - Chess, Chinese Checkers, Cipher, Crostic, FreeCell, Mines, Same and Tetris. - plus Atomic'! Item was removed: - ----- Method: Player class>>createTurtleSubclass (in category 'turtles') ----- - createTurtleSubclass - - | instVarString classInstVarString aName aClass | - instVarString := KedamaTurtleVectorPlayer instVarNames. - classInstVarString := ''. - aName := self chooseUniqueTurtleClassName. - aClass := self subclass: aName instanceVariableNames: instVarString - classVariableNames: '' poolDictionaries: '' category: self categoryForUniclasses. - classInstVarString size > 0 ifTrue: - [aClass class instanceVariableNames: classInstVarString]. - aClass copyAllCategoriesUnobtrusivelyFrom: KedamaTurtleVectorPlayer. - ^ aClass - ! Item was removed: - ----- Method: SugarLauncher>>badgeFlap (in category 'presence') ----- - badgeFlap - "This finds or creates a flap to hold badges" - - | translatedFlapName flapTab flap spacer holder | - translatedFlapName := 'Buddies' translated. - flapTab := Flaps globalFlapTab: translatedFlapName. - flapTab ifNotNil: [^flapTab]. - - flap := AlignmentMorph newRow. - flap clipSubmorphs: true. - flap beTransparent. - flap layoutInset: 0; cellInset: 0; borderWidth: 0. - flap setProperty: #wantsHaloFromClick toValue: false. - flap beFlap: true. - - spacer := Morph new beTransparent. "This provides space for tabs to be seen." - spacer width: 20. - spacer hResizing: #rigid; vResizing: #spaceFill. - flap addMorphBack: spacer. - - holder := Morph new. - holder name: 'Badges'. - holder position: 0@100. - holder layoutPolicy: TableLayout new. - holder color: Color red muchLighter; - wrapDirection: #topToBottom; - hResizing: #spaceFill; - vResizing: #spaceFill; - cellInset: 10; - layoutInset: 10. - flap addMorphBack: holder. - - flap beSticky. - spacer beSticky; lock: true. - holder beSticky. - - flapTab := FlapTab new. - flapTab referent: flap. - flapTab setName: translatedFlapName edge: #left color: Color red muchLighter. - flapTab referentMargin: 0@75. - flapTab setToPopOutOnDragOver: true. - Flaps addGlobalFlap: flapTab. - ActiveWorld addGlobalFlaps. - ScriptingSystem cleanUpFlapTabsOnLeft. - - ^flapTab! Item was removed: - ----- Method: SugarLauncher>>badgeFor: (in category 'presence') ----- - badgeFor: aBuddy - ^self badgeHolder submorphs - detect: [:m | - (m isKindOf: NebraskaSenderMorph) and: [ - (m valueOfProperty: #buddy) = aBuddy]] - ifNone: [nil] - ! Item was removed: - ----- Method: SugarLauncher>>badgeHolder (in category 'presence') ----- - badgeHolder - "This finds or creates a flap to hold badges" - - ^self badgeFlap referent submorphNamed: 'Badges' - ! Item was removed: - ----- Method: SugarLauncher>>buddies (in category 'presence') ----- - buddies - sharedActivity ifNil: [^Dictionary new]. - buddies ifNil: [self setupBuddies]. - ^buddies! Item was removed: - ----- Method: SugarLauncher>>buddiesLock (in category 'presence') ----- - buddiesLock - ^buddiesLock ifNil: [buddiesLock := Semaphore forMutualExclusion]! Item was removed: - ----- Method: SugarLauncher>>createJournalEntryFor:filename:mimetype: (in category 'datastore') ----- - createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString - | properties id | - properties := self propertiesFrom: aProject. - properties at: 'ctime' put: (properties at: 'mtime'). - properties at: 'mime_type' put: mimetypeString. - properties removeKey: 'uid' ifAbsent: []. "would confuse Sugar 0.82" - aFilename ifEmpty: [properties at: 'title:text' put: 'Etoys' translated]. - id := self dataStore create: properties with: aFilename squeakToUtf8 with: true. - ^id asString! Item was removed: - ----- Method: SugarLauncher>>deleteBadges (in category 'presence') ----- - deleteBadges - | flapTab | - flapTab := (Flaps globalFlapTab: 'Buddies' translated) ifNil: [^self]. - Flaps removeFlapTab: flapTab keepInList: false. - ! Item was removed: - ----- Method: SugarLauncher>>deleteUnused: (in category 'datastore') ----- - deleteUnused: filePath - "Delete file if filePath is indeed unused" - - World submorphs do: [:m | - (m isSystemWindow and: [ - (m model isKindOf: FileList) and: [ - m model fullName = filePath]]) ifTrue: [ - ^self deleteUnused: filePath whenDoneWith: m]]. - - [FileDirectory deleteFilePath: filePath] on: Error do: ["ignore"] - ! Item was removed: - ----- Method: SugarLauncher>>deleteUnused:whenDoneWith: (in category 'datastore') ----- - deleteUnused: fileName whenDoneWith: anObject - "Delete fileName when anObject is not in use anymore" - - ^anObject - toFinalizeSend: #deleteUnused: - to: self - with: fileName! Item was removed: - ----- Method: SugarLauncher>>enableSharedActivitySignals (in category 'presence') ----- - enableSharedActivitySignals - sharedActivity onBuddyJoinedSend: #buddyJoined: to: self. - sharedActivity onBuddyLeftSend: #buddyLeft: to: self. - ! Item was removed: - ----- Method: SugarLauncher>>findJournalEntries:properties: (in category 'datastore') ----- - findJournalEntries: query properties: propNames - "query is either a String or a dictionary, e.g. {'mime_type'->'application/x-squeak-project'}. Answers an array of properties. If propNames is not nil, only the named properties will be returned (which will be more efficient)" - ^(self dataStore find: query with: (propNames ifNil: [#()])) first! Item was removed: - ----- Method: SugarLauncher>>getFile: (in category 'datastore') ----- - getFile: id - "answer a temporary file, will be deleted if not used anymore" - | utf8Name file | - utf8Name := self dataStore getFilename: id. - utf8Name isEmptyOrNil ifTrue: [^nil]. - file := FileStream readOnlyFileNamed: utf8Name utf8ToSqueak. - self deleteUnused: file name whenDoneWith: file. - ^file! Item was removed: - ----- Method: SugarLauncher>>getProperties: (in category 'datastore') ----- - getProperties: objectId - | props | - props := self dataStore getProperties: objectId. - "Make sure the props we care about are strings" - props at: 'title' ifPresent: [:value | props at: 'title' put: value asString utf8ToSqueak composeAccents]. - props at: 'mime_type' ifPresent: [:value | props at: 'mime_type' put: value asString]. - props at: 'uid' put: objectId asString. - ^props! Item was removed: - ----- Method: SugarLauncher>>handleStream:mimetype:titled: (in category 'datastore') ----- - handleStream: tmpStream mimetype: mimetypeOrNil titled: title - "tmpStream was opened from journal or other media. - For simplicity, we re-use the file drop logic." - - ActiveHand lastEvent position: World center. - [ - [(ExternalDropHandler lookupExternalDropHandler: tmpStream) - handle: tmpStream in: World dropEvent: ActiveHand lastEvent] - ifError: [self inform: ('Cannot open {1}' translated format: {title})] - ] ensure: [tmpStream ifNotNil: [tmpStream close]].! Item was removed: - ----- Method: SugarLauncher>>joinSharedActivity (in category 'presence') ----- - joinSharedActivity - "join a shared activity on startup" - Utilities informUser: 'Looking for shared activity ...' translated - during: [ - [sharedActivity := self presence getActivityById: self activityId] - ifError: [^sharedActivity := nil]]. - - Utilities informUser: 'Joining activity ...' translated - during: [ - [sharedActivity join] ifError: [^sharedActivity := nil] . - self setupBuddies. - self setupTubes. - self enableSharedActivitySignals. - SugarNavigatorBar current ifNotNilDo: [:bar | bar joinSharedActivity]. - ]. - - ! Item was removed: - ----- Method: SugarLauncher>>leaveSharedActivity (in category 'presence') ----- - leaveSharedActivity - sharedActivity ifNotNil: [ - sharedActivity leaveAsync. - sharedActivity := nil. - self buddiesLock critical: [buddies := nil]. - self deleteBadges]. - ! Item was removed: - ----- Method: SugarLauncher>>makeJournalEntryFor:filename:mimetype: (in category 'datastore') ----- - makeJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString - "If this is a new project (no journal id yet), create a new Journal object, and remember the new id. - Otherwise, if this is an auto-save, update the existing Journal entry. - But if it is an explicit save, always create a new entry. Which entry we continue to work on depends on the sugarAutoSave preference. If enabled (before 4.1), the new entry is just a checkpoint, the project continues to use the old id/entry, and will be saved again on quit. If disabled (default since 4.1), we switch to the newly created id/entry." - | id | - (id := aProject sugarObjectId) - ifNil: [ - id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString. - aProject sugarObjectId: id. - self monitorJournalEntry: id] - ifNotNil: [ - (Preferences sugarAutoSave and: [aProject projectParameterAt: #sugarAutoSave ifAbsent: [true]]) - ifTrue: [self updateJournalEntry: id for: aProject filename: aFilename mimetype: mimetypeString] - ifFalse: [ - id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString. - Preferences sugarAutoSave ifFalse: [ - self unmonitorJournalEntry: aProject sugarObjectId. - aProject sugarObjectId: id. - self monitorJournalEntry: id]]]! Item was removed: - ----- Method: SugarLauncher>>monitorJournalEntry: (in category 'datastore') ----- - monitorJournalEntry: objectId - self dataStore - onUpdated: objectId - send: #updatedJournalEntry: - to: self.! Item was removed: - ----- Method: SugarLauncher>>propertiesFrom: (in category 'datastore') ----- - propertiesFrom: aProject - | preview autoSave props markFavorite setActivity | - preview := [ByteArray streamContents: [:s | PNGReadWriter - putForm: (aProject thumbnail asFormOfDepth: 16) - onStream: s]] ifError: ['']. - autoSave := aProject projectParameterAt: #sugarAutoSave ifAbsent: [true]. - setActivity := Preferences sugarAutoSave not | autoSave. - markFavorite := Preferences sugarAutoSave & autoSave not. - props := (aProject sugarProperties ifNil: [Dictionary new]) copy. - { - 'activity' -> self bundleId. - 'activity_id' -> (setActivity ifTrue: [self activityId] ifFalse: ['']). - 'title:text' -> (self titleFromProject: aProject) squeakToUtf8. - 'title_set_by_user' -> (aProject currentVersionNumber>0 ifTrue: ['1'] ifFalse: ['0']). - 'keep' -> (markFavorite ifTrue: ['1'] ifFalse: ['0']). - 'mtime' -> (DateAndTime now asString first: 19). - 'timestamp' -> (DateAndTime now asUnixTime). - 'preview' -> preview. - 'icon-color' -> self ownerBuddy colors. - } do: [:each | props add: each]. - ^props - ! Item was removed: - ----- Method: SugarLauncher>>resumeJournalEntry: (in category 'datastore') ----- - resumeJournalEntry: id - | props file title project mimetype | - props := self getProperties: id. - title := props at: 'title' ifAbsent: ['untitled' translated]. - mimetype := props at: 'mime_type' ifAbsent: ['']. - - mimetype isEmpty ifTrue: [^self welcome: '']. - - mimetype = 'application/x-squeak-project' ifFalse: [ - "reuse drop code" - WorldState addDeferredUIMessage: [ - self open: id title: title mimetype: mimetype]. - ^Project enterNew]. - - 'Loading a Project...' displaySequentialProgress: [ - Display fillWhite;forceToScreen. - file := self getFile: id. - "load project and close temp file (which will thus be deleted)" - project := ProjectLoading - loadName: ((title copyReplaceAll: '/' with: '\') contractTo: 64) - stream: file - fromDirectory: nil - withProjectView: nil. - file close. - project keepSugarProperties: props monitor: true. - project projectParameterAt: #sugarAutoSave put: true. - project enter]. - ! Item was removed: - ----- Method: SugarLauncher>>setupBuddies (in category 'presence') ----- - setupBuddies - self badgeFlap. - self buddiesLock critical: [buddies := Dictionary new]. - sharedActivity getJoinedBuddies do: [:each | - self buddyJoined: each]. - ! Item was removed: - ----- Method: SugarLauncher>>sharePublicly: (in category 'presence') ----- - sharePublicly: aBoolean - sharedActivity ifNotNil: [^self]. - - sharedActivity := self presence - shareActivity: self activityId - with: self bundleId - with: (self titleFromProject: Project current) squeakToUtf8 - with: Dictionary new. "due to bug 4660 we can't pass properties directly" - sharedActivity setProperties: ({'private' -> aBoolean not} as: Dictionary). - self setupBuddies. - self enableSharedActivitySignals. - self setupTubes. - ! Item was removed: - ----- Method: SugarLauncher>>showBadges (in category 'presence') ----- - showBadges - self badgeFlap openFully! Item was removed: - ----- Method: SugarLauncher>>titleFromProject: (in category 'datastore') ----- - titleFromProject: aProject - ^(aProject name beginsWith: 'Unnamed' translated) - ifTrue: ['Etoys Project' translated] - ifFalse: [aProject name]! Item was removed: - ----- Method: SugarLauncher>>unmonitorJournalEntry: (in category 'datastore') ----- - unmonitorJournalEntry: objectId - self dataStore - onUpdated: objectId - send: nil - to: self.! Item was removed: - ----- Method: SugarLauncher>>updateJournalEntry: (in category 'datastore') ----- - updateJournalEntry: id - ^self updateJournalEntry: id - for: Project current - filename: '' - mimetype: ''! Item was removed: - ----- Method: SugarLauncher>>updateJournalEntry:for:filename:mimetype: (in category 'datastore') ----- - updateJournalEntry: id for: aProject filename: aFilename mimetype: mimetypeString - "Move aProject saved to aFilename into the datastore, delete aFilename" - | properties | - properties := self propertiesFrom: aProject. - properties at: 'mime_type' put: mimetypeString. - self dataStore update: id with: properties with: aFilename squeakToUtf8 with: true.! Item was removed: - ----- Method: Utilities class>>defaultRepositoryChangeLogOn: (in category '*Etoys-Squeakland-fetching updates') ----- - defaultRepositoryChangeLogOn: aStream - "Transcript clear. Utilities defaultRepositoryChangeLogOn: Transcript" - | repo updates latest previous latestVersion previousVersion added removed latestPackages previousPackages prevDep prevInfo latestInfo | - repo := MCRepositoryGroup default repositories detect: [:r | - r description = MCMcmUpdater defaultUpdateURL]. - updates := repo allFileNames select: [:each | 'update-*.mcm' match: each]. - updates := updates asSortedCollection: - [:a :b | a splitInteger second > b splitInteger second]. - latest := repo versionFromFileNamed: updates first. - previous := repo versionFromFileNamed: updates second. - latestVersion := self versionNumberAndDateFromConfig: latest. - previousVersion := self versionNumberAndDateFromConfig: previous. - aStream nextPutAll: 'Changes from v'; print: previousVersion first; - nextPutAll: ' of '; print: previousVersion second; - nextPutAll: ' to v'; print: latestVersion first; - nextPutAll: ' of '; print: latestVersion second; - nextPutAll: ':'; cr. - aStream flush. - latestPackages := latest dependencies collect: [:dep | dep package]. - previousPackages := previous dependencies collect: [:dep | dep package]. - added := latestPackages difference: previousPackages. - removed := previousPackages difference: latestPackages. - added ifNotEmpty: [ - aStream nextPutAll: 'Added packages:'. - added do: [:each | aStream space; nextPutAll: each name]. - aStream cr]. - removed ifNotEmpty: [ - aStream nextPutAll: 'Removed packages:'. - removed do: [:each | aStream space; nextPutAll: each name]. - aStream cr]. - latest dependencies do: [:latestDep | - prevDep := previous dependencies detect: [:p | latestDep package = p package] ifNone: []. - (prevDep notNil and: [prevDep versionInfo ~= latestDep versionInfo]) - ifTrue: [ - aStream nextPutAll: '--------------------'; cr. - prevInfo := prevDep package workingCopy ancestry findAncestor: prevDep versionInfo. - latestInfo := latestDep package workingCopy ancestry findAncestor: latestDep versionInfo. - (latestInfo allAncestorsOnPathTo: prevInfo) reverse, {latestInfo} - do: [:ver | aStream nextPutAll: ver name; cr; nextPutAll: ver message; cr] - separatedBy: [aStream cr]]]. - aStream flush - ! Item was removed: - ----- Method: Utilities class>>updateFromDefaultRepository (in category '*Etoys-Squeakland-fetching updates') ----- - updateFromDefaultRepository - | config | - "Flush all caches. If a previous download failed this is often helpful" - MCFileBasedRepository flushAllCaches. - config := MCMcmUpdater updateFromDefaultRepository. - config ifNil: [^self inform: 'Repository unavailable' translated]. - self setSystemVersionFromConfig: config. - self inform: ('Update completed. - System version is now: - {1}' translated format: {SystemVersion current asString}). - ! |
We have a number of Etoys submissions from 'jl' in the inbox, including
EToys-jl.235. Are these being merged with the 'tfel' versions? If so, maybe the inbox files can be moved to the treated inbox. Dave On Tue, Sep 20, 2016 at 08:40:49AM +0000, [hidden email] wrote: > Tim Felgentreff uploaded a new version of EToys to project The Trunk: > http://source.squeak.org/trunk/EToys-tfel.235.mcz > > ==================== Summary ==================== > > Name: EToys-tfel.235 > Author: tfel > Time: 20 September 2016, 10:40:06.499404 am > UUID: 4c293f06-9bcb-5348-844b-76cc91922065 > Ancestors: EToys-bf.234 > > - begin removal of old Kedama classes, to eventually replace everything with Kedama2 > - move SugarLauncher code that needs Dbus into SugarDBus package > - remove unused BooleanPreferenceView and HaloThemePrefernceView classes > - remove unused MorphicGamesInfo class > - remove old Utilities methods that got moved into McmUpdater and re-added by the merge heuristic > > =============== Diff against EToys-bf.234 =============== > > Item was removed: > - PreferenceView subclass: #BooleanPreferenceView > - instanceVariableNames: '' > - classVariableNames: '' > - poolDictionaries: '' > - category: 'Etoys-Squeakland-System-Support'! > - > - !BooleanPreferenceView commentStamp: '<historical>' prior: 0! > - I am responsible for building the visual representation of a preference that accepts true and false values! > > Item was removed: > - ----- Method: BooleanPreferenceView class>>handlesPanel: (in category 'view registry') ----- > - handlesPanel: aPreferencePanel > - ^aPreferencePanel isKindOf: PreferencesPanel! > > Item was removed: > - ----- Method: BooleanPreferenceView class>>initialize (in category 'class initialization') ----- > - initialize > - PreferenceViewRegistry ofBooleanPreferences register: self.! > > Item was removed: > - ----- Method: BooleanPreferenceView class>>unload (in category 'class initialization') ----- > - unload > - PreferenceViewRegistry ofBooleanPreferences unregister: self.! > > Item was removed: > - ----- Method: BooleanPreferenceView>>offerPersistenceMenu (in category 'user interface') ----- > - offerPersistenceMenu > - | aMenu | > - Preferences ensurePersistedPreferencesAccessible > - ifFalse: [^self]. > - aMenu := MenuMorph new defaultTarget: self preference. > - aMenu addTitle: self preference name. > - aMenu addUpdating: #isEnabledOnStartupString target: self preference selector: #persistValue: argumentList: {true}. > - aMenu addUpdating: #isDisabledOnStartupString target: self preference selector: #persistValue: argumentList: {false}. > - aMenu addUpdating: #isNotSetOnStartupString target: self preference selector: #persistValue: argumentList: {nil}. > - aMenu popUpInWorld! > > Item was removed: > - ----- Method: BooleanPreferenceView>>offerPreferenceNameMenu:with:in: (in category 'user interface') ----- > - offerPreferenceNameMenu: aPanel with: ignored1 in: ignored2 > - "the user clicked on a preference name -- put up a menu" > - > - | aMenu | > - ActiveHand showTemporaryCursor: nil. > - aMenu := MenuMorph new defaultTarget: self preference. > - aMenu addTitle: self preference name. > - > - (Preferences okayToChangeProjectLocalnessOf: self preference name) ifTrue: > - [aMenu addUpdating: #isProjectLocalString target: self preference action: #toggleProjectLocalness. > - aMenu balloonTextForLastItem: 'Some preferences are best applied uniformly to all projects, and others are best set by each individual project. If this item is checked, then this preference will be printed in bold and will have a separate value for each project' translated]. > - > - aMenu add: 'browse senders' translated target: self systemNavigation selector: #browseAllCallsOn: argument: self preference name. > - aMenu balloonTextForLastItem: 'This will open a method-list browser on all methods that the send the preference "' translated, self preference name, '".'. > - aMenu add: 'show category...' translated target: aPanel selector: #findCategoryFromPreference: argument: self preference name. > - aMenu balloonTextForLastItem: 'Allows you to find out which category, or categories, this preference belongs to.' translated. > - > - Smalltalk isMorphic ifTrue: > - [aMenu add: 'hand me a button for this preference' translated target: self selector: #tearOffButton. > - aMenu balloonTextForLastItem: 'Will give you a button that governs this preference, which you may deposit wherever you wish' translated]. > - > - aMenu add: 'copy this name to clipboard' translated target: self preference selector: #copyName. > - aMenu balloonTextForLastItem: 'Copy the name of the preference to the text clipboard, so that you can paste into code somewhere' translated. > - aMenu add: 'set automatically on startup...' translated target: self selector: #offerPersistenceMenu. > - aMenu balloonTextForLastItem: 'Store a value for this preference on file. On startup, it will be automatically restored.' translated. > - > - aMenu popUpInWorld! > > Item was removed: > - ----- Method: BooleanPreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') ----- > - representativeButtonWithColor: aColor inPanel: aPreferencesPanel > - "Return a button that controls the setting of prefSymbol. It will keep up to date even if the preference value is changed in a different place" > - > - | outerButton aButton str miniWrapper | > - > - outerButton := AlignmentMorph newRow height: 24. > - outerButton color: (aColor ifNil: [Color r: 0.645 g: 1.0 b: 1.0]). > - outerButton hResizing: (aPreferencesPanel ifNil: [#shrinkWrap] ifNotNil: [#spaceFill]). > - outerButton vResizing: #shrinkWrap. > - outerButton addMorph: (aButton := UpdatingThreePhaseButtonMorph checkBox). > - aButton > - target: self preference; > - actionSelector: #togglePreferenceValue; > - getSelector: #preferenceValue. > - > - outerButton addTransparentSpacerOfSize: (2 @ 0). > - str := StringMorph contents: self preference name font: Preferences standardButtonFont. > - > - self preference localToProject ifTrue: > - [str emphasis: 1]. > - > - miniWrapper := AlignmentMorph newRow hResizing: #shrinkWrap; vResizing: #shrinkWrap. > - miniWrapper layoutInset: 0. > - miniWrapper beTransparent addMorphBack: str lock. > - aPreferencesPanel > - ifNotNil: "We're in a Preferences panel" > - [miniWrapper on: #mouseDown send: #offerPreferenceNameMenu:with:in: to: self withValue: aPreferencesPanel. > - miniWrapper on: #mouseEnter send: #menuButtonMouseEnter: to: miniWrapper. > - miniWrapper on: #mouseLeave send: #menuButtonMouseLeave: to: miniWrapper. > - miniWrapper setBalloonText: 'Click here for a menu of options regarding this preference. Click on the checkbox to the left to toggle the setting of this preference' translated] > - > - ifNil: "We're a naked button, not in a panel" > - [miniWrapper setBalloonText: self preference helpString translated; setProperty: #balloonTarget toValue: aButton]. > - > - outerButton addMorphBack: miniWrapper. > - outerButton setNameTo: self preference name. > - > - aButton setBalloonText: self preference helpString. > - > - ^ outerButton > - ! > > Item was removed: > - PreferenceView subclass: #HaloThemePreferenceView > - instanceVariableNames: '' > - classVariableNames: '' > - poolDictionaries: '' > - category: 'Etoys-Squeakland-System-Support'! > - > - !HaloThemePreferenceView commentStamp: '<historical>' prior: 0! > - I am responsible for building the view for the preference that choose the halo theme! > > Item was removed: > - ----- Method: HaloThemePreferenceView class>>handlesPanel: (in category 'view registry') ----- > - handlesPanel: aPreferencePanel > - ^aPreferencePanel isKindOf: PreferencesPanel! > > Item was removed: > - ----- Method: HaloThemePreferenceView class>>initialize (in category 'class initialization') ----- > - initialize > - "adding the halo theme preference to Preferences and registering myself as its view" > - PreferenceViewRegistry ofHaloThemePreferences register: self. > - Preferences > - addPreference: #haloTheme > - categories: {#halos} > - default: #iconicHaloSpecifications > - balloonHelp: '' > - projectLocal: false > - changeInformee: nil > - changeSelector: nil > - viewRegistry: PreferenceViewRegistry ofHaloThemePreferences.! > > Item was removed: > - ----- Method: HaloThemePreferenceView class>>unload (in category 'class initialization') ----- > - unload > - PreferenceViewRegistry ofHaloThemePreferences unregister: self.! > > Item was removed: > - ----- Method: HaloThemePreferenceView>>haloThemeRadioButtons (in category 'user interface') ----- > - haloThemeRadioButtons > - "Answer a column of butons representing the choices of halo theme" > - > - | buttonColumn aRow aRadioButton aStringMorph | > - buttonColumn := AlignmentMorph newColumn beTransparent. > - #('iconic' 'classic' 'simple' 'custom') translatedNoop. > - #( (iconicHaloSpecifications iconic iconicHalosInForce 'circular halos with icons inside') > - (classicHaloSpecs classic classicHalosInForce 'plain circular halos') > - (simpleFullHaloSpecifications simple simpleHalosInForce 'fewer, larger halos') > - (customHaloSpecs custom customHalosInForce 'customizable halos')) translatedNoop do: > - > - [:quad | > - aRow := AlignmentMorph newRow beTransparent. > - aRow addMorph: (aRadioButton := UpdatingThreePhaseButtonMorph radioButton). > - aRadioButton target: Preferences. > - aRadioButton setBalloonText: quad fourth translated. > - aRadioButton actionSelector: #installHaloTheme:. > - aRadioButton getSelector: quad third. > - aRadioButton arguments: (Array with: quad first). > - aRow addTransparentSpacerOfSize: (4 @ 0). > - aRow addMorphBack: (aStringMorph := StringMorph contents: quad second asString translated). > - aStringMorph setBalloonText: quad fourth translated. > - buttonColumn addMorphBack: aRow]. > - ^ buttonColumn > - > - "(Preferences preferenceAt: #haloTheme) view tearOffButton"! > > Item was removed: > - ----- Method: HaloThemePreferenceView>>representativeButtonWithColor:inPanel: (in category 'user interface') ----- > - representativeButtonWithColor: aColor inPanel: aPreferencesPanel > - | outerButton editButton | > - editButton := SimpleButtonMorph new > - target: Preferences; > - color: Color transparent; > - actionSelector: #editCustomHalos; > - label: 'Edit custom halos' translated; > - setBalloonText: 'Click here to edit the method that defines the custom halos' translated. > - > - outerButton := AlignmentMorph newColumn. > - outerButton > - color: (aColor ifNil: [Color r: 0.645 g: 1.0 b: 1.0]); > - hResizing: (aPreferencesPanel ifNil: [#shrinkWrap] ifNotNil: [#spaceFill]); > - vResizing: #shrinkWrap; > - addTransparentSpacerOfSize: (0@4); > - addMorphBack: self haloThemeRadioButtons; > - addTransparentSpacerOfSize: (0@4); > - addMorphBack: editButton. > - > - ^outerButton. > - > - "(Preferences preferenceAt: #haloTheme) view tearOffButton" ! > > Item was removed: > - ----- Method: KedamaExamplerPlayer>>copyAllMethodsAgain (in category 'debug support') ----- > - copyAllMethodsAgain > - > - | c result | > - c := turtles class. > - result := (ClassBuilder new) > - name: c name > - inEnvironment: c environment > - subclassOf: c superclass > - type: c typeOfClass > - instanceVariableNames: KedamaTurtleVectorPlayer instanceVariablesString > - classVariableNames: KedamaTurtleVectorPlayer classVariablesString > - poolDictionaries: KedamaTurtleVectorPlayer sharedPoolsString > - category: c category. > - turtles class copyAllCategoriesUnobtrusivelyFrom: KedamaTurtleVectorPlayer. > - sequentialStub ifNotNil: [sequentialStub class copyAllCategoriesUnobtrusivelyFrom: KedamaSequenceExecutionStub]. > - ! > > Item was removed: > - ----- Method: KedamaExamplerPlayer>>createTurtles (in category 'subclass players management') ----- > - createTurtles > - > - turtles := self class createTurtleSubclass new. > - turtles kedamaWorld: kedamaWorld. > - turtles exampler: self. > - ^ turtles. > - ! > > Item was added: > + ----- Method: KedamaSequenceExecutionStub class>>isSystemDefined (in category 'as yet unclassified') ----- > + isSystemDefined > + ^ name endsWithDigit not! > > Item was added: > + ----- Method: KedamaSequenceExecutionStub class>>isUniClass (in category 'as yet unclassified') ----- > + isUniClass > + > + ^ self ~~ self officialClass! > > Item was removed: > - ----- Method: KedamaTurtleMorph class>>copyAllMethodsAgain (in category 'scripting') ----- > - copyAllMethodsAgain > - " > - KedamaTurtleMorph copyAllMethodsAgain. > - " > - KedamaTurtleMorph allInstancesDo: [:e | e player ifNotNil: [e player copyAllMethodsAgain]]. > - ! > > Item was removed: > - KedamaExamplerPlayer subclass: #KedamaTurtleVectorPlayer > - instanceVariableNames: 'exampler info types arrays deletingIndex whoTable whoTableBase whoTableValid turtlesMap turtleMapValid lastWho lastWhoStub' > - classVariableNames: '' > - poolDictionaries: '' > - category: 'Etoys-StarSqueak'! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer class>>officialClass (in category 'all') ----- > - officialClass > - > - ^ KedamaTurtleVectorPlayer > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>aTurtleAtX:y: (in category 'turtle map') ----- > - aTurtleAtX: xPos y: yPos > - > - | w x y index who stub | > - turtleMapValid ifFalse: [ > - self makeTurtlesMap. > - ]. > - > - w := kedamaWorld dimensions x. > - x := xPos truncated. > - y := yPos truncated. > - x < 0 ifTrue: [^ nil]. > - x >= w ifTrue: [^ nil]. > - y < 0 ifTrue: [^ nil]. > - y >= kedamaWorld dimensions y ifTrue: [^ nil]. > - index := (w * y) + x + 1. > - who := turtlesMap at: index. > - who = 0 ifTrue: [^ nil]. > - who = lastWho ifTrue: [^ lastWhoStub]. > - stub := exampler clonedSequentialStub. > - stub who: who. > - lastWho := who. > - ^ lastWhoStub := stub. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>addInstanceVarNamed:withValue: (in category 'player protocol') ----- > - addInstanceVarNamed: aName withValue: aValue > - > - | newArray | > - (aValue isKindOf: Number) ifTrue: [ > - newArray := KedamaFloatArray new: self size. > - ]. > - (aValue isKindOf: Color) ifTrue: [ > - newArray := WordArray new: self size. > - ]. > - (aValue isKindOf: Player) ifTrue: [ > - newArray := Array new: self size. > - ]. > - > - arrays := arrays, newArray. > - info at: aName asSymbol put: arrays size. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>addInstanceVarVectorNamed:withValue: (in category 'player protocol') ----- > - addInstanceVarVectorNamed: aName withValue: aValue > - > - | newArray | > - newArray := KedamaFloatArray new: self size. > - arrays := arrays, (Array with: newArray). > - newArray atAllPut: aValue. > - info at: aName asSymbol put: arrays size. > - types at: arrays size put: #Number. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>addTurtlesCount:ofPrototype:for:positionAndColorArray: (in category 'add turtles') ----- > - addTurtlesCount: count ofPrototype: prototype for: aKedamaWorld positionAndColorArray: positionAndColorArray > - > - | oldCount | > - oldCount := self size. > - info associationsDo: [:assoc | | defaultValue index newArray array | > - index := info at: assoc key. > - array := arrays at: (info at: assoc key). > - defaultValue := prototype at: index. > - newArray := array class new: count. > - (#(who x y heading color normal) includes: assoc key) ifFalse: [ > - newArray atAllPut: defaultValue. > - ]. > - assoc key = #x ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray first startingAt: 1]. > - assoc key = #y ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray second startingAt: 1]. > - assoc key = #color ifTrue: [newArray replaceFrom: 1 to: newArray size with: positionAndColorArray third startingAt: 1]. > - assoc key = #heading ifTrue: [newArray atAllPut: 1.57079631 "Float pi / 2.0"]. > - assoc key = #normal ifTrue: [newArray atAllPut: 1.57079631 "Float pi / 2.0"]. > - > - arrays at: (assoc value) put: array, newArray. > - ]. > - > - #(who) do: [:name | > - self setInitialValueOf: name from: oldCount + 1 to: self size for: aKedamaWorld. > - ]. > - whoTableValid := false. > - turtleMapValid := false. > - > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>addTurtlesCount:ofPrototype:for:randomize: (in category 'add turtles') ----- > - addTurtlesCount: count ofPrototype: prototype for: aKedamaWorld randomize: randomizeFlag > - > - | oldCount | > - oldCount := self size. > - info associationsDo: [:assoc | | array defaultValue newArray index | > - index := info at: assoc key. > - array := arrays at: index. > - defaultValue := prototype at: index. > - newArray := array class new: count. > - newArray atAllPut: defaultValue. > - arrays at: index put: (array, newArray). > - ]. > - > - self setInitialValueOf: #who from: oldCount + 1 to: self size for: aKedamaWorld. > - > - randomizeFlag ifTrue: [ > - #(x y heading) do: [:name | > - self setInitialValueOf: name from: oldCount + 1 to: self size for: aKedamaWorld. > - ]. > - ]. > - whoTableValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>arrayForType: (in category 'private') ----- > - arrayForType: typeName > - > - | newArray | > - (typeName = #Number) ifTrue: [ > - newArray := KedamaFloatArray new: self size. > - ]. > - (typeName = #Color) ifTrue: [ > - newArray := WordArray new: self size. > - ]. > - (typeName = #Boolean) ifTrue: [ > - newArray := ByteArray new: self size. > - ]. > - > - newArray ifNil: [ > - newArray := Array new: self size. > - ]. > - > - ^ newArray. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>arrays (in category 'accessing') ----- > - arrays > - > - ^ arrays. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>basicGetAngleTo: (in category 'player commands') ----- > - basicGetAngleTo: players > - > - | ret p xArray yArray result | > - players isCollection ifFalse: [ > - p := players > - ]. > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - result := KedamaFloatArray new: self size. > - 1 to: self size do: [:index | > - players isCollection ifTrue: [ > - p := players at: index. > - ]. > - ret := ((p getX - (xArray at: index))@(p getY - (yArray at: index))) theta radiansToDegrees + 90.0. > - ret > 360.0 ifTrue: [ret := ret - 360.0]. > - result at: index put: ret. > - ]. > - ^ result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>basicGetDistanceTo: (in category 'player commands') ----- > - basicGetDistanceTo: players > - > - | p xArray yArray result | > - players isCollection ifFalse: [ > - p := players > - ]. > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - result := KedamaFloatArray new: self size. > - 1 to: self size do: [:index | > - players isCollection ifTrue: [ > - p := players at: index. > - ]. > - result at: index put: ((p getX - (xArray at: index)) squared + (p getY - (yArray at: index)) squared) sqrt. > - > - ]. > - ^ result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>basicMakeTurtlesMap (in category 'turtle map') ----- > - basicMakeTurtlesMap > - > - | x y xArray yArray width height mapIndex whoArray | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - whoArray := arrays at: 1. > - width := kedamaWorld dimensions x. > - height := kedamaWorld dimensions y. > - turtlesMap atAllPut: 0. > - > - 1 to: self size do: [:index | > - x := (xArray at: index) truncated. > - y := (yArray at: index) truncated. > - mapIndex := (width * y) + x + 1. > - (0 < mapIndex and: [mapIndex <= turtlesMap size]) ifTrue: [ > - turtlesMap at: mapIndex put: (whoArray at: index). > - ]. > - ]. > - > - turtleMapValid := true. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>color: (in category 'player commands') ----- > - color: c > - > - c isColor ifTrue: [ > - self setColorVarAt: 5 put: ((c pixelValueForDepth: 32) bitAnd: 16rFFFFFF). > - ] ifFalse: [ > - self setColorVarAt: 5 put: c. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>colorFromPatch: (in category 'player commands') ----- > - colorFromPatch: aPatch > - > - | xArray yArray cArray patch | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - cArray := arrays at: 5. > - patch := aPatch costume renderedMorph. > - 1 to: self size do: [:i | > - cArray at: i put: ((patch pixelAtX: (xArray at: i) y: (yArray at: i)) bitAnd: 16rFFFFFF). > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>colorToPatch: (in category 'player commands') ----- > - colorToPatch: aPatch > - > - | xArray yArray cArray patch | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - cArray := arrays at: 5. > - patch := aPatch costume renderedMorph. > - 1 to: self size do: [:i | > - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: (cArray at: i). > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>compileAllAccessors (in category 'player protocol') ----- > - compileAllAccessors > - > - info keys do: [:k | > - (#(who x y heading color visible) includes: k) ifFalse: [ > - self compileVectorInstVarAccessorsFor: k. > - ]. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>compileVectorInstVarAccessorsFor: (in category 'player protocol') ----- > - compileVectorInstVarAccessorsFor: varName > - > - | nameString index type setPhrase | > - nameString := varName asString capitalized. > - index := info at: varName asSymbol. > - self class compileSilently: ('get', nameString, ' > - ^ ', '(arrays at: ', index printString, ')') > - classified: 'access'. > - > - type := types at: index. > - type = #Number ifTrue: [ > - setPhrase := 'setNumberVarAt:'. > - ]. > - type = #Boolean ifTrue: [ > - setPhrase := 'setBooleanVarAt:'. > - ]. > - type = #Color ifTrue: [ > - setPhrase := 'setColorVarAt:'. > - ]. > - setPhrase ifNil: [setPhrase := 'setObjectVarAt:']. > - > - self class compileSilently: ('set', nameString, ': xxxArg > - self ', setPhrase, index printString, ' put: xxxArg') > - classified: 'access'! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>delete (in category 'deleting') ----- > - delete > - > - exampler := nil. > - arrays := nil. > - whoTable := nil. > - turtlesMap := nil. > - self class removeFromSystem: false. > - self becomeForward: UnscriptedPlayer new > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>deleteTurtleID: (in category 'player commands') ----- > - deleteTurtleID: who > - > - | whoArray whoIndex | > - whoArray := arrays at: 1. > - whoIndex := whoArray indexOf: who ifAbsent: [^ self]. > - deletingIndex := whoIndex - 1. > - arrays withIndexDo: [:array :index | | newArray | > - newArray := (array copyFrom: 1 to: whoIndex - 1), (array copyFrom: whoIndex + 1 to: array size). > - arrays at: index put: newArray. > - ]. > - whoTableValid := false. > - turtleMapValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>doCommand: (in category 'command execution') ----- > - doCommand: aBlock > - > - ^ aBlock value: self. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>doDieCommand: (in category 'command execution') ----- > - doDieCommand: aBlock > - > - ^ exampler doDieCommand: aBlock. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>doExamplerCommand: (in category 'command execution') ----- > - doExamplerCommand: aBlock > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>doSequentialCommand: (in category 'command execution') ----- > - doSequentialCommand: aBlock > - > - ^ exampler doSequentialCommand: aBlock. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>drawOn: (in category 'displaying') ----- > - drawOn: aForm > - > - | xArray yArray colorArray visibleArray bits x y visible bitsIndex dimX dimY ret | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - colorArray := arrays at: 5. > - visibleArray := arrays at: 6. > - bits := aForm bits. > - dimX := aForm width. > - dimY := aForm height. > - > - ret := self primDrawOn: bits destWidth: dimX destHeight: dimY xArray: xArray yArray: yArray colorArray: colorArray visibleArray: visibleArray. > - ret ifNotNil: [^ self]. > - > - 1 to: self size do: [:index | > - x := (xArray at: index) truncated. > - y := (yArray at: index) truncated. > - visible := (visibleArray at: index) ~= 0. > - (visible and: [((x >= 0) and: [y >= 0]) and: [(x < dimX) and: [y < dimY]]]) ifTrue: [ > - bitsIndex := ((y * dimX) + x) + 1. > - bits at: bitsIndex put: (colorArray at: index). > - ]. > - ]. > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>exampler: (in category 'accessing') ----- > - exampler: e > - > - exampler := e. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>forward: (in category 'player commands') ----- > - forward: val > - > - exampler getGrouped ifFalse: [ > - self primForwardXArray: (arrays at: 2) yArray: (arrays at: 3) headingArray: (arrays at: 4) value: (val isNumber ifTrue: [val asFloat] ifFalse: [val]) destWidth: kedamaWorld wrapX asFloat destHeight: kedamaWorld wrapY asFloat leftEdgeMode: kedamaWorld leftEdgeModeMnemonic rightEdgeMode: kedamaWorld rightEdgeModeMnemonic topEdgeMode: kedamaWorld topEdgeModeMnemonic bottomEdgeMode: kedamaWorld bottomEdgeModeMnemonic. > - ] ifTrue: [ > - self groupForward: val > - ]. > - turtleMapValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getAngleTo: (in category 'player commands') ----- > - getAngleTo: players > - > - | p xArray yArray result pX pY xy | > - players isCollection ifFalse: [ > - p := players > - ]. > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - result := KedamaFloatArray new: self size. > - players isCollection ifTrue: [ > - pX := KedamaFloatArray new: players size. > - pY := KedamaFloatArray new: players size. > - 1 to: players size do: [:i | > - xy := (players at: i) getXAndY. > - pX at: i put: xy x. > - pY at: i put: xy y. > - ]. > - ] ifFalse: [ > - xy := p getXAndY. > - pX := xy x. > - pY := xy y. > - ]. > - ^ self primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result. > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getBlueComponentIn: (in category 'player commands') ----- > - getBlueComponentIn: aPatch > - > - | pix xArray yArray patch w | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - w := WordArray new: self size. > - 1 to: self size do: [:i | > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - w at: i put: (pix bitAnd: 16rFF). > - ]. > - ^ w. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getBooleanVarAt: (in category 'accessing - private') ----- > - getBooleanVarAt: index > - > - ^ arrays at: index. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getColor (in category 'player commands') ----- > - getColor > - > - ^ self getVarAt: 5. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getColorVarAt: (in category 'accessing - private') ----- > - getColorVarAt: index > - > - ^ (arrays at: index) collect: [:c | Color colorFromPixelValue: c depth: 32]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getDistanceTo: (in category 'player commands') ----- > - getDistanceTo: players > - > - | p xArray yArray result pX pY xy | > - players isCollection ifFalse: [ > - p := players > - ]. > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - result := KedamaFloatArray new: self size. > - players isCollection ifTrue: [ > - pX := KedamaFloatArray new: players size. > - pY := KedamaFloatArray new: players size. > - 1 to: players size do: [:i | > - xy := (players at: i) getXAndY. > - pX at: i put: xy x. > - pY at: i put: xy y. > - ]. > - ] ifFalse: [ > - xy := p getXAndY. > - pX := xy x. > - pY := xy y. > - ]. > - ^ self primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getGreenComponentIn: (in category 'player commands') ----- > - getGreenComponentIn: aPatch > - > - | pix xArray yArray patch w | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - w := WordArray new: self size. > - 1 to: self size do: [:i | > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - w at: i put: ((pix bitShift: -8) bitAnd: 16rFF). > - ]. > - ^ w. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getGrouped (in category 'player commands') ----- > - getGrouped > - > - ^ exampler getGrouped. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getHeading (in category 'player commands') ----- > - getHeading > - > - | heading result ret | > - heading := (arrays at: 4). > - result := KedamaFloatArray new: heading size. > - ret := self primGetHeading: heading into: result. > - ret ifNotNil: [^ result]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getNormal (in category 'player commands') ----- > - getNormal > - > - | result ret normal | > - normal := (arrays at: 7). > - result := KedamaFloatArray new: normal size. > - ret := self primGetHeading: normal into: result. > - ret ifNotNil: [^ result]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getPatchValueIn: (in category 'player commands') ----- > - getPatchValueIn: aPatch > - > - | w patch xArray yArray | > - w := WordArray new: self size. > - patch := aPatch costume renderedMorph. > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch pixelsAtXArray: xArray yArray: yArray into: w. > - ^ w. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getRedComponentIn: (in category 'player commands') ----- > - getRedComponentIn: aPatch > - > - | pix xArray yArray patch w | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - w := WordArray new: self size. > - 1 to: self size do: [:i | > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - w at: i put: ((pix bitShift: -16) bitAnd: 16rFF). > - ]. > - ^ w. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getTurtleAt: (in category 'player commands') ----- > - getTurtleAt: aPlayer > - > - | xy | > - aPlayer isCollection ifTrue: [ > - self error: 'should not happen'. > - ]. > - xy := aPlayer getXAndY. > - ^ (self aTurtleAtX: xy x y: xy y) ifNil: [^ aPlayer]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getTurtleOf: (in category 'player commands') ----- > - getTurtleOf: aBreedPlayer > - > - | xy | > - aBreedPlayer isCollection ifTrue: [ > - "self error: 'should not happen'." > - ^ aBreedPlayer. > - ]. > - xy := aBreedPlayer getXAndY. > - ^ (self aTurtleAtX: xy x y: xy y) ifNil: [^ aBreedPlayer]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getTurtleVisible (in category 'player commands') ----- > - getTurtleVisible > - > - ^ (turtles arrays at: 6) collect: [:t | t = 1]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getUphillIn: (in category 'player commands') ----- > - getUphillIn: aPatch > - > - | xArray yArray headingArray result patch | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - headingArray := arrays at: 4. > - result := KedamaFloatArray new: self size. > - patch := aPatch costume renderedMorph. > - 1 to: self size do: [:index | > - result at: index put: (patch > - uphillForTurtleX: (xArray at: index) > - turtleY: (yArray at: index) > - turtleHeading: (headingArray at: index)). > - ]. > - ^ result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getVarAt: (in category 'accessing - private') ----- > - getVarAt: index > - > - ^ arrays at: index. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getX (in category 'player commands') ----- > - getX > - > - | xArray | > - exampler getGrouped ifFalse: [ > - ^ arrays at: 2. > - ] ifTrue: [ > - xArray := arrays at: 2. > - xArray size = 0 ifTrue: [^ exampler getX]. > - ^ xArray first. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>getY (in category 'player commands') ----- > - getY > - > - | yArray | > - exampler getGrouped ifFalse: [ > - ^ arrays at: 3. > - ] ifTrue: [ > - yArray := arrays at: 3. > - yArray size = 0 ifTrue: [^ exampler getY]. > - ^ yArray first. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>groupForward: (in category 'private') ----- > - groupForward: dist > - > - | x y headingRadians | > - self size = 0 ifTrue: [^ self]. > - > - x := (arrays at: 2) first. > - y := (arrays at: 3) first. > - headingRadians := (arrays at: 4) first. > - self groupSetX: (x + (dist asFloat * headingRadians cos)). > - self groupSetY: (y - (dist asFloat * headingRadians sin)). > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>groupSetX: (in category 'private') ----- > - groupSetX: val > - > - | xArray headingArray origX origHeading leftEdgeMode rightEdgeMode newArray wrapX minX maxX | > - self size = 0 ifTrue: [^ self]. > - xArray := arrays at: 2. > - headingArray := arrays at: 4. > - > - origX := xArray first. > - origHeading := headingArray first. > - > - leftEdgeMode := kedamaWorld leftEdgeModeMnemonic. > - rightEdgeMode := kedamaWorld rightEdgeModeMnemonic. > - > - newArray := xArray collect: [:e | e + val - origX]. > - wrapX := kedamaWorld wrapX. > - minX := newArray min. > - maxX := newArray max. > - ((minX < 0.0) not and: [(maxX >= wrapX) not]) ifTrue: [ > - arrays at: 2 put: newArray. > - ^ self. > - ]. > - > - minX < 0.0 ifTrue: [ > - leftEdgeMode = 1 ifTrue: [ > - newArray withIndexDo: [:e :i | > - e < 0.0 ifTrue: [newArray at: i put: e + wrapX]. > - ]. > - ]. > - leftEdgeMode = 2 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - minX. > - ]. > - ]. > - leftEdgeMode = 3 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e + (minX * -2.0). > - ]. > - ]. > - ]. > - > - maxX >= wrapX ifTrue: [ > - rightEdgeMode = 1 ifTrue: [ > - newArray withIndexDo: [:e :i | > - e >= wrapX ifTrue: [newArray at: i put: e - wrapX]. > - ]. > - ]. > - rightEdgeMode = 2 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - (maxX - wrapX) - 2.35099e-038. > - ]. > - ]. > - rightEdgeMode = 3 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - ((maxX - wrapX) * 2.0) - 2.35099e-038. > - ]. > - ]. > - ]. > - > - arrays at: 2 put: newArray. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>groupSetY: (in category 'private') ----- > - groupSetY: val > - > - | yArray headingArray origY origHeading topEdgeMode bottomEdgeMode newArray wrapY minY maxY | > - self size = 0 ifTrue: [^ self]. > - yArray := arrays at: 3. > - headingArray := arrays at: 4. > - > - origY := yArray first. > - origHeading := headingArray first. > - > - topEdgeMode := kedamaWorld topEdgeModeMnemonic. > - bottomEdgeMode := kedamaWorld bottomEdgeModeMnemonic. > - > - newArray := yArray collect: [:e | e + val - origY]. > - wrapY := kedamaWorld wrapY. > - minY := newArray min. > - maxY := newArray max. > - ((minY < 0.0) not and: [(maxY >= wrapY) not]) ifTrue: [ > - arrays at: 3 put: newArray. > - ^ self. > - ]. > - > - minY < 0.0 ifTrue: [ > - topEdgeMode = 1 ifTrue: [ > - newArray withIndexDo: [:e :i | > - e < 0.0 ifTrue: [newArray at: i put: e + wrapY]. > - ]. > - ]. > - topEdgeMode = 2 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - minY. > - ]. > - ]. > - topEdgeMode = 3 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e + (minY * -2.0). > - ]. > - ]. > - ]. > - > - maxY >= wrapY ifTrue: [ > - bottomEdgeMode = 1 ifTrue: [ > - newArray withIndexDo: [:e :i | > - e >= wrapY ifTrue: [newArray at: i put: e - wrapY]. > - ]. > - ]. > - bottomEdgeMode = 2 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - (maxY - wrapY) - 2.35099e-038. > - ]. > - ]. > - bottomEdgeMode = 3 ifTrue: [ > - newArray withIndexDo: [:e :i | > - newArray at: i put: e - ((maxY - wrapY) * 2.0) - 2.35099e-038. > - ]. > - ]. > - ]. > - > - arrays at: 3 put: newArray. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>heading (in category 'player commands') ----- > - heading > - > - ^ self getHeading. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>heading: (in category 'player commands') ----- > - heading: degrees > - > - | deg | > - deg := degrees isNumber ifTrue: [degrees asFloat] ifFalse: [degrees]. > - self primSetHeading: (arrays at: 4) from: deg. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>hide (in category 'player commands') ----- > - hide > - > - (arrays at: 6) atAllPut: 0. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>indexOf: (in category 'enumeration') ----- > - indexOf: who > - > - | whoArray | > - whoTableValid ifTrue: [^ whoTable at: (who - whoTableBase)]. > - > - whoArray := arrays at: 1. > - > - whoArray size = 0 ifTrue: [^ 0]. > - > - whoTableBase := whoArray first - 1. > - whoTable := WordArray new: whoArray last - whoTableBase. > - 1 to: whoArray size do: [:w | > - whoTable at: (whoArray at: w) - whoTableBase put: w. > - ]. > - whoTableValid := true. > - > - ^ whoTable at: (who - whoTableBase). > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>info (in category 'accessing') ----- > - info > - > - ^ info. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>initialize (in category 'initialization') ----- > - initialize > - > - super initialize. > - info := IdentityDictionary new. > - info at: #who put: 1. > - info at: #x put: 2. > - info at: #y put: 3. > - info at: #heading put: 4. > - info at: #color put: 5. > - info at: #visible put: 6. > - info at: #normal put: 7. > - > - arrays := Array new: 7. > - arrays at: (info at: #who) put: (WordArray new: 0). > - arrays at: (info at: #x) put: (KedamaFloatArray new: 0). > - arrays at: (info at: #y) put: (KedamaFloatArray new: 0). > - arrays at: (info at: #heading) put: (KedamaFloatArray new: 0). > - arrays at: (info at: #color) put: (WordArray new: 0). > - arrays at: (info at: #visible) put: (ByteArray new: 0). > - arrays at: (info at: #normal) put: (KedamaFloatArray new: 0). > - > - types := Array new: 64. > - > - types at: 1 put: #Integer. > - types at: 2 put: #Number. > - types at: 3 put: #Number. > - types at: 4 put: #Number. > - types at: 5 put: #Color. > - types at: 6 put: #Boolean. > - types at: 7 put: #Number. > - > - whoTableValid := false. > - turtleMapValid := false. > - > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>initializeDeletingIndex (in category 'enumeration') ----- > - initializeDeletingIndex > - > - deletingIndex := 0. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>instSize (in category 'accessing') ----- > - instSize > - > - ^ arrays size. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>invalidateTurtleMap (in category 'turtle map') ----- > - invalidateTurtleMap > - > - turtleMapValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>makePrototypeFromFirstInstance (in category 'add turtles') ----- > - makePrototypeFromFirstInstance > - > - ^ (1 to: arrays size) collect: [:index | > - (arrays at: index) first > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>makeTurtlesMap (in category 'turtle map') ----- > - makeTurtlesMap > - > - | xArray yArray width height whoArray ret | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - whoArray := arrays at: 1. > - width := kedamaWorld dimensions x. > - height := kedamaWorld dimensions y. > - turtlesMap ifNil: [turtlesMap := WordArray new: width * height]. > - > - ret := self primMakeTurtlesMap: turtlesMap whoArray: whoArray xArray: xArray yArray: yArray width: width height: height. > - > - ret ifNil: [self basicMakeTurtlesMap]. > - > - turtleMapValid := true. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>nextDeletingIndex (in category 'enumeration') ----- > - nextDeletingIndex > - > - ^ deletingIndex := deletingIndex + 1. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>normal: (in category 'player commands') ----- > - normal: degrees > - > - | deg | > - deg := degrees isNumber ifTrue: [degrees asFloat] ifFalse: [degrees]. > - self primSetHeading: (arrays at: 7) from: deg. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>noteRenameOf:to:inPlayer: (in category 'player protocol') ----- > - noteRenameOf: oldSlotName to: newSlotName inPlayer: aPlayer > - > - self compileAllAccessors > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primDrawOn:destWidth:destHeight:xArray:yArray:colorArray:visibleArray: (in category 'primitives') ----- > - primDrawOn: destBits destWidth: destWidth destHeight: destHeight xArray: xArray yArray: yArray colorArray: colorArray visibleArray: visibleArray > - > - | x y visible bitsIndex | > - <primitive: 'drawTurtlesInArray' module: 'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #drawTurtlesInArray." > - > - 1 to: xArray size do: [:i | > - x := (xArray at: i) asInteger. > - y := (yArray at: i) asInteger. > - visible := (visibleArray at: i). > - (visible ~= 0 and: [((x >= 0) and: [y >= 0]) and: [(x < destWidth) and: [y < destHeight]]]) ifTrue: [ > - bitsIndex := ((y * destWidth) + x) + 1. > - destBits at: bitsIndex put: (colorArray at: i). > - ] > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primForwardXArray:yArray:headingArray:value:destWidth:destHeight:leftEdgeMode:rightEdgeMode:topEdgeMode:bottomEdgeMode: (in category 'primitives') ----- > - primForwardXArray: xArray yArray: yArray headingArray: headingArray value: v destWidth: destWidth destHeight: destHeight leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode > - > - | dist newX newY | > - <primitive: 'primTurtlesForward' module: 'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #primTurtlesForward." > - > - 1 to: xArray size do: [:i | > - v isCollection ifTrue: [ > - dist := (v at: i) asFloat. > - ] ifFalse: [ > - dist := v asFloat. > - ]. > - newX := (xArray at: i) + (dist * (headingArray at: i) cos). > - newY := (yArray at: i) - (dist * (headingArray at: i) sin). > - KedamaMorph scalarXAt: i xArray: xArray headingArray: headingArray value: newX destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode. > - KedamaMorph scalarYAt: i yArray: yArray headingArray: headingArray value: newY destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primGetAngleToX:toY:xArray:yArray:resultInto: (in category 'primitives') ----- > - primGetAngleToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result > - > - | ppx ppy x y ret | > - <primitive: 'vectorGetAngleTo' module:'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #vectorGetAngleTo." > - > - ppx := pX. > - ppy := pY. > - 1 to: result size do: [:index | > - pX isCollection ifTrue: [ > - ppx := pX at: index. > - ppy := pY at: index. > - ]. > - x := ppx - (xArray at: index). > - y := ppy - (yArray at: index). > - ret := (x@y) theta radiansToDegrees + 90.0. > - ret > 360.0 ifTrue: [ret := ret - 360.0]. > - result at: index put: ret. > - ]. > - ^ result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primGetDistanceToX:toY:xArray:yArray:resultInto: (in category 'primitives') ----- > - primGetDistanceToX: pX toY: pY xArray: xArray yArray: yArray resultInto: result > - > - | ppx ppy | > - <primitive: 'vectorGetDistanceTo' module:'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #vectorGetDistanceTo." > - > - ppx := pX. > - ppy := pY. > - 1 to: result size do: [:index | > - pX isCollection ifTrue: [ > - ppx := pX at: index. > - ppy := pY at: index. > - ]. > - result at: index put: ((ppx - (xArray at: index)) squared + (ppy - (yArray at: index)) squared) sqrt. > - > - ]. > - ^ result. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primGetHeading:into: (in category 'primitives') ----- > - primGetHeading: headingArray into: resultArray > - > - | heading | > - <primitive: 'getHeadingArrayInto' module:'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #getHeadingArrayInto." > - > - 1 to: headingArray size do: [:i | > - heading := headingArray at: i. > - heading := heading / 0.0174532925199433. > - heading := 90.0 - heading. > - heading > 0.0 ifFalse: [heading := heading + 360.0]. > - resultArray at: i put: heading. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primMakeTurtlesMap:whoArray:xArray:yArray:width:height: (in category 'primitives') ----- > - primMakeTurtlesMap: map whoArray: whoArray xArray: xArray yArray: yArray width: w height: h > - > - <primitive: 'makeTurtlesMap' module: 'KedamaPlugin'> > - ^ nil. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primRandomRange:from:to:intoFloatArray:factor: (in category 'primitives') ----- > - primRandomRange: range from: from to: to intoFloatArray: aFloatArray factor: factor > - > - <primitive: 'randomIntoFloatArray' module: 'KedamaPlugin'> > - > - from to: to do: [:index | > - aFloatArray at: index put: (kedamaWorld random: range) asFloat * factor. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primRandomRange:from:to:intoIntegerArray:factor: (in category 'primitives') ----- > - primRandomRange: range from: from to: to intoIntegerArray: anIntegerArray factor: factor > - > - <primitive: 'randomIntoIntegerArray' module: 'KedamaPlugin'> > - > - from to: to do: [:index | > - anIntegerArray at: index put: ((kedamaWorld random: range) asFloat * factor) asInteger. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primSetHeading:from: (in category 'primitives') ----- > - primSetHeading: headingArray from: val > - > - | heading | > - <primitive: 'setHeadingArrayFrom' module:'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #setHeadingArrayFrom." > - > - val isCollection ifFalse: [ > - heading := val asFloat. > - heading := KedamaMorph degreesToRadians: heading. > - ]. > - > - 1 to: headingArray size do: [:i | > - val isCollection ifTrue: [ > - heading := val at: i. > - heading := KedamaMorph degreesToRadians: heading. > - ]. > - headingArray at: i put: heading. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primSetX:headingArray:value:destWidth:leftEdgeMode:rightEdgeMode: (in category 'primitives') ----- > - primSetX: xArray headingArray: headingArray value: v destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode > - > - | val newX | > - <primitive: 'turtlesSetX' module: 'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #turtlesSetX." > - > - v isCollection ifFalse: [ > - val := v asFloat. > - ]. > - > - 1 to: xArray size do: [:i | > - v isCollection ifTrue: [ > - newX := v at: i. > - ] ifFalse: [ > - newX := val. > - ]. > - KedamaMorph scalarXAt: i xArray: xArray headingArray: headingArray value: newX destWidth: destWidth leftEdgeMode: leftEdgeMode rightEdgeMode: rightEdgeMode. > - ]. > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>primSetY:headingArray:value:destHeight:topEdgeMode:bottomEdgeMode: (in category 'primitives') ----- > - primSetY: yArray headingArray: headingArray value: v destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode > - > - | val newY | > - <primitive: 'turtlesSetY' module: 'KedamaPlugin'> > - "^ KedamaPlugin doPrimitive: #turtlesSetY." > - > - v isCollection ifFalse: [ > - val := v asFloat. > - ]. > - > - 1 to: yArray size do: [:i | > - v isCollection ifTrue: [ > - newY := v at: i. > - ] ifFalse: [ > - newY := val. > - ]. > - KedamaMorph scalarYAt: i yArray: yArray headingArray: headingArray value: newY destHeight: destHeight topEdgeMode: topEdgeMode bottomEdgeMode: bottomEdgeMode. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>removeSlotNamed: (in category 'player protocol') ----- > - removeSlotNamed: aSlotName > - > - | index newArrays | > - self basicRemoveSlotNamed: aSlotName. > - index := info at: aSlotName asSymbol ifAbsent: [^ self]. > - newArrays := (arrays copyFrom: 1 to: index - 1), (arrays copyFrom: index + 1 to: arrays size). > - types replaceFrom: index to: types size with: types startingAt: index + 1. > - > - info removeKey: aSlotName asSymbol. > - arrays := newArrays. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>removeVectorSlotNamed: (in category 'player protocol') ----- > - removeVectorSlotNamed: aSlotName > - > - | index newArrays | > - index := info at: aSlotName asSymbol ifAbsent: [^ self]. > - newArrays := (arrays copyFrom: 1 to: index - 1), (arrays copyFrom: index + 1 to: arrays size). > - types replaceFrom: index to: types size - 1 with: types startingAt: index + 1. > - > - info removeKey: aSlotName asSymbol. > - arrays := newArrays. > - self compileAllAccessors. > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>renameVectorSlot:newSlotName: (in category 'player protocol') ----- > - renameVectorSlot: oldSlotName newSlotName: newSlotName > - > - | index | > - index := info at: oldSlotName asSymbol ifAbsent: [^ self]. > - info removeKey: oldSlotName asSymbol. > - info at: newSlotName put: index. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setBlueComponentIn:to: (in category 'player commands') ----- > - setBlueComponentIn: aPatch to: value > - > - | xArray yArray patch component | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - value isCollection ifFalse: [ > - component := value asInteger bitAnd: 16rFF. > - ]. > - (1 to: self size) do: [:i | | pix | > - value isCollection ifTrue: [ > - component := (value at: i) asInteger bitAnd: 16rFF. > - ]. > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - pix := (pix bitAnd: 16rFFFF00) bitOr: component. > - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setBooleanVarAt:put: (in category 'accessing - private') ----- > - setBooleanVarAt: index put: v > - > - (v == true or: [v == false]) ifTrue: [ > - (arrays at: index) atAllPut: (v == true ifTrue: [1] ifFalse: [0]). > - ^ self. > - ]. > - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setColor: (in category 'player commands') ----- > - setColor: color > - > - ^ self color: color. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setColorVarAt:put: (in category 'accessing - private') ----- > - setColorVarAt: index put: cPixel > - > - cPixel isNumber ifTrue: [ > - (arrays at: index) atAllPut: cPixel. > - ^ self. > - ]. > - > - (arrays at: index) replaceFrom: 1 to: cPixel size with: cPixel startingAt: 1. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setGreenComponentIn:to: (in category 'player commands') ----- > - setGreenComponentIn: aPatch to: value > - > - | xArray yArray patch component | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - value isCollection ifFalse: [ > - component := (value asInteger bitAnd: 16rFF) bitShift: 8. > - ]. > - (1 to: self size) do: [:i | | pix | > - value isCollection ifTrue: [ > - component := ((value at: i) asInteger bitAnd: 16rFF) bitShift: 8. > - ]. > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - pix := (pix bitAnd: 16rFF00FF) bitOr: component. > - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setHeading: (in category 'player commands') ----- > - setHeading: degrees > - > - ^ self heading: degrees. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setInitialValueOf:from:to:for: (in category 'player commands') ----- > - setInitialValueOf: name from: from to: to for: aKedamaWorld > - > - | array max | > - array := arrays at: (info at: name). > - name = #who ifTrue: [ > - from to: to do: [:index | > - array at: index put: (aKedamaWorld nextTurtleID). > - ]. > - ^ self. > - ]. > - name = #x ifTrue: [ > - max := aKedamaWorld dimensions x * 100. > - self primRandomRange: max from: from to: to intoFloatArray: array factor: 0.01. > - ^ self. > - ]. > - name = #y ifTrue: [ > - max := aKedamaWorld dimensions y * 100. > - self primRandomRange: max from: from to: to intoFloatArray: array factor: 0.01. > - ^ self. > - ]. > - name = #heading ifTrue: [ > - self primRandomRange: 36000 from: from to: to intoFloatArray: array factor: (0.01 * 0.0174532925199433). > - ^ self. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setNormal: (in category 'player commands') ----- > - setNormal: degrees > - > - ^ self normal: degrees. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setNumberVarAt:put: (in category 'accessing - private') ----- > - setNumberVarAt: index put: v > - > - v isNumber ifTrue: [ > - (arrays at: index) atAllPut: v. > - ^ self. > - ]. > - (v isMemberOf: KedamaFloatArray) ifTrue: [ > - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. > - ^ self. > - ]. > - (v isMemberOf: WordArray) ifTrue: [ > - v primAddScalar: v and: 0.0 into: (arrays at: index). > - ^ self. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setObjectVarAt:put: (in category 'accessing - private') ----- > - setObjectVarAt: index put: v > - > - (v isKindOf: Array) ifFalse: [ > - (arrays at: index) atAllPut: v. > - ^ self. > - ]. > - (arrays at: index) replaceFrom: 1 to: v size with: v startingAt: 1. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setPatchValueIn:to: (in category 'player commands') ----- > - setPatchValueIn: aPatch to: value > - > - | xArray yArray patchMorph | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patchMorph := aPatch costume renderedMorph. > - patchMorph setPixelsAtXArray: xArray yArray: yArray value: value. > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setRedComponentIn:to: (in category 'player commands') ----- > - setRedComponentIn: aPatch to: value > - > - | xArray yArray patch component | > - xArray := arrays at: 2. > - yArray := arrays at: 3. > - patch := aPatch costume renderedMorph. > - value isCollection ifFalse: [ > - component := (value asInteger bitAnd: 16rFF) bitShift: 16. > - ]. > - (1 to: self size) do: [:i | | pix | > - value isCollection ifTrue: [ > - component := ((value at: i) asInteger bitAnd: 16rFF) bitShift: 16. > - ]. > - pix := patch pixelAtX: (xArray at: i) y: (yArray at: i). > - pix := (pix bitAnd: 16r00FFFF) bitOr: component. > - patch pixelAtX: (xArray at: i) y: (yArray at: i) put: pix. > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setTurtleVisible: (in category 'player commands') ----- > - setTurtleVisible: aBooleanArray > - > - 1 to: self size do: [:i | > - (turtles arrays at: 6) at: i put: ((aBooleanArray at: i) ifTrue: [1] ifFalse: [0]). > - ]. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setTurtlesCount:prototype:for:randomize: (in category 'add turtles') ----- > - setTurtlesCount: count prototype: prototype for: aKedamaWorld randomize: rondomizeFlag > - > - | anInteger | > - anInteger := count. > - count < 0 ifTrue: [anInteger := 0]. > - > - self size > anInteger ifTrue: [ > - info associationsDo: [:assoc | | array | > - array := (arrays at: assoc value). > - array := array copyFrom: 1 to: anInteger. > - arrays at: assoc value put: array. > - ]. > - turtleMapValid := false. > - whoTableValid := false. > - ]. > - > - self size < anInteger ifTrue: [ > - self addTurtlesCount: (anInteger - self size) ofPrototype: prototype for: aKedamaWorld randomize: rondomizeFlag. > - turtleMapValid := false. > - whoTableValid := false. > - > - ]. > - > - > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setVectorSlotTypeFor:typeChosen: (in category 'player protocol') ----- > - setVectorSlotTypeFor: slotName typeChosen: typeChosen > - > - | index initVar | > - index := info at: slotName asSymbol. > - index = 0 ifTrue: [^ self]. > - > - initVar := self initialValueForSlotOfType: typeChosen. > - > - types at: index put: typeChosen. > - > - self compileAllAccessors. > - arrays at: index put: (self arrayForType: typeChosen). > - self perform: ('set', slotName capitalized, ':') asSymbol with: initVar. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setX: (in category 'player commands') ----- > - setX: v > - > - exampler getGrouped ifFalse: [ > - self > - primSetX: (arrays at: 2) > - headingArray: (arrays at: 4) > - value: (v isNumber ifTrue: [v asFloat] ifFalse: [v]) > - destWidth: kedamaWorld wrapX > - leftEdgeMode: kedamaWorld leftEdgeModeMnemonic > - rightEdgeMode: kedamaWorld rightEdgeModeMnemonic. > - ] ifTrue: [ > - self groupSetX: v > - ]. > - turtleMapValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>setY: (in category 'player commands') ----- > - setY: v > - > - exampler getGrouped ifFalse: [ > - self > - primSetY: (arrays at: 3) > - headingArray: (arrays at: 4) > - value: (v isNumber ifTrue: [v asFloat] ifFalse: [v]) > - destHeight: kedamaWorld wrapY > - topEdgeMode: kedamaWorld topEdgeModeMnemonic > - bottomEdgeMode: kedamaWorld bottomEdgeModeMnemonic. > - ] ifTrue: [ > - self groupSetY: v. > - ]. > - turtleMapValid := false. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>show (in category 'player commands') ----- > - show > - > - (arrays at: 6) atAllPut: 1. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>size (in category 'accessing') ----- > - size > - > - ^ arrays first size. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>turn: (in category 'player commands') ----- > - turn: degrees > - "Turn by the given number of degrees." > - > - self heading: (self heading + degrees). > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>types (in category 'accessing') ----- > - types > - > - ^ types. > - ! > > Item was removed: > - ----- Method: KedamaTurtleVectorPlayer>>useKedamaFloatArray (in category 'private') ----- > - useKedamaFloatArray > - > - > - arrays withIndexDo: [:array :index | | newArray | > - (array isMemberOf: FloatArray) ifTrue: [ > - newArray := KedamaFloatArray new: array size. > - newArray replaceFrom: 1 to: array size with: array startingAt: 1. > - arrays at: index put: newArray. > - ]. > - ]. > - ! > > Item was removed: > - PackageInfo subclass: #MorphicGamesInfo > - instanceVariableNames: '' > - classVariableNames: '' > - poolDictionaries: '' > - category: 'Etoys-Squeakland-Morphic-Games'! > - > - !MorphicGamesInfo commentStamp: 'asm 7/5/2003 15:59' prior: 0! > - to create the package: > - > - in a 5325 image > - -file in SARBuilder > - > - SARPackageDumper fileOutPackageNamed: 'Morphic-Games' > - as: (FileDirectory default nextNameFor: 'Morphic-Games' extension: 'sar')! > > Item was removed: > - ----- Method: MorphicGamesInfo>>changesText (in category 'introspection') ----- > - changesText > - ^' > - version 6: included Rick McGeer''s Chess Castling Fix > - version 5: included Atomic (some changes were needed to make it work in 3.7) and some Babel stuff > - version 4: includes Andreas Raab''s rewrite of ChessConstants as declarative pool (update 5325) > - version 3: -added one change by the KCP team > - -Chess its playing again > - version 2: applied changes by the MCP team'! > > Item was removed: > - ----- Method: MorphicGamesInfo>>postscriptText (in category 'introspection') ----- > - postscriptText > - "Executed after load" > - ^ 'Utilities informUser: ''Generating Games thumbnails in PartsBin, please wait...'' during: [ > - PartsBin clearThumbnailCache. > - PartsBin cacheAllThumbnails. > - ]. > - "End ', self packageName, '"'! > > Item was removed: > - ----- Method: MorphicGamesInfo>>readmeText (in category 'introspection') ----- > - readmeText > - ^'Morphic-Games has the games that were in the image before 3.6: > - Chess, Chinese Checkers, Cipher, Crostic, FreeCell, Mines, Same and Tetris. > - plus Atomic'! > > Item was removed: > - ----- Method: Player class>>createTurtleSubclass (in category 'turtles') ----- > - createTurtleSubclass > - > - | instVarString classInstVarString aName aClass | > - instVarString := KedamaTurtleVectorPlayer instVarNames. > - classInstVarString := ''. > - aName := self chooseUniqueTurtleClassName. > - aClass := self subclass: aName instanceVariableNames: instVarString > - classVariableNames: '' poolDictionaries: '' category: self categoryForUniclasses. > - classInstVarString size > 0 ifTrue: > - [aClass class instanceVariableNames: classInstVarString]. > - aClass copyAllCategoriesUnobtrusivelyFrom: KedamaTurtleVectorPlayer. > - ^ aClass > - ! > > Item was removed: > - ----- Method: SugarLauncher>>badgeFlap (in category 'presence') ----- > - badgeFlap > - "This finds or creates a flap to hold badges" > - > - | translatedFlapName flapTab flap spacer holder | > - translatedFlapName := 'Buddies' translated. > - flapTab := Flaps globalFlapTab: translatedFlapName. > - flapTab ifNotNil: [^flapTab]. > - > - flap := AlignmentMorph newRow. > - flap clipSubmorphs: true. > - flap beTransparent. > - flap layoutInset: 0; cellInset: 0; borderWidth: 0. > - flap setProperty: #wantsHaloFromClick toValue: false. > - flap beFlap: true. > - > - spacer := Morph new beTransparent. "This provides space for tabs to be seen." > - spacer width: 20. > - spacer hResizing: #rigid; vResizing: #spaceFill. > - flap addMorphBack: spacer. > - > - holder := Morph new. > - holder name: 'Badges'. > - holder position: 0@100. > - holder layoutPolicy: TableLayout new. > - holder color: Color red muchLighter; > - wrapDirection: #topToBottom; > - hResizing: #spaceFill; > - vResizing: #spaceFill; > - cellInset: 10; > - layoutInset: 10. > - flap addMorphBack: holder. > - > - flap beSticky. > - spacer beSticky; lock: true. > - holder beSticky. > - > - flapTab := FlapTab new. > - flapTab referent: flap. > - flapTab setName: translatedFlapName edge: #left color: Color red muchLighter. > - flapTab referentMargin: 0@75. > - flapTab setToPopOutOnDragOver: true. > - Flaps addGlobalFlap: flapTab. > - ActiveWorld addGlobalFlaps. > - ScriptingSystem cleanUpFlapTabsOnLeft. > - > - ^flapTab! > > Item was removed: > - ----- Method: SugarLauncher>>badgeFor: (in category 'presence') ----- > - badgeFor: aBuddy > - ^self badgeHolder submorphs > - detect: [:m | > - (m isKindOf: NebraskaSenderMorph) and: [ > - (m valueOfProperty: #buddy) = aBuddy]] > - ifNone: [nil] > - ! > > Item was removed: > - ----- Method: SugarLauncher>>badgeHolder (in category 'presence') ----- > - badgeHolder > - "This finds or creates a flap to hold badges" > - > - ^self badgeFlap referent submorphNamed: 'Badges' > - ! > > Item was removed: > - ----- Method: SugarLauncher>>buddies (in category 'presence') ----- > - buddies > - sharedActivity ifNil: [^Dictionary new]. > - buddies ifNil: [self setupBuddies]. > - ^buddies! > > Item was removed: > - ----- Method: SugarLauncher>>buddiesLock (in category 'presence') ----- > - buddiesLock > - ^buddiesLock ifNil: [buddiesLock := Semaphore forMutualExclusion]! > > Item was removed: > - ----- Method: SugarLauncher>>createJournalEntryFor:filename:mimetype: (in category 'datastore') ----- > - createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString > - | properties id | > - properties := self propertiesFrom: aProject. > - properties at: 'ctime' put: (properties at: 'mtime'). > - properties at: 'mime_type' put: mimetypeString. > - properties removeKey: 'uid' ifAbsent: []. "would confuse Sugar 0.82" > - aFilename ifEmpty: [properties at: 'title:text' put: 'Etoys' translated]. > - id := self dataStore create: properties with: aFilename squeakToUtf8 with: true. > - ^id asString! > > Item was removed: > - ----- Method: SugarLauncher>>deleteBadges (in category 'presence') ----- > - deleteBadges > - | flapTab | > - flapTab := (Flaps globalFlapTab: 'Buddies' translated) ifNil: [^self]. > - Flaps removeFlapTab: flapTab keepInList: false. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>deleteUnused: (in category 'datastore') ----- > - deleteUnused: filePath > - "Delete file if filePath is indeed unused" > - > - World submorphs do: [:m | > - (m isSystemWindow and: [ > - (m model isKindOf: FileList) and: [ > - m model fullName = filePath]]) ifTrue: [ > - ^self deleteUnused: filePath whenDoneWith: m]]. > - > - [FileDirectory deleteFilePath: filePath] on: Error do: ["ignore"] > - ! > > Item was removed: > - ----- Method: SugarLauncher>>deleteUnused:whenDoneWith: (in category 'datastore') ----- > - deleteUnused: fileName whenDoneWith: anObject > - "Delete fileName when anObject is not in use anymore" > - > - ^anObject > - toFinalizeSend: #deleteUnused: > - to: self > - with: fileName! > > Item was removed: > - ----- Method: SugarLauncher>>enableSharedActivitySignals (in category 'presence') ----- > - enableSharedActivitySignals > - sharedActivity onBuddyJoinedSend: #buddyJoined: to: self. > - sharedActivity onBuddyLeftSend: #buddyLeft: to: self. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>findJournalEntries:properties: (in category 'datastore') ----- > - findJournalEntries: query properties: propNames > - "query is either a String or a dictionary, e.g. {'mime_type'->'application/x-squeak-project'}. Answers an array of properties. If propNames is not nil, only the named properties will be returned (which will be more efficient)" > - ^(self dataStore find: query with: (propNames ifNil: [#()])) first! > > Item was removed: > - ----- Method: SugarLauncher>>getFile: (in category 'datastore') ----- > - getFile: id > - "answer a temporary file, will be deleted if not used anymore" > - | utf8Name file | > - utf8Name := self dataStore getFilename: id. > - utf8Name isEmptyOrNil ifTrue: [^nil]. > - file := FileStream readOnlyFileNamed: utf8Name utf8ToSqueak. > - self deleteUnused: file name whenDoneWith: file. > - ^file! > > Item was removed: > - ----- Method: SugarLauncher>>getProperties: (in category 'datastore') ----- > - getProperties: objectId > - | props | > - props := self dataStore getProperties: objectId. > - "Make sure the props we care about are strings" > - props at: 'title' ifPresent: [:value | props at: 'title' put: value asString utf8ToSqueak composeAccents]. > - props at: 'mime_type' ifPresent: [:value | props at: 'mime_type' put: value asString]. > - props at: 'uid' put: objectId asString. > - ^props! > > Item was removed: > - ----- Method: SugarLauncher>>handleStream:mimetype:titled: (in category 'datastore') ----- > - handleStream: tmpStream mimetype: mimetypeOrNil titled: title > - "tmpStream was opened from journal or other media. > - For simplicity, we re-use the file drop logic." > - > - ActiveHand lastEvent position: World center. > - [ > - [(ExternalDropHandler lookupExternalDropHandler: tmpStream) > - handle: tmpStream in: World dropEvent: ActiveHand lastEvent] > - ifError: [self inform: ('Cannot open {1}' translated format: {title})] > - ] ensure: [tmpStream ifNotNil: [tmpStream close]].! > > Item was removed: > - ----- Method: SugarLauncher>>joinSharedActivity (in category 'presence') ----- > - joinSharedActivity > - "join a shared activity on startup" > - Utilities informUser: 'Looking for shared activity ...' translated > - during: [ > - [sharedActivity := self presence getActivityById: self activityId] > - ifError: [^sharedActivity := nil]]. > - > - Utilities informUser: 'Joining activity ...' translated > - during: [ > - [sharedActivity join] ifError: [^sharedActivity := nil] . > - self setupBuddies. > - self setupTubes. > - self enableSharedActivitySignals. > - SugarNavigatorBar current ifNotNilDo: [:bar | bar joinSharedActivity]. > - ]. > - > - ! > > Item was removed: > - ----- Method: SugarLauncher>>leaveSharedActivity (in category 'presence') ----- > - leaveSharedActivity > - sharedActivity ifNotNil: [ > - sharedActivity leaveAsync. > - sharedActivity := nil. > - self buddiesLock critical: [buddies := nil]. > - self deleteBadges]. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>makeJournalEntryFor:filename:mimetype: (in category 'datastore') ----- > - makeJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString > - "If this is a new project (no journal id yet), create a new Journal object, and remember the new id. > - Otherwise, if this is an auto-save, update the existing Journal entry. > - But if it is an explicit save, always create a new entry. Which entry we continue to work on depends on the sugarAutoSave preference. If enabled (before 4.1), the new entry is just a checkpoint, the project continues to use the old id/entry, and will be saved again on quit. If disabled (default since 4.1), we switch to the newly created id/entry." > - | id | > - (id := aProject sugarObjectId) > - ifNil: [ > - id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString. > - aProject sugarObjectId: id. > - self monitorJournalEntry: id] > - ifNotNil: [ > - (Preferences sugarAutoSave and: [aProject projectParameterAt: #sugarAutoSave ifAbsent: [true]]) > - ifTrue: [self updateJournalEntry: id for: aProject filename: aFilename mimetype: mimetypeString] > - ifFalse: [ > - id := self createJournalEntryFor: aProject filename: aFilename mimetype: mimetypeString. > - Preferences sugarAutoSave ifFalse: [ > - self unmonitorJournalEntry: aProject sugarObjectId. > - aProject sugarObjectId: id. > - self monitorJournalEntry: id]]]! > > Item was removed: > - ----- Method: SugarLauncher>>monitorJournalEntry: (in category 'datastore') ----- > - monitorJournalEntry: objectId > - self dataStore > - onUpdated: objectId > - send: #updatedJournalEntry: > - to: self.! > > Item was removed: > - ----- Method: SugarLauncher>>propertiesFrom: (in category 'datastore') ----- > - propertiesFrom: aProject > - | preview autoSave props markFavorite setActivity | > - preview := [ByteArray streamContents: [:s | PNGReadWriter > - putForm: (aProject thumbnail asFormOfDepth: 16) > - onStream: s]] ifError: ['']. > - autoSave := aProject projectParameterAt: #sugarAutoSave ifAbsent: [true]. > - setActivity := Preferences sugarAutoSave not | autoSave. > - markFavorite := Preferences sugarAutoSave & autoSave not. > - props := (aProject sugarProperties ifNil: [Dictionary new]) copy. > - { > - 'activity' -> self bundleId. > - 'activity_id' -> (setActivity ifTrue: [self activityId] ifFalse: ['']). > - 'title:text' -> (self titleFromProject: aProject) squeakToUtf8. > - 'title_set_by_user' -> (aProject currentVersionNumber>0 ifTrue: ['1'] ifFalse: ['0']). > - 'keep' -> (markFavorite ifTrue: ['1'] ifFalse: ['0']). > - 'mtime' -> (DateAndTime now asString first: 19). > - 'timestamp' -> (DateAndTime now asUnixTime). > - 'preview' -> preview. > - 'icon-color' -> self ownerBuddy colors. > - } do: [:each | props add: each]. > - ^props > - ! > > Item was removed: > - ----- Method: SugarLauncher>>resumeJournalEntry: (in category 'datastore') ----- > - resumeJournalEntry: id > - | props file title project mimetype | > - props := self getProperties: id. > - title := props at: 'title' ifAbsent: ['untitled' translated]. > - mimetype := props at: 'mime_type' ifAbsent: ['']. > - > - mimetype isEmpty ifTrue: [^self welcome: '']. > - > - mimetype = 'application/x-squeak-project' ifFalse: [ > - "reuse drop code" > - WorldState addDeferredUIMessage: [ > - self open: id title: title mimetype: mimetype]. > - ^Project enterNew]. > - > - 'Loading a Project...' displaySequentialProgress: [ > - Display fillWhite;forceToScreen. > - file := self getFile: id. > - "load project and close temp file (which will thus be deleted)" > - project := ProjectLoading > - loadName: ((title copyReplaceAll: '/' with: '\') contractTo: 64) > - stream: file > - fromDirectory: nil > - withProjectView: nil. > - file close. > - project keepSugarProperties: props monitor: true. > - project projectParameterAt: #sugarAutoSave put: true. > - project enter]. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>setupBuddies (in category 'presence') ----- > - setupBuddies > - self badgeFlap. > - self buddiesLock critical: [buddies := Dictionary new]. > - sharedActivity getJoinedBuddies do: [:each | > - self buddyJoined: each]. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>sharePublicly: (in category 'presence') ----- > - sharePublicly: aBoolean > - sharedActivity ifNotNil: [^self]. > - > - sharedActivity := self presence > - shareActivity: self activityId > - with: self bundleId > - with: (self titleFromProject: Project current) squeakToUtf8 > - with: Dictionary new. "due to bug 4660 we can't pass properties directly" > - sharedActivity setProperties: ({'private' -> aBoolean not} as: Dictionary). > - self setupBuddies. > - self enableSharedActivitySignals. > - self setupTubes. > - ! > > Item was removed: > - ----- Method: SugarLauncher>>showBadges (in category 'presence') ----- > - showBadges > - self badgeFlap openFully! > > Item was removed: > - ----- Method: SugarLauncher>>titleFromProject: (in category 'datastore') ----- > - titleFromProject: aProject > - ^(aProject name beginsWith: 'Unnamed' translated) > - ifTrue: ['Etoys Project' translated] > - ifFalse: [aProject name]! > > Item was removed: > - ----- Method: SugarLauncher>>unmonitorJournalEntry: (in category 'datastore') ----- > - unmonitorJournalEntry: objectId > - self dataStore > - onUpdated: objectId > - send: nil > - to: self.! > > Item was removed: > - ----- Method: SugarLauncher>>updateJournalEntry: (in category 'datastore') ----- > - updateJournalEntry: id > - ^self updateJournalEntry: id > - for: Project current > - filename: '' > - mimetype: ''! > > Item was removed: > - ----- Method: SugarLauncher>>updateJournalEntry:for:filename:mimetype: (in category 'datastore') ----- > - updateJournalEntry: id for: aProject filename: aFilename mimetype: mimetypeString > - "Move aProject saved to aFilename into the datastore, delete aFilename" > - | properties | > - properties := self propertiesFrom: aProject. > - properties at: 'mime_type' put: mimetypeString. > - self dataStore update: id with: properties with: aFilename squeakToUtf8 with: true.! > > Item was removed: > - ----- Method: Utilities class>>defaultRepositoryChangeLogOn: (in category '*Etoys-Squeakland-fetching updates') ----- > - defaultRepositoryChangeLogOn: aStream > - "Transcript clear. Utilities defaultRepositoryChangeLogOn: Transcript" > - | repo updates latest previous latestVersion previousVersion added removed latestPackages previousPackages prevDep prevInfo latestInfo | > - repo := MCRepositoryGroup default repositories detect: [:r | > - r description = MCMcmUpdater defaultUpdateURL]. > - updates := repo allFileNames select: [:each | 'update-*.mcm' match: each]. > - updates := updates asSortedCollection: > - [:a :b | a splitInteger second > b splitInteger second]. > - latest := repo versionFromFileNamed: updates first. > - previous := repo versionFromFileNamed: updates second. > - latestVersion := self versionNumberAndDateFromConfig: latest. > - previousVersion := self versionNumberAndDateFromConfig: previous. > - aStream nextPutAll: 'Changes from v'; print: previousVersion first; > - nextPutAll: ' of '; print: previousVersion second; > - nextPutAll: ' to v'; print: latestVersion first; > - nextPutAll: ' of '; print: latestVersion second; > - nextPutAll: ':'; cr. > - aStream flush. > - latestPackages := latest dependencies collect: [:dep | dep package]. > - previousPackages := previous dependencies collect: [:dep | dep package]. > - added := latestPackages difference: previousPackages. > - removed := previousPackages difference: latestPackages. > - added ifNotEmpty: [ > - aStream nextPutAll: 'Added packages:'. > - added do: [:each | aStream space; nextPutAll: each name]. > - aStream cr]. > - removed ifNotEmpty: [ > - aStream nextPutAll: 'Removed packages:'. > - removed do: [:each | aStream space; nextPutAll: each name]. > - aStream cr]. > - latest dependencies do: [:latestDep | > - prevDep := previous dependencies detect: [:p | latestDep package = p package] ifNone: []. > - (prevDep notNil and: [prevDep versionInfo ~= latestDep versionInfo]) > - ifTrue: [ > - aStream nextPutAll: '--------------------'; cr. > - prevInfo := prevDep package workingCopy ancestry findAncestor: prevDep versionInfo. > - latestInfo := latestDep package workingCopy ancestry findAncestor: latestDep versionInfo. > - (latestInfo allAncestorsOnPathTo: prevInfo) reverse, {latestInfo} > - do: [:ver | aStream nextPutAll: ver name; cr; nextPutAll: ver message; cr] > - separatedBy: [aStream cr]]]. > - aStream flush > - ! > > Item was removed: > - ----- Method: Utilities class>>updateFromDefaultRepository (in category '*Etoys-Squeakland-fetching updates') ----- > - updateFromDefaultRepository > - | config | > - "Flush all caches. If a previous download failed this is often helpful" > - MCFileBasedRepository flushAllCaches. > - config := MCMcmUpdater updateFromDefaultRepository. > - config ifNil: [^self inform: 'Repository unavailable' translated]. > - self setSystemVersionFromConfig: config. > - self inform: ('Update completed. > - System version is now: > - {1}' translated format: {SystemVersion current asString}). > - ! > |
Free forum by Nabble | Edit this page |