source: trunk/SRC/ToBeReviewed/WIDGET/COMPOUND_WIDGET/cw_pagelayout.pro @ 327

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

modification of headers : mainly blanks around = sign for keywords in declaration of function and pro

  • Property svn:eol-style set to native
  • Property svn:keywords set to Id
File size: 5.1 KB
Line 
1;+
2;
3; @file_comments
4;
5; @categories
6; Compound widget
7;
8; @param EVENT
9;
10; @returns
11;
12; @uses
13;
14; @restrictions
15;
16; @examples
17;
18; @history
19;
20; @version
21; $Id$
22;
23;-
24FUNCTION cw_pagelayout_event, event
25;
26  compile_opt idl2, strictarrsubs
27;
28
29   widget_control, event.id, get_uvalue=uval
30   widget_control, event.top, get_uvalue=top_uvalue
31;
32   smallin = extractatt(top_uvalue, 'smallin')
33   numdessinin = smallin[2]-1
34   smallout = extractatt(top_uvalue, 'smallout')
35;
36   if uval.name EQ 'undo' then begin
37      return,{ID:event.handler, TOP:event.top, HANDLER:0L}
38   ENDIF ELSE BEGIN
39;
40@common
41; If we do not change the number of columns, we send
42      if uval.name EQ 'column' then $
43       if event.index+1 EQ smallin[0] THEN $
44       return,{ID:event.handler, TOP:event.top, HANDLER:0L}
45; If we do not change the number of lines, we send
46      if uval.name EQ 'row' then $
47       if event.index+1 EQ smallin[1] THEN $
48       return,{ID:event.handler, TOP:event.top, HANDLER:0L}
49;
50; We erase the page
51;      graphid = widget_info(event.top,find_by_uname = 'graph')
52      graphid = extractatt(top_uvalue, 'graphid')
53      widget_control,graphid,get_value=win
54      wset, win
55      erase, 255
56      case uval.name of
57         'clear':
58         'column':BEGIN
59            smallin = [event.index+1, smallin[1], 1]
60            smallout = [event.index+1, smallout[1], 1]
61         END
62         'row':BEGIN
63            smallin = [smallin[0], event.index+1, 1]
64            smallout = [smallout[0], event.index+1, 1]
65         END
66      endcase
67      nbredessin = smallin[0]*smallin[1]
68;
69; We put all back to 0 for postscripts
70      createhistory, event.top, smallin
71;
72      options = extractatt(top_uvalue, 'options')
73      flags = extractatt(top_uvalue, 'optionsflag')
74      flag = flags[*, numdessinin]
75;
76; update and reset all values of the top_uvalue...
77;
78      *top_uvalue[1, findline(top_uvalue, 'smallin')] = smallin
79      *top_uvalue[1, findline(top_uvalue, 'smallout')] = smallout
80;
81      *top_uvalue[1, findline(top_uvalue, 'penvs')] = replicate(!p, nbredessin)
82      *top_uvalue[1, findline(top_uvalue, 'xenvs')] = replicate(!x, nbredessin)
83      *top_uvalue[1, findline(top_uvalue, 'yenvs')] = replicate(!y, nbredessin)
84;
85      *top_uvalue[1, findline(top_uvalue, 'nameprocedures')] = strarr(nbredessin)
86      *top_uvalue[1, findline(top_uvalue, 'types')] = strarr(nbredessin)
87      *top_uvalue[1, findline(top_uvalue, 'varinfo')] = strarr(2, nbredessin)
88      *top_uvalue[1, findline(top_uvalue, 'domaines')] = fltarr(6, nbredessin)
89      *top_uvalue[1, findline(top_uvalue, 'dates')] = lonarr(2, nbredessin)
90      *top_uvalue[1, findline(top_uvalue, 'txtcmd')] = strarr(nbredessin)
91      *top_uvalue[1, findline(top_uvalue, 'optionsflag')] = flag#replicate(1, nbredessin)
92;
93      ptr_free, extractatt(top_uvalue, 'exextra')
94      *top_uvalue[1, findline(top_uvalue, 'exextra')] = ptrarr(nbredessin, /allocate_heap)
95;      *top_uvalue[1, findline(top_uvalue, '')] =
96;
97   ENDELSE
98
99   return,{ID:event.handler, TOP:event.top, HANDLER:0L}
100end
101;
102;+
103;
104; @file_comments
105;
106; @categories
107; Compound widget
108;
109; @param PARENT {in}{required}
110; The widget ID of the parent widget.
111;
112; @param SMALL
113;
114; @keyword COLUMN
115; Buttons will be arranged in the number of columns
116; specified by this keyword.
117;
118; @keyword ROW
119; Buttons will be arranged in the number of rows
120; specified by this keyword.
121;
122; @keyword UVALUE
123; The user value to be associated with the widget.
124;
125; @keyword UNAME
126; The user name to be associated with the widget.
127;
128; @keyword _EXTRA
129; Used to pass keywords
130;
131; @keyword UNZOOM
132;
133; @returns
134;
135; @uses
136;
137; @restrictions
138;
139; @examples
140;
141; @history
142;
143; @version
144; $Id$
145;
146; @todo
147; seb: documenter
148;
149;-
150FUNCTION cw_pagelayout, parent, small, UVALUE=uvalue, UNAME=uname $
151                      , UNZOOM=unzoom, COLUMN=column, ROW=row, _EXTRA=ex
152;
153  compile_opt idl2, strictarrsubs
154;
155  row = keyword_set(row)*(1-keyword_set(column))
156  if NOT keyword_set(uvalue) then uvalue = ''
157  if NOT keyword_set(uname) then uname = ''
158  base = widget_base(parent $
159                     , EVENT_FUNC = 'cw_pagelayout_event' $
160                     , FUNC_GET_VALUE = 'cw_pagelayout_get_value' $
161                     , PRO_SET_VALUE = 'cw_pagelayout_set_value' $
162                     , UVALUE = uvalue, UNAME = uname, space = 0, _extra = ex)
163;------------------------------------------------
164  IF n_elements(small) eq 0 then small = [1, 1, 1]
165;
166  dummy = widget_label(base, value = 'cln', yoffset = 3)
167  id = widget_combobox(base, value = strtrim(indgen(9)+1, 1), uvalue = {name:'column'} $
168                       , uname = 'column', xoffset = 20, xsize = 40)
169  widget_control, id, set_combobox_select = small[0]-1
170;
171  IF keyword_set(row) THEN BEGIN
172    xoff = 60
173    yoff = 0
174  ENDIF ELSE BEGIN
175    xoff = 0
176    yoff = 20
177  ENDELSE
178  dummy = widget_label(base, value = 'row', xoffset = xoff, yoffset = yoff+3)
179  id = widget_combobox(base, value = strtrim(indgen(9)+1, 1), uvalue = {name:'row'} $
180                       , uname = 'row', xoffset = xoff+20, xsize = 40, yoffset = yoff)
181  widget_control, id, set_combobox_select = small[1]-1
182;------------------------------------------------
183;------------------------------------------------
184  return, base
185end
Note: See TracBrowser for help on using the repository browser.