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

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

change *.pro file properties (del eof-style, del executable, set keywords Id

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