-
Notifications
You must be signed in to change notification settings - Fork 12
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
2 changed files
with
102 additions
and
88 deletions.
There are no files selected for viewing
95 changes: 7 additions & 88 deletions
95
src/Roassal-Inspector/SpRoassal3InspectorPresenter.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 |
---|---|---|
@@ -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
95
src/Roassal-Inspector/SpRoassalInspectorPresenter.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,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 | ||
] |