Skip to content

Commit 297e672

Browse files
Merge pull request #268 from OpenSmock/devStage_shadow
Dev stage shadow
2 parents b318155 + 1ea94f5 commit 297e672

63 files changed

Lines changed: 579 additions & 133 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Pyramid-Bloc/PyramidBackgroundBlocPlugin.class.st

Lines changed: 88 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -671,6 +671,86 @@ PyramidBackgroundBlocPlugin class >> outskirts [
671671
^ property
672672
]
673673

674+
{ #category : #accessing }
675+
PyramidBackgroundBlocPlugin class >> shadow [
676+
677+
| property |
678+
property := PyramidProperty new
679+
name: 'Shadow Effect';
680+
command: PyramidShadowCommand current;
681+
inputPresenterClass: PyramidMagicButtonsInputPresenter;
682+
yourself.
683+
property inputPresenterModel
684+
addButtonModel: (PyramidMagicButtonModel new
685+
icon: (Smalltalk ui icons iconNamed: #blank);
686+
helpSelected: 'No shadow.';
687+
helpNotSelected: 'Remove shadow.';
688+
label: 'None';
689+
inputValue: [ BlNullEffect new ];
690+
inputValidation: [ :value | value class = BlNullEffect ];
691+
yourself);
692+
addButtonModel: (PyramidMagicButtonModel new
693+
icon: (Smalltalk ui icons iconNamed: #windowMaximize);
694+
helpSelected: 'Shadow type is simple.';
695+
helpNotSelected: 'Set shadow type to simple.';
696+
label: 'Simple';
697+
inputValue: [ PyramidShadowCommand current lastSimpleShadow ];
698+
inputValidation: [ :value | value class = BlSimpleShadowEffect ];
699+
yourself);
700+
addButtonModel: (PyramidMagicButtonModel new
701+
icon: (Smalltalk ui icons iconNamed: #radioButtonUnselected);
702+
helpSelected: 'Shadow type is gaussian.';
703+
helpNotSelected: 'Set shadow type to gaussian.';
704+
label: 'Gaussian';
705+
inputValue: [ PyramidShadowCommand current lastGaussianShadow ];
706+
inputValidation: [ :value | value class = BlGaussianShadowEffect ];
707+
yourself).
708+
^ property
709+
]
710+
711+
{ #category : #accessing }
712+
PyramidBackgroundBlocPlugin class >> shadowColor [
713+
714+
| property |
715+
property := PyramidProperty new
716+
name: 'Shadow Color';
717+
command: PyramidShadowColorCommand new;
718+
inputPresenterClass:
719+
PyramidColorInputSingleLineWithPickupButtonPresenter;
720+
yourself.
721+
^ property
722+
723+
724+
]
725+
726+
{ #category : #accessing }
727+
PyramidBackgroundBlocPlugin class >> shadowOffset [
728+
729+
| property |
730+
property := PyramidProperty new
731+
name: 'Shadow Offset';
732+
command: PyramidShadowOffsetCommand new;
733+
inputPresenterClass:
734+
PyramidPointInputPresenter;
735+
yourself.
736+
property inputPresenterModel help:
737+
'Set the position x and y for the shadow offset'.
738+
^ property
739+
]
740+
741+
{ #category : #accessing }
742+
PyramidBackgroundBlocPlugin class >> shadowWidthGaussian [
743+
744+
| property |
745+
property := PyramidProperty new
746+
name: 'Shadow Width';
747+
command: PyramidShadowGaussianWidthCommand new;
748+
inputPresenterClass: PyramidNumberInputPresenter;
749+
yourself.
750+
property inputPresenterModel help: 'Set the width value'.
751+
^ property
752+
]
753+
674754
{ #category : #adding }
675755
PyramidBackgroundBlocPlugin >> addPanelsOn: aPyramidSimpleWindow [
676756

@@ -747,7 +827,14 @@ PyramidBackgroundBlocPlugin >> initialize [
747827
propertiesManager addProperty: self class borderRadialInnerCenter.
748828
propertiesManager addProperty: self class borderRadialInnerRadius.
749829
propertiesManager addProperty: self class borderRadialOuterCenter.
750-
propertiesManager addProperty: self class borderRadialOuterRadius
830+
propertiesManager addProperty: self class borderRadialOuterRadius.
831+
832+
"Shadow"
833+
PyramidShadowCommand resetShadowCommand.
834+
propertiesManager addProperty: self class shadow.
835+
propertiesManager addProperty: self class shadowColor.
836+
propertiesManager addProperty: self class shadowOffset.
837+
propertiesManager addProperty: self class shadowWidthGaussian
751838
]
752839

753840
{ #category : #adding }

src/Pyramid-Bloc/PyramidMoveChildInParentPlugin.class.st

Lines changed: 38 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -46,22 +46,21 @@ PyramidMoveChildInParentPlugin >> contextMenuMoveChildInParent: aBuilder [
4646

4747
aBuilder
4848
addGroupSingleSelection: [ :group :single |
49-
group
50-
addItem: [ :item |
51-
item
52-
icon: (Smalltalk ui icons iconNamed: #up);
53-
name: 'Move index child up';
54-
action: [ self moveChildIndexUpInParent ];
55-
yourself ];
56-
57-
addItem: [ :item |
58-
item
59-
icon: (Smalltalk ui icons iconNamed: #down);
60-
name: 'Move index child down';
61-
action: [ self moveChildIndexDownInParent ];
62-
yourself ];
63-
yourself ]
64-
order: 10.
49+
group
50+
addItem: [ :item |
51+
item
52+
icon: (Smalltalk ui icons iconNamed: #up);
53+
name: 'Move child up';
54+
action: [ self moveChildIndexDownInParent ];
55+
yourself ];
56+
addItem: [ :item |
57+
item
58+
icon: (Smalltalk ui icons iconNamed: #down);
59+
name: 'Move child down';
60+
action: [self moveChildIndexUpInParent];
61+
yourself ];
62+
yourself ]
63+
order: 10
6564
]
6665

6766
{ #category : #accessing }
@@ -91,28 +90,23 @@ PyramidMoveChildInParentPlugin >> moveChildIndexDownCommand: aBlElementParent wi
9190
PyramidMoveChildInParentPlugin >> moveChildIndexDownInParent [
9291

9392
| childToMoveCollection childToMove childIndexToMove parentChild navigationSelectionPanel |
94-
9593
childToMoveCollection := projectModel selection collection.
9694
navigationSelectionPanel := navigationPlugin navigation selectionPanel.
97-
98-
childToMoveCollection size = 1
99-
ifFalse: [ ^ self ].
95+
96+
childToMoveCollection size = 1 ifFalse: [ ^ self ].
10097
childToMove := childToMoveCollection first.
101-
102-
childToMove hasParent
103-
ifFalse: [ ^ self ].
98+
99+
childToMove hasParent ifFalse: [ ^ self ].
104100
parentChild := childToMove parent.
105-
106-
childIndexToMove := (parentChild childIndexOf: childToMove).
107-
108-
childIndexToMove > 1
109-
ifTrue: [ self moveChildIndexDownCommand: parentChild with: childToMove.
110-
self refreshTreeTable ]
111-
ifFalse: [ self inform: 'Cannot move down' ].
112101

113-
114-
102+
childIndexToMove := parentChild childIndexOf: childToMove.
115103

104+
childIndexToMove > 1
105+
ifTrue: [
106+
self moveChildIndexDownCommand: parentChild with: childToMove.
107+
self refreshTreeTable ]
108+
ifFalse: [ "cannot move the child up and the index down"
109+
self inform: 'Cannot move up' ]
116110
]
117111

118112
{ #category : #'as yet unclassified' }
@@ -129,27 +123,23 @@ PyramidMoveChildInParentPlugin >> moveChildIndexUpCommand: aBlElementParent with
129123
PyramidMoveChildInParentPlugin >> moveChildIndexUpInParent [
130124

131125
| childToMoveCollection childToMove childIndexToMove parentChild navigationSelectionPanel |
132-
133126
childToMoveCollection := projectModel selection collection.
134127
navigationSelectionPanel := navigationPlugin navigation selectionPanel.
135-
136-
childToMoveCollection size = 1
137-
ifFalse: [ ^ self ].
128+
129+
childToMoveCollection size = 1 ifFalse: [ ^ self ].
138130
childToMove := childToMoveCollection first.
139-
140-
childToMove hasParent
141-
ifFalse: [ ^ self ].
131+
132+
childToMove hasParent ifFalse: [ ^ self ].
142133
parentChild := childToMove parent.
143-
144-
childIndexToMove := (parentChild childIndexOf: childToMove).
145-
146-
childIndexToMove < (parentChild children size)
147-
ifTrue: [ self moveChildIndexUpCommand: parentChild with: childToMove.
148-
self refreshTreeTable ]
149-
ifFalse: [ self inform: 'Cannot move up' ].
150-
151-
152134

135+
childIndexToMove := parentChild childIndexOf: childToMove.
136+
137+
childIndexToMove < parentChild children size
138+
ifTrue: [
139+
self moveChildIndexUpCommand: parentChild with: childToMove.
140+
self refreshTreeTable ]
141+
ifFalse: [ "cannot move the child down and the index up"
142+
self inform: 'Cannot move down' ]
153143
]
154144

155145
{ #category : #accessing }
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Class {
2+
#name : #PyramidShadowColorCommand,
3+
#superclass : #PyramidAbstractBlocCommand,
4+
#category : #'Pyramid-Bloc-plugin-bloc-visuals'
5+
}
6+
7+
{ #category : #testing }
8+
PyramidShadowColorCommand >> canBeUsedFor: anObject [
9+
10+
^ (super canBeUsedFor: anObject) and: [
11+
anObject effect class = BlSimpleShadowEffect or: [
12+
anObject effect class = BlGaussianShadowEffect ] ]
13+
]
14+
15+
{ #category : #accessing }
16+
PyramidShadowColorCommand >> getValueFor: aBlElement [
17+
18+
(aBlElement effect class = BlSimpleShadowEffect or: [
19+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
20+
^ aBlElement effect color
21+
]
22+
23+
{ #category : #accessing }
24+
PyramidShadowColorCommand >> setValueFor: aBlElement with: aColor [
25+
26+
(aBlElement effect class = BlSimpleShadowEffect or: [
27+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
28+
aBlElement effect: (aBlElement effect copyWithColor: aColor).
29+
PyramidShadowCommand current syncFromElement: aBlElement
30+
]
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
Class {
2+
#name : #PyramidShadowCommand,
3+
#superclass : #PyramidAbstractBlocCommand,
4+
#instVars : [
5+
'lastSimpleShadow',
6+
'lastGaussianShadow'
7+
],
8+
#classInstVars : [
9+
'current'
10+
],
11+
#category : #'Pyramid-Bloc-plugin-bloc-visuals'
12+
}
13+
14+
{ #category : #accessing }
15+
PyramidShadowCommand class >> current [
16+
current ifNil: [ current := self new ].
17+
^ current
18+
]
19+
20+
{ #category : #accessing }
21+
PyramidShadowCommand class >> resetShadowCommand [
22+
23+
current := nil
24+
]
25+
26+
{ #category : #accessing }
27+
PyramidShadowCommand >> getValueFor: aBlElement [
28+
29+
^ aBlElement effect
30+
]
31+
32+
{ #category : #accessing }
33+
PyramidShadowCommand >> lastGaussianShadow [
34+
^ lastGaussianShadow ifNil: [ BlGaussianShadowEffect color: Color black width: 2 offset: 2 @ 2 ]
35+
]
36+
37+
{ #category : #accessing }
38+
PyramidShadowCommand >> lastSimpleShadow [
39+
40+
^ lastSimpleShadow ifNil: [
41+
BlSimpleShadowEffect color: Color black offset: 2 @ 2 ]
42+
]
43+
44+
{ #category : #accessing }
45+
PyramidShadowCommand >> setValueFor: aBlElement with: anArgument [
46+
47+
anArgument class = BlSimpleShadowEffect ifTrue: [
48+
lastSimpleShadow := anArgument ].
49+
anArgument class = BlGaussianShadowEffect ifTrue: [
50+
lastGaussianShadow := anArgument ].
51+
aBlElement effect: anArgument
52+
]
53+
54+
{ #category : #updating }
55+
PyramidShadowCommand >> syncFromElement: aBlElement [
56+
57+
aBlElement effect class = BlSimpleShadowEffect ifTrue: [
58+
lastSimpleShadow := aBlElement effect ].
59+
aBlElement effect class = BlGaussianShadowEffect ifTrue: [
60+
lastGaussianShadow := aBlElement effect ]
61+
]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Class {
2+
#name : #PyramidShadowGaussianWidthCommand,
3+
#superclass : #PyramidAbstractBlocCommand,
4+
#category : #'Pyramid-Bloc-plugin-bloc-visuals'
5+
}
6+
7+
{ #category : #testing }
8+
PyramidShadowGaussianWidthCommand >> canBeUsedFor: anObject [
9+
10+
^ (super canBeUsedFor: anObject) and: [
11+
anObject effect class = BlGaussianShadowEffect ]
12+
]
13+
14+
{ #category : #accessing }
15+
PyramidShadowGaussianWidthCommand >> getValueFor: aBlElement [
16+
17+
(aBlElement effect class = BlSimpleShadowEffect or: [
18+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
19+
^ aBlElement effect width
20+
]
21+
22+
{ #category : #accessing }
23+
PyramidShadowGaussianWidthCommand >> setValueFor: aBlElement with: aWidth [
24+
25+
(aBlElement effect class = BlSimpleShadowEffect or: [
26+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
27+
aBlElement effect: (aBlElement effect copyWithWidth: aWidth).
28+
PyramidShadowCommand current syncFromElement: aBlElement
29+
]
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
Class {
2+
#name : #PyramidShadowOffsetCommand,
3+
#superclass : #PyramidAbstractBlocCommand,
4+
#category : #'Pyramid-Bloc-plugin-bloc-visuals'
5+
}
6+
7+
{ #category : #testing }
8+
PyramidShadowOffsetCommand >> canBeUsedFor: anObject [
9+
10+
^ (super canBeUsedFor: anObject) and: [
11+
anObject effect class = BlSimpleShadowEffect or: [anObject effect class = BlGaussianShadowEffect] ]
12+
]
13+
14+
{ #category : #accessing }
15+
PyramidShadowOffsetCommand >> getValueFor: aBlElement [
16+
17+
(aBlElement effect class = BlSimpleShadowEffect or: [
18+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
19+
^ aBlElement effect offset
20+
]
21+
22+
{ #category : #accessing }
23+
PyramidShadowOffsetCommand >> setValueFor: aBlElement with: aPoint [
24+
25+
(aBlElement effect class = BlSimpleShadowEffect or: [
26+
aBlElement effect class = BlGaussianShadowEffect ]) ifFalse: [ ^ nil ].
27+
aBlElement effect: (aBlElement effect copyWithOffset: aPoint).
28+
PyramidShadowCommand current syncFromElement: aBlElement
29+
]

src/Pyramid-Tests/PyramidAddChildCommandTest.class.st

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ PyramidAddChildCommandTest >> command [
1212
^ PyramidAddChildCommand new
1313
]
1414

15-
{ #category : #'as yet unclassified' }
15+
{ #category : #accessing }
1616
PyramidAddChildCommandTest >> targetsCanBeUsedFor [
1717

1818
^ { BlElement new . BlElement new addChild: BlElement new; yourself }

0 commit comments

Comments
 (0)