Skip to content

Commit

Permalink
Better inputs for visibility and geometry
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyan11 committed Aug 2, 2024
1 parent 74da2f7 commit dba6d1b
Show file tree
Hide file tree
Showing 12 changed files with 534 additions and 263 deletions.
27 changes: 27 additions & 0 deletions src/Pyramid-Bloc/BlBezierCurveGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
Extension { #name : #BlBezierCurveGeometry }

{ #category : #'*Pyramid-Bloc' }
BlBezierCurveGeometry class >> asIcon [

^ super asIcon copy: (0 @ 12 extent: 16 @ 12)
]

{ #category : #'*Pyramid-Bloc' }
BlBezierCurveGeometry class >> pyramidDefaultValue [

^ self controlPoints: {
(0 @ 0).
(0 @ 75).
(50 @ -25).
(50 @ 50) }
]

{ #category : #'*Pyramid-Bloc' }
BlBezierCurveGeometry class >> pyramidDefaultValueForIcon [

^ self controlPoints: {
(0 @ 0).
(0 @ 24).
(16 @ -12).
(16 @ 12) }
]
41 changes: 41 additions & 0 deletions src/Pyramid-Bloc/BlElementGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
Extension { #name : #BlElementGeometry }

{ #category : #'*Pyramid-Bloc' }
BlElementGeometry class >> asIcon [

| element |
element := BlElement new
size: 16 @ 12;
background: (Color gray: 0.75);
border: (BlBorder paint: Color black width: 1);
geometry: self pyramidDefaultValueForIcon;
yourself.
^ element exportAsForm
]

{ #category : #'*Pyramid-Bloc' }
BlElementGeometry class >> asPyramidMagicButton [

^ PyramidMagicButtonModel new
icon: self asIcon;
helpSelected:
('The geometry is <1s>.' expandMacrosWith: self name);
helpNotSelected:
('Set the geometry to <1s>.' expandMacrosWith: self name);
label: '';
inputValue: self pyramidDefaultValue;
inputValidation: [ :value | value isKindOf: self ];
yourself
]

{ #category : #'*Pyramid-Bloc' }
BlElementGeometry class >> pyramidDefaultValue [

^ self new
]

{ #category : #'*Pyramid-Bloc' }
BlElementGeometry class >> pyramidDefaultValueForIcon [

^ self pyramidDefaultValue
]
13 changes: 13 additions & 0 deletions src/Pyramid-Bloc/BlLineGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Extension { #name : #BlLineGeometry }

{ #category : #'*Pyramid-Bloc' }
BlLineGeometry class >> pyramidDefaultValue [

^ self from: 0 asPoint to: 50 asPoint
]

{ #category : #'*Pyramid-Bloc' }
BlLineGeometry class >> pyramidDefaultValueForIcon [

^ self from: 0 asPoint to: 12 asPoint
]
19 changes: 19 additions & 0 deletions src/Pyramid-Bloc/BlPolygonGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
Extension { #name : #BlPolygonGeometry }

{ #category : #'*Pyramid-Bloc' }
BlPolygonGeometry class >> pyramidDefaultValue [

^ self vertices: {
(0 @ 50).
(0 @ 0).
(25 @ 25).
(50 @ 0).
(50 @ 50) }
]

{ #category : #'*Pyramid-Bloc' }
BlPolygonGeometry class >> pyramidDefaultValueForIcon [

^ self vertices:
(self pyramidDefaultValue vertices collect: [ :each | each / 4.2 ])
]
18 changes: 18 additions & 0 deletions src/Pyramid-Bloc/BlPolylineGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
Extension { #name : #BlPolylineGeometry }

{ #category : #'*Pyramid-Bloc' }
BlPolylineGeometry class >> pyramidDefaultValue [

^ self vertices: {
(0 @ 50).
(0 @ 0).
(25 @ 25).
(50 @ 0).
(50 @ 50) }
]

{ #category : #'*Pyramid-Bloc' }
BlPolylineGeometry class >> pyramidDefaultValueForIcon [

^ self vertices: (self pyramidDefaultValue vertices collect: [ :each | each / 4.2 ])
]
7 changes: 7 additions & 0 deletions src/Pyramid-Bloc/BlRoundedRectangleGeometry.extension.st
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Extension { #name : #BlRoundedRectangleGeometry }

{ #category : #'*Pyramid-Bloc' }
BlRoundedRectangleGeometry class >> pyramidDefaultValue [

^ self cornerRadius: 8
]
22 changes: 20 additions & 2 deletions src/Pyramid-Bloc/BlVisibility.extension.st
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,20 @@ Extension { #name : #BlVisibility }

{ #category : #'*Pyramid-Bloc' }
BlVisibility >> asIcon [
"return a 16 by 16 `Form`"
^ self shouldBeImplemented

| bloc target |
bloc := self class blocIcon.
target := bloc isCollection
ifTrue: [
BlElement new
layout: BlFrameLayout new;
constraintsDo: [ :c |
c horizontal fitContent.
c vertical fitContent ];
addChildren: bloc;
yourself ]
ifFalse: [ bloc ].
^ target exportAsForm
]

{ #category : #'*Pyramid-Bloc' }
Expand All @@ -13,6 +25,12 @@ BlVisibility >> asString [
^ self shouldBeImplemented
]

{ #category : #'*Pyramid-Bloc' }
BlVisibility class >> blocIcon [

^ self shouldBeImplemented
]

{ #category : #'*Pyramid-Bloc' }
BlVisibility >> nextVisibilityForTree [
"return the next visibility.
Expand Down
111 changes: 105 additions & 6 deletions src/Pyramid-Bloc/BlVisibilityGone.extension.st
Original file line number Diff line number Diff line change
@@ -1,17 +1,116 @@
Extension { #name : #BlVisibilityGone }

{ #category : #'*Pyramid-Bloc' }
BlVisibilityGone >> asIcon [
BlVisibilityGone >> asString [

^ PyramidBlocPlugin
iconOf: PyramidBlocPlugin blocVisibilityGone
maxHeight: 12
^ 'gone'
]

{ #category : #'*Pyramid-Bloc' }
BlVisibilityGone >> asString [
BlVisibilityGone class >> blocIcon [
"This class has been generated using Pyramid.
^ 'gone'
By: YannLEGOFF
2024-08-02 09:26:40"

<pyStash>
^ [
| blinsets1 |
blinsets1 := BlInsets
top: 0.0
right: 2.0
bottom: 0.0
left: 0.0.
{ (BlElement new
geometry: BlRectangleGeometry new;
constraintsDo: [ :constraints |
constraints horizontal exact: 24.0.
constraints vertical exact: 12.0 ];
layout: BlLinearLayout horizontal;
addChildren: {
(BlElement new
background: (BlPaintBackground new
paint: (BlColorPaint new
color: (Color
r: 0.5728250244379277
g: 0.8191593352883676
b: 1.0
alpha: 1.0);
yourself);
opacity: 1.0;
yourself);
border: (BlBorderBuilder new
paint: (BlColorPaint new
color: (Color
r: 0.0
g: 0.0
b: 0.0
alpha: 1.0);
yourself);
build);
geometry: BlRectangleGeometry new;
constraintsDo: [ :constraints |
constraints horizontal matchParent.
constraints vertical matchParent.
constraints margin: blinsets1 ];
id: #B;
yourself).
(BlElement new
background: (BlPaintBackground new
paint: (BlColorPaint new
color: (Color
r: 0.5728250244379277
g: 0.8191593352883676
b: 1.0
alpha: 1.0);
yourself);
opacity: 1.0;
yourself);
border: (BlBorderBuilder new
paint: (BlColorPaint new
color: (Color
r: 0.0
g: 0.0
b: 0.0
alpha: 1.0);
yourself);
build);
geometry: BlRectangleGeometry new;
constraintsDo: [ :constraints |
constraints horizontal matchParent.
constraints vertical matchParent.
constraints margin: blinsets1 ];
id: #C;
yourself).
(BlElement new
background: (BlPaintBackground new
paint: (BlColorPaint new
color: (Color
r: 0.5728250244379277
g: 0.8191593352883676
b: 1.0
alpha: 1.0);
yourself);
opacity: 1.0;
yourself);
border: (BlBorderBuilder new
paint: (BlColorPaint new
color: (Color
r: 0.0
g: 0.0
b: 0.0
alpha: 1.0);
yourself);
build);
geometry: BlRectangleGeometry new;
visibility: BlVisibility hidden;
constraintsDo: [ :constraints |
constraints horizontal matchParent.
constraints vertical matchParent ];
id: #D;
yourself) };
id: #A;
yourself) } ] value
]

{ #category : #'*Pyramid-Bloc' }
Expand Down
Loading

0 comments on commit dba6d1b

Please sign in to comment.