Commit patch from Brian Sidebotham: Project template in Kicad manager

This commit is contained in:
Brian Sidebotham 2012-10-14 18:57:11 +02:00 committed by jean-pierre charras
parent 621a43c4ad
commit 9823666ca9
26 changed files with 2595 additions and 44 deletions

View File

@ -108,10 +108,16 @@ if(CMAKE_COMPILER_IS_GNUCXX)
# conversion in the Boost polygon library. At some point in the future when # conversion in the Boost polygon library. At some point in the future when
# Boost is updated to the next version, -Wno-narrowing should be removed to # Boost is updated to the next version, -Wno-narrowing should be removed to
# see if the problem has been resolved. Wayne. # see if the problem has been resolved. Wayne.
#
# Also note the optimization level is -O1 instead of the usual -O2 level
# because boost::polygon has a function (inflate polygon) broken by
# the -O2 level with GCC 4.7 (works fine with with GCC 4.6).
# This lower optimization level does not have a significant change on the speed.
#
if(WIN32) # under Windows/mingw, -fPIC option is enabled by default if(WIN32) # under Windows/mingw, -fPIC option is enabled by default
# Set default flags for Release build. # Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG") set(CMAKE_C_FLAGS_RELEASE "-Wall -Wno-narrowing -O1 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wno-narrowing -O2 -DNDEBUG") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -Wno-narrowing -O1 -DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build. # Set default flags for Debug build.
@ -119,8 +125,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "-Wall -Wno-narrowing -g3 -ggdb3 -DDEBUG")
else(WIN32) else(WIN32)
# Set default flags for Release build. # Set default flags for Release build.
set(CMAKE_C_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC") set(CMAKE_C_FLAGS_RELEASE "-Wall -O1 -DNDEBUG -fPIC")
set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O2 -DNDEBUG -fPIC") set(CMAKE_CXX_FLAGS_RELEASE "-Wall -O1 -DNDEBUG -fPIC")
set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "-s")
# Set default flags for Debug build. # Set default flags for Debug build.

View File

@ -395,6 +395,7 @@ set( BMAPS_MID
new_library new_library
new_pcb new_pcb
new_project new_project
new_project_with_template
new_sch new_sch
new_txt new_txt
new new

View File

@ -13,7 +13,7 @@
version="1.1" version="1.1"
viewBox="0 0 48 48" viewBox="0 0 48 48"
id="svg2" id="svg2"
inkscape:version="0.47 r22583" inkscape:version="0.48.1 "
sodipodi:docname="new_project.svg"> sodipodi:docname="new_project.svg">
<metadata <metadata
id="metadata153"> id="metadata153">
@ -36,14 +36,14 @@
inkscape:pageopacity="0" inkscape:pageopacity="0"
inkscape:pageshadow="2" inkscape:pageshadow="2"
inkscape:window-width="1280" inkscape:window-width="1280"
inkscape:window-height="949" inkscape:window-height="968"
id="namedview151" id="namedview151"
showgrid="false" showgrid="false"
inkscape:zoom="4.9166667" inkscape:zoom="12.783333"
inkscape:cx="24" inkscape:cx="24"
inkscape:cy="23.59322" inkscape:cy="23.59322"
inkscape:window-x="0" inkscape:window-x="-4"
inkscape:window-y="25" inkscape:window-y="-4"
inkscape:window-maximized="1" inkscape:window-maximized="1"
inkscape:current-layer="svg2" /> inkscape:current-layer="svg2" />
<defs <defs
@ -545,22 +545,25 @@
</g> </g>
</g> </g>
<g <g
transform="matrix(4.1228166,0,0,4.0916513,-12.598545,25.226531)" transform="matrix(4.1228166,0,0,4.0916513,-14.945351,27.182202)"
id="g78"> id="g78">
<path <path
style="fill:#afaf00" style="fill:#afaf00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z" d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.86499,0,0,0.86499,3.3638,-4.5167)" transform="matrix(0.86499,0,0,0.86499,3.3638,-4.5167)"
id="path80" /> id="path80"
inkscape:connector-curvature="0" />
<path <path
style="fill:#ebeb00" style="fill:#ebeb00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z" d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.61624,0,0,0.61624,5.7296,-4.1188)" transform="matrix(0.61624,0,0,0.61624,5.7296,-4.1188)"
id="path82" /> id="path82"
inkscape:connector-curvature="0" />
<path <path
style="fill:#ffff00" style="fill:#ffff00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z" d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.3815,0,0,0.3815,7.9622,-3.7434)" transform="matrix(0.3815,0,0,0.3815,7.9622,-3.7434)"
id="path84" /> id="path84"
inkscape:connector-curvature="0" />
</g> </g>
</svg> </svg>

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 17 KiB

View File

