Commit 36f1147d authored by Maciej Suminski's avatar Maciej Suminski

Upstream merge.

parents 46eabaa4 28d702f6
include/boost
downloads-by-cmake
.downloads-by-cmake
common/netlist_keywords.*
common/netlist_lexer.h
common/pcb_plot_params_lexer.h
common/page_layout_reader_keywords.cpp
common/fp_lib_table_keywords.*
include/fp_lib_table_lexer.h
include/netlist_lexer.h
include/page_layout_reader_lexer.h
eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.*
eeschema/template_fieldnames_keywords.*
......
......@@ -74,6 +74,13 @@ else()
message("Build testing (unstable) version of KiCad")
endif()
# All CMake downloads go here. Suggested is up in the source tree, not in the build dir where they
# would have to be downloaded over and over again. The default is to choose a directory that is
# hidden on linux (starts with a '.') because there is a way to exclude this directory when grepping
# the source tree.
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/.downloads-by-cmake
CACHE PATH "Location of KiCad downloads, suggested is a dir common to all builds, i.e. global." )
#================================================
# Set flags for GCC.
......@@ -149,6 +156,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG")
endif()
# quiet GCC 4.8.1 while in boost
if( GCC_VERSION VERSION_GREATER 4.8 OR GCC_VERSION VERSION_EQUAL 4.8 )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
endif()
endif(CMAKE_COMPILER_IS_GNUCXX)
if(wxUSE_UNICODE)
......@@ -239,10 +251,6 @@ include(Functions)
include( ExternalProject )
# All CMake downloads go here, up in the source tree, not in the build dir where they
# would have to be downloaded over and over again.
set( DOWNLOAD_DIR ${PROJECT_SOURCE_DIR}/downloads-by-cmake )
#================================================
# Find libraries that are needed to build KiCad.
#================================================
......
......@@ -8,5 +8,6 @@ file( STRINGS ${inputFile} lines )
file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from an HTML file\n" )
foreach( line ${lines} )
file( APPEND ${outputFile} "\"" ${line} "\"\n" )
STRING(REGEX REPLACE "\"" "\\\\\"" linem ${line})
file( APPEND ${outputFile} "\"" ${linem} "\\n\"\n" )
endforeach( line ${lines} )
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
if( NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" )
message( FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"" )
endif()
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
STRING(REGEX REPLACE "\n" ";" files "${files}")
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"")
IF(EXISTS "$ENV{DESTDIR}${file}")
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
IF(NOT "${rm_retval}" STREQUAL 0)
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"")
ENDIF(NOT "${rm_retval}" STREQUAL 0)
ELSE(EXISTS "$ENV{DESTDIR}${file}")
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.")
ENDIF(EXISTS "$ENV{DESTDIR}${file}")
ENDFOREACH(file)
file( READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files )
string( REGEX REPLACE "\n" ";" files "${files}" )
foreach( file ${files} )
message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" )
if( EXISTS "$ENV{DESTDIR}${file}" )
EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval
)
if( NOT "${rm_retval}" STREQUAL 0 )
message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" )
endif()
else()
message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
endif()
endforeach()
......@@ -28,16 +28,22 @@ development libaries.
After a fresh install you need the following packages to compile and run
KiCad from source.
CMake - Cross-platform make
GLUT - The OpenGL Utility Library
wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
* bzr - Bazaar version control system
* CMake - Cross-platform make
* GLUT - The OpenGL Utility Library
* wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
Boost - Collection of portable C++ source libraries
Because boost is in the repository of kicad you don't need to install them.
* Boost - Collection of portable C++ source libraries
boost will be automagically downloaded and copied in kicad sources tree,
the first time you compile kicad.
Useful, but not required:
Doxygen - Documentation system for several programming languages
* Doxygen - Documentation system for several programming languages
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
Be sure you bzr install also includes bzrtools.
boost libraries will be downloaded the first time you build Kicad.
Compiler and basic development tools
-------------
......
Bazaar
------
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
The easiest way to get a copy of the KiCad source is to use Bazaar.
Bazaar can be download from http://wiki.bazaar.canonical.com.
Your best bet is to use the stand alone version of Bazaar
(which includes bzrtools, needed by Kicad) rather than one of
the Python specific versions.
Be sure bzrtools is also installed.
boost libraries will be downloaded the first time you build Kicad.
CMake
-----
KiCad uses CMake to generate the build files specific for the target platform
specified by the developer. This document attempts to define some of the more
common CMake and KiCad build configuration settings. You can use CMake either
......
......@@ -26,10 +26,12 @@ languages. Only C is installed by default and C++ is required to build KiCad.
Bazaar
------
KiCad uses the Bazaar version control system to track source code changes.
KiCad uses the Bazaar version control system to track source code changes,
and download the boost libraries needed by Kicad.
The easiest way to get a copy of the KiCad source is to use Bazaar. Bazaar
can be download from http://http://wiki.bazaar.canonical.com/WindowsDownloads.
Your best bet is to use the stand alone version of Bazaar rather than one of
can be download from http://wiki.bazaar.canonical.com/WindowsDownloads.
Your best bet is to use the stand alone version of Bazaar
(which includes bzrtools, needed Kicad) rather than one of
the Python specific versions.
CMake
......@@ -87,7 +89,7 @@ MinGW linker.
Build and Install the wxWidgets Library
---------------------------------------
The wxWidgets library is the base that KiCad is built upon. Version 2.9.4
or later of wxWidgets should be used on Windows. You may be able to build
or later of wxWidgets *should be* used on Windows. You may be able to build
KiCad with older versions of wxWidgets but it is not recommended. wxWidgets
can be downloaded from http://http://www.wxwidgets.org/downloads/
......@@ -107,16 +109,10 @@ install the wxWidgets library into MinGW then enter the following commands:
If you want to install wxWidgets in MinGW then enter the following commands:
#mkdir Release
#cd Release
#../configure --prefix=/mingw --with-opengl
#../configure --prefix=/mingw --enable-monolithic=no --disable-shared --with-opengl
#make && make install
#move /mingw/lib/wxmsw*.dll /mingw/bin
The last command is critical so that the libraries are in the MinGW PATH
and can be found at run time. If you want to build a full debugging version
of wxWidgets, add --enable-debug to the configure command. If you are going
to use the GNU debugger, you may also want to build the debugging libraries
with the extra GDB debugging information by adding --enable-debug_gdb to the
configure command.
wxWidgets will be statically linked to Kicad, which avoid issus with wxWidgets dlls
Download the KiCad Source Code
------------------------------
......@@ -229,5 +225,5 @@ To build the HTML developer documentation, run the following commands:
#cd <kicadSource>/build/debug
#make doxygen-docs
The documentation will be created in the <kicadSouce>/Documenation/html
The documentation will be created in the <kicadSouce>/Documentation/html
directory.
......@@ -9,6 +9,7 @@ Snow Leopard
Requirements
* XCode Tools (http://developer.apple.com/tools/xcode)
* bzr (bazaar)
* CMake (http://www.cmake.org)
* wxWidgets 2.9 (http://www.wxwidgets.org/downloads)
* Doxygen (http://www.doxygen.nl)
......@@ -19,7 +20,7 @@ Building wxWidgets 2.9 Universal
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
To check if your tools and libraries are installed check with file for architectures.
user@macosx$ file /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib
user@macosx$ file /Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib: Mach-O universal binary with 4 architectures
/Developer/SDKs/MacOSX10.5.sdk/usr/lib/libSystem.dylib (for architecture ppc7400): Mach-O dynamically linked shared library stub ppc
......@@ -37,7 +38,7 @@ At time of writing (2009-01-16) this is on line 18381
into this: OSX_UNIV_OPTS="-arch ppc -arch i386 -arch x86_64"
Building a universal monolib wxWidgets 2.9 with the following parameters:
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --with-expat=builtin --enable-universal_binary --enable-aui --enable-debug --with-osx_cocoa --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk/ --prefix=/opt/wxwidgets/<rev>
./configure --enable-unicode=yes --enable-shared=no --enable-monolithic --with-opengl --with-expat=builtin --enable-universal_binary --enable-aui --enable-debug --with-osx_cocoa --with-macosx-sdk=/Developer/SDKs/MacOSX10.5.sdk/ --prefix=/opt/wxwidgets/<rev>
<rev> Should be subsituded with the revision from SVN
......@@ -91,7 +92,7 @@ It depends on which CMake version you use:
//This fixes also BOOST macro errors
CMAKE_CXX_FLAGS:STRING=-D__ASSERTMACROS__
//Build architectures for OSX
//Build architectures for OSX
CMAKE_OSX_ARCHITECTURES:STRING=x86_64 -arch i386 -arch ppc -isysroot /Developer/SDKs/MacOSX10.5.sdk/ -mmacosx-version-min=10.5
//The product will be built against the headers and libraries located
......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="generator" content="AsciiDoc 8.4.5" />
<title>KiCad 2010-xx-xx Release</title>
<style type="text/css">
/* Debug borders */
p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
/*
border: 1px solid red;
*/
}
body {
margin: 1em 5% 1em 5%;
}
a {
color: blue;
text-decoration: underline;
}
a:visited {
color: fuchsia;
}
em {
font-style: italic;
color: navy;
}
strong {
font-weight: bold;
color: #083194;
}
tt {
color: navy;
}
h1, h2, h3, h4, h5, h6 {
color: #527bbd;
font-family: sans-serif;
margin-top: 1.2em;
margin-bottom: 0.5em;
line-height: 1.3;
}
h1, h2, h3 {
border-bottom: 2px solid silver;
}
h2 {
padding-top: 0.5em;
}
h3 {
float: left;
}
h3 + * {
clear: left;
}
div.sectionbody {
font-family: serif;
margin-left: 0;
}
hr {
border: 1px solid silver;
}
p {
margin-top: 0.5em;
margin-bottom: 0.5em;
}
ul, ol, li > p {
margin-top: 0;
}
pre {
padding: 0;
margin: 0;
}
span#author {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
font-size: 1.1em;
}
span#email {
}
span#revnumber, span#revdate, span#revremark {
font-family: sans-serif;
}
div#footer {
font-family: sans-serif;
font-size: small;
border-top: 2px solid silver;
padding-top: 0.5em;
margin-top: 4.0em;
}
div#footer-text {
float: left;
padding-bottom: 0.5em;
}
div#footer-badges {
float: right;
padding-bottom: 0.5em;
}
div#preamble {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
div.admonitionblock {
margin-top: 1.5em;
margin-bottom: 1.5em;
}
div.admonitionblock {
margin-top: 2.5em;
margin-bottom: 2.5em;
}
div.content { /* Block element content. */
padding: 0;
}
/* Block element titles. */
div.title, caption.title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
text-align: left;
margin-top: 1.0em;
margin-bottom: 0.5em;
}
div.title + * {
margin-top: 0;
}
td div.title:first-child {
margin-top: 0.0em;
}
div.content div.title:first-child {
margin-top: 0.0em;
}
div.content + div.title {
margin-top: 0.0em;
}
div.sidebarblock > div.content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.listingblock > div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock {
padding-left: 2.0em;
margin-right: 10%;
}
div.quoteblock > div.attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock {
padding-left: 2.0em;
margin-right: 10%;
}
div.verseblock > div.content {
white-space: pre;
}
div.verseblock > div.attribution {
padding-top: 0.75em;
text-align: left;
}
/* DEPRECATED: Pre version 8.2.7 verse style literal block. */
div.verseblock + div.attribution {
text-align: left;
}
div.admonitionblock .icon {
vertical-align: top;
font-size: 1.1em;
font-weight: bold;
text-decoration: underline;
color: #527bbd;
padding-right: 0.5em;
}
div.admonitionblock td.content {
padding-left: 0.5em;
border-left: 2px solid silver;
}
div.exampleblock > div.content {
border-left: 2px solid silver;
padding: 0.5em;
}
div.imageblock div.content { padding-left: 0; }
span.image img { border-style: none; }
a.image:visited { color: white; }
dl {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
dt {
margin-top: 0.5em;
margin-bottom: 0;
font-style: normal;
color: navy;
}
dd > *:first-child {
margin-top: 0.1em;
}
ul, ol {
list-style-position: outside;
}
ol.arabic {
list-style-type: decimal;
}
ol.loweralpha {
list-style-type: lower-alpha;
}
ol.upperalpha {
list-style-type: upper-alpha;
}
ol.lowerroman {
list-style-type: lower-roman;
}
ol.upperroman {
list-style-type: upper-roman;
}
div.compact ul, div.compact ol,
div.compact p, div.compact p,
div.compact div, div.compact div {
margin-top: 0.1em;
margin-bottom: 0.1em;
}
div.tableblock > table {
border: 3px solid #527bbd;
}
thead {
font-family: sans-serif;
font-weight: bold;
}
tfoot {
font-weight: bold;
}
td > div.verse {
white-space: pre;
}
p.table {
margin-top: 0;
}
/* Because the table frame attribute is overriden by CSS in most browsers. */
div.tableblock > table[frame="void"] {
border-style: none;
}
div.tableblock > table[frame="hsides"] {
border-left-style: none;
border-right-style: none;
}
div.tableblock > table[frame="vsides"] {
border-top-style: none;
border-bottom-style: none;
}
div.hdlist {
margin-top: 0.8em;
margin-bottom: 0.8em;
}
div.hdlist tr {
padding-bottom: 15px;
}
dt.hdlist1.strong, td.hdlist1.strong {
font-weight: bold;
}
td.hdlist1 {
vertical-align: top;
font-style: normal;
padding-right: 0.8em;
color: navy;
}
td.hdlist2 {
vertical-align: top;
}
div.hdlist.compact tr {
margin: 0;
padding-bottom: 0;
}
.comment {
background: yellow;
}
@media print {
div#footer-badges { display: none; }
}
div#toctitle {
color: #527bbd;
font-family: sans-serif;
font-size: 1.1em;
font-weight: bold;
margin-top: 1.0em;
margin-bottom: 0.1em;
}
div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
margin-top: 0;
margin-bottom: 0;
}
div.toclevel2 {
margin-left: 2em;
font-size: 0.9em;
}
div.toclevel3 {
margin-left: 4em;
font-size: 0.9em;
}
div.toclevel4 {
margin-left: 6em;
font-size: 0.9em;
}
/* Workarounds for IE6's broken and incomplete CSS2. */
div.sidebar-content {
background: #ffffee;
border: 1px solid silver;
padding: 0.5em;
}
div.sidebar-title, div.image-title {
color: #527bbd;
font-family: sans-serif;
font-weight: bold;
margin-top: 0.0em;
margin-bottom: 0.5em;
}
div.listingblock div.content {
border: 1px solid silver;
background: #f4f4f4;
padding: 0.5em;
}
div.quoteblock-attribution {
padding-top: 0.5em;
text-align: right;
}
div.verseblock-content {
white-space: pre;
}
div.verseblock-attribution {
padding-top: 0.75em;
text-align: left;
}
div.exampleblock-content {
border-left: 2px solid silver;
padding-left: 0.5em;
}
/* IE6 sets dynamically generated links as visited. */
div#toc a:visited { color: blue; }
</style>
</head>
<body>
<div id="header">
<h1>KiCad 2010-xx-xx Release</h1>
</div>
<h2 id="_common">Common</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
Actions can now be undo and redo
</p>
</li>
<li>
<p>
Menus and tooltips more clear
</p>
</li>
<li>
<p>
File history now in Open Recent submenu
</p>
</li>
<li>
<p>
Many new hotkeys added
</p>
</li>
<li>
<p>
Plot and print dialog rewritten
</p>
</li>
<li>
<p>
Remember last dialog position and tab
</p>
</li>
<li>
<p>
Better font shapes
</p>
</li>
<li>
<p>
Generation of bill of materials
</p>
</li>
<li>
<p>
Plot SVG output
</p>
</li>
</ul></div>
</div>
<h2 id="_kicad">KiCad</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
Issue fixed when opening a project in a directory with a lot of subdirectories
</p>
</li>
<li>
<p>
If project is noname.pro no <tt>error</tt> will be displayed
</p>
</li>
</ul></div>
</div>
<h2 id="_eeschema">EESchema</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
New pin properties dialog
</p>
</li>
</ul></div>
</div>
<h2 id="_pcbnew">PCBNew</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
Advanced layer setup
</p>
</li>
<li>
<p>
New panel for layer management
</p>
</li>
<li>
<p>
Support for net classes
</p>
</li>
<li>
<p>
Incorrect DRC error fixed, DRC min via and min track check
</p>
</li>
<li>
<p>
Handle local mask clearance and local net clearance
</p>
</li>
<li>
<p>
Handle zones in connectivity calculations
</p>
</li>
</ul></div>
</div>
<h2 id="_core">Core</h2>
<div class="sectionbody">
<div class="ulist"><ul>
<li>
<p>
Many many bugfixes and cleanups
</p>
</li>
<li>
<p>
All comments translated to English
</p>
</li>
<li>
<p>
Moved to wxAUI and dialogs created with wxFormBuilder
</p>
</li>
<li>
<p>
Full support for Mac OS X with wxWidgets 2.9
</p>
</li>
</ul></div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2010-02-21 13:41:09 CEST
</div>
</div>
</body>
</html>
KiCad 2010-xx-xx Release
========================
== Common
* Actions can now be undo and redo
* Menus and tooltips more clear
* File history now in Open Recent submenu
* Many new hotkeys added
* Plot and print dialog rewritten
* Remember last dialog position and tab
* Better font shapes
* Generation of bill of materials
* Plot SVG output
== KiCad
* Issue fixed when opening a project in a directory with a lot of subdirectories.
* If project is noname.pro no `error` will be displayed
== EESchema
* New pin properties dialog
== PCBNew
* Plot DXF output
* Advanced layer setup
* New panel for layer management
* Support for net classes
* Incorrect DRC error fixed, DRC min via and min track check
* Handle local mask clearance and local net clearance
* Handle zones in connectivity calculations
== Core
* Many many bugfixes and cleanups
* All comments translated to English
* Moved to wxAUI and dialogs created with wxFormBuilder
* Full support for Mac OS X with wxWidgets 2.9
///////////////////////////////////////
This is a asciidoc formatted file, it can be converted
to PDF,(XHTML) and others. See asciidoc homepage.
///////////////////////////////////////
......@@ -2,40 +2,42 @@ Contribute to KiCad (under Linux)
--------------------
1) make sure you have all the dependencies of KiCad:
sudo apt-get install debhelper dpatch libx11-dev
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install cmake bzr
sudo apt-get install debhelper dpatch libx11-dev
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-dev
sudo apt-get install libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install cmake bzr
sudo apt-get install cmake bzr bzrtools
2) initialize Bazaar:
bzr whoami "John Doe <john.doe@gmail.com>"
bzr whoami "John Doe <john.doe@gmail.com>"
3) get LATEST KiCad source tree and name it, for instance, "kicad_john":
cd ~/
bzr branch lp:kicad kicad_john
cd ~/
bzr branch lp:kicad kicad_john
4) create a copy of this folder and zip it away (just in case).
4) Read coding_style_policy.pdf, in <kicad_sources>/Documentation,
and other docs.
5) Modify/add source code.
cd kicad_john
gedit .......
cd kicad_john
gedit .......
6) Compile:
cd kicad_john
mkdir build; cd build
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
cd kicad_john
mkdir build; cd build
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Debug
to build a debug version
or
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
to build a release version
make -j 4 # this is for a 4 core machine
make
7) Repeat step 5 and 6 until satisfied.
8) Create a patch:
in kicad_john:
in kicad_john:
if some files are added: bzr add [FILE...]
bzr diff > my_changes.patch
bzr diff > my_changes.patch
9) Send the patch file "my_changes.patch" to the KiCad developers mailing list.
in the subject of the e-mail include the keyword "[PATCH]".
......
......@@ -46,6 +46,7 @@
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
......@@ -79,8 +80,32 @@ private:
void OnPaint( wxPaintEvent& event );
void OnLoadFile( wxCommandEvent& event );
bool LoadFile( wxString& aFullFileName );
void OnExportEeschema( wxCommandEvent& event );
void OnExportPcbnew( wxCommandEvent& event );
void OnExport( wxCommandEvent& event );
/**
* Generate a schematic library which comtains one component:
* the logo
*/
void OnExportEeschema();
/**
* Depending on the option:
* Legacy format: generate a module library which comtains one component
* New kicad_mod format: generate a module in S expr format
*/
void OnExportPcbnew( bool aLegacyFormat );
/**
* Generate a postscript file
*/
void OnExportPostScript();
/**
* Generate a file suitable to be copied into a page layout
* description file (.kicad_wks file
*/
void OnExportLogo();
void Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
void OnOptionsSelection( wxCommandEvent& event );
void OnThresholdChange( wxScrollEvent& event );
......@@ -104,6 +129,9 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
if( m_Config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
m_rbOptions->SetSelection( tmp ? 1 : 0 );
m_Config->Read( KEYWORD_LAST_FORMAT, &tmp );
m_radioBoxFormat->SetSelection( tmp );
// Give an icon
wxIcon icon;
......@@ -114,8 +142,7 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
m_buttonExportEeschema->Enable( false );
m_buttonExportPcbnew->Enable( false );
m_buttonExport->Enable( false );
if ( m_FramePos == wxDefaultPosition )
Centre();
......@@ -138,6 +165,7 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
m_Config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
delete m_Config;
......@@ -198,8 +226,7 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
if( ! LoadFile( fullFilename ) )
return;
m_buttonExportEeschema->Enable( true );
m_buttonExportPcbnew->Enable( true );
m_buttonExport->Enable( true );
SetStatusText( fullFilename );
Refresh();
}
......@@ -300,8 +327,103 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
Refresh();
}
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
{
int sel = m_radioBoxFormat->GetSelection();
switch( sel )
{
case 0:
OnExportEeschema();
break;
case 1:
OnExportPcbnew( true );
break;
case 2:
OnExportPcbnew( false );
break;
case 3:
OnExportPostScript();
break;
case 4:
OnExportLogo();
break;
}
}
void BM2CMP_FRAME::OnExportLogo()
{
wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxString msg = _( "Logo file (*.kicad_wks)|*.kicad_wks" );
wxFileDialog FileDlg( this, _( "Create a logo file" ), path, wxEmptyString,
msg,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = FileDlg.ShowModal();
if( diag != wxID_OK )
return;
m_ConvertedFileName = FileDlg.GetPath();
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
{
wxString msg;
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
wxMessageBox( msg );
return;
}
ExportFile( outfile, 4 );
fclose( outfile );
}
void BM2CMP_FRAME::OnExportPostScript()
{
wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath();
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxString msg = _( "Postscript file (*.ps)|*.ps" );
wxFileDialog FileDlg( this, _( "Create a Postscript file" ), path, wxEmptyString,
msg,
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
int diag = FileDlg.ShowModal();
if( diag != wxID_OK )
return;
m_ConvertedFileName = FileDlg.GetPath();
FILE* outfile;
outfile = wxFopen( m_ConvertedFileName, wxT( "w" ) );
if( outfile == NULL )
{
wxString msg;
msg.Printf( _( "File %s could not be created" ), m_ConvertedFileName.c_str() );
wxMessageBox( msg );
return;
}
ExportFile( outfile, 3 );
fclose( outfile );
}
void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
void BM2CMP_FRAME::OnExportEeschema()
{
wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath();
......@@ -331,12 +453,12 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
return;
}
ExportFile( outfile, 1 );
ExportFile( outfile, 2 );
fclose( outfile );
}
void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
{
wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath();
......@@ -344,7 +466,9 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd();
wxString msg = _( "Footprint file (*.mod;*.emp)|*.mod;*.emp" );
wxString msg = aLegacyFormat ?
_( "Footprint file (*.emp)|*.emp" ) :
_( "Footprint file (*.kicad_mod)|*.kicad_mod" );
wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
path, wxEmptyString,
msg,
......@@ -368,7 +492,7 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
return;
}
ExportFile( outfile, 0 );
ExportFile( outfile, aLegacyFormat ? 0 : 1 );
fclose( outfile );
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -47,77 +47,82 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
m_staticTextSizeX = new wxStaticText( m_panelRight, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 );
fgSizerInfo->Add( m_staticTextSizeX, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_staticTextSizeX, 0, wxALIGN_RIGHT|wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeXValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXValue->Wrap( -1 );
fgSizerInfo->Add( m_SizeXValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_SizeXValue, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeXunits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunits->Wrap( -1 );
fgSizerInfo->Add( m_SizeXunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_SizeXunits, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextSizeY = new wxStaticText( m_panelRight, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 );
fgSizerInfo->Add( m_staticTextSizeY, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_staticTextSizeY, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeYValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYValue->Wrap( -1 );
fgSizerInfo->Add( m_SizeYValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_SizeYValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_SizeYunits = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunits->Wrap( -1 );
fgSizerInfo->Add( m_SizeYunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_SizeYunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_staticTextBPP = new wxStaticText( m_panelRight, wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBPP->Wrap( -1 );
fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_staticTextBPP, 0, wxALIGN_RIGHT|wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_BPPValue = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPValue->Wrap( -1 );
fgSizerInfo->Add( m_BPPValue, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_BPPValue, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
m_BPPunits = new wxStaticText( m_panelRight, wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPunits->Wrap( -1 );
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
fgSizerInfo->Add( m_BPPunits, 0, wxBOTTOM|wxRIGHT|wxLEFT|wxALIGN_CENTER_VERTICAL, 5 );
sbSizerInfo->Add( fgSizerInfo, 0, wxEXPAND|wxBOTTOM, 5 );
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxALL, 5 );
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonExportEeschema = new wxButton( m_panelRight, wxID_ANY, _("Export to Eeschema"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExportEeschema->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_buttonExportEeschema, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonExport = new wxButton( m_panelRight, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExport->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
m_buttonExportPcbnew = new wxButton( m_panelRight, wxID_ANY, _("Export to Pcbnew"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExportPcbnew->SetToolTip( _("Create a footprint file for PcbNew\nThis footprint contains only one footprint: logo") );
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_buttonExportPcbnew, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
wxString m_radioBoxFormatChoices[] = { _("Eeschema"), _("Pcbnew old fmt (.emp)"), _("Pcbnew kicad_mod"), _("Postscript"), _("Logo for title block") };
int m_radioBoxFormatNChoices = sizeof( m_radioBoxFormatChoices ) / sizeof( wxString );
m_radioBoxFormat = new wxRadioBox( m_panelRight, wxID_ANY, _("Format"), wxDefaultPosition, wxDefaultSize, m_radioBoxFormatNChoices, m_radioBoxFormatChoices, 1, wxRA_SPECIFY_COLS );
m_radioBoxFormat->SetSelection( 4 );
brightSizer->Add( m_radioBoxFormat, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
int m_rbOptionsNChoices = sizeof( m_rbOptionsChoices ) / sizeof( wxString );
m_rbOptions = new wxRadioBox( m_panelRight, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, m_rbOptionsNChoices, m_rbOptionsChoices, 1, wxRA_SPECIFY_COLS );
m_rbOptions->SetSelection( 0 );
brightSizer->Add( m_rbOptions, 0, wxALL|wxEXPAND, 5 );
brightSizer->Add( m_rbOptions, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_ThresholdText = new wxStaticText( m_panelRight, wxID_ANY, _("Threshold Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThresholdText->Wrap( -1 );
brightSizer->Add( m_ThresholdText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_ThresholdText, 0, wxRIGHT|wxLEFT, 5 );
m_sliderThreshold = new wxSlider( m_panelRight, wxID_ANY, 25, 0, 50, wxDefaultPosition, wxDefaultSize, wxSL_AUTOTICKS|wxSL_HORIZONTAL|wxSL_TOP );
m_sliderThreshold = new wxSlider( m_panelRight, wxID_ANY, 50, 0, 100, wxDefaultPosition, wxDefaultSize, wxSL_HORIZONTAL|wxSL_LABELS );
m_sliderThreshold->SetToolTip( _("Adjust the level to convert the greyscale picture to a black and white picture.") );
brightSizer->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_panelRight->SetSizer( brightSizer );
m_panelRight->Layout();
brightSizer->Fit( m_panelRight );
bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
this->SetSizer( bMainSizer );
this->Layout();
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY );
......@@ -127,8 +132,7 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS
m_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
m_BNPicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
m_buttonLoad->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
m_buttonExportEeschema->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportEeschema ), NULL, this );
m_buttonExportPcbnew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportPcbnew ), NULL, this );
m_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
m_rbOptions->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
}
......@@ -140,8 +144,7 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
m_BNPicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
m_buttonLoad->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnLoadFile ), NULL, this );
m_buttonExportEeschema->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportEeschema ), NULL, this );
m_buttonExportPcbnew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportPcbnew ), NULL, this );
m_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
m_rbOptions->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), NULL, this );
m_sliderThreshold->Disconnect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
......
This source diff could not be displayed because it is too large. You can view the blob instead.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __bitmap2cmp_gui_base__
#define __bitmap2cmp_gui_base__
#ifndef __BITMAP2CMP_GUI_BASE_H__
#define __BITMAP2CMP_GUI_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/scrolwin.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
......@@ -56,8 +57,8 @@ class BM2CMP_FRAME_BASE : public wxFrame
wxStaticText* m_BPPValue;
wxStaticText* m_BPPunits;
wxButton* m_buttonLoad;
wxButton* m_buttonExportEeschema;
wxButton* m_buttonExportPcbnew;
wxButton* m_buttonExport;
wxRadioBox* m_radioBoxFormat;
wxRadioBox* m_rbOptions;
wxStaticText* m_ThresholdText;
wxSlider* m_sliderThreshold;
......@@ -66,17 +67,17 @@ class BM2CMP_FRAME_BASE : public wxFrame
// Virtual event handlers, overide them in your derived class
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportEeschema( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportPcbnew( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExport( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOptionsSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
public:
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 500,419 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bitmap to Component Converter"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 527,470 ), long style = wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER|wxTAB_TRAVERSAL );
~BM2CMP_FRAME_BASE();
};
#endif //__bitmap2cmp_gui_base__
#endif //__BITMAP2CMP_GUI_BASE_H__
/*
* This program source code file is part of KICAD, a free EDA CAD application.
*
* Copyright (C) 1992-2010 jean-pierre.charras
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 1992-2013 jean-pierre.charras
* Copyright (C) 1992-2013 Kicad Developers, see change_log.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
......@@ -22,8 +22,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <cmath>
#include <algorithm> // std::max
// For some unknown reasons, polygon.hpp shoul be included first
// For some unknown reasons, polygon.hpp should be included first
#include <boost/polygon/polygon.hpp>
#include <wx/wx.h>
......@@ -38,13 +39,6 @@
#include <auxiliary.h>
#ifndef max
#define max( a, b ) ( ( (a) > (b) ) ? (a) : (b) )
#endif
#ifndef min
#define min( a, b ) ( ( (a) < (b) ) ? (a) : (b) )
#endif
// Define some types used here from boost::polygon
namespace bpl = boost::polygon; // bpl = boost polygon library
using namespace bpl::operators; // +, -, =, ...
......@@ -58,9 +52,12 @@ typedef bpl::point_data<coordinate_type> KPolyPoint; // define a corner o
enum output_format {
POSTSCRIPT_FMT = 1,
PCBNEW_FMT,
EESCHEMA_FMT
PCBNEW_LEGACY_EMP,
PCBNEW_KICAD_MOD,
EESCHEMA_FMT,
KICAD_LOGO
};
/* free a potrace bitmap */
static void bm_free( potrace_bitmap_t* bm )
{
......@@ -172,22 +169,37 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
switch( aFormat )
{
case 2:
case 4:
info.m_Format = KICAD_LOGO;
info.m_ScaleX = 1e3 * 25.4 / 300; // the conversion scale from PPI to micro
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom
info.CreateOutputFile();
break;
case 3:
info.m_Format = POSTSCRIPT_FMT;
info.m_ScaleX = info.m_ScaleY = 1.0; // the conversion scale
info.m_ScaleX = 1.0; // the conversion scale
info.m_ScaleY = info.m_ScaleX;
// output vector data, e.g. as a rudimentary EPS file (mainly for tests)
info.CreateOutputFile();
break;
case 1:
case 2:
info.m_Format = EESCHEMA_FMT;
info.m_ScaleX = 1000.0 / 300; // the conversion scale
info.m_ScaleX = 1000.0 / 300; // the conversion scale from PPI to UI
info.m_ScaleY = -info.m_ScaleX; // Y axis is bottom to Top for components in libs
info.CreateOutputFile();
break;
case 1:
info.m_Format = PCBNEW_KICAD_MOD;
info.m_ScaleX = 1e6 * 25.4 / 300; // the conversion scale from PPI to UI
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
info.CreateOutputFile();
break;
case 0:
info.m_Format = PCBNEW_FMT;
info.m_Format = PCBNEW_LEGACY_EMP;
info.m_ScaleX = 10000.0 / 300; // the conversion scale
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
info.CreateOutputFile();
......@@ -221,7 +233,7 @@ void BITMAPCONV_INFO::OuputFileHeader()
fprintf( m_Outfile, "gsave\n" );
break;
case PCBNEW_FMT:
case PCBNEW_LEGACY_EMP:
#define FIELD_LAYER 21
fieldSize = 600; // fields text size = 60 mils
Ypos += fieldSize / 2;
......@@ -240,6 +252,22 @@ void BITMAPCONV_INFO::OuputFileHeader()
-Ypos, fieldSize, fieldSize, fieldSize / 5, FIELD_LAYER, m_CmpName );
break;
case PCBNEW_KICAD_MOD:
// fields text size = 1.5 mm
// fields text thickness = 1.5 / 5 = 0.3mm
fprintf( m_Outfile, "(module %s (layer F.Cu)\n (at 0 0)\n",
m_CmpName );
fprintf( m_Outfile, " (fp_text reference \"G***\" (at 0 0) (layer F.SilkS) hide\n"
" (effects (font (thickness 0.3)))\n )\n" );
fprintf( m_Outfile, " (fp_text value \"%s\" (at 0.75 0) (layer F.SilkS) hide\n"
" (effects (font (thickness 0.3)))\n )\n",
m_CmpName );
break;
case KICAD_LOGO:
fprintf( m_Outfile, "(polygon (pos 0 0 rbcorner) (rotate 0) (linewidth 0.01)\n" );
break;
case EESCHEMA_FMT:
fprintf( m_Outfile, "EESchema-LIBRARY Version 2.3\n" );
fprintf( m_Outfile, "#\n# %s\n", m_CmpName );
......@@ -267,11 +295,19 @@ void BITMAPCONV_INFO::OuputFileEnd()
fprintf( m_Outfile, "%%EOF\n" );
break;
case PCBNEW_FMT:
case PCBNEW_LEGACY_EMP:
fprintf( m_Outfile, "$EndMODULE %s\n", m_CmpName );
fprintf( m_Outfile, "$EndLIBRARY\n" );
break;
case PCBNEW_KICAD_MOD:
fprintf( m_Outfile, ")\n" );
break;
case KICAD_LOGO:
fprintf( m_Outfile, ")\n" );
break;
case EESCHEMA_FMT:
fprintf( m_Outfile, "ENDDRAW\n" );
fprintf( m_Outfile, "ENDDEF\n" );
......@@ -282,11 +318,11 @@ void BITMAPCONV_INFO::OuputFileEnd()
/**
* Function OuputOnePolygon
* write one polygon to output file.
* Polygon coordinates are expected scaled by the polugon extraction function
* Polygon coordinates are expected scaled by the polygon extraction function
*/
void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
{
unsigned ii;
unsigned ii, jj;
KPolyPoint currpoint;
int offsetX = (int)( m_PixmapWidth / 2 * m_ScaleX );
......@@ -297,19 +333,27 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
switch( m_Format )
{
case POSTSCRIPT_FMT:
fprintf( m_Outfile, "%d %d moveto\n",
startpoint.x(), startpoint.y() );
offsetY = (int)( m_PixmapHeight * m_ScaleY );
fprintf( m_Outfile, "newpath\n%d %d moveto\n",
startpoint.x(), offsetY - startpoint.y() );
jj = 0;
for( ii = 1; ii < aPolygon.size(); ii++ )
{
currpoint = *(aPolygon.begin() + ii);
fprintf( m_Outfile, "%d %d lineto\n",
currpoint.x(), currpoint.y() );
fprintf( m_Outfile, " %d %d lineto",
currpoint.x(), offsetY - currpoint.y() );
if( jj++ > 6 )
{
jj = 0;
fprintf( m_Outfile, ("\n") );
}
}
fprintf( m_Outfile, "0 setgray fill\n" );
fprintf( m_Outfile, "\nclosepath fill\n" );
break;
case PCBNEW_FMT:
case PCBNEW_LEGACY_EMP:
{
LAYER_NUM layer = SILKSCREEN_N_FRONT;
int width = 1;
......@@ -330,6 +374,54 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
}
break;
case PCBNEW_KICAD_MOD:
{
double width = 0.1;
fprintf( m_Outfile, " (fp_poly (pts" );
jj = 0;
for( ii = 0; ii < aPolygon.size(); ii++ )
{
currpoint = *( aPolygon.begin() + ii );
fprintf( m_Outfile, " (xy %f %f)",
(currpoint.x() - offsetX) / 1e6,
(currpoint.y() - offsetY) / 1e6 );
if( jj++ > 6 )
{
jj = 0;
fprintf( m_Outfile, ("\n ") );
}
}
// Close polygon
fprintf( m_Outfile, " (xy %f %f) )",
(startpoint.x() - offsetX) / 1e6, (startpoint.y() - offsetY) / 1e6 );
fprintf( m_Outfile, "(layer F.SilkS) (width %f)\n )\n", width );
}
break;
case KICAD_LOGO:
fprintf( m_Outfile, " (pts" );
// Internal units = micron, file unit = mm
jj = 0;
for( ii = 0; ii < aPolygon.size(); ii++ )
{
currpoint = *( aPolygon.begin() + ii );
fprintf( m_Outfile, " (xy %.3f %.3f)",
(currpoint.x() - offsetX) / 1e3,
(currpoint.y() - offsetY) / 1e3 );
if( jj++ > 4 )
{
jj = 0;
fprintf( m_Outfile, ("\n ") );
}
}
// Close polygon
fprintf( m_Outfile, " (xy %.3f %.3f) )\n",
(startpoint.x() - offsetX) / 1e3, (startpoint.y() - offsetY) / 1e3 );
break;
case EESCHEMA_FMT:
fprintf( m_Outfile, "P %d 0 0 1", (int) aPolygon.size() + 1 );
for( ii = 0; ii < aPolygon.size(); ii++ )
......@@ -363,6 +455,9 @@ void BITMAPCONV_INFO::CreateOutputFile()
KPolygonSet polyset_holes;
potrace_dpoint_t( *c )[3];
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
OuputFileHeader();
bool main_outline = true;
......@@ -451,6 +546,8 @@ void BITMAPCONV_INFO::CreateOutputFile()
}
OuputFileEnd();
setlocale( LC_NUMERIC, "" ); // revert to the current locale
}
......
......@@ -112,6 +112,9 @@ set(COMMON_SRCS
msgpanel.cpp
netlist_keywords.cpp
newstroke_font.cpp
page_layout_default_description.cpp
page_layout_reader_keywords.cpp
page_layout_reader.cpp
projet_config.cpp
ptree.cpp
reporter.cpp
......@@ -237,6 +240,15 @@ make_lexer(
FP_LIB_TABLE_T
)
# auto-generate page layout reader s-expression page_layout_reader_lexer.h
# and title_block_reader_keywords.cpp.
make_lexer(
${CMAKE_CURRENT_SOURCE_DIR}/page_layout_reader.keywords
${PROJECT_SOURCE_DIR}/include/page_layout_reader_lexer.h
${CMAKE_CURRENT_SOURCE_DIR}/page_layout_reader_keywords.cpp
TB_READER_T
)
# The dsntest may not build properly using MS Visual Studio.
if(NOT MSVC)
# This one gets made only when testing.
......
......@@ -7,9 +7,9 @@
#ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST
# define KICAD_BUILD_VERSION "(2013-mar-13 GOST)"
# define KICAD_BUILD_VERSION "(2013-jun-18 GOST)"
#else
# define KICAD_BUILD_VERSION "(2013-mar-13)"
# define KICAD_BUILD_VERSION "(2013-jun-18)"
#endif
#endif
......
......@@ -40,6 +40,20 @@
#include <wx/process.h>
// Fail build if wxWidgets printing was not configured.
#if !wxUSE_PRINTING_ARCHITECTURE && !SWIG
# error "You must use '--enable-printarch' in your wx library configuration."
#endif
// Show warning if wxWidgets Gnome or GTK printing was not configured.
#if defined( __WXGTK__ )
# if !wxUSE_LIBGNOMEPRINT && !wxUSE_GTKPRINT && !SWIG
# warning "You must use '--with-gnomeprint' or '--with-gtkprint' in your wx library configuration for full print capabilities."
# endif
#endif
/**
* Global variables definitions.
*
......
......@@ -35,6 +35,8 @@
#include <drawtxt.h>
#include <class_title_block.h>
#include "worksheet_shape_builder.h"
#include <wx/filename.h>
wxString GetDefaultPlotExtension( PlotFormat aFormat )
......@@ -98,8 +100,12 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aNumberOfSheets );
drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), aSheetDesc,
aFilename, aTitleBlock, plotColor, plotColor );
// Print only a short filename, if aFilename is the full filename
wxFileName fn( aFilename );
drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), fn.GetFullName(),
aSheetDesc, aTitleBlock, plotColor, plotColor );
// Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,7 +9,7 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_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( 400,120 ), wxDefaultSize );
......@@ -23,6 +23,7 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent,
m_buttonClose->SetDefault();
bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer );
this->Layout();
......@@ -36,4 +37,5 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE()
// Disconnect Events
m_htmlWindow->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this );
m_buttonClose->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnCloseButtonClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_display_info_HTML_base__
#define __dialog_display_info_HTML_base__
#ifndef __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#define __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/html/htmlwin.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
......@@ -26,7 +30,7 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DISPLAY_HTML_TEXT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_DISPLAY_HTML_TEXT_BASE : public wxDialog
class DIALOG_DISPLAY_HTML_TEXT_BASE : public DIALOG_SHIM
{
private:
......@@ -34,15 +38,16 @@ class DIALOG_DISPLAY_HTML_TEXT_BASE : public wxDialog
wxButton* m_buttonClose;
// Virtual event handlers, overide them in your derived class
virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ){ event.Skip(); }
virtual void OnCloseButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
virtual void OnCloseButtonClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxHtmlWindow* m_htmlWindow;
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 431,120 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxEmptyString, const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 431,120 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_DISPLAY_HTML_TEXT_BASE();
};
#endif //__dialog_display_info_HTML_base__
#endif //__DIALOG_DISPLAY_INFO_HTML_BASE_H__
......@@ -729,13 +729,13 @@ bool EDA_DRAW_FRAME::HandleBlockBegin( wxDC* aDC, int aKey, const wxPoint& aPosi
break;
default:
{
wxString msg;
msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
Block->GetCommand();
DisplayError( this, msg );
}
break;
{
wxString msg;
msg << wxT( "EDA_DRAW_FRAME::HandleBlockBegin() error: Unknown command " ) <<
Block->GetCommand();
DisplayError( this, msg );
}
break;
}
Block->SetMessageBlock( this );
......
......@@ -831,16 +831,26 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return;
// Auto pan if mouse is leave working area:
// Auto pan when mouse has left the client window
// Ensure the cross_hair position is updated,
// because it will be used to center the screen.
// We use a position inside the client window
wxSize size = GetClientSize();
wxPoint cross_hair_pos = event.GetPosition();
cross_hair_pos.x = std::min( cross_hair_pos.x, size.x );
cross_hair_pos.y = std::min( cross_hair_pos.y, size.x );
cross_hair_pos.x = std::max( cross_hair_pos.x, 0 );
cross_hair_pos.y = std::max( cross_hair_pos.y, 0 );
if( ( size.x < event.GetX() ) || ( size.y < event.GetY() )
|| ( event.GetX() <= 0) || ( event.GetY() <= 0 ) )
{
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
}
INSTALL_UNBUFFERED_DC( dc, this );
cross_hair_pos.x = dc.DeviceToLogicalX( cross_hair_pos.x );
cross_hair_pos.y = dc.DeviceToLogicalY( cross_hair_pos.y );
GetScreen()->SetCrossHairPosition( cross_hair_pos );
wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd );
event.Skip();
}
......
......@@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
/**
* Function DrawGraphicText
* Draw a graphic text (like module texts)
* @param aPanel = the current m_canvas. NULL if draw within a 3D GL Canvas
* @param aClipBox = the clipping rect, or NULL if no clipping
* @param aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify)
* @param aColor (enum EDA_COLOR_T) = text color
......@@ -261,7 +261,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
* @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text.
*/
void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
void DrawGraphicText( EDA_RECT* aClipBox,
wxDC* aDC,
const wxPoint& aPos,
EDA_COLOR_T aColor,
......@@ -284,9 +284,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
wxPoint current_char_pos; // Draw coordinates for the current char
wxPoint overbar_pos; // Start point for the current overbar
int overbar_italic_comp; // Italic compensation for overbar
EDA_RECT* clipBox; // Clip box used in basic draw functions
clipBox = aPanel ? aPanel->GetClipBox() : NULL;
#define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false;
......@@ -322,7 +319,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
dy = size_v;
/* Do not draw the text if out of draw area! */
if( aPanel )
if( aClipBox )
{
int xm, ym, ll, xc, yc;
ll = std::abs( dx );
......@@ -330,10 +327,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
xc = current_char_pos.x;
yc = current_char_pos.y;
x0 = aPanel->GetClipBox()->GetX() - ll;
y0 = aPanel->GetClipBox()->GetY() - ll;
xm = aPanel->GetClipBox()->GetRight() + ll;
ym = aPanel->GetClipBox()->GetBottom() + ll;
x0 = aClipBox->GetX() - ll;
y0 = aClipBox->GetY() - ll;
xm = aClipBox->GetRight() + ll;
ym = aClipBox->GetBottom() + ll;
if( xc < x0 )
return;
......@@ -407,7 +404,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
}
else
GRLine( clipBox, aDC,
GRLine( aClipBox, aDC,
current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor );
return;
......@@ -461,7 +458,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos;
// Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
}
......@@ -508,7 +505,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aWidth <= 1 )
aWidth = 0;
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, point_count, coord,
aCallback, aPlotter );
}
......@@ -554,13 +551,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
coord[1] = overbar_pos;
// Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter );
}
}
void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
wxDC * aDC,
void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
const wxPoint &aPos,
enum EDA_COLOR_T aBgColor,
enum EDA_COLOR_T aColor1,
......@@ -570,24 +566,23 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold,
int aWidth, bool aItalic, bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER * aPlotter )
{
// Swap color if contrast would be better
if( ColorIsLight( aBgColor ) ) {
if( ColorIsLight( aBgColor ) )
{
EDA_COLOR_T c = aColor1;
aColor1 = aColor2;
aColor2 = c;
}
DrawGraphicText( aPanel, aDC, aPos, aColor1, aText, aOrient, aSize,
DrawGraphicText( aClipBox, aDC, aPos, aColor1, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth, aItalic, aBold,
aCallback, aPlotter );
DrawGraphicText( aPanel, aDC, aPos, aColor2, aText, aOrient, aSize,
DrawGraphicText( aClipBox, aDC, aPos, aColor2, aText, aOrient, aSize,
aH_justify, aV_justify, aWidth / 4, aItalic, aBold,
aCallback, aPlotter );
}
......
This diff is collapsed.
......@@ -35,10 +35,13 @@
// Conversion to application internal units defined at build time.
#if defined( PCBNEW )
#include <class_board_item.h>
#include <class_board_item.h>
#elif defined( EESCHEMA )
#include <sch_item_struct.h>
#include <sch_item_struct.h>
#elif defined( GERBVIEW )
#elif defined( PL_EDITOR )
#include <base_units.h>
#define FMT_IU Double2Str
#else
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif
......@@ -212,7 +215,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy
}
void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
EDA_COLOR_T aColor, GR_DRAWMODE aDrawMode,
EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color )
{
......@@ -229,34 +232,23 @@ void EDA_TEXT::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aOffset,
for( unsigned i = 0; i<list->Count(); i++ )
{
wxString txt = list->Item( i );
DrawOneLineOfText( aPanel,
aDC,
aOffset,
aColor,
aDrawMode,
aFillMode,
drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode,
i ? UNSPECIFIED_COLOR : aAnchor_color,
txt,
pos );
txt, pos );
pos += offset;
}
delete (list);
}
else
DrawOneLineOfText( aPanel,
aDC,
aOffset,
aColor,
aDrawMode,
aFillMode,
aAnchor_color,
m_Text,
m_Pos );
drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDrawMode, aFillMode,
aAnchor_color, m_Text, m_Pos );
}
void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
void EDA_TEXT::drawOneLineOfText( EDA_RECT* aClipBox, wxDC* aDC,
const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_COLOR_T aAnchor_color,
......@@ -273,7 +265,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
// Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR )
{
GRDrawAnchor( aPanel->GetClipBox(), aDC,
GRDrawAnchor( aClipBox, aDC,
aPos.x + aOffset.x, aPos.y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color );
}
......@@ -286,7 +278,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( m_Mirror )
size.x = -size.x;
DrawGraphicText( aPanel, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
DrawGraphicText( aClipBox, aDC, aOffset + aPos, aColor, aText, m_Orient, size,
m_HJustify, m_VJustify, width, m_Italic, m_Bold );
}
......
......@@ -99,7 +99,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
fpinfo->SetLibraryName( filename.GetName() );
fpinfo->SetLibraryPath( filename.GetFullPath() );
fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
......@@ -163,7 +163,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
fpinfo->SetLibraryName( libNickNames[ii] );
fpinfo->SetLibraryPath( path );
fpinfo->m_Module = fpnames[i];
fpinfo->m_padCount = m->GetPadCount();
fpinfo->m_padCount = m->GetPadCount( MODULE::DO_NOT_INCLUDE_NPTH );
fpinfo->m_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription();
......@@ -180,3 +180,26 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
return true;
}
bool FOOTPRINT_INFO::InLibrary( const wxString& aLibrary ) const
{
if( aLibrary.IsEmpty() )
return false;
if( aLibrary == m_libName || aLibrary == m_libPath )
return true;
wxFileName filename = aLibrary;
if( filename.GetExt().IsEmpty() )
filename.SetExt( LegacyFootprintLibPathExtension );
if( filename.GetFullPath() == m_libPath )
return true;
if( filename.GetPath().IsEmpty() )
filename = wxGetApp().FindLibraryPath( filename.GetFullName() );
return filename.GetFullPath() == m_libPath;
}
......@@ -25,7 +25,7 @@
#include <config.h>
#include <common.h>
#if defined(_WIN32)
......
......@@ -519,6 +519,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
if( file )
{
fputs( TO_UTF8( msg ), file );
fclose( file );
}
else
{
......
......@@ -6,8 +6,8 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
wxPoint aPos, wxSize aSize)
: DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
{
SetFocus();
ListClear();
Center();
}
void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event )
......
/**
* @file page_layout_default_description.cpp
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 1992-2013 Jean-Pierre Charras <jp.charras at wanadoo.fr>.
* Copyright (C) 1992-2013 KiCad Developers, see change_log.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
*/
/* keyword used in page layout description are (see page_layout_reader.keywords)
* page_layout
* setup
* linewidth
* textlinewidth
* textsize
* comment
* line
* rect
* polygon
* tbtext
* ltcorner
* lbcorner
* rbcorner
* rtcorner
* name
* pos
* start
* end
* pts
* xy
* maxlen
* maxheight
* font
* bold
* italic
* size
* justify
* left
* center
* right
* top
* bottom
* rotate
* repeat
* incrx
* incry
* incrlabel
*/
/*
* Items use coordinates.
* A coordinate is defined relative to a page corner
* A coordinate is the X pos, the Y pos, and the corner which is the coordinate origin
* the default is the bottom right corner
* example: (start 10 0 ltcorner) or (start 20 10)
* The direction depends on the corner: a positive coordinate define a point
* from the corner origin, to the opposite corner.
*
* Items are defined by a name, coordinates in mm and some attributes,
* and can be repeated.
* for instance (repeat 2) (incrx 2) (incry 2) repeat the item 2 times,
* and coordinates are incremented by 2 on X direction, and 2 on Y direction
* Comments are allowed. they are inside (), and start by the keyword comment
* example:
* (comment rect around the title block)
*
* Lines and rect are defined by 2 coordinates start and end, and attributes.
* Attributes are linewidth and repeat parameters.
* example:
* (line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )
* (rect (comment rect around the title block) (linewidth 0.15) (start 110 34) (end 2 2) )
*
* Texts are defined by the text (between quotes), the position, and attributes
* example
* "(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )"
* the text can be rotated by (rotation <value>) with value = rot angle in degrees
* (font (size 1.3 1.3) bold italic) defines a specific size,
* with bold and italic options
* (justify <justif keyword>) controls the text justification (the default is left)
* justif keyword is center, left, right, top and bottom
* (justify center top) is a text centered on X axis and top aligned on vertical axis
* The text size can be constrained:
* (maxlen <value>) and (maxheight <value>) force the actual text x and/or y size to be
* reduced to limit the text height to the maxheight value,
* and the full text x size to the maxlen value.
* If the actual text size is smaller than limits, its size is not modified.
*
* Texts can include a format symbol, a la printf.
* At run time these format symbols will be replaced by their actual value.
*
* format symbols are:
*
* %% = replaced by %
* %K = Kicad version
* %Z = paper format name (A4, USLetter ...)
* %Y = company name
* %D = date
* %R = revision
* %S = sheet number
* %N = number of sheets
* %Cx = comment (x = 0 to 9 to identify the comment)
* %F = filename
* %P = sheet path (sheet full name)
* %T = title
*
* example:
* (tbtext \"Size: %Z\" ...) displays "Size A4" or Size USLetter"
*
* Poly Polygons
* Set of filled polygons are supported.
*
* The main purpose is to allow logos, or complex shapes
* They support the repeat and rotation options
* They are defined by
* (polygon (position ..) <rotation> <linewidth>
* the parameter linewidth defines the pen size used to draw/plot
* the polygon outlines (default = 0)
* example:
* (polygon (pos 134 18 rbcorner) (rotate 20) (linewidth 0.00254)
*
* and a list of corners like
* (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
* .... )
*
* each sequence like
* (pts (xy 20.574 8.382) (xy 19.9009 8.382) (xy 19.9009 6.26364) (xy 19.7485 5.98932)
* .... )
* defines a polygon.
* Each coordinate is relative to the polygon position.
* Therefore a "polygon" is in fact a set of polygons, of a poly polygon
*
*/
#include <worksheet.h> // defaultPageLayout
// height of the band reference grid 2.0 mm
// worksheet frame reference text size 1.3 mm
// default text size 1.5 mm
// default line width 0.15 mm
// frame ref pitch 50 mm
// export defaultPageLayout:
extern const char defaultPageLayout[];
// Default page layout (sizes are in mm)
const char defaultPageLayout[] = "( page_layout\n"
"(setup (textsize 1.5 1.5) (linewidth 0.15) (textlinewidth 0.15) )"
"(rect (comment \"rect around the title block\") (linewidth 0.15) (start 110 34) (end 2 2) )\n"
"(rect (start 0 0 ltcorner) (end 0 0 rbcorner) (repeat 2) (incrx 2) (incry 2) )\n"
"(line (start 50 2 ltcorner) (end 50 0 ltcorner) (repeat 30) (incrx 50) )\n"
"(tbtext \"1\" (pos 25 1 ltcorner) (font (size 1.3 1.3))(repeat 100) (incrx 50) )\n"
"(line (start 50 2 lbcorner) (end 50 0 lbcorner) (repeat 30) (incrx 50) )\n"
"(tbtext \"1\" (pos 25 1 lbcorner) (font (size 1.3 1.3)) (repeat 100) (incrx 50) )\n"
"(line (start 0 50 ltcorner) (end 2 50 ltcorner) (repeat 30) (incry 50) )\n"
"(tbtext \"A\" (pos 1 25 ltcorner) (font (size 1.3 1.3)) (justify center)(repeat 100) (incry 50) )\n"
"(line (start 0 50 rtcorner) (end 2 50 rtcorner) (repeat 30) (incry 50) )\n"
"(tbtext \"A\" (pos 1 25 rtcorner) (font (size 1.3 1.3)) (justify center) (repeat 100) (incry 50) )\n"
"(tbtext \"Date: %D\" (pos 87 6.9) )\n"
"(line (start 110 5.5) end 2 5.5) )\n"
"(tbtext \"%K\" (pos 109 4.1) (comment \"Kicad version\" ) )\n"
"(line (start 110 8.5) end 2 8.5) )\n"
"(tbtext \"Rev: %R\" (pos 24 6.9)(font bold)(justify left) )\n"
"(tbtext \"Size: %Z\" (comment \"Paper format name\")(pos 109 6.9) )\n"
"(tbtext \"Id: %S/%N\" (comment \"Sheet id\")(pos 24 4.1) )\n"
"(line (start 110 12.5) end 2 12.5) )\n"
"(tbtext \"Title: %T\" (pos 109 10.7)(font bold italic (size 2 2)) )\n"
"(tbtext \"File: %F\" (pos 109 14.3) )\n"
"(line (start 110 18.5) end 2 18.5) )\n"
"(tbtext \"Sheet: %P\" (pos 109 17) )\n"
"(tbtext \"%Y\" (comment \"Company name\") (pos 109 20)(font bold) )\n"
"(tbtext \"%C0\" (comment \"Comment 0\") (pos 109 23) )\n"
"(tbtext \"%C1\" (comment \"Comment 1\") (pos 109 26) )\n"
"(tbtext \"%C2\" (comment \"Comment 2\") (pos 109 29) )\n"
"(tbtext \"%C3\" (comment \"Comment 3\") (pos 109 32) )\n"
"(line (start 90 8.5) end 90 5.5) )\n"
"(line (start 26 8.5) end 26 2) )\n"
")\n"
;
This diff is collapsed.
page_layout
setup
linewidth
textlinewidth
textsize
comment
line
rect
polygon
tbtext
ltcorner
lbcorner
rbcorner
rtcorner
name
pos
start
end
pts
xy
maxlen
maxheight
font
bold
italic
size
justify
left
center
right
top
bottom
rotate
repeat
incrx
incry
incrlabel
......@@ -29,7 +29,7 @@
#include <reporter.h>
REPORTER& REPORTER::Report( const char *aText )
REPORTER& REPORTER::Report( const char* aText )
{
Report( FROM_UTF8( aText ) );
return *this;
......
This diff is collapsed.
/**
* @file title_block_shapes_gost.cpp
* @file title_block_shape_gost.h
* @brief description of graphic items and texts to build a title block
* using GOST standard
*/
......@@ -43,6 +43,17 @@
#define TEXTSIZE 100 // worksheet text size
struct Ki_WorkSheetData
{
public:
int m_Type;
Ki_WorkSheetData* Pnext;
int m_Posx, m_Posy;
int m_Endx, m_Endy;
const wxChar* m_TextBase;
int m_Flags;
};
// Work sheet structure type definitions.
enum TypeKi_WorkSheetData {
WS_OSN,
......
......@@ -72,7 +72,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB files (*.brd)|*.brd" ) );
const wxString PCadPcbFileWildcard( _( "P-Cad 2002/2004 ASCII PCB files (*.pcb)|*.pcb" ) );
const wxString PCadPcbFileWildcard( _( "P-Cad 200x ASCII PCB files (*.pcb)|*.pcb" ) );
const wxString PcbFileWildcard( _( "KiCad s-expr printed circuit board files (*.kicad_pcb)|*.kicad_pcb" ) );
const wxString KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) );
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -45,6 +45,7 @@ class FOOTPRINTS_LISTBOX;
class COMPONENTS_LISTBOX;
class LIBRARY_LISTBOX;
class DISPLAY_FOOTPRINTS_FRAME;
class COMPONENT;
/**
......@@ -52,8 +53,9 @@ class DISPLAY_FOOTPRINTS_FRAME;
*/
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
{
public:
wxArrayString m_footprintListEntries;
public:
bool m_KeepCvpcbOpen;
FOOTPRINTS_LISTBOX* m_FootprintList;
LIBRARY_LISTBOX* m_LibraryList;
......@@ -81,9 +83,6 @@ public:
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~CVPCB_MAINFRAME();
void OnLeftClick( wxListEvent& event );
void OnLeftDClick( wxListEvent& event );
/**
* Function OnSelectComponent
* Called when clicking on a component in component list window
......@@ -96,10 +95,11 @@ public:
void OnQuit( wxCommandEvent& event );
void OnCloseWindow( wxCloseEvent& Event );
void OnSize( wxSizeEvent& SizeEvent );
void OnChar( wxKeyEvent& event );
void ReCreateHToolbar();
virtual void ReCreateMenuBar();
void ChangeFocus( bool aMoveRight );
/**
* Function SetLanguage
* is called on a language menu selection.
......@@ -224,7 +224,15 @@ public:
/**
* Function DisplayStatus
* displays info to the status line at bottom of the main frame.
* updates the information displayed on the status bar at bottom of the main frame.
*
* When the library or component list controls have the focus, the footprint assignment
* status of the components is displayed in the first status bar pane and the list of
* filters for the selected component is displayed in the second status bar pane. When
* the footprint list control has the focus, the description of the selected footprint is
* displayed in the first status bar pane and the key words for the selected footprint are
* displayed in the second status bar pane. The third status bar pane always displays the
* current footprint list filtering.
*/
void DisplayStatus();
......@@ -275,6 +283,8 @@ public:
*/
void SendMessageToEESCHEMA();
COMPONENT* GetSelectedComponent();
DECLARE_EVENT_TABLE()
};
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,6 +3,29 @@
* @brief Component annotation.
*/
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2004-2013 KiCad Developers, see change_log.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 <algorithm> // to use sort vector
#include <vector>
......@@ -13,7 +36,6 @@
#include <netlist.h>
#include <class_library.h>
#include <protos.h>
#include <sch_component.h>
#include <lib_pin.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment