diff --git a/packages/Sandblocks-Babylonian/Object.extension.st b/packages/Sandblocks-Babylonian/Object.extension.st index 6fa8ddae..a72a1043 100644 --- a/packages/Sandblocks-Babylonian/Object.extension.st +++ b/packages/Sandblocks-Babylonian/Object.extension.st @@ -63,7 +63,6 @@ Object >> sbWatchValueMorphFor: aSBWatchValue sized: aSBMorphResizer [ "Objects can choose if they want to apply a changed extent" ^ (SBWatchValue newContainerMorphFor: aSBWatchValue) - "addMorphBack: (SBIcon iconFor: aSBWatchValue watchedValueIdentityHash) asMorph;" addMorphBack: self asMorph; yourself ] diff --git a/packages/Sandblocks-Babylonian/SBCluster.class.st b/packages/Sandblocks-Babylonian/SBCluster.class.st index 9e7505a2..f71746d7 100644 --- a/packages/Sandblocks-Babylonian/SBCluster.class.st +++ b/packages/Sandblocks-Babylonian/SBCluster.class.st @@ -145,7 +145,7 @@ SBCluster >> visualize [ self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph" self newContainerMorph listDirection: #leftToRight; - cellInset: 5@(-30); + cellInset: 3@3; addAllMorphsBack: { self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph" SBGrid newDisplaying: diff --git a/packages/Sandblocks-Babylonian/SBCorrelationView.class.st b/packages/Sandblocks-Babylonian/SBCorrelationView.class.st index b0862722..47937be3 100644 --- a/packages/Sandblocks-Babylonian/SBCorrelationView.class.st +++ b/packages/Sandblocks-Babylonian/SBCorrelationView.class.st @@ -93,7 +93,7 @@ SBCorrelationView >> buildVariantSelection [ displayPrefixOnly ] -{ #category : #'as yet unclassified' } +{ #category : #accessing } SBCorrelationView >> buttons [ ^ super buttons, {self buildSelectionOptions} @@ -130,7 +130,7 @@ SBCorrelationView >> ensureVariantSelectionIn: aMorph [ aMorph addMorph: variantSelection. selectedVariants - ifNil: [selectedVariants := {} asOrderedCollection] + ifNil: [selectedVariants := {variantSelection object} asOrderedCollection] ifNotNil: [selectedVariants := selectedVariants select: [:aVariant | self multiverse variants includes: aVariant]]. ] diff --git a/packages/Sandblocks-Babylonian/SBDiffTabView.class.st b/packages/Sandblocks-Babylonian/SBDiffTabView.class.st index 7b49db85..3f05cf69 100644 --- a/packages/Sandblocks-Babylonian/SBDiffTabView.class.st +++ b/packages/Sandblocks-Babylonian/SBDiffTabView.class.st @@ -86,6 +86,7 @@ SBDiffTabView >> initialize [ super initialize. + wantsTabCountChanges := true. isShowingDiff := false. self hResizing: #spaceFill. ] diff --git a/packages/Sandblocks-Babylonian/SBExample.class.st b/packages/Sandblocks-Babylonian/SBExample.class.st index b5ec7f49..c6112b76 100644 --- a/packages/Sandblocks-Babylonian/SBExample.class.st +++ b/packages/Sandblocks-Babylonian/SBExample.class.st @@ -393,7 +393,11 @@ SBExample >> run [ self scheduleLastError: nil. currentProcess := nil. processRunning := false. - Project current addDeferredUIMessage: [self sendFinishNotification]] forkAt: Processor userBackgroundPriority. + Project current addDeferredUIMessage: [ + returnValue reportValues: {returned asSBWatchValue} sized: SBMorphResizer newThumbmail. + returnValue updateDisplay. + self sendFinishNotification] + ] forkAt: Processor userBackgroundPriority. ^ currentProcess ] @@ -415,7 +419,8 @@ SBExample >> runSetup [ errorDecorator ifNotNil: #detach. errorDecorator := nil. - traceSize := 0 + traceSize := 0. + returnValue clear. ] { #category : #execution } @@ -444,13 +449,14 @@ SBExample >> self: aBlock args: aCollectionBlock label: aString [ removeAllMorphs; addMorphBack: (icon := SBIcon iconPause small; - color: (Color r: 1 g: 1 b: 1); + color: (Color white); on: #click send: #toggleRunning to: self); addMorphBack: (nameInput := SBTextBubble new contents: aString); addMorphBack: (SBStringMorph new contents: 'self:'); addMorphBack: aBlock; addMorphBack: (SBStringMorph new contents: 'args:'); addMorphBack: aCollectionBlock; + addMorphBack: (returnValue := SBExampleWatchView new); updateIcon ] @@ -517,6 +523,7 @@ SBExample >> stopRunning [ self stopSteppingSelector: #run. active := false. + returnValue clear. self updateIcon. self sandblockEditor allMorphsDo: [:morph | (morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]] diff --git a/packages/Sandblocks-Babylonian/SBExampleValueDisplay.class.st b/packages/Sandblocks-Babylonian/SBExampleValueDisplay.class.st index f1633313..3d82a123 100644 --- a/packages/Sandblocks-Babylonian/SBExampleValueDisplay.class.st +++ b/packages/Sandblocks-Babylonian/SBExampleValueDisplay.class.st @@ -79,7 +79,7 @@ SBExampleValueDisplay >> initialize [ cellGap: 2; layoutInset: 2@3; addAllMorphsBack: { - label := SBStringMorph new visible: false. + label := SBStringMorph new. statusLabel := SBStringMorph new contents: ''. self newChangeVizButton}; yourself); @@ -136,7 +136,7 @@ SBExampleValueDisplay >> reportValues: aCollectionOfWatchValues name: aString si display reportValues: aCollectionOfWatchValues sized: aSBMorphResizer. label contents: aString. - label visible: false. + label visible: aString notEmpty. hadValue := true ] diff --git a/packages/Sandblocks-Babylonian/SBExampleWatch.class.st b/packages/Sandblocks-Babylonian/SBExampleWatch.class.st index 63378fbb..3b717343 100644 --- a/packages/Sandblocks-Babylonian/SBExampleWatch.class.st +++ b/packages/Sandblocks-Babylonian/SBExampleWatch.class.st @@ -369,6 +369,7 @@ SBExampleWatch >> initialize [ hResizing: #spaceFill; listCentering: #bottomRight; addMorphBack: dimensionOptions; + addMorphBack: modifyExpression yourself}; yourself ] @@ -447,7 +448,8 @@ SBExampleWatch >> modifyExpression [ SBExampleWatch >> modifyExpression: aBlock [ modifyExpression ifNotNil: #delete. - modifyExpression := aBlock + modifyExpression := aBlock. + self addMorphBack: modifyExpression. ] { #category : #accessing } @@ -464,7 +466,7 @@ SBExampleWatch >> outOfWorld: aWorld [ self class unregisterWatch: self ] -{ #category : #'as yet unclassified' } +{ #category : #testing } SBExampleWatch >> preventOcclusion [ ^ false diff --git a/packages/Sandblocks-Babylonian/SBExploriants.class.st b/packages/Sandblocks-Babylonian/SBExploriants.class.st index 1597397c..0a9674c7 100644 --- a/packages/Sandblocks-Babylonian/SBExploriants.class.st +++ b/packages/Sandblocks-Babylonian/SBExploriants.class.st @@ -56,15 +56,8 @@ SBExploriants >> artefactSaved: aMethodBlock [ SBExploriants >> asTabButton: aNamedBlock [ | button | - button := SBButton new - label: aNamedBlock nameToDisplay do: [self setActive: aNamedBlock]; - cornerStyle: #squared; - hResizing: #spaceFill; - changeTableLayout; - makeSmall; - listDirection: #leftToRight. - - aNamedBlock = self active ifTrue: [button makeBold]. + button := super asTabButton: aNamedBlock. + button when: #doubleClicked send: #value to: []. ^ button ] @@ -85,20 +78,15 @@ SBExploriants >> binding: aString for: block class: aClass ifPresent: aBlock [ ] { #category : #ui } -SBExploriants >> buildTabs [ +SBExploriants >> buildView [ - self addMorphBack: (SBRow new - addAllMorphsBack: (self namedBlocks collect: [:block | self asTabButton: block]); - name: #tabs; - changeTableLayout; - listDirection: #leftToRight; - hResizing: #shrinkWrap) + self addMorphBack: (self activeBlock hResizing: #shrinkWrap) ] -{ #category : #ui } -SBExploriants >> buildView [ +{ #category : #accessing } +SBExploriants >> buttonClass [ - self addMorphBack: (self activeBlock hResizing: #shrinkWrap) + ^ SBButton ] { #category : #testing } @@ -195,12 +183,6 @@ SBExploriants >> selector [ ^ nil ] -{ #category : #accessing } -SBExploriants >> tabs [ - - ^ (self submorphNamed: #tabs) submorphs -] - { #category : #actions } SBExploriants >> tryToUpdateInBackgroundAfterChangeIn: aMethodBlock [ diff --git a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st index 8469b814..ae03051e 100644 --- a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st +++ b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st @@ -85,12 +85,6 @@ SBInactiveExampleWatch >> originalIdentifier: aNumber [ SBInactiveExampleWatch >> saveObjectsActivePermutations [ "Force morphs to persist their permutation even when on the UI process" - "exampleToValues associationsDo: [:anExampleValuesPair | - anExampleValuesPair value do: [:aWatchValue | - aWatchValue watchedValue allMorphsDo: [:aSubMorph | - SBExploriants objectToPermutation - at: aSubMorph - put: SBActiveVariantPermutation value]]]." exampleToDisplay associationsDo: [:anExampleDisplayPair | anExampleDisplayPair value displayedWatchValueBlocks do: [:aValueMorph | aValueMorph lastSubmorph allMorphsDo: [:aSubMorph | diff --git a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st index 539f93ed..877f59f5 100644 --- a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st +++ b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st @@ -10,12 +10,6 @@ SBInactiveExampleWatch >> listensToExamples [ SBInactiveExampleWatch >> saveObjectsActivePermutations [ "Force morphs to persist their permutation even when on the UI process" - "exampleToValues associationsDo: [:anExampleValuesPair | - anExampleValuesPair value do: [:aWatchValue | - aWatchValue watchedValue allMorphsDo: [:aSubMorph | - SBExploriants objectToPermutation - at: aSubMorph - put: SBActiveVariantPermutation value]]]." exampleToDisplay associationsDo: [:anExampleDisplayPair | anExampleDisplayPair value displayedWatchValueBlocks do: [:aValueMorph | aValueMorph lastSubmorph allMorphsDo: [:aSubMorph | diff --git a/packages/Sandblocks-Babylonian/SBLiveView.class.st b/packages/Sandblocks-Babylonian/SBLiveView.class.st index 69265b13..1fdf3dd0 100644 --- a/packages/Sandblocks-Babylonian/SBLiveView.class.st +++ b/packages/Sandblocks-Babylonian/SBLiveView.class.st @@ -14,8 +14,7 @@ Class { { #category : #building } SBLiveView >> buildAllPossibleResults [ - self multiverse watches ifEmpty: [^ self]. - self multiverse universes do: [:aUniverse | self buildPreviewFor: aUniverse] + self multiverse universes do: [:aUniverse | self buildPreviewFor: aUniverse activePermutation] ] { #category : #building } @@ -32,19 +31,37 @@ SBLiveView >> buildBrodcaster [ ] { #category : #building } -SBLiveView >> buildPreviewFor: aUniverse [ +SBLiveView >> buildPreviewFor: aPermutation [ | preview | - preview := self newRegisteredListenerFor: aUniverse. + preview := self newRegisteredListenerFor: aPermutation. gridContainer addMorphBack: (self containerRow cellPositioning: #center; addAllMorphsBack: { self containerRow listDirection: #topToBottom; addAllMorphsBack: { - (SBPermutationLabel newDisplaying: aUniverse activePermutation) wrapFlag: false. - self newPermutationButtonRowFor: aUniverse showing: preview. + (SBPermutationLabel newDisplaying: aPermutation) wrapFlag: false. + self newPermutationButtonRowFor: aPermutation showing: preview. preview}}). ] +{ #category : #building } +SBLiveView >> buildSetUpRow [ + + self block addMorphBack: (SBRow new + changeTableLayout; + hResizing: #spaceFill; + wrapCentering: #center; + listCentering: #center; + cellPositioning: #center; + name: #setup; + cellGap: 8 * self scalingFactor; + addMorphBack: (SBIcon iconSpinner + balloonText: 'Toggle stepping'; + on: #click send: #toggleStepping to: self); + addMorphBack: (SBStringMorph new contents: 'Setup:'); + addMorphBack: ([Morph new] asSandblock width: 200)) +] + { #category : #building } SBLiveView >> buttons [ @@ -77,6 +94,7 @@ SBLiveView >> initialize [ super initialize. self name: 'Playground'. + self buildSetUpRow. ] @@ -98,30 +116,28 @@ SBLiveView >> listeners [ ] { #category : #building } -SBLiveView >> newPermutationButtonRowFor: aUniverse showing: aPreview [ +SBLiveView >> newPermutationButtonRowFor: aPermutation showing: aPreview [ ^ self containerRow layoutInset: 0; cellInset: 0; addAllMorphsBack: { - SBButton newApplyPermutationFor: aUniverse activePermutation. - self rebuildButtonIn: aPreview applying: aUniverse. + self rebuildButtonIn: aPreview applying: aPermutation. self synchronizeButtonIn: aPreview} ] { #category : #initialization } -SBLiveView >> newRegisteredListenerFor: aUniverse [ +SBLiveView >> newRegisteredListenerFor: aPermutation [ - | listener value container watch | - self flag: #todo. "for multiple watch values" - watch := aUniverse watches first. - value := watch exampleToValues values first first watchedValue. - listener := value veryDeepCopy asMorph. + | listener container | + SBActiveVariantPermutation value: aPermutation. + listener := self evaluateSetUp. container := broadcaster addListener: listener. listener allMorphsDo: [:aSubMorph | - SBExploriants objectToPermutation at: aSubMorph put: watch createdWithPermutation]. + SBExploriants objectToPermutation at: aSubMorph put: aPermutation]. + SBActiveVariantPermutation value: nil. ^ container ] @@ -209,6 +225,7 @@ SBLiveView >> snapshot [ ^ self containerRow listDirection: #topToBottom; addAllMorphsBack: { + ImageMorph new newForm: (self block submorphNamed: 'setup') imageForm. ImageMorph new newForm: gridContainer imageForm} ] @@ -246,14 +263,13 @@ SBLiveView >> toggleStepping [ { #category : #actions } SBLiveView >> visualize [ - ^ self. - "self clean. + self clean. self buildBrodcaster. self buildButtonRow. self block addMorphBack: gridContainer. self buildAllPossibleResults. - self listeners ifNotEmpty: [broadcaster extent: self listeners last extent. ]. - self concludeContainerWidth. " + broadcaster extent: self listeners last extent. + self concludeContainerWidth. ] diff --git a/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st b/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st index 614ac664..d22ff1b5 100644 --- a/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st +++ b/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st @@ -14,7 +14,6 @@ SBPlainResultsView >> buildAllPossibleResults [ SBPlainResultsView >> buildPermutationFor: aSBUniverse [ self block addAllMorphsBack: {(SBPermutationLabel newDisplaying: aSBUniverse activePermutation) wrapFlag: false. - SBButton newApplyPermutationFor: aSBUniverse activePermutation. (self containerRow listDirection: #leftToRight) addAllMorphsBack: aSBUniverse watches. LineMorph from: 0@0 to: 50@0 color: Color black width: 2} diff --git a/packages/Sandblocks-Core/SBTabView.class.st b/packages/Sandblocks-Core/SBTabView.class.st index 3b09f847..01d450ea 100644 --- a/packages/Sandblocks-Core/SBTabView.class.st +++ b/packages/Sandblocks-Core/SBTabView.class.st @@ -3,7 +3,8 @@ Class { #superclass : #SBBlock, #instVars : [ 'namedBlocks', - 'activeIndex' + 'activeIndex', + 'wantsTabCountChanges' ], #category : #'Sandblocks-Core' } @@ -153,15 +154,16 @@ SBTabView >> allMorphsDepthFirstDo: aBlock [ SBTabView >> asTabButton: aNamedBlock [ | button | - button := SBEditableButton new + button := self buttonClass new label: aNamedBlock nameToDisplay do: [self setActive: aNamedBlock]; cornerStyle: #squared; makeSmall; hResizing: #spaceFill; changeTableLayout; - listDirection: #leftToRight; - addMorphBack: (self deleteButtonFor: aNamedBlock). - + listDirection: #leftToRight. + + self wantsTabCountChanges ifTrue: [button addMorphBack: (self deleteButtonFor: aNamedBlock)]. + aNamedBlock = self active ifTrue: [button makeBold]. button when: #contentsChanged send: #updateNameFor:on: to: self withArguments: {aNamedBlock. button}. button when: #doubleClicked send: #triggerEvent: to: self with: #doubleClicked. @@ -186,13 +188,15 @@ SBTabView >> blockAt: anIndex [ { #category : #ui } SBTabView >> buildTabs [ - self addMorphBack: (SBRow new + | tabs | + tabs := SBRow new addAllMorphsBack: (self namedBlocks collect: [:block | self asTabButton: block]); name: #tabs; - addMorphBack: self addButton; changeTableLayout; listDirection: #leftToRight; - hResizing: #shrinkWrap) + hResizing: #shrinkWrap. + self wantsTabCountChanges ifTrue: [tabs addMorphBack: self addButton]. + self addMorphBack: tabs. ] { #category : #ui } @@ -201,6 +205,12 @@ SBTabView >> buildView [ self addMorphBack: (self activeBlock hResizing: #spaceFill) ] +{ #category : #accessing } +SBTabView >> buttonClass [ + + ^ SBEditableButton +] + { #category : #ui } SBTabView >> deleteButtonFor: aNamedBlock [ @@ -225,6 +235,7 @@ SBTabView >> initialize [ namedBlocks := {SBNamedBlock new} asOrderedCollection. activeIndex := 1. + wantsTabCountChanges := false. self changeTableLayout; @@ -450,7 +461,9 @@ SBTabView >> tabCount [ { #category : #accessing } SBTabView >> tabs [ - ^ (self submorphNamed: #tabs) submorphs allButLast + ^ self wantsTabCountChanges + ifTrue: [(self submorphNamed: #tabs) submorphs allButLast] + ifFalse: [(self submorphNamed: #tabs) submorphs] ] { #category : #ui } @@ -488,3 +501,15 @@ SBTabView >> view [ ^ self lastSubmorph ] + +{ #category : #accessing } +SBTabView >> wantsTabCountChanges [ + + ^ wantsTabCountChanges +] + +{ #category : #accessing } +SBTabView >> wantsTabCountChanges: aBoolean [ + + wantsTabCountChanges := aBoolean +] diff --git a/packages/Sandblocks-Morphs/SBButton.class.st b/packages/Sandblocks-Morphs/SBButton.class.st index e484cb83..41d7403d 100644 --- a/packages/Sandblocks-Morphs/SBButton.class.st +++ b/packages/Sandblocks-Morphs/SBButton.class.st @@ -10,17 +10,6 @@ Class { #category : #'Sandblocks-Morphs' } -{ #category : #'instance creation' } -SBButton class >> newApplyPermutationFor: aPermutation [ - - ^ self new - icon: (SBIcon iconArrowDown size: 8.0 sbScaled) - label: 'Apply' - do: [aPermutation apply]; - makeSmall; - cornerStyle: #squared -] - { #category : #accessing } SBButton >> active [ diff --git a/packages/Sandblocks-Smalltalk/SBStASTNode.class.st b/packages/Sandblocks-Smalltalk/SBStASTNode.class.st index 50a73b3d..14e1c846 100644 --- a/packages/Sandblocks-Smalltalk/SBStASTNode.class.st +++ b/packages/Sandblocks-Smalltalk/SBStASTNode.class.st @@ -164,6 +164,7 @@ SBStASTNode >> grammarHandler [ { #category : #accessing } SBStASTNode >> guessClassExpensive [ + self flag: #fixme. "new sandbox interface, tobe" ^ self guessedClass ifNil: [ self valueOfProperty: #guessedClassExpensive ifAbsentPut: [ nil]]