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