source: trunk/SRC/Colors/xpal.pro

Last change on this file was 495, checked in by pinsard, 10 years ago

fix thanks to coding rules; typo; dupe empty lines; trailing blanks

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