<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE X3D PUBLIC "ISO//Web3D//DTD X3D 3.0//EN" "https://www.web3d.org/specifications/x3d-3.0.dtd">
<X3D profile='Immersive' version='3.0' xmlns:xsd='http://www.w3.org/2001/XMLSchema-instance' xsd:noNamespaceSchemaLocation='https://www.web3d.org/specifications/x3d-3.0.xsd'>
  <head>
    <meta content='DvdControllerPrototype.x3d' name='title'/>
    <meta content='Digital Virtual Display (DVD) Controller Prototype definition to control animation timing. Heads-up display keeps DVD Controller on screen.' name='description'/>
    <meta content='Jane Wu, Don Brutzman, Jonathan Roberts' name='creator'/>
    <meta content='19 July 2001' name='created'/>
    <meta content='5 March 2024' name='modified'/>
    <meta content='DvdController animation control' name='subject'/>
    <meta content='check handling of beginning/end buttos' name='TODO'/>
    <meta content='X3D-Edit ExternProtoDeclare panel autocheck missed notifying that some fields are not in original ProtoDeclare' name='TODO'/>
    <meta content='https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerPrototype.x3d' name='identifier'/>
    <meta content='X3D-Edit 4.0, https://www.web3d.org/x3d/tools/X3D-Edit' name='generator'/>
    <meta content='../../license.html' name='license'/>
  </head>
  <Scene>
    <WorldInfo title='DvdControllerPrototype.x3d'/>
    <ExternProtoDeclare appinfo='Slider user-interface widget that produces floating-point output values' name='SliderFloat' url='"../../../Savage/Tools/Animation/SliderFloatPrototype.x3d#SliderFloat" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/SliderFloatPrototype.x3d#SliderFloat" "../../../Savage/Tools/Animation/SliderFloatPrototype.wrl#SliderFloat" "https://www.web3d.org/x3d/content/examples/Savage/Tools/Animation/SliderFloatPrototype.wrl#SliderFloat"'>
      <!-- TODO autocheck missed that these are not in original ProtoDeclare... do these go into DvdController interface? <field accessType='outputOnly' name='isDragged' type='SFBool'/> <field accessType='initializeOnly' appinfo='default value true' name='dragEnabled' type='SFBool'/> <field accessType='inputOnly' name='setDragEnabled' type='SFBool'/> <field accessType='outputOnly' name='dragEnabledChanged' type='SFBool'/> <field accessType='initializeOnly' appinfo='default value true' name='clickEnabled' type='SFBool'/> <field accessType='inputOnly' name='setClickEnabled' type='SFBool'/> <field accessType='outputOnly' name='clickEnabledChanged' type='SFBool'/> -->
      <field accessType='initializeOnly' appinfo='Allowed values: vertical, horizontal' name='layoutDirection' type='SFString'/>
      <field accessType='initializeOnly' appinfo='default value 1.0' name='height' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='default value 0.1' name='radius' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='default value 0.02' name='barRadius' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='default value .8 .4 .8' name='sliderBarColor' type='SFColor'/>
      <field accessType='initializeOnly' appinfo='default value .3 .4 .8' name='sliderBallColor' type='SFColor'/>
      <field accessType='initializeOnly' appinfo='default value .2 .3 .9' name='sliderEndColor' type='SFColor'/>
      <field accessType='initializeOnly' appinfo='default value 0.0' name='min' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='default value 10.0' name='max' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='default value 0.0' name='value' type='SFFloat'/>
      <field accessType='inputOnly' name='setMin' type='SFFloat'/>
      <field accessType='inputOnly' name='setMax' type='SFFloat'/>
      <field accessType='inputOnly' name='setValue' type='SFFloat'/>
      <field accessType='outputOnly' name='valueChanged' type='SFFloat'/>
      <field accessType='initializeOnly' appinfo='Enable/disable console output for troubleshooting' name='traceEnabled' type='SFBool'/>
    </ExternProtoDeclare>
    <ProtoDeclare appinfo='Digital Virtual Display (DVD) Controller Prototype is a heads-up display (HUD) to control animation timing' name='DvdController'>
      <ProtoInterface>
        <field accessType='initializeOnly' appinfo='default value -2' name='testTimeVal' type='SFTime' value='-2'/>
        <field accessType='initializeOnly' appinfo='Short description of what is animated by this DvdController.' name='description' type='SFString'/>
        <field accessType='initializeOnly' appinfo='Whether or not play mode is enabled including during startup.' name='playEnabled' type='SFBool' value='false'/>
        <field accessType='initializeOnly' appinfo='Initializes how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master Ghost Local) and Playback control (i.e. Reset to Start Fast Rewind Rewind Pause Play Fast Forward Reset to End). Possible values are (case sensitive): ALL DIS_ONLY PLAYBACK_ONLY SLIDER_ONLY DIS_PLAYBACK DIS_SLIDER PLAYBACK_SLIDER and NONE.' name='displayMode' type='SFString' value='PLAYBACK_SLIDER'/>
        <field accessType='inputOnly' appinfo='Sets how control buttons and slider are displayed. The control buttons include DIS control (i.e. Master Ghost Local) and Playback control (i.e. Reset to Start Fast Rewind Rewind Pause Play Fast Forward Reset to End). Possible values are (case sensitive): ALL DIS_ONLY PLAYBACK_ONLY SLIDER_ONLY DIS_PLAYBACK DIS_SLIDER PLAYBACK_SLIDER and NONE.' name='setDisplayMode' type='SFString'/>
        <field accessType='initializeOnly' appinfo='Default button color.' name='buttonColor' type='SFColor' value='0.55 0.55 0.55'/>
        <field accessType='initializeOnly' appinfo='Button color when selected by user.' name='selectedButtonColor' type='SFColor' value='0.75 0.75 0.75'/>
        <field accessType='initializeOnly' appinfo='Default label color.' name='labelColor' type='SFColor' value='0 0 0'/>
        <field accessType='initializeOnly' appinfo='Label color when selected by user.' name='selectedLabelColor' type='SFColor' value='0.1 0.65 0.2'/>
        <field accessType='initializeOnly' appinfo='Modified screen location and distance (for size).' name='locationOffset' type='SFVec3f' value='-2 -2 0'/>
        <field accessType='initializeOnly' appinfo='default value true' name='clockEnabled' type='SFBool' value='true'/>
        <field accessType='initializeOnly' appinfo='Time for complete loop cycle in seconds.' name='cycleInterval' type='SFTime' value='1.0'/>
        <field accessType='inputOnly' name='set_cycleInterval' type='SFTime'/>
        <field accessType='outputOnly' name='cycleInterval_changed' type='SFTime'/>
        <field accessType='initializeOnly' appinfo='Factor used to determine the speed increase/decrease for Fast Rewind and Fast Forward action.' name='speedFactor' type='SFFloat' value='10'/>
        <field accessType='outputOnly' name='isActive' type='SFBool'/>
        <field accessType='outputOnly' name='startTime_changed' type='SFTime'/>
        <field accessType='outputOnly' name='stopTime_changed' type='SFTime'/>
        <field accessType='outputOnly' name='time_changed' type='SFTime'/>
        <field accessType='outputOnly' name='fraction_changed' type='SFFloat'/>
        <field accessType='outputOnly' name='secondsElapsed' type='SFTime'/>
        <field accessType='outputOnly' appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.' name='isMaster' type='SFBool'/>
        <field accessType='outputOnly' appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.' name='isRemote' type='SFBool'/>
        <field accessType='outputOnly' appinfo='isMaster isRemote and isLocal are booleans represent a 3-way toggle. Only one of them can have a true value at any time.' name='isLocal' type='SFBool'/>
        <field accessType='outputOnly' appinfo='isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa.' name='isPaused' type='SFBool'/>
        <field accessType='outputOnly' appinfo='isPaused and isRunning always have opposite values. When isPaused is true isRunning will be false and vice versa.' name='isRunning' type='SFBool'/>
        <field accessType='initializeOnly' appinfo='Enable/disable console output for troubleshooting' name='traceEnabled' type='SFBool' value='false'/>
      </ProtoInterface>
      <ProtoBody>
        <Transform DEF='LocationOffset'>
          <IS>
            <connect nodeField='translation' protoField='locationOffset'/>
          </IS>
          <ProximitySensor DEF='WhereSensor' size='1000000000 1000000000 1000000000'/>
          <Transform DEF='FixedLocation'>
            <Transform DEF='MovableLocation'>
              <Transform translation='0 0 -10'>
                <Group DEF='PlaneMovementSensorGroup'>
                  <PlaneSensor DEF='PlaneMovementSensor' description='select and drag to move interface'/>
                  <VisibilitySensor DEF='MovementVisibilitySensor'/>
                  <Script DEF='VisibilityControlScript'>
                    <field accessType='initializeOnly' name='description' type='SFString'/>
                    <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
                    <field accessType='initializeOnly' name='isVisible' type='SFBool' value='true'/>
                    <field accessType='initializeOnly' name='locationOffset' type='SFVec3f'/>
                    <field accessType='initializeOnly' name='planeSensorTranslation' type='SFVec3f' value='0 0 0'/>
                    <field accessType='inputOnly' name='setIsVisible' type='SFBool'/>
                    <field accessType='inputOnly' name='setPlaneSensorIsActive' type='SFBool'/>
                    <field accessType='inputOnly' name='setPlaneSensorTranslation' type='SFVec3f'/>
                    <field accessType='outputOnly' name='translationChanged' type='SFVec3f'/>
                    <field accessType='outputOnly' name='translationOffsetChanged' type='SFVec3f'/>
                    <IS>
                      <connect nodeField='description' protoField='description'/>
                      <connect nodeField='traceEnabled' protoField='traceEnabled'/>
                      <connect nodeField='locationOffset' protoField='locationOffset'/>
                    </IS>
                    <![CDATA[
ecmascript:

function tracePrint (text)
{
    if (traceEnabled) Browser.println ('[DvdController ' + description + ' VisibilityControlScript] ' + text);
}
function initialize ()
{
    translationOffsetChanged = locationOffset;
    planeSensorTranslation   = locationOffset;
    setPlaneSensorIsActive (false, -1); // dummy timeStamp
}
function setIsVisible (value, timeStamp)
{
    isVisible = value;
    tracePrint('isVisible=' + value);
}
function setPlaneSensorIsActive (value, timeStamp)
{
    tracePrint('PlaneSensor isActive=' + value + ', translationOffsetChanged=' + translationOffsetChanged.toString());

    if (value == false)
    {
            tracePrint('planeSensorTranslation=' + planeSensorTranslation.toString());
            if (isVisible)
            {
                    translationChanged = planeSensorTranslation;
            }
            else
            {
                    translationChanged = new SFVec3f(0, 0, 0);
                    translationOffsetChanged  = new SFVec3f(0, 0, 0);
            }
    }
}
function setPlaneSensorTranslation (value, timeStamp)
{
	planeSensorTranslation = value;
	tracePrint('planeSensorTranslation=' + value.toString());
}
]]>
                  </Script>
                  <ROUTE fromField='isActive' fromNode='PlaneMovementSensor' toField='setPlaneSensorIsActive' toNode='VisibilityControlScript'/>
                  <ROUTE fromField='translation_changed' fromNode='PlaneMovementSensor' toField='setPlaneSensorTranslation' toNode='VisibilityControlScript'/>
                  <ROUTE fromField='isActive' fromNode='MovementVisibilitySensor' toField='setIsVisible' toNode='VisibilityControlScript'/>
                  <Switch DEF='MovementControlSwitch' whichChoice='0'>
                    <Transform DEF='AllLayer' translation='-0.25 0 0'>
                      <Shape>
                        <Appearance DEF='MovementControlAppearance'>
                          <Material diffuseColor='0.65 0.65 0.65'/>
                        </Appearance>
                        <Box size='0.25 1.75 0.05'/>
                      </Shape>
                    </Transform>
                    <Transform DEF='TwoLayer' translation='-0.25 -0.285 0'>
                      <Shape>
                        <Appearance USE='MovementControlAppearance'/>
                        <Box size='0.25 1.175 0.05'/>
                      </Shape>
                    </Transform>
                    <Transform DEF='OneLayer' translation='-0.25 -0.575 0'>
                      <Shape>
                        <Appearance USE='MovementControlAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                    </Transform>
                  </Switch>
                </Group>
                <Switch DEF='DisplayControlSwitch' whichChoice='0'>
                  <Transform DEF='DisplayAllLayer'>
                    <Transform DEF='DisplayAllToggle'>
                      <Shape>
                        <Appearance DEF='ButtonBaseAppearance'>
                          <Material diffuseColor='0.65 0.65 0.65'/>
                        </Appearance>
                        <Box size='0.25 1.75 0.05'/>
                      </Shape>
                      <TouchSensor DEF='DisplayAllSensor' description='display/hide all rows'/>
                      <Shape>
                        <Appearance>
                          <Material DEF='DisplayAllMaterial' diffuseColor='0 0.35 0.8'/>
                        </Appearance>
                        <Cylinder height='1.65' radius='0.1'/>
                      </Shape>
                    </Transform>
                    <Transform DEF='DisplayTopLayerToggle' translation='0.25 0.575 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                      <TouchSensor DEF='DisplayTopLayerSensor' description='hide top row'/>
                      <Shape>
                        <Appearance>
                          <Material DEF='DisplayControlMaterial' diffuseColor='0 0.35 0.8'/>
                        </Appearance>
                        <Cylinder height='0.5' radius='0.1'/>
                      </Shape>
                    </Transform>
                    <Transform DEF='DisplayMidLayerToggle' translation='0.25 0 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                      <TouchSensor DEF='DisplayMidLayerSensor' description='hide middle row'/>
                      <Shape>
                        <Appearance>
                          <Material USE='DisplayControlMaterial'/>
                        </Appearance>
                        <Cylinder height='0.5' radius='0.1'/>
                      </Shape>
                    </Transform>
                    <Transform DEF='DisplayBottomLayerToggle' translation='0.25 -0.575 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                      <TouchSensor DEF='DisplayBottomLayerSensor' description='hide bottom row'/>
                      <Shape>
                        <Appearance>
                          <Material USE='DisplayControlMaterial'/>
                        </Appearance>
                        <Cylinder height='0.5' radius='0.1'/>
                      </Shape>
                    </Transform>
                  </Transform>
                  <Transform DEF='DisplayTwoLayer'>
                    <Transform DEF='DisplayTwoToggle' translation='0 -0.285 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 1.175 0.05'/>
                      </Shape>
                      <TouchSensor USE='DisplayAllSensor'/>
                      <Shape>
                        <Appearance>
                          <Material USE='DisplayAllMaterial'/>
                        </Appearance>
                        <Cylinder height='1.08' radius='0.1'/>
                      </Shape>
                    </Transform>
                    <Transform USE='DisplayMidLayerToggle'/>
                    <Transform USE='DisplayBottomLayerToggle'/>
                  </Transform>
                  <Transform DEF='DisplayOneLayer'>
                    <Transform DEF='DisplayOneToggle' translation='0 -0.575 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                      <TouchSensor USE='DisplayAllSensor'/>
                      <Shape>
                        <Appearance>
                          <Material USE='DisplayAllMaterial'/>
                        </Appearance>
                        <Cylinder height='0.5' radius='0.1'/>
                      </Shape>
                    </Transform>
                    <Transform USE='DisplayBottomLayerToggle'/>
                  </Transform>
                  <Transform DEF='DisplayNoLayer'>
                    <Transform DEF='DisplayNoToggle' translation='0 -0.575 0'>
                      <Shape>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='0.25 0.6 0.05'/>
                      </Shape>
                      <TouchSensor USE='DisplayAllSensor'/>
                      <Shape>
                        <Appearance>
                          <Material USE='DisplayAllMaterial'/>
                        </Appearance>
                        <Cylinder height='0.5' radius='0.1'/>
                      </Shape>
                    </Transform>
                  </Transform>
                </Switch>
                <Script DEF='DisplayLayerScript'>
                  <field accessType='initializeOnly' name='description' type='SFString'/>
                  <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
                  <field accessType='initializeOnly' name='displayMode' type='SFString'/>
                  <field accessType='inputOnly' name='setDisplayMode' type='SFString'/>
                  <field accessType='initializeOnly' name='displayAllToggleArmed' type='SFBool' value='false'/>
                  <field accessType='initializeOnly' name='topLayerToggleArmed' type='SFBool' value='false'/>
                  <field accessType='initializeOnly' name='midLayerToggleArmed' type='SFBool' value='false'/>
                  <field accessType='initializeOnly' name='bottomLayerToggleArmed' type='SFBool' value='false'/>
                  <field accessType='inputOnly' name='displayAllToggleEnabled' type='SFBool'/>
                  <field accessType='inputOnly' name='topLayerToggleEnabled' type='SFBool'/>
                  <field accessType='inputOnly' name='midLayerToggleEnabled' type='SFBool'/>
                  <field accessType='inputOnly' name='bottomLayerToggleEnabled' type='SFBool'/>
                  <field accessType='outputOnly' name='displayAllColor' type='SFColor'/>
                  <field accessType='outputOnly' appinfo='0 - Display all three animation controls (DIS Mode Selection Playback Controls and Time scale) in a three layer stack. 1 - Display two of the three animation controls in a two layer stack. 2 - Display one of the three animation controls in a one layer stack.' name='movementControlSwitchSelection' type='SFInt32'/>
                  <field accessType='outputOnly' appinfo='0 - Display all three animation controls (DIS Mode Selection Playback Controls and Time scale) in a three layer stack. 1 - Display two of the three animation controls in a two layer stack. 2 - Display one of the three animation controls in a one layer stack. 3 - Display no layers of animation controls.' name='displayControlSwitchSelection' type='SFInt32'/>
                  <field accessType='outputOnly' appinfo='0 - Display DIS Mode (Master Remote Local) Selection at top layer. 1 - Do not display anything at top layer.' name='topLayerSwitchSelection' type='SFInt32'/>
                  <field accessType='outputOnly' appinfo='0 - Display Playback Control Buttons (Reset to Start Fast Rewind Rewind Pause Play Fast Forward Reset To End) at the mid layer. 1 - Display DIS Mode Selection at the mid layer. 2 - Display nothing at the mid layer.' name='midLayerSwitchSelection' type='SFInt32'/>
                  <field accessType='outputOnly' appinfo='0 - Display Time Scale at the bottom layer. 1 - Display DIS Mode Selection at the bottom layer. 2 - Display Playback Control Buttons at the bottom layer. 3 - Display nothing at the bottom layer.' name='bottomLayerSwitchSelection' type='SFInt32'/>
                  <IS>
                    <connect nodeField='description' protoField='description'/>
                    <connect nodeField='traceEnabled' protoField='traceEnabled'/>
                    <connect nodeField='displayMode' protoField='displayMode'/>
                    <connect nodeField='setDisplayMode' protoField='setDisplayMode'/>
                  </IS>
                  <![CDATA[
ecmascript:

function initialize()
{
	setDisplayMode(displayMode, -1);
}
function tracePrint (text)
{
	if (traceEnabled) Browser.println ('[DvdController ' + description + ' DisplayLayerScript] ' + text);
}
function setDisplayMode(value, timeStamp)
{
	// javascript switch statement is convenient but not consistently supported, so test the old-fashioned way:
        
        if (displayMode == 'ALL')
	{
            movementControlSwitchSelection = 0; //AllLayer
            displayControlSwitchSelection = 0;  //DisplayAllLayer
            displayAllColor = new SFColor(0, 0.35, 0.8);
            topLayerSwitchSelection = 0;
            midLayerSwitchSelection = 0;
            bottomLayerSwitchSelection = 0;
	}
        else if (displayMode == 'DIS_ONLY')
        {
            movementControlSwitchSelection = 2; //OneLayer
            displayControlSwitchSelection = 2;  //DisplayOneLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 2;        //DisplayNoneMid
            bottomLayerSwitchSelection = 1;     //DisplayDISModeBottom
	}
        else if (displayMode == 'PLAYBACK_ONLY')
        {
            movementControlSwitchSelection = 2; //OneLayer
            displayControlSwitchSelection = 2;  //DisplayOneLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 2;        //DisplayNoneMid
            bottomLayerSwitchSelection = 2;     //DisplayPlaybackButtonsBottom
	}
        else if (displayMode == 'SLIDER_ONLY')
        {
            movementControlSwitchSelection = 2; //OneLayer
            displayControlSwitchSelection = 2;  //DisplayOneLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 2;        //DisplayNoneMid
            bottomLayerSwitchSelection = 0;     //DiaplaySliderBottom
	}
        else if (displayMode == 'DIS_PLAYBACK')
        {
            movementControlSwitchSelection = 1; //TwoLayer
            displayControlSwitchSelection = 1;  //DisplayTwoLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 1;        //DisplayDISModeMid
            bottomLayerSwitchSelection = 2;     //DisplayPlaybackButtonsBottom
	}
        else if (displayMode == 'DIS_SLIDER')
        {
            movementControlSwitchSelection = 1; //TwoLayer
            displayControlSwitchSelection = 1;  //DisplayTwoLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 1;        //DisplayDISModeMid
            bottomLayerSwitchSelection = 0;     //DisplaySliderBottom
	}
        else if (displayMode == 'PLAYBACK_SLIDER')
        {
            movementControlSwitchSelection = 1; //TwoLayer
            displayControlSwitchSelection = 1;  //DisplayTwoLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 0;        //DisplayPlaybackButtosMid
            bottomLayerSwitchSelection = 0;     //DisplaySliderBottom
	}
        else
        {
            if (displayMode != 'NONE')
                Browser.println ('Unknown value for displayMode=' + displayMode + ', assuming value of NONE');
                
            movementControlSwitchSelection = 2; //OneLayer
            displayControlSwitchSelection = 3;  //DisplayNoLayer
            displayAllColor = new SFColor(1, 0, 0);
            topLayerSwitchSelection = 1;        //DisplayNoneTop
            midLayerSwitchSelection = 2;        //DisplayNoneMid
            bottomLayerSwitchSelection = 3;     //DisplayNoneBottom
	}
}

function displayAllToggleEnabled(value, timeStamp) {
	if (displayAllToggleArmed == false)
	{
		displayAllToggleArmed = true;
		if (displayControlSwitchSelection == 0)
		{
			movementControlSwitchSelection = 2;
			displayControlSwitchSelection = 3;
			displayAllColor = new SFColor(1, 0, 0);
			topLayerSwitchSelection = 1;
			midLayerSwitchSelection = 2;
			bottomLayerSwitchSelection = 3;
			tracePrint('movementControlSwitchSelection =' + movementControlSwitchSelection);
			tracePrint('displayControlSwitchSelection =' + displayControlSwitchSelection);
			tracePrint('topLayerSwitchSelection =' + topLayerSwitchSelection);
			tracePrint('midLayerSwitchSelection =' + midLayerSwitchSelection);
			tracePrint('bottomLayerSwitchSelection =' + bottomLayerSwitchSelection);
		}
		else //displayControlSwitchSelection not 0
		{
			movementControlSwitchSelection = 0;
			displayControlSwitchSelection = 0;
			displayAllColor = new SFColor(0, 0.35, 0.8);
			topLayerSwitchSelection = 0;
			midLayerSwitchSelection = 0;
			bottomLayerSwitchSelection = 0;
			tracePrint('movementControlSwitchSelection =' + movementControlSwitchSelection);
			tracePrint('displayControlSwitchSelection =' + displayControlSwitchSelection);
			tracePrint('topLayerSwitchSelection =' + topLayerSwitchSelection);
			tracePrint('midLayerSwitchSelection =' + midLayerSwitchSelection);
			tracePrint('bottomLayerSwitchSelection =' + bottomLayerSwitchSelection);
		}
	}
	else
	{
		displayAllToggleArmed = false;
		return;
	}
}

function topLayerToggleEnabled(value, timeStamp) {
	if (topLayerToggleArmed == false)
	{
		topLayerToggleArmed = true;
		displayControlSwitchSelection += 1;
		if (displayControlSwitchSelection == 3)
			movementControlSwitchSelection = 2;
		else
			movementControlSwitchSelection = displayControlSwitchSelection;
		displayAllColor = new SFColor(1, 0, 0);
		topLayerSwitchSelection = 1;
		tracePrint('movementControlSwitchSelection =' + movementControlSwitchSelection);
		tracePrint('displayControlSwitchSelection =' + displayControlSwitchSelection);
		tracePrint('topLayerSwitchSelection =' + topLayerSwitchSelection);
	}
	else
	{
		topLayerToggleArmed = false;
		return;
	}
}

function midLayerToggleEnabled(value, timeStamp) {
	if (midLayerToggleArmed == false)
	{
		midLayerToggleArmed = true;
		displayControlSwitchSelection += 1;
		if (displayControlSwitchSelection == 3)
			movementControlSwitchSelection = 2;
		else
			movementControlSwitchSelection = displayControlSwitchSelection;
		displayAllColor = new SFColor(1, 0, 0);
		if (topLayerSwitchSelection == 0)
		{
			topLayerSwitchSelection = 1;
			midLayerSwitchSelection = 1;
		}
		else
		{
			midLayerSwitchSelection = 2;
		}
		tracePrint('movementControlSwitchSelection =' + movementControlSwitchSelection);
		tracePrint('displayControlSwitchSelection =' + displayControlSwitchSelection);
		tracePrint('topLayerSwitchSelection =' + topLayerSwitchSelection);
		tracePrint('midLayerSwitchSelection =' + midLayerSwitchSelection);
	}
	else
	{
		midLayerToggleArmed = false;
		return;
	}
}

function bottomLayerToggleEnabled(value, timeStamp) {
	if (bottomLayerToggleArmed == false)
	{
		bottomLayerToggleArmed = true;
		displayControlSwitchSelection += 1;
		if (displayControlSwitchSelection == 3)
			movementControlSwitchSelection = 2;
		else
			movementControlSwitchSelection = displayControlSwitchSelection;
		displayAllColor = new SFColor(1, 0, 0);
		if (topLayerSwitchSelection == 0) //if top display animation mode selection
		{
			topLayerSwitchSelection = 1; //top display nothing
			midLayerSwitchSelection = 1; //mid display animation mode selection
			bottomLayerSwitchSelection = 2; //bottom display playback control buttons
		}
		else if (midLayerSwitchSelection == 0) //if mid display playback control buttons
		{
			//top display nothing implied
			midLayerSwitchSelection = 2; //mid display nothing
			bottomLayerSwitchSelection = 2; //bottom display playback control buttons
		}
		else if (midLayerSwitchSelection == 1) //if mid display animation mode selection
		{
			//top display nothing implied
			midLayerSwitchSelection = 2; //mid display nothing
			bottomLayerSwitchSelection = 1; //bottom display animation mode selection
		}
		else //if mid display nothing
		{
			//top display nothing implied
			//mid display nothing implied
			bottomLayerSwitchSelection = 3; //bottom display nothing
		}

		tracePrint('movementControlSwitchSelection =' + movementControlSwitchSelection);
		tracePrint('displayControlSwitchSelection =' + displayControlSwitchSelection);
		tracePrint('topLayerSwitchSelection =' + topLayerSwitchSelection);
		tracePrint('midLayerSwitchSelection =' + midLayerSwitchSelection);
		tracePrint('bottomLayerSwitchSelection =' + bottomLayerSwitchSelection);
	}
	else
	{
		bottomLayerToggleArmed = false;
		return;
	}
}
]]>
                </Script>
                <ROUTE fromField='isActive' fromNode='DisplayAllSensor' toField='displayAllToggleEnabled' toNode='DisplayLayerScript'/>
                <ROUTE fromField='isActive' fromNode='DisplayTopLayerSensor' toField='topLayerToggleEnabled' toNode='DisplayLayerScript'/>
                <ROUTE fromField='isActive' fromNode='DisplayMidLayerSensor' toField='midLayerToggleEnabled' toNode='DisplayLayerScript'/>
                <ROUTE fromField='isActive' fromNode='DisplayBottomLayerSensor' toField='bottomLayerToggleEnabled' toNode='DisplayLayerScript'/>
                <ROUTE fromField='movementControlSwitchSelection' fromNode='DisplayLayerScript' toField='whichChoice' toNode='MovementControlSwitch'/>
                <ROUTE fromField='displayControlSwitchSelection' fromNode='DisplayLayerScript' toField='whichChoice' toNode='DisplayControlSwitch'/>
                <ROUTE fromField='displayAllColor' fromNode='DisplayLayerScript' toField='diffuseColor' toNode='DisplayAllMaterial'/>
                <Switch DEF='TopLayerSwitch' whichChoice='0'>
                  <Transform DEF='DisplayDISModeTop' translation='2.86 0.58 0'>
                    <Transform DEF='DISModeButtons'>
                      <Shape DEF='GroupButtonBaseShape'>
                        <Appearance USE='ButtonBaseAppearance'/>
                        <Box size='5 0.6 0.05'/>
                      </Shape>
                      <Transform translation='-1.6 0 0'>
                        <TouchSensor DEF='MasterSensor' description='Master entity, send DIS PDU packets'/>
                        <Shape DEF='PushButton'>
                          <Appearance>
                            <Material DEF='MasterButtonMaterial' diffuseColor='0.9 0.9 0.9' transparency='1'/>
                          </Appearance>
                          <IndexedFaceSet DEF='DISModePushButton' ccw='false' coordIndex='0 1 2 3 0 -1' solid='false'>
                            <Coordinate point='-0.8 0.25 0.05 0.8 0.25 0.05 0.8 -0.25 0.05 -0.8 -0.25 0.05'/>
                          </IndexedFaceSet>
                        </Shape>
                        <Transform translation='0 0 0.15'>
                          <Shape>
                            <Appearance>
                              <Material DEF='MasterLabelMaterial'/>
                            </Appearance>
                            <Text string='"networkWriter"'>
                              <FontStyle DEF='LabelFont' justify='"MIDDLE" "MIDDLE"' size='0.2' style='BOLD'/>
                            </Text>
                          </Shape>
                        </Transform>
                      </Transform>
                      <Transform>
                        <TouchSensor DEF='RemoteSensor' description='Remote entity, read DIS PDU packets'/>
                        <Shape USE='PushButton'/>
                        <Transform translation='0.1 0 0.25'>
                          <Shape>
                            <Appearance>
                              <Material DEF='RemoteLabelMaterial'/>
                            </Appearance>
                            <Text string='"networkReader"'>
                              <FontStyle USE='LabelFont'/>
                            </Text>
                          </Shape>
                        </Transform>
                      </Transform>
                      <Transform translation='1.6 0 0'>
                        <TouchSensor DEF='LocalSensor' description='Local entity, no DIS traffic'/>
                        <Shape USE='PushButton'/>
                        <Transform translation='0 0 0.15'>
                          <Shape>
                            <Appearance>
                              <Material DEF='LocalLabelMaterial'/>
                            </Appearance>
                            <Text string='"standAlone"'>
                              <FontStyle USE='LabelFont'/>
                            </Text>
                          </Shape>
                        </Transform>
                      </Transform>
                      <Script DEF='DISModeScript'>
                        <field accessType='initializeOnly' name='description' type='SFString'/>
                        <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
                        <field accessType='initializeOnly' name='buttonColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='activeButtonColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='labelColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='activeLabelColor' type='SFColor'/>
                        <field accessType='inputOnly' name='masterToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='remoteToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='localToggleEnabled' type='SFBool'/>
                        <field accessType='outputOnly' name='masterButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='masterLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='remoteButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='remoteLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='localButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='localLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='isMaster' type='SFBool'/>
                        <field accessType='outputOnly' name='isRemote' type='SFBool'/>
                        <field accessType='outputOnly' name='isLocal' type='SFBool'/>
                        <field accessType='outputOnly' name='arePlaybackButtonsActive' type='SFBool'/>
                        <field accessType='outputOnly' name='playbackButtonLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='resetToStartEnabled' type='SFBool'/>
                        <IS>
                          <connect nodeField='description' protoField='description'/>
                          <connect nodeField='traceEnabled' protoField='traceEnabled'/>
                          <connect nodeField='buttonColor' protoField='buttonColor'/>
                          <connect nodeField='activeButtonColor' protoField='selectedButtonColor'/>
                          <connect nodeField='labelColor' protoField='labelColor'/>
                          <connect nodeField='activeLabelColor' protoField='selectedLabelColor'/>
                          <connect nodeField='isMaster' protoField='isMaster'/>
                          <connect nodeField='isRemote' protoField='isRemote'/>
                          <connect nodeField='isLocal' protoField='isLocal'/>
                        </IS>
                        <![CDATA[
ecmascript:

function tracePrint (text)
{
	if (traceEnabled) Browser.println ('[DvdController ' + description + ' DISModeScript] ' + text);
}

function initialize()
{
	masterButtonColor = buttonColor;
	remoteButtonColor = buttonColor;
	localButtonColor  = activeButtonColor;

	masterLabelColor = labelColor;
	remoteLabelColor = labelColor;
	localLabelColor  = activeLabelColor;

	isMaster = false;
	isRemote = false;
	isLocal  = true;
	arePlaybackButtonsActive = true;

	//set default mode
	localToggleEnabled(true, -1);
}

function masterToggleEnabled(value, timeStamp)
{
	masterButtonColor = activeButtonColor;
	remoteButtonColor = buttonColor;
	localButtonColor  = buttonColor;

	masterLabelColor = activeLabelColor;
	remoteLabelColor = labelColor;
	localLabelColor  = labelColor;

	isMaster = true;
	isRemote = false;
	isLocal  = false;

	if (!arePlaybackButtonsActive)
		playbackButtonLabelColor = labelColor;

	arePlaybackButtonsActive = true;
}

function remoteToggleEnabled(value, timeStamp)
{
	masterButtonColor = buttonColor;
	remoteButtonColor = activeButtonColor;
	localButtonColor  = buttonColor;

	masterLabelColor = labelColor;
	remoteLabelColor = activeLabelColor;
	localLabelColor  = labelColor;

	isMaster = false;
	isRemote = true;
	isLocal  = false;

	arePlaybackButtonsActive = false;
	playbackButtonLabelColor = labelColor;
	resetToStartEnabled = true;
}

function localToggleEnabled(value, timeStamp)
{
	masterButtonColor = buttonColor;
	remoteButtonColor = buttonColor;
	localButtonColor  = activeButtonColor;

	masterLabelColor = labelColor;
	remoteLabelColor = labelColor;
	localLabelColor  = activeLabelColor;

	isMaster = false;
	isRemote = false;
	isLocal  = true;

	if (!arePlaybackButtonsActive)
		playbackButtonLabelColor = labelColor;

	arePlaybackButtonsActive = true;
}
]]>
                      </Script>
                      <ROUTE fromField='masterButtonColor' fromNode='DISModeScript' toField='diffuseColor' toNode='MasterButtonMaterial'/>
                      <ROUTE fromField='masterLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='MasterLabelMaterial'/>
                      <ROUTE fromField='remoteLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='RemoteLabelMaterial'/>
                      <ROUTE fromField='localLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='LocalLabelMaterial'/>
                      <ROUTE fromField='isActive' fromNode='MasterSensor' toField='masterToggleEnabled' toNode='DISModeScript'/>
                      <ROUTE fromField='isActive' fromNode='RemoteSensor' toField='remoteToggleEnabled' toNode='DISModeScript'/>
                      <ROUTE fromField='isActive' fromNode='LocalSensor' toField='localToggleEnabled' toNode='DISModeScript'/>
                    </Transform>
                  </Transform>
                  <Transform DEF='DisplayNoneTop'/>
                </Switch>
                <ROUTE fromField='topLayerSwitchSelection' fromNode='DisplayLayerScript' toField='whichChoice' toNode='TopLayerSwitch'/>
                <Switch DEF='MidLayerSwitch' whichChoice='0'>
                  <Transform DEF='DisplayPlaybackButtonsMid' translation='2.86 0 0'>
                    <Transform DEF='PlaybackButtons'>
                      <Shape USE='GroupButtonBaseShape'/>
                      <Transform translation='-2.05 0 0'>
                        <TouchSensor DEF='ResetToStartSensor' description='reset clock to beginning'/>
                        <Transform DEF='InvisibleButtonBox' translation='0.03 0.02 0.1'>
                          <Shape>
                            <Appearance>
                              <Material transparency='1'/>
                            </Appearance>
                            <Box size='0.6 0.4 0.001'/>
                          </Shape>
                        </Transform>
                        <Shape>
                          <Appearance>
                            <Material DEF='ResetToStartButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet DEF='PlaybackButton' coordIndex='3 2 1 0 3 -1' solid='false'>
                            <Coordinate point='-0.375 0.25 0.05 0.375 0.25 0.05 0.375 -0.25 0.05 -0.375 -0.25 0.05'/>
                          </IndexedFaceSet>
                        </Shape>
                        <Transform>
                          <Transform translation='-0.12 0 0'>
                            <Shape>
                              <Appearance>
                                <Material DEF='ResetToStartLabelMaterial'/>
                              </Appearance>
                              <Box DEF='Bar' size='0.04 0.3 0.12'/>
                            </Shape>
                          </Transform>
                          <Transform translation='0.01 0 0'>
                            <Shape>
                              <Appearance>
                                <Material USE='ResetToStartLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet DEF='Triangle' coordIndex='0 1 2 -1'>
                                <Coordinate point='-0.15 0 0.051 0.15 -0.15 0.051 0.15 0.15 0.051'/>
                              </IndexedFaceSet>
                            </Shape>
                          </Transform>
                        </Transform>
                      </Transform>
                      <Transform translation='-1.36 0 0'>
                        <TouchSensor DEF='FastRewindSensor' description='fast rewind'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='FastRewindButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform>
                          <Transform translation='-0.15 0.0 0'>
                            <Shape>
                              <Appearance>
                                <Material DEF='FastRewindLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet USE='Triangle'/>
                            </Shape>
                          </Transform>
                          <Transform translation='0.1 0 0'>
                            <Shape>
                              <Appearance>
                                <Material USE='FastRewindLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet USE='Triangle'/>
                            </Shape>
                          </Transform>
                        </Transform>
                      </Transform>
                      <Transform translation='-0.68 0 0'>
                        <TouchSensor DEF='RewindSensor' description='rewind'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='RewindButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform>
                          <Shape>
                            <Appearance>
                              <Material DEF='RewindLabelMaterial'/>
                            </Appearance>
                            <IndexedFaceSet USE='Triangle'/>
                          </Shape>
                        </Transform>
                      </Transform>
                      <Transform>
                        <TouchSensor DEF='PauseSensor' description='pause'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='PauseButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform>
                          <Transform translation='-0.05 0 0'>
                            <Shape>
                              <Appearance>
                                <Material DEF='PauseLabelMaterial'/>
                              </Appearance>
                              <Box USE='Bar'/>
                            </Shape>
                          </Transform>
                          <Transform translation='0.085 0 0'>
                            <Shape>
                              <Appearance>
                                <Material USE='PauseLabelMaterial'/>
                              </Appearance>
                              <Box USE='Bar'/>
                            </Shape>
                          </Transform>
                        </Transform>
                      </Transform>
                      <Transform translation='0.68 0 0'>
                        <TouchSensor DEF='PlaySensor' description='play'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='PlayButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform rotation='0 0 1 3.14' translation='0.05 0 0'>
                          <Shape>
                            <Appearance>
                              <Material DEF='PlayLabelMaterial'/>
                            </Appearance>
                            <IndexedFaceSet USE='Triangle'/>
                          </Shape>
                        </Transform>
                      </Transform>
                      <Transform translation='1.36 0 0'>
                        <TouchSensor DEF='FastForwardSensor' description='fast forward'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='FastForwardButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform rotation='0 0 1 3.14'>
                          <Transform translation='-0.15 0 0'>
                            <Shape>
                              <Appearance>
                                <Material DEF='FastForwardLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet USE='Triangle'/>
                            </Shape>
                          </Transform>
                          <Transform translation='0.1 0 0'>
                            <Shape>
                              <Appearance>
                                <Material USE='FastForwardLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet USE='Triangle'/>
                            </Shape>
                          </Transform>
                        </Transform>
                      </Transform>
                      <Transform translation='2.05 0 0'>
                        <TouchSensor DEF='ResetToEndSensor' description='reset clock to end'/>
                        <Transform USE='InvisibleButtonBox'/>
                        <Shape>
                          <Appearance>
                            <Material DEF='ResetToEndButtonMaterial' transparency='0.9'/>
                          </Appearance>
                          <IndexedFaceSet USE='PlaybackButton'/>
                        </Shape>
                        <Transform>
                          <Transform rotation='0 0 1 3.14'>
                            <Shape>
                              <Appearance>
                                <Material DEF='ResetToEndLabelMaterial'/>
                              </Appearance>
                              <IndexedFaceSet USE='Triangle'/>
                            </Shape>
                          </Transform>
                          <Transform translation='0.12 0 0'>
                            <Shape>
                              <Appearance>
                                <Material USE='ResetToEndLabelMaterial'/>
                              </Appearance>
                              <Box USE='Bar'/>
                            </Shape>
                          </Transform>
                        </Transform>
                      </Transform>
                      <Script DEF='PlaybackControlScript'>
                        <field accessType='initializeOnly' name='description' type='SFString'/>
                        <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
                        <field accessType='initializeOnly' name='playEnabled' type='SFBool'/>
                        <field accessType='initializeOnly' name='buttonColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='activeButtonColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='labelColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='activeLabelColor' type='SFColor'/>
                        <field accessType='initializeOnly' name='isActive' type='SFBool' value='true'/>
                        <field accessType='inputOnly' name='setIsActive' type='SFBool'/>
                        <field accessType='initializeOnly' name='resetToStartToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='fastRewindToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='rewindToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='pauseToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='playToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='fastForwardToggleArmed' type='SFBool' value='false'/>
                        <field accessType='initializeOnly' name='resetToEndToggleArmed' type='SFBool' value='false'/>
                        <field accessType='inputOnly' name='resetToStartToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='fastRewindToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='rewindToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='pauseToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='playToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='fastForwardToggleEnabled' type='SFBool'/>
                        <field accessType='inputOnly' name='resetToEndToggleEnabled' type='SFBool'/>
                        <field accessType='outputOnly' name='resetToStartButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='resetToStartLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='fastRewindButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='fastRewindLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='rewindButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='rewindLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='pauseButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='pauseLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='playButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='playLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='fastForwardButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='fastForwardLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='resetToEndButtonColor' type='SFColor'/>
                        <field accessType='outputOnly' name='resetToEndLabelColor' type='SFColor'/>
                        <field accessType='outputOnly' name='isPaused' type='SFBool'/>
                        <field accessType='outputOnly' name='isRunning' type='SFBool'/>
                        <field accessType='outputOnly' name='resetToStartChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='fastRewindChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='rewindChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='pauseChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='playChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='fastForwardChanged' type='SFBool'/>
                        <field accessType='outputOnly' name='resetToEndChanged' type='SFBool'/>
                        <IS>
                          <connect nodeField='description' protoField='description'/>
                          <connect nodeField='traceEnabled' protoField='traceEnabled'/>
                          <connect nodeField='playEnabled' protoField='playEnabled'/>
                          <connect nodeField='buttonColor' protoField='buttonColor'/>
                          <connect nodeField='activeButtonColor' protoField='selectedButtonColor'/>
                          <connect nodeField='labelColor' protoField='labelColor'/>
                          <connect nodeField='activeLabelColor' protoField='selectedLabelColor'/>
                          <connect nodeField='isPaused' protoField='isPaused'/>
                          <connect nodeField='isRunning' protoField='isRunning'/>
                        </IS>
                        <![CDATA[
ecmascript:

function tracePrint (text)
{
	if (traceEnabled) Browser.println ('[DvdController ' + description + ' PlaybackControlScript] ' + text);
}
function TraceLabelColors ()
{
	if (traceEnabled == false) return;

	Browser.println ('	buttonColor=' + buttonColor.toString());
	Browser.println ('	activeButtonColor=' + activeButtonColor.toString());
	Browser.println ('	labelColor=' + labelColor.toString());
	Browser.println ('	activeLabelColor=' + activeLabelColor.toString());

	Browser.println ('	resetToStartLabelColor=' + resetToStartLabelColor.toString());
	Browser.println ('	fastRewindLabelColor=' + fastRewindLabelColor.toString());
	Browser.println ('	rewindLabelColor=' + rewindLabelColor.toString());
	Browser.println ('	pauseLabelColor=' + pauseLabelColor.toString());
	Browser.println ('	playLabelColor=' + playLabelColor.toString());
	Browser.println ('	fastForwardLabelColor=' + fastForwardLabelColor.toString());
	Browser.println ('	resetToEndLabelColor=' + resetToEndLabelColor.toString());
}
function initialize()
{
	tracePrint ('initialize() starting...');
	if (!playEnabled)
	{
		resetToStartButtonColor = buttonColor;
		fastRewindButtonColor   = buttonColor;
		rewindButtonColor       = buttonColor;
		pauseButtonColor        = activeButtonColor;
		playButtonColor         = buttonColor;
		fastForwardButtonColor  = buttonColor;
		resetToEndButtonColor   = buttonColor;

		resetToStartLabelColor  = labelColor;
		fastRewindLabelColor    = labelColor;
		rewindLabelColor        = labelColor;
		pauseLabelColor         = activeLabelColor;
		playLabelColor          = labelColor;
		fastForwardLabelColor   = labelColor;
		resetToEndLabelColor    = labelColor;

		isPaused = true;
		isRunning = false;
		TraceLabelColors ();
	}
	else //	playEnabled == true
	{
		playToggleEnabled(true, -1); // dummy timeStamp
		playToggleArmed = false;
	}
	tracePrint ('...initialize() complete');
}
function setIsActive(value, timeStamp)
{
	isActive = value;
}
function resetToStartToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('resetToStartToggleEnabled (' + value + ')' + ', resetToStartToggleArmed=' + resetToStartToggleArmed);

	if (!resetToStartToggleArmed)
	{
		resetToStartButtonColor = activeButtonColor;
		resetToStartLabelColor  = activeLabelColor;
		resetToStartToggleArmed = true;
		return;
	}
	isPaused  = true;
	isRunning = false;
	resetToStartChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = activeButtonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = activeLabelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}
function fastRewindToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('fastRewindToggleEnabled (' + value + ')' + ', fastRewindToggleArmed=' + fastRewindToggleArmed);

	if (fastRewindToggleArmed)
	{
		fastRewindToggleArmed = false;
		return;
	}
	isPaused  = true;
	isRunning = false;
	fastRewindChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = activeButtonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = activeLabelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}

function rewindToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('rewindToggleEnabled (' + value + ')' + ', rewindToggleArmed=' + rewindToggleArmed);

	if (rewindToggleArmed)
	{
		rewindToggleArmed = false;
		return;
	}
	isPaused  = true;
	isRunning = false;
	rewindChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = activeButtonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = activeLabelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}

function pauseToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('pauseToggleEnabled (' + value + ')' + ', pauseToggleArmed=' + pauseToggleArmed);

	if (pauseToggleArmed)
	{
		pauseToggleArmed = false;
		return;
	}
	isPaused  = true;
	isRunning = false;
	pauseChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = activeButtonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = activeLabelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}

function playToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('playToggleEnabled (' + value + ')' + ', pauseToggleArmed=' + playToggleArmed);

	if (playToggleArmed)
	{
		playToggleArmed = false;
		return;
	}
	isPaused  = false;
	isRunning = true;
	playChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = activeButtonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = activeLabelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}

function fastForwardToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('fastForwardToggleEnabled (' + value + ')' + ', fastForwardToggleArmed=' + fastForwardToggleArmed);

	if (fastForwardToggleArmed)
	{
		fastForwardToggleArmed = false;
		return;
	}
	isPaused  = false;
	isRunning = true;
	fastForwardChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = activeButtonColor;
	resetToEndButtonColor   = buttonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = activeLabelColor;
	resetToEndLabelColor   = labelColor;

	TraceLabelColors ();
}

