Skip to content

Commit

Permalink
adds save and change tab button to history view
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeAtHPI committed Feb 19, 2024
1 parent 2ee71e6 commit dc43e9c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 11 deletions.
53 changes: 42 additions & 11 deletions packages/Sandblocks-Babylonian/SBHistoryView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ SBHistoryView >> buildMetaUsageIn: aRow [
^ self containerRow
cellGap: 5@0;
addAllMorphsBack: {self deleteEpocheButton: aRow.
TextMorph new contents: (Text fromString: TimeStamp current asStringOrText) allBold}
TextMorph new contents: (Text fromString: TimeStamp current asStringOrText) allBold.
SBLabel new contents: 'Notes'}


]
Expand All @@ -40,9 +41,8 @@ SBHistoryView >> buildMetaUsageIn: aRow [
SBHistoryView >> buildSnapshotTabView [

^ SBTabView
namedBlocks: (SBExploriants uniqueInstance namedBlocks
select: #wantsHistory
thenCollect: [:aTab | SBNamedBlock block: aTab snapshot named: aTab name])
namedBlocks: (self tabsToSnapshot
collect: [:aTab | SBNamedBlock block: aTab snapshot named: aTab name])
activeIndex: (SBExploriants uniqueInstance active wantsHistory
ifTrue: [SBExploriants uniqueInstance activeIndex]
ifFalse: [1])
Expand All @@ -52,23 +52,27 @@ SBHistoryView >> buildSnapshotTabView [
{ #category : #building }
SBHistoryView >> buttons [

^ super buttons, {self clearButton}
^ super buttons, {self clearButton. self changeTabsButton. self saveButton }
]

{ #category : #building }
SBHistoryView >> clearButton [
SBHistoryView >> changeTabsButton [

^ SBButton new
icon: SBIcon iconClockO
label: 'Clear History'
do: [self clean. self block addMorphBack: self buildButtonRow];
icon: SBIcon iconTable
label: 'Change All Tabs To'
do: [self offerChangeTabMenu];
cornerStyle: #squared
]

{ #category : #building }
SBHistoryView >> collectSnapshots [
SBHistoryView >> clearButton [

^ (SBExploriants uniqueInstance namedBlocks collect: [:aView | aView snapshot]) flatten
^ SBButton new
icon: SBIcon iconClockO
label: 'Clear History'
do: [self clean. self block addMorphBack: self buildButtonRow];
cornerStyle: #squared
]

{ #category : #building }
Expand Down Expand Up @@ -99,6 +103,33 @@ SBHistoryView >> maxEpoches [
^ 100
]

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

| index options |
options := self tabsToSnapshot collect: #name.
index := UIManager default chooseFrom: options.
index = 0 ifTrue: [^ self].

self block submorphs allButFirst do: [:anEpoche | anEpoche lastSubmorph activeIndex: index].
]

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

^ SBButton new
icon: SBIcon iconSave
label: 'Save As PNG'
do: [self block exportAsPNG];
cornerStyle: #squared
]

{ #category : #accessing }
SBHistoryView >> tabsToSnapshot [

^ SBExploriants uniqueInstance namedBlocks select: #wantsHistory
]

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

Expand Down
6 changes: 6 additions & 0 deletions packages/Sandblocks-Babylonian/SBVariantsView.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -56,3 +56,9 @@ SBVariantsView >> visualize [
ifNotEmptyDo: [:theMethods | theMethods do: [:aSBStMethod | self buildMethodSectionFor: aSBStMethod]]
ifEmpty: [self buildNoVariantsText]
]

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

^ false
]

0 comments on commit dc43e9c

Please sign in to comment.