Skip to content

Draft simplerene integration #189

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/BaselineOfPyramid/BaselineOfPyramid.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,13 @@ BaselineOfPyramid >> preload: loader package: packageSpec [
{ #category : 'packages' }
BaselineOfPyramid >> pyramidPackages: spec [

spec package: 'Pyramid'.
spec
package: 'Pyramid-IDE'
with: [ spec requires: #( 'Pyramid' ) ].
spec baseline: 'SimpleRene' with: [
spec
repository: 'github://pharo-contributions/SimpleRene:v1.0.0';
loads: #( Core ) ].

spec package: 'Pyramid' with: [ spec requires: #( 'SimpleRene' ) ].
spec package: 'Pyramid-IDE' with: [ spec requires: #( 'Pyramid' ) ]
]

{ #category : 'dependencies' }
Expand Down
18 changes: 14 additions & 4 deletions src/Pyramid-Bloc/PyramidBlocTextPlugin.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,9 @@ Class {
{ #category : 'accessing' }
PyramidBlocTextPlugin class >> changeText [

<pyManualProperty>
| property |

property := PyramidProperty new
name: 'Text';
command: PyramidChangeTextCommand new;
Expand All @@ -38,6 +40,7 @@ PyramidBlocTextPlugin class >> fontSize [
{ #category : 'accessing' }
PyramidBlocTextPlugin class >> fontWeight [

<pyManualProperty>
| property |
property := PyramidProperty new
name: 'Font weight';
Expand All @@ -51,6 +54,7 @@ PyramidBlocTextPlugin class >> fontWeight [
{ #category : 'accessing' }
PyramidBlocTextPlugin class >> textForeground [

<pyManualProperty>
| property |
property := PyramidProperty new
name: 'Text foreground';
Expand All @@ -66,8 +70,14 @@ PyramidBlocTextPlugin class >> textForeground [
{ #category : 'connecting' }
PyramidBlocTextPlugin >> connectOn: aPyramidEditor [

aPyramidEditor propertiesManager addProperty: self class changeText.
aPyramidEditor propertiesManager addProperty: self class fontSize.
aPyramidEditor propertiesManager addProperty: self class fontWeight.
aPyramidEditor propertiesManager addProperty: self class textForeground
(self class class methods select: [ :e |
e hasPragmaNamed: #pyManualProperty ]) do: [ :m |
aPyramidEditor propertiesManager addProperty:
(self class perform: m selector) ].

BlTextElement new simpleReneDescription do: [ :propertyDescription |
| property |
property := PyramidMagritteProperty new magritteDescription:
propertyDescription.
aPyramidEditor propertiesManager addProperty: property ]
]
3 changes: 1 addition & 2 deletions src/Pyramid-Bloc/PyramidFontSizeCommand.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,5 @@ PyramidFontSizeCommand >> getValueFor: aBlTextElement [
{ #category : 'as yet unclassified' }
PyramidFontSizeCommand >> setValueFor: aBlTextElement with: aNumber [

aBlTextElement text attribute: (BlFontSizeAttribute size: aNumber).
aBlTextElement textChanged
aBlTextElement fontSize: aNumber
]
34 changes: 34 additions & 0 deletions src/Pyramid-Bloc/PyramidGenericCommand.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Class {
#name : 'PyramidGenericCommand',
#superclass : 'PyramidBlocTextCommand',
#instVars : [
'selector'
],
#category : 'Pyramid-Bloc-plugin-bloc-text',
#package : 'Pyramid-Bloc',
#tag : 'plugin-bloc-text'
}

{ #category : 'as yet unclassified' }
PyramidGenericCommand >> getValueFor: aBLElement [

^ aBLElement perform: selector
]

{ #category : 'accessing' }
PyramidGenericCommand >> selector [

^ selector
]

{ #category : 'accessing' }
PyramidGenericCommand >> selector: anObject [

selector := anObject
]

{ #category : 'as yet unclassified' }
PyramidGenericCommand >> setValueFor: aBLElement with: aValue [

aBLElement perform: selector asMutator with: aValue
]
89 changes: 89 additions & 0 deletions src/Pyramid/PyramidMagritteProperty.class.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
Class {
#name : 'PyramidMagritteProperty',
#superclass : 'Object',
#instVars : [
'magritteDescription',
'commandExecutor',
'presenterBuilder'
],
#category : 'Pyramid-property',
#package : 'Pyramid',
#tag : 'property'
}

{ #category : 'ad' }
PyramidMagritteProperty >> buildPresenterFromCluster: aCluster [

^ self presenterBuilder
cluster: aCluster;
property: self;
build
]

{ #category : 'accessing' }
PyramidMagritteProperty >> command [

^ PyramidGenericCommand new
selector: magritteDescription accessor readSelector;
yourself
]

{ #category : 'accessing' }
PyramidMagritteProperty >> commandExecutor [
^ commandExecutor
]

{ #category : 'accessing' }
PyramidMagritteProperty >> commandExecutor: aPyramidCallbackCommandExecutor [

commandExecutor := aPyramidCallbackCommandExecutor
]

{ #category : 'accessing' }
PyramidMagritteProperty >> initialize [

super initialize.
presenterBuilder := PyramidPopingPresenterBuilder new
]

{ #category : 'accessing' }
PyramidMagritteProperty >> magritteDescription [

^ magritteDescription
]

{ #category : 'accessing' }
PyramidMagritteProperty >> magritteDescription: anObject [

magritteDescription := anObject
]

{ #category : 'tests' }
PyramidMagritteProperty >> makeNewInput [

^ magritteDescription acceptSimpleReneVisitor: self
]

{ #category : 'accessing' }
PyramidMagritteProperty >> name [

^ magritteDescription label
]

{ #category : 'accessing' }
PyramidMagritteProperty >> presenterBuilder [

^ presenterBuilder
]

{ #category : 'visiting' }
PyramidMagritteProperty >> visitNumberDescription: aMANumberDescription [

| presenter |
presenter := PyramidNumberInputPresenter new.
presenter help: magritteDescription comment.
aMANumberDescription min ifNotNil: [
presenter min: aMANumberDescription min ].

^ presenter
]
27 changes: 22 additions & 5 deletions src/Pyramid/PyramidNumberInputPresenter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ Class {
#superclass : 'PyramidInputPresenter',
#instVars : [
'inputNumber',
'submitBlock'
'submitBlock',
'min'
],
#category : 'Pyramid-specs-custom',
#package : 'Pyramid',
Expand All @@ -30,7 +31,16 @@ PyramidNumberInputPresenter >> defaultLayout [
{ #category : 'as yet unclassified' }
PyramidNumberInputPresenter >> getNumberFrom: aString [

^ NumberParser parse: aString onError: [ PyramidUnknowState new ]
| number |
number := (NumberParser parse: aString onError: [ PyramidUnknowState new ]).
min ifNotNil: [ ^ number max: min ].
^ number
]

{ #category : 'as yet unclassified' }
PyramidNumberInputPresenter >> help: aString [

self inputNumber help: aString
]

{ #category : 'initialization - deprecated' }
Expand All @@ -42,14 +52,21 @@ PyramidNumberInputPresenter >> initializePresenters [

{ #category : 'accessing' }
PyramidNumberInputPresenter >> inputNumber [
^ inputNumber

^ inputNumber
]

{ #category : 'accessing' }
PyramidNumberInputPresenter >> min: anInteger [

min := anInteger
]

{ #category : 'accessing' }
PyramidNumberInputPresenter >> submitBlock [

submitBlock ifNil: [ submitBlock := [ :n | ] ].
^ submitBlock
submitBlock ifNil: [ submitBlock := [ :n | ] ].
^ submitBlock
]

{ #category : 'accessing' }
Expand Down
4 changes: 1 addition & 3 deletions src/Pyramid/PyramidPopingPresenterBuilder.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,5 @@ PyramidPopingPresenterBuilder >> layoutForLabel: aString input: anInput button:
{ #category : 'as yet unclassified' }
PyramidPopingPresenterBuilder >> makeNewInput [

^ self property pyramidInputPresenterClass new
strings: self property pyramidInputPresenterStrings;
yourself
^ self property makeNewInput
]
8 changes: 8 additions & 0 deletions src/Pyramid/PyramidProperty.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,14 @@ PyramidProperty >> initialize [
name := 'Default property name'
]

{ #category : 'tests' }
PyramidProperty >> makeNewInput [

^ self pyramidInputPresenterClass new
strings: self pyramidInputPresenterStrings;
yourself
]

{ #category : 'accessing' }
PyramidProperty >> name [

Expand Down
Loading