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

Last change on this file since 367 was 325, checked in by pinsard, 16 years ago

modification of some headers (+some corrections) to prepare usage of the new idldoc

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