Skip to content

Commit

Permalink
Merge pull request #22 from OpenSmock/project-setup
Browse files Browse the repository at this point in the history
Add stash package
  • Loading branch information
Nyan11 authored Jul 22, 2024
2 parents 09a182b + 91977f4 commit aa017cb
Show file tree
Hide file tree
Showing 124 changed files with 5,233 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,31 @@ BaselineOfBlocSerialization >> baseline: spec [

<baseline>
spec for: #common do: [ "dependencies"
spec
baseline: 'Ston'
with: [ spec repository: 'github://svenvc/ston/repository' ].

spec
baseline: 'StashSerialization'
with: [ spec repository: 'github://Nyan11/Stash/src' ].

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

self dependency: spec.

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

{ #category : #accessing }
BaselineOfBlocSerialization >> dependency: spec [

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

spec
baseline: 'StashSerialization'
with: [ spec repository: 'github://Nyan11/Stash/src' ].

spec
baseline: 'Bloc'
with: [ spec repository: 'github://pharo-graphics/Bloc:master/src' ].
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineCompositeTransformation }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineCompositeTransformation >> allSetterAndGettersForMyStash [

^ self transformations flatCollect: [ :each | each allSetterAndGettersForMyStash ]
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineTransformationCenterOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationCenterOrigin >> asStashMethodForTransformationBloc [

^ #centerOrigin
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineTransformationLeftCenterOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationLeftCenterOrigin >> asStashMethodForTransformationBloc [

^ 'origin: <1s> new' expandMacrosWith: self class printString.
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineTransformationNormalizedPositionOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationNormalizedPositionOrigin >> asStashMethodForTransformationBloc [

^ 'normalizedOrigin: <1p> @ <2p>' expandMacrosWith: self position x with: self position y
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineTransformationPositionOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationPositionOrigin >> asStashMethodForTransformationBloc [

^ 'origin: (<1s> new position: <2s> @ <3s>; yourself)' expandMacrosWith: self class printString with: self position x with: self position y
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlAffineTransformationRightCenterOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationRightCenterOrigin >> asStashMethodForTransformationBloc [

^ #rightCenterOrigin
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Extension { #name : #BlAffineTransformationTopLeftOrigin }

{ #category : #'*Bloc-Serialization-Stash' }
BlAffineTransformationTopLeftOrigin >> asStashMethodForTransformationBloc [
^ #topLeftOrigin
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #BlAnnulusSectorGeometry }

{ #category : #'*Bloc-Serialization-Stash' }
BlAnnulusSectorGeometry >> stashAccessors [

<stashAccessors>
^ {#startAngle .#endAngle .#innerRadius .#outerRadius}
]
26 changes: 26 additions & 0 deletions src/Bloc-Serialization-Stash/BlAttributeRope.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
Extension { #name : #BlAttributeRope }

{ #category : #'*Bloc-Serialization-Stash' }
BlAttributeRope >> asStashContructor [

^ self class printString
]

{ #category : #'*Bloc-Serialization-Stash' }
BlAttributeRope >> asStashObject [

^ StashBlAttributeRope new
object: self;
rope: self rope;
attributes: self attributes;
yourself
]

{ #category : #'*Bloc-Serialization-Stash' }
BlAttributeRope >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlBackground >> stashBackgroundOpacity [

<stashAccessors>
^ { (#opacity) }
]
13 changes: 13 additions & 0 deletions src/Bloc-Serialization-Stash/BlBasicLayout.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Extension { #name : #BlBasicLayout }

{ #category : #'*Bloc-Serialization-Stash' }
BlBasicLayout >> asStashContructor [

^ 'BlBasicLayout uniqueInstance'
]

{ #category : #'*Bloc-Serialization-Stash' }
BlBasicLayout >> shouldBeTagged [

^ false
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #BlBezierCurveGeometry }

{ #category : #'*Bloc-Serialization-Stash' }
BlBezierCurveGeometry >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlBorder >> asStashObject [

^ StashObjectWithBuilder new
builder: BlBorderBuilder new;
methodToBuild: #build;
object: self;
yourself
]

{ #category : #'*Bloc-Serialization-Stash' }
BlBorder >> stashAccessors [

<stashAccessors>
| defaults settersAndGetters |
settersAndGetters := OrderedCollection new.
defaults := BlBorderBuilder new.
self paint = defaults defaultPaint ifFalse: [
settersAndGetters add: #paint ].
self width = defaults defaultWidth ifFalse: [
settersAndGetters add: #width ].
self style lineCap = defaults defaultLineCap ifFalse: [
settersAndGetters add:
#lineCap: -> [ :border | border style lineCap ] ].
self style lineJoin = defaults defaultLineJoin ifFalse: [
settersAndGetters add: #lineJoin: ->
[ :border | border style lineJoin ] ].
self style miterLimit = defaults defaultMiterLimit ifFalse: [
settersAndGetters add:
#miterLimit: -> [ :border | border style miterLimit ] ].
self style dashArray = defaults defaultDashArray ifFalse: [
settersAndGetters add:
#dashArray: -> [ :border | border style dashArray ] ].
self style dashOffset = defaults defaultDashOffset ifFalse: [
settersAndGetters add:
#dashOffset: -> [ :border | border style dashOffset ] ].
self opacity = defaults defaultOpacity ifFalse: [
settersAndGetters add: #opacity ].

^ settersAndGetters
]
7 changes: 7 additions & 0 deletions src/Bloc-Serialization-Stash/BlBottomAlignment.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlBottomAlignment }

{ #category : #'*Bloc-Serialization-Stash' }
BlBottomAlignment >> asStashSelector [

^ #alignBottom
]
8 changes: 8 additions & 0 deletions src/Bloc-Serialization-Stash/BlCollectionRope.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #BlCollectionRope }

{ #category : #'*Bloc-Serialization-Stash' }
BlCollectionRope >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlColorPaint >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlCornerRadii >> stashAccessors [

<stashAccessors>
^ { #topLeft .#topRight .#bottomLeft .#bottomRight }
]
90 changes: 90 additions & 0 deletions src/Bloc-Serialization-Stash/BlElement.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
Extension { #name : #BlElement }

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashChildren [

<stashAccessors>
self shouldSerializedChildren ifFalse: [ ^ { } ].
self children ifNotEmpty: [
^ { #addChildren: -> #children } ].
^ { }
]

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashConstraints [

<stashAccessors>
(constraints allSetterAndGettersForMyStash) ifNotEmpty: [
^ { #constraintsDo: -> #constraints } ].
^ { }
]

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashIdentifier [

<stashAccessors>
| elementId |
self userData at: #elementId ifAbsent: [ ^ { } ].
elementId := self userData at: #elementId.
elementId class = BlElementNoId ifTrue: [ ^ { } ].
elementId class = BlElementNamedId ifTrue: [ ^ { #id } ].
^ { #elementId }

]

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashLayout [

<stashAccessors>
self layout == self defaultLayout ifFalse: [
^ { #layout } ].
^ { }

]

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashTransformation [

<stashAccessors>
self transformation isIdentity ifFalse: [
^ { #transformDo: -> #transformation } ].
^ { }
]

{ #category : #'*Bloc-Serialization-Stash' }
BlElement >> allSetterAndGettersForMyStashVisuals [

<stashAccessors>
| settersAndGetters |
settersAndGetters := OrderedCollection new.
self background == BlElementVisuals defaultBackground ifFalse: [
settersAndGetters add: #background ].
self border == BlElementVisuals defaultBorder ifFalse: [
settersAndGetters add: #border ].
self geometry == BlElementVisuals defaultGeometry ifFalse: [
settersAndGetters add: #geometry ].
self effect == (BlElementVisuals classPool at: #DefaultEffect)
ifFalse: [ settersAndGetters add: #effect ].
self opacity == (BlElementVisuals classPool at: #DefaultOpacity)
ifFalse: [ settersAndGetters add: #opacity ].
self visibility
== (BlElementVisuals classPool at: #DefaultVisibility) ifFalse: [
settersAndGetters add: #visibility ].
self outskirts == (BlElementVisuals classPool at: #DefaultOutskirts)
ifFalse: [ settersAndGetters add: #outskirts ].
self clipChildren
== (BlElementVisuals classPool at: #DefaultClipChildren) ifFalse: [
settersAndGetters add: #clipChildren ].
self focusability
== (BlElementVisuals classPool at: #DefaultFocusability) ifFalse: [
settersAndGetters add: #focusability ].
self elevation == (BlElementVisuals classPool at: #DefaultElevation)
ifFalse: [ settersAndGetters add: #elevation ].
self focused == (BlElementVisuals classPool at: #DefaultFocused)
ifFalse: [ settersAndGetters add: #focused ].
self mouseCursor
== (BlElementVisuals classPool at: #DefaultMouseCursor) ifFalse: [
settersAndGetters add: #mouseCursor ].
^ settersAndGetters

]
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
Extension { #name : #BlElementCachedTransformation }

{ #category : #'*Bloc-Serialization-Stash' }
BlElementCachedTransformation >> asStashObject [

^ StashBlTransformation new
object: self;
yourself
]

{ #category : #'*Bloc-Serialization-Stash' }
BlElementCachedTransformation >> stashAccessors [

<stashAccessors>
^ self asElementTransformation allSetterAndGettersForMyStash
]
7 changes: 7 additions & 0 deletions src/Bloc-Serialization-Stash/BlElementGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlElementGeometry }

{ #category : #'*Bloc-Serialization-Stash' }
BlElementGeometry >> shouldBeTagged [

^ false
]
8 changes: 8 additions & 0 deletions src/Bloc-Serialization-Stash/BlElementIndexedId.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #BlElementIndexedId }

{ #category : #'*Bloc-Serialization-Stash' }
BlElementIndexedId >> stashAccessors [

<stashAccessors>
^ { #index . #prefixId }
]
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Extension { #name : #BlElementLocalTransformation }

{ #category : #'*Bloc-Serialization-Stash' }
BlElementLocalTransformation >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlElementNamedId >> stashAccessors [

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

{ #category : #'*Bloc-Serialization-Stash' }
BlElevation >> asStashContructor [

^ self class printString , ' elevation: ' , self elevation printString
]
Loading

0 comments on commit aa017cb

Please sign in to comment.