<<prev file | next file >>    view single page | view frames    summary: fields | routine    details: routine

Colors/

xpal.pro

Choose the best foreground and background colors for the current color maps and set !P appropriately. Re-draw the RGB plots. Change current color. Like xpalette but shorter to write and, moreover, possess a hotkey save which (thanks to the newpalette routine) allows to save the routine that we have just done. Comment: when we press the predefined hotkey, it calls xlct instead of xloadct No explicit inputs. The current color table is used as a starting point.

topxpal Color, Widget

xpal, GROUP=GROUP, BLOCK=BLOCK, UPDATECALLBACK=UPDATECALLBACK, UPDATECBDATA=UPDATECBDATA

Keywords

GROUP       

The widget ID of the widget that calls xpal. When this ID is specified, a death of the caller results in a death of xpal

BLOCK        default: 1

Set this keyword to have XMANAGER block when this application is registered. By default the Xmanager keyword NO_BLOCK is set to 1 to provide access to the command line if active command line processing is available. Note that setting BLOCK for this application will cause all widget applications to block, not only this application. For more information see the NO_BLOCK keyword to XMANAGER.

UPDATECALLBACK       

Set this keyword to a string containing the name of a user-supplied procedure that will be called when the color table is updated by XLOADCT. The procedure may optionally accept a keyword called DATA, which will be automatically set to the value specified by the optional UPDATECBDATA keyword.

UPDATECBDATA       

Set this keyword to a value of any type. It will be passed via the DATA keyword to the user-supplied procedure specified via the UPDATECALLBACK keyword, if any. If the UPDATECBDATA keyword is not set the value accepted by the DATA keyword to the procedure specified by UPDATECALLBACK will be undefined.

Examples

The XPAL widget has the following controls: Left: Three plots showing the current Red, Green, and Blue vectors. Center: A status region containing: 1) The total number of colors. 2) The current color. XPAL allows changing one color at a time. This color is known as the "current color" and is indicated in the color spectrum display with a special marker. 3) The current mark index. The mark is used to remember a color index. It is established by pressing the "Set Mark Button" while the current color index is the desired mark index. 4) The current color. The special marker used in color spectrum display prevents the user from seeing the color of the current index, but it is visible here. A panel of control buttons, which do the following when pressed: Done: Exits XPAL. Predefined: Starts XLOADCT to allow selection of one of the predefined color tables. Help: Supplies help information similar to this header. Redraw: Completely redraws the display using the current state of the color map. Set Mark: Set the value of the mark index to the current index. Switch Mark: Exchange the mark and the current index. Copy Current: Every color lying between the current index and the mark index (inclusive) is given the current color. Interpolate: The colors lying between the current index and the mark index are interpolated linearly to lie between the colors of two endpoints. save: Allows to save the palette which is currently on the screen. When we press this hotkey, there is a widget who appear and ask: 1) the name of the palette we want to save. 2) The number of the palette we may want to erase by the new palette. If there is not any number specified, the new palette is add to elders. 3) The name of the file containing palettes. Comment: May follow instructions gave by the prompter. Three sliders (R, G, and B) that allow the user to modify the current color. Right: A display which shows the current color map as a series of squares. Color index 0 is at the upper left. The color index increases monotonically by rows going left to right and top to bottom. The current color index is indicated by a special marker symbol. There are 4 ways to change the current color: 1) Press any mouse button while the mouse pointer is over the color map display. 2) Use the "By Index" slider to move to the desired color index. 3) Use the "Row" Slider to move the marker vertically. 4) Use the "Column" Slider to move the marker horizontally.

Version history

Version

$Id: xpal.pro 238 2007-03-27 13:43:18Z pinsard $

History

Adaptation of xpalette to add a save button by Grima Nicolas (nglod@ipsl.jussieu.fr) and by Masson Sebastien (smlod@ipsl.jussieu.fr)

Known issues

Restrictions

XPAL uses two colors from the current color table as drawing foreground and background colors. These are used for the RGB plots on the left, and the current index marker on the right. This means that if the user set these two colors to the same value, the XPAL display could become unreadable (like writing on black paper with black ink). XPAL minimizes this possibility by noting changes to the color map and always using the brightest available color for the foreground color and the darkest for the background. Thus, the only way to make XPAL's display unreadable is to set the entire color map to a single color, which is highly unlikely. The only side effect of this policy is that you may notice XPAL redrawing the entire display after you've modified the current color. This simply means that the change has made XPAL pick new drawing colors. The new color tables are saved in the COLORS common and loaded to the display.

Other attributes

Uses routines

XP_COM Private to this module.

Common blocks used

xp_com colors

Statistics

McCabe cyclic 10
McCabe essential 1
McCabe modular design 1
Produced by IDLdoc 2.0.