<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
   - Version: MPL 1.1/GPL 2.0/LGPL 2.1
   -
   - The contents of this file are subject to the Mozilla 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/MPL/
   -
   - 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 Verbosio XML editor.
   -
   - The Initial Developer of the Original Code is
   - Alexander J. Vincent <ajvincent@gmail.com>.
   - Portions created by the Initial Developer are Copyright (C) 2005-2007
   - the Initial Developer. All Rights Reserved.
   -
   - Contributor(s):
   -
   - Alternatively, the contents of this file may be used under the terms of
   - either the GNU General Public License Version 2 or later (the "GPL"), or
   - the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
   - in which case the provisions of the GPL or the LGPL are applicable instead
   - of those above. If you wish to allow use of your version of this file only
   - under the terms of either the GPL or the LGPL, and not to allow others to
   - use your version of this file under the terms of the MPL, indicate your
   - decision by deleting the provisions above and replace them with the notice
   - and other provisions required by the LGPL or the GPL. If you do not delete
   - the provisions above, a recipient may use your version of this file under
   - the terms of any one of the MPL, the GPL or the LGPL.
   -
   - ***** END LICENSE BLOCK ***** -->
<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://verbosio/content/verbosioOverlay.xul"?>

<?xml-stylesheet type="text/css" href="chrome://xulwidgets/skin/"?>
<?xml-stylesheet type="text/css" href="chrome://global/skin/tabbox.css"?>
<?xml-stylesheet type="text/css" href="chrome://verbosio/skin/verbosio.css"?>
<?xml-stylesheet type="text/css" href="chrome://verbosio/skin/valuepanel.css"?>
<?xml-stylesheet type="text/css" href="chrome://verbosio/content/verbosio.css"?>

<!DOCTYPE window [
  <!ENTITY % verbosioLocale SYSTEM "chrome://verbosio/locale/verbosio.dtd">
  %verbosioLocale;
  <!ENTITY % commonDTD SYSTEM "chrome://verbosio/content/verbosio.dtd">
  %commonDTD;
  <!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd" >
  %textcontextDTD;
  <!ENTITY % domTreeViewContext SYSTEM
             "chrome://verbosio/content/tools/domTreeViewContext.dtd">
  %domTreeViewContext;
]>
<!--
We may also want a CSS editor capability embedded in this application somehow.

Including the ability to edit document fragments (instead of full documents) would help too.
Then a user could simply "paste" them into full documents.

Sample XPI's:
* Generic XML editor (required)
  * Includes xeXMLLanguagePack for generic XML
  * Includes xeDocumentType for a generic XML document
* Foo language editor
* Normal rendering viewer (required)
  * Includes xeDocumentViewer for normal rendering view
* Source text viewer (required)
  * Includes xeDocumentViewer for source text view
* Current-edits viewer
  -->
<window id="main-window"
        title="&app.name.long;"
        width="1024"
        height="768"
        screenX="0"
        screenY="0"
        xmlns:html="&XHTML_NS;"
        xmlns:xbl="&XBL_NS;"
        xmlns:xul="&XUL_NS;"
        xmlns="&XUL_NS;"
       >
  <commandset id="globalCommands"
              commandupdater="true"
              oncommandupdate="baseGlobalController.updateCommands();">
    <command id="cmd_open_pack"
             oncommand="baseGlobalController.doCommand('cmd_open_pack');"
            />
    <command id="cmd_open_files"
             oncommand="baseGlobalController.doCommand('cmd_open_files');"
            />
    <command id="cmd_save"
             oncommand="baseGlobalController.doCommand('cmd_save');"
            />
    <command id="cmd_close"
             oncommand="baseGlobalController.doCommand('cmd_close');"
            />
    <command id="cmd_quit"
             oncommand="goQuitApplication();"
            />
    <!-- DOM Inspector requires this... -->
    <commandset id="tasksCommands"/>
  </commandset>

  <commandset id="editCommands"
              commandupdater="true"
              oncommandupdate="baseEditController.updateCommands();">
    <command id="cmd_undo" oncommand="baseEditController.doCommand('cmd_undo');"/>
    <command id="cmd_redo" oncommand="baseEditController.doCommand('cmd_redo');"/>
    <command id="cmd_cut"    oncommand="baseEditController.doCommand('cmd_cut');"/>
    <command id="cmd_copy"   oncommand="baseEditController.doCommand('cmd_copy');"/>
    <command id="cmd_paste"  oncommand="baseEditController.doCommand('cmd_paste');"/>
    <command id="cmd_delete" oncommand="baseEditController.doCommand('cmd_delete');"/>
    <command id="cmd_insert" oncommand="baseEditController.doCommand('cmd_insert');"/>
  </commandset>

  <commandset id="overlayCommands">
    <!-- Use this for language pack specific commands. -->
  </commandset>

  <keyset id="globalKeys">
    <key id="key_close"/>
    <key id="key_quit"/>
  </keyset>

  <keyset id="editMenuKeys"/>

  <toolbox id="mainToolbox">
    <menubar id="commonOperations">
      <!-- This is where language-independent operations, such as search and
           file input/output, live. -->
      <menu id="fileMenu"
            label="&fileMenu.label;"
            accesskey="&fileMenu.accessKey;"
           >
        <menupopup id="menu_FilePopup"
                   onpopupshowing="baseGlobalController.updateCommands();"
                  >
          <menu id="newDocumentMenu"
                label="&newDocumentMenu.label;"
               >
            <!-- If you want to create a new type of XML document, overlay it here. -->
            <menupopup id="newDocumentMenuPopup"/>
          </menu>
          <menuitem label="&menu_open_app.label;"
                    command="cmd_open_pack"
                   />
          <menuitem label="&menu_save_document.label;"
                    command="cmd_save"
                   />
          <menuitem label="&menu.saveDocumentAs.label;"
                    disabled="true"
                   />
          <menuseparator/>
          <menuitem id="menu_close"
                    label="&menu_close_document.label;"
                    command="cmd_close"
                   />
          <menuitem id="menu_FileQuitItem" 
                    label="&menu_quit.label;"
                    key="key_quit"
                    accesskey="&menu_quit.accesskey;"
                    command="cmd_quit"
                   />
        </menupopup>
      </menu>

      <menu id="editMenu"
            label="&editMenu.label;"
           >
        <menupopup>
&domTreeViewMaker.contextmenu;
          <menuseparator/>
          <menuitem label="&selectAll.label;"
                    disabled="true"
                   />
        </menupopup>
      </menu>

      <menu id="languageMenu"
            label="&languageMenu.label;"
           >
        <!-- Overlay XML languages by name here. -->
        <menupopup id="languageMenuPopup"/>
      </menu>

      <menu id="documentsMenu"
            label="&documentsMenu.label;"
            accesskey="&documentsMenu.accessKey;"
           >
        <menupopup id="documentsMenuPopup"/>
      </menu>

      <menu id="viewersMenu"
            label="&viewersMenu.label;"
            accesskey="&viewersMenu.accessKey;"
           >
        <menupopup id="viewersMenuPopup"/>
      </menu>

      <menu id="preferencesMenu"
            label="&preferencesMenu.label;"
           />
      <menu id="windowsMenu"
            label="&windowsMenu.label;"
           />
      <menu id="toolsMenu"
            label="&toolsMenu.label;"
           >
        <!-- JavaScript Console, DOM Inspector, Venkman, etc. -->
        <menupopup id="toolsPopup"/>
      </menu>
    </menubar>
<!--
    <toolbar id="changeSelection">
      <description>Select:</description>
      <toolbarbutton label="Parent Node" disabled="true"/>
      <toolbarbutton label="Previous Sibling" disabled="true"/>
      <toolbarbutton label="Next Sibling" disabled="true"/>
      <toolbarbutton label="First Child" disabled="true"/>
      <toolbarbutton label="Last Child" disabled="true"/>
      <toolbarbutton label="Owner Document" disabled="true"/>
      <textbox id="changeSelectionById" size="15" disabled="true"/>
      <toolbarbutton label="Get Element By Id" disabled="true"/>
    </toolbar>
-->
    <deck id="languageDeck">
      <!-- This is where language-specific menubars and toolbars live.  -->
    </deck>
  </toolbox>

  <vbox style="overflow: scroll;">
    <documentviewer id="documentViewer">
      <!-- Any non-tabs element which is a direct child of the document viewer
           goes into the start page.
        -->
      <vbox style="min-height: 300px; min-width: 300px;"/>
    </documentviewer>
    <splitter/>
    <vbox id="preconditionUIBox"
          style="height:100px; min-height: 100px;"
          flex="1"
         />
    <spacer/>
  </vbox>

  <stringbundleset id="stringbundlesets">
    <stringbundle id="verbosioLocaleStrings"
                  src="chrome://verbosio/locale/verbosio.properties"
                 />
  </stringbundleset>

  <box hidden="true" id="templatesBox">
    <!-- Use this as a place to store your document templates, precondition templates, etc. -->
  </box>

  <!-- This is for a number of things where we might need a regular frame:
       * Checking for and getting XPI packs for the XML editor
    -->
  <iframe id="utilityFrame" hidden="true"/>

  <script type="&JS_TYPE;"
          src="resource://app/res/ecma-debug.js"/>
  <script type="&JS_TYPE;" 
          src="chrome://verbosio/content/tools/scopeHandler.js"/>
  <script type="&JS_TYPE;" 
          src="chrome://verbosio/content/tools/dataRegistry.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/namespaceRegistry.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/fileTypesRegistry.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/packTypesRegistry.js"/>
  <script type="&JS_TYPE;" 
          src="chrome://verbosio/content/tools/documentRegistry.js"/>
  <script type="&JS_TYPE;" 
          src="chrome://verbosio/content/tools/mutationEvents.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/ensureJSLib.js"/>
  <script type="&JS_TYPE;" src="chrome://jslib/content/jslib.js"/>
  <script type="&JS_TYPE;" src="chrome://jslib/content/io/io.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/domTreeViewMaker.js"/>
  <script type="&JS_TYPE;"
          src="chrome://verbosio/content/tools/xeTransactionCommon.js"/>
  <script type="&JS_TYPE;" src="chrome://verbosio/content/verbosio.js"/>
  &namespaces.script;

  <box hidden="true" id="scriptsContainer">
    <!-- Use this as a place to overlay your central scripts.
         chrome://verbosio/content/verbosio.js must precede all your scripts.
      -->
  </box>

  <splitter/>
  <textbox readonly="true" id="dumpTextbox" value="No messages from system."
           cols="60" rows="5" multiline="true"/>
  <hbox>
    <textbox size="60" id="executeText"/>
    <button label="Execute!" oncommand="dumpTextbox.value = eval(executeText.value);"/>
  </hbox>

  <statusbar>
    <!-- Maybe: Quick buttons to switch editing modes? -->
    <!-- Maybe: Buttons a la Composer to show you the path back to the #document node? -->
  </statusbar>
</window>
