#!/bin/bash

. $APPDIR/gui_menu
. $APPDIR/gui_misc
. $APPDIR/gui_add
. $APPDIR/gui_toolbar
. $APPDIR/gui_playlist
. $APPDIR/gui_navigation
. $APPDIR/gui_mixer

GUI='
 <vbox> 
  '$GUI_MENUS'
  '$GUI_PROGRESS'

  <hbox scrollable="true" height="200" width-request="10"> ##width-request to avoid scrollbars
   <vbox space-expand="true" space-fill="true">
    <vbox space-expand="false" space-fill="false">
     <text height-request="2"><label>""</label></text>
     '$GUI_ADD_SEARCH'
    </vbox>
    <hbox space-expand="true" space-fill="true">
     '$GUI_ADD_FIELD'
    </hbox>
   </vbox>
   <vbox width-request="350">
    '$GUI_PLAYLIST_FIELD'
   </vbox>
  </hbox>

  ##album-art
  <hbox height-request="90">
    <eventbox tooltip-text="'$(gettext 'Show track-info window')'" above-child="true" visible-window="true" spacing="0" space-expand="false" space-fill="false">
     <pixmap>
      <variable>ARTWORK</variable>
      <input file>'$WORKDIR'/albumart.jpg</input>
      <height>90</height>
     </pixmap>
     <action signal="enter-notify-event">disable:ARTWORK</action>
     <action signal="leave-notify-event">enable:ARTWORK</action>
     <action signal="button-release-event">'$APPDIR'/func_kill -trackinfo</action>
     <action signal="button-release-event">echo false > '$WORKDIR'/UPDATE_TRACKINFO</action> ##this to reset conditional timer - workaround
     <action signal="button-release-event">'$APPDIR'/func_trackinfo "" -gui &</action>
    </eventbox>

   <vbox space-expand="true" space-fill="true" spacing="2">
    <hbox>

     <notebook show-tabs="false" show-border="false" labels="1|2|3|4|5|6|7|8|9" height-request="90" space-expand="true" space-fill="true">
      <vbox space-expand="true" space-fill="true" spacing="0">
       ##svg
       <vbox space-expand="true" space-fill="true">
         '$GUI_SVG_NOWPLAYING'
       </vbox>
       <hbox space-expand="true" space-fill="true" spacing="0">
        <vbox spacing="0">
         <hbox space-expand="true" space-fill="true"><text><label>""</label></text></hbox>
          <vbox height-request="16" space-expand="false" space-fill="false">
           <hbox height-request="16" space-expand="true" space-fill="true">
            '$GUI_PROGRESSBAR'
           </hbox>
          </vbox>
         </vbox>
        </hbox>
       </vbox>
       <vbox>
        '$GUI_MSG'
       </vbox>
       <vbox>
        '$GUI_MSG2'
       </vbox>
       <variable>NOTEBOOK_MAINGUI</variable>
       <input file>'$WORKDIR'/maingui_notebook_page</input>
      </notebook>
  
    <vbox spacing="8">
     <hbox space-expand="false" space-fill="false">
      <vbox homogeneous="true" space-expand="false" space-fill="false">
       <hbox spacing="1" space-expand="false" space-fill="false">
        '$GUI_BUTTON_NEW'
        '$GUI_BUTTON_PLAYLIST_HISTORY_BACK'
        '$GUI_BUTTON_PLAYLIST_HISTORY_FORWARD'
       </hbox>
      </vbox>
      <text space-expand="true" space-fill="true"><label>""</label></text>
      <hbox space-expand="false" space-fill="false">
       <vbox>
       '$GUI_NAVIGATION'
       </vbox>
      </hbox>
      <text space-expand="true" space-fill="true"><label>""</label></text>
      <vbox homogeneous="true" space-expand="false" space-fill="false">
       <hbox spacing="1" space-expand="false" space-fill="false">
        '$GUI_BUTTON_PLAYMODE'
        '$GUI_BUTTON_MIXER'
       </hbox>
      </vbox>
     </hbox>

     ##Volume
     <hbox width-request="350" space-expand="true" space-fill="true" spacing="0">
      <text width-request="200" space-expand="true" space-fill="true"><label>""</label></text>
##      <vbox spacing="0">
##       <text height-request="0" space-expand="true" space-fill="true"><label>""</label></text>
       <vbox height-request="16" space-expand="true" space-fill="true">
        <hbox height-request="16" space-expand="true" space-fill="true">
         '$GUI_VOLUME'
        </hbox>
       </vbox>
##      </vbox>
     </hbox>

    </vbox>
   </hbox>
   <vbox height-request="18" space-expand="false" space-fill="false">
    <hbox  height-request="18" space-expand="true" space-fill="true">
     '$GUI_STATUSBAR'
    </hbox>
   </vbox>
  </vbox>
 </hbox>

 </vbox>
 <variable>WINDOW_TITLE</variable>
 <input file>'$WORKDIR'/window_title</input>
 <action signal="show">'$APPDIR'/func_mixer -get_levels</action>
 <action signal="show">refresh:VOLUME</action>
 <action signal="show">refresh:BALANCE</action>
 <action signal="show">echo > '$WORKDIR'/gui_is_running</action>
 <action signal="show">echo 100 > '$WORKDIR'/splash</action>
 <action signal="delete-event">'$APPDIR'/func_config -write_config</action>
 <action signal="delete-event">'$APPDIR'/func -quit</action>
 <action signal="delete-event">exit:Exit</action>
</window>'