function resetToEndToggleEnabled(value, timeStamp)
{
	if (value == false) return;
	tracePrint ('resetToEndToggleEnabled (' + value + ')' + ', resetToEndToggleArmed=' + resetToEndToggleArmed);

	if (!resetToEndToggleArmed)
	{
		resetToEndButtonColor = activeButtonColor;
		resetToEndLabelColor = activeLabelColor;
		resetToEndToggleArmed = true;
		return;
	}
	isPaused  = true;
	isRunning = false;
	resetToEndChanged = true;

	if (!isActive) return;

	resetToStartButtonColor = buttonColor;
	fastRewindButtonColor   = buttonColor;
	rewindButtonColor       = buttonColor;
	pauseButtonColor        = buttonColor;
	playButtonColor         = buttonColor;
	fastForwardButtonColor  = buttonColor;
	resetToEndButtonColor   = activeButtonColor;

	resetToStartLabelColor = labelColor;
	fastRewindLabelColor   = labelColor;
	rewindLabelColor       = labelColor;
	pauseLabelColor        = labelColor;
	playLabelColor         = labelColor;
	fastForwardLabelColor  = labelColor;
	resetToEndLabelColor   = activeLabelColor;

	TraceLabelColors ();
}
]]>
                      </Script>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='setIsActive' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='resetToStartEnabled' fromNode='DISModeScript' toField='resetToStartToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='ResetToStartLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='FastRewindLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='RewindLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='PauseLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='PlayLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='FastForwardLabelMaterial'/>
                      <ROUTE fromField='playbackButtonLabelColor' fromNode='DISModeScript' toField='diffuseColor' toNode='ResetToEndLabelMaterial'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='ResetToStartSensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='FastRewindSensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='RewindSensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='PauseSensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='PlaySensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='FastForwardSensor'/>
                      <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='enabled' toNode='ResetToEndSensor'/>
                      <ROUTE fromField='resetToStartButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='ResetToStartButtonMaterial'/>
                      <ROUTE fromField='resetToStartLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='ResetToStartLabelMaterial'/>
                      <ROUTE fromField='fastRewindButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='FastRewindButtonMaterial'/>
                      <ROUTE fromField='fastRewindLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='FastRewindLabelMaterial'/>
                      <ROUTE fromField='rewindButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='RewindButtonMaterial'/>
                      <ROUTE fromField='rewindLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='RewindLabelMaterial'/>
                      <ROUTE fromField='pauseButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='PauseButtonMaterial'/>
                      <ROUTE fromField='pauseLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='PauseLabelMaterial'/>
                      <ROUTE fromField='playButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='PlayButtonMaterial'/>
                      <ROUTE fromField='playLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='PlayLabelMaterial'/>
                      <ROUTE fromField='fastForwardButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='FastForwardButtonMaterial'/>
                      <ROUTE fromField='fastForwardLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='FastForwardLabelMaterial'/>
                      <ROUTE fromField='resetToEndButtonColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='ResetToEndButtonMaterial'/>
                      <ROUTE fromField='resetToEndLabelColor' fromNode='PlaybackControlScript' toField='diffuseColor' toNode='ResetToEndLabelMaterial'/>
                      <ROUTE fromField='isActive' fromNode='ResetToStartSensor' toField='resetToStartToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='FastRewindSensor' toField='fastRewindToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='RewindSensor' toField='rewindToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='PauseSensor' toField='pauseToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='PlaySensor' toField='playToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='FastForwardSensor' toField='fastForwardToggleEnabled' toNode='PlaybackControlScript'/>
                      <ROUTE fromField='isActive' fromNode='ResetToEndSensor' toField='resetToEndToggleEnabled' toNode='PlaybackControlScript'/>
                    </Transform>
                  </Transform>
                  <Transform DEF='DisplayDISModeMid' translation='2.86 0 0'>
                    <Transform USE='DISModeButtons'/>
                  </Transform>
                  <Transform DEF='DisplayNoneMid'/>
                </Switch>
                <ROUTE fromField='midLayerSwitchSelection' fromNode='DisplayLayerScript' toField='whichChoice' toNode='MidLayerSwitch'/>
                <Switch DEF='BottomLayerSwitch' whichChoice='0'>
                  <Transform DEF='DisplaySliderBottom' translation='2.86 -0.58 0'>
                    <Transform DEF='TimeScale'>
                      <Shape USE='GroupButtonBaseShape'/>
                      <Transform translation='0 -0.15 0'>
                        <ProtoInstance DEF='Slider' name='SliderFloat'>
                          <fieldValue name='layoutDirection' value='horizontal'/>
                          <fieldValue name='height' value='4.725'/>
                          <fieldValue name='radius' value='0.1'/>
                          <fieldValue name='barRadius' value='0.035'/>
                          <fieldValue name='min' value='0.0'/>
                          <fieldValue name='max' value='1.0'/>
                          <fieldValue name='value' value='0.0'/>
                          <fieldValue name='traceEnabled' value='true'/>
                        </ProtoInstance>
                      </Transform>
                      <Transform translation='0 0 0.05'>
                        <Transform translation='-1.4 0 0'>
                          <Shape>
                            <Appearance DEF='TimeLabelAppearance'>
                              <Material DEF='TimeLabelMaterial'>
                                <IS>
                                  <connect nodeField='diffuseColor' protoField='labelColor'/>
                                </IS>
                              </Material>
                            </Appearance>
                            <Text DEF='DurationText' string='"00h00m00s"'>
                              <FontStyle DEF='TimeLabelFont' size='0.2' style='ITALIC'/>
                            </Text>
                          </Shape>
                        </Transform>
                        <Transform translation='-2.4 0 0'>
                          <Shape>
                            <Appearance USE='TimeLabelAppearance'/>
                            <Text string='"duration:"'>
                              <FontStyle USE='TimeLabelFont'/>
                            </Text>
                          </Shape>
                        </Transform>
                        <Transform translation='0.0 0 0'>
                          <Shape>
                            <Appearance>
                              <Material USE='TimeLabelMaterial'/>
                            </Appearance>
                            <Text string='"elapsed:"'>
                              <FontStyle USE='TimeLabelFont'/>
                            </Text>
                          </Shape>
                        </Transform>
                        <Transform translation='0.9 0 0'>
                          <Shape>
                            <Appearance>
                              <Material USE='TimeLabelMaterial'/>
                            </Appearance>
                            <Text DEF='secondsElapsedText' string='"00h00m00s"'>
                              <FontStyle USE='TimeLabelFont'/>
                            </Text>
                          </Shape>
                        </Transform>
                        <Script DEF='TimeScaleScript'>
                          <field accessType='initializeOnly' name='description' type='SFString'/>
                          <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
                          <field accessType='inputOutput' name='duration' type='SFTime'/>
                          <field accessType='initializeOnly' name='secondsElapsed' type='SFTime' value='0'/>
                          <field accessType='inputOnly' name='setSecondsElapsed' type='SFTime'/>
                          <field accessType='outputOnly' name='durationOutput' type='MFString'/>
                          <field accessType='outputOnly' name='secondsElapsedOutput' type='MFString'/>
                          <IS>
                            <connect nodeField='description' protoField='description'/>
                            <connect nodeField='traceEnabled' protoField='traceEnabled'/>
                            <connect nodeField='duration' protoField='cycleInterval'/>
                          </IS>
                          <![CDATA[
ecmascript:

function tracePrint (text)
{
	if (traceEnabled) forcePrint (text);
}

function forcePrint (text)
{
	Browser.println ('[DvdController ' + description + ' TimeScaleScript] ' + text);
}

function initialize()
{
        tracePrint ('initialize duration:');
	set_duration(duration, -1); // dummy timeStamp
	secondsElapsedOutput = new MFString('00h00m00s');
}

function set_duration(value, timeStamp)
{
	duration = Math.floor(value);
        tracePrint ('set_cycleInterval value=' + value + ', duration=' + duration);
	durationOutput = new MFString(printTime(duration));
        forcePrint ('duration=' + durationOutput.toString());
}

function setSecondsElapsed(value, timeStamp)
{
	secondsElapsed = Math.floor(value);
	secondsElapsedOutput = new MFString(printTime(secondsElapsed));
        tracePrint ('secondsElapsedOutput=' + secondsElapsedOutput.toString());
}

function printTime(value)
{
	timeInSeconds = value;
	seconds = timeInSeconds % 60;
	minute = ((timeInSeconds - seconds) / 60) % 60;
	hour = (timeInSeconds - minute * 60 - seconds) / 3600;
	hStr = (hour    < 10 ? '0' + hour    : '' + hour);
	mStr = (minute  < 10 ? '0' + minute  : '' + minute);
	sStr = (seconds < 10 ? '0' + seconds : '' + seconds);
	timeString = new SFString( hStr + 'h' + mStr + 'm' + sStr + 's');
        tracePrint ('timeString=' + timeString.toString());
	return timeString;
}
]]>
                        </Script>
                        <ROUTE fromField='durationOutput' fromNode='TimeScaleScript' toField='string' toNode='DurationText'/>
                        <ROUTE fromField='secondsElapsedOutput' fromNode='TimeScaleScript' toField='string' toNode='secondsElapsedText'/>
                      </Transform>
                    </Transform>
                  </Transform>
                  <Transform DEF='DisplayDISModeBottom' translation='2.86 -0.58 0'>
                    <Transform USE='DISModeButtons'/>
                  </Transform>
                  <Transform DEF='DisplayPlaybackButtonsBottom' translation='2.86 -0.58 0'>
                    <Transform USE='PlaybackButtons'/>
                  </Transform>
                  <Transform DEF='DisplayNoneBottom'/>
                </Switch>
                <ROUTE fromField='bottomLayerSwitchSelection' fromNode='DisplayLayerScript' toField='whichChoice' toNode='BottomLayerSwitch'/>
              </Transform>
              <ROUTE fromField='translation_changed' fromNode='PlaneMovementSensor' toField='set_translation' toNode='MovableLocation'/>
              <ROUTE fromField='translationChanged' fromNode='VisibilityControlScript' toField='set_translation' toNode='MovableLocation'/>
              <ROUTE fromField='translationOffsetChanged' fromNode='VisibilityControlScript' toField='set_offset' toNode='PlaneMovementSensor'/>
            </Transform>
          </Transform>
          <ROUTE fromField='position_changed' fromNode='WhereSensor' toField='set_translation' toNode='FixedLocation'/>
          <ROUTE fromField='orientation_changed' fromNode='WhereSensor' toField='set_rotation' toNode='FixedLocation'/>
          <TimeSensor DEF='ForwardClock'/>
          <TimeSensor DEF='FastForwardClock'/>
          <TimeSensor DEF='RewindClock'/>
          <TimeSensor DEF='FastRewindClock'/>
          <TimeSensor DEF='SliderClock'/>
          <Script DEF='ClockScript'>
            <field accessType='initializeOnly' name='description' type='SFString'/>
            <field accessType='initializeOnly' name='traceEnabled' type='SFBool'/>
            <field accessType='initializeOnly' name='duration' type='SFTime'/>
            <field accessType='inputOnly' name='set_duration' type='SFTime'/>
            <field accessType='outputOnly' name='durationChanged' type='SFTime'/>
            <field accessType='outputOnly' name='forwardCycleInterval' type='SFTime'/>
            <field accessType='outputOnly' name='fastForwardCycleInterval' type='SFTime'/>
            <field accessType='outputOnly' name='rewindCycleInterval' type='SFTime'/>
            <field accessType='outputOnly' name='fastRewindCycleInterval' type='SFTime'/>
            <field accessType='outputOnly' name='sliderClockCycleInterval' type='SFTime'/>
            <field accessType='initializeOnly' name='speedFactor' type='SFFloat'/>
            <field accessType='initializeOnly' name='startTime' type='SFTime' value='-1'/>
            <field accessType='outputOnly' name='startTime_changed' type='SFTime'/>
            <field accessType='initializeOnly' name='stopTime' type='SFTime' value='-1'/>
            <field accessType='outputOnly' name='stopTime_changed' type='SFTime'/>
            <field accessType='outputOnly' name='rewindStartTime' type='SFTime'/>
            <field accessType='outputOnly' name='rewindStopTime' type='SFTime'/>
            <field accessType='outputOnly' name='fastForwardStartTime' type='SFTime'/>
            <field accessType='outputOnly' name='fastForwardStopTime' type='SFTime'/>
            <field accessType='outputOnly' name='fastRewindStartTime' type='SFTime'/>
            <field accessType='outputOnly' name='fastRewindStopTime' type='SFTime'/>
            <field accessType='outputOnly' name='sliderClockStartTime' type='SFTime'/>
            <field accessType='outputOnly' name='sliderClockStopTime' type='SFTime'/>
            <field accessType='initializeOnly' name='time' type='SFTime' value='-1'/>
            <field accessType='inputOnly' name='setTime' type='SFTime'/>
            <field accessType='outputOnly' name='time_changed' type='SFTime'/>
            <field accessType='initializeOnly' name='isClockActive' type='SFBool' value='false'/>
            <field accessType='inputOnly' name='setIsClockActive' type='SFBool'/>
            <field accessType='outputOnly' name='isClockActiveChanged' type='SFBool'/>
            <field accessType='outputOnly' name='secondsElapsed' type='SFTime'/>
            <field accessType='initializeOnly' name='fraction' type='SFFloat' value='0'/>
            <field accessType='inputOnly' name='setFraction' type='SFFloat'/>
            <field accessType='inputOnly' name='setFastForwardFraction' type='SFFloat'/>
            <field accessType='inputOnly' name='setRewindFraction' type='SFFloat'/>
            <field accessType='inputOnly' name='setFastRewindFraction' type='SFFloat'/>
            <field accessType='inputOnly' name='setSliderDragFraction' type='SFFloat'/>
            <field accessType='inputOnly' name='setSliderClockFraction' type='SFFloat'/>
            <field accessType='outputOnly' name='fraction_changed' type='SFFloat'/>
            <field accessType='outputOnly' name='isResetToStart' type='SFBool'/>
            <field accessType='inputOnly' name='setResetToStart' type='SFBool'/>
            <field accessType='outputOnly' name='isFastRewind' type='SFBool'/>
            <field accessType='inputOnly' name='setFastRewind' type='SFBool'/>
            <field accessType='outputOnly' name='isRewinding' type='SFBool'/>
            <field accessType='inputOnly' name='setRewind' type='SFBool'/>
            <field accessType='inputOnly' name='setPaused' type='SFBool'/>
            <field accessType='outputOnly' name='isPlaying' type='SFBool'/>
            <field accessType='inputOnly' name='setPlay' type='SFBool'/>
            <field accessType='outputOnly' name='isFastForward' type='SFBool'/>
            <field accessType='inputOnly' name='setFastForward' type='SFBool'/>
            <field accessType='outputOnly' name='isResetToEnd' type='SFBool'/>
            <field accessType='inputOnly' name='setResetToEnd' type='SFBool'/>
            <field accessType='outputOnly' name='sliderClockEnabled' type='SFBool'/>
            <field accessType='initializeOnly' name='sliderDragArmed' type='SFBool' value='false'/>
            <field accessType='inputOnly' name='setSliderDragged' type='SFBool'/>
            <field accessType='initializeOnly' name='pauseTime' type='SFTime' value='-1'/>
            <field accessType='initializeOnly' name='activateButtonColor' type='SFColor'/>
            <field accessType='initializeOnly' name='activateLabelColor' type='SFColor'/>
            <field accessType='initializeOnly' name='deactivateButtonColor' type='SFColor'/>
            <field accessType='initializeOnly' name='arePlaybackButtonsActive' type='SFBool' value='true'/>
            <field accessType='inputOnly' name='setarePlaybackButtonsActive' type='SFBool'/>
            <field accessType='outputOnly' name='deactivateButtonColorChanged' type='SFColor'/>
            <field accessType='initializeOnly' name='deactivateLabelColor' type='SFColor'/>
            <field accessType='outputOnly' name='deactivateLabelColorChanged' type='SFColor'/>
            <field accessType='outputOnly' name='playButtonActivateColorChanged' type='SFColor'/>
            <field accessType='outputOnly' name='playLabelActivateColorChanged' type='SFColor'/>
            <field accessType='outputOnly' name='rewindButtonActivateColorChanged' type='SFColor'/>
            <field accessType='outputOnly' name='rewindLabelActivateColorChanged' type='SFColor'/>
            <field accessType='initializeOnly' name='rewindStart_fraction' type='SFFloat' value='0'/>
            <field accessType='initializeOnly' name='fastRewindStart_fraction' type='SFFloat' value='0'/>
            <field accessType='initializeOnly' name='sliderClockStart_fraction' type='SFFloat' value='0'/>
            <field accessType='initializeOnly' name='fastRewind_level' type='SFFloat' value='0'/>
            <field accessType='initializeOnly' name='fastForward_level' type='SFFloat' value='0'/>
            <field accessType='initializeOnly' name='preDrag_fraction' type='SFFloat' value='0'/>
            <IS>
              <connect nodeField='description' protoField='description'/>
              <connect nodeField='traceEnabled' protoField='traceEnabled'/>
              <connect nodeField='deactivateButtonColor' protoField='buttonColor'/>
              <connect nodeField='activateButtonColor' protoField='selectedButtonColor'/>
              <connect nodeField='deactivateLabelColor' protoField='labelColor'/>
              <connect nodeField='activateLabelColor' protoField='selectedLabelColor'/>
              <connect nodeField='duration' protoField='cycleInterval'/>
              <connect nodeField='set_duration' protoField='set_cycleInterval'/>
              <connect nodeField='durationChanged' protoField='cycleInterval_changed'/>
              <connect nodeField='speedFactor' protoField='speedFactor'/>
              <connect nodeField='isClockActiveChanged' protoField='isActive'/>
              <connect nodeField='startTime_changed' protoField='startTime_changed'/>
              <connect nodeField='stopTime_changed' protoField='stopTime_changed'/>
              <connect nodeField='time_changed' protoField='time_changed'/>
              <connect nodeField='fraction_changed' protoField='fraction_changed'/>
              <connect nodeField='secondsElapsed' protoField='secondsElapsed'/>
            </IS>
            <![CDATA[
ecmascript:

function tracePrint (text)
{
	if (traceEnabled) Browser.println ('[DvdController ' + description + ' ClockScript] ' + text);
}
function alwaysPrint(output)
{
	Browser.println ('[DvdController ' + description + ' ClockScript] ' + output);
}

function initialize()
{
	isResetToStart = false;
	isFastRewind = false;
	isRewinding = false;
	isPlaying = false;
	isFastForward = false;
	isResetToEnd = false;

	durationChanged = duration;
	forwardCycleInterval = duration;
	fastForwardCycleInterval = duration;
	rewindCycleInterval = duration;
	fastRewindCycleInterval = duration;
	sliderClockCycleInterval = duration;

	fraction = 0;
	fastRewind_level = 0;
	fastForward_level = 0;
	sliderClockStart_fraction = 0;
}

function set_duration(value, timeStamp)
{
	duration = value;
	durationChanged = value;
	forwardCycleInterval = duration;
	fastForwardCycleInterval = duration;
	rewindCycleInterval = duration;
	fastRewindCycleInterval = duration;
	sliderClockCycleInterval = duration;
	alwaysPrint ('set_duration (' + duration + ') complete');
}

function setarePlaybackButtonsActive(value, timeStamp)
{
	arePlaybackButtonsActive = value;
	tracePrint('arePlaybackButtonsActive=' + arePlaybackButtonsActive);
}

function setIsClockActive(value, timeStamp)
{
	isClockActive = isClockActiveChanged = value;
	tracePrint('isClockActive=' + isClockActive);
}

function setResetToStart(value, timeStamp)
{
	tracePrint('setResetToStart(' + value + ')');
	isResetToStart = true;

	//Stop all clocks
	isPlaying = false;
	isRewinding = false;
	isFastForward = false;
	isFastRewind = false;
	sliderClockEnabled = false;

	fraction = fraction_changed = 0.0;
	secondsElapsed = 0.0;
	startTime = startTime_changed = timeStamp;
	stopTime = stopTime_changed = startTime + duration;
	deactivateButtonColorChanged = deactivateButtonColor;

	if (!arePlaybackButtonsActive)
		return;

	deactivateLabelColorChanged = deactivateLabelColor;
}

function setFastRewind(value, timeStamp)
{
	tracePrint('setFastRewind(' + value + ')');
	if (!isFastRewind)
		fastRewindStart_fraction = fraction;

	isFastRewind = true;
	isPlaying = false;
	isRewinding = false;
	isFastForward = false;
	sliderClockEnabled = false;

	if (fastRewind_level < 1)
	{
		++fastRewind_level;
		fastRewindCycleInterval = duration / (speedFactor * fastRewind_level);
	}

	if (fraction == 0) //start reached
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged = deactivateLabelColor;
		return;
	}

	fastRewindStartTime = timeStamp;
	fastRewindStopTime = fastRewindStartTime + secondsElapsed / (speedFactor * fastRewind_level);

	startTime = startTime_changed = fastRewindStopTime;
}

function setRewind(value, timeStamp)
{
	tracePrint('setRewind(' + value + ')');
	if (!isRewinding)
		rewindStart_fraction = fraction;

	isRewinding = true;
	isPlaying = false;
	isFastForward = false;
	isFastRewind = false;
	sliderClockEnabled = false;

	fastRewind_level = 0;  //reset
	rewindCycleInterval = duration;

	if (fraction == 0)  //start reached
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged = deactivateLabelColor;
		return;
	}

	rewindStartTime = timeStamp;
	rewindStopTime = rewindStartTime + secondsElapsed;

	startTime = startTime_changed = rewindStopTime;
}

