src/hid/lesstif/menu.c: Added doxygen comments for GetXY().
[geda-pcb/pcjc2.git] / data / regen_files
blob55dd6d807485b359d02a9900aea272a52ba9f757
1 #!/bin/sh
4 CONVERT=${CONVERT:-convert}
5 COMPOSITE=${COMPOSITE:-composite}
6 INKSCAPE=${INKSCAPE:-inkscape}
7 PPMTOWINICON=${PPMTOWINICON:-ppmtowinicon}
9 do_inkscape=yes
10 do_convert=yes
11 do_winicon=yes
13 usage() {
14 cat << EOF
16 $0 -- Regenerate desktop icon files and windows icon files
18 Options
20 --help Displays this message and exits
22 --skip-png Skips the regeneration of the .png file(s)
24 --skip-winicon Skips the regneration of the Windows icon file(s)
26 EOF
30 while test $# -ne 0 ; do
31 case $1 in
32 --help)
33 usage
34 exit 0
37 --skip-png)
38 do_inkscape=no
39 shift
42 --skip-winicon)
43 do_convert=no
44 do_winicon=no
45 shift
48 -*)
49 echo "$0: Unknown option $1"
50 usage
51 exit 1
55 break
57 esac
58 done
60 if test $? -ne 0 ; then
61 usage
62 exit 1
66 ## Export the SVG graphics
69 # see if we have inkscape
70 if test $do_inkscape = yes ; then
71 ${INKSCAPE} --version 2>&1 >/dev/null
72 if test $? -ne 0 ; then
73 echo "\"${INKSCAPE} --version\" failed."
74 echo "Make sure that inkscape is installed and functional on your system."
75 echo "Skipping the SVG -> PNG conversion."
76 do_inkscape=no
80 if test $do_inkscape = yes ; then
81 echo "Export SVG graphics to png..."
83 for r in 16 22 24 32 48 ; do
84 case ${r} in
85 24)
86 x=-1
87 y=23
88 rs=22
91 x=0
92 y=${r}
93 rs=${r}
95 esac
96 for f in *-${rs}.svg ; do
97 fb=`basename ${f} ${rs}.svg`
98 p="${fb}${r}.png"
99 echo "${f} -> ${p}"
100 ${INKSCAPE} --export-png=${p} --export-area=${x}:${x}:${y}:${y} ${f}
101 done
102 done
106 ## Generate the windows icon file
109 app_icon="application-x-pcb-layout"
111 if test $do_convert = yes ; then
112 # see if we have ImageMagick
113 ${CONVERT} --version 2>&1 >/dev/null
114 if test $? -ne 0 ; then
115 echo "\"${CONVERT} --version\" failed."
116 echo "Make sure that ImageMagick is installed and functional on your system."
117 echo "Skipping the PNG -> PPM conversion."
118 do_convert=no
122 if test $do_convert = yes ; then
123 echo "Creating windows pbm mask files..."
124 ${CONVERT} -channel matte -separate +matte ${app_icon}-48.png - |
125 ${CONVERT} -threshold 65534 -negate - 48_mask.pbm
126 ${CONVERT} -channel matte -separate +matte ${app_icon}-32.png - |
127 ${CONVERT} -threshold 65534 -negate - 32_mask.pbm
128 ${CONVERT} -channel matte -separate +matte ${app_icon}-16.png - |
129 ${CONVERT} -threshold 65534 -negate - 16_mask.pbm
131 echo "Creating windows ppm flattened files..."
132 ${CONVERT} -flatten -colors 16 ${app_icon}-48.png 48_16.ppm
133 ${CONVERT} -flatten -colors 256 ${app_icon}-48.png 48_256.ppm
134 ${CONVERT} -flatten -colors 16 ${app_icon}-32.png 32_16.ppm
135 ${CONVERT} -flatten -colors 256 ${app_icon}-32.png 32_256.ppm
136 ${CONVERT} -flatten -colors 16 ${app_icon}-16.png 16_16.ppm
137 ${CONVERT} -flatten -colors 256 ${app_icon}-16.png 16_256.ppm
140 # see if we have netpbm
141 if test $do_winicon = yes ; then
142 ${PPMTOWINICON} --version 2>&1 >/dev/null
143 if test $? -ne 0 ; then
144 echo "\"${PPMTOWINICON} --version\" failed."
145 echo "Make sure that netpbm is installed and functional on your system."
146 echo "Skipping the pbm -> windows icon conversion."
147 do_winicon=no
151 if test $do_winicon = yes ; then
152 echo "Creating windows icon file..."
153 ${PPMTOWINICON} -output pcb_icon.ico -andpgms\
154 48_16.ppm 48_mask.pbm 48_256.ppm 48_mask.pbm\
155 32_16.ppm 32_mask.pbm 32_256.ppm 32_mask.pbm\
156 16_16.ppm 16_mask.pbm 16_256.ppm 16_mask.pbm
159 rm -f \
160 48_16.ppm 48_256.ppm 48_mask.pbm\
161 32_16.ppm 32_256.ppm 32_mask.pbm\
162 16_16.ppm 16_256.ppm 16_mask.pbm
164 echo "All done"