#!/bin/bash
#Ptimer
#Copyright 2007,2008
#Sigmund Berglund

#------------------------------
#This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation version 2.

#This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. <http://www.gnu.org/licenses/>.
#------------------------------

VERSION="0.1"
APPDIR="`dirname $0`"
[ "$APPDIR" = "." ] && APPDIR="`pwd`"
export APPDIR="$APPDIR"

export Ptimer="
<window title=\"Ptimer $VERSION\"icon-name=\"gtk-execute\">
 <vbox>
  <notebook labels=\" ストップウォッチ | 時計 | スタイル\">
   <vbox>
    <frame タイマー>
     <checkbox>
      <variable>TIMER</variable>
      <label>指定された時間経過後にアラーム</label>
      <action>if false disable:ENTRY_TIMER</action>
      <action>if true enable:ENTRY_TIMER</action>
      <action>if false disable:TEXT_TIMER</action>
      <action>if true enable:TEXT_TIMER</action>
     </checkbox>
     <hbox>
      <entry>
       <variable>ENTRY_TIMER</variable>
       <input>echo '00:00'</input>
       <visible>disabled</visible>
      </entry>
      <text>
       <variable>TEXT_TIMER</variable>
       <label>分:秒</label>
       <visible>disabled</visible>
      </text>
     </hbox>
    </frame>
    <frame カウント>
     <checkbox>
      <variable>TENTH</variable>
      <default>true</default>
      <label>１／１０秒を数える</label>
      <action>if true disable:COUNTDOWN</action>
      <action>if false enable:COUNTDOWN</action>
     </checkbox>
     <checkbox>
      <variable>COUNTDOWN</variable>
      <default>true</default>
      <visible>disabled</visible>
      <label>カウントダウン - システム時刻と同期</label>
      <action>if true enable:TENTH</action>
      <action>if false disable:TENTH</action>
     </checkbox>
    </frame>
    <hbox>
     <checkbox>
      <variable>AUTOSTART</variable>
      <default>true</default>
      <label>オートスタート</label>
     </checkbox>
    </hbox>
    <button>
     <label>スタート</label>
     <action>. $APPDIR/func -stopwatch</action>
    </button>
   </vbox>
   <vbox>
    <frame アラーム>
     <checkbox>
      <variable>CLOCK_ALARM</variable>
      <label>指定された時刻にアラーム</label>
      <action>if false disable:ENTRY_ALARM</action>
      <action>if true enable:ENTRY_ALARM</action>
      <action>if false disable:TEXT_ALARM</action>
      <action>if true enable:TEXT_ALARM</action>
     </checkbox>
     <hbox>
      <entry>
       <variable>ENTRY_ALARM</variable>
       <input>echo '00:00'</input>
       <visible>disabled</visible>
      </entry>
      <text>
       <variable>ALARM_TIMER</variable>
       <label>時:分</label>
       <visible>disabled</visible>
      </text>
     </hbox>
    </frame>
    <button>
     <label>スタート</label>
     <action>. $APPDIR/func -clock</action>
    </button>
   </vbox>
   <vbox>
    <frame サウンド>
     <hbox>
      <text><label>アラーム</label></text>
      <entry>
       <variable>SOUND_ALARM</variable>
       <input>echo 'aplay /usr/share/audio/beep_high.wav'</input>
      </entry>
     </hbox>
    <hbox>
      <text><label>ビープ 高</label></text>
      <entry>
       <variable>SOUND_BEEP_HIGH</variable>
       <input>echo 'aplay /usr/share/audio/beep_high.wav'</input>
      </entry>
     </hbox>
    <hbox>
      <text><label>ビープ 低</label></text>
      <entry>
       <variable>SOUND_BEEP_LOW</variable>
       <input>echo 'aplay /usr/share/audio/beep_low.wav'</input>
      </entry>
     </hbox>
    </frame>
    <frame フォント>
     <hbox>
      <entry>
       <variable>ENTRY_FONT</variable>
       <input>echo 'Mono'</input>
      </entry>
      <entry>
       <variable>ENTRY_FONTSIZE</variable>
       <input>echo '60'</input>
       <width>40</width><height>25</height>
      </entry>
     </hbox>
    </frame>
    <frame ウィンドウサイズ (たて:よこ)>
     <entry>
      <variable>ENTRY_WINDOWSIZE</variable>
     </entry>
    </frame>
   </vbox>
  </notebook>
 </vbox>
</window>"
I=$IFS; IFS=""
for STATEMENTS in  $(gtkdialog3 --program=Ptimer --center); do
	eval $STATEMENTS
done
IFS=$I
case $EXIT in
	*)			exit;;
esac
