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

Upstream merge.

parents 46eabaa4 28d702f6
include/boost include/boost
downloads-by-cmake .downloads-by-cmake
common/netlist_keywords.* common/netlist_keywords.*
common/netlist_lexer.h common/netlist_lexer.h
common/pcb_plot_params_lexer.h common/pcb_plot_params_lexer.h
common/page_layout_reader_keywords.cpp
common/fp_lib_table_keywords.* common/fp_lib_table_keywords.*
include/fp_lib_table_lexer.h include/fp_lib_table_lexer.h
include/netlist_lexer.h include/netlist_lexer.h
include/page_layout_reader_lexer.h
eeschema/cmp_library_lexer.h eeschema/cmp_library_lexer.h
eeschema/cmp_library_keywords.* eeschema/cmp_library_keywords.*
eeschema/template_fieldnames_keywords.* eeschema/template_fieldnames_keywords.*
......
...@@ -74,6 +74,13 @@ else() ...@@ -74,6 +74,13 @@ else()
message("Build testing (unstable) version of KiCad") message("Build testing (unstable) version of KiCad")
endif() 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. # Set flags for GCC.
...@@ -149,6 +156,11 @@ if(CMAKE_COMPILER_IS_GNUCXX) ...@@ -149,6 +156,11 @@ if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG") set(CMAKE_CXX_FLAGS_DEBUG "${KICAD_GCC_DEBUG_BUILD_FLAGS} -Wall -g3 -ggdb3 -DDEBUG")
endif() 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) endif(CMAKE_COMPILER_IS_GNUCXX)
if(wxUSE_UNICODE) if(wxUSE_UNICODE)
...@@ -239,10 +251,6 @@ include(Functions) ...@@ -239,10 +251,6 @@ include(Functions)
include( ExternalProject ) 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. # Find libraries that are needed to build KiCad.
#================================================ #================================================
......
...@@ -8,5 +8,6 @@ file( STRINGS ${inputFile} lines ) ...@@ -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" ) file( WRITE ${outputFile} "// Do not edit this file, it is autogenerated by CMake from an HTML file\n" )
foreach( line ${lines} ) foreach( line ${lines} )
file( APPEND ${outputFile} "\"" ${line} "\"\n" ) STRING(REGEX REPLACE "\"" "\\\\\"" linem ${line})
file( APPEND ${outputFile} "\"" ${linem} "\\n\"\n" )
endforeach( line ${lines} ) endforeach( line ${lines} )
IF(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\"") message( FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"" )
ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") endif()
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) file( READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files )
STRING(REGEX REPLACE "\n" ";" files "${files}") string( REGEX REPLACE "\n" ";" files "${files}" )
FOREACH(file ${files})
MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") foreach( file ${files} )
IF(EXISTS "$ENV{DESTDIR}${file}") message( STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"" )
if( EXISTS "$ENV{DESTDIR}${file}" )
EXEC_PROGRAM( EXEC_PROGRAM(
"@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\""
OUTPUT_VARIABLE rm_out OUTPUT_VARIABLE rm_out
RETURN_VALUE rm_retval RETURN_VALUE rm_retval
) )
IF(NOT "${rm_retval}" STREQUAL 0) if( NOT "${rm_retval}" STREQUAL 0 )
MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") message( FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"" )
ENDIF(NOT "${rm_retval}" STREQUAL 0) endif()
ELSE(EXISTS "$ENV{DESTDIR}${file}") else()
MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") message( STATUS "File \"$ENV{DESTDIR}${file}\" does not exist." )
ENDIF(EXISTS "$ENV{DESTDIR}${file}") endif()
ENDFOREACH(file) endforeach()
...@@ -28,16 +28,22 @@ development libaries. ...@@ -28,16 +28,22 @@ development libaries.
After a fresh install you need the following packages to compile and run After a fresh install you need the following packages to compile and run
KiCad from source. KiCad from source.
CMake - Cross-platform make * bzr - Bazaar version control system
GLUT - The OpenGL Utility Library * CMake - Cross-platform make
wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings * GLUT - The OpenGL Utility Library
* wxGTK or wxWidgets - The wxWidgets GUI toolkit with GTK+ bindings
Boost - Collection of portable C++ source libraries * Boost - Collection of portable C++ source libraries
Because boost is in the repository of kicad you don't need to install them. boost will be automagically downloaded and copied in kicad sources tree,
the first time you compile kicad.
Useful, but not required: 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 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 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 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 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. ...@@ -26,10 +26,12 @@ languages. Only C is installed by default and C++ is required to build KiCad.
Bazaar 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 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. can be download from http://wiki.bazaar.canonical.com/WindowsDownloads.
Your best bet is to use the stand alone version of Bazaar rather than one of 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. the Python specific versions.
CMake CMake
...@@ -87,7 +89,7 @@ MinGW linker. ...@@ -87,7 +89,7 @@ MinGW linker.
Build and Install the wxWidgets Library Build and Install the wxWidgets Library
--------------------------------------- ---------------------------------------
The wxWidgets library is the base that KiCad is built upon. Version 2.9.4 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 KiCad with older versions of wxWidgets but it is not recommended. wxWidgets
can be downloaded from http://http://www.wxwidgets.org/downloads/ 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: ...@@ -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: If you want to install wxWidgets in MinGW then enter the following commands:
#mkdir Release #mkdir Release
#cd Release #cd Release
#../configure --prefix=/mingw --with-opengl #../configure --prefix=/mingw --enable-monolithic=no --disable-shared --with-opengl
#make && make install #make && make install
#move /mingw/lib/wxmsw*.dll /mingw/bin
The last command is critical so that the libraries are in the MinGW PATH wxWidgets will be statically linked to Kicad, which avoid issus with wxWidgets dlls
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.
Download the KiCad Source Code Download the KiCad Source Code
------------------------------ ------------------------------
...@@ -229,5 +225,5 @@ To build the HTML developer documentation, run the following commands: ...@@ -229,5 +225,5 @@ To build the HTML developer documentation, run the following commands:
#cd <kicadSource>/build/debug #cd <kicadSource>/build/debug
#make doxygen-docs #make doxygen-docs
The documentation will be created in the <kicadSouce>/Documenation/html The documentation will be created in the <kicadSouce>/Documentation/html
directory. directory.
...@@ -9,6 +9,7 @@ Snow Leopard ...@@ -9,6 +9,7 @@ Snow Leopard
Requirements Requirements
* XCode Tools (http://developer.apple.com/tools/xcode) * XCode Tools (http://developer.apple.com/tools/xcode)
* bzr (bazaar)
* CMake (http://www.cmake.org) * CMake (http://www.cmake.org)
* wxWidgets 2.9 (http://www.wxwidgets.org/downloads) * wxWidgets 2.9 (http://www.wxwidgets.org/downloads)
* Doxygen (http://www.doxygen.nl) * Doxygen (http://www.doxygen.nl)
......
<!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.
///////////////////////////////////////
...@@ -6,6 +6,7 @@ Contribute to KiCad (under Linux) ...@@ -6,6 +6,7 @@ Contribute to KiCad (under Linux)
sudo apt-get install libglu1-mesa-dev libgl1-mesa-dev mesa-common-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 libwxbase2.8-dev libwxgtk2.8-dev libboost-dev fakeroot
sudo apt-get install cmake bzr sudo apt-get install cmake bzr
sudo apt-get install cmake bzr bzrtools
2) initialize Bazaar: 2) initialize Bazaar:
bzr whoami "John Doe <john.doe@gmail.com>" bzr whoami "John Doe <john.doe@gmail.com>"
...@@ -14,7 +15,8 @@ Contribute to KiCad (under Linux) ...@@ -14,7 +15,8 @@ Contribute to KiCad (under Linux)
cd ~/ cd ~/
bzr branch lp:kicad kicad_john 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. 5) Modify/add source code.
cd kicad_john cd kicad_john
...@@ -28,7 +30,7 @@ Contribute to KiCad (under Linux) ...@@ -28,7 +30,7 @@ Contribute to KiCad (under Linux)
or or
cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release cmake ../ -DKICAD_TESTING_VERSION=ON -DCMAKE_BUILD_TYPE=Release
to build a release version to build a release version
make -j 4 # this is for a 4 core machine make
7) Repeat step 5 and 6 until satisfied. 7) Repeat step 5 and 6 until satisfied.
......
...@@ -46,6 +46,7 @@ ...@@ -46,6 +46,7 @@
#define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" ) #define KEYWORD_FRAME_SIZEY wxT( "Bmconverter_Size_y" )
#define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" ) #define KEYWORD_LAST_INPUT_FILE wxT( "Last_input" )
#define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" ) #define KEYWORD_LAST_OUTPUT_FILE wxT( "Last_output" )
#define KEYWORD_LAST_FORMAT wxT( "Last_format" )
#define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" ) #define KEYWORD_BINARY_THRESHOLD wxT( "Threshold" )
#define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" ) #define KEYWORD_BW_NEGATIVE wxT( "Negative_choice" )
...@@ -79,8 +80,32 @@ private: ...@@ -79,8 +80,32 @@ private:
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnLoadFile( wxCommandEvent& event ); void OnLoadFile( wxCommandEvent& event );
bool LoadFile( wxString& aFullFileName ); bool LoadFile( wxString& aFullFileName );
void OnExportEeschema( wxCommandEvent& event ); void OnExport( wxCommandEvent& event );
void OnExportPcbnew( 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 Binarize( double aThreshold ); // aThreshold = 0.0 (black level) to 1.0 (white level)
void OnOptionsSelection( wxCommandEvent& event ); void OnOptionsSelection( wxCommandEvent& event );
void OnThresholdChange( wxScrollEvent& event ); void OnThresholdChange( wxScrollEvent& event );
...@@ -104,6 +129,9 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL ) ...@@ -104,6 +129,9 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL )
if( m_Config->Read( KEYWORD_BW_NEGATIVE, &tmp ) ) if( m_Config->Read( KEYWORD_BW_NEGATIVE, &tmp ) )
m_rbOptions->SetSelection( tmp ? 1 : 0 ); m_rbOptions->SetSelection( tmp ? 1 : 0 );
m_Config->Read( KEYWORD_LAST_FORMAT, &tmp );
m_radioBoxFormat->SetSelection( tmp );
// Give an icon // Give an icon
wxIcon icon; wxIcon icon;
...@@ -114,8 +142,7 @@ BM2CMP_FRAME::BM2CMP_FRAME() : BM2CMP_FRAME_BASE( NULL ) ...@@ -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 ); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
m_buttonExportEeschema->Enable( false ); m_buttonExport->Enable( false );
m_buttonExportPcbnew->Enable( false );
if ( m_FramePos == wxDefaultPosition ) if ( m_FramePos == wxDefaultPosition )
Centre(); Centre();
...@@ -138,6 +165,7 @@ BM2CMP_FRAME::~BM2CMP_FRAME() ...@@ -138,6 +165,7 @@ BM2CMP_FRAME::~BM2CMP_FRAME()
m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName ); m_Config->Write( KEYWORD_LAST_OUTPUT_FILE, m_ConvertedFileName );
m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() ); m_Config->Write( KEYWORD_BINARY_THRESHOLD, m_sliderThreshold->GetValue() );
m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() ); m_Config->Write( KEYWORD_BW_NEGATIVE, m_rbOptions->GetSelection() );
m_Config->Write( KEYWORD_LAST_FORMAT, m_radioBoxFormat->GetSelection() );
delete m_Config; delete m_Config;
...@@ -198,8 +226,7 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event ) ...@@ -198,8 +226,7 @@ void BM2CMP_FRAME::OnLoadFile( wxCommandEvent& event )
if( ! LoadFile( fullFilename ) ) if( ! LoadFile( fullFilename ) )
return; return;
m_buttonExportEeschema->Enable( true ); m_buttonExport->Enable( true );
m_buttonExportPcbnew->Enable( true );
SetStatusText( fullFilename ); SetStatusText( fullFilename );
Refresh(); Refresh();
} }
...@@ -300,8 +327,103 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event ) ...@@ -300,8 +327,103 @@ void BM2CMP_FRAME::OnThresholdChange( wxScrollEvent& event )
Refresh(); 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); wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath(); wxString path = fn.GetPath();
...@@ -331,12 +453,12 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event ) ...@@ -331,12 +453,12 @@ void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
return; return;
} }
ExportFile( outfile, 1 ); ExportFile( outfile, 2 );
fclose( outfile ); fclose( outfile );
} }
void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event ) void BM2CMP_FRAME::OnExportPcbnew( bool aLegacyFormat )
{ {
wxFileName fn(m_ConvertedFileName); wxFileName fn(m_ConvertedFileName);
wxString path = fn.GetPath(); wxString path = fn.GetPath();
...@@ -344,7 +466,9 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event ) ...@@ -344,7 +466,9 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
if( path.IsEmpty() || !wxDirExists(path) ) if( path.IsEmpty() || !wxDirExists(path) )
path = ::wxGetCwd(); 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" ), wxFileDialog FileDlg( this, _( "Create a footprint file for PcbNew" ),
path, wxEmptyString, path, wxEmptyString,
msg, msg,
...@@ -368,7 +492,7 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event ) ...@@ -368,7 +492,7 @@ void BM2CMP_FRAME::OnExportPcbnew( wxCommandEvent& event )
return; return;
} }
ExportFile( outfile, 0 ); ExportFile( outfile, aLegacyFormat ? 0 : 1 );
fclose( outfile ); fclose( outfile );
} }
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Sep 8 2010) // C++ code generated with wxFormBuilder (version Oct 8 2012)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -47,77 +47,82 @@ BM2CMP_FRAME_BASE::BM2CMP_FRAME_BASE( wxWindow* parent, wxWindowID id, const wxS ...@@ -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 = new wxStaticText( m_panelRight, wxID_ANY, _("Size X:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeX->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXValue->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeXunits->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("Size Y:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextSizeY->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYValue->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("pixels"), wxDefaultPosition, wxDefaultSize, 0 );
m_SizeYunits->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("BPP:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextBPP->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("0000"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPValue->Wrap( -1 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("bits"), wxDefaultPosition, wxDefaultSize, 0 );
m_BPPunits->Wrap( -1 ); 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 ); 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( sbSizerInfo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
brightSizer->Add( m_buttonLoad, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
m_buttonExportEeschema = new wxButton( m_panelRight, wxID_ANY, _("Export to Eeschema"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
m_buttonExportEeschema->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") ); 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 ); brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_buttonExportPcbnew->SetToolTip( _("Create a footprint file for PcbNew\nThis footprint contains only one footprint: logo") );
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") }; wxString m_rbOptionsChoices[] = { _("Normal"), _("Negative") };
int m_rbOptionsNChoices = sizeof( m_rbOptionsChoices ) / sizeof( wxString ); 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 = new wxRadioBox( m_panelRight, wxID_ANY, _("Options"), wxDefaultPosition, wxDefaultSize, m_rbOptionsNChoices, m_rbOptionsChoices, 1, wxRA_SPECIFY_COLS );
m_rbOptions->SetSelection( 0 ); 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 = new wxStaticText( m_panelRight, wxID_ANY, _("Threshold Value:"), wxDefaultPosition, wxDefaultSize, 0 );
m_ThresholdText->Wrap( -1 ); 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.") ); 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 ); brightSizer->Add( m_sliderThreshold, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_panelRight->SetSizer( brightSizer ); m_panelRight->SetSizer( brightSizer );
m_panelRight->Layout(); m_panelRight->Layout();
brightSizer->Fit( m_panelRight ); brightSizer->Fit( m_panelRight );
bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 ); bMainSizer->Add( m_panelRight, 0, wxEXPAND, 0 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
m_statusBar = this->CreateStatusBar( 1, wxST_SIZEGRIP, wxID_ANY ); 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 ...@@ -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_GreyscalePicturePanel->Connect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this );
m_BNPicturePanel->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_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_buttonExport->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
m_buttonExportPcbnew->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportPcbnew ), NULL, this );
m_rbOptions->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), 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 ); m_sliderThreshold->Connect( wxEVT_SCROLL_THUMBTRACK, wxScrollEventHandler( BM2CMP_FRAME_BASE::OnThresholdChange ), NULL, this );
} }
...@@ -140,8 +144,7 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE() ...@@ -140,8 +144,7 @@ BM2CMP_FRAME_BASE::~BM2CMP_FRAME_BASE()
m_GreyscalePicturePanel->Disconnect( wxEVT_PAINT, wxPaintEventHandler( BM2CMP_FRAME_BASE::OnPaint ), NULL, this ); 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_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_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_buttonExport->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExport ), NULL, this );
m_buttonExportPcbnew->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnExportPcbnew ), NULL, this );
m_rbOptions->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( BM2CMP_FRAME_BASE::OnOptionsSelection ), 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 ); 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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __bitmap2cmp_gui_base__ #ifndef __BITMAP2CMP_GUI_BASE_H__
#define __bitmap2cmp_gui_base__ #define __BITMAP2CMP_GUI_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
#include <wx/scrolwin.h> #include <wx/scrolwin.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
...@@ -56,8 +57,8 @@ class BM2CMP_FRAME_BASE : public wxFrame ...@@ -56,8 +57,8 @@ class BM2CMP_FRAME_BASE : public wxFrame
wxStaticText* m_BPPValue; wxStaticText* m_BPPValue;
wxStaticText* m_BPPunits; wxStaticText* m_BPPunits;
wxButton* m_buttonLoad; wxButton* m_buttonLoad;
wxButton* m_buttonExportEeschema; wxButton* m_buttonExport;
wxButton* m_buttonExportPcbnew; wxRadioBox* m_radioBoxFormat;
wxRadioBox* m_rbOptions; wxRadioBox* m_rbOptions;
wxStaticText* m_ThresholdText; wxStaticText* m_ThresholdText;
wxSlider* m_sliderThreshold; wxSlider* m_sliderThreshold;
...@@ -66,17 +67,17 @@ class BM2CMP_FRAME_BASE : public wxFrame ...@@ -66,17 +67,17 @@ class BM2CMP_FRAME_BASE : public wxFrame
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); } virtual void OnPaint( wxPaintEvent& event ) { event.Skip(); }
virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); } virtual void OnLoadFile( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportEeschema( wxCommandEvent& event ) { event.Skip(); } virtual void OnExport( wxCommandEvent& event ) { event.Skip(); }
virtual void OnExportPcbnew( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOptionsSelection( wxCommandEvent& event ) { event.Skip(); } virtual void OnOptionsSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); } virtual void OnThresholdChange( wxScrollEvent& event ) { event.Skip(); }
public: 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(); ~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. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 1992-2010 jean-pierre.charras * Copyright (C) 1992-2013 jean-pierre.charras
* Copyright (C) 1992-2010 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2013 Kicad Developers, see change_log.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
...@@ -22,8 +22,9 @@ ...@@ -22,8 +22,9 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <cmath> #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 <boost/polygon/polygon.hpp>
#include <wx/wx.h> #include <wx/wx.h>
...@@ -38,13 +39,6 @@ ...@@ -38,13 +39,6 @@
#include <auxiliary.h> #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 // Define some types used here from boost::polygon
namespace bpl = boost::polygon; // bpl = boost polygon library namespace bpl = boost::polygon; // bpl = boost polygon library
using namespace bpl::operators; // +, -, =, ... using namespace bpl::operators; // +, -, =, ...
...@@ -58,9 +52,12 @@ typedef bpl::point_data<coordinate_type> KPolyPoint; // define a corner o ...@@ -58,9 +52,12 @@ typedef bpl::point_data<coordinate_type> KPolyPoint; // define a corner o
enum output_format { enum output_format {
POSTSCRIPT_FMT = 1, POSTSCRIPT_FMT = 1,
PCBNEW_FMT, PCBNEW_LEGACY_EMP,
EESCHEMA_FMT PCBNEW_KICAD_MOD,
EESCHEMA_FMT,
KICAD_LOGO
}; };
/* free a potrace bitmap */ /* free a potrace bitmap */
static void bm_free( potrace_bitmap_t* bm ) static void bm_free( potrace_bitmap_t* bm )
{ {
...@@ -172,22 +169,37 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo ...@@ -172,22 +169,37 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, int aFo
switch( aFormat ) 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_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) // output vector data, e.g. as a rudimentary EPS file (mainly for tests)
info.CreateOutputFile(); info.CreateOutputFile();
break; break;
case 1: case 2:
info.m_Format = EESCHEMA_FMT; 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.m_ScaleY = -info.m_ScaleX; // Y axis is bottom to Top for components in libs
info.CreateOutputFile(); info.CreateOutputFile();
break; 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: case 0:
info.m_Format = PCBNEW_FMT; info.m_Format = PCBNEW_LEGACY_EMP;
info.m_ScaleX = 10000.0 / 300; // the conversion scale info.m_ScaleX = 10000.0 / 300; // the conversion scale
info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit info.m_ScaleY = info.m_ScaleX; // Y axis is top to bottom in modedit
info.CreateOutputFile(); info.CreateOutputFile();
...@@ -221,7 +233,7 @@ void BITMAPCONV_INFO::OuputFileHeader() ...@@ -221,7 +233,7 @@ void BITMAPCONV_INFO::OuputFileHeader()
fprintf( m_Outfile, "gsave\n" ); fprintf( m_Outfile, "gsave\n" );
break; break;
case PCBNEW_FMT: case PCBNEW_LEGACY_EMP:
#define FIELD_LAYER 21 #define FIELD_LAYER 21
fieldSize = 600; // fields text size = 60 mils fieldSize = 600; // fields text size = 60 mils
Ypos += fieldSize / 2; Ypos += fieldSize / 2;
...@@ -240,6 +252,22 @@ void BITMAPCONV_INFO::OuputFileHeader() ...@@ -240,6 +252,22 @@ void BITMAPCONV_INFO::OuputFileHeader()
-Ypos, fieldSize, fieldSize, fieldSize / 5, FIELD_LAYER, m_CmpName ); -Ypos, fieldSize, fieldSize, fieldSize / 5, FIELD_LAYER, m_CmpName );
break; 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: case EESCHEMA_FMT:
fprintf( m_Outfile, "EESchema-LIBRARY Version 2.3\n" ); fprintf( m_Outfile, "EESchema-LIBRARY Version 2.3\n" );
fprintf( m_Outfile, "#\n# %s\n", m_CmpName ); fprintf( m_Outfile, "#\n# %s\n", m_CmpName );
...@@ -267,11 +295,19 @@ void BITMAPCONV_INFO::OuputFileEnd() ...@@ -267,11 +295,19 @@ void BITMAPCONV_INFO::OuputFileEnd()
fprintf( m_Outfile, "%%EOF\n" ); fprintf( m_Outfile, "%%EOF\n" );
break; break;
case PCBNEW_FMT: case PCBNEW_LEGACY_EMP:
fprintf( m_Outfile, "$EndMODULE %s\n", m_CmpName ); fprintf( m_Outfile, "$EndMODULE %s\n", m_CmpName );
fprintf( m_Outfile, "$EndLIBRARY\n" ); fprintf( m_Outfile, "$EndLIBRARY\n" );
break; break;
case PCBNEW_KICAD_MOD:
fprintf( m_Outfile, ")\n" );
break;
case KICAD_LOGO:
fprintf( m_Outfile, ")\n" );
break;
case EESCHEMA_FMT: case EESCHEMA_FMT:
fprintf( m_Outfile, "ENDDRAW\n" ); fprintf( m_Outfile, "ENDDRAW\n" );
fprintf( m_Outfile, "ENDDEF\n" ); fprintf( m_Outfile, "ENDDEF\n" );
...@@ -282,11 +318,11 @@ void BITMAPCONV_INFO::OuputFileEnd() ...@@ -282,11 +318,11 @@ void BITMAPCONV_INFO::OuputFileEnd()
/** /**
* Function OuputOnePolygon * Function OuputOnePolygon
* write one polygon to output file. * 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 ) void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
{ {
unsigned ii; unsigned ii, jj;
KPolyPoint currpoint; KPolyPoint currpoint;
int offsetX = (int)( m_PixmapWidth / 2 * m_ScaleX ); int offsetX = (int)( m_PixmapWidth / 2 * m_ScaleX );
...@@ -297,19 +333,27 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon ) ...@@ -297,19 +333,27 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
switch( m_Format ) switch( m_Format )
{ {
case POSTSCRIPT_FMT: case POSTSCRIPT_FMT:
fprintf( m_Outfile, "%d %d moveto\n", offsetY = (int)( m_PixmapHeight * m_ScaleY );
startpoint.x(), startpoint.y() ); fprintf( m_Outfile, "newpath\n%d %d moveto\n",
startpoint.x(), offsetY - startpoint.y() );
jj = 0;
for( ii = 1; ii < aPolygon.size(); ii++ ) for( ii = 1; ii < aPolygon.size(); ii++ )
{ {
currpoint = *(aPolygon.begin() + ii); currpoint = *(aPolygon.begin() + ii);
fprintf( m_Outfile, "%d %d lineto\n", fprintf( m_Outfile, " %d %d lineto",
currpoint.x(), currpoint.y() ); 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; break;
case PCBNEW_FMT: case PCBNEW_LEGACY_EMP:
{ {
LAYER_NUM layer = SILKSCREEN_N_FRONT; LAYER_NUM layer = SILKSCREEN_N_FRONT;
int width = 1; int width = 1;
...@@ -330,6 +374,54 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon ) ...@@ -330,6 +374,54 @@ void BITMAPCONV_INFO::OuputOnePolygon( KPolygon & aPolygon )
} }
break; 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: case EESCHEMA_FMT:
fprintf( m_Outfile, "P %d 0 0 1", (int) aPolygon.size() + 1 ); fprintf( m_Outfile, "P %d 0 0 1", (int) aPolygon.size() + 1 );
for( ii = 0; ii < aPolygon.size(); ii++ ) for( ii = 0; ii < aPolygon.size(); ii++ )
...@@ -363,6 +455,9 @@ void BITMAPCONV_INFO::CreateOutputFile() ...@@ -363,6 +455,9 @@ void BITMAPCONV_INFO::CreateOutputFile()
KPolygonSet polyset_holes; KPolygonSet polyset_holes;
potrace_dpoint_t( *c )[3]; potrace_dpoint_t( *c )[3];
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C
OuputFileHeader(); OuputFileHeader();
bool main_outline = true; bool main_outline = true;
...@@ -451,6 +546,8 @@ void BITMAPCONV_INFO::CreateOutputFile() ...@@ -451,6 +546,8 @@ void BITMAPCONV_INFO::CreateOutputFile()
} }
OuputFileEnd(); OuputFileEnd();
setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
......
...@@ -112,6 +112,9 @@ set(COMMON_SRCS ...@@ -112,6 +112,9 @@ set(COMMON_SRCS
msgpanel.cpp msgpanel.cpp
netlist_keywords.cpp netlist_keywords.cpp
newstroke_font.cpp newstroke_font.cpp
page_layout_default_description.cpp
page_layout_reader_keywords.cpp
page_layout_reader.cpp
projet_config.cpp projet_config.cpp
ptree.cpp ptree.cpp
reporter.cpp reporter.cpp
...@@ -237,6 +240,15 @@ make_lexer( ...@@ -237,6 +240,15 @@ make_lexer(
FP_LIB_TABLE_T 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. # The dsntest may not build properly using MS Visual Studio.
if(NOT MSVC) if(NOT MSVC)
# This one gets made only when testing. # This one gets made only when testing.
......
...@@ -7,9 +7,9 @@ ...@@ -7,9 +7,9 @@
#ifndef KICAD_BUILD_VERSION #ifndef KICAD_BUILD_VERSION
#if defined KICAD_GOST #if defined KICAD_GOST
# define KICAD_BUILD_VERSION "(2013-mar-13 GOST)" # define KICAD_BUILD_VERSION "(2013-jun-18 GOST)"
#else #else
# define KICAD_BUILD_VERSION "(2013-mar-13)" # define KICAD_BUILD_VERSION "(2013-jun-18)"
#endif #endif
#endif #endif
......
...@@ -40,6 +40,20 @@ ...@@ -40,6 +40,20 @@
#include <wx/process.h> #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. * Global variables definitions.
* *
......
...@@ -35,6 +35,8 @@ ...@@ -35,6 +35,8 @@
#include <drawtxt.h> #include <drawtxt.h>
#include <class_title_block.h> #include <class_title_block.h>
#include "worksheet_shape_builder.h" #include "worksheet_shape_builder.h"
#include <wx/filename.h>
wxString GetDefaultPlotExtension( PlotFormat aFormat ) wxString GetDefaultPlotExtension( PlotFormat aFormat )
...@@ -98,8 +100,12 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock, ...@@ -98,8 +100,12 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
drawList.SetSheetNumber( aSheetNumber ); drawList.SetSheetNumber( aSheetNumber );
drawList.SetSheetCount( aNumberOfSheets ); drawList.SetSheetCount( aNumberOfSheets );
drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), aSheetDesc, // Print only a short filename, if aFilename is the full filename
aFilename, aTitleBlock, plotColor, plotColor );
wxFileName fn( aFilename );
drawList.BuildWorkSheetGraphicList( aPageInfo.GetType(), fn.GetFullName(),
aSheetDesc, aTitleBlock, plotColor, plotColor );
// Draw item list // Draw item list
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item; 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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -9,7 +9,7 @@ ...@@ -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 ); this->SetSizeHints( wxSize( 400,120 ), wxDefaultSize );
...@@ -23,6 +23,7 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent, ...@@ -23,6 +23,7 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::DIALOG_DISPLAY_HTML_TEXT_BASE( wxWindow* parent,
m_buttonClose->SetDefault(); m_buttonClose->SetDefault();
bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 ); bMainSizer->Add( m_buttonClose, 0, wxALIGN_RIGHT|wxRIGHT|wxLEFT, 5 );
this->SetSizer( bMainSizer ); this->SetSizer( bMainSizer );
this->Layout(); this->Layout();
...@@ -36,4 +37,5 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE() ...@@ -36,4 +37,5 @@ DIALOG_DISPLAY_HTML_TEXT_BASE::~DIALOG_DISPLAY_HTML_TEXT_BASE()
// Disconnect Events // Disconnect Events
m_htmlWindow->Disconnect( wxEVT_COMMAND_HTML_LINK_CLICKED, wxHtmlLinkEventHandler( DIALOG_DISPLAY_HTML_TEXT_BASE::OnHTMLLinkClicked ), NULL, this ); 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 ); 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/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_display_info_HTML_base__ #ifndef __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#define __dialog_display_info_HTML_base__ #define __DIALOG_DISPLAY_INFO_HTML_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h> #include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/html/htmlwin.h> #include <wx/html/htmlwin.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
#include <wx/font.h> #include <wx/font.h>
...@@ -26,7 +30,7 @@ ...@@ -26,7 +30,7 @@
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_DISPLAY_HTML_TEXT_BASE /// Class DIALOG_DISPLAY_HTML_TEXT_BASE
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
class DIALOG_DISPLAY_HTML_TEXT_BASE : public wxDialog class DIALOG_DISPLAY_HTML_TEXT_BASE : public DIALOG_SHIM
{ {
private: private:
...@@ -34,15 +38,16 @@ class DIALOG_DISPLAY_HTML_TEXT_BASE : public wxDialog ...@@ -34,15 +38,16 @@ class DIALOG_DISPLAY_HTML_TEXT_BASE : public wxDialog
wxButton* m_buttonClose; wxButton* m_buttonClose;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ){ event.Skip(); } virtual void OnHTMLLinkClicked( wxHtmlLinkEvent& event ) { event.Skip(); }
virtual void OnCloseButtonClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCloseButtonClick( wxCommandEvent& event ) { event.Skip(); }
public: public:
wxHtmlWindow* m_htmlWindow; 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(); ~DIALOG_DISPLAY_HTML_TEXT_BASE();
}; };
#endif //__dialog_display_info_HTML_base__ #endif //__DIALOG_DISPLAY_INFO_HTML_BASE_H__
...@@ -831,16 +831,26 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event ) ...@@ -831,16 +831,26 @@ void EDA_DRAW_PANEL::OnMouseLeaving( wxMouseEvent& event )
if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents ) if( !m_enableAutoPan || !m_requestAutoPan || m_ignoreMouseEvents )
return; 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(); 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 );
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 );
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 ); wxCommandEvent cmd( wxEVT_COMMAND_MENU_SELECTED, ID_POPUP_ZOOM_CENTER );
cmd.SetEventObject( this ); cmd.SetEventObject( this );
GetEventHandler()->ProcessEvent( cmd ); GetEventHandler()->ProcessEvent( cmd );
}
event.Skip(); event.Skip();
} }
......
...@@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox, ...@@ -242,7 +242,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox,
/** /**
* Function DrawGraphicText * Function DrawGraphicText
* Draw a graphic text (like module texts) * 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 aDC = the current Device Context. NULL if draw within a 3D GL Canvas
* @param aPos = text position (according to h_justify, v_justify) * @param aPos = text position (according to h_justify, v_justify)
* @param aColor (enum EDA_COLOR_T) = text color * @param aColor (enum EDA_COLOR_T) = text color
...@@ -261,7 +261,7 @@ static void DrawGraphicTextPline( EDA_RECT* aClipBox, ...@@ -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 * @param aPlotter = a pointer to a PLOTTER instance, when this function is used to plot
* the text. NULL to draw this text. * the text. NULL to draw this text.
*/ */
void DrawGraphicText( EDA_DRAW_PANEL* aPanel, void DrawGraphicText( EDA_RECT* aClipBox,
wxDC* aDC, wxDC* aDC,
const wxPoint& aPos, const wxPoint& aPos,
EDA_COLOR_T aColor, EDA_COLOR_T aColor,
...@@ -284,9 +284,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -284,9 +284,6 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
wxPoint current_char_pos; // Draw coordinates for the current char wxPoint current_char_pos; // Draw coordinates for the current char
wxPoint overbar_pos; // Start point for the current overbar wxPoint overbar_pos; // Start point for the current overbar
int overbar_italic_comp; // Italic compensation for 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 #define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false; bool sketch_mode = false;
...@@ -322,7 +319,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -322,7 +319,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
dy = size_v; dy = size_v;
/* Do not draw the text if out of draw area! */ /* Do not draw the text if out of draw area! */
if( aPanel ) if( aClipBox )
{ {
int xm, ym, ll, xc, yc; int xm, ym, ll, xc, yc;
ll = std::abs( dx ); ll = std::abs( dx );
...@@ -330,10 +327,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -330,10 +327,10 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
xc = current_char_pos.x; xc = current_char_pos.x;
yc = current_char_pos.y; yc = current_char_pos.y;
x0 = aPanel->GetClipBox()->GetX() - ll; x0 = aClipBox->GetX() - ll;
y0 = aPanel->GetClipBox()->GetY() - ll; y0 = aClipBox->GetY() - ll;
xm = aPanel->GetClipBox()->GetRight() + ll; xm = aClipBox->GetRight() + ll;
ym = aPanel->GetClipBox()->GetBottom() + ll; ym = aClipBox->GetBottom() + ll;
if( xc < x0 ) if( xc < x0 )
return; return;
...@@ -407,7 +404,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -407,7 +404,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
} }
else else
GRLine( clipBox, aDC, GRLine( aClipBox, aDC,
current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor ); current_char_pos.x, current_char_pos.y, end.x, end.y, aWidth, aColor );
return; return;
...@@ -461,7 +458,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -461,7 +458,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos; coord[1] = overbar_pos;
// Plot the overbar segment // Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter ); sketch_mode, 2, coord, aCallback, aPlotter );
} }
...@@ -508,7 +505,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -508,7 +505,7 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
if( aWidth <= 1 ) if( aWidth <= 1 )
aWidth = 0; aWidth = 0;
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, point_count, coord, sketch_mode, point_count, coord,
aCallback, aPlotter ); aCallback, aPlotter );
} }
...@@ -554,13 +551,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel, ...@@ -554,13 +551,12 @@ void DrawGraphicText( EDA_DRAW_PANEL* aPanel,
coord[1] = overbar_pos; coord[1] = overbar_pos;
// Plot the overbar segment // Plot the overbar segment
DrawGraphicTextPline( clipBox, aDC, aColor, aWidth, DrawGraphicTextPline( aClipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, aPlotter ); sketch_mode, 2, coord, aCallback, aPlotter );
} }
} }
void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
wxDC * aDC,
const wxPoint &aPos, const wxPoint &aPos,
enum EDA_COLOR_T aBgColor, enum EDA_COLOR_T aBgColor,
enum EDA_COLOR_T aColor1, enum EDA_COLOR_T aColor1,
...@@ -570,24 +566,23 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel, ...@@ -570,24 +566,23 @@ void DrawGraphicHaloText( EDA_DRAW_PANEL * aPanel,
const wxSize &aSize, const wxSize &aSize,
enum EDA_TEXT_HJUSTIFY_T aH_justify, enum EDA_TEXT_HJUSTIFY_T aH_justify,
enum EDA_TEXT_VJUSTIFY_T aV_justify, enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth, int aWidth, bool aItalic, bool aBold,
bool aItalic,
bool aBold,
void (*aCallback)( int x0, int y0, int xf, int yf ), void (*aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER * aPlotter ) PLOTTER * aPlotter )
{ {
// Swap color if contrast would be better // Swap color if contrast would be better
if( ColorIsLight( aBgColor ) ) { if( ColorIsLight( aBgColor ) )
{
EDA_COLOR_T c = aColor1; EDA_COLOR_T c = aColor1;
aColor1 = aColor2; aColor1 = aColor2;
aColor2 = c; 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, aH_justify, aV_justify, aWidth, aItalic, aBold,
aCallback, aPlotter ); 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, aH_justify, aV_justify, aWidth / 4, aItalic, aBold,
aCallback, aPlotter ); aCallback, aPlotter );
} }
......
This diff is collapsed.
...@@ -35,10 +35,13 @@ ...@@ -35,10 +35,13 @@
// Conversion to application internal units defined at build time. // Conversion to application internal units defined at build time.
#if defined( PCBNEW ) #if defined( PCBNEW )
#include <class_board_item.h> #include <class_board_item.h>
#elif defined( EESCHEMA ) #elif defined( EESCHEMA )
#include <sch_item_struct.h> #include <sch_item_struct.h>
#elif defined( GERBVIEW ) #elif defined( GERBVIEW )
#elif defined( PL_EDITOR )
#include <base_units.h>
#define FMT_IU Double2Str
#else #else
#error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW." #error "Cannot resolve units formatting due to no definition of EESCHEMA or PCBNEW."
#endif #endif
...@@ -212,7 +215,7 @@ bool EDA_TEXT::TextHitTest( const EDA_RECT& aRect, bool aContains, int aAccuracy ...@@ -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_COLOR_T aColor, GR_DRAWMODE aDrawMode,
EDA_DRAW_MODE_T aFillMode, EDA_COLOR_T aAnchor_color ) 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, ...@@ -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++ ) for( unsigned i = 0; i<list->Count(); i++ )
{ {
wxString txt = list->Item( i ); wxString txt = list->Item( i );
DrawOneLineOfText( aPanel, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDC, aDrawMode, aFillMode,
aOffset,
aColor,
aDrawMode,
aFillMode,
i ? UNSPECIFIED_COLOR : aAnchor_color, i ? UNSPECIFIED_COLOR : aAnchor_color,
txt, txt, pos );
pos );
pos += offset; pos += offset;
} }
delete (list); delete (list);
} }
else else
DrawOneLineOfText( aPanel, drawOneLineOfText( aClipBox, aDC, aOffset, aColor,
aDC, aDrawMode, aFillMode,
aOffset, aAnchor_color, m_Text, m_Pos );
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, const wxPoint& aOffset, EDA_COLOR_T aColor,
GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode, GR_DRAWMODE aDrawMode, EDA_DRAW_MODE_T aFillMode,
EDA_COLOR_T aAnchor_color, EDA_COLOR_T aAnchor_color,
...@@ -273,7 +265,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -273,7 +265,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
// Draw text anchor, if requested // Draw text anchor, if requested
if( aAnchor_color != UNSPECIFIED_COLOR ) if( aAnchor_color != UNSPECIFIED_COLOR )
{ {
GRDrawAnchor( aPanel->GetClipBox(), aDC, GRDrawAnchor( aClipBox, aDC,
aPos.x + aOffset.x, aPos.y + aOffset.y, aPos.x + aOffset.x, aPos.y + aOffset.y,
DIM_ANCRE_TEXTE, aAnchor_color ); DIM_ANCRE_TEXTE, aAnchor_color );
} }
...@@ -286,7 +278,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -286,7 +278,7 @@ void EDA_TEXT::DrawOneLineOfText( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
if( m_Mirror ) if( m_Mirror )
size.x = -size.x; 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 ); m_HJustify, m_VJustify, width, m_Italic, m_Bold );
} }
......
...@@ -99,7 +99,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames ) ...@@ -99,7 +99,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( wxArrayString& aFootprintsLibNames )
fpinfo->SetLibraryName( filename.GetName() ); fpinfo->SetLibraryName( filename.GetName() );
fpinfo->SetLibraryPath( filename.GetFullPath() ); fpinfo->SetLibraryPath( filename.GetFullPath() );
fpinfo->m_Module = fpnames[i]; 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_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription(); fpinfo->m_Doc = m->GetDescription();
...@@ -163,7 +163,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable ) ...@@ -163,7 +163,7 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
fpinfo->SetLibraryName( libNickNames[ii] ); fpinfo->SetLibraryName( libNickNames[ii] );
fpinfo->SetLibraryPath( path ); fpinfo->SetLibraryPath( path );
fpinfo->m_Module = fpnames[i]; 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_KeyWord = m->GetKeywords();
fpinfo->m_Doc = m->GetDescription(); fpinfo->m_Doc = m->GetDescription();
...@@ -180,3 +180,26 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable ) ...@@ -180,3 +180,26 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE& aTable )
return true; 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 @@ ...@@ -25,7 +25,7 @@
#include <config.h> #include <config.h>
#include <common.h>
#if defined(_WIN32) #if defined(_WIN32)
......
...@@ -519,6 +519,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList, ...@@ -519,6 +519,7 @@ int EDA_BASE_FRAME::WriteHotkeyConfig( struct EDA_HOTKEY_CONFIG* aDescList,
if( file ) if( file )
{ {
fputs( TO_UTF8( msg ), file ); fputs( TO_UTF8( msg ), file );
fclose( file );
} }
else else
{ {
......
...@@ -6,8 +6,8 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle, ...@@ -6,8 +6,8 @@ HTML_MESSAGE_BOX::HTML_MESSAGE_BOX( wxWindow* parent, const wxString & aTitle,
wxPoint aPos, wxSize aSize) wxPoint aPos, wxSize aSize)
: DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize ) : DIALOG_DISPLAY_HTML_TEXT_BASE( parent, wxID_ANY, aTitle, aPos, aSize )
{ {
SetFocus();
ListClear(); ListClear();
Center();
} }
void HTML_MESSAGE_BOX::OnCloseButtonClick( wxCommandEvent& event ) 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 @@ ...@@ -29,7 +29,7 @@
#include <reporter.h> #include <reporter.h>
REPORTER& REPORTER::Report( const char *aText ) REPORTER& REPORTER::Report( const char* aText )
{ {
Report( FROM_UTF8( aText ) ); Report( FROM_UTF8( aText ) );
return *this; 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 * @brief description of graphic items and texts to build a title block
* using GOST standard * using GOST standard
*/ */
...@@ -43,6 +43,17 @@ ...@@ -43,6 +43,17 @@
#define TEXTSIZE 100 // worksheet text size #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. // Work sheet structure type definitions.
enum TypeKi_WorkSheetData { enum TypeKi_WorkSheetData {
WS_OSN, WS_OSN,
......
...@@ -72,7 +72,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) ); ...@@ -72,7 +72,7 @@ const wxString NetlistFileWildcard( _( "KiCad netlist files (*.net)|*.net" ) );
const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) ); const wxString GerberFileWildcard( _( "Gerber files (*.pho)|*.pho" ) );
const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) ); const wxString LegacyPcbFileWildcard( _( "KiCad printed circuit board files (*.brd)|*.brd" ) );
const wxString EaglePcbFileWildcard( _( "Eagle ver. 6.x XML PCB 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 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 KiCadFootprintLibFileWildcard( _( "KiCad footprint s-expre library file (*.kicad_mod)|*.kicad_mod" ) );
const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) ); const wxString KiCadFootprintLibPathWildcard( _( "KiCad footprint s-expre library path (*.pretty)|*.pretty" ) );
......
This diff is collapsed.
/*************************************************************************/ /*
/* listboxes.cpp: class for displaying footprint list and component list */ * This program source code file is part of KiCad, a free EDA CAD application.
/*************************************************************************/ *
* 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
*/
/**
* @file class_components_listbox.h
*/
#include <fctsys.h> #include <fctsys.h>
#include <wxstruct.h> #include <wxstruct.h>
...@@ -8,15 +31,11 @@ ...@@ -8,15 +31,11 @@
#include <cvpcb.h> #include <cvpcb.h>
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <cvstruct.h> #include <cvstruct.h>
#include <cvpcb_id.h>
/**************************************************/
/* ListBox handling the schematic components list */
/**************************************************/
COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id, COMPONENTS_LISTBOX::COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
const wxPoint& loc, const wxSize& size, const wxPoint& loc, const wxSize& size ) :
int nbitems, wxString choice[] ) :
ITEMS_LISTBOX_BASE( parent, id, loc, size, LISTB_STYLE & ~wxLC_SINGLE_SEL ) ITEMS_LISTBOX_BASE( parent, id, loc, size, LISTB_STYLE & ~wxLC_SINGLE_SEL )
{ {
} }
...@@ -27,12 +46,10 @@ COMPONENTS_LISTBOX::~COMPONENTS_LISTBOX() ...@@ -27,12 +46,10 @@ COMPONENTS_LISTBOX::~COMPONENTS_LISTBOX()
} }
/* Build the events table for the schematic components list box
*/
BEGIN_EVENT_TABLE( COMPONENTS_LISTBOX, ITEMS_LISTBOX_BASE ) BEGIN_EVENT_TABLE( COMPONENTS_LISTBOX, ITEMS_LISTBOX_BASE )
EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize )
EVT_CHAR( COMPONENTS_LISTBOX::OnChar ) EVT_CHAR( COMPONENTS_LISTBOX::OnChar )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, COMPONENTS_LISTBOX::OnSelectComponent )
END_EVENT_TABLE() END_EVENT_TABLE()
...@@ -53,6 +70,7 @@ void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text ) ...@@ -53,6 +70,7 @@ void COMPONENTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
{ {
if( linecount >= m_ComponentList.Count() ) if( linecount >= m_ComponentList.Count() )
linecount = m_ComponentList.Count() - 1; linecount = m_ComponentList.Count() - 1;
if( linecount >= 0 ) if( linecount >= 0 )
m_ComponentList[linecount] = text; m_ComponentList[linecount] = text;
} }
...@@ -65,19 +83,12 @@ void COMPONENTS_LISTBOX::AppendLine( const wxString& text ) ...@@ -65,19 +83,12 @@ void COMPONENTS_LISTBOX::AppendLine( const wxString& text )
} }
/*
* Overlaid function: MUST be provided in wxLC_VIRTUAL mode
* because real data are not handled by ITEMS_LISTBOX_BASE
*/
wxString COMPONENTS_LISTBOX::OnGetItemText( long item, long column ) const wxString COMPONENTS_LISTBOX::OnGetItemText( long item, long column ) const
{ {
return m_ComponentList.Item( item ); return m_ComponentList.Item( item );
} }
/*
* Enable or disable an item
*/
void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State ) void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State )
{ {
if( (int) index >= GetCount() ) if( (int) index >= GetCount() )
...@@ -87,6 +98,7 @@ void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State ) ...@@ -87,6 +98,7 @@ void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State )
{ {
Select( index, State ); Select( index, State );
EnsureVisible( index ); EnsureVisible( index );
#ifdef __WXMAC__ #ifdef __WXMAC__
Update(); Update();
#endif #endif
...@@ -94,23 +106,23 @@ void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State ) ...@@ -94,23 +106,23 @@ void COMPONENTS_LISTBOX::SetSelection( unsigned index, bool State )
} }
/**
* Function OnChar
* called on a key pressed
* Call default handler for some special keys,
* and for "ascii" keys, select the first component
* that the name starts by the letter.
* This is the defaut behaviour of a listbox, but because we use
* virtual lists, the listbox does not know anything to what is displayed,
* we must handle this behaviour here.
* Furthermore the reference of components is not at the beginning of
* displayed lines (the first word is the line number)
*/
void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event ) void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event )
{ {
int key = event.GetKeyCode(); int key = event.GetKeyCode();
switch( key ) switch( key )
{ {
case WXK_TAB:
case WXK_RIGHT:
case WXK_NUMPAD_RIGHT:
GetParent()->ChangeFocus( true );
return;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
GetParent()->ChangeFocus( false );
return;
case WXK_HOME: case WXK_HOME:
case WXK_END: case WXK_END:
case WXK_UP: case WXK_UP:
...@@ -120,47 +132,47 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event ) ...@@ -120,47 +132,47 @@ void COMPONENTS_LISTBOX::OnChar( wxKeyEvent& event )
event.Skip(); event.Skip();
return; return;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
GetParent()->m_LibraryList->SetFocus();
return;
case WXK_RIGHT:
case WXK_NUMPAD_RIGHT:
GetParent()->m_FootprintList->SetFocus();
return;
default: default:
break; break;
} }
// Search for an item name starting by the key code: // Search for an item name starting by the key code:
key = toupper(key); key = toupper( key );
for( unsigned ii = 0; ii < m_ComponentList.GetCount(); ii++ ) for( unsigned ii = 0; ii < m_ComponentList.GetCount(); ii++ )
{ {
wxString text = m_ComponentList.Item(ii); wxString text = m_ComponentList.Item( ii );
/* search for the start char of the footprint name.
* we must skip the line number // Search for the start char of the footprint name. Skip the line number.
*/ text.Trim( false ); // Remove leading spaces in line
text.Trim(false); // Remove leading spaces in line
unsigned jj = 0; unsigned jj = 0;
for( ; jj < text.Len(); jj++ ) for( ; jj < text.Len(); jj++ )
{ // skip line number { // skip line number
if( text[jj] == ' ' ) if( text[jj] == ' ' )
break; break;
} }
for( ; jj < text.Len(); jj++ ) for( ; jj < text.Len(); jj++ )
{ // skip blanks { // skip blanks
if( text[jj] != ' ' ) if( text[jj] != ' ' )
break; break;
} }
int start_char = toupper(text[jj]);
if ( key == start_char ) int start_char = toupper( text[jj] );
if( key == start_char )
{ {
Focus( ii );
SetSelection( ii, true ); // Ensure visible SetSelection( ii, true ); // Ensure visible
break; break;
} }
} }
}
void COMPONENTS_LISTBOX::OnSelectComponent( wxListEvent& event )
{
SetFocus();
GetParent()->OnSelectComponent( event );
} }
This diff is collapsed.
...@@ -33,19 +33,17 @@ ...@@ -33,19 +33,17 @@
#include <cvpcb.h> #include <cvpcb.h>
#include <cvpcb_mainframe.h> #include <cvpcb_mainframe.h>
#include <cvstruct.h> #include <cvstruct.h>
#include <cvpcb_id.h>
/***************************************/ /***************************************/
/* ListBox handling the library list */ /* ListBox handling the library list */
/***************************************/ /***************************************/
LIBRARY_LISTBOX::LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, LIBRARY_LISTBOX::LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
wxWindowID id, const wxPoint& loc, const wxPoint& loc, const wxSize& size ) :
const wxSize& size,
int nbitems, wxString choice[] ) :
ITEMS_LISTBOX_BASE( parent, id, loc, size ) ITEMS_LISTBOX_BASE( parent, id, loc, size )
{ {
//ListLibraries();
} }
...@@ -54,24 +52,19 @@ LIBRARY_LISTBOX::~LIBRARY_LISTBOX() ...@@ -54,24 +52,19 @@ LIBRARY_LISTBOX::~LIBRARY_LISTBOX()
} }
/*
* Return number of items
*/
int LIBRARY_LISTBOX::GetCount() int LIBRARY_LISTBOX::GetCount()
{ {
return m_LibraryList.Count(); return m_libraryList.Count();
} }
/*
* Change an item text
*/
void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text ) void LIBRARY_LISTBOX::SetString( unsigned linecount, const wxString& text )
{ {
if( linecount >= m_LibraryList.Count() ) if( linecount >= m_libraryList.Count() )
linecount = m_LibraryList.Count() - 1; linecount = m_libraryList.Count() - 1;
if( linecount >= 0 ) if( linecount >= 0 )
m_LibraryList[linecount] = text; m_libraryList[linecount] = text;
} }
...@@ -82,7 +75,7 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary() ...@@ -82,7 +75,7 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary()
if( ii >= 0 ) if( ii >= 0 )
{ {
libraryName = m_LibraryList[ii]; libraryName = m_libraryList[ii];
} }
return libraryName; return libraryName;
...@@ -91,23 +84,17 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary() ...@@ -91,23 +84,17 @@ wxString LIBRARY_LISTBOX::GetSelectedLibrary()
void LIBRARY_LISTBOX::AppendLine( const wxString& text ) void LIBRARY_LISTBOX::AppendLine( const wxString& text )
{ {
m_LibraryList.Add( text ); m_libraryList.Add( text );
SetItemCount( m_LibraryList.Count() ); SetItemCount( m_libraryList.Count() );
} }
/*
* Overlaid function: MUST be provided in wxLC_VIRTUAL mode
* because real data is not handled by ITEMS_LISTBOX_BASE
*/
wxString LIBRARY_LISTBOX::OnGetItemText( long item, long column ) const wxString LIBRARY_LISTBOX::OnGetItemText( long item, long column ) const
{ {
return m_LibraryList.Item( item ); return m_libraryList.Item( item );
} }
/*
* Enable or disable an item
*/
void LIBRARY_LISTBOX::SetSelection( unsigned index, bool State ) void LIBRARY_LISTBOX::SetSelection( unsigned index, bool State )
{ {
if( (int) index >= GetCount() ) if( (int) index >= GetCount() )
...@@ -126,57 +113,43 @@ void LIBRARY_LISTBOX::SetSelection( unsigned index, bool State ) ...@@ -126,57 +113,43 @@ void LIBRARY_LISTBOX::SetSelection( unsigned index, bool State )
} }
void LIBRARY_LISTBOX::SetLibraryList( wxArrayString list ) void LIBRARY_LISTBOX::SetLibraryList( const wxArrayString& aList )
{ {
wxString msg;
int oldSelection = GetSelection(); int oldSelection = GetSelection();
m_LibraryList.Clear(); m_libraryList = aList;
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
{
msg = list.Item(ii);
m_LibraryList.Add( msg );
}
SetItemCount(list.GetCount()); SetItemCount( m_libraryList.GetCount() );
if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() ) if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() )
SetSelection( 0, true ); SetSelection( 0, true );
Refresh(); Refresh();
} }
/**************************************/
/* Event table for the library list */
/**************************************/
BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE ) BEGIN_EVENT_TABLE( LIBRARY_LISTBOX, ITEMS_LISTBOX_BASE )
EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize ) EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize )
EVT_CHAR( LIBRARY_LISTBOX::OnChar ) EVT_CHAR( LIBRARY_LISTBOX::OnChar )
EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, LIBRARY_LISTBOX::OnSelectLibrary )
END_EVENT_TABLE() END_EVENT_TABLE()
/**
* Function OnChar
* called on a key pressed
* Call default handler for some special keys,
* and for "ascii" keys, select the first footprint
* that the name starts by the letter.
* This is the defaut behaviour of a listbox, but because we use
* virtual lists, the listbox does not know anything to what is displayed,
* we must handle this behaviour here.
* Furthermore the footprint name is not at the beginning of
* displayed lines (the first word is the line number)
*/
void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event ) void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event )
{ {
int key = event.GetKeyCode(); int key = event.GetKeyCode();
switch( key ) switch( key )
{ {
case WXK_TAB:
case WXK_RIGHT: case WXK_RIGHT:
case WXK_NUMPAD_RIGHT: case WXK_NUMPAD_RIGHT:
GetParent()->m_ListCmp->SetFocus(); GetParent()->ChangeFocus( true );
return;
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
GetParent()->ChangeFocus( false );
return; return;
case WXK_HOME: case WXK_HOME:
...@@ -185,24 +158,24 @@ void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event ) ...@@ -185,24 +158,24 @@ void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event )
case WXK_DOWN: case WXK_DOWN:
case WXK_PAGEUP: case WXK_PAGEUP:
case WXK_PAGEDOWN: case WXK_PAGEDOWN:
case WXK_LEFT:
case WXK_NUMPAD_LEFT:
event.Skip(); event.Skip();
return; return;
default: default:
break; break;
} }
// Search for an item name starting by the key code: // Search for an item name starting by the key code:
key = toupper(key); key = toupper(key);
for( unsigned ii = 0; ii < m_LibraryList.GetCount(); ii++ )
for( unsigned ii = 0; ii < m_libraryList.GetCount(); ii++ )
{ {
wxString text = m_LibraryList.Item(ii); wxString text = m_libraryList.Item( ii );
/* search for the start char of the footprint name.
* we must skip the line number // Search for the start char of the footprint name. Skip the line number.
*/ text.Trim( false ); // Remove leading spaces in line
text.Trim(false); // Remove leading spaces in line
unsigned jj = 0; unsigned jj = 0;
for( ; jj < text.Len(); jj++ ) for( ; jj < text.Len(); jj++ )
{ {
// skip line number // skip line number
...@@ -217,11 +190,18 @@ void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event ) ...@@ -217,11 +190,18 @@ void LIBRARY_LISTBOX::OnChar( wxKeyEvent& event )
} }
int start_char = toupper( text[jj] ); int start_char = toupper( text[jj] );
if( key == start_char ) if( key == start_char )
{ {
Focus( ii );
SetSelection( ii, true ); // Ensure visible SetSelection( ii, true ); // Ensure visible
break; break;
} }
} }
} }
void LIBRARY_LISTBOX::OnSelectLibrary( wxListEvent& event )
{
SetFocus();
GetParent()->OnSelectComponent( event );
}
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.
...@@ -44,7 +44,7 @@ ...@@ -44,7 +44,7 @@
<property name="pos"></property> <property name="pos"></property>
<property name="size">700,496</property> <property name="size">700,496</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property> <property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxMINIMIZE_BOX|wxRESIZE_BORDER|wxSYSTEM_MENU</property>
<property name="subclass">; </property> <property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title">Component Properties</property> <property name="title">Component Properties</property>
<property name="tooltip"></property> <property name="tooltip"></property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
......
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