@ -0,0 +1,763 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
height="48"
width="48"
version="1.1"
viewBox="0 0 48 48"
id="svg2"
inkscape:version="0.48.1 "
sodipodi:docname="new_project.svg">
<metadata
id="metadata153">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
<dc:title></dc:title>
</cc:Work>
</rdf:RDF>
</metadata>
<sodipodi:namedview
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1280"
inkscape:window-height="968"
id="namedview151"
showgrid="false"
inkscape:zoom="12.783333"
inkscape:cx="24"
inkscape:cy="23.59322"
inkscape:window-x="-4"
inkscape:window-y="-4"
inkscape:window-maximized="1"
inkscape:current-layer="svg2" />
<defs
id="defs4">
<filter
id="q"
color-interpolation-filters="sRGB">
<feGaussianBlur
stdDeviation="1.2065414"
id="feGaussianBlur7" />
</filter>
<filter
id="p"
color-interpolation-filters="sRGB">
<feGaussianBlur
stdDeviation="0.89955545"
id="feGaussianBlur10" />
</filter>
<filter
id="z"
color-interpolation-filters="sRGB">
<feGaussianBlur
stdDeviation="2.1604423"
id="feGaussianBlur13" />
</filter>
<linearGradient
id="v"
y2="-373.12"
gradientUnits="userSpaceOnUse"
x2="-56.358"
gradientTransform="matrix(0,1,-1,0,-39.998,140)"
y1="-381.1"
x1="-86.12">
<stop
stop-color="#008c00"
offset="0"
id="stop16" />
<stop
stop-color="#00bf00"
offset="1"
id="stop18" />
</linearGradient>
<radialGradient
id="x"
gradientUnits="userSpaceOnUse"
cy="92"
cx="344"
gradientTransform="matrix(0,1,-1,0,-39.998,140)"
r="36">
<stop
stop-color="#e5ff00"
offset="0"
id="stop21" />
<stop
stop-color="#bff500"
stop-opacity="0"
offset="1"
id="stop23" />
</radialGradient>
<linearGradient
id="ad"
y2="87.759"
gradientUnits="userSpaceOnUse"
x2="336.98"
y1="120.81"
x1="328.12">
<stop
stop-color="#0f0"
offset="0"
id="stop26" />
<stop
stop-color="#006500"
offset="1"
id="stop28" />
</linearGradient>
<clipPath
id="y">
<circle
cy="92"
cx="344"
r="36"
fill="url(#linearGradient5167)"
id="circle31" />
</clipPath>
<filter
id="ab"
color-interpolation-filters="sRGB">
<feGaussianBlur
stdDeviation="2.8805897"
id="feGaussianBlur34" />
</filter>
<linearGradient
id="w"
y2="-131.93"
gradientUnits="userSpaceOnUse"
x2="-45.097"
gradientTransform="matrix(0,0.73882,-0.73882,0,-1.5227,63.256)"
y1="-131.93"
x1="-80.003">
<stop
stop-color="#fff"
offset="0"
id="stop37" />
<stop
stop-color="#fff"
stop-opacity="0"
offset="1"
id="stop39" />
</linearGradient>
<linearGradient
id="u"
y2="65.933"
gradientUnits="userSpaceOnUse"
x2="102"
gradientTransform="translate(20,-56)"
y1="118"
x1="102">
<stop
stop-color="#004d00"
stop-opacity="0"
offset="0"
id="stop42" />
<stop
stop-color="#004d00"
offset=".5"
id="stop44" />
<stop
stop-color="#004d00"
stop-opacity="0"
offset="1"
id="stop46" />
</linearGradient>
<filter
id="aa"
color-interpolation-filters="sRGB">
<feGaussianBlur
stdDeviation="1.04"
id="feGaussianBlur49" />
</filter>
<radialGradient
id="s"
gradientUnits="userSpaceOnUse"
cy="112.3"
cx="102"
gradientTransform="matrix(.875 0 0 .85714 10 17.143)"
r="139.56">
<stop
stop-color="#00537d"
offset="0"
id="stop52" />
<stop
stop-color="#186389"
offset=".0151"
id="stop54" />
<stop
stop-color="#558ca8"
offset=".0558"
id="stop56" />
<stop
stop-color="#89afc3"
offset=".0964"
id="stop58" />
<stop
stop-color="#b3ccd8"
offset=".1357"
id="stop60" />
<stop
stop-color="#d4e2e9"
offset=".1737"
id="stop62" />
<stop
stop-color="#ecf2f5"
offset=".20990"
id="stop64" />
<stop
stop-color="#fafcfd"
offset=".24350"
id="stop66" />
<stop
stop-color="#fff"
offset=".27220"
id="stop68" />
</radialGradient>
<radialGradient
id="t"
gradientUnits="userSpaceOnUse"
cy="109.33"
cx="99.081"
gradientTransform="matrix(.85638 0 0 .84156 11.191 18.14)"
r="139.56">
<stop
stop-color="#7a7d80"
offset="0"
id="stop71" />
<stop
stop-color="#c2c2c2"
offset=".12618"
id="stop73" />
<stop
stop-color="#fafafa"
offset=".23251"
id="stop75" />
<stop
stop-color="#fff"
offset=".27220"
id="stop77" />
<stop
stop-color="#fafafa"
offset=".53130"
id="stop79" />
<stop
stop-color="#ebecec"
offset=".84490"
id="stop81" />
<stop
stop-color="#e1e2e3"
offset="1"
id="stop83" />
</radialGradient>
<linearGradient
id="r"
y2="94.104"
gradientUnits="userSpaceOnUse"
x2="86.572"
gradientTransform="matrix(.875 0 0 .85714 10 17.143)"
y1="104"
x1="96">
<stop
stop-color="#888a85"
offset="0"
id="stop86" />
<stop
stop-color="#8c8e89"
offset=".0072"
id="stop88" />
<stop
stop-color="#abaca9"
offset=".0673"
id="stop90" />
<stop
stop-color="#c5c6c4"
offset=".1347"
id="stop92" />
<stop
stop-color="#dbdbda"
offset=".2115"
id="stop94" />
<stop
stop-color="#ebebeb"
offset=".3012"
id="stop96" />
<stop
stop-color="#f7f7f6"
offset=".4122"
id="stop98" />
<stop
stop-color="#fdfdfd"
offset=".5679"
id="stop100" />
<stop
stop-color="#fff"
offset="1"
id="stop102" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#s"
id="radialGradient2979"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.875,0,0,0.85714,10,17.143)"
cx="102"
cy="112.3"
r="139.56" />
<radialGradient
inkscape:collect="always"
xlink:href="#t"
id="radialGradient2981"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.85638,0,0,0.84156,11.191,18.14)"
cx="99.081"
cy="109.33"
r="139.56" />
<linearGradient
inkscape:collect="always"
xlink:href="#r"
id="linearGradient2983"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.875,0,0,0.85714,10,17.143)"
x1="96"
y1="104"
x2="86.572"
y2="94.104" />
<radialGradient
inkscape:collect="always"
xlink:href="#s"
id="radialGradient2985"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.875,0,0,0.85714,10,17.143)"
cx="102"
cy="112.3"
r="139.56" />
<radialGradient
inkscape:collect="always"
xlink:href="#t"
id="radialGradient2987"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.85638,0,0,0.84156,11.191,18.14)"
cx="99.081"
cy="109.33"
r="139.56" />
<linearGradient
inkscape:collect="always"
xlink:href="#r"
id="linearGradient2989"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.875,0,0,0.85714,10,17.143)"
x1="96"
y1="104"
x2="86.572"
y2="94.104" />
<linearGradient
inkscape:collect="always"
xlink:href="#v"
id="linearGradient3014"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,1,-1,0,-39.998,140)"
x1="-86.12"
y1="-381.1"
x2="-56.358"
y2="-373.12" />
<radialGradient
inkscape:collect="always"
xlink:href="#x"
id="radialGradient3016"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,1,-1,0,-39.998,140)"
cx="344"
cy="92"
r="36" />
<linearGradient
inkscape:collect="always"
xlink:href="#ad"
id="linearGradient3018"
gradientUnits="userSpaceOnUse"
x1="328.12"
y1="120.81"
x2="336.98"
y2="87.759" />
<linearGradient
inkscape:collect="always"
xlink:href="#w"
id="linearGradient3020"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0,0.73882,-0.73882,0,-1.5227,63.256)"
x1="-80.003"
y1="-131.93"
x2="-45.097"
y2="-131.93" />
<linearGradient
inkscape:collect="always"
xlink:href="#u"
id="linearGradient3022"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(20,-56)"
x1="102"
y1="118"
x2="102"
y2="65.933" />
<linearGradient
inkscape:collect="always"
xlink:href="#i"
id="linearGradient3123"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)"
x1="28.079"
y1="12.338"
x2="30.431999"
y2="14.691" />
<linearGradient
id="i"
y2="14.691"
gradientUnits="userSpaceOnUse"
x2="30.431999"
gradientTransform="translate(6.3922,12.185)"
y1="12.338"
x1="28.079">
<stop
stop-color="#fcaf3e"
offset="0"
id="stop7" />
<stop
stop-color="#ce5c00"
offset="1"
id="stop9" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#j"
id="linearGradient3125"
gradientUnits="userSpaceOnUse"
gradientTransform="translate(6.3922,12.185)"
x1="23.448"
y1="21.481001"
x2="22.809999"
y2="22.118999" />
<linearGradient
id="j"
y2="22.118999"
gradientUnits="userSpaceOnUse"
x2="22.809999"
gradientTransform="translate(6.3922,12.185)"
y1="21.481001"
x1="23.448">
<stop
stop-color="#ce5c00"
offset="0"
id="stop12" />
<stop
stop-color="#ce5c00"
offset="1"
id="stop14" />
</linearGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#k"
id="linearGradient3127"
gradientUnits="userSpaceOnUse"
x1="26.379"
y1="34.389999"
x2="25.485001"
y2="32.714001" />
<linearGradient
id="k"
y2="32.714001"
gradientUnits="userSpaceOnUse"
x2="25.485001"
y1="34.389999"
x1="26.379">
<stop
stop-color="#e9b96e"
offset="0"
id="stop17" />
<stop
stop-color="#fff"
offset="1"
id="stop19" />
</linearGradient>
<radialGradient
inkscape:collect="always"
xlink:href="#n"
id="radialGradient3129"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.35473,-0.34328,0.35696,0.34544,130.15,-71.026)"
cx="-138.84"
cy="128"
r="9.1267004" />
<radialGradient
id="n"
gradientUnits="userSpaceOnUse"
cy="128"
cx="-138.84"
gradientTransform="matrix(0.35473,-0.34328,0.35696,0.34544,130.15,-71.026)"
r="9.1267004">
<stop
stop-color="#f9a9a9"
offset="0"
id="stop22" />
<stop
stop-color="#ab5f5f"
offset="1"
id="stop24" />
</radialGradient>
<linearGradient
inkscape:collect="always"
xlink:href="#l"
id="linearGradient3131"
gradientUnits="userSpaceOnUse"
gradientTransform="matrix(0.20949,-0.20274,0.20949,0.20274,129.28,-31.999)"
x1="-158.75"
y1="115.94"
x2="-158.75"
y2="134.25" />
<linearGradient
id="l"
y2="134.25"
gradientUnits="userSpaceOnUse"
x2="-158.75"
gradientTransform="matrix(0.20949,-0.20274,0.20949,0.20274,129.28,-31.999)"
y1="115.94"
x1="-158.75">
<stop
stop-color="#ddd"
offset="0"
id="stop27" />
<stop
stop-color="#fff"
offset=".34468"
id="stop29" />
<stop
stop-color="#737373"
offset=".72695"
id="stop31" />
<stop
stop-color="#bbb"
offset="1"
id="stop33" />
</linearGradient>
<linearGradient
y2="134.25"
x2="-158.75"
y1="115.94"
x1="-158.75"
gradientTransform="matrix(0.20949,-0.20274,0.20949,0.20274,129.28,-31.999)"
gradientUnits="userSpaceOnUse"
id="linearGradient6083"
xlink:href="#l"
inkscape:collect="always" />
</defs>
<g
id="g106"
transform="matrix(0.41145,0,0,0.37764,-1.4857,0.041)">
<use
id="use108"
x="0"
y="0"
width="128"
height="128"
transform="translate(-12,-12)"
xlink:href="#ac" />
<g
transform="translate(-4,-8)"
id="ac">
<path
style="opacity:0.6;filter:url(#p)"
id="path111"
transform="matrix(1.0476,0,0,1.0417,-2.0952,-4.0417)"
d="m 23,25 v 96 H 76.525 C 76.989,121 107,91.602 107,91.147 V 25 H 23 z" />
<path
style="fill:url(#radialGradient2985)"
id="path113"
d="m 24,24 v 96 H 77.525 C 77.989,120 108,90.602 108,90.147 V 24 H 24 z" />
<path
style="fill:url(#radialGradient2987)"
id="path115"
d="m 26.606,25.714 c -0.47187,0 -0.85638,0.37786 -0.85638,0.84156 v 90.888 c 0,0.46455 0.38452,0.84157 0.85638,0.84157 H 77.28 c 0.22523,0 0.44618,-0.0892 0.60546,-0.24658 l 28.115,-27.618 c 0.16013,-0.15737 0.25092,-0.37365 0.25092,-0.59498 v -63.262 c 0,-0.4637 -0.38366,-0.84156 -0.85639,-0.84156 h -78.787 z" />
<path
style="opacity:0.5;filter:url(#q)"
id="path117"
d="m 76.526,120 c 0,0 11.662,-9 16.474,-13.714 4.812,-4.72 14,-16.143 14,-16.143 0,0 -8,5.853 -24,5.853 0,16 -6.4745,24 -6.4745,24 z" />
<path
style="fill:url(#linearGradient2989)"
id="path119"
d="m 77.526,120 c 0,0 11.662,-9 16.474,-13.714 4.812,-4.72 14,-16.143 14,-16.143 0,0 -8,5.853 -24,5.853 0,16 -6.4745,24 -6.4745,24 z" />
</g>
<g
id="g121"
transform="translate(8,4)">
<path
style="opacity:0.6;filter:url(#p)"
id="path123"
transform="matrix(1.0476,0,0,1.0417,-2.0952,-4.0417)"
d="m 23,25 v 96 H 76.525 C 76.989,121 107,91.602 107,91.147 V 25 H 23 z" />
<path
style="fill:url(#radialGradient2979)"
id="path125"
d="m 24,24 v 96 H 77.525 C 77.989,120 108,90.602 108,90.147 V 24 H 24 z" />
<path
style="fill:url(#radialGradient2981)"
id="path127"
d="m 26.606,25.714 c -0.47187,0 -0.85638,0.37786 -0.85638,0.84156 v 90.888 c 0,0.46455 0.38452,0.84157 0.85638,0.84157 H 77.28 c 0.22523,0 0.44618,-0.0892 0.60546,-0.24658 l 28.115,-27.618 c 0.16013,-0.15737 0.25092,-0.37365 0.25092,-0.59498 v -63.262 c 0,-0.4637 -0.38366,-0.84156 -0.85639,-0.84156 h -78.787 z" />
<path
style="opacity:0.5;filter:url(#q)"
id="path129"
d="m 76.526,120 c 0,0 11.662,-9 16.474,-13.714 4.812,-4.72 14,-16.143 14,-16.143 0,0 -8,5.853 -24,5.853 0,16 -6.4745,24 -6.4745,24 z" />
<path
style="fill:url(#linearGradient2983)"
id="path131"
d="m 77.526,120 c 0,0 11.662,-9 16.474,-13.714 4.812,-4.72 14,-16.143 14,-16.143 0,0 -8,5.853 -24,5.853 0,16 -6.4745,24 -6.4745,24 z" />
</g>
</g>
<g
id="g133"
transform="matrix(0.36686,0,0,0.37005,40.311347,3.3522881)">
<circle
style="opacity:0.5;filter:url(#z)"
sodipodi:ry="36"
sodipodi:rx="36"
sodipodi:cy="92"
sodipodi:cx="344"
d="m 380,92 c 0,19.88225 -16.11775,36 -36,36 -19.88225,0 -36,-16.11775 -36,-36 0,-19.882251 16.11775,-36 36,-36 19.88225,0 36,16.117749 36,36 z"
id="circle135"
r="36"
cx="344"
cy="92"
transform="matrix(-0.85842,0.23001,-0.23001,-0.85842,412.46,35.85)" />
<circle
sodipodi:ry="36"
sodipodi:rx="36"
sodipodi:cy="92"
sodipodi:cx="344"
style="fill:url(#linearGradient3014)"
d="m 380,92 c 0,19.88225 -16.11775,36 -36,36 -19.88225,0 -36,-16.11775 -36,-36 0,-19.882251 16.11775,-36 36,-36 19.88225,0 36,16.117749 36,36 z"
id="circle137"
r="36"
cx="344"
cy="92"
transform="matrix(-0.85842,0.23001,-0.23001,-0.85842,412.46,31.85)" />
<circle
sodipodi:ry="36"
sodipodi:rx="36"
sodipodi:cy="92"
sodipodi:cx="344"
style="fill:url(#radialGradient3016)"
d="m 380,92 c 0,19.88225 -16.11775,36 -36,36 -19.88225,0 -36,-16.11775 -36,-36 0,-19.882251 16.11775,-36 36,-36 19.88225,0 36,16.117749 36,36 z"
id="circle139"
r="36"
cx="344"
cy="92"
transform="matrix(-0.64382,0.17251,-0.17251,-0.64382,333.34,31.888)" />
<circle
sodipodi:ry="36"
sodipodi:rx="36"
sodipodi:cy="92"
sodipodi:cx="344"
style="opacity:0.8;fill:none;stroke:url(#linearGradient3018);stroke-width:6.75139999;filter:url(#ab)"
d="m 380,92 c 0,19.88225 -16.11775,36 -36,36 -19.88225,0 -36,-16.11775 -36,-36 0,-19.882251 16.11775,-36 36,-36 19.88225,0 36,16.117749 36,36 z"
id="circle141"
r="36"
cx="344"
cy="92"
transform="matrix(-0.85842,-0.23001,-0.23001,0.85842,412.46,32.15)"
clip-path="url(#y)" />
<path
style="opacity:0.8;fill:url(#linearGradient3020)"
id="path143"
d="m 96,4.1482 c -11.346,0 -20.826,8.0116 -23.111,18.678 4.5547,4.2459 13.197,7.1111 23.111,7.1111 9.9142,0 18.556,-2.8652 23.111,-7.1111 -2.28,-10.666 -11.76,-18.678 -23.11,-18.678 z" />
<g
id="g145"
transform="translate(-26,-4)">
<path
style="fill:none;stroke:url(#linearGradient3022);stroke-width:4;stroke-linecap:round;stroke-linejoin:round;filter:url(#aa)"
id="path147"
d="m 118,16 v 16 h -16 v 8 h 16 v 16 h 8 V 40 h 16 V 32 H 126 V 16 h -8 z" />
<path
style="fill:#ffffff;fill-rule:evenodd"
id="path149"
d="m 118,16 v 16 h -16 v 8 h 16 v 16 h 8 V 40 h 16 V 32 H 126 V 16 h -8 z" />
</g>
</g>
<g
transform="matrix(-0.06556536,1.2979898,-1.1671085,-0.04646565,79.500138,-117.80133)"
id="g80">
<g
transform="matrix(1.1072,0,0,1.0714,74.214,8.4286)"
id="g82">
<path
d="m 25.892,30.185 19,-19 c 2.175,0.35996 3.0847,1.7322 3.5,3.5 l -19,19 -4.6161,0.7045 1.1161,-4.2045 z"
id="path84-1"
style="fill:url(#linearGradient3123);fill-rule:evenodd;stroke:url(#linearGradient3125);stroke-linejoin:round"
inkscape:connector-curvature="0" />
<path
d="M 26.792,30.685 45.29,12.287 c 1.0897,0.17844 1.5173,0.98794 2,2 l -18.398,18.498 -3.3,0.9 1.2,-3 z"
id="path86"
inkscape:connector-curvature="0"
style="opacity:0.28235001;fill:none;stroke:#ffffff" />
<path
d="m 24.55,34.633 1.6663,-4.1803 c 0,0 1.1995,0.24536 1.9322,0.97509 0.73264,0.72973 0.99839,1.9438 0.99839,1.9438 l -4.5969,1.2614 z"
id="path88"
style="fill:url(#linearGradient3127);fill-rule:evenodd"
inkscape:connector-curvature="0" />
<path
d="m 23,21.5 -5.5,1.5 2,-5"
transform="translate(6.3922,12.185)"
id="path90"
inkscape:connector-curvature="0"
style="fill:none;stroke:#e9b96e;stroke-linecap:round;stroke-linejoin:round" />
<path
d="m 23.955,33.685 -0.90625,2.25 2.3438,-0.65625 c 0.002,-0.03184 0,-0.06141 0,-0.09375 0,-0.80212 -0.64531,-1.4598 -1.4375,-1.5 z"
id="path92"
inkscape:connector-curvature="0"
style="fill-rule:evenodd" />
</g>
<path
style="fill:url(#radialGradient3129);stroke:#ef2929;stroke-width:1.0891;enable-background:new"
d="m 121.62,22.515 c 2.0307,-0.53628 4.3014,1.7694 3.8196,3.6963 l 2.4306,-2.3522 c 1.1808,-2.6427 -1.2536,-4.7247 -3.8692,-3.7443 l -2.381,2.4002 z"
id="path94"
inkscape:connector-curvature="0" />
<path
style="fill:url(#linearGradient6083);stroke:#888a85;stroke-width:1.0891;enable-background:new"
d="m 119.12,24.769 c 2.144,-0.56623 4.5413,1.8683 4.0326,3.9028 l 2.5662,-2.4836 c 0.8353,-1.7098 -2.2637,-4.6473 -4.085,-3.9535 l -2.52,2.535 z"
id="path96"
inkscape:connector-curvature="0" />
</g>
<g
transform="matrix(4.1228166,0,0,4.0916513,-20.734138,26.947522)"
id="g78">
<path
style="fill:#afaf00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.86499,0,0,0.86499,3.3638,-4.5167)"
id="path80"
inkscape:connector-curvature="0" />
<path
style="fill:#ebeb00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.61624,0,0,0.61624,5.7296,-4.1188)"
id="path82"
inkscape:connector-curvature="0" />
<path
style="fill:#ffff00"
d="M 12,5.5 9.4826,4.1505 6.9438,5.4592 7.4494,2.648 5.4202,0.6379 8.25,0.25 9.5347,-2.301 10.778,0.2704 13.601,0.70392 11.54,2.68102 z"
transform="matrix(0.3815,0,0,0.3815,7.9622,-3.7434)"
id="path84"
inkscape:connector-curvature="0" />
</g>
</svg>

