diff --git a/packages/Sandblocks-Babylonian/Object.extension.st b/packages/Sandblocks-Babylonian/Object.extension.st index 52a49113..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 a454e812..f71746d7 100644 --- a/packages/Sandblocks-Babylonian/SBCluster.class.st +++ b/packages/Sandblocks-Babylonian/SBCluster.class.st @@ -42,7 +42,8 @@ SBCluster >> initialize [ changeTableLayout; listDirection: #topToBottom; vResizing: #shrinkWrap; - hResizing: #shrinkWrap + hResizing: #shrinkWrap; + cellInset: 0@2 ] { #category : #accessing } @@ -113,8 +114,7 @@ SBCluster >> newTopRowFrom: aCollectionOfMorphs [ cellPositioning: #topCenter; hResizing: #spaceFill; addAllMorphsBack: (aCollectionOfMorphs collect: [:aMorph | - aMorph rotationDegrees: 90. - (self wrapInCell: aMorph owner flexVertically: true flexHorizontally: false) borderWidth: 0]) + self morphResizer applyOn: aMorph]) ] { #category : #visualisation } @@ -138,16 +138,19 @@ SBCluster >> visualize [ (matrix rowCount < 2 or: [matrix columnCount < 2]) ifTrue:[self visualizeNothingToDisplay. ^ self]. - self addAllMorphsBack: { - self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph" + self addMorphBack: ( self newContainerMorph - listDirection: #leftToRight; - cellInset: 0; - addAllMorphsBack: { - self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph" - SBGrid newDisplaying: - ((matrix atRows: 2 to: matrix rowCount columns: 2 to: matrix columnCount) - collect: [:aMorph | self wrapInCell: aMorph])}} + cellInset: 0@0; + addAllMorphsBack: { + self newTopRowFrom: (matrix atRow: 1) allButFirst. "ignore placeholder morph" + self newContainerMorph + listDirection: #leftToRight; + cellInset: 3@3; + addAllMorphsBack: { + self newLeftColumnFrom: (matrix atColumn: 1) allButFirst. "ignore placeholder morph" + SBGrid newDisplaying: + ((matrix atRows: 2 to: matrix rowCount columns: 2 to: matrix columnCount) + collect: [:aMorph | self wrapInCell: aMorph])}}) ] { #category : #visualisation } @@ -171,6 +174,7 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo | cell targetExtent| cell := self newCellMorph. + cell on: #click send: #value to: [aMorph triggerEvent: #clicked]. aVBoolean ifTrue: [cell vResizing: #shrinkWrap]. aHBoolean ifTrue: [cell hResizing: #shrinkWrap]. @@ -189,6 +193,6 @@ SBCluster >> wrapInCell: aMorph flexVertically: aVBoolean flexHorizontally: aHBo cell addMorph: (ImageMorph new 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 ] diff --git a/packages/Sandblocks-Babylonian/SBCorrelationCluster.class.st b/packages/Sandblocks-Babylonian/SBCorrelationCluster.class.st index 43033d83..6e247006 100644 --- a/packages/Sandblocks-Babylonian/SBCorrelationCluster.class.st +++ b/packages/Sandblocks-Babylonian/SBCorrelationCluster.class.st @@ -120,6 +120,19 @@ SBCorrelationCluster >> extractedTopHeadingsFrom: aCollectionOfCorrelatingUniver referingTo: aCorrelatingUniverse] ] +{ #category : #visualisation } +SBCorrelationCluster >> newLeftColumnFrom: aCollectionOfMorphs [ + + "Height should be set, but width can vary" + ^ self newContainerMorph + cellPositioning: #rightCenter; + addAllMorphsBack: (aCollectionOfMorphs collect: [:aMorph | + aMorph wrapFlag: false. + (self wrapInCell: aMorph flexVertically: false flexHorizontally: true) + listDirection: #rightToLeft; + borderWidth: 0]) +] + { #category : #visualisation } SBCorrelationCluster >> newTopRowFrom: aCollectionOfPermutationLabels [ @@ -127,14 +140,17 @@ SBCorrelationCluster >> newTopRowFrom: aCollectionOfPermutationLabels [ ^ self newContainerMorph listDirection: #leftToRight; listCentering: #bottomRight; - cellPositioning: #topCenter; + cellPositioning: #bottomCenter; hResizing: #spaceFill; addAllMorphsBack: (aCollectionOfPermutationLabels collect: [:aLabel | - self newContainerMorph - addAllMorphsBack: { - (self - wrapInCell: aLabel - flexVertically: true - flexHorizontally: false) borderWidth: 0. - SBButton newApplyPermutationFor: (aLabel universe activePermutation).}]) + self morphResizer applyOn: aLabel]) +] + +{ #category : #helper } +SBCorrelationCluster >> wrapInCell: aMorph [ + + ^ self morphResizer label = SBMorphResizer newIdentity label + ifTrue: [self wrapInCell: aMorph flexVertically: true flexHorizontally: true] + ifFalse: [self wrapInCell: aMorph flexVertically: true flexHorizontally: false] + ] diff --git a/packages/Sandblocks-Babylonian/SBCorrelationView.class.st b/packages/Sandblocks-Babylonian/SBCorrelationView.class.st index ee2666aa..47937be3 100644 --- a/packages/Sandblocks-Babylonian/SBCorrelationView.class.st +++ b/packages/Sandblocks-Babylonian/SBCorrelationView.class.st @@ -13,10 +13,6 @@ Class { { #category : #building } SBCorrelationView >> buildAllPossibleResults [ - self multiverse activeExamples - ifEmpty: [gridContainer addMorph: (TextMorph new contents: 'No examples active'). - gridContainer width: gridContainer firstSubmorph width + 5 "a bit of margin"]. - groupedUniverses := self groupUniversesContainingAllVariantsIn: selectedVariants. basePermutations := self collectAllPermutationsOfSelectedVariants asOrderedCollection. @@ -33,9 +29,13 @@ SBCorrelationView >> buildForExample: anExample watching: aWatch [ self containerRow listDirection: #topToBottom; addAllMorphsBack: { SBOwnTextMorph new contents: ( - '{1}, {2}' format: {anExample label. - (aWatch cleanedExpression sourceString)}). - self buildGridsFor: anExample watching: aWatch} flatten}) + '{1}{2}' format: {"anExample label" ''. + (aWatch cleanedExpression sourceString withoutLineEndings)}). + self containerRow + listDirection: #topToBottom; + cellPositioning: #rightCenter; + cellInset: 0@10; + addAllMorphsBack: ((self buildGridsFor: anExample watching: aWatch) flatten)}}) ] { #category : #building } @@ -58,17 +58,22 @@ SBCorrelationView >> buildGridsFor: anExample watching: aWatch [ ] { #category : #building } -SBCorrelationView >> buildSelectionRow [ +SBCorrelationView >> buildSelectionOptions [ | container selectedString | - container := self containerRow. + container := Morph new + color: Color transparent; + changeTableLayout; + vResizing: #shrinkWrap; + hResizing: #shrinkWrap; + listDirection: #leftToRight. self ensureVariantSelectionIn: container. - selectedString := 'Selected: '. + selectedString := ''. selectedVariants ifEmpty: [ selectedString := selectedString, 'None' ] ifNotEmpty: [ selectedString := selectedString, ((selectedVariants collect: #name) fold: [:a :b | a, ', ', Character cr, b ])]. - container addMorphBack: selectedString asMorph. - self block addMorph: container. + container addMorphBack: selectedString withoutLineEndings asMorph. + ^ container ] @@ -80,7 +85,7 @@ SBCorrelationView >> buildVariantSelection [ topLevelVariant := options detect: [:aVariant | aVariant parentVariant isNil] ifNone: [options first]. ^ SBComboBox new - prefix: 'Add or Remove'; + prefix: 'Configure Y Axis'; labels: (options collect: #name); values: options; object: topLevelVariant; @@ -90,8 +95,8 @@ SBCorrelationView >> buildVariantSelection [ { #category : #accessing } SBCorrelationView >> buttons [ - - ^ {} + + ^ super buttons, {self buildSelectionOptions} ] { #category : #building } @@ -117,19 +122,6 @@ SBCorrelationView >> collectAllPermutationsOfSelectedVariants [ ^ allPermutations ] -{ #category : #building } -SBCorrelationView >> ensureVariantSelection [ - - self multiverse variants ifEmpty: [selectedVariants := OrderedCollection new. ^ self]. - variantSelection := self buildVariantSelection. - self block addMorph: variantSelection. - - selectedVariants - ifNil: [selectedVariants := {variantSelection object} asOrderedCollection] - ifNotNil: [selectedVariants := selectedVariants select: [:aVariant | self multiverse variants includes: aVariant]]. - -] - { #category : #building } SBCorrelationView >> ensureVariantSelectionIn: aMorph [ @@ -187,20 +179,6 @@ SBCorrelationView >> initialize [ ] -{ #category : #actions } -SBCorrelationView >> visualize [ - - self clean. - - self buildSelectionRow. - self block addMorph: dimensionOptions. - - self buildButtonRow. - - self buildAllPossibleResults . - self concludeContainerWidth. -] - { #category : #accessing } SBCorrelationView >> wantsReloadOnSaveWhenOpen [ diff --git a/packages/Sandblocks-Babylonian/SBCustomView.class.st b/packages/Sandblocks-Babylonian/SBCustomView.class.st index 13ec7048..c88ed7f2 100644 --- a/packages/Sandblocks-Babylonian/SBCustomView.class.st +++ b/packages/Sandblocks-Babylonian/SBCustomView.class.st @@ -20,13 +20,19 @@ SBCustomView >> buildViewOptions [ options := self viewClasses collect: [:aClass | aClass new hasBeenRenamed: true]. ^ SBComboBox new - prefix: 'Current View: '; + prefix: 'Current Grid View: '; labels: (options collect: #name); values: options ; - object: options first; + object: options third; when: #selectionChanged send: #switchView to: self ] +{ #category : #accessing } +SBCustomView >> buttons [ + + ^ {viewOptions}, super buttons +] + { #category : #initialization } SBCustomView >> initialize [ @@ -36,8 +42,6 @@ SBCustomView >> initialize [ self name: 'Results'. self buildButtonRow. - - self block addMorphBack: viewOptions. self block addMorphBack: self selectedView ] diff --git a/packages/Sandblocks-Babylonian/SBDiffTabView.class.st b/packages/Sandblocks-Babylonian/SBDiffTabView.class.st index 2a968edf..3f05cf69 100644 --- a/packages/Sandblocks-Babylonian/SBDiffTabView.class.st +++ b/packages/Sandblocks-Babylonian/SBDiffTabView.class.st @@ -7,22 +7,6 @@ Class { #category : #'Sandblocks-Babylonian' } -{ #category : #nil } -SBDiffTabView >> addButton [ - - ^ SBButton new - icon: (SBIcon iconPlus - size: 7.0 sbScaled; - color: (Color green)) - do: [self addTab]; - makeSmall; - cornerStyle: #squared; - vResizing: #spaceFill; - balloonText: 'Add'; - cellGap: -1.0 sbScaled; - layoutInset: (4.0 @ 4.0) sbScaled -] - { #category : #callbacks } SBDiffTabView >> artefactSaved: aMethodBlock [ @@ -72,14 +56,12 @@ SBDiffTabView >> buildView [ SBDiffTabView >> diffButton [ ^ SBButton new - icon: (SBIcon iconCodeFork size: 12.0) + icon: (SBIcon iconCodeFork size: 10) do: [self toggleDiffView]; makeSmall; balloonText: 'Toggle diff to others'; vResizing: #spaceFill; - cornerStyle: #squared; - cellGap: -1.0 sbScaled; - layoutInset: (4.0 @ 3.0) + cornerStyle: #squared ] { #category : #diffing } @@ -104,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 706cf44e..c6112b76 100644 --- a/packages/Sandblocks-Babylonian/SBExample.class.st +++ b/packages/Sandblocks-Babylonian/SBExample.class.st @@ -320,12 +320,9 @@ SBExample >> lastError: anError [ anError ifNotNil: [ true ifTrue: [ - "ToolSet debugException: anError" ^ reportedError := self sandblockEditor reportError: anError - process: ((Process forContext: anError signal copyStack priority: Processor activeProcess priority) - shouldResumeFromDebugger: false; - yourself) + process: currentProcess source: self]. errorIndicator ifNil: [ @@ -386,8 +383,7 @@ SBExample >> run [ self sendStartNotification. processRunning := true. - currentProcess := [ - | returned | + currentProcess := [ | returned | SBExecutionEnvironment value: self. [returned := self evaluate] on: Error do: [:e | @@ -401,8 +397,8 @@ SBExample >> run [ returnValue reportValues: {returned asSBWatchValue} sized: SBMorphResizer newThumbmail. returnValue updateDisplay. self sendFinishNotification] - ] forkAt: Processor userBackgroundPriority. - + ] forkAt: Processor userBackgroundPriority. + ^ currentProcess ] @@ -453,7 +449,7 @@ SBExample >> self: aBlock args: aCollectionBlock label: aString [ removeAllMorphs; addMorphBack: (icon := SBIcon iconPause small; - color: Color white; + color: (Color white); on: #click send: #toggleRunning to: self); addMorphBack: (nameInput := SBTextBubble new contents: aString); addMorphBack: (SBStringMorph new contents: 'self:'); @@ -530,8 +526,7 @@ SBExample >> stopRunning [ returnValue clear. self updateIcon. - self sandblockEditor allMorphsDo: [:morph | - (morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]] + self sandblockEditor allMorphsDo: [:morph | (morph isSandblock and: [morph listensToExamples]) ifTrue: [morph exampleStopped: self]] ] { #category : #actions } diff --git a/packages/Sandblocks-Babylonian/SBExampleCluster.class.st b/packages/Sandblocks-Babylonian/SBExampleCluster.class.st index 16d268e3..c0520503 100644 --- a/packages/Sandblocks-Babylonian/SBExampleCluster.class.st +++ b/packages/Sandblocks-Babylonian/SBExampleCluster.class.st @@ -95,21 +95,5 @@ SBExampleCluster >> newTopRowFrom: aCollectionOfPermutationLabels [ cellPositioning: #topCenter; hResizing: #spaceFill; addAllMorphsBack: (aCollectionOfPermutationLabels collect: [:aLabel | - | wrappedLabel button | - aLabel rotationDegrees: 90. - wrappedLabel := (self wrapInCell: aLabel owner - flexVertically: true - flexHorizontally: false) borderWidth: 0. - "Rotating morphs somehow clips their right border, so dirty hack so container gets clipped 1px" - button := self newContainerMorph - cellInset: 1; - addMorphBack: (SBButton newApplyPermutationFor: aLabel permutation); - rotationDegrees: 90. - button owner width > wrappedLabel width ifTrue: [button firstSubmorph makeTiny]. - - self newContainerMorph - cellPositioning: #bottomToTop; - cellPositioning: #topCenter; - cellInset: 0@2; - addAllMorphsBack: {button owner. wrappedLabel}]) + self morphResizer applyOn: aLabel]) ] diff --git a/packages/Sandblocks-Babylonian/SBExampleWatch.class.st b/packages/Sandblocks-Babylonian/SBExampleWatch.class.st index b7a29069..7856135e 100644 --- a/packages/Sandblocks-Babylonian/SBExampleWatch.class.st +++ b/packages/Sandblocks-Babylonian/SBExampleWatch.class.st @@ -10,7 +10,8 @@ Class { 'dimensionOptions', 'modifyExpression', 'exampleToDisplay', - 'exampleToValues' + 'exampleToValues', + 'ignoreReports' ], #classVars : [ 'Registry' @@ -79,9 +80,9 @@ SBExampleWatch class >> report: aValue for: aSymbol modifying: aBlock [ | watchers example | example := SBExecutionEnvironment value ifNil: [^ aValue]. - watchers := self registry select: [:watcher | watcher notNil and: [watcher identifier = aSymbol] + and: [watcher ignoreReports not] and: [watcher isActive]]. watchers do: [:watcher | watcher reportValue: aValue asSBWatchValue for: example]. @@ -130,7 +131,8 @@ SBExampleWatch >> asInactiveCopy [ originalIdentifier: self identifier; expression: (SBTextBubble new contents: self cleanedExpression sourceString); modifyExpression: self modifyExpression veryDeepCopy; - dimensionOptions: self dimensionOptions veryDeepCopy. + dimensionOptions: self dimensionOptions veryDeepCopy; + createdWithPermutation: SBActiveVariantPermutation value. exampleToValues keys do: [:anExample | copy exampleStarting: anExample; @@ -141,8 +143,7 @@ SBExampleWatch >> asInactiveCopy [ (copy exampleToDisplay at: anExample) display selectedDisplayIndex: (exampleToDisplay at: anExample) display selectedDisplayIndex]. - exampleToValues keys do: [:anExample | copy exampleFinished: anExample]. - + exampleToValues keys do: [:anExample | copy exampleFinished: anExample]. ^ copy saveObjectsActivePermutations; @@ -247,6 +248,7 @@ SBExampleWatch >> exampleFinished: anExample [ SBExampleWatch >> exampleStarting: anExample [ exampleToValues at: anExample put: OrderedCollection new. + self ignoreReports: false. (exampleToDisplay at: anExample ifAbsentPut: [self buildDefaultDisplayFor: anExample]) exampleStarting: anExample; @@ -324,6 +326,18 @@ SBExampleWatch >> identifier: aSymbol [ self world ifNotNil: [self class registerWatch: self] ] +{ #category : #accessing } +SBExampleWatch >> ignoreReports [ + + ^ ignoreReports +] + +{ #category : #accessing } +SBExampleWatch >> ignoreReports: aBoolean [ + + ignoreReports := aBoolean +] + { #category : #initialization } SBExampleWatch >> initialize [ @@ -334,8 +348,9 @@ SBExampleWatch >> initialize [ exampleToDisplay := IdentityDictionary new. exampleToValues := IdentityDictionary new. watchedExpression := SBStMessageSend new. + ignoreReports := false. dimensionOptions := SBComboBox new - prefix: 'Preview sizes: '; + prefix: 'Preview size: '; labels: (options collect: #label); values: options; object: options third; @@ -355,12 +370,7 @@ SBExampleWatch >> initialize [ listCentering: #bottomRight; addMorphBack: dimensionOptions; yourself. - SBVariant - named: 'modifyExpression' - associations: {'with' -> [modifyExpression]. 'without' -> []} - activeIndex: 2 - id: '90d7c718-89b8-7e48-8262-467d07d56880' - isActive: false}; + modifyExpression}; yourself ] @@ -456,6 +466,12 @@ SBExampleWatch >> outOfWorld: aWorld [ self class unregisterWatch: self ] +{ #category : #testing } +SBExampleWatch >> preventOcclusion [ + + ^ false +] + { #category : #printing } SBExampleWatch >> printOn: aStream [ diff --git a/packages/Sandblocks-Babylonian/SBExploriants.class.st b/packages/Sandblocks-Babylonian/SBExploriants.class.st index 34e0a475..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 } @@ -136,6 +124,8 @@ SBExploriants >> initialize [ objectToPermutation := WeakKeyDictionary new. updateProcessRunning := false. + ignoreUpdate := false. + namedBlocks := {SBExploriantsView new} asOrderedCollection. self attachDecorator: SBMoveDecorator new; @@ -143,18 +133,43 @@ SBExploriants >> initialize [ vResizing: #shrinkWrap ] +{ #category : #initialization } +SBExploriants >> intoWorld: aWorld [ + + super intoWorld: aWorld. + SystemChangeNotifier uniqueInstance + noMoreNotificationsFor: self; + notify: self ofSystemChangesOfItem: #method using: #methodChanged: +] + { #category : #testing } SBExploriants >> isArtefact [ ^ true ] +{ #category : #initialization } +SBExploriants >> methodChanged: anEvent [ + + anEvent isModified + ifTrue: [ + namedBlocks detect: #isHistory + ifFound: [:history | history addCodeSnapshot: anEvent]] +] + { #category : #accessing } SBExploriants >> objectToPermutation [ ^ objectToPermutation ] +{ #category : #initialization } +SBExploriants >> outOfWorld: aWorld [ + + SystemChangeNotifier uniqueInstance noMoreNotificationsFor: self. + super outOfWorld: aWorld +] + { #category : #'artefact protocol' } SBExploriants >> saveTryFixing: aFixBoolean quick: aQuickBoolean [ @@ -168,12 +183,6 @@ SBExploriants >> selector [ ^ nil ] -{ #category : #accessing } -SBExploriants >> tabs [ - - ^ (self submorphNamed: #tabs) submorphs -] - { #category : #actions } SBExploriants >> tryToUpdateInBackgroundAfterChangeIn: aMethodBlock [ @@ -205,7 +214,7 @@ SBExploriants >> updateInBackgroundOnTimeoutRevertTo: theOldMultiverse [ newMultiverse := SBMultiverse bigbangInEditorWithoutKaboom: self sandblockEditor. self namedBlocks do: [:aTab | aTab multiverse: newMultiverse]. [newMultiverse kaboom] - valueWithin: 7 seconds + valueWithin: 20 seconds onTimeout: [newMultiverse cleanUp. self namedBlocks do: [:aTab | aTab multiverse: theOldMultiverse]]. updateProcess := nil. updateProcessRunning := false. @@ -214,9 +223,10 @@ SBExploriants >> updateInBackgroundOnTimeoutRevertTo: theOldMultiverse [ { #category : #actions } SBExploriants >> visualize [ - - | tabs | + + |tabs| self width: 0. + ignoreUpdate := false. "tabs will visualize as soon as multiverse is finished" tabs := SBExploriantsView getTabsInMultiverse: (SBMultiverse bigbangInEditor: self sandblockEditor). diff --git a/packages/Sandblocks-Babylonian/SBExploriantsView.class.st b/packages/Sandblocks-Babylonian/SBExploriantsView.class.st index 403ae16c..39160a95 100644 --- a/packages/Sandblocks-Babylonian/SBExploriantsView.class.st +++ b/packages/Sandblocks-Babylonian/SBExploriantsView.class.st @@ -86,13 +86,19 @@ SBExploriantsView >> initialize [ changeTableLayout; color: Color white; listDirection: #topToBottom; - layoutInset: 3; - cellGap: 4; + layoutInset: 1; + cellGap: 2; cellInset: 2; hResizing: #shrinkWrap; vResizing: #shrinkWrap). ] +{ #category : #accessing } +SBExploriantsView >> isHistory [ + + ^ false +] + { #category : #accessing } SBExploriantsView >> isOverview [ diff --git a/packages/Sandblocks-Babylonian/SBGrid.class.st b/packages/Sandblocks-Babylonian/SBGrid.class.st index 9ae5f41e..b64dacc0 100644 --- a/packages/Sandblocks-Babylonian/SBGrid.class.st +++ b/packages/Sandblocks-Babylonian/SBGrid.class.st @@ -51,5 +51,5 @@ SBGrid >> initialize [ { #category : #visualisation } SBGrid >> updateWidthToPersistColumns [ - self width: (columnCount * (self submorphs first width + (2 * self cellInset))) + self width: (columnCount * (self submorphs first width + (2 * self cellInset))) ] diff --git a/packages/Sandblocks-Babylonian/SBHistoryView.class.st b/packages/Sandblocks-Babylonian/SBHistoryView.class.st index 3bc0216b..e0252565 100644 --- a/packages/Sandblocks-Babylonian/SBHistoryView.class.st +++ b/packages/Sandblocks-Babylonian/SBHistoryView.class.st @@ -1,15 +1,48 @@ Class { #name : #SBHistoryView, #superclass : #SBExploriantsView, + #instVars : [ + 'scrollPane' + ], #category : #'Sandblocks-Babylonian' } +{ #category : #building } +SBHistoryView >> addCodeSnapshot: aChange [ + + self ensureStackSize. + + self scroller addMorphFront: (self buildCodeSnapshot: aChange) +] + { #category : #building } SBHistoryView >> addEpoche [ - self submorphs size - 1 "buttonRow" > self maxEpoches ifTrue: [self lastSubmorph delete]. + self ensureStackSize. + + self scroller addMorphFront: self buildEpoche +] + +{ #category : #building } +SBHistoryView >> buildCodeSnapshot: aChange [ + + | row lastVersion | + row := self containerRow. + + lastVersion := (VersionsBrowser new + scanVersionsOf: aChange item class: aChange item methodClass meta: false + category: aChange item methodReference category selector: aChange item selector) changeList at: 2 ifAbsent: [nil]. + + ^ row + cellGap: 0@10; + listDirection: #topToBottom; + addAllMorphsBack: { + self buildMetaUsageIn: row. + (lastVersion ifNotNil: [ + (TextDiffBuilder buildDisplayPatchFrom: lastVersion text to: aChange item getSource inClass: aChange item methodClass prettyDiffs: false)] ifNil: [aChange item getSource]) asMorph + } + - self block addMorph: self buildEpoche atIndex: 2 ] { #category : #building } @@ -37,6 +70,28 @@ SBHistoryView >> buildMetaUsageIn: aRow [ ] +{ #category : #building } +SBHistoryView >> buildScrollPane [ + + | scrollPane | + scrollPane := ScrollPane new + color: Color transparent; + borderWidth: 0; + hResizing: #spaceFill; + scrollBarThickness: 7 sbScaled; + showHScrollBarOnlyWhenNeeded; + showVScrollBarOnlyWhenNeeded; + height: 600 sbScaled. + scrollPane scroller + changeTableLayout; + listDirection: #topToBottom; + cellPositioning: #topLeft; + layoutInset: 1; + cellGap: 2; + cellInset: 2. + ^ scrollPane +] + { #category : #building } SBHistoryView >> buildSnapshotTabView [ @@ -63,13 +118,19 @@ SBHistoryView >> changeTabsButton [ cornerStyle: #squared ] +{ #category : #actions } +SBHistoryView >> clean [ + + self scroller submorphs copy do: #delete +] + { #category : #building } SBHistoryView >> clearButton [ ^ SBButton new icon: SBIcon iconClockO label: 'Clear History' - do: [self clean. self block addMorphBack: self buildButtonRow]; + do: [self clean]; cornerStyle: #squared ] @@ -86,6 +147,12 @@ SBHistoryView >> deleteEpocheButton: theRow [ ] +{ #category : #building } +SBHistoryView >> ensureStackSize [ + + self scroller submorphs size > self maxEpoches ifTrue: [self scroller lastSubmorph delete]. +] + { #category : #initialization } SBHistoryView >> initialize [ @@ -93,6 +160,14 @@ SBHistoryView >> initialize [ self name: 'History'. self buildButtonRow. + scrollPane := self buildScrollPane. + self block addMorphBack: scrollPane. +] + +{ #category : #accessing } +SBHistoryView >> isHistory [ + + ^ true ] { #category : #accessing } @@ -109,7 +184,8 @@ SBHistoryView >> offerChangeTabMenu [ index := UIManager default chooseFrom: options. index = 0 ifTrue: [^ self]. - self block submorphs allButFirst do: [:anEpoche | anEpoche lastSubmorph activeIndex: index]. + self scroller submorphs do: [:anEpoche | + (anEpoche lastSubmorph isKindOf: SBTabView) ifTrue: [anEpoche lastSubmorph activeIndex: index]]. ] { #category : #building } @@ -118,10 +194,16 @@ SBHistoryView >> saveButton [ ^ SBButton new icon: SBIcon iconSave label: 'Save As PNG' - do: [self block exportAsPNG]; + do: [self scroller exportAsPNG]; cornerStyle: #squared ] +{ #category : #accessing } +SBHistoryView >> scroller [ + + ^ scrollPane scroller +] + { #category : #accessing } SBHistoryView >> tabsToSnapshot [ diff --git a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st index 8199e643..ae03051e 100644 --- a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st +++ b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.class.st @@ -5,7 +5,8 @@ Class { #name : #SBInactiveExampleWatch, #superclass : #SBExampleWatch, #instVars : [ - 'originalIdentifier' + 'originalIdentifier', + 'createdWithPermutation' ], #category : #'Sandblocks-Babylonian' } @@ -31,6 +32,18 @@ SBInactiveExampleWatch >> artefactSaved: aBlock [ ifTrue: [self applyModifyExpressionOnValues. self saveObjectsActivePermutations.] ] +{ #category : #accessing } +SBInactiveExampleWatch >> createdWithPermutation [ + + ^ createdWithPermutation +] + +{ #category : #accessing } +SBInactiveExampleWatch >> createdWithPermutation: aPermutation [ + + createdWithPermutation := aPermutation +] + { #category : #'event handling' } SBInactiveExampleWatch >> doubleClick: evt [ @@ -77,5 +90,5 @@ SBInactiveExampleWatch >> saveObjectsActivePermutations [ aValueMorph lastSubmorph allMorphsDo: [:aSubMorph | SBExploriants objectToPermutation at: aSubMorph - put: SBActiveVariantPermutation value]]]. + put: self createdWithPermutation]]]. ] diff --git a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st index 0b86b4f6..877f59f5 100644 --- a/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st +++ b/packages/Sandblocks-Babylonian/SBInactiveExampleWatch.extension.st @@ -15,5 +15,5 @@ SBInactiveExampleWatch >> saveObjectsActivePermutations [ aValueMorph lastSubmorph allMorphsDo: [:aSubMorph | SBExploriants objectToPermutation at: aSubMorph - put: SBActiveVariantPermutation value]]]. + put: self createdWithPermutation]]]. ] diff --git a/packages/Sandblocks-Babylonian/SBInputBroadcaster.class.st b/packages/Sandblocks-Babylonian/SBInputBroadcaster.class.st index bc3f3c5a..da5890e2 100644 --- a/packages/Sandblocks-Babylonian/SBInputBroadcaster.class.st +++ b/packages/Sandblocks-Babylonian/SBInputBroadcaster.class.st @@ -53,6 +53,7 @@ SBInputBroadcaster >> eventProcessMouse: aMouse goingTo: aPosition in: aMorph [ { #category : #events } SBInputBroadcaster >> filterEvent: anEvent for: aMorph [ + self listeners withIndexDo: [:aListener :i | | localTarget newEvent delta | localTarget := self translatedPositionOf: anEvent from: aMorph to: aListener. diff --git a/packages/Sandblocks-Babylonian/SBLiveView.class.st b/packages/Sandblocks-Babylonian/SBLiveView.class.st index 111fd12e..cfcc491a 100644 --- a/packages/Sandblocks-Babylonian/SBLiveView.class.st +++ b/packages/Sandblocks-Babylonian/SBLiveView.class.st @@ -39,13 +39,13 @@ SBLiveView >> buildPreviewFor: aPermutation [ addAllMorphsBack: { self containerRow listDirection: #topToBottom; addAllMorphsBack: { - SBPermutationLabel newDisplaying: aPermutation. + (SBPermutationLabel newDisplaying: aPermutation) wrapFlag: false. self newPermutationButtonRowFor: aPermutation showing: preview. preview}}). ] { #category : #building } -SBLiveView >> buildSetUpRow [ +SBLiveView >> buildSetUpRow [ self block addMorphBack: (SBRow new changeTableLayout; @@ -122,7 +122,6 @@ SBLiveView >> newPermutationButtonRowFor: aPermutation showing: aPreview [ layoutInset: 0; cellInset: 0; addAllMorphsBack: { - SBButton newApplyPermutationFor: aPermutation. self rebuildButtonIn: aPreview applying: aPermutation. self synchronizeButtonIn: aPreview} ] @@ -131,12 +130,14 @@ SBLiveView >> newPermutationButtonRowFor: aPermutation showing: aPreview [ SBLiveView >> newRegisteredListenerFor: aPermutation [ | listener container | + SBActiveVariantPermutation value: aPermutation. listener := self evaluateSetUp. container := broadcaster addListener: listener. listener allMorphsDo: [:aSubMorph | SBExploriants objectToPermutation at: aSubMorph put: aPermutation]. + SBActiveVariantPermutation value: nil. ^ container ] diff --git a/packages/Sandblocks-Babylonian/SBMultiverse.class.st b/packages/Sandblocks-Babylonian/SBMultiverse.class.st index 8eff50fa..fbd8ca28 100644 --- a/packages/Sandblocks-Babylonian/SBMultiverse.class.st +++ b/packages/Sandblocks-Babylonian/SBMultiverse.class.st @@ -118,6 +118,8 @@ SBMultiverse >> cleanUp [ watches do: #resumeGraphicalUpdates. (watches select: [:anOpenWatch | anOpenWatch containingArtefact isNil]) copy do: #delete. watches select: #isInEditor thenDo: [:aWatch | aWatch exampleToDisplay values do: #updateDisplay]. + allMethodBlocksContainingWatches do: [:aMethodBlock | + (aMethodBlock valueOfProperty: #originals) do: [:aWatch| aWatch ignoreReports: true]]. ] { #category : #collecting } @@ -162,6 +164,8 @@ SBMultiverse >> gatherElements [ watches := (allMethodBlocksContainingWatches collect: [:aMethodBlock | | copies | copies := aMethodBlock containedExampleWatches. + "Because the watches share the id, values would be reported to original too. Stop that" + (aMethodBlock valueOfProperty: #originals) do: [:aWatch| aWatch ignoreReports: true]. (aMethodBlock valueOfProperty: #originals) withIndexDo: [:original :i | (copies at: i) copySelectedDisplayIndicesFrom: original]. copies ]) flatten. watches do: [:aWatch | activeExamples do: [:anExample | aWatch exampleStarting: anExample]]. diff --git a/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.class.st b/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.class.st index 4320f5dd..bede6ade 100644 --- a/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.class.st +++ b/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.class.st @@ -1,8 +1,7 @@ Class { #name : #SBPartialPermutationLabel, - #superclass : #TextMorph, + #superclass : #SBPermutationLabel, #instVars : [ - 'permutation', 'universe' ], #category : #'Sandblocks-Babylonian' @@ -18,22 +17,10 @@ SBPartialPermutationLabel class >> newDisplaying: aSBPermutation referingTo: aUn yourself ] -{ #category : #'*Sandblocks-Babylonian' } -SBPartialPermutationLabel >> listensToPermutations [ - - ^ true -] - -{ #category : #accessing } -SBPartialPermutationLabel >> permutation [ - - ^ permutation -] - -{ #category : #accessing } -SBPartialPermutationLabel >> permutation: aPermutation [ - - permutation := aPermutation +{ #category : #'event handling' } +SBPartialPermutationLabel >> mouseDown: evt [ + + self universe activePermutation apply ] { #category : #accessing } diff --git a/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.extension.st b/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.extension.st deleted file mode 100644 index a4e59e1e..00000000 --- a/packages/Sandblocks-Babylonian/SBPartialPermutationLabel.extension.st +++ /dev/null @@ -1,7 +0,0 @@ -Extension { #name : #SBPartialPermutationLabel } - -{ #category : #'*Sandblocks-Babylonian' } -SBPartialPermutationLabel >> listensToPermutations [ - - ^ true -] diff --git a/packages/Sandblocks-Babylonian/SBPermutationGridsView.class.st b/packages/Sandblocks-Babylonian/SBPermutationGridsView.class.st index 74636836..9225d1c3 100644 --- a/packages/Sandblocks-Babylonian/SBPermutationGridsView.class.st +++ b/packages/Sandblocks-Babylonian/SBPermutationGridsView.class.st @@ -17,8 +17,8 @@ SBPermutationGridsView >> buildPermutationFor: aSBUniverse [ addAllMorphsBack: { self containerRow listDirection: #topToBottom; addAllMorphsBack: { - SBPermutationLabel newDisplaying: aSBUniverse activePermutation. - SBButton newApplyPermutationFor: aSBUniverse activePermutation. + (SBPermutationLabel newDisplaying: aSBUniverse activePermutation) + wrapFlag: false. (self currentClusterClass newForSize: self selectedResizer havingWatches: aSBUniverse watches)}}) diff --git a/packages/Sandblocks-Babylonian/SBPermutationLabel.class.st b/packages/Sandblocks-Babylonian/SBPermutationLabel.class.st index b1a45868..cf86ad65 100644 --- a/packages/Sandblocks-Babylonian/SBPermutationLabel.class.st +++ b/packages/Sandblocks-Babylonian/SBPermutationLabel.class.st @@ -16,12 +16,56 @@ SBPermutationLabel class >> newDisplaying: aSBPermutation [ yourself ] +{ #category : #'*Sandblocks-Babylonian' } +SBPermutationLabel >> applyResize: aPoint [ + + ^ self extent: aPoint +] + +{ #category : #initialization } +SBPermutationLabel >> initialize [ + + super initialize. + + self wrapFlag: true. +] + { #category : #'*Sandblocks-Babylonian' } SBPermutationLabel >> listensToPermutations [ ^ true ] +{ #category : #'event handling' } +SBPermutationLabel >> mouseDown: evt [ + + self permutation apply +] + +{ #category : #'event handling' } +SBPermutationLabel >> mouseEnter: evt [ + + "nothing" +] + +{ #category : #'event handling' } +SBPermutationLabel >> mouseLeave: evt [ + + "nothing" +] + +{ #category : #'event handling' } +SBPermutationLabel >> mouseMove: evt [ + + ^ Cursor execute show +] + +{ #category : #'event handling' } +SBPermutationLabel >> mouseUp: evt [ + + "nothing" +] + { #category : #accessing } SBPermutationLabel >> permutation [ diff --git a/packages/Sandblocks-Babylonian/SBPermutationLabel.extension.st b/packages/Sandblocks-Babylonian/SBPermutationLabel.extension.st index ad89430d..b49ace75 100644 --- a/packages/Sandblocks-Babylonian/SBPermutationLabel.extension.st +++ b/packages/Sandblocks-Babylonian/SBPermutationLabel.extension.st @@ -1,5 +1,11 @@ Extension { #name : #SBPermutationLabel } +{ #category : #'*Sandblocks-Babylonian' } +SBPermutationLabel >> applyResize: aPoint [ + + ^ self extent: aPoint +] + { #category : #'*Sandblocks-Babylonian' } SBPermutationLabel >> listensToPermutations [ diff --git a/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st b/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st index a530636f..d22ff1b5 100644 --- a/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st +++ b/packages/Sandblocks-Babylonian/SBPlainResultsView.class.st @@ -13,8 +13,7 @@ SBPlainResultsView >> buildAllPossibleResults [ { #category : #building } SBPlainResultsView >> buildPermutationFor: aSBUniverse [ - self block addAllMorphsBack: {SBPermutationLabel newDisplaying: aSBUniverse activePermutation. - SBButton newApplyPermutationFor: aSBUniverse activePermutation. + self block addAllMorphsBack: {(SBPermutationLabel newDisplaying: aSBUniverse activePermutation) wrapFlag: false. (self containerRow listDirection: #leftToRight) addAllMorphsBack: aSBUniverse watches. LineMorph from: 0@0 to: 50@0 color: Color black width: 2} diff --git a/packages/Sandblocks-Babylonian/SBResizableResultsView.class.st b/packages/Sandblocks-Babylonian/SBResizableResultsView.class.st index ab04b549..51337ef7 100644 --- a/packages/Sandblocks-Babylonian/SBResizableResultsView.class.st +++ b/packages/Sandblocks-Babylonian/SBResizableResultsView.class.st @@ -21,13 +21,19 @@ SBResizableResultsView >> buildDimensionOptions [ options := SBMorphResizer standardOptions. ^ SBComboBox new - prefix: 'Preview sizes: '; + prefix: 'Preview size: '; labels: (options collect: #label); values: options; object: options third; when: #selectionChanged send: #applyResizer to: self ] +{ #category : #accessing } +SBResizableResultsView >> buttons [ + + ^ {dimensionOptions} +] + { #category : #initialization } SBResizableResultsView >> initialize [ @@ -41,15 +47,3 @@ SBResizableResultsView >> selectedResizer [ ^ dimensionOptions object ] - -{ #category : #'as yet unclassified' } -SBResizableResultsView >> visualize [ - - self clean. - - self block addMorph: dimensionOptions. - self buildButtonRow. - - self buildAllPossibleResults . - self concludeContainerWidth. -] diff --git a/packages/Sandblocks-Babylonian/SBStMessageSend.extension.st b/packages/Sandblocks-Babylonian/SBStMessageSend.extension.st index a98bfc2a..0a7e0b7a 100644 --- a/packages/Sandblocks-Babylonian/SBStMessageSend.extension.st +++ b/packages/Sandblocks-Babylonian/SBStMessageSend.extension.st @@ -4,14 +4,6 @@ Extension { #name : #SBStMessageSend } SBStMessageSend >> suggestedAlternationName [ ^ self isAssignment - ifTrue: ['{2}{1}' format: {self selector. self receiver suggestedAlternationName}] - ifFalse: [ - SBVariant - named: 'format: to ''{1} to {2}''' - associations: { - 'with sender' -> ['{1} to {2}' format: {self selector. self receiver suggestedAlternationName}]. - 'w/o sender' -> ['{1}' format: {self selector}]} - activeIndex: 2 - id: '1949332c-4768-ff4a-98ba-0356e4a3f2fa' - isActive: false] + ifTrue: [self receiver suggestedAlternationName] + ifFalse: ['{1}' format: {self selector}] ] diff --git a/packages/Sandblocks-Babylonian/SBSwitchableResultsView.class.st b/packages/Sandblocks-Babylonian/SBSwitchableResultsView.class.st index f1482132..a186cf87 100644 --- a/packages/Sandblocks-Babylonian/SBSwitchableResultsView.class.st +++ b/packages/Sandblocks-Babylonian/SBSwitchableResultsView.class.st @@ -13,7 +13,7 @@ Class { { #category : #accessing } SBSwitchableResultsView >> buttons [ - ^ {self toggleViewButton} + ^ super buttons, {self toggleViewButton} ] { #category : #accessing } diff --git a/packages/Sandblocks-Core/SBEditor.class.st b/packages/Sandblocks-Core/SBEditor.class.st index c74bd492..560a69eb 100644 --- a/packages/Sandblocks-Core/SBEditor.class.st +++ b/packages/Sandblocks-Core/SBEditor.class.st @@ -294,6 +294,11 @@ SBEditor >> buildCommandBar [ shortcut: (self class anyShortcutForAction: #openRepl) do: [self openRepl]; balloonText: 'Add artifact...'); + addMorphBack: (SBButton new + icon: SBIcon iconObjectGroup + shortcut: (self class anyShortcutForAction: #openExploriants) + do: [self openExploriants]; + balloonText: 'Open Exploriants'); addMorphBack: (Morph new height: 0; color: Color transparent; diff --git a/packages/Sandblocks-Core/SBNamedBlock.class.st b/packages/Sandblocks-Core/SBNamedBlock.class.st index d86ca02d..0341c4fa 100644 --- a/packages/Sandblocks-Core/SBNamedBlock.class.st +++ b/packages/Sandblocks-Core/SBNamedBlock.class.st @@ -95,8 +95,8 @@ SBNamedBlock >> suggestedName [ String streamContents: [:aStream | aStream nextPutAll: ((self block statements collect: #suggestedAlternationName) fold: [:a :b | a, ' ', b])] - limitedTo: 20. - limitedString size < 20 ifTrue: [^ limitedString]. + limitedTo: 14. + limitedString size < 14 ifTrue: [^ limitedString]. ^ limitedString , '...' ] diff --git a/packages/Sandblocks-Core/SBTabView.class.st b/packages/Sandblocks-Core/SBTabView.class.st index 4bee0880..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' } @@ -113,15 +114,14 @@ SBTabView >> addButton [ ^ SBButton new icon: (SBIcon iconPlus - size: 7.0 sbScaled; + size: 10; color: (Color green)) do: [self addTab]; makeSmall; + cellPositioning: #center; cornerStyle: #squared; vResizing: #spaceFill; - balloonText: 'Add'; - cellGap: -1.0 sbScaled; - layoutInset: (4.0 @ 4.0) sbScaled + balloonText: 'Add' ] { #category : #commands } @@ -154,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. @@ -187,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 } @@ -202,6 +205,12 @@ SBTabView >> buildView [ self addMorphBack: (self activeBlock hResizing: #spaceFill) ] +{ #category : #accessing } +SBTabView >> buttonClass [ + + ^ SBEditableButton +] + { #category : #ui } SBTabView >> deleteButtonFor: aNamedBlock [ @@ -226,6 +235,7 @@ SBTabView >> initialize [ namedBlocks := {SBNamedBlock new} asOrderedCollection. activeIndex := 1. + wantsTabCountChanges := false. self changeTableLayout; @@ -321,6 +331,13 @@ SBTabView >> jumpToTab: anIndex [ ] +{ #category : #tabs } +SBTabView >> jumpToTabWithoutSaving: anIndex [ + + self namedBlocks at: anIndex ifPresent: [:block | self basicSetActive: block] + +] + { #category : #'shortcut-utility' } SBTabView >> jumpToThirdTab [ @@ -395,6 +412,8 @@ SBTabView >> removeCurrentTab [ { #category : #tabs } SBTabView >> setActive: aNamedBlock [ + self containingArtefact ifNil: [^ self activeIndex: (self namedBlocks indexOf: aNamedBlock ifAbsent: 1)]. + self containingArtefact isMethod ifFalse: [self basicSetActive: aNamedBlock. ^ self]. self containingArtefact hasUnsavedChanges @@ -402,7 +421,7 @@ SBTabView >> setActive: aNamedBlock [ ifFalse: ["changing tabs is latest change" self basicSetActive: aNamedBlock. SBExploriants uniqueInstance ignoreUpdate: true. - self sandblockEditor save: self containingArtefact tryFixing: false quick: true.]. + self sandblockEditor save: self containingArtefact tryFixing: false quick: false.]. ] @@ -442,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 } @@ -480,3 +501,15 @@ SBTabView >> view [ ^ self lastSubmorph ] + +{ #category : #accessing } +SBTabView >> wantsTabCountChanges [ + + ^ wantsTabCountChanges +] + +{ #category : #accessing } +SBTabView >> wantsTabCountChanges: aBoolean [ + + wantsTabCountChanges := aBoolean +] diff --git a/packages/Sandblocks-Core/SBTextInputMapping.class.st b/packages/Sandblocks-Core/SBTextInputMapping.class.st index 663330aa..39089d5a 100644 --- a/packages/Sandblocks-Core/SBTextInputMapping.class.st +++ b/packages/Sandblocks-Core/SBTextInputMapping.class.st @@ -97,7 +97,8 @@ SBTextInputMapping >> registerDefaultShortcuts [ registerShortcut: $f command do: #startSearch; registerShortcut: $g command do: #nextSearchResult; registerShortcut: $t command do: #promptAddArtifact; - registerShortcut: $J command do: #activateForces. + registerShortcut: $J command do: #activateForces; + registerShortcut: $e command do: #openExploriants. " navigation " self diff --git a/packages/Sandblocks-Morphs/SBButton.class.st b/packages/Sandblocks-Morphs/SBButton.class.st index fb411f14..41d7403d 100644 --- a/packages/Sandblocks-Morphs/SBButton.class.st +++ b/packages/Sandblocks-Morphs/SBButton.class.st @@ -10,19 +10,6 @@ Class { #category : #'Sandblocks-Morphs' } -{ #category : #'instance creation' } -SBButton class >> newApplyPermutationFor: aPermutation [ - - ^ self new - icon: (SBIcon iconArrowDown - size: 10.0 sbScaled; - color: (Color r: 0.0 g: 1 b: 0.0)) - 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 54ab6963..14e1c846 100644 --- a/packages/Sandblocks-Smalltalk/SBStASTNode.class.st +++ b/packages/Sandblocks-Smalltalk/SBStASTNode.class.st @@ -164,19 +164,10 @@ SBStASTNode >> grammarHandler [ { #category : #accessing } SBStASTNode >> guessClassExpensive [ + self flag: #fixme. "new sandbox interface, tobe" ^ self guessedClass ifNil: [ self valueOfProperty: #guessedClassExpensive ifAbsentPut: [ - Smalltalk at: #Sandbox ifPresent: [:sandboxClass | - [ - sandboxClass new - stepLimit: 100000; - evaluate: [ - self evaluate ifNotNil: [:result | - [result class] on: MessageNotUnderstood do: ["might be ProtoObject" - thisContext objectClass: result]]] - ifFailed: [nil]] - on: (Smalltalk at: #SandboxError) - do: [:err | nil]]]] + nil]] ] { #category : #accessing } diff --git a/packages/Sandblocks-Smalltalk/SBStGrammarHandler.class.st b/packages/Sandblocks-Smalltalk/SBStGrammarHandler.class.st index 48655465..b95a9e50 100644 --- a/packages/Sandblocks-Smalltalk/SBStGrammarHandler.class.st +++ b/packages/Sandblocks-Smalltalk/SBStGrammarHandler.class.st @@ -712,7 +712,6 @@ SBStGrammarHandler >> wrapInVariant [ callingAlternativesBuilder: #defaultAlternativesForBlocks:]. variant sandblockEditor select: variant nameBlock. - variant sandblockEditor save: variant containingArtefact tryFixing: true quick: false. ] { #category : #actions } diff --git a/packages/Sandblocks-Smalltalk/SBVariant.class.st b/packages/Sandblocks-Smalltalk/SBVariant.class.st index cf98b2cf..9d247b1b 100644 --- a/packages/Sandblocks-Smalltalk/SBVariant.class.st +++ b/packages/Sandblocks-Smalltalk/SBVariant.class.st @@ -88,6 +88,7 @@ SBVariant class >> named: aString associations: aCollectionOfAssociations active "Always prioritize the permutation which is marked as active" SBActiveVariantPermutation value ifNotNil: [^ (aCollectionOfAssociations at: (SBActiveVariantPermutation value at: uuid) ifAbsent: [^ defaultBehavior value]) value value]. + requestor := thisContext sender receiver. "The requesting object does not require dynamic update behavior in which it needs to know a certain alternative" SBExploriants objectToPermutation at: (requestor := thisContext sender receiver) ifAbsent: [^ defaultBehavior value]. "The permutation is outdated and does not know this variant" @@ -469,6 +470,12 @@ SBVariant >> switchToAlternative: anIndex [ self widget jumpToTab: anIndex ] +{ #category : #actions } +SBVariant >> switchToAlternativeWithoutSaving: anIndex [ + + self widget jumpToTabWithoutSaving: anIndex +] + { #category : #accessing } SBVariant >> toggleActive [ diff --git a/packages/Sandblocks-Utils/SBPermutation.class.st b/packages/Sandblocks-Utils/SBPermutation.class.st index 64cb68df..5e7a01e7 100644 --- a/packages/Sandblocks-Utils/SBPermutation.class.st +++ b/packages/Sandblocks-Utils/SBPermutation.class.st @@ -53,7 +53,11 @@ SBPermutation >> activeScore [ { #category : #actions } SBPermutation >> apply [ - self referencedVariants do: [:aVariant | aVariant switchToAlternative: (self at: aVariant id)]. + self referencedVariants do: [:aVariant | aVariant switchToAlternativeWithoutSaving: (self at: aVariant id)]. + SBExploriants uniqueInstance ignoreUpdate: true. + ((self referencedVariants collect: #containingArtefact) asSet) do: [:aMethod | + self referencedVariants first sandblockEditor save: aMethod tryFixing: false quick: false]. + ((Set newFrom: (referencedVariants collect: #sandblockEditor)) reject: #isNil) do: #sendNewPermutationNotification @@ -65,7 +69,8 @@ SBPermutation >> asString [ "collecting instead of calling (a active name), ', ', (b active name) in fold as one variant only will not return a string but a variant" ^ (self referencedVariants collect: [:aVariant | - aVariant name, ': ', (aVariant blockAt: (self at: aVariant id)) nameToDisplay ]) + ((aVariant name endsWith: ':') ifTrue: [aVariant name, ' '] ifFalse: [aVariant name, ': ']), + (aVariant blockAt: (self at: aVariant id)) nameToDisplay ]) fold: [:a :b | a, ', ', Character cr, b ] diff --git a/packages/Sandblocks-Watch/SBMorphResizer.class.st b/packages/Sandblocks-Watch/SBMorphResizer.class.st index d68bcd71..22263d8b 100644 --- a/packages/Sandblocks-Watch/SBMorphResizer.class.st +++ b/packages/Sandblocks-Watch/SBMorphResizer.class.st @@ -14,7 +14,7 @@ Class { { #category : #'initialize-release' } SBMorphResizer class >> newBig [ - ^ self newLabeled: 'big' transforming: [:anObject | anObject applyResize: 350@350] + ^ self newLabeled: 'big' transforming: [:anObject | anObject applyResize: (350@350) sbScaled] ] { #category : #'initialize-release' } @@ -35,25 +35,25 @@ SBMorphResizer class >> newLabeled: aName transforming: aBlockTakingASingleParam { #category : #'initialize-release' } SBMorphResizer class >> newMedium [ - ^ self newLabeled: 'medium' transforming: [:anObject | anObject applyResize: 150@150] + ^ self newLabeled: 'medium' transforming: [:anObject | anObject applyResize: (200@200) sbScaled] ] { #category : #'initialize-release' } SBMorphResizer class >> newSmall [ - ^ self newLabeled: 'small' transforming: [:anObject | anObject applyResize: 100@100] + ^ self newLabeled: 'small' transforming: [:anObject | anObject applyResize: (100@100) sbScaled] ] { #category : #'initialize-release' } SBMorphResizer class >> newThumbmail [ - ^ self newLabeled: 'thumbmail' transforming: [:anObject | anObject applyResize: 40@40] + ^ self newLabeled: 'thumbmail' transforming: [:anObject | anObject applyResize: (40@40) sbScaled] ] { #category : #'initialize-release' } SBMorphResizer class >> newTiny [ - ^ self newLabeled: 'tiny' transforming: [:anObject | anObject applyResize: 15@15] + ^ self newLabeled: 'tiny' transforming: [:anObject | anObject applyResize: (15@15) sbScaled] ] { #category : #'initialize-release' }