function setPaused(value, timeStamp)
{
	tracePrint('setPaused(' + value + ')');
	if (value == true)
	{
		now = new Date();
		pauseTime = now.getTime() / 1000.0;

		isFastRewind = false;
		isRewinding = false;
		isPlaying = false;
		isFastForward = false;
		sliderClockEnabled = false;
	}
}

function setPlay(value, timeStamp)
{
	tracePrint('setPlay(' + value + ')');
	isPlaying = true;
	isRewinding = false;
	isFastForward = false;
	isFastRewind = false;
	sliderClockEnabled = false;

	fastRewind_level = 0; //reset fast rewind
	forwardCycleInterval = duration;

	if (fraction == 0 || fraction == 1)  //start or restart from beginning
	{
		startTime = startTime_changed = timeStamp;
		stopTime = stopTime_changed = startTime + duration;
	}
	else
	{
		startTime = startTime_changed = timeStamp - secondsElapsed;
		stopTime = stopTime_changed = startTime + duration;
	}
}

function setFastForward(value, timeStamp)
{
	tracePrint('setFastForward(' + value + ')');
	isFastForward = true;
	isPlaying = false;
	isRewinding = false;
	isFastRewind = false;
	sliderClockEnabled = false;

	if (fastForward_level < 1)
	{
		++fastForward_level;
		fastForwardCycleInterval = duration / (speedFactor * fastForward_level);
	}

	fastForwardStartTime = timeStamp - secondsElapsed / (speedFactor * fastForward_level);
	fastForwardStopTime = fastForwardStartTime + duration / (speedFactor * fastForward_level);

	startTime = startTime_changed = fastForwardStartTime;
}