After

Width:  |  Height:  |  Size: 23 KiB

View File

@ -53,7 +53,6 @@ enum id_eeschema_frm
{ {
ID_UPDATE_ONE_SHEET = ID_END_LIST, ID_UPDATE_ONE_SHEET = ID_END_LIST,
ID_SAVE_ONE_SHEET_UNDER_NEW_NAME, ID_SAVE_ONE_SHEET_UNDER_NEW_NAME,
ID_LOAD_ONE_SHEET,
/* Schematic editor horizontal toolbar IDs */ /* Schematic editor horizontal toolbar IDs */
ID_HIERARCHY, ID_HIERARCHY,

View File

@ -319,6 +319,7 @@ EXTERN_BITMAP( new_gerb_xpm )
EXTERN_BITMAP( new_library_xpm ) EXTERN_BITMAP( new_library_xpm )
EXTERN_BITMAP( new_pcb_xpm ) EXTERN_BITMAP( new_pcb_xpm )
EXTERN_BITMAP( new_project_xpm ) EXTERN_BITMAP( new_project_xpm )
EXTERN_BITMAP( new_project_with_template_xpm )
EXTERN_BITMAP( new_python_xpm ) EXTERN_BITMAP( new_python_xpm )
EXTERN_BITMAP( new_sch_xpm ) EXTERN_BITMAP( new_sch_xpm )
EXTERN_BITMAP( new_txt_xpm ) EXTERN_BITMAP( new_txt_xpm )

View File

@ -48,6 +48,7 @@ enum main_id
ID_TO_CVPCB, ID_TO_CVPCB,
ID_LOAD_PROJECT, ID_LOAD_PROJECT,
ID_NEW_PROJECT, ID_NEW_PROJECT,
ID_NEW_PROJECT_FROM_TEMPLATE,
ID_SAVE_PROJECT, ID_SAVE_PROJECT,
ID_SAVE_PROJECT_AS, ID_SAVE_PROJECT_AS,
ID_LOAD_FILE, ID_LOAD_FILE,

View File

@ -11,12 +11,15 @@ set(KICAD_SRCS
class_treeprojectfiles.cpp class_treeprojectfiles.cpp
class_treeproject_item.cpp class_treeproject_item.cpp
commandframe.cpp commandframe.cpp
dialogs/dialog_template_selector_base.cpp
dialogs/dialog_template_selector.cpp
files-io.cpp files-io.cpp
kicad.cpp kicad.cpp
mainframe.cpp mainframe.cpp
menubar.cpp menubar.cpp
preferences.cpp preferences.cpp
prjconfig.cpp prjconfig.cpp
project_template.cpp
tree_project_frame.cpp) tree_project_frame.cpp)
if(WIN32) if(WIN32)

View File

@ -0,0 +1,213 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "dialog_template_selector.h"
#include <wx/dir.h>
#include <wx/settings.h>
TEMPLATE_SELECTION_PANEL::TEMPLATE_SELECTION_PANEL( wxWindow* aParent ) :
TEMPLATE_SELECTION_PANEL_BASE( aParent )
{
parent = aParent;
}
TEMPLATE_SELECTION_PANEL::~TEMPLATE_SELECTION_PANEL()
{
}
TEMPLATE_WIDGET::TEMPLATE_WIDGET( wxWindow* aParent, wxDialog* aDialog ) :
TEMPLATE_WIDGET_BASE( aParent )
{
parent = aParent;
dialog = aDialog;
// wxWidgets 2.9.x way of doing the same...
// Bind(wxEVT_LEFT_DOWN, &TEMPLATE_WIDGET::OnMouse, this );
m_bitmapIcon->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this );
m_staticTitle->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( TEMPLATE_WIDGET::OnMouse ), NULL, this );
// We're not selected until we're clicked
Unselect();
// Start with template being NULL
templ = NULL;
}
TEMPLATE_WIDGET::~TEMPLATE_WIDGET()
{
}
void TEMPLATE_WIDGET::Select()
{
DIALOG_TEMPLATE_SELECTOR* d = (DIALOG_TEMPLATE_SELECTOR*)dialog;
d->SetWidget( this );
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNHIGHLIGHT ) );
selected = true;
Refresh();
}
void TEMPLATE_WIDGET::Unselect()
{
SetBackgroundColour( wxSystemSettings::GetColour( wxSYS_COLOUR_BTNFACE ) );
selected = false;
Refresh();
}
bool TEMPLATE_WIDGET::IsSelected()
{
return selected;
}
PROJECT_TEMPLATE* TEMPLATE_WIDGET::GetTemplate()
{
return templ;
}
void TEMPLATE_WIDGET::SetTemplate(PROJECT_TEMPLATE* aTemplate)
{
templ = aTemplate;
m_staticTitle->SetLabel( *(aTemplate->GetTitle()) );
m_bitmapIcon->SetBitmap( *(aTemplate->GetIcon()) );
}
void TEMPLATE_WIDGET::OnMouse( wxMouseEvent& event )
{
/* Toggle selection here */
Select();
event.Skip();
}
void DIALOG_TEMPLATE_SELECTOR::onNotebookResize(wxSizeEvent& event)
{
for ( size_t i=0; i < m_notebook->GetPageCount(); i++ )
{
m_panels[i]->SetSize( m_notebook->GetSize().GetWidth() - 6, 140 );
m_panels[i]->m_SizerBase->FitInside( m_panels[i] );
m_panels[i]->m_scrolledWindow1->SetSize( m_panels[i]->GetSize().GetWidth() - 6,
m_panels[i]->GetSize().GetHeight() - 6 );
m_panels[i]->m_SizerChoice->FitInside( m_panels[i]->m_scrolledWindow1 );
}
m_notebook->Refresh();
event.Skip();
}
DIALOG_TEMPLATE_SELECTOR::DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent ) :
DIALOG_TEMPLATE_SELECTOR_BASE( aParent )
{
m_htmlWin->SetPage( _( "<html><h1>Template Selector</h1></html>" ) );
m_notebook->Connect( wxEVT_SIZE, wxSizeEventHandler( DIALOG_TEMPLATE_SELECTOR::onNotebookResize ), NULL, this );
m_selectedWidget = NULL;
}
void DIALOG_TEMPLATE_SELECTOR::SetHtml( wxFileName aFilename )
{
m_htmlWin->LoadPage( aFilename.GetFullPath() );
}
DIALOG_TEMPLATE_SELECTOR::~DIALOG_TEMPLATE_SELECTOR()
{
}
TEMPLATE_WIDGET* DIALOG_TEMPLATE_SELECTOR::GetWidget()
{
return m_selectedWidget;
}
void DIALOG_TEMPLATE_SELECTOR::SetWidget( TEMPLATE_WIDGET* aWidget )
{
if( m_selectedWidget != NULL )
m_selectedWidget->Unselect();
m_selectedWidget = aWidget;
SetHtml( m_selectedWidget->GetTemplate()->GetHtmlFile() );
}
void DIALOG_TEMPLATE_SELECTOR::AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate )
{
TEMPLATE_WIDGET* w = new TEMPLATE_WIDGET( m_panels[aPage]->m_scrolledWindow1, this );
w->SetTemplate( aTemplate );
m_panels[aPage]->m_SizerChoice->Add( w );
m_panels[aPage]->m_SizerChoice->Layout();
m_panels[aPage]->SetSize( m_notebook->GetSize().GetWidth() - 6, 140 );
m_panels[aPage]->m_SizerBase->FitInside( m_panels[aPage] );
m_panels[aPage]->m_scrolledWindow1->SetSize( m_panels[aPage]->GetSize().GetWidth() - 6,
m_panels[aPage]->GetSize().GetHeight() - 6 );
m_panels[aPage]->m_SizerChoice->FitInside( m_panels[aPage]->m_scrolledWindow1 );
m_notebook->Refresh();
}
void DIALOG_TEMPLATE_SELECTOR::AddPage( const wxString& aTitle, wxFileName& aPath )
{
wxNotebookPage* newPage = new wxNotebookPage( m_notebook, wxID_ANY );
m_notebook->AddPage( newPage, aTitle );
TEMPLATE_SELECTION_PANEL* p = new TEMPLATE_SELECTION_PANEL( newPage );
m_panels.push_back( p );
// Get a list of files under the template path to include as choices...
wxArrayString files;
wxDir dir, sub;
if ( dir.Open( aPath.GetPath() ) )
{
wxString filename;
bool cont = dir.GetFirst( &filename, wxEmptyString, wxDIR_FILES | wxDIR_DIRS );
while( cont )
{
if( sub.Open( aPath.GetPathWithSep() + filename ) )
{
files.Add( filename );
PROJECT_TEMPLATE* pt = new PROJECT_TEMPLATE( aPath.GetPathWithSep() + filename );
AddTemplate( m_notebook->GetPageCount() - 1, pt );
}
cont = dir.GetNext( &filename );
}
}
}

