1 | ;+ |
---|
2 | ; |
---|
3 | ; @file_comments |
---|
4 | ; slightly modified version of cw_field ... |
---|
5 | ; |
---|
6 | ; @categories |
---|
7 | ; |
---|
8 | ; @param parent {in}{required} |
---|
9 | ; The ID of the parent widget. |
---|
10 | ; |
---|
11 | ; @keyword COLUMN |
---|
12 | ; Buttons will be arranged in the number of columns specified by this keyword. |
---|
13 | ; |
---|
14 | ; @keyword ROW |
---|
15 | ; Buttons will be arranged in the number of rows specified by this keyword. |
---|
16 | ; |
---|
17 | ; @keyword EVENT_FUNC |
---|
18 | ; The name of an optional user-supplied event function for buttons. |
---|
19 | ; This function is called with the return value structure whenever a |
---|
20 | ; button is pressed, and follows the conventions for user-written event functions. |
---|
21 | ; |
---|
22 | ; @keyword FLOATING |
---|
23 | ; |
---|
24 | ; @keyword INTEGER |
---|
25 | ; |
---|
26 | ; @keyword LONG |
---|
27 | ; |
---|
28 | ; @keyword STRING |
---|
29 | ; |
---|
30 | ; @keyword FONT |
---|
31 | ; The name of the font to be used for the button titles. If this keyword |
---|
32 | ; is not specified, the default font is used. |
---|
33 | ; |
---|
34 | ; @keyword FRAME |
---|
35 | ; Specifies the width of the frame to be drawn around the base. |
---|
36 | ; |
---|
37 | ; @keyword TITLE |
---|
38 | ; The title of the window |
---|
39 | ; |
---|
40 | ; @keyword UVALUE |
---|
41 | ; The user value to be associated with the widget. |
---|
42 | ; |
---|
43 | ; @keyword VALUE |
---|
44 | ; |
---|
45 | ; @keyword RETURN_EVENTS |
---|
46 | ; |
---|
47 | ; @keyword ALL_EVENTS |
---|
48 | ; |
---|
49 | ; @keyword FIELDFONT |
---|
50 | ; |
---|
51 | ; @keyword NOEDIT |
---|
52 | ; |
---|
53 | ; @keyword TEXT_FRAME |
---|
54 | ; |
---|
55 | ; @keyword XSIZE |
---|
56 | ; The width of the base |
---|
57 | ; |
---|
58 | ; @keyword YSIZE |
---|
59 | ; The height of the base. |
---|
60 | ; |
---|
61 | ; @keyword UNAME |
---|
62 | ; The user name to be associated with the widget. |
---|
63 | ; |
---|
64 | ; @returns |
---|
65 | ; |
---|
66 | ; @uses |
---|
67 | ; |
---|
68 | ; @restrictions |
---|
69 | ; |
---|
70 | ; @examples |
---|
71 | ; |
---|
72 | ; @history |
---|
73 | ; |
---|
74 | ; @version |
---|
75 | ; $Id$ |
---|
76 | ;- |
---|
77 | FUNCTION cw_field2, parent, COLUMN=column, ROW=row $ |
---|
78 | , EVENT_FUNC=efun $ |
---|
79 | , FLOATING=float, INTEGER=int, LONG=long, STRING=string $ |
---|
80 | , FONT=labelfont, FRAME=frame, TITLE=title, UVALUE=uvalue $ |
---|
81 | , VALUE=textvaluein $ |
---|
82 | , RETURN_EVENTS=returnevents, ALL_EVENTS=allupdates $ |
---|
83 | , FIELDFONT=fieldfont, NOEDIT=noedit, TEXT_FRAME=text_frame $ |
---|
84 | , XSIZE=xsize, YSIZE=ysize, UNAME=uname |
---|
85 | ; , FLOOR=vmin, CEILING=vmax |
---|
86 | ; |
---|
87 | compile_opt idl2, strictarrsubs |
---|
88 | ; |
---|
89 | resolve_routine, 'cw_field', /compile_full_file, /is_function |
---|
90 | ; Examine our keyword list and set default values |
---|
91 | ; for keywords that are not explicitly set. |
---|
92 | |
---|
93 | Column = KEYWORD_SET(Column) |
---|
94 | Row = 1 - Column |
---|
95 | AllEvents = 1 - KEYWORD_SET(NoEdit) |
---|
96 | |
---|
97 | ; Enum Update { None, All, CRonly } |
---|
98 | Update = 0 |
---|
99 | IF KEYWORD_SET(AllUpdates) THEN Update = 1 |
---|
100 | IF KEYWORD_SET(ReturnEvents) THEN Update = 2 |
---|
101 | |
---|
102 | IF N_ELEMENTS(efun) LE 0 THEN efun = '' |
---|
103 | IF N_ELEMENTS(Title) EQ 0 THEN Title='Input Field:' |
---|
104 | TextValue = (N_ELEMENTS(TextValueIn) gt 0) ? TextValueIn : '' |
---|
105 | ; Convert non-string values to strings. |
---|
106 | if (SIZE(TextValue, /TNAME) ne 'STRING') then $ |
---|
107 | TextValue = STRTRIM(TextValue,2) |
---|
108 | IF N_ELEMENTS(YSize) EQ 0 THEN YSize=1 |
---|
109 | IF N_ELEMENTS(uname) EQ 0 THEN uname='CW_FIELD_UNAME' |
---|
110 | |
---|
111 | Type = 0 ; string is default |
---|
112 | IF KEYWORD_SET(Float) THEN Type = 1 |
---|
113 | IF KEYWORD_SET(Int) THEN Type = 2 |
---|
114 | IF KEYWORD_SET(Long) THEN Type = 3 |
---|
115 | |
---|
116 | ; Don't allow multiline non string widgets |
---|
117 | if (Type ne 0) then $ |
---|
118 | YSize=1 |
---|
119 | YSize = YSize > 1 |
---|
120 | |
---|
121 | ; Build Widget |
---|
122 | |
---|
123 | Base = WIDGET_BASE(parent, ROW=row, COLUMN=column, UVALUE=uvalue, $ |
---|
124 | EVENT_FUNC='CW_FIELD_EVENT', $ |
---|
125 | PRO_SET_VALUE='CW_FIELD_SET', $ |
---|
126 | FUNC_GET_VALUE='CW_FIELD_GET', $ |
---|
127 | FRAME=Frame, UNAME=uname ) |
---|
128 | FOR i = 0, n_elements(title)-1 DO $ |
---|
129 | Label = WIDGET_LABEL(Base, VALUE = Title[i], FONT = LabelFont, $ |
---|
130 | UNAME = uname+'_LABEL', /align_left) |
---|
131 | Text = WIDGET_TEXT(Base, VALUE = TextValue, $ |
---|
132 | XSIZE=XSize, YSIZE=YSize, FONT=FieldFont, $ |
---|
133 | ALL_EVENTS=AllEvents, $ |
---|
134 | EDITABLE=(AllEvents AND TYPE EQ 0), $ |
---|
135 | FRAME=Text_Frame , $ |
---|
136 | UNAME=uname+'_TEXT') |
---|
137 | |
---|
138 | ; NO_ECHO=(AllEvents AND (TYPE NE 0))) |
---|
139 | |
---|
140 | ; Save our internal state in the first child widget |
---|
141 | State = { $ |
---|
142 | efun: efun, $ |
---|
143 | TextId:Text, $ |
---|
144 | Title:Title, $ |
---|
145 | Update:Update, $ |
---|
146 | Type:Type $ |
---|
147 | } |
---|
148 | WIDGET_CONTROL, WIDGET_INFO(Base, /CHILD), SET_UVALUE=State, /NO_COPY |
---|
149 | RETURN, Base |
---|
150 | END |
---|
151 | ; |
---|
152 | ; |
---|
153 | ;+ |
---|
154 | ; |
---|
155 | ; @file_comments |
---|
156 | ; get back the ids of the cw_field widgets |
---|
157 | ; |
---|
158 | ; @categories |
---|
159 | ; |
---|
160 | ; @param EVENT |
---|
161 | ; |
---|
162 | ; @returns |
---|
163 | ; |
---|
164 | ; @uses |
---|
165 | ; |
---|
166 | ; @restrictions |
---|
167 | ; |
---|
168 | ; @examples |
---|
169 | ; |
---|
170 | ; @history |
---|
171 | ; |
---|
172 | ; @version |
---|
173 | ; $Id$ |
---|
174 | ; |
---|
175 | ;- |
---|
176 | PRO printerdef_event, event |
---|
177 | ; |
---|
178 | compile_opt idl2, strictarrsubs |
---|
179 | ; |
---|
180 | widget_control, event.id, get_uvalue = cwids |
---|
181 | IF size(cwids, /n_dimensions) EQ 1 THEN cwids = reform(cwids, 3, 1) |
---|
182 | help, cwids |
---|
183 | dims = size(cwids, /dimensions) |
---|
184 | help, dims |
---|
185 | print, dims |
---|
186 | results = strarr(dims) |
---|
187 | FOR i = 0, dims[1]-1 DO BEGIN |
---|
188 | widget_control, cwids[0, i], get_value = res & results[0, i] = res |
---|
189 | widget_control, cwids[1, i], get_value = res & results[1, i] = res |
---|
190 | widget_control, cwids[2, i], get_value = res & results[2, i] = res |
---|
191 | ENDFOR |
---|
192 | nothing = where(results EQ '', count) |
---|
193 | IF count NE 0 THEN BEGIN |
---|
194 | nothing = dialog_message('Some of the text box are still empty', dialog_parent = event.top, /information) |
---|
195 | return |
---|
196 | ENDIF |
---|
197 | ; now we give the result to buildinit.pro by using the pointer uvalue |
---|
198 | widget_control, event.top, get_uvalue = ptresult |
---|
199 | *ptresult = temporary(results) |
---|
200 | ; we destroy the widget |
---|
201 | widget_control, event.top, /destroy |
---|
202 | RETURN |
---|
203 | END |
---|
204 | ; |
---|
205 | ; |
---|
206 | ;+ |
---|
207 | ; |
---|
208 | ; @file_comments |
---|
209 | ; get back the ids of the cw_field widgets |
---|
210 | ; |
---|
211 | ; @categories |
---|
212 | ; |
---|
213 | ; @param EVENT |
---|
214 | ; |
---|
215 | ; @returns |
---|
216 | ; |
---|
217 | ; @uses |
---|
218 | ; |
---|
219 | ; @restrictions |
---|
220 | ; |
---|
221 | ; @examples |
---|
222 | ; |
---|
223 | ; @history |
---|
224 | ; |
---|
225 | ; @version |
---|
226 | ; $Id$ |
---|
227 | ; |
---|
228 | ;- |
---|
229 | PRO papsize_event, event |
---|
230 | ; |
---|
231 | compile_opt idl2, strictarrsubs |
---|
232 | ; |
---|
233 | widget_control, event.id, get_uvalue = uvalue |
---|
234 | IF uvalue[0] NE 'ok' THEN return |
---|
235 | idist = widget_info(event.top, find_by_uname = 'list') |
---|
236 | id = widget_info(idist, /list_select) |
---|
237 | widget_control, idist, get_uvalue = selected |
---|
238 | selected = selected[id] |
---|
239 | selected = strsplit(selected, /extract) |
---|
240 | ; now we give the result to buildinit.pro by using the pointer uvalue |
---|
241 | widget_control, event.top, get_uvalue = ptresult |
---|
242 | *ptresult = [float(selected[3]), float(selected[4])] |
---|
243 | ; we destroy the widget |
---|
244 | widget_control, event.top, /destroy |
---|
245 | RETURN |
---|
246 | END |
---|
247 | ; |
---|
248 | ;+ |
---|
249 | ; @file_comments |
---|
250 | ; now we give the answer to buildinit.pro by using the pointer uvalue |
---|
251 | ; |
---|
252 | ; @categories |
---|
253 | ; |
---|
254 | ; @param event |
---|
255 | ; |
---|
256 | ; @returns |
---|
257 | ; |
---|
258 | ; @uses |
---|
259 | ; |
---|
260 | ; @restrictions |
---|
261 | ; |
---|
262 | ; @examples |
---|
263 | ; |
---|
264 | ; @history |
---|
265 | ; |
---|
266 | ; @version |
---|
267 | ; $Id$ |
---|
268 | ; |
---|
269 | ;- |
---|
270 | PRO xask_event, event |
---|
271 | ; |
---|
272 | compile_opt idl2, strictarrsubs |
---|
273 | ; |
---|
274 | widget_control, event.top, get_uvalue = ptranswer |
---|
275 | *ptranswer = event.value |
---|
276 | ; we destroy the widget |
---|
277 | widget_control, event.top, /destroy |
---|
278 | RETURN |
---|
279 | END |
---|
280 | ; |
---|
281 | ;+ |
---|
282 | ; |
---|
283 | ; @file_comments |
---|
284 | ; |
---|
285 | ; @categories |
---|
286 | ; |
---|
287 | ; @keyword _EXTRA |
---|
288 | ; Used to pass keywords |
---|
289 | ; |
---|
290 | ; @returns |
---|
291 | ; |
---|
292 | ; @uses |
---|
293 | ; |
---|
294 | ; @restrictions |
---|
295 | ; |
---|
296 | ; @examples |
---|
297 | ; |
---|
298 | ; @history |
---|
299 | ; |
---|
300 | ; @version |
---|
301 | ; $Id$ |
---|
302 | ; |
---|
303 | ;- |
---|
304 | FUNCTION xask, _EXTRA=ex |
---|
305 | ; |
---|
306 | compile_opt idl2, strictarrsubs |
---|
307 | ; |
---|
308 | base = widget_base() |
---|
309 | field = cw_field2(base, /frame, /return_events, /column, _extra = ex) |
---|
310 | ptranswer = ptr_new(/allocate_heap) |
---|
311 | ; we realize the widget and wait for an answer |
---|
312 | widget_control, base, /realize, set_uvalue = ptranswer |
---|
313 | xmanager, 'xask', base |
---|
314 | ; we get the answer |
---|
315 | answer = *ptranswer |
---|
316 | ; we freeing the pointer |
---|
317 | ptr_free, ptranswer |
---|
318 | RETURN, answer |
---|
319 | END |
---|
320 | ; |
---|
321 | ;+ |
---|
322 | ; |
---|
323 | ; @file_comments |
---|
324 | ; |
---|
325 | ; @categories |
---|
326 | ; |
---|
327 | ; @keyword TITLE |
---|
328 | ; The title of the window |
---|
329 | ; |
---|
330 | ; @keyword NOMARK |
---|
331 | ; |
---|
332 | ; @keyword NOWRITE |
---|
333 | ; |
---|
334 | ; @returns |
---|
335 | ; |
---|
336 | ; @uses |
---|
337 | ; |
---|
338 | ; @restrictions |
---|
339 | ; |
---|
340 | ; @examples |
---|
341 | ; |
---|
342 | ; @history |
---|
343 | ; |
---|
344 | ; @version |
---|
345 | ; $Id$ |
---|
346 | ; |
---|
347 | ;- |
---|
348 | FUNCTION getdir, TITLE=title, NOMARK=nomark, NOWRITE=nowrite |
---|
349 | ; |
---|
350 | compile_opt idl2, strictarrsubs |
---|
351 | ; |
---|
352 | |
---|
353 | REPEAT BEGIN |
---|
354 | dir = dialog_pickfile(/directory, /must_exist, title = title) |
---|
355 | ; make sure dir is ok, check read/write access and directory separator mark |
---|
356 | dir = file_search(dir, /test_directory, /test_read $ |
---|
357 | , test_write = 1 - keyword_set(nowrite) $ |
---|
358 | , mark_directory = 1 - keyword_set(nomark)) |
---|
359 | dir = dir[0] |
---|
360 | ENDREP UNTIL dir NE '' |
---|
361 | |
---|
362 | RETURN, dir |
---|
363 | END |
---|
364 | ; |
---|
365 | ; |
---|
366 | ;+ |
---|
367 | ; |
---|
368 | ; @file_comments |
---|
369 | ; |
---|
370 | ; @categories |
---|
371 | ; |
---|
372 | ; @returns |
---|
373 | ; |
---|
374 | ; @uses |
---|
375 | ; |
---|
376 | ; @restrictions |
---|
377 | ; |
---|
378 | ; @examples |
---|
379 | ; |
---|
380 | ; @history |
---|
381 | ; |
---|
382 | ; @version |
---|
383 | ; $Id$ |
---|
384 | ; |
---|
385 | ;- |
---|
386 | PRO buildinit |
---|
387 | ; |
---|
388 | compile_opt idl2, strictarrsubs |
---|
389 | ; |
---|
390 | IF fix(strmid(!version.release, 0, 1)) LT 6 THEN BEGIN |
---|
391 | print, ' *** ***** ***' |
---|
392 | print, ' *** ERROR ***' |
---|
393 | print, ' *** ***** ***' |
---|
394 | print, 'This version of SAXO needs at least IDL version 6.0' |
---|
395 | print, ' *** ***** ***' |
---|
396 | print, ' *** ERROR ***' |
---|
397 | print, ' *** ***** ***' |
---|
398 | return |
---|
399 | ENDIF |
---|
400 | IF lmgr(/demo) EQ 1 THEN BEGIN |
---|
401 | print, 'impossible to use buildinit in demo mode' |
---|
402 | return |
---|
403 | ENDIF |
---|
404 | ; |
---|
405 | init = [';' $ |
---|
406 | , '; This is the initialisation file.' $ |
---|
407 | , '; it defines the !path and the defaut values of some of the common variables' $ |
---|
408 | , ';' $ |
---|
409 | , '; this is supposed to speed-up IDL...' $ |
---|
410 | , ';' $ |
---|
411 | , '; a = fltarr(1000,1000,100)' $ |
---|
412 | , '; a = 0' $ |
---|
413 | , ';' $ |
---|
414 | , '; path definition' $ |
---|
415 | , ';'] |
---|
416 | ; |
---|
417 | ; define "myIDL" directory |
---|
418 | myIDL = getdir(title = 'Select the home directory (my IDL)', /nomark) |
---|
419 | ; define "SAXO" directory |
---|
420 | saxodir = getdir(title = 'Select SAXO directory', /nomark, /nowrite) |
---|
421 | ; define the !path |
---|
422 | init = [init, '!path = expand_path(''+'' + '''+myIDL+''') $' $ |
---|
423 | , ' + path_sep(/search_path) + expand_path(''+'' + '''+saxodir+''') $' $ |
---|
424 | , ' + path_sep(/search_path) + expand_path(''+'' + !dir)'] |
---|
425 | ; |
---|
426 | ; should we keep the compatibility with the old version? |
---|
427 | ; |
---|
428 | yes = dialog_message(['shall we keep the compatibility' $ |
---|
429 | , 'with the old version ?'], /question, /default_no) |
---|
430 | yes = strlowcase(yes) |
---|
431 | |
---|
432 | init = [init $ |
---|
433 | , ';' $ |
---|
434 | , '; compatibility with the old version' $ |
---|
435 | , ';' $ |
---|
436 | , 'keep_compatibility, ' + strtrim(fix(yes EQ 'yes'), 2)] |
---|
437 | ; |
---|
438 | ; define all the commons |
---|
439 | ; |
---|
440 | init = [init $ |
---|
441 | , ';' $ |
---|
442 | , '; define all the commons' $ |
---|
443 | , ';' $ |
---|
444 | , '@all_cm'] |
---|
445 | ; |
---|
446 | ; define default directories |
---|
447 | ; |
---|
448 | init = [init $ |
---|
449 | , ';' $ |
---|
450 | , '; define default directories' $ |
---|
451 | , ';' $ |
---|
452 | , 'homedir = isadirectory('''+myIDL+'/'', title = ''Select the default HOME directory'')'] |
---|
453 | iodir = getdir(title = 'Select the default IO directory') |
---|
454 | init = [init $ |
---|
455 | , 'iodir = isadirectory('''+iodir+''', title = ''Select the default IO directory'')'] |
---|
456 | psdir = getdir(title = 'Select the default postscripts directory') |
---|
457 | init = [init $ |
---|
458 | , 'psdir = isadirectory('''+psdir+''', title = ''Select the default postscripts directory'')'] |
---|
459 | imagedir = getdir(title = 'Select the default images directory') |
---|
460 | init = [init $ |
---|
461 | , 'imagedir = isadirectory('''+imagedir+''', title = ''Select the default images directory'')'] |
---|
462 | animdir = getdir(title = 'Select the default animations directory') |
---|
463 | init = [init $ |
---|
464 | , 'animdir = isadirectory('''+animdir+''', title = ''Select the default animations directory'')'] |
---|
465 | ; |
---|
466 | ; number of printer |
---|
467 | ; |
---|
468 | ptnumb = xask(title = 'Number of accessible printers', value = 0, /long) |
---|
469 | ; |
---|
470 | ; define all the printer parameters |
---|
471 | ; |
---|
472 | init = [init $ |
---|
473 | , ';' $ |
---|
474 | , '; define printer parameters' $ |
---|
475 | , ';' ] |
---|
476 | ; |
---|
477 | IF ptnumb NE 0 THEN BEGIN |
---|
478 | base = widget_base(/column, /frame) |
---|
479 | cwids = lonarr(3, ptnumb) |
---|
480 | FOR i = 0, ptnumb-1 DO BEGIN |
---|
481 | subbase = widget_base(base, /row) |
---|
482 | cwids[0, i] = cw_field(subbase, /string $ |
---|
483 | , Title = 'printer_human_names['+strtrim(i, 2)+'] = ') |
---|
484 | cwids[1, i] = cw_field(subbase, /string $ |
---|
485 | , Title = 'printer_machine_names['+strtrim(i, 2)+'] = ') |
---|
486 | cwids[2, i] = cw_field(subbase, /string, value = '\lpr -P' $ |
---|
487 | , Title = 'print_command['+strtrim(i, 2)+'] = ') |
---|
488 | ENDFOR |
---|
489 | trash = widget_button(base, value = 'ok', uvalue = cwids) |
---|
490 | ptresult = ptr_new(/allocate_heap) |
---|
491 | ; we realize the widget and wait for an answer |
---|
492 | widget_control, base, /realize, set_uvalue = ptresult |
---|
493 | xmanager, 'printerdef', base |
---|
494 | ; |
---|
495 | init = [init $ |
---|
496 | , 'printer_human_names = strarr('+strtrim(ptnumb, 2)+')' $ |
---|
497 | , 'printer_machine_names = strarr('+strtrim(ptnumb, 2)+')' $ |
---|
498 | , 'print_command = strarr('+strtrim(ptnumb, 2)+')'] |
---|
499 | FOR i = 0, ptnumb-1 DO BEGIN |
---|
500 | init = [init $ |
---|
501 | , 'printer_human_names['+strtrim(i, 2)+'] = ''' $ |
---|
502 | + (*ptresult)[0, i]+'''' $ |
---|
503 | , 'printer_machine_names['+strtrim(i, 2)+'] = ''' $ |
---|
504 | + (*ptresult)[1, i]+'''' $ |
---|
505 | , 'print_command['+strtrim(i, 2)+'] = ''' $ |
---|
506 | + (*ptresult)[2, i]+''''] |
---|
507 | ENDFOR |
---|
508 | ; we freeing the pointer |
---|
509 | ptr_free, ptresult |
---|
510 | ENDIF ELSE BEGIN |
---|
511 | init = [init $ |
---|
512 | , 'printer_human_names = ''''' $ |
---|
513 | , 'printer_machine_names = ''''' $ |
---|
514 | , 'print_command = '''''] |
---|
515 | ENDELSE |
---|
516 | ; |
---|
517 | ; Colors |
---|
518 | ; |
---|
519 | init = [init $ |
---|
520 | , ';' $ |
---|
521 | , '; colors ...' $ |
---|
522 | , ';' $ |
---|
523 | , 'device, decomposed = 0' $ |
---|
524 | , 'device, retain = 2'] |
---|
525 | ; |
---|
526 | ; default color tables |
---|
527 | ; |
---|
528 | loadct, get_names = names |
---|
529 | |
---|
530 | ntables = 40 |
---|
531 | title = [' -------------------------------------- ' $ |
---|
532 | , ' --- Choose the default color table --- ' $ |
---|
533 | , ' -------------------------------------- ', ''] |
---|
534 | ; the following lines come from loadct procedure... |
---|
535 | nlines = (ntables + 2) / 3 ;# of lines to print |
---|
536 | nend = nlines - ((nlines*3) - ntables) |
---|
537 | for i = 0, nend-1 do $ ;Print each line |
---|
538 | title = [title $ |
---|
539 | , string(format = "(i2,'- ',a17, 3x, i2,'- ',a17, 3x, i2,'- ',a17)" $ |
---|
540 | , i, names[i], i+nlines, names[i+nlines] $ |
---|
541 | , i+2*nlines < (ntables-1) $ |
---|
542 | , names[i+2*nlines < (ntables-1)])] |
---|
543 | if (nend lt nlines) then begin |
---|
544 | for i = nend, nlines-1 do $ |
---|
545 | title = [title $ |
---|
546 | , string(format = "(i2,'- ',a17, 3x, i2,'- ',a17)", $ |
---|
547 | i, names[i], i+nlines, names[i+nlines])] |
---|
548 | ENDIF |
---|
549 | title = [title, ''] |
---|
550 | ctnumb = 0 > xask(title = title, value = 39, /long) < 39 |
---|
551 | ; |
---|
552 | init = [init $ |
---|
553 | , 'lct, '+strtrim(ctnumb, 2)] |
---|
554 | ; |
---|
555 | ; postscript position |
---|
556 | ; |
---|
557 | yes = dialog_message(['the default postscript position', 'is landscape?'], /question) |
---|
558 | init = [init $ |
---|
559 | , ';' $ |
---|
560 | , '; postscript parameters ...' $ |
---|
561 | , ';' $ |
---|
562 | , 'key_portrait = '+strtrim(fix(strlowcase(yes) NE 'yes'), 2)] |
---|
563 | ; |
---|
564 | ; paper size |
---|
565 | ; |
---|
566 | list = ['a0 33.0556 46.7778 83.9611 118.816' $ |
---|
567 | , 'a1 23.3889 33.0556 59.4078 83.9611' $ |
---|
568 | , 'a2 16.5278 23.3889 41.9806 59.4078' $ |
---|
569 | , 'a3 11.6944 16.5278 29.7039 41.9806' $ |
---|
570 | , 'a4 8.26389 11.6944 20.9903 29.7039' $ |
---|
571 | , 'a5 5.84722 8.26389 14.8519 20.9903' $ |
---|
572 | , 'a6 4.125 5.84722 10.4775 14.8519' $ |
---|
573 | , 'a7 2.91667 4.125 7.40833 10.4775' $ |
---|
574 | , 'a8 2.05556 2.91667 5.22111 7.40833' $ |
---|
575 | , 'a9 1.45833 2.05556 3.70417 5.22111' $ |
---|
576 | , 'a10 1.02778 1.45833 2.61056 3.70417' $ |
---|
577 | , 'b0 39.3889 55.6667 100.048 141.393' $ |
---|
578 | , 'b1 27.8333 39.3889 70.6967 100.048' $ |
---|
579 | , 'b2 19.6944 27.8333 50.0239 70.6967' $ |
---|
580 | , 'b3 13.9167 19.6944 35.3483 50.0239' $ |
---|
581 | , 'b4 9.84722 13.9167 25.0119 35.3483' $ |
---|
582 | , 'b5 6.95833 9.84722 17.6742 25.0119' $ |
---|
583 | , 'archA 9 12 22.86 30.48' $ |
---|
584 | , 'archB 12 18 30.48 45.72' $ |
---|
585 | , 'archC 18 24 45.72 60.96' $ |
---|
586 | , 'archD 24 36 60.96 91.44' $ |
---|
587 | , 'archE 36 48 91.44 121.92' $ |
---|
588 | , 'flsa 8.5 13 21.59 33.02' $ |
---|
589 | , 'flse 8.5 13 21.59 33.02' $ |
---|
590 | , 'halfletter 5.5 8.5 13.97 21.59' $ |
---|
591 | , 'note 7.5 10 19.05 25.4' $ |
---|
592 | , 'letter 8.5 11 21.59 27.94' $ |
---|
593 | , 'legal 8.5 14 21.59 35.56' $ |
---|
594 | , '11x17 11 17 27.94 43.18' $ |
---|
595 | , 'ledger 17 11 43.18 27.94'] |
---|
596 | base = widget_base(/column) |
---|
597 | trash = widget_label(base, value = '--- Select the paper size ---') |
---|
598 | trash = widget_label(base, value = '') |
---|
599 | trash = widget_label(base, value = 'PAPERSIZE X inches Y inches X cm Y cm', /align_left, uvalue = 'dummy') |
---|
600 | listid = widget_list(base, value = list, uvalue = list, uname = 'list', ysize = n_elements(list) < 15) |
---|
601 | widget_control, listid, set_list_select = 4 |
---|
602 | trash = widget_button(base, value = 'ok', uvalue = 'ok') |
---|
603 | ptresult = ptr_new(/allocate_heap) |
---|
604 | ; we realize the widget and wait for an answer |
---|
605 | widget_control, base, /realize, set_uvalue = ptresult |
---|
606 | xmanager, 'papsize', base |
---|
607 | ; |
---|
608 | papsize = *ptresult |
---|
609 | ; we freeing the pointer |
---|
610 | ptr_free, ptresult |
---|
611 | init = [init $ |
---|
612 | , 'page_size = [' + strtrim(papsize[0], 2) $ |
---|
613 | + ', ' +strtrim(papsize[1], 2) + ']'] |
---|
614 | ; |
---|
615 | ; window size |
---|
616 | ; |
---|
617 | title = [' --- Size of the Window ---', '' $ |
---|
618 | , 'The size of window (in cm) is given by:' $ |
---|
619 | , 'windowsize_scale * page_size, with ' $ |
---|
620 | , 'page_size = [' + strtrim(papsize[0], 2)+ ', ' +strtrim(papsize[1], 2) + ']' $ |
---|
621 | , 'Please select a value for windowsize_scale '] |
---|
622 | wsize_scale = xask(title = title, value = 1, /floating) |
---|
623 | init = [init, 'windowsize_scale = ' + strtrim(wsize_scale, 2)] |
---|
624 | |
---|
625 | ; |
---|
626 | ; postscript archiving... |
---|
627 | ; |
---|
628 | title = [' --- Select the default postscript archiving method ---', ''$ |
---|
629 | , '0 : never archive the postscript' $ |
---|
630 | , '1 : always archive the postscript when printed' $ |
---|
631 | , '2 : ask if the postscript must be archived each time its printed', ''] |
---|
632 | archive_ps = 0 > xask(title = title, value = 0, /long) < 2 |
---|
633 | init = [init $ |
---|
634 | , 'archive_ps = '+strtrim(archive_ps, 2) $ |
---|
635 | , ';' $ |
---|
636 | , ';========================================================' $ |
---|
637 | , '; end of the part that should be modified by the users...' $ |
---|
638 | , ';========================================================' $ |
---|
639 | , ';' $ |
---|
640 | , '; if needed, keep compatibility with the old version' $ |
---|
641 | , ';' $ |
---|
642 | , '@updateold' $ |
---|
643 | , ';' ] |
---|
644 | |
---|
645 | filename = xask(title = ['name of the init file', '(written in homedir: ' + myIDL + ')'], value = 'init.pro', /string) |
---|
646 | journal, myIDL + '/' + filename |
---|
647 | FOR i = 0, n_elements(init)-1 DO journal, init[i] |
---|
648 | journal |
---|
649 | |
---|
650 | RETURN |
---|
651 | END |
---|