1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; |
---|
5 | ; @categories |
---|
6 | ; Compound widget |
---|
7 | ; |
---|
8 | ; @param ID |
---|
9 | ; |
---|
10 | ; @param VALUE |
---|
11 | ; It is the default tick mark value (a floating-point number). |
---|
12 | ; |
---|
13 | ; @returns |
---|
14 | ; |
---|
15 | ; @uses |
---|
16 | ; |
---|
17 | ; @restrictions |
---|
18 | ; |
---|
19 | ; @examples |
---|
20 | ; |
---|
21 | ; @history |
---|
22 | ; |
---|
23 | ; @version |
---|
24 | ; $Id$ |
---|
25 | ; |
---|
26 | ;- |
---|
27 | PRO cw_specifie_set_value, id, value |
---|
28 | ; |
---|
29 | compile_opt idl2, strictarrsubs |
---|
30 | ; |
---|
31 | @cm_general |
---|
32 | if size(value, /type) NE 8 then return |
---|
33 | widget_control, widget_info(id,find_by_uname='min'), set_value = strtrim(value.min, 2) |
---|
34 | widget_control, widget_info(id,find_by_uname='max'), set_value = strtrim(value.max, 2) |
---|
35 | widget_control, widget_info(id,find_by_uname='int'), set_value = strtrim(value.inter, 2) |
---|
36 | widget_control, widget_info(id,find_by_uname='palnum'), set_value = strtrim(value.lct, 2) |
---|
37 | autres = extractstru(value, ['min', 'max', 'inter', 'lct', 'nothing', 'xindex', 'yindex']) |
---|
38 | if size(autres, /type) EQ 8 then BEGIN |
---|
39 | autresid = widget_info(id,find_by_uname='autres') |
---|
40 | widget_control, widget_info(id, find_by_uname = 'autres'), get_value = autresautres |
---|
41 | autresautres = autresautres[0] |
---|
42 | if strtrim(autresautres, 2) NE '' then begin |
---|
43 | autresautres = createfunc('get_extra(' + autresautres + ')' $ |
---|
44 | , filename = myuniquetmpdir +'for_createfunc.pro') |
---|
45 | autres = mixstru(autres, autresautres) |
---|
46 | endif |
---|
47 | autres = strkeywd(autres) |
---|
48 | widget_control, widget_info(id,find_by_uname='autres'), set_value = autres |
---|
49 | endif |
---|
50 | return |
---|
51 | end |
---|
52 | ; |
---|
53 | ;+ |
---|
54 | ; |
---|
55 | ; @file_comments |
---|
56 | ; |
---|
57 | ; @categories |
---|
58 | ; Compound widget |
---|
59 | ; |
---|
60 | ; @param ID |
---|
61 | ; |
---|
62 | ; @returns |
---|
63 | ; |
---|
64 | ; @uses |
---|
65 | ; |
---|
66 | ; @restrictions |
---|
67 | ; |
---|
68 | ; @examples |
---|
69 | ; |
---|
70 | ; @history |
---|
71 | ; |
---|
72 | ; @version |
---|
73 | ; $Id$ |
---|
74 | ; |
---|
75 | ;- |
---|
76 | FUNCTION cw_specifie_get_value, id |
---|
77 | ; |
---|
78 | compile_opt idl2, strictarrsubs |
---|
79 | ; |
---|
80 | @cm_general |
---|
81 | widget_control, widget_info(id,find_by_uname='min'), get_value = min |
---|
82 | min = float(min[0]) |
---|
83 | widget_control, widget_info(id,find_by_uname='max'), get_value = max |
---|
84 | max = float(max[0]) |
---|
85 | widget_control, widget_info(id,find_by_uname='int'), get_value = int |
---|
86 | int = float(int[0]) |
---|
87 | widget_control, widget_info(id,find_by_uname='palnum'), get_value = palnum |
---|
88 | palnum = long(palnum[0]) |
---|
89 | widget_control, widget_info(id,find_by_uname='autres'), get_value = autres |
---|
90 | autres = autres[0] |
---|
91 | ; |
---|
92 | exextra = {min:min, max:max, inter:int, lct:palnum} |
---|
93 | if strtrim(autres, 2) NE '' then $ |
---|
94 | exextra = createfunc('get_extra('+autres+', _extra = exextra)' $ |
---|
95 | , kwdlist = 'exextra = exextra', exextra = exextra $ |
---|
96 | , filename = myuniquetmpdir +'for_createfunc.pro') |
---|
97 | ; |
---|
98 | return, exextra |
---|
99 | end |
---|
100 | ; |
---|
101 | ;+ |
---|
102 | ; |
---|
103 | ; @file_comments |
---|
104 | ; |
---|
105 | ; @categories |
---|
106 | ; Compound widget |
---|
107 | ; |
---|
108 | ; @param EVENT |
---|
109 | ; |
---|
110 | ; @returns |
---|
111 | ; |
---|
112 | ; @uses |
---|
113 | ; |
---|
114 | ; @restrictions |
---|
115 | ; |
---|
116 | ; @examples |
---|
117 | ; |
---|
118 | ; @history |
---|
119 | ; |
---|
120 | ; @version |
---|
121 | ; $Id$ |
---|
122 | ; |
---|
123 | ;- |
---|
124 | FUNCTION cw_specifie_event, event |
---|
125 | ; |
---|
126 | compile_opt idl2, strictarrsubs |
---|
127 | ; |
---|
128 | ;------------------------------------------------------------ |
---|
129 | ; on recupere les ID des differents widgets |
---|
130 | ;------------------------------------------------------------ |
---|
131 | ;------------------------------------------------------------ |
---|
132 | widget_control, event.id, get_uvalue = uval |
---|
133 | widget_control, event.top, get_uvalue = top_uvalue |
---|
134 | smallin = extractatt(top_uvalue, 'smallin') |
---|
135 | numdessinin = smallin[2]-1 |
---|
136 | smallout = extractatt(top_uvalue, 'smallout') |
---|
137 | numdessinout = smallout[2]-1 |
---|
138 | ;------------------------------------------------------------ |
---|
139 | case uval of |
---|
140 | 'default':BEGIN |
---|
141 | ;--------------- |
---|
142 | ; We find the name of the variable: |
---|
143 | vlstid = widget_info(event.top, find_by_uname = 'varlist') |
---|
144 | fieldname = widget_info(vlstid, /combobox_gettext) |
---|
145 | ;--------------- |
---|
146 | exextra = definedefaultextra(fieldname) |
---|
147 | widget_control, widget_info(event.handler, find_by_uname = 'min'), set_value = strtrim(exextra.min, 1) |
---|
148 | widget_control, widget_info(event.handler, find_by_uname = 'max'), set_value = strtrim(exextra.max, 1) |
---|
149 | widget_control, widget_info(event.handler, find_by_uname = 'int'), set_value = strtrim(exextra.inter, 1) |
---|
150 | widget_control, widget_info(event.handler, find_by_uname = 'palnum'), set_value = strtrim(exextra.lct, 1) |
---|
151 | widget_control, widget_info(event.handler, find_by_uname = 'autres'), set_value = '' |
---|
152 | END |
---|
153 | 'palcol':BEGIN |
---|
154 | ind = fix(strmid(event.value, 0, strpos(event.value, '-'))) |
---|
155 | widget_control, widget_info(event.handler, find_by_uname = 'palnum'), set_value = strtrim(ind, 1) |
---|
156 | END |
---|
157 | ELSE: |
---|
158 | endcase |
---|
159 | return, {ID:event.handler, TOP:event.top, HANDLER:0L, OK:uval EQ 'ok'} |
---|
160 | end |
---|
161 | ; |
---|
162 | ;+ |
---|
163 | ; |
---|
164 | ; @file_comments |
---|
165 | ; |
---|
166 | ; @categories |
---|
167 | ; Compound widget |
---|
168 | ; |
---|
169 | ; @param PARENT {in}{required} |
---|
170 | ; The widget ID of the parent widget. |
---|
171 | ; |
---|
172 | ; @keyword COLUMN |
---|
173 | ; Buttons will be arranged in the number of columns |
---|
174 | ; specified by this keyword. |
---|
175 | ; |
---|
176 | ; @keyword ROW |
---|
177 | ; Buttons will be arranged in the number of rows |
---|
178 | ; specified by this keyword. |
---|
179 | ; |
---|
180 | ; @keyword UVALUE |
---|
181 | ; The user value to be associated with the widget. |
---|
182 | ; |
---|
183 | ; @keyword UNAME |
---|
184 | ; The user name to be associated with the widget. |
---|
185 | ; |
---|
186 | ; @keyword FRAME |
---|
187 | ; |
---|
188 | ; @keyword FORXXX |
---|
189 | ; |
---|
190 | ; @keyword _EXTRA |
---|
191 | ; Used to pass keywords |
---|
192 | ; |
---|
193 | ; @returns |
---|
194 | ; |
---|
195 | ; @uses |
---|
196 | ; |
---|
197 | ; @restrictions |
---|
198 | ; |
---|
199 | ; @examples |
---|
200 | ; |
---|
201 | ; @history |
---|
202 | ; |
---|
203 | ; @version |
---|
204 | ; $Id$ |
---|
205 | ; |
---|
206 | ; @todo |
---|
207 | ; seb: documenter |
---|
208 | ; |
---|
209 | ;- |
---|
210 | FUNCTION cw_specifie, parent, ROW=row, COLUMN=column $ |
---|
211 | , UVALUE=uvalue, UNAME=uname, FRAME=frame $ |
---|
212 | , FORXXX=forxxx, _EXTRA=ex |
---|
213 | ; |
---|
214 | compile_opt idl2, strictarrsubs |
---|
215 | ; |
---|
216 | ; checking exclusive keywords |
---|
217 | column = keyword_set(column)*(1-keyword_set(row)) |
---|
218 | row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) |
---|
219 | ;------------------------------------------------ |
---|
220 | if NOT keyword_set(uvalue) then uvalue = '' |
---|
221 | if NOT keyword_set(uname) then uname = '' |
---|
222 | base = widget_base(parent, space = 0, /frame $ |
---|
223 | , EVENT_FUNC = 'cw_specifie_event' $ |
---|
224 | , FUNC_GET_VALUE='cw_specifie_get_value' $ |
---|
225 | , PRO_SET_VALUE='cw_specifie_set_value' $ |
---|
226 | , UVALUE = uvalue, UNAME = uname, _extra = ex) |
---|
227 | ; base1 |
---|
228 | base1 = widget_base(base) |
---|
229 | rien = widget_label(base1, value = 'Min', xoffset = 85, yoffset = 15) |
---|
230 | rien = widget_label(base1, value = 'Max', xoffset = 145, yoffset = 15) |
---|
231 | rien = widget_label(base1, value = 'Int', xoffset = 210, yoffset = 15) |
---|
232 | ; |
---|
233 | lct, get_name = nomcouleur |
---|
234 | nbrligne = 30 |
---|
235 | nbrlist = n_elements(nomcouleur)/nbrligne |
---|
236 | nomcouleur = strtrim(sindgen(n_elements(nomcouleur)), 1)+'- '+nomcouleur |
---|
237 | nomcouleur = '0\'+nomcouleur |
---|
238 | nomcouleur = ['1\Color', nomcouleur] |
---|
239 | if nbrlist GT 1 then for i = 1,nbrlist do $ |
---|
240 | nomcouleur = [nomcouleur[0:nbrligne*i-1+i], '1\ ', nomcouleur[nbrligne*i+i:n_elements(nomcouleur)-1]] |
---|
241 | rien = cw_pdmenu(base1, nomcouleur, /RETURN_NAME , uvalue = 'palcol', uname = 'palcol', xoffset = 250, yoffset = 0) |
---|
242 | ; base2 |
---|
243 | base2 = widget_base(base, column = 4+keyword_set(forxxx), yoffset = 30) |
---|
244 | if keyword_set(forxxx) then rien = widget_button(base2,value='Default', uvalue = 'default', /frame, tooltip = 'see '+(find('definedefaultextra'))[0]) |
---|
245 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'min', uvalue = 'min') |
---|
246 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'max', uvalue = 'max') |
---|
247 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'int', uvalue = 'int') |
---|
248 | if keyword_set(forxxx) then colvalue = '' ELSE colvalue = '39' |
---|
249 | rien = widget_text(base2, value = colvalue, /editable, xsize = 2, uname = 'palnum', uvalue = 'palnum') |
---|
250 | |
---|
251 | |
---|
252 | |
---|
253 | ; widget text containing other keywords pass into top_uvalue.exextra |
---|
254 | ; Does it remain some? If yes, we have to put them as string |
---|
255 | |
---|
256 | rien = widget_text(base, value = ' ', /editable, uname = 'autres', uvalue = 'autres', xsize = 54, ysize = 3, yoffset = 65, /wrap, /no_newline) |
---|
257 | |
---|
258 | if keyword_set(forxxx) then cw_specifie_set_value, base, definedefaultextra('rien_du_tout') |
---|
259 | |
---|
260 | ;------------------------------------------------ |
---|
261 | return, base |
---|
262 | end |
---|
263 | |
---|