Skip to content

Commit

Permalink
Merge pull request #4 from OpenSmock/project-setup
Browse files Browse the repository at this point in the history
Project setup
  • Loading branch information
Nyan11 authored Jul 22, 2024
2 parents 52856aa + fa11cb4 commit 08efb97
Show file tree
Hide file tree
Showing 26 changed files with 284 additions and 126 deletions.
5 changes: 1 addition & 4 deletions .smalltalk.ston
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,5 @@ SmalltalkCISpec {
#directory : 'src',
#platforms : [ #pharo ]
}
],
#testing : {
#packages : [ 'Toplo-Serialization.*' ]
}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,24 +12,29 @@ BaselineOfToploSerialization >> baseline: spec [
self dependency: spec.

"project packages"
self dependency: spec.

"project packages"
spec package: 'Toplo-Serialization-STON'.
spec package: 'Toplo-Serialization-Stash'.
spec package: 'Toplo-Serialization' with: [
spec requires:
#( 'Toplo' 'BlocSerialization' 'Toplo-Serialization-STON'
'Toplo-Serialization-Stash' ) ].
spec
package: 'Toplo-Serialization'
]
package: 'Toplo-Serialization-Tests'
with: [ spec requires: #( 'Toplo-Serialization' ) ] ]
]

{ #category : #baselines }
BaselineOfToploSerialization >> dependency: spec [

spec
baseline: 'Ston'
with: [ spec repository: 'github://svenvc/ston/repository' ].

spec
baseline: #BlocSerialization
with: [
spec repository: 'github://OpenSmock/Bloc-Serialization:main/src' ].

spec baseline: 'Toplo' with: [ spec repository: 'github://pharo-graphics/Toplo:master/src' ].


spec
baseline: 'Toplo'
with: [ spec repository: 'github://pharo-graphics/Toplo:dev/src' ]
]
40 changes: 40 additions & 0 deletions src/Toplo-Serialization-STON/ToButton.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
Extension { #name : #ToButton }

{ #category : #'*Toplo-Serialization-STON' }
ToButton >> stonPostReferenceResolution [

super stonPostReferenceResolution.

"LabeledIcon"
self userData at: #stonLabeledIcon ifPresent: [ :anElement |
(self class slotNamed: #labeledIcon) write: anElement to: self.
self addChild: anElement.
self userData removeKey: #stonLabeledIcon ].

"Checkable"
self userData at: #stonIsCheckable ifAbsent: [ ^ self ].
self beCheckable.
self userData at: #stonChecked ifPresent: [ :aCheckValue |
self checked: aCheckValue.
self userData removeKey: #stonChecked ].
self userData at: #stonGroup ifPresent: [ :aGroup |
aGroup register: self.
self userData removeKey: #stonGroup ]
]

{ #category : #'*Toplo-Serialization-STON' }
ToButton >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.

"LabeledIcon"
(self class usesTrait: TToElementWithLabeledIcon) ifTrue: [
aIdentityDictionary at: #stonLabeledIcon put: self labeledIcon ].

"Checkable"
self isCheckable ifFalse: [ ^ self ].
aIdentityDictionary at: #stonIsCheckable put: self isCheckable.
aIdentityDictionary at: #stonChecked put: self isChecked.
self group ifNotNil: [
aIdentityDictionary at: #stonGroup put: self group ]
]
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
Extension { #name : #ToCheckableGroup }

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToCheckableGroup >> fromSton: stonReader [

stonReader parseMapDo: [ :key :value |
key = #checkingStrategy ifTrue: [ self checkingStrategy: value ] ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToCheckableGroup >> stonOn: stonWriter [

stonWriter writeObject: self streamMap: [ :dictionary |
dictionary
at: #checkingStrategy put: self checkingStrategy ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToCheckableGroup >> stonProcessSubObjects: block [

self
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,22 @@
Extension { #name : #ToCheckbox }

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToCheckbox >> stonPostReferenceResolution [

super stonPostReferenceResolution.
self userData at: #stonChecked ifPresent: [ :aCheckValue |
self checked: aCheckValue.
self userData removeKey: #stonChecked ].
self userData at: #stonGroup ifPresent: [ :aGroup |
aGroup add: self.
aGroup register: self.
self userData removeKey: #stonGroup ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToCheckbox >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.
aIdentityDictionary at: #stonChecked put: self checked.
self group ifNotNil: [ aIdentityDictionary at: #stonGroup put: self group. ]
self group ifNotNil: [
aIdentityDictionary at: #stonGroup put: self group ]
]
34 changes: 34 additions & 0 deletions src/Toplo-Serialization-STON/ToElement.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
Extension { #name : #ToElement }

{ #category : #'*Toplo-Serialization-STON' }
ToElement >> stonPostReferenceResolution [

super stonPostReferenceResolution.
self userData at: #tooltipContent ifPresent: [ :anElement |
self tooltipContent: anElement.
self userData removeKey: #tooltipContent ].
]

{ #category : #'*Toplo-Serialization-STON' }
ToElement >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.
"TToEnableable"
self userData
at: #enabled
ifPresent: [ :id | aIdentityDictionary at: #enabled put: id ].

"TToElementWithTooltip"
self hasTooltip ifTrue: [
aIdentityDictionary
at: #tooltipContent
put: (self rawTooltipWindowManager builder asContext tempAt: 3).
self userData at: #tooltipPopupDelay ifPresent: [ :aDuration |
aIdentityDictionary at: #tooltipPopupDelay put: aDuration ].
self userData
at: #closeTooltipWindowOnMouseLeave
ifPresent: [ :aBoolean |
aIdentityDictionary
at: #closeTooltipWindowOnMouseLeave
put: aBoolean ] ]
]
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ToImage }

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToImage >> stonPostReferenceResolution [

super stonPostReferenceResolution.
Expand All @@ -9,7 +9,7 @@ ToImage >> stonPostReferenceResolution [
self userData removeKey: #stonInnerImage ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToImage >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ToLabel }

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToLabel >> stonPostReferenceResolution [

super stonPostReferenceResolution.
Expand All @@ -9,7 +9,7 @@ ToLabel >> stonPostReferenceResolution [
self userData removeKey: #stonToLabelText ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToLabel >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Extension { #name : #ToLabeledIcon }

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToLabeledIcon >> stonPostReferenceResolution [

super stonPostReferenceResolution.
Expand All @@ -12,7 +12,7 @@ ToLabeledIcon >> stonPostReferenceResolution [
self userData removeKey: #stonToImage ]
]

{ #category : #'*Toplo-Serialization' }
{ #category : #'*Toplo-Serialization-STON' }
ToLabeledIcon >> stonUserDataOn: aIdentityDictionary [

super stonUserDataOn: aIdentityDictionary.
Expand Down
1 change: 1 addition & 0 deletions src/Toplo-Serialization-STON/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Toplo-Serialization-STON' }
30 changes: 30 additions & 0 deletions src/Toplo-Serialization-Stash/BlElement.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Extension { #name : #BlElement }

{ #category : #'*Toplo-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashAllStamps [

<stashAccessors>
self allStamps isEmpty ifTrue: [ ^ { } ].
^ self toStyleStore stampIndex allProperties collect: [ :assoc | | setter getter |
setter := [ :element | 'addStamp: <1p> withValue:' expandMacrosWith: assoc value name ].
getter := [ :element | assoc value value ].
setter -> getter
]


]

{ #category : #'*Toplo-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashAllTokens [

<stashAccessors>
self ensuredToStyleStore.
self toStyleStore tokenPropertyIndex isEmpty ifTrue: [ ^ { } ].
^ self toStyleStore tokenPropertyIndex allProperties collect: [ :assoc | | setter getter |
setter := [ :element | 'addTokenNamed: <1p> withValue:' expandMacrosWith: assoc value name ].
getter := [ :element | assoc value value ].
setter -> getter
]


]
12 changes: 12 additions & 0 deletions src/Toplo-Serialization-Stash/TToCheckable.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Extension { #name : #TToCheckable }

{ #category : #'*Toplo-Serialization-Stash' }
TToCheckable >> allSetterAndGettersOfTraitForMyStash: aToElement [

| settersAndGetters |
self isCheckable ifFalse: [ ^ { } ].
settersAndGetters := OrderedCollection new.
settersAndGetters add: #checked.
settersAndGetters add: #group.
^ settersAndGetters
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
Extension { #name : #TToElementWithLabeledIcon }

{ #category : #'*Toplo-Serialization-Stash' }
TToElementWithLabeledIcon >> allSetterAndGettersOfTraitForMyStash: aToElement [

| settersAndGetters |
settersAndGetters := OrderedCollection new.
aToElement isStartToEnd ifTrue: [ settersAndGetters add: (#beStartToEnd -> nil) onlySetOnStash ].
aToElement isEndToStart ifTrue: [ settersAndGetters add: (#beEndToStart -> nil) onlySetOnStash ].

aToElement isVertical ifTrue: [ settersAndGetters add: (#isVertical -> nil) onlySetOnStash ].
aToElement isHorizontal ifTrue: [ settersAndGetters add: (#isHorizontal -> nil) onlySetOnStash ].

settersAndGetters add: #endAlignment.
settersAndGetters add: #endElement.
settersAndGetters add: #endInterspace.
settersAndGetters add: #flexible.
settersAndGetters add: #icon.
settersAndGetters add: #iconContainerHeight.
settersAndGetters add: #iconContainerWidth.
settersAndGetters add: #label.
settersAndGetters add: #startAlignment.
settersAndGetters add: #startInterspace.
^ settersAndGetters
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #TToElementWithTooltip }

{ #category : #'*Toplo-Serialization-Stash' }
TToElementWithTooltip >> allSetterAndGettersOfTraitForMyStash: aToElement [

self hasTooltip ifFalse: [ ^ { } ].
^ { #tooltipBuilder. #closeTooltipWindowOnMouseLeave . #tooltipPopupDelay }
]
8 changes: 8 additions & 0 deletions src/Toplo-Serialization-Stash/TToEnableable.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #TToEnableable }

{ #category : #'*Toplo-Serialization-Stash' }
TToEnableable >> allSetterAndGettersOfTraitForMyStash: aToElement [

aToElement isEnabled ifTrue: [ ^ { } ].
^ { #enabled: -> #isEnabled }
]
9 changes: 9 additions & 0 deletions src/Toplo-Serialization-Stash/ToButton.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
Extension { #name : #ToButton }

{ #category : #'*Toplo-Serialization-Stash' }
ToButton >> stashToButtonCheckable [

<stashAccessors>
self isCheckable ifFalse: [ ^ { } ].
^ { (#beCheckable -> self) onlySetOnStash }
]
8 changes: 8 additions & 0 deletions src/Toplo-Serialization-Stash/ToCheckableGroup.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #ToCheckableGroup }

{ #category : #'*Toplo-Serialization-Stash' }
ToCheckableGroup >> stashAccessorsForCheckableGroup [

<stashAccessors>
^ { #registerAll: -> #registeredCheckables }
]
8 changes: 8 additions & 0 deletions src/Toplo-Serialization-Stash/ToImage.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #ToImage }

{ #category : #'*Toplo-Serialization-Stash' }
ToImage >> stashAccessorsForInnerImage [

<stashAccessors>
^ { #innerImage }
]
8 changes: 8 additions & 0 deletions src/Toplo-Serialization-Stash/ToLabel.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #ToLabel }

{ #category : #'*Toplo-Serialization-Stash' }
ToLabel >> stashAccessorsForText [

<stashAccessors>
^ { #text }
]
10 changes: 10 additions & 0 deletions src/Toplo-Serialization-Stash/ToObservableCollection.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Extension { #name : #ToObservableCollection }

{ #category : #'*Toplo-Serialization-Stash' }
ToObservableCollection >> asStashObject [

^ StashCollection new
object: collection;
classType: collection class;
yourself
]
1 change: 1 addition & 0 deletions src/Toplo-Serialization-Stash/package.st
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Package { #name : #'Toplo-Serialization-Stash' }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Class {
#name : #ToElementWithLeafForTesting,
#superclass : #ToElement,
#category : #'Toplo-Serialization-cases-test'
#category : #'Toplo-Serialization-Tests'
}
Loading

0 comments on commit 08efb97

Please sign in to comment.