source: trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_slide_slice.pro @ 226

Last change on this file since 226 was 226, checked in by pinsard, 17 years ago

corrections of some misspellings in some *.pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 9.1 KB
Line 
1;+
2; @file_comments
3;
4;
5; @categories
6; Compound widget
7;
8; @param ID
9;
10; @param VALUE
11; It is the default tick mark value (a floating-point number).
12;
13; @returns
14;
15; @uses
16;
17; @restrictions
18;
19; @examples
20;
21; @history
22;
23; @version
24; $Id$
25;-
26pro cw_slide_slice_set_value, id, value
27;
28  compile_opt idl2, strictarrsubs
29;
30@common
31   topid = findtopid(id)
32   domainid = widget_info(topid, find_by_uname = 'domain')
33   widget_control, domainid, get_value = boxzoom
34   if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x'
35   thickid  = widget_info(topid, find_by_uname = 'thickness')
36   widget_control, thickid, get_uvalue = thicknessuval
37   widget_control, thickid, get_value = thickness
38   thickness = thicknessuval.choix[thickness.droplist_select]
39   sliderid = widget_info(topid, find_by_uname = 'slider')
40   if type EQ 'y' then BEGIN
41      mini = floor(min([glamt, glamf], max = maxi))
42      maxi = ceil(maxi)-thickness
43      widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:boxzoom[0]<maxi}
44      thickness = boxzoom[1]-boxzoom[0]
45   ENDIF ELSE BEGIN
46      mini = floor(min([gphit, gphif], max = maxi))
47      maxi = ceil(maxi)-thickness
48      widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:boxzoom[2]<maxi}
49      thickness = boxzoom[3]-boxzoom[2]
50   ENDELSE
51   thicknessval = thicknessuval.choix
52   index = where(thicknessval EQ thickness) & index = index[0]
53   if index EQ -1 then BEGIN
54      index = 20
55      thicknessval[20] = strtrim(thickness, 1)
56      widget_control, thickid, set_value = thicknessval
57      widget_control, thickid, set_uvalue ={name:'thickness', choix:thicknessval}
58   endif
59   widget_control, thickid, set_value = {droplist_select:index}
60   return
61end
62;----------------------------------------------------------------------
63;+
64; @file_comments
65;
66;
67; @categories
68; Compound widget
69;
70; @param EVENT
71;
72; @returns
73;
74; @uses
75;
76; @restrictions
77;
78; @examples
79;
80; @history
81;
82; @version
83; $Id$
84;-
85FUNCTION cw_slide_slice_event,  event
86;
87  compile_opt idl2, strictarrsubs
88;
89@common
90   widget_control, event.id, get_uvalue=uval
91   domainid = widget_info(event.top, find_by_uname = 'domain')
92   thickid  = widget_info(event.handler, find_by_uname = 'thickness')
93   sliderid = widget_info(event.handler, find_by_uname = 'slider')
94;   uniteid  = widget_info(event.handler, find_by_uname = 'unite')
95   widget_control, domainid, get_value = boxzoom
96   if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x'
97   widget_control, thickid, get_uvalue = thicknessuval
98   widget_control, thickid, get_value = thickness
99   thickness = thicknessuval.choix[thickness.droplist_select]
100   widget_control, sliderid, get_value = slider & slider = slider.value
101
102   if uval.name EQ 'thickness' then begin
103      if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x'
104      if type EQ 'y' then BEGIN
105         mini = floor(min([glamt, glamf], max = maxi))
106         maxi = ceil(maxi)-thickness
107      ENDIF ELSE BEGIN
108         mini = floor(min([gphit, gphif], max = maxi))
109         maxi = ceil(maxi)-thickness
110      ENDELSE
111      slider = slider<maxi
112      widget_control, sliderid, set_value = {slider_min:mini, slider_max:maxi, value:slider}
113   endif
114
115;   widget_control, uniteid, get_value = unite
116;
117;
118;    if uval.name EQ 'unite' then begin
119;       domdef, boxzoom, gridtype = 'T'
120;       if unite EQ 'degre' then BEGIN
121;          if strpos(type,'y') NE -1 then begin
122;             mini = floor(min([glamt, glamf], max = maxi))
123;             maxi = ceil(maxi)
124; print, lon1, mini, maxi
125;             widget_control, sliderid, set_value = {value:lon1, slider_min_max:[mini, maxi]}
126;          ENDIF ELSE BEGIN
127;             mini = floor(min([gphit, glamf], max = maxi))
128;             maxi = ceil(maxi)
129;             widget_control, sliderid, set_value = {value:lat1, slider_min_max:[mini, maxi]}
130;          ENDELSE
131;       ENDIF ELSE BEGIN
132;          if strpos(type,'y') NE -1 then BEGIN
133; print, 'ds if',firstxt, 0, jpi-1
134;             widget_control, sliderid, set_value = {value:firstxt, slider_min_max:[0, jpi-1]}
135;          ENDIF ELSE BEGIN
136;             widget_control, sliderid, set_value = {value:firstyt, slider_min_max:[0, jpj-1]}
137;          ENDELSE
138;       ENDELSE
139;    endif
140;
141;   if unite EQ 'degre' then BEGIN
142   if type EQ 'y' then begin
143      boxzoom[0] = slider &  boxzoom[1] = slider+thickness
144   ENDIF ELSE BEGIN
145      boxzoom[2] = slider &  boxzoom[3] = slider+thickness
146   ENDELSE
147;    ENDIF ELSE BEGIN
148;       if strpos(type,'y') NE -1 then begin
149;          boxzoom[0] = glamt[slider, 0] &  boxzoom[1] = glamf[slider+thickness, 0]
150;       ENDIF ELSE BEGIN
151;          boxzoom[2] = gphit[0, slider] &  boxzoom[3] = gphif[0, slider+thickness]
152;       ENDELSE
153;    ENDELSE
154   widget_control, domainid, set_value = boxzoom
155   return, {CW_SLIDE_SLICE, ID:event.handler, TOP:event.top, HANDLER:0L}
156end
157;--------------------------------------------------------------------------------
158;+
159; @file_comments
160;
161;
162; @categories
163; Compound widget
164;
165; @param PARENT {in}{required}
166; The widget ID of the parent widget.
167;
168; @keyword BOXZOOM
169; Vector indicating the geographic zone on which we want to cut the map.
170; If BOXZOOM has :
171;   1 element : The extraction is made on [lon1, lon2, lat1, lat2, 0.,boxzoom[0]]
172;   2 elements: The extraction is made on [lon1, lon2, lat1, lat2, boxzoom[0],boxzoom[1]]
173;   4 elements: The extraction is made on [Boxzoom, 0, max([gdept, gdepw])]
174;   5 elements: The extraction is made on [Boxzoom[0:3], 0, Boxzoom[4]]
175;   6 elements: The extraction is made on Boxzoom
176; Where lon1, lon2,lat1,lat2 are global variables defined at the last domdef!
177;
178; @keyword COLUMN
179; Buttons will be arranged in the number of columns
180; specified by this keyword.
181;
182; @keyword FRAME
183; Specifies the width of the frame to be drawn around the base.
184;
185; @keyword ROW
186; Buttons will be arranged in the number of rows
187; specified by this keyword.
188;
189; @keyword UVALUE
190; The user value to be associated with the widget.
191;
192; @keyword UNAME
193; The user name to be associated with the widget.
194;
195; @keyword _EXTRA
196; Used to pass your keywords
197;
198; @returns
199;
200; @uses
201;
202; @restrictions
203;
204; @examples
205;
206; @history
207;
208; @version
209; $Id$
210;
211; @todo
212; seb: documenter
213;
214;-
215FUNCTION cw_slide_slice, parent, boxzoom = boxzoom, UVALUE = uvalue, UNAME = uname, FRAME = frame, ROW = row, COLUMN = column, _extra = ex
216;
217  compile_opt idl2, strictarrsubs
218;
219@common
220;------------------------------------------------
221; checking exclusive keywords
222   column = keyword_set(column)*(1-keyword_set(row))
223   row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column)
224   if NOT keyword_set(uvalue) then uvalue = ''
225   if NOT keyword_set(uname) then uname = ''
226;
227   base = widget_base(parent, ROW = row, COLUMN = column  $
228                      , EVENT_FUNC = 'cw_slide_slice_event' $
229                      , FUNC_GET_VALUE='cw_slide_slice_get_value' $
230                      , PRO_SET_VALUE='cw_slide_slice_set_value' $
231                      , ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname $
232                      , FRAME = frame, _extra = ex)
233;------------------------------------------------
234   if NOT keyword_set(boxzoom) then boxzoom = [lon1, lon2, lat1, lat2]
235;    rien = cw_bgroup(base, ['degre', 'points'],/exclusive, /column, uname = 'unite', uvalue = {name:'unite'}, /return_name, set_value = 0, /no_release)
236   thicknessval = indgen(21)+1
237   thicknessval = string(thicknessval)
238   for i = 0, n_elements(thicknessval)-1 do thicknessval[i] = strtrim(thicknessval[i], 1)
239   droplistid = cw_droplist_pm(base, value = thicknessval, uname = 'thickness', uvalue = {name:'thickness', choix:thicknessval})
240;
241   if boxzoom[1]-boxzoom[0] LT boxzoom[3]-boxzoom[2] then type = 'y' ELSE type = 'x'
242   if type EQ 'y' then BEGIN
243      mini = floor(min([glamt, glamf], max = maxi))
244      thickness = boxzoom[1]-boxzoom[0]
245      maxi = ceil(maxi)-thickness
246      rien = cw_slider_pm(base, minimum = mini, maximum = (mini+1) > maxi $
247                          , value = mini > boxzoom[0] < maxi, /column, uname = 'slider' $
248                          , uvalue = {name:'slider'})
249   ENDIF ELSE BEGIN
250      mini = floor(min([gphit, gphif], max = maxi))
251      thickness = boxzoom[3]-boxzoom[2]
252      maxi = ceil(maxi)-thickness
253      rien = cw_slider_pm(base, minimum = mini, maximum =  (mini+1) > maxi $
254                          , value = mini > boxzoom[2] < maxi, /column, uname = 'slider' $
255                          , uvalue = {name:'slider'})
256   ENDELSE
257   index = where(thicknessval EQ thickness) & index = index[0]
258   if index EQ -1 then BEGIN
259      index = 20
260      thicknessval[20] = strtrim(thickness, 1)
261      widget_control, droplistid, set_value = thicknessval
262      widget_control, droplistid, set_uvalue ={name:'thickness', choix:thicknessval}
263   endif
264   widget_control, droplistid, set_value = {droplist_select:index}
265
266;   if type EQ 'xt' then begin
267;       mini = floor(min([glamt,glamf], max = maxi))
268;       maxi = ceil(maxi)
269;    ENDIF ELSE BEGIN
270;       mini = floor(min([gphit,gphif], max = maxi))
271;       maxi = ceil(maxi)
272;    ENDELSE
273 
274;------------------------------------------------
275   return, base
276end
Note: See TracBrowser for help on using the repository browser.