<?xml version="1.0"?> 
<!--
   The contents of this file are subject to the Netscape Public
   License Version 1.1 (the "License"); you may not use this file
   except in compliance with the License. You may obtain a copy of
   the License at http://www.mozilla.org/NPL/
    
   Software distributed under the License is distributed on an "AS
   IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
   implied. See the License for the specific language governing
   rights and limitations under the License.
    
   The Original Code is Mozilla Communicator client code, released
   March 31, 1998.
   
   The Initial Developer of the Original Code is Netscape
   Communications Corporation. Portions created by Netscape are
   Copyright (C) 1998-1999 Netscape Communications Corporation. All
   Rights Reserved.
   
   Contributor(s): 
  bryner@uiuc.edu
  sspitzer@netscape.com
  -->

<?xml-stylesheet href="chrome://communicator/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://communicator/skin/dialogOverlay.css" type="text/css"?>
  

<!DOCTYPE window [
<!ENTITY % platformDTD SYSTEM "chrome://global-platform/locale/platformDialogOverlay.dtd" >
%platformDTD;
<!ENTITY % prefMousewheelDTD SYSTEM "chrome://communicator/locale/pref/pref-mousewheel.dtd" >
%prefMousewheelDTD;
]>

<window xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    class="color-dialog"
    onload="parent.initPanel('chrome://communicator/content/pref/pref-mousewheel.xul');"
    orient="vertical">

  <script type="application/x-javascript">
  <![CDATA[
  var _elementIDs = ["mousewheelWithNoKeyAction", "mousewheelWithNoKeyNumlines", "mousewheelWithNoKeySysNumlines", 
                     "mousewheelWithAltKeyAction", "mousewheelWithAltKeyNumlines", "mousewheelWithAltKeySysNumlines", 
                     "mousewheelWithCtrlKeyAction", "mousewheelWithCtrlKeyNumlines", "mousewheelWithCtrlKeySysNumlines", 
                     "mousewheelWithShiftKeyAction", "mousewheelWithShiftKeyNumlines", "mousewheelWithShiftKeySysNumlines"]; 
   
  function switchPage( aElement )
  {
    var deck = document.getElementById( "modifierDeck" );
    deck.setAttribute( "index", aElement.selectedItem.value );
  }
  
  function doEnableElement( aEventTarget, aElementID )
  {
    var aElement = document.getElementById( aElementID );
    if( aEventTarget.checked == true )
      aElement.setAttribute( "disabled", "true" );
    else
      aElement.removeAttribute( "disabled" );
  }
  
  function Startup()
  {
    var fields = ["mousewheelWithNoKeyNumlines", "mousewheelWithAltKeyNumlines", "mousewheelWithCtrlKeyNumlines", "mousewheelWithShiftKeyNumlines"];
    var checkboxes = ["mousewheelWithNoKeySysNumlines", "mousewheelWithAltKeySysNumlines", "mousewheelWithCtrlKeySysNumlines", "mousewheelWithShiftKeySysNumlines"];
    for( var i = 0; i < checkboxes.length; i++ )
    {
      var currEl = document.getElementById( checkboxes[i] );
      doEnableElement( currEl, fields[i] );
    }
  }  
  
   function enableField(aCheckbox, aNodeID) 
   { 
     var el = document.getElementById(aNodeID); 
     if (aCheckbox.checked) 
       el.setAttribute("disabled", "true"); 
     else 
       el.removeAttribute("disabled"); 
   } 

  ]]>
  </script>

  <box class="box-smallheader" title="&title.label;"/>

    <box orient="vertical">
      <box valign="bottom" autostretch="never">
        <box orient="vertical">
          <text class="label" value="&mouseWheelPanel.label;" accesskey="&mouseWheelPanel.accesskey;" 
                for="mouseWheelMode"/>
        </box>
      </box>
    </box>

    <separator class="thin"/>
  
    <titledbox orient="vertical">
      <label>
        <box> 
          <menulist id="mouseWheelMode" oncommand="switchPage(this);"
            pref="true" preftype="bool" prefstring="pref.mousewheel.disable_button.modifier" prefattribute="disabled">
            <menupopup>
              <menuitem value="0" label="&usingJustTheWheel.label;"/>
              <menuitem value="1" label="&usingWheelAndAlt.label;"/>
              <menuitem value="2" label="&usingWheelAndCtrl.label;"/>
              <menuitem value="3" label="&usingWheelAndShft.label;"/>
            </menupopup>
          </menulist>
        </box>
      </label>


    <deck id="modifierDeck" class="indent">
      
      <!-- no key modifiers -->
      <radiogroup id="mousewheelWithNoKeyAction" orient="vertical" autostretch="never"
                  pref="true" preftype="int" prefstring="mousewheel.withnokey.action" 
                  prefattribute="value">
        <box autostretch="never" valign="top">
          <radio group="mousewheelWithNoKeyAction" value="0" label="&scroll.label;" accesskey="&scroll.accesskey;"/>
          <box orient="vertical" autostretch="never">
            <hbox autostretch="never">
              <textbox id="mousewheelWithNoKeyNumlines" size="3" 
                         pref="true" preftype="int" prefstring="mousewheel.withnokey.numlines"
                         prefattribute="value"/>
              <text class="label" value="&scrollLines.label;"/>
            </hbox>
            <checkbox id="mousewheelWithNoKeySysNumlines" label="&useSystemDefault.label;" accesskey="&useSystemDefault.accesskey;"
                      pref="true" preftype="bool" prefstring="mousewheel.withnokey.sysnumlines"
                      prefattribute="checked" oncommand="enableField(this, 'mousewheelWithNoKeyNumlines');"/>
          </box>
        </box>
        <radio group="mousewheelWithNoKeyAction" value="1" label="&scrollPgUpPgDn.label;" accesskey="&scrollPgUpPgDn.accesskey;"/>
        <radio group="mousewheelWithNoKeyAction" value="2" label="&history.label;" accesskey="&history.accesskey;"/>
        <radio group="mousewheelWithNoKeyAction" value="3" label="&textsize.label;" accesskey="&textsize.accesskey;"/>
      </radiogroup>
        
      <!-- alt modifiers -->
      <radiogroup id="mousewheelWithAltKeyAction" orient="vertical" autostretch="never" 
                  pref="true" preftype="int" prefstring="mousewheel.withaltkey.action" 
                  prefattribute="value">
        <box autostretch="never" valign="top">
          <radio group="mousewheelWithAltKeyAction" value="0" label="&scroll.label;" accesskey="&scroll.accesskey;"/>
          <box orient="vertical" autostretch="never">
            <hbox autostretch="never">
              <textbox id="mousewheelWithAltKeyNumlines" size="3" 
                         pref="true" preftype="int" prefstring="mousewheel.withaltkey.numlines"
                         prefattribute="value"/>
              <text class="label" value="&scrollLines.label;"/>
            </hbox>
            <checkbox id="mousewheelWithAltKeySysNumlines" label="&useSystemDefault.label;" accesskey="&useSystemDefault.accesskey;"
                      pref="true" preftype="bool" prefstring="mousewheel.withaltkey.sysnumlines"
                      prefattribute="checked" oncommand="enableField(this, 'mousewheelWithAltKeyNumlines');"/>
          </box>
        </box>
        <radio group="mousewheelWithAltKeyAction" value="1" label="&scrollPgUpPgDn.label;" accesskey="&scrollPgUpPgDn.accesskey;"/>
        <radio group="mousewheelWithAltKeyAction" value="2" label="&history.label;" accesskey="&history.accesskey;"/>
        <radio group="mousewheelWithAltKeyAction" value="3" label="&textsize.label;" accesskey="&textsize.accesskey;"/>
      </radiogroup>
  
      <!-- ctrl modifiers -->
      <radiogroup id="mousewheelWithCtrlKeyAction" orient="vertical" autostretch="never"
                  pref="true" preftype="int" prefstring="mousewheel.withcontrolkey.action" 
                  prefattribute="value">
        <box autostretch="never" valign="top">
          <radio group="mousewheelWithCtrlKeyAction" value="0" label="&scroll.label;" accesskey="&scroll.accesskey;"/>
          <box orient="vertical" autostretch="never">
            <hbox autostretch="never">
              <textbox id="mousewheelWithCtrlKeyNumlines" size="3" 
                         pref="true" preftype="int" prefstring="mousewheel.withcontrolkey.numlines"
                         prefattribute="value"/>
              <text class="label" value="&scrollLines.label;"/>
            </hbox>
            <checkbox id="mousewheelWithCtrlKeySysNumlines" label="&useSystemDefault.label;" accesskey="&useSystemDefault.accesskey;"
                      pref="true" preftype="bool" prefstring="mousewheel.withcontrolkey.sysnumlines"
                      prefattribute="checked" oncommand="enableField(this, 'mousewheelWithCtrlKeyNumlines');"/>
          </box>
        </box>
        <radio group="mousewheelWithCtrlKeyAction" value="1" label="&scrollPgUpPgDn.label;" accesskey="&scrollPgUpPgDn.accesskey;"/>
        <radio group="mousewheelWithCtrlKeyAction" value="2" label="&history.label;" accesskey="&history.accesskey;"/>
        <radio group="mousewheelWithCtrlKeyAction" value="3" label="&textsize.label;" accesskey="&textsize.accesskey;"/>
      </radiogroup>
  
      <!-- shift modifiers -->
      <radiogroup id="mousewheelWithShiftKeyAction" orient="vertical" autostretch="never"
                  pref="true" preftype="int" prefstring="mousewheel.withshiftkey.action" 
                  prefattribute="value">
        <box autostretch="never" valign="top">
          <radio group="mousewheelWithShiftKeyAction" value="0" label="&scroll.label;" accesskey="&scroll.accesskey;"/>
          <box orient="vertical" autostretch="never">
            <hbox autostretch="never">
              <textbox id="mousewheelWithShiftKeyNumlines" size="3" 
                         pref="true" preftype="int" prefstring="mousewheel.withshiftkey.numlines"
                         prefattribute="value"/>
              <text class="label" value="&scrollLines.label;"/>
            </hbox>
            <checkbox id="mousewheelWithShiftKeySysNumlines" label="&useSystemDefault.label;" accesskey="&useSystemDefault.accesskey;"
                      pref="true" preftype="bool" prefstring="mousewheel.withshiftkey.sysnumlines"
                      prefattribute="checked" oncommand="enableField(this, 'mousewheelWithShiftKeyNumlines');"/>
          </box>
        </box>
        <radio group="mousewheelWithShiftKeyAction" value="1" label="&scrollPgUpPgDn.label;" accesskey="&scrollPgUpPgDn.accesskey;"/>
        <radio group="mousewheelWithShiftKeyAction" value="2" label="&history.label;" accesskey="&history.accesskey;"/>
        <radio group="mousewheelWithShiftKeyAction" value="3" label="&textsize.label;" accesskey="&textsize.accesskey;"/>
      </radiogroup>
    </deck>     
  </titledbox>
  

</window>

