- Timestamp:
- 05/11/06 12:35:53 (18 years ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar_event.pro
r68 r69 4 4 5 5 6 case event.value of 7 'Open' :begin 8 newfile = selectfile() 9 if size(newfile, /type) NE 8 then return 10 widget_control, event.top, /hourglass 11 widget_control, event.top, update = 0 12 widget_control, event.top, get_uvalue = top_uvalue 6 case event.value of 7 'Open' :begin 8 oldmeshparams = ccmeshparameters 9 newfile = selectfile() 10 if size(newfile, /type) NE 8 then return 11 widget_control, event.top, /hourglass 12 widget_control, event.top, update = 0 13 widget_control, event.top, get_uvalue = top_uvalue 13 14 ; on s''occupe de filelist 14 15 16 15 filelist = extractatt(top_uvalue, 'filelist') 16 filelist = [filelist, newfile.fileparameters.filename] 17 currentfile = n_elements(filelist)-1 17 18 ; on update le widget 18 19 widget_control, filelistid, set_value = filelist20 widget_control, filelistid, set_list_select = currentfile19 filelistid = widget_info(event.top, find_by_uname = 'filelist') 20 widget_control, filelistid, combobox_additem = file_basename(newfile.fileparameters.filename) 21 widget_control, filelistid, set_combobox_select = currentfile 21 22 ; on update les elements filelist et currentfile de la top_uvalue 22 23 24 23 *top_uvalue[1, findline(top_uvalue, 'filelist')] = filelist 24 oldfile = *top_uvalue[1, findline(top_uvalue, 'currentfile')] 25 *top_uvalue[1, findline(top_uvalue, 'currentfile')] = currentfile 25 26 ; on s''occupe du nom de la variable 26 champid = widget_info(event.top, find_by_uname = 'champ')27 vlstid = widget_info(event.top, find_by_uname = 'varlist') 27 28 ; quel etait le champ selectionne ? on le reselectionne ? 28 oldlistvar = (*(extractatt(top_uvalue, 'fileparameters'))[oldfile]).listvar 29 fieldname = oldlistvar[widget_info(champid,/droplist_select)] 30 index = where(newfile.fileparameters.listvar EQ fieldname) & index = 0>index[0] 31 widget_control, champid, set_value = newfile.fileparameters.listvar 32 widget_control, champid, set_droplist_select = index 29 fieldname = widget_info(vlstid, /combobox_gettext) 30 index = where(newfile.fileparameters.listvar EQ fieldname) 31 widget_control, vlstid, set_value = newfile.fileparameters.listvar 32 widget_control, vlstid, set_combobox_select = 0 > index[0] 33 33 ; on s''occupe du calendrier 34 date1id = widget_info(event.top, find_by_uname = 'calendar1') 35 widget_control, date1id, get_value = date1 36 widget_control, date1id, /destroy 37 if (where(newfile.fileparameters.time_counter EQ date1))[0] EQ -1 $ 38 then date1 = newfile.fileparameters.time_counter[0] 39 date2id = widget_info(event.top, find_by_uname = 'calendar2') 40 widget_control, date2id, get_value = date2 41 widget_control, date2id, /destroy 42 if (where(newfile.fileparameters.time_counter EQ date2))[0] EQ -1 then date2 = date1 43 base12 = widget_info(event.top, find_by_uname = 'base12') 44 rien = cw_calendar(base12,newfile.fileparameters.time_counter,date1, uname = 'calendar1' $ 45 , uvalue = {name:'calendar1'}, /frame) 46 rien = cw_calendar(base12,newfile.fileparameters.time_counter,date2, uname = 'calendar2' $ 47 , uvalue = {name:'calendar2'}, /frame) 48 ; update la grille??? 49 change = changegrid(newfile.meshparameters) 50 if change then BEGIN 51 domainid = widget_info(event.top, find_by_uname = 'domain') 52 widget_control, domainid, set_value = -1 53 endif 34 date1id = widget_info(event.top, find_by_uname = 'calendar1') 35 widget_control, date1id, get_value = date1 36 widget_control, date1id, /destroy 37 if (where(newfile.fileparameters.time_counter EQ date1))[0] EQ -1 $ 38 then date1 = newfile.fileparameters.time_counter[0] 39 date2id = widget_info(event.top, find_by_uname = 'calendar2') 40 widget_control, date2id, get_value = date2 41 widget_control, date2id, /destroy 42 if (where(newfile.fileparameters.time_counter EQ date2))[0] EQ -1 then date2 = date1 43 basecal = widget_info(event.top, find_by_uname = 'basecal') 44 rien = cw_calendar(basecal, newfile.fileparameters.time_counter, date1, uname = 'calendar1' $ 45 , uvalue = {name:'calendar1'}, /frame) 46 rien = cw_calendar(basecal, newfile.fileparameters.time_counter, date2, uname = 'calendar2' $ 47 , uvalue = {name:'calendar2'}, /frame) 54 48 ; on update les elements fileparameters, readparameters et meshparameters de la top_uvalue 55 56 57 58 59 60 49 newfileparameters = ptrarr(currentfile+1, /allocate_heap) 50 FOR i = 0, currentfile-1 DO $ 51 *newfileparameters[i] = *(extractatt(top_uvalue, 'fileparameters'))[i] 52 *newfileparameters[currentfile] = newfile.fileparameters 53 ptr_free, extractatt(top_uvalue, 'fileparameters') 54 *top_uvalue[1, findline(top_uvalue, 'fileparameters')] = newfileparameters 61 55 ; 62 63 64 65 66 67 56 newreadparameters = ptrarr(currentfile+1, /allocate_heap) 57 FOR i = 0, currentfile-1 DO $ 58 *newreadparameters[i] = *(extractatt(top_uvalue, 'readparameters'))[i] 59 *newreadparameters[currentfile] = newfile.readparameters 60 ptr_free, extractatt(top_uvalue, 'readparameters') 61 *top_uvalue[1, findline(top_uvalue, 'readparameters')] = newreadparameters 68 62 ; 69 70 71 72 73 74 63 newmeshparameters = ptrarr(currentfile+1, /allocate_heap) 64 FOR i = 0, currentfile-1 DO $ 65 *newmeshparameters[i] = *(extractatt(top_uvalue, 'meshparameters'))[i] 66 *newmeshparameters[currentfile] = newfile.meshparameters 67 ptr_free, extractatt(top_uvalue, 'meshparameters') 68 *top_uvalue[1, findline(top_uvalue, 'meshparameters')] = newmeshparameters 75 69 ; on actualise le widget! 76 widget_control, event.top, update = 1 77 end 78 'New xxx' :BEGIN 79 widget_control, event.top, get_uvalue = top_uvalue 80 extra = extractatt(top_uvalue, 'extra') 81 xxx, CALLERWIDID = event.top, _extra = extra 82 end 83 'Quit':begin 84 widget_control, event.top, get_uvalue = top_uvalue 85 ptr_free, extractatt(top_uvalue, 'exextra') 86 ptr_free, extractatt(top_uvalue, 'fileparameters') 87 ptr_free, extractatt(top_uvalue, 'readparameters') 88 ptr_free, extractatt(top_uvalue, 'meshparameters') 89 ptr_free, top_uvalue 90 widget_control, event.top, /destroy ;on ferme le widget 91 end 92 'PS' :BEGIN 93 IF lmgr(/demo) EQ 1 THEN BEGIN 94 dummy = report('impossible to save as postscript in demo mode') 95 return 96 ENDIF 97 widget_control,event.top, get_uvalue = top_uvalue 70 if cmpgrid(oldmeshparams) then BEGIN 71 domainid = widget_info(event.top, find_by_uname = 'domain') 72 widget_control, domainid, set_value = -1 73 endif 74 widget_control, event.top, update = 1 75 end 76 'New xxx' :BEGIN 77 widget_control, event.top, get_uvalue = top_uvalue 78 extra = extractatt(top_uvalue, 'extra') 79 xxx, CALLERWIDID = event.top, _extra = extra 80 end 81 'Quit':begin 82 widget_control, event.top, get_uvalue = top_uvalue 83 ptr_free, extractatt(top_uvalue, 'exextra') 84 ptr_free, extractatt(top_uvalue, 'fileparameters') 85 ptr_free, extractatt(top_uvalue, 'readparameters') 86 ptr_free, extractatt(top_uvalue, 'meshparameters') 87 ptr_free, top_uvalue 88 widget_control, event.top, /destroy ;on ferme le widget 89 end 90 'PostScript' :BEGIN 91 IF lmgr(/demo) EQ 1 THEN BEGIN 92 dummy = report('impossible to save as postscript in demo mode') 93 return 94 ENDIF 95 widget_control, event.top, get_uvalue = top_uvalue 96 ; on recupere la liste des instructions 97 globalcommand = extractatt(top_uvalue, 'globalcommand') 98 ; for i = 0, n_elements(globalcommand)-1 do print, globalcommand[i] 99 ; on complete par le premiere et les dernieres lignes du programme 100 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 101 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript' $ 102 +', PORTRAIT = portrait, LANDSCAPE = landscape' $ 103 +', DATE1IN = date1in, DATE2IN = date2in' $ 104 , /POSTSCRIPT 105 END 106 'Animated gif' :begin 107 IF float(strmid(!version.release,0,3)) GE 6.2 THEN xcreateanim, event.top 108 end 109 'Gif' :BEGIN 110 IF lmgr(/demo) EQ 1 THEN BEGIN 111 dummy = report('impossible to save as an image in demo mode') 112 return 113 ENDIF 114 widget_control, event.top, get_uvalue = top_uvalue 115 smallin = extractatt(top_uvalue, 'smallin') 116 numdessinin = smallin[2]-1 117 smallout = extractatt(top_uvalue, 'smallout') 118 numdessinout = smallout[2]-1 119 tracecadre, smallin, /erase 120 tracecadre, smallout, /erase 121 filename = xquestion('dans quelle fichier gif voulez vous sauver !C l''ecran de xxx?', 'xxx_image.gif') 122 if rstrpos(filename, '.gif') NE strlen(filename)-4 then filename = filename+'.gif' 123 filename = isafile(file = filename, io = imagedir, /new) 124 saveimage, filename, /quiet 125 end 126 'IDL procedure':BEGIN 127 IF lmgr(/demo) EQ 1 THEN BEGIN 128 dummy = report('impossible to save as a idl program file in demo mode') 129 return 130 ENDIF 131 ; on recupere le nom du fichier 132 filename = xquestion('dans quelle procedure IDL voulez vous sauver !C la realisation de ce graph?', 'xxx_figure.pro') 133 ; on le complete par un .pro 134 if rstrpos(filename, '.pro') NE strlen(filename)-4 then filename = filename+'.pro' 135 filename = isafile(file = filename, io = homedir, /new) 136 widget_control, event.top, get_uvalue = top_uvalue 98 137 ; portrait ou landscape ??? 99 100 101 102 ; on recupere la liste des instructions103 138 options = extractatt(top_uvalue, 'options') 139 optionsflag = extractatt(top_uvalue, 'optionsflag') 140 portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0] 141 ; on lit les commandes pour faire un plot 142 globalcommand = extractatt(top_uvalue, 'globalcommand') 104 143 ; on complete par le premiere et les dernieres lignes du programme 105 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 106 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape, DATE1IN = date1in, DATE2IN = date2in, _extra = ex' $ 107 , KWDUSED = ', /POSTSCRIPT, PORTRAIT = portrait' 108 END 109 'Anim' :begin 110 ;;; no more working... xcreateanim, event.top 111 end 112 'Gif' :BEGIN 113 IF lmgr(/demo) EQ 1 THEN BEGIN 114 dummy = report('impossible to save as an image in demo mode') 115 return 116 ENDIF 117 widget_control,event.top, get_uvalue = top_uvalue 118 smallin = extractatt(top_uvalue, 'smallin') 119 numdessinin = smallin[2]-1 120 smallout = extractatt(top_uvalue, 'smallout') 121 numdessinout = smallout[2]-1 122 tracecadre, smallin, /erase 123 tracecadre, smallout, /erase 124 filename = xquestion('dans quelle fichier gif voulez vous sauver !C l''ecran de xxx?', 'xxx_image.gif') 125 if rstrpos(filename, '.gif') NE strlen(filename)-4 then filename = filename+'.gif' 126 filename = isafile(file = filename, io = imagedir, /new) 127 saveimage, filename, /quiet 128 end 129 'Script':BEGIN 130 IF lmgr(/demo) EQ 1 THEN BEGIN 131 dummy = report('impossible to save as a idl program file in demo mode') 132 return 133 ENDIF 144 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 145 CASE thisOS of 146 'MAC':sep = ':' 147 'WIN':sep = '\' 148 ELSE:sep = '/' 149 ENDCASE 150 poslastsep = rstrpos(filename, sep) 151 proname = strmid(filename, poslastsep+1, strlen(filename)-poslastsep-1-4) 152 globalcommand = ['pro '+proname+', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape, DATE1IN = date1in, DATE2IN = date2in, _extra = ex' $ 153 , ' ' $ 154 , ' '+globalcommand $ 155 , ' ' $ 156 , 'return' $ 157 , 'end'] 158 ; on les ecrit dans un programme 159 putfile, filename, globalcommand 160 END 161 'RESTORE kwd of xxx':BEGIN 162 IF lmgr(/demo) EQ 1 THEN BEGIN 163 dummy = report('impossible to save the widget in demo mode') 164 return 165 ENDIF 134 166 ; on recupere le nom du fichier 135 filename = xquestion('dans quelle procedure IDL voulez vous sauver !C la realisation de ce graph?', 'xxx_figure.pro') 136 ; on le complete par un .pro 137 if rstrpos(filename, '.pro') NE strlen(filename)-4 then filename = filename+'.pro' 138 filename = isafile(file = filename, io = homedir, /new) 139 widget_control,event.top, get_uvalue = top_uvalue 140 ; portrait ou landscape ??? 141 options = extractatt(top_uvalue, 'options') 142 optionsflag = extractatt(top_uvalue, 'optionsflag') 143 portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0] 144 ; on lit les commandes pour faire un plot 145 globalcommand = extractatt(top_uvalue, 'globalcommand') 146 ; on complete par le premiere et les dernieres lignes du programme 147 thisOS = strupcase(strmid(!version.os_family, 0, 3)) 148 CASE thisOS of 149 'MAC':sep = ':' 150 'WIN':sep = '\' 151 ELSE:sep = '/' 152 ENDCASE 153 poslastsep = rstrpos(filename, sep) 154 proname = strmid(filename, poslastsep+1, strlen(filename)-poslastsep-1-4) 155 globalcommand = ['pro '+proname+', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape, DATE1IN = date1in, DATE2IN = date2in, _extra = ex' $ 156 , '@common' $ 157 , ' ' $ 158 , ' portrait = '+strtrim(portrait, 1) $ 159 , ' '+globalcommand $ 160 , ' ' $ 161 , 'return' $ 162 , 'end'] 163 ; on les ecrit dans un programme 164 putfile, filename, globalcommand 165 END 166 'Widget':BEGIN 167 IF lmgr(/demo) EQ 1 THEN BEGIN 168 dummy = report('impossible to save the widget in demo mode') 169 return 170 ENDIF 171 ; on recupere le nom du fichier 172 filename = xquestion('dans quel fichier bianire voulez vous sauver le widget ?', 'xxx_widget.dat') 167 filename = xquestion('dans quel fichier bianire voulez vous sauver le widget ?', 'xxx_widget.dat') 173 168 ; on le complete par un .dat 174 175 169 if rstrpos(filename, '.dat') NE strlen(filename)-4 then filename = filename+'.dat' 170 filename = isafile(file = filename, io = homedir, /new) 176 171 ; 177 widget_control, event.top, get_uvalue = uvalue 178 widget_control, extractatt(uvalue, 'graphid'),get_value=win 179 wshow, win 180 wset, win 181 image = tvrd(/true) 182 save, uvalue, image, filename = filename 183 END 184 'Prompt':BEGIN 185 commande = getfile(myuniquetmpdir + 'xxx_oneplot.pro') 186 for i = 0, n_elements(commande)-1 do print, commande[i] 187 end 188 'Ok button' :begin 189 widget_control, event.top, get_uvalue = top_uvalue 190 options = extractatt(top_uvalue, 'options') 191 index = where(options EQ 'Ok button') & index = index[0] 192 optionsflag = extractatt(top_uvalue, 'optionsflag') 193 flag = 1-optionsflag[index, 0] 194 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = flag 195 widget_control, widget_info(event.top, find_by_uname = 'base ok button'), map = flag 196 end 197 'Portrait/Landscape' :begin 198 widget_control, event.top, get_uvalue = top_uvalue 199 options = extractatt(top_uvalue, 'options') 200 index = where(options EQ 'Portrait/Landscape') & index = index[0] 201 optionsflag = extractatt(top_uvalue, 'optionsflag') 202 key_portrait= 1-optionsflag[index, 0] 203 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = key_portrait 172 widget_control, event.top, get_uvalue = uvalue 173 widget_control, extractatt(uvalue, 'graphid'), get_value = win 174 wshow, win 175 wset, win 176 image = tvrd(/true) 177 save, uvalue, image, filename = filename 178 END 179 'Print to prompt':BEGIN 180 commande = getfile(myuniquetmpdir + 'xxx_oneplot.pro') 181 for i = 0, n_elements(commande)-1 do print, commande[i] 182 end 183 'Portrait/Landscape' :begin 184 widget_control, event.top, get_uvalue = top_uvalue 185 options = extractatt(top_uvalue, 'options') 186 index = where(options EQ 'Portrait/Landscape') & index = index[0] 187 optionsflag = extractatt(top_uvalue, 'optionsflag') 188 key_portrait = 1-optionsflag[index, 0] 189 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = key_portrait 204 190 ; fenetre separee ou fenetre collee au widget ? 205 191 if widget_info(event.top, find_by_uname = 'graph') EQ 0 then BEGIN 206 192 ; on tue la fenetre 207 208 193 graphid = extractatt(top_uvalue, 'graphid') 194 widget_control, widget_info(graphid, /parent), /destroy 209 195 ; on la recree 210 211 212 213 214 215 , xsize = windsize[0],ysize = windsize[1])216 widget_control,basegraph,/realize217 xmanager,'xxx',basegraph, /no_block196 basegraph = widget_base(title = 'xxx window', group_leader = event.top, uvalue = event.top, uname = 'basegraph') 197 windsize = givewindowsize() 198 graphid = widget_draw(basegraph, uname = 'graph' $ 199 , uvalue = {name:'graph', press:0, click:0, x:[0., 0.], y:[0., 0.]} $ 200 , /button_events, retain = 2 $ 201 , xsize = windsize[0], ysize = windsize[1]) 202 widget_control, basegraph, /realize 203 xmanager, 'xxx', basegraph, /no_block 218 204 ; on redessine ce qu''il y avait dedans 219 205 ; on recupere la liste des instructions 220 206 globalcommand = extractatt(top_uvalue, 'globalcommand') 221 207 ; on complete par le premiere et les dernieres lignes du programme 222 223 224 208 createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $ 209 , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape' $ 210 , KWDUSED = ', /noerase, PORTRAIT = portrait' 225 211 ; on reattribue l''element graphid de la top_uvalue 226 227 228 229 230 231 232 233 234 235 236 237 238 212 *top_uvalue[1, findline(top_uvalue, 'graphid')] = graphid 213 ENDIF ELSE BEGIN 214 extra = extractatt(top_uvalue, 'extra') 215 xxx, CALLERWIDID = event.top, /redraw, _extra = extra 216 widget_control, event.top, /destroy ;on ferme le widget 217 ENDELSE 218 end 219 'Overlay' :begin 220 widget_control, event.top, get_uvalue = top_uvalue 221 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 222 options = extractatt(top_uvalue, 'options') 223 flags = extractatt(top_uvalue, 'optionsflag') 224 index = where(options EQ 'Overlay') 239 225 ; on change le flag sur Longitude / x index 240 226 flag = 1-flags[index, numdessinin] & flag = flag[0] 241 227 ; on le reeatribue 242 243 244 245 246 247 248 249 228 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 229 end 230 'Vecteur':BEGIN 231 widget_control, event.top, get_uvalue = top_uvalue 232 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 233 options = extractatt(top_uvalue, 'options') 234 flags = extractatt(top_uvalue, 'optionsflag') 235 index = where(options EQ 'Vecteur') 250 236 ; on change le flag sur Longitude / x index 251 237 flag = 1-flags[index, numdessinin] & flag = flag[0] 252 238 ; on le reeatribue 253 254 255 256 257 258 259 260 239 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 240 end 241 'Longitude / x index':BEGIN 242 widget_control, event.top, get_uvalue = top_uvalue 243 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 244 options = extractatt(top_uvalue, 'options') 245 flags = extractatt(top_uvalue, 'optionsflag') 246 index = where(options EQ 'Longitude / x index') 261 247 ; on change le flag sur Longitude / x index 262 248 flag = 1-flags[index, numdessinin] & flag = flag[0] 263 249 ; on le reeatribue 264 250 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 265 251 ; maintenant on va changer les sliders definissant la boxzoom 266 267 252 domainid = widget_info(event.top, find_by_uname = 'domain') 253 boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin] 268 254 ; on veut retrouver le type de grille qui est utilisee 269 currentfile = extractatt(top_uvalue, 'currentfile') 270 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid 271 indexvar = widget_info(widget_info(event.top, find_by_uname = 'champ'), /droplist_select) 272 vargrid = strupcase(listgrid[indexvar]) 273 if flag EQ 0 then BEGIN ; longitudes 255 currentfile = extractatt(top_uvalue, 'currentfile') 256 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid 257 listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar 258 vlstid = widget_info(event.top, find_by_uname = 'varlist') 259 namevar = widget_info(vlstid, /combobox_gettext) 260 indexvar = where(listvar EQ namevar) 261 vargrid = strupcase(listgrid[indexvar]) 262 if flag EQ 0 then BEGIN ; longitudes 274 263 ; on fait un domdef pour retrouver le lon1 lon2 correspondant a la 275 264 ; boxzoom definie sur le widget... 276 277 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0]278 279 ENDIF ELSE BEGIN; xindex265 domdef, boxzoom, gridtype = vargrid, /xindex $ 266 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0] 267 widget_control, domainid, set_value = [lon1, lon2, boxzoom[2:3]] 268 ENDIF ELSE BEGIN ; xindex 280 269 ; maintenant ion veut retrouver firstx, lastx correspondant a la 281 270 ; boxzoom definie sur le widget... 282 283 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0]284 grille, -1, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz285 286 271 domdef, boxzoom, gridtype = vargrid $ 272 , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0] 273 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 274 widget_control, domainid, set_value = [firstx, lastx, boxzoom[2:3]] 275 ENDELSE 287 276 ; on met a jour la top_uvalue 288 289 290 291 292 293 294 295 296 277 widget_control, domainid, get_value = boxzoom 278 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom 279 end 280 'Latitude / y index':begin 281 widget_control, event.top, get_uvalue = top_uvalue 282 numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1 283 options = extractatt(top_uvalue, 'options') 284 flags = extractatt(top_uvalue, 'optionsflag') 285 index = where(options EQ 'Latitude / y index') 297 286 ; on change le flag sur Latitude / y index 298 287 flag = 1-flags[index, numdessinin] & flag = flag[0] 299 288 ; on le reeatribue 300 289 (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag 301 290 ; maintenant on va changer les sliders definissant la boxzoom 302 303 291 domainid = widget_info(event.top, find_by_uname = 'domain') 292 boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin] 304 293 ; on veut retrouver le type de grille qui est utilisee 305 currentfile = extractatt(top_uvalue, 'currentfile') 306 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid 307 indexvar = widget_info(widget_info(event.top, find_by_uname = 'champ'), /droplist_select) 308 vargrid = strupcase(listgrid[indexvar]) 309 if flag EQ 0 then BEGIN ; latitudes 294 currentfile = extractatt(top_uvalue, 'currentfile') 295 listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid 296 listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar 297 vlstid = widget_info(event.top, find_by_uname = 'varlist') 298 namevar = widget_info(vlstid, /combobox_gettext) 299 indexvar = where(listvar EQ namevar) 300 vargrid = strupcase(listgrid[indexvar]) 301 if flag EQ 0 then BEGIN ; latitudes 310 302 ; on fait un domdef pour retrouver le lat1 lat2 correspondant a la 311 303 ; boxzoom definie sur le widget... 312 313 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0]314 315 ENDIF ELSE BEGIN; yindex304 domdef, boxzoom, gridtype = vargrid, /yindex $ 305 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0] 306 widget_control, domainid, set_value = [boxzoom[0:1], lat1, lat2] 307 ENDIF ELSE BEGIN ; yindex 316 308 ; maintenant ion veut retrouver firsty, lasty correspondant a la 317 309 ; boxzoom definie sur le widget... 318 319 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0]320 grille, -1, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz321 322 310 domdef, boxzoom, gridtype = vargrid $ 311 , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0] 312 grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz 313 widget_control, domainid, set_value = [boxzoom[0:1], firsty, lasty] 314 ENDELSE 323 315 ; on met a jour la top_uvalue 324 325 326 end327 328 316 widget_control, domainid, get_value = boxzoom 317 (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom 318 END 319 endcase 320 return 329 321 end 330 ;------------------------------------------------331 PRO xxxmenubar, parent, OPTIONS =options, _EXTRA = ex332 ; desc = [ '1\Colors' , $333 ; '0\Red' , $334 ; '0\Green' , $335 ; '1\Blue' , $336 ; '0\Light' , $337 ; '0\Medium' , $338 ; '0\Dark' , $339 ; '0\Navy' , $340 ; '2\Royal' , $341 ; '0\Cyan' , $342 ; '2\Magenta' , $343 ; '2\Quit' ]344 desc = [ '1\File' , $345 '0\Open' , $346 '0\New xxx' , $347 '2\Quit', $348 '1\Save as' , $349 '0\PS' , $350 '0\Anim' , $351 '0\Gif' , $352 '0\Script', $353 '0\Widget', $354 '2\Prompt', $355 '1\Flag options']356 descsuite = options357 if n_elements(descsuite) GE 2 then $358 descsuite[0:n_elements(descsuite)-2] = '0\'+descsuite[0:n_elements(descsuite)-2]359 descsuite[n_elements(descsuite)-1] = '2\'+descsuite[n_elements(descsuite)-1]360 desc = [desc, descsuite]361 362 menu = CW_PDMENU(parent, desc, /RETURN_NAME, /mbar, uname = 'menubar', uvalue = {name:'menubar'}, _EXTRA = ex)363 364 365 ;------------------------------------------------366 return367 end
Note: See TracChangeset
for help on using the changeset viewer.