<?xml version="1.0" encoding="UTF-8"?>
<interface>
  <requires lib="gtk" version="4.0"/>
  <requires lib="adw" version="1.0"/>
  <template class="BaseHeaderbar" parent="AdwBin">
    <child>
      <object class="AdwHeaderBar" id="headerbar">
        <child type="start">
          <object class="GtkButton">
            <property name="tooltip-text" translatable="yes">New File</property>
            <property name="action-name">app.new-window</property>
            <property name="icon_name">document-new-symbolic</property>
          </object>
        </child>
        <child type="start">
          <object class="GtkMenuButton">
            <property name="label" translatable="yes">_Open</property>
            <property name="use-underline">True</property>
            <property name="can-shrink">True</property>
            <property name="tooltip-text" translatable="yes">Open Markdown File</property>
            <property name="popover">open_menu</property>
          </object>
        </child>
        <child type="start">
          <object class="AdwSplitButton">
            <property name="label" translatable="yes">_Save</property>
            <property name="use-underline">True</property>
            <property name="can-shrink">True</property>
            <property name="tooltip-text" translatable="yes">Save Markdown File</property>
            <property name="action-name">win.save</property>
            <property name="menu-model">export_menu</property>
          </object>
        </child>
        <child type="end">
          <object class="GtkButton" id="exit_fs_button">
            <property name="action-name">win.fullscreen</property>
            <property name="visible" bind-source="BaseHeaderbar" bind-property="is_fullscreen" bind-flags="sync-create"/>
            <property name="icon-name">view-restore-symbolic</property>
          </object>
        </child>
        <child type="end">
          <object class="GtkMenuButton" id="menu_button">
            <property name="menu-model">Main Menu</property>
            <property name="icon-name">open-menu-symbolic</property>
            <property name="tooltip-text" translatable="yes">Main Menu</property>
            <style>
              <class name="image-button"/>
            </style>
          </object>
        </child>
        <child type="end">
          <object class="PreviewLayoutSwitcher" id="preview_layout_switcher"/>
        </child>
        <child type="end">
          <object class="GtkToggleButton">
            <property name="tooltip-text" translatable="yes">Search in the File</property>
            <property name="action-name">win.find</property>
            <property name="icon-name">system-search-symbolic</property>
          </object>
        </child>
        <style>
          <class name="titlebar"/>
        </style>
      </object>
    </child>
  </template>
  <object class="ApostropheOpenPopover" id="open_menu"/>

  <!-- Main Menu-->

  <menu id="Main Menu">
    <section>
      <item>
        <attribute name="custom">themeswitcher</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">_Hemingway Mode</attribute>
        <attribute name="action">win.hemingway_mode</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_Focus Mode</attribute>
        <attribute name="action">win.focus_mode</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">Find and _Replace</attribute>
        <attribute name="action">win.find_replace</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">_Preferences</attribute>
        <attribute name="action">app.preferences</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">Open _Tutorial</attribute>
        <attribute name="action">win.open_file</attribute>
        <attribute name="target">resource:///org/gnome/gitlab/somas/Apostrophe/media/apostrophe_markdown.md</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_Keyboard Shortcuts</attribute>
        <attribute name="action">win.show-help-overlay</attribute>
      </item>
      <item>
        <attribute name="label" translatable="yes">_About Apostrophe</attribute>
        <attribute name="action">app.about</attribute>
      </item>
    </section>
  </menu>

  <!-- Export Menu -->

  <menu id="export_menu">
    <section>
      <item>
        <attribute name="label" translatable="yes">_Save As...</attribute>
        <attribute name="action">win.save_as</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="no">_PDF</attribute>
        <attribute name="action">win.export</attribute>
        <attribute name="target">pdf</attribute>
      </item>
      <item>
        <attribute name="label" translatable="no">_HTML</attribute>
        <attribute name="action">win.export</attribute>
        <attribute name="target">html</attribute>
      </item>
      <item>
        <attribute name="label" translatable="no">_ODT</attribute>
        <attribute name="action">win.export</attribute>
        <attribute name="target">odt</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">Advanced _Export…</attribute>
        <attribute name="action">win.advanced_export</attribute>
      </item>
    </section>
    <section>
      <item>
        <attribute name="label" translatable="yes">_Copy HTML</attribute>
        <attribute name="action">win.copy_html</attribute>
      </item>
    </section>
  </menu>
</interface>