function setResetToEnd(value, timeStamp)
{
	tracePrint('setResetToEnd(' + value + ')');
	isResetToEnd = true;

	//Stop all clocks
	isPlaying = false;
	isRewinding = false;
	isFastForward = false;
	isFastRewind = false;
	sliderClockEnabled = false;

	fraction = fraction_changed = 1.0;
	secondsElapsed = duration;

	stopTime = stopTime_changed = timeStamp;
	startTime = startTime_changed = stopTime - duration;
	deactivateButtonColorChanged = deactivateButtonColor;
	deactivateLabelColorChanged = deactivateLabelColor;
}

function setFraction(value, timeStamp)
{
	if (isRewinding || isFastForward || isFastRewind || sliderClockEnabled || sliderDragArmed)
        {
//              tracePrint('setFraction immediate return..');
		return;
        }
//	tracePrint('setFraction(' + value + ')');

	if (isResetToStart)
	{
                tracePrint('setFraction isResetToStart=true, reset..');
		isResetToStart = false; //reset
		return;
	}
	else if (isResetToEnd)
	{
                tracePrint('setFraction isResetToEnd=true, reset..');
		isResetToEnd = false; //reset
		return;
	}

	fraction = fraction_changed = value;
        tracePrint('fraction_changed=' + fraction_changed);

	if (fraction >= 1) //end reached
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged = deactivateLabelColor;
		fraction = fraction_changed = 1.0;
	}
}

