Compare commits
29 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 575b22d018 | |||
| 5f01ca8f88 | |||
| 5a3c944b2a | |||
| 50a4b5553a | |||
| 4cb084cd63 | |||
| a458342cfc | |||
| 8023c7a794 | |||
| 65fe561a4b | |||
| 18f77b894e | |||
| 94a3390544 | |||
| cec3e300a8 | |||
| a262445047 | |||
| 0fbdec4c08 | |||
| de52ae6c70 | |||
| 9ca6405bcb | |||
| 1dc747c0ae | |||
| 183835ee67 | |||
| 6dbe262b53 | |||
| e074c798bf | |||
| bd1aae9071 | |||
| 6382db4ebf | |||
| 8151ec387c | |||
| 6e1d45c79e | |||
| 1d05076761 | |||
| 89e7d89223 | |||
| 115d70e060 | |||
| 1a89a0601a | |||
| ca0aa6c971 | |||
| 5b4542231e |
+55
@@ -0,0 +1,55 @@
|
||||
boost_root
|
||||
.downloads-by-cmake
|
||||
Build*
|
||||
build*
|
||||
common/netlist_keywords.*
|
||||
common/netlist_lexer.h
|
||||
common/pcb_plot_params_lexer.h
|
||||
common/page_layout/page_layout_reader_keywords.cpp
|
||||
common/lib_table_keywords.*
|
||||
common/gal/opengl/shader_src.h
|
||||
include/lib_table_lexer.h
|
||||
include/netlist_lexer.h
|
||||
include/page_layout_reader_lexer.h
|
||||
eeschema/cmp_library_lexer.h
|
||||
eeschema/cmp_library_keywords.*
|
||||
eeschema/dialogs/dialog_bom_cfg_keywords.cpp
|
||||
eeschema/dialogs/dialog_bom_cfg_lexer.h
|
||||
eeschema/dialogs/dialog_bom_help_html.h
|
||||
eeschema/template_fieldnames_keywords.*
|
||||
eeschema/template_fieldnames_lexer.h
|
||||
pcbnew/dialogs/dialog_freeroute_exchange_help_html.h
|
||||
pcbnew/pcb_plot_params_keywords.cpp
|
||||
pcbnew/pcb_plot_params_lexer.h
|
||||
pcb_calculator/attenuators/bridget_tee_formula.h
|
||||
pcb_calculator/attenuators/pi_formula.h
|
||||
pcb_calculator/attenuators/splitter_formula.h
|
||||
pcb_calculator/attenuators/tee_formula.h
|
||||
Makefile
|
||||
CMakeCache.txt
|
||||
auto_renamed_to_cpp
|
||||
Testing
|
||||
version.h
|
||||
config.h
|
||||
install_manifest.txt
|
||||
Documentation/doxygen
|
||||
Documentation/development/doxygen
|
||||
*.bak
|
||||
*.pyc
|
||||
.*.swp
|
||||
*~
|
||||
common/pcb_plot_params_keywords.cpp
|
||||
include/pcb_plot_params_lexer.h
|
||||
pcbnew/specctra_keywords.cpp
|
||||
pcbnew/specctra_lexer.h
|
||||
pcb_calculator/pcb_calculator_datafile_keywords.cpp
|
||||
pcb_calculator/pcb_calculator_datafile_lexer.h
|
||||
new/html
|
||||
new/sch_lib_table_keywords.cpp
|
||||
new/sch_lib_table_lexer.h
|
||||
new/sweet_keywords.cpp
|
||||
new/sweet_lexer.h
|
||||
bitmaps_png/png*
|
||||
bitmaps_png/tmp
|
||||
common/pcb_keywords.cpp
|
||||
include/pcb_lexer.h
|
||||
+22
-3
@@ -1,3 +1,25 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2007-2016 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
|
||||
#
|
||||
|
||||
# Default to CMAKE_BUILD_TYPE = Release unless overridden on command line
|
||||
# http://www.cmake.org/pipermail/cmake/2008-September/023808.html
|
||||
@@ -83,9 +105,6 @@ mark_as_advanced( KICAD_SKIP_BOOST ) # Normal builders should build Boost.
|
||||
option( BUILD_GITHUB_PLUGIN "Build the GITHUB_PLUGIN for pcbnew." ON )
|
||||
|
||||
|
||||
# This can be set to a custom name to brag about a particular branch in the "About" dialog:
|
||||
set( KICAD_REPO_NAME "product" CACHE STRING "Name of the tree from which this build came." )
|
||||
|
||||
|
||||
# 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
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2010 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2010-2015 Kicad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2010-2016 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
|
||||
@@ -23,9 +23,9 @@
|
||||
#
|
||||
|
||||
macro( create_git_version_header _git_src_path )
|
||||
# If bzr is not found or an error occurs using the git commands to determine the repo
|
||||
# version, set the build version string to "no-git"
|
||||
set( KICAD_BUILD_VERSION "no-git" )
|
||||
# If an error occurs using the git commands to determine the repo
|
||||
# version, set the build version string to "git-error".
|
||||
set( KICAD_GIT_BUILD_VERSION "git-error" )
|
||||
|
||||
# Include Git support to automagically create version header file.
|
||||
find_package( Git )
|
||||
@@ -72,17 +72,17 @@ macro( create_git_version_header _git_src_path )
|
||||
|
||||
execute_process(
|
||||
COMMAND
|
||||
${GIT_EXECUTABLE} rev-list HEAD --count
|
||||
--first-parent
|
||||
${GIT_EXECUTABLE} rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${_git_src_path}
|
||||
OUTPUT_VARIABLE _git_SERIAL
|
||||
OUTPUT_VARIABLE _git_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
|
||||
message(STATUS "Git hash: ${_git_LONG_HASH}")
|
||||
message(STATUS "Git branch: ${_git_BRANCH}")
|
||||
|
||||
if( ${_git_log_result} EQUAL 0 )
|
||||
string( REGEX REPLACE "^(.*\n)?revno: ([^ \n]+).*"
|
||||
"\\2" Kicad_REPO_REVISION "BZR ${_git_SERIAL}, Git ${_git_SHORT_HASH}" )
|
||||
"\\2" Kicad_REPO_REVISION "revision ${_git_SHORT_HASH}" )
|
||||
string( REGEX REPLACE "^(.*\n)?committer: ([^\n]+).*"
|
||||
"\\2" Kicad_REPO_LAST_CHANGED_AUTHOR "${_git_LAST_COMITTER}")
|
||||
string( REGEX REPLACE "^(.*\n)?timestamp: [a-zA-Z]+ ([^ \n]+).*"
|
||||
@@ -98,8 +98,8 @@ macro( create_git_version_header _git_src_path )
|
||||
if( Kicad_REPO_LAST_CHANGED_DATE )
|
||||
string( REGEX REPLACE "^([0-9]+)\\-([0-9]+)\\-([0-9]+)" "\\1-\\2-\\3"
|
||||
_kicad_git_date ${Kicad_REPO_LAST_CHANGED_DATE} )
|
||||
set( KICAD_BUILD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
|
||||
set( KICAD_VERSION "(${_kicad_git_date} ${Kicad_REPO_REVISION})" )
|
||||
set( KICAD_BRANCH_NAME ${_git_BRANCH} )
|
||||
endif()
|
||||
|
||||
set( KICAD_BUILD_VERSION ${KICAD_BUILD_VERSION} )
|
||||
endmacro()
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
#
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2016 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
|
||||
#
|
||||
|
||||
# Note: unless you are the person responsible for creating releases,
|
||||
# do *not* change these variables. This way the KiCad project
|
||||
# can maintain control over what is an official KiCad build and
|
||||
# what is not. Setting these variable that conflict with KiCad
|
||||
# releases is a shooting offense.
|
||||
#
|
||||
# This file gets included in the WriteVersionHeader.cmake file to set
|
||||
# the KiCad version when the source is provided in an archive file.
|
||||
# When KiCad is cloned using git, the git version is used. The only
|
||||
# time this should be set to a value other than "no-vcs-found" is when
|
||||
# a source archive is created. This eliminates the need to set
|
||||
# KICAD_VERSION during the build configuration step.
|
||||
set( KICAD_VERSION "4.0.5" )
|
||||
@@ -2,7 +2,7 @@
|
||||
# This program source code file is part of KICAD, a free EDA CAD application.
|
||||
#
|
||||
# Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
# Copyright (C) 2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
# Copyright (C) 2015-2016 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
|
||||
@@ -22,49 +22,35 @@
|
||||
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
#
|
||||
|
||||
# Automagically create version header file if the version string was not defined during
|
||||
# the build configuration. If CreateBzrVersionHeader or CreateGitVersionHeader cannot
|
||||
# determine the current repo version, a version.h file is still created with
|
||||
# KICAD_BUILD_VERSION set to "no-vcs-found".
|
||||
if( NOT KICAD_BUILD_VERSION )
|
||||
set( _wvh_version_str "no-vcs-found" )
|
||||
# Automagically create version header file if the version string was
|
||||
# not defined during the build configuration. If
|
||||
# CreateGitVersionHeader cannot determine the current repo version, a
|
||||
# version.h file is still created with KICAD_VERSION set to "no-vcs-found".
|
||||
include( ${CMAKE_MODULE_PATH}/KiCadVersion.cmake )
|
||||
|
||||
# Detect the appropiate VCS and set the version string.
|
||||
if( EXISTS "${SRC_PATH}/.bzr" )
|
||||
message( STATUS "Using Bazaar to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateBzrVersionHeader.cmake )
|
||||
create_bzr_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
elseif( EXISTS "${SRC_PATH}/.git" )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
endif()
|
||||
else()
|
||||
set( _wvh_version_str ${KICAD_BUILD_VERSION} )
|
||||
# Attempt to detect if we have a git repo and set the version string if
|
||||
# the version wasn't set to something other than the default value in
|
||||
# KiCadVersion.cmake.
|
||||
if( KICAD_VERSION STREQUAL "no-vcs-found" AND EXISTS "${SRC_PATH}/.git" )
|
||||
message( STATUS "Using Git to determine build version string." )
|
||||
include( ${CMAKE_MODULE_PATH}/CreateGitVersionHeader.cmake )
|
||||
create_git_version_header( ${SRC_PATH} )
|
||||
endif()
|
||||
|
||||
set( _wvh_write_version_file ON )
|
||||
# $KICAD_VERSION_FULL will always be set to something. Even if it is "no-vcs-found".
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION}" )
|
||||
|
||||
# Compare the version argument against the version in the existing header file for a mismatch.
|
||||
if( EXISTS ${OUTPUT_FILE} )
|
||||
file( STRINGS ${OUTPUT_FILE} _current_version_str
|
||||
REGEX "^#define[\t ]+KICAD_BUILD_VERSION[\t ]+.*" )
|
||||
string( REGEX REPLACE "^#define KICAD_BUILD_VERSION \"([()a-zA-Z0-9 -.]+)\".*"
|
||||
"\\1" _wvh_last_version "${_current_version_str}" )
|
||||
|
||||
# No change, do not write version.h
|
||||
if( _wvh_version_str STREQUAL _wvh_last_version )
|
||||
message( STATUS "Not updating ${OUTPUT_FILE}" )
|
||||
set( _wvh_write_version_file OFF )
|
||||
endif()
|
||||
# Optional branch name detected by git or configuration defined option.
|
||||
if( KICAD_BRANCH_NAME )
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_BRANCH_NAME}" )
|
||||
endif()
|
||||
|
||||
if( _wvh_write_version_file )
|
||||
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${_wvh_version_str}" )
|
||||
# Optional user version information defined at configuration.
|
||||
if( KICAD_VERSION_EXTRA )
|
||||
set( KICAD_VERSION_FULL "${KICAD_VERSION_FULL}-${KICAD_VERSION_EXTRA}" )
|
||||
endif()
|
||||
|
||||
file( WRITE ${OUTPUT_FILE}
|
||||
set( _wvh_new_version_text
|
||||
"/* Do not modify this file, it was automatically generated by CMake. */
|
||||
|
||||
/*
|
||||
@@ -73,11 +59,26 @@ if( _wvh_write_version_file )
|
||||
#ifndef __KICAD_VERSION_H__
|
||||
#define __KICAD_VERSION_H__
|
||||
|
||||
#define KICAD_BUILD_VERSION \"${_wvh_version_str}\"
|
||||
#define KICAD_VERSION_FULL \"${KICAD_VERSION_FULL}\"
|
||||
|
||||
#endif /* __KICAD_VERSION_H__ */
|
||||
"
|
||||
)
|
||||
" )
|
||||
|
||||
set( _wvh_write_version_file ON )
|
||||
|
||||
# Only write the header if it has changed, to avoid rebuilds
|
||||
if( EXISTS ${OUTPUT_FILE} )
|
||||
file( READ ${OUTPUT_FILE} _wvh_old_version_text )
|
||||
if( _wvh_old_version_text STREQUAL _wvh_new_version_text )
|
||||
message( STATUS "Not updating ${OUTPUT_FILE}" )
|
||||
set( _wvh_write_version_file OFF )
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if( _wvh_write_version_file )
|
||||
message( STATUS "Writing ${OUTPUT_FILE} file with version: ${KICAD_VERSION_FULL}" )
|
||||
|
||||
file( WRITE ${OUTPUT_FILE} ${_wvh_new_version_text} )
|
||||
|
||||
endif()
|
||||
|
||||
|
||||
@@ -77,7 +77,4 @@
|
||||
#define KIFACE_SUFFIX wxT( "@KIFACE_SUFFIX@" )
|
||||
#define KIFACE_PREFIX wxT( "@KIFACE_PREFIX@" )
|
||||
|
||||
/// Name of repo from which this build came.
|
||||
#define KICAD_REPO_NAME "@KICAD_REPO_NAME@"
|
||||
|
||||
#endif // CONFIG_H_
|
||||
|
||||
@@ -151,6 +151,11 @@ supplied by KiCad. This option is disabled by default.
|
||||
The KICAD_SCRIPTING_WXPYTHON option is used to enable building the wxPython interface into
|
||||
Pcbnew including the wxPython console. This option is disabled by default.
|
||||
|
||||
## Github Plugin ## {#github_opt}
|
||||
|
||||
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
|
||||
enabled by default.
|
||||
|
||||
## Build with Static Libraries ## {#static_lib_opt}
|
||||
|
||||
The KICAD_BUILD_STATIC option is used to build KiCad with static libraries. This option is
|
||||
@@ -175,10 +180,30 @@ The USE_OSX_DEPS_BUILDER option forces the build configuration to download and b
|
||||
required dependencies to build KiCad on OSX. This option is not longer maintained and most
|
||||
likely is broken. Use it at your own peril.
|
||||
|
||||
## Github Plugin ## {#github_opt}
|
||||
## Setting the Build Version and Repository Name ## {#build_version_opt}
|
||||
|
||||
The BUILD_GITHUB_PLUGIN option is used to control if the Github plugin is built. This option is
|
||||
enabled by default.
|
||||
The KiCad version string is defined by the three CMake variables KICAD_VERSION, KICAD_BRANCH_NAME,
|
||||
and KICAD_VERSION_EXTRA. Variables KICAD_BRANCH_NAME and KICAD_VERSION_EXTRA are defined as empty
|
||||
strings and can be set at configuration. Unless the source branch is a stable release archive,
|
||||
KICAD_VERSION is set to "no-vcs-found". If an optional variable is not define, it is not appended
|
||||
to the full version string. If an optional variable is defined it is appended along with a leading
|
||||
'-' to the full version string as follows:
|
||||
|
||||
KICAD_VERSION[-KICAD_BRANCH_NAME][-KICAD_VERSION_EXTRA]
|
||||
|
||||
When the version string is set to "no-vcs-found", the build script automatically creates the
|
||||
version string information from the [git][] repository information as follows:
|
||||
|
||||
|
||||
(2016-08-26 revision 67230ac)-master
|
||||
| | |
|
||||
| | branch name, "HEAD" if not on a branch,
|
||||
| | or "unknown" if no .git present
|
||||
| |
|
||||
| abbreviated commit hash, or no-git if no .git
|
||||
| present
|
||||
|
|
||||
date of commit, or date of build if no .git present
|
||||
|
||||
# Getting the KiCad Source Code ## {#getting_src}
|
||||
|
||||
|
||||
@@ -115,15 +115,20 @@ install( TARGETS lib_kicad
|
||||
endif()
|
||||
|
||||
|
||||
# KiCad build version string defaults to undefined which forces the build version header
|
||||
# command to look for Bazaar to create the version string header.
|
||||
set( KICAD_BUILD_VERSION "" CACHE STRING "Version string defined at configuration time." )
|
||||
# KiCad build version string defaults to "no-vcs-found" which forces the build version header
|
||||
# command to look for git to create the version string header when the .git path is found in
|
||||
# the source path.
|
||||
set( KICAD_BRANCH_NAME "" CACHE STRING "KiCad repository name." )
|
||||
set( KICAD_VERSION_EXTRA "" CACHE STRING
|
||||
"User defined configuration string to append to KiCad version." )
|
||||
|
||||
# Generate version header file.
|
||||
add_custom_target(
|
||||
version_header ALL
|
||||
COMMAND ${CMAKE_COMMAND}
|
||||
-DKICAD_BUILD_VERSION=${KICAD_BUILD_VERSION}
|
||||
-DKICAD_VERSION=${KICAD_VERSION}
|
||||
-DKICAD_BRANCH_NAME=${KICAD_BRANCH_NAME}
|
||||
-DKICAD_VERSION_EXTRA=${KICAD_VERSION_EXTRA}
|
||||
-DOUTPUT_FILE=${CMAKE_BINARY_DIR}/kicad_build_version.h
|
||||
-DSRC_PATH=${PROJECT_SOURCE_DIR}
|
||||
-DCMAKE_MODULE_PATH=${CMAKE_MODULE_PATH}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors.
|
||||
* Copyright (C) 2015-2016 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
|
||||
@@ -37,9 +37,8 @@
|
||||
wxString GetBuildVersion()
|
||||
{
|
||||
wxString msg = wxString::Format(
|
||||
wxT( "%s-%s" ),
|
||||
wxT( KICAD_BUILD_VERSION ),
|
||||
wxT( KICAD_REPO_NAME )
|
||||
wxT( "%s" ),
|
||||
wxT( KICAD_VERSION_FULL )
|
||||
);
|
||||
|
||||
return msg;
|
||||
|
||||
@@ -107,9 +107,8 @@ bool BITMAP_BASE::SaveData( FILE* aFile ) const
|
||||
// Write binary data in hexadecimal form (ASCII)
|
||||
wxStreamBuffer* buffer = stream.GetOutputStreamBuffer();
|
||||
char* begin = (char*) buffer->GetBufferStart();
|
||||
int ii;
|
||||
|
||||
for( ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
|
||||
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
|
||||
{
|
||||
if( ii >= 32 )
|
||||
{
|
||||
@@ -140,7 +139,7 @@ void BITMAP_BASE::SaveData( wxArrayString& aPngStrings ) const
|
||||
char* begin = (char*) buffer->GetBufferStart();
|
||||
wxString line;
|
||||
|
||||
for( int ii = 0; begin <= buffer->GetBufferEnd(); begin++, ii++ )
|
||||
for( int ii = 0; begin < buffer->GetBufferEnd(); begin++, ii++ )
|
||||
{
|
||||
if( ii >= 32 )
|
||||
{
|
||||
|
||||
@@ -450,7 +450,7 @@ void OPENGL_GAL::DrawRectangle( const VECTOR2D& aStartPoint, const VECTOR2D& aEn
|
||||
|
||||
void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
|
||||
{
|
||||
if( aPointList.empty() )
|
||||
if( aPointList.size() < 2 )
|
||||
return;
|
||||
|
||||
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
|
||||
@@ -478,6 +478,9 @@ void OPENGL_GAL::DrawPolyline( const std::deque<VECTOR2D>& aPointList )
|
||||
|
||||
void OPENGL_GAL::DrawPolyline( const VECTOR2D aPointList[], int aListSize )
|
||||
{
|
||||
if( aListSize < 2 )
|
||||
return;
|
||||
|
||||
currentManager->Color( strokeColor.r, strokeColor.g, strokeColor.b, strokeColor.a );
|
||||
|
||||
// Start from the second point
|
||||
|
||||
@@ -80,7 +80,6 @@ BEGIN_EVENT_TABLE( CVPCB_MAINFRAME, KIWAY_PLAYER )
|
||||
EVT_TOOL( ID_CVPCB_GOTO_PREVIOUSNA, CVPCB_MAINFRAME::ToPreviousNA )
|
||||
EVT_TOOL( ID_CVPCB_DEL_ASSOCIATIONS, CVPCB_MAINFRAME::DelAssociations )
|
||||
EVT_TOOL( ID_CVPCB_AUTO_ASSOCIE, CVPCB_MAINFRAME::AutomaticFootprintMatching )
|
||||
EVT_TOOL( ID_PCB_DISPLAY_FOOTPRINT_DOC, CVPCB_MAINFRAME::DisplayDocFile )
|
||||
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
||||
CVPCB_MAINFRAME::OnSelectFilteringFootprint )
|
||||
EVT_TOOL( ID_CVPCB_FOOTPRINT_DISPLAY_PIN_FILTERED_LIST,
|
||||
@@ -500,12 +499,6 @@ void CVPCB_MAINFRAME::DisplayModule( wxCommandEvent& event )
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::DisplayDocFile( wxCommandEvent& event )
|
||||
{
|
||||
GetAssociatedDocument( this, m_DocModulesFileName, &Kiface().KifaceSearch() );
|
||||
}
|
||||
|
||||
|
||||
void CVPCB_MAINFRAME::OnSelectComponent( wxListEvent& event )
|
||||
{
|
||||
if( m_skipComponentSelect )
|
||||
|
||||
@@ -164,8 +164,6 @@ public:
|
||||
*/
|
||||
void AutomaticFootprintMatching( wxCommandEvent& event );
|
||||
|
||||
void DisplayDocFile( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function OnSelectFilteringFootprint
|
||||
* is the command event handler for enabling and disabling footprint filtering.
|
||||
|
||||
+4
-4
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2016 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
|
||||
@@ -91,9 +91,9 @@ void CVPCB_MAINFRAME::ReCreateMenuBar()
|
||||
KiBitmap( editor_xpm ) );
|
||||
|
||||
AddMenuItem( preferencesMenu, ID_CVPCB_EQUFILES_LIST_EDIT,
|
||||
_( "Edit &Equ Files List" ),
|
||||
_( "Setup equ files list (.equ files)\n"
|
||||
"They are files which give the footprint name from the component value"),
|
||||
_( "&Edit Footprint Association File" ),
|
||||
_( "Modify footprint association file (.equ). This is the file which "
|
||||
"assigns the footprint name by the component value" ),
|
||||
KiBitmap( library_table_xpm ) );
|
||||
|
||||
// Language submenu
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2007-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2007-2016 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
|
||||
@@ -79,11 +79,6 @@ void CVPCB_MAINFRAME::ReCreateHToolbar()
|
||||
KiBitmap( delete_association_xpm ),
|
||||
_( "Delete all associations (links)" ) );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_PCB_DISPLAY_FOOTPRINT_DOC, wxEmptyString,
|
||||
KiBitmap( datasheet_xpm ),
|
||||
_( "Display footprint documentation" ) );
|
||||
|
||||
m_mainToolBar->AddSeparator();
|
||||
m_mainToolBar->AddTool( ID_CVPCB_FOOTPRINT_DISPLAY_FILTERED_LIST,
|
||||
KiBitmap( module_filtered_list_xpm ),
|
||||
|
||||
@@ -563,10 +563,7 @@ void DIALOG_ERC::TestErc( wxArrayString* aMessagesList )
|
||||
return;
|
||||
|
||||
if( WriteDiagnosticERC( dlg.GetPath() ) )
|
||||
{
|
||||
Close( true );
|
||||
ExecuteFile( this, Pgm().GetEditorName(), QuoteFullPath( fn ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -444,8 +444,7 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
case HK_ZOOM_REDRAW:
|
||||
case HK_ZOOM_CENTER:
|
||||
case HK_ZOOM_AUTO:
|
||||
case HK_LEAVE_SHEET:
|
||||
case HK_DELETE_NODE:
|
||||
// case HK_ZOOM_SELECTION:
|
||||
case HK_MOVEBLOCK_TO_DRAGBLOCK: // Switch to drag mode, when block moving
|
||||
case HK_SAVE_BLOCK: // Copy block to paste buffer.
|
||||
cmd.SetId( hotKey->m_IdMenuEvent );
|
||||
@@ -472,10 +471,12 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
|
||||
}
|
||||
break;
|
||||
|
||||
case HK_UNDO:
|
||||
case HK_REDO:
|
||||
case HK_UNDO: // Hot keys that map to command IDs that cannot be called
|
||||
case HK_REDO: // while busy performing another command.
|
||||
case HK_FIND_ITEM:
|
||||
case HK_FIND_REPLACE:
|
||||
case HK_DELETE_NODE:
|
||||
case HK_LEAVE_SHEET:
|
||||
if( notBusy )
|
||||
{
|
||||
cmd.SetId( hotKey->m_IdMenuEvent );
|
||||
|
||||
@@ -55,10 +55,11 @@
|
||||
|
||||
<!-- the table entries -->
|
||||
<xsl:template match="components/comp">
|
||||
<xsl:value-of select="@ref"/><xsl:text>,</xsl:text>
|
||||
<xsl:value-of select="value"/><xsl:text>,</xsl:text>
|
||||
<xsl:value-of select="footprint"/><xsl:text>,</xsl:text>
|
||||
<xsl:value-of select="datasheet"/>
|
||||
<xsl:text>"</xsl:text>
|
||||
<xsl:value-of select="@ref"/><xsl:text>","</xsl:text>
|
||||
<xsl:value-of select="value"/><xsl:text>","</xsl:text>
|
||||
<xsl:value-of select="footprint"/><xsl:text>","</xsl:text>
|
||||
<xsl:value-of select="datasheet"/><xsl:text>"</xsl:text>
|
||||
<xsl:apply-templates select="fields"/>
|
||||
<xsl:text>&nl;</xsl:text>
|
||||
</xsl:template>
|
||||
@@ -72,7 +73,7 @@
|
||||
<!-- for all existing head entries -->
|
||||
<xsl:for-each select="/export/components/comp/fields/field[generate-id(.) = generate-id(key('headentr',@name)[1])]">
|
||||
<xsl:variable name="allnames" select="@name"/>
|
||||
<xsl:text>,</xsl:text>
|
||||
<xsl:text>,"</xsl:text>
|
||||
|
||||
<!-- for all field entries in the remembered fields section -->
|
||||
<xsl:for-each select="$fieldvar">
|
||||
@@ -87,6 +88,8 @@
|
||||
Every non-blank entry is assigned to its proper column.
|
||||
-->
|
||||
</xsl:for-each>
|
||||
|
||||
<xsl:text>"</xsl:text>
|
||||
</xsl:for-each>
|
||||
</xsl:template>
|
||||
|
||||
|
||||
@@ -162,17 +162,17 @@ void DIALOG_PRINT_USING_PRINTER::InitValues( )
|
||||
{
|
||||
msg = _( "Layer" );
|
||||
msg << wxT( " " ) << ii + 1;
|
||||
m_BoxSelectLayer[ii] = new wxCheckBox( this, -1, msg );
|
||||
|
||||
if( g_GERBER_List.GetGbrImage( ii ) == NULL ) // Nothing loaded on this draw layer
|
||||
wxStaticBoxSizer* boxSizer = ( ii < 16 ) ? m_leftLayersBoxSizer
|
||||
: m_rightLayersBoxSizer;
|
||||
|
||||
m_BoxSelectLayer[ii] = new wxCheckBox( boxSizer->GetStaticBox(),
|
||||
wxID_ANY, msg );
|
||||
boxSizer->Add( m_BoxSelectLayer[ii], wxGROW | wxLEFT | wxRIGHT | wxTOP );
|
||||
|
||||
if( g_GERBER_List.GetGbrImage( ii ) == NULL )
|
||||
// Nothing loaded on this draw layer
|
||||
m_BoxSelectLayer[ii]->Enable( false );
|
||||
|
||||
if( ii < 16 )
|
||||
m_leftLayersBoxSizer->Add( m_BoxSelectLayer[ii],
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP );
|
||||
else
|
||||
m_rightLayersBoxSizer->Add( m_BoxSelectLayer[ii],
|
||||
wxGROW | wxLEFT | wxRIGHT | wxTOP );
|
||||
}
|
||||
|
||||
// Read the scale adjust option
|
||||
|
||||
+2
-5
@@ -2,8 +2,8 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2009 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2009 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2009-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -255,9 +255,6 @@ enum main_id
|
||||
ID_EDA_SOCKET_EVENT_SERV,
|
||||
ID_EDA_SOCKET_EVENT,
|
||||
|
||||
// Command IDs common to Pcbnew and CvPcb.
|
||||
ID_PCB_DISPLAY_FOOTPRINT_DOC,
|
||||
|
||||
// Common to all
|
||||
ID_TB_OPTIONS_SELECT_UNIT_MM,
|
||||
ID_TB_OPTIONS_SELECT_UNIT_INCH,
|
||||
|
||||
@@ -75,6 +75,7 @@ namespace PCB { struct IFACE; } // KIFACE_I is in pcbnew.cpp
|
||||
*/
|
||||
#define PCB_EDIT_FRAME_NAME wxT( "PcbFrame" )
|
||||
|
||||
|
||||
class PCB_EDIT_FRAME : public PCB_BASE_EDIT_FRAME
|
||||
{
|
||||
friend struct PCB::IFACE;
|
||||
@@ -227,6 +228,13 @@ public:
|
||||
|
||||
void OnQuit( wxCommandEvent& event );
|
||||
|
||||
/**
|
||||
* Function GetAutoSaveFilePrefix
|
||||
*
|
||||
* @return the string to prepend to a file name for automatic save.
|
||||
*/
|
||||
static wxString GetAutoSaveFilePrefix();
|
||||
|
||||
/**
|
||||
* Execute a remote command send by Eeschema via a socket,
|
||||
* port KICAD_PCB_PORT_SERVICE_NUMBER (currently 4242)
|
||||
|
||||
@@ -612,7 +612,7 @@ void MirrorMarkedItems( MODULE* module, wxPoint offset, bool force_all )
|
||||
tmpz.x = -tmpz.x;
|
||||
pad->SetDelta( tmpz );
|
||||
|
||||
pad->SetOrientation( 1800 - pad->GetOrientation() );
|
||||
pad->SetOrientation( - pad->GetOrientation() );
|
||||
}
|
||||
|
||||
for( EDA_ITEM* item = module->GraphicalItems(); item; item = item->Next() )
|
||||
|
||||
@@ -230,14 +230,15 @@ void MODULE::TransformGraphicShapesWithClearanceToPolygonSet(
|
||||
|
||||
if( outline->GetLayer() != aLayer )
|
||||
break;
|
||||
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer,
|
||||
0,
|
||||
aCircleToSegmentsCount,
|
||||
aCorrectionFactor );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
outline->TransformShapeWithClearanceToPolygon( aCornerBuffer,
|
||||
0,
|
||||
aCircleToSegmentsCount,
|
||||
aCorrectionFactor );
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -188,6 +188,10 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
|
||||
|
||||
SetToolID( ID_NO_TOOL_SELECTED, m_canvas->GetDefaultCursor(), wxEmptyString );
|
||||
}
|
||||
|
||||
if( TOOL_MANAGER* toolMgr = GetToolManager() )
|
||||
toolMgr->DeactivateTool();
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 1992-2012 Jean_Pierre Charras <jp.charras at wanadoo.fr>
|
||||
* Copyright (C) 1992-2012 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -772,10 +772,9 @@ const wxString EXCELLON_WRITER::drillFileName( LAYER_PAIR aPair, bool aNPTH ) co
|
||||
wxFileName fn = m_pcb->GetFileName();
|
||||
|
||||
fn.SetName( fn.GetName() + extend );
|
||||
fn.SetPath( "" );
|
||||
fn.SetExt( DrillFileExtension );
|
||||
|
||||
wxString ret = fn.GetFullPath(); // show me in debugger
|
||||
wxString ret = fn.GetFullName(); // show me in debugger
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
+38
-11
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2011-2015 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
@@ -64,6 +64,12 @@ static const wxChar backupSuffix[] = wxT( "-bak" );
|
||||
static const wxChar autosavePrefix[] = wxT( "_autosave-" );
|
||||
|
||||
|
||||
wxString PCB_EDIT_FRAME::GetAutoSaveFilePrefix()
|
||||
{
|
||||
return wxString( autosavePrefix );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function AskLoadBoardFileName
|
||||
* puts up a wxFileDialog asking for a BOARD filename to open.
|
||||
@@ -807,7 +813,7 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName )
|
||||
}
|
||||
|
||||
DisplayInfoMessage( this, wxString::Format( _( "Board copied to:\n'%s'" ),
|
||||
GetChars( pcbFileName.GetFullPath() ) ) );
|
||||
GetChars( pcbFileName.GetFullPath() ) ) );
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -815,19 +821,40 @@ bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName )
|
||||
|
||||
bool PCB_EDIT_FRAME::doAutoSave()
|
||||
{
|
||||
wxFileName tmpFileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
||||
wxFileName fn = tmpFileName;
|
||||
wxFileName tmpFileName;
|
||||
|
||||
// Auto save file name is the normal file name prepended with
|
||||
// autosaveFilePrefix string.
|
||||
fn.SetName( wxString( autosavePrefix ) + fn.GetName() );
|
||||
if( GetBoard()->GetFileName().IsEmpty() )
|
||||
{
|
||||
tmpFileName = wxFileName( wxStandardPaths::Get().GetDocumentsDir(), wxT( "noname" ),
|
||||
KiCadPcbFileExtension );
|
||||
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
||||
}
|
||||
else
|
||||
{
|
||||
tmpFileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
|
||||
}
|
||||
|
||||
wxLogTrace( traceAutoSave,
|
||||
wxT( "Creating auto save file <" + fn.GetFullPath() ) + wxT( ">" ) );
|
||||
wxFileName autoSaveFileName = tmpFileName;
|
||||
|
||||
if( !fn.IsOk() )
|
||||
// Auto save file name is the board file name prepended with autosaveFilePrefix string.
|
||||
autoSaveFileName.SetName( wxString( autosavePrefix ) + autoSaveFileName.GetName() );
|
||||
|
||||
if( !autoSaveFileName.IsOk() )
|
||||
return false;
|
||||
else if( SavePcbFile( fn.GetFullPath(), NO_BACKUP_FILE ) )
|
||||
|
||||
// If the board file path is not writable, try writing to a platform specific temp file
|
||||
// path. If that path isn't writabe, give up.
|
||||
if( !autoSaveFileName.IsDirWritable() )
|
||||
{
|
||||
autoSaveFileName.SetPath( wxFileName::GetTempDir() );
|
||||
|
||||
if( !autoSaveFileName.IsOk() || !autoSaveFileName.IsDirWritable() )
|
||||
return false;
|
||||
}
|
||||
|
||||
wxLogTrace( traceAutoSave, "Creating auto save file <" + autoSaveFileName.GetFullPath() + ">" );
|
||||
|
||||
if( SavePcbFile( autoSaveFileName.GetFullPath(), NO_BACKUP_FILE ) )
|
||||
{
|
||||
GetScreen()->SetModify();
|
||||
GetBoard()->SetFileName( tmpFileName.GetFullPath() );
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -39,12 +39,12 @@
|
||||
#include <class_pcb_text.h>
|
||||
|
||||
// Keys to store setup in config
|
||||
#define DXF_IMPORT_LAYER_OPTION_KEY wxT("DxfImportBrdLayer")
|
||||
#define DXF_IMPORT_COORD_ORIGIN_KEY wxT("DxfImportCoordOrigin")
|
||||
#define DXF_IMPORT_LAST_FILE_KEY wxT("DxfImportLastFile")
|
||||
#define DXF_IMPORT_GRID_UNITS_KEY wxT("DxfImportGridUnits")
|
||||
#define DXF_IMPORT_GRID_OFFSET_X_KEY wxT("DxfImportGridOffsetX")
|
||||
#define DXF_IMPORT_GRID_OFFSET_Y_KEY wxT("DxfImportGridOffsetY")
|
||||
#define DXF_IMPORT_LAYER_OPTION_KEY "DxfImportBrdLayer"
|
||||
#define DXF_IMPORT_COORD_ORIGIN_KEY "DxfImportCoordOrigin"
|
||||
#define DXF_IMPORT_LAST_FILE_KEY "DxfImportLastFile"
|
||||
#define DXF_IMPORT_GRID_UNITS_KEY "DxfImportGridUnits"
|
||||
#define DXF_IMPORT_GRID_OFFSET_X_KEY "DxfImportGridOffsetX"
|
||||
#define DXF_IMPORT_GRID_OFFSET_Y_KEY "DxfImportGridOffsetY"
|
||||
|
||||
|
||||
// Static members of DIALOG_DXF_IMPORT, to remember
|
||||
@@ -54,10 +54,11 @@ int DIALOG_DXF_IMPORT::m_offsetSelection = 0;
|
||||
LAYER_NUM DIALOG_DXF_IMPORT::m_layer = Dwgs_User;
|
||||
|
||||
|
||||
DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent )
|
||||
DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent, bool aUseModuleItems )
|
||||
: DIALOG_DXF_IMPORT_BASE( aParent )
|
||||
{
|
||||
m_parent = aParent;
|
||||
m_dxfImporter.UseModuleItems( aUseModuleItems );
|
||||
m_config = Kiface().KifaceSettings();
|
||||
m_PCBGridUnits = 0;
|
||||
m_PCBGridOffsetX = 0.0;
|
||||
@@ -77,7 +78,7 @@ DIALOG_DXF_IMPORT::DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent )
|
||||
wxString tmpStr;
|
||||
tmpStr << m_PCBGridOffsetX;
|
||||
m_DXFPCBXCoord->SetValue( tmpStr );
|
||||
tmpStr = wxT( "" );
|
||||
tmpStr = "";
|
||||
tmpStr << m_PCBGridOffsetY;
|
||||
m_DXFPCBYCoord->SetValue( tmpStr );
|
||||
|
||||
@@ -136,7 +137,7 @@ void DIALOG_DXF_IMPORT::OnBrowseDxfFiles( wxCommandEvent& event )
|
||||
wxFileDialog dlg( m_parent,
|
||||
_( "Open File" ),
|
||||
path, filename,
|
||||
wxT( "DXF Files (*.dxf)|*.dxf" ),
|
||||
"DXF Files (*.dxf)|*.dxf",
|
||||
wxFD_OPEN|wxFD_FILE_MUST_EXIST );
|
||||
|
||||
if( dlg.ShowModal() != wxID_OK )
|
||||
@@ -238,7 +239,7 @@ bool InvokeDXFDialogModuleImport( PCB_BASE_FRAME* aCaller, MODULE* aModule )
|
||||
{
|
||||
wxASSERT( aModule );
|
||||
|
||||
DIALOG_DXF_IMPORT dlg( aCaller );
|
||||
DIALOG_DXF_IMPORT dlg( aCaller, true );
|
||||
bool success = ( dlg.ShowModal() == wxID_OK );
|
||||
|
||||
if( success )
|
||||
@@ -252,37 +253,7 @@ bool InvokeDXFDialogModuleImport( PCB_BASE_FRAME* aCaller, MODULE* aModule )
|
||||
|
||||
for( it = list.begin(), itEnd = list.end(); it != itEnd; ++it )
|
||||
{
|
||||
BOARD_ITEM* item = *it;
|
||||
BOARD_ITEM* converted = NULL;
|
||||
|
||||
// Modules use different types for the same things,
|
||||
// so we need to convert imported items to appropriate classes.
|
||||
switch( item->Type() )
|
||||
{
|
||||
case PCB_LINE_T:
|
||||
{
|
||||
converted = new EDGE_MODULE( aModule );
|
||||
*static_cast<DRAWSEGMENT*>( converted ) = *static_cast<DRAWSEGMENT*>( item );
|
||||
aModule->Add( converted );
|
||||
static_cast<EDGE_MODULE*>( converted )->SetLocalCoord();
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
|
||||
case PCB_TEXT_T:
|
||||
{
|
||||
converted = new TEXTE_MODULE( aModule );
|
||||
*static_cast<TEXTE_PCB*>( converted ) = *static_cast<TEXTE_PCB*>( item );
|
||||
aModule->Add( converted );
|
||||
static_cast<TEXTE_MODULE*>( converted )->SetLocalCoord();
|
||||
delete item;
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
wxLogDebug( wxT( "type %d currently not handled" ), item->Type() );
|
||||
break;
|
||||
}
|
||||
aModule->Add( *it );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -305,6 +276,7 @@ int DIALOG_DXF_IMPORT::GetPCBGridUnits( void )
|
||||
return m_DXFPCBGridUnits->GetSelection();
|
||||
}
|
||||
|
||||
|
||||
void DIALOG_DXF_IMPORT::GetPCBGridOffsets( double &aXOffset, double &aYOffset )
|
||||
{
|
||||
aXOffset = DoubleValueFromString( UNSCALED_UNITS, m_DXFPCBXCoord->GetValue() );
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -29,7 +29,7 @@
|
||||
class DIALOG_DXF_IMPORT : public DIALOG_DXF_IMPORT_BASE
|
||||
{
|
||||
public:
|
||||
DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent );
|
||||
DIALOG_DXF_IMPORT( PCB_BASE_FRAME* aParent, bool aUseModuleItems = false );
|
||||
~DIALOG_DXF_IMPORT();
|
||||
|
||||
/**
|
||||
|
||||
+166
-148
@@ -2,7 +2,7 @@
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2016 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
|
||||
@@ -44,8 +44,10 @@
|
||||
#include <macros.h>
|
||||
#include <class_board.h>
|
||||
#include <class_drawsegment.h>
|
||||
#include <class_edge_mod.h>
|
||||
#include <class_pcb_text.h>
|
||||
#include <convert_from_iu.h>
|
||||
#include <class_text_mod.h>
|
||||
#include <drw_base.h>
|
||||
|
||||
// minimum bulge value before resorting to a line segment;
|
||||
@@ -98,9 +100,6 @@ bool DXF2BRD_CONVERTER::ImportDxfFile( const wxString& aFile )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Implementation of the method which handles layers.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& aData )
|
||||
{
|
||||
// Not yet useful in Pcbnew.
|
||||
@@ -111,12 +110,10 @@ void DXF2BRD_CONVERTER::addLayer( const DRW_Layer& aData )
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* Import line entities.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addLine( const DRW_Line& aData )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
wxPoint start( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
@@ -148,7 +145,9 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& aData )
|
||||
continue;
|
||||
}
|
||||
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( NULL );
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) :
|
||||
new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetStart( segment_startpoint );
|
||||
@@ -163,7 +162,9 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& aData )
|
||||
// Polyline flags bit 0 indicates closed (1) or open (0) polyline
|
||||
if( aData.flags & 1 )
|
||||
{
|
||||
DRAWSEGMENT* closing_segm = new DRAWSEGMENT( NULL );
|
||||
DRAWSEGMENT* closing_segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) :
|
||||
new DRAWSEGMENT;
|
||||
|
||||
closing_segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
closing_segm->SetStart( segment_startpoint );
|
||||
@@ -174,6 +175,7 @@ void DXF2BRD_CONVERTER::addPolyline(const DRW_Polyline& aData )
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& aData )
|
||||
{
|
||||
// Currently, Pcbnew does not know polylines, for boards.
|
||||
@@ -221,12 +223,11 @@ void DXF2BRD_CONVERTER::addLWPolyline(const DRW_LWPolyline& aData )
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Import Circle entities.
|
||||
*/
|
||||
|
||||
void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& aData )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetShape( S_CIRCLE );
|
||||
@@ -244,7 +245,8 @@ void DXF2BRD_CONVERTER::addCircle( const DRW_Circle& aData )
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT;
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT;
|
||||
|
||||
segm->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
segm->SetShape( S_ARC );
|
||||
@@ -276,13 +278,26 @@ void DXF2BRD_CONVERTER::addArc( const DRW_Arc& data )
|
||||
m_newItemsList.push_back( segm );
|
||||
}
|
||||
|
||||
/**
|
||||
* Import texts (TEXT).
|
||||
*/
|
||||
|
||||
void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
|
||||
{
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( NULL );
|
||||
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
BOARD_ITEM* brdItem;
|
||||
EDA_TEXT* textItem;
|
||||
|
||||
if( m_useModuleItems )
|
||||
{
|
||||
TEXTE_MODULE* modText = new TEXTE_MODULE( NULL );
|
||||
brdItem = static_cast< BOARD_ITEM* >( modText );
|
||||
textItem = static_cast< EDA_TEXT* >( modText );
|
||||
}
|
||||
else
|
||||
{
|
||||
TEXTE_PCB* pcbText = new TEXTE_PCB( NULL );
|
||||
brdItem = static_cast< BOARD_ITEM* >( pcbText );
|
||||
textItem = static_cast< EDA_TEXT* >( pcbText );
|
||||
}
|
||||
|
||||
brdItem->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
|
||||
wxPoint refPoint( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
wxPoint secPoint( mapX( aData.secPoint.x ), mapY( aData.secPoint.y ) );
|
||||
@@ -299,63 +314,63 @@ void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
|
||||
|
||||
switch( aData.alignV )
|
||||
{
|
||||
case DRW_Text::VBaseLine:
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
break;
|
||||
case DRW_Text::VBaseLine:
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
break;
|
||||
|
||||
case DRW_Text::VBottom:
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
break;
|
||||
case DRW_Text::VBottom:
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
break;
|
||||
|
||||
case DRW_Text::VMiddle:
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
break;
|
||||
case DRW_Text::VMiddle:
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
break;
|
||||
|
||||
case DRW_Text::VTop:
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
break;
|
||||
case DRW_Text::VTop:
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
break;
|
||||
}
|
||||
|
||||
switch( aData.alignH )
|
||||
{
|
||||
case DRW_Text::HLeft:
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
case DRW_Text::HLeft:
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
|
||||
case DRW_Text::HCenter:
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
break;
|
||||
case DRW_Text::HCenter:
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
break;
|
||||
|
||||
case DRW_Text::HRight:
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
break;
|
||||
case DRW_Text::HRight:
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
break;
|
||||
|
||||
case DRW_Text::HAligned:
|
||||
// no equivalent options in text pcb.
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
case DRW_Text::HAligned:
|
||||
// no equivalent options in text pcb.
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
|
||||
case DRW_Text::HMiddle:
|
||||
// no equivalent options in text pcb.
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
break;
|
||||
case DRW_Text::HMiddle:
|
||||
// no equivalent options in text pcb.
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
break;
|
||||
|
||||
case DRW_Text::HFit:
|
||||
// no equivalent options in text pcb.
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
case DRW_Text::HFit:
|
||||
// no equivalent options in text pcb.
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
break;
|
||||
}
|
||||
|
||||
#if 0
|
||||
wxString sty = wxString::FromUTF8(aData.style.c_str());
|
||||
sty=sty.ToLower();
|
||||
wxString sty = wxString::FromUTF8( aData.style.c_str() );
|
||||
sty = sty.ToLower();
|
||||
|
||||
if (aData.textgen==2)
|
||||
if( aData.textgen == 2 )
|
||||
{
|
||||
// Text dir = left to right;
|
||||
} else if (aData.textgen==4)
|
||||
} else if( aData.textgen == 4 )
|
||||
{
|
||||
/ Text dir = top to bottom;
|
||||
// Text dir = top to bottom;
|
||||
} else
|
||||
{
|
||||
}
|
||||
@@ -363,21 +378,19 @@ void DXF2BRD_CONVERTER::addText( const DRW_Text& aData )
|
||||
|
||||
wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
|
||||
|
||||
pcb_text->SetTextPosition( refPoint );
|
||||
pcb_text->SetOrientation( aData.angle * 10 );
|
||||
// The 0.8 factor gives a better height/width ratio with our font
|
||||
pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( aData.height ) );
|
||||
pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
pcb_text->SetText( text );
|
||||
textItem->SetTextPosition( refPoint );
|
||||
textItem->SetOrientation( aData.angle * 10 );
|
||||
|
||||
m_newItemsList.push_back( pcb_text );
|
||||
// The 0.8 factor gives a better height/width ratio with our font
|
||||
textItem->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
textItem->SetHeight( mapDim( aData.height ) );
|
||||
textItem->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
textItem->SetText( text );
|
||||
|
||||
m_newItemsList.push_back( static_cast< BOARD_ITEM* >( brdItem ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Import multi line texts (MTEXT).
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
|
||||
{
|
||||
wxString text = toNativeString( wxString::FromUTF8( aData.text.c_str() ) );
|
||||
@@ -408,46 +421,63 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
|
||||
text = tmp;
|
||||
}
|
||||
|
||||
TEXTE_PCB* pcb_text = new TEXTE_PCB( NULL );
|
||||
pcb_text->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
BOARD_ITEM* brdItem;
|
||||
EDA_TEXT* textItem;
|
||||
|
||||
if( m_useModuleItems )
|
||||
{
|
||||
TEXTE_MODULE* modText = new TEXTE_MODULE( NULL );
|
||||
brdItem = static_cast< BOARD_ITEM* >( modText );
|
||||
textItem = static_cast< EDA_TEXT* >( modText );
|
||||
}
|
||||
else
|
||||
{
|
||||
TEXTE_PCB* pcbText = new TEXTE_PCB( NULL );
|
||||
brdItem = static_cast< BOARD_ITEM* >( pcbText );
|
||||
textItem = static_cast< EDA_TEXT* >( pcbText );
|
||||
}
|
||||
|
||||
brdItem->SetLayer( ToLAYER_ID( m_brdLayer ) );
|
||||
wxPoint textpos( mapX( aData.basePoint.x ), mapY( aData.basePoint.y ) );
|
||||
pcb_text->SetTextPosition( textpos );
|
||||
pcb_text->SetOrientation( aData.angle * 10 );
|
||||
|
||||
textItem->SetTextPosition( textpos );
|
||||
textItem->SetOrientation( aData.angle * 10 );
|
||||
|
||||
// The 0.8 factor gives a better height/width ratio with our font
|
||||
pcb_text->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
pcb_text->SetHeight( mapDim( aData.height ) );
|
||||
pcb_text->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
pcb_text->SetText( text );
|
||||
textItem->SetWidth( mapDim( aData.height * 0.8 ) );
|
||||
textItem->SetHeight( mapDim( aData.height ) );
|
||||
textItem->SetThickness( mapDim( aData.thickness == 0 ? m_defaultThickness : aData.thickness ) );
|
||||
textItem->SetText( text );
|
||||
|
||||
// Initialize text justifications:
|
||||
if( aData.textgen <= 3 )
|
||||
{
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_TOP );
|
||||
}
|
||||
else if( aData.textgen <= 6 )
|
||||
{
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_CENTER );
|
||||
}
|
||||
else
|
||||
{
|
||||
pcb_text->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
textItem->SetVertJustify( GR_TEXT_VJUSTIFY_BOTTOM );
|
||||
}
|
||||
|
||||
if( aData.textgen % 3 == 1 )
|
||||
{
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_LEFT );
|
||||
}
|
||||
else if( aData.textgen % 3 == 2 )
|
||||
{
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_CENTER );
|
||||
}
|
||||
else
|
||||
{
|
||||
pcb_text->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
textItem->SetHorizJustify( GR_TEXT_HJUSTIFY_RIGHT );
|
||||
}
|
||||
|
||||
#if 0 // These setting have no mening in Pcbnew
|
||||
if( data.alignH==1 )
|
||||
if( data.alignH == 1 )
|
||||
{
|
||||
// Text is left to right;
|
||||
}
|
||||
@@ -460,7 +490,7 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
|
||||
// use ByStyle;
|
||||
}
|
||||
|
||||
if( aData.alignV==1 )
|
||||
if( aData.alignV == 1 )
|
||||
{
|
||||
// use AtLeast;
|
||||
}
|
||||
@@ -470,13 +500,10 @@ void DXF2BRD_CONVERTER::addMText( const DRW_MText& aData )
|
||||
}
|
||||
#endif
|
||||
|
||||
m_newItemsList.push_back( pcb_text );
|
||||
m_newItemsList.push_back( static_cast< BOARD_ITEM* >( brdItem ) );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Sets the header variables from the DXF file.
|
||||
*/
|
||||
void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data )
|
||||
{
|
||||
std::map<std::string, DRW_Variant*>::const_iterator it;
|
||||
@@ -497,77 +524,69 @@ void DXF2BRD_CONVERTER::addHeader( const DRW_Header* data )
|
||||
|
||||
switch( var->content.i )
|
||||
{
|
||||
case 1: // inches
|
||||
m_DXF2mm = 25.4;
|
||||
break;
|
||||
case 1: // inches
|
||||
m_DXF2mm = 25.4;
|
||||
break;
|
||||
|
||||
case 2: // feet
|
||||
m_DXF2mm = 304.8;
|
||||
break;
|
||||
case 2: // feet
|
||||
m_DXF2mm = 304.8;
|
||||
break;
|
||||
|
||||
case 5: // centimeters
|
||||
m_DXF2mm = 10.0;
|
||||
break;
|
||||
case 5: // centimeters
|
||||
m_DXF2mm = 10.0;
|
||||
break;
|
||||
|
||||
case 6: // meters
|
||||
m_DXF2mm = 1000.0;
|
||||
break;
|
||||
case 6: // meters
|
||||
m_DXF2mm = 1000.0;
|
||||
break;
|
||||
|
||||
case 8: // microinches
|
||||
m_DXF2mm = 2.54e-5;
|
||||
break;
|
||||
case 8: // microinches
|
||||
m_DXF2mm = 2.54e-5;
|
||||
break;
|
||||
|
||||
case 9: // mils
|
||||
m_DXF2mm = 0.0254;
|
||||
break;
|
||||
case 9: // mils
|
||||
m_DXF2mm = 0.0254;
|
||||
break;
|
||||
|
||||
case 10: // yards
|
||||
m_DXF2mm = 914.4;
|
||||
break;
|
||||
case 10: // yards
|
||||
m_DXF2mm = 914.4;
|
||||
break;
|
||||
|
||||
case 11: // Angstroms
|
||||
m_DXF2mm = 1.0e-7;
|
||||
break;
|
||||
case 11: // Angstroms
|
||||
m_DXF2mm = 1.0e-7;
|
||||
break;
|
||||
|
||||
case 12: // nanometers
|
||||
m_DXF2mm = 1.0e-6;
|
||||
break;
|
||||
case 12: // nanometers
|
||||
m_DXF2mm = 1.0e-6;
|
||||
break;
|
||||
|
||||
case 13: // micrometers
|
||||
m_DXF2mm = 1.0e-3;
|
||||
break;
|
||||
case 13: // micrometers
|
||||
m_DXF2mm = 1.0e-3;
|
||||
break;
|
||||
|
||||
case 14: // decimeters
|
||||
m_DXF2mm = 100.0;
|
||||
break;
|
||||
case 14: // decimeters
|
||||
m_DXF2mm = 100.0;
|
||||
break;
|
||||
|
||||
default:
|
||||
// use the default of 1.0 for:
|
||||
// 0: Unspecified Units
|
||||
// 4: mm
|
||||
// 3: miles
|
||||
// 7: kilometers
|
||||
// 15: decameters
|
||||
// 16: hectometers
|
||||
// 17: gigameters
|
||||
// 18: AU
|
||||
// 19: lightyears
|
||||
// 20: parsecs
|
||||
break;
|
||||
default:
|
||||
// use the default of 1.0 for:
|
||||
// 0: Unspecified Units
|
||||
// 4: mm
|
||||
// 3: miles
|
||||
// 7: kilometers
|
||||
// 15: decameters
|
||||
// 16: hectometers
|
||||
// 17: gigameters
|
||||
// 18: AU
|
||||
// 19: lightyears
|
||||
// 20: parsecs
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts a native unicode string into a DXF encoded string.
|
||||
*
|
||||
* DXF endoding includes the following special sequences:
|
||||
* - %%%c for a diameter sign
|
||||
* - %%%d for a degree sign
|
||||
* - %%%p for a plus/minus sign
|
||||
*/
|
||||
wxString DXF2BRD_CONVERTER::toDxfString( const wxString& aStr )
|
||||
{
|
||||
wxString res;
|
||||
@@ -622,9 +641,6 @@ wxString DXF2BRD_CONVERTER::toDxfString( const wxString& aStr )
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Converts a DXF encoded string into a native Unicode string.
|
||||
*/
|
||||
wxString DXF2BRD_CONVERTER::toNativeString( const wxString& aData )
|
||||
{
|
||||
wxString res;
|
||||
@@ -708,7 +724,8 @@ void DXF2BRD_CONVERTER::addTextStyle( const DRW_Textstyle& aData )
|
||||
void DXF2BRD_CONVERTER::insertLine( const wxRealPoint& aSegStart,
|
||||
const wxRealPoint& aSegEnd, int aWidth )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( NULL );
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT;
|
||||
wxPoint segment_startpoint( Millimeter2iu( aSegStart.x ), Millimeter2iu( aSegStart.y ) );
|
||||
wxPoint segment_endpoint( Millimeter2iu( aSegEnd.x ), Millimeter2iu( aSegEnd.y ) );
|
||||
|
||||
@@ -725,7 +742,8 @@ void DXF2BRD_CONVERTER::insertLine( const wxRealPoint& aSegStart,
|
||||
void DXF2BRD_CONVERTER::insertArc( const wxRealPoint& aSegStart, const wxRealPoint& aSegEnd,
|
||||
double aBulge, int aWidth )
|
||||
{
|
||||
DRAWSEGMENT* segm = new DRAWSEGMENT( NULL );
|
||||
DRAWSEGMENT* segm = ( m_useModuleItems ) ?
|
||||
static_cast< DRAWSEGMENT* >( new EDGE_MODULE( NULL ) ) : new DRAWSEGMENT;
|
||||
|
||||
wxPoint segment_startpoint( Millimeter2iu( aSegStart.x ), Millimeter2iu( aSegStart.y ) );
|
||||
wxPoint segment_endpoint( Millimeter2iu( aSegEnd.x ), Millimeter2iu( aSegEnd.y ) );
|
||||
|
||||
@@ -50,11 +50,15 @@ private:
|
||||
int m_brdLayer; // The board layer to place imported DXF items
|
||||
int m_version; // the dxf version, not used here
|
||||
std::string m_codePage; // The code page, not used here
|
||||
bool m_useModuleItems; // Use module items instead of board items when true.
|
||||
|
||||
public:
|
||||
DXF2BRD_CONVERTER();
|
||||
~DXF2BRD_CONVERTER();
|
||||
|
||||
bool IsUsingModuleItems() const { return m_useModuleItems; }
|
||||
void UseModuleItems( bool aUseModuleItems = true ) { m_useModuleItems = aUseModuleItems; }
|
||||
|
||||
/**
|
||||
* Set the coordinate offset between the importede dxf items
|
||||
* and Pcbnew.
|
||||
@@ -151,7 +155,19 @@ private:
|
||||
|
||||
virtual void setBlock( const int aHandle ) {}
|
||||
|
||||
/**
|
||||
* Converts a native unicode string into a DXF encoded string.
|
||||
*
|
||||
* DXF endoding includes the following special sequences:
|
||||
* - %%%c for a diameter sign
|
||||
* - %%%d for a degree sign
|
||||
* - %%%p for a plus/minus sign
|
||||
*/
|
||||
static wxString toDxfString( const wxString& aStr );
|
||||
|
||||
/**
|
||||
* Converts a DXF encoded string into a native Unicode string.
|
||||
*/
|
||||
static wxString toNativeString( const wxString& aData );
|
||||
|
||||
// These functions are not used in Kicad.
|
||||
|
||||
@@ -151,7 +151,7 @@ protected:
|
||||
///> otherwise returns unchanged net code
|
||||
inline int getNetCode( int aNetCode )
|
||||
{
|
||||
if( aNetCode < (int) m_netCodes.size() )
|
||||
if( (unsigned int) aNetCode < m_netCodes.size() )
|
||||
return m_netCodes[aNetCode];
|
||||
|
||||
return aNetCode;
|
||||
|
||||
@@ -1960,7 +1960,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
|
||||
|
||||
RotatePoint( &pt, module->GetOrientation() );
|
||||
pad->SetPosition( pt + module->GetPosition() );
|
||||
module->Add( pad );
|
||||
module->Add( pad, ADD_APPEND );
|
||||
}
|
||||
break;
|
||||
|
||||
|
||||
+9
-2
@@ -609,8 +609,15 @@ void PCB_EDIT_FRAME::OnCloseWindow( wxCloseEvent& Event )
|
||||
// Delete the auto save file if it exists.
|
||||
wxFileName fn = GetBoard()->GetFileName();
|
||||
|
||||
// Auto save file name is the normal file name prefixed with a '$'.
|
||||
fn.SetName( wxT( "$" ) + fn.GetName() );
|
||||
// Auto save file name is the normal file name prefixed with '_autosave'.
|
||||
fn.SetName( GetAutoSaveFilePrefix() + fn.GetName() );
|
||||
|
||||
// When the auto save feature does not have write access to the board file path, it falls
|
||||
// back to a platform specific user temporary file path.
|
||||
if( !fn.IsOk() || !fn.IsDirWritable() )
|
||||
fn.SetPath( wxFileName::GetTempDir() );
|
||||
|
||||
wxLogTrace( traceAutoSave, "Deleting auto save file <" + fn.GetFullPath() + ">" );
|
||||
|
||||
// Remove the auto save file on a normal close of Pcbnew.
|
||||
if( fn.FileExists() && !wxRemoveFile( fn.GetFullPath() ) )
|
||||
|
||||
+15
-26
@@ -205,40 +205,29 @@ static bool scriptingSetup()
|
||||
{
|
||||
wxString path_frag;
|
||||
|
||||
#if defined( __MINGW32__ )
|
||||
// force python environment under Windows:
|
||||
const wxString python_us( wxT( "python27_us" ) );
|
||||
#if defined( __WINDOWS__ )
|
||||
// If our python.exe (in kicad/bin) exists, force our kicad python environment
|
||||
wxString kipython = FindKicadFile( "python.exe" );
|
||||
|
||||
// Build our python path inside kicad
|
||||
wxString kipython = FindKicadFile( python_us + wxT( "/python.exe" ) );
|
||||
|
||||
//we need only the path:
|
||||
wxFileName fn( kipython );
|
||||
// we need only the path:
|
||||
wxFileName fn( kipython );
|
||||
kipython = fn.GetPath();
|
||||
|
||||
// If our python install is existing inside kicad, use it
|
||||
// Note: this is usefull only when an other python version is installed
|
||||
if( wxDirExists( kipython ) )
|
||||
{
|
||||
// clear any PYTHONPATH and PYTHONHOME env var definition: the default
|
||||
// values work fine inside Kicad:
|
||||
wxSetEnv( wxT( "PYTHONPATH" ), wxEmptyString );
|
||||
wxSetEnv( wxT( "PYTHONHOME" ), wxEmptyString );
|
||||
|
||||
// Add our python executable path in first position:
|
||||
wxString ppath;
|
||||
wxGetEnv( wxT( "PATH" ), &ppath );
|
||||
|
||||
if( !wxGetEnv( wxT( "PYTHONPATH" ), &ppath ) || !ppath.Contains( python_us ) )
|
||||
{
|
||||
ppath << kipython << wxT( "/pylib;" );
|
||||
ppath << kipython << wxT( "/lib;" );
|
||||
ppath << kipython << wxT( "/dll" );
|
||||
wxSetEnv( wxT( "PYTHONPATH" ), ppath );
|
||||
// DBG( std::cout << "set PYTHONPATH to " << TO_UTF8( ppath ) << "\n"; )
|
||||
|
||||
// Add python executable path:
|
||||
wxGetEnv( wxT( "PATH" ), &ppath );
|
||||
|
||||
if( !ppath.Contains( python_us ) )
|
||||
{
|
||||
kipython << wxT( ";" ) << ppath;
|
||||
wxSetEnv( wxT( "PATH" ), kipython );
|
||||
// DBG( std::cout << "set PATH to " << TO_UTF8( kipython ) << "\n"; )
|
||||
}
|
||||
}
|
||||
kipython << wxT( ";" ) << ppath;
|
||||
wxSetEnv( wxT( "PATH" ), kipython );
|
||||
}
|
||||
|
||||
// TODO: make this path definable by the user, and set more than one path
|
||||
|
||||
@@ -486,6 +486,13 @@ bool ROUTER_TOOL::onViaCommand( TOOL_EVENT& aEvent, VIATYPE_T aType )
|
||||
bool ROUTER_TOOL::prepareInteractive()
|
||||
{
|
||||
int routingLayer = getStartLayer( m_startItem );
|
||||
|
||||
if( !IsCopperLayer( routingLayer ) )
|
||||
{
|
||||
DisplayError( m_frame, _( "Tracks on Copper layers only " ) );
|
||||
return false;
|
||||
}
|
||||
|
||||
m_frame->SetActiveLayer( ToLAYER_ID( routingLayer ) );
|
||||
|
||||
// fixme: switch on invisible layer
|
||||
|
||||
@@ -447,7 +447,10 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
||||
if (g_DumpZonesWhenFilling)
|
||||
dumper->Write( &holes, "feature-holes-postsimplify" );
|
||||
|
||||
solidAreas.BooleanSubtract( holes, true );
|
||||
// Generate the filled areas (currently, without thermal shapes, which will
|
||||
// be created later).
|
||||
// Generate strictly simple polygons needed by Gerber files and Fracture()
|
||||
solidAreas.BooleanSubtract( holes, false );
|
||||
|
||||
if (g_DumpZonesWhenFilling)
|
||||
dumper->Write( &solidAreas, "solid-areas-minus-holes" );
|
||||
@@ -476,8 +479,9 @@ void ZONE_CONTAINER::AddClearanceAreasPolygonsToPolysList_NG( BOARD* aPcb )
|
||||
if( !thermalHoles.IsEmpty() )
|
||||
{
|
||||
thermalHoles.Simplify();
|
||||
// Remove unconnected stubs
|
||||
solidAreas.BooleanSubtract( thermalHoles );
|
||||
// Remove unconnected stubs.
|
||||
// Generate strictly simple polygons needed by Gerber files and Fracture()
|
||||
solidAreas.BooleanSubtract( thermalHoles, false );
|
||||
|
||||
if( g_DumpZonesWhenFilling )
|
||||
dumper->Write( &thermalHoles, "thermal-holes" );
|
||||
|
||||
Reference in New Issue
Block a user