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