-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPyramidBlocPlugin.class.st
More file actions
267 lines (225 loc) · 7.31 KB
/
PyramidBlocPlugin.class.st
File metadata and controls
267 lines (225 loc) · 7.31 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
Class {
#name : #PyramidBlocPlugin,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'editor',
'groupCommand',
'propertiesManager'
],
#category : #'Pyramid-Bloc-plugin-bloc'
}
{ #category : #accessing }
PyramidBlocPlugin class >> clipChildren [
| property |
property := PyramidProperty new
name: 'Clip Children';
command: PyramidClipChildrenCommand new;
inputPresenterClass: PyramidSwitchInputPresenter;
yourself.
property inputPresenterModel help:
'If clipChildren is true, the children will not display outside the geometry of the parent element. If clipChildren is false, the children will display outside the geometry of the parent element.'.
property inputPresenterModel onLabel: 'True'.
property inputPresenterModel offLabel: 'False'.
property inputPresenterModel uncertainLabel: 'Uncertain'.
^ property
]
{ #category : #accessing }
PyramidBlocPlugin class >> elementId [
| property |
property := PyramidProperty new
name: 'Element ID';
command: PyramidElementIdCommand new;
inputPresenterClass: PyramidTextInputPresenter;
yourself.
property inputPresenterModel help: 'Change the id.'.
^ property
]
{ #category : #accessing }
PyramidBlocPlugin class >> visibility [
| property |
property := PyramidProperty new
name: 'Visibility';
command: PyramidVisibilityCommand new;
inputPresenterClass: PyramidMagicButtonsInputPresenter;
yourself.
property inputPresenterModel
buttonExtent: 64 @ 24;
addButtonModel: (PyramidMagicButtonModel new
icon: BlVisibility visible asIcon;
helpSelected: 'The object is visible.';
helpNotSelected: 'Set the value to visible.';
label: 'Visible';
inputValue: BlVisibility visible;
inputValidation: [ :value | value isVisible ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: BlVisibility hidden asIcon;
helpSelected:
'The object is hidden. (Still computed for the layout)';
helpNotSelected:
'Set the value to hidden. (Still computed for the layout)';
label: 'Hidden';
inputValue: BlVisibility hidden;
inputValidation: [ :value |
value isHidden and: [ value isGone not ] ];
yourself);
addButtonModel: (PyramidMagicButtonModel new
icon: BlVisibility gone asIcon;
helpSelected: 'The object is gone. (Not computed for the layout)';
helpNotSelected:
'Set the value to gone. (Not computed for the layout)';
label: 'Gone';
inputValue: BlVisibility gone;
inputValidation: [ :value | value isGone ];
yourself).
^ property
]
{ #category : #accessing }
PyramidBlocPlugin class >> zIndex [
| property |
property := PyramidProperty new
name: 'Elevation';
command: PyramidZIndexCommand new;
inputPresenterClass: PyramidNumberInputPresenter;
yourself.
property inputPresenterModel help:
'Change the elevation (#zIndex:). Bloc will use the elevation to determine wich of two siblings must be draw on top. The higher zIndex will be drawn on top of the lesser one.'.
^ property
]
{ #category : #adding }
PyramidBlocPlugin >> addPanelsOn: aPyramidSimpleWindow [
aPyramidSimpleWindow at: #tabRight addItem: [ :builder |
builder
makeTab: self propertiesManager mainPresenter
label: 'Props'
icon: (Smalltalk ui icons iconNamed: #box)
order: 1 ].
aPyramidSimpleWindow
at: #selectionMenu
addItem: [ :builder | self menuGroupOn: builder ].
aPyramidSimpleWindow
at: #selectionMenu
addItem: [ :builder | self menuChangeOrderOn: builder ]
]
{ #category : #connecting }
PyramidBlocPlugin >> connectOn: aPyramidEditor [
self editor: aPyramidEditor.
"Configure the sort function."
aPyramidEditor projectModel firstLevelElements sortFunction:
PyramidElevationSortFunction new.
propertiesManager projectModel: aPyramidEditor projectModel.
propertiesManager commandExecutor: aPyramidEditor commandExecutor
]
{ #category : #accessing }
PyramidBlocPlugin >> editor [
^ editor
]
{ #category : #accessing }
PyramidBlocPlugin >> editor: anObject [
editor := anObject
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> groupCollection: aCollection [
self editor ifNil: [ ^ self ].
self editor commandExecutor
use: self groupCommand
on: { aCollection }
with: self editor projectModel firstLevelElements
]
{ #category : #accessing }
PyramidBlocPlugin >> groupCommand [
^ groupCommand
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> groupMenuBlock: group for: aCollection [
group addItem: [ :item |
item
icon: (Smalltalk ui icons iconNamed: #collection);
name: 'Group selection';
enabled: true;
action: [ self groupCollection: aCollection ];
yourself ]
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> groupMenuBlockMulti [
^ [ :group :multi | | copy |
copy := multi asArray.
(self groupCommand canBeUsedFor: copy) ifTrue: [
self groupMenuBlock: group for: copy ] ]
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> groupMenuBlockSingle [
^ [ :group :single | | copy |
copy := { single }.
(self groupCommand canBeUsedFor: copy) ifTrue: [
self groupMenuBlock: group for: copy ] ]
]
{ #category : #initialization }
PyramidBlocPlugin >> initialize [
super initialize.
groupCommand := PyramidGroupCommand new.
propertiesManager := PyramidPropertiesManagerForSelection new.
propertiesManager addProperty: self class elementId.
propertiesManager addProperty: self class visibility.
propertiesManager addProperty: self class zIndex.
propertiesManager addProperty: self class clipChildren
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> menuChangeOrderOn: aBuilder [
aBuilder
addGroupSingleSelection: [ :group :single |
group
addItem: [ :item |
item
icon: PyramidDrawOrderIcons formOnForeground;
name: 'On foreground';
enabled: true;
action: [
self send: PyramidOnForegroundOrderCommand new on: { single } ];
yourself ];
addItem: [ :item |
item
icon: PyramidDrawOrderIcons formOnBackground;
name: 'On background';
enabled: true;
action: [
self send: PyramidOnBackgroundOrderCommand new on: { single } ];
yourself ];
addItem: [ :item |
item
icon: PyramidDrawOrderIcons formMoveForward;
name: 'Move forward';
enabled: true;
action: [
self send: PyramidMoveForwardOrderCommand new on: { single } ];
yourself ];
addItem: [ :item |
item
icon: PyramidDrawOrderIcons formMoveBackward;
name: 'Move backward';
enabled: true;
action: [
self send: PyramidMoveBackwardOrderCommand new on: { single } ];
yourself ];
yourself ]
order: 20
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> menuGroupOn: aBuilder [
aBuilder addGroupSingleSelection: self groupMenuBlockSingle order: 20.
aBuilder addGroupMultiSelection: self groupMenuBlockMulti order: 20
]
{ #category : #accessing }
PyramidBlocPlugin >> propertiesManager [
^ propertiesManager
]
{ #category : #'as yet unclassified' }
PyramidBlocPlugin >> send: aCommand on: aCollection [
self editor ifNil: [ ^ self ].
self editor commandExecutor
use: aCommand
on: aCollection
with: nil
]