source: trunk/SRC/ToBeReviewed/WIDGET/AUTOUR_de_XXX/longclickaction.pro @ 231

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

improvements/corrections of some *.pro headers

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 4.2 KB
Line 
1;+
2;
3; @file_comments
4;
5; @categories
6;
7; @param EVENT
8;
9; @returns
10;
11; @uses
12;
13; @restrictions
14;
15; @examples
16;
17; @history
18;
19; @version
20; $Id$
21;
22; @todo
23; seb
24;
25;-
26;
27PRO longclickaction, event
28;
29  compile_opt idl2, strictarrsubs
30;
31  widget_control, event.id, get_uvalue = uval
32  widget_control, event.top, get_uvalue = top_uvalue
33; What is the selected drawing?
34  smallout = extractatt(top_uvalue, 'smallout')
35  smallin = extractatt(top_uvalue, 'smallin')
36  small = smallin
37  x = (convert_coord(uval.x[0], uval.y[0], /device, /to_normal))[0]
38  y = (convert_coord(uval.x[0], uval.y[0], /device, /to_normal))[1]
39  numcolonne = n_elements(where(findgen(small[0])/small[0] lt x))-1
40  numligne = n_elements(where(findgen(small[1])/small[1] lt 1-y))-1
41  numdessin = numcolonne+numligne*small[0]
42; we put on numdessin as the leader plot
43  tracecadre, smallin, /erase
44  if total(smallin EQ smallout) EQ 3 then $
45     tracecadre, smallout, /out
46  smallin = [smallin[0:1], numdessin+1]
47  *top_uvalue[1, findline(top_uvalue, 'smallin')] = smallin
48  tracecadre, smallin
49  !p = (extractatt(top_uvalue, 'penvs'))[numdessin]
50  !x = (extractatt(top_uvalue, 'xenvs'))[numdessin]
51  !y = (extractatt(top_uvalue, 'yenvs'))[numdessin]
52;------------------------------------------------------------
53  actionid = widget_info(event.top, find_by_uname = 'action')
54  type = widget_info(actionid, /combobox_gettext)
55;------------------------------------------------------------
56; Change the domain box:
57;------------------------------------------------------------
58  coor = (convert_coord(uval.x, uval.y, /device, /to_data))
59  x = [coor[0, 0], coor[0, 1]]
60  y = [coor[1, 0], coor[1, 1]]
61  domainid = widget_info(event.top, find_by_uname = 'domain')
62  IF type EQ 'pltv' THEN BEGIN
63    currentfile = extractatt(top_uvalue, 'currentfile')
64    listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
65    listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar
66    vlstid = widget_info(event.top, find_by_uname = 'varlist')
67    namevar = widget_info(vlstid, /combobox_gettext)
68    indexvar = where(listvar EQ namevar)
69    vargrid = strupcase(listgrid[indexvar])
70    grille, -1, glam, gphi
71    boxzoom = [glam[x[0], y[0]], glam[x[1], y[1]], gphi[x[0], y[0]], gphi[x[1], y[1]]]
72  ENDIF ELSE boxzoom = [x, y]
73; Do we have to pass the boxzoom in indexes ???
74  currentplot = (extractatt(top_uvalue, 'smallin'))[2]-1
75  options = extractatt(top_uvalue, 'options')
76  flags = extractatt(top_uvalue, 'optionsflag')
77  flags = flags[*, currentplot]
78  changex = (flags[where(options EQ 'Longitude / x index')])[0] EQ 1
79  changey = (flags[where(options EQ 'Latitude / y index')])[0] EQ 1
80  if changex OR changey then begin
81; We want to find the type of grid which is used
82    currentfile = extractatt(top_uvalue, 'currentfile')
83    listgrid = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listgrid
84    listvar = (*(extractatt(top_uvalue, 'fileparameters'))[currentfile]).listvar
85    vlstid = widget_info(event.top, find_by_uname = 'varlist')
86    namevar = widget_info(vlstid, /combobox_gettext)
87    indexvar = where(listvar EQ namevar)
88    vargrid = strupcase(listgrid[indexvar])
89    domdef, boxzoom, gridtype = vargrid
90    grille, -1, -1, -1, -1, nx, ny, nz, firstx, firsty, firstz, lastx, lasty, lastz
91    if changex then boxzoom[0:1] = [firstx, lastx]
92    if changey then boxzoom[2:3] = [firsty, lasty]
93  endif
94;
95  widget_control, domainid, set_value = boxzoom
96;
97  case uval.press of
98    1:BEGIN
99      nodates = (type EQ 'xt' OR type EQ 'yt' OR type EQ 'zt' OR type EQ 't')
100      updatewidget, event.top, /noboxzoom, nodates = nodates, notype = type NE 'plt'
101      letsdraw, event.top
102    END
103    2:BEGIN
104      IF type EQ 'plt' THEN BEGIN
105        (*top_uvalue[1, findline(top_uvalue, 'types')])[smallout[2]-1] = 'pltz'
106        forcetype = 'pltz'
107      ENDIF
108      updatewidget, event.top, /noboxzoom
109      letsdraw, event.top, forcetype = forcetype
110    END
111    4:BEGIN
112      IF type EQ 'plt' THEN BEGIN
113        (*top_uvalue[1, findline(top_uvalue, 'types')])[smallout[2]-1] = 'pltt'
114        forcetype = 'pltt'
115      ENDIF
116      updatewidget, event.top, /noboxzoom, /nodates
117      letsdraw, event.top, forcetype = forcetype
118    END
119  endcase
120;------------------------------------------------------------
121  return
122end
Note: See TracBrowser for help on using the repository browser.