View File

@ -0,0 +1,96 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PROJECT_TEMPLATE_SELECTOR_H
#define PROJECT_TEMPLATE_SELECTOR_H
#include "dialogs/dialog_template_selector_base.h"
#include "project_template.h"
class TEMPLATE_WIDGET : public TEMPLATE_WIDGET_BASE
{
protected:
wxDialog* dialog;
wxWindow* parent;
wxPanel* panel;
bool selected;
PROJECT_TEMPLATE* templ;
void OnKillFocus( wxFocusEvent& event );
void OnMouse( wxMouseEvent& event );
public:
TEMPLATE_WIDGET( wxWindow* aParent, wxDialog* aDialog );
~TEMPLATE_WIDGET();
/**
* Set the project template for this widget, which will determine the icon and title
* associated with this project template widget
*/
void SetTemplate(PROJECT_TEMPLATE* aTemplate);
PROJECT_TEMPLATE* GetTemplate();
void Select();
void Unselect();
bool IsSelected();
};
class TEMPLATE_SELECTION_PANEL : public TEMPLATE_SELECTION_PANEL_BASE
{
protected:
wxWindow* parent;
public:
/**
* @param aParent The window creating the dialog
* @param aDialogParent
*/
TEMPLATE_SELECTION_PANEL( wxWindow* aParent );
~TEMPLATE_SELECTION_PANEL();
};
class DIALOG_TEMPLATE_SELECTOR : public DIALOG_TEMPLATE_SELECTOR_BASE
{
protected:
vector<TEMPLATE_SELECTION_PANEL*> m_panels;
void AddTemplate( int aPage, PROJECT_TEMPLATE* aTemplate );
TEMPLATE_WIDGET* m_selectedWidget;
public:
DIALOG_TEMPLATE_SELECTOR( wxWindow* aParent );
~DIALOG_TEMPLATE_SELECTOR();
/**
* Add a new page with \a aTitle, populated with templates from \a aPath - All directories
* directories under the path are treated as templates
*/
void AddPage( const wxString& aTitle, wxFileName& aPath );
void SetHtml( wxFileName aFilename );
TEMPLATE_WIDGET* GetWidget();
void SetWidget( TEMPLATE_WIDGET* aWidget );
void onNotebookResize(wxSizeEvent& event);
};
#endif

View File

@ -0,0 +1,91 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_template_selector_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_TEMPLATE_SELECTOR_BASE::DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxSize( 640,480 ), wxDefaultSize );
wxBoxSizer* bSizer1;
bSizer1 = new wxBoxSizer( wxVERTICAL );
m_notebook = new wxNotebook( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0 );
bSizer1->Add( m_notebook, 0, wxEXPAND | wxALL, 3 );
m_htmlWin = new wxHtmlWindow( this, wxID_ANY, wxDefaultPosition, wxSize( -1,-1 ), wxHW_SCROLLBAR_AUTO );
bSizer1->Add( m_htmlWin, 1, wxALL|wxEXPAND, 3 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bSizer1->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 3 );
this->SetSizer( bSizer1 );
this->Layout();
this->Centre( wxBOTH );
}
DIALOG_TEMPLATE_SELECTOR_BASE::~DIALOG_TEMPLATE_SELECTOR_BASE()
{
}
TEMPLATE_SELECTION_PANEL_BASE::TEMPLATE_SELECTION_PANEL_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
m_SizerBase = new wxBoxSizer( wxHORIZONTAL );
m_scrolledWindow1 = new wxScrolledWindow( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxHSCROLL );
m_scrolledWindow1->SetScrollRate( 5, 5 );
m_SizerChoice = new wxBoxSizer( wxHORIZONTAL );
m_scrolledWindow1->SetSizer( m_SizerChoice );
m_scrolledWindow1->Layout();
m_SizerChoice->Fit( m_scrolledWindow1 );
m_SizerBase->Add( m_scrolledWindow1, 0, wxEXPAND | wxALL, 3 );
this->SetSizer( m_SizerBase );
this->Layout();
}
TEMPLATE_SELECTION_PANEL_BASE::~TEMPLATE_SELECTION_PANEL_BASE()
{
}
TEMPLATE_WIDGET_BASE::TEMPLATE_WIDGET_BASE( wxWindow* parent, wxWindowID id, const wxPoint& pos, const wxSize& size, long style ) : wxPanel( parent, id, pos, size, style )
{
this->SetMinSize( wxSize( 74,-1 ) );
this->SetMaxSize( wxSize( 74,-1 ) );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxVERTICAL );
m_bitmapIcon = new wxStaticBitmap( this, wxID_ANY, wxNullBitmap, wxDefaultPosition, wxSize( 64,64 ), 0 );
bSizer4->Add( m_bitmapIcon, 0, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3 );
m_staticTitle = new wxStaticText( this, wxID_ANY, wxT("Project Template Title"), wxDefaultPosition, wxDefaultSize, wxALIGN_CENTRE );
m_staticTitle->Wrap( 150 );
bSizer4->Add( m_staticTitle, 1, wxALIGN_CENTER_HORIZONTAL|wxALL|wxEXPAND, 3 );
this->SetSizer( bSizer4 );
this->Layout();
}
TEMPLATE_WIDGET_BASE::~TEMPLATE_WIDGET_BASE()
{
}

