<?xml version="1.0"?>

<!DOCTYPE page [
  <!ENTITY % dtd1 SYSTEM "chrome://inspector/locale/inspector.dtd"> %dtd1;
  <!ENTITY % dtd2 SYSTEM "chrome://inspector/content/util.dtd"> %dtd2;
  <!ENTITY % dtd3 SYSTEM "chrome://inspector/locale/viewers/dom.dtd"> %dtd3;
  <!ENTITY % dtd4 SYSTEM "chrome://inspector/locale/editing.dtd"> %dtd4;
]>

<?xul-overlay href="chrome://inspector/content/editingOverlay.xul"?>

<?xml-stylesheet href="chrome://inspector/skin/viewers/dom/dom.css"?>

<page id="winDOMViewer"
      orient="vertical"
      xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  
  <script type="application/x-javascript" src="chrome://inspector/content/utils.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/hooks.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/Flasher.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/jsutil/xpcom/XPCU.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/jsutil/system/PrefUtils.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/jsutil/events/ObserverManager.js"/>
  <script type="application/x-javascript" src="chrome://global/content/XPCNativeWrapper.js"/>
  <script type="application/x-javascript" src="chrome://inspector/content/viewers/dom/dom.js"/>

  <!--============================= COMMANDS ============================== -->

  <commandset id="cmdsEditing"/>  

  <commandset>
    <command id="cmdInspectInNewWindow" 
      oncommand="viewer.cmdInspectInNewWindow()"/>

    <command id="cmdInspectBrowser" 
      isvalid="return viewer.cmdInspectBrowserIsValid()"
      oncommand="viewer.cmdInspectBrowser()"/>

    <command id="cmdCopyXML"
      oncommand="viewer.cmdCopySelectedXML()"/>

    <command id="cmdBlink" 
      isvalid="return viewer.cmdBlinkIsValid();"
      oncommand="viewer.cmdBlink()"/>

    <command id="cmdShowPseudoClasses"
      oncommand="viewer.cmdShowPseudoClasses()"/>

    <command id="cmdEditPasteBefore" oncommand="viewer.pane.panelset.execCommand('cmdEditPasteBefore');"/>
    <command id="cmdEditPasteReplace" oncommand="viewer.pane.panelset.execCommand('cmdEditPasteReplace');"/>
    <command id="cmdEditPasteFirstChild" oncommand="viewer.pane.panelset.execCommand('cmdEditPasteFirstChild');"/>
    <command id="cmdEditPasteLastChild" oncommand="viewer.pane.panelset.execCommand('cmdEditPasteLastChild');"/>
    <command id="cmdEditPasteAsParent" oncommand="viewer.pane.panelset.execCommand('cmdEditPasteAsParent');"/>

    <command id="cmdEditInsertAfter" oncommand="viewer.pane.panelset.execCommand('cmdEditInsertAfter');"/>
    <command id="cmdEditInsertBefore" oncommand="viewer.pane.panelset.execCommand('cmdEditInsertBefore');"/>
    <command id="cmdEditInsertFirstChild" oncommand="viewer.pane.panelset.execCommand('cmdEditInsertFirstChild');"/>
    <command id="cmdEditInsertLastChild" oncommand="viewer.pane.panelset.execCommand('cmdEditInsertLastChild');"/>

  </commandset>
  
  <!--============================= POPUPS ============================== -->

  <popupset id="psPopups">
    <popup id="ppDOMContext" onpopupshowing="viewer.onContextCreate(this)">
      <menuitem label="&cmdInspectInNewWindow.label;"
                accesskey="&cmdInspectInNewWindow.accesskey;"
                observes="cmdInspectInNewWindow"/>
      <menuitem label="&cmdInspectBrowser.label;"
                accesskey="&cmdInspectBrowser.accesskey;"
                observes="cmdInspectBrowser"/>
      <menuseparator/>
      <menuitem id="mnEditCut"/>
      <menuitem id="mnEditCopy"/>
      <menu id="mnEditPasteMenu"
            label="&mnEditPasteMenu.label;"
            accesskey="&mnEditPasteMenu.accesskey;">
        <menupopup onpopupshowing="viewer.onCommandPopupShowing(this)">
          <!-- keep older functionality of paste command for paste menu in DOM Nodes viewer -->
          <menuitem id="mnEditPasteAfter"
                    label="&mnEditPasteAfter.label;"
                    accesskey="&mnEditPasteAfter.accesskey;"
                    command="cmdEditPaste"
                    key="keyEditPaste"/>
          <!-- other paste commands -->            
          <menuitem id="mnEditPasteBefore"
                    label="&mnEditPasteBefore.label;"
                    accesskey="&mnEditPasteBefore.accesskey;"
                    command="cmdEditPasteBefore"/>
          <menuitem id="mnEditPasteReplace"
                    label="&mnEditPasteReplace.label;"
                    accesskey="&mnEditPasteReplace.accesskey;"
                    command="cmdEditPasteReplace"/>
          <menuitem id="mnEditPasteFirstChild"
                    label="&mnEditPasteFirstChild.label;"
                    accesskey="&mnEditPasteFirstChild.accesskey;"
                    command="cmdEditPasteFirstChild"/>
          <menuitem id="mnEditPasteLastChild"
                    label="&mnEditPasteLastChild.label;"
                    accesskey="&mnEditPasteLastChild.accesskey;"
                    command="cmdEditPasteLastChild"/>
          <menuitem id="mnEditPasteAsParent"
                    label="&mnEditPasteAsParent.label;"
                    accesskey="&mnEditPasteAsParent.accesskey;"
                    command="cmdEditPasteAsParent"/>
        </menupopup>
      </menu>
      <menuseparator/>
      <menu id="mnEditInsertMenu"
            label="&mnEditInsertMenu.label;"
            accesskey="&mnEditInsertMenu.accesskey;">
        <menupopup onpopupshowing="viewer.onCommandPopupShowing(this)">
          <menuitem id="mnEditInsertAfter"
                    label="&mnEditInsertAfter.label;"
                    accesskey="&mnEditInsertAfter.accesskey;"
                    command="cmdEditInsertAfter"/>
          <menuitem id="mnEditInsertBefore"
                    label="&mnEditInsertBefore.label;"
                    accesskey="&mnEditInsertBefore.accesskey;"
                    command="cmdEditInsertBefore"/>
          <menuitem id="mnEditInsertFirstChild"
                    label="&mnEditInsertFirstChild.label;"
                    accesskey="&mnEditInsertFirstChild.accesskey;"
                    command="cmdEditInsertFirstChild"/>
          <menuitem id="mnEditInsertLastChild"
                    label="&mnEditInsertLastChild.label;"
                    accesskey="&mnEditInsertLastChild.accesskey;"
                    command="cmdEditInsertLastChild"/>
        </menupopup>
      </menu>
      <menuitem id="mnEditDelete"/>
      <menuseparator/>
      <menuitem label="&cmdCopyXML.label;"
                accesskey="&cmdCopyXML.accesskey;"
                observes="cmdCopyXML"/>
      <menuseparator/>
      <menuitem label="&cmdBlink.label;"
                accesskey="&cmdBlink.accesskey;"
                observes="cmdBlink"/>
      <menuitem label="&cmdShowPseudoClasses.label;"
                accesskey="&cmdShowPseudoClasses.accesskey;"
                observes="cmdShowPseudoClasses"/>
    </popup>
  </popupset>

  <!-- ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    The template for this tree will be filled in by inTreeBuilder
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: -->
  
  <tree id="trDOMTree" class="plain" flex="1" enableColumnDrag="true"
            contextmenu="ppDOMContext"
            onselect="viewer.onItemSelected()">
    <treecols>
      <!-- These labels don't need to be localized since they are defined by DOM APIs -->
      <treecol id="colNodeName" label="nodeName" primary="true" persist="width,hidden,ordinal" flex="3"/>
      <splitter class="tree-splitter"/>
      <treecol id="colLocalName" label="localName" hidden="true" persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="colPrefix" label="prefix" hidden="true" persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="colNamespaceURI" label="namespaceURI" hidden="true" persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="colNodeType" label="nodeType" hidden="true"  persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="colNodeValue" label="nodeValue" hidden="true" persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="col@id" label="id" persist="width,hidden,ordinal" flex="1"/>
      <splitter class="tree-splitter"/>
      <treecol id="col@class" label="class" persist="width,hidden,ordinal" flex="1"/>
    </treecols>
    <treechildren id="trDOMTreeBody"/>
  </tree>
</page>
