#!/bin/sh
#  fidget-widget modifies the output of XDesigner.
#  the creation function returns widget1 and does not create the parent.
#  marc + matthieu

NAME=$2
FILE=$1
case $FILE in
  ctreebr_ps.xdc|classbr_ps.xdc) filter="grep -v Offset" ;;
  *) filter=cat ;;
esac
sed "
    /^\*\* Generated by / a\\
	** Modified by fidget-widget, `date +%d-%h-%y`
    /Widget widget0/d
    /^create_widget0/s//Widget $NAME/
    /int h_spacing/s//short h_spacing/
    /widget0 =/d
    /widget1 =/s/widget0/parent/
    /^}/i\\
	return widget1;
    " $FILE | $filter