View File

@ -0,0 +1,93 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 10 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_TEMPLATE_SELECTOR_BASE_H__
#define __DIALOG_TEMPLATE_SELECTOR_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include "dialog_shim.h"
#include <wx/gdicmn.h>
#include <wx/notebook.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/string.h>
#include <wx/html/htmlwin.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
#include <wx/scrolwin.h>
#include <wx/panel.h>
#include <wx/bitmap.h>
#include <wx/image.h>
#include <wx/icon.h>
#include <wx/statbmp.h>
#include <wx/stattext.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_TEMPLATE_SELECTOR_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_TEMPLATE_SELECTOR_BASE : public DIALOG_SHIM
{
private:
protected:
wxNotebook* m_notebook;
wxHtmlWindow* m_htmlWin;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
public:
DIALOG_TEMPLATE_SELECTOR_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Project Template Selector"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 640,480 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_TEMPLATE_SELECTOR_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_SELECTION_PANEL_BASE
///////////////////////////////////////////////////////////////////////////////
class TEMPLATE_SELECTION_PANEL_BASE : public wxPanel
{
private:
protected:
public:
wxBoxSizer* m_SizerBase;
wxScrolledWindow* m_scrolledWindow1;
wxBoxSizer* m_SizerChoice;
TEMPLATE_SELECTION_PANEL_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,140 ), long style = wxNO_BORDER|wxTAB_TRAVERSAL );
~TEMPLATE_SELECTION_PANEL_BASE();
};
///////////////////////////////////////////////////////////////////////////////
/// Class TEMPLATE_WIDGET_BASE
///////////////////////////////////////////////////////////////////////////////
class TEMPLATE_WIDGET_BASE : public wxPanel
{
private:
protected:
wxStaticBitmap* m_bitmapIcon;
wxStaticText* m_staticTitle;
public:
TEMPLATE_WIDGET_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 74,-1 ), long style = wxTAB_TRAVERSAL );
~TEMPLATE_WIDGET_BASE();
};
#endif //__DIALOG_TEMPLATE_SELECTOR_BASE_H__

View File

