# Template: minmax_rgba
#
# This gadget is a real hack. We tie the rgba sliders to the values
# for r, g, b, a using a foreign vector.
#
# The actual parm isn't even represented here. If it were it would
# look something like this:
# PARM(PSI_SIZE, "PSI_TOKEN", 3) PSI_TYPE "PSI_LABEL" STRETCH(1, 0);
#
PSI_TOKEN.ramps =
{
 LAYOUT( vertical ) STRETCH(1, 0) MARGIN(0.01, 0) LOOK(bevel)

 { LOOK(  redramp, none) SIZE(0.0, 0.05) STRETCH(1, 0) }
 { LOOK(greenramp, none) SIZE(0.0, 0.05) STRETCH(1, 0) }
 { LOOK( blueramp, none) SIZE(0.0, 0.05) STRETCH(1, 0) }
 { LOOK( greyramp, none) SIZE(0.0, 0.05) STRETCH(1, 0) }
}

PSI_TOKEN.gad =
{
    LAYOUT(horizontal%) MARGIN(0, 0.01) STRETCH(1, 0)

    #
    # A bit of a hack here. We assume that the r,g,b,a values have
    # names "red", "green", "blue", "alpha" respectively. Not *too*
    # huge an assumption.
    #
    FIELD float
	    VALUE(  red.val[1],
		  green.val[1],
		   blue.val[1],
		  alpha.val[1]);

    {
      LAYOUT(vertical) STRETCH(1, 0)
    	
      PSI_TOKEN.ramps;
      {
	LAYOUT(horizontal) MARGIN(0, 0) STRETCH(1, 0)

	SLIDER -1 1 LAYOUT(horizontal) SIZE(0, 0.1) STRETCH(1, 0)
		VALUE(  red.val[1],
		      green.val[1],
		       blue.val[1],
		      alpha.val[1]);

	SLIDER  0 2 LAYOUT(horizontal) SIZE(0, 0.1) STRETCH(1, 0)
		VALUE(  red.val[0],
		      green.val[0],
		       blue.val[0],
		      alpha.val[0]);
      }
    }
    FIELD float
	    VALUE(  red.val[0],
		  green.val[0],
		   blue.val[0],
		  alpha.val[0]);
}

