source: trunk/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_domain.pro @ 51

Last change on this file since 51 was 51, checked in by pinsard, 18 years ago

upgrade of COMPOUND_WIDGET according to cerbere.lodyc.jussieu.fr: /usr/home/smasson/SAXO_RD/ : files

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 23.6 KB
Line 
1; IDL> testwid
2; PRO testwid_event, event
3; ; help,  event, /struct
4;    Id = widget_info(event.top,find_by_uname = 'c''est lui')
5;    widget_control, event.id, get_uvalue=uval
6;    if n_elements(uval) EQ 0 then return
7;    case uval of
8;       'done':widget_control, event.top, /destroy
9;       'set':BEGIN
10;          widget_control, event.id, get_value = value & value = value[0]
11;          nothing = execute('boxzoom ='+value)
12;          widget_control, Id, set_value = boxzoom
13;       END
14;       'get':BEGIN
15;          widget_control, Id, get_value = value
16;          print,  value
17;       END
18;       ELSE:
19;    endcase
20;    return
21; end
22; PRO testwid, _extra = ex
23;    base=widget_base(/COLUMN)
24;    print, 'base=', base
25;    nothing = widget_label(base, value = 'beginning of the test')
26; ;
27;    nothing = cw_domain(base,_extra = ex, uname = 'c''est lui', uvalue = 'c''est lui')
28;    print, 'cw_domain ID =', nothing
29; ;
30;    nothing = widget_label(base, value = 'end of the test')
31;    nothing = widget_text(base, value = '[40, 100, -10, 10]', uvalue = 'set', /editable)
32;    nothing = widget_button(base, value = 'get', uvalue = 'get')
33;    nothing = widget_button(base, value = 'done', uvalue = 'done')
34;    widget_control, base, /REALIZE
35;    xmanager,'testwid', base
36;    return
37; end
38;
39;
40;*********************************************************************
41pro cw_domain_set_value, id, value
42@common
43;------------------------------------------------
44; quel est le type de boxzoom?
45   topid = findtopid(id)
46   widget_control, topid, get_uvalue=top_uvalue
47   currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1
48   options = extractatt(top_uvalue, 'options')   
49   flags = extractatt(top_uvalue, 'optionsflag')
50   flags = flags[*, currentplot]
51   IF (flags[where(options EQ 'Longitude / x index')])[0] EQ 0 THEN $
52    xtype = 'geographic' ELSE xtype = 'index'
53   IF (flags[where(options EQ 'Latitude / y index')])[0] EQ 0 THEN $
54    ytype = 'geographic' ELSE ytype = 'index'
55;------------------------------------------------
56; comment completer la boxzoom?
57   IF xtype EQ  'geographic' then begin
58      lonn1 = lon1
59      lonn2 = lon2
60      xtitle = 'lon'
61   ENDIF ELSE BEGIN
62      lonn1 = firstxt
63      lonn2 = lastxt
64      xtitle = 'x index'
65   ENDELSE
66   IF ytype EQ  'geographic' then begin
67      latt1 = lat1
68      latt2 = lat2
69      ytitle = 'lat'
70   ENDIF ELSE BEGIN
71      latt1 = firstyt
72      latt2 = lastyt
73      ytitle = 'y index'
74   ENDELSE
75;------------------------------------------------
76   vertf1 = floor(min([gdepw[0], gdept[0]]))
77   vertf2 = ceil(max([gdepw[0], gdept[0]]))
78;------------------------------------------------
79   Case N_Elements(Value) OF
80      0:boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2]
81      1:BEGIN
82         if value EQ -1 then boxzoom = [lonn1, lonn2, latt1, latt2, vertf1, vertf2] $
83         ELSE boxzoom=[lonn1, lonn2, latt1, latt2, 0.,value[0]]
84      END
85      2:boxzoom=[lonn1, lonn2, latt1, latt2, value[0],value[1]]
86      4:boxzoom=[Value]
87      5:boxzoom=[Value[0:3], 0, Value[4]]
88      6:boxzoom = Value
89      Else:BEGIN
90         rien = report('Mauvaise Definition de Boxzoom')
91      END
92   ENDCASE
93;------------------------------------------------
94   boxzoom[0] = floor(boxzoom[0])
95   boxzoom[1] = ceil(boxzoom[1])
96   boxzoom[2] = floor(boxzoom[2])
97   boxzoom[3] = ceil(boxzoom[3])
98   if n_elements(boxzoom GE 5) then begin
99      boxzoom[4] = floor(boxzoom[4])
100      boxzoom[5] = ceil(boxzoom[5])
101   endif
102;------------------------------------------------
103;------------------------------------------------
104   widget_control,widget_info(id,find_by_uname = 'lon1'), get_uvalue = uvalue
105   strict = uvalue.strict
106;
107; les longitudes
108;
109; min et max possible
110   if xtype EQ 'geographic' then BEGIN
111      min = floor(min([glamt,glamf], max = max))
112      max = ceil(max)
113   ENDIF ELSE BEGIN
114      min = 0
115      max = jpi-1
116   ENDELSE
117; les id des widgets
118   lon1id = widget_info(id,find_by_uname = 'lon1')
119   lon2id = widget_info(id,find_by_uname = 'lon2')
120; doit-on changer de type d''axe x: longitude/index
121   lonbase = widget_info(id,find_by_uname = 'lonbase')
122   widget_control, lonbase,  get_uvalue = lonbase_uvalue
123   if lonbase_uvalue.name NE xtype then BEGIN
124      widget_control, lonbase, update = 0
125; on casse tout
126      widget_control, lon1id, /destroy
127      widget_control, lon2id, /destroy
128; on reconstruit
129      lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $
130                            , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $
131                            , title = xtitle+'1', minimum = min $
132                            , maximum = (boxzoom[1] < max)-keyword_set(strict))
133      lon2id = cw_slider_pm(lonbase,value=((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $
134                            , uvalue={name:'lon2', strict:keyword_set(strict)} $
135                            , uname='lon2', title = xtitle+'2', maximum = max $
136                            , minimum = (min > boxzoom[0])+keyword_set(strict))
137      widget_control, lonbase, set_uvalue = {name:xtype}
138      widget_control, lonbase, update = 1
139   ENDIF ELSE BEGIN
140; la nouvelle valeur qu''ils vont avoir
141      cursorvalue1 = min > boxzoom[0] < ((boxzoom[1] < max)-strict)
142      cursorvalue2 = ((min > boxzoom[0])+strict) > boxzoom[1] < max
143; on change les bornes des slider
144      widget_control, lon1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict}
145      widget_control, lon2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max}
146; on attribut la nouvelle valeur
147      widget_control, lon1id , set_value = cursorvalue1
148      widget_control, lon2id, set_value = cursorvalue2
149   ENDELSE
150;
151; les latitudes
152;
153; min et max possible
154   if ytype EQ 'geographic' then begin
155      min = floor(min([gphit,gphif], max = max))
156      max = ceil(max)
157   ENDIF ELSE BEGIN
158      min = 0
159      max = jpj-1
160   ENDELSE
161; doit-on changer de type d''axe y: latitude/index
162   latbase = widget_info(id,find_by_uname = 'latbase')
163   widget_control, latbase,  get_uvalue = latbase_uvalue
164   lat1id = widget_info(id,find_by_uname = 'lat1')
165   lat2id = widget_info(id,find_by_uname = 'lat2')
166   if latbase_uvalue.name NE ytype then BEGIN
167      widget_control, latbase, update = 0
168      widget_control, lat1id, /destroy
169      widget_control, lat2id, /destroy
170      lat1id = cw_slider_pm(latbase,value=min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $
171                            , uvalue={name:'lat1', strict:keyword_set(strict)},uname ='lat1' $
172                            , title = ytitle+'1', minimum =min $
173                            , maximum = ((boxzoom[3] < max)-keyword_set(strict)))
174      lat2id = cw_slider_pm(latbase,value=((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $
175                            , uvalue={name:'lat2', strict:keyword_set(strict)} $
176                            , uname ='lat2', title = ytitle+'2' ,maximum =  max $
177                            , minimum =(min > boxzoom[2])+keyword_set(strict))
178      widget_control, latbase, set_uvalue = {name:ytype}
179      widget_control, latbase, update = 1
180   ENDIF ELSE BEGIN
181      cursorvalue1 = min > boxzoom[2] < ((boxzoom[3] < max)-strict)
182      cursorvalue2 = ((min > boxzoom[2])+strict) > boxzoom[3] < max
183      widget_control, lat1id, set_value = {slider_min:min, slider_max:cursorvalue2-strict}
184      widget_control, lat2id, set_value = {slider_min:cursorvalue1+strict, slider_max:max}
185      widget_control, lat1id, set_value = cursorvalue1
186      widget_control, lat2id, set_value = cursorvalue2
187   ENDELSE
188;
189;
190   if n_elements(boxzoom) EQ 4 then return
191;
192; la profondeur
193;
194   depthlev1id = widget_info(id,find_by_uname = 'depthlev1')
195   depthlev2id = widget_info(id,find_by_uname = 'depthlev2')
196   depth1id = widget_info(id,find_by_uname = 'depth1')
197   depth2id = widget_info(id,find_by_uname = 'depth2')
198   widget_control, depthlev1id, get_uvalue = depthlev1_uval
199; a-t-on change de type de grille ?, faut=il changerl''axe verticale?
200   widget_control, findtopid(id),  get_uvalue = top_uvalue
201   zgrid = extractatt(top_uvalue, 'zgrid')
202   grid_t = zgrid EQ 'T'
203   if grid_t NE depthlev1_uval.grid_t then BEGIN
204      widget_control, depthlev2id, get_uvalue = depthlev2_uval
205      depthlev1_uval.grid_t = grid_t
206      depthlev2_uval.grid_t = grid_t
207;
208      if grid_t then gdep = gdept ELSE gdep = gdepw
209      gdep1 = floor(gdep)
210      gdep2 = ceil(gdep)
211      identique = where(gdep2-gdep1 EQ 0)
212      if identique[0] NE -1 then gdep2[identique] = gdep2[identique] +1
213      depthlev1_uval.value = gdep1
214      depthlev2_uval.value = gdep2
215;
216      widget_control, depthlev1id, set_value = {value:strtrim(gdep1, 1)}
217      widget_control, depthlev2id, set_value = {value:strtrim(gdep2, 1)}
218;
219      widget_control, depthlev1id, set_uvalue = depthlev1_uval
220      widget_control, depthlev2id, set_uvalue = depthlev2_uval
221   ENDIF ELSE BEGIN
222      gdep1 = depthlev1_uval.value
223      gdep2 = gdep1+1
224   ENDELSE
225; on s''assure que les profs donnees contiennent bien au moins un
226; niveau.
227   if boxzoom[4] GT boxzoom[5] then begin
228      rien = boxzoom[4]
229      boxzoom[4] = boxzoom[5]
230      boxzoom[5] = rien
231   endif
232;
233   rien = where(gdep1 LT boxzoom[4], indice1)
234   indice1 = indice1 < (jpk-1)
235   rien = where(gdep2 LE boxzoom[5], indice2)
236   indice2 = indice1 > (indice2-1)
237;
238   if indice1 EQ indice2 then BEGIN
239      if (where(gdep1 GE boxzoom[4] AND gdep2 LE boxzoom[5]))[0]  EQ -1 then begin
240         indice1 = 0 > (indice1-(grid_t EQ 1))
241         indice2 = indice1
242      endif
243      boxzoom[4] = gdep1[indice1]
244      boxzoom[5] = boxzoom[4]+1
245   endif
246; maintenant que les values et les indexes sont definis proprement,
247; on peut les appliquer
248   widget_control, depthlev1id, set_value = {droplist_select:indice1}
249   widget_control, depthlev2id, set_value = {droplist_select:indice2}
250; controler les min et les max des sliders...
251   if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1]
252   max1 = (min1+1) > gdep1[indice2]
253   widget_control, depth1id, set_value = {slider_min:min1, slider_max:max1, value:boxzoom[4]}
254   min2 = gdep2[indice1]
255   if indice2 EQ jpk-1 then BEGIN
256      max2 = max([gdept, gdepw])
257      max2 = strtrim(string(max2,format='(e8.0)'), 1)
258      max2 = float('1'+strmid(max2, 1))+float(max2)
259   ENDIF ELSE max2 = gdep1[indice2+1]
260   widget_control, depth2id, set_value = {slider_min:min2, slider_max:max2, value:boxzoom[5]}
261;
262   return
263end
264;*********************************************************************
265FUNCTION cw_domain_get_value, id
266   box = lonarr(6)
267   possiblecase = ['lon1', 'lon2','lat1', 'lat2','depth1','depth2']
268   for i = 0, 5 do begin
269      widget_control,widget_info(id,find_by_uname = possiblecase[i]) $
270       , get_value = value
271      box[i] = value.value
272   endfor
273   return, box
274end
275;*********************************************************************
276FUNCTION cw_domain_event, event
277@common
278; help,  /struct, event
279   if (where(tag_names(event) EQ 'OUT'))[0] NE -1 then if event.out NE 0 then return,  -1
280   widget_control, event.id, get_uvalue=uval
281   case uval.name of
282      'lon1':widget_control,widget_info(event.handler,find_by_uname = 'lon2') $
283       , set_value = {slider_min:event.value+uval.strict}
284      'lon2':widget_control,widget_info(event.handler,find_by_uname = 'lon1') $
285       , set_value = {slider_max:event.value-uval.strict}
286      'lat1':widget_control,widget_info(event.handler,find_by_uname = 'lat2') $
287       , set_value = {slider_min:event.value+uval.strict}
288      'lat2':widget_control,widget_info(event.handler,find_by_uname = 'lat1') $
289       , set_value = {slider_max:event.value-uval.strict}
290      'unzoom':BEGIN
291         id = widget_info(event.handler,find_by_uname = 'lon1')
292         widget_control, id, get_value = value
293         widget_control, id, set_value = {slider_min:value.slider_min_max[0]}
294         widget_control, id, set_value = value.slider_min_max[0]
295         id = widget_info(event.handler,find_by_uname = 'lat1')
296         widget_control, id, get_value = value
297         widget_control, id, set_value = {slider_min:value.slider_min_max[0]}
298         widget_control, id, set_value = value.slider_min_max[0]
299         id = widget_info(event.handler,find_by_uname = 'lon2')
300         widget_control, id, get_value = value
301         widget_control, id, set_value = {slider_max:value.slider_min_max[1]}
302         widget_control, id, set_value = value.slider_min_max[1]
303         id = widget_info(event.handler,find_by_uname = 'lat2')
304         widget_control, id, get_value = value
305         widget_control, id, set_value = {slider_max:value.slider_min_max[1]}
306         widget_control, id, set_value = value.slider_min_max[1]
307      END
308      'depthlev1':BEGIN
309; ids...
310         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
311         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
312         depthlev2id = widget_info(event.handler,find_by_uname = 'depthlev2')
313; faut-il changer depthlev2 ?
314         widget_control, depthlev2id, get_value = depthlev2_value
315         if depthlev2_value.droplist_select LT event.index then BEGIN
316; on redefinie la valeur de depthlev2id
317            widget_control, depthlev2id, set_value = {droplist_select:event.index}
318; donc on redefinit la valeur et le max du slider 2
319            widget_control, depthlev2id, get_uvalue = depthlev2_uval
320            if event.index EQ jpk-1 then BEGIN
321               max = max([gdept, gdepw])
322               max = strtrim(string(max,format='(e8.0)'), 1)
323               max = float('1'+strmid(max, 1))+float(max)
324            ENDIF ELSE max = depthlev2_uval.value[event.index+1]-1
325            widget_control, depth2id $
326             , set_value = {slider_max:max, value:depthlev2_uval.value[event.index]}
327; du coup on redefinie donc le max du slider 1
328            widget_control, depth1id, set_value = {slider_max:uval.value[event.index]}
329         END
330; on redefinie la valeur et le min du slider depth 1
331         if event.index EQ 0 then min = 0 ELSE min = uval.value[event.index-1]+1
332         widget_control, depth1id, set_value = {slider_min:min, value:uval.value[event.index]}
333; du coup on change aussi la valeur du min du slider depth 2
334         widget_control, depth2id, set_value = {slider_min:uval.value[event.index]+1}
335      END
336      'depthlev2':BEGIN
337; ids...
338         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
339         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
340         depthlev1id = widget_info(event.handler,find_by_uname = 'depthlev1')
341; faut-il changer depthlev1 ?
342         widget_control, depthlev1id, get_value = depthlev1_value
343         if depthlev1_value.droplist_select GT event.index then BEGIN
344; on redefinie la valeur de depthlev1id
345            widget_control, depthlev1id, set_value = {droplist_select:event.index}
346; donc on redefinit la valeur et le min du slider 1
347            widget_control, depthlev1id, get_uvalue = depthlev1_uval
348            if event.index EQ 0 then min = 0 ELSE min = uval.value[event.index-1]
349            widget_control, depth1id $
350             , set_value = {slider_min:min, value:depthlev1_uval.value[event.index]}
351; du coup on redefinie donc le min du slider 2
352            widget_control, depth2id, set_value = {slider_min:uval.value[event.index]}
353         END
354; on redefinie la valeur et le max du slider depth 2
355         if event.index EQ jpk-1 then BEGIN
356            max = max([gdept, gdepw])
357            max = strtrim(string(max,format='(e8.0)'), 1)
358            max = float('1'+strmid(max, 1))+float(max)
359         ENDIF ELSE max = uval.value[event.index+1]-1
360         widget_control, depth2id, set_value = {slider_max:max, value:uval.value[event.index]}
361; du coup on change aussi la valeur du max du slider depth 1
362         widget_control, depth1id, set_value = {slider_max:uval.value[event.index]-1}
363      END
364      'depth1':BEGIN
365; ids...
366         depth2id = widget_info(event.handler,find_by_uname = 'depth2')
367         depthlev1id = widget_info(event.handler,find_by_uname = 'depthlev1')
368; doit-on changer depthlev1 ?
369         widget_control, depthlev1id, get_value = depthlev1_value
370         widget_control, depthlev1id, get_uvalue = depthlev1_uval
371         rien = where(depthlev1_uval.value LT event.value, indice)
372         indice = indice < (jpk-1)
373         if indice NE depthlev1_value.droplist_select then begin
374; on change le min de depth2
375            widget_control, depth2id, set_value = {slider_min:depthlev1_uval.value[indice]+1}
376; on redefinie la valeur de depthlev1id
377            widget_control, depthlev1id, set_value = {droplist_select:indice}
378; donc on redefinit le min du slider 1
379            if indice EQ 0 then min = 0 ELSE min = depthlev1_uval.value[indice-1]+1
380            widget_control, event.id, set_value = {slider_min:min}
381         endif
382      END
383      'depth2':BEGIN
384; ids...
385         depth1id = widget_info(event.handler,find_by_uname = 'depth1')
386         depthlev2id = widget_info(event.handler,find_by_uname = 'depthlev2')
387; doit-on changer depthlev2 ?
388         widget_control, depthlev2id, get_value = depthlev2_value
389         widget_control, depthlev2id, get_uvalue = depthlev2_uval
390         rien = where(depthlev2_uval.value LE event.value, indice)
391         indice = 0 > (indice-1)
392         if indice NE depthlev2_value.droplist_select then begin
393; on change le max de depth1
394            widget_control, depth1id, set_value = {slider_max:depthlev2_uval.value[indice]-1}
395; on redefinie la valeur de depthlev2id
396            widget_control, depthlev2id, set_value = {droplist_select:indice}
397; donc on redefinit le max du slider 2
398            if indice EQ jpk-1 then BEGIN
399               max = max([gdept, gdepw])
400               max = strtrim(string(max,format='(e8.0)'), 1)
401               max = float('1'+strmid(max, 1))+float(max)
402            ENDIF ELSE max = depthlev2_uval.value[indice+1]-1
403            widget_control, event.id, set_value = {slider_max:max}
404         endif
405      END
406      ELSE:
407   ENDCASE
408;    slidesliceid = widget_info(event.top, find_by_uname = 'slide_slice')
409;    if slidesliceid NE 0 then widget_control, slidesliceid, set_value = 1
410   return,{ID:event.handler, TOP:event.top, HANDLER:0L $
411           , BOX:cw_domain_get_value(event.handler)}
412end
413;*********************************************************************
414FUNCTION cw_domain, parent, BOXZOOM = boxzoom, STRICT = strict, UVALUE = uvalue, UNAME = uname, ROW = row, COLUMN = column, UNZOOM = unzoom, _extra = ex
415;
416@common
417; cheking exclusive keywords
418   column = keyword_set(column)*(1-keyword_set(row))
419   row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column)
420; def de la boxzoom
421   if NOT keyword_set(boxzoom) then boxzoom = [lon1, lon2, lat1, lat2 $
422                                           , min([gdepw[0], gdept[0]]), max([gdepw[0], gdept[0]]) ]
423   Case N_Elements(Boxzoom) OF
424      0:boxzoom = [lon1, lon2, lat1, lat2, vert1, vert2]
425      1:boxzoom=[lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
426      2:boxzoom=[lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
427      4:boxzoom=[Boxzoom, vert1, vert2]
428      5:boxzoom=[Boxzoom[0:3], 0, Boxzoom[4]]
429      6:
430      Else: return, report('Mauvaise Definition de Boxzoom')
431   ENDCASE
432;
433   boxzoom[0] = floor(boxzoom[0])
434   boxzoom[1] = ceil(boxzoom[1])
435   boxzoom[2] = floor(boxzoom[2])
436   boxzoom[3] = ceil(boxzoom[3])
437   boxzoom[4] = floor(boxzoom[4])
438   boxzoom[5] = ceil(boxzoom[5])
439;------------------------------------------------
440   if NOT keyword_set(uvalue) then uvalue = ''
441   if NOT keyword_set(uname) then uname = ''
442   base = widget_base(parent, /row  $
443                      , space = 1,  xpad = 1,  ypad = 1 $
444                      , EVENT_FUNC = 'cw_domain_event' $
445                      , FUNC_GET_VALUE='cw_domain_get_value' $
446                      , PRO_SET_VALUE='cw_domain_set_value' $
447                      , UVALUE = uvalue, UNAME = uname, _extra = ex)   
448;-------------longitude---------------------------
449   basehori = widget_base(base, ROW = row, COLUMN = column)
450;-------------longitude---------------------------
451   min = floor(min([glamt,glamf], max = max))
452   max = ceil(max)
453   lonbase = widget_base(basehori, /ROW, space = 1, xpad = 1, ypad = 1, uname = 'lonbase')
454   lon1id = cw_slider_pm(lonbase,value=min > boxzoom[0] < ((boxzoom[1] < max)-keyword_set(strict)) $
455                       , uvalue={name:'lon1', strict:keyword_set(strict)},uname ='lon1' $
456                       , title = 'lon1', minimum = min $
457                       , maximum = (boxzoom[1] < max)-keyword_set(strict))
458   lon2id = cw_slider_pm(lonbase,value=((min > boxzoom[0])+keyword_set(strict)) > boxzoom[1] < max $
459                       , uvalue={name:'lon2', strict:keyword_set(strict)} $
460                       , uname='lon2', title = 'lon2', maximum = max $
461                       , minimum = (min > boxzoom[0])+keyword_set(strict))
462   widget_control, lonbase, set_uvalue = {name:'geographic'}
463;---------------latitude-------------------------
464   min = floor(min([gphit,gphif], max = max))
465   max = ceil(max)
466   latbase = widget_base(basehori, /ROW, space = 1, xpad = 1, ypad = 1, uname = 'latbase')
467   lat1id = cw_slider_pm(latbase,value=min > boxzoom[2] < ((boxzoom[3] < max)-keyword_set(strict)) $
468                       , uvalue={name:'lat1', strict:keyword_set(strict)},uname ='lat1' $
469                       , title = 'lat1', minimum =min $
470                       , maximum = ((boxzoom[3] < max)-keyword_set(strict)))
471   lat2id = cw_slider_pm(latbase,value=((min > boxzoom[2])+keyword_set(strict)) > boxzoom[3] < max $
472                       , uvalue={name:'lat2', strict:keyword_set(strict)} $
473                       , uname ='lat2', title = 'lat2' ,maximum =  max $
474                       , minimum =(min > boxzoom[2])+keyword_set(strict))
475   widget_control, latbase, set_uvalue = {name:'geographic'}
476;----------------unzoom------------------------
477   if keyword_set(unzoom) then rien = widget_button(basehori,value='unzoom', uvalue={name:'unzoom'})
478;----------------depth------------------------
479   basevert = widget_base(base, ROW = row, COLUMN = column)
480   basedepth = widget_base(basevert, /row)
481;
482   if strupcase(vargrid) EQ 'W' then gdep = gdepw ELSE gdep = gdept
483   gdep1 = floor(gdep)
484   gdep2 = ceil(gdep)
485   identique = where(gdep2-gdep1 EQ 0)
486   if identique[0] NE -1 then gdep2[identique] = gdep2[identique] +1
487   sgdep1 = strtrim(gdep1, 1)
488   sgdep2 = strtrim(gdep2, 1)
489;
490   basedepthdrop = widget_base(basedepth, column = column,  row = row)
491;
492   dephtid=cw_droplist_pm(basedepthdrop,value=''+sgdep1, uvalue={name:'depthlev1', value:gdep1, grid_t:strupcase(vargrid) NE 'W'}, uname='depthlev1')
493   rien = where(gdep1 LT boxzoom[4], indice1)
494   indice1 = indice1 < (jpk-1)
495   widget_control, dephtid, set_value = {droplist_select:indice1}
496;
497   dephtid=cw_droplist_pm(basedepthdrop,value=''+sgdep2, uvalue={name:'depthlev2', value:gdep2, grid_t:strupcase(vargrid) NE 'W'}, uname='depthlev2')
498   rien = where(gdep2 LE boxzoom[5], indice2)
499   indice2 = indice1 > (indice2-1)
500   widget_control, dephtid, set_value = {droplist_select:indice2}
501;
502   basedepthslid = widget_base(basedepth, column = column,  row = row)
503;
504   if indice1 EQ 0 then min1 = 0 ELSE min1 = gdep2[indice1-1]
505   max1 = (min1+1) > gdep1[indice2]
506   rien = cw_slider_pm(basedepthslid, value= min1 > boxzoom[4] < (boxzoom[5] < max1) $
507                       , uvalue = {name:'depth1'}, uname = 'depth1' $
508                       , title = 'depth1', minimum = min1, maximum = max1)
509;
510   min2 = gdep2[indice1]
511   if indice2 EQ jpk-1 then BEGIN
512      max2 = max([gdept, gdepw])
513      max2 = strtrim(string(max2,format='(e8.0)'), 1)
514      max2 = float('1'+strmid(max2, 1))+float(max2)
515   ENDIF ELSE max2 = gdep1[indice2+1]
516   if max2 EQ min2 then max2 = min2+1
517   rien = cw_slider_pm(basedepthslid, value= (min2 > boxzoom[4]) > boxzoom[5] < max2 $
518                       , uvalue={name:'depth2'}, minimum = min2 $
519                       , uname = 'depth2', title = 'depth2' ,maximum =  max2)
520;--------------------------------------------
521;
522;
523;
524   return, base
525end
Note: See TracBrowser for help on using the repository browser.