@ -155,7 +155,7 @@ public: KICAD_MANAGER_FRAME( wxWindow* parent, const wxString& title,
void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event ); void OnUpdateDefaultPdfBrowser( wxUpdateUIEvent& event );
void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event ); void OnUpdatePreferredPdfBrowser( wxUpdateUIEvent& event );
void CreateNewProject( const wxString PrjFullFileName ); void CreateNewProject( const wxString aPrjFullFileName, bool aTemplateSelector );
/** /**
* Function LoadSettings * Function LoadSettings

View File

@ -1,9 +1,9 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2009-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2009-2012 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
@ -44,6 +44,7 @@ BEGIN_EVENT_TABLE( KICAD_MANAGER_FRAME, EDA_BASE_FRAME )
/* Toolbar events */ /* Toolbar events */
EVT_TOOL( ID_NEW_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject ) EVT_TOOL( ID_NEW_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_NEW_PROJECT_FROM_TEMPLATE, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_LOAD_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject ) EVT_TOOL( ID_LOAD_PROJECT, KICAD_MANAGER_FRAME::OnLoadProject )
EVT_TOOL( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject ) EVT_TOOL( ID_SAVE_PROJECT, KICAD_MANAGER_FRAME::OnSaveProject )
EVT_TOOL( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles ) EVT_TOOL( ID_SAVE_AND_ZIP_FILES, KICAD_MANAGER_FRAME::OnArchiveFiles )
@ -134,8 +135,20 @@ void KICAD_MANAGER_FRAME::ReCreateMenuBar()
KiBitmap( open_project_xpm ) ); KiBitmap( open_project_xpm ) );
// New // New
AddMenuItem( fileMenu, ID_NEW_PROJECT, static wxMenu* newMenu = new wxMenu();
_( "&New\tCtrl+N" ), AddMenuItem( newMenu, ID_NEW_PROJECT,
_( "&Blank\tCtrl+N" ),
_( "Start a blank project" ),
KiBitmap( new_project_xpm ) );
AddMenuItem( newMenu, ID_NEW_PROJECT_FROM_TEMPLATE,
_( "New from &Template\tCtrl+T" ),
_( "Start a new project from a template" ),
KiBitmap( new_project_with_template_xpm ) );
AddMenuItem( fileMenu, newMenu,
wxID_ANY,
_( "New" ),
_( "Start a new project" ), _( "Start a new project" ),
KiBitmap( new_project_xpm ) ); KiBitmap( new_project_xpm ) );
@ -309,6 +322,10 @@ void KICAD_MANAGER_FRAME::RecreateBaseHToolbar()
KiBitmap( new_project_xpm ), KiBitmap( new_project_xpm ),
_( "Start a new project" ) ); _( "Start a new project" ) );
m_mainToolBar->AddTool( ID_NEW_PROJECT_FROM_TEMPLATE, wxEmptyString,
KiBitmap( new_project_with_template_xpm ),
_( "Start a new project from a template" ) );
// Load // Load
m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString, m_mainToolBar->AddTool( ID_LOAD_PROJECT, wxEmptyString,
KiBitmap( open_project_xpm ), KiBitmap( open_project_xpm ),

View File

@ -31,13 +31,21 @@
#include <appl_wxstruct.h> #include <appl_wxstruct.h>
#include <confirm.h> #include <confirm.h>
#include <gestfich.h> #include <gestfich.h>
#include <prjconfig.h>
#include <kicad.h> #include <kicad.h>
#include <prjconfig.h>
#include <project_template.h>
#include <tree_project_frame.h> #include <tree_project_frame.h>
#include <wildcards_and_files_ext.h> #include <wildcards_and_files_ext.h>
#include <vector>
#include <build_version.h> #include <build_version.h>
#include <wx/filename.h>
#include <wx/stdpaths.h>
#include "dialogs/dialog_template_selector.h"
#define SEP() wxFileName::GetPathSeparator()
static const wxString GeneralGroupName( wxT( "/general" ) ); static const wxString GeneralGroupName( wxT( "/general" ) );
/* KiCad project file entry names. */ /* KiCad project file entry names. */
@ -45,39 +53,94 @@ static const wxString SchematicRootNameEntry( wxT( "RootSch" ) );
static const wxString BoardFileNameEntry( wxT( "BoardNm" ) ); static const wxString BoardFileNameEntry( wxT( "BoardNm" ) );
void KICAD_MANAGER_FRAME::CreateNewProject( const wxString PrjFullFileName ) void KICAD_MANAGER_FRAME::CreateNewProject( const wxString aPrjFullFileName, bool aTemplateSelector = false )
{ {
wxString filename; wxString filename;
wxFileName newProjectName = PrjFullFileName; wxFileName newProjectName = aPrjFullFileName;
ClearMsg(); ClearMsg();
/* Init default config filename */ // Init default config filename
filename = wxGetApp().FindLibraryPath( wxT( "kicad" ) + g_KicadPrjFilenameExtension ); filename = wxGetApp().FindLibraryPath( wxT( "kicad" ) + g_KicadPrjFilenameExtension );
/* Check if file kicad.pro exist in template directory */ // If we are creating a project from a template, make sure the template directory is sane
if( aTemplateSelector )
{
DIALOG_TEMPLATE_SELECTOR* ps = new DIALOG_TEMPLATE_SELECTOR( this );
// Add a new tab for system templates
wxFileName templatePath = wxPathOnly(wxStandardPaths::Get().GetExecutablePath()) +
SEP() + wxT( ".." ) + SEP() + wxT( "share" ) + SEP() + wxT( "template" ) + SEP();
ps->AddPage( _( "System Templates" ), templatePath );
// Add a new tab for user templates
wxFileName userPath = wxStandardPaths::Get().GetDocumentsDir() +
SEP() + wxT( "kicad" ) + SEP() + wxT( "template" ) + SEP();
ps->AddPage( _( "User Templates" ), userPath );
// Check to see if a custom template location is available and setup a new selection tab
// if there is
wxString envStr;
wxGetEnv( wxT("KICAD_PTEMPLATES"), &envStr );
wxFileName envPath = envStr;
if( envStr != wxEmptyString )
{
wxFileName envPath = envStr;
ps->AddPage( _("Portable Templates"), envPath );
}
// Show the project template selector dialog
int result = ps->ShowModal();
if( result != wxID_OK )
{
wxMessageBox( _( "Did not generate new project from template" ),
_( "Cancelled new project from template" ),
wxOK | wxICON_EXCLAMATION,
this );
}
else
{
// The selected template widget contains the template we're attempting to use to
// create a project
if( !ps->GetWidget()->GetTemplate()->CreateProject( newProjectName ) )
{
wxMessageBox( _( "Problem whilst creating new project from template!" ),
_( "Could not generate new project" ),
wxOK | wxICON_ERROR,
this );
}
}
}
else
{
// Check if file kicad.pro exist in template directory
if( wxFileName::FileExists( filename ) ) if( wxFileName::FileExists( filename ) )
{ {
wxCopyFile( filename, PrjFullFileName ); wxCopyFile( filename, aPrjFullFileName );
} }
else else
{ {
DisplayInfoMessage( NULL, _( "Project template file <kicad.pro> not found. " ) ); DisplayInfoMessage( NULL, _( "Project template file <kicad.pro> not found. " ) );
return; return;
} }
}
/* Init schematic filename */ // Init schematic filename
m_SchematicRootFileName = wxFileName( newProjectName.GetName(), m_SchematicRootFileName = wxFileName( newProjectName.GetName(),
SchematicFileExtension ).GetFullName(); SchematicFileExtension ).GetFullName();
/* Init pcb board filename */ // Init pcb board filename
m_BoardFileName = wxFileName( newProjectName.GetName(), PcbFileExtension ).GetFullName(); m_BoardFileName = wxFileName( newProjectName.GetName(), PcbFileExtension ).GetFullName();
/* Init project filename */ // Init project filename
m_ProjectFileName = newProjectName; m_ProjectFileName = newProjectName;
/* Write settings to project file */ // Write settings to project file
wxGetApp().WriteProjectConfig( PrjFullFileName, GeneralGroupName, NULL ); wxGetApp().WriteProjectConfig( aPrjFullFileName, GeneralGroupName, NULL );
} }
@ -90,7 +153,8 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
if( event.GetId() != wxID_ANY ) if( event.GetId() != wxID_ANY )
{ {
if( event.GetId() == ID_NEW_PROJECT ) if( ( event.GetId() == ID_NEW_PROJECT ) ||
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE ) )
{ {
title = _( "Create New Project" ); title = _( "Create New Project" );
style = wxFD_SAVE | wxFD_OVERWRITE_PROMPT; style = wxFD_SAVE | wxFD_OVERWRITE_PROMPT;
@ -108,19 +172,25 @@ void KICAD_MANAGER_FRAME::OnLoadProject( wxCommandEvent& event )
m_ProjectFileName = dlg.GetPath(); m_ProjectFileName = dlg.GetPath();
if( event.GetId() == ID_NEW_PROJECT ) if( ( event.GetId() == ID_NEW_PROJECT ) ||
( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE ) )
{ {
// Ensure project filename extension is .pro if ( !m_ProjectFileName.GetFullPath().EndsWith( g_KicadPrjFilenameExtension ) )
wxString fullname = m_ProjectFileName.GetFullPath();
if ( !fullname.EndsWith( g_KicadPrjFilenameExtension ) )
{ {
fullname += g_KicadPrjFilenameExtension; m_ProjectFileName.SetFullName( m_ProjectFileName.GetFullPath() +
m_ProjectFileName.SetFullName( fullname ); g_KicadPrjFilenameExtension );
} }
if( event.GetId() == ID_NEW_PROJECT )
{
CreateNewProject( m_ProjectFileName.GetFullPath() ); CreateNewProject( m_ProjectFileName.GetFullPath() );
} }
else if( event.GetId() == ID_NEW_PROJECT_FROM_TEMPLATE )
{
// Launch the template selector dialog
CreateNewProject( m_ProjectFileName.GetFullPath(), true );
}
}
} }
wxLogDebug( wxT( "Loading KiCad project file: " ) + m_ProjectFileName.GetFullPath() ); wxLogDebug( wxT( "Loading KiCad project file: " ) + m_ProjectFileName.GetFullPath() );

212
kicad/project_template.cpp Normal file
View File

@ -0,0 +1,212 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include "project_template.h"
#include <vector>
#include <wx/wx.h>
#include <wx/arrstr.h>
#include <wx/dir.h>
#include <wx/filename.h>
#include <wx/txtstrm.h>
#include <wx/wfstream.h>
using namespace std;
#define SEP() wxFileName::GetPathSeparator()
PROJECT_TEMPLATE::PROJECT_TEMPLATE( const wxString& aPath )
{
templateBasePath = wxFileName::DirName( aPath );
templateMetaPath = wxFileName::DirName( aPath + SEP() + METADIR );
templateMetaHtmlFile = wxFileName::FileName( aPath + SEP() + METADIR + SEP() +
METAFILE_INFO_HTML );
templateMetaIconFile = wxFileName::FileName( aPath + SEP() + METADIR + SEP() + METAFILE_ICON );
title = wxEmptyString;
// Test the project template requirements to make sure aPath is a valid
// template structure
if( !wxFileName::DirExists( templateBasePath.GetPath() ) )
{
// Error, the path doesn't exist!
title = wxT( "Could open the template path! " + aPath );
}
else if( !wxFileName::DirExists( templateMetaPath.GetPath() ) )
{
// Error, the meta information directory doesn't exist!
title = wxT( "Couldn't open the meta information directory for this template! " +
templateMetaPath.GetPath() );
}
else if( !wxFileName::FileExists( templateMetaHtmlFile.GetFullPath() ) )
{
// Error, the meta information directory doesn't contain the informational html file!
title = wxT( "Cound't find the meta html information file for this template!" );
}
// Try to load an icon
metaIcon = new wxBitmap( templateMetaIconFile.GetFullPath(), wxBITMAP_TYPE_PNG );
}
vector<wxFileName> PROJECT_TEMPLATE::GetFileList()
{
vector<wxFileName> files;
wxString f = templateBasePath.GetPath();
wxArrayString allfiles;
wxFileName p;
wxDir::GetAllFiles( f, &allfiles );
// Create the vector and ignore all of the meta data files!
for( size_t i=0; i < allfiles.size(); i++ )
{
p = allfiles[i];
// Files that are in the meta directory must not be included
if( !p.GetPath().StartsWith( templateMetaPath.GetPath() ) )
files.push_back(allfiles[i]);
}
return files;
}
wxString PROJECT_TEMPLATE::GetName()
{
return templateBasePath.GetDirs()[ templateBasePath.GetDirCount()-1 ];
}
PROJECT_TEMPLATE::~PROJECT_TEMPLATE()
{
}
wxFileName PROJECT_TEMPLATE::GetHtmlFile()
{
return templateMetaHtmlFile;
}
wxBitmap* PROJECT_TEMPLATE::GetIcon()
{
return metaIcon;
}
bool PROJECT_TEMPLATE::CreateProject( wxFileName& aNewProjectPath )
{
bool result = true;
vector<wxFileName> srcFiles = GetFileList();
vector<wxFileName> dstFiles;
for( size_t i=0; i < srcFiles.size(); i++ )
{
// Replace the template path
wxFileName destination = srcFiles[i];
wxString destname = destination.GetName();
// Replace the template name with the project name for the new project creation
destname.Replace( GetName(), aNewProjectPath.GetName() );
// Add the file extension (if there was one!)
if( destination.GetExt() != wxEmptyString )
destname += wxT(".") + destination.GetExt();
wxString destpath = destination.GetPathWithSep();
destpath.Replace( destination.GetPathWithSep(), aNewProjectPath.GetPathWithSep() );
destination = destpath + destname;
dstFiles.push_back( destination );
wxString srcFile = srcFiles[i].GetFullPath();
wxString dstFile = dstFiles[i].GetFullPath();
if( !wxCopyFile( srcFile, dstFile ) )
{
result = false;
break;
}
}
return result;
}
wxString* PROJECT_TEMPLATE::GetTitle(void)
{
wxFileInputStream input( GetHtmlFile().GetFullPath() );
wxTextInputStream text( input, wxT( "\x9" ), wxConvUTF8 );
/* Open HTML file and get the text between the title tags */
if( title == wxEmptyString )
{
int start = 0;
int finish = 0;
bool done = false;
while( input.IsOk() && !input.Eof() && !done )
{
wxString line = text.ReadLine();
start = line.Find( wxT( "<title>" ) );
finish = line.Find( wxT( "</title>" ) );
// find the opening tag
if( start != wxNOT_FOUND )
{
if( finish != wxNOT_FOUND )
{
title = line.SubString( start + 7, finish );
}
else
{
title = line.SubString( start + 7, line.Len() - 1 );
done = true;
}
}
else
{
if( finish != wxNOT_FOUND )
{
title += line.SubString( 0, finish );
done = true;
}
else
{
title += line;
}
}
// Remove line endings
title.Replace( wxT( "\r" ), wxT( "" ) );
title.Replace( wxT( "\n" ), wxT( "" ) );
}
}
return &title;
}

205
kicad/project_template.h Normal file
View File

@ -0,0 +1,205 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Brian Sidebotham <brian.sidebotham@gmail.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
*
* 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; either version 2
* of the License, or (at your option) any later version.
*
* 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.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
@page prj_tmp Project Templates
Author: Brian Sidebotham
Proposal
--------
To add new project template functionality to KiCad to facilitate the easy setup of projects
which have common attributes such as pre-defined board outlines, connector positions,
schematic elements, design rules, etc.
Definitions
-----------
A template is a directory of files, which includes a directory of metadata. The template system
name (SYSNAME) is the directory name under which the template files are stored. The metadata
directory (METADIR) contains pre-defined files which provide information about the template.
All files and directories in a template are copied to the new project path when a project is
created using a template, except METADIR.
All files and directories which start with SYSNAME will have SYSNAME replaced by the new
project file name, excluding the file extension.
Metadata
--------
A template's METADIR must contain the required files, and might optionally contain any of the
optional files
Required Files
~~~~~~~~~~~~~~
/info.html - Contains html formatted information about the template which is used by the
user to determine if the template is what they are after. The <title> tag
determines the actual name of the template that is exposed to the user for
template selection. Using html to format this document means that images can
be in-lined without having to invent a new scheme. Only HTML supported by
wxHTML can be used to format this document.
Optional Files
~~~~~~~~~~~~~~
/icon.png - A 64 x 64px PNG icon file which is used as a clickable icon in the template
selection dialog.
Operation
---------
The KiCad File menu will be modified to change New from a menu item to a pop-out menu item, in
the same manor as Open Recent. There will be two options on the pop-out menu:
Blank -> Will act exactly the same as the current new menu item so that anyone who wishes to
create a blank project won't have their settings lost or feel alienated.
From Template -> Will open the template selection dialog.
The template selection dialog will have a list of icons on the left, and a wxHTML window to the
right. A single click on a template's icon on the left will load that templates info.html
metadata file and display it in the wxHTML window.
A double click on a template's icon will start the new project creation and will open a new
file dialog. If the user selects a valid location for the new project, the template will be
copied to the new project location ( excluding METADIR as mentioned earlier ) and any files
that match the string replacement rules will be renamed to reflect the new project's name.
The list of available templates will be gathered from the following sources:
wxStandardPaths::GetExecutableDir()/../share/template/
wxStandardPaths::GetUserDataDir()/templates/
wxGetEnv(wxT("KICAD_TEMPLATES"))
*/
#ifndef PROJECT_TEMPLATE_H
#define PROJECT_TEMPLATE_H
#include <vector>
#include <wx/wx.h>
#include <wx/image.h>
#include <wx/filename.h>
using namespace std;
/**
* @brief A directory which contains information about the project template and does not get
* copied. This define is the default filename for this directory
*
*/
#define METADIR wxT("meta")
/**
* @brief A required html formatted file which contains information about the project template.
* This define is the default filename for this file
*
*/
#define METAFILE_INFO_HTML wxT("info.html")
/**
* @brief An optional png icon, exactly 64px x 64px which is used in the template selector if
* present. This define is the default filename for this file
*
*/
#define METAFILE_ICON wxT("icon.png")
/**
* @brief A class which provides project template functionality.
*
*
*
*/
class PROJECT_TEMPLATE {
private:
protected:
wxFileName templateBasePath;
wxFileName templateMetaPath;
wxFileName templateMetaHtmlFile;
wxFileName templateMetaIconFile;
wxBitmap* metaIcon;
wxString title;
public:
/**
* @brief Create a new project instance from \a aPath. \a aPath should be a directory that
* conforms to the project template requirements
*
* @param aPath Should be a directory containing the template
*/
PROJECT_TEMPLATE( const wxString& aPath );
/**
* @brief Non-virtual destructor (so no dervied classes)
*/
~PROJECT_TEMPLATE();
/**
* @brief Get the system name of the project template
* @return the system name of the template
*/
wxString GetName();
/**
* @brief Get the full Html filename for the project template
* @return the html meta information file for this template
*/
wxFileName GetHtmlFile();
/**
* @brief Copies and renames all template files to create a new project.
* @param aNewProjectPath The full path of the new project file to create
*/
bool CreateProject( wxFileName& aNewProjectPath );
/**
* @brief Get the 64px^2 icon for the project template
* @return an image file of 64px x 64px which is the templates icon
*/
wxBitmap* GetIcon();
/**
* @brief Get the title of the project (extracted from the html title tag)
*/
wxString* GetTitle();
/**
* @brief Get a vector list of filenames for the template. The files are the source files,
* and have not yet been through any renaming
*/
vector<wxFileName> GetFileList();
};
#endif

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.2 KiB

View File

@ -0,0 +1,22 @@
<html>
<head>
<title>Raspberry Pi - Expansion Board</title>
</head>
<body>
<h1>Raspberry Pi</h1>
<h2>Expansion Board</h2>
This project template is the basis of an expansion board for the
<a href="http://www.raspberrypi.org/" target="blank">Raspberry Pi $25 ARM
board.</a>
<br><br>
This base project includes a PCB edge defined as the same size as the
Raspberry-Pi PCB with the connectors placed correctly to align the two boards.
All IO present on the Raspberry-Pi board is connected to the project through the
0.1" expansion headers.
<br><br>
The board outline looks like the following:
<br><br>
(c)2012 Brian Sidebotham<br>
(c)2012 Kicad Developers<br>
</body>
</html>

View File

@ -0,0 +1,76 @@
EESchema-LIBRARY Version 2.3 Date: 03/08/2012 23:04:32
#encoding utf-8
#
# +3.3V
#
DEF +3.3V #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 -40 30 H I C CNN
F1 "+3.3V" 0 110 30 H V C CNN
ALIAS +3,3V
DRAW
X +3.3V 1 0 0 0 U 30 30 0 0 W N
C 0 60 20 0 1 0 N
P 3 0 1 0 0 0 0 40 0 40 N
ENDDRAW
ENDDEF
#
# +5V
#
DEF +5V #PWR 0 40 Y Y 1 F P
F0 "#PWR" 0 90 20 H I C CNN
F1 "+5V" 0 90 30 H V C CNN
DRAW
X +5V 1 0 0 0 U 20 20 0 0 W N
C 0 50 20 0 1 0 N
P 4 0 1 0 0 0 0 30 0 30 0 30 N
ENDDRAW
ENDDEF
#
# CONN_13X2
#
DEF CONN_13X2 P 0 10 Y N 1 F N
F0 "P" 0 700 60 H V C CNN
F1 "CONN_13X2" 0 0 50 V V C CNN
DRAW
S -100 650 100 -650 0 1 0 N
X P1 1 -400 600 300 R 40 30 1 1 P I
X P2 2 400 600 300 L 40 30 1 1 P I
X P3 3 -400 500 300 R 40 30 1 1 P I
X P4 4 400 500 300 L 40 30 1 1 P I
X P5 5 -400 400 300 R 40 30 1 1 P I
X P6 6 400 400 300 L 40 30 1 1 P I
X P7 7 -400 300 300 R 40 30 1 1 P I
X P8 8 400 300 300 L 40 30 1 1 P I
X P9 9 -400 200 300 R 40 30 1 1 P I
X P10 10 400 200 300 L 40 30 1 1 P I
X P20 20 400 -300 300 L 40 30 1 1 P I
X P11 11 -400 100 300 R 40 30 1 1 P I
X P21 21 -400 -400 300 R 40 30 1 1 P I
X P12 12 400 100 300 L 40 30 1 1 P I
X P22 22 400 -400 300 L 40 30 1 1 P I
X P13 13 -400 0 300 R 40 30 1 1 P I
X P23 23 -400 -500 300 R 40 30 1 1 P I
X P14 14 400 0 300 L 40 30 1 1 P I
X P20 24 400 -500 300 L 40 30 1 1 P I
X P15 15 -400 -100 300 R 40 30 1 1 P I
X P24 25 -400 -600 300 R 40 30 1 1 P I
X P16 16 400 -100 300 L 40 30 1 1 P I
X P22 26 400 -600 300 L 40 30 1 1 P I
X P17 17 -400 -200 300 R 40 30 1 1 P I
X P18 18 400 -200 300 L 40 30 1 1 P I
X P19 19 -400 -300 300 R 40 30 1 1 P I
ENDDRAW
ENDDEF
#
# GND
#
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C CNN
F1 "GND" 0 -70 30 H I C CNN
DRAW
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
ENDDRAW
ENDDEF
#
#End Library

View File

@ -0,0 +1,320 @@
PCBNEW-BOARD Version 1 date 03/08/2012 23:04:25
# Created by Pcbnew(2012-08-03 BZR 3666)-testing
$GENERAL
encoding utf-8
Units deci-mils
LayerCount 2
EnabledLayers 1FFF8001
VisibleLayers 1FFFFFFF
Links 0
NoConn 0
Di 64424 41924 100576 63576
Ndraw 4
Ntrack 0
Nzone 0
BoardThickness 620
Nmodule 1
Nnets 4
$EndGENERAL
$SHEETDESCR
Sheet A3 16535 11693
Title ""
Date "3 aug 2012"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndSHEETDESCR
$SETUP
Layers 2
Layer[0] Back signal
Layer[15] Front signal
TrackWidth 100
TrackClearence 100
ZoneClearence 200
Zone_45_Only 0
TrackMinWidth 100
DrawSegmWidth 150
EdgeSegmWidth 150
ViaSize 350
ViaDrill 250
ViaMinSize 350
ViaMinDrill 200
MicroViaSize 200
MicroViaDrill 50
MicroViasAllowed 0
MicroViaMinSize 200
MicroViaMinDrill 50
TextPcbWidth 120
TextPcbSize 600 800
EdgeModWidth 150
TextModSize 600 600
TextModWidth 120
PadSize 600 600
PadDrill 320
Pad2MaskClearance 100
AuxiliaryAxisOrg 0 0
VisibleElements FFFFFFBF
PcbPlotParams (pcbplotparams (layerselection 3178497) (usegerberextensions true) (excludeedgelayer true) (linewidth 60) (plotframeref false) (viasonmask false) (mode 1) (useauxorigin false) (hpglpennumber 1) (hpglpenspeed 20) (hpglpendiameter 15) (hpglpenoverlay 2) (pscolor true) (psnegative false) (psa4output false) (plotreference true) (plotvalue true) (plotothertext true) (plotinvisibletext false) (padsonsilk false) (subtractmaskfromsilk false) (outputformat 1) (mirror false) (drillshape 1) (scaleselection 1) (outputdirectory ""))
$EndSETUP
$EQUIPOT
Na 0 ""
St ~
$EndEQUIPOT
$EQUIPOT
Na 1 "+3.3V"
St ~
$EndEQUIPOT
$EQUIPOT
Na 2 "+5V"
St ~
$EndEQUIPOT
$EQUIPOT
Na 3 "GND"
St ~
$EndEQUIPOT
$NCLASS
Name "Default"
Desc "This is the default net class."
Clearance 100
TrackWidth 100
ViaDia 350
ViaDrill 250
uViaDia 200
uViaDrill 50
AddNet ""
AddNet "+3.3V"
AddNet "+5V"
AddNet "GND"
$EndNCLASS
$MODULE pin_array_13x2
Po 71500 43500 0 15 501C4AA3 501C493E ~~
Li pin_array_13x2
Cd Double rangee de contacts 2 x 12 pins
Kw CONN
Sc 501C493E
AR /501C45CC
Op 0 0 0
T0 -6000 1500 400 400 0 80 N V 21 N "P1"
T1 4500 1500 400 400 0 80 N V 21 N "CONN_13X2"
DS -6500 1000 6500 1000 80 21
DS 6500 -1000 -6500 -1000 80 21
DS -6500 -1000 -6500 1000 80 21
DS 6500 1000 6500 -1000 80 21
$PAD
Sh "1" R 600 600 0 0 0
Dr 320 0 0
At STD N 00E0FFFF
Ne 1 "+3.3V"
Po -6000 500
$EndPAD
$PAD
Sh "2" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 2 "+5V"
Po -6000 -500
$EndPAD
$PAD
Sh "3" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -5000 500
$EndPAD
$PAD
Sh "4" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -5000 -500
$EndPAD
$PAD
Sh "5" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -4000 500
$EndPAD
$PAD
Sh "6" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 3 "GND"
Po -4000 -500
$EndPAD
$PAD
Sh "7" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -3000 500
$EndPAD
$PAD
Sh "8" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -3000 -500
$EndPAD
$PAD
Sh "9" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -2000 500
$EndPAD
$PAD
Sh "10" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -2000 -500
$EndPAD
$PAD
Sh "11" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -1000 500
$EndPAD
$PAD
Sh "12" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po -1000 -500
$EndPAD
$PAD
Sh "13" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 0 500
$EndPAD
$PAD
Sh "14" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 0 -500
$EndPAD
$PAD
Sh "15" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 1000 500
$EndPAD
$PAD
Sh "16" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 1000 -500
$EndPAD
$PAD
Sh "17" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 2000 500
$EndPAD
$PAD
Sh "18" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 2000 -500
$EndPAD
$PAD
Sh "19" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 3000 500
$EndPAD
$PAD
Sh "20" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 3000 -500
$EndPAD
$PAD
Sh "21" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 4000 500
$EndPAD
$PAD
Sh "22" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 4000 -500
$EndPAD
$PAD
Sh "23" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 5000 500
$EndPAD
$PAD
Sh "24" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 5000 -500
$EndPAD
$PAD
Sh "25" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 6000 500
$EndPAD
$PAD
Sh "26" C 600 600 0 0 0
Dr 400 0 0
At STD N 00E0FFFF
Ne 0 ""
Po 6000 -500
$EndPAD
$SHAPE3D
Na "pin_array/pins_array_13x2.wrl"
Sc 1 1 1
Of 0 0 0
Ro 0 0 0
$EndSHAPE3D
$EndMODULE pin_array_13x2
$DRAWSEGMENT
Po 0 100500 63500 64500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 64500 42000 64500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 100500 42000 100500 63500 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$DRAWSEGMENT
Po 0 64500 42000 100500 42000 150
De 28 0 900 0 0
$EndDRAWSEGMENT
$TRACK
$EndTRACK
$ZONE
$EndZONE
$EndBOARD

View File

@ -0,0 +1,10 @@
Cmp-Mod V01 Created by CvPcb (2012-08-03 BZR 3666)-testing date = 03/08/2012 22:59:51
BeginCmp
TimeStamp = /501C45CC;
Reference = P1;
ValeurCmp = CONN_13X2;
IdModule = pin_array_13x2;
EndCmp
EndListe

View File

@ -0,0 +1,35 @@
# EESchema Netlist Version 1.1 created 03/08/2012 22:54:12
(
( /501C45CC $noname P1 CONN_13X2 {Lib=CONN_13X2}
( 1 +3.3V )
( 2 +5V )
( 3 ? )
( 4 ? )
( 5 ? )
( 6 GND )
( 7 ? )
( 8 ? )
( 9 ? )
( 10 ? )
( 11 ? )
( 12 ? )
( 13 ? )
( 14 ? )
( 15 ? )
( 16 ? )
( 17 ? )
( 18 ? )
( 19 ? )
( 20 ? )
( 21 ? )
( 22 ? )
( 23 ? )
( 24 ? )
( 25 ? )
( 26 ? )
)
)
*
{ Pin List by Nets
}
#End

View File

@ -0,0 +1,145 @@
update=03/08/2012 22:36:35
version=1
last_client=kicad
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetDir=
LibDir=
NetType=0
[cvpcb/libraries]
EquName1=devcms
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
PadForm=1
PadMask=14745599
ViaDiam=450
ViaDril=250
Isol=60
Countlayer=2
Lpiste=170
RouteTo=15
RouteBo=0
TypeVia=3
Segm45=1
Racc45=1
Unite=0
SegFill=1
SegAffG=0
NewAffG=1
PadFill=1
PadAffG=1
PadSNum=1
ModAffC=0
ModAffT=0
PcbAffT=0
SgPcb45=1
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
HPGLnum=1
HPGdiam=15
HPGLSpd=20
HPGLrec=2
HPGLorg=0
GERBmin=15
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
ForPlot=1
WpenSer=10
UserGrX=0,01
UserGrY=0,01
UserGrU=1
DivGrPc=1
TimeOut=600
MaxLnkS=3
ShowRat=0
ShowMRa=1
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=valves
LibName9=led
LibName10=dip_sockets
[eeschema]
version=1
LibDir=
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
[eeschema/libraries]
LibName1=power
LibName2=device
LibName3=transistors
LibName4=conn
LibName5=linear
LibName6=regul
LibName7=74xx
LibName8=cmos4000
LibName9=adc-dac
LibName10=memory
LibName11=xilinx
LibName12=special
LibName13=microcontrollers
LibName14=dsp
LibName15=microchip
LibName16=analog_switches
LibName17=motorola
LibName18=texas
LibName19=intel
LibName20=audio
LibName21=interface
LibName22=digital-audio
LibName23=philips
LibName24=display
LibName25=cypress
LibName26=siliconi
LibName27=opto
LibName28=atmel
LibName29=contrib
LibName30=valves
[general]
version=1

View File

@ -0,0 +1,168 @@
EESchema Schematic File Version 2 date 03/08/2012 23:04:32
LIBS:power
LIBS:device
LIBS:transistors
LIBS:conn
LIBS:linear
LIBS:regul
LIBS:74xx
LIBS:cmos4000
LIBS:adc-dac
LIBS:memory
LIBS:xilinx
LIBS:special
LIBS:microcontrollers
LIBS:dsp
LIBS:microchip
LIBS:analog_switches
LIBS:motorola
LIBS:texas
LIBS:intel
LIBS:audio
LIBS:interface
LIBS:digital-audio
LIBS:philips
LIBS:display
LIBS:cypress
LIBS:siliconi
LIBS:opto
LIBS:atmel
LIBS:contrib
LIBS:valves
EELAYER 43 0
EELAYER END
$Descr A4 11693 8268
encoding utf-8
Sheet 1 1
Title ""
Date "3 aug 2012"
Rev ""
Comp ""
Comment1 ""
Comment2 ""
Comment3 ""
Comment4 ""
$EndDescr
$Comp
L CONN_13X2 P1
U 1 1 501C45CC
P 9600 1500
F 0 "P1" H 9600 2200 60 0000 C CNN
F 1 "CONN_13X2" V 9600 1500 50 0000 C CNN
1 9600 1500
1 0 0 -1
$EndComp
$Comp
L +5V #PWR01
U 1 1 501C4637
P 10100 800
F 0 "#PWR01" H 10100 890 20 0001 C CNN
F 1 "+5V" H 10100 890 30 0000 C CNN
1 10100 800
1 0 0 -1
$EndComp
$Comp
L +3.3V #PWR02
U 1 1 501C4646
P 9100 800
F 0 "#PWR02" H 9100 760 30 0001 C CNN
F 1 "+3.3V" H 9100 910 30 0000 C CNN
1 9100 800
1 0 0 -1
$EndComp
$Comp
L GND #PWR03
U 1 1 501C4659
P 10100 2200
F 0 "#PWR03" H 10100 2200 30 0001 C CNN
F 1 "GND" H 10100 2130 30 0001 C CNN
1 10100 2200
1 0 0 -1
$EndComp
Wire Wire Line
10000 1100 10100 1100
Wire Wire Line
10100 1100 10100 2200
Wire Wire Line
10000 900 10100 900
Wire Wire Line
10100 900 10100 800
Wire Wire Line
9200 900 9100 900
Wire Wire Line
9100 900 9100 800
Wire Wire Line
10000 1200 11000 1200
Wire Wire Line
10000 1300 11000 1300
Text Label 11000 1200 2 60 ~ 0
GPIO14_(TxD)
Text Label 11000 1300 2 60 ~ 0
GPIO15_(RxD)
Wire Wire Line
10000 1400 11000 1400
Text Label 11000 1400 2 60 ~ 0
GPIO18_(PCM_CLK)
Wire Wire Line
10000 1600 11000 1600
Wire Wire Line
10000 1700 11000 1700
Text Label 11000 1600 2 60 ~ 0
GPIO23
Text Label 11000 1700 2 60 ~ 0
GPIO24
Wire Wire Line
10000 1900 11000 1900
Wire Wire Line
10000 2000 11000 2000
Wire Wire Line
10000 2100 11000 2100
Text Label 11000 1900 2 60 ~ 0
GPIO25
Text Label 11000 2000 2 60 ~ 0
GPIO8_(CE0)
Text Label 11000 2100 2 60 ~ 0
CPIO7_(CE1)
NoConn ~ 10000 1800
NoConn ~ 10000 1500
NoConn ~ 10000 1000
Wire Wire Line
9200 1000 8200 1000
Wire Wire Line
9200 1100 8200 1100
Wire Wire Line
9200 1200 8200 1200
Wire Wire Line
9200 1400 8200 1400
Wire Wire Line
9200 1500 8200 1500
Wire Wire Line
9200 1600 8200 1600
Wire Wire Line
9200 1800 8200 1800
Wire Wire Line
9200 1900 8200 1900
Wire Wire Line
9200 2000 8200 2000
NoConn ~ 9200 2100
NoConn ~ 9200 1700
NoConn ~ 9200 1300
Text Label 8200 1000 0 60 ~ 0
GPIO0_(SDA)
Text Label 8200 1100 0 60 ~ 0
GPIO1_(SCL)
Text Label 8200 1200 0 60 ~ 0
GPIO4_(GPCLK0)
Text Label 8200 1400 0 60 ~ 0
GPIO17
Text Label 8200 1500 0 60 ~ 0
GPIO21_(PCM_DOUT)
Text Label 8200 1600 0 60 ~ 0
GPIO22
Text Label 8200 1800 0 60 ~ 0
GPIO10_(MOSI)
Text Label 8200 1900 0 60 ~ 0
GPIO9_(MISO)
Text Label 8200 2000 0 60 ~ 0
GPIO11_(SCKL)
$EndSCHEMATC

View File

@ -0,0 +1 @@
comp = "P1" module = "HE10_26D"