<?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 SeaMonkey internet suite code.

 The Initial Developer of the Original Code is
 Netscape Communications Corporation.
 Portions created by the Initial Developer are Copyright (C) 2006
 the Initial Developer. All Rights Reserved.

 Contributor(s):
   Robert Kaiser <kairo@kairo.at>
   Philip Chee <philip.chee@gmail.com>

 Alternatively, the contents of this file may be used under the terms of
 either of 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 GPL or the LGPL. 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 ***** -->

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

<?xul-overlay href="chrome://global/content/globalOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/utilityOverlay.xul"?>
<?xul-overlay href="chrome://communicator/content/tasksOverlay.xul"?>

<!DOCTYPE overlay [
<!ENTITY % console2DTD SYSTEM "chrome://console2/locale/console2.dtd">
%console2DTD;
<!ENTITY % console2fallbackDTD SYSTEM "chrome://console2/content/console2.dtd">
%console2fallbackDTD;
]>

<overlay id="consoleOverlay"
         xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">

  <script type="application/x-javascript"><![CDATA[
    function initC2Menubar()
    {
      window.removeEventListener("load", initC2Menubar, false);

      top.controllers.insertControllerAt(0, ConsoleController);

      if (_inSidebar())
      {
        var menubar = _("main-menubar");
        if (menubar)
        {
          menubar.hidden = true;
        }
      }
    }

    /* :::::::: Command Controller for the Window ::::::::::::::: */

    var ConsoleController = 
    {
      isCommandEnabled: function (aCommand)
      {
        switch (aCommand) {
          case "cmd_copy":
            return (gConsole.selectedItem != null);
          default:
            return false;
        }
      },

      supportsCommand: function (aCommand) 
      {
        switch (aCommand) {
          case "cmd_copy":
            return true;
          default:
            return false;
        }
      },

      doCommand: function (aCommand)
      {
        switch (aCommand) {
          case "cmd_copy":
            copySelectedItems();
            break;
          default:
            break;
        }
      },

      onEvent: function (aEvent) 
      {
      }
    }

    window.addEventListener("load", initC2Menubar, false);
    window.addEventListener("unload",
      function() {top.controllers.removeController(ConsoleController);},
      false);
	]]></script>

  <commandset id="consoleCommands">
    <commandset id="tasksCommands"/>
    <command id="cmd_quit"/>
  </commandset>

  <keyset id="consoleKeys">
    <keyset id="tasksKeys"/>
    <key id="key_copy"/>
    <key id="key_close2"/>
    <key id="key_quit"/>
  </keyset>

  <toolbox id="ConsoleToolbox">
    <menubar id="main-menubar" class="chromeclass-menubar"
             grippytooltiptext="&menuBar.tooltip;" position="1">
      <menu id="menu_File">
        <menupopup id="menu_FilePopup">
          <menuitem id="menu_close"/>
        </menupopup>
      </menu>

      <menu id="menu_Edit">
        <menupopup>
          <menuitem id="menu_copy"/>
        </menupopup>
      </menu>

      <menu id="menu_View">
        <menupopup>
          <menu label="&toolbarsCmd.label;" accesskey="&toolbarsCmd.accesskey;">
            <menupopup>
              <menuitem id="toggleToolbarMode" type="checkbox" checked="true"
                        oncommand="goToggleToolbar('ToolbarMode','toggleToolbarMode');"
                        label="&modeBar.label;"
                        accesskey="&modeBar.accesskey;"/>
              <menuitem id="toggleToolbarExt" type="checkbox" checked="true"
                        oncommand="goToggleToolbar('ToolbarExt','toggleToolbarExt');"
                        label="&extBar.label;"
                        accesskey="&extBar.accesskey;"/>
              <menuitem id="toggleToolbarEval" type="checkbox" checked="true"
                        oncommand="goToggleToolbar('ToolbarEval','toggleToolbarEval');"
                        label="&evalBar.label;"
                        accesskey="&evalBar.accesskey;"/>
            </menupopup>
          </menu>
          <menuseparator/>
          <menuitem type="radio" observes="Console:sortAscend"/>
          <menuitem type="radio" observes="Console:sortDescend"/>
        </menupopup>
      </menu>

      <!-- tasks menu filled from tasksOverlay -->
      <menu id="tasksMenu"/>

      <!-- window menu filled from tasksOverlay -->
      <menu id="windowMenu"/>

      <!-- help menu filled from globalOverlay -->
      <menu id="menu_Help"/>
    </menubar>
  </toolbox>

  <toolbar id="ToolbarMode" grippytooltiptext="&modeBar.label;"/>
  <toolbar id="ToolbarExt"  grippytooltiptext="&extBar.label;"/>
  <toolbar id="ToolbarEval" grippytooltiptext="&evalBar.label;"/>

  <toolbarbutton id="item_modeErrors"     accesskey="&errors3.accesskey;"/>
  <toolbarbutton id="item_modeWarnings"   accesskey="&warnings3.accesskey;"/>

  <toolbarbutton id="item_modeCtxChrome"  accesskey="&ctx.chr3.accesskey;"/>
  <toolbarbutton id="item_modeCtxContent" accesskey="&ctx.cnt3.accesskey;"/>

  <toolbarbutton id="ButtonEval"          accesskey="&evaluate3.accesskey;"/>
  <toolbarbutton id="menu_consoleTools"   accesskey="&tools3.accesskey;"/>
  <toolbarbutton id="modeCtxButton"       accesskey="&ctx3.accesskey;"/>
  <toolbarbutton id="modeLangButton"      accesskey="&lang3.accesskey;"/>

  <toolbarbutton id="item_modeAll"        accesskey="&all3.accesskey;"/>
  <toolbarbutton id="item_modeMessages"   accesskey="&messages3.accesskey;"/>
  <toolbarbutton id="item_clearConsole"   accesskey="&clear3.accesskey;"/>

  <toolbarbutton id="item_modeLangJS"     accesskey="&lang.js3.accesskey;"/>
  <toolbarbutton id="item_modeLangCSS"    accesskey="&lang.css3.accesskey;"/>
  <toolbarbutton id="item_modeLangXML"    accesskey="&lang.xml3.accesskey;"/>

</overlay>
