Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

History Tab in Exploriants, Tab Renaming, Space compression #141

Merged
merged 6 commits into from
Feb 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions packages/Sandblocks-Babylonian/SBCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,7 @@ Class {
SBCluster >> compressedMorphsForDisplay: aSBWatchView [

| displayedMorphs |
displayedMorphs := aSBWatchView watchValues collect: [:aWatchValue |
aWatchValue morphResizer: self morphResizer.
aWatchValue asValueMorph].
displayedMorphs := self gatherMorphsToCompressFrom: aSBWatchView.
^ (displayedMorphs size = 1)
ifTrue: [displayedMorphs first]
ifFalse: [self newCellMorph
Expand All @@ -24,6 +22,16 @@ SBCluster >> compressedMorphsForDisplay: aSBWatchView [
addAllMorphsBack: displayedMorphs]
]

{ #category : #visualisation }
SBCluster >> gatherMorphsToCompressFrom: aSBWatchView [

^ aSBWatchView isDisplayingWatchValues
ifTrue: [aSBWatchView watchValues collect: [:aWatchValue |
aWatchValue morphResizer: self morphResizer.
aWatchValue asValueMorph]]
ifFalse: [{self morphResizer applyOn: aSBWatchView selectedDisplay sbSnapshot }]
]

{ #category : #initialization }
SBCluster >> initialize [

Expand Down Expand Up @@ -177,7 +185,7 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo

self flag: #todo. "Another way besides turning into an image to keep interactions.-jb"
cell addMorph: (ImageMorph new
newForm: (aMorph iconOrThumbnailOfSize: targetExtent);
newForm: (aMorph imageForm scaledIntoFormOfSize: targetExtent);
when: #clicked send: #triggerEvent: to: aMorph with: #clicked).
cell on: #click send: #value to: [cell submorphs first triggerEvent: #clicked].
^ cell
Expand Down
1 change: 1 addition & 0 deletions packages/Sandblocks-Babylonian/SBDiffTabView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,7 @@ SBDiffTabView >> initialize [
super initialize.

isShowingDiff := false.
self hResizing: #spaceFill.
]

{ #category : #accessing }
Expand Down
4 changes: 2 additions & 2 deletions packages/Sandblocks-Babylonian/SBExampleCluster.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ SBExampleCluster >> displayedIndex: aNumber [
{ #category : #visualisation }
SBExampleCluster >> extractRowsFrom: aUniverse [

^ aUniverse watches collect: [:anExample | | display |
display := (anExample exampleToDisplay associations at: self displayedIndex) value display.
^ aUniverse watches collect: [:aWatch | | display |
display := (aWatch exampleToDisplay associations at: self displayedIndex) value display.
self compressedMorphsForDisplay: display]
]

Expand Down
16 changes: 4 additions & 12 deletions packages/Sandblocks-Babylonian/SBExampleGridsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ Class {
SBExampleGridsView >> buildAllPossibleResults [

self multiverse activeExamples
ifEmpty: [gridContainer addMorph: (SBOwnTextMorph new contents: 'No examples active')].
ifEmpty: [gridContainer addMorph: (TextMorph new contents: 'No examples active').
gridContainer width: gridContainer firstSubmorph width + 5 "a bit of margin"].

self multiverse activeExamples withIndexDo: [:anExample :anIndex | self buildExampleFor: anIndex]
]
Expand All @@ -24,10 +25,7 @@ SBExampleGridsView >> buildExampleFor: aNumber [
self currentClusterClass
newForSize: self selectedResizer
multiverse: self multiverse
displaying: aNumber}.
LineMorph from: 0@0 to: 0@50 color: Color black width: 2}).

self updateContainerWidth.
displaying: aNumber}})
]

{ #category : #accessing }
Expand All @@ -38,16 +36,10 @@ SBExampleGridsView >> currentClusterClass [
ifFalse: [SBExampleCluster]
]

{ #category : #updating }
SBExampleGridsView >> gridSize [

^ self multiverse activeExamples size
]

{ #category : #initialization }
SBExampleGridsView >> initialize [

super initialize.

self name: 'Example Grid View'.
self name: 'Example Focused'.
]
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ SBExampleValueDisplay >> display [
{ #category : #accessing }
SBExampleValueDisplay >> displayedWatchValueBlocks [

display isDisplayingWatchValues ifFalse: [^ {}].
^ display displayedMorphs
]

Expand Down Expand Up @@ -82,7 +83,7 @@ SBExampleValueDisplay >> initialize [
statusLabel := SBStringMorph new contents: ''.
self newChangeVizButton};
yourself);
addMorphBack: (display := SBExampleWatch watchViewClass saving: -1)
addMorphBack: (display := SBExampleWatch watchViewClass new)
]

{ #category : #accessing }
Expand Down
46 changes: 37 additions & 9 deletions packages/Sandblocks-Babylonian/SBExampleWatch.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -131,15 +131,34 @@ SBExampleWatch >> asInactiveCopy [
modifyExpression: self modifyExpression veryDeepCopy;
dimensionOptions: self dimensionOptions veryDeepCopy.

exampleToValues keys do: [:anExample | copy exampleStarting: anExample;
reportValues: (self valuesForExample: anExample) for: anExample;
exampleFinished: anExample ].
exampleToValues keys do: [:anExample |
copy exampleStarting: anExample;
reportValues: (self valuesForExample: anExample) for: anExample].

"Keep switched views consistent"
exampleToDisplay keys do: [:anExample |
(copy exampleToDisplay at: anExample) display
selectedDisplayIndex: (exampleToDisplay at: anExample) display selectedDisplayIndex].

exampleToValues keys do: [:anExample | copy exampleFinished: anExample].


^ copy
saveObjectsActivePermutations;
yourself
]

{ #category : #initialization }
SBExampleWatch >> buildDefaultDisplayFor: anExample [

| valueDisplay |
valueDisplay := SBExampleValueDisplay new.
valueDisplay display fallbackResizer: self selectedMorphResizer.
self addMorph: (exampleToDisplay at: anExample put: valueDisplay) atIndex: 2.
anExample when: #outOfWorld send: #exampleStopped: to: self with: anExample.
^ valueDisplay
]

{ #category : #accessing }
SBExampleWatch >> cleanedExpression [

Expand Down Expand Up @@ -169,6 +188,14 @@ SBExampleWatch >> color [
^ self parentSandblock color
]

{ #category : #copying }
SBExampleWatch >> copySelectedDisplayIndicesFrom: other [

other exampleToDisplay associationsDo: [:exampleToDisplayAss |
(exampleToDisplay at: exampleToDisplayAss key ifAbsentPut: [self buildDefaultDisplayFor: exampleToDisplayAss key])
display selectedDisplayIndex: exampleToDisplayAss value display selectedDisplayIndex]
]

{ #category : #'insert/delete' }
SBExampleWatch >> deleteCommandFor: aBlock [

Expand Down Expand Up @@ -220,12 +247,7 @@ SBExampleWatch >> exampleStarting: anExample [

exampleToValues at: anExample put: OrderedCollection new.

(exampleToDisplay at: anExample ifAbsentPut: [ | valueDisplay |
valueDisplay := SBExampleValueDisplay new.
valueDisplay display fallbackResizer: self selectedMorphResizer.
self addMorph: (exampleToDisplay at: anExample put: valueDisplay) atIndex: 2.
anExample when: #outOfWorld send: #exampleStopped: to: self with: anExample.
valueDisplay])
(exampleToDisplay at: anExample ifAbsentPut: [self buildDefaultDisplayFor: anExample])
exampleStarting: anExample;
name: anExample label
]
Expand All @@ -250,6 +272,12 @@ SBExampleWatch >> exampleToDisplay: anExampleToDisplayDict [
exampleToDisplay := anExampleToDisplayDict
]

{ #category : #accessing }
SBExampleWatch >> exampleToValues [

^ exampleToValues
]

{ #category : #accessing }
SBExampleWatch >> exampleToValues: anExampleToCollectionOfWatchValuesDict [

Expand Down
21 changes: 17 additions & 4 deletions packages/Sandblocks-Babylonian/SBExploriantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ SBExploriantsView class >> block: aSBBlock named: aString [
{ #category : #'instance creation' }
SBExploriantsView class >> getTabsInMultiverse: aSBMultiverse [

^ {SBPermutationGridsView. SBExampleGridsView. SBPlainResultsView. SBLiveView. SBVariantsView}
^ {SBPermutationGridsView. SBExampleGridsView. SBLiveView. SBPlainResultsView. SBVariantsView. SBHistoryView}
collect: [:mySubclass | mySubclass newMultiverse: aSBMultiverse]
]

Expand Down Expand Up @@ -60,9 +60,9 @@ SBExploriantsView >> containerRow [
cellPositioning: #topLeft;
changeTableLayout;
listDirection: #leftToRight;
layoutInset: 8;
cellGap: 3;
cellInset: 3;
layoutInset: 2;
cellGap: 1;
cellInset: 2;
borderWidth: 0
]

Expand Down Expand Up @@ -115,6 +115,12 @@ SBExploriantsView >> resolveButton [
cornerStyle: #squared
]

{ #category : #copying }
SBExploriantsView >> snapshot [

^ ImageMorph new newForm: self block imageForm
]

{ #category : #building }
SBExploriantsView >> updateButton [

Expand All @@ -132,3 +138,10 @@ SBExploriantsView >> visualize [

self buildButtonRow
]

{ #category : #copying }
SBExploriantsView >> wantsHistory [

"If returning true, will be automatically collected for an epoche in the history view"
^ true
]
2 changes: 1 addition & 1 deletion packages/Sandblocks-Babylonian/SBGrid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Class {
{ #category : #constants }
SBGrid class >> cellInsetValue [

^ 2
^ 0
]

{ #category : #'initialize-release' }
Expand Down
30 changes: 15 additions & 15 deletions packages/Sandblocks-Babylonian/SBGridResultsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,15 @@ SBGridResultsView >> clean [
]

{ #category : #updating }
SBGridResultsView >> gridSize [

self subclassResponsibility
SBGridResultsView >> concludeContainerWidth [

| widthTillWrap |
widthTillWrap := self multiverse sandblockEditor width * 0.95.
gridContainer fullBounds width < widthTillWrap ifTrue: [^ self].

gridContainer hResizing: #rigid; wrapDirection: #topToBottom.
gridContainer width: widthTillWrap.
gridContainer hResizing: #shrinkWrap.
]

{ #category : #initialization }
Expand All @@ -37,22 +43,16 @@ SBGridResultsView >> newGridContainer [
changeTableLayout;
color: Color white;
listDirection: #leftToRight;
wrapDirection: #topToBottom;
wrapCentering: #topLeft;
hResizing: #rigid;
width: 50;
cellInset: 0;
vResizing: #shrinkWrap;
hResizing: #shrinkWrap;
yourself
]

{ #category : #updating }
SBGridResultsView >> updateContainerWidth [

gridContainer width:
(self gridSize safeSquareRoot ceiling + 1)
* (gridContainer lastSubmorph fullBounds width
+ (2 * gridContainer cellInset)
+ (2 * gridContainer cellGap)
+ 10)
{ #category : #actions }
SBGridResultsView >> visualize [

super visualize.
self concludeContainerWidth
]
Loading
Loading