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

Last change on this file since 150 was 150, checked in by navarro, 18 years ago

english and nicer header (3a)

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