<?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/TR/REC-html40"
    xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    onload="Startup()"
    orient="vertical">

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

  <broadcaster id="args" value=""/>
  <keyset id="keyset"/>

  <tabcontrol orient="vertical">
	  <tabbox flex="1">
		  <tab id="TableTab" selected="true" oncommand="SelectTableTab()" value="&tableTab.label;"/>
		  <tab id="CellTab" oncommand="SelectCellTab()" value="&cellTab.label;"/>
	  	<spring flex="1"/>
	  </tabbox>
    <tabpanel class="Padding5" orient="vertical" id="TabPanel">
      <!-- TABLE PANEL -->
      <box id="TablePanel" orient="vertical">
        <titledbox><title><text value="&size.label;"/></title>
          <box orient="vertical">
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="TableRowsInput" value="&tableRows.label;"/>
              <textfield class="narrow" id="TableRowsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="TableColumnsInput" value="&tableColumns.label;"/>
              <textfield class="narrow" id="TableColumnsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
            </box>
          </box>
          <spring class="bigspacer"/>
          <spring class="bigspacer"/>
          <box orient="vertical">
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="right" for="TableHeightInput" value="&tableHeight.label;"/>
              <textfield class="narrow" id="TableHeightInput" onkeyup="forceInteger(this.id)"/>
              <menulist id="TableHeightUnits"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="right" for="TableWidthInput" value="&tableWidth.label;"/>
              <textfield class="narrow" id="TableWidthInput" onkeyup="forceInteger(this.id)"/>
              <menulist id="TableWidthUnits"/>
            </box>
          </box>
          <spring flex="1"/>
        </titledbox>
        <box>
          <titledbox orient="vertical"><title><text align="left" value="&tableBorderSpacing.label;"/></title>
            <box valign="baseline" autostretch="never">
              <text align="left" for="BorderWidthInput" value="&tableBorderWidth.label;"/>
              <spring class="spacer"/>
              <textfield class="narrow" id="BorderWidthInput" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&pixels.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="SpacingInput" value="&tableSpacing.label;"/>
              <textfield class="narrow" id="SpacingInput" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&tablePxBetwCells.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="PaddingInput" value="&tablePadding.label;"/>
              <textfield class="narrow" id="PaddingInput" onkeyup="forceInteger(this.id)"/>
              <!-- Use DIV instead of TEXT because label has embeded <br> -->
              <html:div>&tablePxBetwBrdrCellContent.label;</html:div>
            </box>
            <spring flex="1"/>
          </titledbox>
          <spring class="spacer"/>
          <box orient="vertical" flex="1">
            <spring class="bigspacer"/>
            <box orient="vertical" flex="1">
              <text align="left" for="TableAlignSelect" value="&tableAlignment.label;"/>
              <spring class="smallspacer"/>
              <menulist id="TableAlignSelect">
                <menupopup>
                  <menuitem value="&AlignLeft.label;"   data="left"/>
                  <menuitem value="&AlignCenter.label;" data="center"/>
                  <menuitem value="&AlignRight.label;"  data="right"/>
                </menupopup>
              </menulist>
              <spring class="bigspacer"/>
              <text align="left" for="CaptionSelect" value="&tableCaption.label;"/>
              <spring class="smallspacer"/>
              <menulist id="CaptionSelect" disabled="true">
                <menupopup>
                  <menuitem value="&tableCaptionNone.label;"/>
                  <menuitem value="&tableCaptionAbove.label;"/>
                  <menuitem value="&tableCaptionBelow.label;"/>
                </menupopup>
              </menulist>
              <spring flex="1"/>
            </box>
          </box>
          <spring class="bigspacer"/>
        </box>
        <titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
          <box valign="baseline" autostretch="never">
            <text class="MinWidth50" align="left" value="&color.label;"/>
            <menu class="colorpicker">
    	        <box>
                <spring id="tableBackgroundCW" class="color-well"/>
                <image class="popup-trigger"/>
              </box>
    	        <menupopup>
                <colorpicker id="tableBackgroundCP" palettename="standard" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this);"/>
                <button class="dialog" value="&defaultColor.label;" oncommand="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this)"/>
    	        </menupopup>
            </menu>
            <spring class="spacer"/>
            <text id="TableInheritColor" value="&tableInheritColor.label;" hidden="true"/>
          </box>
          <spring class="spacer"/>
          <box valign="baseline" autostretch="never">
            <text class="MinWidth50" align="left" for="TableImageInput" value="&image.label;"/>
              <textfield id="TableImageInput" flex="1"/>
              <button class="dialog" value="&ChooseImage.label;" id="TableImageButton" oncommand="ChooseCellImage()"/>
          </box>
<!-- Not sure if we will support this
          <box valign="baseline" autostretch="never">
            <spring class="MinWidth50"/>
            <html:input type="checkbox" id="TableLeaveLocCheck"/>
            <text align="left" for="TableLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
          </box>
