<?xml version="1.0"?>

<!-- This Source Code Form is subject to the terms of the Mozilla Public
   - License, v. 2.0. If a copy of the MPL was not distributed with this
   - file, You can obtain one at http://mozilla.org/MPL/2.0/. -->

<!DOCTYPE window [
  <!ENTITY % webideDTD SYSTEM "chrome://devtools/locale/webide.dtd" >
  %webideDTD;
]>

<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>

<?xml-stylesheet href="chrome://global/skin/global.css"?>
<?xml-stylesheet href="resource://devtools/client/themes/common.css"?>
<?xml-stylesheet href="chrome://webide/skin/webide.css"?>

<window id="webide" onclose="return UI.canCloseProject();"
        xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
        xmlns:html="http://www.w3.org/1999/xhtml"
        title="&windowTitle;"
        windowtype="devtools:webide"
        macanimationtype="document"
        fullscreenbutton="true"
        screenX="4" screenY="4"
        width="800" height="600"
        persist="screenX screenY width height sizemode">

  <script type="application/javascript" src="chrome://global/content/globalOverlay.js"></script>
  <script type="application/javascript" src="project-panel.js"></script>
  <script type="application/javascript" src="runtime-panel.js"></script>
  <script type="application/javascript" src="webide.js"></script>

  <commandset id="mainCommandSet">
    <commandset id="editMenuCommands"/>
    <commandset id="webideCommands">
      <command id="cmd_quit" oncommand="Cmds.quit()"/>
      <command id="cmd_newApp" oncommand="Cmds.newApp()" label="&projectMenu_newApp_label;"/>
      <command id="cmd_importPackagedApp" oncommand="Cmds.importPackagedApp()" label="&projectMenu_importPackagedApp_label;"/>
      <command id="cmd_importHostedApp" oncommand="Cmds.importHostedApp()" label="&projectMenu_importHostedApp_label;"/>
      <command id="cmd_showDevicePrefs" label="&runtimeMenu_showDevicePrefs_label;" oncommand="Cmds.showDevicePrefs()"/>
      <command id="cmd_showSettings" label="&runtimeMenu_showSettings_label;" oncommand="Cmds.showSettings()"/>
      <command id="cmd_removeProject" oncommand="Cmds.removeProject()" label="&projectMenu_remove_label;"/>
      <command id="cmd_showProjectPanel" oncommand="Cmds.showProjectPanel()"/>
      <command id="cmd_showRuntimePanel" oncommand="Cmds.showRuntimePanel()"/>
      <command id="cmd_disconnectRuntime" oncommand="Cmds.disconnectRuntime()" label="&runtimeMenu_disconnect_label;"/>
      <command id="cmd_showMonitor" oncommand="Cmds.showMonitor()" label="&runtimeMenu_showMonitor_label;"/>
      <command id="cmd_showPermissionsTable" oncommand="Cmds.showPermissionsTable()" label="&runtimeMenu_showPermissionTable_label;"/>
      <command id="cmd_showRuntimeDetails" oncommand="Cmds.showRuntimeDetails()" label="&runtimeMenu_showDetails_label;"/>
      <command id="cmd_takeScreenshot" oncommand="Cmds.takeScreenshot()" label="&runtimeMenu_takeScreenshot_label;"/>
      <command id="cmd_toggleEditor" oncommand="Cmds.toggleEditors()" label="&viewMenu_toggleEditor_label;"/>
      <command id="cmd_showAddons" oncommand="Cmds.showAddons()"/>
      <command id="cmd_showPrefs" oncommand="Cmds.showPrefs()"/>
      <command id="cmd_showTroubleShooting" oncommand="Cmds.showTroubleShooting()"/>
      <command id="cmd_play" oncommand="Cmds.play()"/>
      <command id="cmd_stop" oncommand="Cmds.stop()" label="&projectMenu_stop_label;"/>
      <command id="cmd_toggleToolbox" oncommand="Cmds.toggleToolbox()"/>
      <command id="cmd_zoomin" label="&viewMenu_zoomin_label;" oncommand="Cmds.zoomIn()"/>
      <command id="cmd_zoomout" label="&viewMenu_zoomout_label;" oncommand="Cmds.zoomOut()"/>
      <command id="cmd_resetzoom" label="&viewMenu_resetzoom_label;" oncommand="Cmds.resetZoom()"/>
    </commandset>
  </commandset>

  <menubar id="main-menubar">
    <menu id="menu-project" label="&projectMenu_label;" accesskey="&projectMenu_accesskey;">
      <menupopup id="menu-project-popup">
        <menuitem command="cmd_newApp" accesskey="&projectMenu_newApp_accesskey;"/>
        <menuitem command="cmd_importPackagedApp" accesskey="&projectMenu_importPackagedApp_accesskey;"/>
        <menuitem command="cmd_importHostedApp" accesskey="&projectMenu_importHostedApp_accesskey;"/>
        <menuitem id="menuitem-show_projectPanel" command="cmd_showProjectPanel" key="key_showProjectPanel" label="&projectMenu_selectApp_label;" accesskey="&projectMenu_selectApp_accesskey;"/>
        <menuseparator/>
        <menuitem command="cmd_play" key="key_play" label="&projectMenu_play_label;" accesskey="&projectMenu_play_accesskey;"/>
        <menuitem command="cmd_stop" accesskey="&projectMenu_stop_accesskey;"/>
        <menuitem command="cmd_toggleToolbox" key="key_toggleToolbox" label="&projectMenu_debug_label;" accesskey="&projectMenu_debug_accesskey;"/>
        <menuseparator/>
        <menuitem command="cmd_removeProject" accesskey="&projectMenu_remove_accesskey;"/>
        <menuseparator/>
        <menuitem command="cmd_showPrefs" label="&projectMenu_showPrefs_label;" accesskey="&projectMenu_showPrefs_accesskey;"/>
        <menuitem command="cmd_showAddons" label="&projectMenu_manageComponents_label;" accesskey="&projectMenu_manageComponents_accesskey;"/>
      </menupopup>
    </menu>

    <menu id="menu-runtime" label="&runtimeMenu_label;" accesskey="&runtimeMenu_accesskey;">
      <menupopup id="menu-runtime-popup">
        <menuitem command="cmd_showMonitor" accesskey="&runtimeMenu_showMonitor_accesskey;"/>
        <menuitem command="cmd_takeScreenshot" accesskey="&runtimeMenu_takeScreenshot_accesskey;"/>
        <menuitem command="cmd_showPermissionsTable" accesskey="&runtimeMenu_showPermissionTable_accesskey;"/>
        <menuitem command="cmd_showRuntimeDetails" accesskey="&runtimeMenu_showDetails_accesskey;"/>
        <menuitem command="cmd_showDevicePrefs" accesskey="&runtimeMenu_showDevicePrefs_accesskey;"/>
        <menuitem command="cmd_showSettings" accesskey="&runtimeMenu_showSettings_accesskey;"/>
        <menuseparator/>
        <menuitem command="cmd_disconnectRuntime" accesskey="&runtimeMenu_disconnect_accesskey;"/>
      </menupopup>
    </menu>

    <menu id="menu-view" label="&viewMenu_label;" accesskey="&viewMenu_accesskey;">
      <menupopup id="menu-ViewPopup">
        <menuitem command="cmd_toggleEditor" key="key_toggleEditor" accesskey="&viewMenu_toggleEditor_accesskey;"/>
        <menuseparator/>
        <menuitem command="cmd_zoomin" key="key_zoomin" accesskey="&viewMenu_zoomin_accesskey;"/>
        <menuitem command="cmd_zoomout" key="key_zoomout" accesskey="&viewMenu_zoomout_accesskey;"/>
        <menuitem command="cmd_resetzoom" key="key_resetzoom" accesskey="&viewMenu_resetzoom_accesskey;"/>
      </menupopup>
    </menu>

  </menubar>

  <keyset id="mainKeyset">
    <key key="&key_quit;" id="key_quit" command="cmd_quit" modifiers="accel"/>
    <key key="&key_showProjectPanel;" id="key_showProjectPanel" command="cmd_showProjectPanel" modifiers="accel"/>
    <key key="&key_play;" id="key_play" command="cmd_play" modifiers="accel"/>
    <key key="&key_toggleEditor;" id="key_toggleEditor" command="cmd_toggleEditor" modifiers="accel"/>
    <key keycode="&key_toggleToolbox;" id="key_toggleToolbox" command="cmd_toggleToolbox"/>
    <key key="&key_zoomin;" id="key_zoomin" command="cmd_zoomin" modifiers="accel"/>
    <key key="&key_zoomin2;" id="key_zoomin2" command="cmd_zoomin" modifiers="accel"/>
    <key key="&key_zoomout;" id="key_zoomout" command="cmd_zoomout" modifiers="accel"/>
    <key key="&key_resetzoom;" id="key_resetzoom" command="cmd_resetzoom" modifiers="accel"/>
  </keyset>

  <tooltip id="aHTMLTooltip" page="true"/>

  <toolbar id="main-toolbar">

    <vbox flex="1">
      <hbox id="action-buttons-container" class="busy">
        <toolbarbutton id="action-button-play"  class="action-button" command="cmd_play" tooltiptext="&projectMenu_play_label;"/>
        <toolbarbutton id="action-button-stop"  class="action-button" command="cmd_stop" tooltiptext="&projectMenu_stop_label;"/>
        <toolbarbutton id="action-button-debug" class="action-button" command="cmd_toggleToolbox" tooltiptext="&projectMenu_debug_label;"/>
        <hbox id="action-busy" align="center">
          <html:img id="action-busy-undetermined" src="chrome://webide/skin/throbber.svg"/>
          <progressmeter id="action-busy-determined"/>
        </hbox>
      </hbox>

      <hbox id="panel-buttons-container">
        <spacer flex="1"/>
        <toolbarbutton id="runtime-panel-button" class="panel-button">
          <image class="panel-button-image"/>
          <label class="panel-button-label" value="&runtimeButton_label;"/>
        </toolbarbutton>
      </hbox>

    </vbox>
  </toolbar>

  <notificationbox flex="1" id="notificationbox">
    <div flex="1" id="deck-panels">
      <vbox id="project-listing-panel" class="project-listing panel-list" flex="1">
        <div id="project-listing-wrapper" class="panel-list-wrapper">
          <iframe id="project-listing-panel-details" flex="1" src="project-listing.xhtml" tooltip="aHTMLTooltip"/>
        </div>
      </vbox>
      <splitter class="devtools-side-splitter" id="project-listing-splitter"/>
      <deck flex="1" id="deck" selectedIndex="-1">
        <iframe id="deck-panel-details" flex="1" src="details.xhtml"/>
        <iframe id="deck-panel-projecteditor" flex="1"/>
        <iframe id="deck-panel-addons" flex="1" src="addons.xhtml"/>
        <iframe id="deck-panel-prefs" flex="1" src="prefs.xhtml"/>
        <iframe id="deck-panel-permissionstable" flex="1" lazysrc="permissionstable.xhtml"/>
        <iframe id="deck-panel-runtimedetails" flex="1" lazysrc="runtimedetails.xhtml"/>
        <iframe id="deck-panel-monitor" flex="1" lazysrc="monitor.xhtml"/>
        <iframe id="deck-panel-devicepreferences" flex="1" lazysrc="devicepreferences.xhtml"/>
        <iframe id="deck-panel-devicesettings" flex="1" lazysrc="devicesettings.xhtml"/>
        <iframe id="deck-panel-logs" flex="1" src="logs.xhtml"/>
        <iframe id="deck-panel-simulator" flex="1" lazysrc="simulator.xhtml"/>
      </deck>
      <splitter class="devtools-side-splitter" id="runtime-listing-splitter"/>
      <vbox id="runtime-listing-panel" class="runtime-listing panel-list" flex="1">
        <div id="runtime-listing-wrapper" class="panel-list-wrapper">
          <iframe id="runtime-listing-panel-details" flex="1" src="runtime-listing.xhtml" tooltip="aHTMLTooltip"/>
        </div>
      </vbox>
    </div>
    <splitter hidden="true" class="devtools-horizontal-splitter" orient="vertical"/>
    <!-- toolbox iframe will be inserted here -->
  </notificationbox>

</window>