-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathPyramidToploThemePlugin.class.st
More file actions
207 lines (171 loc) · 6.6 KB
/
PyramidToploThemePlugin.class.st
File metadata and controls
207 lines (171 loc) · 6.6 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
Class {
#name : #PyramidToploThemePlugin,
#superclass : #Object,
#traits : 'TPyramidPlugin',
#classTraits : 'TPyramidPlugin classTrait',
#instVars : [
'themePresenter',
'themePropertyManager'
],
#classInstVars : [
'defaultTheme'
],
#category : #'Pyramid-Toplo-plugin-theme-management'
}
{ #category : #'as yet unclassified' }
PyramidToploThemePlugin class >> defaultTheme [
defaultTheme ifNil: [
defaultTheme := (ToTheme withAllSubclasses select: [ :e | e canBeDefault ]) last ].
^ defaultTheme
]
{ #category : #'as yet unclassified' }
PyramidToploThemePlugin class >> defaultTheme: anObject [
defaultTheme := anObject
]
{ #category : #'as yet unclassified' }
PyramidToploThemePlugin class >> defaultThemeSettingOn: aBuilder [
<systemsettings>
(aBuilder pickOne: #defaultTheme)
parent: #pyramid;
label: 'Choose the default theme.';
target: self;
domainValues:
(ToTheme withAllSubclasses select: #canBeDefault);
description:
'Define the theme that will be used by default when a new editor is opened.'
]
{ #category : #adding }
PyramidToploThemePlugin class >> toploAntIconCategory [
<pyramidLibraryCategory: 11>
^ PyramidToploThemePlugin
toploIconThemeCategoryFromClass: ToAntDesignIconProvider
withCategoryPrefix: 'Ant Design - '
]
{ #category : #adding }
PyramidToploThemePlugin class >> toploIconThemeCategoryFromClass: aClass withCategoryPrefix: aString [
| categoriesMethods |
categoriesMethods := aClass class methods select: [ :method |
method selector first = $_ and: [
($_ split: method selector) last = 'loaded' ] ].
^ categoriesMethods collect: [ :method |
| prefix elementSelectors elements |
prefix := ($_ split: method selector) second.
elementSelectors := (aClass perform: method selector) collect: [
:suffix | prefix , '_' , suffix ].
elements := elementSelectors collect: [ :selector |
PyramidLibraryElement new
name: selector;
icon: (Smalltalk ui icons iconNamed: #blank);
block: [
| image |
image := ToImage new
extent: 48 asPoint;
innerImage:
(PyramidExternalRessourceProxy new
pyramidExternalRessourceSource:
(PyramidExternalRessourceSource new
postConstructionBlock: [ :obj |
obj constraints horizontal
matchParent.
obj constraints vertical
matchParent ];
target: BlSvgConverter;
selector: #convertFromString:;
arguments:
{ (PyramidExternalRessourceProxy
new
pyramidExternalRessourceSource:
(PyramidExternalRessourceSource
new
target: aClass;
selector: selector asSymbol;
arguments: { };
yourself);
yourself) };
yourself);
yourself).
{ image } ];
yourself ].
PyramidLibraryCategory new
name: aString , prefix;
icon: (Smalltalk ui icons iconNamed: #image);
elements: elements;
yourself ]
]
{ #category : #adding }
PyramidToploThemePlugin class >> toploLibraryCategory [
<pyramidLibraryCategory: 1>
| classes elements |
classes := ToElement allSubclasses , { ToElement }.
elements := classes
reject: [ :each |
each isAbstract or: [
(each name findString: 'Abstract') > 0 or: [
[
each new.
false ]
on: Error
do: [ true ] ] ] ]
thenCollect: [ :class |
PyramidLibraryElement new
icon:
(Smalltalk ui icons iconNamed: class systemIconName);
name: class name;
block: [ { class new } ];
yourself ].
^ { (PyramidLibraryCategory new
name: 'Toplo';
icon: (Smalltalk ui icons iconNamed: #box);
elements: (elements sorted: [ :a :b | a name < b name ]);
yourself) }
]
{ #category : #adding }
PyramidToploThemePlugin class >> toploMaterialIconCategory [
<pyramidLibraryCategory: 12>
^ PyramidToploThemePlugin
toploIconThemeCategoryFromClass: ToMaterialDesignIconProvider
withCategoryPrefix: 'Material Design - '
]
{ #category : #adding }
PyramidToploThemePlugin >> addPanelsOn: aPyramidSimpleWindow [
aPyramidSimpleWindow at: #tabRight addItem: [ :builder |
builder
makeTab: self themePresenter
label: 'Toplo-Theme'
icon: (Smalltalk ui icons iconNamed: #smallPushpin)
order: 6 ]
]
{ #category : #actions }
PyramidToploThemePlugin >> configureBuilder: aPyramidEditorBuilder [
| spacePlugin listOfPlugins pluginSorted |
listOfPlugins := aPyramidEditorBuilder plugins.
pluginSorted := listOfPlugins select: [ :extensions | extensions isKindOf: PyramidSpacePlugin ].
pluginSorted size = 1
ifFalse: [^ self].
spacePlugin := pluginSorted asArray first.
self themePresenter pyramidSpaceBuilderConfigurationOn: spacePlugin builder
]
{ #category : #connecting }
PyramidToploThemePlugin >> connectOn: aPyramidEditor [
self themePresenter editor: aPyramidEditor.
self themePropertyManager projectModel: aPyramidEditor projectModel.
self themePresenter projectModel: aPyramidEditor projectModel.
self themePresenter treeTableStampPresenter projectModel: aPyramidEditor projectModel.
]
{ #category : #initialization }
PyramidToploThemePlugin >> initialize [
themePresenter := PyramidThemePresenter new.
themePropertyManager := PyramidPropertiesManagerForSelection new
presenterStrategy:
PyramidThemePropertyStrategy new;
yourself.
themePresenter treeTableStampPresenter pyramidPropertiesStrategy: PyramidThemePropertyStrategy new.
]
{ #category : #accessing }
PyramidToploThemePlugin >> themePresenter [
^ themePresenter
]
{ #category : #accessing }
PyramidToploThemePlugin >> themePropertyManager [
^ themePropertyManager
]