forked from dmcoles/ReBuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
glyphObject.e
235 lines (195 loc) · 6.85 KB
/
glyphObject.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
OPT MODULE, OSVERSION=37
MODULE 'reaction/reaction_macros',
'window','classes/window',
'gadgets/layout','layout',
'reaction/reaction_lib',
'button','gadgets/button',
'images/bevel',
'string',
'images/glyph','glyph',
'gadgets/integer','integer',
'gadgets/chooser','chooser',
'gadgets/checkbox','checkbox',
'images/label','label',
'amigalib/boopsi',
'libraries/gadtools',
'intuition/intuition',
'intuition/imageclass',
'intuition/gadgetclass'
MODULE '*reactionObject','*reactionForm','*sourceGen','*validator'
EXPORT ENUM GLYGAD_IDENT, GLYGAD_NAME, GLYGAD_TYPE,
GLYGAD_OK, GLYGAD_CHILD, GLYGAD_CANCEL
CONST NUM_GLY_GADS=GLYGAD_CANCEL+1
EXPORT OBJECT glyphObject OF reactionObject
glyphType:CHAR
ENDOBJECT
OBJECT glyphSettingsForm OF reactionForm
PRIVATE
glyphObject:PTR TO glyphObject
labels1:PTR TO LONG
ENDOBJECT
PROC create() OF glyphSettingsForm
DEF gads:PTR TO LONG
NEW gads[NUM_GLY_GADS]
self.gadgetList:=gads
NEW gads[NUM_GLY_GADS]
self.gadgetActions:=gads
self.windowObj:=WindowObject,
WA_TITLE, 'Glyph Attribute Setting',
WA_LEFT, 0,
WA_TOP, 0,
WA_HEIGHT, 70,
WA_WIDTH, 150,
WA_MINWIDTH, 150,
WA_MAXWIDTH, 8192,
WA_MINHEIGHT, 80,
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_NOCAREREFRESH, TRUE,
WA_IDCMP,IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR IDCMP_CLOSEWINDOW OR 0,
WINDOW_PARENTGROUP, VLayoutObject,
LAYOUT_SPACEOUTER, TRUE,
LAYOUT_DEFERLAYOUT, TRUE,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_IDENT ]:=StringObject,
GA_ID, GLYGAD_IDENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Identifier',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_NAME ]:=StringObject,
GA_ID, GLYGAD_NAME,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Label',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_TYPE ]:=ChooserObject,
GA_ID, GLYGAD_TYPE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels1:=chooserLabelsA(['GLYPH_NONE', 'GLYPH_DOWNARROW', 'GLYPH_UPARROW', 'GLYPH_LEFTARROW', 'GLYPH_RIGHTARROW',
'GLYPH_DROPDOWN', 'GLYPH_POPUP', 'GLYPH_CHECKMARK', 'GLYPH_POPFONT', 'GLYPH_POPFILE','GLYPH_POPDRAWER','GLYPH_POPSCREENMODE',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Type',
LabelEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_OK ]:=ButtonObject,
GA_ID, GLYGAD_OK,
GA_TEXT, '_OK',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_CHILD ]:=ButtonObject,
GA_ID, GLYGAD_CHILD,
GA_TEXT, 'C_hild',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ GLYGAD_CANCEL ]:=ButtonObject,
GA_ID, GLYGAD_CANCEL,
GA_TEXT, '_Cancel',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
CHILD_WEIGHTEDHEIGHT, 0,
LayoutEnd,
WindowEnd
self.gadgetActions[GLYGAD_CHILD]:={editChildSettings}
self.gadgetActions[GLYGAD_CANCEL]:=MR_CANCEL
self.gadgetActions[GLYGAD_OK]:=MR_OK
ENDPROC
PROC editChildSettings(nself,gadget,id,code) OF glyphSettingsForm
self:=nself
self.setBusy()
self.glyphObject.editChildSettings()
self.clearBusy()
ENDPROC
PROC end() OF glyphSettingsForm
freeChooserLabels( self.labels1 )
END self.gadgetList[NUM_GLY_GADS]
END self.gadgetActions[NUM_GLY_GADS]
DisposeObject(self.windowObj)
ENDPROC
EXPORT PROC canClose(modalRes) OF glyphSettingsForm
DEF res
IF modalRes=MR_CANCEL THEN RETURN TRUE
IF checkIdent(self,self.glyphObject,GLYGAD_IDENT)=FALSE
RETURN FALSE
ENDIF
ENDPROC TRUE
PROC editSettings(comp:PTR TO glyphObject) OF glyphSettingsForm
DEF res
self.glyphObject:=comp
SetGadgetAttrsA(self.gadgetList[ GLYGAD_IDENT ],0,0,[STRINGA_TEXTVAL,comp.ident,0])
SetGadgetAttrsA(self.gadgetList[ GLYGAD_NAME ],0,0,[STRINGA_TEXTVAL,comp.name,0])
SetGadgetAttrsA(self.gadgetList[ GLYGAD_TYPE ],0,0,[CHOOSER_SELECTED,comp.glyphType,0])
res:=self.showModal()
IF res=MR_OK
AstrCopy(comp.ident,Gets(self.gadgetList[ GLYGAD_IDENT ],STRINGA_TEXTVAL))
AstrCopy(comp.name,Gets(self.gadgetList[ GLYGAD_NAME ],STRINGA_TEXTVAL))
comp.glyphType:=Gets(self.gadgetList[ GLYGAD_TYPE ],CHOOSER_SELECTED)
ENDIF
ENDPROC res
EXPORT PROC createPreviewObject(scr) OF glyphObject
self.previewObject:=GlyphObject,
GLYPH_GLYPH, ListItem([GLYPH_NONE,GLYPH_DOWNARROW,GLYPH_UPARROW,GLYPH_LEFTARROW,GLYPH_RIGHTARROW, GLYPH_DROPDOWN,GLYPH_POPUP,GLYPH_CHECKMARK,GLYPH_POPFONT,GLYPH_POPFILE,GLYPH_POPDRAWER,GLYPH_POPSCREENMODE],self.glyphType),
GLYPH_DRAWINFO, self.drawInfo,
GlyphEnd
IF self.previewObject=0 THEN self.previewObject:=self.createErrorObject(scr)
self.makePreviewChildAttrs(self.name)
ENDPROC
EXPORT PROC create(parent) OF glyphObject
self.type:=TYPE_GLYPH
SUPER self.create(parent)
self.glyphType:=9
self.libsused:=[TYPE_GLYPH,TYPE_LABEL]
ENDPROC
EXPORT PROC editSettings() OF glyphObject
DEF editForm:PTR TO glyphSettingsForm
DEF res
NEW editForm.create()
res:=editForm.editSettings(self)
END editForm
ENDPROC res=MR_OK
#define makeProp(a,b) 'a',{self.a},b
EXPORT PROC serialiseData() OF glyphObject IS
[
makeProp(glyphType,FIELDTYPE_CHAR)
]
EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF glyphObject
srcGen.componentProperty('GLYPH_DrawInfo','gDrawInfo',FALSE)
IF self.glyphType<>0 THEN srcGen.componentProperty('GLYPH_Glyph',ListItem(['GLYPH_NONE', 'GLYPH_DOWNARROW', 'GLYPH_UPARROW', 'GLYPH_LEFTARROW', 'GLYPH_RIGHTARROW',
'GLYPH_DROPDOWN', 'GLYPH_POPUP', 'GLYPH_CHECKMARK', 'GLYPH_POPFONT', 'GLYPH_POPFILE','GLYPH_POPDRAWER','GLYPH_POPSCREENMODE'],self.glyphType),FALSE)
ENDPROC
EXPORT PROC genCodeChildProperties(srcGen:PTR TO srcGen) OF glyphObject
srcGen.componentAddChildLabel(self.name)
SUPER self.genCodeChildProperties(srcGen)
ENDPROC
EXPORT PROC getTypeName() OF glyphObject
RETURN 'Glyph'
ENDPROC
EXPORT PROC isImage() OF glyphObject IS TRUE
EXPORT PROC createGlyphObject(parent)
DEF glyph:PTR TO glyphObject
NEW glyph.create(parent)
ENDPROC glyph