#!/bin/sh

cfgfile=`xsetrcv wcfg`

if [ -f $cfgfile ]; then
    picture=`cat $cfgfile |grep ^r_picture |sed 's/r_picture=//'`
    lastpic=`cat $cfgfile |grep ^r_lastpic |sed 's/r_lastpic=//'`
fi

eval `dml "<meta title='To pulpitu' width=67 height=22><br><br>\
<check id=tap checked=$picture> Mapa bitowa ta<br><br>\
<input id=file width=55 caption=$lastpic title=Wybierz fs=r label="..."><br><br>\
<menu id=m>\
<item id=white>  Biey  \
<item id=cyan>  Cyan  \
<item id=black>  Czarny  \
<item id=red>  Czerwony  \
<item id=darkblue>  DarkBlue  \
<item id=gray>  Szary  \
<item id=magenta>  Magenta  \
<item id=blue>  Niebieski  \
<item id=green>  Zielony  \
<item id=yellow>  ty  \
<item id="#006100">  Ulubiony  \
</menu><br><br>\
              <button caption=Ustaw> \
                <button caption=Anuluj id=end><br><br>"`

if [ X$end = Xyes ]; then
    exit 0
fi
if [ X$tap = Xyes ]; then
    picture=1
    xsetroot -bitmap $file
else    
    picture=0
    xsetroot -solid $m
fi

cat $cfgfile |sed 's/r_picture=//' |sed 's/r_lastpic=//' \
|sed 's/r_lastsolid=//' |grep = >$cfgfile

echo "r_picture=$picture" >>$cfgfile
echo "r_lastpic=$file" >>$cfgfile
echo "r_lastsolid=$m" >>$cfgfile
