<?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/" 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()"
    align="vertical">

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

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

  <tabcontrol align="vertical">
	  <tabbox align="horizontal" flex="100%">
		  <tab id="TableTab" selected="true" onclick="SelectTableTab()" value="&tableTab.label;"/>
		  <tab id="CellTab" onclick="SelectCellTab()" value="&cellTab.label;"/>
	  	<spring flex="1"/>
	  </tabbox>
    <tabpanel class="Padding5" orient="vertical" id="TabPanel">
      <!-- TABLE PANEL -->
      <box id="TablePanel" orient="vertical">
        <titledbox class="NoBottomPad NoTopMargin NoTopPadding"><title><text value="&size.label;"/></title>
          <box orient="vertical">
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="TableRowsInput" value="&tableRows.label;"/>
              <html:div><html:input type="text" id="TableRowsInput" size="5" onkeyup="forceInteger(this.id)" disabled="true"/></html:div>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="TableColumnsInput" value="&tableColumns.label;"/>
              <html:input type="text" id="TableColumnsInput" size="5" onkeyup="forceInteger(this.id)" disabled="true"/>
            </box>
          </box>
          <spring class="bigspacer"/>
          <spring class="bigspacer"/>
          <box orient="vertical">
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="right" for="TableHeightInput" value="&tableHeight.label;"/>
              <html:input type="text" id="TableHeightInput" size="5" onkeyup="forceInteger(this.id)"/>
              <html:select id="TableHeightUnits"/>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="right" for="TableWidthInput" value="&tableWidth.label;"/>
              <html:input type="text" id="TableWidthInput" size="5" onkeyup="forceInteger(this.id)"/>
              <html:select id="TableWidthUnits"/>
            </box>
          </box>
        <spring flex="1"/>
        </titledbox>
        <box>
          <titledbox class="NoBottomPad" align="vertical"><title><text align="left" value="&tableBorderSpacing.label;"/></title>
            <box valign="middle" autostretch="never">
              <text align="left" for="BorderWidthInput" value="&tableBorderWidth.label;"/>
              <spring class="spacer"/>
              <html:input type="text" id="BorderWidthInput" size="3" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&pixels.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="SpacingInput" value="&tableSpacing.label;"/>
              <html:input type="text" id="SpacingInput" size="3" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&tablePxBetwCells.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="PaddingInput" value="&tablePadding.label;"/>
              <html:input type="text" id="PaddingInput" size="3" 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"/>
              <html:select id="TableAlignSelect">
                <html:option value="left">&AlignLeft.label;</html:option>
                <html:option value="center">&AlignCenter.label;</html:option>
                <html:option value="right">&AlignRight.label;</html:option>
              </html:select>
              <spring class="bigspacer"/>
              <text align="left" for="CaptionSelect" value="&tableCaption.label;"/>
              <spring class="smallspacer"/>
              <html:select id="CaptionSelect" disabled="true">
                <html:option>&tableCaptionNone.label;</html:option>
                <html:option>&tableCaptionAbove.label;</html:option>
                <html:option>&tableCaptionBelow.label;</html:option>
              </html:select>
              <spring flex="1"/>
            </box>
          </box>
          <spring class="bigspacer"/>
        </box>
        <titledbox class="NoBottomPad" align="vertical"><title><text align="left" value="&background.label;"/></title>
          <box valign="middle" 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;" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this)"/>
    	        </menupopup>
            </menu>
            <spring class="spacer"/>
            <text id="TableInheritColor" value="&tableInheritColor.label;" hidden="true"/>
          </box>
          <spring class="spacer"/>
          <box valign="middle" autostretch="never">
            <text class="MinWidth50" align="left" for="TableImageInput" value="&image.label;"/>
              <html:input type="text" id="TableImageInput" flex="1"/>
              <button class="dialog" value="&ChooseImage.label;" id="TableImageButton" oncommand="ChooseCellImage()"/>
          </box>
