Upstream merge.
This commit is contained in:
commit
36f1147da1
|
@ -1,11 +1,13 @@
|
||||||
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()
|
||||||
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)
|
||||||
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)
|
||||||
|
|
||||||
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 )
|
||||||
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} )
|
||||||
|
|
|
@ -1,21 +1,22 @@
|
||||||
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.
|
||||||
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
|
||||||
-------------
|
-------------
|
||||||
|
|
|
@ -1,3 +1,17 @@
|
||||||
|
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.
|
||||||
|
|
||||||
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.
|
||||||
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:
|
||||||
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:
|
||||||
#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
|
||||||
|
|
||||||
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)
|
||||||
|
|
|
@ -1,530 +0,0 @@
|
||||||
<!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>
|
|
|
@ -1,40 +0,0 @@
|
||||||
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)
|
||||||
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)
|
||||||
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)
|
||||||
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 @@
|
||||||
#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:
|
||||||
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 )
|
||||||
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 )
|
||||||
|
|
||||||
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()
|
||||||
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 )
|
||||||
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 )
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void BM2CMP_FRAME::OnExport( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int sel = m_radioBoxFormat->GetSelection();
|
||||||
|
|
||||||
void BM2CMP_FRAME::OnExportEeschema( wxCommandEvent& event )
|
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()
|
||||||
{
|
{
|
||||||
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 )
|
||||||
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 )
|
||||||
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 )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ExportFile( outfile, 0 );
|
ExportFile( outfile, aLegacyFormat ? 0 : 1 );
|
||||||
fclose( outfile );
|
fclose( outfile );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 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
|
||||||
|
|
||||||
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 );
|
|
||||||
|
brightSizer->Add( sbSizerInfo, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_buttonLoad = new wxButton( m_panelRight, wxID_ANY, _("Load Bitmap"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
brightSizer->Add( m_buttonLoad, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
|
brightSizer->Add( m_buttonLoad, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_buttonExportEeschema = new wxButton( m_panelRight, wxID_ANY, _("Export to Eeschema"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_buttonExport = new wxButton( m_panelRight, wxID_ANY, _("Export"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_buttonExportEeschema->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
|
m_buttonExport->SetToolTip( _("Create a library file for Eeschema\nThis library contains only one component: logo") );
|
||||||
|
|
||||||
brightSizer->Add( m_buttonExportEeschema, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
|
brightSizer->Add( m_buttonExport, 0, wxEXPAND|wxALIGN_CENTER_HORIZONTAL|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_buttonExportPcbnew = new wxButton( m_panelRight, wxID_ANY, _("Export to Pcbnew"), wxDefaultPosition, wxDefaultSize, 0 );
|
wxString m_radioBoxFormatChoices[] = { _("Eeschema"), _("Pcbnew old fmt (.emp)"), _("Pcbnew kicad_mod"), _("Postscript"), _("Logo for title block") };
|
||||||
m_buttonExportPcbnew->SetToolTip( _("Create a footprint file for PcbNew\nThis footprint contains only one footprint: logo") );
|
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 );
|
||||||
brightSizer->Add( m_buttonExportPcbnew, 0, wxALL|wxEXPAND|wxALIGN_CENTER_HORIZONTAL, 5 );
|
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
|
||||||
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()
|
||||||
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 );
|
||||||
|
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,15 +1,16 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 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
|
||||||
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
|
||||||
// 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__
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* 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 @@
|
||||||
* 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 @@
|
||||||
#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
|
||||||
|
|
||||||
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
|
||||||
|
|
||||||
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()
|
||||||
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()
|
||||||
-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()
|
||||||
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()
|
||||||
/**
|
/**
|
||||||
* 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 )
|
||||||
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 )
|
||||||
}
|
}
|
||||||
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()
|
||||||
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()
|
||||||
}
|
}
|
||||||
|
|
||||||
OuputFileEnd();
|
OuputFileEnd();
|
||||||
|
|
||||||
|
setlocale( LC_NUMERIC, "" ); // revert to the current locale
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -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(
|
||||||
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 @@
|
||||||
|
|
||||||
#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 @@
|
||||||
|
|
||||||
#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 @@
|
||||||
#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,
|
||||||
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;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 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 @@
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
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,
|
||||||
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()
|
||||||
// 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 );
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,9 +2,13 @@
|
||||||
<wxFormBuilder_Project>
|
<wxFormBuilder_Project>
|
||||||
<FileVersion major="1" minor="11" />
|
<FileVersion major="1" minor="11" />
|
||||||
<object class="Project" expanded="1">
|
<object class="Project" expanded="1">
|
||||||
<property name="class_decoration" />
|
<property name="class_decoration"></property>
|
||||||
<property name="code_generation">C++</property>
|
<property name="code_generation">C++</property>
|
||||||
<property name="disconnect_events">1</property>
|
<property name="disconnect_events">1</property>
|
||||||
|
<property name="disconnect_mode">source_name</property>
|
||||||
|
<property name="disconnect_php_events">0</property>
|
||||||
|
<property name="disconnect_python_events">0</property>
|
||||||
|
<property name="embedded_files_path">res</property>
|
||||||
<property name="encoding">UTF-8</property>
|
<property name="encoding">UTF-8</property>
|
||||||
<property name="event_generation">connect</property>
|
<property name="event_generation">connect</property>
|
||||||
<property name="file">dialog_display_info_HTML_base</property>
|
<property name="file">dialog_display_info_HTML_base</property>
|
||||||
|
@ -12,64 +16,76 @@
|
||||||
<property name="help_provider">none</property>
|
<property name="help_provider">none</property>
|
||||||
<property name="internationalize">1</property>
|
<property name="internationalize">1</property>
|
||||||
<property name="name">dialog_display_info_HTML</property>
|
<property name="name">dialog_display_info_HTML</property>
|
||||||
<property name="namespace" />
|
<property name="namespace"></property>
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header" />
|
<property name="precompiled_header"></property>
|
||||||
<property name="relative_path">1</property>
|
<property name="relative_path">1</property>
|
||||||
|
<property name="skip_php_events">1</property>
|
||||||
|
<property name="skip_python_events">1</property>
|
||||||
<property name="use_enum">0</property>
|
<property name="use_enum">0</property>
|
||||||
<property name="use_microsoft_bom">0</property>
|
<property name="use_microsoft_bom">0</property>
|
||||||
<object class="Dialog" expanded="1">
|
<object class="Dialog" expanded="1">
|
||||||
<property name="bg" />
|
<property name="aui_managed">0</property>
|
||||||
<property name="center" />
|
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||||
<property name="context_help" />
|
<property name="bg"></property>
|
||||||
|
<property name="center"></property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
<property name="enabled">1</property>
|
<property name="enabled">1</property>
|
||||||
<property name="extra_style" />
|
<property name="event_handler">impl_virtual</property>
|
||||||
<property name="fg" />
|
<property name="extra_style"></property>
|
||||||
<property name="font" />
|
<property name="fg"></property>
|
||||||
|
<property name="font"></property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size" />
|
<property name="maximum_size"></property>
|
||||||
<property name="minimum_size">400,120</property>
|
<property name="minimum_size">400,120</property>
|
||||||
<property name="name">DIALOG_DISPLAY_HTML_TEXT_BASE</property>
|
<property name="name">DIALOG_DISPLAY_HTML_TEXT_BASE</property>
|
||||||
<property name="pos" />
|
<property name="pos"></property>
|
||||||
<property name="size">431,120</property>
|
<property name="size">431,120</property>
|
||||||
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||||
<property name="subclass" />
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
<property name="title" />
|
<property name="title"></property>
|
||||||
<property name="tooltip" />
|
<property name="tooltip"></property>
|
||||||
<property name="window_extra_style" />
|
<property name="window_extra_style"></property>
|
||||||
<property name="window_name" />
|
<property name="window_name"></property>
|
||||||
<property name="window_style" />
|
<property name="window_style"></property>
|
||||||
<event name="OnActivate" />
|
<event name="OnActivate"></event>
|
||||||
<event name="OnActivateApp" />
|
<event name="OnActivateApp"></event>
|
||||||
<event name="OnChar" />
|
<event name="OnAuiFindManager"></event>
|
||||||
<event name="OnClose" />
|
<event name="OnAuiPaneButton"></event>
|
||||||
<event name="OnEnterWindow" />
|
<event name="OnAuiPaneClose"></event>
|
||||||
<event name="OnEraseBackground" />
|
<event name="OnAuiPaneMaximize"></event>
|
||||||
<event name="OnHibernate" />
|
<event name="OnAuiPaneRestore"></event>
|
||||||
<event name="OnIconize" />
|
<event name="OnAuiRender"></event>
|
||||||
<event name="OnIdle" />
|
<event name="OnChar"></event>
|
||||||
<event name="OnInitDialog" />
|
<event name="OnClose"></event>
|
||||||
<event name="OnKeyDown" />
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnKeyUp" />
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnKillFocus" />
|
<event name="OnHibernate"></event>
|
||||||
<event name="OnLeaveWindow" />
|
<event name="OnIconize"></event>
|
||||||
<event name="OnLeftDClick" />
|
<event name="OnIdle"></event>
|
||||||
<event name="OnLeftDown" />
|
<event name="OnInitDialog"></event>
|
||||||
<event name="OnLeftUp" />
|
<event name="OnKeyDown"></event>
|
||||||
<event name="OnMiddleDClick" />
|
<event name="OnKeyUp"></event>
|
||||||
<event name="OnMiddleDown" />
|
<event name="OnKillFocus"></event>
|
||||||
<event name="OnMiddleUp" />
|
<event name="OnLeaveWindow"></event>
|
||||||
<event name="OnMotion" />
|
<event name="OnLeftDClick"></event>
|
||||||
<event name="OnMouseEvents" />
|
<event name="OnLeftDown"></event>
|
||||||
<event name="OnMouseWheel" />
|
<event name="OnLeftUp"></event>
|
||||||
<event name="OnPaint" />
|
<event name="OnMiddleDClick"></event>
|
||||||
<event name="OnRightDClick" />
|
<event name="OnMiddleDown"></event>
|
||||||
<event name="OnRightDown" />
|
<event name="OnMiddleUp"></event>
|
||||||
<event name="OnRightUp" />
|
<event name="OnMotion"></event>
|
||||||
<event name="OnSetFocus" />
|
<event name="OnMouseEvents"></event>
|
||||||
<event name="OnSize" />
|
<event name="OnMouseWheel"></event>
|
||||||
<event name="OnUpdateUI" />
|
<event name="OnPaint"></event>
|
||||||
|
<event name="OnRightDClick"></event>
|
||||||
|
<event name="OnRightDown"></event>
|
||||||
|
<event name="OnRightUp"></event>
|
||||||
|
<event name="OnSetFocus"></event>
|
||||||
|
<event name="OnSize"></event>
|
||||||
|
<event name="OnUpdateUI"></event>
|
||||||
<object class="wxBoxSizer" expanded="1">
|
<object class="wxBoxSizer" expanded="1">
|
||||||
<property name="minimum_size">-1,-1</property>
|
<property name="minimum_size">-1,-1</property>
|
||||||
<property name="name">bMainSizer</property>
|
<property name="name">bMainSizer</property>
|
||||||
|
@ -80,51 +96,83 @@
|
||||||
<property name="flag">wxEXPAND</property>
|
<property name="flag">wxEXPAND</property>
|
||||||
<property name="proportion">1</property>
|
<property name="proportion">1</property>
|
||||||
<object class="wxHtmlWindow" expanded="1">
|
<object class="wxHtmlWindow" expanded="1">
|
||||||
<property name="bg" />
|
<property name="BottomDockable">1</property>
|
||||||
<property name="context_help" />
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
<property name="enabled">1</property>
|
<property name="enabled">1</property>
|
||||||
<property name="fg" />
|
<property name="fg"></property>
|
||||||
<property name="font" />
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_ANY</property>
|
<property name="id">wxID_ANY</property>
|
||||||
<property name="maximum_size" />
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
<property name="minimum_size">-1,-1</property>
|
<property name="minimum_size">-1,-1</property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_htmlWindow</property>
|
<property name="name">m_htmlWindow</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
<property name="permission">public</property>
|
<property name="permission">public</property>
|
||||||
<property name="pos" />
|
<property name="pin_button">1</property>
|
||||||
<property name="size" />
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
<property name="style">wxHW_SCROLLBAR_AUTO</property>
|
<property name="style">wxHW_SCROLLBAR_AUTO</property>
|
||||||
<property name="subclass" />
|
<property name="subclass"></property>
|
||||||
<property name="tooltip" />
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="window_extra_style" />
|
<property name="tooltip"></property>
|
||||||
<property name="window_name" />
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
<property name="window_style">wxSUNKEN_BORDER</property>
|
<property name="window_style">wxSUNKEN_BORDER</property>
|
||||||
<event name="OnChar" />
|
<event name="OnChar"></event>
|
||||||
<event name="OnEnterWindow" />
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground" />
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnHtmlCellClicked" />
|
<event name="OnHtmlCellClicked"></event>
|
||||||
<event name="OnHtmlCellHover" />
|
<event name="OnHtmlCellHover"></event>
|
||||||
<event name="OnHtmlLinkClicked">OnHTMLLinkClicked</event>
|
<event name="OnHtmlLinkClicked">OnHTMLLinkClicked</event>
|
||||||
<event name="OnKeyDown" />
|
<event name="OnKeyDown"></event>
|
||||||
<event name="OnKeyUp" />
|
<event name="OnKeyUp"></event>
|
||||||
<event name="OnKillFocus" />
|
<event name="OnKillFocus"></event>
|
||||||
<event name="OnLeaveWindow" />
|
<event name="OnLeaveWindow"></event>
|
||||||
<event name="OnLeftDClick" />
|
<event name="OnLeftDClick"></event>
|
||||||
<event name="OnLeftDown" />
|
<event name="OnLeftDown"></event>
|
||||||
<event name="OnLeftUp" />
|
<event name="OnLeftUp"></event>
|
||||||
<event name="OnMiddleDClick" />
|
<event name="OnMiddleDClick"></event>
|
||||||
<event name="OnMiddleDown" />
|
<event name="OnMiddleDown"></event>
|
||||||
<event name="OnMiddleUp" />
|
<event name="OnMiddleUp"></event>
|
||||||
<event name="OnMotion" />
|
<event name="OnMotion"></event>
|
||||||
<event name="OnMouseEvents" />
|
<event name="OnMouseEvents"></event>
|
||||||
<event name="OnMouseWheel" />
|
<event name="OnMouseWheel"></event>
|
||||||
<event name="OnPaint" />
|
<event name="OnPaint"></event>
|
||||||
<event name="OnRightDClick" />
|
<event name="OnRightDClick"></event>
|
||||||
<event name="OnRightDown" />
|
<event name="OnRightDown"></event>
|
||||||
<event name="OnRightUp" />
|
<event name="OnRightUp"></event>
|
||||||
<event name="OnSetFocus" />
|
<event name="OnSetFocus"></event>
|
||||||
<event name="OnSize" />
|
<event name="OnSize"></event>
|
||||||
<event name="OnUpdateUI" />
|
<event name="OnUpdateUI"></event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
<object class="sizeritem" expanded="1">
|
<object class="sizeritem" expanded="1">
|
||||||
|
@ -132,51 +180,87 @@
|
||||||
<property name="flag">wxALIGN_RIGHT|wxRIGHT|wxLEFT</property>
|
<property name="flag">wxALIGN_RIGHT|wxRIGHT|wxLEFT</property>
|
||||||
<property name="proportion">0</property>
|
<property name="proportion">0</property>
|
||||||
<object class="wxButton" expanded="1">
|
<object class="wxButton" expanded="1">
|
||||||
<property name="bg" />
|
<property name="BottomDockable">1</property>
|
||||||
<property name="context_help" />
|
<property name="LeftDockable">1</property>
|
||||||
|
<property name="RightDockable">1</property>
|
||||||
|
<property name="TopDockable">1</property>
|
||||||
|
<property name="aui_layer"></property>
|
||||||
|
<property name="aui_name"></property>
|
||||||
|
<property name="aui_position"></property>
|
||||||
|
<property name="aui_row"></property>
|
||||||
|
<property name="best_size"></property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="caption"></property>
|
||||||
|
<property name="caption_visible">1</property>
|
||||||
|
<property name="center_pane">0</property>
|
||||||
|
<property name="close_button">1</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
<property name="default">1</property>
|
<property name="default">1</property>
|
||||||
|
<property name="default_pane">0</property>
|
||||||
|
<property name="dock">Dock</property>
|
||||||
|
<property name="dock_fixed">0</property>
|
||||||
|
<property name="docking">Left</property>
|
||||||
<property name="enabled">1</property>
|
<property name="enabled">1</property>
|
||||||
<property name="fg" />
|
<property name="fg"></property>
|
||||||
<property name="font" />
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
<property name="hidden">0</property>
|
<property name="hidden">0</property>
|
||||||
<property name="id">wxID_CANCEL</property>
|
<property name="id">wxID_CANCEL</property>
|
||||||
<property name="label">Close</property>
|
<property name="label">Close</property>
|
||||||
<property name="maximum_size" />
|
<property name="max_size"></property>
|
||||||
<property name="minimum_size" />
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
<property name="name">m_buttonClose</property>
|
<property name="name">m_buttonClose</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
<property name="permission">protected</property>
|
<property name="permission">protected</property>
|
||||||
<property name="pos" />
|
<property name="pin_button">1</property>
|
||||||
<property name="size" />
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
<property name="style">wxBU_EXACTFIT</property>
|
<property name="style">wxBU_EXACTFIT</property>
|
||||||
<property name="subclass" />
|
<property name="subclass"></property>
|
||||||
<property name="tooltip" />
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="window_extra_style" />
|
<property name="tooltip"></property>
|
||||||
<property name="window_name" />
|
<property name="validator_data_type"></property>
|
||||||
<property name="window_style" />
|
<property name="validator_style">wxFILTER_NONE</property>
|
||||||
|
<property name="validator_type">wxDefaultValidator</property>
|
||||||
|
<property name="validator_variable"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
<event name="OnButtonClick">OnCloseButtonClick</event>
|
<event name="OnButtonClick">OnCloseButtonClick</event>
|
||||||
<event name="OnChar" />
|
<event name="OnChar"></event>
|
||||||
<event name="OnEnterWindow" />
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground" />
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnKeyDown" />
|
<event name="OnKeyDown"></event>
|
||||||
<event name="OnKeyUp" />
|
<event name="OnKeyUp"></event>
|
||||||
<event name="OnKillFocus" />
|
<event name="OnKillFocus"></event>
|
||||||
<event name="OnLeaveWindow" />
|
<event name="OnLeaveWindow"></event>
|
||||||
<event name="OnLeftDClick" />
|
<event name="OnLeftDClick"></event>
|
||||||
<event name="OnLeftDown" />
|
<event name="OnLeftDown"></event>
|
||||||
<event name="OnLeftUp" />
|
<event name="OnLeftUp"></event>
|
||||||
<event name="OnMiddleDClick" />
|
<event name="OnMiddleDClick"></event>
|
||||||
<event name="OnMiddleDown" />
|
<event name="OnMiddleDown"></event>
|
||||||
<event name="OnMiddleUp" />
|
<event name="OnMiddleUp"></event>
|
||||||
<event name="OnMotion" />
|
<event name="OnMotion"></event>
|
||||||
<event name="OnMouseEvents" />
|
<event name="OnMouseEvents"></event>
|
||||||
<event name="OnMouseWheel" />
|
<event name="OnMouseWheel"></event>
|
||||||
<event name="OnPaint" />
|
<event name="OnPaint"></event>
|
||||||
<event name="OnRightDClick" />
|
<event name="OnRightDClick"></event>
|
||||||
<event name="OnRightDown" />
|
<event name="OnRightDown"></event>
|
||||||
<event name="OnRightUp" />
|
<event name="OnRightUp"></event>
|
||||||
<event name="OnSetFocus" />
|
<event name="OnSetFocus"></event>
|
||||||
<event name="OnSize" />
|
<event name="OnSize"></event>
|
||||||
<event name="OnUpdateUI" />
|
<event name="OnUpdateUI"></event>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
</object>
|
</object>
|
||||||
|
|
|
@ -1,15 +1,19 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// 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 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// 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
|
||||||
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 )
|
||||||
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,
|
||||||
/**
|
/**
|
||||||
* 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,
|
||||||
* @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,
|
||||||
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,
|
||||||
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,
|
||||||
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,
|
||||||
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,
|
||||||
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,
|
||||||
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,
|
||||||
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,
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,20 +33,9 @@
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <dsnlexer.h>
|
#include <dsnlexer.h>
|
||||||
|
|
||||||
//#include "fctsys.h"
|
|
||||||
//#include "pcbnew.h"
|
|
||||||
|
|
||||||
//#define STANDALONE 1 // enable this for stand alone testing.
|
//#define STANDALONE 1 // enable this for stand alone testing.
|
||||||
|
|
||||||
static int compare( const void* a1, const void* a2 )
|
|
||||||
{
|
|
||||||
const KEYWORD* k1 = (const KEYWORD*) a1;
|
|
||||||
const KEYWORD* k2 = (const KEYWORD*) a2;
|
|
||||||
|
|
||||||
int ret = strcmp( k1->name, k2->name );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//-----<DSNLEXER>-------------------------------------------------------------
|
//-----<DSNLEXER>-------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -61,6 +50,23 @@ void DSNLEXER::init()
|
||||||
space_in_quoted_tokens = false;
|
space_in_quoted_tokens = false;
|
||||||
|
|
||||||
commentsAreTokens = false;
|
commentsAreTokens = false;
|
||||||
|
|
||||||
|
#if 1
|
||||||
|
if( keywordCount > 11 )
|
||||||
|
{
|
||||||
|
// resize the hashtable bucket count
|
||||||
|
keyword_hash.reserve( keywordCount );
|
||||||
|
}
|
||||||
|
|
||||||
|
// fill the specialized "C string" hashtable from keywords[]
|
||||||
|
const KEYWORD* it = keywords;
|
||||||
|
const KEYWORD* end = it + keywordCount;
|
||||||
|
|
||||||
|
for( ; it < end; ++it )
|
||||||
|
{
|
||||||
|
keyword_hash[it->name] = it->token;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -168,21 +174,21 @@ LINE_READER* DSNLEXER::PopReader()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
static int compare( const void* a1, const void* a2 )
|
||||||
|
{
|
||||||
|
const KEYWORD* k1 = (const KEYWORD*) a1;
|
||||||
|
const KEYWORD* k2 = (const KEYWORD*) a2;
|
||||||
|
|
||||||
|
int ret = strcmp( k1->name, k2->name );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
int DSNLEXER::findToken( const std::string& tok )
|
int DSNLEXER::findToken( const std::string& tok )
|
||||||
{
|
{
|
||||||
// convert to lower case once, this should be faster than using strcasecmp()
|
|
||||||
// for each test in compare().
|
|
||||||
lowercase.clear();
|
|
||||||
|
|
||||||
for( std::string::const_iterator iter = tok.begin(); iter!=tok.end(); ++iter )
|
|
||||||
lowercase += (char) tolower( *iter );
|
|
||||||
|
|
||||||
KEYWORD search;
|
KEYWORD search;
|
||||||
|
|
||||||
search.name = lowercase.c_str();
|
search.name = tok.c_str();
|
||||||
|
|
||||||
// a boost hashtable might be a few percent faster, depending on
|
|
||||||
// hashtable size and quality of the hash function.
|
|
||||||
|
|
||||||
const KEYWORD* findings = (const KEYWORD*) bsearch( &search,
|
const KEYWORD* findings = (const KEYWORD*) bsearch( &search,
|
||||||
keywords, keywordCount,
|
keywords, keywordCount,
|
||||||
|
@ -190,9 +196,21 @@ int DSNLEXER::findToken( const std::string& tok )
|
||||||
if( findings )
|
if( findings )
|
||||||
return findings->token;
|
return findings->token;
|
||||||
else
|
else
|
||||||
return -1;
|
return DSN_SYMBOL; // not a keyword, some arbitrary symbol.
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
inline int DSNLEXER::findToken( const std::string& tok )
|
||||||
|
{
|
||||||
|
KEYWORD_MAP::const_iterator it = keyword_hash.find( tok.c_str() );
|
||||||
|
if( it != keyword_hash.end() )
|
||||||
|
return it->second;
|
||||||
|
|
||||||
|
return DSN_SYMBOL; // not a keyword, some arbitrary symbol.
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
const char* DSNLEXER::Syntax( int aTok )
|
const char* DSNLEXER::Syntax( int aTok )
|
||||||
{
|
{
|
||||||
|
@ -281,25 +299,24 @@ bool DSNLEXER::IsSymbol( int aTok )
|
||||||
|
|
||||||
void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR )
|
void DSNLEXER::Expecting( int aTok ) throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
wxString errText;
|
wxString errText = wxString::Format(
|
||||||
errText.Printf( _("Expecting '%s'"), GetChars( GetTokenString( aTok ) ) );
|
_("Expecting '%s'"), GetChars( GetTokenString( aTok ) ) );
|
||||||
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR )
|
void DSNLEXER::Expecting( const char* text ) throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
wxString errText;
|
wxString errText = wxString::Format(
|
||||||
errText.Printf( _("Expecting '%s'"),
|
_("Expecting '%s'"), GetChars( wxString::FromUTF8( text ) ) );
|
||||||
GetChars( wxString::FromUTF8( text ) ) );
|
|
||||||
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR )
|
void DSNLEXER::Unexpected( int aTok ) throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
wxString errText;
|
wxString errText = wxString::Format(
|
||||||
errText.Printf( _("Unexpected '%s'"), GetChars( GetTokenString( aTok ) ) );
|
_("Unexpected '%s'"), GetChars( GetTokenString( aTok ) ) );
|
||||||
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -314,9 +331,8 @@ void DSNLEXER::Duplicate( int aTok ) throw( IO_ERROR )
|
||||||
|
|
||||||
void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR )
|
void DSNLEXER::Unexpected( const char* text ) throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
wxString errText;
|
wxString errText = wxString::Format(
|
||||||
errText.Printf( _("Unexpected '%s'"),
|
_("Unexpected '%s'"), GetChars( wxString::FromUTF8( text ) ) );
|
||||||
GetChars( wxString::FromUTF8( text ) ) );
|
|
||||||
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errText, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -414,11 +430,11 @@ inline bool isSep( char cc )
|
||||||
* at the first non-number character, even if it is not whitespace.
|
* at the first non-number character, even if it is not whitespace.
|
||||||
*
|
*
|
||||||
* @param cp is the start of the current token.
|
* @param cp is the start of the current token.
|
||||||
* @param limit is the end of the current line of text.
|
* @param limit is the end of the current token.
|
||||||
* @return const char* - if initial text was a number, then pointer to the text
|
*
|
||||||
* after this number, else NULL if initial text was not a number.
|
* @return bool - true if input token is a number, else false.
|
||||||
*/
|
*/
|
||||||
static const char* isNumber( const char* cp, const char* limit )
|
static bool isNumber( const char* cp, const char* limit )
|
||||||
{
|
{
|
||||||
// regex for a float: "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?" i.e. any number,
|
// regex for a float: "^[-+]?[0-9]*\\.?[0-9]+([eE][-+]?[0-9]+)?" i.e. any number,
|
||||||
// code traversal manually here:
|
// code traversal manually here:
|
||||||
|
@ -464,7 +480,7 @@ static const char* isNumber( const char* cp, const char* limit )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return sawNumber ? cp : NULL;
|
return sawNumber && cp==limit;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -475,8 +491,9 @@ int DSNLEXER::NextTok() throw( IO_ERROR )
|
||||||
|
|
||||||
prevTok = curTok;
|
prevTok = curTok;
|
||||||
|
|
||||||
if( curTok != DSN_EOF )
|
if( curTok == DSN_EOF )
|
||||||
{
|
goto exit;
|
||||||
|
|
||||||
if( cur >= limit )
|
if( cur >= limit )
|
||||||
{
|
{
|
||||||
L_read:
|
L_read:
|
||||||
|
@ -502,9 +519,15 @@ L_read:
|
||||||
{
|
{
|
||||||
if( commentsAreTokens )
|
if( commentsAreTokens )
|
||||||
{
|
{
|
||||||
// save the entire line, including new line as the current token.
|
// Grab the entire current line [excluding end of line char(s)] as the
|
||||||
// the '#' character may not be at offset zero.
|
// current token. The '#' character may not be at offset zero.
|
||||||
curText = start; // entire line is the token
|
|
||||||
|
while( limit[-1] == '\n' || limit[-1] == '\r' )
|
||||||
|
--limit;
|
||||||
|
|
||||||
|
curText.clear();
|
||||||
|
curText.append( start, limit );
|
||||||
|
|
||||||
cur = start; // ensure a good curOffset below
|
cur = start; // ensure a good curOffset below
|
||||||
curTok = DSN_COMMENT;
|
curTok = DSN_COMMENT;
|
||||||
head = limit; // do a readLine() on next call in here.
|
head = limit; // do a readLine() on next call in here.
|
||||||
|
@ -540,63 +563,12 @@ L_read:
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
|
|
||||||
// switching the string_quote character
|
|
||||||
if( prevTok == DSN_STRING_QUOTE )
|
|
||||||
{
|
|
||||||
static const wxString errtxt( _("String delimiter must be a single character of ', \", or $"));
|
|
||||||
|
|
||||||
char cc = *cur;
|
|
||||||
switch( cc )
|
|
||||||
{
|
|
||||||
case '\'':
|
|
||||||
case '$':
|
|
||||||
case '"':
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
|
||||||
}
|
|
||||||
|
|
||||||
curText = cc;
|
|
||||||
|
|
||||||
head = cur+1;
|
|
||||||
|
|
||||||
if( head<limit && !isSep( *head ) )
|
|
||||||
{
|
|
||||||
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
|
||||||
}
|
|
||||||
|
|
||||||
curTok = DSN_QUOTE_DEF;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* get the dash out of a <pin_reference> which is embedded for example
|
|
||||||
like: U2-14 or "U2"-"14"
|
|
||||||
This is detectable by a non-space immediately preceeding the dash.
|
|
||||||
*/
|
|
||||||
if( *cur == '-' && cur>start && !isSpace( cur[-1] ) )
|
|
||||||
{
|
|
||||||
curText = '-';
|
|
||||||
curTok = DSN_DASH;
|
|
||||||
head = cur+1;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( ( head = isNumber( cur, limit ) ) != NULL &&
|
|
||||||
// token can only be a number if trailing text is a separator or line end
|
|
||||||
( head==limit || isSep( *head ) ) )
|
|
||||||
{
|
|
||||||
curText.clear();
|
|
||||||
curText.append( cur, head );
|
|
||||||
curTok = DSN_NUMBER;
|
|
||||||
goto exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
// a quoted string, will return DSN_STRING
|
|
||||||
if( *cur == stringDelimiter )
|
|
||||||
{
|
|
||||||
// Non-specctraMode, understands and deciphers escaped \, \r, \n, and \".
|
// Non-specctraMode, understands and deciphers escaped \, \r, \n, and \".
|
||||||
// Strips off leading and trailing double quotes
|
// Strips off leading and trailing double quotes
|
||||||
if( !specctraMode )
|
if( !specctraMode )
|
||||||
|
{
|
||||||
|
// a quoted string, will return DSN_STRING
|
||||||
|
if( *cur == stringDelimiter )
|
||||||
{
|
{
|
||||||
// copy the token, character by character so we can remove doubled up quotes.
|
// copy the token, character by character so we can remove doubled up quotes.
|
||||||
curText.clear();
|
curText.clear();
|
||||||
|
@ -680,8 +652,53 @@ L_read:
|
||||||
wxString errtxt( _( "Un-terminated delimited string" ) );
|
wxString errtxt( _( "Un-terminated delimited string" ) );
|
||||||
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
else // specctraMode DSN_STRING
|
else // is specctraMode, tests in this block should not occur in KiCad mode.
|
||||||
|
{
|
||||||
|
/* get the dash out of a <pin_reference> which is embedded for example
|
||||||
|
like: U2-14 or "U2"-"14"
|
||||||
|
This is detectable by a non-space immediately preceeding the dash.
|
||||||
|
*/
|
||||||
|
if( *cur == '-' && cur>start && !isSpace( cur[-1] ) )
|
||||||
|
{
|
||||||
|
curText = '-';
|
||||||
|
curTok = DSN_DASH;
|
||||||
|
head = cur+1;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// switching the string_quote character
|
||||||
|
if( prevTok == DSN_STRING_QUOTE )
|
||||||
|
{
|
||||||
|
static const wxString errtxt( _("String delimiter must be a single character of ', \", or $"));
|
||||||
|
|
||||||
|
char cc = *cur;
|
||||||
|
switch( cc )
|
||||||
|
{
|
||||||
|
case '\'':
|
||||||
|
case '$':
|
||||||
|
case '"':
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
curText = cc;
|
||||||
|
|
||||||
|
head = cur+1;
|
||||||
|
|
||||||
|
if( head<limit && !isSep( *head ) )
|
||||||
|
{
|
||||||
|
THROW_PARSE_ERROR( errtxt, CurSource(), CurLine(), CurLineNumber(), CurOffset() );
|
||||||
|
}
|
||||||
|
|
||||||
|
curTok = DSN_QUOTE_DEF;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
|
// specctraMode DSN_STRING
|
||||||
|
if( *cur == stringDelimiter )
|
||||||
{
|
{
|
||||||
++cur; // skip over the leading delimiter: ",', or $
|
++cur; // skip over the leading delimiter: ",', or $
|
||||||
|
|
||||||
|
@ -704,30 +721,28 @@ L_read:
|
||||||
curTok = DSN_STRING;
|
curTok = DSN_STRING;
|
||||||
goto exit;
|
goto exit;
|
||||||
}
|
}
|
||||||
}
|
} // specctraMode
|
||||||
|
|
||||||
// Maybe it is a token we will find in the token table.
|
|
||||||
// If not, then call it a DSN_SYMBOL.
|
|
||||||
{
|
|
||||||
head = cur+1;
|
|
||||||
while( head<limit && !isSep( *head ) )
|
|
||||||
++head;
|
|
||||||
|
|
||||||
|
// non-quoted token, read it into curText.
|
||||||
curText.clear();
|
curText.clear();
|
||||||
curText.append( cur, head );
|
|
||||||
|
|
||||||
int found = findToken( curText );
|
head = cur;
|
||||||
|
while( head<limit && !isSep( *head ) )
|
||||||
|
curText += *head++;
|
||||||
|
|
||||||
if( found != -1 )
|
if( isNumber( curText.c_str(), curText.c_str() + curText.size() ) )
|
||||||
curTok = found;
|
{
|
||||||
|
curTok = DSN_NUMBER;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
else if( 0 == curText.compare( "string_quote" ) )
|
if( specctraMode && curText == "string_quote" )
|
||||||
|
{
|
||||||
curTok = DSN_STRING_QUOTE;
|
curTok = DSN_STRING_QUOTE;
|
||||||
|
goto exit;
|
||||||
|
}
|
||||||
|
|
||||||
else // unrecogized token, call it a symbol
|
curTok = findToken( curText );
|
||||||
curTok = DSN_SYMBOL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
exit: // single point of exit, no returns elsewhere please.
|
exit: // single point of exit, no returns elsewhere please.
|
||||||
|
|
||||||
|
@ -739,3 +754,25 @@ exit: // single point of exit, no returns elsewhere please.
|
||||||
return curTok;
|
return curTok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxArrayString* DSNLEXER::ReadCommentLines() throw( IO_ERROR )
|
||||||
|
{
|
||||||
|
wxArrayString* ret = 0;
|
||||||
|
bool cmt_setting = SetCommentsAreTokens( true );
|
||||||
|
int tok = NextTok();
|
||||||
|
|
||||||
|
if( tok == DSN_COMMENT )
|
||||||
|
{
|
||||||
|
ret = new wxArrayString();
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
ret->Add( FromUTF8() );
|
||||||
|
}
|
||||||
|
while( ( tok = NextTok() ) == DSN_COMMENT );
|
||||||
|
}
|
||||||
|
|
||||||
|
SetCommentsAreTokens( cmt_setting );
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
|
@ -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
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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,
|
||||||
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,
|
||||||
// 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,
|
||||||
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 )
|
||||||
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 )
|
||||||
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 )
|
||||||
|
|
||||||
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 @@
|
||||||
|
|
||||||
|
|
||||||
#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,
|
||||||
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,
|
||||||
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 )
|
||||||
|
|
|
@ -0,0 +1,198 @@
|
||||||
|
/**
|
||||||
|
* @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"
|
||||||
|
;
|
|
@ -0,0 +1,623 @@
|
||||||
|
/**
|
||||||
|
* @file page_layout_reader.cpp
|
||||||
|
* @brief read an S expression of description of graphic items and texts
|
||||||
|
* to build a title block and page layout
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
|
#include <base_struct.h>
|
||||||
|
#include <worksheet.h>
|
||||||
|
#include <worksheet_shape_builder.h>
|
||||||
|
#include <math/vector2d.h>
|
||||||
|
#include <page_layout_reader_lexer.h>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace TB_READER_T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class PAGE_LAYOUT_READER_PARSER
|
||||||
|
* holds data and functions pertinent to parsing a S-expression file
|
||||||
|
* for a WORKSHEET_LAYOUT.
|
||||||
|
*/
|
||||||
|
class PAGE_LAYOUT_READER_PARSER : public PAGE_LAYOUT_READER_LEXER
|
||||||
|
{
|
||||||
|
DSIZE m_defaultTextSize; // Default text size, when not defined inside a tbtext
|
||||||
|
double m_defaultLineWidth;
|
||||||
|
double m_defaulTextLineWidth;
|
||||||
|
|
||||||
|
public:
|
||||||
|
PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource );
|
||||||
|
void Parse( WORKSHEET_LAYOUT* aLayout )
|
||||||
|
throw( PARSE_ERROR, IO_ERROR );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function parseInt
|
||||||
|
* parses an integer and constrains it between two values.
|
||||||
|
* @param aMin is the smallest return value.
|
||||||
|
* @param aMax is the largest return value.
|
||||||
|
* @return int - the parsed integer.
|
||||||
|
*/
|
||||||
|
int parseInt( int aMin, int aMax );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function parseDouble
|
||||||
|
* parses a double
|
||||||
|
* @return double - the parsed double.
|
||||||
|
*/
|
||||||
|
double parseDouble();
|
||||||
|
|
||||||
|
void parseSetup() throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
void parseGraphic( WORKSHEET_DATAITEM * aItem ) throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
void parseText( WORKSHEET_DATAITEM_TEXT * aItem ) throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
void parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
void parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
void parseCoordinate( POINT_COORD& aCoord) throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
};
|
||||||
|
|
||||||
|
// PCB_PLOT_PARAMS_PARSER
|
||||||
|
|
||||||
|
PAGE_LAYOUT_READER_PARSER::PAGE_LAYOUT_READER_PARSER( const char* aLine, const wxString& aSource ) :
|
||||||
|
PAGE_LAYOUT_READER_LEXER( aLine, aSource )
|
||||||
|
{
|
||||||
|
m_defaultTextSize.x = m_defaultTextSize.y = TB_DEFAULT_TEXTSIZE;
|
||||||
|
m_defaultLineWidth = 0.0;
|
||||||
|
m_defaulTextLineWidth = 0.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::Parse( WORKSHEET_LAYOUT* aLayout )
|
||||||
|
throw( PARSE_ERROR, IO_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
WORKSHEET_DATAITEM * item;
|
||||||
|
|
||||||
|
LOCALE_IO toggle;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
if( token == T_page_layout )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_setup: // Defines default values for graphic items
|
||||||
|
parseSetup();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_line:
|
||||||
|
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_SEGMENT );
|
||||||
|
parseGraphic( item );
|
||||||
|
aLayout->Append( item );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_rect:
|
||||||
|
item = new WORKSHEET_DATAITEM( WORKSHEET_DATAITEM::WS_RECT );
|
||||||
|
parseGraphic( item );
|
||||||
|
aLayout->Append( item );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_polygon:
|
||||||
|
item = new WORKSHEET_DATAITEM_POLYPOLYGON();
|
||||||
|
parsePolygon( (WORKSHEET_DATAITEM_POLYPOLYGON*) item );
|
||||||
|
aLayout->Append( item );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_tbtext:
|
||||||
|
NeedSYMBOLorNUMBER();
|
||||||
|
item = new WORKSHEET_DATAITEM_TEXT( FromUTF8() );
|
||||||
|
parseText( (WORKSHEET_DATAITEM_TEXT*) item );
|
||||||
|
aLayout->Append( item );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parseSetup() throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_LEFT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_linewidth:
|
||||||
|
m_defaultLineWidth = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_textsize:
|
||||||
|
m_defaultTextSize.x = parseDouble();
|
||||||
|
m_defaultTextSize.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_textlinewidth:
|
||||||
|
m_defaulTextLineWidth = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parsePolygon( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
aItem->m_LineWidth = 0;
|
||||||
|
|
||||||
|
T token;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_comment: // Comment, search the closing ')'
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT && token != T_EOF );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_pos:
|
||||||
|
parseCoordinate( aItem->m_Pos );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_pts:
|
||||||
|
parsePolyOutline( aItem );
|
||||||
|
aItem->CloseContour();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_rotate:
|
||||||
|
aItem->m_Orient = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_repeat:
|
||||||
|
aItem->m_RepeatCount = parseInt( -1, 100 );
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incrx:
|
||||||
|
aItem->m_IncrementVector.x = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incry:
|
||||||
|
aItem->m_IncrementVector.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_linewidth:
|
||||||
|
aItem->m_LineWidth = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
aItem->SetBoundingBox();
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parsePolyOutline( WORKSHEET_DATAITEM_POLYPOLYGON * aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
DPOINT corner;
|
||||||
|
T token;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_xy:
|
||||||
|
corner.x = parseDouble();
|
||||||
|
corner.y = parseDouble();
|
||||||
|
aItem->AppendCorner( corner );
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parseGraphic( WORKSHEET_DATAITEM * aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
|
||||||
|
aItem->m_LineWidth = m_defaultLineWidth;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_comment: // Comment, search the closing ')'
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT && token != T_EOF );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_start:
|
||||||
|
parseCoordinate( aItem->m_Pos );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_end:
|
||||||
|
parseCoordinate( aItem->m_End );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_repeat:
|
||||||
|
aItem->m_RepeatCount = parseInt( -1, 100 );
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incrx:
|
||||||
|
aItem->m_IncrementVector.x = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incry:
|
||||||
|
aItem->m_IncrementVector.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_linewidth:
|
||||||
|
aItem->m_LineWidth = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parseText( WORKSHEET_DATAITEM_TEXT* aItem )
|
||||||
|
throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
|
||||||
|
aItem->m_TextSize = m_defaultTextSize;
|
||||||
|
aItem->m_LineWidth = m_defaulTextLineWidth;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_comment: // Comment, search the closing ')'
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT && token != T_EOF );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_pos:
|
||||||
|
parseCoordinate( aItem->m_Pos );
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_repeat:
|
||||||
|
aItem->m_RepeatCount = parseInt( -1, 100 );
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incrx:
|
||||||
|
aItem->m_IncrementVector.x = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incry:
|
||||||
|
aItem->m_IncrementVector.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_incrlabel:
|
||||||
|
aItem->m_IncrementLabel = parseInt(INT_MIN, INT_MAX);
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_maxlen:
|
||||||
|
aItem->m_BoundingBoxSize.x = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_maxheight:
|
||||||
|
aItem->m_BoundingBoxSize.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_font:
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_LEFT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_bold:
|
||||||
|
aItem->m_Flags |= USE_BOLD;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_italic:
|
||||||
|
aItem->m_Flags |= USE_ITALIC;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_size:
|
||||||
|
aItem->m_TextSize.x = parseDouble();
|
||||||
|
aItem->m_TextSize.y = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_linewidth:
|
||||||
|
aItem->m_LineWidth = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_justify:
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_center:
|
||||||
|
aItem->m_Hjustify = GR_TEXT_HJUSTIFY_CENTER;
|
||||||
|
aItem->m_Vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_left:
|
||||||
|
aItem->m_Hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_right:
|
||||||
|
aItem->m_Hjustify = GR_TEXT_HJUSTIFY_RIGHT;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_top:
|
||||||
|
aItem->m_Vjustify = GR_TEXT_VJUSTIFY_TOP;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_bottom:
|
||||||
|
aItem->m_Vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_rotate:
|
||||||
|
aItem->m_Orient = parseDouble();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// parse an expression like " 25 1 ltcorner)"
|
||||||
|
void PAGE_LAYOUT_READER_PARSER::parseCoordinate( POINT_COORD& aCoord)
|
||||||
|
throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
|
||||||
|
aCoord.m_Pos.x = parseDouble();
|
||||||
|
aCoord.m_Pos.y = parseDouble();
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_ltcorner:
|
||||||
|
aCoord.m_Anchor = LT_CORNER; // left top corner
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_lbcorner:
|
||||||
|
aCoord.m_Anchor = LB_CORNER; // left bottom corner
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_rbcorner:
|
||||||
|
aCoord.m_Anchor = RB_CORNER; // right bottom corner
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_rtcorner:
|
||||||
|
aCoord.m_Anchor = RT_CORNER; // right top corner
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
int PAGE_LAYOUT_READER_PARSER::parseInt( int aMin, int aMax )
|
||||||
|
{
|
||||||
|
T token = NextTok();
|
||||||
|
|
||||||
|
if( token != T_NUMBER )
|
||||||
|
Expecting( T_NUMBER );
|
||||||
|
|
||||||
|
int val = atoi( CurText() );
|
||||||
|
|
||||||
|
if( val < aMin )
|
||||||
|
val = aMin;
|
||||||
|
else if( val > aMax )
|
||||||
|
val = aMax;
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
double PAGE_LAYOUT_READER_PARSER::parseDouble()
|
||||||
|
{
|
||||||
|
T token = NextTok();
|
||||||
|
|
||||||
|
if( token != T_NUMBER )
|
||||||
|
Expecting( T_NUMBER );
|
||||||
|
|
||||||
|
double val = strtod( CurText(), NULL );
|
||||||
|
|
||||||
|
return val;
|
||||||
|
}
|
||||||
|
|
||||||
|
// defaultPageLayout is the default page layout description
|
||||||
|
// using the S expr.
|
||||||
|
// see page_layout_default_shape.cpp
|
||||||
|
extern const char defaultPageLayout[];
|
||||||
|
|
||||||
|
void WORKSHEET_LAYOUT::SetDefaultLayout()
|
||||||
|
{
|
||||||
|
ClearList();
|
||||||
|
PAGE_LAYOUT_READER_PARSER lp_parser( defaultPageLayout, wxT( "default page" ) );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lp_parser.Parse( this );
|
||||||
|
}
|
||||||
|
catch( IO_ERROR ioe )
|
||||||
|
{
|
||||||
|
wxLogMessage( ioe.errorText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#include <wx/file.h>
|
||||||
|
|
||||||
|
// SetLayout() try to load a custom layout file,
|
||||||
|
// currently defined by the environment variable KICAD_WKSFILE
|
||||||
|
// (a *.kicad_wks file).
|
||||||
|
// if does not exists, loads the default page layout.
|
||||||
|
void WORKSHEET_LAYOUT::SetLayout()
|
||||||
|
{
|
||||||
|
wxString fullFileName;
|
||||||
|
wxGetEnv( wxT( "KICAD_WKSFILE" ), &fullFileName );
|
||||||
|
|
||||||
|
if( fullFileName.IsEmpty() || !wxFileExists( fullFileName ) )
|
||||||
|
{
|
||||||
|
#if 0
|
||||||
|
if( !fullFileName.IsEmpty() )
|
||||||
|
{
|
||||||
|
wxLogMessage( wxT("Page layout file <%s> not found"),
|
||||||
|
fullFileName.GetData() );
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
SetDefaultLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFile wksFile( fullFileName );
|
||||||
|
|
||||||
|
if( ! wksFile.IsOpened() )
|
||||||
|
{
|
||||||
|
SetDefaultLayout();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
int filelen = wksFile.Length();
|
||||||
|
char * buffer = new char[filelen+10];
|
||||||
|
|
||||||
|
if( wksFile.Read( buffer, filelen ) != filelen )
|
||||||
|
wxLogMessage( _("The file <%s> was not fully read"),
|
||||||
|
fullFileName.GetData() );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
buffer[filelen]=0;
|
||||||
|
ClearList();
|
||||||
|
PAGE_LAYOUT_READER_PARSER lp_parser( buffer, fullFileName );
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
lp_parser.Parse( this );
|
||||||
|
}
|
||||||
|
catch( IO_ERROR ioe )
|
||||||
|
{
|
||||||
|
wxLogMessage( ioe.errorText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
delete[] buffer;
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
page_layout
|
||||||
|
setup
|
||||||
|
linewidth
|
||||||
|
textlinewidth
|
||||||
|
textsize
|
||||||
|
comment
|
||||||
|
line
|
||||||
|
rect
|
||||||
|
polygon
|
||||||
|
tbtext
|
||||||
|
ltcorner
|
||||||
|
lbcorner
|
||||||
|
rbcorner
|
||||||
|
rtcorner
|
||||||
|
name
|
||||||
|
pos
|
||||||
|
start
|
||||||
|
end
|
||||||
|
pts
|
||||||
|
xy
|
||||||
|
maxlen
|
||||||
|
maxheight
|
||||||
|
font
|
||||||
|
bold
|
||||||
|
italic
|
||||||
|
size
|
||||||
|
justify
|
||||||
|
left
|
||||||
|
center
|
||||||
|
right
|
||||||
|
top
|
||||||
|
bottom
|
||||||
|
rotate
|
||||||
|
repeat
|
||||||
|
incrx
|
||||||
|
incry
|
||||||
|
incrlabel
|
|
@ -29,7 +29,7 @@
|
||||||
#include <reporter.h>
|
#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;
|
||||||
|
|
|
@ -1,13 +1,8 @@
|
||||||
/**
|
/**
|
||||||
* @file title_block_shapes.cpp
|
* @file title_block_shape.cpp
|
||||||
* @brief description of graphic items and texts to build a title block
|
* @brief description of graphic items and texts to build a title block
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
|
||||||
* This file creates a lot of structures which define the shape of a title block
|
|
||||||
* and frame references
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* 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.
|
||||||
*
|
*
|
||||||
|
@ -33,271 +28,261 @@
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*
|
||||||
|
* the class WORKSHEET_DATAITEM (and WORKSHEET_DATAITEM_TEXT) defines
|
||||||
|
* a basic shape of a page layout ( frame references and title block )
|
||||||
|
* Basic shapes are line, rect and texts
|
||||||
|
* the WORKSHEET_DATAITEM coordinates units is the mm, and are relative to
|
||||||
|
* one of 4 page corners.
|
||||||
|
*
|
||||||
|
* These items cannot be drawn or plot "as this". they should be converted
|
||||||
|
* to a "draw list" (WS_DRAW_ITEM_BASE and derived items)
|
||||||
|
|
||||||
|
* The list of these items is stored in a WORKSHEET_LAYOUT instance.
|
||||||
|
*
|
||||||
|
* When building the draw list:
|
||||||
|
* the WORKSHEET_LAYOUT is used to create a WS_DRAW_ITEM_LIST
|
||||||
|
* coordinates are converted to draw/plot coordinates.
|
||||||
|
* texts are expanded if they contain format symbols.
|
||||||
|
* Items with m_RepeatCount > 1 are created m_RepeatCount times
|
||||||
|
*
|
||||||
|
* the WORKSHEET_LAYOUT is created only once.
|
||||||
|
* the WS_DRAW_ITEM_LIST is created each time the page layout is plot/drawn
|
||||||
|
*
|
||||||
|
* the WORKSHEET_LAYOUT instance is created from a S expression which
|
||||||
|
* describes the page layout (can be the default page layout or a custom file).
|
||||||
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <drawtxt.h>
|
#include <drawtxt.h>
|
||||||
#include <worksheet.h>
|
#include <worksheet.h>
|
||||||
#include <class_title_block.h>
|
#include <class_title_block.h>
|
||||||
#include <worksheet_shape_builder.h>
|
#include <worksheet_shape_builder.h>
|
||||||
|
|
||||||
#define GRID_REF_W Mm2mils( 1.8 ) // height of the band reference grid
|
WORKSHEET_DATAITEM_POLYPOLYGON::WORKSHEET_DATAITEM_POLYPOLYGON() :
|
||||||
#define TEXTSIZE Mm2mils( 1.5 ) // worksheet text size
|
WORKSHEET_DATAITEM( WS_POLYPOLYGON )
|
||||||
#define FRMREF_TXTSIZE Mm2mils( 1.3 ) // worksheet frame reference text size
|
|
||||||
#define VARIABLE_BLOCK_START_POSITION (TEXTSIZE * 10)
|
|
||||||
|
|
||||||
// The coordinates below are relative to the bottom right corner of page and
|
|
||||||
// will be subtracted from this origin.
|
|
||||||
#define BLOCK_OX Mm2mils( 106 )
|
|
||||||
#define BLOCK_KICAD_VERSION_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_KICAD_VERSION_Y TEXTSIZE
|
|
||||||
#define BLOCK_REV_X Mm2mils( 22 )
|
|
||||||
#define BLOCK_REV_Y (TEXTSIZE * 3)
|
|
||||||
#define BLOCK_DATE_X BLOCK_OX - (TEXTSIZE * 15)
|
|
||||||
#define BLOCK_DATE_Y (TEXTSIZE * 3)
|
|
||||||
#define BLOCK_ID_SHEET_X Mm2mils( 22 )
|
|
||||||
#define BLOCK_ID_SHEET_Y TEXTSIZE
|
|
||||||
#define BLOCK_SIZE_SHEET_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_SIZE_SHEET_Y (TEXTSIZE * 3)
|
|
||||||
#define BLOCK_TITLE_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_TITLE_Y (TEXTSIZE * 5)
|
|
||||||
#define BLOCK_FULLSHEETNAME_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_FULLSHEETNAME_Y (TEXTSIZE * 7)
|
|
||||||
#define BLOCK_FILENAME_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_FILENAME_Y (TEXTSIZE * 9)
|
|
||||||
#define BLOCK_COMMENT_X BLOCK_OX - TEXTSIZE
|
|
||||||
#define BLOCK_COMPANY_Y (TEXTSIZE * 11)
|
|
||||||
#define BLOCK_COMMENT1_Y (TEXTSIZE * 13)
|
|
||||||
#define BLOCK_COMMENT2_Y (TEXTSIZE * 15)
|
|
||||||
#define BLOCK_COMMENT3_Y (TEXTSIZE * 17)
|
|
||||||
#define BLOCK_COMMENT4_Y (TEXTSIZE * 19)
|
|
||||||
|
|
||||||
|
|
||||||
// Text attributes set in m_Flags (ORed bits)
|
|
||||||
#define USE_BOLD 1 // has meaning for texts
|
|
||||||
#define USE_THICK_LINE 1 // equivalent to bold for lines
|
|
||||||
#define USE_ITALIC 2 // has meaning for texts
|
|
||||||
#define USE_TEXT_COLOR 4
|
|
||||||
#define SET_UPPER_LIMIT 8 // Flag used to calculate variable position items
|
|
||||||
|
|
||||||
// Work sheet structure type definitions.
|
|
||||||
enum TypeKi_WorkSheetData {
|
|
||||||
WS_TEXT,
|
|
||||||
WS_SEGMENT,
|
|
||||||
WS_UPPER_SEGMENT,
|
|
||||||
WS_LEFT_SEGMENT
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// superior horizontal segment: should be after comments
|
|
||||||
// to know the exact position
|
|
||||||
Ki_WorkSheetData WS_MostUpperLine =
|
|
||||||
{
|
{
|
||||||
WS_UPPER_SEGMENT,
|
m_Orient = 0.0;
|
||||||
NULL,
|
}
|
||||||
BLOCK_OX, TEXTSIZE * 16,
|
|
||||||
0, TEXTSIZE * 16,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// Left vertical segment: should be after comments
|
const DPOINT WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPosition( unsigned aIdx,
|
||||||
// to know the exact position
|
int aRepeat ) const
|
||||||
Ki_WorkSheetData WS_MostLeftLine =
|
|
||||||
{
|
{
|
||||||
WS_LEFT_SEGMENT,
|
DPOINT pos = m_Corners[aIdx];
|
||||||
&WS_MostUpperLine,
|
|
||||||
BLOCK_OX, TEXTSIZE * 16,
|
|
||||||
BLOCK_OX, 0,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
// horizontal segment between filename and comments
|
// Rotation:
|
||||||
Ki_WorkSheetData WS_SeparatorLine =
|
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
||||||
|
pos += GetStartPos( aRepeat );
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
void WORKSHEET_DATAITEM_POLYPOLYGON::SetBoundingBox()
|
||||||
{
|
{
|
||||||
WS_SEGMENT,
|
if( m_Corners.size() == 0 )
|
||||||
&WS_MostLeftLine,
|
{
|
||||||
BLOCK_OX, VARIABLE_BLOCK_START_POSITION,
|
m_minCoord.x = m_maxCoord.x = 0.0;
|
||||||
0, VARIABLE_BLOCK_START_POSITION,
|
m_minCoord.y = m_maxCoord.y = 0.0;
|
||||||
NULL
|
return;
|
||||||
};
|
}
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Date =
|
DPOINT pos;
|
||||||
|
pos = m_Corners[0];
|
||||||
|
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
||||||
|
m_minCoord = m_maxCoord = pos;
|
||||||
|
|
||||||
|
for( unsigned ii = 1; ii < m_Corners.size(); ii++ )
|
||||||
|
{
|
||||||
|
pos = m_Corners[ii];
|
||||||
|
RotatePoint( &pos.x, &pos.y, m_Orient * 10 );
|
||||||
|
|
||||||
|
if( m_minCoord.x > pos.x )
|
||||||
|
m_minCoord.x = pos.x;
|
||||||
|
|
||||||
|
if( m_minCoord.y > pos.y )
|
||||||
|
m_minCoord.y = pos.y;
|
||||||
|
|
||||||
|
if( m_maxCoord.x < pos.x )
|
||||||
|
m_maxCoord.x = pos.x;
|
||||||
|
|
||||||
|
if( m_maxCoord.y < pos.y )
|
||||||
|
m_maxCoord.y = pos.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
bool WORKSHEET_DATAITEM_POLYPOLYGON::IsInsidePage( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos = GetStartPos( ii );
|
||||||
&WS_SeparatorLine,
|
pos += m_minCoord; // left top pos of bounding box
|
||||||
BLOCK_DATE_X, BLOCK_DATE_Y,
|
|
||||||
0, 0,
|
|
||||||
wxT( "Date: %D" )
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Licence =
|
if( m_LT_Corner.x > pos.x || m_LT_Corner.y > pos.y )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
pos = GetStartPos( ii );
|
||||||
|
pos += m_maxCoord; // rignt bottom pos of bounding box
|
||||||
|
|
||||||
|
if( m_RB_Corner.x < pos.x || m_RB_Corner.y < pos.y )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxPoint WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi( unsigned aIdx,
|
||||||
|
int aRepeat ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos = GetCornerPosition( aIdx, aRepeat );
|
||||||
&WS_Date,
|
pos = pos * m_WSunits2Iu;
|
||||||
BLOCK_KICAD_VERSION_X,BLOCK_KICAD_VERSION_Y,
|
return wxPoint( int(pos.x), int(pos.y) );
|
||||||
0,
|
}
|
||||||
0,
|
|
||||||
wxT("%K") // Kicad version
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Revision =
|
WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxChar* aTextBase ) :
|
||||||
|
WORKSHEET_DATAITEM( WS_TEXT )
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
m_TextBase = aTextBase;
|
||||||
&WS_Licence,
|
m_IncrementLabel = 1;
|
||||||
BLOCK_REV_X, BLOCK_REV_Y,
|
m_Hjustify = GR_TEXT_HJUSTIFY_LEFT;
|
||||||
0, 0,
|
m_Vjustify = GR_TEXT_VJUSTIFY_CENTER;
|
||||||
wxT( "Rev: %R" ),
|
m_Orient = 0.0;
|
||||||
USE_BOLD
|
m_TextSize.x = m_TextSize.y = TB_DEFAULT_TEXTSIZE;
|
||||||
};
|
}
|
||||||
|
|
||||||
Ki_WorkSheetData WS_SizeSheet =
|
void WORKSHEET_DATAITEM_TEXT::TransfertSetupToGraphicText( WS_DRAW_ITEM_TEXT* aGText )
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
aGText->SetHorizJustify( m_Hjustify ) ;
|
||||||
&WS_Revision,
|
aGText->SetVertJustify( m_Vjustify );
|
||||||
BLOCK_SIZE_SHEET_X,BLOCK_SIZE_SHEET_Y,
|
aGText->SetOrientation( m_Orient * 10 ); // graphic text orient unit = 0.1 degree
|
||||||
0, 0,
|
}
|
||||||
wxT( "Size: %Z" ) // Paper format name
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_IdentSheet =
|
void WORKSHEET_DATAITEM_TEXT::IncrementLabel( int aIncr )
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
wxChar lbchar = m_TextBase[0];
|
||||||
&WS_SizeSheet,
|
if( lbchar >= '0' && lbchar <= '9' )
|
||||||
BLOCK_ID_SHEET_X,BLOCK_ID_SHEET_Y,
|
// A number is expected:
|
||||||
0, 0,
|
m_FullText.Printf( wxT("%d"), aIncr + lbchar - '0' );
|
||||||
wxT( "Id: %S/%N" )
|
else
|
||||||
};
|
m_FullText.Printf( wxT("%c"), aIncr + lbchar );
|
||||||
|
}
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Title =
|
void WORKSHEET_DATAITEM_TEXT::SetConstrainedTextSize()
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
m_ConstrainedTextSize = m_TextSize;
|
||||||
&WS_IdentSheet,
|
|
||||||
BLOCK_TITLE_X, BLOCK_TITLE_Y,
|
|
||||||
0, 0,
|
|
||||||
wxT( "Title: %T" ),
|
|
||||||
USE_BOLD
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_SheetFilename =
|
if( m_BoundingBoxSize.x )
|
||||||
|
{
|
||||||
|
bool italic = (m_Flags & USE_ITALIC) != 0;
|
||||||
|
int linewidth = 0;
|
||||||
|
int lenMsg = ReturnGraphicTextWidth( m_FullText, m_TextSize.x, italic, linewidth );
|
||||||
|
if( lenMsg > m_BoundingBoxSize.x )
|
||||||
|
m_ConstrainedTextSize.x = m_TextSize.x * m_BoundingBoxSize.x / lenMsg;
|
||||||
|
}
|
||||||
|
|
||||||
|
if( m_BoundingBoxSize.y )
|
||||||
|
{
|
||||||
|
if( m_ConstrainedTextSize.y > m_BoundingBoxSize.y )
|
||||||
|
m_ConstrainedTextSize.y = m_BoundingBoxSize.y;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const DPOINT WORKSHEET_DATAITEM::GetStartPos( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos;
|
||||||
&WS_Title,
|
pos.x = m_Pos.m_Pos.x + ( m_IncrementVector.x * ii );
|
||||||
BLOCK_FILENAME_X, BLOCK_FILENAME_Y,
|
pos.y = m_Pos.m_Pos.y + ( m_IncrementVector.y * ii );
|
||||||
0, 0,
|
|
||||||
wxT( "File: %F" )
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_FullSheetName =
|
switch( m_Pos.m_Anchor )
|
||||||
|
{
|
||||||
|
case RB_CORNER: // right bottom corner
|
||||||
|
pos = m_RB_Corner - pos;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RT_CORNER: // right top corner
|
||||||
|
pos.x = m_RB_Corner.x - pos.x;
|
||||||
|
pos.y = m_LT_Corner.y + pos.y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LB_CORNER: // left bottom corner
|
||||||
|
pos.x = m_LT_Corner.x + pos.x;
|
||||||
|
pos.y = m_RB_Corner.y - pos.y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LT_CORNER: // left top corner
|
||||||
|
pos = m_LT_Corner + pos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxPoint WORKSHEET_DATAITEM::GetStartPosUi( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos = GetStartPos( ii );
|
||||||
&WS_SheetFilename,
|
pos = pos * m_WSunits2Iu;
|
||||||
BLOCK_FULLSHEETNAME_X,BLOCK_FULLSHEETNAME_Y,
|
return wxPoint( int(pos.x), int(pos.y) );
|
||||||
0,
|
}
|
||||||
0,
|
|
||||||
wxT( "Sheet: %P" ) // Full sheet name (sheet path)
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Company =
|
const DPOINT WORKSHEET_DATAITEM::GetEndPos( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos;
|
||||||
&WS_FullSheetName,
|
pos.x = m_End.m_Pos.x + ( m_IncrementVector.x * ii );
|
||||||
BLOCK_COMMENT_X,BLOCK_COMPANY_Y,
|
pos.y = m_End.m_Pos.y + ( m_IncrementVector.y * ii );
|
||||||
0, 0,
|
switch( m_End.m_Anchor )
|
||||||
wxT("%Y"), // Company name
|
{
|
||||||
USE_BOLD | SET_UPPER_LIMIT | USE_TEXT_COLOR
|
case RB_CORNER: // right bottom corner
|
||||||
};
|
pos = m_RB_Corner - pos;
|
||||||
|
break;
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Comment1 =
|
case RT_CORNER: // right top corner
|
||||||
|
pos.x = m_RB_Corner.x - pos.x;
|
||||||
|
pos.y = m_LT_Corner.y + pos.y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LB_CORNER: // left bottom corner
|
||||||
|
pos.x = m_LT_Corner.x + pos.x;
|
||||||
|
pos.y = m_RB_Corner.y - pos.y;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case LT_CORNER: // left top corner
|
||||||
|
pos = m_LT_Corner + pos;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
const wxPoint WORKSHEET_DATAITEM::GetEndPosUi( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos = GetEndPos( ii );
|
||||||
&WS_Company,
|
pos = pos * m_WSunits2Iu;
|
||||||
BLOCK_COMMENT_X,BLOCK_COMMENT1_Y,
|
return wxPoint( int(pos.x), int(pos.y) );
|
||||||
0, 0,
|
}
|
||||||
wxT("%C1"), // Comment 1
|
|
||||||
SET_UPPER_LIMIT | USE_TEXT_COLOR
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Comment2 =
|
|
||||||
|
bool WORKSHEET_DATAITEM::IsInsidePage( int ii ) const
|
||||||
{
|
{
|
||||||
WS_TEXT,
|
DPOINT pos = GetStartPos( ii );
|
||||||
&WS_Comment1,
|
|
||||||
BLOCK_COMMENT_X,BLOCK_COMMENT2_Y,
|
|
||||||
0, 0,
|
|
||||||
wxT("%C2"), // Comment 2
|
|
||||||
SET_UPPER_LIMIT | USE_TEXT_COLOR
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Comment3 =
|
if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x )
|
||||||
{
|
return false;
|
||||||
WS_TEXT,
|
|
||||||
&WS_Comment2,
|
|
||||||
BLOCK_COMMENT_X,BLOCK_COMMENT3_Y,
|
|
||||||
0, 0,
|
|
||||||
wxT("%C3"), // Comment 3
|
|
||||||
SET_UPPER_LIMIT | USE_TEXT_COLOR
|
|
||||||
};
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Comment4 =
|
if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y )
|
||||||
{
|
return false;
|
||||||
WS_TEXT,
|
|
||||||
&WS_Comment3,
|
|
||||||
BLOCK_COMMENT_X, BLOCK_COMMENT4_Y,
|
|
||||||
0, 0,
|
|
||||||
wxT("%C4"), // Comment 4
|
|
||||||
SET_UPPER_LIMIT | USE_TEXT_COLOR
|
|
||||||
};
|
|
||||||
|
|
||||||
|
pos = GetEndPos( ii );
|
||||||
|
|
||||||
// horizontal segment above COMPANY NAME
|
if( m_RB_Corner.x < pos.x || m_LT_Corner.x > pos.x )
|
||||||
Ki_WorkSheetData WS_Segm3 =
|
return false;
|
||||||
{
|
|
||||||
WS_SEGMENT,
|
|
||||||
&WS_Comment4,
|
|
||||||
BLOCK_OX, TEXTSIZE * 6,
|
|
||||||
0, TEXTSIZE * 6,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
if( m_RB_Corner.y < pos.y || m_LT_Corner.y > pos.y )
|
||||||
|
return false;
|
||||||
|
|
||||||
// vertical segment of the left REV and SHEET
|
return true;
|
||||||
Ki_WorkSheetData WS_Segm4 =
|
}
|
||||||
{
|
|
||||||
WS_SEGMENT,
|
|
||||||
&WS_Segm3,
|
|
||||||
BLOCK_REV_X + TEXTSIZE,TEXTSIZE * 4,
|
|
||||||
BLOCK_REV_X + TEXTSIZE, 0,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
double WORKSHEET_DATAITEM::m_WSunits2Iu = 1.0;
|
||||||
|
DPOINT WORKSHEET_DATAITEM::m_RB_Corner;
|
||||||
|
DPOINT WORKSHEET_DATAITEM::m_LT_Corner;
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Segm5 =
|
WORKSHEET_LAYOUT dataList; // The layout shape
|
||||||
{
|
|
||||||
WS_SEGMENT,
|
|
||||||
&WS_Segm4,
|
|
||||||
BLOCK_OX, TEXTSIZE * 2,
|
|
||||||
0, TEXTSIZE * 2,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Segm6 =
|
|
||||||
{
|
|
||||||
WS_SEGMENT,
|
|
||||||
&WS_Segm5,
|
|
||||||
BLOCK_OX, TEXTSIZE * 4,
|
|
||||||
0, TEXTSIZE * 4,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
Ki_WorkSheetData WS_Segm7 =
|
|
||||||
{
|
|
||||||
WS_SEGMENT,
|
|
||||||
&WS_Segm6,
|
|
||||||
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 4,
|
|
||||||
BLOCK_OX - (TEXTSIZE * 11),TEXTSIZE * 2,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
#include <worksheet_shape_builder.h>
|
|
||||||
|
|
||||||
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
||||||
const wxString& aPaperFormat,
|
const wxString& aPaperFormat,
|
||||||
|
@ -306,178 +291,147 @@ void WS_DRAW_ITEM_LIST::BuildWorkSheetGraphicList(
|
||||||
const TITLE_BLOCK& aTitleBlock,
|
const TITLE_BLOCK& aTitleBlock,
|
||||||
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
|
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
|
||||||
{
|
{
|
||||||
wxSize textsize( TEXTSIZE * m_milsToIu, TEXTSIZE * m_milsToIu );
|
#define milsTomm (25.4/1000)
|
||||||
wxSize size_ref( FRMREF_TXTSIZE * m_milsToIu,
|
|
||||||
FRMREF_TXTSIZE * m_milsToIu );
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
m_titleBlock = &aTitleBlock,
|
m_titleBlock = &aTitleBlock,
|
||||||
m_paperFormat = &aPaperFormat,
|
m_paperFormat = &aPaperFormat,
|
||||||
m_fileName = &aFileName,
|
m_fileName = &aFileName,
|
||||||
m_sheetFullName = &aSheetPathHumanReadable;
|
m_sheetFullName = &aSheetPathHumanReadable;
|
||||||
|
|
||||||
|
// Build the basic layout shape, if the layout list is empty
|
||||||
|
if( dataList.GetCount() == 0 )
|
||||||
|
dataList.SetLayout();
|
||||||
|
|
||||||
|
WORKSHEET_DATAITEM::m_WSunits2Iu = m_milsToIu / milsTomm;
|
||||||
|
|
||||||
// Left top corner position
|
// Left top corner position
|
||||||
wxPoint lt_corner;
|
DPOINT lt_corner;
|
||||||
lt_corner.x = m_LTmargin.x;
|
lt_corner.x = m_LTmargin.x;
|
||||||
lt_corner.y = m_LTmargin.y;
|
lt_corner.y = m_LTmargin.y;
|
||||||
|
WORKSHEET_DATAITEM::m_LT_Corner = lt_corner * milsTomm;
|
||||||
|
|
||||||
// Right bottom corner position
|
// Right bottom corner position
|
||||||
wxPoint rb_corner;
|
DPOINT rb_corner;
|
||||||
rb_corner.x = m_pageSize.x - m_RBmargin.x;
|
rb_corner.x = m_pageSize.x - m_RBmargin.x;
|
||||||
rb_corner.y = m_pageSize.y - m_RBmargin.y;
|
rb_corner.y = m_pageSize.y - m_RBmargin.y;
|
||||||
|
WORKSHEET_DATAITEM::m_RB_Corner = rb_corner * milsTomm;
|
||||||
// Draw the border.
|
|
||||||
int ii, jj, ipas, gxpas, gypas;
|
|
||||||
|
|
||||||
wxPoint pos = lt_corner;
|
|
||||||
wxPoint end = rb_corner;
|
|
||||||
for( ii = 0; ii < 2; ii++ )
|
|
||||||
{
|
|
||||||
Append( new WS_DRAW_ITEM_RECT(
|
|
||||||
wxPoint( pos.x * m_milsToIu, pos.y * m_milsToIu ),
|
|
||||||
wxPoint( end.x * m_milsToIu, end.y * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
|
||||||
|
|
||||||
pos.x += GRID_REF_W;
|
|
||||||
pos.y += GRID_REF_W;
|
|
||||||
end.x -= GRID_REF_W;
|
|
||||||
end.y -= GRID_REF_W;
|
|
||||||
}
|
|
||||||
|
|
||||||
ipas = ( rb_corner.x - lt_corner.x ) / PAS_REF;
|
|
||||||
gxpas = ( rb_corner.x - lt_corner.x ) / ipas;
|
|
||||||
|
|
||||||
for( ii = lt_corner.x + gxpas, jj = 1; ipas > 0; ii += gxpas, jj++, ipas-- )
|
|
||||||
{
|
|
||||||
msg.Printf( wxT( "%d" ), jj );
|
|
||||||
|
|
||||||
if( ii < rb_corner.x - PAS_REF / 2 )
|
|
||||||
{
|
|
||||||
Append( new WS_DRAW_ITEM_LINE(
|
|
||||||
wxPoint( ii * m_milsToIu, lt_corner.y * m_milsToIu ),
|
|
||||||
wxPoint( ii * m_milsToIu, ( lt_corner.y + GRID_REF_W ) * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Append( new WS_DRAW_ITEM_TEXT( msg,
|
|
||||||
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu,
|
|
||||||
( lt_corner.y + GRID_REF_W / 2 ) * m_milsToIu ),
|
|
||||||
size_ref, m_penSize, aLineColor ) );
|
|
||||||
|
|
||||||
if( ii < rb_corner.x - PAS_REF / 2 )
|
|
||||||
{
|
|
||||||
Append( new WS_DRAW_ITEM_LINE(
|
|
||||||
wxPoint( ii * m_milsToIu, rb_corner.y * m_milsToIu ),
|
|
||||||
wxPoint( ii * m_milsToIu, (rb_corner.y - GRID_REF_W ) * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Append( new WS_DRAW_ITEM_TEXT( msg,
|
|
||||||
wxPoint( ( ii - gxpas / 2 ) * m_milsToIu,
|
|
||||||
( rb_corner.y - GRID_REF_W / 2) * m_milsToIu ),
|
|
||||||
size_ref, m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
ipas = ( rb_corner.y - lt_corner.y ) / PAS_REF;
|
|
||||||
gypas = ( rb_corner.y - lt_corner.y ) / ipas;
|
|
||||||
|
|
||||||
for( ii = lt_corner.y + gypas, jj = 0; ipas > 0; ii += gypas, jj++, ipas-- )
|
|
||||||
{
|
|
||||||
if( jj < 26 )
|
|
||||||
msg.Printf( wxT( "%c" ), jj + 'A' );
|
|
||||||
else // I hope 52 identifiers are enough...
|
|
||||||
msg.Printf( wxT( "%c" ), 'a' + jj - 26 );
|
|
||||||
|
|
||||||
if( ii < rb_corner.y - PAS_REF / 2 )
|
|
||||||
{
|
|
||||||
Append( new WS_DRAW_ITEM_LINE(
|
|
||||||
wxPoint( lt_corner.x * m_milsToIu, ii * m_milsToIu ),
|
|
||||||
wxPoint( ( lt_corner.x + GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Append( new WS_DRAW_ITEM_TEXT( msg,
|
|
||||||
wxPoint( ( lt_corner.x + GRID_REF_W / 2 ) * m_milsToIu,
|
|
||||||
( ii - gypas / 2 ) * m_milsToIu ),
|
|
||||||
size_ref, m_penSize, aLineColor ) );
|
|
||||||
|
|
||||||
if( ii < rb_corner.y - PAS_REF / 2 )
|
|
||||||
{
|
|
||||||
Append( new WS_DRAW_ITEM_LINE(
|
|
||||||
wxPoint( rb_corner.x * m_milsToIu, ii * m_milsToIu ),
|
|
||||||
wxPoint( ( rb_corner.x - GRID_REF_W ) * m_milsToIu, ii * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
Append( new WS_DRAW_ITEM_TEXT( msg,
|
|
||||||
wxPoint( ( rb_corner.x - GRID_REF_W / 2 ) * m_milsToIu,
|
|
||||||
( ii - gxpas / 2 ) * m_milsToIu ),
|
|
||||||
size_ref, m_penSize, aLineColor ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
int upperLimit = VARIABLE_BLOCK_START_POSITION;
|
|
||||||
rb_corner.x -= GRID_REF_W;
|
|
||||||
rb_corner.y -= GRID_REF_W;
|
|
||||||
|
|
||||||
WS_DRAW_ITEM_TEXT* gtext;
|
WS_DRAW_ITEM_TEXT* gtext;
|
||||||
Ki_WorkSheetData* WsItem;
|
|
||||||
int pensize;
|
int pensize;
|
||||||
bool bold;
|
|
||||||
bool italic = false;
|
|
||||||
EDA_COLOR_T color;
|
EDA_COLOR_T color;
|
||||||
|
|
||||||
for( WsItem = &WS_Segm7; WsItem != NULL; WsItem = WsItem->Pnext )
|
for( unsigned ii = 0; ; ii++ )
|
||||||
{
|
{
|
||||||
pos.x = (rb_corner.x - WsItem->m_Posx) * m_milsToIu;
|
WORKSHEET_DATAITEM* wsItem = dataList.GetItem( ii );
|
||||||
pos.y = (rb_corner.y - WsItem->m_Posy) * m_milsToIu;
|
|
||||||
|
|
||||||
msg.Empty();
|
if( wsItem == NULL )
|
||||||
|
|
||||||
if( WsItem->m_Type == WS_TEXT && WsItem->m_TextBase )
|
|
||||||
msg = BuildFullText( WsItem->m_TextBase );
|
|
||||||
|
|
||||||
switch( WsItem->m_Type )
|
|
||||||
{
|
|
||||||
case WS_TEXT:
|
|
||||||
if( msg.IsEmpty() )
|
|
||||||
break;
|
break;
|
||||||
bold = false;
|
|
||||||
|
pensize = wsItem->GetPenSizeUi();
|
||||||
|
|
||||||
|
switch( wsItem->m_Type )
|
||||||
|
{
|
||||||
|
case WORKSHEET_DATAITEM::WS_TEXT:
|
||||||
|
{
|
||||||
|
WORKSHEET_DATAITEM_TEXT * wsText = (WORKSHEET_DATAITEM_TEXT*)wsItem;
|
||||||
|
wsText->m_FullText = BuildFullText( wsText->m_TextBase );
|
||||||
|
if( wsText->m_FullText.IsEmpty() )
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( pensize == 0 )
|
||||||
pensize = m_penSize;
|
pensize = m_penSize;
|
||||||
|
|
||||||
color = aLineColor;
|
color = aLineColor;
|
||||||
if( WsItem->m_Flags & USE_TEXT_COLOR )
|
|
||||||
|
if( wsText->m_Flags & USE_TEXT_COLOR )
|
||||||
color = aTextColor;
|
color = aTextColor;
|
||||||
|
|
||||||
if( WsItem->m_Flags & USE_BOLD )
|
wsText->SetConstrainedTextSize();
|
||||||
{
|
wxSize textsize;
|
||||||
bold = true;
|
|
||||||
|
textsize.x = KiROUND( wsText->m_ConstrainedTextSize.x
|
||||||
|
* WORKSHEET_DATAITEM::m_WSunits2Iu );
|
||||||
|
textsize.y = KiROUND( wsText->m_ConstrainedTextSize.y
|
||||||
|
* WORKSHEET_DATAITEM::m_WSunits2Iu );
|
||||||
|
|
||||||
|
if( wsText->IsBold())
|
||||||
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
|
pensize = GetPenSizeForBold( std::min( textsize.x, textsize.y ) );
|
||||||
|
|
||||||
|
for( int jj = 0; jj < wsText->m_RepeatCount; jj++)
|
||||||
|
{
|
||||||
|
if( ! wsText->IsInsidePage( jj ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
Append( gtext = new WS_DRAW_ITEM_TEXT( wsText->m_FullText,
|
||||||
|
wsText->GetStartPosUi( jj ),
|
||||||
|
textsize,
|
||||||
|
pensize, color,
|
||||||
|
wsText->IsItalic(),
|
||||||
|
wsText->IsBold() ) );
|
||||||
|
wsText->TransfertSetupToGraphicText( gtext );
|
||||||
|
|
||||||
|
// Increment label for the next text
|
||||||
|
if( wsText->m_RepeatCount > 1 )
|
||||||
|
wsText->IncrementLabel( jj+1 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Append( gtext = new WS_DRAW_ITEM_TEXT( msg, pos, textsize,
|
|
||||||
pensize, color, italic, bold ) );
|
|
||||||
gtext->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
|
||||||
|
|
||||||
if( WsItem->m_Flags & SET_UPPER_LIMIT )
|
|
||||||
upperLimit = std::max( upperLimit, WsItem->m_Posy + TEXTSIZE );
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WS_UPPER_SEGMENT:
|
case WORKSHEET_DATAITEM::WS_SEGMENT:
|
||||||
|
if( pensize == 0 )
|
||||||
|
pensize = m_penSize;
|
||||||
|
|
||||||
if( upperLimit == 0 )
|
for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
|
||||||
|
{
|
||||||
|
if( ! wsItem->IsInsidePage( jj ) )
|
||||||
|
continue;
|
||||||
|
Append( new WS_DRAW_ITEM_LINE( wsItem->GetStartPosUi( jj ),
|
||||||
|
wsItem->GetEndPosUi( jj ),
|
||||||
|
pensize, aLineColor ) );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WS_LEFT_SEGMENT:
|
case WORKSHEET_DATAITEM::WS_RECT:
|
||||||
WS_MostUpperLine.m_Posy = upperLimit;
|
if( pensize == 0 )
|
||||||
WS_MostUpperLine.m_Endy = upperLimit;
|
pensize = m_penSize;
|
||||||
WS_MostLeftLine.m_Posy = upperLimit;
|
|
||||||
pos.y = (rb_corner.y - WsItem->m_Posy) * m_milsToIu;
|
|
||||||
|
|
||||||
case WS_SEGMENT:
|
for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
|
||||||
end.x = rb_corner.x - WsItem->m_Endx;
|
{
|
||||||
end.y = rb_corner.y - WsItem->m_Endy;
|
if( ! wsItem->IsInsidePage( jj ) )
|
||||||
Append( new WS_DRAW_ITEM_LINE( pos,
|
break;
|
||||||
wxPoint( end.x * m_milsToIu, end.y * m_milsToIu ),
|
|
||||||
m_penSize, aLineColor ) );
|
Append( new WS_DRAW_ITEM_RECT( wsItem->GetStartPosUi( jj ),
|
||||||
|
wsItem->GetEndPosUi( jj ),
|
||||||
|
pensize, aLineColor ) );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WORKSHEET_DATAITEM::WS_POLYPOLYGON:
|
||||||
|
{
|
||||||
|
WORKSHEET_DATAITEM_POLYPOLYGON * wspoly =
|
||||||
|
(WORKSHEET_DATAITEM_POLYPOLYGON*) wsItem;
|
||||||
|
for( int jj = 0; jj < wsItem->m_RepeatCount; jj++ )
|
||||||
|
{
|
||||||
|
if( ! wsItem->IsInsidePage( jj ) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
for( int kk = 0; kk < wspoly->GetPolyCount(); kk++ )
|
||||||
|
{
|
||||||
|
const bool fill = true;
|
||||||
|
WS_DRAW_ITEM_POLYGON* poly = new WS_DRAW_ITEM_POLYGON( fill,
|
||||||
|
pensize, aLineColor );
|
||||||
|
Append( poly );
|
||||||
|
|
||||||
|
// Create polygon outline
|
||||||
|
unsigned ist = wspoly->GetPolyIndexStart( kk );
|
||||||
|
unsigned iend = wspoly->GetPolyIndexEnd( kk );
|
||||||
|
while( ist <= iend )
|
||||||
|
poly->m_Corners.push_back(
|
||||||
|
wspoly->GetCornerPositionUi( ist++, jj ) );
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @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 @@
|
||||||
|
|
||||||
#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" ) );
|
||||||
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" ) );
|
||||||
|
|
|
@ -46,15 +46,68 @@
|
||||||
|
|
||||||
static const wxString productName = wxT( "KiCad E.D.A. " );
|
static const wxString productName = wxT( "KiCad E.D.A. " );
|
||||||
|
|
||||||
|
/* Draws the item list crated by BuildWorkSheetGraphicList
|
||||||
|
* aClipBox = the clipping rect, or NULL if no clipping
|
||||||
|
* aDC = the current Device Context
|
||||||
|
*/
|
||||||
|
void WS_DRAW_ITEM_LIST::Draw( EDA_RECT* aClipBox, wxDC* aDC )
|
||||||
|
{
|
||||||
|
for( WS_DRAW_ITEM_BASE* item = GetFirst(); item; item = GetNext() )
|
||||||
|
{
|
||||||
|
switch( item->GetType() )
|
||||||
|
{
|
||||||
|
case WS_DRAW_ITEM_BASE::wsg_line:
|
||||||
|
{
|
||||||
|
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
||||||
|
GRLine( aClipBox, aDC,
|
||||||
|
line->GetStart(), line->GetEnd(),
|
||||||
|
line->GetPenWidth(), line->GetColor() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
|
case WS_DRAW_ITEM_BASE::wsg_rect:
|
||||||
|
{
|
||||||
|
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
||||||
|
GRRect( aClipBox, aDC,
|
||||||
|
rect->GetStart().x, rect->GetStart().y,
|
||||||
|
rect->GetEnd().x, rect->GetEnd().y,
|
||||||
|
rect->GetPenWidth(), rect->GetColor() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WS_DRAW_ITEM_BASE::wsg_text:
|
||||||
|
{
|
||||||
|
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
||||||
|
DrawGraphicText( aClipBox, aDC, text->GetTextPosition(),
|
||||||
|
text->GetColor(), text->GetText(),
|
||||||
|
text->GetOrientation(), text->GetSize(),
|
||||||
|
text->GetHorizJustify(), text->GetVertJustify(),
|
||||||
|
text->GetPenWidth(), text->IsItalic(), text->IsBold() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case WS_DRAW_ITEM_BASE::wsg_poly:
|
||||||
|
{
|
||||||
|
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
|
||||||
|
GRPoly( aClipBox, aDC,
|
||||||
|
poly->m_Corners.size(), &poly->m_Corners[0],
|
||||||
|
poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
|
||||||
|
poly->GetPenWidth(),
|
||||||
|
poly->GetColor(), poly->GetColor() );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void DrawPageLayout( wxDC* aDC, EDA_RECT* aClipBox,
|
||||||
const PAGE_INFO& aPageInfo,
|
const PAGE_INFO& aPageInfo,
|
||||||
const wxString &aFullSheetName,
|
const wxString &aFullSheetName,
|
||||||
const wxString& aFileName,
|
const wxString& aFileName,
|
||||||
TITLE_BLOCK& aTitleBlock,
|
TITLE_BLOCK& aTitleBlock,
|
||||||
int aSheetCount, int aSheetNumber,
|
int aSheetCount, int aSheetNumber,
|
||||||
int aPenWidth, double aScalar,
|
int aPenWidth, double aScalar,
|
||||||
EDA_COLOR_T aLineColor, EDA_COLOR_T aTextColor )
|
EDA_COLOR_T aColor, EDA_COLOR_T aAltColor )
|
||||||
{
|
{
|
||||||
GRSetDrawMode( aDC, GR_COPY );
|
GRSetDrawMode( aDC, GR_COPY );
|
||||||
WS_DRAW_ITEM_LIST drawList;
|
WS_DRAW_ITEM_LIST drawList;
|
||||||
|
@ -72,56 +125,10 @@ void DrawPageLayout( wxDC* aDC, EDA_DRAW_PANEL * aCanvas,
|
||||||
|
|
||||||
drawList.BuildWorkSheetGraphicList(
|
drawList.BuildWorkSheetGraphicList(
|
||||||
aPageInfo.GetType(), aFullSheetName, aFileName,
|
aPageInfo.GetType(), aFullSheetName, aFileName,
|
||||||
aTitleBlock, aLineColor, aTextColor );
|
aTitleBlock, aColor, aAltColor );
|
||||||
|
|
||||||
// Draw item list
|
// Draw item list
|
||||||
for( WS_DRAW_ITEM_BASE* item = drawList.GetFirst(); item;
|
drawList.Draw( aClipBox, aDC );
|
||||||
item = drawList.GetNext() )
|
|
||||||
{
|
|
||||||
switch( item->GetType() )
|
|
||||||
{
|
|
||||||
case WS_DRAW_ITEM_BASE::wsg_line:
|
|
||||||
{
|
|
||||||
WS_DRAW_ITEM_LINE* line = (WS_DRAW_ITEM_LINE*) item;
|
|
||||||
GRLine( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
|
|
||||||
line->GetStart(), line->GetEnd(),
|
|
||||||
line->GetPenWidth(), line->GetColor() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WS_DRAW_ITEM_BASE::wsg_rect:
|
|
||||||
{
|
|
||||||
WS_DRAW_ITEM_RECT* rect = (WS_DRAW_ITEM_RECT*) item;
|
|
||||||
GRRect( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
|
|
||||||
rect->GetStart().x, rect->GetStart().y,
|
|
||||||
rect->GetEnd().x, rect->GetEnd().y,
|
|
||||||
rect->GetPenWidth(), rect->GetColor() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WS_DRAW_ITEM_BASE::wsg_text:
|
|
||||||
{
|
|
||||||
WS_DRAW_ITEM_TEXT* text = (WS_DRAW_ITEM_TEXT*) item;
|
|
||||||
DrawGraphicText( aCanvas, aDC, text->GetTextPosition(),
|
|
||||||
text->GetColor(), text->GetText(),
|
|
||||||
text->GetOrientation(), text->GetSize(),
|
|
||||||
text->GetHorizJustify(), text->GetVertJustify(),
|
|
||||||
text->GetPenWidth(), text->IsItalic(), text->IsBold() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
case WS_DRAW_ITEM_BASE::wsg_poly:
|
|
||||||
{
|
|
||||||
WS_DRAW_ITEM_POLYGON* poly = (WS_DRAW_ITEM_POLYGON*) item;
|
|
||||||
GRPoly( aCanvas ? aCanvas->GetClipBox() : NULL, aDC,
|
|
||||||
poly->m_Corners.size(), &poly->m_Corners[0],
|
|
||||||
poly->IsFilled() ? FILLED_SHAPE : NO_FILL,
|
|
||||||
poly->GetPenWidth(),
|
|
||||||
poly->GetColor(), poly->GetColor() );
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -146,59 +153,13 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
|
||||||
TITLE_BLOCK t_block = GetTitleBlock();
|
TITLE_BLOCK t_block = GetTitleBlock();
|
||||||
EDA_COLOR_T color = RED;
|
EDA_COLOR_T color = RED;
|
||||||
|
|
||||||
DrawPageLayout( aDC, m_canvas, pageInfo,
|
DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
|
||||||
aFilename, GetScreenDesc(), t_block,
|
aFilename, GetScreenDesc(), t_block,
|
||||||
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
|
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
|
||||||
aLineWidth, aScalar, color, color );
|
aLineWidth, aScalar, color, color );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition ) const
|
|
||||||
{
|
|
||||||
const PAGE_INFO& pageInfo = GetPageSettings();
|
|
||||||
|
|
||||||
int ii;
|
|
||||||
int xg, yg;
|
|
||||||
int ipas;
|
|
||||||
int gxpas, gypas;
|
|
||||||
int refx, refy;
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
// Upper left corner
|
|
||||||
refx = pageInfo.GetLeftMarginMils();
|
|
||||||
refy = pageInfo.GetTopMarginMils();
|
|
||||||
|
|
||||||
// lower right corner
|
|
||||||
xg = pageInfo.GetSizeMils().x - pageInfo.GetRightMarginMils();
|
|
||||||
yg = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();
|
|
||||||
|
|
||||||
// Get the Y axis identifier (A symbol A ... Z)
|
|
||||||
if( aPosition.y < refy || aPosition.y > yg ) // Outside of Y limits
|
|
||||||
msg << wxT( "?" );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ipas = ( yg - refy ) / PAS_REF; // ipas = Y count sections
|
|
||||||
gypas = ( yg - refy ) / ipas; // gypas = Y section size
|
|
||||||
ii = ( aPosition.y - refy ) / gypas;
|
|
||||||
msg.Printf( wxT( "%c" ), 'A' + ii );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get the X axis identifier (A number 1 ... n)
|
|
||||||
if( aPosition.x < refx || aPosition.x > xg ) // Outside of X limits
|
|
||||||
msg << wxT( "?" );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ipas = ( xg - refx ) / PAS_REF; // ipas = X count sections
|
|
||||||
gxpas = ( xg - refx ) / ipas; // gxpas = X section size
|
|
||||||
|
|
||||||
ii = ( aPosition.x - refx ) / gxpas;
|
|
||||||
msg << ii + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return msg;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
wxString EDA_DRAW_FRAME::GetScreenDesc()
|
wxString EDA_DRAW_FRAME::GetScreenDesc()
|
||||||
{
|
{
|
||||||
// Virtual function, in basic function, returns
|
// Virtual function, in basic function, returns
|
||||||
|
@ -293,20 +254,17 @@ wxString WS_DRAW_ITEM_LIST::BuildFullText( const wxString& aTextbase )
|
||||||
format = aTextbase[++ii];
|
format = aTextbase[++ii];
|
||||||
switch( format )
|
switch( format )
|
||||||
{
|
{
|
||||||
|
case '0':
|
||||||
case '1':
|
case '1':
|
||||||
msg += m_titleBlock->GetComment1();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '2':
|
case '2':
|
||||||
msg += m_titleBlock->GetComment2();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '3':
|
case '3':
|
||||||
msg += m_titleBlock->GetComment3();
|
|
||||||
break;
|
|
||||||
|
|
||||||
case '4':
|
case '4':
|
||||||
msg += m_titleBlock->GetComment4();
|
case '5':
|
||||||
|
case '6':
|
||||||
|
case '7':
|
||||||
|
case '8':
|
||||||
|
case '9':
|
||||||
|
msg += m_titleBlock->GetComment( format - '0');
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
@ -326,43 +284,42 @@ void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
|
||||||
throw( IO_ERROR )
|
throw( IO_ERROR )
|
||||||
{
|
{
|
||||||
// Don't write the title block information if there is nothing to write.
|
// Don't write the title block information if there is nothing to write.
|
||||||
if( !m_title.IsEmpty() || !m_date.IsEmpty() || !m_revision.IsEmpty()
|
bool isempty = true;
|
||||||
|| !m_company.IsEmpty() || !m_comment1.IsEmpty() || !m_comment2.IsEmpty()
|
for( unsigned idx = 0; idx < m_tbTexts.GetCount(); idx++ )
|
||||||
|| !m_comment3.IsEmpty() || !m_comment4.IsEmpty() )
|
{
|
||||||
|
if( ! m_tbTexts[idx].IsEmpty() )
|
||||||
|
{
|
||||||
|
isempty = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( !isempty )
|
||||||
{
|
{
|
||||||
aFormatter->Print( aNestLevel, "(title_block\n" );
|
aFormatter->Print( aNestLevel, "(title_block\n" );
|
||||||
|
|
||||||
if( !m_title.IsEmpty() )
|
if( !GetTitle().IsEmpty() )
|
||||||
aFormatter->Print( aNestLevel+1, "(title %s)\n",
|
aFormatter->Print( aNestLevel+1, "(title %s)\n",
|
||||||
aFormatter->Quotew( m_title ).c_str() );
|
aFormatter->Quotew( GetTitle() ).c_str() );
|
||||||
|
|
||||||
if( !m_date.IsEmpty() )
|
if( !GetDate().IsEmpty() )
|
||||||
aFormatter->Print( aNestLevel+1, "(date %s)\n",
|
aFormatter->Print( aNestLevel+1, "(date %s)\n",
|
||||||
aFormatter->Quotew( m_date ).c_str() );
|
aFormatter->Quotew( GetDate() ).c_str() );
|
||||||
|
|
||||||
if( !m_revision.IsEmpty() )
|
if( !GetRevision().IsEmpty() )
|
||||||
aFormatter->Print( aNestLevel+1, "(rev %s)\n",
|
aFormatter->Print( aNestLevel+1, "(rev %s)\n",
|
||||||
aFormatter->Quotew( m_revision ).c_str() );
|
aFormatter->Quotew( GetRevision() ).c_str() );
|
||||||
|
|
||||||
if( !m_company.IsEmpty() )
|
if( !GetCompany().IsEmpty() )
|
||||||
aFormatter->Print( aNestLevel+1, "(company %s)\n",
|
aFormatter->Print( aNestLevel+1, "(company %s)\n",
|
||||||
aFormatter->Quotew( m_company ).c_str() );
|
aFormatter->Quotew( GetCompany() ).c_str() );
|
||||||
|
|
||||||
if( !m_comment1.IsEmpty() )
|
for( int ii = 0; ii < 4; ii++ )
|
||||||
aFormatter->Print( aNestLevel+1, "(comment 1 %s)\n",
|
{
|
||||||
aFormatter->Quotew( m_comment1 ).c_str() );
|
if( !GetComment(ii).IsEmpty() )
|
||||||
|
aFormatter->Print( aNestLevel+1, "(comment %d %s)\n", ii+1,
|
||||||
if( !m_comment2.IsEmpty() )
|
aFormatter->Quotew( GetComment(ii) ).c_str() );
|
||||||
aFormatter->Print( aNestLevel+1, "(comment 2 %s)\n",
|
}
|
||||||
aFormatter->Quotew( m_comment2 ).c_str() );
|
|
||||||
|
|
||||||
if( !m_comment3.IsEmpty() )
|
|
||||||
aFormatter->Print( aNestLevel+1, "(comment 3 %s)\n",
|
|
||||||
aFormatter->Quotew( m_comment3 ).c_str() );
|
|
||||||
|
|
||||||
if( !m_comment4.IsEmpty() )
|
|
||||||
aFormatter->Print( aNestLevel+1, "(comment 4 %s)\n",
|
|
||||||
aFormatter->Quotew( m_comment4 ).c_str() );
|
|
||||||
|
|
||||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,29 @@
|
||||||
/*************************************************************************/
|
/*
|
||||||
/* 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 @@
|
||||||
#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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* 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 )
|
||||||
{
|
{
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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 )
|
||||||
{
|
{
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 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 )
|
||||||
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 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,21 +36,14 @@
|
||||||
#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 footprint list */
|
|
||||||
/***************************************/
|
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent,
|
FOOTPRINTS_LISTBOX::FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent,
|
||||||
wxWindowID id, const wxPoint& loc,
|
wxWindowID id, 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 )
|
||||||
{
|
{
|
||||||
m_UseFootprintFullList = true;
|
|
||||||
m_ActiveFootprintList = NULL;
|
|
||||||
SetActiveFootprintList( true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -59,24 +52,19 @@ FOOTPRINTS_LISTBOX::~FOOTPRINTS_LISTBOX()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Return number of items
|
|
||||||
*/
|
|
||||||
int FOOTPRINTS_LISTBOX::GetCount()
|
int FOOTPRINTS_LISTBOX::GetCount()
|
||||||
{
|
{
|
||||||
return m_ActiveFootprintList->Count();
|
return m_footprintList.Count();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Change an item text
|
|
||||||
*/
|
|
||||||
void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
void FOOTPRINTS_LISTBOX::SetString( unsigned linecount, const wxString& text )
|
||||||
{
|
{
|
||||||
if( linecount >= m_ActiveFootprintList->Count() )
|
if( linecount >= m_footprintList.Count() )
|
||||||
linecount = m_ActiveFootprintList->Count() - 1;
|
linecount = m_footprintList.Count() - 1;
|
||||||
|
|
||||||
if( linecount >= 0 )
|
if( linecount >= 0 )
|
||||||
(*m_ActiveFootprintList)[linecount] = text;
|
m_footprintList[linecount] = text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -87,7 +75,7 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
|
||||||
|
|
||||||
if( ii >= 0 )
|
if( ii >= 0 )
|
||||||
{
|
{
|
||||||
wxString msg = (*m_ActiveFootprintList)[ii];
|
wxString msg = m_footprintList[ii];
|
||||||
msg.Trim( true );
|
msg.Trim( true );
|
||||||
msg.Trim( false );
|
msg.Trim( false );
|
||||||
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
||||||
|
@ -99,24 +87,20 @@ wxString FOOTPRINTS_LISTBOX::GetSelectedFootprint()
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text )
|
void FOOTPRINTS_LISTBOX::AppendLine( const wxString& text )
|
||||||
{
|
{
|
||||||
m_ActiveFootprintList->Add( text );
|
m_footprintList.Add( text );
|
||||||
SetItemCount( m_ActiveFootprintList->Count() );
|
SetItemCount( m_footprintList.Count() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Overlaid function: MUST be provided in wxLC_VIRTUAL mode
|
|
||||||
* because real data is not handled by ITEMS_LISTBOX_BASE
|
|
||||||
*/
|
|
||||||
wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
|
wxString FOOTPRINTS_LISTBOX::OnGetItemText( long item, long column ) const
|
||||||
{
|
{
|
||||||
return m_ActiveFootprintList->Item( item );
|
if( item < 0 || item >= (long)m_footprintList.GetCount() )
|
||||||
|
return wxEmptyString;
|
||||||
|
|
||||||
|
return m_footprintList.Item( item );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Enable or disable an item
|
|
||||||
*/
|
|
||||||
void FOOTPRINTS_LISTBOX::SetSelection( unsigned index, bool State )
|
void FOOTPRINTS_LISTBOX::SetSelection( unsigned index, bool State )
|
||||||
{
|
{
|
||||||
if( (int) index >= GetCount() )
|
if( (int) index >= GetCount() )
|
||||||
|
@ -127,7 +111,9 @@ void FOOTPRINTS_LISTBOX::SetSelection( unsigned index, bool State )
|
||||||
#ifndef __WXMAC__
|
#ifndef __WXMAC__
|
||||||
Select( index, State );
|
Select( index, State );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
EnsureVisible( index );
|
EnsureVisible( index );
|
||||||
|
|
||||||
#ifdef __WXMAC__
|
#ifdef __WXMAC__
|
||||||
Refresh();
|
Refresh();
|
||||||
#endif
|
#endif
|
||||||
|
@ -135,232 +121,78 @@ void FOOTPRINTS_LISTBOX::SetSelection( unsigned index, bool State )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::SetFootprintFullList( FOOTPRINT_LIST& list )
|
void FOOTPRINTS_LISTBOX::SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName,
|
||||||
|
COMPONENT* aComponent, int aFilterType )
|
||||||
{
|
{
|
||||||
|
wxArrayString newList;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
int oldSelection = GetSelection();
|
wxString oldSelection;
|
||||||
|
|
||||||
m_FullFootprintList.Clear();
|
if( GetSelection() >= 0 && GetSelection() < (int)m_footprintList.GetCount() )
|
||||||
|
oldSelection = m_footprintList[ GetSelection() ];
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < aList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
FOOTPRINT_INFO & footprint = list.GetItem(ii);
|
if( aFilterType == UNFILTERED )
|
||||||
msg.Printf( wxT( "%3zu %s" ), m_FullFootprintList.GetCount() + 1,
|
{
|
||||||
GetChars(footprint.m_Module) );
|
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
|
||||||
m_FullFootprintList.Add( msg );
|
GetChars( aList.GetItem( ii ).m_Module ) );
|
||||||
|
newList.Add( msg );
|
||||||
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
SetActiveFootprintList( true );
|
if( (aFilterType & BY_LIBRARY) && !aLibName.IsEmpty()
|
||||||
|
&& !aList.GetItem( ii ).InLibrary( aLibName ) )
|
||||||
if( GetCount() == 0 || oldSelection < 0 || oldSelection >= GetCount() )
|
|
||||||
SetSelection( 0, true );
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::SetFootprintFilteredList( COMPONENT* aComponent,
|
|
||||||
FOOTPRINT_LIST& list )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
unsigned jj;
|
|
||||||
int OldSelection = GetSelection();
|
|
||||||
bool hasItem = false;
|
|
||||||
|
|
||||||
m_FilteredFootprintList.Clear();
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
FOOTPRINT_INFO& footprint = list.GetItem(ii);
|
|
||||||
// Search for matching footprints
|
|
||||||
// The search is case insensitive
|
|
||||||
wxString module = footprint.m_Module.Upper();
|
|
||||||
wxString candidate;
|
|
||||||
|
|
||||||
for( jj = 0; jj < aComponent->GetFootprintFilters().GetCount(); jj++ )
|
|
||||||
{
|
|
||||||
candidate = aComponent->GetFootprintFilters()[jj].Upper();
|
|
||||||
|
|
||||||
if( !module.Matches( candidate ) )
|
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
msg.Printf( wxT( "%3zu %s" ), m_FilteredFootprintList.GetCount() + 1,
|
if( (aFilterType & BY_COMPONENT) && (aComponent != NULL)
|
||||||
footprint.m_Module.GetData() );
|
&& !aComponent->MatchesFootprintFilters( aList.GetItem( ii ).m_Module ) )
|
||||||
m_FilteredFootprintList.Add( msg );
|
continue;
|
||||||
hasItem = true;
|
|
||||||
}
|
if( (aFilterType & BY_PIN_COUNT) && (aComponent!= NULL)
|
||||||
|
&& (aComponent->GetNetCount() != aList.GetItem( ii ).m_padCount) )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
msg.Printf( wxT( "%3zu %s" ), newList.GetCount() + 1,
|
||||||
|
aList.GetItem( ii ).m_Module.GetData() );
|
||||||
|
newList.Add( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( hasItem )
|
if( newList == m_footprintList )
|
||||||
SetActiveFootprintList( false );
|
return;
|
||||||
else
|
|
||||||
SetActiveFootprintList( true );
|
|
||||||
|
|
||||||
if( ( GetCount() == 0 ) || ( OldSelection >= GetCount() ) )
|
m_footprintList = newList;
|
||||||
SetSelection( 0, true );
|
|
||||||
|
|
||||||
|
int selection = m_footprintList.Index( oldSelection );
|
||||||
|
|
||||||
|
if( selection == wxNOT_FOUND )
|
||||||
|
selection = 0;
|
||||||
|
|
||||||
|
DeleteAllItems();
|
||||||
|
SetItemCount( m_footprintList.GetCount() );
|
||||||
|
SetSelection( selection, true );
|
||||||
Refresh();
|
Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::SetFootprintFilteredByPinCount( COMPONENT* aComponent,
|
|
||||||
FOOTPRINT_LIST& list )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
int oldSelection = GetSelection();
|
|
||||||
bool hasItem = false;
|
|
||||||
|
|
||||||
m_FilteredFootprintList.Clear();
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
FOOTPRINT_INFO& footprint = list.GetItem(ii);
|
|
||||||
|
|
||||||
if( aComponent->GetNetCount() == footprint.m_padCount )
|
|
||||||
{
|
|
||||||
msg.Printf( wxT( "%3zu %s" ), m_FilteredFootprintList.GetCount() + 1,
|
|
||||||
footprint.m_Module.GetData() );
|
|
||||||
m_FilteredFootprintList.Add( msg );
|
|
||||||
hasItem = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( hasItem )
|
|
||||||
SetActiveFootprintList( false );
|
|
||||||
else
|
|
||||||
SetActiveFootprintList( true );
|
|
||||||
|
|
||||||
if( ( GetCount() == 0 ) || ( oldSelection >= GetCount() ) )
|
|
||||||
SetSelection( 0, true );
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::SetFootprintFilteredByLibraryList( FOOTPRINT_LIST& list,
|
|
||||||
wxString SelectedLibrary ) {
|
|
||||||
wxString msg;
|
|
||||||
int oldSelection = GetSelection();
|
|
||||||
bool hasItem = false;
|
|
||||||
|
|
||||||
wxFileName filename = SelectedLibrary;
|
|
||||||
filename.SetExt( LegacyFootprintLibPathExtension );
|
|
||||||
wxString FullLibraryName = wxGetApp().FindLibraryPath( filename );
|
|
||||||
|
|
||||||
m_FilteredFootprintList.Clear();
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < list.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
FOOTPRINT_INFO& footprint = list.GetItem(ii);
|
|
||||||
wxString LibName = footprint.m_libPath;
|
|
||||||
if( LibName.Matches( FullLibraryName ) )
|
|
||||||
{
|
|
||||||
msg.Printf( wxT( "%3d %s" ), m_FilteredFootprintList.GetCount() + 1,
|
|
||||||
footprint.m_Module.GetData() );
|
|
||||||
m_FilteredFootprintList.Add( msg );
|
|
||||||
hasItem = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( hasItem )
|
|
||||||
SetActiveFootprintList( false );
|
|
||||||
else
|
|
||||||
SetActiveFootprintList( true );
|
|
||||||
|
|
||||||
if( ( GetCount() == 0 ) || ( oldSelection >= GetCount() ) )
|
|
||||||
SetSelection( 0, true );
|
|
||||||
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Set the footprint list. We can have 2 footprint list:
|
|
||||||
* The full footprint list
|
|
||||||
* The filtered footprint list (if the current selected component has a
|
|
||||||
* filter for footprints)
|
|
||||||
* @param FullList true = full footprint list, false = filtered footprint list
|
|
||||||
* @param Redraw = true to redraw the window
|
|
||||||
*/
|
|
||||||
void FOOTPRINTS_LISTBOX::SetActiveFootprintList( bool FullList, bool Redraw )
|
|
||||||
{
|
|
||||||
bool old_selection = m_UseFootprintFullList;
|
|
||||||
|
|
||||||
#ifdef __WINDOWS__
|
|
||||||
|
|
||||||
/* Workaround for a curious bug in wxWidgets:
|
|
||||||
* if we switch from a long list of footprints to a short list (a
|
|
||||||
* filtered footprint list), and if the selected item is near the end
|
|
||||||
* of the long list, the new list is not displayed from the top of
|
|
||||||
* the list box
|
|
||||||
*/
|
|
||||||
if( m_ActiveFootprintList )
|
|
||||||
{
|
|
||||||
bool new_selection;
|
|
||||||
|
|
||||||
if( FullList )
|
|
||||||
new_selection = true;
|
|
||||||
else
|
|
||||||
new_selection = false;
|
|
||||||
|
|
||||||
if( new_selection != old_selection )
|
|
||||||
SetSelection( 0, true );
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
if( FullList )
|
|
||||||
{
|
|
||||||
m_UseFootprintFullList = true;
|
|
||||||
m_ActiveFootprintList = &m_FullFootprintList;
|
|
||||||
SetItemCount( m_FullFootprintList.GetCount() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_UseFootprintFullList = false;
|
|
||||||
m_ActiveFootprintList = &m_FilteredFootprintList;
|
|
||||||
SetItemCount( m_FilteredFootprintList.GetCount() );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( Redraw )
|
|
||||||
{
|
|
||||||
if( !m_UseFootprintFullList || ( m_UseFootprintFullList != old_selection ) )
|
|
||||||
{
|
|
||||||
Refresh();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
GetParent()->DisplayStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
|
||||||
/* Event table for the footprint list */
|
|
||||||
/**************************************/
|
|
||||||
|
|
||||||
BEGIN_EVENT_TABLE( FOOTPRINTS_LISTBOX, ITEMS_LISTBOX_BASE )
|
BEGIN_EVENT_TABLE( FOOTPRINTS_LISTBOX, ITEMS_LISTBOX_BASE )
|
||||||
EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize )
|
EVT_SIZE( ITEMS_LISTBOX_BASE::OnSize )
|
||||||
EVT_CHAR( FOOTPRINTS_LISTBOX::OnChar )
|
EVT_CHAR( FOOTPRINTS_LISTBOX::OnChar )
|
||||||
|
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftClick )
|
||||||
|
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, FOOTPRINTS_LISTBOX::OnLeftDClick )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
|
void FOOTPRINTS_LISTBOX::OnLeftClick( wxListEvent& event )
|
||||||
{
|
{
|
||||||
FOOTPRINT_INFO* Module;
|
if( m_footprintList.IsEmpty() )
|
||||||
wxString footprintName = GetSelectedFootprint();
|
return;
|
||||||
|
|
||||||
Module = GetParent()->m_footprints.GetModuleInfo( footprintName );
|
// If the footprint view window is displayed, update the footprint.
|
||||||
wxASSERT(Module);
|
|
||||||
if( GetParent()->m_DisplayFootprintFrame )
|
if( GetParent()->m_DisplayFootprintFrame )
|
||||||
{
|
|
||||||
// Refresh current selected footprint view:
|
|
||||||
GetParent()->CreateScreenCmp();
|
GetParent()->CreateScreenCmp();
|
||||||
}
|
|
||||||
|
|
||||||
if( Module )
|
GetParent()->DisplayStatus();
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg = Module->m_Doc;
|
|
||||||
GetParent()->SetStatusText( msg, 0 );
|
|
||||||
|
|
||||||
msg = wxT( "KeyW: " );
|
|
||||||
msg += Module->m_KeyWord;
|
|
||||||
GetParent()->SetStatusText( msg, 1 );
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -378,9 +210,15 @@ void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
|
|
||||||
switch( key )
|
switch( key )
|
||||||
{
|
{
|
||||||
|
case WXK_TAB:
|
||||||
|
case WXK_RIGHT:
|
||||||
|
case WXK_NUMPAD_RIGHT:
|
||||||
|
GetParent()->ChangeFocus( true );
|
||||||
|
return;
|
||||||
|
|
||||||
case WXK_LEFT:
|
case WXK_LEFT:
|
||||||
case WXK_NUMPAD_LEFT:
|
case WXK_NUMPAD_LEFT:
|
||||||
GetParent()->m_ListCmp->SetFocus();
|
GetParent()->ChangeFocus( false );
|
||||||
return;
|
return;
|
||||||
|
|
||||||
case WXK_HOME:
|
case WXK_HOME:
|
||||||
|
@ -389,8 +227,6 @@ void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
case WXK_DOWN:
|
case WXK_DOWN:
|
||||||
case WXK_PAGEUP:
|
case WXK_PAGEUP:
|
||||||
case WXK_PAGEDOWN:
|
case WXK_PAGEDOWN:
|
||||||
case WXK_RIGHT:
|
|
||||||
case WXK_NUMPAD_RIGHT:
|
|
||||||
event.Skip();
|
event.Skip();
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -399,16 +235,14 @@ void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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_ActiveFootprintList->GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_footprintList.GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
wxString text = m_ActiveFootprintList->Item(ii);
|
wxString text = m_footprintList.Item( ii );
|
||||||
|
|
||||||
/* search for the start char of the footprint name.
|
// Search for the start char of the footprint name. Skip the line number.
|
||||||
* we must 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++ )
|
||||||
|
@ -428,7 +262,6 @@ void FOOTPRINTS_LISTBOX::OnChar( wxKeyEvent& event )
|
||||||
|
|
||||||
if( key == start_char )
|
if( key == start_char )
|
||||||
{
|
{
|
||||||
Focus( ii );
|
|
||||||
SetSelection( ii, true ); // Ensure visible
|
SetSelection( ii, true ); // Ensure visible
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -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()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* 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()
|
||||||
|
|
||||||
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()
|
||||||
|
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
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++ )
|
SetItemCount( m_libraryList.GetCount() );
|
||||||
{
|
|
||||||
msg = list.Item(ii);
|
|
||||||
m_LibraryList.Add( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
SetItemCount(list.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 )
|
||||||
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 )
|
||||||
}
|
}
|
||||||
|
|
||||||
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 );
|
||||||
|
}
|
||||||
|
|
|
@ -87,20 +87,11 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, EDA_BASE_FRAME )
|
||||||
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
||||||
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
||||||
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
||||||
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
|
|
||||||
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
|
||||||
|
|
||||||
// Frame events
|
// Frame events
|
||||||
EVT_CHAR( CVPCB_MAINFRAME::OnChar )
|
|
||||||
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
EVT_CLOSE( CVPCB_MAINFRAME::OnCloseWindow )
|
||||||
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
EVT_SIZE( CVPCB_MAINFRAME::OnSize )
|
||||||
|
|
||||||
// List item events
|
|
||||||
EVT_LIST_ITEM_SELECTED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftClick )
|
|
||||||
EVT_LIST_ITEM_ACTIVATED( ID_CVPCB_FOOTPRINT_LIST, CVPCB_MAINFRAME::OnLeftDClick )
|
|
||||||
EVT_LIST_ITEM_SELECTED( ID_CVPCB_COMPONENT_LIST, CVPCB_MAINFRAME::OnSelectComponent )
|
|
||||||
EVT_LIST_ITEM_SELECTED( ID_CVPCB_LIBRARY_LIST, CVPCB_MAINFRAME::OnSelectComponent )
|
|
||||||
|
|
||||||
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
|
EVT_UPDATE_UI( ID_CVPCB_CONFIG_KEEP_OPEN_ON_SAVE, CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
@ -112,7 +103,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
||||||
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
|
wxDefaultSize, style, CVPCB_MAINFRAME_NAME )
|
||||||
{
|
{
|
||||||
m_FrameName = CVPCB_MAINFRAME_NAME;
|
m_FrameName = CVPCB_MAINFRAME_NAME;
|
||||||
|
|
||||||
m_ListCmp = NULL;
|
m_ListCmp = NULL;
|
||||||
m_FootprintList = NULL;
|
m_FootprintList = NULL;
|
||||||
m_LibraryList = NULL;
|
m_LibraryList = NULL;
|
||||||
|
@ -200,22 +190,6 @@ CVPCB_MAINFRAME::CVPCB_MAINFRAME( const wxString& title, long style ) :
|
||||||
|
|
||||||
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
|
CVPCB_MAINFRAME::~CVPCB_MAINFRAME()
|
||||||
{
|
{
|
||||||
wxConfig* config = wxGetApp().GetSettings();
|
|
||||||
|
|
||||||
if( config )
|
|
||||||
{
|
|
||||||
int state = 0;
|
|
||||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
|
||||||
{
|
|
||||||
state = 1;
|
|
||||||
}
|
|
||||||
else if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
|
||||||
{
|
|
||||||
state = 2;
|
|
||||||
}
|
|
||||||
config->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_auimgr.UnInit();
|
m_auimgr.UnInit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -242,6 +216,19 @@ void CVPCB_MAINFRAME::SaveSettings()
|
||||||
EDA_BASE_FRAME::SaveSettings();
|
EDA_BASE_FRAME::SaveSettings();
|
||||||
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
cfg->Write( KeepCvpcbOpenEntry, m_KeepCvpcbOpen );
|
||||||
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
cfg->Write( FootprintDocFileEntry, m_DocModulesFileName );
|
||||||
|
|
||||||
|
int state = 0;
|
||||||
|
|
||||||
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||||
|
state |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
||||||
|
|
||||||
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||||
|
state |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
||||||
|
|
||||||
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||||
|
state |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
||||||
|
|
||||||
|
cfg->Write( wxT( FILTERFOOTPRINTKEY ), state );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -318,83 +305,77 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnChar( wxKeyEvent& event )
|
void CVPCB_MAINFRAME::ChangeFocus( bool aMoveRight )
|
||||||
{
|
{
|
||||||
switch( event.GetKeyCode() )
|
wxWindow* hasFocus = wxWindow::FindFocus();
|
||||||
|
|
||||||
|
if( aMoveRight )
|
||||||
{
|
{
|
||||||
case WXK_LEFT:
|
if( hasFocus == m_LibraryList )
|
||||||
case WXK_NUMPAD_LEFT:
|
|
||||||
m_ListCmp->SetFocus();
|
m_ListCmp->SetFocus();
|
||||||
break;
|
else if( hasFocus == m_ListCmp )
|
||||||
|
|
||||||
case WXK_RIGHT:
|
|
||||||
case WXK_NUMPAD_RIGHT:
|
|
||||||
m_FootprintList->SetFocus();
|
m_FootprintList->SetFocus();
|
||||||
break;
|
else if( hasFocus == m_FootprintList )
|
||||||
|
m_LibraryList->SetFocus();
|
||||||
default:
|
}
|
||||||
event.Skip();
|
else
|
||||||
break;
|
{
|
||||||
|
if( hasFocus == m_LibraryList )
|
||||||
|
m_FootprintList->SetFocus();
|
||||||
|
else if( hasFocus == m_ListCmp )
|
||||||
|
m_LibraryList->SetFocus();
|
||||||
|
else if( hasFocus == m_FootprintList )
|
||||||
|
m_ListCmp->SetFocus();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::ToFirstNA( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int ii = 0;
|
|
||||||
int selection;
|
|
||||||
|
|
||||||
if( m_netlist.IsEmpty() )
|
if( m_netlist.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
selection = m_ListCmp->GetSelection();
|
long selection = m_ListCmp->GetFirstSelected();
|
||||||
|
|
||||||
if( selection < 0 )
|
if( selection < 0 )
|
||||||
selection = 0;
|
selection = -1; // We will start to 0 for the first search , if no item selected
|
||||||
|
|
||||||
for( unsigned jj = 0; jj < m_netlist.GetCount(); jj++ )
|
for( unsigned jj = selection+1; jj < m_netlist.GetCount(); jj++ )
|
||||||
{
|
{
|
||||||
if( m_netlist.GetComponent( jj )->GetFootprintName().IsEmpty() && ii > selection )
|
if( m_netlist.GetComponent( jj )->GetFootprintName().IsEmpty() )
|
||||||
{
|
{
|
||||||
m_ListCmp->SetSelection( ii );
|
m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections
|
||||||
|
m_ListCmp->SetSelection( jj );
|
||||||
SendMessageToEESCHEMA();
|
SendMessageToEESCHEMA();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ii++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ListCmp->SetSelection( selection );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::ToPreviousNA( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int ii;
|
|
||||||
int selection;
|
|
||||||
|
|
||||||
if( m_netlist.IsEmpty() )
|
if( m_netlist.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ii = m_ListCmp->GetCount() - 1;
|
int selection = m_ListCmp->GetFirstSelected();
|
||||||
selection = m_ListCmp->GetSelection();
|
|
||||||
|
|
||||||
if( selection < 0 )
|
if( selection < 0 )
|
||||||
selection = m_ListCmp->GetCount() - 1;
|
selection = m_ListCmp->GetCount();
|
||||||
|
else
|
||||||
|
while( m_ListCmp->GetNextSelected( selection ) >= 0 )
|
||||||
|
selection = m_ListCmp->GetNextSelected( selection );
|
||||||
|
|
||||||
for( unsigned kk = m_netlist.GetCount() - 1; kk >= 0; kk-- )
|
for( int kk = selection-1; kk >= 0; kk-- )
|
||||||
{
|
{
|
||||||
if( m_netlist.GetComponent( kk )->GetFootprintName().IsEmpty() && ii < selection )
|
if( m_netlist.GetComponent( kk )->GetFootprintName().IsEmpty() )
|
||||||
{
|
{
|
||||||
m_ListCmp->SetSelection( ii );
|
m_ListCmp->SetSelection( wxNOT_FOUND, false ); // Remove all selections
|
||||||
|
m_ListCmp->SetSelection( kk );
|
||||||
SendMessageToEESCHEMA();
|
SendMessageToEESCHEMA();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ii--;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
m_ListCmp->SetSelection( selection );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -508,91 +489,46 @@ void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnLeftClick( wxListEvent& event )
|
|
||||||
{
|
|
||||||
m_FootprintList->OnLeftClick( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnLeftDClick( wxListEvent& event )
|
|
||||||
{
|
|
||||||
m_FootprintList->OnLeftDClick( event );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Called when clicking on a component in component list window
|
|
||||||
* * Updates the filtered footprint list, if the filtered list option is selected
|
|
||||||
* * Updates the current selected footprint in footprint list
|
|
||||||
* * Updates the footprint shown in footprint display window (if opened)
|
|
||||||
*/
|
|
||||||
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
{
|
{
|
||||||
if( m_skipComponentSelect )
|
if( m_skipComponentSelect )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#define REDRAW_LIST true
|
wxString libraryName;
|
||||||
#define SELECT_FULL_LIST true
|
COMPONENT* component = NULL;
|
||||||
int selection = -1;
|
int filter = FOOTPRINTS_LISTBOX::UNFILTERED;
|
||||||
wxString SelectedLibrary;
|
|
||||||
|
|
||||||
if( !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST )
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||||
&& !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST )
|
filter |= FOOTPRINTS_LISTBOX::BY_COMPONENT;
|
||||||
&& !m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST )
|
|
||||||
)
|
|
||||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
selection = m_ListCmp->GetSelection();
|
|
||||||
|
|
||||||
if( selection < 0 )
|
|
||||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_netlist.GetComponent( selection ) == NULL )
|
|
||||||
m_FootprintList->SetActiveFootprintList( SELECT_FULL_LIST, REDRAW_LIST );
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||||
{
|
filter |= FOOTPRINTS_LISTBOX::BY_PIN_COUNT;
|
||||||
m_FootprintList->SetFootprintFilteredByPinCount( m_netlist.GetComponent( selection ),
|
|
||||||
m_footprints );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||||
{
|
filter |= FOOTPRINTS_LISTBOX::BY_LIBRARY;
|
||||||
SelectedLibrary=m_LibraryList->GetSelectedLibrary();
|
|
||||||
m_FootprintList->SetFootprintFilteredByLibraryList( m_footprints, SelectedLibrary );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
m_FootprintList->SetFootprintFilteredList( m_netlist.GetComponent( selection ),
|
|
||||||
m_footprints );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
selection = m_ListCmp->GetSelection();
|
component = GetSelectedComponent();
|
||||||
|
libraryName = m_LibraryList->GetSelectedLibrary();
|
||||||
|
m_FootprintList->SetFootprints( m_footprints, libraryName, component, filter );
|
||||||
|
|
||||||
if( selection < 0 )
|
if( component == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Preview of the already assigned footprint.
|
// Preview of the already assigned footprint.
|
||||||
// Find the footprint that was already choosen for this component and select it,
|
// Find the footprint that was already chosen for this component and select it,
|
||||||
// but only if the selection is made from the component list.
|
// but only if the selection is made from the component list or the library list.
|
||||||
// If the selection is made from the footprint list, do not change the current selected footprint.
|
// If the selection is made from the footprint list, do not change the current
|
||||||
|
// selected footprint.
|
||||||
if( FindFocus() == m_ListCmp )
|
if( FindFocus() == m_ListCmp || FindFocus() == m_LibraryList )
|
||||||
{
|
{
|
||||||
wxString module = m_netlist.GetComponent( selection )->GetFootprintName();
|
wxString module = component->GetFootprintName();
|
||||||
|
|
||||||
bool found = false;
|
bool found = false;
|
||||||
|
|
||||||
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
|
for( int ii = 0; ii < m_FootprintList->GetCount(); ii++ )
|
||||||
{
|
{
|
||||||
wxString footprintName;
|
wxString footprintName;
|
||||||
wxString msg = (*m_FootprintList->m_ActiveFootprintList)[ii];
|
wxString msg = m_FootprintList->OnGetItemText( ii, 0 );
|
||||||
msg.Trim( true );
|
msg.Trim( true );
|
||||||
msg.Trim( false );
|
msg.Trim( false );
|
||||||
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
footprintName = msg.AfterFirst( wxChar( ' ' ) );
|
||||||
|
@ -604,11 +540,14 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( ! found )
|
|
||||||
|
if( !found )
|
||||||
{
|
{
|
||||||
int ii = m_FootprintList->GetSelection();
|
int ii = m_FootprintList->GetSelection();
|
||||||
|
|
||||||
if ( ii >= 0 )
|
if ( ii >= 0 )
|
||||||
m_FootprintList->SetSelection( ii, false );
|
m_FootprintList->SetSelection( ii, false );
|
||||||
|
|
||||||
if( m_DisplayFootprintFrame )
|
if( m_DisplayFootprintFrame )
|
||||||
{
|
{
|
||||||
CreateScreenCmp();
|
CreateScreenCmp();
|
||||||
|
@ -623,36 +562,6 @@ void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||||
|
|
||||||
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
void CVPCB_MAINFRAME::OnSelectFilteringFootprint( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
switch( event.GetId() )
|
|
||||||
{
|
|
||||||
case ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST:
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST:
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST:
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST:
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, false );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
wxListEvent l_event;
|
wxListEvent l_event;
|
||||||
|
|
||||||
OnSelectComponent( l_event );
|
OnSelectComponent( l_event );
|
||||||
|
@ -668,34 +577,87 @@ void CVPCB_MAINFRAME::OnUpdateKeepOpenOnSave( wxUpdateUIEvent& event )
|
||||||
void CVPCB_MAINFRAME::DisplayStatus()
|
void CVPCB_MAINFRAME::DisplayStatus()
|
||||||
{
|
{
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
COMPONENT* component;
|
||||||
|
|
||||||
msg.Printf( _( "Components: %d (free: %d)" ), (int) m_netlist.GetCount(),
|
if( wxWindow::FindFocus() == m_ListCmp || wxWindow::FindFocus() == m_LibraryList )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Components: %d, unassigned: %d" ), (int) m_netlist.GetCount(),
|
||||||
m_undefinedComponentCnt );
|
m_undefinedComponentCnt );
|
||||||
SetStatusText( msg, 0 );
|
SetStatusText( msg, 0 );
|
||||||
|
|
||||||
SetStatusText( wxEmptyString, 1 );
|
msg.Empty();
|
||||||
|
|
||||||
|
component = GetSelectedComponent();
|
||||||
|
|
||||||
|
if( component )
|
||||||
|
{
|
||||||
|
for( unsigned ii = 0; ii < component->GetFootprintFilters().GetCount(); ii++ )
|
||||||
|
{
|
||||||
|
if( msg.IsEmpty() )
|
||||||
|
msg += component->GetFootprintFilters()[ii];
|
||||||
|
else
|
||||||
|
msg += wxT( ", " ) + component->GetFootprintFilters()[ii];
|
||||||
|
}
|
||||||
|
|
||||||
|
msg = _( "Filter list: " ) + msg;
|
||||||
|
}
|
||||||
|
|
||||||
|
SetStatusText( msg, 1 );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxString footprintName = m_FootprintList->GetSelectedFootprint();
|
||||||
|
FOOTPRINT_INFO* module = m_footprints.GetModuleInfo( footprintName );
|
||||||
|
|
||||||
|
if( module ) // can be NULL if no netlist loaded
|
||||||
|
{
|
||||||
|
msg = _( "Description: " ) + module->m_Doc;
|
||||||
|
SetStatusText( msg, 0 );
|
||||||
|
|
||||||
|
msg = _( "Key words: " ) + module->m_KeyWord;
|
||||||
|
SetStatusText( msg, 1 );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
msg.Empty();
|
||||||
|
|
||||||
if( m_FootprintList )
|
if( m_FootprintList )
|
||||||
{
|
{
|
||||||
if( m_FootprintList->m_UseFootprintFullList )
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST ) )
|
||||||
msg.Printf( _( "Footprints (All): %d" ),
|
msg = _( "key words" );
|
||||||
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
|
|
||||||
else
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST ) )
|
||||||
msg.Printf( _( "Footprints (filtered): %d" ),
|
|
||||||
(int) m_FootprintList->m_ActiveFootprintList->GetCount() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
msg.Empty();
|
if( !msg.IsEmpty() )
|
||||||
|
msg += wxT( ", " );
|
||||||
|
|
||||||
|
msg += _( "pin count" );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( m_mainToolBar->GetToolToggled( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST ) )
|
||||||
|
{
|
||||||
|
if( !msg.IsEmpty() )
|
||||||
|
msg += wxT( ", " );
|
||||||
|
|
||||||
|
msg += _( "library" );
|
||||||
|
}
|
||||||
|
|
||||||
|
if( msg.IsEmpty() )
|
||||||
|
msg = _( "No filtering" );
|
||||||
|
else
|
||||||
|
msg = _( "Filtered by " ) + msg;
|
||||||
|
|
||||||
|
msg << wxT( ": " ) << m_FootprintList->GetCount();
|
||||||
|
|
||||||
SetStatusText( msg, 2 );
|
SetStatusText( msg, 2 );
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
{
|
{
|
||||||
/* Check if there are footprint libraries in project file */
|
// Check if there are footprint libraries in project file.
|
||||||
if( m_ModuleLibNames.GetCount() == 0 )
|
if( m_ModuleLibNames.GetCount() == 0 )
|
||||||
{
|
{
|
||||||
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
|
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
|
||||||
|
@ -705,10 +667,10 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
|
|
||||||
m_footprints.ReadFootprintFiles( m_ModuleLibNames );
|
m_footprints.ReadFootprintFiles( m_ModuleLibNames );
|
||||||
|
|
||||||
/* Display error messages, if any */
|
// Display error messages, if any.
|
||||||
if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
|
if( !m_footprints.m_filesNotFound.IsEmpty() || !m_footprints.m_filesInvalid.IsEmpty() )
|
||||||
{
|
{
|
||||||
HTML_MESSAGE_BOX dialog( this, _("Load Error") );
|
HTML_MESSAGE_BOX dialog( this, _( "Load Error" ) );
|
||||||
|
|
||||||
if( !m_footprints.m_filesNotFound.IsEmpty() )
|
if( !m_footprints.m_filesNotFound.IsEmpty() )
|
||||||
{
|
{
|
||||||
|
@ -717,7 +679,7 @@ bool CVPCB_MAINFRAME::LoadFootprintFiles()
|
||||||
dialog.ListSet( m_footprints.m_filesNotFound );
|
dialog.ListSet( m_footprints.m_filesNotFound );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Display if there are invalid files */
|
// Display if there are invalid files.
|
||||||
if( !m_footprints.m_filesInvalid.IsEmpty() )
|
if( !m_footprints.m_filesInvalid.IsEmpty() )
|
||||||
{
|
{
|
||||||
dialog.MessageSet( _( "Some files are invalid!" ) );
|
dialog.MessageSet( _( "Some files are invalid!" ) );
|
||||||
|
@ -815,7 +777,6 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// We also remove footprint name if it is "$noname" because this is a dummy name,
|
// We also remove footprint name if it is "$noname" because this is a dummy name,
|
||||||
// not the actual name of the footprint.
|
// not the actual name of the footprint.
|
||||||
for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
|
for( unsigned ii = 0; ii < m_netlist.GetCount(); ii++ )
|
||||||
|
@ -831,7 +792,7 @@ int CVPCB_MAINFRAME::ReadSchematicNetlist()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* File header. */
|
// File header.
|
||||||
static char HeaderLinkFile[] = { "Cmp-Mod V01" };
|
static char HeaderLinkFile[] = { "Cmp-Mod V01" };
|
||||||
|
|
||||||
|
|
||||||
|
@ -900,3 +861,86 @@ void CVPCB_MAINFRAME::CreateScreenCmp()
|
||||||
|
|
||||||
m_DisplayFootprintFrame->InitDisplay();
|
m_DisplayFootprintFrame->InitDisplay();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
|
||||||
|
{
|
||||||
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
|
|
||||||
|
if( m_FootprintList == NULL )
|
||||||
|
{
|
||||||
|
m_FootprintList = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
|
||||||
|
wxDefaultPosition, wxDefaultSize );
|
||||||
|
m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(),
|
||||||
|
wxFONTFAMILY_MODERN,
|
||||||
|
wxFONTSTYLE_NORMAL,
|
||||||
|
wxFONTWEIGHT_NORMAL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_FootprintList->SetFootprints( m_footprints, wxEmptyString, NULL,
|
||||||
|
FOOTPRINTS_LISTBOX::UNFILTERED );
|
||||||
|
DisplayStatus();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::BuildCmpListBox()
|
||||||
|
{
|
||||||
|
wxString msg;
|
||||||
|
COMPONENT* component;
|
||||||
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
|
|
||||||
|
if( m_ListCmp == NULL )
|
||||||
|
{
|
||||||
|
m_ListCmp = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
|
||||||
|
wxDefaultPosition, wxDefaultSize );
|
||||||
|
m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(),
|
||||||
|
wxFONTFAMILY_MODERN,
|
||||||
|
wxFONTSTYLE_NORMAL,
|
||||||
|
wxFONTWEIGHT_NORMAL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ListCmp->m_ComponentList.Clear();
|
||||||
|
|
||||||
|
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
||||||
|
{
|
||||||
|
component = m_netlist.GetComponent( i );
|
||||||
|
|
||||||
|
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
||||||
|
GetChars( component->GetReference() ),
|
||||||
|
GetChars( component->GetValue() ),
|
||||||
|
GetChars( component->GetFootprintName() ) );
|
||||||
|
m_ListCmp->m_ComponentList.Add( msg );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() );
|
||||||
|
m_ListCmp->SetSelection( 0, true );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
|
||||||
|
{
|
||||||
|
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
||||||
|
|
||||||
|
if( m_LibraryList == NULL )
|
||||||
|
{
|
||||||
|
m_LibraryList = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
|
||||||
|
wxDefaultPosition, wxDefaultSize );
|
||||||
|
m_LibraryList->SetFont( wxFont( guiFont.GetPointSize(),
|
||||||
|
wxFONTFAMILY_MODERN,
|
||||||
|
wxFONTSTYLE_NORMAL,
|
||||||
|
wxFONTWEIGHT_NORMAL ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
m_LibraryList->SetLibraryList( m_ModuleLibNames );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
COMPONENT* CVPCB_MAINFRAME::GetSelectedComponent()
|
||||||
|
{
|
||||||
|
int selection = m_ListCmp->GetSelection();
|
||||||
|
|
||||||
|
if( selection >= 0 && selection < (int) m_netlist.GetCount() )
|
||||||
|
return m_netlist.GetComponent( selection );
|
||||||
|
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ class FOOTPRINTS_LISTBOX;
|
||||||
class COMPONENTS_LISTBOX;
|
class COMPONENTS_LISTBOX;
|
||||||
class LIBRARY_LISTBOX;
|
class LIBRARY_LISTBOX;
|
||||||
class DISPLAY_FOOTPRINTS_FRAME;
|
class DISPLAY_FOOTPRINTS_FRAME;
|
||||||
|
class COMPONENT;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,8 +53,9 @@ class DISPLAY_FOOTPRINTS_FRAME;
|
||||||
*/
|
*/
|
||||||
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
|
class CVPCB_MAINFRAME : public EDA_BASE_FRAME
|
||||||
{
|
{
|
||||||
public:
|
wxArrayString m_footprintListEntries;
|
||||||
|
|
||||||
|
public:
|
||||||
bool m_KeepCvpcbOpen;
|
bool m_KeepCvpcbOpen;
|
||||||
FOOTPRINTS_LISTBOX* m_FootprintList;
|
FOOTPRINTS_LISTBOX* m_FootprintList;
|
||||||
LIBRARY_LISTBOX* m_LibraryList;
|
LIBRARY_LISTBOX* m_LibraryList;
|
||||||
|
@ -81,9 +83,6 @@ public:
|
||||||
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
CVPCB_MAINFRAME( const wxString& title, long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||||
~CVPCB_MAINFRAME();
|
~CVPCB_MAINFRAME();
|
||||||
|
|
||||||
void OnLeftClick( wxListEvent& event );
|
|
||||||
void OnLeftDClick( wxListEvent& event );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function OnSelectComponent
|
* Function OnSelectComponent
|
||||||
* Called when clicking on a component in component list window
|
* Called when clicking on a component in component list window
|
||||||
|
@ -96,10 +95,11 @@ public:
|
||||||
void OnQuit( wxCommandEvent& event );
|
void OnQuit( wxCommandEvent& event );
|
||||||
void OnCloseWindow( wxCloseEvent& Event );
|
void OnCloseWindow( wxCloseEvent& Event );
|
||||||
void OnSize( wxSizeEvent& SizeEvent );
|
void OnSize( wxSizeEvent& SizeEvent );
|
||||||
void OnChar( wxKeyEvent& event );
|
|
||||||
void ReCreateHToolbar();
|
void ReCreateHToolbar();
|
||||||
virtual void ReCreateMenuBar();
|
virtual void ReCreateMenuBar();
|
||||||
|
|
||||||
|
void ChangeFocus( bool aMoveRight );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetLanguage
|
* Function SetLanguage
|
||||||
* is called on a language menu selection.
|
* is called on a language menu selection.
|
||||||
|
@ -224,7 +224,15 @@ public:
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DisplayStatus
|
* Function DisplayStatus
|
||||||
* displays info to the status line at bottom of the main frame.
|
* updates the information displayed on the status bar at bottom of the main frame.
|
||||||
|
*
|
||||||
|
* When the library or component list controls have the focus, the footprint assignment
|
||||||
|
* status of the components is displayed in the first status bar pane and the list of
|
||||||
|
* filters for the selected component is displayed in the second status bar pane. When
|
||||||
|
* the footprint list control has the focus, the description of the selected footprint is
|
||||||
|
* displayed in the first status bar pane and the key words for the selected footprint are
|
||||||
|
* displayed in the second status bar pane. The third status bar pane always displays the
|
||||||
|
* current footprint list filtering.
|
||||||
*/
|
*/
|
||||||
void DisplayStatus();
|
void DisplayStatus();
|
||||||
|
|
||||||
|
@ -275,6 +283,8 @@ public:
|
||||||
*/
|
*/
|
||||||
void SendMessageToEESCHEMA();
|
void SendMessageToEESCHEMA();
|
||||||
|
|
||||||
|
COMPONENT* GetSelectedComponent();
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
110
cvpcb/cvstruct.h
110
cvpcb/cvstruct.h
|
@ -29,6 +29,7 @@
|
||||||
#define CVSTRUCT_H
|
#define CVSTRUCT_H
|
||||||
|
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
|
|
||||||
#include <cvpcb.h>
|
#include <cvpcb.h>
|
||||||
|
|
||||||
/* Forward declarations of all top-level window classes. */
|
/* Forward declarations of all top-level window classes. */
|
||||||
|
@ -45,7 +46,7 @@ class ITEMS_LISTBOX_BASE : public wxListView
|
||||||
public:
|
public:
|
||||||
ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
ITEMS_LISTBOX_BASE( CVPCB_MAINFRAME* aParent, wxWindowID aId,
|
||||||
const wxPoint& aLocation, const wxSize& aSize,
|
const wxPoint& aLocation, const wxSize& aSize,
|
||||||
long aStyle = wxLC_SINGLE_SEL);
|
long aStyle = wxLC_SINGLE_SEL );
|
||||||
|
|
||||||
~ITEMS_LISTBOX_BASE();
|
~ITEMS_LISTBOX_BASE();
|
||||||
|
|
||||||
|
@ -55,48 +56,54 @@ public:
|
||||||
virtual CVPCB_MAINFRAME* GetParent();
|
virtual CVPCB_MAINFRAME* GetParent();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
/* ListBox showing the list of footprints */
|
/* ListBox showing the list of footprints */
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
class FOOTPRINTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
class FOOTPRINTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
wxArrayString m_FullFootprintList;
|
wxArrayString m_footprintList;
|
||||||
wxArrayString m_FilteredFootprintList;
|
|
||||||
public:
|
|
||||||
wxArrayString* m_ActiveFootprintList;
|
|
||||||
bool m_UseFootprintFullList;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
enum FP_FILTER_T
|
||||||
|
{
|
||||||
|
UNFILTERED = 0,
|
||||||
|
BY_COMPONENT = 0x0001,
|
||||||
|
BY_PIN_COUNT = 0x0002,
|
||||||
|
BY_LIBRARY = 0x0004,
|
||||||
|
};
|
||||||
|
|
||||||
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
FOOTPRINTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
||||||
const wxPoint& loc, const wxSize& size,
|
const wxPoint& loc, const wxSize& size );
|
||||||
int nbitems, wxString choice[] );
|
|
||||||
~FOOTPRINTS_LISTBOX();
|
~FOOTPRINTS_LISTBOX();
|
||||||
|
|
||||||
int GetCount();
|
int GetCount();
|
||||||
void SetSelection( unsigned index, bool State = true );
|
void SetSelection( unsigned index, bool State = true );
|
||||||
void SetString( unsigned linecount, const wxString& text );
|
void SetString( unsigned linecount, const wxString& text );
|
||||||
void AppendLine( const wxString& text );
|
void AppendLine( const wxString& text );
|
||||||
void SetFootprintFullList( FOOTPRINT_LIST& list );
|
|
||||||
void SetFootprintFilteredList( COMPONENT* aComponent,
|
|
||||||
FOOTPRINT_LIST& aList );
|
|
||||||
void SetFootprintFilteredByPinCount( COMPONENT* aComponent,
|
|
||||||
FOOTPRINT_LIST& aList );
|
|
||||||
void SetFootprintFilteredByLibraryList( FOOTPRINT_LIST& list,
|
|
||||||
wxString SelectedLibrary );
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the footprint list. We can have 2 footprint list:
|
* Function SetFootprints
|
||||||
* The full footprint list
|
* populates the wxListCtrl with the footprints from \a aList that meet the filter
|
||||||
* The filtered footprint list (if the current selected component has a
|
* criteria defined by \a aFilterType.
|
||||||
* filter for footprints)
|
*
|
||||||
* @param FullList true = full footprint list, false = filtered footprint list
|
* @param aList is a #FOOTPRINT_LIST item containing the footprints.
|
||||||
* @param Redraw = true to redraw the window
|
* @param aLibName is wxString containing the name of the selected library. Can be
|
||||||
|
* wxEmptyString.
|
||||||
|
* @param aComponent is the #COMPONENT used by the filtering criteria. Can be NULL.
|
||||||
|
* @param aFilterType defines the criteria to filter \a aList.
|
||||||
*/
|
*/
|
||||||
void SetActiveFootprintList( bool FullList, bool Redraw = false );
|
void SetFootprints( FOOTPRINT_LIST& aList, const wxString& aLibName,
|
||||||
|
COMPONENT* aComponent, int aFilterType );
|
||||||
|
|
||||||
wxString GetSelectedFootprint();
|
wxString GetSelectedFootprint();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnGetItemText
|
||||||
|
* this overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||||
|
* because real data is not handled by ITEMS_LISTBOX_BASE
|
||||||
|
*/
|
||||||
wxString OnGetItemText( long item, long column ) const;
|
wxString OnGetItemText( long item, long column ) const;
|
||||||
|
|
||||||
// Events functions:
|
// Events functions:
|
||||||
|
@ -107,43 +114,54 @@ public:
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/******************************************/
|
/******************************************/
|
||||||
/* ListBox showing the list of library */
|
/* ListBox showing the list of library */
|
||||||
/******************************************/
|
/******************************************/
|
||||||
|
|
||||||
class LIBRARY_LISTBOX : public ITEMS_LISTBOX_BASE
|
class LIBRARY_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||||
{
|
{
|
||||||
//private:
|
wxArrayString m_libraryList;
|
||||||
|
|
||||||
public:
|
|
||||||
wxArrayString m_LibraryList;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
LIBRARY_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
||||||
const wxPoint& loc, const wxSize& size,
|
const wxPoint& loc, const wxSize& size );
|
||||||
int nbitems, wxString choice[] );
|
|
||||||
~LIBRARY_LISTBOX();
|
~LIBRARY_LISTBOX();
|
||||||
|
|
||||||
int GetCount();
|
int GetCount();
|
||||||
void SetSelection( unsigned index, bool State = true );
|
void SetSelection( unsigned index, bool State = true );
|
||||||
void SetString( unsigned linecount, const wxString& text );
|
void SetString( unsigned linecount, const wxString& text );
|
||||||
void AppendLine( const wxString& text );
|
void AppendLine( const wxString& text );
|
||||||
void SetLibraryList( wxArrayString list );
|
void SetLibraryList( const wxArrayString& aList );
|
||||||
|
|
||||||
wxString GetSelectedLibrary();
|
wxString GetSelectedLibrary();
|
||||||
wxString OnGetItemText( long item, long column ) const;
|
wxString OnGetItemText( long item, long column ) const;
|
||||||
|
|
||||||
// Events functions:
|
// Events functions:
|
||||||
void OnLeftClick( wxListEvent& event );
|
void OnLeftClick( wxListEvent& event );
|
||||||
|
|
||||||
|
void OnSelectLibrary( wxListEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 OnChar( wxKeyEvent& event );
|
void OnChar( wxKeyEvent& event );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
/* ListBox showing the list of schematic components */
|
/* ListBox showing the list of schematic components */
|
||||||
/****************************************************/
|
/****************************************************/
|
||||||
|
|
||||||
class COMPONENTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
class COMPONENTS_LISTBOX : public ITEMS_LISTBOX_BASE
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -153,21 +171,45 @@ public:
|
||||||
public:
|
public:
|
||||||
|
|
||||||
COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
COMPONENTS_LISTBOX( CVPCB_MAINFRAME* parent, wxWindowID id,
|
||||||
const wxPoint& loc, const wxSize& size,
|
const wxPoint& loc, const wxSize& size );
|
||||||
int nbitems, wxString choice[] );
|
|
||||||
|
|
||||||
~COMPONENTS_LISTBOX();
|
~COMPONENTS_LISTBOX();
|
||||||
|
|
||||||
void Clear();
|
void Clear();
|
||||||
int GetCount();
|
int GetCount();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnGetItemText
|
||||||
|
* this overloaded function MUST be provided for the wxLC_VIRTUAL mode
|
||||||
|
* because real data is not handled by ITEMS_LISTBOX_BASE
|
||||||
|
*/
|
||||||
wxString OnGetItemText( long item, long column ) const;
|
wxString OnGetItemText( long item, long column ) const;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Enable or disable an item
|
||||||
|
*/
|
||||||
void SetSelection( unsigned index, bool State = true );
|
void SetSelection( unsigned index, bool State = true );
|
||||||
void SetString( unsigned linecount, const wxString& text );
|
void SetString( unsigned linecount, const wxString& text );
|
||||||
void AppendLine( const wxString& text );
|
void AppendLine( const wxString& text );
|
||||||
|
|
||||||
// Events functions:
|
// Events functions:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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 default behavior of a listbox, but because we use
|
||||||
|
* virtual lists, the listbox does not know anything to what is displayed,
|
||||||
|
* we must handle this behavior here.
|
||||||
|
* Furthermore the reference of components is not at the beginning of
|
||||||
|
* displayed lines (the first word is the line number)
|
||||||
|
*/
|
||||||
void OnChar( wxKeyEvent& event );
|
void OnChar( wxKeyEvent& event );
|
||||||
|
|
||||||
|
void OnSelectComponent( wxListEvent& event );
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -83,90 +83,3 @@ CVPCB_MAINFRAME* ITEMS_LISTBOX_BASE::GetParent()
|
||||||
{
|
{
|
||||||
return (CVPCB_MAINFRAME*) wxListView::GetParent();
|
return (CVPCB_MAINFRAME*) wxListView::GetParent();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create or update the schematic components list.
|
|
||||||
*/
|
|
||||||
void CVPCB_MAINFRAME::BuildCmpListBox()
|
|
||||||
{
|
|
||||||
COMPONENT* component;
|
|
||||||
wxString msg;
|
|
||||||
wxSize size( 10, 10 );
|
|
||||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
||||||
|
|
||||||
if( m_ListCmp == NULL )
|
|
||||||
{
|
|
||||||
m_ListCmp = new COMPONENTS_LISTBOX( this, ID_CVPCB_COMPONENT_LIST,
|
|
||||||
wxDefaultPosition, size,
|
|
||||||
0, NULL );
|
|
||||||
m_ListCmp->SetFont( wxFont( guiFont.GetPointSize(),
|
|
||||||
wxFONTFAMILY_MODERN,
|
|
||||||
wxFONTSTYLE_NORMAL,
|
|
||||||
wxFONTWEIGHT_NORMAL ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ListCmp->m_ComponentList.Clear();
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < m_netlist.GetCount(); i++ )
|
|
||||||
{
|
|
||||||
component = m_netlist.GetComponent( i );
|
|
||||||
|
|
||||||
msg.Printf( CMP_FORMAT, m_ListCmp->GetCount() + 1,
|
|
||||||
GetChars( component->GetReference() ),
|
|
||||||
GetChars( component->GetValue() ),
|
|
||||||
GetChars( component->GetFootprintName() ) );
|
|
||||||
m_ListCmp->m_ComponentList.Add( msg );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_ListCmp->SetItemCount( m_ListCmp->m_ComponentList.Count() );
|
|
||||||
m_ListCmp->SetSelection( 0, true );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create or update the footprint list.
|
|
||||||
*/
|
|
||||||
void CVPCB_MAINFRAME::BuildFOOTPRINTS_LISTBOX()
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
wxSize size( 10, 10 );
|
|
||||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
||||||
|
|
||||||
if( m_FootprintList == NULL )
|
|
||||||
{
|
|
||||||
m_FootprintList = new FOOTPRINTS_LISTBOX( this, ID_CVPCB_FOOTPRINT_LIST,
|
|
||||||
wxDefaultPosition, size,
|
|
||||||
0, NULL );
|
|
||||||
m_FootprintList->SetFont( wxFont( guiFont.GetPointSize(),
|
|
||||||
wxFONTFAMILY_MODERN,
|
|
||||||
wxFONTSTYLE_NORMAL,
|
|
||||||
wxFONTWEIGHT_NORMAL ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_FootprintList->SetFootprintFullList( m_footprints );
|
|
||||||
DisplayStatus();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Create or update the library list.
|
|
||||||
*/
|
|
||||||
void CVPCB_MAINFRAME::BuildLIBRARY_LISTBOX()
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
wxSize size( 10, 10 );
|
|
||||||
wxFont guiFont = wxSystemSettings::GetFont( wxSYS_DEFAULT_GUI_FONT );
|
|
||||||
|
|
||||||
if( m_LibraryList == NULL )
|
|
||||||
{
|
|
||||||
m_LibraryList = new LIBRARY_LISTBOX( this, ID_CVPCB_LIBRARY_LIST,
|
|
||||||
wxDefaultPosition, size,
|
|
||||||
0 , NULL );
|
|
||||||
m_LibraryList->SetFont( wxFont( guiFont.GetPointSize(),
|
|
||||||
wxFONTFAMILY_MODERN,
|
|
||||||
wxFONTSTYLE_NORMAL,
|
|
||||||
wxFONTWEIGHT_NORMAL ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
m_LibraryList->SetLibraryList( m_ModuleLibNames );
|
|
||||||
}
|
|
||||||
|
|
|
@ -94,36 +94,30 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||||
KiBitmap( module_filtered_list_xpm ),
|
KiBitmap( module_filtered_list_xpm ),
|
||||||
wxNullBitmap,
|
wxNullBitmap,
|
||||||
true, NULL,
|
true, NULL,
|
||||||
_( "Display the filtered footprint list for the current component" ),
|
_( "Filter the footprint list for the current component key words" ),
|
||||||
wxEmptyString );
|
wxEmptyString );
|
||||||
|
|
||||||
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
||||||
KiBitmap( module_pin_filtered_list_xpm ),
|
KiBitmap( module_pin_filtered_list_xpm ),
|
||||||
wxNullBitmap,
|
wxNullBitmap,
|
||||||
true, NULL,
|
true, NULL,
|
||||||
_( "Display the filtered footprint list by pin count for the current component" ),
|
_( "Filter the footprint list by pin count for the current component" ),
|
||||||
wxEmptyString );
|
wxEmptyString );
|
||||||
|
|
||||||
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST,
|
||||||
KiBitmap( module_library_list_xpm ),
|
KiBitmap( module_library_list_xpm ),
|
||||||
wxNullBitmap, true, NULL,
|
wxNullBitmap, true, NULL,
|
||||||
_( "Display the footprint list from selected library" ),
|
_( "Filter the footprint list by the selected library" ),
|
||||||
wxEmptyString );
|
|
||||||
|
|
||||||
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST,
|
|
||||||
KiBitmap( module_full_list_xpm ),
|
|
||||||
wxNullBitmap, true, NULL,
|
|
||||||
_( "Display the full footprint list (without filtering)" ),
|
|
||||||
wxEmptyString );
|
wxEmptyString );
|
||||||
|
|
||||||
if( config )
|
if( config )
|
||||||
{
|
{
|
||||||
wxString key = wxT( FILTERFOOTPRINTKEY );
|
wxString key = wxT( FILTERFOOTPRINTKEY );
|
||||||
int opt = config->Read( key, (long) 1 );
|
int opt = config->Read( key, (long) 1 );
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt == 3 );
|
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt == 2 );
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_BY_LIBRARY_LIST, opt & 4 );
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt == 1 );
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST, opt & 2 );
|
||||||
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FULL_LIST, opt == 0 );
|
m_mainToolBar->ToggleTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST, opt & 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
// after adding the buttons to the toolbar, must call Realize() to reflect the changes
|
||||||
|
|
|
@ -1,188 +0,0 @@
|
||||||
/**
|
|
||||||
* @file BOM_lister.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras jp.charras at wanadoo.fr
|
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _BOM_LISTER_H_
|
|
||||||
#define _BOM_LISTER_H_
|
|
||||||
|
|
||||||
#include <netlist.h>
|
|
||||||
|
|
||||||
|
|
||||||
// A helper class to build item lists for BOM,
|
|
||||||
// and write lists on files
|
|
||||||
class BOM_LISTER
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
BOM_LABEL_LIST m_labelList; // a list of global and hierarchical labels
|
|
||||||
SCH_REFERENCE_LIST m_cmplist; // a flat list of components in the full hierarchy
|
|
||||||
FILE* m_outFile; // the output file for BOM generation
|
|
||||||
char m_separatorSymbol; // the separator used for csv files ( usually \t ; or , )
|
|
||||||
bool m_outputFmtCsv; // true to create Csv files, false to create text lists
|
|
||||||
bool m_includeSubComponents; // true to list each part
|
|
||||||
// of a multiple part per package component
|
|
||||||
// false to list only once this kind of component
|
|
||||||
bool m_csvForm; // true to print less verbose component list
|
|
||||||
// false to print more verbose component list
|
|
||||||
bool m_groupReferences; // true to group in list by reference (when possible,
|
|
||||||
// i.e. when other fields have the same value
|
|
||||||
// false to list one reference per line
|
|
||||||
bool m_printLocation; // true to print component location in list by reference
|
|
||||||
std::vector <int> m_fieldIDactive; // list of field IDs to print
|
|
||||||
|
|
||||||
public:
|
|
||||||
BOM_LISTER()
|
|
||||||
{
|
|
||||||
m_outFile = NULL;
|
|
||||||
m_separatorSymbol = '\t';
|
|
||||||
m_outputFmtCsv = false;
|
|
||||||
m_includeSubComponents = false;
|
|
||||||
m_csvForm = true;
|
|
||||||
m_printLocation = false;
|
|
||||||
m_groupReferences = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Accessors:
|
|
||||||
void SetGroupReferences( bool aGroupRef )
|
|
||||||
{
|
|
||||||
m_groupReferences = aGroupRef;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetPrintLocation( bool aPrintLoc )
|
|
||||||
{
|
|
||||||
m_printLocation = aPrintLoc;
|
|
||||||
}
|
|
||||||
|
|
||||||
void SetIncludeSubCmp( bool aIncludeSubCmp )
|
|
||||||
{
|
|
||||||
m_includeSubComponents = aIncludeSubCmp;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetCvsFormOn
|
|
||||||
* prepare parameters to create a BOM list in comma separated value (cvs)
|
|
||||||
* @param aSeparator = the character used as "csv" separator
|
|
||||||
*/
|
|
||||||
void SetCvsFormOn( char aSeparator )
|
|
||||||
{
|
|
||||||
m_csvForm = true;
|
|
||||||
m_separatorSymbol = aSeparator;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SetCvsFormOff
|
|
||||||
* prepare parameters to create a BOM list in full text readable mode
|
|
||||||
* (not csv format)
|
|
||||||
*/
|
|
||||||
void SetCvsFormOff()
|
|
||||||
{
|
|
||||||
m_csvForm = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void AddFieldIdToPrintList( int aFieldId );
|
|
||||||
|
|
||||||
void ClearFieldIdPrintList() { m_fieldIDactive.clear(); }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CreateCsvBOMListByValues
|
|
||||||
* print the list of components, grouped by values:
|
|
||||||
* One line by value. The format is something like:
|
|
||||||
* value;quantity;references;other fields
|
|
||||||
* 18pF;2;"C404 C405";SM0402
|
|
||||||
* 22nF/25V;4;"C128 C168 C228 C268";SM0402
|
|
||||||
* @param aFile = the file to write to (will be closed)
|
|
||||||
*/
|
|
||||||
void CreateCsvBOMListByValues( FILE* aFile );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function PrintGlobalAndHierarchicalLabelsList
|
|
||||||
* print the list of global and hierarchical labels by sheet or by name
|
|
||||||
* @param aSortBySheet = true to print by sheet name order
|
|
||||||
* false to print by label name order
|
|
||||||
* @param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
void PrintGlobalAndHierarchicalLabelsList( FILE* aFile, bool aSortBySheet );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function PrintComponentsListByReferenceHumanReadable
|
|
||||||
* print a BOM list in human readable form
|
|
||||||
* @param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
bool PrintComponentsListByReferenceHumanReadable( FILE* aFile );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function PrintComponentsListByReferenceCsvForm
|
|
||||||
* print the list of components ordered by references. Generate 2 formats:
|
|
||||||
* - full component list in csv form
|
|
||||||
* - "short" component list in csv form, grouped by common fields values
|
|
||||||
* (mainly component value)
|
|
||||||
* @param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
bool PrintComponentsListByReferenceCsvForm( FILE* aFile );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function PrintComponentsListByValue
|
|
||||||
* print the list of components, sorted by value, one line per component
|
|
||||||
* not useable for csv format (use CreateCsvBOMListByValues instead)
|
|
||||||
* @param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
int PrintComponentsListByValue( FILE* aFile );
|
|
||||||
|
|
||||||
private:
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function isFieldPrintable
|
|
||||||
* @return true if the field aFieldId should be printed.
|
|
||||||
* @param aFieldId = the field Id (FOOTPRIN, FIELD4 ...)
|
|
||||||
*/
|
|
||||||
bool isFieldPrintable( int aFieldId );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function buildGlobalAndHierarchicalLabelsList
|
|
||||||
* Populate m_labelList with global and hierarchical labels
|
|
||||||
* and sheet pins labels
|
|
||||||
*/
|
|
||||||
void buildGlobalAndHierarchicalLabelsList();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function returnFieldsString
|
|
||||||
* @return a string containing all selected fields texts,
|
|
||||||
* @param aComponent = the schematic component
|
|
||||||
* separated by the csv separator symbol
|
|
||||||
*/
|
|
||||||
const wxString returnFieldsString( SCH_COMPONENT* aComponent );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper function returnURLItemLocation
|
|
||||||
* @param aPathName = the full sheet name of item
|
|
||||||
* @param aPosition = a position (in internal units) to print
|
|
||||||
* @return a formated string to print the full location:
|
|
||||||
* /sheet name/( X Y position)
|
|
||||||
*/
|
|
||||||
const wxString returnURLItemLocation( const wxString& aPathName,
|
|
||||||
wxPoint aPosition );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _BOM_LISTER_H_
|
|
|
@ -12,8 +12,11 @@ include_directories(
|
||||||
|
|
||||||
set(EESCHEMA_DLGS
|
set(EESCHEMA_DLGS
|
||||||
dialogs/dialog_color_config.cpp
|
dialogs/dialog_color_config.cpp
|
||||||
dialogs/annotate_dialog.cpp
|
dialogs/dialog_annotate.cpp
|
||||||
dialogs/dialog_annotate_base.cpp
|
dialogs/dialog_annotate_base.cpp
|
||||||
|
dialogs/dialog_bom.cpp
|
||||||
|
dialogs/dialog_bom_base.cpp
|
||||||
|
dialogs/dialog_bom_cfg_keywords.cpp
|
||||||
dialogs/dialog_lib_edit_text.cpp
|
dialogs/dialog_lib_edit_text.cpp
|
||||||
dialogs/dialog_lib_edit_text_base.cpp
|
dialogs/dialog_lib_edit_text_base.cpp
|
||||||
dialogs/dialog_edit_component_in_lib.cpp
|
dialogs/dialog_edit_component_in_lib.cpp
|
||||||
|
@ -203,6 +206,33 @@ make_lexer(
|
||||||
template_fieldnames.h
|
template_fieldnames.h
|
||||||
)
|
)
|
||||||
|
|
||||||
|
make_lexer(
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_cfg.keywords
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_cfg_lexer.h
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_cfg_keywords.cpp
|
||||||
|
T_BOMCFG_T
|
||||||
|
|
||||||
|
# Pass header file with dependency on *_lexer.h as extra_arg
|
||||||
|
/dialogs/dialog_bom_cfg.h
|
||||||
|
)
|
||||||
|
|
||||||
|
# Create a C++ compilable string initializer containing html text into a *.h file:
|
||||||
|
add_custom_command(
|
||||||
|
OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
|
||||||
|
COMMAND ${CMAKE_COMMAND}
|
||||||
|
-DinputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html
|
||||||
|
-DoutputFile=${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
|
||||||
|
-P ${CMAKE_MODULE_PATH}/Html2C.cmake
|
||||||
|
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html
|
||||||
|
COMMENT "creating ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
|
||||||
|
from ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help.html"
|
||||||
|
)
|
||||||
|
|
||||||
|
set_source_files_properties( dialogs/dialog_bom.cpp
|
||||||
|
PROPERTIES
|
||||||
|
OBJECT_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/dialogs/dialog_bom_help_html.h
|
||||||
|
)
|
||||||
|
|
||||||
add_executable(eeschema WIN32 MACOSX_BUNDLE
|
add_executable(eeschema WIN32 MACOSX_BUNDLE
|
||||||
${EESCHEMA_SRCS}
|
${EESCHEMA_SRCS}
|
||||||
${EESCHEMA_COMMON_SRCS}
|
${EESCHEMA_COMMON_SRCS}
|
||||||
|
|
|
@ -3,6 +3,29 @@
|
||||||
* @brief Component annotation.
|
* @brief Component annotation.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2004-2013 KiCad Developers, see change_log.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <algorithm> // to use sort vector
|
#include <algorithm> // to use sort vector
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
@ -13,7 +36,6 @@
|
||||||
|
|
||||||
#include <netlist.h>
|
#include <netlist.h>
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <protos.h>
|
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
|
|
||||||
|
|
|
@ -1,736 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
||||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
|
|
||||||
* 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 build_BOM.cpp
|
|
||||||
* @brief Code used to generate bill of materials.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <algorithm> // to use sort vector
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <sch_sheet.h>
|
|
||||||
#include <sch_component.h>
|
|
||||||
#include <template_fieldnames.h>
|
|
||||||
#include <class_library.h>
|
|
||||||
#include <base_units.h>
|
|
||||||
|
|
||||||
#include <BOM_lister.h>
|
|
||||||
|
|
||||||
/* Creates the list of components, grouped by values:
|
|
||||||
* One line by value. The format is something like:
|
|
||||||
* value;quantity;references;other fields
|
|
||||||
* 18pF;2;"C404 C405";SM0402
|
|
||||||
* 22nF/25V;4;"C128 C168 C228 C268";SM0402
|
|
||||||
* param aFile = the file to write to (will be closed)
|
|
||||||
*/
|
|
||||||
void BOM_LISTER::CreateCsvBOMListByValues( FILE* aFile )
|
|
||||||
{
|
|
||||||
m_outFile = aFile;
|
|
||||||
|
|
||||||
SCH_SHEET_LIST sheetList;
|
|
||||||
|
|
||||||
sheetList.GetComponents( m_cmplist, false );
|
|
||||||
|
|
||||||
// sort component list by ref and remove sub components
|
|
||||||
m_cmplist.RemoveSubComponentsFromList();
|
|
||||||
|
|
||||||
// sort component list by value
|
|
||||||
m_cmplist.SortByValueOnly();
|
|
||||||
|
|
||||||
unsigned int index = 0;
|
|
||||||
|
|
||||||
while( index < m_cmplist.GetCount() )
|
|
||||||
{
|
|
||||||
SCH_COMPONENT* component = m_cmplist[index].GetComponent();
|
|
||||||
wxString referenceListStr;
|
|
||||||
int qty = 1;
|
|
||||||
referenceListStr.append( m_cmplist[index].GetRef() );
|
|
||||||
|
|
||||||
for( unsigned int ii = index + 1; ii < m_cmplist.GetCount(); )
|
|
||||||
{
|
|
||||||
if( *( m_cmplist[ii].GetComponent() ) == *component )
|
|
||||||
{
|
|
||||||
referenceListStr.append( wxT( " " ) + m_cmplist[ii].GetRef() );
|
|
||||||
m_cmplist.RemoveItem( ii );
|
|
||||||
qty++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
ii++; // Increment index only when current item is not removed from the list
|
|
||||||
}
|
|
||||||
|
|
||||||
// Write value, quantity and list of references
|
|
||||||
fprintf( m_outFile, "%s%c%d%c\"%s\"",
|
|
||||||
TO_UTF8( component->GetField( VALUE )->GetText() ),
|
|
||||||
m_separatorSymbol, qty,
|
|
||||||
m_separatorSymbol, TO_UTF8( referenceListStr ) );
|
|
||||||
|
|
||||||
for( int ii = FOOTPRINT; ii < component->GetFieldCount(); ii++ )
|
|
||||||
{
|
|
||||||
if( isFieldPrintable( ii ) )
|
|
||||||
fprintf( m_outFile, "%c%s", m_separatorSymbol,
|
|
||||||
TO_UTF8( component->GetField( ii )->GetText() ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf( m_outFile, "\n" );
|
|
||||||
index++;
|
|
||||||
}
|
|
||||||
|
|
||||||
fclose( m_outFile );
|
|
||||||
m_outFile = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool BOM_LISTER::isFieldPrintable( int aFieldId )
|
|
||||||
{
|
|
||||||
for( unsigned ii = 0; ii < m_fieldIDactive.size(); ii++ )
|
|
||||||
if( m_fieldIDactive[ii] == aFieldId )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void BOM_LISTER::AddFieldIdToPrintList( int aFieldId )
|
|
||||||
{
|
|
||||||
for( unsigned ii = 0; ii < m_fieldIDactive.size(); ii++ )
|
|
||||||
if( m_fieldIDactive[ii] == aFieldId )
|
|
||||||
return;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
m_fieldIDactive.push_back( aFieldId );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* compare function for sorting labels by value, then by sheet
|
|
||||||
*/
|
|
||||||
static bool SortLabelsByValue( const BOM_LABEL& obj1, const BOM_LABEL& obj2 )
|
|
||||||
{
|
|
||||||
int ii = obj1.GetText().CmpNoCase( obj2.GetText() );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
|
|
||||||
|
|
||||||
return ii < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* compare function for sorting labels by sheet, then by alphabetic order
|
|
||||||
*/
|
|
||||||
static bool SortLabelsBySheet( const BOM_LABEL& obj1, const BOM_LABEL& obj2 )
|
|
||||||
{
|
|
||||||
int ii = obj1.GetSheetPath().Cmp( obj2.GetSheetPath() );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = obj1.GetText().CmpNoCase( obj2.GetText() );
|
|
||||||
|
|
||||||
return ii < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Creates the flat list of global, hierachycal labels and pin sheets
|
|
||||||
// and populate m_labelList
|
|
||||||
void BOM_LISTER::buildGlobalAndHierarchicalLabelsList()
|
|
||||||
{
|
|
||||||
m_labelList.clear();
|
|
||||||
|
|
||||||
// Explore the flat sheet list
|
|
||||||
SCH_SHEET_LIST sheetList;
|
|
||||||
|
|
||||||
for( SCH_SHEET_PATH* path = sheetList.GetFirst(); path; path = sheetList.GetNext() )
|
|
||||||
{
|
|
||||||
SCH_ITEM* schItem = (SCH_ITEM*) path->LastDrawList();
|
|
||||||
|
|
||||||
for( ; schItem; schItem = schItem->Next() )
|
|
||||||
{
|
|
||||||
switch( schItem->Type() )
|
|
||||||
{
|
|
||||||
case SCH_HIERARCHICAL_LABEL_T:
|
|
||||||
case SCH_GLOBAL_LABEL_T:
|
|
||||||
m_labelList.push_back( BOM_LABEL( schItem->Type(), schItem, *path ) );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_SHEET_T:
|
|
||||||
{
|
|
||||||
SCH_SHEET* sheet = (SCH_SHEET*) schItem;
|
|
||||||
|
|
||||||
BOOST_FOREACH( SCH_SHEET_PIN & sheetPin, sheet->GetPins() ) {
|
|
||||||
m_labelList.push_back( BOM_LABEL( SCH_SHEET_PIN_T,
|
|
||||||
&sheetPin, *path ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Print the flat list of global, hierachycal labels and pin sheets
|
|
||||||
// contained by m_labelList
|
|
||||||
void BOM_LISTER::PrintGlobalAndHierarchicalLabelsList( FILE* aFile, bool aSortBySheet )
|
|
||||||
{
|
|
||||||
m_outFile = aFile;
|
|
||||||
|
|
||||||
buildGlobalAndHierarchicalLabelsList();
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( aSortBySheet )
|
|
||||||
{
|
|
||||||
sort( m_labelList.begin(), m_labelList.end(), SortLabelsBySheet );
|
|
||||||
msg.Printf( _(
|
|
||||||
"\n#Global, Hierarchical Labels and PinSheets \
|
|
||||||
( order = Sheet Number ) count = %d\n" ),
|
|
||||||
m_labelList.size() );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
sort( m_labelList.begin(), m_labelList.end(), SortLabelsByValue );
|
|
||||||
msg.Printf( _(
|
|
||||||
"\n#Global, Hierarchical Labels and PinSheets ( \
|
|
||||||
order = Alphab. ) count = %d\n\n" ),
|
|
||||||
m_labelList.size() );
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%s", TO_UTF8( msg ) );
|
|
||||||
|
|
||||||
SCH_LABEL* label;
|
|
||||||
SCH_SHEET_PIN* pinsheet;
|
|
||||||
wxString sheetpath;
|
|
||||||
wxString labeltype;
|
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_labelList.size(); ii++ )
|
|
||||||
{
|
|
||||||
switch( m_labelList[ii].GetType() )
|
|
||||||
{
|
|
||||||
case SCH_HIERARCHICAL_LABEL_T:
|
|
||||||
case SCH_GLOBAL_LABEL_T:
|
|
||||||
label = (SCH_LABEL*) ( m_labelList[ii].GetLabel() );
|
|
||||||
|
|
||||||
if( m_labelList[ii].GetType() == SCH_HIERARCHICAL_LABEL_T )
|
|
||||||
labeltype = wxT( "Hierarchical" );
|
|
||||||
else
|
|
||||||
labeltype = wxT( "Global " );
|
|
||||||
|
|
||||||
sheetpath = m_labelList[ii].GetSheetPath().PathHumanReadable();
|
|
||||||
msg.Printf( wxT( "> %-28.28s %s %s\n" ),
|
|
||||||
GetChars( label->GetText() ),
|
|
||||||
GetChars( labeltype ),
|
|
||||||
GetChars( returnURLItemLocation( sheetpath, label->GetPosition() ) ) );
|
|
||||||
|
|
||||||
fputs( TO_UTF8( msg ), m_outFile );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case SCH_SHEET_PIN_T:
|
|
||||||
pinsheet = (SCH_SHEET_PIN*) m_labelList[ii].GetLabel();
|
|
||||||
labeltype = FROM_UTF8( SheetLabelType[pinsheet->GetShape()] );
|
|
||||||
|
|
||||||
msg.Printf( _( "> %-28.28s PinSheet %-7.7s %s\n" ),
|
|
||||||
GetChars( pinsheet->GetText() ),
|
|
||||||
GetChars( labeltype ),
|
|
||||||
GetChars( returnURLItemLocation( m_labelList[ii].GetSheetPath().
|
|
||||||
PathHumanReadable(),
|
|
||||||
pinsheet->GetPosition() ) ) );
|
|
||||||
|
|
||||||
fputs( TO_UTF8( msg ), m_outFile );
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = _( "#End labels\n" );
|
|
||||||
fputs( TO_UTF8( msg ), m_outFile );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function
|
|
||||||
* returns a string containing all selected fields texts,
|
|
||||||
* separated by the csv separator symbol (csv form) or a ;
|
|
||||||
*/
|
|
||||||
const wxString BOM_LISTER::returnFieldsString( SCH_COMPONENT* aComponent )
|
|
||||||
{
|
|
||||||
wxString outStr;
|
|
||||||
wxString tmpStr;
|
|
||||||
wxString text;
|
|
||||||
|
|
||||||
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
|
|
||||||
{
|
|
||||||
if( !isFieldPrintable( ii ) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( aComponent->GetFieldCount() > ii )
|
|
||||||
text = aComponent->GetField( ii )->GetText();
|
|
||||||
else
|
|
||||||
text = wxEmptyString;
|
|
||||||
|
|
||||||
if( m_csvForm )
|
|
||||||
tmpStr.Printf( wxT( "%c%s" ), m_separatorSymbol, GetChars( text ) );
|
|
||||||
else
|
|
||||||
tmpStr.Printf( wxT( "; %-12s" ), GetChars( text ) );
|
|
||||||
|
|
||||||
outStr += tmpStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
return outStr;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* print the list of components ordered by references,
|
|
||||||
* full component list in human readable form
|
|
||||||
* param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* full list in human readable form sample:
|
|
||||||
* #Cmp ( order = Reference )with sub-composants
|
|
||||||
* | C101 47pF Loc /(X=344,170 mm, Y=116,840 mm); C1 ; field1 ;
|
|
||||||
* | C102 47pF Loc /(X=364,490 mm, Y=116,840 mm); C1 ; ;
|
|
||||||
* | C103 47uF Loc /(X=66,040 mm, Y=231,140 mm); CP6 ; ;
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool BOM_LISTER::PrintComponentsListByReferenceHumanReadable( FILE* aFile )
|
|
||||||
{
|
|
||||||
m_outFile = aFile;
|
|
||||||
bool addDatasheet = isFieldPrintable( DATASHEET );
|
|
||||||
|
|
||||||
// Print component location if needed, but only when
|
|
||||||
// include sub component option is enabled, because for multiple
|
|
||||||
// parts per package there are more than one location per reference
|
|
||||||
bool printLocCmp = m_printLocation && m_includeSubComponents;
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( m_cmplist.GetCount() == 0 ) // Build component list
|
|
||||||
{
|
|
||||||
SCH_SHEET_LIST sheetList;
|
|
||||||
sheetList.GetComponents( m_cmplist, false );
|
|
||||||
|
|
||||||
// sort component list
|
|
||||||
m_cmplist.SortByReferenceOnly();
|
|
||||||
|
|
||||||
if( !m_includeSubComponents )
|
|
||||||
m_cmplist.RemoveSubComponentsFromList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_cmplist.SortByReferenceOnly();
|
|
||||||
|
|
||||||
// Print comment line:
|
|
||||||
msg = _( "#Cmp ( order = Reference )" );
|
|
||||||
|
|
||||||
if( m_includeSubComponents )
|
|
||||||
msg << _( " (with SubCmp)" );
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( msg ) );
|
|
||||||
|
|
||||||
wxString subReference; // Unit ident, for mutiple parts per package
|
|
||||||
std::string CmpName;
|
|
||||||
|
|
||||||
// Print list of items
|
|
||||||
for( unsigned ii = 0; ii < m_cmplist.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
EDA_ITEM* item = m_cmplist[ii].GetComponent();
|
|
||||||
|
|
||||||
if( item == NULL )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( item->Type() != SCH_COMPONENT_T )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
|
|
||||||
|
|
||||||
bool isMulti = false;
|
|
||||||
|
|
||||||
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
|
|
||||||
|
|
||||||
if( entry )
|
|
||||||
isMulti = entry->IsMulti();
|
|
||||||
|
|
||||||
CmpName = m_cmplist[ii].GetRefStr();
|
|
||||||
|
|
||||||
if( isMulti && m_includeSubComponents )
|
|
||||||
{
|
|
||||||
subReference = LIB_COMPONENT::ReturnSubReference( m_cmplist[ii].GetUnit() );
|
|
||||||
CmpName += TO_UTF8( subReference );
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf( m_outFile, "| %-10s %-12s", CmpName.c_str(),
|
|
||||||
TO_UTF8( comp->GetField( VALUE )->GetText() ) );
|
|
||||||
|
|
||||||
if( addDatasheet )
|
|
||||||
fprintf( m_outFile, "%-20s",
|
|
||||||
TO_UTF8( comp->GetField( DATASHEET )->GetText() ) );
|
|
||||||
|
|
||||||
if( m_includeSubComponents )
|
|
||||||
{
|
|
||||||
if( printLocCmp )
|
|
||||||
{
|
|
||||||
msg = returnURLItemLocation( m_cmplist[ii].GetSheetPath().PathHumanReadable(),
|
|
||||||
comp->GetPosition() );
|
|
||||||
fprintf( m_outFile, "%s", TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
wxString tmpStr = returnFieldsString( comp );
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( tmpStr ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the last line:
|
|
||||||
fputs( "#End Cmp\n", m_outFile );
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* print the list of components ordered by references. Generate 2 formats:
|
|
||||||
* - full component list in csv form
|
|
||||||
* - "short" component list in csv form, grouped by common fields values
|
|
||||||
* (mainly component value)
|
|
||||||
* param aFile = the file to write to (will be NOT closed)
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* full csv format sample:
|
|
||||||
* ref;value;sheet path(location);footprint;field1;field2
|
|
||||||
* C101;47pF;Loc /(X=57,150 mm, Y=74,930 mm);Loc /(X=344,170 mm, Y=116,840 mm));C1;field1;
|
|
||||||
* C102;47pF;Loc /(X=344,170 mm, Y=116,840 mm);Loc /(X=364,490 mm, Y=116,840 mm));C1;;
|
|
||||||
* C103;47uF;Loc /(X=364,490 mm, Y=116,840 mm);Loc /(X=66,040 mm, Y=231,140 mm));CP6;;
|
|
||||||
* C104;47uF;Loc /(X=66,040 mm, Y=231,140 mm);Loc /(X=82,550 mm, Y=231,140 mm));CP6;;
|
|
||||||
*/
|
|
||||||
/* short csv format sample:
|
|
||||||
* ref;value;footprint;Champ1;Champ2
|
|
||||||
* C101;47pF;C1;field1;;1
|
|
||||||
* C102;47pF;C1;;;1
|
|
||||||
* C103..C106;47uF;CP6;;;4
|
|
||||||
*/
|
|
||||||
|
|
||||||
bool BOM_LISTER::PrintComponentsListByReferenceCsvForm( FILE* aFile )
|
|
||||||
{
|
|
||||||
m_outFile = aFile;
|
|
||||||
bool addDatasheet = isFieldPrintable( DATASHEET );
|
|
||||||
|
|
||||||
// Set option group references, for components having same field values
|
|
||||||
// (same value, same footprint ...)
|
|
||||||
// obviously, this is possible only when print location
|
|
||||||
// and include Sub Components are not enabled.
|
|
||||||
bool groupRefs = m_groupReferences;
|
|
||||||
bool includeSubComponents = m_includeSubComponents && !groupRefs;
|
|
||||||
|
|
||||||
// Print component location if needed, but only when
|
|
||||||
// include sub component option is enabled, because for multiple
|
|
||||||
// parts per package there are more than one location per reference
|
|
||||||
bool printLocCmp = m_printLocation && !groupRefs && m_includeSubComponents;
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( m_cmplist.GetCount() == 0 ) // Build component list
|
|
||||||
{
|
|
||||||
SCH_SHEET_LIST sheetList;
|
|
||||||
sheetList.GetComponents( m_cmplist, false );
|
|
||||||
|
|
||||||
// sort component list
|
|
||||||
m_cmplist.SortByReferenceOnly();
|
|
||||||
|
|
||||||
if( !includeSubComponents )
|
|
||||||
m_cmplist.RemoveSubComponentsFromList();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
m_cmplist.SortByReferenceOnly();
|
|
||||||
|
|
||||||
// Print comment line:
|
|
||||||
msg = wxT( "ref" );
|
|
||||||
msg << (wxChar)m_separatorSymbol << wxT( "value" );
|
|
||||||
|
|
||||||
if( addDatasheet )
|
|
||||||
msg << (wxChar)m_separatorSymbol << wxT( "datasheet" );
|
|
||||||
|
|
||||||
if( printLocCmp )
|
|
||||||
msg << (wxChar)m_separatorSymbol << wxT( "sheet path(location)" );
|
|
||||||
|
|
||||||
if( isFieldPrintable( FOOTPRINT ) )
|
|
||||||
msg << (wxChar)m_separatorSymbol << wxT( "footprint" );
|
|
||||||
|
|
||||||
for( int ii = FIELD1; ii <= FIELD8; ii++ )
|
|
||||||
{
|
|
||||||
if( isFieldPrintable( ii ) )
|
|
||||||
msg << (wxChar)m_separatorSymbol << _( "Field" ) << ii - FIELD1 + 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( groupRefs )
|
|
||||||
msg << (wxChar)m_separatorSymbol << _( "Item count" );
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( msg ) );
|
|
||||||
|
|
||||||
// Print BOM list
|
|
||||||
wxString strCur;
|
|
||||||
wxString strPred;
|
|
||||||
int amount = 0; // number of items, on the same line
|
|
||||||
wxString cmpName;
|
|
||||||
wxString cmpNameFirst;
|
|
||||||
wxString cmpNameLast;
|
|
||||||
|
|
||||||
// Print list of items, by reference
|
|
||||||
for( unsigned ii = 0; ii < m_cmplist.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
EDA_ITEM* item = m_cmplist[ii].GetComponent();
|
|
||||||
|
|
||||||
if( item == NULL )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( item->Type() != SCH_COMPONENT_T )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SCH_COMPONENT* comp = (SCH_COMPONENT*) item;
|
|
||||||
|
|
||||||
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( comp->GetLibName() );
|
|
||||||
|
|
||||||
bool isMulti = false;
|
|
||||||
|
|
||||||
if( entry )
|
|
||||||
isMulti = entry->IsMulti();
|
|
||||||
|
|
||||||
cmpName = m_cmplist[ii].GetRef();
|
|
||||||
|
|
||||||
if( isMulti && includeSubComponents )
|
|
||||||
// Add unit ident, for mutiple parts per package
|
|
||||||
cmpName += LIB_COMPONENT::ReturnSubReference( m_cmplist[ii].GetUnit() );
|
|
||||||
|
|
||||||
if( groupRefs )
|
|
||||||
{
|
|
||||||
// Store value and datasheet (will be printed later)
|
|
||||||
strCur.Empty();
|
|
||||||
strCur << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->GetText();
|
|
||||||
|
|
||||||
if( addDatasheet )
|
|
||||||
strCur << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->GetText();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// Print the current component reference, value and datasheet
|
|
||||||
msg = cmpName;
|
|
||||||
msg << (wxChar)m_separatorSymbol << comp->GetField( VALUE )->GetText();
|
|
||||||
|
|
||||||
if( addDatasheet )
|
|
||||||
msg << (wxChar)m_separatorSymbol << comp->GetField( DATASHEET )->GetText();
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%s", TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( printLocCmp ) // Is allowed only for full list (not grouped)
|
|
||||||
{
|
|
||||||
msg = returnURLItemLocation(
|
|
||||||
m_cmplist[ii].GetSheetPath().PathHumanReadable(),
|
|
||||||
comp->GetPosition() );
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%c%s", m_separatorSymbol, TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
if( groupRefs )
|
|
||||||
{
|
|
||||||
wxString tmpStr = returnFieldsString( comp );
|
|
||||||
strCur += tmpStr;
|
|
||||||
|
|
||||||
if( strPred.Len() == 0 )
|
|
||||||
cmpNameFirst = cmpName;
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// print a BOM line
|
|
||||||
msg.Empty();
|
|
||||||
if( !strCur.IsSameAs( strPred ) )
|
|
||||||
{
|
|
||||||
switch( amount )
|
|
||||||
{
|
|
||||||
case 1: // One reference to print
|
|
||||||
// format C103;47uF;CP6;;;1
|
|
||||||
msg << cmpNameFirst <<strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: // 2 references to print
|
|
||||||
// format C103,C104;47uF;CP6;;;2
|
|
||||||
msg << cmpNameFirst << wxT(",") << cmpNameLast
|
|
||||||
<< strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default: // Many references to print :
|
|
||||||
// format: C103..C106;47uF;CP6;;;4
|
|
||||||
msg << cmpNameFirst << wxT("..") << cmpNameLast
|
|
||||||
<< strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( msg ) );
|
|
||||||
|
|
||||||
cmpNameFirst = cmpName;
|
|
||||||
amount = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
strPred = strCur;
|
|
||||||
cmpNameLast = cmpName;
|
|
||||||
amount++;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
msg = returnFieldsString( comp );
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Print the last line:
|
|
||||||
if( groupRefs )
|
|
||||||
{
|
|
||||||
msg.Empty();
|
|
||||||
switch( amount )
|
|
||||||
{
|
|
||||||
case 1:
|
|
||||||
msg << cmpNameFirst << strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2:
|
|
||||||
msg << cmpNameFirst << wxT(",") << cmpNameLast
|
|
||||||
<< strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
|
|
||||||
default:
|
|
||||||
msg << cmpNameFirst << wxT("..") << cmpNameFirst << cmpNameLast
|
|
||||||
<< strPred << (wxChar)m_separatorSymbol << amount;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* PrintComponentsListByValue
|
|
||||||
* print the list of components, sorted by value, one line per component
|
|
||||||
* param aFile = the file to write to (will be NOT closed)
|
|
||||||
* not useable for csv format (use CreateCsvBOMListByValues instead)
|
|
||||||
* format:
|
|
||||||
* | 10pF C15 Loc /controle/(X=48,260 mm, Y=83,820 mm); <fields>
|
|
||||||
* | 10pF C16 Loc /controle/(X=68,580 mm, Y=83,820 mm); <fields>
|
|
||||||
*/
|
|
||||||
int BOM_LISTER::PrintComponentsListByValue( FILE* aFile )
|
|
||||||
{
|
|
||||||
m_outFile = aFile;
|
|
||||||
|
|
||||||
if( m_cmplist.GetCount() == 0 ) // Build component list
|
|
||||||
{
|
|
||||||
SCH_SHEET_LIST sheetList;
|
|
||||||
sheetList.GetComponents( m_cmplist, false );
|
|
||||||
|
|
||||||
if( !m_includeSubComponents )
|
|
||||||
{
|
|
||||||
// sort component list
|
|
||||||
m_cmplist.SortByReferenceOnly();
|
|
||||||
m_cmplist.RemoveSubComponentsFromList();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
m_cmplist.SortByValueOnly();
|
|
||||||
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
msg = _( "\n#Cmp ( order = Value )" );
|
|
||||||
|
|
||||||
if( m_includeSubComponents )
|
|
||||||
msg << _( " (with SubCmp)" );
|
|
||||||
|
|
||||||
msg << wxT( "\n" );
|
|
||||||
|
|
||||||
fputs( TO_UTF8( msg ), m_outFile );
|
|
||||||
|
|
||||||
std::string cmpName;
|
|
||||||
for( unsigned ii = 0; ii < m_cmplist.GetCount(); ii++ )
|
|
||||||
{
|
|
||||||
EDA_ITEM* schItem = m_cmplist[ii].GetComponent();
|
|
||||||
|
|
||||||
if( schItem == NULL )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
if( schItem->Type() != SCH_COMPONENT_T )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
SCH_COMPONENT* drawLibItem = (SCH_COMPONENT*) schItem;
|
|
||||||
|
|
||||||
bool isMulti = false;
|
|
||||||
LIB_COMPONENT* entry = CMP_LIBRARY::FindLibraryComponent( drawLibItem->GetLibName() );
|
|
||||||
|
|
||||||
if( entry )
|
|
||||||
isMulti = entry->IsMulti();
|
|
||||||
|
|
||||||
cmpName = m_cmplist[ii].GetRefStr();
|
|
||||||
|
|
||||||
if( isMulti && m_includeSubComponents )
|
|
||||||
// Add unit ident, for mutiple parts per package
|
|
||||||
cmpName += TO_UTF8( LIB_COMPONENT::ReturnSubReference( m_cmplist[ii].GetUnit() ) );
|
|
||||||
|
|
||||||
fprintf( m_outFile, "| %-12s %-10s",
|
|
||||||
TO_UTF8( drawLibItem->GetField( VALUE )->GetText() ),
|
|
||||||
cmpName.c_str() );
|
|
||||||
|
|
||||||
// print the sheet path and location
|
|
||||||
if( m_includeSubComponents )
|
|
||||||
{
|
|
||||||
msg = returnURLItemLocation( m_cmplist[ii].GetSheetPath().PathHumanReadable(),
|
|
||||||
drawLibItem->GetPosition() );
|
|
||||||
fprintf( m_outFile, "%s", TO_UTF8( msg ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
fprintf( m_outFile, "%s\n", TO_UTF8( returnFieldsString( drawLibItem ) ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
msg = _( "#End Cmp\n" );
|
|
||||||
fputs( TO_UTF8( msg ), m_outFile );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* returnURLItemLocation
|
|
||||||
* return a formated string to print the full location:
|
|
||||||
* <sheet name>/( X Y position)
|
|
||||||
* param aPathName = the full sheet name of item
|
|
||||||
* param aPosition = a position (in internal units) to print
|
|
||||||
*/
|
|
||||||
const wxString BOM_LISTER::returnURLItemLocation( const wxString& aPathName,
|
|
||||||
wxPoint aPosition )
|
|
||||||
{
|
|
||||||
wxString text;
|
|
||||||
|
|
||||||
text.Printf( wxT( "Loc %s(X=%s, Y=%s)" ), GetChars( aPathName ),
|
|
||||||
GetChars( ReturnStringFromValue( g_UserUnit, aPosition.x, true ) ),
|
|
||||||
GetChars( ReturnStringFromValue( g_UserUnit, aPosition.y, true ) ) );
|
|
||||||
return text;
|
|
||||||
}
|
|
|
@ -67,7 +67,6 @@ bool SCH_REFERENCE_LIST::sortByXPosition( const SCH_REFERENCE& item1,
|
||||||
return ii < 0;
|
return ii < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SCH_REFERENCE_LIST::sortByYPosition( const SCH_REFERENCE& item1,
|
bool SCH_REFERENCE_LIST::sortByYPosition( const SCH_REFERENCE& item1,
|
||||||
const SCH_REFERENCE& item2 )
|
const SCH_REFERENCE& item2 )
|
||||||
{
|
{
|
||||||
|
@ -106,252 +105,6 @@ bool SCH_REFERENCE_LIST::sortByRefAndValue( const SCH_REFERENCE& item1,
|
||||||
return ii < 0;
|
return ii < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool SCH_REFERENCE_LIST::sortByValueAndRef( const SCH_REFERENCE& item1,
|
|
||||||
const SCH_REFERENCE& item2 )
|
|
||||||
{
|
|
||||||
int ii = item1.CompareValue( item2 );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_Unit - item2.m_Unit;
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_SheetNum - item2.m_SheetNum;
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_CmpPos.x - item2.m_CmpPos.x;
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_CmpPos.y - item2.m_CmpPos.y;
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_TimeStamp - item2.m_TimeStamp;
|
|
||||||
|
|
||||||
return ii < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Helper function to calculate in a component value string
|
|
||||||
* the value, depending on multiplier symbol:
|
|
||||||
* pico
|
|
||||||
* nano
|
|
||||||
* micro (u)
|
|
||||||
* milli (m)
|
|
||||||
* kilo (k ou K)
|
|
||||||
* Mega
|
|
||||||
* Giga
|
|
||||||
* Tera
|
|
||||||
*
|
|
||||||
* with notations like 1K; 1.5K; 1,5K; 1k5
|
|
||||||
* returns true if the string is a value, false if not
|
|
||||||
* (a value is a string starting by a number)
|
|
||||||
*/
|
|
||||||
|
|
||||||
static bool engStrToDouble( wxString aStr, double* aDouble )
|
|
||||||
{
|
|
||||||
// A trick to take care of strings without a multiplier
|
|
||||||
aStr.Append( wxT( "R" ) );
|
|
||||||
|
|
||||||
// Regular expression for a value string, e.g., 47k2
|
|
||||||
#if defined(KICAD_GOST)
|
|
||||||
static wxRegEx valueRegEx( wxT( "^([0-9]+)(мк|[pnumRkKMGT.,кнМГ])([0-9]*)(мк*|[pnumRkKMGTкнМГ]*)" ) );
|
|
||||||
#else
|
|
||||||
static wxRegEx valueRegEx( wxT( "^([0-9]+)([pnumRkKMGT.,])([0-9]*)([pnumRkKMGT]*)" ) );
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if( !valueRegEx.Matches( aStr ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
wxString valueStr = wxString( valueRegEx.GetMatch( aStr, 1 )
|
|
||||||
+ wxT( "." )
|
|
||||||
+ valueRegEx.GetMatch( aStr, 3 ) );
|
|
||||||
wxString multiplierString = valueRegEx.GetMatch( aStr, 2 );
|
|
||||||
#if defined(KICAD_GOST)
|
|
||||||
if ( multiplierString == wxT( "мк" ) )
|
|
||||||
multiplierString = wxT( "u" );
|
|
||||||
else if ( multiplierString == wxT( "к" ) )
|
|
||||||
multiplierString = wxT( "k" );
|
|
||||||
else if ( multiplierString == wxT( "н" ) )
|
|
||||||
multiplierString = wxT( "n" );
|
|
||||||
else if ( multiplierString == wxT( "М" ) )
|
|
||||||
multiplierString = wxT( "M" );
|
|
||||||
else if ( multiplierString == wxT( "Г" ) )
|
|
||||||
multiplierString = wxT( "G" );
|
|
||||||
#endif
|
|
||||||
wxString post_multiplierString = valueRegEx.GetMatch( aStr, 4 );
|
|
||||||
#if defined(KICAD_GOST)
|
|
||||||
if ( post_multiplierString == wxT( "мк" ) )
|
|
||||||
multiplierString = wxT( "u" );
|
|
||||||
else if ( post_multiplierString == wxT( "к" ) )
|
|
||||||
multiplierString = wxT( "k" );
|
|
||||||
else if ( post_multiplierString == wxT( "н" ) )
|
|
||||||
multiplierString = wxT( "n" );
|
|
||||||
else if ( post_multiplierString == wxT( "М" ) )
|
|
||||||
multiplierString = wxT( "M" );
|
|
||||||
else if ( post_multiplierString == wxT( "Г" ) )
|
|
||||||
multiplierString = wxT( "G" );
|
|
||||||
#endif
|
|
||||||
double multiplier;
|
|
||||||
|
|
||||||
switch( (wxChar)multiplierString[0] )
|
|
||||||
{
|
|
||||||
case 'p':
|
|
||||||
multiplier = 1e-12;
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
multiplier = 1e-9;
|
|
||||||
break;
|
|
||||||
case 'u':
|
|
||||||
multiplier = 1e-6;
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
multiplier = 1e-3;
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
case 'K':
|
|
||||||
multiplier = 1e3;
|
|
||||||
break;
|
|
||||||
case 'M':
|
|
||||||
multiplier = 1e6;
|
|
||||||
break;
|
|
||||||
case 'G':
|
|
||||||
multiplier = 1e9;
|
|
||||||
break;
|
|
||||||
case 'T':
|
|
||||||
multiplier = 1e12;
|
|
||||||
break;
|
|
||||||
case 'R':
|
|
||||||
case '.': // floating point separator
|
|
||||||
case ',': // floating point separator (some languages)
|
|
||||||
default:
|
|
||||||
multiplier = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
switch( (wxChar)post_multiplierString[0] )
|
|
||||||
{
|
|
||||||
case 'p':
|
|
||||||
multiplier = 1e-12;
|
|
||||||
break;
|
|
||||||
case 'n':
|
|
||||||
multiplier = 1e-9;
|
|
||||||
break;
|
|
||||||
case 'u':
|
|
||||||
multiplier = 1e-6;
|
|
||||||
break;
|
|
||||||
case 'm':
|
|
||||||
multiplier = 1e-3;
|
|
||||||
break;
|
|
||||||
case 'k':
|
|
||||||
case 'K':
|
|
||||||
multiplier = 1e3;
|
|
||||||
break;
|
|
||||||
case 'M':
|
|
||||||
multiplier = 1e6;
|
|
||||||
break;
|
|
||||||
case 'G':
|
|
||||||
multiplier = 1e9;
|
|
||||||
break;
|
|
||||||
case 'T':
|
|
||||||
multiplier = 1e12;
|
|
||||||
break;
|
|
||||||
case 'R':
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
LOCALE_IO dummy; // set to C floating point standard
|
|
||||||
valueStr.ToDouble( aDouble );
|
|
||||||
*aDouble *= multiplier;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static bool splitRefStr( const wxString& aRef, wxString* aStr, int* aNumber )
|
|
||||||
{
|
|
||||||
static wxRegEx refRegEx( wxT( "^([a-zA-Z]+)([0-9]+)" ) );
|
|
||||||
|
|
||||||
if( !refRegEx.Matches( aRef ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
*aStr = refRegEx.GetMatch( aRef, 1 );
|
|
||||||
*aNumber = wxAtoi( refRegEx.GetMatch( aRef, 2 ) );
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* sort the list of references by value.
|
|
||||||
* Components are grouped by type and are sorted by value:
|
|
||||||
* The value of a component accept multiplier symbols (p, n, K ..)
|
|
||||||
* groups are made by first letter of reference
|
|
||||||
*/
|
|
||||||
bool SCH_REFERENCE_LIST::sortByValueOnly( const SCH_REFERENCE& item1,
|
|
||||||
const SCH_REFERENCE& item2 )
|
|
||||||
{
|
|
||||||
// First, group by type according to reference text part (R, C, etc.)
|
|
||||||
wxString text1 = item1.GetComponent()->GetField( REFERENCE )->GetText();
|
|
||||||
wxString text2 = item2.GetComponent()->GetField( REFERENCE )->GetText();
|
|
||||||
wxString refNameStr1, refNameStr2;
|
|
||||||
int refNumber1, refNumber2;
|
|
||||||
|
|
||||||
if( !splitRefStr( text1, &refNameStr1, &refNumber1 ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( !splitRefStr( text2, &refNameStr2, &refNumber2 ) )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
int ii = refNameStr1.CmpNoCase( refNameStr2 );
|
|
||||||
|
|
||||||
if( ii != 0 )
|
|
||||||
return ii < 0;
|
|
||||||
|
|
||||||
// We can compare here 2 values relative to components of the same type
|
|
||||||
// assuming references are correctly chosen
|
|
||||||
text1 = item1.GetComponent()->GetField( VALUE )->GetText();
|
|
||||||
text2 = item2.GetComponent()->GetField( VALUE )->GetText();
|
|
||||||
|
|
||||||
double value1, value2;
|
|
||||||
|
|
||||||
// Try to convert value to double (4k7 -> 4700 etc.)
|
|
||||||
bool match1 = engStrToDouble( text1, &value1 );
|
|
||||||
bool match2 = engStrToDouble( text2, &value2 );
|
|
||||||
|
|
||||||
// Values come before other strings
|
|
||||||
if( match1 && !match2 )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
// Values come before other strings
|
|
||||||
if( !match1 && match2 )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if( match1 && match2 && (value1 != value2) )
|
|
||||||
return value1 < value2;
|
|
||||||
|
|
||||||
// Inside a group of components of same value, it could be good to group per footprints
|
|
||||||
text1 = item1.GetComponent()->GetField( FOOTPRINT )->GetText();
|
|
||||||
text2 = item2.GetComponent()->GetField( FOOTPRINT )->GetText();
|
|
||||||
ii = text1.CmpNoCase( text2 );
|
|
||||||
|
|
||||||
if( ii != 0 )
|
|
||||||
return ii < 0;
|
|
||||||
|
|
||||||
if( refNumber1 != refNumber2 )
|
|
||||||
return refNumber1 < refNumber2;
|
|
||||||
|
|
||||||
// Fall back to normal string compare
|
|
||||||
ii = text1.CmpNoCase( text2 );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = RefDesStringCompare( item1.GetRef(), item2.GetRef() );
|
|
||||||
|
|
||||||
if( ii == 0 )
|
|
||||||
ii = item1.m_Unit - item2.m_Unit;
|
|
||||||
|
|
||||||
return ii < 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
bool SCH_REFERENCE_LIST::sortByReferenceOnly( const SCH_REFERENCE& item1,
|
bool SCH_REFERENCE_LIST::sortByReferenceOnly( const SCH_REFERENCE& item1,
|
||||||
const SCH_REFERENCE& item2 )
|
const SCH_REFERENCE& item2 )
|
||||||
|
@ -385,7 +138,6 @@ bool SCH_REFERENCE_LIST::sortByTimeStamp( const SCH_REFERENCE& item1,
|
||||||
return ii < 0;
|
return ii < 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit )
|
int SCH_REFERENCE_LIST::FindUnit( size_t aIndex, int aUnit )
|
||||||
{
|
{
|
||||||
int NumRef;
|
int NumRef;
|
||||||
|
@ -837,27 +589,17 @@ int SCH_REFERENCE_LIST::CheckAnnotation( wxArrayString* aMessageList )
|
||||||
|
|
||||||
if( componentFlatList[ii].CompareValue( componentFlatList[next] ) != 0 )
|
if( componentFlatList[ii].CompareValue( componentFlatList[next] ) != 0 )
|
||||||
{
|
{
|
||||||
#if defined(KICAD_GOST)
|
msg.Printf( _( "Different values for %s%d%s (%s) and %s%d%s (%s)" ),
|
||||||
msg.Printf( _( "Different values for %s%d.%d (%s) and %s%d.%d (%s)" ),
|
|
||||||
GetChars( componentFlatList[ii].GetRef() ),
|
GetChars( componentFlatList[ii].GetRef() ),
|
||||||
componentFlatList[ii].m_NumRef,
|
componentFlatList[ii].m_NumRef,
|
||||||
componentFlatList[ii].m_Unit,
|
GetChars( LIB_COMPONENT::ReturnSubReference(
|
||||||
|
componentFlatList[ii].m_Unit ) ),
|
||||||
GetChars( componentFlatList[ii].m_Value->GetText() ),
|
GetChars( componentFlatList[ii].m_Value->GetText() ),
|
||||||
GetChars( componentFlatList[next].GetRef() ),
|
GetChars( componentFlatList[next].GetRef() ),
|
||||||
componentFlatList[next].m_NumRef,
|
componentFlatList[next].m_NumRef,
|
||||||
componentFlatList[next].m_Unit,
|
GetChars( LIB_COMPONENT::ReturnSubReference(
|
||||||
componentFlatList[next].m_Value->GetText().GetData() );
|
componentFlatList[next].m_Unit ) ),
|
||||||
#else
|
|
||||||
msg.Printf( _( "Different values for %s%d%c (%s) and %s%d%c (%s)" ),
|
|
||||||
GetChars( componentFlatList[ii].GetRef() ),
|
|
||||||
componentFlatList[ii].m_NumRef,
|
|
||||||
componentFlatList[ii].m_Unit + 'A' - 1,
|
|
||||||
GetChars( componentFlatList[ii].m_Value->GetText() ),
|
|
||||||
GetChars( componentFlatList[next].GetRef() ),
|
|
||||||
componentFlatList[next].m_NumRef,
|
|
||||||
componentFlatList[next].m_Unit + 'A' - 1,
|
|
||||||
GetChars( componentFlatList[next].m_Value->GetText() ) );
|
GetChars( componentFlatList[next].m_Value->GetText() ) );
|
||||||
#endif
|
|
||||||
|
|
||||||
if( aMessageList )
|
if( aMessageList )
|
||||||
aMessageList->Add( msg + wxT( "\n" ));
|
aMessageList->Add( msg + wxT( "\n" ));
|
||||||
|
|
|
@ -1,71 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 1992-2012 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _ANNOTATE_DIALOG_H_
|
|
||||||
#define _ANNOTATE_DIALOG_H_
|
|
||||||
|
|
||||||
#include <dialog_annotate_base.h>
|
|
||||||
|
|
||||||
|
|
||||||
class SCH_EDIT_FRAME;
|
|
||||||
class wxConfig;
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* DIALOG_ANNOTATE class declaration
|
|
||||||
*/
|
|
||||||
|
|
||||||
class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
SCH_EDIT_FRAME * m_Parent;
|
|
||||||
wxConfig* m_Config;
|
|
||||||
|
|
||||||
public:
|
|
||||||
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent );
|
|
||||||
~DIALOG_ANNOTATE(){};
|
|
||||||
|
|
||||||
private:
|
|
||||||
/// Initialises member variables
|
|
||||||
void InitValues();
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
void OnClearAnnotationCmpClick( wxCommandEvent& event );
|
|
||||||
void OnApplyClick( wxCommandEvent& event );
|
|
||||||
|
|
||||||
// User functions:
|
|
||||||
bool GetLevel( void );
|
|
||||||
bool GetResetItems( void );
|
|
||||||
int GetSortOrder( void );
|
|
||||||
int GetAnnotateAlgo( void );
|
|
||||||
bool GetAnnotateAutoCloseOpt()
|
|
||||||
{
|
|
||||||
return m_cbAutoCloseDlg->GetValue();
|
|
||||||
}
|
|
||||||
bool GetAnnotateSilentMode()
|
|
||||||
{
|
|
||||||
return m_cbUseSilentMode->GetValue();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif
|
|
||||||
// _ANNOTATE_DIALOG_H_
|
|
|
@ -1,5 +1,5 @@
|
||||||
/**
|
/**
|
||||||
* @file annotate_dialog.cpp
|
* @file dialog_annotate.cpp
|
||||||
* @brief Annotation dialog functions.
|
* @brief Annotation dialog functions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
@ -33,75 +33,132 @@
|
||||||
#include <wxEeschemaStruct.h>
|
#include <wxEeschemaStruct.h>
|
||||||
#include <class_drawpanel.h>
|
#include <class_drawpanel.h>
|
||||||
|
|
||||||
#include <annotate_dialog.h>
|
#include <invoke_sch_dialog.h>
|
||||||
|
#include <dialog_annotate_base.h>
|
||||||
|
|
||||||
|
|
||||||
|
#define KEY_ANNOTATE_SORT_OPTION wxT( "AnnotateSortOption" )
|
||||||
|
#define KEY_ANNOTATE_ALGO_OPTION wxT( "AnnotateAlgoOption" )
|
||||||
|
#define KEY_ANNOTATE_AUTOCLOSE_OPTION wxT( "AnnotateAutoCloseOption" )
|
||||||
|
#define KEY_ANNOTATE_USE_SILENTMODE wxT( "AnnotateSilentMode" )
|
||||||
|
|
||||||
|
|
||||||
|
class wxConfig;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DIALOG_ANNOTATE
|
||||||
|
*/
|
||||||
|
class DIALOG_ANNOTATE: public DIALOG_ANNOTATE_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent );
|
||||||
|
|
||||||
|
|
||||||
|
private:
|
||||||
|
SCH_EDIT_FRAME* m_Parent;
|
||||||
|
wxConfig* m_Config;
|
||||||
|
|
||||||
|
/// Initialises member variables
|
||||||
|
void InitValues();
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
void OnClearAnnotationCmpClick( wxCommandEvent& event );
|
||||||
|
void OnApplyClick( wxCommandEvent& event );
|
||||||
|
|
||||||
|
// User functions:
|
||||||
|
bool GetLevel();
|
||||||
|
bool GetResetItems();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetSortOrder
|
||||||
|
* @return 0 if annotation by X position,
|
||||||
|
* 1 if annotation by Y position,
|
||||||
|
* 2 if annotation by value
|
||||||
|
*/
|
||||||
|
int GetSortOrder();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetAnnotateAlgo
|
||||||
|
* @return 0 if annotation using first not used Id value
|
||||||
|
* 1 if annotation using first not used Id value inside sheet num * 100 to sheet num * 100 + 99
|
||||||
|
* 2 if annotation using first nhot used Id value inside sheet num * 1000 to sheet num * 1000 + 999
|
||||||
|
*/
|
||||||
|
int GetAnnotateAlgo();
|
||||||
|
|
||||||
|
bool GetAnnotateAutoCloseOpt()
|
||||||
|
{
|
||||||
|
return m_cbAutoCloseDlg->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetAnnotateSilentMode()
|
||||||
|
{
|
||||||
|
return m_cbUseSilentMode->GetValue();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
#define KEY_ANNOTATE_SORT_OPTION wxT("AnnotateSortOption")
|
|
||||||
#define KEY_ANNOTATE_ALGO_OPTION wxT("AnnotateAlgoOption")
|
|
||||||
#define KEY_ANNOTATE_AUTOCLOSE_OPTION wxT("AnnotateAutoCloseOption")
|
|
||||||
#define KEY_ANNOTATE_USE_SILENTMODE wxT("AnnotateSilentMode")
|
|
||||||
|
|
||||||
|
|
||||||
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
|
DIALOG_ANNOTATE::DIALOG_ANNOTATE( SCH_EDIT_FRAME* parent )
|
||||||
: DIALOG_ANNOTATE_BASE( parent )
|
: DIALOG_ANNOTATE_BASE( parent )
|
||||||
{
|
{
|
||||||
m_Parent = parent;
|
m_Parent = parent;
|
||||||
|
|
||||||
InitValues();
|
InitValues();
|
||||||
Layout();
|
Layout();
|
||||||
GetSizer()->SetSizeHints(this);
|
GetSizer()->SetSizeHints( this );
|
||||||
Centre();
|
Centre();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************/
|
|
||||||
void DIALOG_ANNOTATE::InitValues()
|
void DIALOG_ANNOTATE::InitValues()
|
||||||
/*********************************/
|
|
||||||
{
|
{
|
||||||
m_Config = wxGetApp().GetSettings();
|
m_Config = wxGetApp().GetSettings();
|
||||||
SetFocus(); // needed to close dialog by escape key
|
|
||||||
if( m_Config )
|
if( m_Config )
|
||||||
{
|
{
|
||||||
long option;
|
long option;
|
||||||
m_Config->Read(KEY_ANNOTATE_SORT_OPTION, &option, 0l);
|
|
||||||
|
m_Config->Read( KEY_ANNOTATE_SORT_OPTION, &option, 0l );
|
||||||
switch( option )
|
switch( option )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
m_rbSortBy_X_Position->SetValue(1);
|
m_rbSortBy_X_Position->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
m_rbSortBy_Y_Position->SetValue(1);
|
m_rbSortBy_Y_Position->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
m_rbUseIncremental->SetValue(1);
|
m_rbUseIncremental->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Config->Read(KEY_ANNOTATE_ALGO_OPTION, &option, 0l);
|
m_Config->Read( KEY_ANNOTATE_ALGO_OPTION, &option, 0l );
|
||||||
switch( option )
|
switch( option )
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case 0:
|
case 0:
|
||||||
m_rbUseIncremental->SetValue(1);
|
m_rbUseIncremental->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
m_rbUseSheetNum->SetValue(1);
|
m_rbUseSheetNum->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
m_rbStartSheetNumLarge->SetValue(1);
|
m_rbStartSheetNumLarge->SetValue( 1 );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Config->Read(KEY_ANNOTATE_AUTOCLOSE_OPTION, &option, 0l);
|
m_Config->Read( KEY_ANNOTATE_AUTOCLOSE_OPTION, &option, 0l );
|
||||||
if( option )
|
if( option )
|
||||||
m_cbAutoCloseDlg->SetValue(1);
|
m_cbAutoCloseDlg->SetValue( 1 );
|
||||||
|
|
||||||
m_Config->Read(KEY_ANNOTATE_USE_SILENTMODE, &option, 0l);
|
m_Config->Read( KEY_ANNOTATE_USE_SILENTMODE, &option, 0l );
|
||||||
if( option )
|
if( option )
|
||||||
m_cbUseSilentMode->SetValue(1);
|
m_cbUseSilentMode->SetValue( 1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) );
|
annotate_down_right_bitmap->SetBitmap( KiBitmap( annotate_down_right_xpm ) );
|
||||||
|
@ -111,19 +168,17 @@ void DIALOG_ANNOTATE::InitValues()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************/
|
|
||||||
void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||||
/*********************************************************/
|
|
||||||
{
|
{
|
||||||
int response;
|
int response;
|
||||||
wxString message;
|
wxString message;
|
||||||
|
|
||||||
if( m_Config )
|
if( m_Config )
|
||||||
{
|
{
|
||||||
m_Config->Write(KEY_ANNOTATE_SORT_OPTION, GetSortOrder());
|
m_Config->Write( KEY_ANNOTATE_SORT_OPTION, GetSortOrder() );
|
||||||
m_Config->Write(KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo());
|
m_Config->Write( KEY_ANNOTATE_ALGO_OPTION, GetAnnotateAlgo() );
|
||||||
m_Config->Write(KEY_ANNOTATE_AUTOCLOSE_OPTION, GetAnnotateAutoCloseOpt());
|
m_Config->Write( KEY_ANNOTATE_AUTOCLOSE_OPTION, GetAnnotateAutoCloseOpt() );
|
||||||
m_Config->Write(KEY_ANNOTATE_USE_SILENTMODE, GetAnnotateSilentMode());
|
m_Config->Write( KEY_ANNOTATE_USE_SILENTMODE, GetAnnotateSilentMode() );
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display a message info in verbose mode,
|
// Display a message info in verbose mode,
|
||||||
|
@ -152,7 +207,7 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||||
|
|
||||||
if (response == wxCANCEL)
|
if( response == wxCANCEL )
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,13 +231,11 @@ void DIALOG_ANNOTATE::OnApplyClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************************/
|
|
||||||
void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
|
void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
|
||||||
/************************************************************************/
|
|
||||||
{
|
{
|
||||||
int response;
|
int response;
|
||||||
|
|
||||||
wxString message;
|
wxString message;
|
||||||
|
|
||||||
if( GetLevel() )
|
if( GetLevel() )
|
||||||
message = _( "Clear the existing annotation for the entire schematic?" );
|
message = _( "Clear the existing annotation for the entire schematic?" );
|
||||||
else
|
else
|
||||||
|
@ -191,19 +244,17 @@ void DIALOG_ANNOTATE::OnClearAnnotationCmpClick( wxCommandEvent& event )
|
||||||
message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." );
|
message += _( "\n\nThis operation will clear the existing annotation and cannot be undone." );
|
||||||
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
response = wxMessageBox( message, wxT( "" ), wxICON_EXCLAMATION | wxOK | wxCANCEL );
|
||||||
|
|
||||||
if (response == wxCANCEL)
|
if( response == wxCANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
m_Parent->DeleteAnnotation( GetLevel() ? false : true );
|
m_Parent->DeleteAnnotation( GetLevel() ? false : true );
|
||||||
m_Parent->GetCanvas()->Refresh();
|
m_Parent->GetCanvas()->Refresh();
|
||||||
|
|
||||||
m_btnClear->Enable(false);
|
m_btnClear->Enable( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/************************************************************/
|
|
||||||
void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event )
|
void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event )
|
||||||
/************************************************************/
|
|
||||||
{
|
{
|
||||||
if( IsModal() )
|
if( IsModal() )
|
||||||
EndModal( wxID_CANCEL );
|
EndModal( wxID_CANCEL );
|
||||||
|
@ -215,44 +266,46 @@ void DIALOG_ANNOTATE::OnCancelClick( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**************************************/
|
bool DIALOG_ANNOTATE::GetLevel()
|
||||||
bool DIALOG_ANNOTATE::GetLevel( void )
|
|
||||||
/**************************************/
|
|
||||||
{
|
{
|
||||||
return m_rbEntireSchematic->GetValue();
|
return m_rbEntireSchematic->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
/******************************************/
|
|
||||||
bool DIALOG_ANNOTATE::GetResetItems( void )
|
bool DIALOG_ANNOTATE::GetResetItems()
|
||||||
/******************************************/
|
|
||||||
{
|
{
|
||||||
return m_rbResetAnnotation->GetValue();
|
return m_rbResetAnnotation->GetValue();
|
||||||
}
|
}
|
||||||
|
|
||||||
int DIALOG_ANNOTATE::GetSortOrder( void )
|
|
||||||
/**
|
int DIALOG_ANNOTATE::GetSortOrder()
|
||||||
* @return 0 if annotation by X position,
|
|
||||||
* 1 if annotation by Y position,
|
|
||||||
* 2 if annotation by value
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
if ( m_rbSortBy_X_Position->GetValue() )
|
if( m_rbSortBy_X_Position->GetValue() )
|
||||||
return 0;
|
return 0;
|
||||||
if ( m_rbSortBy_Y_Position->GetValue() )
|
|
||||||
|
if( m_rbSortBy_Y_Position->GetValue() )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
int DIALOG_ANNOTATE::GetAnnotateAlgo( void )
|
|
||||||
/**
|
int DIALOG_ANNOTATE::GetAnnotateAlgo()
|
||||||
* @return 0 if annotation using first not used Id value
|
|
||||||
* 1 if annotation using first not used Id value inside sheet num * 100 to sheet num * 100 + 99
|
|
||||||
* 2 if annotation using first nhot used Id value inside sheet num * 1000 to sheet num * 1000 + 999
|
|
||||||
*/
|
|
||||||
{
|
{
|
||||||
if ( m_rbUseIncremental->GetValue() )
|
if( m_rbUseIncremental->GetValue() )
|
||||||
return 0;
|
return 0;
|
||||||
if ( m_rbUseSheetNum->GetValue() )
|
|
||||||
|
if( m_rbUseSheetNum->GetValue() )
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
DIALOG_ANNOTATE dlg( aCaller );
|
||||||
|
|
||||||
|
return dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,489 @@
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||||
|
* Copyright (C) 1992-2013 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 eeschema/dialogs/dialog_bom.cpp
|
||||||
|
* @brief Dialog box for creating bom and other documents from generic netlist.
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
#include <fctsys.h>
|
||||||
|
#include <appl_wxstruct.h>
|
||||||
|
#include <confirm.h>
|
||||||
|
#include <gestfich.h>
|
||||||
|
#include <wxEeschemaStruct.h>
|
||||||
|
|
||||||
|
#include <netlist.h>
|
||||||
|
#include <sch_sheet.h>
|
||||||
|
#include <invoke_sch_dialog.h>
|
||||||
|
#include <dialog_helpers.h>
|
||||||
|
#include <dialog_bom_base.h>
|
||||||
|
#include <html_messagebox.h>
|
||||||
|
|
||||||
|
#define BOM_PLUGINS_KEY wxT("bom_plugins")
|
||||||
|
#define BOM_PLUGIN_SELECTED_KEY wxT("bom_plugin_selected")
|
||||||
|
|
||||||
|
const char * s_bomHelpInfo =
|
||||||
|
#include <dialog_bom_help_html.h>
|
||||||
|
;
|
||||||
|
|
||||||
|
#include <dialog_bom_cfg_lexer.h>
|
||||||
|
|
||||||
|
using namespace T_BOMCFG_T;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class BOM_CFG_READER_PARSER
|
||||||
|
* holds data and functions pertinent to parsing a S-expression file
|
||||||
|
* for a WORKSHEET_LAYOUT.
|
||||||
|
*/
|
||||||
|
class BOM_CFG_READER_PARSER : public DIALOG_BOM_CFG_LEXER
|
||||||
|
{
|
||||||
|
wxArrayString* m_pluginsList;
|
||||||
|
|
||||||
|
public:
|
||||||
|
BOM_CFG_READER_PARSER( wxArrayString* aPlugins,
|
||||||
|
const char* aData, const wxString& aSource );
|
||||||
|
void Parse() throw( PARSE_ERROR, IO_ERROR );
|
||||||
|
|
||||||
|
private:
|
||||||
|
void parsePlugin() throw( IO_ERROR, PARSE_ERROR );
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
// PCB_PLOT_PARAMS_PARSER
|
||||||
|
|
||||||
|
BOM_CFG_READER_PARSER::BOM_CFG_READER_PARSER( wxArrayString* aPlugins,
|
||||||
|
const char* aLine,
|
||||||
|
const wxString& aSource ) :
|
||||||
|
DIALOG_BOM_CFG_LEXER( aLine, aSource )
|
||||||
|
{
|
||||||
|
m_pluginsList = aPlugins;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void BOM_CFG_READER_PARSER::Parse() throw( PARSE_ERROR, IO_ERROR )
|
||||||
|
{
|
||||||
|
T token;
|
||||||
|
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if( token == T_LEFT )
|
||||||
|
token = NextTok();
|
||||||
|
|
||||||
|
if( token == T_plugins )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_plugin: // Defines a new plugin
|
||||||
|
parsePlugin();
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
// Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void BOM_CFG_READER_PARSER::parsePlugin() throw( IO_ERROR, PARSE_ERROR )
|
||||||
|
{
|
||||||
|
wxString title, command;
|
||||||
|
|
||||||
|
NeedSYMBOLorNUMBER();
|
||||||
|
title = FromUTF8();
|
||||||
|
|
||||||
|
T token;
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT )
|
||||||
|
{
|
||||||
|
if( token == T_EOF)
|
||||||
|
break;
|
||||||
|
|
||||||
|
switch( token )
|
||||||
|
{
|
||||||
|
case T_LEFT:
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_cmd:
|
||||||
|
NeedSYMBOLorNUMBER();
|
||||||
|
command = FromUTF8();
|
||||||
|
NeedRIGHT();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case T_opts:
|
||||||
|
while( ( token = NextTok() ) != T_RIGHT && token != T_EOF );
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
Unexpected( CurText() );
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if( ! title.IsEmpty() )
|
||||||
|
{
|
||||||
|
m_pluginsList->Add( title );
|
||||||
|
m_pluginsList->Add( command );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// The main dialog frame tu run scripts to build bom
|
||||||
|
class DIALOG_BOM : public DIALOG_BOM_BASE
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
SCH_EDIT_FRAME* m_parent;
|
||||||
|
// The list of scripts (or plugins):
|
||||||
|
// a script descr uses 2 lines:
|
||||||
|
// the first is the title
|
||||||
|
// the second is the command line
|
||||||
|
wxArrayString m_plugins;
|
||||||
|
wxConfig* m_config; // to store the "plugins"
|
||||||
|
|
||||||
|
public:
|
||||||
|
// Constructor and destructor
|
||||||
|
DIALOG_BOM( SCH_EDIT_FRAME* parent );
|
||||||
|
~DIALOG_BOM();
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnPluginSelected( wxCommandEvent& event );
|
||||||
|
void OnRunPlugin( wxCommandEvent& event );
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
void OnHelp( wxCommandEvent& event );
|
||||||
|
void OnAddPlugin( wxCommandEvent& event );
|
||||||
|
void OnChoosePlugin( wxCommandEvent& event );
|
||||||
|
void OnRemovePlugin( wxCommandEvent& event );
|
||||||
|
void OnEditPlugin( wxCommandEvent& event );
|
||||||
|
void OnCommandLineEdited( wxCommandEvent& event );
|
||||||
|
void OnNameEdited( wxCommandEvent& event );
|
||||||
|
|
||||||
|
void pluginInit();
|
||||||
|
void installPluginsList();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Create and show DIALOG_BOM.
|
||||||
|
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
DIALOG_BOM dlg( aCaller );
|
||||||
|
return dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_BOM::DIALOG_BOM( SCH_EDIT_FRAME* parent ) :
|
||||||
|
DIALOG_BOM_BASE( parent )
|
||||||
|
{
|
||||||
|
m_parent = parent;
|
||||||
|
m_config = wxGetApp().GetSettings();
|
||||||
|
installPluginsList();
|
||||||
|
|
||||||
|
GetSizer()->SetSizeHints( this );
|
||||||
|
Centre();
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_BOM::~DIALOG_BOM()
|
||||||
|
{
|
||||||
|
// Save the plugin descriptions in config.
|
||||||
|
// the config stores only one string.
|
||||||
|
// plugins are saved inside a S expr:
|
||||||
|
// ( plugins
|
||||||
|
// ( plugin "plugin name" (cmd "command line") )
|
||||||
|
// ....
|
||||||
|
// )
|
||||||
|
|
||||||
|
STRING_FORMATTER writer;
|
||||||
|
writer.Print( 0, "(plugins" );
|
||||||
|
for( unsigned ii = 0; ii < m_plugins.GetCount(); ii += 2 )
|
||||||
|
{
|
||||||
|
writer.Print( 1, "(plugin %s (cmd %s))",
|
||||||
|
writer.Quotew( m_plugins[ii] ).c_str(),
|
||||||
|
writer.Quotew( m_plugins[ii+1] ).c_str() );
|
||||||
|
}
|
||||||
|
writer.Print( 0, ")" );
|
||||||
|
|
||||||
|
wxString list( FROM_UTF8( writer.GetString().c_str() ) );
|
||||||
|
|
||||||
|
m_config->Write( BOM_PLUGINS_KEY, list );
|
||||||
|
|
||||||
|
wxString active_plugin_name = m_lbPlugins->GetStringSelection( );
|
||||||
|
m_config->Write( BOM_PLUGIN_SELECTED_KEY, active_plugin_name );
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Read the initialized plugins in config and fill the list
|
||||||
|
* of names
|
||||||
|
*/
|
||||||
|
void DIALOG_BOM::installPluginsList()
|
||||||
|
{
|
||||||
|
wxString list, active_plugin_name;
|
||||||
|
m_config->Read( BOM_PLUGINS_KEY, &list );
|
||||||
|
m_config->Read( BOM_PLUGIN_SELECTED_KEY, &active_plugin_name );
|
||||||
|
|
||||||
|
if( !list.IsEmpty() )
|
||||||
|
{
|
||||||
|
BOM_CFG_READER_PARSER cfg_parser( &m_plugins, TO_UTF8( list ),
|
||||||
|
wxT( "plugins" ) );
|
||||||
|
try
|
||||||
|
{
|
||||||
|
cfg_parser.Parse();
|
||||||
|
}
|
||||||
|
catch( IO_ERROR ioe )
|
||||||
|
{
|
||||||
|
// wxLogMessage( ioe.errorText );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Populate list box
|
||||||
|
for( unsigned ii = 0; ii < m_plugins.GetCount(); ii+=2 )
|
||||||
|
{
|
||||||
|
m_lbPlugins->Append( m_plugins[ii] );
|
||||||
|
|
||||||
|
if( active_plugin_name == m_plugins[ii] )
|
||||||
|
m_lbPlugins->SetSelection( ii/2 );
|
||||||
|
}
|
||||||
|
|
||||||
|
pluginInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnPluginSelected( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
pluginInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::pluginInit()
|
||||||
|
{
|
||||||
|
int ii = m_lbPlugins->GetSelection();
|
||||||
|
|
||||||
|
if( ii < 0 )
|
||||||
|
{
|
||||||
|
m_textCtrlName->SetValue( wxEmptyString );
|
||||||
|
m_textCtrlCommand->SetValue( wxEmptyString );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
m_textCtrlName->SetValue( m_plugins[2 * ii] );
|
||||||
|
m_textCtrlCommand->SetValue( m_plugins[(2 * ii)+1] );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function RunPlugin
|
||||||
|
* run the plugin command line
|
||||||
|
*/
|
||||||
|
void DIALOG_BOM::OnRunPlugin( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxFileName fn;
|
||||||
|
wxString fileWildcard;
|
||||||
|
wxString title = _( "Save Netlist File" );
|
||||||
|
|
||||||
|
// Calculate the xml netlist filename
|
||||||
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
|
|
||||||
|
if( fn.GetPath().IsEmpty() )
|
||||||
|
fn.SetPath( wxGetCwd() );
|
||||||
|
|
||||||
|
fn.ClearExt();
|
||||||
|
wxString fullfilename = fn.GetFullPath();
|
||||||
|
m_parent->ClearMsgPanel();
|
||||||
|
|
||||||
|
m_parent->SetNetListerCommand( m_textCtrlCommand->GetValue() );
|
||||||
|
m_parent->CreateNetlist( -1, fullfilename, 0 );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnCancelClick( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
EndModal( wxID_CANCEL );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnRemovePlugin
|
||||||
|
* Remove a plugin from the list
|
||||||
|
*/
|
||||||
|
void DIALOG_BOM::OnRemovePlugin( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int ii = m_lbPlugins->GetSelection();
|
||||||
|
|
||||||
|
if( ii < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_lbPlugins->Delete( ii );
|
||||||
|
|
||||||
|
m_plugins.RemoveAt( 2*ii, 2 ); // Remove title and command line
|
||||||
|
|
||||||
|
// Select the next item, if exists
|
||||||
|
if( (int)m_lbPlugins->GetCount() >= ii )
|
||||||
|
ii = m_lbPlugins->GetCount() - 1;
|
||||||
|
|
||||||
|
if( ii >= 0 )
|
||||||
|
m_lbPlugins->SetSelection( ii );
|
||||||
|
|
||||||
|
pluginInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnAddPlugin
|
||||||
|
* Add a new panel for a new netlist plugin
|
||||||
|
*/
|
||||||
|
void DIALOG_BOM::OnAddPlugin( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
// Creates a new plugin entry
|
||||||
|
wxString name = wxGetTextFromUser( _("Plugin") );
|
||||||
|
|
||||||
|
if( name.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Verify if it does not exists
|
||||||
|
for( unsigned ii = 0; ii < m_plugins.GetCount(); ii += 2 )
|
||||||
|
{
|
||||||
|
if( name == m_plugins[ii] )
|
||||||
|
{
|
||||||
|
wxMessageBox( _("This plugin already exists. Abort") );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
m_plugins.Add( name );
|
||||||
|
m_plugins.Add( wxEmptyString );
|
||||||
|
m_lbPlugins->Append( name );
|
||||||
|
m_lbPlugins->SetSelection( m_lbPlugins->GetCount() - 1 );
|
||||||
|
pluginInit();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Browse plugin files, and set m_CommandStringCtrl field
|
||||||
|
*/
|
||||||
|
void DIALOG_BOM::OnChoosePlugin( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxString FullFileName, Mask, Path;
|
||||||
|
|
||||||
|
Mask = wxT( "*" );
|
||||||
|
Path = wxGetApp().GetExecutablePath();
|
||||||
|
FullFileName = EDA_FileSelector( _( "Plugin files:" ),
|
||||||
|
Path,
|
||||||
|
FullFileName,
|
||||||
|
wxEmptyString,
|
||||||
|
Mask,
|
||||||
|
this,
|
||||||
|
wxFD_OPEN,
|
||||||
|
true
|
||||||
|
);
|
||||||
|
if( FullFileName.IsEmpty() )
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Creates a default command line,
|
||||||
|
// suitable to run the external tool xslproc or python
|
||||||
|
// The default command line depending on plugin extension, currently
|
||||||
|
// "xsl" or "exe" or "py"
|
||||||
|
wxString cmdLine;
|
||||||
|
wxFileName fn( FullFileName );
|
||||||
|
wxString ext = fn.GetExt();
|
||||||
|
|
||||||
|
if( ext == wxT("xsl" ) )
|
||||||
|
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
|
||||||
|
else if( ext == wxT("exe" ) || ext.IsEmpty() )
|
||||||
|
cmdLine.Printf(wxT("\"%s\" < \"%%I\" > \"%%O\""), GetChars(FullFileName) );
|
||||||
|
else if( ext == wxT("py" ) || ext.IsEmpty() )
|
||||||
|
cmdLine.Printf(wxT("python \"%s\" \"%%I\" \"%%O\""), GetChars(FullFileName) );
|
||||||
|
else
|
||||||
|
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
|
||||||
|
|
||||||
|
m_textCtrlCommand->SetValue( cmdLine );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnEditPlugin( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxString pluginName, cmdline;
|
||||||
|
|
||||||
|
// Try to find the plugin name.
|
||||||
|
// This is possible if the name ends by .py or .xsl
|
||||||
|
cmdline = m_textCtrlCommand->GetValue();
|
||||||
|
int pos = -1;
|
||||||
|
|
||||||
|
if( (pos = cmdline.Find( wxT(".py") )) != wxNOT_FOUND )
|
||||||
|
pos += 2;
|
||||||
|
else if( (pos = cmdline.Find( wxT(".xsl") )) != wxNOT_FOUND )
|
||||||
|
pos += 3;
|
||||||
|
|
||||||
|
// the end of plugin name is at position pos.
|
||||||
|
if( pos > 0 )
|
||||||
|
{
|
||||||
|
// Be sure this is the end of the name: the next char is " or space
|
||||||
|
int eos = cmdline[pos+1];
|
||||||
|
|
||||||
|
if( eos == ' '|| eos == '\"' )
|
||||||
|
{
|
||||||
|
// search for the starting point of the name
|
||||||
|
int jj = pos-1;
|
||||||
|
while( jj >= 0 )
|
||||||
|
if( cmdline[jj] != eos )
|
||||||
|
jj--;
|
||||||
|
else
|
||||||
|
break;
|
||||||
|
|
||||||
|
// extract the name
|
||||||
|
if( jj >= 0 )
|
||||||
|
pluginName = cmdline.SubString( jj, pos );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
AddDelimiterString( pluginName );
|
||||||
|
wxString editorname = wxGetApp().GetEditorName();
|
||||||
|
|
||||||
|
if( !editorname.IsEmpty() )
|
||||||
|
ExecuteFile( this, editorname, pluginName );
|
||||||
|
else
|
||||||
|
wxMessageBox( _("No text editor selected in KiCad. Please choose it") );
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnHelp( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
HTML_MESSAGE_BOX help_Dlg( this, _("Bom Generation Help"),
|
||||||
|
wxDefaultPosition, wxSize( 750,550 ) );
|
||||||
|
|
||||||
|
wxString msg = FROM_UTF8(s_bomHelpInfo);
|
||||||
|
help_Dlg.m_htmlWindow->AppendToPage( msg );
|
||||||
|
help_Dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnCommandLineEdited( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int ii = m_lbPlugins->GetSelection();
|
||||||
|
|
||||||
|
if( ii < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_plugins[(2 * ii)+1] = m_textCtrlCommand->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
void DIALOG_BOM::OnNameEdited( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
int ii = m_lbPlugins->GetSelection();
|
||||||
|
|
||||||
|
if( ii < 0 )
|
||||||
|
return;
|
||||||
|
|
||||||
|
m_plugins[2 * ii] = m_textCtrlName->GetValue();
|
||||||
|
m_lbPlugins->SetString( ii, m_plugins[2 * ii] );
|
||||||
|
}
|
|
@ -0,0 +1,115 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "dialog_bom_base.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
BEGIN_EVENT_TABLE( DIALOG_BOM_BASE, DIALOG_SHIM )
|
||||||
|
EVT_LISTBOX( wxID_ANY, DIALOG_BOM_BASE::_wxFB_OnPluginSelected )
|
||||||
|
EVT_TEXT( IN_NAMELINE, DIALOG_BOM_BASE::_wxFB_OnNameEdited )
|
||||||
|
EVT_BUTTON( ID_CREATE_BOM, DIALOG_BOM_BASE::_wxFB_OnRunPlugin )
|
||||||
|
EVT_BUTTON( wxID_CANCEL, DIALOG_BOM_BASE::_wxFB_OnCancelClick )
|
||||||
|
EVT_BUTTON( ID_HELP, DIALOG_BOM_BASE::_wxFB_OnHelp )
|
||||||
|
EVT_BUTTON( ID_ADD_PLUGIN, DIALOG_BOM_BASE::_wxFB_OnAddPlugin )
|
||||||
|
EVT_BUTTON( wxID_BROWSE_PLUGINS, DIALOG_BOM_BASE::_wxFB_OnChoosePlugin )
|
||||||
|
EVT_BUTTON( ID_REMOVEL_PLUGIN, DIALOG_BOM_BASE::_wxFB_OnRemovePlugin )
|
||||||
|
EVT_BUTTON( wxID_ANY, DIALOG_BOM_BASE::_wxFB_OnEditPlugin )
|
||||||
|
EVT_TEXT( ID_CMDLINE, DIALOG_BOM_BASE::_wxFB_OnCommandLineEdited )
|
||||||
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
DIALOG_BOM_BASE::DIALOG_BOM_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( wxDefaultSize, wxDefaultSize );
|
||||||
|
|
||||||
|
wxBoxSizer* bMainSizer;
|
||||||
|
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bUpperSizer;
|
||||||
|
bUpperSizer = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
||||||
|
wxBoxSizer* bLeftSizer;
|
||||||
|
bLeftSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_staticTextPluginTitle = new wxStaticText( this, wxID_ANY, _("Plugins"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextPluginTitle->Wrap( -1 );
|
||||||
|
bLeftSizer->Add( m_staticTextPluginTitle, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_lbPlugins = new wxListBox( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
||||||
|
bLeftSizer->Add( m_lbPlugins, 1, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_staticTextName = new wxStaticText( this, wxID_ANY, _("Name:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextName->Wrap( -1 );
|
||||||
|
bLeftSizer->Add( m_staticTextName, 0, wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_textCtrlName = new wxTextCtrl( this, IN_NAMELINE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textCtrlName->SetMaxLength( 0 );
|
||||||
|
bLeftSizer->Add( m_textCtrlName, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bUpperSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bRightSizer;
|
||||||
|
bRightSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_buttonNetlist = new wxButton( this, ID_CREATE_BOM, _("Generate"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_buttonNetlist->SetDefault();
|
||||||
|
bRightSizer->Add( m_buttonNetlist, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Close"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonCancel, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonHelp = new wxButton( this, ID_HELP, _("Help"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonHelp, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
||||||
|
bRightSizer->Add( m_staticline2, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonAddPlugin = new wxButton( this, ID_ADD_PLUGIN, _("Add Plugin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonAddPlugin, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonBrowsePlugin = new wxButton( this, wxID_BROWSE_PLUGINS, _("Set Plugin Cmd"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonBrowsePlugin, 0, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonDelPlugin = new wxButton( this, ID_REMOVEL_PLUGIN, _("Remove Plugin"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonDelPlugin, 0, wxALIGN_CENTER_HORIZONTAL|wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_buttonEdit = new wxButton( this, wxID_ANY, _("Edit Plugin File"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bRightSizer->Add( m_buttonEdit, 0, wxALL|wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bUpperSizer->Add( bRightSizer, 0, wxALIGN_CENTER_VERTICAL, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bMainSizer->Add( bUpperSizer, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
wxBoxSizer* bbottomSizer;
|
||||||
|
bbottomSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_staticTextCmd = new wxStaticText( this, wxID_ANY, _("Command line:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_staticTextCmd->Wrap( -1 );
|
||||||
|
bbottomSizer->Add( m_staticTextCmd, 0, wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
m_textCtrlCommand = new wxTextCtrl( this, ID_CMDLINE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textCtrlCommand->SetMaxLength( 0 );
|
||||||
|
m_textCtrlCommand->SetMinSize( wxSize( 380,-1 ) );
|
||||||
|
|
||||||
|
bbottomSizer->Add( m_textCtrlCommand, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
bMainSizer->Add( bbottomSizer, 0, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
this->SetSizer( bMainSizer );
|
||||||
|
this->Layout();
|
||||||
|
|
||||||
|
this->Centre( wxBOTH );
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_BOM_BASE::~DIALOG_BOM_BASE()
|
||||||
|
{
|
||||||
|
}
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,100 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DIALOG_BOM_BASE_H__
|
||||||
|
#define __DIALOG_BOM_BASE_H__
|
||||||
|
|
||||||
|
#include <wx/artprov.h>
|
||||||
|
#include <wx/xrc/xmlres.h>
|
||||||
|
#include <wx/intl.h>
|
||||||
|
class DIALOG_SHIM;
|
||||||
|
|
||||||
|
#include "dialog_shim.h"
|
||||||
|
#include <wx/string.h>
|
||||||
|
#include <wx/stattext.h>
|
||||||
|
#include <wx/gdicmn.h>
|
||||||
|
#include <wx/font.h>
|
||||||
|
#include <wx/colour.h>
|
||||||
|
#include <wx/settings.h>
|
||||||
|
#include <wx/listbox.h>
|
||||||
|
#include <wx/textctrl.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/button.h>
|
||||||
|
#include <wx/statline.h>
|
||||||
|
#include <wx/dialog.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Class DIALOG_BOM_BASE
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class DIALOG_BOM_BASE : public DIALOG_SHIM
|
||||||
|
{
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
private:
|
||||||
|
|
||||||
|
// Private event handlers
|
||||||
|
void _wxFB_OnPluginSelected( wxCommandEvent& event ){ OnPluginSelected( event ); }
|
||||||
|
void _wxFB_OnNameEdited( wxCommandEvent& event ){ OnNameEdited( event ); }
|
||||||
|
void _wxFB_OnRunPlugin( wxCommandEvent& event ){ OnRunPlugin( event ); }
|
||||||
|
void _wxFB_OnCancelClick( wxCommandEvent& event ){ OnCancelClick( event ); }
|
||||||
|
void _wxFB_OnHelp( wxCommandEvent& event ){ OnHelp( event ); }
|
||||||
|
void _wxFB_OnAddPlugin( wxCommandEvent& event ){ OnAddPlugin( event ); }
|
||||||
|
void _wxFB_OnChoosePlugin( wxCommandEvent& event ){ OnChoosePlugin( event ); }
|
||||||
|
void _wxFB_OnRemovePlugin( wxCommandEvent& event ){ OnRemovePlugin( event ); }
|
||||||
|
void _wxFB_OnEditPlugin( wxCommandEvent& event ){ OnEditPlugin( event ); }
|
||||||
|
void _wxFB_OnCommandLineEdited( wxCommandEvent& event ){ OnCommandLineEdited( event ); }
|
||||||
|
|
||||||
|
|
||||||
|
protected:
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
IN_NAMELINE = 1000,
|
||||||
|
ID_CREATE_BOM,
|
||||||
|
ID_HELP,
|
||||||
|
ID_ADD_PLUGIN,
|
||||||
|
wxID_BROWSE_PLUGINS,
|
||||||
|
ID_REMOVEL_PLUGIN,
|
||||||
|
ID_CMDLINE
|
||||||
|
};
|
||||||
|
|
||||||
|
wxStaticText* m_staticTextPluginTitle;
|
||||||
|
wxListBox* m_lbPlugins;
|
||||||
|
wxStaticText* m_staticTextName;
|
||||||
|
wxTextCtrl* m_textCtrlName;
|
||||||
|
wxButton* m_buttonNetlist;
|
||||||
|
wxButton* m_buttonCancel;
|
||||||
|
wxButton* m_buttonHelp;
|
||||||
|
wxStaticLine* m_staticline2;
|
||||||
|
wxButton* m_buttonAddPlugin;
|
||||||
|
wxButton* m_buttonBrowsePlugin;
|
||||||
|
wxButton* m_buttonDelPlugin;
|
||||||
|
wxButton* m_buttonEdit;
|
||||||
|
wxStaticText* m_staticTextCmd;
|
||||||
|
wxTextCtrl* m_textCtrlCommand;
|
||||||
|
|
||||||
|
// Virtual event handlers, overide them in your derived class
|
||||||
|
virtual void OnPluginSelected( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnNameEdited( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRunPlugin( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnHelp( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnAddPlugin( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnChoosePlugin( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnRemovePlugin( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnEditPlugin( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
virtual void OnCommandLineEdited( wxCommandEvent& event ) { event.Skip(); }
|
||||||
|
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DIALOG_BOM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Bill of Material"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 404,315 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
|
~DIALOG_BOM_BASE();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__DIALOG_BOM_BASE_H__
|
|
@ -0,0 +1,4 @@
|
||||||
|
plugins
|
||||||
|
plugin
|
||||||
|
cmd
|
||||||
|
opts
|
|
@ -0,0 +1,210 @@
|
||||||
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
|
||||||
|
<HTML>
|
||||||
|
<HEAD>
|
||||||
|
<META HTTP-EQUIV="CONTENT-TYPE" CONTENT="text/html; charset=windows-1252">
|
||||||
|
<TITLE>kicad help</TITLE>
|
||||||
|
<META NAME="GENERATOR" CONTENT="LibreOffice 4.0.2.2 (Windows)">
|
||||||
|
<META NAME="CREATED" CONTENT="0;0">
|
||||||
|
<META NAME="CHANGED" CONTENT="20130614;10225357">
|
||||||
|
<STYLE TYPE="text/css">
|
||||||
|
<!--
|
||||||
|
@page { margin: 2cm }
|
||||||
|
P { margin-bottom: 0.21cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto }
|
||||||
|
P.western { font-family: "Arial", sans-serif; font-size: 10pt; so-language: en-US }
|
||||||
|
A:link { color: #004586; text-decoration: none }
|
||||||
|
A.western:link { font-family: "Liberation Sans", sans-serif; so-language: zxx; font-style: italic }
|
||||||
|
A.sdfootnotesym-western { font-family: "DejaVu Serif", serif }
|
||||||
|
-->
|
||||||
|
</STYLE>
|
||||||
|
</HEAD>
|
||||||
|
<BODY LANG="en-AU" LINK="#004586" DIR="LTR">
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"><A NAME="__RefHeading__2925_482973253"></A>
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>1 - Full
|
||||||
|
documentation:</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><B>The
|
||||||
|
</B></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><I><B>Eeschema
|
||||||
|
documentation, chapter 14</B></I></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><B>
|
||||||
|
describes this intermediate netlist and gives examples<BR>See also
|
||||||
|
</B></SPAN></FONT></FONT><FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN LANG="en-US"><I><B>https://answers.launchpad.net/kicad/+faq/2265</B></I></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B><I>2 - </I>The
|
||||||
|
intermediate Netlist File</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>BOM files (and
|
||||||
|
netlist files) can be created from an Intermediate netlist file
|
||||||
|
created by Eeschema.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>This file uses XML
|
||||||
|
syntax and is called the intermediate netlist. The intermediate
|
||||||
|
netlist includes a large amount of data about your board and because
|
||||||
|
of this, it can be used with post-processing to create a BOM or other
|
||||||
|
reports.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Depending on the
|
||||||
|
output (BOM or netlist), different subsets of the complete
|
||||||
|
Intermediate Netlist file will be used in the post-processing.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>3 - Conversion to
|
||||||
|
a new format</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>By applying a
|
||||||
|
post-processing filter to the Intermediate netlist file you can
|
||||||
|
generate foreign netlist files as well as BOM files. Because this
|
||||||
|
conversion is a text to text transformation.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>this post-processing
|
||||||
|
filter can be written using Python, XSLT, or any other tool capable
|
||||||
|
of taking XML as input.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">XSLT
|
||||||
|
itself is a XML language very suitable for XML transformations. There
|
||||||
|
is a free program called </SPAN></SPAN></SPAN><I><SPAN STYLE="font-weight: normal">xsltproc</SPAN></I><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">that
|
||||||
|
you can download and install. The</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">xsltproc
|
||||||
|
program can be used to read the Intermediate XML netlist input file,
|
||||||
|
apply</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal"> </SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">a
|
||||||
|
style-sheet to transform the input, and save the results in an output
|
||||||
|
file. Use of xsltproc requires a style-sheet file using XSLT
|
||||||
|
conventions. The full conversion process is handled</SPAN></SPAN></SPAN><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">by
|
||||||
|
Eeschema, after it is configured once to run xsltproc in a specific
|
||||||
|
way.</SPAN></SPAN></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4 -
|
||||||
|
Initialization of the dialog window</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>You should add a new
|
||||||
|
pluging (a script) in plugin list by clicking on the Add Plugin
|
||||||
|
button.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.1 - Plugin
|
||||||
|
Configuration Parameters</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The Eeschema plug-in
|
||||||
|
configuration dialog requires the following information:</FONT></FONT></P>
|
||||||
|
<UL>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The title: for
|
||||||
|
instance, the name of the netlist format.</FONT></FONT></P>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line to
|
||||||
|
launch the converter (usually a script).</FONT></FONT></P>
|
||||||
|
</UL>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Once you click on
|
||||||
|
the generate button the following will happen:</FONT></FONT></P>
|
||||||
|
<OL>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Eeschema creates an
|
||||||
|
intermediate netlist file *.xml, for instance <I>test.xml.</I></FONT></FONT></P>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Eeschema runs the
|
||||||
|
script from the command line to create the final output file.</FONT></FONT></P>
|
||||||
|
</OL>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.2 - Generate
|
||||||
|
netlist files with the command line</B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Assuming we are
|
||||||
|
using the program <I>xsltproc.exe</I><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">to
|
||||||
|
apply the sheet style to the intermediate file, </SPAN></SPAN><I>xsltproc.exe</I><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">is
|
||||||
|
executed with the following command.</SPAN></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>xsltproc.exe -o <
|
||||||
|
output filename > < style-sheet filename > < input XML
|
||||||
|
file to convert ></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT>
|
||||||
|
<FONT SIZE=2 STYLE="font-size: 11pt">Windows the command line is the
|
||||||
|
following.<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I>f:/kicad/bin/xsltproc.exe
|
||||||
|
-o “%O” f:/kicad/bin/plugins/myconverter.xsl “%I”</I></FONT></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT>
|
||||||
|
<FONT SIZE=2 STYLE="font-size: 11pt">Linux the command becomes as
|
||||||
|
following.<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I>xsltproc
|
||||||
|
-o “%O” /usr/local/kicad/bin/plugins/myconverter .xsl
|
||||||
|
“%I”</I></FONT></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">Where
|
||||||
|
</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><I><SPAN STYLE="font-weight: normal">myconverter</SPAN></I></FONT></SPAN><FONT SIZE=2 STYLE="font-size: 11pt"><I><SPAN STYLE="font-weight: normal">.xsl</SPAN></I></FONT><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">is
|
||||||
|
the style-sheet that you are applying. Do not forget the double
|
||||||
|
quotes</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">around
|
||||||
|
the file names, this allows them to have spaces after the
|
||||||
|
substitution by Eeschema.</SPAN></SPAN></FONT></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line
|
||||||
|
format accepts parameters for filenames:</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The supported
|
||||||
|
formatting parameters are.</FONT></FONT></P>
|
||||||
|
<UL>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%B => base
|
||||||
|
filename and path of selected output file, minus path and extension.</FONT></FONT></P>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%I => complete
|
||||||
|
filename and path of the temporary input file (the intermediate net
|
||||||
|
file).</FONT></FONT></P>
|
||||||
|
<LI><P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%O => complete
|
||||||
|
filename and path of the user chosen output file.</FONT></FONT></P>
|
||||||
|
</UL>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>%I will be replaced
|
||||||
|
by the actual intermediate file name<BR><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">%O
|
||||||
|
will be replaced by the actual output file name.</SPAN></SPAN></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.3 - Command
|
||||||
|
line format: example for <SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">xsltproc</SPAN></SPAN></B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">The
|
||||||
|
command line format for xsltproc is the following:<BR>< path of
|
||||||
|
</SPAN></SPAN>xsltproc > <SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">xsltproc
|
||||||
|
< </SPAN></SPAN>xsltproc parameters ></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On
|
||||||
|
Windows:<BR><I><B>f:/kicad/bin/xsltproc.exe -o “%O”
|
||||||
|
f:/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”</B></I></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><FONT SIZE=2 STYLE="font-size: 11pt">On</FONT>
|
||||||
|
<FONT SIZE=2 STYLE="font-size: 11pt">Linux:<BR></FONT><FONT SIZE=2 STYLE="font-size: 11pt"><I><B>xsltproc
|
||||||
|
-o “%O”
|
||||||
|
/usr/local/kicad/bin/plugins/netlist_form_pads-pcb.xsl “%I”</B></I></FONT></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">The
|
||||||
|
above examples assume</SPAN></SPAN></FONT></SPAN><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><FONT SIZE=2 STYLE="font-size: 11pt"><SPAN STYLE="font-style: normal"><SPAN STYLE="font-weight: normal">xsltproc
|
||||||
|
is installed on your PC under Windows and all files located in
|
||||||
|
kicad/bin.</SPAN></SPAN></FONT></SPAN></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3><B>4.4 - Command
|
||||||
|
line format: example fo<SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">r
|
||||||
|
python scripts</SPAN></SPAN></B></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>The command line
|
||||||
|
format for python is something like:<BR><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal">python</SPAN></SPAN><SPAN STYLE="font-variant: normal">
|
||||||
|
</SPAN><SPAN STYLE="font-variant: normal"><SPAN STYLE="font-style: normal"><
|
||||||
|
script file name </SPAN></SPAN>> < input filename > <
|
||||||
|
output filename ></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On
|
||||||
|
Windows:<BR><I><B>python.exe f:/kicad/python/my_python_script.py</B></I>
|
||||||
|
“<I><B>%I” “%O”</B></I></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>On Linux:<BR><I><B>python</B></I>
|
||||||
|
<I><B>/usr/local/kicad/python/my_python_script.py</B></I> “<I><B>%I”
|
||||||
|
“%O”</B></I></FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto">
|
||||||
|
<FONT FACE="Times New Roman, serif"><FONT SIZE=3>Assuming python is
|
||||||
|
installed on your PC.</FONT></FONT></P>
|
||||||
|
<P LANG="en-US" CLASS="western" STYLE="margin-bottom: 0cm; widows: 0; orphans: 0; page-break-before: auto; page-break-after: auto"><A NAME="__RefHeading__1787_435485510"></A>
|
||||||
|
<BR>
|
||||||
|
</P>
|
||||||
|
</BODY>
|
||||||
|
</HTML>
|
|
@ -1,591 +0,0 @@
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
|
||||||
* Copyright (C) 1992-2011 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 dialog_build_BOM.cpp
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <fctsys.h>
|
|
||||||
#include <appl_wxstruct.h>
|
|
||||||
#include <confirm.h>
|
|
||||||
#include <gestfich.h>
|
|
||||||
#include <kicad_string.h>
|
|
||||||
#include <class_sch_screen.h>
|
|
||||||
#include <wxstruct.h>
|
|
||||||
#include <build_version.h>
|
|
||||||
|
|
||||||
#include <netlist.h>
|
|
||||||
#include <template_fieldnames.h>
|
|
||||||
#include <sch_component.h>
|
|
||||||
#include <sch_sheet.h>
|
|
||||||
#include <class_library.h>
|
|
||||||
|
|
||||||
#include <wx/valgen.h>
|
|
||||||
|
|
||||||
#include <dialog_build_BOM.h>
|
|
||||||
#include <BOM_lister.h>
|
|
||||||
|
|
||||||
|
|
||||||
/* Local variables */
|
|
||||||
static bool s_ListByRef = true;
|
|
||||||
static bool s_ListByValue = true;
|
|
||||||
static bool s_ListWithSubCmponents;
|
|
||||||
static bool s_ListHierarchicalPinByName;
|
|
||||||
static bool s_ListHierarchicalPinBySheet;
|
|
||||||
static bool s_BrowseCreatedList;
|
|
||||||
static int s_OutputFormOpt;
|
|
||||||
static int s_OutputSeparatorOpt;
|
|
||||||
static bool s_Add_Location = false;
|
|
||||||
static bool s_Add_FpField_state = true;
|
|
||||||
static bool s_Add_DatasheetField_state;
|
|
||||||
static bool s_Add_F1_state;
|
|
||||||
static bool s_Add_F2_state;
|
|
||||||
static bool s_Add_F3_state;
|
|
||||||
static bool s_Add_F4_state;
|
|
||||||
static bool s_Add_F5_state;
|
|
||||||
static bool s_Add_F6_state;
|
|
||||||
static bool s_Add_F7_state;
|
|
||||||
static bool s_Add_F8_state;
|
|
||||||
static bool s_Add_Alls_state;
|
|
||||||
static char s_ExportSeparatorSymbol;
|
|
||||||
|
|
||||||
|
|
||||||
static bool* s_AddFieldList[] =
|
|
||||||
{
|
|
||||||
&s_Add_FpField_state,
|
|
||||||
&s_Add_F1_state,
|
|
||||||
&s_Add_F2_state,
|
|
||||||
&s_Add_F3_state,
|
|
||||||
&s_Add_F4_state,
|
|
||||||
&s_Add_F5_state,
|
|
||||||
&s_Add_F6_state,
|
|
||||||
&s_Add_F7_state,
|
|
||||||
&s_Add_F8_state,
|
|
||||||
&s_Add_Alls_state,
|
|
||||||
&s_Add_DatasheetField_state,
|
|
||||||
NULL
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
const wxString OPTION_BOM_LIST_REF( wxT("BomListPerRef") );
|
|
||||||
const wxString OPTION_BOM_LIST_VALUE( wxT("BomListPerValue") );
|
|
||||||
const wxString OPTION_BOM_LIST_HPINS( wxT("BomListPerHPins") );
|
|
||||||
const wxString OPTION_BOM_LIST_HPINS_BY_SHEET( wxT("BomListHPinsPerSheet") );
|
|
||||||
const wxString OPTION_BOM_LIST_HPINS_BY_NAME_( wxT("BomListHPinsPerName") );
|
|
||||||
const wxString OPTION_BOM_LIST_SUB_CMP( wxT("BomListSubCmps") );
|
|
||||||
|
|
||||||
const wxString OPTION_BOM_FORMAT( wxT("BomFormat") );
|
|
||||||
const wxString OPTION_BOM_LAUNCH_BROWSER( wxT("BomLaunchBrowser") );
|
|
||||||
const wxString OPTION_BOM_SEPARATOR( wxT("BomExportSeparator") );
|
|
||||||
const wxString OPTION_BOM_ADD_FIELD ( wxT("BomAddField") );
|
|
||||||
const wxString OPTION_BOM_ADD_LOCATION ( wxT("BomAddLocation") );
|
|
||||||
|
|
||||||
/* list of separators used in bom export to spreadsheet
|
|
||||||
* (selected by s_OutputSeparatorOpt, and s_OutputSeparatorOpt radiobox)
|
|
||||||
*/
|
|
||||||
static char s_ExportSeparator[] = ("\t;,.");
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* DIALOG_BUILD_BOM dialog type definition
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
DIALOG_BUILD_BOM::DIALOG_BUILD_BOM( EDA_DRAW_FRAME* parent ) :
|
|
||||||
DIALOG_BUILD_BOM_BASE( parent )
|
|
||||||
{
|
|
||||||
m_config = wxGetApp().GetSettings();
|
|
||||||
wxASSERT( m_config != NULL );
|
|
||||||
|
|
||||||
m_parent = parent;
|
|
||||||
|
|
||||||
Init();
|
|
||||||
|
|
||||||
if( GetSizer() )
|
|
||||||
{
|
|
||||||
GetSizer()->SetSizeHints( this );
|
|
||||||
}
|
|
||||||
Centre();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Init Controls for DIALOG_BUILD_BOM
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DIALOG_BUILD_BOM::Init()
|
|
||||||
{
|
|
||||||
SetFocus();
|
|
||||||
|
|
||||||
/* Get options */
|
|
||||||
m_config->Read( OPTION_BOM_LIST_REF, &s_ListByRef );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_VALUE , &s_ListByValue );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_HPINS, &s_ListHierarchicalPinByName );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_HPINS_BY_SHEET, &s_ListWithSubCmponents );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_HPINS_BY_NAME_, &s_ListWithSubCmponents );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_SUB_CMP, &s_ListWithSubCmponents );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_HPINS_BY_SHEET, &s_ListHierarchicalPinBySheet );
|
|
||||||
m_config->Read( OPTION_BOM_LIST_HPINS_BY_NAME_, &s_ListHierarchicalPinByName );
|
|
||||||
s_OutputFormOpt = m_config->Read( OPTION_BOM_FORMAT, 0l );
|
|
||||||
m_config->Read( OPTION_BOM_LAUNCH_BROWSER, &s_BrowseCreatedList );
|
|
||||||
s_OutputSeparatorOpt = m_config->Read( OPTION_BOM_SEPARATOR, 0l );
|
|
||||||
m_config->Read( OPTION_BOM_ADD_LOCATION, &s_Add_Location );
|
|
||||||
|
|
||||||
long addfields = m_config->Read( OPTION_BOM_ADD_FIELD, 0l );
|
|
||||||
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
|
|
||||||
{
|
|
||||||
if( (addfields & bitmask) )
|
|
||||||
*s_AddFieldList[ii] = true;
|
|
||||||
else
|
|
||||||
*s_AddFieldList[ii] = false;
|
|
||||||
|
|
||||||
bitmask <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Set validators
|
|
||||||
m_ListCmpbyRefItems->SetValidator( wxGenericValidator( &s_ListByRef ) );
|
|
||||||
m_ListSubCmpItems->SetValidator( wxGenericValidator( &s_ListWithSubCmponents ) );
|
|
||||||
m_ListCmpbyValItems->SetValidator( wxGenericValidator( &s_ListByValue ) );
|
|
||||||
m_GenListLabelsbyVal->SetValidator( wxGenericValidator( &s_ListHierarchicalPinByName ) );
|
|
||||||
m_GenListLabelsbySheet->SetValidator( wxGenericValidator( &s_ListHierarchicalPinBySheet ) );
|
|
||||||
m_OutputFormCtrl->SetValidator( wxGenericValidator( &s_OutputFormOpt ) );
|
|
||||||
m_OutputSeparatorCtrl->SetValidator( wxGenericValidator( &s_OutputSeparatorOpt ) );
|
|
||||||
m_GetListBrowser->SetValidator( wxGenericValidator( &s_BrowseCreatedList ) );
|
|
||||||
|
|
||||||
m_AddLocationField->SetValidator( wxGenericValidator( &s_Add_Location ) );
|
|
||||||
m_AddFootprintField->SetValidator( wxGenericValidator( &s_Add_FpField_state ) );
|
|
||||||
m_AddDatasheetField->SetValidator( wxGenericValidator( &s_Add_DatasheetField_state ) );
|
|
||||||
m_AddField1->SetValidator( wxGenericValidator( &s_Add_F1_state ) );
|
|
||||||
m_AddField2->SetValidator( wxGenericValidator( &s_Add_F2_state ) );
|
|
||||||
m_AddField3->SetValidator( wxGenericValidator( &s_Add_F3_state ) );
|
|
||||||
m_AddField4->SetValidator( wxGenericValidator( &s_Add_F4_state ) );
|
|
||||||
m_AddField5->SetValidator( wxGenericValidator( &s_Add_F5_state ) );
|
|
||||||
m_AddField6->SetValidator( wxGenericValidator( &s_Add_F6_state ) );
|
|
||||||
m_AddField7->SetValidator( wxGenericValidator( &s_Add_F7_state ) );
|
|
||||||
m_AddField8->SetValidator( wxGenericValidator( &s_Add_F8_state ) );
|
|
||||||
m_AddAllFields->SetValidator( wxGenericValidator( &s_Add_Alls_state ) );
|
|
||||||
|
|
||||||
m_OutputFormCtrl->SetSelection( s_OutputFormOpt );
|
|
||||||
m_OutputSeparatorCtrl->SetSelection( s_OutputSeparatorOpt );
|
|
||||||
|
|
||||||
// Enable/disable options:
|
|
||||||
wxCommandEvent dummy;
|
|
||||||
OnRadioboxSelectFormatSelected( dummy );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Called on BOM format selection:
|
|
||||||
* Enable/disable options in dialog
|
|
||||||
*/
|
|
||||||
void DIALOG_BUILD_BOM::OnRadioboxSelectFormatSelected( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
switch( m_OutputFormCtrl->GetSelection() )
|
|
||||||
{
|
|
||||||
case 0: // Human readable text full report
|
|
||||||
m_OutputSeparatorCtrl->Enable( false );
|
|
||||||
m_ListCmpbyRefItems->Enable( true );
|
|
||||||
m_ListCmpbyValItems->Enable( true );
|
|
||||||
m_GenListLabelsbyVal->Enable( true );
|
|
||||||
m_GenListLabelsbySheet->Enable( true );
|
|
||||||
m_ListSubCmpItems->Enable( true );
|
|
||||||
m_AddLocationField->Enable( true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // Csv format, full list by reference
|
|
||||||
m_OutputSeparatorCtrl->Enable( true );
|
|
||||||
m_ListCmpbyRefItems->Enable( false );
|
|
||||||
m_ListCmpbyValItems->Enable( false );
|
|
||||||
m_GenListLabelsbyVal->Enable( false );
|
|
||||||
m_GenListLabelsbySheet->Enable( false );
|
|
||||||
m_ListSubCmpItems->Enable( true );
|
|
||||||
m_AddLocationField->Enable( true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: // Csv format, grouped list by reference
|
|
||||||
m_OutputSeparatorCtrl->Enable( true );
|
|
||||||
m_ListCmpbyRefItems->Enable( false );
|
|
||||||
m_ListCmpbyValItems->Enable( false );
|
|
||||||
m_GenListLabelsbyVal->Enable( false );
|
|
||||||
m_GenListLabelsbySheet->Enable( false );
|
|
||||||
m_ListSubCmpItems->Enable( false );
|
|
||||||
m_AddLocationField->Enable( false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3: // Csv format, short list by values
|
|
||||||
m_OutputSeparatorCtrl->Enable( true );
|
|
||||||
m_ListCmpbyRefItems->Enable( false );
|
|
||||||
m_ListCmpbyValItems->Enable( false );
|
|
||||||
m_GenListLabelsbyVal->Enable( false );
|
|
||||||
m_GenListLabelsbySheet->Enable( false );
|
|
||||||
m_ListSubCmpItems->Enable( false );
|
|
||||||
m_AddLocationField->Enable( false );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DIALOG_BUILD_BOM::OnOkClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
char ExportSeparatorSymbol = s_ExportSeparator[0];
|
|
||||||
|
|
||||||
if( m_OutputSeparatorCtrl->GetSelection() > 0 )
|
|
||||||
ExportSeparatorSymbol = s_ExportSeparator[m_OutputSeparatorCtrl->GetSelection()];
|
|
||||||
|
|
||||||
int ExportFileType = m_OutputFormCtrl->GetSelection();
|
|
||||||
|
|
||||||
SavePreferences();
|
|
||||||
|
|
||||||
Create_BOM_Lists( ExportFileType, m_ListSubCmpItems->GetValue(),
|
|
||||||
ExportSeparatorSymbol, m_GetListBrowser->GetValue() );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
|
|
||||||
*/
|
|
||||||
|
|
||||||
void DIALOG_BUILD_BOM::OnCancelClick( wxCommandEvent& event )
|
|
||||||
{
|
|
||||||
EndModal( -1 );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_BUILD_BOM::SavePreferences()
|
|
||||||
{
|
|
||||||
// Determine current settings of "List items" and "Options" checkboxes
|
|
||||||
s_ListByRef = m_ListCmpbyRefItems->GetValue();
|
|
||||||
s_ListWithSubCmponents = m_ListSubCmpItems->GetValue();
|
|
||||||
s_ListByValue = m_ListCmpbyValItems->GetValue();
|
|
||||||
s_ListHierarchicalPinByName = m_GenListLabelsbyVal->GetValue();
|
|
||||||
s_ListHierarchicalPinBySheet = m_GenListLabelsbySheet->GetValue();
|
|
||||||
s_BrowseCreatedList = m_GetListBrowser->GetValue();
|
|
||||||
|
|
||||||
// (saved in config ):
|
|
||||||
|
|
||||||
// Determine current settings of both radiobutton groups
|
|
||||||
s_OutputFormOpt = m_OutputFormCtrl->GetSelection();
|
|
||||||
s_OutputSeparatorOpt = m_OutputSeparatorCtrl->GetSelection();
|
|
||||||
|
|
||||||
if( s_OutputSeparatorOpt < 0 )
|
|
||||||
s_OutputSeparatorOpt = 0;
|
|
||||||
|
|
||||||
// Determine current settings of all "Fields to add" checkboxes
|
|
||||||
s_Add_Location = m_AddLocationField->GetValue();
|
|
||||||
s_Add_FpField_state = m_AddFootprintField->GetValue();
|
|
||||||
s_Add_DatasheetField_state = m_AddDatasheetField->GetValue();
|
|
||||||
s_Add_F1_state = m_AddField1->GetValue();
|
|
||||||
s_Add_F2_state = m_AddField2->GetValue();
|
|
||||||
s_Add_F3_state = m_AddField3->GetValue();
|
|
||||||
s_Add_F4_state = m_AddField4->GetValue();
|
|
||||||
s_Add_F5_state = m_AddField5->GetValue();
|
|
||||||
s_Add_F6_state = m_AddField6->GetValue();
|
|
||||||
s_Add_F7_state = m_AddField7->GetValue();
|
|
||||||
s_Add_F8_state = m_AddField8->GetValue();
|
|
||||||
s_Add_Alls_state = m_AddAllFields->GetValue();
|
|
||||||
|
|
||||||
// Now save current settings of both radiobutton groups
|
|
||||||
m_config->Write( OPTION_BOM_LIST_REF, s_ListByRef );
|
|
||||||
m_config->Write( OPTION_BOM_LIST_VALUE , s_ListByValue );
|
|
||||||
m_config->Write( OPTION_BOM_LIST_HPINS, s_ListHierarchicalPinByName );
|
|
||||||
m_config->Write( OPTION_BOM_LIST_HPINS_BY_SHEET, s_ListHierarchicalPinBySheet );
|
|
||||||
m_config->Write( OPTION_BOM_LIST_HPINS_BY_NAME_, s_ListHierarchicalPinByName );
|
|
||||||
m_config->Write( OPTION_BOM_LIST_SUB_CMP, s_ListWithSubCmponents );
|
|
||||||
|
|
||||||
m_config->Write( OPTION_BOM_FORMAT, (long) s_OutputFormOpt );
|
|
||||||
m_config->Write( OPTION_BOM_SEPARATOR, (long) s_OutputSeparatorOpt );
|
|
||||||
m_config->Write( OPTION_BOM_LAUNCH_BROWSER, (long) s_BrowseCreatedList );
|
|
||||||
|
|
||||||
// Now save current settings of all "Fields to add" checkboxes
|
|
||||||
m_config->Write( OPTION_BOM_ADD_LOCATION, s_Add_Location );
|
|
||||||
|
|
||||||
long addfields = 0;
|
|
||||||
for( int ii = 0, bitmask = 1; s_AddFieldList[ii] != NULL; ii++ )
|
|
||||||
{
|
|
||||||
if( *s_AddFieldList[ii] )
|
|
||||||
addfields |= bitmask;
|
|
||||||
|
|
||||||
bitmask <<= 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
m_config->Write( OPTION_BOM_ADD_FIELD, addfields );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void DIALOG_BUILD_BOM::Create_BOM_Lists( int aTypeFile,
|
|
||||||
bool aIncludeSubComponents,
|
|
||||||
char aExportSeparatorSymbol,
|
|
||||||
bool aRunBrowser )
|
|
||||||
{
|
|
||||||
wxString wildcard;
|
|
||||||
|
|
||||||
static wxFileName fn;
|
|
||||||
|
|
||||||
wxFileName current = g_RootSheet->GetScreen()->GetFileName();
|
|
||||||
|
|
||||||
s_ExportSeparatorSymbol = aExportSeparatorSymbol;
|
|
||||||
|
|
||||||
if( !fn.HasName() || fn.GetName()==NAMELESS_PROJECT )
|
|
||||||
{
|
|
||||||
fn.SetName( current.GetName() );
|
|
||||||
}
|
|
||||||
// else use a previous run's name, because fn was set before and user
|
|
||||||
// is probably just iteratively refining the BOM.
|
|
||||||
|
|
||||||
if( fn.GetPath().IsEmpty() )
|
|
||||||
{
|
|
||||||
fn.SetPath( current.GetPath() );
|
|
||||||
}
|
|
||||||
// else use a previous run's path, because fn was set before and user
|
|
||||||
// is probably just iteratively refining the BOM.
|
|
||||||
|
|
||||||
wxString bomDesc = _( "Bill of Materials" ); // translate once, use twice.
|
|
||||||
|
|
||||||
if( aTypeFile == 0 )
|
|
||||||
{
|
|
||||||
fn.SetExt( wxT( "lst" ) );
|
|
||||||
wildcard = bomDesc + wxT( " (*.lst)|*.lst" );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fn.SetExt( wxT( "csv" ) );
|
|
||||||
wildcard = bomDesc + wxT( " (*.csv)|*.csv" );
|
|
||||||
}
|
|
||||||
|
|
||||||
wxFileDialog dlg( this, bomDesc, fn.GetPath(),
|
|
||||||
fn.GetFullName(), wildcard, wxFD_SAVE );
|
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
|
||||||
return;
|
|
||||||
|
|
||||||
fn = dlg.GetPath(); // remember path+filename+ext for subsequent runs.
|
|
||||||
|
|
||||||
m_listFileName = dlg.GetPath();
|
|
||||||
|
|
||||||
// Close dialog, then show the list (if so requested)
|
|
||||||
|
|
||||||
switch( aTypeFile )
|
|
||||||
{
|
|
||||||
case 0: // list
|
|
||||||
CreatePartsAndLabelsFullList( aIncludeSubComponents );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 1: // spreadsheet, Single Part per line
|
|
||||||
CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, false );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 2: // spreadsheet, group Part with same fields per line
|
|
||||||
CreateSpreadSheetPartsFullList( aIncludeSubComponents, s_Add_Location, true );
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 3: // spreadsheet, one value per line and no sub-component
|
|
||||||
CreateSpreadSheetPartsShortList();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
EndModal( 1 );
|
|
||||||
|
|
||||||
if( aRunBrowser )
|
|
||||||
{
|
|
||||||
wxString editorname = wxGetApp().GetEditorName();
|
|
||||||
wxString filename = m_listFileName;
|
|
||||||
AddDelimiterString( filename );
|
|
||||||
ExecuteFile( this, editorname, filename );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/** Helper function IsFieldChecked
|
|
||||||
* return the state of the wxCheckbox corresponding to the
|
|
||||||
* field aFieldId (FOOTPRINT, DATASHEET and FIELD1 to FIELD8
|
|
||||||
* if the option "All user fields" is checked, return always true
|
|
||||||
* for fileds ids >= FIELD1
|
|
||||||
* @param aFieldId = the field id : FOOTPRINT to FIELD8
|
|
||||||
*/
|
|
||||||
bool DIALOG_BUILD_BOM::IsFieldChecked(int aFieldId)
|
|
||||||
{
|
|
||||||
if( m_AddAllFields->IsChecked() && (aFieldId>= FIELD1) )
|
|
||||||
return true;
|
|
||||||
|
|
||||||
switch ( aFieldId )
|
|
||||||
{
|
|
||||||
case FIELD1:
|
|
||||||
return m_AddField1->IsChecked();
|
|
||||||
case FIELD2:
|
|
||||||
return m_AddField2->IsChecked();
|
|
||||||
case FIELD3:
|
|
||||||
return m_AddField3->IsChecked();
|
|
||||||
case FIELD4:
|
|
||||||
return m_AddField4->IsChecked();
|
|
||||||
case FIELD5:
|
|
||||||
return m_AddField5->IsChecked();
|
|
||||||
case FIELD6:
|
|
||||||
return m_AddField6->IsChecked();
|
|
||||||
case FIELD7:
|
|
||||||
return m_AddField7->IsChecked();
|
|
||||||
case FIELD8:
|
|
||||||
return m_AddField8->IsChecked();
|
|
||||||
case FOOTPRINT:
|
|
||||||
return m_AddFootprintField->IsChecked();
|
|
||||||
case DATASHEET:
|
|
||||||
return m_AddDatasheetField->IsChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Prints a list of components, in a form which can be imported by a spreadsheet.
|
|
||||||
* components having the same value and the same footprint
|
|
||||||
* are grouped on the same line
|
|
||||||
* Form is:
|
|
||||||
* value; number of components; list of references; <footprint>; <field1>; ...;
|
|
||||||
* list is sorted by values
|
|
||||||
*/
|
|
||||||
void DIALOG_BUILD_BOM::CreateSpreadSheetPartsShortList( )
|
|
||||||
{
|
|
||||||
FILE* f;
|
|
||||||
|
|
||||||
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
|
|
||||||
{
|
|
||||||
wxString msg;
|
|
||||||
msg.Printf( _( "Failed to open file <%s>" ), GetChars(m_listFileName) );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOM_LISTER bom_lister;
|
|
||||||
bom_lister.SetCvsFormOn( s_ExportSeparatorSymbol );
|
|
||||||
|
|
||||||
// Set the list of fields to add to list
|
|
||||||
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
|
|
||||||
if( IsFieldChecked( ii ) )
|
|
||||||
bom_lister.AddFieldIdToPrintList( ii );
|
|
||||||
// Write the list of components grouped by values:
|
|
||||||
bom_lister.CreateCsvBOMListByValues( f );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Print a list of components, in a form which can be imported by a spreadsheet
|
|
||||||
* form is:
|
|
||||||
* cmp ref; cmp val; fields;
|
|
||||||
* Components are sorted by reference
|
|
||||||
* param aIncludeSubComponents = true to print sub components
|
|
||||||
* param aPrintLocation = true to print components location
|
|
||||||
* (only possible when aIncludeSubComponents == true)
|
|
||||||
* param aGroupRefs = true to group components references, when other fieds
|
|
||||||
* have the same value
|
|
||||||
*/
|
|
||||||
void DIALOG_BUILD_BOM::CreateSpreadSheetPartsFullList( bool aIncludeSubComponents,
|
|
||||||
bool aPrintLocation,
|
|
||||||
bool aGroupRefs )
|
|
||||||
{
|
|
||||||
FILE* f;
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOM_LISTER bom_lister;
|
|
||||||
bom_lister.SetCvsFormOn( s_ExportSeparatorSymbol );
|
|
||||||
|
|
||||||
// Set group refs option (hight priority):
|
|
||||||
// Obvioulsy only useful when not including sub-components
|
|
||||||
bom_lister.SetGroupReferences( aGroupRefs );
|
|
||||||
bom_lister.SetIncludeSubCmp( aIncludeSubComponents && !aGroupRefs );
|
|
||||||
|
|
||||||
// Set print location option:
|
|
||||||
// Obvioulsy only possible when including sub components
|
|
||||||
// and not grouping references
|
|
||||||
bom_lister.SetPrintLocation( aPrintLocation && !aGroupRefs &&
|
|
||||||
aIncludeSubComponents );
|
|
||||||
|
|
||||||
// Set the list of fields to add to list
|
|
||||||
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
|
|
||||||
if( IsFieldChecked( ii ) )
|
|
||||||
bom_lister.AddFieldIdToPrintList( ii );
|
|
||||||
|
|
||||||
// create the file
|
|
||||||
bom_lister.PrintComponentsListByReferenceCsvForm( f );
|
|
||||||
|
|
||||||
fclose( f );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* CreatePartsAndLabelsFullList()
|
|
||||||
* Main function to create the list of components and/or labels
|
|
||||||
* (global labels, hierarchical labels and pin sheets )
|
|
||||||
*/
|
|
||||||
void DIALOG_BUILD_BOM::CreatePartsAndLabelsFullList( bool aIncludeSubComponents )
|
|
||||||
{
|
|
||||||
FILE* f;
|
|
||||||
wxString msg;
|
|
||||||
|
|
||||||
if( ( f = wxFopen( m_listFileName, wxT( "wt" ) ) ) == NULL )
|
|
||||||
{
|
|
||||||
msg.Printf( _( "Failed to open file <%s>" ), GetChars( m_listFileName ) );
|
|
||||||
DisplayError( this, msg );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
BOM_LISTER bom_lister;
|
|
||||||
bom_lister.SetIncludeSubCmp( aIncludeSubComponents );
|
|
||||||
bom_lister.SetCvsFormOff();
|
|
||||||
bom_lister.SetPrintLocation( s_Add_Location );
|
|
||||||
// Set the list of fields to add to list
|
|
||||||
for( int ii = FOOTPRINT; ii <= FIELD8; ii++ )
|
|
||||||
if( IsFieldChecked( ii ) )
|
|
||||||
bom_lister.AddFieldIdToPrintList( ii );
|
|
||||||
|
|
||||||
// creates the list file
|
|
||||||
wxString Title = wxGetApp().GetAppName() + wxT( " " ) + GetBuildVersion();
|
|
||||||
|
|
||||||
fprintf( f, "%s >> Creation date: %s\n", TO_UTF8( Title ), TO_UTF8( DateAndTime() ) );
|
|
||||||
|
|
||||||
if( m_ListCmpbyRefItems->GetValue() )
|
|
||||||
bom_lister.PrintComponentsListByReferenceHumanReadable( f );
|
|
||||||
|
|
||||||
if( m_ListCmpbyValItems->GetValue() )
|
|
||||||
bom_lister.PrintComponentsListByValue( f );
|
|
||||||
|
|
||||||
// Create list of global labels, hierachical labels and pins sheets
|
|
||||||
|
|
||||||
if( m_GenListLabelsbySheet->GetValue() )
|
|
||||||
bom_lister.PrintGlobalAndHierarchicalLabelsList( f, true );
|
|
||||||
|
|
||||||
if( m_GenListLabelsbyVal->GetValue() )
|
|
||||||
bom_lister.PrintGlobalAndHierarchicalLabelsList( f, false );
|
|
||||||
|
|
||||||
msg = _( "\n#End List\n" );
|
|
||||||
fprintf( f, "%s", TO_UTF8( msg ) );
|
|
||||||
fclose( f );
|
|
||||||
}
|
|
|
@ -1,94 +0,0 @@
|
||||||
/**
|
|
||||||
* @file dialog_build_BOM.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
#ifndef _DIALOG_BUILD_BOM_H_
|
|
||||||
#define _DIALOG_BUILD_BOM_H_
|
|
||||||
|
|
||||||
#include <dialog_build_BOM_base.h>
|
|
||||||
|
|
||||||
|
|
||||||
class EDA_DRAW_FRAME;
|
|
||||||
class SCH_COMPONENT;
|
|
||||||
class wxConfig;
|
|
||||||
|
|
||||||
class DIALOG_BUILD_BOM : public DIALOG_BUILD_BOM_BASE
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
EDA_DRAW_FRAME* m_parent;
|
|
||||||
wxConfig* m_config;
|
|
||||||
wxString m_listFileName; // The full filename of the file report.
|
|
||||||
|
|
||||||
private:
|
|
||||||
void OnRadioboxSelectFormatSelected( wxCommandEvent& event );
|
|
||||||
void OnOkClick( wxCommandEvent& event );
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void SavePreferences();
|
|
||||||
void Init();
|
|
||||||
void Create_BOM_Lists( int aTypeFile,
|
|
||||||
bool aIncludeSubComponents,
|
|
||||||
char aExportSeparatorSymbol,
|
|
||||||
bool aRunBrowser );
|
|
||||||
|
|
||||||
void CreatePartsAndLabelsFullList( bool aIncludeSubComponents );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CreateSpreadSheetPartsFullList
|
|
||||||
* prints a list of components, in a form which can be imported by a
|
|
||||||
* spreadsheet. Form is:
|
|
||||||
* reference; cmp value; \<footprint\>; \<field1\>; ...;
|
|
||||||
* Components are sorted by reference
|
|
||||||
* @param aIncludeSubComponents = true to print sub components
|
|
||||||
* @param aPrintLocation = true to print components location
|
|
||||||
* (only possible when aIncludeSubComponents == true)
|
|
||||||
* @param aGroupRefs = true to group components references, when other fieds
|
|
||||||
* have the same value
|
|
||||||
*/
|
|
||||||
void CreateSpreadSheetPartsFullList( bool aIncludeSubComponents,
|
|
||||||
bool aPrintLocation,
|
|
||||||
bool aGroupRefs );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function CreateSpreadSheetPartsShortList
|
|
||||||
* prints a list of components, in a form which can be imported by a spreadsheet.
|
|
||||||
* components having the same value and the same footprint
|
|
||||||
* are grouped on the same line
|
|
||||||
* Form is:
|
|
||||||
* value; number of components; list of references; \<footprint\>; \<field1\>; ...;
|
|
||||||
* list is sorted by values
|
|
||||||
*/
|
|
||||||
void CreateSpreadSheetPartsShortList();
|
|
||||||
|
|
||||||
bool IsFieldChecked( int aFieldId );
|
|
||||||
|
|
||||||
public:
|
|
||||||
DIALOG_BUILD_BOM( EDA_DRAW_FRAME* parent );
|
|
||||||
|
|
||||||
// ~DIALOG_BUILD_BOM() {};
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // _DIALOG_BUILD_BOM_H_
|
|
|
@ -1,157 +0,0 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
|
||||||
// http://www.wxformbuilder.org/
|
|
||||||
//
|
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#include "dialog_build_BOM_base.h"
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
DIALOG_BUILD_BOM_BASE::DIALOG_BUILD_BOM_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( wxDefaultSize, wxDefaultSize );
|
|
||||||
|
|
||||||
wxBoxSizer* bMainSizer;
|
|
||||||
bMainSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
wxBoxSizer* bSizerUpper;
|
|
||||||
bSizerUpper = new wxBoxSizer( wxHORIZONTAL );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbOptionsSizer;
|
|
||||||
sbOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options:") ), wxVERTICAL );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbListOptionsSizer;
|
|
||||||
sbListOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("List items:") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_ListCmpbyRefItems = new wxCheckBox( this, wxID_ANY, _("Components by reference"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbListOptionsSizer->Add( m_ListCmpbyRefItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_ListSubCmpItems = new wxCheckBox( this, wxID_ANY, _("Sub components (i.e. U2A, U2B ...)"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbListOptionsSizer->Add( m_ListSubCmpItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_ListCmpbyValItems = new wxCheckBox( this, wxID_ANY, _("Components by value"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbListOptionsSizer->Add( m_ListCmpbyValItems, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_GenListLabelsbyVal = new wxCheckBox( this, wxID_ANY, _("Hierarchical pins by name"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbListOptionsSizer->Add( m_GenListLabelsbyVal, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_GenListLabelsbySheet = new wxCheckBox( this, wxID_ANY, _("Hierarchical pins by sheet"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbListOptionsSizer->Add( m_GenListLabelsbySheet, 0, wxALL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
sbOptionsSizer->Add( sbListOptionsSizer, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxString m_OutputFormCtrlChoices[] = { _("List"), _("List for spreadsheet import (by ref)"), _("List for spreadsheet import (by grouped ref)"), _("List for spreadsheet import (by value)") };
|
|
||||||
int m_OutputFormCtrlNChoices = sizeof( m_OutputFormCtrlChoices ) / sizeof( wxString );
|
|
||||||
m_OutputFormCtrl = new wxRadioBox( this, ID_RADIOBOX_SELECT_FORMAT, _("Output format:"), wxDefaultPosition, wxDefaultSize, m_OutputFormCtrlNChoices, m_OutputFormCtrlChoices, 1, wxRA_SPECIFY_COLS );
|
|
||||||
m_OutputFormCtrl->SetSelection( 1 );
|
|
||||||
sbOptionsSizer->Add( m_OutputFormCtrl, 0, wxEXPAND|wxTOP, 5 );
|
|
||||||
|
|
||||||
wxString m_OutputSeparatorCtrlChoices[] = { _("Tab"), _(";"), _(",") };
|
|
||||||
int m_OutputSeparatorCtrlNChoices = sizeof( m_OutputSeparatorCtrlChoices ) / sizeof( wxString );
|
|
||||||
m_OutputSeparatorCtrl = new wxRadioBox( this, wxID_ANY, _("Field separator for spreadsheet import:"), wxDefaultPosition, wxDefaultSize, m_OutputSeparatorCtrlNChoices, m_OutputSeparatorCtrlChoices, 1, wxRA_SPECIFY_ROWS );
|
|
||||||
m_OutputSeparatorCtrl->SetSelection( 0 );
|
|
||||||
sbOptionsSizer->Add( m_OutputSeparatorCtrl, 0, wxEXPAND|wxTOP, 5 );
|
|
||||||
|
|
||||||
m_GetListBrowser = new wxCheckBox( this, wxID_ANY, _("Launch list browser"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbOptionsSizer->Add( m_GetListBrowser, 0, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerUpper->Add( sbOptionsSizer, 3, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxBoxSizer* bRightSizer;
|
|
||||||
bRightSizer = new wxBoxSizer( wxVERTICAL );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbAddToListSelectionSizer;
|
|
||||||
sbAddToListSelectionSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Add to list:") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_AddLocationField = new wxCheckBox( this, wxID_ANY, _("Component location"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbAddToListSelectionSizer->Add( m_AddLocationField, 0, wxALL, 5 );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbFixedFieldsSizer;
|
|
||||||
sbFixedFieldsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("System Fields:") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_AddDatasheetField = new wxCheckBox( this, wxID_ANY, _("Datasheet"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbFixedFieldsSizer->Add( m_AddDatasheetField, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddFootprintField = new wxCheckBox( this, wxID_ANY, _("Footprint"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbFixedFieldsSizer->Add( m_AddFootprintField, 0, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
sbAddToListSelectionSizer->Add( sbFixedFieldsSizer, 0, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
wxStaticBoxSizer* sbUsersFiledsSizer;
|
|
||||||
sbUsersFiledsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Users fields:") ), wxVERTICAL );
|
|
||||||
|
|
||||||
m_AddField1 = new wxCheckBox( this, wxID_ANY, _("Field 1"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField1, 0, wxEXPAND|wxALL, 5 );
|
|
||||||
|
|
||||||
m_AddField2 = new wxCheckBox( this, wxID_ANY, _("Field 2"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField2, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField3 = new wxCheckBox( this, wxID_ANY, _("Field 3"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField3, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField4 = new wxCheckBox( this, wxID_ANY, _("Field 4"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField4, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField5 = new wxCheckBox( this, wxID_ANY, _("Field 5"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField5, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField6 = new wxCheckBox( this, wxID_ANY, _("Field 6"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField6, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField7 = new wxCheckBox( this, wxID_ANY, _("Field 7"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField7, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
m_AddField8 = new wxCheckBox( this, wxID_ANY, _("Field 8"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbUsersFiledsSizer->Add( m_AddField8, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
sbAddToListSelectionSizer->Add( sbUsersFiledsSizer, 0, wxEXPAND|wxTOP, 5 );
|
|
||||||
|
|
||||||
m_AddAllFields = new wxCheckBox( this, wxID_ANY, _("All existing user fields"), wxDefaultPosition, wxDefaultSize, 0 );
|
|
||||||
sbAddToListSelectionSizer->Add( m_AddAllFields, 0, wxALL, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bRightSizer->Add( sbAddToListSelectionSizer, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bSizerUpper->Add( bRightSizer, 2, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
bMainSizer->Add( bSizerUpper, 1, wxEXPAND, 5 );
|
|
||||||
|
|
||||||
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
|
|
||||||
bMainSizer->Add( m_staticline1, 0, wxEXPAND|wxLEFT|wxRIGHT, 5 );
|
|
||||||
|
|
||||||
m_sdbSizer = new wxStdDialogButtonSizer();
|
|
||||||
m_sdbSizerOK = new wxButton( this, wxID_OK );
|
|
||||||
m_sdbSizer->AddButton( m_sdbSizerOK );
|
|
||||||
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
|
|
||||||
m_sdbSizer->AddButton( m_sdbSizerCancel );
|
|
||||||
m_sdbSizer->Realize();
|
|
||||||
|
|
||||||
bMainSizer->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 5 );
|
|
||||||
|
|
||||||
|
|
||||||
this->SetSizer( bMainSizer );
|
|
||||||
this->Layout();
|
|
||||||
bMainSizer->Fit( this );
|
|
||||||
|
|
||||||
// Connect Events
|
|
||||||
m_OutputFormCtrl->Connect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnRadioboxSelectFormatSelected ), NULL, this );
|
|
||||||
m_sdbSizerCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnCancelClick ), NULL, this );
|
|
||||||
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnOkClick ), NULL, this );
|
|
||||||
}
|
|
||||||
|
|
||||||
DIALOG_BUILD_BOM_BASE::~DIALOG_BUILD_BOM_BASE()
|
|
||||||
{
|
|
||||||
// Disconnect Events
|
|
||||||
m_OutputFormCtrl->Disconnect( wxEVT_COMMAND_RADIOBOX_SELECTED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnRadioboxSelectFormatSelected ), NULL, this );
|
|
||||||
m_sdbSizerCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnCancelClick ), NULL, this );
|
|
||||||
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_BUILD_BOM_BASE::OnOkClick ), NULL, this );
|
|
||||||
|
|
||||||
}
|
|
File diff suppressed because it is too large
Load Diff
|
@ -1,83 +0,0 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
|
||||||
// http://www.wxformbuilder.org/
|
|
||||||
//
|
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
#ifndef __DIALOG_BUILD_BOM_BASE_H__
|
|
||||||
#define __DIALOG_BUILD_BOM_BASE_H__
|
|
||||||
|
|
||||||
#include <wx/artprov.h>
|
|
||||||
#include <wx/xrc/xmlres.h>
|
|
||||||
#include <wx/intl.h>
|
|
||||||
class DIALOG_SHIM;
|
|
||||||
|
|
||||||
#include "dialog_shim.h"
|
|
||||||
#include <wx/string.h>
|
|
||||||
#include <wx/checkbox.h>
|
|
||||||
#include <wx/gdicmn.h>
|
|
||||||
#include <wx/font.h>
|
|
||||||
#include <wx/colour.h>
|
|
||||||
#include <wx/settings.h>
|
|
||||||
#include <wx/sizer.h>
|
|
||||||
#include <wx/statbox.h>
|
|
||||||
#include <wx/radiobox.h>
|
|
||||||
#include <wx/statline.h>
|
|
||||||
#include <wx/button.h>
|
|
||||||
#include <wx/dialog.h>
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
/// Class DIALOG_BUILD_BOM_BASE
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
class DIALOG_BUILD_BOM_BASE : public DIALOG_SHIM
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
|
|
||||||
protected:
|
|
||||||
enum
|
|
||||||
{
|
|
||||||
ID_RADIOBOX_SELECT_FORMAT = 1000
|
|
||||||
};
|
|
||||||
|
|
||||||
wxCheckBox* m_ListCmpbyRefItems;
|
|
||||||
wxCheckBox* m_ListSubCmpItems;
|
|
||||||
wxCheckBox* m_ListCmpbyValItems;
|
|
||||||
wxCheckBox* m_GenListLabelsbyVal;
|
|
||||||
wxCheckBox* m_GenListLabelsbySheet;
|
|
||||||
wxRadioBox* m_OutputFormCtrl;
|
|
||||||
wxRadioBox* m_OutputSeparatorCtrl;
|
|
||||||
wxCheckBox* m_GetListBrowser;
|
|
||||||
wxCheckBox* m_AddLocationField;
|
|
||||||
wxCheckBox* m_AddDatasheetField;
|
|
||||||
wxCheckBox* m_AddFootprintField;
|
|
||||||
wxCheckBox* m_AddField1;
|
|
||||||
wxCheckBox* m_AddField2;
|
|
||||||
wxCheckBox* m_AddField3;
|
|
||||||
wxCheckBox* m_AddField4;
|
|
||||||
wxCheckBox* m_AddField5;
|
|
||||||
wxCheckBox* m_AddField6;
|
|
||||||
wxCheckBox* m_AddField7;
|
|
||||||
wxCheckBox* m_AddField8;
|
|
||||||
wxCheckBox* m_AddAllFields;
|
|
||||||
wxStaticLine* m_staticline1;
|
|
||||||
wxStdDialogButtonSizer* m_sdbSizer;
|
|
||||||
wxButton* m_sdbSizerOK;
|
|
||||||
wxButton* m_sdbSizerCancel;
|
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
|
||||||
virtual void OnRadioboxSelectFormatSelected( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
DIALOG_BUILD_BOM_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("List of Materials"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
|
||||||
~DIALOG_BUILD_BOM_BASE();
|
|
||||||
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif //__DIALOG_BUILD_BOM_BASE_H__
|
|
|
@ -1,8 +1,29 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Name: dialog_edit_component_in_lib.cpp
|
* @file dialog_edit_component_in_lib.cpp
|
||||||
// Author: jean-pierre Charras
|
*/
|
||||||
// Licence: GPL
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
#include <fctsys.h>
|
#include <fctsys.h>
|
||||||
#include <common.h>
|
#include <common.h>
|
||||||
|
@ -11,12 +32,12 @@
|
||||||
#include <appl_wxstruct.h>
|
#include <appl_wxstruct.h>
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <protos.h>
|
|
||||||
#include <libeditframe.h>
|
#include <libeditframe.h>
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
|
|
||||||
#include <dialog_edit_component_in_lib.h>
|
#include <dialog_edit_component_in_lib.h>
|
||||||
|
|
||||||
|
int DIALOG_EDIT_COMPONENT_IN_LIBRARY::m_lastOpenedPage = 0;
|
||||||
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent ):
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRAME* aParent ):
|
||||||
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent )
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( aParent )
|
||||||
|
@ -33,6 +54,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY::DIALOG_EDIT_COMPONENT_IN_LIBRARY( LIB_EDIT_FRA
|
||||||
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
|
DIALOG_EDIT_COMPONENT_IN_LIBRARY::~DIALOG_EDIT_COMPONENT_IN_LIBRARY()
|
||||||
{
|
{
|
||||||
|
m_lastOpenedPage = m_NoteBook->GetSelection( );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Initialize state of check boxes and texts
|
/* Initialize state of check boxes and texts
|
||||||
|
@ -86,6 +108,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
|
||||||
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m_NoteBook->SetSelection( m_lastOpenedPage );
|
||||||
|
|
||||||
m_stdSizerButtonOK->SetDefault();
|
m_stdSizerButtonOK->SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -156,7 +180,6 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::InitBasicPanel()
|
||||||
|
|
||||||
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
|
||||||
/* Update the doc, keyword and doc filename strings */
|
/* Update the doc, keyword and doc filename strings */
|
||||||
int index;
|
int index;
|
||||||
LIB_ALIAS* alias;
|
LIB_ALIAS* alias;
|
||||||
|
|
|
@ -1,8 +1,29 @@
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/**
|
||||||
// Name: dialog_edit_component_in_lib.h
|
* @file dialog_edit_component_in_lib.h
|
||||||
// Author: jean-pierre Charras
|
*/
|
||||||
// Licence: GPL
|
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, you may find one here:
|
||||||
|
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||||
|
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||||
|
* or you may write to the Free Software Foundation, Inc.,
|
||||||
|
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
#ifndef _DIALOG_EDIT_COMPONENT_IN_LIB_H_
|
#ifndef _DIALOG_EDIT_COMPONENT_IN_LIB_H_
|
||||||
|
@ -13,6 +34,8 @@
|
||||||
|
|
||||||
class DIALOG_EDIT_COMPONENT_IN_LIBRARY: public DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
|
class DIALOG_EDIT_COMPONENT_IN_LIBRARY: public DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE
|
||||||
{
|
{
|
||||||
|
static int m_lastOpenedPage; // To remember the last notebook selection
|
||||||
|
|
||||||
public:
|
public:
|
||||||
LIB_EDIT_FRAME* m_Parent;
|
LIB_EDIT_FRAME* m_Parent;
|
||||||
bool m_RecreateToolbar;
|
bool m_RecreateToolbar;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 10 2012)
|
// 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!
|
||||||
|
@ -109,7 +109,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
|
||||||
m_PanelBasic->SetSizer( bSizerBasicPanel );
|
m_PanelBasic->SetSizer( bSizerBasicPanel );
|
||||||
m_PanelBasic->Layout();
|
m_PanelBasic->Layout();
|
||||||
bSizerBasicPanel->Fit( m_PanelBasic );
|
bSizerBasicPanel->Fit( m_PanelBasic );
|
||||||
m_NoteBook->AddPage( m_PanelBasic, _("Options"), false );
|
m_NoteBook->AddPage( m_PanelBasic, _("Options"), true );
|
||||||
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* m_PanelDocBoxSizer;
|
wxBoxSizer* m_PanelDocBoxSizer;
|
||||||
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
|
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
|
||||||
|
@ -121,6 +121,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
|
||||||
m_PanelDocBoxSizer->Add( m_staticTextDescription, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_staticTextDescription, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_DocCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_DocCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_DocCtrl->SetMaxLength( 0 );
|
||||||
m_PanelDocBoxSizer->Add( m_DocCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_DocCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -130,6 +131,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
|
||||||
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_KeywordsCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_KeywordsCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_KeywordsCtrl->SetMaxLength( 0 );
|
||||||
m_PanelDocBoxSizer->Add( m_KeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_KeywordsCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_staticTextDocFileName = new wxStaticText( m_PanelDoc, wxID_ANY, _("DocFileName:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextDocFileName = new wxStaticText( m_PanelDoc, wxID_ANY, _("DocFileName:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -139,6 +141,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
|
||||||
m_PanelDocBoxSizer->Add( m_staticTextDocFileName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_staticTextDocFileName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
m_DocfileCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 );
|
m_DocfileCtrl = new wxTextCtrl( m_PanelDoc, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 400,-1 ), 0 );
|
||||||
|
m_DocfileCtrl->SetMaxLength( 0 );
|
||||||
m_PanelDocBoxSizer->Add( m_DocfileCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
m_PanelDocBoxSizer->Add( m_DocfileCtrl, 0, wxEXPAND|wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||||
|
|
||||||
wxBoxSizer* bSizerPaneldocbutts;
|
wxBoxSizer* bSizerPaneldocbutts;
|
||||||
|
@ -157,7 +160,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
|
||||||
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
|
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
|
||||||
m_PanelDoc->Layout();
|
m_PanelDoc->Layout();
|
||||||
m_PanelDocBoxSizer->Fit( m_PanelDoc );
|
m_PanelDocBoxSizer->Fit( m_PanelDoc );
|
||||||
m_NoteBook->AddPage( m_PanelDoc, _("Description"), true );
|
m_NoteBook->AddPage( m_PanelDoc, _("Description"), false );
|
||||||
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
|
||||||
wxBoxSizer* bSizerMainPanelAlias;
|
wxBoxSizer* bSizerMainPanelAlias;
|
||||||
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
|
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
|
||||||
|
|
|
@ -185,7 +185,7 @@
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Options</property>
|
<property name="label">Options</property>
|
||||||
<property name="select">0</property>
|
<property name="select">1</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
|
@ -1348,7 +1348,7 @@
|
||||||
<object class="notebookpage" expanded="1">
|
<object class="notebookpage" expanded="1">
|
||||||
<property name="bitmap"></property>
|
<property name="bitmap"></property>
|
||||||
<property name="label">Description</property>
|
<property name="label">Description</property>
|
||||||
<property name="select">1</property>
|
<property name="select">0</property>
|
||||||
<object class="wxPanel" expanded="1">
|
<object class="wxPanel" expanded="1">
|
||||||
<property name="BottomDockable">1</property>
|
<property name="BottomDockable">1</property>
|
||||||
<property name="LeftDockable">1</property>
|
<property name="LeftDockable">1</property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 10 2012)
|
// 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!
|
||||||
|
@ -11,6 +11,8 @@
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/xrc/xmlres.h>
|
#include <wx/xrc/xmlres.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
class DIALOG_SHIM;
|
||||||
|
|
||||||
#include "dialog_shim.h"
|
#include "dialog_shim.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
|
|
|
@ -40,12 +40,95 @@
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
|
#include <dialog_edit_component_in_schematic_fbp.h>
|
||||||
|
|
||||||
#include <dialog_edit_component_in_schematic.h>
|
|
||||||
|
/**
|
||||||
|
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
|
||||||
|
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
|
||||||
|
* is maintained by wxFormBuilder. Do not auto-generate this class or file,
|
||||||
|
* it is hand coded.
|
||||||
|
*/
|
||||||
|
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
/** Constructor */
|
||||||
|
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function InitBuffers
|
||||||
|
* sets up to edit the given component.
|
||||||
|
* @param aComponent The component to edit.
|
||||||
|
*/
|
||||||
|
void InitBuffers( SCH_COMPONENT* aComponent );
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
friend class SCH_EDIT_FRAME;
|
||||||
|
|
||||||
|
SCH_EDIT_FRAME* m_Parent;
|
||||||
|
SCH_COMPONENT* m_Cmp;
|
||||||
|
LIB_COMPONENT* m_LibEntry;
|
||||||
|
bool m_skipCopyFromPanel;
|
||||||
|
|
||||||
|
static int s_SelectedRow;
|
||||||
|
|
||||||
|
/// a copy of the edited component's SCH_FIELDs
|
||||||
|
SCH_FIELDS m_FieldsBuf;
|
||||||
|
|
||||||
|
void setSelectedFieldNdx( int aFieldNdx );
|
||||||
|
|
||||||
|
int getSelectedFieldNdx();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function copySelectedFieldToPanel
|
||||||
|
* sets the values displayed on the panel according to
|
||||||
|
* the currently selected field row
|
||||||
|
*/
|
||||||
|
void copySelectedFieldToPanel();
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function copyPanelToSelectedField
|
||||||
|
* copies the values displayed on the panel fields to the currently
|
||||||
|
* selected field
|
||||||
|
* @return bool - true if all fields are OK, else false if the user has put
|
||||||
|
* bad data into a field, and this value can be used to deny a row change.
|
||||||
|
*/
|
||||||
|
bool copyPanelToSelectedField();
|
||||||
|
|
||||||
|
void copyOptionsToPanel();
|
||||||
|
|
||||||
|
void copyPanelToOptions();
|
||||||
|
|
||||||
|
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
|
||||||
|
|
||||||
|
// event handlers
|
||||||
|
void OnListItemDeselected( wxListEvent& event );
|
||||||
|
void OnListItemSelected( wxListEvent& event );
|
||||||
|
void OnCancelButtonClick( wxCommandEvent& event );
|
||||||
|
void OnOKButtonClick( wxCommandEvent& event );
|
||||||
|
void SetInitCmp( wxCommandEvent& event );
|
||||||
|
void addFieldButtonHandler( wxCommandEvent& event );
|
||||||
|
void deleteFieldButtonHandler( wxCommandEvent& event );
|
||||||
|
void moveUpButtonHandler( wxCommandEvent& event );
|
||||||
|
|
||||||
|
SCH_FIELD* findField( const wxString& aFieldName );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function updateDisplay
|
||||||
|
* update the listbox showing fields, according to the fields texts
|
||||||
|
* must be called after a text change in fields, if this change is not an edition
|
||||||
|
*/
|
||||||
|
void updateDisplay( )
|
||||||
|
{
|
||||||
|
for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
|
||||||
|
setRowItem( ii, m_FieldsBuf[ii] );
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
|
int DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_SelectedRow;
|
||||||
wxSize DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = wxDefaultSize;
|
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
|
void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
|
||||||
|
@ -59,25 +142,11 @@ void SCH_EDIT_FRAME::EditComponent( SCH_COMPONENT* aComponent )
|
||||||
|
|
||||||
dlg->InitBuffers( aComponent );
|
dlg->InitBuffers( aComponent );
|
||||||
|
|
||||||
wxSize sizeNow = dlg->GetSize();
|
|
||||||
|
|
||||||
// this relies on wxDefaultSize being -1,-1, be careful here.
|
|
||||||
if( sizeNow.GetWidth() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetWidth()
|
|
||||||
|| sizeNow.GetHeight() < DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize.GetHeight() )
|
|
||||||
{
|
|
||||||
dlg->SetSize( DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize );
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
|
// make sure the chipnameTextCtrl is wide enough to hold any unusually long chip names:
|
||||||
EnsureTextCtrlWidth( dlg->chipnameTextCtrl );
|
EnsureTextCtrlWidth( dlg->chipnameTextCtrl );
|
||||||
|
|
||||||
dlg->ShowModal();
|
dlg->ShowModal();
|
||||||
|
|
||||||
// Some of the field values are long and are not always fully visible because the
|
|
||||||
// window comes up too narrow. Remember user's manual window resizing efforts here
|
|
||||||
// so it comes up wide enough next time.
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::s_LastSize = dlg->GetSize();
|
|
||||||
|
|
||||||
m_canvas->MoveCursorToCrossHair();
|
m_canvas->MoveCursorToCrossHair();
|
||||||
m_canvas->SetIgnoreMouseEvents( false );
|
m_canvas->SetIgnoreMouseEvents( false );
|
||||||
dlg->Destroy();
|
dlg->Destroy();
|
||||||
|
|
|
@ -1,105 +0,0 @@
|
||||||
|
|
||||||
#ifndef __dialog_edit_component_in_schematic__
|
|
||||||
#define __dialog_edit_component_in_schematic__
|
|
||||||
|
|
||||||
|
|
||||||
#include <sch_field.h>
|
|
||||||
#include <template_fieldnames.h>
|
|
||||||
|
|
||||||
#include <dialog_edit_component_in_schematic_fbp.h>
|
|
||||||
|
|
||||||
|
|
||||||
class SCH_EDIT_FRAME;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
|
|
||||||
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which
|
|
||||||
* is maintained by wxFormBuilder. Do not auto-generate this class or file,
|
|
||||||
* it is hand coded.
|
|
||||||
*/
|
|
||||||
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
|
|
||||||
{
|
|
||||||
friend class SCH_EDIT_FRAME;
|
|
||||||
|
|
||||||
SCH_EDIT_FRAME* m_Parent;
|
|
||||||
SCH_COMPONENT* m_Cmp;
|
|
||||||
LIB_COMPONENT* m_LibEntry;
|
|
||||||
bool m_skipCopyFromPanel;
|
|
||||||
|
|
||||||
static int s_SelectedRow;
|
|
||||||
|
|
||||||
/// The size of the dialog window last time it was displayed;
|
|
||||||
static wxSize s_LastSize;
|
|
||||||
|
|
||||||
/// a copy of the edited component's SCH_FIELDs
|
|
||||||
SCH_FIELDS m_FieldsBuf;
|
|
||||||
|
|
||||||
void setSelectedFieldNdx( int aFieldNdx );
|
|
||||||
|
|
||||||
int getSelectedFieldNdx();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function copySelectedFieldToPanel
|
|
||||||
* sets the values displayed on the panel according to
|
|
||||||
* the currently selected field row
|
|
||||||
*/
|
|
||||||
void copySelectedFieldToPanel();
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function copyPanelToSelectedField
|
|
||||||
* copies the values displayed on the panel fields to the currently
|
|
||||||
* selected field
|
|
||||||
* @return bool - true if all fields are OK, else false if the user has put
|
|
||||||
* bad data into a field, and this value can be used to deny a row change.
|
|
||||||
*/
|
|
||||||
bool copyPanelToSelectedField();
|
|
||||||
|
|
||||||
void copyOptionsToPanel();
|
|
||||||
|
|
||||||
void copyPanelToOptions();
|
|
||||||
|
|
||||||
void setRowItem( int aFieldNdx, const SCH_FIELD& aField );
|
|
||||||
|
|
||||||
// event handlers
|
|
||||||
void OnListItemDeselected( wxListEvent& event );
|
|
||||||
void OnListItemSelected( wxListEvent& event );
|
|
||||||
void OnCancelButtonClick( wxCommandEvent& event );
|
|
||||||
void OnOKButtonClick( wxCommandEvent& event );
|
|
||||||
void SetInitCmp( wxCommandEvent& event );
|
|
||||||
void addFieldButtonHandler( wxCommandEvent& event );
|
|
||||||
void deleteFieldButtonHandler( wxCommandEvent& event );
|
|
||||||
void moveUpButtonHandler( wxCommandEvent& event );
|
|
||||||
|
|
||||||
SCH_FIELD* findField( const wxString& aFieldName );
|
|
||||||
|
|
||||||
|
|
||||||
protected:
|
|
||||||
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Constructor */
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function InitBuffers
|
|
||||||
* sets up to edit the given component.
|
|
||||||
* @param aComponent The component to edit.
|
|
||||||
*/
|
|
||||||
void InitBuffers( SCH_COMPONENT* aComponent );
|
|
||||||
|
|
||||||
private:
|
|
||||||
/**
|
|
||||||
* Function updateDisplay
|
|
||||||
* update the listbox showing fields, according to the fields texts
|
|
||||||
* must be called after a text change in fields, if this change is not an edition
|
|
||||||
*/
|
|
||||||
void updateDisplay( )
|
|
||||||
{
|
|
||||||
for( unsigned ii = FIELD1; ii<m_FieldsBuf.size(); ii++ )
|
|
||||||
setRowItem( ii, m_FieldsBuf[ii] );
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif // __dialog_edit_component_in_schematic__
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -9,7 +9,7 @@
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
|
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( 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( wxDefaultSize, wxDefaultSize );
|
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
|
||||||
|
|
||||||
|
|
|
@ -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>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -11,6 +11,9 @@
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/xrc/xmlres.h>
|
#include <wx/xrc/xmlres.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
class DIALOG_SHIM;
|
||||||
|
|
||||||
|
#include "dialog_shim.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#include <wx/gdicmn.h>
|
#include <wx/gdicmn.h>
|
||||||
|
@ -33,7 +36,7 @@
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
|
/// Class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public wxDialog
|
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP : public DIALOG_SHIM
|
||||||
{
|
{
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
|
@ -35,6 +35,7 @@
|
||||||
#include <appl_wxstruct.h>
|
#include <appl_wxstruct.h>
|
||||||
#include <class_sch_screen.h>
|
#include <class_sch_screen.h>
|
||||||
#include <wxEeschemaStruct.h>
|
#include <wxEeschemaStruct.h>
|
||||||
|
#include <invoke_sch_dialog.h>
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <netlist.h>
|
#include <netlist.h>
|
||||||
|
@ -45,6 +46,7 @@
|
||||||
#include <dialog_erc.h>
|
#include <dialog_erc.h>
|
||||||
#include <dialog_erc_listbox.h>
|
#include <dialog_erc_listbox.h>
|
||||||
#include <erc.h>
|
#include <erc.h>
|
||||||
|
#include <id.h>
|
||||||
|
|
||||||
|
|
||||||
bool DIALOG_ERC::m_writeErcFile = false;
|
bool DIALOG_ERC::m_writeErcFile = false;
|
||||||
|
@ -57,7 +59,10 @@ END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
DIALOG_ERC::DIALOG_ERC( SCH_EDIT_FRAME* parent ) :
|
||||||
DIALOG_ERC_BASE( parent )
|
DIALOG_ERC_BASE(
|
||||||
|
parent,
|
||||||
|
ID_DIALOG_ERC // parent looks for this ID explicitly
|
||||||
|
)
|
||||||
{
|
{
|
||||||
m_parent = parent;
|
m_parent = parent;
|
||||||
Init();
|
Init();
|
||||||
|
@ -564,3 +569,14 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
// This is a modeless dialog, so new it rather than instantiating on stack.
|
||||||
|
DIALOG_ERC* dlg = new DIALOG_ERC( aCaller );
|
||||||
|
|
||||||
|
dlg->Show( true );
|
||||||
|
|
||||||
|
return dlg; // wxDialog is information hiding about DIALOG_ERC.
|
||||||
|
}
|
||||||
|
|
|
@ -1,10 +1,12 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 11 2012)
|
// 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!
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "wx/bmpcbox.h"
|
||||||
|
|
||||||
#include "dialog_lib_edit_pin_base.h"
|
#include "dialog_lib_edit_pin_base.h"
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -33,6 +35,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerPins->Add( m_staticTextPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_textPinName = new wxTextCtrl( this, ID_M_TEXTPINNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textPinName->SetMaxLength( 0 );
|
||||||
fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
fgSizerPins->Add( m_textPinName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||||
|
|
||||||
m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextPadName = new wxStaticText( this, ID_M_STATICTEXTPADNAME, _("Pin n&umber:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -42,13 +45,14 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerPins->Add( m_staticTextPadName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_textPadName = new wxTextCtrl( this, ID_M_TEXTPADNAME, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textPadName->SetMaxLength( 0 );
|
||||||
fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
fgSizerPins->Add( m_textPadName, 0, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||||
|
|
||||||
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextOrient = new wxStaticText( this, wxID_ANY, _("&Orientation:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextOrient->Wrap( -1 );
|
m_staticTextOrient->Wrap( -1 );
|
||||||
fgSizerPins->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerPins->Add( m_staticTextOrient, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
m_choiceOrientation = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||||
fgSizerPins->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
fgSizerPins->Add( m_choiceOrientation, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||||
|
|
||||||
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextEType = new wxStaticText( this, wxID_ANY, _("&Electrical type:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -57,14 +61,14 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
|
|
||||||
fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerPins->Add( m_staticTextEType, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
m_choiceElectricalType = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||||
fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
fgSizerPins->Add( m_choiceElectricalType, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||||
|
|
||||||
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticTextGstyle = new wxStaticText( this, wxID_ANY, _("Graphic &Style:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
m_staticTextGstyle->Wrap( -1 );
|
m_staticTextGstyle->Wrap( -1 );
|
||||||
fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerPins->Add( m_staticTextGstyle, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, 0 );
|
m_choiceStyle = new wxBitmapComboBox( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0, NULL, wxCB_READONLY );
|
||||||
fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
fgSizerPins->Add( m_choiceStyle, 0, wxEXPAND|wxTOP|wxBOTTOM, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,6 +119,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
fgSizerTextsSizes->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerTextsSizes->Add( m_staticTextNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_textPinNameTextSize = new wxTextCtrl( this, ID_M_TEXTPINNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textPinNameTextSize->SetMaxLength( 0 );
|
||||||
fgSizerTextsSizes->Add( m_textPinNameTextSize, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
fgSizerTextsSizes->Add( m_textPinNameTextSize, 1, wxALIGN_CENTER_VERTICAL|wxEXPAND|wxTOP|wxBOTTOM, 3 );
|
||||||
|
|
||||||
m_staticNameTextSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticNameTextSizeUnits = new wxStaticText( this, ID_M_STATICNAMETEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -126,6 +131,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
fgSizerTextsSizes->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
fgSizerTextsSizes->Add( m_staticTextPadNameSize, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
|
||||||
|
|
||||||
m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_textPadNameTextSize = new wxTextCtrl( this, ID_M_TEXTPADNAMETEXTSIZE, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textPadNameTextSize->SetMaxLength( 0 );
|
||||||
fgSizerTextsSizes->Add( m_textPadNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxEXPAND, 3 );
|
fgSizerTextsSizes->Add( m_textPadNameTextSize, 0, wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxEXPAND, 3 );
|
||||||
|
|
||||||
m_staticNumberTextSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticNumberTextSizeUnits = new wxStaticText( this, ID_M_STATICNUMBERTEXTSIZEUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
@ -137,6 +143,7 @@ DIALOG_LIB_EDIT_PIN_BASE::DIALOG_LIB_EDIT_PIN_BASE( wxWindow* parent, wxWindowID
|
||||||
fgSizerTextsSizes->Add( m_staticTextPinLen, 0, wxALL, 5 );
|
fgSizerTextsSizes->Add( m_staticTextPinLen, 0, wxALL, 5 );
|
||||||
|
|
||||||
m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
m_textLength = new wxTextCtrl( this, ID_M_TEXTLENGTH, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_textLength->SetMaxLength( 0 );
|
||||||
fgSizerTextsSizes->Add( m_textLength, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 );
|
fgSizerTextsSizes->Add( m_textLength, 0, wxTOP|wxBOTTOM|wxEXPAND, 5 );
|
||||||
|
|
||||||
m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
m_staticLengthUnits = new wxStaticText( this, ID_M_STATICLENGTHUNITS, _("units"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
|
|
@ -607,7 +607,7 @@
|
||||||
<property name="selection">-1</property>
|
<property name="selection">-1</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style"></property>
|
<property name="style">wxCB_READONLY</property>
|
||||||
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
||||||
<property name="toolbar_pane">0</property>
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
|
@ -781,7 +781,7 @@
|
||||||
<property name="selection">-1</property>
|
<property name="selection">-1</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style"></property>
|
<property name="style">wxCB_READONLY</property>
|
||||||
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
||||||
<property name="toolbar_pane">0</property>
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
|
@ -955,7 +955,7 @@
|
||||||
<property name="selection">-1</property>
|
<property name="selection">-1</property>
|
||||||
<property name="show">1</property>
|
<property name="show">1</property>
|
||||||
<property name="size"></property>
|
<property name="size"></property>
|
||||||
<property name="style"></property>
|
<property name="style">wxCB_READONLY</property>
|
||||||
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
<property name="subclass">wxBitmapComboBox; wx/bmpcbox.h</property>
|
||||||
<property name="toolbar_pane">0</property>
|
<property name="toolbar_pane">0</property>
|
||||||
<property name="tooltip"></property>
|
<property name="tooltip"></property>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 11 2012)
|
// 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!
|
||||||
|
@ -11,7 +11,9 @@
|
||||||
#include <wx/artprov.h>
|
#include <wx/artprov.h>
|
||||||
#include <wx/xrc/xmlres.h>
|
#include <wx/xrc/xmlres.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include "wx/bmpcbox.h"
|
class DIALOG_SHIM;
|
||||||
|
class wxBitmapComboBox;
|
||||||
|
|
||||||
#include "dialog_shim.h"
|
#include "dialog_shim.h"
|
||||||
#include <wx/string.h>
|
#include <wx/string.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
/*
|
/*
|
||||||
* 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) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net>
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or
|
* This program is free software; you can redistribute it and/or
|
||||||
|
@ -49,13 +49,184 @@
|
||||||
#include <protos.h>
|
#include <protos.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <dialog_netlist.h>
|
#include <dialogs/dialog_netlist_base.h>
|
||||||
#include <dialogs/annotate_dialog.h>
|
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
#include <wildcards_and_files_ext.h>
|
#include <wildcards_and_files_ext.h>
|
||||||
|
#include <invoke_sch_dialog.h>
|
||||||
|
|
||||||
#include <eeschema_id.h>
|
#include <eeschema_id.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
||||||
|
|
||||||
|
|
||||||
|
/* panel (notebook page) identifiers */
|
||||||
|
enum panel_netlist_index {
|
||||||
|
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
|
||||||
|
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
|
||||||
|
PANELCADSTAR, /* Handle Netlist format CadStar */
|
||||||
|
PANELSPICE, /* Handle Netlist format Pspice */
|
||||||
|
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
|
||||||
|
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* wxPanels for creating the NoteBook pages for each netlist format: */
|
||||||
|
class NETLIST_PAGE_DIALOG : public wxPanel
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
NETLIST_TYPE_ID m_IdNetType;
|
||||||
|
wxCheckBox* m_IsCurrentFormat;
|
||||||
|
wxCheckBox* m_AddSubPrefix;
|
||||||
|
wxTextCtrl* m_CommandStringCtrl;
|
||||||
|
wxTextCtrl* m_TitleStringCtrl;
|
||||||
|
wxButton* m_ButtonCancel;
|
||||||
|
wxBoxSizer* m_LeftBoxSizer;
|
||||||
|
wxBoxSizer* m_RightBoxSizer;
|
||||||
|
wxBoxSizer* m_RightOptionsBoxSizer;
|
||||||
|
wxBoxSizer* m_LowBoxSizer;
|
||||||
|
wxRadioBox* m_NetOption;
|
||||||
|
private:
|
||||||
|
wxString m_pageNetFmtName;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/** Constructor to create a setup page for one netlist format.
|
||||||
|
* Used in Netlist format Dialog box creation
|
||||||
|
* @param parent = wxNotebook * parent
|
||||||
|
* @param title = title (name) of the notebook page
|
||||||
|
* @param id_NetType = netlist type id
|
||||||
|
*/
|
||||||
|
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
|
||||||
|
NETLIST_TYPE_ID id_NetType );
|
||||||
|
~NETLIST_PAGE_DIALOG() { };
|
||||||
|
|
||||||
|
/**
|
||||||
|
* function GetPageNetFmtName
|
||||||
|
* @return the name of the netlist format for this page
|
||||||
|
* This is usually the page label.
|
||||||
|
* For the pcbnew netlist, this is "LegacyPcbnew"
|
||||||
|
* when the "old" format is selected
|
||||||
|
* and "PcbnewAdvanced" when the advanced format (S expr fmt)is selected
|
||||||
|
*/
|
||||||
|
const wxString GetPageNetFmtName();
|
||||||
|
|
||||||
|
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Dialog frame for creating netlists */
|
||||||
|
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
SCH_EDIT_FRAME* m_Parent;
|
||||||
|
wxString m_NetFmtName;
|
||||||
|
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
|
||||||
|
|
||||||
|
private:
|
||||||
|
wxConfig* m_config;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
// Constructor and destructor
|
||||||
|
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
|
||||||
|
~NETLIST_DIALOG() { };
|
||||||
|
|
||||||
|
private:
|
||||||
|
void InstallCustomPages();
|
||||||
|
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
|
||||||
|
const wxString & aCommandString,
|
||||||
|
NETLIST_TYPE_ID aNetTypeId );
|
||||||
|
void InstallPageSpice();
|
||||||
|
void GenNetlist( wxCommandEvent& event );
|
||||||
|
void RunSimulator( wxCommandEvent& event );
|
||||||
|
void NetlistUpdateOpt();
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
void OnNetlistTypeSelection( wxNotebookEvent& event );
|
||||||
|
void SelectDefaultNetlistType( wxCommandEvent& event );
|
||||||
|
void EnableSubcircuitPrefix( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnAddPlugin
|
||||||
|
* Add a new panel for a new netlist plugin
|
||||||
|
*/
|
||||||
|
void OnAddPlugin( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnDelPlugin
|
||||||
|
* Remove a panel relative to a netlist plugin
|
||||||
|
*/
|
||||||
|
void OnDelPlugin( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function WriteCurrentNetlistSetup
|
||||||
|
* Write the current netlist options setup in the configuration
|
||||||
|
*/
|
||||||
|
void WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
|
bool GetUseDefaultNetlistName()
|
||||||
|
{
|
||||||
|
return m_cbUseDefaultNetlistName->IsChecked();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReturnUserNetlistTypeName
|
||||||
|
* to retrieve user netlist type names
|
||||||
|
* @param first_item = true: return first name of the list, false = return next
|
||||||
|
* @return a wxString : name of the type netlist or empty string
|
||||||
|
* this function must be called first with "first_item" = true
|
||||||
|
* and after with "first_item" = false to get all the other existing netlist names
|
||||||
|
*/
|
||||||
|
const wxString ReturnUserNetlistTypeName( bool first_item );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ReturnFilenamePrms
|
||||||
|
* returns the filename extension and the wildcard string for this curr
|
||||||
|
* or a void name if there is no default name
|
||||||
|
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
||||||
|
* @param aExt = a reference to a wxString to return the default file ext.
|
||||||
|
* @param aWildCard = reference to a wxString to return the default wildcard.
|
||||||
|
* @return true for known netlist type, false for custom formats
|
||||||
|
*/
|
||||||
|
bool ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
|
wxString * aExt, wxString * aWildCard );
|
||||||
|
|
||||||
|
DECLARE_EVENT_TABLE()
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
NETLIST_DIALOG* m_Parent;
|
||||||
|
|
||||||
|
public:
|
||||||
|
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
|
||||||
|
const wxString GetPluginTitle()
|
||||||
|
{
|
||||||
|
return m_textCtrlName->GetValue();
|
||||||
|
}
|
||||||
|
const wxString GetPluginTCommandLine()
|
||||||
|
{
|
||||||
|
return m_textCtrlCommand->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnOKClick
|
||||||
|
* Validate info relative to a new netlist plugin
|
||||||
|
*/
|
||||||
|
void OnOKClick( wxCommandEvent& event );
|
||||||
|
void OnCancelClick( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Browse plugin files, and set m_CommandStringCtrl field
|
||||||
|
*/
|
||||||
|
void OnBrowsePlugins( wxCommandEvent& event );
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/* Event id for notebook page buttons: */
|
/* Event id for notebook page buttons: */
|
||||||
enum id_netlist {
|
enum id_netlist {
|
||||||
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
|
ID_CREATE_NETLIST = ID_END_EESCHEMA_ID_LIST + 1,
|
||||||
|
@ -87,14 +258,7 @@ BEGIN_EVENT_TABLE( NETLIST_DIALOG, NETLIST_DIALOG_BASE )
|
||||||
END_EVENT_TABLE()
|
END_EVENT_TABLE()
|
||||||
|
|
||||||
|
|
||||||
/*******************************/
|
|
||||||
/* Functions for these classes */
|
|
||||||
/*******************************/
|
|
||||||
|
|
||||||
|
|
||||||
/* Contructor to create a setup page for one netlist format.
|
|
||||||
* Used in Netlist format Dialog box creation
|
|
||||||
*/
|
|
||||||
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
||||||
const wxString& title,
|
const wxString& title,
|
||||||
NETLIST_TYPE_ID id_NetType ) :
|
NETLIST_TYPE_ID id_NetType ) :
|
||||||
|
@ -164,6 +328,7 @@ NETLIST_PAGE_DIALOG::NETLIST_PAGE_DIALOG( wxNotebook* parent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
|
const wxString NETLIST_PAGE_DIALOG::GetPageNetFmtName()
|
||||||
{
|
{
|
||||||
// PCBNEW Format is a special type:
|
// PCBNEW Format is a special type:
|
||||||
|
@ -224,14 +389,6 @@ NETLIST_DIALOG::NETLIST_DIALOG( SCH_EDIT_FRAME* parent ) :
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnUserNetlistTypeName
|
|
||||||
* to retrieve user netlist type names
|
|
||||||
* @param first_item = true: return first name of the list, false = return next
|
|
||||||
* @return a wxString : name of the type netlist or empty string
|
|
||||||
* this function must be called first with "first_item" = true
|
|
||||||
* and after with "first_item" = false to get all the other existing netlist names
|
|
||||||
*/
|
|
||||||
const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
||||||
{
|
{
|
||||||
static int index;
|
static int index;
|
||||||
|
@ -250,6 +407,7 @@ const wxString NETLIST_DIALOG::ReturnUserNetlistTypeName( bool first_item )
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG::InstallPageSpice()
|
void NETLIST_DIALOG::InstallPageSpice()
|
||||||
{
|
{
|
||||||
wxButton* Button;
|
wxButton* Button;
|
||||||
|
@ -283,8 +441,6 @@ void NETLIST_DIALOG::InstallPageSpice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* create the pages for custom netlist format selection:
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::InstallCustomPages()
|
void NETLIST_DIALOG::InstallCustomPages()
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -309,6 +465,7 @@ void NETLIST_DIALOG::InstallCustomPages()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
||||||
const wxString & aCommandString,
|
const wxString & aCommandString,
|
||||||
NETLIST_TYPE_ID aNetTypeId )
|
NETLIST_TYPE_ID aNetTypeId )
|
||||||
|
@ -347,8 +504,6 @@ NETLIST_PAGE_DIALOG* NETLIST_DIALOG::AddOneCustomPage( const wxString & aTitle,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Called when the check box "default format" is clicked
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -367,10 +522,7 @@ void NETLIST_DIALOG::SelectDefaultNetlistType( wxCommandEvent& event )
|
||||||
currPage->m_IsCurrentFormat->SetValue( true );
|
currPage->m_IsCurrentFormat->SetValue( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when a netlist type is selected.
|
|
||||||
* Enable/disable relevant/irrelevant widgets, and display the default
|
|
||||||
* netlist name, for known types
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
||||||
|
@ -391,10 +543,7 @@ void NETLIST_DIALOG::OnNetlistTypeSelection( wxNotebookEvent& event )
|
||||||
m_textCtrlDefaultFileName->Clear();
|
m_textCtrlDefaultFileName->Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Called when the check box m_AddSubPrefix
|
|
||||||
* "default format" is clicked
|
|
||||||
* ( Spice format only )
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -408,6 +557,7 @@ void NETLIST_DIALOG::EnableSubcircuitPrefix( wxCommandEvent& event )
|
||||||
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
|
m_Parent->SetAddReferencePrefix( currPage->m_AddSubPrefix->IsChecked() );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG::NetlistUpdateOpt()
|
void NETLIST_DIALOG::NetlistUpdateOpt()
|
||||||
{
|
{
|
||||||
int ii;
|
int ii;
|
||||||
|
@ -426,12 +576,6 @@ void NETLIST_DIALOG::NetlistUpdateOpt()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function GenNetlist
|
|
||||||
* Create the netlist file:
|
|
||||||
* calculate the filename with the suitable extensions
|
|
||||||
* and run the netlist creator
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -446,7 +590,7 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
|
|
||||||
unsigned netlist_opt = 0;
|
unsigned netlist_opt = 0;
|
||||||
|
|
||||||
/* Calculate the netlist filename */
|
// Calculate the netlist filename
|
||||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
|
ReturnFilenamePrms( currPage->m_IdNetType, &fileExt, &fileWildcard );
|
||||||
|
|
||||||
|
@ -479,18 +623,20 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
if( fn.GetPath().IsEmpty() )
|
if( fn.GetPath().IsEmpty() )
|
||||||
fn.SetPath( wxGetCwd() );
|
fn.SetPath( wxGetCwd() );
|
||||||
|
|
||||||
wxString fullfilename = fn.GetFullPath();
|
wxString fullpath = fn.GetFullPath();
|
||||||
|
|
||||||
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
|
if( !GetUseDefaultNetlistName() || currPage->m_IdNetType >= NET_TYPE_CUSTOM1 )
|
||||||
{
|
{
|
||||||
wxFileDialog dlg( this, title, fn.GetPath(),
|
wxString fullname = fn.GetFullName();
|
||||||
fullfilename, fileWildcard,
|
wxString path = fn.GetPath();
|
||||||
wxFD_SAVE );
|
|
||||||
|
// fullname does not and should not include the path, per wx docs.
|
||||||
|
wxFileDialog dlg( this, title, path, fullname, fileWildcard, wxFD_SAVE );
|
||||||
|
|
||||||
if( dlg.ShowModal() == wxID_CANCEL )
|
if( dlg.ShowModal() == wxID_CANCEL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
fullfilename = dlg.GetPath();
|
fullpath = dlg.GetPath(); // directory + filename
|
||||||
}
|
}
|
||||||
|
|
||||||
m_Parent->ClearMsgPanel();
|
m_Parent->ClearMsgPanel();
|
||||||
|
@ -500,22 +646,14 @@ void NETLIST_DIALOG::GenNetlist( wxCommandEvent& event )
|
||||||
else
|
else
|
||||||
m_Parent->SetNetListerCommand( wxEmptyString );
|
m_Parent->SetNetListerCommand( wxEmptyString );
|
||||||
|
|
||||||
m_Parent->CreateNetlist( currPage->m_IdNetType, fullfilename, netlist_opt );
|
m_Parent->CreateNetlist( currPage->m_IdNetType, fullpath, netlist_opt );
|
||||||
|
|
||||||
WriteCurrentNetlistSetup();
|
WriteCurrentNetlistSetup();
|
||||||
|
|
||||||
EndModal( wxID_OK );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnFilenamePrms
|
|
||||||
* returns the filename extension and the wildcard string for this curr
|
|
||||||
* or a void name if there is no default name
|
|
||||||
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
|
||||||
* @param aExt = a reference to a wxString to return the default file ext.
|
|
||||||
* @param aWildCard = reference to a wxString to return the default wildcard.
|
|
||||||
* @return true for known netlist type, false for custom formats
|
|
||||||
*/
|
|
||||||
bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
wxString * aExt, wxString * aWildCard )
|
wxString * aExt, wxString * aWildCard )
|
||||||
{
|
{
|
||||||
|
@ -556,15 +694,7 @@ bool NETLIST_DIALOG::ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Function CreateNetlist
|
|
||||||
* > test for some issues (missing or duplicate references and sheet names)
|
|
||||||
* > build netlist info
|
|
||||||
* > create the netlist file
|
|
||||||
* param aFormat = netlist format (NET_TYPE_PCBNEW ...)
|
|
||||||
* param aFullFileName = full netlist file name
|
|
||||||
* param aNetlistOptions = netlist options using OR'ed bits (see WriteNetListFile).
|
|
||||||
* return true if success.
|
|
||||||
*/
|
|
||||||
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
bool SCH_EDIT_FRAME::CreateNetlist( int aFormat, const wxString& aFullFileName,
|
||||||
unsigned aNetlistOptions )
|
unsigned aNetlistOptions )
|
||||||
{
|
{
|
||||||
|
@ -593,7 +723,7 @@ Do you want to annotate schematic?" ) ) )
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Cleanup the entire hierarchy */
|
// Cleanup the entire hierarchy
|
||||||
SCH_SCREENS screens;
|
SCH_SCREENS screens;
|
||||||
screens.SchematicCleanUp();
|
screens.SchematicCleanUp();
|
||||||
|
|
||||||
|
@ -622,7 +752,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
ExecFile = tmp.BeforeFirst( ' ' );
|
ExecFile = tmp.BeforeFirst( ' ' );
|
||||||
CommandLine = tmp.AfterFirst( ' ' );
|
CommandLine = tmp.AfterFirst( ' ' );
|
||||||
|
|
||||||
/* Calculate the netlist filename */
|
// Calculate the netlist filename
|
||||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
fn.SetExt( wxT( "cir" ) );
|
fn.SetExt( wxT( "cir" ) );
|
||||||
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
|
CommandLine += wxT( " \"" ) + fn.GetFullPath() + wxT( "\"" );
|
||||||
|
@ -644,11 +774,7 @@ void NETLIST_DIALOG::RunSimulator( wxCommandEvent& event )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
void NETLIST_DIALOG::WriteCurrentNetlistSetup()
|
||||||
* Function WriteCurrentNetlistSetup
|
|
||||||
* Write the current netlist options setup in the configuration
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
|
|
||||||
{
|
{
|
||||||
wxString msg, Command;
|
wxString msg, Command;
|
||||||
|
|
||||||
|
@ -656,7 +782,8 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
|
||||||
|
|
||||||
m_config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
|
m_config->Write( NETLIST_USE_DEFAULT_NETNAME, GetUseDefaultNetlistName() );
|
||||||
|
|
||||||
// Update the new titles
|
// Update existing custom pages
|
||||||
|
int jj = 0;
|
||||||
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
for( int ii = 0; ii < CUSTOMPANEL_COUNTMAX; ii++ )
|
||||||
{
|
{
|
||||||
NETLIST_PAGE_DIALOG* currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
|
NETLIST_PAGE_DIALOG* currPage = m_PanelNetType[ii + PANELCUSTOMBASE];
|
||||||
|
@ -664,37 +791,36 @@ void NETLIST_DIALOG::WriteCurrentNetlistSetup( void )
|
||||||
if( currPage == NULL )
|
if( currPage == NULL )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
msg = wxT( "Custom" );
|
|
||||||
msg << ii + 1;
|
|
||||||
|
|
||||||
if( currPage->m_TitleStringCtrl )
|
|
||||||
{
|
|
||||||
wxString title = currPage->m_TitleStringCtrl->GetValue();
|
wxString title = currPage->m_TitleStringCtrl->GetValue();
|
||||||
currPage->SetPageNetFmtName( title );
|
|
||||||
|
|
||||||
if( msg != title ) // Title has changed, Update config
|
if( title.IsEmpty() )
|
||||||
{
|
continue;
|
||||||
|
|
||||||
msg = CUSTOM_NETLIST_TITLE;
|
msg = CUSTOM_NETLIST_TITLE;
|
||||||
msg << ii + 1;
|
msg << jj + 1;
|
||||||
m_config->Write( msg, title );
|
m_config->Write( msg, title );
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( currPage->m_CommandStringCtrl )
|
|
||||||
{
|
|
||||||
Command = currPage->m_CommandStringCtrl->GetValue();
|
Command = currPage->m_CommandStringCtrl->GetValue();
|
||||||
msg = CUSTOM_NETLIST_COMMAND;
|
msg = CUSTOM_NETLIST_COMMAND;
|
||||||
msg << ii + 1;
|
msg << jj + 1;
|
||||||
m_config->Write( msg, Command );
|
m_config->Write( msg, Command );
|
||||||
|
jj++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Ensure all other pages are void
|
||||||
|
for(; jj < CUSTOMPANEL_COUNTMAX; jj++ )
|
||||||
|
{
|
||||||
|
msg = CUSTOM_NETLIST_TITLE;
|
||||||
|
msg << jj + 1;
|
||||||
|
m_config->Write( msg, wxEmptyString );
|
||||||
|
|
||||||
|
msg = CUSTOM_NETLIST_COMMAND;
|
||||||
|
msg << jj + 1;
|
||||||
|
m_config->Write( msg, wxEmptyString );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnDelPlugin
|
|
||||||
* Remove a panel relative to a netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
NETLIST_PAGE_DIALOG* currPage = (NETLIST_PAGE_DIALOG*) m_NoteBook->GetCurrentPage();
|
||||||
|
@ -712,10 +838,7 @@ void NETLIST_DIALOG::OnDelPlugin( wxCommandEvent& event )
|
||||||
EndModal( NET_PLUGIN_CHANGE );
|
EndModal( NET_PLUGIN_CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnAddPlugin
|
|
||||||
* Add a new panel for a new netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
|
void NETLIST_DIALOG::OnAddPlugin( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
|
NETLIST_DIALOG_ADD_PLUGIN dlg( this );
|
||||||
|
@ -760,10 +883,7 @@ NETLIST_DIALOG_ADD_PLUGIN::NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent ) :
|
||||||
GetSizer()->SetSizeHints( this );
|
GetSizer()->SetSizeHints( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function OnOKClick
|
|
||||||
* Validate info relative to a new netlist plugin
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
if( m_textCtrlCommand->GetValue() == wxEmptyString )
|
if( m_textCtrlCommand->GetValue() == wxEmptyString )
|
||||||
|
@ -781,14 +901,13 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnOKClick( wxCommandEvent& event )
|
||||||
EndModal( wxID_OK );
|
EndModal( wxID_OK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnCancelClick( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
EndModal( wxID_CANCEL );
|
EndModal( wxID_CANCEL );
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* Browse plugin files, and set m_CommandStringCtrl field
|
|
||||||
*/
|
|
||||||
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxString FullFileName, Mask, Path;
|
wxString FullFileName, Mask, Path;
|
||||||
|
@ -807,8 +926,9 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
if( FullFileName.IsEmpty() )
|
if( FullFileName.IsEmpty() )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Creates a default command line, suitable for external tool xslproc:
|
// Creates a default command line, suitable for external tool xslproc or python
|
||||||
// try to build a default command line depending on plugin extension
|
// try to build a default command line depending on plugin extension
|
||||||
|
// "xsl" or "exe" or "py"
|
||||||
wxString cmdLine;
|
wxString cmdLine;
|
||||||
wxFileName fn( FullFileName );
|
wxFileName fn( FullFileName );
|
||||||
wxString ext = fn.GetExt();
|
wxString ext = fn.GetExt();
|
||||||
|
@ -817,6 +937,8 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
|
cmdLine.Printf(wxT("xsltproc -o \"%%O\" \"%s\" \"%%I\""), GetChars(FullFileName) );
|
||||||
else if( ext == wxT("exe" ) || ext.IsEmpty() )
|
else if( ext == wxT("exe" ) || ext.IsEmpty() )
|
||||||
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
|
cmdLine.Printf(wxT("\"%s\" > \"%%O\" < \"%%I\""), GetChars(FullFileName) );
|
||||||
|
else if( ext == wxT("py" ) || ext.IsEmpty() )
|
||||||
|
cmdLine.Printf(wxT("python \"%s\" \"%%I\" \"%%O\""), GetChars(FullFileName) );
|
||||||
else
|
else
|
||||||
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
|
cmdLine.Printf(wxT("\"%s\""), GetChars(FullFileName) );
|
||||||
|
|
||||||
|
@ -828,3 +950,12 @@ void NETLIST_DIALOG_ADD_PLUGIN::OnBrowsePlugins( wxCommandEvent& event )
|
||||||
if( title.IsEmpty() )
|
if( title.IsEmpty() )
|
||||||
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
|
wxMessageBox( _( "Do not forget to choose a title for this netlist control page" ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
NETLIST_DIALOG dlg( aCaller );
|
||||||
|
|
||||||
|
return dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,205 +0,0 @@
|
||||||
/**
|
|
||||||
* @file eeschema/dialogs/dialog_netlist.h
|
|
||||||
*/
|
|
||||||
|
|
||||||
/*
|
|
||||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
|
||||||
*
|
|
||||||
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras@wanadoo.fr
|
|
||||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
|
||||||
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, you may find one here:
|
|
||||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
|
||||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
|
||||||
* or you may write to the Free Software Foundation, Inc.,
|
|
||||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef _DIALOG_NETLIST_H_
|
|
||||||
#define _DIALOG_NETLIST_H_
|
|
||||||
|
|
||||||
#include <dialogs/dialog_netlist_base.h>
|
|
||||||
|
|
||||||
#define CUSTOMPANEL_COUNTMAX 8 // Max number of netlist plugins
|
|
||||||
|
|
||||||
// Id to select netlist type
|
|
||||||
enum NETLIST_TYPE_ID {
|
|
||||||
NET_TYPE_UNINIT = 0,
|
|
||||||
NET_TYPE_PCBNEW,
|
|
||||||
NET_TYPE_ORCADPCB2,
|
|
||||||
NET_TYPE_CADSTAR,
|
|
||||||
NET_TYPE_SPICE,
|
|
||||||
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
|
||||||
* is the first id for user netlist format
|
|
||||||
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
|
||||||
* is the last id for user netlist format
|
|
||||||
*/
|
|
||||||
NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
|
||||||
};
|
|
||||||
|
|
||||||
/* panel (notebook page) identifiers */
|
|
||||||
enum panel_netlist_index {
|
|
||||||
PANELPCBNEW = 0, /* Handle Netlist format Pcbnew */
|
|
||||||
PANELORCADPCB2, /* Handle Netlist format OracdPcb2 */
|
|
||||||
PANELCADSTAR, /* Handle Netlist format CadStar */
|
|
||||||
PANELSPICE, /* Handle Netlist format Pspice */
|
|
||||||
PANELCUSTOMBASE /* First auxiliary panel (custom netlists).
|
|
||||||
* others use PANELCUSTOMBASE+1, PANELCUSTOMBASE+2.. */
|
|
||||||
};
|
|
||||||
|
|
||||||
// Values returned when the netlist dialog is dismissed
|
|
||||||
#define NET_PLUGIN_CHANGE 1
|
|
||||||
// other values in use are wxID_OK and wxID_CANCEL
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/* wxPanels for creating the NoteBook pages for each netlist format: */
|
|
||||||
class NETLIST_PAGE_DIALOG : public wxPanel
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
NETLIST_TYPE_ID m_IdNetType;
|
|
||||||
wxCheckBox* m_IsCurrentFormat;
|
|
||||||
wxCheckBox* m_AddSubPrefix;
|
|
||||||
wxTextCtrl* m_CommandStringCtrl;
|
|
||||||
wxTextCtrl* m_TitleStringCtrl;
|
|
||||||
wxButton* m_ButtonCancel;
|
|
||||||
wxBoxSizer* m_LeftBoxSizer;
|
|
||||||
wxBoxSizer* m_RightBoxSizer;
|
|
||||||
wxBoxSizer* m_RightOptionsBoxSizer;
|
|
||||||
wxBoxSizer* m_LowBoxSizer;
|
|
||||||
wxRadioBox* m_NetOption;
|
|
||||||
private:
|
|
||||||
wxString m_pageNetFmtName;
|
|
||||||
|
|
||||||
public:
|
|
||||||
/** Constructor to create a setup page for one netlist format.
|
|
||||||
* Used in Netlist format Dialog box creation
|
|
||||||
* @param parent = wxNotebook * parent
|
|
||||||
* @param title = title (name) of the notebook page
|
|
||||||
* @param id_NetType = netlist type id
|
|
||||||
*/
|
|
||||||
NETLIST_PAGE_DIALOG( wxNotebook* parent, const wxString& title,
|
|
||||||
NETLIST_TYPE_ID id_NetType );
|
|
||||||
~NETLIST_PAGE_DIALOG() { };
|
|
||||||
|
|
||||||
/**
|
|
||||||
* function GetPageNetFmtName
|
|
||||||
* @return the name of the netlist format for this page
|
|
||||||
* This is usually the page label.
|
|
||||||
* For the pcbnew netlist, this is "LegacyPcbnew"
|
|
||||||
* when the "old" format is selected
|
|
||||||
* and "PcbnewAdvanced" when the advanced format (S expr fmt)is selected
|
|
||||||
*/
|
|
||||||
const wxString GetPageNetFmtName();
|
|
||||||
|
|
||||||
void SetPageNetFmtName( const wxString &aName ) { m_pageNetFmtName = aName; }
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
// Options for Spice netlist generation (OR'ed bits
|
|
||||||
enum netlistOptions {
|
|
||||||
NET_USE_X_PREFIX = 2, // for Spice netlist : change "U" and "IC" reference prefix to "X"
|
|
||||||
NET_PCBNEW_USE_NEW_FORMAT = 1, // For Pcbnew use the new format (S expression and SWEET)
|
|
||||||
};
|
|
||||||
|
|
||||||
/* Dialog frame for creating netlists */
|
|
||||||
class NETLIST_DIALOG : public NETLIST_DIALOG_BASE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SCH_EDIT_FRAME* m_Parent;
|
|
||||||
wxString m_NetFmtName;
|
|
||||||
NETLIST_PAGE_DIALOG* m_PanelNetType[4 + CUSTOMPANEL_COUNTMAX];
|
|
||||||
|
|
||||||
private:
|
|
||||||
wxConfig* m_config;
|
|
||||||
|
|
||||||
public:
|
|
||||||
|
|
||||||
// Constructor and destructor
|
|
||||||
NETLIST_DIALOG( SCH_EDIT_FRAME* parent );
|
|
||||||
~NETLIST_DIALOG() { };
|
|
||||||
|
|
||||||
private:
|
|
||||||
void InstallCustomPages();
|
|
||||||
NETLIST_PAGE_DIALOG* AddOneCustomPage( const wxString & aTitle,
|
|
||||||
const wxString & aCommandString,
|
|
||||||
NETLIST_TYPE_ID aNetTypeId );
|
|
||||||
void InstallPageSpice();
|
|
||||||
void GenNetlist( wxCommandEvent& event );
|
|
||||||
void RunSimulator( wxCommandEvent& event );
|
|
||||||
void NetlistUpdateOpt();
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
void OnNetlistTypeSelection( wxNotebookEvent& event );
|
|
||||||
void SelectDefaultNetlistType( wxCommandEvent& event );
|
|
||||||
void EnableSubcircuitPrefix( wxCommandEvent& event );
|
|
||||||
void OnAddPlugin( wxCommandEvent& event );
|
|
||||||
void OnDelPlugin( wxCommandEvent& event );
|
|
||||||
|
|
||||||
void WriteCurrentNetlistSetup( void );
|
|
||||||
|
|
||||||
bool GetUseDefaultNetlistName()
|
|
||||||
{
|
|
||||||
return m_cbUseDefaultNetlistName->IsChecked();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnUserNetlistTypeName
|
|
||||||
* to retrieve user netlist type names
|
|
||||||
* @param first_item = true: return first name of the list, false = return next
|
|
||||||
* @return a wxString : name of the type netlist or empty string
|
|
||||||
* this function must be called first with "first_item" = true
|
|
||||||
* and after with "first_item" = false to get all the other existing netlist names
|
|
||||||
*/
|
|
||||||
const wxString ReturnUserNetlistTypeName( bool first_item );
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Function ReturnFilenamePrms
|
|
||||||
* returns the filename extension and the wildcard string for this curr
|
|
||||||
* or a void name if there is no default name
|
|
||||||
* @param aNetTypeId = the netlist type ( NET_TYPE_PCBNEW ... )
|
|
||||||
* @param aExt = a reference to a wxString to return the default file ext.
|
|
||||||
* @param aWildCard = reference to a wxString to return the default wildcard.
|
|
||||||
* @return true for known netlist type, false for custom formats
|
|
||||||
*/
|
|
||||||
bool ReturnFilenamePrms( NETLIST_TYPE_ID aNetTypeId,
|
|
||||||
wxString * aExt, wxString * aWildCard );
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
class NETLIST_DIALOG_ADD_PLUGIN : public NETLIST_DIALOG_ADD_PLUGIN_BASE
|
|
||||||
{
|
|
||||||
private:
|
|
||||||
NETLIST_DIALOG* m_Parent;
|
|
||||||
|
|
||||||
public:
|
|
||||||
NETLIST_DIALOG_ADD_PLUGIN( NETLIST_DIALOG* parent );
|
|
||||||
const wxString GetPluginTitle()
|
|
||||||
{
|
|
||||||
return m_textCtrlName->GetValue();
|
|
||||||
}
|
|
||||||
const wxString GetPluginTCommandLine()
|
|
||||||
{
|
|
||||||
return m_textCtrlCommand->GetValue();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void OnOKClick( wxCommandEvent& event );
|
|
||||||
void OnCancelClick( wxCommandEvent& event );
|
|
||||||
void OnBrowsePlugins( wxCommandEvent& event );
|
|
||||||
};
|
|
||||||
|
|
||||||
#endif /* _DIALOG_NETLIST_H_ */
|
|
|
@ -16,7 +16,35 @@
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
#include <sch_sheet_path.h>
|
#include <sch_sheet_path.h>
|
||||||
|
|
||||||
#include <dialog_print_using_printer.h>
|
#include <invoke_sch_dialog.h>
|
||||||
|
#include <dialog_print_using_printer_base.h>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Class DIALOG_PRINT_USING_PRINTER
|
||||||
|
* offers to print a schematic dialog.
|
||||||
|
*
|
||||||
|
* Derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder
|
||||||
|
*/
|
||||||
|
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent );
|
||||||
|
|
||||||
|
SCH_EDIT_FRAME* GetParent() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
void OnCloseWindow( wxCloseEvent& event );
|
||||||
|
void OnInitDialog( wxInitDialogEvent& event );
|
||||||
|
void OnPageSetup( wxCommandEvent& event );
|
||||||
|
void OnPrintPreview( wxCommandEvent& event );
|
||||||
|
void OnPrintButtonClick( wxCommandEvent& event );
|
||||||
|
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
|
||||||
|
|
||||||
|
void GetPrintOptions();
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -415,3 +443,11 @@ void SCH_PRINTOUT::DrawPage( SCH_SCREEN* aScreen )
|
||||||
aScreen->m_DrawOrg = old_org;
|
aScreen->m_DrawOrg = old_org;
|
||||||
aScreen->SetZoom( oldZoom );
|
aScreen->SetZoom( oldZoom );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller )
|
||||||
|
{
|
||||||
|
DIALOG_PRINT_USING_PRINTER dlg( aCaller );
|
||||||
|
|
||||||
|
return dlg.ShowModal();
|
||||||
|
}
|
||||||
|
|
|
@ -1,34 +0,0 @@
|
||||||
|
|
||||||
#ifndef _DIALOG_PRINT_USING_PRINTER_H_
|
|
||||||
#define _DIALOG_PRINT_USING_PRINTER_H_
|
|
||||||
|
|
||||||
|
|
||||||
#include <dialog_print_using_printer_base.h>
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Print schematic dialog.
|
|
||||||
*
|
|
||||||
* Class derived from DIALOG_PRINT_USING_PRINTER_base created by wxFormBuilder
|
|
||||||
*/
|
|
||||||
class DIALOG_PRINT_USING_PRINTER : public DIALOG_PRINT_USING_PRINTER_BASE
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DIALOG_PRINT_USING_PRINTER( SCH_EDIT_FRAME* aParent );
|
|
||||||
~DIALOG_PRINT_USING_PRINTER() {};
|
|
||||||
|
|
||||||
SCH_EDIT_FRAME* GetParent() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
void OnCloseWindow( wxCloseEvent& event );
|
|
||||||
void OnInitDialog( wxInitDialogEvent& event );
|
|
||||||
void OnPageSetup( wxCommandEvent& event );
|
|
||||||
void OnPrintPreview( wxCommandEvent& event );
|
|
||||||
void OnPrintButtonClick( wxCommandEvent& event );
|
|
||||||
void OnButtonCancelClick( wxCommandEvent& event ){ Close(); }
|
|
||||||
|
|
||||||
void GetPrintOptions();
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
#endif // _DIALOG_PRINT_USING_PRINTER_H_
|
|
|
@ -161,9 +161,11 @@ bool EDA_APP::OnInit()
|
||||||
|
|
||||||
frame->Zoom_Automatique( true );
|
frame->Zoom_Automatique( true );
|
||||||
|
|
||||||
/* Load file specified in the command line. */
|
// Load file specified in the command line:
|
||||||
if( fileReady )
|
if( fileReady )
|
||||||
{
|
{
|
||||||
|
if( !filename.GetPath().IsEmpty() )
|
||||||
|
// wxSetWorkingDirectory does not like empty paths
|
||||||
wxSetWorkingDirectory( filename.GetPath() );
|
wxSetWorkingDirectory( filename.GetPath() );
|
||||||
|
|
||||||
if( frame->LoadOneEEProject( filename.GetFullPath(), false ) )
|
if( frame->LoadOneEEProject( filename.GetFullPath(), false ) )
|
||||||
|
|
|
@ -0,0 +1,79 @@
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||||
|
* Copyright (C) 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
|
||||||
|
*/
|
||||||
|
|
||||||
|
// This header is an insolation layer between top most frames and any number of
|
||||||
|
// DIALOG classes which can be called from a frame window.
|
||||||
|
// It is a place to put invocation functions for [modal] dialogs, with benefits:
|
||||||
|
//
|
||||||
|
// 1) The information about each dialog class is not exposed to the frame.
|
||||||
|
// So therefore the DIALOG class can often be kept out of a header file entirely.
|
||||||
|
//
|
||||||
|
// 2) The information about the calling frame is not necessarily exposed to
|
||||||
|
// to the called dialog class, at least not in here.
|
||||||
|
|
||||||
|
// The actual InvokeDialog<class>() function is usually coded at the bottom of the
|
||||||
|
// DIALOG_<class>.cpp file.
|
||||||
|
|
||||||
|
|
||||||
|
#ifndef INVOKE_SCH_DIALOG_H_
|
||||||
|
#define INVOKE_SCH_DIALOG_H_
|
||||||
|
|
||||||
|
|
||||||
|
class wxFrame;
|
||||||
|
class wxDialog;
|
||||||
|
|
||||||
|
// Often this is not used in the prototypes, since wxFrame is good enough and would
|
||||||
|
// represent maximum information hiding.
|
||||||
|
class SCH_EDIT_FRAME;
|
||||||
|
|
||||||
|
|
||||||
|
/// Create and show DIALOG_ANNOTATE and return whatever
|
||||||
|
/// DIALOG_ANNOTATE::ShowModal() returns.
|
||||||
|
int InvokeDialogAnnotate( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
/// Create the modeless DIALOG_ERC and show it, return something to
|
||||||
|
/// destroy or close it. The dialog will have ID_DIALOG_ERC from id.h
|
||||||
|
wxDialog* InvokeDialogERC( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
/// Create and show DIALOG_PRINT_USING_PRINTER and return whatever
|
||||||
|
/// DIALOG_PRINT_USING_PRINTER::ShowModal() returns.
|
||||||
|
int InvokeDialogPrintUsingPrinter( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
/// Create and show DIALOG_BOM and return whatever
|
||||||
|
/// DIALOG_BOM::ShowModal() returns.
|
||||||
|
int InvokeDialogCreateBOM( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function InvokeDialogNetList
|
||||||
|
* creates and shows NETLIST_DIALOG and returns whatever
|
||||||
|
* NETLIST_DIALOG::ShowModal() returns.
|
||||||
|
* @param int - NET_PLUGIN_CHANGE means user added or deleted a plugin,
|
||||||
|
* wxID_OK, or wxID_CANCEL.
|
||||||
|
*/
|
||||||
|
#define NET_PLUGIN_CHANGE 1
|
||||||
|
int InvokeDialogNetList( SCH_EDIT_FRAME* aCaller );
|
||||||
|
|
||||||
|
|
||||||
|
#endif // INVOKE_SCH_DIALOG_H_
|
|
@ -304,7 +304,8 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
|
||||||
text = m_Text;
|
text = m_Text;
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
DrawGraphicText( aPanel, aDC, text_pos, (EDA_COLOR_T) color, text, m_Orient, m_Size,
|
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
|
||||||
|
DrawGraphicText( clipbox, aDC, text_pos, (EDA_COLOR_T) color, text, m_Orient, m_Size,
|
||||||
m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );
|
m_HJustify, m_VJustify, linewidth, m_Italic, m_Bold );
|
||||||
|
|
||||||
/* Set to one (1) to draw bounding box around field text to validate
|
/* Set to one (1) to draw bounding box around field text to validate
|
||||||
|
@ -315,7 +316,7 @@ void LIB_FIELD::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& a
|
||||||
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
|
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
|
||||||
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
|
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
|
||||||
grBox.Move( aOffset );
|
grBox.Move( aOffset );
|
||||||
GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA );
|
GRRect( clipbox, aDC, grBox, 0, LIGHTMAGENTA );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -311,7 +311,8 @@ void LIB_PIN::SetOrientation( int orientation )
|
||||||
|
|
||||||
for( size_t i = 0; i < pinList.size(); i++ )
|
for( size_t i = 0; i < pinList.size(); i++ )
|
||||||
{
|
{
|
||||||
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 || pinList[i]->m_orientation == orientation )
|
if( ( pinList[i]->m_Flags & IS_LINKED ) == 0 ||
|
||||||
|
pinList[i]->m_orientation == orientation )
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
pinList[i]->m_orientation = orientation;
|
pinList[i]->m_orientation = orientation;
|
||||||
|
@ -349,6 +350,12 @@ void LIB_PIN::SetShape( int aShape )
|
||||||
|
|
||||||
void LIB_PIN::SetType( int aType )
|
void LIB_PIN::SetType( int aType )
|
||||||
{
|
{
|
||||||
|
if( aType < 0 )
|
||||||
|
aType = 0;
|
||||||
|
|
||||||
|
if( aType >= (int)PIN_ELECTRICAL_TYPE_CNT )
|
||||||
|
aType = PIN_ELECTRICAL_TYPE_CNT - 1;
|
||||||
|
|
||||||
if( m_type != aType )
|
if( m_type != aType )
|
||||||
{
|
{
|
||||||
m_type = aType;
|
m_type = aType;
|
||||||
|
@ -1084,6 +1091,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
|
numLineWidth = Clamp_Text_PenSize( numLineWidth, m_numTextSize, false );
|
||||||
|
|
||||||
GRSetDrawMode( DC, DrawMode );
|
GRSetDrawMode( DC, DrawMode );
|
||||||
|
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
|
||||||
|
|
||||||
/* Get the num and name colors */
|
/* Get the num and name colors */
|
||||||
if( (Color < 0) && IsSelected() )
|
if( (Color < 0) && IsSelected() )
|
||||||
|
@ -1132,7 +1140,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
if( orient == PIN_RIGHT )
|
if( orient == PIN_RIGHT )
|
||||||
{
|
{
|
||||||
x = x1 + TextInside;
|
x = x1 + TextInside;
|
||||||
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
|
DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
|
||||||
m_name,
|
m_name,
|
||||||
TEXT_ORIENT_HORIZ,
|
TEXT_ORIENT_HORIZ,
|
||||||
PinNameSize,
|
PinNameSize,
|
||||||
|
@ -1143,7 +1151,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
else // Orient == PIN_LEFT
|
else // Orient == PIN_LEFT
|
||||||
{
|
{
|
||||||
x = x1 - TextInside;
|
x = x1 - TextInside;
|
||||||
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor,
|
DrawGraphicText( clipbox, DC, wxPoint( x, y1 ), NameColor,
|
||||||
m_name,
|
m_name,
|
||||||
TEXT_ORIENT_HORIZ,
|
TEXT_ORIENT_HORIZ,
|
||||||
PinNameSize,
|
PinNameSize,
|
||||||
|
@ -1155,7 +1163,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
DrawGraphicText( panel, DC,
|
DrawGraphicText( clipbox, DC,
|
||||||
wxPoint( (x1 + pin_pos.x) / 2,
|
wxPoint( (x1 + pin_pos.x) / 2,
|
||||||
y1 - TXTMARGE ), NumColor,
|
y1 - TXTMARGE ), NumColor,
|
||||||
StringPinNum,
|
StringPinNum,
|
||||||
|
@ -1173,7 +1181,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
y = y1 + TextInside;
|
y = y1 + TextInside;
|
||||||
|
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
|
DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
|
||||||
m_name,
|
m_name,
|
||||||
TEXT_ORIENT_VERT, PinNameSize,
|
TEXT_ORIENT_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_RIGHT,
|
GR_TEXT_HJUSTIFY_RIGHT,
|
||||||
|
@ -1181,7 +1189,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
false, false );
|
false, false );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
DrawGraphicText( panel, DC,
|
DrawGraphicText( clipbox, DC,
|
||||||
wxPoint( x1 - TXTMARGE,
|
wxPoint( x1 - TXTMARGE,
|
||||||
(y1 + pin_pos.y) / 2 ), NumColor,
|
(y1 + pin_pos.y) / 2 ), NumColor,
|
||||||
StringPinNum,
|
StringPinNum,
|
||||||
|
@ -1195,7 +1203,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
y = y1 - TextInside;
|
y = y1 - TextInside;
|
||||||
|
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor,
|
DrawGraphicText( clipbox, DC, wxPoint( x1, y ), NameColor,
|
||||||
m_name,
|
m_name,
|
||||||
TEXT_ORIENT_VERT, PinNameSize,
|
TEXT_ORIENT_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_LEFT,
|
GR_TEXT_HJUSTIFY_LEFT,
|
||||||
|
@ -1203,7 +1211,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
false, false );
|
false, false );
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
DrawGraphicText( panel, DC,
|
DrawGraphicText( clipbox, DC,
|
||||||
wxPoint( x1 - TXTMARGE,
|
wxPoint( x1 - TXTMARGE,
|
||||||
(y1 + pin_pos.y) / 2 ), NumColor,
|
(y1 + pin_pos.y) / 2 ), NumColor,
|
||||||
StringPinNum,
|
StringPinNum,
|
||||||
|
@ -1222,7 +1230,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
{
|
{
|
||||||
x = (x1 + pin_pos.x) / 2;
|
x = (x1 + pin_pos.x) / 2;
|
||||||
DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ),
|
DrawGraphicText( clipbox, DC, wxPoint( x, y1 - TXTMARGE ),
|
||||||
NameColor, m_name,
|
NameColor, m_name,
|
||||||
TEXT_ORIENT_HORIZ, PinNameSize,
|
TEXT_ORIENT_HORIZ, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
|
@ -1232,7 +1240,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
x = (x1 + pin_pos.x) / 2;
|
x = (x1 + pin_pos.x) / 2;
|
||||||
DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ),
|
DrawGraphicText( clipbox, DC, wxPoint( x, y1 + TXTMARGE ),
|
||||||
NumColor, StringPinNum,
|
NumColor, StringPinNum,
|
||||||
TEXT_ORIENT_HORIZ, PinNumSize,
|
TEXT_ORIENT_HORIZ, PinNumSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
|
@ -1245,7 +1253,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
if( DrawPinName )
|
if( DrawPinName )
|
||||||
{
|
{
|
||||||
y = (y1 + pin_pos.y) / 2;
|
y = (y1 + pin_pos.y) / 2;
|
||||||
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ),
|
DrawGraphicText( clipbox, DC, wxPoint( x1 - TXTMARGE, y ),
|
||||||
NameColor, m_name,
|
NameColor, m_name,
|
||||||
TEXT_ORIENT_VERT, PinNameSize,
|
TEXT_ORIENT_VERT, PinNameSize,
|
||||||
GR_TEXT_HJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER,
|
||||||
|
@ -1255,7 +1263,7 @@ void LIB_PIN::DrawPinTexts( EDA_DRAW_PANEL* panel,
|
||||||
|
|
||||||
if( DrawPinNum )
|
if( DrawPinNum )
|
||||||
{
|
{
|
||||||
DrawGraphicText( panel, DC,
|
DrawGraphicText( clipbox, DC,
|
||||||
wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
|
wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ),
|
||||||
NumColor, StringPinNum,
|
NumColor, StringPinNum,
|
||||||
TEXT_ORIENT_VERT, PinNumSize,
|
TEXT_ORIENT_VERT, PinNumSize,
|
||||||
|
|
|
@ -399,7 +399,8 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
|
||||||
// Calculate pos accordint to mirror/rotation.
|
// Calculate pos accordint to mirror/rotation.
|
||||||
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
txtpos = aTransform.TransformCoordinate( txtpos ) + aOffset;
|
||||||
|
|
||||||
DrawGraphicText( aPanel, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size,
|
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
|
||||||
|
DrawGraphicText( clipbox, aDC, txtpos, (EDA_COLOR_T) color, m_Text, orient, m_Size,
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, GetPenSize(),
|
||||||
m_Italic, m_Bold );
|
m_Italic, m_Bold );
|
||||||
|
|
||||||
|
@ -412,7 +413,7 @@ void LIB_TEXT::drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aO
|
||||||
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
|
grBox.SetOrigin( aTransform.TransformCoordinate( bBox.GetOrigin() ) );
|
||||||
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
|
grBox.SetEnd( aTransform.TransformCoordinate( bBox.GetEnd() ) );
|
||||||
grBox.Move( aOffset );
|
grBox.Move( aOffset );
|
||||||
GRRect( aPanel->GetClipBox(), aDC, grBox, 0, LIGHTMAGENTA );
|
GRRect( clipbox, aDC, grBox, 0, LIGHTMAGENTA );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -468,9 +468,9 @@ void LIB_EDIT_FRAME::UpdatePartSelectList()
|
||||||
{
|
{
|
||||||
for( int i = 0; i < m_component->GetPartCount(); i++ )
|
for( int i = 0; i < m_component->GetPartCount(); i++ )
|
||||||
{
|
{
|
||||||
wxString msg = LIB_COMPONENT::ReturnSubReference( i+1, false );
|
wxString sub = LIB_COMPONENT::ReturnSubReference( i+1, false );
|
||||||
msg.Printf( _( "Part %s" ), GetChars( msg ) );
|
wxString part = wxString::Format( _( "Part %s" ), GetChars( sub ) );
|
||||||
m_partSelectBox->Append( msg );
|
m_partSelectBox->Append( part );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,6 @@
|
||||||
|
|
||||||
#include <general.h>
|
#include <general.h>
|
||||||
#include <netlist.h>
|
#include <netlist.h>
|
||||||
#include <dialog_netlist.h>
|
|
||||||
#include <class_library.h>
|
#include <class_library.h>
|
||||||
#include <lib_pin.h>
|
#include <lib_pin.h>
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
|
@ -39,6 +39,29 @@
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
||||||
|
|
||||||
|
/// netlist types
|
||||||
|
enum NETLIST_TYPE_ID {
|
||||||
|
NET_TYPE_UNINIT = 0,
|
||||||
|
NET_TYPE_PCBNEW,
|
||||||
|
NET_TYPE_ORCADPCB2,
|
||||||
|
NET_TYPE_CADSTAR,
|
||||||
|
NET_TYPE_SPICE,
|
||||||
|
NET_TYPE_CUSTOM1, /* NET_TYPE_CUSTOM1
|
||||||
|
* is the first id for user netlist format
|
||||||
|
* NET_TYPE_CUSTOM1+CUSTOMPANEL_COUNTMAX-1
|
||||||
|
* is the last id for user netlist format
|
||||||
|
*/
|
||||||
|
//NET_TYPE_CUSTOM_MAX = NET_TYPE_CUSTOM1 + CUSTOMPANEL_COUNTMAX - 1
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/// Options for Spice netlist generation (OR'ed bits
|
||||||
|
enum netlistOptions {
|
||||||
|
NET_USE_X_PREFIX = 2, // for Spice netlist : change "U" and "IC" reference prefix to "X"
|
||||||
|
NET_PCBNEW_USE_NEW_FORMAT = 1, // For Pcbnew use the new format (S expression and SWEET)
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
class SCH_COMPONENT;
|
class SCH_COMPONENT;
|
||||||
class SCH_REFERENC_LIST;
|
class SCH_REFERENC_LIST;
|
||||||
|
|
||||||
|
@ -374,26 +397,6 @@ public:
|
||||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByRefAndValue );
|
sort( componentFlatList.begin(), componentFlatList.end(), sortByRefAndValue );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SortByValueAndRef
|
|
||||||
* sorts the list of references by value.
|
|
||||||
* <p>
|
|
||||||
* Components are sorted in the following order:
|
|
||||||
* <ul>
|
|
||||||
* <li>Value of component.</li>
|
|
||||||
* <li>Numeric value of reference designator.</li>
|
|
||||||
* <li>Unit number when component has multiple parts.</li>
|
|
||||||
* <li>Sheet number.</li>
|
|
||||||
* <li>X coordinate position.</li>
|
|
||||||
* <li>Y coordinate position.</li>
|
|
||||||
* </ul>
|
|
||||||
* </p>
|
|
||||||
*/
|
|
||||||
void SortByValueAndRef()
|
|
||||||
{
|
|
||||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByValueAndRef );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SortByReferenceOnly
|
* Function SortByReferenceOnly
|
||||||
* sorts the list of references by reference.
|
* sorts the list of references by reference.
|
||||||
|
@ -410,25 +413,6 @@ public:
|
||||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByReferenceOnly );
|
sort( componentFlatList.begin(), componentFlatList.end(), sortByReferenceOnly );
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Function SortByValueOnly
|
|
||||||
* sort the list of references by value.
|
|
||||||
* <p>
|
|
||||||
* Components are grouped by type and are sorted in the following order:
|
|
||||||
* <ul>
|
|
||||||
* <li>Value of component.</li>
|
|
||||||
* <li>Numeric value of reference designator.</li>
|
|
||||||
* <li>Unit number when component has multiple parts.</li>
|
|
||||||
* </ul>
|
|
||||||
* </p>
|
|
||||||
* groups are made by the first letter of reference
|
|
||||||
* or the 2 first letters when existing
|
|
||||||
*/
|
|
||||||
void SortByValueOnly()
|
|
||||||
{
|
|
||||||
sort( componentFlatList.begin(), componentFlatList.end(), sortByValueOnly );
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetUnit
|
* Function GetUnit
|
||||||
* searches the sorted list of components for a another component with the same
|
* searches the sorted list of components for a another component with the same
|
||||||
|
@ -474,16 +458,12 @@ private:
|
||||||
|
|
||||||
static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByRefAndValue( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByValueAndRef( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
|
||||||
|
|
||||||
static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByXPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByYPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByYPosition( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByTimeStamp( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByTimeStamp( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
static bool sortByValueOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
|
||||||
|
|
||||||
static bool sortByReferenceOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
static bool sortByReferenceOnly( const SCH_REFERENCE& item1, const SCH_REFERENCE& item2 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -132,11 +132,6 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
|
||||||
double aScale,
|
double aScale,
|
||||||
bool aPlotFrameRef )
|
bool aPlotFrameRef )
|
||||||
{
|
{
|
||||||
FILE* output_file = wxFopen( aFileName, wxT( "wt" ) );
|
|
||||||
|
|
||||||
if( output_file == NULL )
|
|
||||||
return false;
|
|
||||||
|
|
||||||
PS_PLOTTER* plotter = new PS_PLOTTER();
|
PS_PLOTTER* plotter = new PS_PLOTTER();
|
||||||
plotter->SetPageSettings( aPageInfo );
|
plotter->SetPageSettings( aPageInfo );
|
||||||
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
|
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
|
||||||
|
|
|
@ -249,6 +249,11 @@ void SCH_COMPONENT::SetUnit( int aUnit )
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SCH_COMPONENT::UpdateUnit( int aUnit )
|
||||||
|
{
|
||||||
|
m_unit = aUnit;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_COMPONENT::SetConvert( int aConvert )
|
void SCH_COMPONENT::SetConvert( int aConvert )
|
||||||
{
|
{
|
||||||
|
|
|
@ -130,8 +130,23 @@ public:
|
||||||
|
|
||||||
int GetUnit() const { return m_unit; }
|
int GetUnit() const { return m_unit; }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* change the unit id to aUnit
|
||||||
|
* has maening only for multiple parts per package
|
||||||
|
* Also set the modified flag bit
|
||||||
|
* @param aUnit = the new unit Id
|
||||||
|
*/
|
||||||
void SetUnit( int aUnit );
|
void SetUnit( int aUnit );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* change the unit id to aUnit
|
||||||
|
* has maening only for multiple parts per package
|
||||||
|
* Do not change the modified flag bit, and should be used when
|
||||||
|
* change is not due to an edition command
|
||||||
|
* @param aUnit = the new unit Id
|
||||||
|
*/
|
||||||
|
void UpdateUnit( int aUnit );
|
||||||
|
|
||||||
int GetConvert() const { return m_convert; }
|
int GetConvert() const { return m_convert; }
|
||||||
|
|
||||||
void SetConvert( int aConvert );
|
void SetConvert( int aConvert );
|
||||||
|
|
|
@ -194,7 +194,8 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
color = GetLayerColor( LAYER_FIELDS );
|
color = GetLayerColor( LAYER_FIELDS );
|
||||||
}
|
}
|
||||||
|
|
||||||
DrawGraphicText( panel, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size,
|
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
|
||||||
|
DrawGraphicText( clipbox, DC, textpos, color, GetFullyQualifiedText(), orient, m_Size,
|
||||||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER,
|
||||||
LineWidth, m_Italic, m_Bold );
|
LineWidth, m_Italic, m_Bold );
|
||||||
|
|
||||||
|
@ -214,9 +215,9 @@ void SCH_FIELD::Draw( EDA_DRAW_PANEL* panel, wxDC* DC,
|
||||||
textpos = parentComponent->GetScreenCoord( textpos );
|
textpos = parentComponent->GetScreenCoord( textpos );
|
||||||
textpos += parentComponent->GetPosition();
|
textpos += parentComponent->GetPosition();
|
||||||
const int len = 10;
|
const int len = 10;
|
||||||
GRLine( panel->GetClipBox(), DC,
|
GRLine( clipbox, DC,
|
||||||
textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE );
|
textpos.x - len, textpos.y, textpos.x + len, textpos.y, 0, BLUE );
|
||||||
GRLine( panel->GetClipBox(), DC,
|
GRLine( clipbox, DC,
|
||||||
textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );
|
textpos.x, textpos.y - len, textpos.x, textpos.y + len, 0, BLUE );
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -734,6 +734,11 @@ void SCH_SCREEN::ClearAnnotation( SCH_SHEET_PATH* aSheetPath )
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
SCH_COMPONENT* component = (SCH_COMPONENT*) item;
|
||||||
|
|
||||||
component->ClearAnnotation( aSheetPath );
|
component->ClearAnnotation( aSheetPath );
|
||||||
|
|
||||||
|
// Clear the modified component flag set by component->ClearAnnotation
|
||||||
|
// because we do not use it here and we should not leave this flag set,
|
||||||
|
// when an edition is finished:
|
||||||
|
component->ClearFlags();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -573,6 +573,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
wxPoint pos_sheetname,pos_filename;
|
wxPoint pos_sheetname,pos_filename;
|
||||||
wxPoint pos = m_pos + aOffset;
|
wxPoint pos = m_pos + aOffset;
|
||||||
int lineWidth = GetPenSize();
|
int lineWidth = GetPenSize();
|
||||||
|
EDA_RECT* clipbox = aPanel? aPanel->GetClipBox() : NULL;
|
||||||
|
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
color = aColor;
|
color = aColor;
|
||||||
|
@ -581,7 +582,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
|
|
||||||
GRSetDrawMode( aDC, aDrawMode );
|
GRSetDrawMode( aDC, aDrawMode );
|
||||||
|
|
||||||
GRRect( aPanel->GetClipBox(), aDC, pos.x, pos.y,
|
GRRect( clipbox, aDC, pos.x, pos.y,
|
||||||
pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
|
pos.x + m_size.x, pos.y + m_size.y, lineWidth, color );
|
||||||
|
|
||||||
pos_sheetname = GetSheetNamePosition() + aOffset;
|
pos_sheetname = GetSheetNamePosition() + aOffset;
|
||||||
|
@ -599,7 +600,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
txtcolor = GetLayerColor( LAYER_SHEETNAME );
|
txtcolor = GetLayerColor( LAYER_SHEETNAME );
|
||||||
|
|
||||||
Text = wxT( "Sheet: " ) + m_name;
|
Text = wxT( "Sheet: " ) + m_name;
|
||||||
DrawGraphicText( aPanel, aDC, pos_sheetname,
|
DrawGraphicText( clipbox, aDC, pos_sheetname,
|
||||||
(EDA_COLOR_T) txtcolor, Text, name_orientation,
|
(EDA_COLOR_T) txtcolor, Text, name_orientation,
|
||||||
wxSize( m_sheetNameSize, m_sheetNameSize ),
|
wxSize( m_sheetNameSize, m_sheetNameSize ),
|
||||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, lineWidth,
|
||||||
|
@ -612,7 +613,7 @@ void SCH_SHEET::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||||
txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
|
txtcolor = GetLayerColor( LAYER_SHEETFILENAME );
|
||||||
|
|
||||||
Text = wxT( "File: " ) + m_fileName;
|
Text = wxT( "File: " ) + m_fileName;
|
||||||
DrawGraphicText( aPanel, aDC, pos_filename,
|
DrawGraphicText( clipbox, aDC, pos_filename,
|
||||||
(EDA_COLOR_T) txtcolor, Text, name_orientation,
|
(EDA_COLOR_T) txtcolor, Text, name_orientation,
|
||||||
wxSize( m_fileNameSize, m_fileNameSize ),
|
wxSize( m_fileNameSize, m_fileNameSize ),
|
||||||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth,
|
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, lineWidth,
|
||||||
|
|
|
@ -234,7 +234,7 @@ void SCH_SHEET_PATH::UpdateAllScreenReferences()
|
||||||
{
|
{
|
||||||
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
|
SCH_COMPONENT* component = (SCH_COMPONENT*) t;
|
||||||
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
|
component->GetField( REFERENCE )->SetText( component->GetRef( this ) );
|
||||||
component->SetUnit( component->GetUnitSelection( this ) );
|
component->UpdateUnit( component->GetUnitSelection( this ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
t = t->Next();
|
t = t->Next();
|
||||||
|
|
|
@ -343,6 +343,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
|
||||||
{
|
{
|
||||||
EDA_COLOR_T color;
|
EDA_COLOR_T color;
|
||||||
int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
|
int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
|
||||||
|
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
|
||||||
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||||
|
|
||||||
|
@ -355,7 +356,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
|
||||||
|
|
||||||
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
wxPoint text_offset = aOffset + GetSchematicTextOffset();
|
||||||
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
||||||
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||||
EXCHG( linewidth, m_Thickness ); // set initial value
|
EXCHG( linewidth, m_Thickness ); // set initial value
|
||||||
|
|
||||||
if( m_isDangling )
|
if( m_isDangling )
|
||||||
|
@ -365,7 +366,7 @@ void SCH_TEXT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, const wxPoint& aOffset,
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
EDA_RECT BoundaryBox = GetBoundingBox();
|
EDA_RECT BoundaryBox = GetBoundingBox();
|
||||||
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
|
GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1285,11 +1286,12 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
|
||||||
int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
|
int linewidth = (m_Thickness == 0) ? GetDefaultLineThickness() : m_Thickness;
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||||
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
||||||
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
|
||||||
|
EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||||
EXCHG( linewidth, m_Thickness ); // set initial value
|
EXCHG( linewidth, m_Thickness ); // set initial value
|
||||||
|
|
||||||
CreateGraphicShape( Poly, m_Pos + aOffset );
|
CreateGraphicShape( Poly, m_Pos + aOffset );
|
||||||
GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
||||||
|
|
||||||
if( m_isDangling )
|
if( m_isDangling )
|
||||||
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
|
DrawDanglingSymbol( panel, DC, m_Pos + aOffset, color );
|
||||||
|
@ -1298,7 +1300,7 @@ void SCH_GLOBALLABEL::Draw( EDA_DRAW_PANEL* panel,
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
EDA_RECT BoundaryBox = GetBoundingBox();
|
EDA_RECT BoundaryBox = GetBoundingBox();
|
||||||
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
|
GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -1604,7 +1606,9 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
|
||||||
{
|
{
|
||||||
static std::vector <wxPoint> Poly;
|
static std::vector <wxPoint> Poly;
|
||||||
EDA_COLOR_T color;
|
EDA_COLOR_T color;
|
||||||
int linewidth = ( m_Thickness == 0 ) ? GetDefaultLineThickness() : m_Thickness;
|
int linewidth = m_Thickness == 0 ?
|
||||||
|
GetDefaultLineThickness() : m_Thickness;
|
||||||
|
EDA_RECT* clipbox = panel? panel->GetClipBox() : NULL;
|
||||||
|
|
||||||
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
linewidth = Clamp_Text_PenSize( linewidth, m_Size, m_Bold );
|
||||||
|
|
||||||
|
@ -1617,11 +1621,11 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
|
||||||
|
|
||||||
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
EXCHG( linewidth, m_Thickness ); // Set the minimum width
|
||||||
wxPoint text_offset = offset + GetSchematicTextOffset();
|
wxPoint text_offset = offset + GetSchematicTextOffset();
|
||||||
EDA_TEXT::Draw( panel, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
EDA_TEXT::Draw( clipbox, DC, text_offset, color, DrawMode, FILLED, UNSPECIFIED_COLOR );
|
||||||
EXCHG( linewidth, m_Thickness ); // set initial value
|
EXCHG( linewidth, m_Thickness ); // set initial value
|
||||||
|
|
||||||
CreateGraphicShape( Poly, m_Pos + offset );
|
CreateGraphicShape( Poly, m_Pos + offset );
|
||||||
GRPoly( panel->GetClipBox(), DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
GRPoly( clipbox, DC, Poly.size(), &Poly[0], 0, linewidth, color, color );
|
||||||
|
|
||||||
if( m_isDangling )
|
if( m_isDangling )
|
||||||
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
|
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
|
||||||
|
@ -1630,7 +1634,7 @@ void SCH_HIERLABEL::Draw( EDA_DRAW_PANEL* panel,
|
||||||
#if 0
|
#if 0
|
||||||
{
|
{
|
||||||
EDA_RECT BoundaryBox = GetBoundingBox();
|
EDA_RECT BoundaryBox = GetBoundingBox();
|
||||||
GRRect( panel->GetClipBox(), DC, BoundaryBox, 0, BROWN );
|
GRRect( clipbox, DC, BoundaryBox, 0, BROWN );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -44,17 +44,13 @@
|
||||||
#include <sch_component.h>
|
#include <sch_component.h>
|
||||||
|
|
||||||
#include <dialog_helpers.h>
|
#include <dialog_helpers.h>
|
||||||
#include <dialog_netlist.h>
|
|
||||||
#include <libeditframe.h>
|
#include <libeditframe.h>
|
||||||
#include <viewlib_frame.h>
|
#include <viewlib_frame.h>
|
||||||
#include <hotkeys.h>
|
#include <hotkeys.h>
|
||||||
#include <eeschema_config.h>
|
#include <eeschema_config.h>
|
||||||
#include <sch_sheet.h>
|
#include <sch_sheet.h>
|
||||||
|
|
||||||
#include <dialogs/annotate_dialog.h>
|
#include <invoke_sch_dialog.h>
|
||||||
#include <dialogs/dialog_build_BOM.h>
|
|
||||||
#include <dialogs/dialog_erc.h>
|
|
||||||
#include <dialogs/dialog_print_using_printer.h>
|
|
||||||
#include <dialogs/dialog_schematic_find.h>
|
#include <dialogs/dialog_schematic_find.h>
|
||||||
|
|
||||||
#include <wx/display.h>
|
#include <wx/display.h>
|
||||||
|
@ -200,6 +196,7 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
|
||||||
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
m_findReplaceData = new wxFindReplaceData( wxFR_DOWN );
|
||||||
m_undoItem = NULL;
|
m_undoItem = NULL;
|
||||||
m_hasAutoSave = true;
|
m_hasAutoSave = true;
|
||||||
|
|
||||||
SetForceHVLines( true );
|
SetForceHVLines( true );
|
||||||
SetDefaultLabelSize( DEFAULT_SIZE_TEXT );
|
SetDefaultLabelSize( DEFAULT_SIZE_TEXT );
|
||||||
|
|
||||||
|
@ -244,8 +241,6 @@ SCH_EDIT_FRAME::SCH_EDIT_FRAME( wxWindow* aParent, const wxString& aTitle,
|
||||||
EDA_PANEINFO mesg;
|
EDA_PANEINFO mesg;
|
||||||
mesg.MessageToolbarPane();
|
mesg.MessageToolbarPane();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if( m_mainToolBar )
|
if( m_mainToolBar )
|
||||||
m_auimgr.AddPane( m_mainToolBar,
|
m_auimgr.AddPane( m_mainToolBar,
|
||||||
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
|
wxAuiPaneInfo( horiz ).Name( wxT( "m_mainToolBar" ) ).Top().Row( 0 ) );
|
||||||
|
@ -602,43 +597,40 @@ void SCH_EDIT_FRAME::OnUpdateHiddenPins( wxUpdateUIEvent& aEvent )
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnAnnotate( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_ANNOTATE* dlg = new DIALOG_ANNOTATE( this );
|
InvokeDialogAnnotate( this );
|
||||||
|
|
||||||
dlg->ShowModal();
|
|
||||||
dlg->Destroy();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnErc( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
DIALOG_ERC* dlg = new DIALOG_ERC( this );
|
// See if it's already open...
|
||||||
|
wxWindow* erc = FindWindowById( ID_DIALOG_ERC, this );
|
||||||
|
|
||||||
dlg->Show( true );
|
if( erc )
|
||||||
// dlg->Destroy();
|
// Bring it to the top if already open. Dual monitor users need this.
|
||||||
|
erc->Raise();
|
||||||
|
else
|
||||||
|
InvokeDialogERC( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnCreateNetlist( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
int i;
|
int result;
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
NETLIST_DIALOG* dlg = new NETLIST_DIALOG( this );
|
result = InvokeDialogNetList( this );
|
||||||
i = dlg->ShowModal();
|
|
||||||
dlg->Destroy();
|
|
||||||
} while( i == NET_PLUGIN_CHANGE );
|
|
||||||
|
|
||||||
// If a plugin is removed or added, rebuild and reopen the new dialog
|
// If a plugin is removed or added, rebuild and reopen the new dialog
|
||||||
|
|
||||||
|
} while( result == NET_PLUGIN_CHANGE );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void SCH_EDIT_FRAME::OnCreateBillOfMaterials( wxCommandEvent& )
|
void SCH_EDIT_FRAME::OnCreateBillOfMaterials( wxCommandEvent& )
|
||||||
{
|
{
|
||||||
wxMessageDialog dlg( this,
|
InvokeDialogCreateBOM( this );
|
||||||
wxT( "https://answers.launchpad.net/kicad/+faq/2265" ),
|
|
||||||
_( "BOM Howto" ) );
|
|
||||||
dlg.ShowModal();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -827,9 +819,8 @@ void SCH_EDIT_FRAME::SetLanguage( wxCommandEvent& event )
|
||||||
void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
|
void SCH_EDIT_FRAME::OnPrint( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
DIALOG_PRINT_USING_PRINTER dlg( this );
|
|
||||||
|
|
||||||
dlg.ShowModal();
|
InvokeDialogPrintUsingPrinter( this );
|
||||||
|
|
||||||
fn = g_RootSheet->GetScreen()->GetFileName();
|
fn = g_RootSheet->GetScreen()->GetFileName();
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue