source: trunk/SRC/ToBeReviewed/COULEURS/xpal.pro @ 114

Last change on this file since 114 was 114, checked in by smasson, 18 years ago

new compilation options (compile_opt idl2, strictarrsubs) in each routine

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:keywords set to Author Date Id Revision
File size: 21.5 KB
Line 
1; $Id$
2;
3; Copyright (c) 1992-1998, Research Systems, Inc.  All rights reserved.
4;       Unauthorized reproduction prohibited.
5;+
6; NAME:
7;       XPAL
8;
9; PURPOSE:
10;       comme xpalette mais plus court a ecrire et possede en plus
11;       une touche save qui (grace a la routine newpalette) permet de
12;       sauver la routine que l''on vient de faire. Rq qd on appuie
13;       sur la touche predefined appelle xlct plutot que xloadct
14;
15; CATEGORY:
16;       Color tables, widgets.
17;
18; CALLING SEQUENCE:
19;       XPAL
20;
21; INPUTS:
22;       No explicit inputs.  The current color table is used as a starting
23;       point.
24;
25; KEYWORD PARAMETERS:
26;       BLOCK:  Set this keyword to have XMANAGER block when this
27;               application is registered.  By default the Xmanager
28;               keyword NO_BLOCK is set to 1 to provide access to the
29;               command line if active command  line processing is available.
30;               Note that setting BLOCK for this application will cause
31;               all widget applications to block, not only this
32;               application.  For more information see the NO_BLOCK keyword
33;               to XMANAGER.
34;       UPDATECALLBACK: Set this keyword to a string containing the name of
35;               a user-supplied procedure that will be called when the color
36;               table is updated by XLOADCT.  The procedure may optionally
37;               accept a keyword called DATA, which will be automatically
38;               set to the value specified by the optional UPDATECBDATA
39;               keyword.
40;       UPDATECBDATA: Set this keyword to a value of any type. It will be
41;               passed via the DATA keyword to the user-supplied procedure
42;               specified via the UPDATECALLBACK keyword, if any. If the
43;               UPDATECBDATA keyword is not set the value accepted by the
44;               DATA keyword to the procedure specified by UPDATECALLBACK
45;               will be undefined.
46;
47; OUTPUTS:
48;       None.
49;
50; COMMON BLOCKS:
51;       COLORS: Contains the current RGB color tables.
52;       XP_COM: Private to this module.
53;
54; SIDE EFFECTS:
55;       XPAL uses two colors from the current color table as
56;       drawing foreground and background colors. These are used
57;       for the RGB plots on the left, and the current index marker on
58;       the right. This means that if the user set these two colors
59;       to the same value, the XPAL display could become unreadable
60;       (like writing on black paper with black ink). XPAL minimizes
61;       this possibility by noting changes to the color map and always
62;       using the brightest available color for the foreground color
63;       and the darkest for the background. Thus, the only way
64;       to make XPAL's display unreadable is to set the entire color
65;       map to a single color, which is highly unlikely. The only side
66;       effect of this policy is that you may notice XPAL redrawing
67;       the entire display after you've modified the current color.
68;       This simply means that the change has made XPAL pick new
69;       drawing colors.
70;
71;       The new color tables are saved in the COLORS common and loaded
72;       to the display.
73;
74; PROCEDURE:
75;       The XPAL widget has the following controls:
76;
77;       Left:   Three plots showing the current Red, Green, and Blue vectors.
78;
79;       Center: A status region containing:
80;               1) The total number of colors.
81;               2) The current color. XPAL allows changing
82;                  one color at a time. This color is known as
83;                  the "current color" and is indicated in the
84;                  color spectrum display with a special marker.
85;               3) The current mark index. The mark is used to
86;                  remember a color index. It is established by
87;                  pressing the "Set Mark Button" while the current
88;                  color index is the desired mark index.
89;               4) The current color. The special marker used in
90;                  color spectrum display prevents the user from seeing
91;                  the color of the current index, but it is visible
92;                  here.
93;
94;               A panel of control buttons, which do the following when
95;               pressed:
96;
97;               Done:   Exits XPAL.
98;
99;         Predefined:   Starts XLOADCT to allow selection of one of the
100;                       predefined color tables.
101;
102;               Help:   Supplies help information similar to this header.
103;
104;               Redraw: Completely redraws the display using the current
105;                       state of the color map.
106;
107;             Set Mark: Set the value of the mark index to the
108;                       current index.
109;
110;          Switch Mark: Exchange the mark and the current index.
111;
112;         Copy Current: Every color lying between the current
113;                       index and the mark index (inclusive) is given
114;                       the current color.
115;
116;          Interpolate: The colors lying between the current
117;                       index and the mark index are interpolated linearly
118;                       to lie between the colors of two endpoints.
119;                 save: permet de sauver la palette qui est
120;                       actuellement a l''ecran. Qd on appuie sur ce
121;                       bouton, un widget apparait qui demande:
122;                        1) le nom a donner a la palette que l''on veut sauver
123;                        2) le numero de la palette que l''on veut
124;                        eventuellement ecrase par la nouvelle
125;                        palette.Si aucun numero n''est specifie la
126;                        nouvelle palette estajoutee aux anciennes.
127;                        3) le nom du fichier qui contient les
128;                        palettes. Rq: suivre eventuellement les
129;                        indications fournis au prompteur.
130;               
131;
132;       Three sliders (R, G, and B) that allow the user to modify the
133;       current color.
134;
135;       Right:  A display which shows the current color map as a series of
136;               squares. Color index 0 is at the upper left. The color index
137;               increases monotonically by rows going left to right and top
138;               to bottom.  The current color index is indicated by a special
139;               marker symbol. There are 4 ways to change the current color:
140;                       1) Press any mouse button while the mouse
141;                          pointer is over the color map display.
142;                       2) Use the "By Index" slider to move to
143;                          the desired color index.
144;                       3) Use the "Row" Slider to move the marker
145;                          vertically.
146;                       4) Use the "Column" Slider to move the marker
147;                          horizontally.
148;
149; MODIFICATION HISTORY:
150;          addaptation de xpalette pour ajouter un bouton save par
151;          Gima Nicolas (nglod@ipsl.jussieu.fr) et par Masson
152;          Sebastien (smlod@ipsl.jussieu.fr)
153;-
154
155function XP_NEW_COLORS
156; Choose the best foreground and background colors for the current
157; color maps and set !P appropriately. Returns 1 if the colors changed,
158; 0 otherwise.
159;
160  compile_opt idl2, strictarrsubs
161;
162  common xp_com, xpw, state
163
164  res = 0
165  junk = CT_LUMINANCE(dark=dark_col, bright=bright_col)
166
167  if (bright_col ne !p.color) then begin
168    !p.color = bright_col
169    res = 1
170  endif
171
172  if (dark_col ne !p.background) then begin
173    !p.background = dark_col
174    res = 1
175  endif
176
177  return, res
178end
179
180pro XP_ALERT_CALLER
181;
182  compile_opt idl2, strictarrsubs
183;
184
185  common xp_com, xpw, state
186
187  ErrorStatus = 0
188  CATCH, ErrorStatus
189  if (ErrorStatus NE 0) then begin
190    CATCH, /CANCEL
191    v = DIALOG_MESSAGE(['Unexpected error in XPAL:', $
192                        '!ERR_STRING = ' + !ERR_STRING], $
193                        /ERROR)
194    return
195  endif
196  if (STRLEN(state.updt_callback) gt 0) then begin
197    if (PTR_VALID(state.p_updt_cb_data)) then begin
198      CALL_PROCEDURE, state.updt_callback, DATA=*(state.p_updt_cb_data)
199    endif else begin
200      CALL_PROCEDURE, state.updt_callback
201    endelse
202  endif
203end
204
205pro XP_XLCTCALLBACK
206  ; For visuals with static colormaps, update the graphics
207  ; after a change by XLOADCT.
208;
209  compile_opt idl2, strictarrsubs
210;
211  if ((COLORMAP_APPLICABLE(redrawRequired) GT 0) and $
212        (redrawRequired GT 0)) then begin
213    XP_REDRAW
214  endif
215
216end
217
218pro XP_REDRAW
219;
220  compile_opt idl2, strictarrsubs
221;
222
223  common xp_com, xpw, state
224
225  junk = XP_NEW_COLORS()
226  WIDGET_CONTROL, xpw.colorsel, set_value=-1
227  XP_REPLOT, !p.color, 'F'        ; Update the plots of RGB
228  ; Let the caller of XPAL know that the color table was modified
229  XP_ALERT_CALLER
230end
231
232
233
234pro XP_REPLOT, color_index, type
235; Re-draw the RGB plots. Type has the following possible values.
236;;      - 'D': Draw the data part of all three plots
237;       - 'F': draw all three plots
238;       - 'R': Draw the data part of the Red plot
239;       - 'G': Draw the data part of the Green plot
240;       - 'B': Draw the data part of the Blue plot
241;
242  compile_opt idl2, strictarrsubs
243;
244
245  common xp_com, xpw, state
246  common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
247  common pscale, r_x_s, r_y_s, g_x_s, g_y_s, b_x_s, b_y_s
248
249  ; Update the plots of RGB
250  save_win = !D.WINDOW
251  wset, state.plot_win
252  save_p_region = !p.region
253  save_x_margin = !x.margin
254  save_y_margin = !y.margin
255  save_x_s = !x.s
256  save_y_s = !y.s
257  save_x_type = !x.type
258  save_y_type = !y.type
259
260  !y.margin= [2, 2]
261  !x.margin= [6, 2]
262
263  if (type eq 'F') then begin
264    !p.region = [0,.6667, 1, 1]
265    plot,xstyle=2, ystyle=3, yrange=[0, 260], r_curr, title='Red'
266    r_x_s = !x.s
267    r_y_s = !y.s
268
269    !p.region = [0,.333, 1, .6667]
270    plot,/noerase, xstyle=2,ystyle=3, yrange=[0, 260], g_curr, title='Green'
271    g_x_s = !x.s
272    g_y_s = !y.s
273
274    !p.region = [0,0, 1, .333]
275    plot,/noerase, xstyle=2,ystyle=3, yrange=[0, 260], b_curr, title='Blue'
276
277    b_x_s = !x.s
278    b_y_s = !y.s
279  endif else begin
280    if ((type eq 'D') or (type eq 'R')) then begin
281      !p.region = [0,.6667, 1, 1]
282      !x.s = r_x_s
283      !y.s = r_y_s
284      oplot, r_curr, color=color_index
285    endif
286    if ((type eq 'D') or (type eq 'G')) then begin
287      !p.region = [0,.333, 1, .6667]
288      !x.s = g_x_s
289      !y.s = g_y_s
290      oplot, g_curr, color=color_index
291    endif
292    if ((type eq 'D') or (type eq 'B')) then begin
293      !p.region = [0,0, 1, .333]
294      !x.s = b_x_s
295      !y.s = b_y_s
296      oplot, b_curr, color=color_index
297    endif
298  endelse
299
300  empty
301  WSET, save_win
302  !p.region = save_p_region
303  !x.margin = save_x_margin
304  !y.margin = save_y_margin
305  !x.s = save_x_s
306  !y.s = save_y_s
307  !x.type = save_x_type
308  !y.type = save_y_type
309
310end
311
312
313
314
315pro XP_CHANGE_COLOR, type, value
316; Change current color. Type has the following possible values.
317;       - 'R': Change the R part of the current color
318;       - 'G': ...
319;       - 'B': ...
320;
321  compile_opt idl2, strictarrsubs
322;
323  common xp_com, xpw, state
324  common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
325
326
327  cur_idx = state.cur_idx
328
329  XP_REPLOT, !p.background, type
330
331  if (type eq 'R') then r_curr[cur_idx] = value;
332  if (type eq 'G') then g_curr[cur_idx] = value;
333  if (type eq 'B') then b_curr[cur_idx] = value;
334
335  tvlct, r_curr[cur_idx], g_curr[cur_idx], b_curr[cur_idx], cur_idx
336
337  if (XP_NEW_COLORS()) then begin
338    ; Highlight the current position using the marker
339    WIDGET_CONTROL, xpw.colorsel, set_value=-1  ; Re-initialize
340    XP_REPLOT, !p.color, 'F'
341  endif else begin
342    XP_REPLOT, !p.color, type
343  endelse
344
345  ; For visuals with static colormaps, update the graphics
346  ; of the current color.
347  if ((COLORMAP_APPLICABLE(redrawRequired) GT 0) and $
348        (redrawRequired GT 0)) then begin
349    ; Mark new square
350    tmp = !D.WINDOW
351    wset, state.cur_color_win
352    erase, color=state.cur_idx
353    wset, tmp
354  endif
355
356  ; Let the caller of XPAL know that the color table was modified
357  xp_alert_caller
358
359end
360
361
362
363
364
365
366
367pro XP_BUTTON_EVENT, event
368;
369  compile_opt idl2, strictarrsubs
370;
371
372   common xp_com, xpw, state
373   common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
374
375                                ; NOTE: The value of these tags depend on the order of the buttons
376                                ;     in the base.
377   case (event.value) of
378
379                                ; DONE
380      0: begin
381         empty
382         r_orig = r_curr & g_orig = g_curr & b_orig = b_curr ;new orig color tbl
383         WIDGET_CONTROL, /DESTROY, event.top
384         !p = state.old_p
385      end
386
387                                ; PREDEFINED
388      1: xlct, /silent, group=xpw.base, UPDATECALLBACK='XP_XLCTCALLBACK'
389
390                                ; HELP
391      2: XDisplayFile, FILEPATH("xpal.txt", subdir=['help', 'widget']), $
392       TITLE = "Xpal Help", GROUP = event.top, WIDTH = 55, HEIGHT = 16
393
394                                ; REDRAW
395      3: XP_REDRAW
396
397                                ; SET MARK
398      4: begin
399         state.mark_idx = state.cur_idx
400         WIDGET_CONTROL, xpw.mark_label, $
401          set_value=strcompress(state.mark_idx, /REMOVE)
402      end
403
404                                ; SWITCH MARK
405      5 : if (state.mark_idx ne state.cur_idx) then begin
406         tmp = state.mark_idx
407         state.mark_idx = state.cur_idx
408         state.cur_idx = tmp
409         WIDGET_CONTROL, xpw.colorsel, set_value=tmp
410         WIDGET_CONTROL, xpw.idx_label, $
411          set_value=strcompress(state.cur_idx, /REMOVE)
412         WIDGET_CONTROL, xpw.mark_label, $
413          set_value=strcompress(state.mark_idx, /REMOVE)
414      endif
415
416                                ; COPY CURRENT
417      6 : begin
418         do_copy:
419         cur_idx = state.cur_idx
420         if (state.mark_idx le cur_idx) then begin
421            s = state.mark_idx
422            e = cur_idx
423         endif else begin
424            s = cur_idx
425            e = state.mark_idx
426         endelse
427         n = e-s+1
428         XP_REPLOT, !p.background, 'D'
429         if (event.value eq 6) then begin
430            r_curr[s:e] = r_curr[cur_idx]
431            g_curr[s:e] = g_curr[cur_idx]
432            b_curr[s:e] = b_curr[cur_idx]
433         endif else begin       ; Interpolate
434            scale = findgen(n)/float(n-1)
435            r_curr[s:e] = r_curr[s] + (fix(r_curr[e]) - fix(r_curr[s])) * scale
436            g_curr[s:e] = g_curr[s] + (fix(g_curr[e]) - fix(g_curr[s])) * scale
437            b_curr[s:e] = b_curr[s] + (fix(b_curr[e]) - fix(b_curr[s])) * scale
438         endelse
439         tvlct, r_curr[s:e], g_curr[s:e], b_curr[s:e], s
440         if (XP_NEW_COLORS()) then begin
441            WIDGET_CONTROL, xpw.colorsel, SET_VALUE=-1
442            XP_REPLOT, !p.color, 'F'
443         endif else begin
444            XP_REPLOT, !p.color, 'D'
445         endelse
446                                ; Let the caller of XPAL know that the color table was modified
447         xp_alert_caller
448      end
449
450      7: goto, do_copy
451      8: BEGIN
452         COMMON basecommon,  bas212, bas222,  bas232
453         base = WIDGET_BASE(/COLUMN, /FRAME)
454         bas1 = WIDGET_LABEL(base, value = 'Save')
455         bas2 = WIDGET_BASE(base, /COLUMN)
456         bas21 = WIDGET_BASE(bas2, /COLUMN)
457         bas211 = WIDGET_LABEL(bas21, value = 'Palette Name : ')
458         bas212 = WIDGET_TEXT(bas21, value = 'Noname', /editable)
459         bas22 = WIDGET_BASE(bas2, /COLUMN)
460         bas221 = WIDGET_LABEL(bas22, value = ' Overwrite palette number : ')
461         bas222 = WIDGET_TEXT(bas22, value = '', /editable)
462         bas23 = WIDGET_BASE(bas2, /COLUMN)
463         bas231 = WIDGET_LABEL(bas23, value = 'file name : ')
464         bas232 = WIDGET_TEXT(bas23, value = 'palette.tbl', /editable)
465         bas3 = WIDGET_BASE(base, /ROW)
466         ok = WIDGET_BUTTON(bas3, value = 'OK',$
467                            /ALIGN_LEFT, /FRAME, UVALUE = 'ok')
468         cancel = WIDGET_BUTTON(bas3, value = 'CANCEL',$
469                                /ALIGN_RIGHT, /FRAME, UVALUE = 'cancel')
470         WIDGET_CONTROL, base, /REALIZE
471;         WIDGET_CONTROL, base, SET_UVALUE = drawID
472         XMANAGER,  'xp_button_event',  base
473
474
475
476      END
477      else:
478   endcase
479
480end
481
482
483PRO xp_button_event_event, ev
484;
485  compile_opt idl2, strictarrsubs
486;
487COMMON basecommon,  bas212, bas222,  bas232
488  WIDGET_CONTROL, ev.id,  GET_UVALUE = uval
489  IF(TAG_NAMES(ev,  /STRUCTURE_NAME) EQ 'WIDGET_BUTTON')$
490  THEN BEGIN
491    CASE uval OF
492     'ok' :BEGIN
493        WIDGET_CONTROL, bas212, GET_VALUE = palname
494        WIDGET_CONTROL, bas222, GET_VALUE = over
495        WIDGET_CONTROL, bas232, GET_VALUE = fichname
496        if over[0] EQ '' then over = 255 ELSE over = long(over)
497         newpalette,palname[0], OVER = over[0], file = fichname[0]
498         WIDGET_CONTROL,  ev.top,  /DESTROY
499        END
500     'cancel': WIDGET_CONTROL,  ev.top,  /DESTROY
501    ENDCASE
502  ENDIF
503
504END
505
506
507
508
509
510pro XP_EVENT, event
511;
512  compile_opt idl2, strictarrsubs
513;
514
515   common xp_com, xpw, state
516   common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
517
518   case (event.id) of
519
520      xpw.button_base: XP_BUTTON_EVENT, event
521
522      xpw.rgb_base: begin
523         cur_idx = state.cur_idx
524         if (event.r ne r_curr[cur_idx]) then XP_CHANGE_COLOR, "R", event.r
525         if (event.g ne g_curr[cur_idx]) then XP_CHANGE_COLOR, "G", event.g
526         if (event.b ne b_curr[cur_idx]) then XP_CHANGE_COLOR, "B", event.b
527      end
528
529      xpw.colorsel: begin
530         cur_idx = state.cur_idx
531         new_pos = event.value ne cur_idx
532                                ; Update the RBG sliders
533         if (event.value ne cur_idx) then begin
534            state.cur_idx = (cur_idx = event.value)
535            WIDGET_CONTROL, xpw.idx_label,  $
536             set_value=strcompress(cur_idx, /REMOVE_ALL)
537                                ; Mark new square
538            tmp = !D.WINDOW
539            wset, state.cur_color_win
540            erase, color=cur_idx
541            wset, tmp
542
543            WIDGET_CONTROL, xpw.rgb_base, $
544             set_value=[r_curr[cur_idx], g_curr[cur_idx], b_curr[cur_idx]]
545         endif
546      end
547
548      else:
549   endcase
550
551end
552
553
554
555
556
557
558
559pro XPAL, group=group, BLOCK=block, UPDATECALLBACK=updt_cb_name, $
560        UPDATECBDATA=updt_cb_data
561;
562  compile_opt idl2, strictarrsubs
563;
564
565
566  common xp_com, xpw, state
567  common colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
568
569  IF N_ELEMENTS(updt_cb_name) EQ 0 THEN updt_callback="" $
570                                 ELSE updt_callback=updt_cb_name
571  IF N_ELEMENTS(updt_cb_data) GT 0 THEN p_updt_cb_data=PTR_NEW(updt_cb_data) $
572                                 ELSE p_updt_cb_data=PTR_NEW()
573
574  xpw = { xp_widgets, base:0L, $
575        colorsel:0L, mark_label:0L, idx_label:0L, button_base:0L, rgb_base:0L}
576
577  state = {old_p:!p, $                     ; Original value of !P
578           mark_idx:0, $                   ; Current mark index
579           cur_idx:0, $                    ; Current index
580           cur_color_win:0, $              ; Current Color draw window index
581           plot_win:0, $                   ; RGB plot draw window index
582           updt_callback: updt_callback, $ ; user-defined callback (optional)
583           p_updt_cb_data:p_updt_cb_data}  ; data for callback (optional)
584
585  if (XREGISTERED('XPAL')) then return      ; Only one copy at a time
586
587  IF N_ELEMENTS(block) EQ 0 THEN block=0
588
589  on_error,2              ;Return to caller if an error occurs
590
591  nc = !d.table_size            ;# of colors avail
592  if nc eq 0 then message, "Device has static color tables.  Can't modify."
593  if (nc eq 2) then message, 'Unable to work with monochrome system.'
594
595  state.old_p = !p              ;Save !p
596  !p.noclip = 1                 ;No clipping
597  !p.color = nc -1              ;Foreground color
598  !p.font = 0                   ;Hdw font
599  save_win = !d.window  ;Previous window
600
601  IF N_ELEMENTS(r_orig) LE 0 THEN BEGIN ;If no common, use current colors
602        TVLCT, r_orig, g_orig, b_orig, /GET
603        r_curr = r_orig
604        b_curr = b_orig
605        g_curr = g_orig
606        ENDIF
607
608  ; Create widgets
609  xpw.base=WIDGET_BASE(title='Xpal', /ROW, space=30)
610  ; This is a little tricky. Setting the managed attribute indicates
611  ; our intention to put this app under the control of XMANAGER, and
612  ; prevents our draw widgets from becoming candidates for becoming
613  ; the default window on WSET, -1. XMANAGER sets this, but doing it here
614  ; prevents our own WSETs at startup from having that problem.
615  WIDGET_CONTROL, /MANAGED, xpw.base
616
617  version = WIDGET_INFO(/VERSION)
618  if (version.style='Motif') then junk=510 else junk = 580
619  plot_frame = WIDGET_DRAW(xpw.base, xsize=200, ysize=junk)
620
621  c1 = WIDGET_BASE(xpw.base, /COLUMN, space=20)
622    status = WIDGET_BASE(c1, /COLUMN, /FRAME)
623      ncw = WIDGET_LABEL(WIDGET_BASE(status), /DYNAMIC_RESIZE)
624      xpw.idx_label = CW_FIELD(status, title='Current Index: ', value='0', $
625                               xsize=20, /STRING)
626      xpw.mark_label = CW_FIELD(status, title='Mark Index:    ', value='0', $
627                                xsize=20, /STRING)
628      c1_1 = widget_base(status, /ROW)
629        junk = WIDGET_LABEL(c1_1, value="Current Color: ")
630          cur_color = WIDGET_DRAW(c1_1, xsize = 125, ysize=50, /frame)
631    names = [ 'Done', 'Predefined', 'Help', 'Redraw', 'Set Mark', $
632                'Switch Mark', 'Copy Current', 'Interpolate', 'save']
633    xpw.button_base = CW_BGROUP(c1, names, COLUMN=3, /FRAME)
634    xpw.rgb_base = CW_RGBSLIDER(c1, /FRAME, /DRAG)
635
636    junk = WIDGET_BASE(xpw.base)        ; Responds to YOFFSET
637    if (version.style='Motif') then junk2=30 else junk2 = 50
638    xpw.colorsel = CW_COLORSEL(junk, yoffset=junk2)
639
640
641  state.cur_idx = 0
642  state.mark_idx = 0
643
644  ; Position RGB slider appropriately
645  WIDGET_CONTROL, xpw.rgb_base, SET_VALUE=[r_curr[0], g_curr[0], b_curr[0]]
646  WIDGET_CONTROL, /REALIZE, xpw.base
647
648  WIDGET_CONTROL, ncw, $
649        set_value='Number Of Colors: ' + strcompress(!d.n_colors, /REMOVE_ALL)
650  WIDGET_CONTROL, get_value=tmp, cur_color
651  state.cur_color_win = tmp
652  WIDGET_CONTROL, get_value=tmp, plot_frame
653  state.plot_win = tmp
654
655
656  ; Update the plots of RGB
657  junk = XP_NEW_COLORS()
658  XP_REPLOT, !p.color, 'F'
659
660  WSET, save_win
661
662  XMANAGER, 'Xpal', xpw.base, event_handler='XP_EVENT', group=group, $
663        NO_BLOCK=(NOT(FLOAT(block)))
664end
665
Note: See TracBrowser for help on using the repository browser.