Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcommand.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcommand.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildcommand.pro	(revision 49)
@@ -0,0 +1,414 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:buildcommand
+;
+; PURPOSE:cette fonction reourne un string qui contient la commande de
+; lecture et les parametres du trace.
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:
+; 
+; INPUTS:
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION buildcommand, base, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, BOXZOOM = boxzoom
+;
+;------------------------------------------------------------
+; on recuper les ID des differents widgets 
+;------------------------------------------------------------
+   filelistid = widget_info(base, find_by_uname = 'filelist')
+   champid = widget_info(base, find_by_uname = 'champ')
+   nomexpid = widget_info(base, find_by_uname = 'nom_exp')
+   date1id = widget_info(base, find_by_uname = 'calendar1')
+   date2id = widget_info(base, find_by_uname = 'calendar2')
+   domainid = widget_info(base, find_by_uname = 'domain')
+   graphtypeid = widget_info(base, find_by_uname = 'action')
+;   optionid = widget_info(base, find_by_uname = 'option')
+;------------------------------------------------------------
+   widget_control,base, get_uvalue = top_uvalue
+   smallin = extractatt(top_uvalue, 'smallin')
+   numdessinin = smallin[2]-1
+   smallout = extractatt(top_uvalue, 'smallout')
+   numdessinout = smallout[2]-1
+;------------------------------------------------------------
+;---------------
+; on determine quelle procedure on va etre appele pour faire le dessin
+; et le type
+;---------------
+   widget_control,graphtypeid, get_uvalue = graphtype_uvalue
+   type = graphtype_uvalue.choix[widget_info(graphtypeid, /droplist_select)]
+;   type = top_uvalue.nameprocedures[numdessinin]
+   case type of
+      'plt':procedure = 'plt'
+      'pltz':procedure = 'pltz'
+      'pltt':procedure = 'pltt'
+      'xy':procedure = 'plt'
+      'xz':procedure = 'pltz'
+      'yz':procedure = 'pltz'
+      'xt':procedure = 'pltt'
+      'yt':procedure = 'pltt'
+      'zt':procedure = 'pltt'
+      'x':procedure = 'plt1d'
+      'y':procedure = 'plt1d'
+      'z':procedure = 'plt1d'
+      't':procedure = 'pltt'
+   endcase
+   if keyword_set(forplth) then BEGIN 
+      procedure = 'plt'
+      type = 'plt'
+   ENDIF 
+   if keyword_set(forpltz) then BEGIN 
+      procedure = 'pltz'
+      type = 'pltz'
+   ENDIF 
+   if keyword_set(forpltt) then BEGIN 
+      procedure = 'pltt'
+      type = 'pltt'
+   ENDIF
+;
+;  recherche des options
+;
+   options = extractatt(top_uvalue, 'options')   
+   optionsflag = extractatt(top_uvalue, 'optionsflag')
+   flags = optionsflag[*, numdessinin]
+   xindex = (flags[where(options EQ 'Longitude / x index')])[0]
+   yindex = (flags[where(options EQ 'Latitude / y index')])[0]
+   drawvecteur = (flags[where(options EQ 'Vecteur')])[0]*(procedure eq 'plt')
+   drawover = (flags[where(options EQ 'Overlay')])[0]
+;
+   alreadyread = extractatt(top_uvalue, 'alreadyread')
+   alreadyvector = extractatt(top_uvalue, 'alreadyvector')
+   alreadyover = extractatt(top_uvalue, 'alreadyoer')
+; que devons-nous lire ?
+   case 1 of
+      alreadyover NE -1:BEGIN
+         toread = alreadyover+1
+         whichread = 'over'
+      END
+      alreadyvector NE -1 AND alreadyvector NE !pi:BEGIN
+         toread = alreadyvector+1
+         whichread = 'vector'
+      END
+      alreadyread NE -1 AND alreadyread NE !pi AND alreadyread NE 2.*!pi:BEGIN
+         toread = alreadyread+1
+         whichread = 'classic'
+      END
+      else:BEGIN
+         case 1 of
+            alreadyvector eq !pi:BEGIN
+               toread = alreadyover+1
+               whichread = 'over'
+            END
+            alreadyread EQ !pi:BEGIN
+               toread = alreadyvector+1
+               whichread = 'vector'
+            END
+            alreadyread EQ 2.*!pi:BEGIN
+               toread = alreadyover+1
+               whichread = 'over'
+            END
+            ELSE:BEGIN
+               toread = alreadyread+1
+               whichread = 'classic'
+            END
+         endcase
+      END
+   ENDCASE
+;
+   widget_control, nomexpid, get_value = widcommand
+   widcommand = strcompress(widcommand[0], /remove_all)
+   cutcommand, widcommand, toread, coef, numberofread, operation, nameexp, separator, add
+;
+   readcommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = whichread EQ 'classic' AND alreadyread EQ -1)
+; on choppe la ligne ou il y a litchamp pour appliquer coef et operateur
+   i = 0
+   while strpos(readcommande[i], 'litchamp') EQ -1 do i = i+1
+;-----------------------
+;-----------------------
+;-----------------------
+;-----------------------
+;-----------------------
+   case whichread of
+      'classic':BEGIN
+         if alreadyread+1 EQ 0 then BEGIN
+; on commence a ecrire la commande de lecture...
+            readcommande = ['; beginning of reading the field to draw' $
+                            , '; field number: '+strtrim(alreadyread+2, 1), readcommande]
+            readcommande[i+2] = 'field = '+coef+operation+readcommande[i+2]
+            *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+         ENDIF ELSE BEGIN
+            readcommande = ['; field number: '+strtrim(alreadyread+2, 1), readcommande]
+            readcommande[i+1] = 'field = field'+separator+coef+operation+readcommande[i+1]
+            readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+            *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+         ENDELSE
+         if alreadyread+1 NE numberofread-1 THEN BEGIN 
+; si il faut lire d''autres champs on sort
+            *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = alreadyread+1
+            *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyread+3, 1))
+            return,  ''
+         ENDIF
+; on finalise la commande de lecture
+         readcommande = [readcommande, 'field = field'+add $
+                         , 'field = create_struct({tab:field, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $
+                         , '; end of reading the field to draw', ';']
+; on recupere le _EXTRA:
+         extra = extractatt(top_uvalue, 'extra')
+         if xindex NE 0 then extra = create_struct(extra, 'xindex', xindex)
+         if yindex NE 0 then extra = create_struct(extra, 'yindex', yindex)
+         exextra = cw_specifie_get_value(base)
+         extra =  mixstru(exextra,extra)
+         sextra = struct2string(extra)
+         readcommande = [readcommande, 'extra = '+sextra]
+;
+         *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+         case 1 of
+            drawvecteur:BEGIN
+; quelle function de lecture utilisons nous? trace des vecteurs de
+; facon automatique ou non?
+               currentfile = extractatt(top_uvalue, 'currentfile')
+               funclec_name = *(extractatt(top_uvalue, 'readparameters'))[currentfile]
+               funclec_name = funclec_name.funclec_name
+               if funclec_name EQ 'read_ncdf' then begin
+; il faut lire des vecteurs maintenant?
+                  *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = !pi
+                  *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the zonal component of vector')
+                  return,  ''
+               ENDIF ELSE BEGIN
+; on fait un trace automatique en appelant un et vn ...
+                  readuncommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = 0, namefield = 'un')
+                  i = 0
+                  while strpos(readuncommande[i], 'litchamp') EQ -1 do i = i+1
+                  readuncommande = ['; reading the zonal component of vector', readuncommande]
+                  readuncommande[i+1] = 'fieldu = '+readuncommande[i+1]
+                  readuncommande = [readuncommande,'fieldu = create_struct({tab:fieldu, grille:vargrid, unite:varunit, experience:varexp, nom:varname})']
+;
+                  readvncommande = buildreadcommand(base, ''''+nameexp+'''', procedure, type, BOXZOOM = boxzoom, complete = 0, namefield = 'vn')
+                  i = 0
+                  while strpos(readvncommande[i], 'litchamp') EQ -1 do i = i+1
+                  readvncommande = ['; reading the zonal component of vector', readvncommande]
+                  readvncommande[i+1] = 'fieldv = '+readvncommande[i+1]
+                  readvncommande = [readvncommande,'fieldv = create_struct({tab:fieldv, grille:vargrid, unite:varunit, experience:varexp, nom:varname})']
+;
+                  readcommande = [readcommande,';', readuncommande, ';', readvncommande]
+                  *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+; on enchaine sur un over plot???
+                  if drawover then begin
+                     *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = 2.*!pi
+                     *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay')
+                     return,  ''
+                  ENDIF ELSE *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1
+               ENDELSE
+            END
+            drawover:BEGIN
+; il faut lire un autre champ a surcontourer?
+               *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = 2.*!pi
+               *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay')
+               return,  ''
+            END
+; c'est tout pour la lecture, on va tracer!
+            ELSE:*top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1
+         endcase
+      END
+      'vector':BEGIN
+; pour lesvecteurs, il y a 2 composantes! en u et en v donc il faut
+; doubler la lecture. pour alreadyvector entier, on lit u pour
+; alreadyvector entier+0.5, on lit v!
+         if floor(alreadyvector)+1 EQ 0 then begin
+            if floor(alreadyvector) EQ alreadyvector then begin
+               readcommande = ['; beginning of reading the zonal component of vector' $
+                               , '; fieldu number: '+strtrim(alreadyvector+2, 1), readcommande]
+               readcommande[i+2] = 'fieldu = '+coef+operation+readcommande[i+2]
+               readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+            ENDIF ELSE BEGIN
+               readcommande = ['; beginning of reading the meridional component of vector' $
+                               , '; fieldv number: '+strtrim(floor(alreadyvector)+2, 1), readcommande]
+               readcommande[i+2] = 'fieldv = '+coef+operation+readcommande[i+2]
+               readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+            ENDELSE
+         ENDIF ELSE BEGIN
+            if floor(alreadyvector) EQ alreadyvector then begin
+               readcommande = ['; fieldu number: '+strtrim(alreadyvector+2, 1), readcommande]
+               readcommande[i+1] = 'fieldu = fieldu'+separator+coef+operation+readcommande[i+1]
+               readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+            ENDIF ELSE BEGIN
+               readcommande = ['; fieldv number: '+strtrim(floor(alreadyvector)+2, 1), readcommande]
+               readcommande[i+1] = 'fieldv = fieldv'+separator+coef+operation+readcommande[i+1]
+               readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+            ENDELSE
+         ENDELSE
+         *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+;
+         case alreadyvector+1 of
+            numberofread-1:BEGIN
+; on finalise la commande de lecture
+               readcommande = [readcommande, 'fieldu = fieldu'+add $
+                               , 'fieldu = create_struct({tab:fieldu, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $
+                               , '; end of reading the zonal component of vector', ';']
+               *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+; on vient de finir le lecture des U
+               *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -.5
+               *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the meridional component of vector')
+               return,  ''
+            END
+            numberofread-0.5:BEGIN
+; on finalise la commande de lecture
+               readcommande = [readcommande, 'fieldv = fieldv'+add $
+                               , 'fieldv = create_struct({tab:fieldv, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $
+                               , '; end of reading the meridional component of vector', ';']
+; on vient de finir le lecture des V
+;
+; on recupere le _EXTRA de vector et on complete eventuellement le extra
+; deja constitue:
+               extra = extractatt(top_uvalue, 'extra')
+               exextra = cw_specifie_get_value(base)
+               extra =  mixstru(exextra,extra)
+               sextra = struct2string(extra)
+               readcommande = [readcommande, 'vectorextra = '+sextra, 'extra=mixstru(extra,vectorextra)']
+;
+               *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+;
+               if drawover then BEGIN
+; on enchaine sur un surcontour
+                  *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = !pi
+                  *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field to overlay')
+                  return,  ''
+               ENDIF ELSE BEGIN
+                  *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1
+                  *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1
+               ENDELSE
+            END
+            ELSE:BEGIN
+               *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = alreadyvector+1
+               if floor(alreadyvector) EQ alreadyvector then text = ' zonal ' $
+               ELSE text = ' meridional '
+               *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the '+strtrim(floor(alreadyread)+3, 1)+text+'component of vector')
+               return,  ''
+            END
+         endcase
+      END
+      'over':BEGIN
+         if alreadyover+1 EQ 0 then begin
+; on commence a ecrire la commande de lecture...
+            readcommande = ['; beginning of reading the field to overdraw' $
+                            , '; fieldover number: '+strtrim(alreadyread+2, 1), readcommande]
+            readcommande[i+2] = 'fieldover = '+coef+operation+readcommande[i+2]
+            readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+         ENDIF ELSE BEGIN
+            readcommande = ['; fieldover number: '+strtrim(alreadyover+2, 1), readcommande]
+            readcommande[i+1] = 'fieldover = fieldover'+separator+coef+operation+readcommande[i+1]
+            readcommande = [extractatt(top_uvalue, 'currentreadcommand'), readcommande]
+         ENDELSE
+         *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+;
+         if alreadyover+1 NE numberofread-1 THEN BEGIN 
+; si il faut lire d''autres champs on sort
+            *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = alreadyover+1
+            *top_uvalue[1, findline(top_uvalue, 'noticebase')] = xnotice('Select the field number '+strtrim(alreadyover+3, 1)+' to overlay')
+            return,  ''
+         ENDIF
+; on finalise la commande de lecture
+         readcommande = [readcommande, 'fieldover = fieldover'+add $
+                         , 'fieldover = create_struct({tab:fieldover, grille:vargrid, unite:varunit, experience:varexp, nom:varname})' $
+                         , '; end of reading the field to overdraw', ';']
+; on recupere le _EXTRA de over et on complete eventuellement le extra
+; deja constitue:
+         extra = extractatt(top_uvalue, 'extra')
+         exextra = cw_specifie_get_value(base)
+         extra =  mixstru(exextra,extra)
+         sextra = struct2string(extra)
+         readcommande = [readcommande, 'overextra = '+sextra, 'extra=mixstru(extra,overextra)']
+;
+         *top_uvalue[1, findline(top_uvalue, 'currentreadcommand')] = readcommande
+; on remet les compteurs a 0
+         *top_uvalue[1, findline(top_uvalue, 'alreadyread')] = -1
+         *top_uvalue[1, findline(top_uvalue, 'alreadyvector')] = -1
+         *top_uvalue[1, findline(top_uvalue, 'alreadyover')] = -1
+      END
+   endcase
+;
+;-----------------------
+;-----------------------
+;-----------------------
+;-----------------------
+;-----------------------
+;-----------------------
+;---------------
+; determination du nom de la boxzoom 
+;---------------
+   if NOT keyword_set(boxzoom) then widget_control, domainid, get_value = boxzoom
+; ecriture de celle-ci sous forme d''un string
+   box = '['+strtrim(boxzoom[0], 1)
+   for i = 1, (n_elements(boxzoom)-1) < (3+2*(strpos(type, 'z') EQ -1)) do $
+    box = box+', '+strtrim(boxzoom[i], 1)
+; pour les [plots en z, box doit avoir par defaut 0,profmax
+   if strpos(type, 'z') NE -1 then BEGIN
+; si + de 1 niveau est selectionne:
+      widget_control, widget_info(base, find_by_uname = 'depthlev1'), get_value = niv1
+      niv1 = niv1.droplist_select
+      widget_control, widget_info(base, find_by_uname = 'depthlev2'), get_value = niv2
+      niv2 = niv2.droplist_select
+      if niv1 NE niv2 then begin
+         box = box+','+strtrim(boxzoom[4], 1)+','+strtrim(boxzoom[5], 1)
+      ENDIF ELSE BEGIN
+         if chkstru(exextra, 'profmax') then  pmax = exextra.profmax $
+         ELSE pmax = 200
+         box = box+',0,'+strtrim(pmax, 1)
+      ENDELSE
+   endif
+   box = box+']'
+;---------------
+; on determine typein
+;---------------
+   typein = ''''+type+''''
+;---------------
+;---------------
+; determination de small
+;---------------
+   ssmall = tostr(smallout)
+;------------------------------------------------------------
+; on va definir le string qui contiendra la commande a executer par widgetdessine.pro
+;------------------------------------------------------------
+   Commande = [readCommande, procedure+', field $', ', boxzoom=' $
+               +box+', typein='+typein+', small='+ssmall+' $']
+   IF drawvecteur then Commande = [Commande, ', vecteur = {u: fieldu,v: fieldv} $']
+   IF drawover then Commande = [Commande, ', contour = fieldover $']
+   Commande = [Commande, ', _extra= mixstru(ex, extra), NOERASE=noerase']
+
+;    print, '---------------'
+;    for i = 0, n_elements(Commande)-1 do print, Commande[i]
+;    print, '---------------'
+;---------------
+; on complete et/ou actualise la structure top_uvalue...
+;---------------
+   (*top_uvalue[1, findline(top_uvalue, 'nameprocedures')])[numdessinout] = procedure
+   (*top_uvalue[1, findline(top_uvalue, 'types')])[numdessinout] = type
+   (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinout] = boxzoom
+   (*top_uvalue[1, findline(top_uvalue, 'prefixes')])[numdessinout] = widcommand
+   (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[*, numdessinout] = flags
+   *((*top_uvalue[1, findline(top_uvalue, 'exextra')])[numdessinout]) = extra
+;------------------------------------------------------------
+   return, Commande
+end
+
+
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildreadcommand.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildreadcommand.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/buildreadcommand.pro	(revision 49)
@@ -0,0 +1,161 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:buildreadcommand
+;
+; PURPOSE:
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:
+; 
+; INPUTS:
+;
+; KEYWORD PARAMETERS:
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+FUNCTION buildreadcommand, base, snameexp, procedure, type, BOXZOOM = boxzoom, COMPLETE = complete, NAMEFIELD = namefield
+;------------------------------------------------------------
+; on recuper les ID des differents widgets 
+;------------------------------------------------------------
+   filelistid = widget_info(base, find_by_uname = 'filelist')
+   champid = widget_info(base, find_by_uname = 'champ')
+   nomexpid = widget_info(base, find_by_uname = 'nom_exp')
+   date1id = widget_info(base, find_by_uname = 'calendar1')
+   date2id = widget_info(base, find_by_uname = 'calendar2')
+   domainid = widget_info(base, find_by_uname = 'domain')
+;   optionid = widget_info(base, find_by_uname = 'option')
+;------------------------------------------------------------
+   widget_control,base, get_uvalue = top_uvalue
+   numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1
+   numdessinout = (extractatt(top_uvalue, 'smallout'))[2]-1
+;---------------
+; determination du nom du fichier
+;---------------
+   currentfile = extractatt(top_uvalue, 'currentfile')
+   filelist = extractatt(top_uvalue, 'filelist')
+   filename = filelist[currentfile]
+   sfilename = ''''+filename+''''
+;---------------
+; on recupere le nom de la variable
+;---------------
+   if NOT keyword_set(namefield) then begin
+      listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar
+      nomvariable = listvar[widget_info(champid, /droplist_select)]
+   ENDIF ELSE nomvariable = namefield
+   snomvariable = ''''+nomvariable+''''
+;
+;  recherche des options
+;
+   options = extractatt(top_uvalue, 'options')   
+   flags = extractatt(top_uvalue, 'optionsflag')
+   flags = flags[*, numdessinin]
+   xindex = (flags[where(options EQ 'Longitude / x index')])[0]
+   yindex = (flags[where(options EQ 'Latitude / y index')])[0]
+;
+   extra = extractatt(top_uvalue, 'extra')
+   if xindex NE 0 then extra = create_struct(extra, 'xindex', xindex)
+   if yindex NE 0 then extra = create_struct(extra, 'yindex', yindex)
+   exextra = cw_specifie_get_value(base)
+   exextra = extractstru(exextra, ['min', 'max', 'inter', 'lct'])
+   if size(exextra, /type) EQ 8 then extra = mixstru(exextra,extra)
+   sextra = struct2string(extra)
+
+;---------------
+; determination de date1 et date2
+;---------------
+   widget_control, date1id, get_value = date1
+;
+   widget_control, date2id, get_value = date2
+   date1 = long(date1) & date2 = long(date2)
+;
+   if procedure EQ 'pltt' AND date1 EQ date2 then begin
+      currentfile = extractatt(top_uvalue, 'currentfile')
+      calendar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).time_counter
+      caldat, calendar,monthcal,daycal,yearcal
+      if total(daycal eq 15) EQ n_elements(calendar) then monthly = 1
+      if total(monthcal EQ 6) EQ n_elements(calendar) then BEGIN 
+         monthly = 1 
+         yearly = 1
+      endif
+      date1 = vairdate(calendar[0], mensuel = monthly, annuel = yearly)
+      date2 = vairdate(calendar[n_elements(calendar)-1], mensuel = monthly, annuel = yearly)
+      widget_control, date1id, set_value = date1
+      widget_control, date2id, set_value = date2
+   endif
+;
+   sdate1 = strtrim(date1, 1) & sdate2 = strtrim(date2, 1)
+;---------------
+; determination du nom de la boxzoom 
+;---------------
+   if NOT keyword_set(boxzoom) then widget_control, domainid, get_value = boxzoom
+; ecriture de celle-ci sous forme d''un string
+   box = '['+strtrim(boxzoom[0], 1)
+   for i = 1, (n_elements(boxzoom)-1) < (3+2*(strpos(type, 'z') EQ -1)) do $
+    box = box+', '+strtrim(boxzoom[i], 1)
+   if strpos(type, 'z') NE -1 then BEGIN
+      @common
+      min = min([gdept, gdepw], max = max)
+      box = box+','+strtrim(floor(min), 1)+','+strtrim(ceil(max), 1)
+   endif
+   box = box+']'
+;---------------
+; determination de funclec_name, readparameters, meshparameters
+;---------------
+   readparameters = *(extractatt(top_uvalue, 'readparameters'))[currentfile]
+   funclec_name = readparameters.funclec_name
+   if keyword_set(complete) then begin
+      sreadparameters = struct2string(readparameters)
+      meshparameters = *(extractatt(top_uvalue, 'meshparameters'))[currentfile]
+      smeshparameters = struct2string(meshparameters)
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+; on va definir le string qui contiendra la commande a executer pour
+; la lecture
+;------------------------------------------------------------
+      Commande = ['; declaration de la structure extra:', 'extra='+sextra $
+                  , '; declaration de la structure readparameters:', 'readparameters='+sreadparameters $
+                  , '; on change de lecture?:', 'nothing=changeread(readparameters)' $
+                  , '; declaration de la structure meshparameters:', 'meshparameters='+smeshparameters $
+                  , '; on change de grille?:', 'nothing=changegrid(meshparameters)' $
+                  , '; lecture du champ' $
+                  , 'if keyword_set(date1in) then date1 = date1in else date1 = '+sdate1 $
+                  , 'if keyword_set(date2in) then date2 = date2in else date2 = '+sdate2 $
+                  , 'litchamp('+funclec_name+'('+snomvariable+', date1, date2,'+snameexp $
+                  +',parent='+strtrim(base, 1)+',boxzoom='+box+' $',', filename='+sfilename+' $' $
+                  , ', _extra=mixstru(ex, extra)))']
+      (*top_uvalue[1, findline(top_uvalue, 'champs')])[*, numdessinout] = [filename, nomvariable]
+      (*top_uvalue[1, findline(top_uvalue, 'dates')])[*, numdessinout] = [date1, date2]
+   ENDIF ELSE BEGIN
+      Commande = ['; lecture du champ' $
+                  , 'if keyword_set(date1in) then date1 = date1in else date1 = '+sdate1 $
+                  , 'if keyword_set(date2in) then date2 = date2in else date2 = '+sdate2 $
+                  , 'litchamp('+funclec_name+'('+snomvariable+', date1, date2,'+snameexp $
+                  +',parent='+strtrim(base, 1)+',boxzoom='+box+' $',', filename='+sfilename+' $' $
+                  , ', _extra=mixstru(ex, extra)))']
+   ENDELSE
+;    print, '::::::::::::::::::::::'
+;    for i = 0, n_elements(Commande)-1 do print, Commande[i]
+;    print, '::::::::::::::::::::::'
+;------------------------------------------------------------
+
+;------------------------------------------------------------
+   return, commande
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefield.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefield.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefield.pro	(revision 49)
@@ -0,0 +1,27 @@
+PRO changefield, base, newfieldname, BOXZOOM = boxzoom
+;
+   widget_control, base, get_uvalue = top_uvalue
+;
+; changement de exextra :
+   exextra = definedefaultextra(newfieldname)
+   specifieid = widget_info(base,find_by_uname = 'specifie')
+   widget_control, specifieid, set_value = exextra
+; chamgement de variable -> devra-t-on changer de domaine verticale?
+   oldzgrid = extractatt(top_uvalue, 'zgrid')
+   currentfile = extractatt(top_uvalue, 'currentfile')
+   listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
+   listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar
+;   for i = 0,  n_elements(listvar)-1 do print,  listvar[i], '/', listgrid[i]
+   indexvar = where(listvar EQ newfieldname) & indexvar = 0 > indexvar[0]
+   vargrid = strupcase(listgrid[indexvar])
+   IF vargrid EQ 'W' then zgrid = 'W' ELSE zgrid = 'T'
+   if zgrid NE oldzgrid then BEGIN
+      *top_uvalue[1, findline(top_uvalue, 'zgrid')] = zgrid
+      if NOT keyword_set(boxzoom) THEN BEGIN
+         widget_control, widget_info(base, find_by_uname = 'domain'), get_value = boxzoom
+         widget_control, widget_info(base, find_by_uname = 'domain'), set_value = boxzoom
+      endif
+   endif
+;
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefile.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefile.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/changefile.pro	(revision 49)
@@ -0,0 +1,92 @@
+PRO changefile, base, newfilename, BOXZOOM = boxzoom, DATE1 = date1, DATE2 = date2, FIELDNAME = fieldname
+;
+   widget_control, base, /hourglass
+   widget_control, base, get_uvalue = top_uvalue
+   filelist = extractatt(top_uvalue, 'filelist')
+   newfile = (where(filelist EQ newfilename))[0]
+   if newfile EQ -1 then begin
+      nothing, report('invalid filename')
+      return
+   endif
+   listid = widget_info(base, find_by_uname = 'filelist')
+   widget_control, listid, set_list_select = newfile
+   oldfile = extractatt(top_uvalue, 'currentfile')
+   oldfilename = filelist[oldfile]
+; a-t-on reelement change de fichier?
+   if oldfile EQ newfile AND NOT (keyword_set(BOXZOOM) OR keyword_set(DATE1) OR keyword_set(DATE2) OR keyword_set(FIELDNAME)) then return
+;--------------
+   widget_control, base, update = 0
+;--------------
+;
+; on update l''element currentfile de la top_uvalue
+;
+   *top_uvalue[1, findline(top_uvalue, 'currentfile')] = newfile
+; on s''occupe du nom de la variable
+   oldlistvar = (*(extractatt(top_uvalue, 'fileparameters'))[oldfile]).listvar
+   newlistvar = (*(extractatt(top_uvalue, 'fileparameters'))[newfile]).listvar
+;
+   champid = widget_info(base, find_by_uname = 'champ') 
+   oldindexvar = widget_info(champid,/droplist_select)
+   oldfieldname = oldlistvar[oldindexvar]
+; a-t-on change de liste de variables ?
+   if n_elements(oldlistvar) NE n_elements(newlistvar) $
+    OR total(oldlistvar NE newlistvar) NE 0 THEN $
+    widget_control, champid, set_value = newlistvar
+;
+   if keyword_set(fieldname) then newfieldname = fieldname ELSE newfieldname = oldfieldname
+   indexvar = where(newlistvar EQ newfieldname) & indexvar = 0 > indexvar[0]
+   if oldindexvar NE indexvar then widget_control, champid, set_droplist_select = indexvar
+   newfieldname = newlistvar[indexvar]
+; on a modifiee le nom de la variable?
+   if newfieldname NE oldfieldname then BEGIN
+      changefield, base, newfieldname, BOXZOOM = boxzoom
+      widget_control, champid, set_droplist_select = indexvar
+   ENDIF
+;
+; on s''occupe du calendrier
+;
+   oldcalendar = (*(extractatt(top_uvalue, 'fileparameters'))[oldfile]).time_counter
+   newcalendar = (*(extractatt(top_uvalue, 'fileparameters'))[newfile]).time_counter
+; a-t-on change de calendrier ?
+   if n_elements(oldcalendar) NE n_elements(newcalendar) $
+    OR total(oldcalendar NE newcalendar) NE 0 then begin
+; quelles etaient les dates selectionnees ?    
+      date1id = widget_info(base, find_by_uname = 'calendar1')
+      if NOT keyword_set(date1) then widget_control, date1id, get_value = date1
+      if (where(newcalendar EQ juldate(date1)))[0] EQ -1 then date1 = newcalendar[0]
+      date2id = widget_info(base, find_by_uname = 'calendar2')
+      if NOT keyword_set(date2) then widget_control, date2id, get_value = date2
+      if (where(newcalendar EQ juldate(date2)))[0] EQ -1 then date2 = date1
+      if date2 LT date1 THEN date2 = date1
+      widget_control, date1id, /destroy
+      widget_control, date2id, /destroy
+      base12 = widget_info(base, find_by_uname = 'base12')
+      rien = cw_calendar(base12,newcalendar, juldate(date1), uname = 'calendar1' $
+                         , uvalue = {name:'calendar1'}, /frame)
+      rien = cw_calendar(base12,newcalendar, juldate(date2), uname = 'calendar2' $
+                         , uvalue = {name:'calendar2'}, /frame)
+   ENDIF ELSE BEGIN 
+      if keyword_set(date1) then begin
+         date1id = widget_info(base, find_by_uname = 'calendar1')
+         widget_control, date1id, set_value = date1
+      endif
+      if keyword_set(date2) then begin
+         date2id = widget_info(base, find_by_uname = 'calendar2')
+         widget_control, date2id, set_value = date2
+      endif
+   ENDELSE
+;
+; parametres de la grille
+;
+   newgrid = *(extractatt(top_uvalue, 'meshparameters'))[newfile]
+   change = changegrid(newgrid)
+   if change OR keyword_set(boxzoom) then BEGIN
+      if NOT keyword_set(boxzoom) then boxzoom = -1
+      domainid = widget_info(base, find_by_uname = 'domain')
+      widget_control, domainid, set_value = boxzoom
+   endif
+;--------------
+   widget_control, base, update = 1
+;--------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/createhistory.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/createhistory.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/createhistory.pro	(revision 49)
@@ -0,0 +1,41 @@
+PRO createhistory, base, small
+;
+;-------------------------------------------------------------
+; we save globalcommand in globaloldcommand
+   widget_control,base, get_uvalue = top_uvalue
+   globalcommand = extractatt(top_uvalue, 'globalcommand')
+   *top_uvalue[1, findline(top_uvalue, 'globaloldcommand')] = globalcommand
+; composition du text contennu ds history.pro
+   texte = ['@common' $
+            , ' ' $
+            , 'if n_elements(portrait) ne 0 then key_portrait = portrait' $
+            , 'if n_elements(landscape) ne 0 then key_portrait = 1-landscape' $
+            , ' ' $
+            , 'if keyword_set(postscript) then begin'  $
+            , '    noerase = 1' $
+            , '    openps, infowidget = infowidget' $
+            , 'endif' $
+            , ' ' $
+            , '; beginning of 1' $
+            , ';' $
+            , '; end of 1']
+   if small[0]*small[1] GT 1 then begin
+      for draw = 1, small[0]*small[1]-1  do begin
+         texte = [texte $
+                  , '; beginning of '+strtrim(draw+1, 2) $
+                  , 'noerase=1' $
+                  , '; end of '+strtrim(draw+1, 2)]
+      endfor
+   ENDIF
+   texte = [texte $
+            , 'if keyword_set(postscript) then begin' $
+            , '    closeps, infowidget = infowidget' $
+            , '    printps' $
+            , 'endif']
+; the new globalcommand
+   *top_uvalue[1, findline(top_uvalue, 'globalcommand')] = texte
+;-------------------------------------------------------------
+;   for i = 0, n_elements(texte)-1 do print, texte[i]
+;-------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/cutcommand.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/cutcommand.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/cutcommand.pro	(revision 49)
@@ -0,0 +1,86 @@
+PRO cutcommand, widcommand, toread, coef, numberofread, operation, nameexp, separator, add
+;
+; on separe widcommand en bloc separes par de + ou des -
+; par ex on peut avoir:
+; widcommand=2*champ1+champ2-8*champ9+678
+;
+; si on ne commence pas par un singne + ou -
+   case 1 of
+      strpos(widcommand, '+') EQ 0:BEGIN
+         widcommand = strmid(widcommand, 1)
+         firstsign = '+'
+      end
+      strpos(widcommand, '-') EQ 0:BEGIN
+         widcommand = strmid(widcommand, 1)
+         firstsign = '-'
+      END
+      ELSE:firstsign = '+'
+   endcase
+
+   sepplus = str_sep(widcommand, '+', /trim)
+   sepmoins = str_sep(sepplus[0], '-', /trim)
+   singleread = sepmoins
+   if n_elements(sepmoins) NE 1 then $
+    separator = [replicate('-', n_elements(sepmoins)-1), '+'] ELSE $
+    separator = ['+']
+   if n_elements(sepplus) GT 1 then $
+    for i = 1, n_elements(sepplus)-1 do begin
+      sepmoins = str_sep(sepplus[i], '-', /trim)
+      singleread = [singleread, sepmoins]
+      if n_elements(sepmoins) NE 1 then $
+       separator = [separator, replicate('-', n_elements(sepmoins)-1), '+'] ELSE $
+       separator = [separator, '+']
+   ENDFOR
+   separator = [firstsign, separator]
+;
+   numberofread = n_elements(singleread) 
+; cas simple ou il n''y a qu''un champ a lire...
+   if numberofread EQ 1 and isnumber(singleread[0]) GE 1 then begin
+      coef = ''
+      numberofread = 1
+      operation = ''
+      nameexp = '???'
+      separator = ''
+      add = separator[0]+singleread[0]
+      return
+   endif
+;
+; les dernier element de singleread est-il un ordre de lecture ou une
+; constant a ajouter ???
+;
+   if isnumber(singleread[numberofread-1]) GE 1 then begin
+      add = separator[numberofread-1]+singleread[numberofread-1]
+      singleread = singleread[0:numberofread-2]
+      numberofread = numberofread-1
+   ENDIF ELSE add = ''
+;
+   IF toread GE numberofread then begin
+      rien = report('toread ne peut etre + grand que numberofread')
+      return
+   ENDIF
+;
+;   for i = 0,  n_elements(singleread)-1 do print, separator[i], ' ',  singleread[i]
+;
+   pieceofread = singleread[toread]
+   separator = separator[toread]
+;
+   case 1 of
+      strpos(pieceofread, '*') NE -1:operation = '*'
+      strpos(pieceofread, '/') NE -1:operation = '/'
+      ELSE:operation = ''
+   ENDCASE
+   if operation NE '' then begin
+      finalread = str_sep(pieceofread, operation, /trim)
+      coef = finalread[0]
+      nameexp = finalread[1]
+   ENDIF ELSE BEGIN
+      if toread EQ 0 AND firstsign EQ '-' then begin
+      coef = '-1'
+      operation = '*'
+      ENDIF ELSE coef = ''
+      nameexp = pieceofread
+   ENDELSE
+;
+;
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/definedefaultextra.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/definedefaultextra.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/definedefaultextra.pro	(revision 49)
@@ -0,0 +1,19 @@
+FUNCTION definedefaultextra, nomvariable
+   case strlowcase(nomvariable) of
+;       'sn':BEGIN
+;          return, get_extra(min = 31., max = 37., inter = .2, lct = 33,/nocontout)
+;       END
+;       'tn':BEGIN
+;          return, get_extra(min = 20, max = 31, inter = .5, lct = 39)
+;       END
+;       'un':BEGIN
+;          return, get_extra(min = -1, max = 1, inter = .1, lct = 64)
+;       END
+;       'vn':BEGIN
+;          return, get_extra(min = -1, max = 1, inter = .1, lct = 64)
+;       END
+      ELSE:
+   ENDCASE
+
+   return, get_extra(min = '', max = '', inter = '', lct = 39)
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/doubleclickaction.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/doubleclickaction.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/doubleclickaction.pro	(revision 49)
@@ -0,0 +1,65 @@
+PRO doubleclickaction, event
+;------------------------------------------------------------
+   widget_control, event.id, get_uvalue = uval
+   widget_control,event.top, get_uvalue = top_uvalue
+; on active la bonne fenetre 
+   widget_control,event.id,get_value=win
+   wset, win
+; quel est le dessin selectionne??
+   smallin = extractatt(top_uvalue, 'smallin')
+   smallout = extractatt(top_uvalue, 'smallout')
+   x = (convert_coord(uval.x[0],uval.y[0], /device, /to_normal))[0]
+   y = (convert_coord(uval.x[0],uval.y[0], /device, /to_normal))[1]
+   numcolonne = n_elements(where(findgen(smallin[0])/smallin[0] lt x))-1
+   numligne = n_elements(where(findgen(smallin[1])/smallin[1] lt 1-y))-1
+   numdessin = numcolonne+numligne*smallin[0]+1
+; choix du type d''action
+   case uval.press of
+      1:BEGIN
+;         if top_uvalue.smallin[2] NE numdessin then begin
+         tracecadre, smallin, /erase
+         if total(smallin EQ smallout) EQ 3 then $
+          tracecadre, smallout, /out
+         smallin = [smallin[0:1], numdessin]
+         *top_uvalue[1, findline(top_uvalue, 'smallin')] = smallin
+         tracecadre, smallin
+         !p = (extractatt(top_uvalue, 'penvs'))[numdessin-1]
+         !x = (extractatt(top_uvalue, 'xenvs'))[numdessin-1]
+         !y = (extractatt(top_uvalue, 'yenvs'))[numdessin-1]
+;
+      END
+      2:BEGIN 
+;         if top_uvalue.smallout[2] NE numdessin then begin
+         tracecadre, smallout, /erase
+         if total(smallin EQ smallout) EQ 3 then $
+          tracecadre, smallin
+         smallout = [smallin[0:1], numdessin]
+         *top_uvalue[1, findline(top_uvalue, 'smallout')] = smallout
+         tracecadre, smallout, /out
+;         endif
+      END
+      4:BEGIN
+         tracecadre, [smallin[0:1], numdessin], /fill
+         inserthistory, event.top, ';', '; beginning of '+strtrim(numdessin, 2) $
+          , '; end of '+strtrim(numdessin, 2)
+; remise a 0 des attributs de la uvalue concernant ce dessin:
+
+         numdessin = numdessin-1
+         (*top_uvalue[1, findline(top_uvalue, 'champs')])[*, numdessin] = ['', '']
+         (*top_uvalue[1, findline(top_uvalue, 'dates')])[*, numdessin] = [0l, 0l]
+         (*top_uvalue[1, findline(top_uvalue, 'nameprocedures')])[numdessin] = ''
+         (*top_uvalue[1, findline(top_uvalue, 'types')])[numdessin] = ''
+         (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessin] = fltarr(6)
+         (*top_uvalue[1, findline(top_uvalue, 'prefixes')])[numdessin] = ''
+
+         if numdessin EQ smallin[2] then $
+          tracecadre, smallin
+         if numdessin EQ smallout[2] then $
+          tracecadre, smallout, /out
+       END
+       ELSE:
+   endcase
+   updatewidget, event.top
+;------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/extractatt.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/extractatt.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/extractatt.pro	(revision 49)
@@ -0,0 +1,9 @@
+FUNCTION extractatt, top_uvalue, name
+   taille = size(top_uvalue)
+   j = -1
+   repeat BEGIN
+      j = j+1
+      if j EQ (size(top_uvalue))[2] then return, -1
+   endrep until *top_uvalue[0, j] EQ name
+   return, *top_uvalue[1, j]
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/findline.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/findline.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/findline.pro	(revision 49)
@@ -0,0 +1,9 @@
+FUNCTION findline, top_uvalue, name
+   taille = size(top_uvalue)
+   j = -1
+   repeat BEGIN
+      j = j+1
+      if j EQ (size(top_uvalue))[2] then return, -1
+   endrep until *top_uvalue[0, j] EQ name
+   return, j
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/identifyclick.pro	(revision 49)
@@ -0,0 +1,61 @@
+FUNCTION identifyclick, event
+   widget_control, event.id, get_uvalue=uval, /no_copy
+   thisEvent = TAG_NAMES(event, /Structure)
+   if thisEvent EQ 'WIDGET_TIMER' then press = 0 ELSE press = event.press
+;
+;  d/0/>1 -------->t/1/0--------->**d/2/0**       long click
+;         -------->d/1/0--------->**t/2/0**  click normal
+;                       --------->**d/2/>1**-------->d/3/0----->t/0/0  double click
+;                                           -------->t/3/0----->d/0/0  double click
+   type = 'inutile'
+   case 1 OF
+; d/0/0 1er remonte
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press EQ 0:
+; d/0/>1 1er appuie de la serie
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 0 AND press ge 1:BEGIN
+         uval.x = [event.x, 0]
+         uval.y = [event.y, 0]
+         uval.press = press
+         uval.click = 1
+         widget_control, event.id, timer = .3
+      END
+; d/1/0 1er remonte
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 1 AND press EQ 0:uval.click = 2
+; d/2/0 fin long click
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 2 AND press EQ 0:BEGIN
+         type = 'long'
+         uval.x = [uval.x[0],event.x] & uval.x = uval.x[sort(uval.x)]
+         uval.y = [uval.y[0],event.y] & uval.y = uval.y[sort(uval.y)]
+         uval.click = 0
+         uval.press = event.release
+      END
+; d/2/>1
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 2 AND press ge 1:BEGIN
+         type = 'double'
+         uval.press = press
+         uval.click = 3
+      END
+; d/3/0 remonte et fin de double click
+      thisEvent EQ 'WIDGET_DRAW' AND uval.click EQ 3 AND press EQ 0:uval.click = 0
+; t/0/0 fin de double click
+      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 0 AND press EQ 0:
+; t/1/0 long click
+      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 1 AND press EQ 0:uval.click = 2
+; t/2/0 click normal
+      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 2 AND press EQ 0:BEGIN 
+         type = 'single'
+         press = uval.press
+         uval.click = 0
+      END
+; t/3/0 fin de double click
+      thisEvent EQ 'WIDGET_TIMER' AND uval.click EQ 3 AND press EQ 0:uval.click = 0
+; cas normalement impossible:
+      ELSE:BEGIN
+         print, thisEvent, uval.click, press
+         print, 'Probleme, cas normalement impossible!'
+      END
+   endcase
+
+   widget_control, event.id, set_uvalue=uval, /no_copy
+   return, {type:type}
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/inserthistory.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/inserthistory.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/inserthistory.pro	(revision 49)
@@ -0,0 +1,25 @@
+PRO inserthistory,  base, text, line1, line2
+;-------------------------------------------------------------
+   widget_control,base, get_uvalue = top_uvalue
+   globalcommand = extractatt(top_uvalue, 'globalcommand')
+   *top_uvalue[1, findline(top_uvalue, 'globaloldcommand')] = globalcommand
+;   for i = 0, n_elements(globalcommand)-1 do print, globalcommand[i]
+; we insert text between line1 and line2
+    index1 = where(globalcommand EQ line1) & index1 = index1[0]+1
+    if index1  EQ -1 then begin
+       rien = report(line1+' n''est pas trouve ds globalcommand')
+       return
+    endif
+    index2 = where(globalcommand EQ line2) & index2 = index2[0]
+    if index2  EQ -1 then begin
+       rien = report(line2+' n''est pas trouve ds globalcommand')
+       return
+    ENDIF
+; the new text:
+    globalcommand = [globalcommand[0:index1], text, globalcommand[index2:n_elements(globalcommand)-1]]
+; the new globalcommand
+   *top_uvalue[1, findline(top_uvalue, 'globalcommand')] = globalcommand
+
+;-------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/letsdraw.pro	(revision 49)
@@ -0,0 +1,102 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:widgetdessine
+;
+; PURPOSE: c'est la procedure qui lance le dessin. Si on ne le lui
+; donne pas de commande, elle appelle construitcommande pour savoir
+; quoi tracer.
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:widgetdessine, base
+; 
+; INPUTS:base: l''id du widget ou appliquer le dessin
+;
+; KEYWORD PARAMETERS:
+;       COMMANDE: un string du style: read_data('sst'...),....
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+PRO letsdraw, base, COMMANDE = commande, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, _extra = ex
+@common
+; on recupere la uvalue de base
+; widget_control,base, get_uvalue = top_uvalue
+; print, '*****************'
+; help,  top_uvalue, /struct
+; help,  top_uvalue.exextra, /struct
+   if NOT keyword_set(commande) then $
+    commande = buildcommand(base, FORPLTH=forplt, FORPLTZ=forpltz, FORPLTT=forpltt, _extra=ex)
+   if commande[0] EQ '' then return
+; on recupere la uvalue de base
+   widget_control, base, /hourglass
+   widget_control,base, get_uvalue = top_uvalue
+; print, '*****************'
+; help,  top_uvalue, /struct
+; print, '***..........****'
+;  help,  top_uvalue.exextra, /struct
+;  help,  top_uvalue.extra, /struct
+; print, '-*-*-*-*-*-*-*-*-*'
+; print, commande
+; help,mixstru(top_uvalue.exextra,top_uvalue.extra), /struct
+;
+;
+; on recuperel''id de la fenetre graphique associee au widget d''id base
+   graphid = extractatt(top_uvalue, 'graphid')
+   widget_control, graphid, get_value = win
+; on la selectionne (c''est a elle que sera passe toutes les commandes
+; concernant une fenetre)
+   wset, win
+;   erase, 255                       ; on netoie la fenetre
+; on s''assure que si on travaille avec un ecran codant les couleurs
+; sur 24 bits la couleur de fond specifiee!p.background est bien
+; appliquee
+;    if !d.n_colors gt 256 then begin
+;       device, decomposed=1
+;       !p.background='ffffff'x
+;       plot,[0],[0]
+;       device, decomposed=0
+;    ENDIF
+;
+   smallout = long(extractatt(top_uvalue, 'smallout'))
+   numdessinout = smallout[2]-1
+;
+   tracecadre, smallout, /fill
+;
+;
+   options = extractatt(top_uvalue, 'options')   
+   optionsflag = extractatt(top_uvalue, 'optionsflag')
+   portrait = (strtrim(optionsflag[where(options EQ 'Portrait/Landscape'), 0], 1))[0]
+   
+;
+   createpro, ['@common' $
+               , 'noerase = 1' $
+               , 'portrait = '+portrait $
+               , Commande] $
+    , filename =  myuniquetmpdir + 'xxx_oneplot.pro'
+;
+   inserthistory, base, Commande,'; beginning of '+strtrim(smallout[2], 1) $
+    , '; end of '+strtrim(smallout[2], 1)
+;
+   (*top_uvalue[1, findline(top_uvalue, 'penvs')])[numdessinout] = !p
+   (*top_uvalue[1, findline(top_uvalue, 'xenvs')])[numdessinout] = !x
+   (*top_uvalue[1, findline(top_uvalue, 'yenvs')])[numdessinout] = !y
+
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/longclickaction.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/longclickaction.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/longclickaction.pro	(revision 49)
@@ -0,0 +1,77 @@
+PRO longclickaction, event
+   widget_control, event.id, get_uvalue=uval
+   widget_control,event.top, get_uvalue = top_uvalue
+; quel est le dessin selectionne??
+   smallout = extractatt(top_uvalue, 'smallout')
+   smallin = extractatt(top_uvalue, 'smallin')
+   small = smallin
+   x = (convert_coord(uval.x[0],uval.y[0], /device, /to_normal))[0]
+   y = (convert_coord(uval.x[0],uval.y[0], /device, /to_normal))[1]
+   numcolonne = n_elements(where(findgen(small[0])/small[0] lt x))-1
+   numligne = n_elements(where(findgen(small[1])/small[1] lt 1-y))-1
+   numdessin = numcolonne+numligne*small[0]
+; on met ce cadrant en leader
+   tracecadre, smallin, /erase
+   if total(smallin EQ smallout) EQ 3 then $
+    tracecadre, smallout, /out
+   smallin = [smallin[0:1], numdessin+1]
+   *top_uvalue[1, findline(top_uvalue, 'smallin')] = smallin
+   tracecadre, smallin
+   !p = (extractatt(top_uvalue, 'penvs'))[numdessin]
+   !x = (extractatt(top_uvalue, 'xenvs'))[numdessin]
+   !y = (extractatt(top_uvalue, 'yenvs'))[numdessin]
+;
+;------------------------------------------------------------
+; changement de domaine:
+;------------------------------------------------------------
+   coor = (convert_coord(uval.x,uval.y, /device, /to_data))
+   x = [coor[0, 0],coor[0, 1]]
+   y = [coor[1, 0],coor[1, 1]]
+   domainid = widget_info(event.top,find_by_uname = 'domain')
+   boxzoom = [x, y]
+; faut-il passer la boxzoom en indexes ???
+   currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1
+   options = extractatt(top_uvalue, 'options')   
+   flags = extractatt(top_uvalue, 'optionsflag')
+   flags = flags[*, currentplot]
+   changex = (flags[where(options EQ 'Longitude / x index')])[0] EQ 1
+   changey = (flags[where(options EQ 'Latitude / y index')])[0] EQ 1
+   if changex OR changey then begin
+; on veut retrouver le type de grille qui est utilisee
+      currentfile = extractatt(top_uvalue, 'currentfile')
+      listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
+      indexvar = widget_info(widget_info(event.top, find_by_uname = 'champ'), /droplist_select)
+      vargrid = strupcase(listgrid[indexvar])
+      domdef, boxzoom, gridtype = vargrid
+      grille, -1, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
+      if changex then boxzoom[0:1] = [firstx, lastx]
+      if changey then boxzoom[2:3] = [firsty, lasty]
+   endif
+;
+   widget_control, domainid, set_value = boxzoom
+;
+;------------------------------------------------------------
+   graphtypeid = widget_info(event.top, find_by_uname = 'action')
+   widget_control,graphtypeid, get_uvalue = graphtype_uvalue
+   type = graphtype_uvalue.choix[widget_info(graphtypeid, /droplist_select)]
+   case uval.press of
+      1:BEGIN
+         nodates = (type EQ 'xt' OR type EQ 'yt' OR type EQ 'zt' OR type EQ 't')
+         updatewidget, event.top, /noboxzoom, nodates = nodates, notype = type NE 'plt'
+         forplth = type EQ 'plt'
+         letsdraw, event.top, forplth = forplth
+      END
+      2:BEGIN 
+         updatewidget, event.top, /noboxzoom
+         forpltz = type EQ 'plt'
+         letsdraw, event.top, forpltz = forpltz
+      END
+      4:BEGIN
+         updatewidget, event.top, /noboxzoom, /nodates
+         forpltt = type EQ 'plt'
+         letsdraw, event.top, forpltt = forpltt
+      END
+   endcase
+;------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/read_vermair.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/read_vermair.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/read_vermair.pro	(revision 49)
@@ -0,0 +1,11 @@
+FUNCTION read_vermair, name,debut,fin, nomexp, PARENT = parent, BOXZOOM=boxzoom, _EXTRA = ex
+@common
+;------------------------------------------------------------ 
+   if name EQ 'un' then name = 'vozocrtx'
+   if name EQ 'vn' then name = 'vomecrty'
+   if debut EQ fin then begin
+      res = lec(name,debut,nomexp, BOXZOOM=boxzoom, _EXTRA = ex)
+   ENDIF ELSE res = lect(name,debut,fin, nomexp, BOXZOOM=boxzoom, _EXTRA = ex)
+;------------------------------------------------------------ 
+   return, {tab:res, grille:vargrid, unite:'', experience:varexp, nom:varname}
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/scanfile.pro	(revision 49)
@@ -0,0 +1,183 @@
+;
+;  liste des presupposes:
+;       1) le fichier a lire est un fichier netcdf
+;       2) le nom de ce fichier finit
+;       par U.nc, V.nc, W.nc, T.nc ou F.nc, la lettre avant le
+;       nc designant la grille a laquelle se rapporte la champ.
+;       Si tel n''est pas la cas, le fichier est attribue a la grille
+;       T.
+;       3) ce fichier contient une dimension infinie qui doit etre
+;       celle qui se rapporte au temps et au mois 2 autres dimensions
+;       dont les noms sont 'x','lon','longitude' et 'y','lat' ou
+;       'latitude' ou bien en majuscule.
+;       4) il doit exiter ds ce fichier une unique variable n''ayant
+;       qu''une dimension et etant la dimension temporelle. cette
+;       variable sera prise comme axe des temps. Rq: si plusieurs
+;       variables verifient ces criteres on considere la premiere
+;       variable
+;       5) Cette variable axe des temps doit contenir l''attribut
+;       'units'qui doit etre ecrit suivant la syntaxe:
+;               "seconds since 0001-01-01 00:00:00" 
+;               "hours since 0001-01-01 00:00:00" 
+;               "days since 1979-01-01 00:59:59" 
+;               "months since 1979-01-01 00:59:59" 
+;               "years since 1979-01-01 00:59:59" 
+;
+; je crois que c''est tout!
+;
+;
+;------------------------------------------------------------
+FUNCTION scanfile, nomficher, _extra = ex
+@common
+;------------------------------------------------------------
+; bidouille pour utiliser les mots cles (on passe par des variables
+; declarees ds un common)
+;------------------------------------------------------------
+  res = -1
+;------------------------------------------------------------
+; choix du nom du fichier
+;------------------------------------------------------------
+  nom = isafile(filename = nomficher, IODIRECTORY = iodir, _extra = ex)
+;------------------------------------------------------------
+; ouverture du fichier nom
+;------------------------------------------------------------
+  cdfid = ncdf_open(nom)
+;------------------------------------------------------------
+; que contient le fichier??
+;------------------------------------------------------------
+  contient = ncdf_inquire(cdfid);
+; find vargrid ...
+  vargrid = 'T'                 ; default definition
+  pattern = ['GRID.', 'GRID_', 'GRID', 'UPID_', '30ID_']
+  gdtype = ['T', 'U', 'V', 'W', 'F']
+  fnametest = strupcase(nom)
+  FOR i = 0, n_elements(pattern)-1 DO BEGIN
+    FOR j = 0, n_elements(gdtype)-1 DO BEGIN
+      substr = pattern[i]+gdtype[j]
+      pos = strpos(fnametest, substr)
+      IF pos NE -1 THEN $
+        vargrid = strmid(fnametest, pos+strlen(substr)-1, 1)
+    ENDFOR
+  ENDFOR
+;------------------------------------------------------------
+; nom des differentes variables
+;------------------------------------------------------------
+; on ne garde les noms de variable uniquement si cette variable
+; contient au moins les dimensions qui doivent etre appelles x et y
+; et la dimension infinie
+  nomdim   = strarr(contient.ndims)
+  for dimiq = 0, contient.ndims-1 do begin
+    ncdf_diminq, cdfid, dimiq, name, value ; nom et valeur de la dimension
+    nomdim[dimiq] = strlowcase(name)
+  ENDFOR
+  indexdimx = where(nomdim EQ 'x' OR nomdim EQ 'lon' OR nomdim EQ 'longitude' OR nomdim EQ 'xt_i7_156' OR nomdim EQ 'xi_rho' OR nomdim EQ 'xi_u' OR nomdim EQ 'xi_v' OR nomdim EQ 'xi_psi')
+  indexdimx = indexdimx[0]
+  if indexdimx EQ -1 then begin
+    print, 'one of the dimensions must have the name: ''x'' or ''lon'' or ''longitude'' or ''xt_i7_156'''
+    stop
+  endif
+  indexdimy = where(nomdim EQ 'y' OR nomdim EQ 'lat' OR nomdim EQ 'latitude' OR nomdim EQ 'yt_j6_75' OR nomdim EQ 'eta_rho' OR nomdim EQ 'eta_u' OR nomdim EQ 'eta_v' OR nomdim EQ 'eta_psi')
+  indexdimy = indexdimy[0]
+  if indexdimy EQ -1 then begin
+    print, 'one of the dimensions must have the name: ''y'' or ''lat'' or ''latitude'' or ''yt_j6_75'''
+    stop
+  endif
+;
+  namevar = strarr(contient.nvars)
+  for varid = 0, contient.nvars-1 do begin
+    varcontient = ncdf_varinq(cdfid, varid) ; que contient la variable
+    if (where(varcontient.dim EQ indexdimx))[0] NE -1 AND $
+      (where(varcontient.dim EQ indexdimy))[0] NE -1 AND $
+      (where(varcontient.dim EQ contient.recdim))[0] NE -1 THEN namevar[varid] = varcontient.name 
+  ENDFOR
+  namevar = namevar[where(namevar NE '')]
+  listgrid = replicate(vargrid,  n_elements(namevar))
+;------------------------------------------------------------
+; on recupere l''axe des temps
+;------------------------------------------------------------
+; on recupere le nom de la variable contenant l''axe des temps
+  varid = 0
+  repeat BEGIN ; tant que l''on a pas trouve une variable qui n''a qu''
+                                ; une dimension: la dimension infinie
+    varcontient = ncdf_varinq(cdfid, varid) ; que contient la variable
+    varid = varid+1
+  endrep until n_elements(varcontient.dim) EQ 1 AND varcontient.dim[0] EQ contient.recdim ;
+  varid = varid-1
+;
+; we want to know which attrributes are attached to the time variable...
+;
+  if varcontient.natts EQ 0 then BEGIN
+    ncdf_close, cdfid
+    return, report('the variable '+varcontient.name+' has no attribut.!C we need attribut ''units'' for the calendar ...')
+  endif
+  attnames = strarr(varcontient.natts)
+  for attiq = 0, varcontient.natts-1 do attnames[attiq] = ncdf_attname(cdfid, varid, attiq)
+  if (where(attnames EQ 'units'))[0] EQ -1 then BEGIN
+    ncdf_close, cdfid
+    return, report('Attribut ''units'' not found for the variable '+varid.name+'we need it for the calendar...')
+  endif
+; on lit l''axe des temps
+  ncdf_varget, cdfid, varid, time
+  time = double(time)
+  ncdf_attget, cdfid, varid, 'units', value
+; time_counter:units = "seconds since 0001-01-01 00:00:00" ;
+; time_counter:units = "hours since 0001-01-01 00:00:00" ;
+; time_counter:units = "days since 1979-01-01 00:00:00" ;
+; time_counter:units = "months since 1979-01-01 00:00:00" ;
+; time_counter:units = "years since 1979-01-01 00:00:00" ;
+  value = strtrim(strcompress(string(value)), 2)
+  mots = str_sep(value, ' ')
+  unite = mots[0]
+  debut = str_sep(mots[2], '-')
+;
+; now we try to find the attribut called calendar...
+; the the attribute "calendar" exists?
+; If no, we suppose that the calendar is gregorian calendar
+;
+  if (where(attnames EQ 'calendar'))[0] NE -1 then BEGIN
+      ncdf_attget, cdfid, varid, 'calendar', value
+      value = string(value)
+        CASE value OF
+          '360d':key_caltype = '360d'
+          'greg':IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+          ELSE:BEGIN
+;            notused = report('Unknown calendar: '+value+', we use greg calendar.') 
+            key_caltype = 'greg'
+          END
+        ENDCASE
+      ENDIF ELSE BEGIN
+;        notused = report('Unknown calendar, we use '+key_caltype+' calendar.') 
+        IF n_elements(key_caltype) EQ 0 THEN key_caltype = 'greg'
+      ENDELSE
+;
+; ATTENTION il faut recuperer l''attribut calendar et ajuster time en
+; consequense...
+;
+;
+; on passe time en jour julien d''idl 
+; on suppose qu''on utilise le vrai calendrier.
+;
+  unite = strlowcase(unite)
+  IF strpos(unite, 's', strlen(unite)-1) NE -1 THEN unite = strmid(unite, 0, strlen(unite)-1)
+  IF strpos(unite, 'julian_') NE -1 THEN unite = strmid(unite, 7)
+  case unite of
+    'second':time = julday(debut[1], debut[2], debut[0])+time/(long(24)*3600)
+    'hour':time = julday(debut[1], debut[2], debut[0])+time/(long(24))
+    'day':time = julday(debut[1], debut[2], debut[0])+time
+    'month':BEGIN 
+      if total(fix(time) NE time) NE 0 then $ ; we switch to days with 30d/m
+        time = julday(debut[1], debut[2], debut[0])+round(time*30) $
+      ELSE for t = 0, n_elements(time)-1 DO $
+        time[t] = julday(debut[1]+time[t], debut[2], debut[0])
+    END
+    'year':BEGIN
+      if total(fix(time) NE time) NE 0 then $ ; we switch to days with 365d/y
+        time = julday(debut[1], debut[2], debut[0])+round(time*365) $
+      ELSE for t = 0, n_elements(time)-1 do $
+        time[t] = julday(debut[1], debut[2], debut[0]+time[t])
+    END
+  ENDCASE
+  time = long(time)
+;------------------------------------------------------------
+  return, {filename:nom, time_counter:time, listvar:namevar, listgrid:strupcase(listgrid), calendartype:key_caltype}
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/selectfile.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/selectfile.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/selectfile.pro	(revision 49)
@@ -0,0 +1,97 @@
+;*********************************************************************
+PRO selectfile_event, event
+;
+@common
+;
+   widget_control, event.id,  get_uvalue = eventuvalue
+   IF chkstru(eventuvalue,'name') EQ 0 THEN return
+   case eventuvalue.name of
+      'Global Cancel':BEGIN 
+         widget_control, event.handler, get_uvalue = messenger
+         *messenger = -1
+         widget_control,event.handler,/destroy
+      END
+      'datafilename':BEGIN
+         widget_control, event.id, get_value = filename
+         filename = isafile(filename = filename[0])
+         if size(filename, /type) NE 7 then return
+         widget_control, event.id, set_value = filename
+      END
+      'browse datafilename':BEGIN
+         filename = isafile(iodir = iodir)
+         if size(filename, /type) NE 7 then return
+         widget_control, widget_info(event.handler, find_by_uname = 'datafilename') $
+          , set_value = filename
+      END
+      'meshfilename':BEGIN
+         widget_control, event.id, get_value = filename
+         filename = isafile(filename = filename[0])
+         if size(filename, /type) NE 7 then return
+         widget_control, event.id, set_value = filename
+      END
+      'browse meshfilename':BEGIN
+         filename = isafile(iodir = homedir)
+         if size(filename, /type) NE 7 then return
+         widget_control, widget_info(event.handler, find_by_uname = 'meshfilename') $
+          , set_value = filename
+      END
+      'Lets Go!':BEGIN
+         widget_control, widget_info(event.handler, find_by_uname = 'datafilename') $
+          , get_value = datafilename & datafilename = datafilename[0]
+         widget_control, widget_info(event.handler, find_by_uname = 'meshfilename') $
+          , get_value = meshfilename & meshfilename = meshfilename[0]
+         widget_control, event.handler, get_uvalue = messenger
+         *messenger = create_struct('datafilename', datafilename, 'meshfilename', meshfilename)
+         widget_control,event.handler,/destroy
+      END
+
+   endcase
+   return
+end
+;*********************************************************************
+FUNCTION selectfile
+;
+@common
+;------------------------------------------------------------
+;
+; pour recuperer les reponses possees lors de l''utilisation de ce
+; widget on cree un pointeur que l''on place dans la uvalue. Comme ca
+; une fois que le widget est detruit dans la procedure ...event.pro,
+; la variable surlaquelle pointait le pointeur (contenue ds la uvalue
+; du widget) n''est pas detruite est on peut recuperer le resultat!
+;
+   messenger = ptr_new(/allocate_heap)
+   base=widget_base(/COLUMN, title = 'selectfile', /align_center, uvalue = messenger, _EXTRA = ex)
+;
+   nothing = widget_button(base, value = 'Cancel', uvalue = {name:'Global Cancel'})
+;
+   basea=widget_base(base, /row, /align_center)
+   nothing = widget_label(basea, value = 'Data file name: ')
+   nothing = widget_text(basea, value = '', uvalue = {name:'datafilename'}, uname = 'datafilename', xsize = 45, /EDITABLE)
+   nothing = widget_button(basea, value = 'Browse', uvalue = {name:'browse datafilename'})
+;
+   baseb=widget_base(base, /row, /align_center)
+   nothing = widget_label(baseb, value = 'Mesh file or IDL batch file: ')
+   nothing = widget_text(baseb, value = '', uvalue = {name:'meshfilename'}, uname = 'meshfilename', xsize = 45, /EDITABLE)
+   nothing = widget_button(baseb, value = 'Browse', uvalue = {name:'browse meshfilename'})
+;
+   nothing = widget_button(base, value = 'Lets Go!', uvalue = {name:'Lets Go!'})
+
+;------------------------------------------------------------
+   widget_control,base,/realize
+   xmanager,'selectfile', base,event_handler = 'selectfile_event', no_block = 0
+;
+;
+   res = *messenger
+   ptr_free, messenger
+   if size(res, /type) NE 8 then return,  -1
+;
+   res1 = whichgrid(res.meshfilename, iodir = iodir)
+   if size(res1, /type) NE 8 then return,  -1
+   res2 = whichread()
+   if size(res2, /type) NE 8 then return,  -1
+   res3 = scanfile(res.datafilename, iodir = iodir)
+   if size(res3, /type) NE 8 then return,  -1
+
+   return, {fileparameters:res3, readparameters:res2, meshparameters:res1} 
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/singleclickaction.pro	(revision 49)
@@ -0,0 +1,4 @@
+PRO singleclickaction, event, quelclick
+
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/tracecadre.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/tracecadre.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/tracecadre.pro	(revision 49)
@@ -0,0 +1,28 @@
+PRO tracecadre, small, out = out, erase = erase, fill = fill
+;------------------------------------------------------------
+; determination de la colonne et de la ligne correspondant au small en
+; entree
+   numdessin = small[2]-1
+   numligne = numdessin/small[0]
+   numcolonne = numdessin-numligne*small[0]
+; determination de poscadre
+   largeurcolonne = 1./small[0]
+   largeurligne = 1./small[1]
+   cadre = [numcolonne*largeurcolonne,1.-((numligne+1)*largeurligne) $
+            , (numcolonne+1)*largeurcolonne, 1.-(numligne*largeurligne)]
+   decale = 0.001
+   cadre = cadre+[decale,decale,-decale,-decale]
+   reinitplt
+   !p.position = [0., 0., 1., 1.]
+   IF keyword_set(fill) then begin
+      polyfill, [cadre[0], cadre[2], cadre[2], cadre[0], cadre[0]] $
+       , [cadre[1], cadre[1], cadre[3], cadre[3], cadre[1]], color = 255, /normal
+   ENDIF ELSE BEGIN
+      plot, [cadre[0], cadre[2], cadre[2], cadre[0], cadre[0]] $
+       , [cadre[1], cadre[1], cadre[3], cadre[3], cadre[1]] $
+       , xrange = [0, 1], yrange = [0, 1], linestyle = 2*keyword_set(out) $
+       , /noerase, /normal, thick = 2, color = 0+255*keyword_set(erase)
+   ENDELSE
+;------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/updatewidget.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/updatewidget.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/updatewidget.pro	(revision 49)
@@ -0,0 +1,79 @@
+PRO updatewidget, base, NOBOXZOOM = noboxzoom, NODATES = nodates, NOTYPE = notype
+;----------------------------------------------------------------------
+   widget_control,base, get_uvalue = top_uvalue
+   smallin = extractatt(top_uvalue, 'smallin')
+   numdessinin = smallin[2]-1
+;
+;----------------------------------------------------------------------
+   widget_control, base, update = 0
+;--------------
+; date1 et date2
+;--------------
+   if keyword_set(nodates) then begin
+      date1 = 0
+      date2 = 0 
+   ENDIF ELSE BEGIN 
+      dates = (extractatt(top_uvalue, 'dates'))[*, numdessinin]
+      date1 = dates[0] & date2 = dates[1]
+   ENDELSE
+;--------------
+; domaine
+;--------------
+   boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin]
+   if total(boxzoom) EQ 0 then boxzoom = -1
+   if keyword_set(noboxzoom) then boxzoom = 0
+;--------------
+; champ: filename & nomvar
+;--------------
+   champ = (extractatt(top_uvalue,  'champs'))[*, numdessinin]
+   filename = champ[0] & nomvar = champ[1]
+;
+   if filename NE '' OR nomvar NE '' THEN BEGIN
+      changefile, base, filename, fieldname = nomvar, BOXZOOM = boxzoom, DATE1 = date1, DATE2 = date2
+   ENDIF ELSE BEGIN
+      if date1 NE 0 then begin
+         date1id = widget_info(base, find_by_uname = 'calendar1')
+         widget_control, date1id, set_value = date1
+      endif
+      if date2 NE 0 then begin
+         date2id = widget_info(base, find_by_uname = 'calendar2')
+         widget_control, date2id, set_value = date2
+      endif
+      if keyword_set(boxzoom) then BEGIN 
+         domainid = widget_info(base, find_by_uname = 'domain')
+         widget_control, domainid, set_value = boxzoom
+      endif
+   ENDELSE
+;--------------
+; exextra
+;--------------
+   if n_elements(*((extractatt(top_uvalue, 'exextra'))[numdessinin])) NE 0 then begin
+      exextra = *((extractatt(top_uvalue, 'exextra'))[numdessinin])
+      specifieid = widget_info(base,find_by_uname = 'specifie')
+      widget_control, specifieid, set_value = exextra
+   endif
+;--------------
+; nomexp
+;--------------
+   nomexp = (extractatt(top_uvalue,  'prefixes'))[numdessinin]
+   if nomexp NE '' then begin
+      nomexpid = widget_info(base, find_by_uname = 'nom_exp')
+      widget_control, nomexpid, set_value = nomexp
+   endif
+;--------------
+; graphtype
+;--------------   
+   if NOT keyword_set(notype) then BEGIN
+      graphtype = (extractatt(top_uvalue, 'types'))[numdessinin]
+      if graphtype NE '' then begin
+         actionid = widget_info(base,find_by_uname = 'action')
+         widget_control, actionid, get_uvalue = action_uvalue
+         widget_control, actionid, set_droplist_select = (where(action_uvalue.choix EQ graphtype))[0]
+      endif
+   endif
+;--------------
+   widget_control, base, update = 1
+;--------------
+;----------------------------------------------------------------------
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/widgetdessine.pro.old
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/widgetdessine.pro.old	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/widgetdessine.pro.old	(revision 49)
@@ -0,0 +1,122 @@
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+;+
+; NAME:widgetdessine
+;
+; PURPOSE: c'est la procedure qui lance le dessin. Si on ne le lui
+; donne pas de commande, elle appelle construitcommande pour savoir
+; quoi tracer.
+;
+; CATEGORY:
+;
+; CALLING SEQUENCE:widgetdessine, base
+; 
+; INPUTS:base: l''id du widget ou appliquer le dessin
+;
+; KEYWORD PARAMETERS:
+;       COMMANDE: un string du style: read_data('sst'...),....
+;
+; OUTPUTS:
+;
+; COMMON BLOCKS:common.pro
+;
+; SIDE EFFECTS:
+;
+; RESTRICTIONS:
+;
+; EXAMPLE:
+;
+; MODIFICATION HISTORY:Sebastien Masson (smasson@lodyc.jussieu.fr)
+;
+;-
+;------------------------------------------------------------
+;------------------------------------------------------------
+;------------------------------------------------------------
+
+PRO widgetdessine, base, COMMANDE = commande, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, _extra = ex
+@common
+; on recupere la uvalue de base
+   widget_control,base, get_uvalue = top_uvalue
+; on determine quelle procedure on va etre appeler pour faire le dessin
+   procedure = top_uvalue.name
+   if keyword_set(forplth) then procedure = 'plt'
+   if keyword_set(forpltz) then procedure = 'pltz'
+   if keyword_set(forpltt) then procedure = 'pltt'
+; print, '*****************'
+; help,  top_uvalue, /struct
+; help,  top_uvalue.exextra, /struct
+   if NOT keyword_set(commande) then $
+    commande = construitcommande(base, FORPLTH = forplth, FORPLTZ = forpltz, FORPLTT = forpltt, _extra = ex)
+   widget_control,base, get_uvalue = top_uvalue
+; print, '*****************'
+; help,  top_uvalue, /struct
+; print, '***..........****'
+;  help,  top_uvalue.exextra, /struct
+;  help,  top_uvalue.extra, /struct
+; print, '-*-*-*-*-*-*-*-*-*'
+; print, commande
+; help,mixstru(top_uvalue.exextra,top_uvalue.extra), /struct
+;
+; on recuperel''id de la fenetre graphique associee au widget d''id base
+   widget_control,widget_info(base,find_by_uname = 'graph'),get_value=win
+; on la selectionne (c''est a elle que sera passe toutes les commandes
+; concernant une fenetre)
+   wset, win
+   erase, 255                       ; on netoie la fenetre
+; on s''assure que si on travaille avec un ecran codant les couleurs
+; sur 24 bits la couleur de fond specifiee!p.background est bien
+; appliquee
+   if !d.n_colors gt 256 then begin
+      device, decomposed=1
+      !p.background='ffffff'x
+      plot,[0],[0]
+      device, decomposed=0
+   ENDIF
+;
+; on execute la commande pour faire le dessin
+;
+   IF chkstru(top_uvalue, 'grille') THEN anciennegrille = top_uvalue.grille $
+   ELSE anciennegrille = 'T'
+   rien = execute(procedure+', '+Commande)
+;   if NOT rien then stop
+
+;
+; on va accualiser ;a stuture contenue ds la uvalue de base
+;
+; on doit determiner le type de dessin et eventuellement la nouvelle boite.
+   case procedure OF
+      'plt':type = 'xy'
+      'pltt':BEGIN
+         case 1 of
+            strpos(commande, '''xt''') NE -1:type = 'xt'
+            strpos(commande, '''yt''') NE -1:type = 'yt'
+            ELSE:type = 'unknow !'
+         endcase
+      END
+      'pltz':BEGIN 
+         lastboite = rstrpos(commande, 'boite=')
+         ouvrepos = strpos(commande, '[', lastboite+1)
+         boite = strmid(commande,ouvrepos+1,strpos(commande, ']', lastboite+1)-ouvrepos-1)
+         boite = str_sep(boite, ',') & boite = long(boite)
+         if boite[1]-boite[0] LE boite[3]-boite[2] then type = 'yz' ELSE type = 'xz' 
+      END
+   ENDCASE
+;
+; print, '&&&&&&&&&&&&&&&&&&&&&&&&'
+; help,  top_uvalue, /struct
+; help,   mixstru({name:procedure, commande:commande, penv:!p, xenv:!x, yenv:!y, type:type}, top_uvalue), /struct
+;
+;
+;
+   widget_control, base, set_uvalue = mixstru({name:procedure, commande:commande, penv:!p, xenv:!x, yenv:!y, type:type, grille:vargrid}, top_uvalue)
+; on change d''axe vertical ?
+   if vargrid NE anciennegrille then begin
+      widget_control, widget_info(base,  find_by_uname = 'domain'), get_value = value
+      widget_control, widget_info(base,  find_by_uname = 'domain'), set_value = value
+   endif
+
+; help,  top_uvalue.extra, /struct
+
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xcreateanim.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xcreateanim.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xcreateanim.pro	(revision 49)
@@ -0,0 +1,198 @@
+pro xcreateanim_event, event 
+@common
+; on recupere les aguments contenus ds le widget
+   if tag_names(event, /structure_name) NE 'WIDGET_BUTTON' then return
+   widget_control, event.id, get_uvalue = uval
+   if n_elements(uval) EQ 0 then return
+   if uval EQ 'cancel' then begin
+      widget_control, event.top, /destroy
+      return
+   ENDIF
+; on va ecrire l''animation!
+;
+   widget_control, event.top, get_uvalue = local_uvalue
+   widget_control, local_uvalue.parent, get_uvalue = top_uvalue
+;
+   calendar = (*(extractatt(top_uvalue, 'fileparameters'))[local_uvalue.indexfile]).time_counter
+;
+   widget_control, widget_info(event.top, find_by_uname = 'Filename') $
+    , get_value = nomfic & nomfic = nomfic[0]
+;
+   widget_control, widget_info(event.top, find_by_uname = 'directorie') $
+    , get_value = animdir & animdir = animdir[0]
+;
+   widget_control, widget_info(event.top, find_by_uname = 'debut') $
+    , get_value = vdate1
+   index1 = where(calendar eq juldate(vdate1)) & index1 = index1[0] 
+   if index1 EQ -1 then return
+;
+   widget_control, widget_info(event.handler, find_by_uname = 'fin') $
+    , get_value = vdate2
+   index2 = where(calendar eq juldate(vdate2)) & index2 = index2[0] 
+   if index2 EQ -1 OR index2 LE index1 then return
+; on detruit le widget avant de creer le fichier .ps
+   widget_control, event.top, /destroy 
+; test pour savoir quel type des calendrier on a
+   caldat, calendar, m, d
+   if total(d EQ 15) EQ n_elements(d) then mensuel = 1 ELSE mensuel = 0
+   if total(d EQ 1) EQ n_elements(d) AND total(m EQ 6) EQ n_elements(m) $
+    then annuel = 1 ELSE annuel = 0
+;
+; creation de la routine qui nous serviera pour faire le dessin
+;
+; on recupere la liste des instructions
+   globalcommand = extractatt(top_uvalue, 'globalcommand')
+; on complete par le premiere et les dernieres lignes du programme
+   createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $
+              , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, DATE1IN = date1in, DATE2IN = date2in'
+;
+;--------creation du fichier----------
+;
+;  recupere le nombre d'octets surlequel on code la palette
+   device, get_visual_depth = depth
+; taille de l''image (en nombre de pixel:
+   xsize = !d.x_size
+   ysize = !d.y_size
+;
+; on verifie que le nom du fichier termine bien par .gif
+   if strpos(nomfic, '.gif') EQ -1 then nomfic = nomfic+'.gif'
+
+   current_window = !d.window
+   window, /free, /pixmap, xsize=xsize, ysize=ysize
+
+
+; indication du numero de l''image que l''on est en train de creer
+   base = widget_base()
+   sliderid = widget_slider(base, minimum = 1, maximum = index2-index1+1, value = 1 $
+                            , title = 'image que l''on est en train de creer')
+   widget_control,base,/realize
+;
+; commencement du fichier gif. ecriture d''une image vide 
+   date = vairdate(calendar[index1], mensuel = mensuel, annuel= annuel)
+   xxx2ps, /noerase, date1in = date, date2in = date
+;
+;
+   image = tvrd(true = depth GT 8)
+;- If an 8-bit image was read, reduce the number of colors
+   if depth le 8 then begin
+      tvlct, red, green, blue, /get
+      reduce_colors, image, index
+      red = red[index]
+      green = green[index]
+      blue = blue[index]
+   endif            
+;
+   if depth gt 8 then $
+;- Convert 24-bit image to 8-bit
+   image = color_quan(image, 1, red, green, blue, colors=256, get_translation = translation, /map_all)
+;
+;
+   write_gif,animdir+nomfic, image, red, green, blue, /multiple
+   wdelete, !d.window
+;
+; boucle de creation et d''ecriture ds le fichier.
+;
+   for ind = index1+1, index2 do BEGIN
+;
+      widget_control, sliderid, set_value = ind-index1+1 ; on bouge le slider
+;
+      window, /free, /pixmap, xsize=xsize, ysize=ysize
+      date = vairdate(calendar[ind], mensuel = mensuel, annuel= annuel)
+      xxx2ps, /noerase, date1 = date, date2 = date
+;      
+      image = tvrd(true = depth GT 8)
+;
+      if depth gt 8 then $
+      image = color_quan(image, 1, aaa, bbb, ccc, colors=256, translation = translation) ;
+;
+      write_gif,animdir+nomfic,image,red, green, blue, /multiple
+      wdelete, !d.window
+   ENDFOR
+; on met une derniere image blanche
+      window, /free, /pixmap, xsize=xsize, ysize=ysize
+      reinitplt
+      plot,  [0],  [0], /nodata
+      image = tvrd(true = depth GT 8)
+;
+      if depth gt 8 then $
+      image = color_quan(image, 1, aaa, bbb, ccc, colors=256, translation = translation) ;
+;
+      write_gif,animdir+nomfic,image,red, green, blue, /multiple
+      wdelete, !d.window
+; fermeture du fichier
+   write_gif,animdir+nomfic,/close 
+   widget_control, base, /destroy 
+; rebascule en mode "normal"
+   thisOS = strupcase(strmid(!version.os_family, 0, 3))
+;
+   wset, current_window
+
+; si on est sous x on essaie de lancer xanim...
+
+   if thisOS NE 'MAC' AND thisOS NE 'WIN' then begin
+      spawn, 'which xanim',result
+      if strpos(result[0],'xanim') EQ strlen(result[0])-5 then spawn, 'xanim '+animdir+nomfic+' &'
+   endif
+;
+   
+   return
+end
+;----------------------------------------------------------------
+PRO xcreateanim, parent
+@common
+;
+   widget_control, parent, get_uvalue = top_uvalue
+;
+; on va s''assurer que toutes les procedures de sont pas pltt
+;
+   procedures = extractatt(top_uvalue, 'nameprocedures')
+   if total(procedures EQ 'pltt') NE 0 then begin
+      nothing = report('Certains des plots ont un axe se rapportant au temps. !C Animation impossible!', /error)
+      return
+   ENDIF
+;
+; on va s''assurer que toutes les figures ont le meme calendrier 
+;
+   filelist = extractatt(top_uvalue,  'filelist')
+   filenames = (extractatt(top_uvalue,  'champs'))[0, *]
+   filenames = reform(filenames)
+   filenames = filenames[uniq(filenames, sort(filenames))]
+   if strtrim(filenames[0], 1) EQ '' then filenames = filenames[1:n_elements(filenames)-1]
+   indexfile = (where(filelist EQ filenames[0]))[0]
+   calendar = (*(extractatt(top_uvalue, 'fileparameters'))[indexfile]).time_counter  
+   if n_elements(filenames) GT 1 then begin
+      for i = 1, n_elements(filenames)-1 do begin
+         indexfilebis = (where(filelist EQ filenames[i]))[0]
+         calendarbis = (*(extractatt(top_uvalue, 'fileparameters'))[indexfilebis]).time_counter
+         if n_elements(calendarbis) NE n_elements(calendar)  then begin
+            nothing = report('Les diffrents plots n''utilisent pas le meme calendrier. !C Animation impossible!', /error)
+            return
+         ENDIF
+         if total(calendar NE calendarbis) NE 0 then begin
+            nothing = report('Les diffrents plots n''utilisent pas le meme calendrier. !C Animation impossible!', /error)
+            return
+         endif
+      endfor
+   endif
+;
+; c''est possible de faire une animation  
+;
+   base = widget_base(/column, title = 'creation d''une animation', uvalue = {parent:parent, indexfile:indexfile})   
+   rien = widget_label(base, value = 'Quel nom donner a l''animation')
+   rien = widget_text(base,value='anim_idl.gif', uname='Filename', /editable)
+   rien = widget_label(base, value = 'repertoire ou mettre le fichier')
+   if n_elements(animdir) EQ 0 then cd, current = animdir
+   rien = widget_text(base,value=animdir, uname='directorie', /editable)
+   rien = widget_label(base, value = 'Debut de l''animation')
+   rien = cw_calendar(base, calendar, uname = 'debut', uvalue = {name:'calendar'}, /frame)
+   rien = widget_label(base, value = 'Fin de l''animation')
+   rien = cw_calendar(base, calendar, calendar[n_elements(calendar)-1] $
+                      , uname = 'fin', uvalue = {name:'calendar'}, /frame)
+   rien = widget_button(base,value='OK', uvalue = 'ok')
+   rien = widget_button(base,value='Cancel', uvalue = 'cancel')
+;
+   widget_control,base,/realize
+   xmanager,'xcreateanim', base, /no_block
+   
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xspecifiedessin.pro.old
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xspecifiedessin.pro.old	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xspecifiedessin.pro.old	(revision 49)
@@ -0,0 +1,140 @@
+PRO xspecifiedessin_event, event 
+   widget_control, event.top, get_uvalue = topid
+   widget_control, topid, get_uvalue = top_uvalue
+   widget_control, event.id, get_uvalue = uval
+   if n_elements(uval) EQ 0 then return
+   case uval of
+      'cancel':widget_control, event.top, /destroy
+      'default':BEGIN 
+         exextra = definedefaultextra(top_uvalue.nomvariable)
+         widget_control, widget_info(event.top,find_by_uname='min'), set_value = strtrim(exextra.min, 1)
+         widget_control, widget_info(event.top,find_by_uname='max'), set_value = strtrim(exextra.max, 1)
+         widget_control, widget_info(event.top,find_by_uname='int'), set_value = strtrim(exextra.inter, 1)
+         widget_control, widget_info(event.top,find_by_uname='palnum'), set_value = strtrim(exextra.lct, 1)
+         widget_control, widget_info(event.top,find_by_uname='autres'), set_value = '' 
+      END
+      'palcol':BEGIN 
+         ind = fix(strmid(event.value, 0, strpos(event.value, '-')))
+         widget_control, widget_info(event.top,find_by_uname='palnum'), set_value = strtrim(ind, 1)
+      END
+      'pzoom':BEGIN 
+         widget_control, widget_info(event.top,find_by_uname='pzoom'), get_value = pzoom
+         pzoom = long(pzoom[0])
+         pmaxid = widget_info(event.top,find_by_uname='pmax')
+         widget_control, pmaxid, get_value = pmax
+         pmax = long(pmax[0])
+         if pzoom GT pmax then widget_control, pmaxid, set_value = strtrim(pzoom, 1)
+      END
+      'ok':BEGIN 
+         widget_control, widget_info(event.top,find_by_uname='min'), get_value = min
+         min = float(min[0])
+         widget_control, widget_info(event.top,find_by_uname='max'), get_value = max
+         max = float(max[0])
+         widget_control, widget_info(event.top,find_by_uname='int'), get_value = int
+         int = float(int[0])
+         widget_control, widget_info(event.top,find_by_uname='palnum'), get_value = palnum
+         palnum = long(palnum[0])
+         widget_control, widget_info(event.top,find_by_uname='autres'), get_value = autres
+         autres = autres[0]
+;
+         exextra = {min:min, max:max, inter:int, lct:palnum}
+         if autres NE '' then rien = execute('exextra = get_extra('+autres+', _extra = exextra)')
+;
+; si on fait un pltz
+;
+         if top_uvalue.name EQ 'pltz' then begin
+            widget_control, widget_info(event.top,find_by_uname='pzoom'), get_value = pzoom
+            pzoom = long(pzoom[0])
+            pmaxid = widget_info(event.top,find_by_uname='pmax')
+            widget_control, pmaxid, get_value = pmax
+            pmax = long(pmax[0])
+            if pzoom GT pmax then pmax = pzoom
+; si pmax n''est pas la valeur par defaut alors il faut changer la
+; boite utiliseee ds le pltz
+            if pmax NE 200 then BEGIN
+               commande = top_uvalue.commande
+; on recupere la fin de la boite
+               pos2 = strpos(commande, ']', rstrpos(commande, 'boite'))
+; on change la derniere valeur de la boite
+               pos1 = rstrpos(commande, ',', pos2)
+               top_uvalue.commande = strmid(commande, 0, pos1+1)+strtrim(pmax, 1)+strmid(commande, pos2)
+;               ENDELSE 
+            ENDIF 
+            exextra = mixstru({profmax:pmax, zoom: pzoom}, exextra)
+         ENDIF 
+         widget_control, topid, set_uvalue = mixstru({exextra:exextra}, top_uvalue)
+         widget_control, event.top, /destroy
+         widgetdessine, topid, commande = top_uvalue.commande
+      END
+      ELSE:
+   endcase
+
+   return
+end
+;----------------------------------------------------------------
+PRO xspecifiedessin, parent, _extra = ex
+   widget_control, parent, get_uvalue = top_uvalue
+   base = widget_base(/column, title = 'Specification du Dessin', uvalue = parent)
+; base1 pour specifier le min, le max et l''intervalle
+   base1 = widget_base(base, /row, /frame)
+   rien = widget_label(base1, value = 'Min')
+   rien = widget_text(base1, value = strtrim(top_uvalue.exextra.min, 1), /editable, xsize = 5, uname = 'min', uvalue = 'min')
+   rien = widget_label(base1, value = 'Max')
+   rien = widget_text(base1, value = strtrim(top_uvalue.exextra.max, 1), /editable, xsize = 5, uname = 'max', uvalue = 'max')
+   rien = widget_label(base1, value = 'Int')
+   rien = widget_text(base1, value = strtrim(top_uvalue.exextra.inter, 1), /editable, xsize = 5, uname = 'int', uvalue = 'int')
+; base2 por specifier la palette de couleur (soit par numero soit ds
+; un menu deroulant)
+   base2 = widget_base(base, /row, /frame)
+   rien = widget_label(base2, value = 'Pal Number')
+   rien = widget_text(base2, value = strtrim(top_uvalue.exextra.lct, 1), /editable, xsize = 3, uname = 'palnum', uvalue = 'palnum')
+   lct,  get_name = nomcouleur
+   nbrligne = 30
+   nbrlist = n_elements(nomcouleur)/nbrligne
+   nomcouleur = strtrim(sindgen(n_elements(nomcouleur)), 1)+'- '+nomcouleur
+   nomcouleur = '0\'+nomcouleur
+   nomcouleur = ['1\palette de couleur', nomcouleur]
+   if nbrlist GT 1 then for i = 1,nbrlist do $
+    nomcouleur = [nomcouleur[0:nbrligne*i-1+i], '1\ ', nomcouleur[nbrligne*i+i:n_elements(nomcouleur)-1]]
+   rien = cw_pdmenu(base2,nomcouleur, /RETURN_NAME , uvalue = 'palcol', uname = 'palcol')
+; si on est en train de faire un graph pour pltz on raoute un widget
+; pour specifier la profmax et la profzoom
+   if top_uvalue.name EQ 'pltz' then BEGIN
+      base4pltz = widget_base(base, /row, /frame)
+      rien = widget_label(base4pltz, value = 'Prof max')
+; il faut retrouver la prof max de la boite utiliseee pour faire le pltz
+      posboite = strpos(top_uvalue.commande, '[', rstrpos(top_uvalue.commande, 'boite'))
+      boite = strmid(top_uvalue.commande, posboite $
+                     , strpos(top_uvalue.commande, ']', posboite )-posboite+1)
+      boite = str_sep(boite, ',')
+      if n_elements(boite) EQ 4 then pmax = 200 ELSE pmax = long(boite[n_elements(boite)-1])
+      pmax = strtrim(pmax, 1)
+; on declare le widget:
+      rien = widget_text(base4pltz, value = pmax, /editable, xsize = 4, uname = 'pmax', uvalue = 'pmax')
+      rien = widget_label(base4pltz, value = 'Prof Zoom')
+      if chkstru(top_uvalue.exextra, 'zoom') then pzoom = top_uvalue.exextra.zoom[0] $
+      ELSE pzoom = pmax
+      rien = widget_text(base4pltz, value = strtrim(pzoom, 1), /editable, xsize = 4, uname = 'pzoom', uvalue = 'pzoom')
+
+   endif
+   
+; baseavantfin pour passer tous les mots cles possibles...
+; widget text contennant les autres mots cles passe ds top_uvalue.exextra
+; en reste-t-il? si oui, il faut les mettres sous forme de string
+   restekeywd = extractstru(top_uvalue.exextra, ['min', 'max', 'inter', 'lct', 'zoom', 'profmax'])
+   if size(restekeywd, /type) EQ 8 then autres = strkeywd(restekeywd) ELSE autres = ''
+   baseavantfin = widget_base(base, /row, /frame)
+   rien = widget_label(baseavantfin, value = 'Autres mots cles')
+   rien = widget_text(baseavantfin, value = autres, /editable, uname = 'autres', uvalue = 'autres')
+; basefin pour en finir, trois boutons: Default/OK/Cancel
+   basefin = widget_base(base, /row, /frame, /align_center)
+   rien = widget_button(basefin,value='Default', uvalue = 'default')
+   rien = widget_button(basefin,value='OK', uvalue = 'ok')
+   rien = widget_button(basefin,value='Cancel', uvalue = 'cancel')
+
+;
+   widget_control,base,/realize
+   xmanager,'xspecifiedessin',base, /no_block
+;
+   return
+end
Index: /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar.pro
===================================================================
--- /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar.pro	(revision 49)
+++ /trunk/ToBeReviewed/WIDGET/AUTOUR_de_XXX/xxxmenubar.pro	(revision 49)
@@ -0,0 +1,367 @@
+;------------------------------------------------
+PRO xxxmenubar_event, event
+@common
+
+
+   case event.value of
+      'Open' :begin 
+         newfile = selectfile()
+         if size(newfile, /type) NE 8 then return
+         widget_control, event.top, /hourglass
+         widget_control, event.top, update = 0
+         widget_control, event.top, get_uvalue = top_uvalue
+; on s''occupe de filelist
+         filelist = extractatt(top_uvalue, 'filelist')
+         filelist = [filelist, newfile.fileparameters.filename]
+         currentfile = n_elements(filelist)-1
+; on update le widget
+         filelistid = widget_info(event.top, find_by_uname = 'filelist')
+         widget_control, filelistid, set_value = filelist
+         widget_control, filelistid, set_list_select = currentfile
+; on update les elements filelist et currentfile de la top_uvalue
+         *top_uvalue[1, findline(top_uvalue, 'filelist')] = filelist
+         oldfile = *top_uvalue[1, findline(top_uvalue, 'currentfile')]
+         *top_uvalue[1, findline(top_uvalue, 'currentfile')] = currentfile
+; on s''occupe du nom de la variable
+         champid = widget_info(event.top, find_by_uname = 'champ')
+; quel etait le champ selectionne ? on le reselectionne ?
+         oldlistvar = (*(extractatt(top_uvalue, 'fileparameters'))[oldfile]).listvar
+         fieldname = oldlistvar[widget_info(champid,/droplist_select)]
+         index = where(newfile.fileparameters.listvar EQ fieldname) & index = 0>index[0]
+         widget_control, champid, set_value = newfile.fileparameters.listvar
+         widget_control, champid, set_droplist_select = index
+; on s''occupe du calendrier
+         date1id = widget_info(event.top, find_by_uname = 'calendar1')
+         widget_control, date1id, get_value = date1
+         widget_control, date1id, /destroy
+         if (where(newfile.fileparameters.time_counter EQ date1))[0] EQ -1 $
+          then date1 = newfile.fileparameters.time_counter[0]
+         date2id = widget_info(event.top, find_by_uname = 'calendar2')
+         widget_control, date2id, get_value = date2
+         widget_control, date2id, /destroy
+         if (where(newfile.fileparameters.time_counter EQ date2))[0] EQ -1 then date2 = date1
+         base12 = widget_info(event.top, find_by_uname = 'base12')
+         rien = cw_calendar(base12,newfile.fileparameters.time_counter,date1, uname = 'calendar1' $
+                            , uvalue = {name:'calendar1'}, /frame)
+         rien = cw_calendar(base12,newfile.fileparameters.time_counter,date2, uname = 'calendar2' $
+                            , uvalue = {name:'calendar2'}, /frame)
+; update la grille???
+         change = changegrid(newfile.meshparameters)
+         if change then BEGIN
+            domainid = widget_info(event.top, find_by_uname = 'domain')
+            widget_control, domainid, set_value = -1
+         endif
+; on update les elements fileparameters, readparameters et meshparameters de la top_uvalue
+         newfileparameters = ptrarr(currentfile+1, /allocate_heap)
+         FOR i = 0, currentfile-1 DO $
+          *newfileparameters[i] = *(extractatt(top_uvalue, 'fileparameters'))[i]
+         *newfileparameters[currentfile] = newfile.fileparameters
+         ptr_free, extractatt(top_uvalue, 'fileparameters')
+         *top_uvalue[1, findline(top_uvalue, 'fileparameters')] = newfileparameters
+;
+         newreadparameters = ptrarr(currentfile+1, /allocate_heap)
+         FOR i = 0, currentfile-1 DO $
+          *newreadparameters[i] = *(extractatt(top_uvalue, 'readparameters'))[i]
+         *newreadparameters[currentfile] = newfile.readparameters
+         ptr_free, extractatt(top_uvalue, 'readparameters')
+         *top_uvalue[1, findline(top_uvalue, 'readparameters')] = newreadparameters
+;
+         newmeshparameters = ptrarr(currentfile+1, /allocate_heap)
+         FOR i = 0, currentfile-1 DO $
+          *newmeshparameters[i] = *(extractatt(top_uvalue, 'meshparameters'))[i]
+         *newmeshparameters[currentfile] = newfile.meshparameters
+         ptr_free, extractatt(top_uvalue, 'meshparameters')
+         *top_uvalue[1, findline(top_uvalue, 'meshparameters')] = newmeshparameters
+; on actualise le widget!
+         widget_control, event.top, update = 1
+      end
+      'New xxx' :BEGIN
+         widget_control, event.top, get_uvalue = top_uvalue
+         extra = extractatt(top_uvalue, 'extra')
+         xxx, CALLERWIDID = event.top, _extra = extra
+      end
+      'Quit':begin 
+         widget_control, event.top, get_uvalue = top_uvalue
+         ptr_free, extractatt(top_uvalue, 'exextra')
+         ptr_free, extractatt(top_uvalue, 'fileparameters')
+         ptr_free, extractatt(top_uvalue, 'readparameters')
+         ptr_free, extractatt(top_uvalue, 'meshparameters')
+         ptr_free, top_uvalue
+         widget_control, event.top, /destroy ;on ferme le widget
+      end
+      'PS' :BEGIN
+         IF lmgr(/demo) EQ 1 THEN BEGIN
+            dummy = report('impossible to save as postscript in demo mode')
+            return
+         ENDIF
+         widget_control,event.top, get_uvalue = top_uvalue
+; portrait ou landscape ???
+         options = extractatt(top_uvalue, 'options')   
+         optionsflag = extractatt(top_uvalue, 'optionsflag')
+         portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0]
+; on recupere la liste des instructions
+         globalcommand = extractatt(top_uvalue, 'globalcommand')
+; on complete par le premiere et les dernieres lignes du programme
+         createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $
+                    , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape, DATE1IN = date1in, DATE2IN = date2in, _extra = ex' $
+                    , KWDUSED = ', /POSTSCRIPT, PORTRAIT = portrait'
+       END
+      'Anim' :begin 
+;;; no more working...         xcreateanim, event.top
+      end
+      'Gif' :BEGIN
+         IF lmgr(/demo) EQ 1 THEN BEGIN
+            dummy = report('impossible to save as an image in demo mode')
+            return
+         ENDIF
+         widget_control,event.top, get_uvalue = top_uvalue
+         smallin = extractatt(top_uvalue, 'smallin')
+         numdessinin = smallin[2]-1
+         smallout = extractatt(top_uvalue, 'smallout')
+         numdessinout = smallout[2]-1
+         tracecadre, smallin, /erase
+         tracecadre, smallout, /erase
+         filename = xquestion('dans quelle fichier gif voulez vous sauver !C l''ecran de xxx?', 'xxx_image.gif')
+         if rstrpos(filename, '.gif') NE strlen(filename)-4 then filename = filename+'.gif'
+         filename = isafile(file = filename, io = imagedir, /new)
+         saveimage, filename, /quiet
+      end
+      'Script':BEGIN
+         IF lmgr(/demo) EQ 1 THEN BEGIN
+            dummy = report('impossible to save as a idl program file in demo mode')
+            return
+         ENDIF
+; on recupere le nom du fichier
+         filename = xquestion('dans quelle procedure IDL voulez vous sauver !C la realisation de ce graph?', 'xxx_figure.pro')
+; on le complete par un .pro
+         if rstrpos(filename, '.pro') NE strlen(filename)-4 then filename = filename+'.pro'
+         filename = isafile(file = filename, io = homedir, /new)
+         widget_control,event.top, get_uvalue = top_uvalue
+; portrait ou landscape ???
+         options = extractatt(top_uvalue, 'options')   
+         optionsflag = extractatt(top_uvalue, 'optionsflag')
+         portrait = (optionsflag[where(options EQ 'Portrait/Landscape'), 0])[0]
+; on lit les commandes pour faire un plot
+         globalcommand = extractatt(top_uvalue, 'globalcommand')
+; on complete par le premiere et les dernieres lignes du programme
+         thisOS = strupcase(strmid(!version.os_family, 0, 3))
+         CASE thisOS of
+            'MAC':sep = ':'
+            'WIN':sep = '\'
+            ELSE:sep = '/'
+         ENDCASE
+         poslastsep = rstrpos(filename, sep)
+         proname = strmid(filename, poslastsep+1, strlen(filename)-poslastsep-1-4)
+         globalcommand = ['pro '+proname+', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape, DATE1IN = date1in, DATE2IN = date2in, _extra = ex' $
+                          , '@common' $
+                          , ' ' $
+                          , '   portrait = '+strtrim(portrait, 1) $
+                          , '   '+globalcommand $
+                          , ' ' $
+                          , 'return' $
+                          , 'end']
+; on les ecrit dans un programme
+         putfile, filename, globalcommand
+      END
+      'Widget':BEGIN
+         IF lmgr(/demo) EQ 1 THEN BEGIN
+            dummy = report('impossible to save the widget in demo mode')
+            return
+         ENDIF
+; on recupere le nom du fichier
+         filename = xquestion('dans quel fichier bianire voulez vous sauver le widget ?', 'xxx_widget.dat')
+; on le complete par un .dat
+         if rstrpos(filename, '.dat') NE strlen(filename)-4 then filename = filename+'.dat'
+         filename = isafile(file = filename, io = homedir, /new)
+;
+         widget_control, event.top, get_uvalue = uvalue
+         widget_control, extractatt(uvalue, 'graphid'),get_value=win
+         wshow, win
+         wset, win
+         image = tvrd(/true)
+         save, uvalue, image, filename = filename
+      END
+      'Prompt':BEGIN
+         commande = getfile(myuniquetmpdir + 'xxx_oneplot.pro')
+         for i = 0,  n_elements(commande)-1 do print, commande[i]
+      end
+      'Ok button' :begin 
+         widget_control, event.top, get_uvalue = top_uvalue
+         options = extractatt(top_uvalue, 'options')
+         index = where(options EQ 'Ok button') & index = index[0]
+         optionsflag = extractatt(top_uvalue, 'optionsflag')
+         flag = 1-optionsflag[index, 0]
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = flag
+         widget_control, widget_info(event.top, find_by_uname = 'base ok button'), map = flag
+      end
+      'Portrait/Landscape' :begin 
+         widget_control, event.top, get_uvalue = top_uvalue
+         options = extractatt(top_uvalue, 'options')
+         index = where(options EQ 'Portrait/Landscape') & index = index[0]
+         optionsflag = extractatt(top_uvalue, 'optionsflag')
+         key_portrait= 1-optionsflag[index, 0]
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, *] = key_portrait
+; fenetre separee ou fenetre collee au widget ?
+         if widget_info(event.top, find_by_uname = 'graph') EQ 0 then BEGIN
+; on tue la fenetre
+            graphid = extractatt(top_uvalue, 'graphid')
+            widget_control, widget_info(graphid, /parent), /destroy
+; on la recree
+            basegraph = widget_base(title = 'xxx window',  group_leader = event.top, uvalue = event.top,  uname = 'basegraph')
+            windsize = givewindowsize()
+            graphid = widget_draw(basegraph, uname = 'graph' $
+                                  , uvalue = {name:'graph', press:0, click:0, x:[0., 0.], y:[0., 0.]} $
+                                  , /button_events, retain = 2 $
+                                  , xsize = windsize[0],ysize = windsize[1])
+            widget_control,basegraph,/realize
+            xmanager,'xxx',basegraph, /no_block
+; on redessine ce qu''il y avait dedans
+; on recupere la liste des instructions
+            globalcommand = extractatt(top_uvalue, 'globalcommand')
+; on complete par le premiere et les dernieres lignes du programme
+            createpro, globalcommand, filename = myuniquetmpdir + 'xxx2ps.pro' $
+                       , KWDLIST = ', NOERASE = noerase, POSTSCRIPT = postscript, PORTRAIT = portrait, LANDSCAPE = landscape' $
+                       , KWDUSED = ', /noerase, PORTRAIT = portrait'
+; on reattribue l''element graphid de la top_uvalue
+            *top_uvalue[1, findline(top_uvalue, 'graphid')] = graphid
+         ENDIF ELSE BEGIN
+            extra = extractatt(top_uvalue, 'extra')
+            xxx, CALLERWIDID = event.top, /redraw, _extra = extra
+            widget_control, event.top, /destroy ;on ferme le widget
+         ENDELSE
+      end
+      'Overlay' :begin 
+         widget_control, event.top, get_uvalue = top_uvalue
+         numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1
+         options = extractatt(top_uvalue, 'options')   
+         flags = extractatt(top_uvalue, 'optionsflag')
+         index = where(options EQ 'Overlay')
+; on change le flag sur Longitude / x index
+         flag = 1-flags[index, numdessinin] & flag = flag[0]
+; on le reeatribue
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag
+      end
+      'Vecteur':BEGIN
+         widget_control, event.top, get_uvalue = top_uvalue
+         numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1
+         options = extractatt(top_uvalue, 'options')   
+         flags = extractatt(top_uvalue, 'optionsflag')
+         index = where(options EQ 'Vecteur')
+; on change le flag sur Longitude / x index
+         flag = 1-flags[index, numdessinin] & flag = flag[0]
+; on le reeatribue
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag
+      end
+      'Longitude / x index':BEGIN
+         widget_control, event.top, get_uvalue = top_uvalue
+         numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1
+         options = extractatt(top_uvalue, 'options')   
+         flags = extractatt(top_uvalue, 'optionsflag')
+         index = where(options EQ 'Longitude / x index')
+; on change le flag sur Longitude / x index
+         flag = 1-flags[index, numdessinin] & flag = flag[0]
+; on le reeatribue
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag
+; maintenant on va changer les sliders definissant la boxzoom
+         domainid = widget_info(event.top, find_by_uname = 'domain')
+         boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin]
+; on veut retrouver le type de grille qui est utilisee
+         currentfile = extractatt(top_uvalue, 'currentfile')
+         listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
+         indexvar = widget_info(widget_info(event.top, find_by_uname = 'champ'), /droplist_select)
+         vargrid = strupcase(listgrid[indexvar])
+         if flag EQ 0 then BEGIN ; longitudes
+; on fait un domdef pour retrouver le lon1 lon2 correspondant a la
+; boxzoom definie sur le widget... 
+            domdef, boxzoom, gridtype = vargrid, /xindex $
+             , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0]
+            widget_control, domainid, set_value = [lon1, lon2, boxzoom[2:3]]
+         ENDIF ELSE BEGIN       ; xindex
+; maintenant ion veut retrouver firstx, lastx correspondant a la
+; boxzoom definie sur le widget...
+            domdef, boxzoom, gridtype = vargrid $
+             , yindex = (flags[where(options EQ 'Latitude / y index'), numdessinin])[0]
+            grille, -1, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
+            widget_control, domainid, set_value = [firstx, lastx, boxzoom[2:3]]
+         ENDELSE
+; on met a jour la top_uvalue
+         widget_control, domainid, get_value = boxzoom
+         (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom
+      end
+      'Latitude / y index':begin 
+         widget_control, event.top, get_uvalue = top_uvalue
+         numdessinin = (extractatt(top_uvalue, 'smallin'))[2]-1
+         options = extractatt(top_uvalue, 'options')   
+         flags = extractatt(top_uvalue, 'optionsflag')
+         index = where(options EQ 'Latitude / y index')
+; on change le flag sur Latitude / y index
+         flag = 1-flags[index, numdessinin] & flag = flag[0]
+; on le reeatribue
+         (*top_uvalue[1, findline(top_uvalue, 'optionsflag')])[index, numdessinin] = flag
+; maintenant on va changer les sliders definissant la boxzoom
+         domainid = widget_info(event.top, find_by_uname = 'domain')
+         boxzoom = (extractatt(top_uvalue, 'domaines'))[*, numdessinin]
+; on veut retrouver le type de grille qui est utilisee
+         currentfile = extractatt(top_uvalue, 'currentfile')
+         listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
+         indexvar = widget_info(widget_info(event.top, find_by_uname = 'champ'), /droplist_select)
+         vargrid = strupcase(listgrid[indexvar])
+         if flag EQ 0 then BEGIN ; latitudes
+; on fait un domdef pour retrouver le lat1 lat2 correspondant a la
+; boxzoom definie sur le widget... 
+            domdef, boxzoom, gridtype = vargrid, /yindex $
+             , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0]
+            widget_control, domainid, set_value = [boxzoom[0:1], lat1, lat2]
+         ENDIF ELSE BEGIN       ; yindex
+; maintenant ion veut retrouver firsty, lasty correspondant a la
+; boxzoom definie sur le widget...
+            domdef, boxzoom, gridtype = vargrid $
+             , xindex = (flags[where(options EQ 'Longitude / x index'), numdessinin])[0]
+            grille, -1, -1, -1, -1,nx,ny,nz,firstx,firsty,firstz,lastx,lasty,lastz
+            widget_control, domainid, set_value = [boxzoom[0:1], firsty, lasty]
+         ENDELSE
+; on met a jour la top_uvalue
+         widget_control, domainid, get_value = boxzoom
+         (*top_uvalue[1, findline(top_uvalue, 'domaines')])[*, numdessinin] = boxzoom
+      end
+   endcase
+   return
+end
+;------------------------------------------------
+PRO xxxmenubar, parent, OPTIONS =options, _EXTRA = ex
+;       desc = [ '1\Colors' , $
+;    '0\Red' , $
+;    '0\Green' , $
+;    '1\Blue' , $
+;    '0\Light' , $
+;    '0\Medium' , $
+;    '0\Dark' , $
+;    '0\Navy' , $
+;    '2\Royal' , $
+;    '0\Cyan' , $
+;    '2\Magenta' , $
+;    '2\Quit' ]
+   desc = [ '1\File' , $
+            '0\Open' , $
+            '0\New xxx' , $
+            '2\Quit', $
+            '1\Save as' , $
+            '0\PS' , $
+            '0\Anim' , $
+            '0\Gif' , $
+            '0\Script', $
+            '0\Widget', $
+            '2\Prompt', $
+            '1\Flag options']
+   descsuite = options
+   if n_elements(descsuite) GE 2 then $
+    descsuite[0:n_elements(descsuite)-2] = '0\'+descsuite[0:n_elements(descsuite)-2]
+   descsuite[n_elements(descsuite)-1] = '2\'+descsuite[n_elements(descsuite)-1]
+   desc = [desc, descsuite]
+            
+   menu = CW_PDMENU(parent, desc, /RETURN_NAME, /mbar, uname = 'menubar', uvalue = {name:'menubar'}, _EXTRA = ex)
+
+
+;------------------------------------------------
+   return
+end
