[2] | 1 | ;***************************************************** |
---|
[157] | 2 | ;+ |
---|
| 3 | ; @file_comments |
---|
| 4 | ; |
---|
| 5 | ; |
---|
| 6 | ; @categories |
---|
| 7 | ; Compound widget |
---|
[226] | 8 | ; |
---|
[157] | 9 | ; @param ID |
---|
| 10 | ; |
---|
| 11 | ; @param VALUE |
---|
| 12 | ; It is the default tick mark value (a floating-point number). |
---|
| 13 | ; |
---|
| 14 | ; @returns |
---|
[226] | 15 | ; |
---|
[157] | 16 | ; @uses |
---|
[226] | 17 | ; |
---|
[157] | 18 | ; @restrictions |
---|
[226] | 19 | ; |
---|
[157] | 20 | ; @examples |
---|
[226] | 21 | ; |
---|
[157] | 22 | ; @history |
---|
[226] | 23 | ; |
---|
| 24 | ; @version |
---|
[157] | 25 | ; $Id$ |
---|
| 26 | ;- |
---|
[2] | 27 | PRO cw_specifie_set_value, id, value |
---|
[114] | 28 | ; |
---|
| 29 | compile_opt idl2, strictarrsubs |
---|
| 30 | ; |
---|
[74] | 31 | @cm_general |
---|
[2] | 32 | if size(value, /type) NE 8 then return |
---|
| 33 | widget_control, widget_info(id,find_by_uname='min'), set_value = strtrim(value.min, 2) |
---|
| 34 | widget_control, widget_info(id,find_by_uname='max'), set_value = strtrim(value.max, 2) |
---|
| 35 | widget_control, widget_info(id,find_by_uname='int'), set_value = strtrim(value.inter, 2) |
---|
| 36 | widget_control, widget_info(id,find_by_uname='palnum'), set_value = strtrim(value.lct, 2) |
---|
| 37 | autres = extractstru(value, ['min', 'max', 'inter', 'lct', 'nothing', 'xindex', 'yindex']) |
---|
[226] | 38 | if size(autres, /type) EQ 8 then BEGIN |
---|
[2] | 39 | autresid = widget_info(id,find_by_uname='autres') |
---|
[74] | 40 | widget_control, widget_info(id, find_by_uname = 'autres'), get_value = autresautres |
---|
[2] | 41 | autresautres = autresautres[0] |
---|
| 42 | if strtrim(autresautres, 2) NE '' then begin |
---|
[74] | 43 | autresautres = createfunc('get_extra(' + autresautres + ')' $ |
---|
| 44 | , filename = myuniquetmpdir +'for_createfunc.pro') |
---|
| 45 | autres = mixstru(autres, autresautres) |
---|
[2] | 46 | endif |
---|
| 47 | autres = strkeywd(autres) |
---|
| 48 | widget_control, widget_info(id,find_by_uname='autres'), set_value = autres |
---|
| 49 | endif |
---|
| 50 | return |
---|
| 51 | end |
---|
| 52 | ;***************************************************** |
---|
[157] | 53 | ;+ |
---|
| 54 | ; @file_comments |
---|
| 55 | ; |
---|
| 56 | ; |
---|
| 57 | ; @categories |
---|
| 58 | ; Compound widget |
---|
[226] | 59 | ; |
---|
[157] | 60 | ; @param ID |
---|
| 61 | ; |
---|
[226] | 62 | ; @returns |
---|
[157] | 63 | ; |
---|
| 64 | ; @uses |
---|
[226] | 65 | ; |
---|
[157] | 66 | ; @restrictions |
---|
[226] | 67 | ; |
---|
[157] | 68 | ; @examples |
---|
[226] | 69 | ; |
---|
[157] | 70 | ; @history |
---|
[226] | 71 | ; |
---|
| 72 | ; @version |
---|
[157] | 73 | ; $Id$ |
---|
| 74 | ;- |
---|
[2] | 75 | FUNCTION cw_specifie_get_value, id |
---|
[114] | 76 | ; |
---|
| 77 | compile_opt idl2, strictarrsubs |
---|
| 78 | ; |
---|
[74] | 79 | @cm_general |
---|
[2] | 80 | widget_control, widget_info(id,find_by_uname='min'), get_value = min |
---|
| 81 | min = float(min[0]) |
---|
| 82 | widget_control, widget_info(id,find_by_uname='max'), get_value = max |
---|
| 83 | max = float(max[0]) |
---|
| 84 | widget_control, widget_info(id,find_by_uname='int'), get_value = int |
---|
| 85 | int = float(int[0]) |
---|
| 86 | widget_control, widget_info(id,find_by_uname='palnum'), get_value = palnum |
---|
| 87 | palnum = long(palnum[0]) |
---|
| 88 | widget_control, widget_info(id,find_by_uname='autres'), get_value = autres |
---|
| 89 | autres = autres[0] |
---|
| 90 | ; |
---|
| 91 | exextra = {min:min, max:max, inter:int, lct:palnum} |
---|
| 92 | if strtrim(autres, 2) NE '' then $ |
---|
[74] | 93 | exextra = createfunc('get_extra('+autres+', _extra = exextra)' $ |
---|
| 94 | , kwdlist = 'exextra = exextra', exextra = exextra $ |
---|
| 95 | , filename = myuniquetmpdir +'for_createfunc.pro') |
---|
| 96 | ; |
---|
[2] | 97 | return, exextra |
---|
| 98 | end |
---|
| 99 | ;***************************************************** |
---|
[157] | 100 | ;+ |
---|
| 101 | ; @file_comments |
---|
| 102 | ; |
---|
| 103 | ; |
---|
| 104 | ; @categories |
---|
| 105 | ; Compound widget |
---|
[226] | 106 | ; |
---|
[157] | 107 | ; @param EVENT |
---|
| 108 | ; |
---|
[226] | 109 | ; @returns |
---|
[157] | 110 | ; |
---|
| 111 | ; @uses |
---|
[226] | 112 | ; |
---|
[157] | 113 | ; @restrictions |
---|
[226] | 114 | ; |
---|
[157] | 115 | ; @examples |
---|
[226] | 116 | ; |
---|
[157] | 117 | ; @history |
---|
[226] | 118 | ; |
---|
| 119 | ; @version |
---|
[157] | 120 | ; $Id$ |
---|
| 121 | ;- |
---|
[2] | 122 | FUNCTION cw_specifie_event, event |
---|
| 123 | ;------------------------------------------------------------ |
---|
[226] | 124 | ; on recupere les ID des differents widgets |
---|
[2] | 125 | ;------------------------------------------------------------ |
---|
| 126 | ;------------------------------------------------------------ |
---|
[114] | 127 | ; |
---|
| 128 | compile_opt idl2, strictarrsubs |
---|
| 129 | ; |
---|
[69] | 130 | widget_control, event.id, get_uvalue = uval |
---|
| 131 | widget_control, event.top, get_uvalue = top_uvalue |
---|
| 132 | smallin = extractatt(top_uvalue, 'smallin') |
---|
| 133 | numdessinin = smallin[2]-1 |
---|
| 134 | smallout = extractatt(top_uvalue, 'smallout') |
---|
| 135 | numdessinout = smallout[2]-1 |
---|
[2] | 136 | ;------------------------------------------------------------ |
---|
[69] | 137 | case uval of |
---|
[226] | 138 | 'default':BEGIN |
---|
[2] | 139 | ;--------------- |
---|
[226] | 140 | ; We find the name of the variable: |
---|
[74] | 141 | vlstid = widget_info(event.top, find_by_uname = 'varlist') |
---|
[69] | 142 | fieldname = widget_info(vlstid, /combobox_gettext) |
---|
[2] | 143 | ;--------------- |
---|
[74] | 144 | exextra = definedefaultextra(fieldname) |
---|
[69] | 145 | widget_control, widget_info(event.handler, find_by_uname = 'min'), set_value = strtrim(exextra.min, 1) |
---|
| 146 | widget_control, widget_info(event.handler, find_by_uname = 'max'), set_value = strtrim(exextra.max, 1) |
---|
| 147 | widget_control, widget_info(event.handler, find_by_uname = 'int'), set_value = strtrim(exextra.inter, 1) |
---|
| 148 | widget_control, widget_info(event.handler, find_by_uname = 'palnum'), set_value = strtrim(exextra.lct, 1) |
---|
| 149 | widget_control, widget_info(event.handler, find_by_uname = 'autres'), set_value = '' |
---|
| 150 | END |
---|
[226] | 151 | 'palcol':BEGIN |
---|
[69] | 152 | ind = fix(strmid(event.value, 0, strpos(event.value, '-'))) |
---|
| 153 | widget_control, widget_info(event.handler, find_by_uname = 'palnum'), set_value = strtrim(ind, 1) |
---|
| 154 | END |
---|
| 155 | ELSE: |
---|
| 156 | endcase |
---|
| 157 | return, {ID:event.handler, TOP:event.top, HANDLER:0L, OK:uval EQ 'ok'} |
---|
[2] | 158 | end |
---|
| 159 | ;***************************************************** |
---|
| 160 | ;***************************************************** |
---|
[150] | 161 | ;+ |
---|
| 162 | ; @file_comments |
---|
| 163 | ; |
---|
| 164 | ; |
---|
| 165 | ; @categories |
---|
[157] | 166 | ; Compound widget |
---|
[226] | 167 | ; |
---|
[150] | 168 | ; @param PARENT {in}{required} |
---|
| 169 | ; The widget ID of the parent widget. |
---|
| 170 | ; |
---|
| 171 | ; @keyword COLUMN |
---|
| 172 | ; Buttons will be arranged in the number of columns |
---|
| 173 | ; specified by this keyword. |
---|
[226] | 174 | ; |
---|
[150] | 175 | ; @keyword ROW |
---|
| 176 | ; Buttons will be arranged in the number of rows |
---|
| 177 | ; specified by this keyword. |
---|
[226] | 178 | ; |
---|
[150] | 179 | ; @keyword UVALUE |
---|
| 180 | ; The user value to be associated with the widget. |
---|
[226] | 181 | ; |
---|
[150] | 182 | ; @keyword UNAME |
---|
| 183 | ; The user name to be associated with the widget. |
---|
| 184 | ; |
---|
| 185 | ; @keyword FRAME |
---|
| 186 | ; |
---|
| 187 | ; @keyword FORXXX |
---|
| 188 | ; |
---|
| 189 | ; @keyword _EXTRA |
---|
| 190 | ; Used to pass your keywords |
---|
| 191 | ; |
---|
| 192 | ; @returns |
---|
[226] | 193 | ; |
---|
[150] | 194 | ; @uses |
---|
[226] | 195 | ; |
---|
[150] | 196 | ; @restrictions |
---|
[226] | 197 | ; |
---|
[150] | 198 | ; @examples |
---|
[226] | 199 | ; |
---|
[150] | 200 | ; @history |
---|
| 201 | ; |
---|
[226] | 202 | ; @version |
---|
| 203 | ; $Id$ |
---|
| 204 | ; |
---|
[150] | 205 | ; @todo |
---|
| 206 | ; seb: documenter |
---|
[226] | 207 | ; |
---|
[150] | 208 | ;- |
---|
[2] | 209 | FUNCTION cw_specifie, parent, ROW = row, COLUMN = column, UVALUE = uvalue, UNAME = uname, FRAME = frame, FORXXX = forxxx, _extra = ex |
---|
[226] | 210 | ; checking exclusive keywords |
---|
[114] | 211 | ; |
---|
| 212 | compile_opt idl2, strictarrsubs |
---|
| 213 | ; |
---|
[2] | 214 | column = keyword_set(column)*(1-keyword_set(row)) |
---|
[226] | 215 | row = keyword_set(row)*(1-keyword_set(column)) +(keyword_set(row) EQ column) |
---|
[2] | 216 | ;------------------------------------------------ |
---|
| 217 | if NOT keyword_set(uvalue) then uvalue = '' |
---|
| 218 | if NOT keyword_set(uname) then uname = '' |
---|
[69] | 219 | base = widget_base(parent, space = 0, /frame $ |
---|
[2] | 220 | , EVENT_FUNC = 'cw_specifie_event' $ |
---|
| 221 | , FUNC_GET_VALUE='cw_specifie_get_value' $ |
---|
| 222 | , PRO_SET_VALUE='cw_specifie_set_value' $ |
---|
[226] | 223 | , UVALUE = uvalue, UNAME = uname, _extra = ex) |
---|
| 224 | ; base1 |
---|
[69] | 225 | base1 = widget_base(base) |
---|
| 226 | rien = widget_label(base1, value = 'Min', xoffset = 85, yoffset = 15) |
---|
| 227 | rien = widget_label(base1, value = 'Max', xoffset = 145, yoffset = 15) |
---|
| 228 | rien = widget_label(base1, value = 'Int', xoffset = 210, yoffset = 15) |
---|
| 229 | ; |
---|
| 230 | lct, get_name = nomcouleur |
---|
[2] | 231 | nbrligne = 30 |
---|
| 232 | nbrlist = n_elements(nomcouleur)/nbrligne |
---|
| 233 | nomcouleur = strtrim(sindgen(n_elements(nomcouleur)), 1)+'- '+nomcouleur |
---|
| 234 | nomcouleur = '0\'+nomcouleur |
---|
[69] | 235 | nomcouleur = ['1\Color', nomcouleur] |
---|
[2] | 236 | if nbrlist GT 1 then for i = 1,nbrlist do $ |
---|
| 237 | nomcouleur = [nomcouleur[0:nbrligne*i-1+i], '1\ ', nomcouleur[nbrligne*i+i:n_elements(nomcouleur)-1]] |
---|
[69] | 238 | rien = cw_pdmenu(base1, nomcouleur, /RETURN_NAME , uvalue = 'palcol', uname = 'palcol', xoffset = 250, yoffset = 0) |
---|
| 239 | ; base2 |
---|
| 240 | base2 = widget_base(base, column = 4+keyword_set(forxxx), yoffset = 30) |
---|
[74] | 241 | if keyword_set(forxxx) then rien = widget_button(base2,value='Default', uvalue = 'default', /frame, tooltip = 'see '+(find('definedefaultextra'))[0]) |
---|
[69] | 242 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'min', uvalue = 'min') |
---|
| 243 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'max', uvalue = 'max') |
---|
| 244 | rien = widget_text(base2, value = '', /editable, xsize = 7, uname = 'int', uvalue = 'int') |
---|
| 245 | if keyword_set(forxxx) then colvalue = '' ELSE colvalue = '39' |
---|
| 246 | rien = widget_text(base2, value = colvalue, /editable, xsize = 2, uname = 'palnum', uvalue = 'palnum') |
---|
[2] | 247 | |
---|
[69] | 248 | |
---|
| 249 | |
---|
[226] | 250 | ; widget text containing other keywords pass into top_uvalue.exextra |
---|
[150] | 251 | ; Does it remain some? If yes, we have to put them as string |
---|
[226] | 252 | |
---|
[69] | 253 | rien = widget_text(base, value = ' ', /editable, uname = 'autres', uvalue = 'autres', xsize = 54, ysize = 3, yoffset = 65, /wrap, /no_newline) |
---|
[2] | 254 | |
---|
[69] | 255 | if keyword_set(forxxx) then cw_specifie_set_value, base, definedefaultextra('rien_du_tout') |
---|
[2] | 256 | |
---|
| 257 | ;------------------------------------------------ |
---|
| 258 | return, base |
---|
| 259 | end |
---|
| 260 | |
---|