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

Last change on this file since 69 was 69, checked in by smasson, 18 years ago

debug + new xxx

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