function setFastForwardFraction(value, timeStamp)
{
	tracePrint('setFastForwardFraction(' + value + ')');
	if (isPlaying || isFastRewind || isRewinding || sliderClockEnabled || sliderDragArmed)
		return;

	if (isResetToStart)
	{
		isResetToStart = false; //reset
		return;
	}
	else if (isResetToEnd)
	{
		isResetToEnd = false; //reset
		return;
	}

	fraction = fraction_changed = value;

	if (fraction >= 1) //end reached
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged = deactivateLabelColor;
		isFastForward = false;
		fraction = fraction_changed = 1.0;
		secondsElapsed = duration;
	}
}

function setRewindFraction(value, timeStamp)
{
	tracePrint('setRewindFraction(' + value + ')');
	if (isPlaying || isFastForward || isFastRewind || sliderClockEnabled || sliderDragArmed)
		return;

	if (isResetToStart)
	{
		isResetToStart = false; //reset
		return;
	}
	else if (isResetToEnd)
	{
		isResetToEnd = false; //reset
		return;
	}

	fraction = fraction_changed = 1 - value - (1 - rewindStart_fraction);

	if (fraction <= 0.0000001) //start reached - rounded off
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged  = deactivateLabelColor;
		isRewinding = false;
		fraction = fraction_changed = 0.0;
		secondsElapsed = 0.0;
	}
}

