Skip to content

Commit

Permalink
An epoche is now a tab view
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Feb 19, 2024
1 parent 4e5c0d8 commit 2ee71e6
Show file tree
Hide file tree
Showing 11 changed files with 57 additions and 78 deletions.
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
6 changes: 0 additions & 6 deletions packages/Sandblocks-Babylonian/SBExampleGridsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@ SBExampleGridsView >> currentClusterClass [
ifFalse: [SBExampleCluster]
]

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

^ self multiverse activeExamples size
]

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

Expand Down
10 changes: 8 additions & 2 deletions packages/Sandblocks-Babylonian/SBExploriantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -118,8 +118,7 @@ SBExploriantsView >> resolveButton [
{ #category : #copying }
SBExploriantsView >> snapshot [

"Return a collection of morphs which capture the current state of this view"
^ self subclassResponsibility
^ ImageMorph new newForm: self block imageForm
]

{ #category : #building }
Expand All @@ -139,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
]
36 changes: 2 additions & 34 deletions packages/Sandblocks-Babylonian/SBGridResultsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -23,41 +23,9 @@ SBGridResultsView >> concludeContainerWidth [
widthTillWrap := self multiverse sandblockEditor width * 0.9.
gridContainer fullBounds width < widthTillWrap ifTrue: [^ self].

self descentToScreenRatioMaxWidth: widthTillWrap.

gridContainer hResizing: #shrinkWrap.
]

{ #category : #updating }
SBGridResultsView >> descentToScreenRatioMaxWidth: maxWidth [

| editorRatio submorphIndex |
gridContainer hResizing: #rigid; wrapDirection: #topToBottom.
editorRatio := DisplayScreen boundingBox width / DisplayScreen boundingBox height.
submorphIndex := gridContainer submorphs size.

[gridContainer fullBounds width / gridContainer height > editorRatio
and: [submorphIndex > 1]]
whileTrue: [ | isBelowMax |
isBelowMax := gridContainer width < maxWidth.
gridContainer width: gridContainer width
- (gridContainer submorphs atWrap: submorphIndex) width.

(editorRatio > 1
and: [gridContainer fullBounds height >= gridContainer width]
and: [isBelowMax])
ifTrue: [ gridContainer width: gridContainer width
+(gridContainer submorphs atWrap: submorphIndex) width.
submorphIndex := -1]
ifFalse: [submorphIndex := submorphIndex - 1]].

gridContainer width > maxWidth ifTrue: [gridContainer width: maxWidth]
]

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

self subclassResponsibility
gridContainer width: widthTillWrap.
gridContainer hResizing: #shrinkWrap.
]

{ #category : #initialization }
Expand Down
46 changes: 31 additions & 15 deletions packages/Sandblocks-Babylonian/SBHistoryView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,35 @@ SBHistoryView >> buildEpoche [
^ row
cellGap: 0@10;
listDirection: #topToBottom;
addMorphBack: (self containerRow
cellGap: 5@0;
addMorphBack: (self deleteEpocheButton: row);
addMorphBack: TimeStamp current asMorph);
addMorphBack: (self containerRow
layoutInset: 0;
cellGap: 0;
cellInset: 0;
addAllMorphsBack: self collectSnapshots)
addAllMorphsBack: {self buildMetaUsageIn: row. self buildSnapshotTabView}


]

{ #category : #building }
SBHistoryView >> buildMetaUsageIn: aRow [

^ self containerRow
cellGap: 5@0;
addAllMorphsBack: {self deleteEpocheButton: aRow.
TextMorph new contents: (Text fromString: TimeStamp current asStringOrText) allBold}


]

{ #category : #building }
SBHistoryView >> buildSnapshotTabView [

^ SBTabView
namedBlocks: (SBExploriants uniqueInstance namedBlocks
select: #wantsHistory
thenCollect: [:aTab | SBNamedBlock block: aTab snapshot named: aTab name])
activeIndex: (SBExploriants uniqueInstance active wantsHistory
ifTrue: [SBExploriants uniqueInstance activeIndex]
ifFalse: [1])

]

{ #category : #building }
SBHistoryView >> buttons [

Expand Down Expand Up @@ -83,14 +99,14 @@ SBHistoryView >> maxEpoches [
^ 100
]

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

^ {}
]

{ #category : #actions }
SBHistoryView >> visualize [

self addEpoche
]

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

^ false
]
14 changes: 6 additions & 8 deletions packages/Sandblocks-Babylonian/SBLiveView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -87,12 +87,6 @@ SBLiveView >> evaluateSetUp [
^ return
]

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

^ self multiverse universes size + 1
]

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

Expand Down Expand Up @@ -205,8 +199,12 @@ SBLiveView >> setUpMorph [

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

^ {ImageMorph new newForm: gridContainer imageForm}

^ self containerRow
listDirection: #topToBottom;
addAllMorphsBack: {
ImageMorph new newForm: (self block submorphNamed: 'setup') imageForm.
ImageMorph new newForm: gridContainer imageForm}
]

{ #category : #building }
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,6 @@ SBPermutationGridsView >> currentClusterClass [
ifFalse: [SBPermutationCluster]
]

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

^ self multiverse universes size
]

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

Expand Down
6 changes: 3 additions & 3 deletions packages/Sandblocks-Babylonian/SBPlainResultsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ SBPlainResultsView >> initialize [
]

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

^ {}
SBPlainResultsView >> wantsHistory [
^ false
]
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ SBSwitchableResultsView >> selectedResizer [
{ #category : #'as yet unclassified' }
SBSwitchableResultsView >> snapshot [

^ {ImageMorph new newForm: gridContainer imageForm}
^ ImageMorph new newForm: gridContainer imageForm

]

Expand Down
2 changes: 1 addition & 1 deletion packages/Sandblocks-Babylonian/SBVariantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ SBVariantsView >> initialize [
{ #category : #copying }
SBVariantsView >> snapshot [

^ {ImageMorph new newForm: contents imageForm}
^ ImageMorph new newForm: contents imageForm
]

{ #category : #actions }
Expand Down
6 changes: 4 additions & 2 deletions packages/Sandblocks-Core/SBTabView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ SBTabView >> initialize [
self
changeTableLayout;
listDirection: #topToBottom;
hResizing: #spaceFill;
hResizing: #shrinkWrap;
vResizing: #shrinkWrap.
]

Expand Down Expand Up @@ -395,7 +395,9 @@ SBTabView >> removeCurrentTab [
{ #category : #tabs }
SBTabView >> setActive: aNamedBlock [

(self containingArtefact hasUnsavedChanges and: [self containingArtefact isMethod])
self containingArtefact isMethod ifFalse: [self basicSetActive: aNamedBlock. ^ self].

self containingArtefact hasUnsavedChanges
ifTrue: [self basicSetActive: aNamedBlock]
ifFalse: ["changing tabs is latest change"
self basicSetActive: aNamedBlock.
Expand Down

0 comments on commit 2ee71e6

Please sign in to comment.