Skip to content

Commit

Permalink
added missing class
Browse files Browse the repository at this point in the history
  • Loading branch information
akevalion committed Oct 15, 2023
1 parent 8f772b3 commit 797e422
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 88 deletions.
95 changes: 7 additions & 88 deletions src/Roassal-Inspector/SpRoassal3InspectorPresenter.class.st
Original file line number Diff line number Diff line change
@@ -1,95 +1,14 @@
"
I am the default Roassal inspector presenter. I work with RSContextInteraction
This class is deprecated please use SpRoassalInspectorPresenter
"
Class {
#name : #SpRoassalInspectorPresenter,
#superclass : #SpPresenter,
#instVars : [
'canvas',
'roassalMorph',
'toolBar'
],
#name : #SpRoassal3InspectorPresenter,
#superclass : #SpRoassalInspectorPresenter,
#category : #'Roassal-Inspector-SP2'
}

{ #category : #layout }
SpRoassalInspectorPresenter class >> defaultLayout [
^ SpBoxLayout newTopToBottom
add: #roassalMorph;
yourself
]

{ #category : #ports }
SpRoassalInspectorPresenter >> activateOnDoubleClick [
]

{ #category : #ports }
SpRoassalInspectorPresenter >> activateOnSingleClick [
]

{ #category : #accessing }
SpRoassalInspectorPresenter >> canvas [
^ canvas
]

{ #category : #accessing }
SpRoassalInspectorPresenter >> canvas: aRSCanvas [
canvas := aRSCanvas.
roassalMorph morph: canvas createMorph
]

{ #category : #enumerating }
SpRoassalInspectorPresenter >> createToolbarIfNecessary [
| context interactions |
context := canvas inspectorContext.
interactions := context inspectorInteractions.
interactions ifEmpty: [ ^ self ].
toolBar := SpBoxLayout newLeftToRight.
interactions do: [ :cls | | i |
i := cls new.
i canvas: canvas.
toolBar add: i newButton withConstraints: [ :constraints |
constraints
width: 20;
height: 20 ] ].
self layout: (SpBoxLayout newTopToBottom
add: toolBar height: 25;
add: #roassalMorph;
yourself)
]

{ #category : #ports }
SpRoassalInspectorPresenter >> defaultOutputPort [

^ self outputSelectionPort
]

{ #category : #initialization }
SpRoassalInspectorPresenter >> initializePresenters [
roassalMorph := self newMorph.
toolBar := self newButton.
toolBar label: 'fooo'
]

{ #category : #ports }
SpRoassalInspectorPresenter >> outputActivationPort [
^ SpActivationPort newPresenter: self
]

{ #category : #ports }
SpRoassalInspectorPresenter >> outputSelectionPort [
^ SpActivationPort newPresenter: self
]

{ #category : #enumerating }
SpRoassalInspectorPresenter >> whenActivatedDo: aBlock [
| context |
self createToolbarIfNecessary.
context := canvas inspectorContext.
context presentation: aBlock.
canvas shapes @ context.
canvas
when: RSShapeAddedEvent
do: [ :evt | evt shape @ context ]
for: self
{ #category : #testing }
SpRoassal3InspectorPresenter class >> isDeprecated [
"please use SpRoassalInspectorPresenter"
^ true
]
95 changes: 95 additions & 0 deletions src/Roassal-Inspector/SpRoassalInspectorPresenter.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
"
I am the default Roassal inspector presenter. I work with RSContextInteraction
"
Class {
#name : #SpRoassalInspectorPresenter,
#superclass : #SpPresenter,
#instVars : [
'canvas',
'roassalMorph',
'toolBar'
],
#category : #'Roassal-Inspector-SP2'
}

{ #category : #layout }
SpRoassalInspectorPresenter class >> defaultLayout [
^ SpBoxLayout newTopToBottom
add: #roassalMorph;
yourself
]

{ #category : #ports }
SpRoassalInspectorPresenter >> activateOnDoubleClick [
]

{ #category : #ports }
SpRoassalInspectorPresenter >> activateOnSingleClick [
]

{ #category : #accessing }
SpRoassalInspectorPresenter >> canvas [
^ canvas
]

{ #category : #accessing }
SpRoassalInspectorPresenter >> canvas: aRSCanvas [
canvas := aRSCanvas.
roassalMorph morph: canvas createMorph
]

{ #category : #enumerating }
SpRoassalInspectorPresenter >> createToolbarIfNecessary [
| context interactions |
context := canvas inspectorContext.
interactions := context inspectorInteractions.
interactions ifEmpty: [ ^ self ].
toolBar := SpBoxLayout newLeftToRight.
interactions do: [ :cls | | i |
i := cls new.
i canvas: canvas.
toolBar add: i newButton withConstraints: [ :constraints |
constraints
width: 20;
height: 20 ] ].
self layout: (SpBoxLayout newTopToBottom
add: toolBar height: 25;
add: #roassalMorph;
yourself)
]

{ #category : #ports }
SpRoassalInspectorPresenter >> defaultOutputPort [

^ self outputSelectionPort
]

{ #category : #initialization }
SpRoassalInspectorPresenter >> initializePresenters [
roassalMorph := self newMorph.
toolBar := self newButton.
toolBar label: 'fooo'
]

{ #category : #ports }
SpRoassalInspectorPresenter >> outputActivationPort [
^ SpActivationPort newPresenter: self
]

{ #category : #ports }
SpRoassalInspectorPresenter >> outputSelectionPort [
^ SpActivationPort newPresenter: self
]

{ #category : #enumerating }
SpRoassalInspectorPresenter >> whenActivatedDo: aBlock [
| context |
self createToolbarIfNecessary.
context := canvas inspectorContext.
context presentation: aBlock.
canvas shapes @ context.
canvas
when: RSShapeAddedEvent
do: [ :evt | evt shape @ context ]
for: self
]

0 comments on commit 797e422

Please sign in to comment.