function setFastRewindFraction(value, timeStamp)
{
	tracePrint('setFastRewindFraction(' + value + ')');
	if (isPlaying || isFastForward || isRewinding || sliderClockEnabled || sliderDragArmed)
		return;

	if (isResetToStart)
	{
		isResetToStart = false; //reset
		return;
	}
	else if (isResetToEnd)
	{
		isResetToEnd = false; //reset
		return;
	}

	fraction = fraction_changed = 1 - value - (1 - fastRewindStart_fraction);

	if (fraction <= 0.0000001) //start reached - rounded off
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged  = deactivateLabelColor;
		isFastRewind = false;
		fraction = fraction_changed = 0.0;
		fastRewindStart_fraction = -1; //reset
		secondsElapsed = 0.0;
	}
}

function setTime(value, timeStamp)
{
	// Check if pause option is selected
	if (!isPlaying && !isRewinding && !isFastForward && !isFastRewind && !sliderClockEnabled)
        {
                tracePrint('setTime(' + value + ') immediate return');
		return;
        }
	tracePrint('setTime(' + value + ')');

	time = time_changed = value; // time_changed is output event via IS/connect
	secondsElapsed = Math.abs(value - startTime);
        tracePrint ('time=' + time + ', secondsElapsed=' + secondsElapsed);
	if (isFastRewind)
		secondsElapsed = secondsElapsed * (speedFactor * fastRewind_level);
	else if (isFastForward)
		secondsElapsed = secondsElapsed * (speedFactor * fastForward_level);
	if (fraction == 0)
		secondsElapsed = 0.0;
	else if (fraction == 1)
		secondsElapsed = duration;
}

