<?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): 
   -    Ben Goodger
  -->

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

<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?> 
<?xul-overlay href="chrome://editor/content/EdDialogOverlay.xul"?> 

<!DOCTYPE window SYSTEM "chrome://editor/locale/EditorTableProperties.dtd">

<window class="dialog" title="&tableWindow.title;"
    xmlns:html="http://www.w3.org/1999/xhtml"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    onload="Startup()"
    orient="vertical">

  <!-- Methods common to all editor dialogs -->
  <script type="application/x-javascript" src="chrome://editor/content/EdDialogCommon.js"/>
  <script type="application/x-javascript" src="chrome://editor/content/EdTableProps.js"/>
  <script type="application/x-javascript" src="chrome://global/content/dialogOverlay.js" />

  <spring id="location" offsetY="50" persist="offsetX offsetY"/>
  <broadcaster id="args" value=""/>
  <keyset id="dialogKeys"/>

  <tabbox orient="vertical">
    <tabs flex="1">
      <tab id="TableTab" oncommand="SelectTableTab()" label="&tableTab.label;"/>
      <tab id="CellTab" oncommand="SelectCellTab()" label="&cellTab.label;"/>
    </tabs>
    <tabpanels orient="vertical" id="TabPanels">

      <!-- TABLE PANEL -->
      <box id="TablePanel" orient="vertical">
        <titledbox><label value="&size.label;"/>
          <grid>
            <columns><column/><column/></columns>
            <rows>
              <row valign="middle">
                <text class="label" value="&tableRows.label;"/>
                <textbox class="narrow" id="TableRowsInput" oninput="forceInteger(this.id);"/>
              </row>
              <row valign="middle">
                <text class="label" value="&tableColumns.label;"/>
                <textbox class="narrow" id="TableColumnsInput" oninput="forceInteger(this.id);"/>
              </row>
            </rows>
          </grid>
          <spring class="bigspacer"/>
          <grid>
            <columns><column/><column/><column/></columns>
            <rows>
              <row valign="middle">
                <text class="label" value="&tableWidth.label;"/>
                <textbox class="narrow" id="TableWidthInput" oninput="forceInteger(this.id);"/>
                <menulist id="TableWidthUnits"/>
              </row>
            </rows>
          </grid>
        </titledbox>
        <titledbox orient="vertical"><label align="left" value="&tableBorderSpacing.label;"/>
        <grid>
          <columns><column/><column/><column/></columns>
          <rows>
            <row valign="middle">
              <text class="label" value="&tableBorderWidth.label;"/>
              <textbox class="narrow" id="BorderWidthInput" oninput="forceInteger(this.id);"/>
              <text class="label" align="left" value="&pixels.label;"/>
            </row>
            <row valign="middle">
              <text class="label" value="&tableSpacing.label;"/>
              <textbox class="narrow" id="SpacingInput" oninput="forceInteger(this.id);"/>
              <text class="label" value="&tablePxBetwCells.label;"/>
            </row>
            <row valign="middle" autostretch="never">
              <text class="label" value="&tablePadding.label;"/>
              <textbox class="narrow" id="PaddingInput" oninput="forceInteger(this.id);"/>
              <text class="label" value="&tablePxBetwBrdrCellContent.label;"/>
            </row>
          </rows>
        </grid>
        </titledbox>
        <!-- Table Alignment and Caption -->
        <box flex="1" valign="middle" autostretch="never">
          <text class="label" value="&tableAlignment.label;"/>
          <menulist id="TableAlignList">
            <menupopup>
              <menuitem label="&AlignLeft.label;"   value="left"/>
              <menuitem label="&AlignCenter.label;" value="center"/>
              <menuitem label="&AlignRight.label;"  value="right"/>
            </menupopup>
          </menulist>
          <spring class="spacer"/>
          <text class="label" value="&tableCaption.label;"/>
          <menulist id="TableCaptionList">
            <menupopup>
              <menuitem label="&tableCaptionNone.label;"  value=""/>
              <menuitem label="&tableCaptionAbove.label;" value="top"/>
              <menuitem label="&tableCaptionBelow.label;" value="bottom"/>
            </menupopup>
          </menulist>
        </box>
        <separator class="groove"/>
        <box valign="middle" autostretch="never">
          <text class="label" value="&backgroundColor.label;"/>
          <stack>
            <button class="dialog color-button" oncommand="GetColorAndUpdate('tableBackgroundCW');"/>
            <box autostretch="never" valign="middle" mousethrough="always">
              <spring flex="1"/>
              <spring id="tableBackgroundCW" class="color-well"/>
              <spring flex="1"/>
            </box>
          </stack>
          <spring class="spacer"/>
          <text class="label" id="TableInheritColor" value="&tableInheritColor.label;" collapsed="true"/>
        </box>
        <separator class="groove"/>
        <box flex="1" autostretch="never">
          <spring flex="1"/>
          <!-- From EdDialogOvlerlay.xul -->
          <button class="dialog" id="AdvancedEditButton"/>
        </box>
        <spring flex="1"/>
      </box><!-- Table Panel -->

      <!-- CELL PANEL -->
      <box id="CellPanel" orient="vertical">
        <titledbox autostretch="never" valign="middle">
          <label value="&cellSelection.label;"/>
          <box orient="vertical">
            <menulist id="SelectionList" oncommand="ChangeSelection(event.target.value)" flex="1">
              <menupopup>
                <!-- JS code assumes order is Cell, Row, Column -->
                <menuitem label="&cellSelectCell.label;"   value="1"/>
                <menuitem label="&cellSelectRow.label;"    value="2"/>
                <menuitem label="&cellSelectColumn.label;" value="3"/>
              </menupopup>
            </menulist>
            <box flex="1">
              <button id="PreviousButton" class="dialog"             label="&cellSelectPrevious.label;" oncommand="MoveSelection(0)" flex="1"/>
              <button id="NextButton"     class="dialog align-right" label="&cellSelectNext.label;"     oncommand="MoveSelection(1)" flex="1"/>
            </box>
          </box>
          <spring class="bigspacer"/>
          <box orient="vertical" flex="1">
            <text class="label" value="&applyBeforeChange1.label;"/>
            <text class="label" value="&applyBeforeChange2.label;"/>
          </box>
        </titledbox>

        <!-- cell size titledbox -->
        <titledbox><label align="left" value="&size.label;"/>
          <grid>
            <columns><column/><column/><column/></columns>
            <rows>
              <row valign="middle" autostretch="never">
                <checkbox id="CellHeightCheckbox" label="&tableHeight.label;"/>
                <textbox class="narrow" id="CellHeightInput"
                         oninput="ChangeIntTextbox(this.id,'CellHeightCheckbox');"/>
                <menulist id="CellHeightUnits" oncommand="SetCheckbox('CellHeightCheckbox');"/>
              </row>
              <row valign="middle" autostretch="never">
                <checkbox id="CellWidthCheckbox" label="&tableWidth.label;"/>
                <textbox class="narrow" id="CellWidthInput"
                         oninput="ChangeIntTextbox(this.id,'CellWidthCheckbox');"/>
                <menulist id="CellWidthUnits" oncommand="SetCheckbox('CellWidthCheckbox');"/>
              </row>
            </rows>
          </grid>
          <spring class="bigspacer"/>
          <grid>
            <columns><column/><column/></columns>
            <rows>
              <row valign="middle" autostretch="never">
                <checkbox id="RowSpanCheckbox" label="&cellRowSpan.label;"/>
                <textbox class="narrow" id="RowSpanInput"
                         oninput="ChangeIntTextbox(this.id,'RowSpanCheckbox');"/>
              </row>
              <row valign="middle" autostretch="never">
                <checkbox id="ColSpanCheckbox" label="&cellColSpan.label;"/>
                <textbox class="narrow" id="ColSpanInput"
                         oninput="ChangeIntTextbox(this.id,'ColSpanCheckbox');"/>
              </row>
            </rows>
          </grid>
        </titledbox>

        <!-- Alignment -->
        <titledbox valign="middle" autostretch="never">
          <label value="&cellContentAlignment.label;"/>
          <checkbox id="CellHAlignCheckbox" label="&cellHorizontal.label;"/>
          <menulist id="CellHAlignList"  oncommand="SelectCellHAlign()">
            <menupopup>
              <menuitem label="&AlignLeft.label;"        value="left"/>
              <menuitem label="&AlignCenter.label;"      value="center"/>
              <menuitem label="&AlignRight.label;"       value="right"/>
              <menuitem label="&cellAlignJustify.label;" value="justify"/>
            </menupopup>
          </menulist>
          <spring class="spacer"/>
          <checkbox id="CellVAlignCheckbox" label="&cellVertical.label;"/>
          <menulist id="CellVAlignList" oncommand="SetCheckbox('CellVAlignCheckbox');">
            <menupopup>
              <menuitem label="&cellAlignTop.label;"    value="top"/>
              <menuitem label="&cellAlignMiddle.label;" value="middle"/>
              <menuitem label="&cellAlignBottom.label;" value="bottom"/>
            </menupopup>
          </menulist>
        </titledbox>
        <spring class="spacer"/>
        <box valign="middle" autostretch="never">
          <checkbox id="CellStyleCheckbox" label="&cellStyle.label;"/>
          <menulist id="CellStyleList" oncommand="SetCheckbox('CellStyleCheckbox');">
            <menupopup>
              <menuitem label="&cellNormal.label;" value="td"/>
              <menuitem label="&cellHeader.label;" value="th"/>
            </menupopup>
          </menulist>
          <spring class="bigspacer"/>
          <checkbox id="TextWrapCheckbox" label="&cellTextWrap.label;"/>
          <menulist id="TextWrapList" oncommand="SetCheckbox('TextWrapCheckbox');">
            <menupopup>
              <menuitem label="&cellWrap.label;" value="wrap"/>
              <menuitem label="&cellNoWrap.label;" value="nowrap"/>
            </menupopup>
          </menulist>
        </box>
        <separator class="groove"/>
        <box valign="middle" autostretch="never">
          <checkbox id="CellColorCheckbox" label="&backgroundColor.label;"/>
          <stack>
            <button class="dialog color-button" oncommand="GetColorAndUpdate('cellBackgroundCW');" flex="1"/>
            <box autostretch="never" valign="middle" mousethrough="always">
              <spring flex="1"/>
              <spring id="cellBackgroundCW" class="color-well"/>
              <spring flex="1"/>
            </box>
          </stack>
          <spring class="spacer"/>
          <text class="label" id="CellInheritColor" value="&cellInheritColor.label;" collapsed="true"/>
        </box>
        <separator class="groove"/>
        <box autostretch="never">
          <html  class="wrap" flex="1" style="width: 1em">&cellUseCheckboxHelp.label;</html>
          <!-- From EdDialogOvlerlay.xul -->
          <button class="dialog" id="AdvancedEditButton2"/>
        </box>
        <spring flex="1"/>
      </box><!-- Cell Panel -->

    </tabpanels> 
    <spring class="spacer"/>
    <!-- from EdDialogOverlay -->
    <box>
      <spring flex="1"/>
      <button class="dialog" label="&applyButton.label;" oncommand="Apply();"/>
      <box id="okCancelButtons"/> 
    </box>
  </tabbox>
</window>
