-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
243 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
66 changes: 66 additions & 0 deletions
66
packages/Sandblocks-Babylonian/SBInputBroadcaster.class.st
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
Class { | ||
#name : #SBInputBroadcaster, | ||
#superclass : #Morph, | ||
#instVars : [ | ||
'listeners' | ||
], | ||
#category : #'Sandblocks-Babylonian' | ||
} | ||
|
||
{ #category : #events } | ||
SBInputBroadcaster >> filterEvent: anEvent for: aMorph [ | ||
|
||
self flag: #todo. "Die Position im Morph in den listener transformieren" | ||
self listeners do: [:aListener | aListener processEvent: (anEvent copy position: aListener position)]. | ||
^ anEvent | ||
] | ||
|
||
{ #category : #'events-processing' } | ||
SBInputBroadcaster >> handleMouseOver: anEvent [ | ||
|
||
super handleMouseOver: anEvent. | ||
anEvent hand newKeyboardFocus: self. | ||
|
||
] | ||
|
||
{ #category : #'event handling' } | ||
SBInputBroadcaster >> handlesKeyboard: evt [ | ||
|
||
^ true | ||
|
||
] | ||
|
||
{ #category : #initialization } | ||
SBInputBroadcaster >> initialize [ | ||
|
||
super initialize. | ||
|
||
listeners := OrderedCollection new. | ||
|
||
self | ||
addKeyboardCaptureFilter: self; | ||
"addMouseCaptureFilter: self;" | ||
extent: 300@200; | ||
color: Color veryLightGray; | ||
changeTableLayout; | ||
listDirection: #topToBottom; | ||
wrapCentering: #center; | ||
listCentering: #center; | ||
addMorph: (StringMorph new | ||
contents: 'Enter Input here'; | ||
color: Color white; | ||
yourself) | ||
|
||
] | ||
|
||
{ #category : #accessing } | ||
SBInputBroadcaster >> listeners [ | ||
|
||
^ listeners | ||
] | ||
|
||
{ #category : #accessing } | ||
SBInputBroadcaster >> listeners: aCollectionOfMorphs [ | ||
|
||
listeners := aCollectionOfMorphs. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,131 @@ | ||
Class { | ||
#name : #SBLiveView, | ||
#superclass : #SBGridResultsView, | ||
#instVars : [ | ||
'broadcaster' | ||
], | ||
#category : #'Sandblocks-Babylonian' | ||
} | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> buildAllPossibleResults [ | ||
|
||
self multiverse universes do: [:aUniverse | self buildPreviewFor: aUniverse activePermutation] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> buildBrodcaster [ | ||
|
||
self block addMorphBack: (SBRow new | ||
changeTableLayout; | ||
hResizing: #spaceFill; | ||
wrapCentering: #center; | ||
listCentering: #center; | ||
cellPositioning: #center; | ||
addMorph: (broadcaster := SBInputBroadcaster new)) | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> buildPreviewFor: aPermutation [ | ||
|
||
gridContainer addMorphBack: (self containerRow cellPositioning: #center; | ||
addAllMorphsBack: { | ||
self containerRow listDirection: #topToBottom; | ||
addAllMorphsBack: { | ||
SBOwnTextMorph new contents: aPermutation asString. | ||
SBButton newApplyPermutationFor: aPermutation. | ||
self newRegisteredListenerFor: aPermutation}. | ||
LineMorph from: 0@0 to: 0@50 color: Color black width: 2}). | ||
|
||
self updateContainerWidth. | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> buildSetUpRow [ | ||
|
||
self block addMorph: (SBRow new | ||
changeTableLayout; | ||
hResizing: #spaceFill; | ||
wrapCentering: #center; | ||
listCentering: #center; | ||
cellPositioning: #center; | ||
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 statements first) width: 200)) | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> clean [ | ||
|
||
self block submorphs allButFirst copy do: #delete. | ||
|
||
gridContainer := self newGridContainer. | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> evaluateSetUp [ | ||
|
||
^ self setUpMorph evaluate | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> gridObjects [ | ||
|
||
^ self multiverse universes | ||
] | ||
|
||
{ #category : #initialization } | ||
SBLiveView >> initialize [ | ||
|
||
super initialize. | ||
|
||
self name: 'Live View'. | ||
self buildSetUpRow. | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> listeners [ | ||
|
||
^ broadcaster listeners | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> newRegisteredListenerFor: aPermutation [ | ||
|
||
| listener | | ||
listener := self evaluateSetUp. | ||
broadcaster listeners add: listener. | ||
|
||
listener allMorphsDo: [:aSubMorph | | ||
SBExploriants objectToPermutation at: aSubMorph put: aPermutation]. | ||
|
||
^ listener | ||
|
||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> setUpMorph [ | ||
|
||
^ self block firstSubmorph "setup row" lastSubmorph | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> toggleStepping [ | ||
|
||
self listeners do: [:aMorph | | ||
aMorph isStepping ifFalse: [aMorph startStepping] ifTrue: [aMorph stopStepping]] | ||
] | ||
|
||
{ #category : #'as yet unclassified' } | ||
SBLiveView >> visualize [ | ||
|
||
self clean. | ||
|
||
self buildBrodcaster. | ||
self block addMorphBack: self updateButton. | ||
self block addMorphBack: gridContainer. | ||
self buildAllPossibleResults. | ||
] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters