# $Id: $
#
# Example of -iv usage to make a gui-wrapper for a 
# command-line program that takes 3 arguments, 
# simulated in these examples by calc-prog.

# Run via:  ./calc-wrap2

cat<<EOF


calc-wrap2 ---

Like calc-wrap, this example illustrates making a wrapper around a
command-line program with -iv, but its putative purpose is
illustrating -bw with some random examples.  It opens eight (8) menus,
4 of them sized and located along left edge of screen, the other 4
sized and located by window manager.  Of the latter 4, 1 will be a
reasonable size, and the other 3 near or exceeding full screen width.

Differences between calc-wrap and calc-wrap2:
  (1) Various -bw sequences here, vs just  -bw dc in calc-wrap
  (2) Various -at 260x200+0+$Y here, vs -at 260x230+0+300  in calc-wrap
  (3) The same menus as in (2) but without -at parameter

EOF

menu() {
AT=$1 BWA=$2 BWB=$3
echo "Creating menu with AT=$AT, BWA=$BWA, and BWB=$BWB."
yume $AT -ti "AT=$AT, BWA=$BWA, and BWB=$BWB"\
 -bw $BWA -bu -la "exit (-bw $BWA)" -ex -la 'Calc w echo' \
   'echo "calc-wrap is running calc-prog $Diam $Leng $Freq ---"; \
    ./calc-prog $Diam $Leng $Freq; echo "--- In calc-wrap again"' \
 -bw dc -bu -la Diam -la '  Wire diam, mm:'  -iv 1\
 -bu -la Leng -la 'Wire length, mm:'  -iv 300\
 -bu -la Freq -la '   Frequency, Hz:' -iv 2000000\
 -bw $BWB -bu -la "exit (-bw $BWB)" -ex -la Calc './calc-prog $Diam $Leng $Freq' &
}

mtwo() {
Y=$1 BWA=$2 BWB=$3
menu "-at 260x190+0+$Y" $BWA $BWB
menu "" $BWA $BWB
}

mtwo 100 ad da
mtwo 325 pb pk
mtwo 550 ^e NL
mtwo 775 tz ni