function setSliderDragged(value, timeStamp)
{
	if (value == true) //Drag started
	{
                tracePrint ('Drag started');
		preDrag_fraction = fraction;
		sliderDragArmed = true;

		isPlaying = false;
		isRewinding = false;
		isFastForward = false;
		isFastRewind = false;
		sliderClockEnabled = false;
	}
	else //Drag finished
	{
                tracePrint ('Drag finished');
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged  = deactivateLabelColor;
		sliderDragArmed = false;

		secondsElapsed = duration * fraction;

		sliderClockEnabled = true;
		if (fraction == 0 || fraction == 1) //start or end reached
			return;

		sliderClockCycleInterval = duration;
		if (fraction >= preDrag_fraction) //play
		{
			drag_forward = true;
			drag_backward = false;
			sliderClockStartTime = timeStamp - secondsElapsed;
			sliderClockStopTime = sliderClockStartTime + duration;
			startTime = startTime_changed = sliderClockStartTime;
			playButtonActivateColorChanged = activateButtonColor;
			playLabelActivateColorChanged  = activateLabelColor;
		}
		else if (fraction < preDrag_fraction) //rewind
		{
			drag_forward = false;
			drag_backward = true;
			sliderClockStartTime = timeStamp;
			sliderClockStopTime = timeStamp + secondsElapsed;
			startTime = startTime_changed = sliderClockStopTime;
			rewindButtonActivateColorChanged = activateButtonColor;
			rewindLabelActivateColorChanged  = activateLabelColor;
	}

		sliderClockStart_fraction = fraction;
	}
}

function setSliderDragFraction(value, timeStamp)
{
	if (isPlaying || isRewinding || isFastForward || isFastRewind || sliderClockEnabled)
        {
//              tracePrint('setSliderDragFraction immediate return');
		return;
        }
	tracePrint('setSliderDragFraction(' + value + ')');

	if (sliderDragArmed)
		fraction = fraction_changed = value;
}

function setSliderClockFraction(value, timeStamp)
{
	if (isPlaying || isRewinding || isFastForward || isFastRewind)
        {
//              tracePrint('setSliderClockFraction immediate return');
		return;
        }
	tracePrint('setSliderClockFraction(' + value + ')');

	if (isResetToStart)
	{
		isResetToStart = false; //reset
		return;
	}
	else if (isResetToEnd)
	{
		isResetToEnd = false; //reset
		return;
	}

	if (drag_forward)
		fraction = fraction_changed = value;
	else if (drag_backward)
		fraction = fraction_changed = 1 - value - (1 - sliderClockStart_fraction);

	if (fraction <= 0.0000001)
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged  = deactivateLabelColor;
		sliderClockEnabled = false;
		fraction = fraction_changed = 0.0;
		secondsElapsed = 0.0;
	}
	else if (fraction >= 1)
	{
		deactivateButtonColorChanged = deactivateButtonColor;
		deactivateLabelColorChanged  = deactivateLabelColor;
		sliderClockEnabled = false;
		fraction = fraction_changed = 1.0;
		secondsElapsed = duration;
	}
}
]]>
          </Script>
          <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='setarePlaybackButtonsActive' toNode='ClockScript'/>
          <!-- TODO use or remove <ROUTE fromField='arePlaybackButtonsActive' fromNode='DISModeScript' toField='setDragEnabled' toNode='Slider'/> -->
          <ROUTE fromField='resetToStartChanged' fromNode='PlaybackControlScript' toField='setResetToStart' toNode='ClockScript'/>
          <ROUTE fromField='fastRewindChanged' fromNode='PlaybackControlScript' toField='setFastRewind' toNode='ClockScript'/>
          <ROUTE fromField='rewindChanged' fromNode='PlaybackControlScript' toField='setRewind' toNode='ClockScript'/>
          <ROUTE fromField='pauseChanged' fromNode='PlaybackControlScript' toField='setPaused' toNode='ClockScript'/>
          <ROUTE fromField='playChanged' fromNode='PlaybackControlScript' toField='setPlay' toNode='ClockScript'/>
          <ROUTE fromField='fastForwardChanged' fromNode='PlaybackControlScript' toField='setFastForward' toNode='ClockScript'/>
          <ROUTE fromField='resetToEndChanged' fromNode='PlaybackControlScript' toField='setResetToEnd' toNode='ClockScript'/>
          <ROUTE fromField='isActive' fromNode='ForwardClock' toField='setIsClockActive' toNode='ClockScript'/>
          <ROUTE fromField='fraction_changed' fromNode='ForwardClock' toField='setFraction' toNode='ClockScript'/>
          <ROUTE fromField='time' fromNode='ForwardClock' toField='setTime' toNode='ClockScript'/>
          <ROUTE fromField='isActive' fromNode='RewindClock' toField='setIsClockActive' toNode='ClockScript'/>
          <ROUTE fromField='fraction_changed' fromNode='RewindClock' toField='setRewindFraction' toNode='ClockScript'/>
          <ROUTE fromField='time' fromNode='RewindClock' toField='setTime' toNode='ClockScript'/>
          <ROUTE fromField='isActive' fromNode='FastForwardClock' toField='setIsClockActive' toNode='ClockScript'/>
          <ROUTE fromField='fraction_changed' fromNode='FastForwardClock' toField='setFastForwardFraction' toNode='ClockScript'/>
          <ROUTE fromField='time' fromNode='FastForwardClock' toField='setTime' toNode='ClockScript'/>
          <ROUTE fromField='isActive' fromNode='FastRewindClock' toField='setIsClockActive' toNode='ClockScript'/>
          <ROUTE fromField='fraction_changed' fromNode='FastRewindClock' toField='setFastRewindFraction' toNode='ClockScript'/>
          <ROUTE fromField='time' fromNode='FastRewindClock' toField='setTime' toNode='ClockScript'/>
          <ROUTE fromField='isActive' fromNode='SliderClock' toField='setIsClockActive' toNode='ClockScript'/>
          <ROUTE fromField='fraction_changed' fromNode='SliderClock' toField='setSliderClockFraction' toNode='ClockScript'/>
          <ROUTE fromField='time' fromNode='SliderClock' toField='setTime' toNode='ClockScript'/>
          <ROUTE fromField='isPlaying' fromNode='ClockScript' toField='set_enabled' toNode='ForwardClock'/>
          <ROUTE fromField='isRewinding' fromNode='ClockScript' toField='set_enabled' toNode='RewindClock'/>
          <ROUTE fromField='isFastForward' fromNode='ClockScript' toField='set_enabled' toNode='FastForwardClock'/>
          <ROUTE fromField='isFastRewind' fromNode='ClockScript' toField='set_enabled' toNode='FastRewindClock'/>
          <ROUTE fromField='sliderClockEnabled' fromNode='ClockScript' toField='set_enabled' toNode='SliderClock'/>
          <ROUTE fromField='forwardCycleInterval' fromNode='ClockScript' toField='set_cycleInterval' toNode='ForwardClock'/>
          <ROUTE fromField='rewindCycleInterval' fromNode='ClockScript' toField='set_cycleInterval' toNode='RewindClock'/>
          <ROUTE fromField='fastForwardCycleInterval' fromNode='ClockScript' toField='set_cycleInterval' toNode='FastForwardClock'/>
          <ROUTE fromField='fastRewindCycleInterval' fromNode='ClockScript' toField='set_cycleInterval' toNode='FastRewindClock'/>
          <ROUTE fromField='sliderClockCycleInterval' fromNode='ClockScript' toField='set_cycleInterval' toNode='SliderClock'/>
          <ROUTE fromField='startTime_changed' fromNode='ClockScript' toField='set_startTime' toNode='ForwardClock'/>
          <ROUTE fromField='stopTime_changed' fromNode='ClockScript' toField='set_stopTime' toNode='ForwardClock'/>
          <ROUTE fromField='rewindStartTime' fromNode='ClockScript' toField='set_startTime' toNode='RewindClock'/>
          <ROUTE fromField='rewindStopTime' fromNode='ClockScript' toField='set_stopTime' toNode='RewindClock'/>
          <ROUTE fromField='fastForwardStartTime' fromNode='ClockScript' toField='set_startTime' toNode='FastForwardClock'/>
          <ROUTE fromField='fastForwardStopTime' fromNode='ClockScript' toField='set_stopTime' toNode='FastForwardClock'/>
          <ROUTE fromField='fastRewindStartTime' fromNode='ClockScript' toField='set_startTime' toNode='FastRewindClock'/>
          <ROUTE fromField='fastRewindStopTime' fromNode='ClockScript' toField='set_stopTime' toNode='FastRewindClock'/>
          <ROUTE fromField='sliderClockStartTime' fromNode='ClockScript' toField='set_startTime' toNode='SliderClock'/>
          <ROUTE fromField='sliderClockStopTime' fromNode='ClockScript' toField='set_stopTime' toNode='SliderClock'/>
          <ROUTE fromField='fraction_changed' fromNode='ClockScript' toField='setValue' toNode='Slider'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='ResetToStartButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='ResetToStartLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='FastRewindButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='FastRewindLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='RewindButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='RewindLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PauseButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PauseLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PlayButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PlayLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='FastForwardButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='FastForwardLabelMaterial'/>
          <ROUTE fromField='deactivateButtonColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='ResetToEndButtonMaterial'/>
          <ROUTE fromField='deactivateLabelColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='ResetToEndLabelMaterial'/>
          <ROUTE fromField='playButtonActivateColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PlayButtonMaterial'/>
          <ROUTE fromField='playLabelActivateColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='PlayLabelMaterial'/>
          <ROUTE fromField='rewindButtonActivateColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='RewindButtonMaterial'/>
          <ROUTE fromField='rewindLabelActivateColorChanged' fromNode='ClockScript' toField='diffuseColor' toNode='RewindLabelMaterial'/>
          <ROUTE fromField='valueChanged' fromNode='Slider' toField='setSliderDragFraction' toNode='ClockScript'/>
          <!-- fix or omit <ROUTE fromField='isDragged' fromNode='Slider' toField='setSliderDragged' toNode='ClockScript'/> -->
          <ROUTE fromField='secondsElapsed' fromNode='ClockScript' toField='setSecondsElapsed' toNode='TimeScaleScript'/>
        </Transform>
      </ProtoBody>
    </ProtoDeclare>
    <!-- ==================== -->
    <Anchor description='DvdController Example' url='"DvdControllerExample.x3d" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerExample.x3d" "DvdControllerExample.wrl" "https://www.web3d.org/x3d/content/examples/Savage/Tools/HeadsUpDisplays/DvdControllerExample.wrl"'>
      <Shape>
        <Appearance>
          <Material diffuseColor='0 1 1' emissiveColor='0 1 1'/>
        </Appearance>
        <Text string='"DvdControllerPrototype" "is a Prototype definition file." "" "To see an example scene" "select this text and view" "DvdControllerExample"'>
          <FontStyle justify='"MIDDLE" "MIDDLE"' size='0.8'/>
        </Text>
      </Shape>
    </Anchor>
  </Scene>
</X3D>