XV: Modifying xv Behavior, part 4/4

## Color Editor Resources

You can set default values for all of the HSV and RGB modification controls in the x v color editor window via X resources. The easiest way to explain this is with an example.

1. Start xv and put it in the background by typing '`xv &'`.
2. Type the command '`cat >foo'` in an active xterm window
3. Bring the xv color editor window up.
4. Issue the Cut Resources command.
5. Click your middle mouse button in the xterm window. A set of resource lines describing the current state of the xv color editor controls will be 'pasted' into the window.
6. You could type <ctrl-D> in the xterm to complete the cat command, edit this file, and put it in your `.Xdefaults` or `.Xresources` file.

The lines generated by Cut Resources will look like this:

>     xv.default.huemap1: 330  30  CW 330  30  CW
>     xv.default.huemap2:  30  90  CW  30  90  CW
>     xv.default.huemap3:  90 150  CW  90 150  CW
>     xv.default.huemap4: 150 210  CW 150 210  CW
>     xv.default.huemap5: 210 270  CW 210 270  CW
>     xv.default.huemap6: 270 330  CW 270 330  CW
>     xv.default.whtmap:  0 0 1
>     xv.default.satval:  0
>     xv.default.igraf: S 4 : 0,0 : 64,64 : 192,192 : 254,254
>     xv.default.rgraf: S 4 : 0,0 : 64,64 : 192,192 : 254,254
>     xv.default.ggraf: S 4 : 0,0 : 64,64 : 192,192 : 254,254
>     xv.default.bgraf: S 4 : 0,0 : 64,64 : 192,192 : 254,254

These lines completely describe one state of the xv color editor controls. There are five different states that you can specify via X resources. The '`default'` state (as shown) holds the settings used whenever the program is first started, and whenever the Reset command is used. You can also store settings in one of the four xv presets (accessed via the 1, 2, 3, or 4 buttons in the xv color editor) by changing the string '`default'` in the above lines to '`preset1'`, '`preset2'`, '`preset3'`, or '`preset4'` respectively.

There are four types of resource described in these lines: `huemap` , `whtmap` , `satval` , and `graf` .

### Huemap Resources

The `huemap` resources describe the state of the hue remapping dials. There are six huemap resources per state of the xv color editor. These huemap resources are numbered '`huemap1'`, through '`huemap6'`, and correspond to the '1'-'6' radio buttons under the hue remapping dials.

Each huemap resources takes six parameters:

1. The 'starting' angle of the From range, in degrees (integer).
2. The 'ending' angle of the From range, in degrees (integer).
3. The direction of the From range. Either '`cw'` (clockwise) or '`ccw'` (counter-clockwise).
4. The 'starting' angle of the To range, in degrees (integer).
5. The 'ending' angle of the To range, in degrees (integer).
6. The direction of the To range. Either '`cw'` or '`ccw'`.

### Whtmap Resources

The `whtmap` resource describes the state of the white remapping control. There is one whtmap resource per state of the xv color editor controls. The whtmap resource takes three parameters:

1. The hue to remap 'white' to, in degrees (integer).
2. The saturation to give to the remapped 'white', in percent (integer).
3. A boolean specifying whether the white remapping control is enabled. If '1', the control is enabled. If '0', the control is disabled.

### Satval Resource

The `satval` resource describes the value of the Saturation dial. There is one satval resource per state. The satval resource takes a single integer value, in the range 100, which specifies how much to add or subtract to the overall image color saturation.

### Graf Resources

The `graf` resources describe the state of the four 'graph' windows in the xv color editor window ( Intensity, Red, Green, and Blue). The graf resources can be in one of two formats, 'gamma' and 'spline/line'.

In 'gamma' format, the graf resource takes two parameters:

1. The letter 'G', specifying 'gamma' mode
2. A single floating point number specifying the gamma value.

In 'spline/line' mode, the graf resource takes a variable number of parameters:

1. The letter 'S' specifying 'spline' mode, or the letter 'L' specifying 'line' mode.
2. An integer number indicating the number of handles (control points) that this graph window will have. (Must be in the range 2-16, inclusive.)
3. For each handle, there will be a ':', and the x and y positions of the handle, separated by a comma. The x and y positions can be in the range 0-255 inclusive.

### Other Resources

`autoApply`
  A boolean resource that sets the default condition of the Auto-Apply HSV/RGB Mods checkbox in the xv color editor window.
`displayMods`
  A boolean resource that sets the default condition of the Display With HSV/RGB Mods checkbox in the xv color editor window.
`dragApply`
  A boolean resource that sets the default condition of the Auto-Apply While Dragging checkbox in the xv color editor window.
`autoReset`
  A boolean resource that sets the default condition of the Auto-Reset On New Image checkbox in the xv color editor window.
`saveNormal`
  A boolean resource that sets the default condition of Normal Size checkbox in the xv save window.
`pspreview`
  A boolean resource that sets the default condition of Preview checkbox in the xv postscript window.
`pscompress`
  A boolean resource that sets the default condition of Compress checkbox in the xv postscript window.
`print`
  A string resource that sets the default command that shows up in the Print dialog box.
`pspaper`
  A string resource that sets the default paper size selected in the xv postscript window. Valid settings are: `8.5x11, 8.5x14, 11x17, 4x5 35mm a3 a4 b5`
`psorient`
  A string resource that sets the default image orientation in the xv postscript window. Valid settings are: `portrait` and `landscape`
`psres`
  An integer resource that sets the default image resolution in the xv postscript window. Valid settings are in the range 10 through 720 dpi.

## Window Classes

xv defines the following 'class' names for its various top-level windows:

`XVroot`
  for the xv image window
`XVcontrols`
  for the xv controls window
`XVdir`
  for the xv load and xv save windows
`XVinfo`
  for the xv info window
`XVcedit`
  for the xv color editor window
`XVps`
  for the xv postscript window
`XVjpeg`
  for the xv jpeg window
`XVtiff`
  for the xv tiff window
`XVconfirm`
  for all the pop-up windows

You may be able to use these class names to do something nifty with your window manager. For instance, with mwm you can control which controls you'll get in the window frame, on a per-window basis. For example, to turn off all the mwm doodads that normally are tacked onto the xv image window, you could put this in your .Xdefaults file:

> `Mwm*XVroot*clientDecoration: none`