[67] | 1 | ;+ |
---|
[231] | 2 | ; |
---|
[157] | 3 | ; @file_comments |
---|
[327] | 4 | ; slightly modified version of cw_field ... |
---|
[67] | 5 | ; |
---|
[157] | 6 | ; @categories |
---|
[67] | 7 | ; |
---|
[327] | 8 | ; @param parent {in}{required} |
---|
[157] | 9 | ; The ID of the parent widget. |
---|
[67] | 10 | ; |
---|
[231] | 11 | ; @keyword COLUMN |
---|
[157] | 12 | ; Buttons will be arranged in the number of columns specified by this keyword. |
---|
[67] | 13 | ; |
---|
[157] | 14 | ; @keyword ROW |
---|
| 15 | ; Buttons will be arranged in the number of rows specified by this keyword. |
---|
[67] | 16 | ; |
---|
[157] | 17 | ; @keyword EVENT_FUNC |
---|
[231] | 18 | ; The name of an optional user-supplied event function for buttons. |
---|
| 19 | ; This function is called with the return value structure whenever a |
---|
[157] | 20 | ; button is pressed, and follows the conventions for user-written event functions. |
---|
[67] | 21 | ; |
---|
[157] | 22 | ; @keyword FLOATING |
---|
[67] | 23 | ; |
---|
[157] | 24 | ; @keyword INTEGER |
---|
[67] | 25 | ; |
---|
[157] | 26 | ; @keyword LONG |
---|
[67] | 27 | ; |
---|
[157] | 28 | ; @keyword STRING |
---|
[67] | 29 | ; |
---|
[157] | 30 | ; @keyword FONT |
---|
[231] | 31 | ; The name of the font to be used for the button titles. If this keyword |
---|
[157] | 32 | ; is not specified, the default font is used. |
---|
[67] | 33 | ; |
---|
[157] | 34 | ; @keyword FRAME |
---|
| 35 | ; Specifies the width of the frame to be drawn around the base. |
---|
[67] | 36 | ; |
---|
[157] | 37 | ; @keyword TITLE |
---|
| 38 | ; The title of the window |
---|
[67] | 39 | ; |
---|
[157] | 40 | ; @keyword UVALUE |
---|
| 41 | ; The user value to be associated with the widget. |
---|
[67] | 42 | ; |
---|
[157] | 43 | ; @keyword VALUE |
---|
[67] | 44 | ; |
---|
[157] | 45 | ; @keyword RETURN_EVENTS |
---|
[67] | 46 | ; |
---|
[157] | 47 | ; @keyword ALL_EVENTS |
---|
[67] | 48 | ; |
---|
[157] | 49 | ; @keyword FIELDFONT |
---|
[67] | 50 | ; |
---|
[157] | 51 | ; @keyword NOEDIT |
---|
[67] | 52 | ; |
---|
[157] | 53 | ; @keyword TEXT_FRAME |
---|
[67] | 54 | ; |
---|
[157] | 55 | ; @keyword XSIZE |
---|
[231] | 56 | ; The width of the base |
---|
[67] | 57 | ; |
---|
[157] | 58 | ; @keyword YSIZE |
---|
| 59 | ; The height of the base. |
---|
[67] | 60 | ; |
---|
[157] | 61 | ; @keyword UNAME |
---|
| 62 | ; The user name to be associated with the widget. |
---|
[67] | 63 | ; |
---|
[157] | 64 | ; @returns |
---|
[67] | 65 | ; |
---|
[157] | 66 | ; @uses |
---|
[67] | 67 | ; |
---|
[223] | 68 | ; @restrictions |
---|
[67] | 69 | ; |
---|
[157] | 70 | ; @examples |
---|
[67] | 71 | ; |
---|
[157] | 72 | ; @history |
---|
| 73 | ; |
---|
| 74 | ; @version |
---|
| 75 | ; $Id$ |
---|
[67] | 76 | ;- |
---|
[327] | 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 |
---|
[114] | 86 | ; |
---|
| 87 | compile_opt idl2, strictarrsubs |
---|
| 88 | ; |
---|
[67] | 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 | |
---|
[237] | 123 | Base = WIDGET_BASE(parent, ROW=row, COLUMN=column, UVALUE=uvalue, $ |
---|
[67] | 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 | ; |
---|
[157] | 153 | ;+ |
---|
[327] | 154 | ; |
---|
[157] | 155 | ; @file_comments |
---|
[327] | 156 | ; get back the ids of the cw_field widgets |
---|
[157] | 157 | ; |
---|
| 158 | ; @categories |
---|
| 159 | ; |
---|
| 160 | ; @param EVENT |
---|
| 161 | ; |
---|
| 162 | ; @returns |
---|
[231] | 163 | ; |
---|
[157] | 164 | ; @uses |
---|
[231] | 165 | ; |
---|
[157] | 166 | ; @restrictions |
---|
[231] | 167 | ; |
---|
[157] | 168 | ; @examples |
---|
[231] | 169 | ; |
---|
[157] | 170 | ; @history |
---|
[231] | 171 | ; |
---|
| 172 | ; @version |
---|
[157] | 173 | ; $Id$ |
---|
[327] | 174 | ; |
---|
[157] | 175 | ;- |
---|
[67] | 176 | PRO printerdef_event, event |
---|
[114] | 177 | ; |
---|
| 178 | compile_opt idl2, strictarrsubs |
---|
| 179 | ; |
---|
[67] | 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 | ; |
---|
[157] | 206 | ;+ |
---|
[231] | 207 | ; |
---|
[157] | 208 | ; @file_comments |
---|
[327] | 209 | ; get back the ids of the cw_field widgets |
---|
[157] | 210 | ; |
---|
| 211 | ; @categories |
---|
| 212 | ; |
---|
| 213 | ; @param EVENT |
---|
| 214 | ; |
---|
[231] | 215 | ; @returns |
---|
[157] | 216 | ; |
---|
| 217 | ; @uses |
---|
[231] | 218 | ; |
---|
[157] | 219 | ; @restrictions |
---|
[231] | 220 | ; |
---|
[157] | 221 | ; @examples |
---|
[231] | 222 | ; |
---|
[157] | 223 | ; @history |
---|
[231] | 224 | ; |
---|
| 225 | ; @version |
---|
[157] | 226 | ; $Id$ |
---|
[327] | 227 | ; |
---|
[157] | 228 | ;- |
---|
[67] | 229 | PRO papsize_event, event |
---|
[114] | 230 | ; |
---|
| 231 | compile_opt idl2, strictarrsubs |
---|
| 232 | ; |
---|
[67] | 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 | ; |
---|
[157] | 248 | ;+ |
---|
| 249 | ; @file_comments |
---|
[327] | 250 | ; now we give the answer to buildinit.pro by using the pointer uvalue |
---|
[157] | 251 | ; |
---|
| 252 | ; @categories |
---|
| 253 | ; |
---|
[327] | 254 | ; @param event |
---|
[157] | 255 | ; |
---|
[231] | 256 | ; @returns |
---|
[157] | 257 | ; |
---|
| 258 | ; @uses |
---|
[231] | 259 | ; |
---|
[157] | 260 | ; @restrictions |
---|
[231] | 261 | ; |
---|
[157] | 262 | ; @examples |
---|
[231] | 263 | ; |
---|
[157] | 264 | ; @history |
---|
[231] | 265 | ; |
---|
| 266 | ; @version |
---|
[157] | 267 | ; $Id$ |
---|
[327] | 268 | ; |
---|
[157] | 269 | ;- |
---|
[67] | 270 | PRO xask_event, event |
---|
[114] | 271 | ; |
---|
| 272 | compile_opt idl2, strictarrsubs |
---|
| 273 | ; |
---|
[67] | 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 | ; |
---|
[231] | 281 | ;+ |
---|
[67] | 282 | ; |
---|
[157] | 283 | ; @file_comments |
---|
| 284 | ; |
---|
| 285 | ; @categories |
---|
| 286 | ; |
---|
| 287 | ; @keyword _EXTRA |
---|
[231] | 288 | ; Used to pass keywords |
---|
[157] | 289 | ; |
---|
| 290 | ; @returns |
---|
[231] | 291 | ; |
---|
[157] | 292 | ; @uses |
---|
[231] | 293 | ; |
---|
[157] | 294 | ; @restrictions |
---|
[231] | 295 | ; |
---|
[157] | 296 | ; @examples |
---|
[231] | 297 | ; |
---|
[157] | 298 | ; @history |
---|
[231] | 299 | ; |
---|
| 300 | ; @version |
---|
[157] | 301 | ; $Id$ |
---|
[327] | 302 | ; |
---|
[157] | 303 | ;- |
---|
[327] | 304 | FUNCTION xask, _EXTRA=ex |
---|
[114] | 305 | ; |
---|
| 306 | compile_opt idl2, strictarrsubs |
---|
| 307 | ; |
---|
[231] | 308 | base = widget_base() |
---|
| 309 | field = cw_field2(base, /frame, /return_events, /column, _extra = ex) |
---|
[67] | 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 | ; |
---|
[231] | 321 | ;+ |
---|
[67] | 322 | ; |
---|
[157] | 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 | ; |
---|
[231] | 334 | ; @returns |
---|
[157] | 335 | ; |
---|
| 336 | ; @uses |
---|
[231] | 337 | ; |
---|
[157] | 338 | ; @restrictions |
---|
[231] | 339 | ; |
---|
[157] | 340 | ; @examples |
---|
[231] | 341 | ; |
---|
[157] | 342 | ; @history |
---|
[231] | 343 | ; |
---|
| 344 | ; @version |
---|
[157] | 345 | ; $Id$ |
---|
[327] | 346 | ; |
---|
[157] | 347 | ;- |
---|
[327] | 348 | FUNCTION getdir, TITLE=title, NOMARK=nomark, NOWRITE=nowrite |
---|
[114] | 349 | ; |
---|
| 350 | compile_opt idl2, strictarrsubs |
---|
| 351 | ; |
---|
[231] | 352 | |
---|
[67] | 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 | ; |
---|
[157] | 366 | ;+ |
---|
[231] | 367 | ; |
---|
[157] | 368 | ; @file_comments |
---|
| 369 | ; |
---|
| 370 | ; @categories |
---|
| 371 | ; |
---|
[231] | 372 | ; @returns |
---|
[157] | 373 | ; |
---|
| 374 | ; @uses |
---|
[231] | 375 | ; |
---|
[157] | 376 | ; @restrictions |
---|
[231] | 377 | ; |
---|
[157] | 378 | ; @examples |
---|
[231] | 379 | ; |
---|
[157] | 380 | ; @history |
---|
[231] | 381 | ; |
---|
| 382 | ; @version |
---|
[157] | 383 | ; $Id$ |
---|
[327] | 384 | ; |
---|
[157] | 385 | ;- |
---|
[67] | 386 | PRO buildinit |
---|
| 387 | ; |
---|
[114] | 388 | compile_opt idl2, strictarrsubs |
---|
| 389 | ; |
---|
[231] | 390 | IF fix(strmid(!version.release, 0, 1)) LT 6 THEN BEGIN |
---|
[67] | 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+''') $' $ |
---|
[229] | 423 | , ' + path_sep(/search_path) + expand_path(''+'' + '''+saxodir+''') $' $ |
---|
| 424 | , ' + path_sep(/search_path) + expand_path(''+'' + !dir)'] |
---|
[67] | 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) |
---|
[231] | 431 | |
---|
[67] | 432 | init = [init $ |
---|
| 433 | , ';' $ |
---|
| 434 | , '; compatibility with the old version' $ |
---|
| 435 | , ';' $ |
---|
[231] | 436 | , 'keep_compatibility, ' + strtrim(fix(yes EQ 'yes'), 2)] |
---|
[67] | 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 | ; |
---|
[231] | 470 | ; define all the printer parameters |
---|
[67] | 471 | ; |
---|
| 472 | init = [init $ |
---|
| 473 | , ';' $ |
---|
| 474 | , '; define printer parameters' $ |
---|
| 475 | , ';' ] |
---|
| 476 | ; |
---|
| 477 | IF ptnumb NE 0 THEN BEGIN |
---|
[231] | 478 | base = widget_base(/column, /frame) |
---|
[67] | 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 $ |
---|
[231] | 483 | , Title = 'printer_human_names['+strtrim(i, 2)+'] = ') |
---|
[67] | 484 | cwids[1, i] = cw_field(subbase, /string $ |
---|
[231] | 485 | , Title = 'printer_machine_names['+strtrim(i, 2)+'] = ') |
---|
[67] | 486 | cwids[2, i] = cw_field(subbase, /string, value = '\lpr -P' $ |
---|
[231] | 487 | , Title = 'print_command['+strtrim(i, 2)+'] = ') |
---|
[67] | 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 = '''''] |
---|
[231] | 515 | ENDELSE |
---|
[67] | 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 | ; |
---|
[231] | 557 | yes = dialog_message(['the default postscript position', 'is landscape?'], /question) |
---|
[67] | 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'] |
---|
[231] | 596 | base = widget_base(/column) |
---|
[67] | 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)] |
---|
[231] | 624 | |
---|
[67] | 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 | , ';' $ |
---|
[76] | 640 | , '; if needed, keep compatibility with the old version' $ |
---|
| 641 | , ';' $ |
---|
[67] | 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 |
---|