source: trunk/SRC/Colors/xpal.pro @ 238

Last change on this file since 238 was 238, checked in by pinsard, 17 years ago

improvements/corrections of some *.pro headers

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