<!-- Not sure if we will support this
          <box valign="middle" 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="AdvancedEditButton2"/>
        </box>
        <spring flex="1"/>
      </box>

      <!-- CELL PANEL -->
    	<box id="CellPanel" orient="vertical">
        <titledbox class="NoTopMargin NoTopPadding NoBottomPad" autostretch="never" valign="middle">
          <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;" onclick="SelectPrevious()" disabled="true"/>
          <spring class="bigspacer"/>
          <button class="dialog MinWidth50" value="&cellSelectionNext.label;" onclick="SelectNext()" disabled="true"/>
        </titledbox>
        <!-- cell size titledbox -->
        <titledbox class="NoBottomPad"><title><text align="left" value="&size.label;"/></title>
          <box orient="vertical">
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="CellHeightInput" value="&tableHeight.label;"/>
              <html:input type="text" id="CellHeightInput" size="5" onkeyup="forceInteger(this.id)"/>
              <html:select id="CellHeightUnits"/>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <text class="MinWidth50" align="left" for="CellWidthInput" value="&tableWidth.label;"/>
              <html:input type="text" id="CellWidthInput" size="5" onkeyup="forceInteger(this.id)"/>
              <html:select 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="middle" autostretch="never">
              <html:input type="text" id="RowSpanInput" size="4" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&cellSpanRows.label;"/>
            </box>
            <spring class="spacer"/>
            <box valign="middle" autostretch="never">
              <html:input type="text" id="ColSpanInput" size="4" onkeyup="forceInteger(this.id)"/>
              <text align="left" value="&cellSpanCols.label;"/>
            </box>
          </box>
        </titledbox>
        <box>
          <titledbox class="NoBottomPad" 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;"/>
              <html:select class="MinWidth100" id="CellHAlignSelect" onchange="SelectCellHAlign()">
                <html:option value="left">&AlignLeft.label;</html:option>
                <html:option value="center">&AlignCenter.label;</html:option>
                <html:option value="right">&AlignRight.label;</html:option>
                <html:option value="justify">&cellAlignJustify.label;</html:option>
                <html:option value="char">&cellAlignAtChar.label;</html:option>
              </html:select>
              <spring class="spacer"/>
              <html:input id="CellAlignCharInput" size="2" maxlength="2" visibility="hidden"/>
            </box>
            <spring class="spacer"/>
            <box valign="top" autostretch="never">
              <text class="MinWidth70" align="right" for="CellVAlignSelect" value="&cellVertical.label;"/>
              <html:select class="MinWidth100" id="CellVAlignSelect">
                <html:option value="top">&cellAlignTop.label;</html:option>
                <html:option value="middle">&cellAlignMiddle.label;</html:option>
                <html:option value="bottom">&cellAlignBottom.label;</html:option>
              </html:select>
            </box>
          </titledbox>
          <spring class="spacer"/>
          <titledbox class="NoBottomPad" orient="vertical">
            <title><text align="left" value="&cellTextStyle.label;"/></title>
            <box valign="middle" autostretch="never">
              <html:input type="checkbox" id="HeaderCheck"/>
              <text align="left" for="HeaderCheck" value="&cellHeader.label;"/>
            </box>
            <box valign="middle" autostretch="never">
              <html:input type="checkbox" id="NoWrapCheck"/>
              <text align="left" for="NoWrapCheck" value="&cellNoWrap.label;"/>
            </box>
          </titledbox>
        </box>
        <titledbox class="NoBottomPad" orient="vertical"><title><text align="left" value="&background.label;"/></title>
          <box valign="middle" 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;"
                    onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
    	        </menupopup>
            </menu>
            <spring class="spacer"/>
            <text id="CellInheritColor" value="&cellInheritColor.label;" hidden="true"/>
          </box>
          <spring class="spacer"/>
          <box valign="middle" autostretch="never">
            <text class="MinWidth50" align="left" for="CellImageInput" value="&image.label;" />
            <html:input type="text" id="CellImageInput" flex="1"/>
            <button class="dialog" value="&ChooseImage.label;" id="CellImageButton" oncommand="ChooseCellImage()"/>
          </box>
<!-- Not sure if we will support this
          <box valign="middle" 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="AdvancedEditButton3"/>
        </box>
      </box>

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