<?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/. -->

<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/content/instantbird.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/content/blist.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/content/tabbrowser.css" type="text/css"?>
<?xml-stylesheet href="chrome://instantbird/skin/tabbrowser.css" type="text/css"?>
#ifdef XP_MACOSX
<?xul-overlay href="chrome://instantbird/content/menus.xul"?>
#endif

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

<!DOCTYPE window [
  <!ENTITY % instantbirdDTD SYSTEM "chrome://instantbird/locale/instantbird.dtd">
  %instantbirdDTD;
  <!ENTITY % brandDTD SYSTEM "chrome://branding/locale/brand.dtd">
  %brandDTD;
  <!ENTITY % textcontextDTD SYSTEM "chrome://global/locale/textcontext.dtd">
  %textcontextDTD;
]>

<window
  id     = "convWindow"
  windowtype="Messenger:convs"
  title  = "&convWindow.title;"
  titlemenuseparator="&convWindow.titlemodifiermenuseparator;"
  titlemodifier="&convWindow.titlemodifier;"
  width  = "500"
  height = "600"
  onclose= "return getTabBrowser().warnAboutClosingTabs(true);"
  persist= "width height screenX screenY"
  xmlns:svg="http://www.w3.org/2000/svg"
  xmlns  = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
  <script type="application/javascript" src="chrome://instantbird/content/utilities.js"/>
  <script type="application/javascript" src="chrome://instantbird/content/instantbird.js"/>
#ifdef XP_MACOSX
  <script type="application/javascript" src="chrome://instantbird/content/macgestures.js"/>
#else
  <script type="application/javascript" src="chrome://global/content/globalOverlay.js"/>
#endif
  <script type="application/javascript" src="chrome://global/content/viewZoomOverlay.js"/>
  <script type="application/javascript" src="chrome://instantbird/content/convZoom.js"/>
  <script type="application/javascript" src="chrome://instantbird/content/nsContextMenu.js"/>

#ifdef XP_MACOSX
# As menus.xul.inc, but with an Edit menu.
  <commandset id="maincommandset"/>
  <keyset id="mainkeyset"/>
  <menubar id="blistMenubar">
    <menu id="menu_edit">
      <menupopup id="menu_editpopup">
        <menuitem id="menu_undo"/>
        <menuitem id="menu_redo"/>
        <menuseparator/>
        <menuitem id="menu_cut"/>
        <menuitem id="menu_copy"/>
        <menuitem id="menu_paste"/>
        <menuitem id="menu_delete"/>
        <menuseparator/>
        <menuitem id="menu_selectAll"/>
        <menuseparator/>
        <menuitem id="menu_find"/>
        <menuitem id="menu_findAgain"/>
      </menupopup>
    </menu>
  </menubar>
  <popupset id="mainPopupSet"/>
#endif

  <commandset id="conversationsCommands">
    <command id="cmd_newtab" oncommand="Conversations.showNewTab()"/>
    <command id="cmd_close" oncommand="getTabBrowser().removeCurrentTab()"/>
    <command id="cmd_putOnHold"
             oncommand="var tabbrowser = getTabBrowser();
                        if (!tabbrowser.selectedConversation) return;
                        tabbrowser.selectedConversation.hide();
                        tabbrowser.removeCurrentTab();"/>
    <command id="cmd_showLogs"
             oncommand="var conv = getTabBrowser().selectedConversation;
                        if (conv) conv.showLogs();"/>
    <command id="cmd_textZoomReduce" oncommand="if (getBrowser()) FullZoom.reduce();"/>
    <command id="cmd_textZoomEnlarge" oncommand="if (getBrowser()) FullZoom.enlarge();"/>
    <command id="cmd_textZoomReset" oncommand="if (getBrowser()) FullZoom.reset();"/>
    <command id="cmd_find"
             oncommand="var panel = getTabBrowser().selectedPanel;
                        if (!panel) return;
                        if (panel.findbar) panel.findbar.onFindCommand();"/>
    <command id="cmd_findAgain"
             oncommand="findAgain(false)"/>
    <command id="cmd_findPrevious"
             oncommand="findAgain(true)"/>
    <commandset id="editMenuCommands"/>
  </commandset>

  <keyset id="conversationsKeys">
    <key id="key_newtab" key="t" modifiers="accel" command="cmd_newtab"/>
    <key id="key_close" key="w" modifiers="accel" command="cmd_close"/>
    <key id="key_putOnHold" keycode="VK_ESCAPE" command="cmd_putOnHold"/>
    <key id="key_showLogs" key="h" modifiers="accel,shift" command="cmd_showLogs"/>
    <key id="key_textZoomEnlarge" key="&textEnlarge.commandkey;" command="cmd_textZoomEnlarge" modifiers="accel"/>
    <key id="key_textZoomEnlarge2" key="&textEnlarge.commandkey2;" command="cmd_textZoomEnlarge" modifiers="accel"/>
    <key id="key_textZoomEnlarge3" key="&textEnlarge.commandkey3;" command="cmd_textZoomEnlarge" modifiers="accel"/>
    <key id="key_textZoomReduce"  key="&textReduce.commandkey;" command="cmd_textZoomReduce" modifiers="accel"/>
    <key id="key_textZoomReduce2"  key="&textReduce.commandkey2;" command="cmd_textZoomReduce" modifiers="accel"/>
    <key id="key_textZoomReset" key="&textReset.commandkey;" command="cmd_textZoomReset" modifiers="accel"/>
    <key id="key_textZoomReset2" key="&textReset.commandkey2;" command="cmd_textZoomReset" modifiers="accel"/>
    <key id="key_find" key="&findOnCmd.commandkey;" command="cmd_find" modifiers="accel"/>
    <key id="key_findAgain" key="&findAgainCmd.commandkey;" command="cmd_findAgain" modifiers="accel"/>
    <key id="key_findPrevious" key="&findAgainCmd.commandkey;" command="cmd_findPrevious" modifiers="accel,shift"/>
    <key keycode="&findAgainCmd.commandkey2;" command="cmd_findAgain"/>
    <key keycode="&findAgainCmd.commandkey2;"  command="cmd_findPrevious" modifiers="shift"/>

