Daylight v4.9
Release Date: 1 February 2008


dw_edgar - edgar widget

C Prototype

#include <X11/Xlib.h>
#include <xview/xview.h>
#include "dt_smiles.h"
#include "dt_depict.h"
#include "dw_xv_widget.h"

/*** Standard widget functions ***/

int dw_edgar_create (Frame parent);
void dw_edgar_destroy (int id);
void dw_edgar_hide (int id);
void dw_edgar_redraw (int id);
void dw_edgar_reset (int id);
void dw_edgar_setlabel(int id, char *label);
void dw_edgar_show (int id);

/*** Functions specific to the Edgar widget ***/

int dy_edgar_invoke(int id);


Edgar (EDit Graphic Attribute Resources) widget is a color-picker-like utility which allows users to associate real properties (e.g. color, line style and width) with functionally-defined graphic attributes (e.g. background, borders, carbon atoms, etc). Edgar functions both as a runtime color picker and a file editor. As a color picker, the user can assign colors to objects and apply them at runtime. As an editor, it can be used to read, edit, and write options files for future use.

All graphics displayed by Daylight 4.x drawing libraries use the concept of functionally-defined graphics attributes (GA's). GA's are arbitrary integers which represent the graphics properties used to render objects of a given type. The function of a GA corresponds to its name, e.g. DL_GA_BORDER defines how borders are rendered, DL_GA_ELEM_N nitrogens, etc. Daylight reserves the first 1000 integers for internal use. The header file dl_defs.h defines 160 GA's. Values from 0-99 are used for general purpose GA's, 100 is used for the wildcard atoms, and 101-205 correspond to elements (atomic number + 100).

The semantics of GA's (i.e. what their values mean) are defined by the drawing library. (Note: the Daylight Toolkit does not care about such assignments; their meaning is strictly between the main program and drawing library.) In principle, GA's are arbitrary integers representing the full range of possible graphic properties, e.g. color, line width, translucency, specularity, etc. With X-Windows drawing libraries, this is limited color and line style. On most workstations, the hardware colormap is a limited resource which must be shared between programs. To promote color-resource sharing, the drawing library supplied by Daylight (dl_defs.h and dl_xview.a) uses the 76 named colors defined by the X Consortium. The standard color names are:

aquamarine       gray30              navy blue
black            gray40              orange
blue             gray50              orange red
blue violet      gray60              orchid
brown            gray70              pale green
cadet blue       gray80              pink
coral            gray90              plum
cornflower blue  green               red
cyan             green yellow        salmon
dark green       indian red          sea green
dark olive green khaki               sienna
dark orchid      light blue          sky blue
dark slate blue  light gray          slate blue
dark slate gray  light steel blue    spring green
dark turquoise   lime green          steel blue
dim gray         magenta             tan
firebrick        maroon              thistle
forest green     medium aquamarine   turquoise
ghost white      medium blue         violet
gold             medium orchid       violet red
goldenrod        medium sea green    wheat
gray             medium slate blue   white
gray0            medium spring green yellow
gray10           medium turquoise    yellow green
gray100          medium violet red
gray20           midnight blue

The color attribute of each GA is defined by a string-valued option, e.g. HUE_BORDER, HUE_ELEM_N, etc. A color options file assigns color names to graphics attributes, for instance, defaultcolors.opt begins:

HUE_BORDER = gray40
HUE_DATA = white
HUE_MUTED = medium blue

whereas papercolors.opt begins:

HUE_BORDER = gray80
HUE_DATA = black
HUE_NORMAL = black
HUE_MUTED = gray70

As an editor, Edgar reads and writes color option files.

dw_edgar_create(Frame parent) => int

Create a Edgar widget as a child of XView Frame parent. The widget is initially empty and is not visible. A positive widget id is returned on success; 0 is returned on error.

dw_edgar_destroy(int id) => void

Destroy the given Edgar widget.

dw_edgar_hide(int id) => void

Unconditionally hide the given Edgar widget.

dw_edgar_invoke(int id, dt_Handle conformation) => int

Invoke Edgar widget id with given conformation.

dw_edgar_redraw(int id) => void

Refresh the given widget.

dw_edgar_reset(int id) => void

Clear the given Edgar widget.

dw_edgar_setlabel(int id, char *label) => void

Set the label on the given Edgar widget. A value of NULL sets the default label.

dw_edgar_show(int id) => void

Make the given Edgar widget visible. This is not typically needed, since dw_edgar_invoke() automatically makes the widget visible.



The initial colors displayed by Edgar are the current values of the HUE_* options. Edgar modifies the current values of these options when the user selects "Apply".

Return Value

No error messages are generated by this widget.

Release 4.2 is the first release of this widget. The 4.3 Edgar Widget is functionally identical to the 4.3 version.


The SGI 4-Sight ("lightning bolt") X-server doesn't update X-Window labels properly, so the user doesn't see the name of the file being edited. This X-server was distributed with Iris 3.3 and earlier and is considered obsolete by SGI. This problem is corrected in the X-Server distributed with Iris 4.0+.

Edgar sets the cursor color to the currently selected color and leaves it that way even after it exits. This was intended as feature, but it can be inadvertently left in a state where the cursor is hard to see. A better solution would be to have an option such as HUE_CURSOR.

Related Topics

Daylight Widget User's Guide
Daylight Widget Programmer's Guide