-
Notifications
You must be signed in to change notification settings - Fork 3
/
colorWheelObject.e
252 lines (206 loc) · 7.02 KB
/
colorWheelObject.e
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
OPT MODULE, OSVERSION=37
MODULE 'reaction/reaction_macros',
'window','classes/window',
'gadgets/layout','layout',
'reaction/reaction_lib',
'button','gadgets/button',
'images/bevel',
'string',
'gadgets/colorwheel','colorwheel',
'gadgets/checkbox','checkbox',
'images/label','label',
'amigalib/boopsi',
'libraries/gadtools',
'intuition/intuition',
'intuition/screens',
'intuition/imageclass',
'intuition/gadgetclass'
MODULE '*reactionObject','*reactionForm','*sourcegen','*validator'
EXPORT ENUM CWHEELGAD_IDENT, CWHEELGAD_LABEL, CWHEELGAD_HINT, CWHEELGAD_BEVELBOX,
CWHEELGAD_OK, CWHEELGAD_CHILD, CWHEELGAD_CANCEL
CONST NUM_CWHEEL_GADS=CWHEELGAD_CANCEL+1
EXPORT OBJECT colorWheelObject OF reactionObject
bevelBox:CHAR
ENDOBJECT
OBJECT colorWheelSettingsForm OF reactionForm
PRIVATE
colorWheelObject:PTR TO colorWheelObject
ENDOBJECT
PROC create() OF colorWheelSettingsForm
DEF gads:PTR TO LONG
NEW gads[NUM_CWHEEL_GADS]
self.gadgetList:=gads
NEW gads[NUM_CWHEEL_GADS]
self.gadgetActions:=gads
self.windowObj:=WindowObject,
WA_TITLE, 'ColorWheel Attribute Setting',
WA_LEFT, 0,
WA_TOP, 0,
WA_HEIGHT, 60,
WA_WIDTH, 260,
WA_MINWIDTH, 150,
WA_MAXWIDTH, 8192,
WA_MINHEIGHT, 60,
WA_MAXHEIGHT, 8192,
WA_ACTIVATE, TRUE,
WINDOW_POSITION, WPOS_CENTERSCREEN,
WA_PUBSCREEN, 0,
->WA_CustomScreen, gScreen,
->WINDOW_AppPort, gApp_port,
WA_CLOSEGADGET, TRUE,
WA_DEPTHGADGET, TRUE,
WA_SIZEGADGET, TRUE,
WA_DRAGBAR, TRUE,
WA_IDCMP,IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR IDCMP_CLOSEWINDOW OR 0,
WINDOW_PARENTGROUP, VLayoutObject,
LAYOUT_SPACEOUTER, TRUE,
LAYOUT_DEFERLAYOUT, TRUE,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_IDENT ]:=StringObject,
GA_ID, CWHEELGAD_IDENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Identifier',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_LABEL ]:=StringObject,
GA_ID, CWHEELGAD_LABEL,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Label',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_HINT ]:=ButtonObject,
GA_ID, CWHEELGAD_HINT,
GA_TEXT, 'Hint',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_BEVELBOX ]:=CheckBoxObject,
GA_ID, CWHEELGAD_BEVELBOX,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Bevel Box',
->CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_OK ]:=ButtonObject,
GA_ID, CWHEELGAD_OK,
GA_TEXT, '_OK',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_CHILD ]:=ButtonObject,
GA_ID, CWHEELGAD_CHILD,
GA_TEXT, 'C_hild',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ CWHEELGAD_CANCEL ]:=ButtonObject,
GA_ID, CWHEELGAD_CANCEL,
GA_TEXT, '_Cancel',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT,0,
LayoutEnd,
WindowEnd
self.gadgetActions[CWHEELGAD_CHILD]:={editChildSettings}
self.gadgetActions[CWHEELGAD_HINT]:={editHint}
self.gadgetActions[CWHEELGAD_CANCEL]:=MR_CANCEL
self.gadgetActions[CWHEELGAD_OK]:=MR_OK
ENDPROC
PROC editHint(nself,gadget,id,code) OF colorWheelSettingsForm
self:=nself
self.setBusy()
self.colorWheelObject.editHint()
self.clearBusy()
self.updateHint(CWHEELGAD_HINT, self.colorWheelObject.hintText)
ENDPROC
PROC editChildSettings(nself,gadget,id,code) OF colorWheelSettingsForm
self:=nself
self.setBusy()
self.colorWheelObject.editChildSettings()
self.clearBusy()
ENDPROC
PROC end() OF colorWheelSettingsForm
END self.gadgetList[NUM_CWHEEL_GADS]
END self.gadgetActions[NUM_CWHEEL_GADS]
DisposeObject(self.windowObj)
ENDPROC
EXPORT PROC canClose(modalRes) OF colorWheelSettingsForm
DEF res
IF modalRes=MR_CANCEL THEN RETURN TRUE
IF checkIdent(self,self.colorWheelObject,CWHEELGAD_IDENT)=FALSE
RETURN FALSE
ENDIF
ENDPROC TRUE
PROC editSettings(comp:PTR TO colorWheelObject) OF colorWheelSettingsForm
DEF res
self.colorWheelObject:=comp
SetGadgetAttrsA(self.gadgetList[ CWHEELGAD_BEVELBOX ],0,0,[CHECKBOX_CHECKED,comp.bevelBox,0])
SetGadgetAttrsA(self.gadgetList[ CWHEELGAD_IDENT ],0,0,[STRINGA_TEXTVAL,comp.ident,0])
SetGadgetAttrsA(self.gadgetList[ CWHEELGAD_LABEL ],0,0,[STRINGA_TEXTVAL,comp.label,0])
res:=self.showModal()
IF res=MR_OK
AstrCopy(comp.ident,Gets(self.gadgetList[ CWHEELGAD_IDENT ],STRINGA_TEXTVAL))
AstrCopy(comp.label,Gets(self.gadgetList[ CWHEELGAD_LABEL ],STRINGA_TEXTVAL))
comp.bevelBox:=Gets(self.gadgetList[ CWHEELGAD_BEVELBOX ],CHECKBOX_CHECKED)
ENDIF
ENDPROC res=MR_OK
EXPORT PROC createPreviewObject(scr) OF colorWheelObject
self.previewObject:=0
IF (colorwheelbase)
self.previewObject:=ColorWheelObject,
GA_ID, self.id,
WHEEL_SCREEN, scr,
WHEEL_BEVELBOX, self.bevelBox,
ColorWheelEnd
ENDIF
IF self.previewObject=0 THEN self.previewObject:=self.createErrorObject(scr)
self.makePreviewChildAttrs(0)
ENDPROC
EXPORT PROC create(parent) OF colorWheelObject
self.type:=TYPE_COLORWHEEL
SUPER self.create(parent)
self.bevelBox:=0
self.libsused:=[TYPE_COLORWHEEL]
ENDPROC
EXPORT PROC editSettings() OF colorWheelObject
DEF editForm:PTR TO colorWheelSettingsForm
DEF res
NEW editForm.create()
res:=editForm.editSettings(self)
END editForm
ENDPROC res
EXPORT PROC getTypeName() OF colorWheelObject
RETURN 'ColorWheel'
ENDPROC
#define makeProp(a,b) 'a',{self.a},b
EXPORT PROC serialiseData() OF colorWheelObject IS
[
makeProp(bevelBox,FIELDTYPE_CHAR)
]
EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF colorWheelObject
srcGen.componentProperty('GA_RelVerify','TRUE',FALSE)
srcGen.componentProperty('GA_TabCycle','TRUE',FALSE)
srcGen.componentProperty('WHEEL_Screen','gScreen',FALSE)
IF self.bevelBox THEN srcGen.componentProperty('WHEEL_BevelBox','TRUE',FALSE)
ENDPROC
EXPORT PROC genCodeChildProperties(srcGen:PTR TO srcGen) OF colorWheelObject
srcGen.componentAddChildLabel(self.label)
SUPER self.genCodeChildProperties(srcGen)
ENDPROC
EXPORT PROC libNameCreate() OF colorWheelObject IS 'colorwheel.gadget'
EXPORT PROC createColorWheelObject(parent)
DEF colorWheel:PTR TO colorWheelObject
NEW colorWheel.create(parent)
ENDPROC colorWheel