#ifdef XP_UNIX
#ifndef XP_MACOSX
#define XP_LINUX
#endif
#endif
#ifdef XP_LINUX
#define NUM_SELECT_TAB_MODIFIER alt
#else
#define NUM_SELECT_TAB_MODIFIER accel
#endif
#expand    <key id="key_selectTab1" oncommand="getTabBrowser().selectTabAtIndex(0, event);" key="1" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab2" oncommand="getTabBrowser().selectTabAtIndex(1, event);" key="2" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab3" oncommand="getTabBrowser().selectTabAtIndex(2, event);" key="3" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab4" oncommand="getTabBrowser().selectTabAtIndex(3, event);" key="4" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab5" oncommand="getTabBrowser().selectTabAtIndex(4, event);" key="5" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab6" oncommand="getTabBrowser().selectTabAtIndex(5, event);" key="6" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab7" oncommand="getTabBrowser().selectTabAtIndex(6, event);" key="7" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectTab8" oncommand="getTabBrowser().selectTabAtIndex(7, event);" key="8" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
#expand    <key id="key_selectLastTab" oncommand="getTabBrowser().selectTabAtIndex(-1, event);" key="9" modifiers="__NUM_SELECT_TAB_MODIFIER__"/>
  </keyset>

  <stringbundleset id="stringbundleset">
    <stringbundle id="bundle_instantbird" src="chrome://instantbird/locale/instantbird.properties"/>
  </stringbundleset>

  <popupset id="mainPopupSet">
    <tooltip id="imTooltip" type="im"/>

    <menupopup id="contentAreaContextMenu"
               onpopupshowing="if (event.target != this) return true; gContextMenu = new nsContextMenu(this, window.getBrowser()); return gContextMenu.shouldDisplay;"
               onpopuphiding="if (event.target == this &amp;&amp; gContextMenu) { gContextMenu.cleanup(); gContextMenu = null; }">
      <menuitem id="context-nick-openconv"
                oncommand="gContextMenu.nickOpenConv();"/>
      <menuitem id="context-nick-showlogs"
                oncommand="gContextMenu.nickShowLogs();"/>
      <menu id="context-nick-addcontact"/>
      <menuseparator id="context-sep-nick"/>

      <menuitem id="context-openlink"
                label="&openLinkCmd.label;"
                accesskey="&openLinkCmd.accesskey;"
                oncommand="gContextMenu.openLink();"/>
      <menuitem id="context-copyemail"
                label="&copyEmailCmd.label;"
                accesskey="&copyEmailCmd.accesskey;"
                oncommand="gContextMenu.copyEmail();"/>
      <menuitem id="context-copylink"
                label="&copyLinkCmd.label;"
                accesskey="&copyLinkCmd.accesskey;"
                oncommand="goDoCommand('cmd_copyLink');"/>
      <menuseparator id="context-sep-copylink"/>

      <menuitem id="context-copy"
                label="&copyCmd.label;"
                accesskey="&copyCmd.accesskey;"
                command="cmd_copy"/>
      <menuitem id="context-selectall"
                label="&selectAllCmd.label;"
                accesskey="&selectAllCmd.accesskey;"
                command="cmd_selectAll"/>
      <menuseparator id="context-sep-selectall"/>
      <menuseparator id="context-sep-messageactions"/>
      <menuitem id="context-searchselect"
                oncommand="gContextMenu.searchSelection();"/>
      <menu id="context-searchselect-with">
        <menupopup id="context-popup-searchselect-with"
                   onpopupshowing="gContextMenu.buildSearchEngineList();"
                   oncommand="gContextMenu.searchSelectionWith(event)">
          <menuseparator id="context-sep-enginemanager"/>
          <menuitem id="context-enginemanager"
                    label="&engineManagerCmd.label;"
                    oncommand="gContextMenu.openEngineManager();"/>
        </menupopup>
      </menu>
    </menupopup>
  </popupset>

  <tabconversation id="conversations" flex="1"
                   contenttooltip="imTooltip"
                   contentcontextmenu="contentAreaContextMenu"/>

#ifdef XP_MACOSX
  <svg:svg height="0">
    <svg:mask id="pinstripe-tab-left-curve-mask" maskContentUnits="userSpaceOnUse">
      <svg:circle cx="9" cy="3" r="3" fill="white"/>
      <svg:rect x="9" y="0" width="3" height="3" fill="white"/>
      <svg:rect x="6" y="3" width="6" height="19" fill="white"/>
      <svg:rect x="1" y="17" width="5" height="5" fill="white"/>
      <svg:circle cx="1" cy="17" r="5"/>
      <svg:rect x="0" y="22" width="12" height="1" fill="white"/>
    </svg:mask>
    <svg:mask id="pinstripe-tab-right-curve-mask" maskContentUnits="userSpaceOnUse">
      <svg:circle cx="3" cy="3" r="3" fill="white"/>
      <svg:rect x="0" y="0" width="3" height="3" fill="white"/>
      <svg:rect x="0" y="3" width="6" height="19" fill="white"/>
      <svg:rect x="6" y="17" width="5" height="5" fill="white"/>
      <svg:circle cx="11" cy="17" r="5"/>
      <svg:rect x="0" y="22" width="12" height="1" fill="white"/>
    </svg:mask>
  </svg:svg>
#endif
</window>