-->
        </titledbox>
        <spring class="spacer"/>
        <box flex="1" autostretch="never">
          <spring flex="1"/>
          <!-- From EdDialogOvlerlay.xul -->
          <button class="dialog" id="AdvancedEditButton"/>
        </box>
        <spring flex="1"/>
      </box>

      <!-- CELL PANEL -->
    	<box id="CellPanel" orient="vertical">
        <titledbox autostretch="never" valign="baseline">
          <title><text align="left" value="&cellSelection.label;"/></title>
          <spring class="spacer"/>
          <menulist class="MinWidth50" id="SelectionList">
            <menupopup>
              <menuitem data="1" id="SelectCellItem"   value="&cellSelectionCell.label;"/>
              <menuitem data="2" id="SelectRowItem"    value="&cellSelectionRow.label;"/>
              <menuitem data="3" id="SelectColumnItem" value="&cellSelectionColumn.label;"/>
            </menupopup>
          </menulist>
          <spring class="bigspacer"/>
          <button class="dialog MinWidth50" value="&cellSelectionPrevious.label;" oncommand="SelectPrevious()" disabled="true"/>
          <spring class="bigspacer"/>
          <button class="dialog MinWidth50" value="&cellSelectionNext.label;" oncommand="SelectNext()" disabled="true"/>
        </titledbox>
        <!-- cell size titledbox -->
        <titledbox><title><text align="left" value="&size.label;"/></title>
          <box orient="vertical">
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="CellHeightInput" value="&tableHeight.label;"/>
              <textfield class="narrow" id="CellHeightInput" onkeyup="forceInteger(this.id)"/>
              <menulist id="CellHeightUnits"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <text class="MinWidth50" align="left" for="CellWidthInput" value="&tableWidth.label;"/>
              <textfield class="narrow" id="CellWidthInput" onkeyup="forceInteger(this.id)"/>
              <menulist id="CellWidthUnits"/>
            </box>
          </box>
          <spring class="bigspacer"/>
          <box orient="vertical">
            <spring class="spacer"/>
           <text for="RowSpanInput" value="&cellSpans.label;"/>
          </box>
          <box orient="vertical">
            <box valign="baseline" autostretch="never">
              <textfield class="narrow" id="RowSpanInput" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&cellSpanRows.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="baseline" autostretch="never">
              <textfield class="narrow" id="ColSpanInput" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&cellSpanCols.label;"/>
            </box>
          </box>
        </titledbox>
        <box>
          <titledbox orient="vertical" flex="1">
            <title><text align="left" value="&cellContentAlignment.label;"/></title>
            <box valign="top" autostretch="never">
              <text class="MinWidth70" align="right" for="CellHAlignSelect" value="&cellHorizontal.label;"/>
              <menulist class="MinWidth100" id="CellHAlignSelect">
                <menupopup  oncommand="SelectCellHAlign()">
                  <menuitem value="&AlignLeft.label;"        data="left"/>
                  <menuitem value="&AlignCenter.label;"      data="center"/>
                  <menuitem value="&AlignRight.label;"       data="right"/>
                  <menuitem value="&cellAlignJustify.label;" data="justify"/>
                  <menuitem value="&cellAlignAtChar.label;"  data="char"/>
                </menupopup>
              </menulist>
              <spring class="spacer"/>
              <html:input style="width: 1em" id="CellAlignCharInput" maxlength="2" visibility="hidden"/>
            </box>
            <spring class="spacer"/>
            <box valign="top" autostretch="never">
              <text class="MinWidth70" align="right" for="CellVAlignSelect" value="&cellVertical.label;"/>
              <menulist class="MinWidth100" id="CellVAlignSelect">
                <menupopup>
                  <menuitem value="&cellAlignTop.label;"    data="top"/>
                  <menuitem value="&cellAlignMiddle.label;" data="middle"/>
                  <menuitem value="&cellAlignBottom.label;" data="bottom"/>
                </menupopup>
              </menulist>
            </box>
          </titledbox>
          <spring class="spacer"/>
          <titledbox orient="vertical">
            <title><text align="left" value="&cellTextStyle.label;"/></title>
            <box valign="baseline" autostretch="never">
              <html:input type="checkbox" id="HeaderCheck"/>
              <text align="left" for="HeaderCheck" value="&cellHeader.label;"/>
            </box>
            <box valign="baseline" autostretch="never">
              <html:input type="checkbox" id="NoWrapCheck"/>
              <text align="left" for="NoWrapCheck" value="&cellNoWrap.label;"/>
            </box>
          </titledbox>
        </box>
        <titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
          <box valign="baseline" autostretch="never">
            <text class="MinWidth50" align="left" value="&color.label;"/>
            <menu class="colorpicker">
    	        <box>
                <spring id="cellBackgroundCW" class="color-well"/>
                <image class="popup-trigger"/>
              </box>
    	        <menupopup>
                <colorpicker id="cellBackgroundCP" palettename="standard"
                    onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
                <button class="dialog" value="&defaultColor.label;"
                    oncommand="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
    	        </menupopup>
            </menu>
            <spring class="spacer"/>
            <text id="CellInheritColor" value="&cellInheritColor.label;" hidden="true"/>
          </box>
          <spring class="spacer"/>
          <box valign="baseline" autostretch="never">
            <text class="MinWidth50" align="left" for="CellImageInput" value="&image.label;" />
            <textfield id="CellImageInput" flex="1"/>
            <button class="dialog" value="&ChooseImage.label;" id="CellImageButton" oncommand="ChooseCellImage()"/>
          </box>
<!-- Not sure if we will support this
          <box valign="baseline" autostretch="never">
            <spring class="MinWidth50"/>
            <html:input type="checkbox" id="CellLeaveLocCheck"/>
            <text align="left" for="CellLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
          </box>
-->
        </titledbox>
        <spring class="spacer"/>
        <box autostretch="never">
          <spring flex="1"/>
          <!-- From EdDialogOvlerlay.xul -->
          <button class="dialog" id="AdvancedEditButton2"/>
        </box>
      </box>

    </tabpanel> 
    <spring class="spacer"/>
    <!-- from EdDialogOverlay -->
    <box>
      <spring flex="1"/>
	    <button class="dialog" value="Apply"/>
      <box id="okCancelButtons"/> 
    </box>
  </tabcontrol>
</window>
