Upstream merge.
This commit is contained in:
commit
537d82fb98
|
@ -40,6 +40,10 @@ option( KICAD_SCRIPTING_WXPYTHON
|
||||||
"set this option ON to build wxpython implementation for wx interface building in python and py.shell"
|
"set this option ON to build wxpython implementation for wx interface building in python and py.shell"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
option( KICAD_BUILD_STATIC
|
||||||
|
"Builds Kicad and all libraries static (except wx-widgets)"
|
||||||
|
)
|
||||||
|
|
||||||
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
|
||||||
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
# PYTHON_EXECUTABLE can be defined when invoking cmake
|
||||||
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
# ( use -DPYTHON_EXECUTABLE=<python path>/python.exe or python2 )
|
||||||
|
@ -75,10 +79,10 @@ mark_as_advanced( KICAD_USER_CONFIG_DIR )
|
||||||
|
|
||||||
|
|
||||||
#================================================
|
#================================================
|
||||||
# Set flags for GCC.
|
# Set flags for GCC, or treat llvm as GCC
|
||||||
#================================================
|
#================================================
|
||||||
|
|
||||||
if( CMAKE_COMPILER_IS_GNUCXX )
|
if( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
|
||||||
execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
execute_process( COMMAND ${CMAKE_C_COMPILER} -dumpversion
|
||||||
OUTPUT_VARIABLE GCC_VERSION
|
OUTPUT_VARIABLE GCC_VERSION
|
||||||
|
@ -110,6 +114,14 @@ if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" )
|
set( CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -DNDEBUG" )
|
||||||
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" )
|
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DNDEBUG" )
|
||||||
|
|
||||||
|
if( GXX_HAS_VISIBILITY_FLAG AND NOT APPLE )
|
||||||
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( GXX_HAS_VISIBILITY_INLINES_FLAG AND NOT APPLE )
|
||||||
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility-inlines-hidden" )
|
||||||
|
endif()
|
||||||
|
|
||||||
if( MINGW )
|
if( MINGW )
|
||||||
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
set( CMAKE_EXE_LINKER_FLAGS_RELEASE "-s" )
|
||||||
|
|
||||||
|
@ -128,8 +140,8 @@ if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
# Disable this response file for includes ( See Windows-GNU.cmake module )
|
# Disable this response file for includes ( See Windows-GNU.cmake module )
|
||||||
if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
|
if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
|
||||||
# fixme: it is needed only with MSYS+MINGW32? or always under MINGW
|
# fixme: it is needed only with MSYS+MINGW32? or always under MINGW
|
||||||
if (${CMAKE_SIZEOF_VOID_P} MATCHES 4)
|
if( ${CMAKE_SIZEOF_VOID_P} MATCHES 4 )
|
||||||
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0)
|
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0 )
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
@ -157,7 +169,12 @@ if( CMAKE_COMPILER_IS_GNUCXX )
|
||||||
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
endif( CMAKE_COMPILER_IS_GNUCXX )
|
if( APPLE )
|
||||||
|
set( CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -D__ASSERTMACROS__" )
|
||||||
|
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D__ASSERTMACROS__" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endif( CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
|
||||||
if( KICAD_KEEPCASE )
|
if( KICAD_KEEPCASE )
|
||||||
add_definitions( -DKICAD_KEEPCASE )
|
add_definitions( -DKICAD_KEEPCASE )
|
||||||
|
@ -242,6 +259,19 @@ include( Functions )
|
||||||
|
|
||||||
include( ExternalProject )
|
include( ExternalProject )
|
||||||
|
|
||||||
|
if ( APPLE )
|
||||||
|
set( KICAD_BUILD_STATIC ON)
|
||||||
|
|
||||||
|
if( NOT CMAKE_CXX_COMPILER )
|
||||||
|
EXEC_PROGRAM( wx-config ARGS --cc OUTPUT_VARIABLE CMAKE_C_COMPILER )
|
||||||
|
endif( NOT CMAKE_CXX_COMPILER )
|
||||||
|
|
||||||
|
if( NOT CMAKE_CXX_COMPILER )
|
||||||
|
EXEC_PROGRAM( wx-config ARGS --cxx OUTPUT_VARIABLE CMAKE_CXX_COMPILER )
|
||||||
|
endif( NOT CMAKE_CXX_COMPILER )
|
||||||
|
|
||||||
|
endif( APPLE )
|
||||||
|
|
||||||
#================================================
|
#================================================
|
||||||
# Find libraries that are needed to build KiCad.
|
# Find libraries that are needed to build KiCad.
|
||||||
#================================================
|
#================================================
|
||||||
|
@ -256,6 +286,23 @@ add_definitions(-DWX_COMPATIBILITY)
|
||||||
find_package( OpenGL QUIET )
|
find_package( OpenGL QUIET )
|
||||||
check_find_package_result( OPENGL_FOUND "OpenGL" )
|
check_find_package_result( OPENGL_FOUND "OpenGL" )
|
||||||
|
|
||||||
|
if ( KICAD_BUILD_STATIC )
|
||||||
|
|
||||||
|
#set(CMAKE_FIND_LIBRARY_SUFFIXES ".a;.so;.dylib;.dll")
|
||||||
|
|
||||||
|
include( download_pkgconfig )
|
||||||
|
set( PKG_CONFIG_EXECUTABLE "${PKGCONFIG_ROOT}/bin/pkg-config")
|
||||||
|
include( download_glew )
|
||||||
|
set( GLEW_GLEW_LIBRARY "${GLEW_ROOT}/lib/libGLEW.a")
|
||||||
|
set( GLEW_INCLUDE_DIR "${GLEW_ROOT}/include")
|
||||||
|
include( download_pixman )
|
||||||
|
set( PIXMAN_LIBRARY "${PIXMAN_ROOT}/lib/libpixman-1.a")
|
||||||
|
include( download_libpng )
|
||||||
|
include( download_cairo )
|
||||||
|
set( CAIRO_INCLUDE_DIR "${CAIRO_ROOT}/include/cairo")
|
||||||
|
set( CAIRO_LIBRARY "${CAIRO_ROOT}/lib/libcairo.a")
|
||||||
|
endif( KICAD_BUILD_STATIC )
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
# Find GLEW library #
|
# Find GLEW library #
|
||||||
#####################
|
#####################
|
||||||
|
@ -272,7 +319,6 @@ check_find_package_result(CAIRO_FOUND "Cairo")
|
||||||
#################################################
|
#################################################
|
||||||
include( download_boost )
|
include( download_boost )
|
||||||
|
|
||||||
|
|
||||||
##########################
|
##########################
|
||||||
# Find wxWidgets library #
|
# Find wxWidgets library #
|
||||||
##########################
|
##########################
|
||||||
|
@ -484,7 +530,7 @@ if( UNIX )
|
||||||
set( UNIX_MIME_DIR resources/linux/mime )
|
set( UNIX_MIME_DIR resources/linux/mime )
|
||||||
set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
|
set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
|
||||||
set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
|
set( UNIX_MIME_FILES ${UNIX_MIME_DIR}/mime )
|
||||||
set( UNIX_ICONS_FILES ${UNIX_MIME_DIR}/icons )
|
set( UNIX_ICON_FILES ${UNIX_MIME_DIR}/icons )
|
||||||
set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
|
set( UNIX_APPLICATIONS_FILES ${UNIX_MIME_DIR}/applications )
|
||||||
|
|
||||||
# Install Mimelnk directory
|
# Install Mimelnk directory
|
||||||
|
@ -494,7 +540,7 @@ if( UNIX )
|
||||||
)
|
)
|
||||||
|
|
||||||
# Install Mime directory
|
# Install Mime directory
|
||||||
install( DIRECTORY ${UNIX_ICONS_FILES}
|
install( DIRECTORY ${UNIX_ICON_FILES}
|
||||||
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
|
||||||
COMPONENT resources
|
COMPONENT resources
|
||||||
)
|
)
|
||||||
|
|
|
@ -30,8 +30,15 @@ macro( create_bzr_version_header )
|
||||||
set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
|
set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
|
||||||
set( ENV{LC_ALL} C )
|
set( ENV{LC_ALL} C )
|
||||||
|
|
||||||
|
# Get the tree revison
|
||||||
execute_process( COMMAND
|
execute_process( COMMAND
|
||||||
${Bazaar_EXECUTABLE} log -r-1 ${PROJECT_SOURCE_DIR}
|
${Bazaar_EXECUTABLE} revno --tree ${PROJECT_SOURCE_DIR}
|
||||||
|
OUTPUT_VARIABLE _bazaar_TREE_DATE
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# Get more info about that revision
|
||||||
|
execute_process( COMMAND
|
||||||
|
${Bazaar_EXECUTABLE} log -r${_bazaar_TREE_DATE} ${PROJECT_SOURCE_DIR}
|
||||||
OUTPUT_VARIABLE _bazaar_LAST_CHANGE_LOG
|
OUTPUT_VARIABLE _bazaar_LAST_CHANGE_LOG
|
||||||
ERROR_VARIABLE _bazaar_log_error
|
ERROR_VARIABLE _bazaar_log_error
|
||||||
RESULT_VARIABLE _bazaar_log_result
|
RESULT_VARIABLE _bazaar_log_result
|
||||||
|
|
|
@ -36,17 +36,21 @@
|
||||||
# Consider it a benchmark when writing your own feature tests.
|
# Consider it a benchmark when writing your own feature tests.
|
||||||
#
|
#
|
||||||
|
|
||||||
macro(perform_feature_checks)
|
macro( perform_feature_checks )
|
||||||
|
|
||||||
include(CheckIncludeFile)
|
include( CheckIncludeFile )
|
||||||
#include(CheckFunctionExists)
|
#include( CheckFunctionExists )
|
||||||
include(CheckLibraryExists)
|
include( CheckLibraryExists )
|
||||||
include(CheckSymbolExists)
|
include( CheckSymbolExists )
|
||||||
include(CheckIncludeFileCXX)
|
include( CheckIncludeFileCXX )
|
||||||
include(CheckCXXSymbolExists)
|
include( CheckCXXSymbolExists )
|
||||||
include(CheckCXXSourceCompiles)
|
include( CheckCXXSourceCompiles )
|
||||||
|
include( CheckCXXCompilerFlag )
|
||||||
|
|
||||||
check_include_file("malloc.h" HAVE_MALLOC_H)
|
check_cxx_compiler_flag( -fvisibility=hidden GXX_HAS_VISIBILITY_FLAG )
|
||||||
|
check_cxx_compiler_flag( -fvisibility-inlines-hidden GXX_HAS_VISIBILITY_INLINES_FLAG )
|
||||||
|
|
||||||
|
check_include_file( "malloc.h" HAVE_MALLOC_H )
|
||||||
|
|
||||||
# FIXME: Visual C++ does not support the "not" keyword natively. It is
|
# FIXME: Visual C++ does not support the "not" keyword natively. It is
|
||||||
# defined as a macro in <iso646.h>. There should be a cmake macro
|
# defined as a macro in <iso646.h>. There should be a cmake macro
|
||||||
|
@ -54,7 +58,7 @@ macro(perform_feature_checks)
|
||||||
# then check for <iso646.h> and include it. Although it doesn't
|
# then check for <iso646.h> and include it. Although it doesn't
|
||||||
# appear to cause any problems with other compilers, that doesn't
|
# appear to cause any problems with other compilers, that doesn't
|
||||||
# mean won't fail somewhere down the line.
|
# mean won't fail somewhere down the line.
|
||||||
check_include_file("iso646.h" HAVE_ISO646_H)
|
check_include_file( "iso646.h" HAVE_ISO646_H )
|
||||||
|
|
||||||
# The STDINT header file test is required because MinGW under Windows
|
# The STDINT header file test is required because MinGW under Windows
|
||||||
# doesn't define HAVE_STDINT_H even though it does have it.
|
# doesn't define HAVE_STDINT_H even though it does have it.
|
||||||
|
@ -62,7 +66,7 @@ macro(perform_feature_checks)
|
||||||
# We need to add it to the global compiler definitions as config.h is not
|
# We need to add it to the global compiler definitions as config.h is not
|
||||||
# included in pyport.h which is where the problem ocurrs without this
|
# included in pyport.h which is where the problem ocurrs without this
|
||||||
# fix.
|
# fix.
|
||||||
check_include_file("stdint.h" HAVE_STDINT_H)
|
check_include_file( "stdint.h" HAVE_STDINT_H )
|
||||||
|
|
||||||
if( HAVE_STDINT_H )
|
if( HAVE_STDINT_H )
|
||||||
add_definitions( -DHAVE_STDINT_H )
|
add_definitions( -DHAVE_STDINT_H )
|
||||||
|
@ -73,40 +77,41 @@ macro(perform_feature_checks)
|
||||||
# re-introduce this.
|
# re-introduce this.
|
||||||
# check_include_file("strings.h" HAVE_STRINGS_H)
|
# check_include_file("strings.h" HAVE_STRINGS_H)
|
||||||
|
|
||||||
check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP)
|
check_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
|
||||||
check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
|
check_symbol_exists( strcasecmp "strings.h" HAVE_STRCASECMP )
|
||||||
check_symbol_exists(strncasecmp "string.h" HAVE_STRNCASECMP)
|
check_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
|
||||||
check_symbol_exists(strncasecmp "strings.h" HAVE_STRNCASECMP)
|
check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
|
||||||
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
|
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
|
||||||
|
|
||||||
# Some platforms define malloc and free in malloc.h instead of stdlib.h.
|
# Some platforms define malloc and free in malloc.h instead of stdlib.h.
|
||||||
check_symbol_exists(malloc "stdlib.h" MALLOC_IN_STDLIB_H)
|
check_symbol_exists( malloc "stdlib.h" MALLOC_IN_STDLIB_H )
|
||||||
|
|
||||||
# Check for functions in math.h.
|
# Check for functions in math.h.
|
||||||
check_include_file("math.h" HAVE_MATH_H)
|
check_include_file( "math.h" HAVE_MATH_H )
|
||||||
|
|
||||||
# Check for functions in C++ cmath.
|
# Check for functions in C++ cmath.
|
||||||
check_include_file_cxx(cmath HAVE_CXX_CMATH)
|
check_include_file_cxx( cmath HAVE_CXX_CMATH )
|
||||||
check_cxx_symbol_exists(asinh cmath HAVE_CMATH_ASINH )
|
check_cxx_symbol_exists( asinh cmath HAVE_CMATH_ASINH )
|
||||||
check_cxx_symbol_exists(acosh cmath HAVE_CMATH_ACOSH )
|
check_cxx_symbol_exists( acosh cmath HAVE_CMATH_ACOSH )
|
||||||
check_cxx_symbol_exists(atanh cmath HAVE_CMATH_ATANH )
|
check_cxx_symbol_exists( atanh cmath HAVE_CMATH_ATANH )
|
||||||
|
|
||||||
# CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a
|
# CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a
|
||||||
# small program to verify isinf() exists in cmath.
|
# small program to verify isinf() exists in cmath.
|
||||||
check_cxx_source_compiles( "#include <cmath>\nint main(int argc, char** argv)\n{\n (void)argv;\n std::isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF )
|
check_cxx_source_compiles( "#include <cmath>\nint main(int argc, char** argv)\n{\n (void)argv;\n std::isinf(1.0); (void)argc;\n return 0;\n}\n" HAVE_CMATH_ISINF )
|
||||||
|
|
||||||
#check_symbol_exists(clock_gettime "time.h" HAVE_CLOCK_GETTIME) non-standard library, does not work
|
#check_symbol_exists( clock_gettime "time.h" HAVE_CLOCK_GETTIME ) non-standard library, does not work
|
||||||
check_library_exists(rt clock_gettime "" HAVE_CLOCK_GETTIME)
|
check_library_exists( rt clock_gettime "" HAVE_CLOCK_GETTIME )
|
||||||
|
|
||||||
# HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC
|
# HAVE_GETTIMEOFDAY is already in use within 2.9 wxWidgets, so use HAVE_GETTIMEOFDAY_FUNC
|
||||||
check_symbol_exists(gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_FUNC)
|
check_symbol_exists( gettimeofday "sys/time.h" HAVE_GETTIMEOFDAY_FUNC )
|
||||||
|
|
||||||
# Check for Posix getc_unlocked() for improved performance over getc(). Fall back to
|
# Check for Posix getc_unlocked() for improved performance over getc(). Fall back to
|
||||||
# getc() on platforms where getc_unlocked() doesn't exist.
|
# getc() on platforms where getc_unlocked() doesn't exist.
|
||||||
check_symbol_exists(getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK)
|
check_symbol_exists( getc_unlocked "stdio.h" HAVE_FGETC_NOLOCK )
|
||||||
|
|
||||||
# Generate config.h.
|
# Generate config.h.
|
||||||
configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
|
||||||
${CMAKE_BINARY_DIR}/config.h)
|
${CMAKE_BINARY_DIR}/config.h
|
||||||
|
)
|
||||||
|
|
||||||
endmacro(perform_feature_checks)
|
endmacro( perform_feature_checks )
|
||||||
|
|
|
@ -40,8 +40,10 @@ set( BOOST_ROOT "${PROJECT_SOURCE_DIR}/boost_root" )
|
||||||
# Space separated list which indicates the subset of boost libraries to compile.
|
# Space separated list which indicates the subset of boost libraries to compile.
|
||||||
# Chosen libraries are based on AVHTTP requirements, and possibly
|
# Chosen libraries are based on AVHTTP requirements, and possibly
|
||||||
# unit_test_framework for its own worth.
|
# unit_test_framework for its own worth.
|
||||||
|
# tool_manager.cpp -> coroutine -> context (_jump_fcontext) (on OSX)
|
||||||
|
|
||||||
set( BOOST_LIBS_BUILT
|
set( BOOST_LIBS_BUILT
|
||||||
#context
|
context
|
||||||
#coroutine
|
#coroutine
|
||||||
date_time
|
date_time
|
||||||
#exception
|
#exception
|
||||||
|
@ -55,7 +57,6 @@ set( BOOST_LIBS_BUILT
|
||||||
thread
|
thread
|
||||||
#unit_test_framework
|
#unit_test_framework
|
||||||
)
|
)
|
||||||
|
|
||||||
#-----</configure>---------------------------------------------------------------
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
find_package( BZip2 REQUIRED )
|
find_package( BZip2 REQUIRED )
|
||||||
|
@ -88,6 +89,16 @@ endfunction()
|
||||||
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
|
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
|
||||||
#message( STATUS "REPLACE libs_csv:${boost_libs_list}" )
|
#message( STATUS "REPLACE libs_csv:${boost_libs_list}" )
|
||||||
|
|
||||||
|
# Default Toolset
|
||||||
|
set( BOOST_TOOLSET "toolset=gcc" )
|
||||||
|
|
||||||
|
if( KICAD_BUILD_STATIC )
|
||||||
|
set( BOOST_LINKTYPE "link=static" )
|
||||||
|
else()
|
||||||
|
unset( BOOST_LINKTYPE )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
if( MINGW )
|
if( MINGW )
|
||||||
if( MSYS )
|
if( MSYS )
|
||||||
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
|
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
|
||||||
|
@ -101,18 +112,62 @@ if( MINGW )
|
||||||
foreach( lib ${boost_libs_list} )
|
foreach( lib ${boost_libs_list} )
|
||||||
set( b2_libs ${b2_libs} --with-${lib} )
|
set( b2_libs ${b2_libs} --with-${lib} )
|
||||||
endforeach()
|
endforeach()
|
||||||
unset( PIC_STUFF )
|
unset( BOOST_CFLAGS )
|
||||||
else()
|
else()
|
||||||
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
|
||||||
#message( STATUS "libs_csv:${libs_csv}" )
|
#message( STATUS "libs_csv:${libs_csv}" )
|
||||||
|
|
||||||
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
|
||||||
# pass to *both* C and C++ compilers
|
# pass to *both* C and C++ compilers
|
||||||
set( PIC_STUFF "cflags=${PIC_FLAG}" )
|
set( BOOST_CFLAGS "cflags=${PIC_FLAG}" )
|
||||||
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
set( BOOST_INCLUDE "${BOOST_ROOT}/include" )
|
||||||
unset( b2_libs )
|
unset( b2_libs )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
if( APPLE )
|
||||||
|
# I set this to being compatible with wxWidgets
|
||||||
|
# wxWidgets still using libstdc++ (gcc), meanwhile OSX
|
||||||
|
# has switched to libc++ (llvm) by default
|
||||||
|
set( BOOST_CXXFLAGS "cxxflags=-mmacosx-version-min=10.5 -fno-common" )
|
||||||
|
set( BOOST_LINKFLAGS "linkflags=-mmacosx-version-min=10.5 -fno-common" )
|
||||||
|
set( BOOST_TOOLSET "toolset=darwin" )
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
set(BOOST_CXXFLAGS "${BOOST_CXXFLAGS} -fno-lto" )
|
||||||
|
set(BOOST_LINKFLAGS "${BOOST_LINKFLAGS} -fno-lto" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
|
||||||
|
if( (CMAKE_OSX_ARCHITECTURES MATCHES "386" OR CMAKE_OSX_ARCHITECTURES MATCHES "ppc ") AND
|
||||||
|
(CMAKE_OSX_ARCHITECTURES MATCHES "64"))
|
||||||
|
message( "-- BOOST found 32/64 Address Model" )
|
||||||
|
|
||||||
|
set( BOOST_ADDRESSMODEL "address-model=32_64" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "386") AND
|
||||||
|
(CMAKE_OSX_ARCHITECTURES MATCHES "ppc"))
|
||||||
|
message("-- BOOST found ppc/x86 Architecture")
|
||||||
|
|
||||||
|
set(BOOST_ARCHITECTURE "architecture=combined")
|
||||||
|
elseif( (CMAKE_OSX_ARCHITECTURES MATCHES "x86_64" OR CMAKE_OSX_ARCHITECTURES MATCHES "386") )
|
||||||
|
message("-- BOOST found x86 Architecture")
|
||||||
|
|
||||||
|
set(BOOST_ARCHITECTURE "architecture=x86")
|
||||||
|
elseif( (CMAKE_OSX_ARCHITECTURES MATCHES "ppc64" OR CMAKE_OSX_ARCHITECTURES MATCHES "ppc") )
|
||||||
|
message("-- BOOST found ppc Architecture")
|
||||||
|
|
||||||
|
set(BOOST_ARCHITECTURE "architecture=ppc")
|
||||||
|
endif()
|
||||||
|
|
||||||
|
set( BOOST_CFLAGS "${BOOST_CFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" )
|
||||||
|
set( BOOST_CXXFLAGS "${BOOST_CXXFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" )
|
||||||
|
set( BOOST_LINKFLAGS "${BOOST_LINKFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" )
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
ExternalProject_Add( boost
|
ExternalProject_Add( boost
|
||||||
PREFIX "${PREFIX}"
|
PREFIX "${PREFIX}"
|
||||||
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
@ -125,10 +180,37 @@ ExternalProject_Add( boost
|
||||||
# fails when applying a patch to the branch twice and doesn't have a switch
|
# fails when applying a patch to the branch twice and doesn't have a switch
|
||||||
# to ignore previously applied patches
|
# to ignore previously applied patches
|
||||||
PATCH_COMMAND bzr revert
|
PATCH_COMMAND bzr revert
|
||||||
# PATCH_COMMAND continuation (any *_COMMAND here can be continued with COMMAND):
|
# bzr revert is insufficient to remove "added" files:
|
||||||
|
COMMAND bzr clean-tree -q --force
|
||||||
|
|
||||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch"
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_minkowski.patch"
|
||||||
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch"
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_cstdint.patch"
|
||||||
|
|
||||||
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||||
|
# tell bzr about "added" files by last patch:
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S
|
||||||
|
|
||||||
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_x86_build.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||||
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_macosx_older_openssl.patch" #https://svn.boost.org/trac/boost/ticket/9273
|
||||||
|
|
||||||
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/boost_mingw.patch" #https://svn.boost.org/trac/boost/ticket/7262
|
||||||
|
# tell bzr about "added" files by last patch:
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_i386_ms_pe_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_i386_ms_pe_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_x86_64_ms_pe_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_x86_64_ms_pe_gas.S
|
||||||
|
|
||||||
|
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/patch_macosx_context_ppc_v2.patch" #https://svn.boost.org/trac/boost/ticket/8266
|
||||||
|
COMMAND bzr add libs/context/build/Jamfile.v2
|
||||||
|
COMMAND bzr add libs/context/build/architecture.jam
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_combined_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_ppc32_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/jump_ppc64_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_combined_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_ppc32_sysv_macho_gas.S
|
||||||
|
COMMAND bzr add libs/context/src/asm/make_ppc64_sysv_macho_gas.S
|
||||||
|
|
||||||
# [Mis-]use this step to erase all the boost headers and libraries before
|
# [Mis-]use this step to erase all the boost headers and libraries before
|
||||||
# replacing them below.
|
# replacing them below.
|
||||||
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
|
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
|
||||||
|
@ -139,10 +221,14 @@ ExternalProject_Add( boost
|
||||||
BUILD_COMMAND ./b2
|
BUILD_COMMAND ./b2
|
||||||
variant=release
|
variant=release
|
||||||
threading=multi
|
threading=multi
|
||||||
toolset=gcc
|
${BOOST_CFLAGS}
|
||||||
${PIC_STUFF}
|
${BOOST_TOOLSET}
|
||||||
|
${BOOST_CXXFLAGS}
|
||||||
|
${BOOST_LINKFLAGS}
|
||||||
|
${BOOST_ADDRESSMODEL}
|
||||||
|
${BOOST_ARCHITECTURE}
|
||||||
${b2_libs}
|
${b2_libs}
|
||||||
#link=static
|
${BOOST_LINKTYPE}
|
||||||
--prefix=<INSTALL_DIR>
|
--prefix=<INSTALL_DIR>
|
||||||
install
|
install
|
||||||
|
|
||||||
|
@ -175,8 +261,8 @@ endif()
|
||||||
set( boost_libs "" )
|
set( boost_libs "" )
|
||||||
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
|
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
|
||||||
|
|
||||||
set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" )
|
set( Boost_LIBRARIES ${boost_libs} )
|
||||||
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
|
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" )
|
||||||
|
|
||||||
mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR )
|
mark_as_advanced( Boost_LIBRARIES Boost_INCLUDE_DIR )
|
||||||
|
|
||||||
|
@ -194,7 +280,7 @@ ExternalProject_Add_Step( boost bzr_commit_boost
|
||||||
|
|
||||||
ExternalProject_Add_Step( boost bzr_add_boost
|
ExternalProject_Add_Step( boost bzr_add_boost
|
||||||
# add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src}
|
# add only the headers to the scratch repo, repo = "../.bzr" from ${headers_src}
|
||||||
COMMAND bzr add -q ${headers_src}
|
COMMAND bzr add -q ${PREFIX}/src/boost
|
||||||
COMMENT "adding pristine boost files to 'boost scratch repo'"
|
COMMENT "adding pristine boost files to 'boost scratch repo'"
|
||||||
DEPENDERS bzr_commit_boost
|
DEPENDERS bzr_commit_boost
|
||||||
)
|
)
|
||||||
|
|
|
@ -0,0 +1,91 @@
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Downloads and builds CAIRO
|
||||||
|
|
||||||
|
#-----<configure>----------------------------------------------------------------
|
||||||
|
|
||||||
|
set( CAIRO_RELEASE 1.12.0 )
|
||||||
|
set( CAIRO_MD5 e6c85575ba7094f88b637bdfd835a751 ) # re-calc this on every RELEASE change
|
||||||
|
|
||||||
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||||
|
# source tree in boost_root.
|
||||||
|
set( CAIRO_ROOT "${PROJECT_SOURCE_DIR}/cairo_root" )
|
||||||
|
|
||||||
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
|
||||||
|
set( PREFIX ${DOWNLOAD_DIR}/cairo )
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
set( CAIRO_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES}" )
|
||||||
|
set( CAIRO_LDFLAGS "LDFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -framework CoreServices -framework Cocoa" )
|
||||||
|
set( CAIRO_OPTS --enable-ft=no )
|
||||||
|
endif( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
|
||||||
|
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
|
||||||
|
set(CAIRO_CFLAGS "${CAIRO_CFLAGS} -fno-lto" )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if( CMAKE_OSX_SYSROOT )
|
||||||
|
#set( CAIRO_CFLAGS "${CAIRO_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
|
||||||
|
set( CAIRO_LDFLAGS "${CAIRO_LDFLAGS} -isysroot ${CMAKE_OSX_SYSROOT}")
|
||||||
|
endif( CMAKE_OSX_SYSROOT)
|
||||||
|
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
|
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||||
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||||
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||||
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||||
|
|
||||||
|
ExternalProject_Add( cairo
|
||||||
|
PREFIX "${PREFIX}"
|
||||||
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
URL http://cairographics.org/releases/cairo-${CAIRO_RELEASE}.tar.gz
|
||||||
|
URL_MD5 ${CAIRO_MD5}
|
||||||
|
STAMP_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
DEPENDS pkgconfig pixman libpng
|
||||||
|
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
#SOURCE_DIR "${PREFIX}"
|
||||||
|
#PATCH_COMMAND ""
|
||||||
|
|
||||||
|
CONFIGURE_COMMAND ./configure --prefix=${CAIRO_ROOT} --enable-static --disable-shared
|
||||||
|
PKG_CONFIG=${PROJECT_SOURCE_DIR}/pkgconfig_root/bin/pkg-config
|
||||||
|
PKG_CONFIG_PATH=${PROJECT_SOURCE_DIR}/pixman_root/lib/pkgconfig:${PROJECT_SOURCE_DIR}/libpng_root/lib/pkgconfig
|
||||||
|
--enable-png=yes --enable-svg=yes
|
||||||
|
--disable-silent-rules --disable-dependency-tracking
|
||||||
|
${CAIRO_CFLAGS}
|
||||||
|
${CAIRO_LDFLAGS}
|
||||||
|
${CAIRO_OPTS}
|
||||||
|
|
||||||
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
BUILD_COMMAND make
|
||||||
|
|
||||||
|
INSTALL_DIR "${CAIRO_ROOT}"
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
)
|
|
@ -0,0 +1,72 @@
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Downloads and builds GLEW
|
||||||
|
|
||||||
|
#-----<configure>----------------------------------------------------------------
|
||||||
|
|
||||||
|
set( GLEW_RELEASE 1.10.0 )
|
||||||
|
set( GLEW_MD5 2f09e5e6cb1b9f3611bcac79bc9c2d5d ) # re-calc this on every RELEASE change
|
||||||
|
|
||||||
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||||
|
# source tree in boost_root.
|
||||||
|
set( GLEW_ROOT "${PROJECT_SOURCE_DIR}/glew_root" )
|
||||||
|
|
||||||
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
|
||||||
|
set( PREFIX ${DOWNLOAD_DIR}/glew )
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
set( GLEW_CFLAGS "CFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||||
|
set( GLEW_LDFLAGS "LDFLAGS.EXTRA=-arch ${CMAKE_OSX_ARCHITECTURES} -mmacosx-version-min=10.5" )
|
||||||
|
set( GLEW_STRIP "STRIP=")
|
||||||
|
endif( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
|
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||||
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||||
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||||
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||||
|
|
||||||
|
ExternalProject_Add( glew
|
||||||
|
PREFIX "${PREFIX}"
|
||||||
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
URL http://sourceforge.net/projects/glew/files/glew/1.10.0/glew-${GLEW_RELEASE}.tgz
|
||||||
|
URL_MD5 ${GLEW_MD5}
|
||||||
|
STAMP_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
#SOURCE_DIR "${PREFIX}"
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
|
||||||
|
#PATCH_COMMAND "true"
|
||||||
|
CONFIGURE_COMMAND ""
|
||||||
|
|
||||||
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
BUILD_COMMAND make ${GLEW_CFLAGS} ${GLEW_LDFLAGS} ${GLEW_STRIP}
|
||||||
|
|
||||||
|
INSTALL_DIR "${GLEW_ROOT}"
|
||||||
|
INSTALL_COMMAND make GLEW_DEST="${GLEW_ROOT}" install && ranlib "${GLEW_ROOT}/lib/libGLEW.a"
|
||||||
|
)
|
|
@ -0,0 +1,69 @@
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Downloads and builds LIBPNG
|
||||||
|
|
||||||
|
#-----<configure>----------------------------------------------------------------
|
||||||
|
|
||||||
|
set( LIBPNG_RELEASE 1.4.12 )
|
||||||
|
set( LIBPNG_MD5 849b14d88e1240a1b9f2cb39dd39701e ) # re-calc this on every RELEASE change
|
||||||
|
|
||||||
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||||
|
# source tree in boost_root.
|
||||||
|
set( LIBPNG_ROOT "${PROJECT_SOURCE_DIR}/libpng_root" )
|
||||||
|
|
||||||
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
|
||||||
|
set( PREFIX ${DOWNLOAD_DIR}/libpng )
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
SET( LIBPNG_CFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES}")
|
||||||
|
endif( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
|
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||||
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||||
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||||
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||||
|
|
||||||
|
ExternalProject_Add( libpng
|
||||||
|
PREFIX "${PREFIX}"
|
||||||
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
URL http://sourceforge.net/projects/libpng/files/libpng14/${LIBPNG_RELEASE}/libpng-${LIBPNG_RELEASE}.tar.bz2
|
||||||
|
URL_MD5 ${LIBPNG_MD5}
|
||||||
|
STAMP_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
#SOURCE_DIR "${PREFIX}"
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
|
||||||
|
#PATCH_COMMAND "true"
|
||||||
|
CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} --enable-static --disable-shared ${LIBPNG_CFLAGS} --disable-dependency-tracking
|
||||||
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
BUILD_COMMAND make
|
||||||
|
|
||||||
|
INSTALL_DIR "${LIBPNG_ROOT}"
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
)
|
|
@ -0,0 +1,69 @@
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Downloads and builds PIXMAN
|
||||||
|
|
||||||
|
#-----<configure>----------------------------------------------------------------
|
||||||
|
|
||||||
|
set( PIXMAN_RELEASE 0.32.4 )
|
||||||
|
set( PIXMAN_MD5 eba449138b972fbf4547a8c152fea162 ) # re-calc this on every RELEASE change
|
||||||
|
|
||||||
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||||
|
# source tree in boost_root.
|
||||||
|
set( PIXMAN_ROOT "${PROJECT_SOURCE_DIR}/pixman_root" )
|
||||||
|
|
||||||
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
|
||||||
|
set( PREFIX ${DOWNLOAD_DIR}/pixman )
|
||||||
|
|
||||||
|
if (APPLE)
|
||||||
|
if( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
set(PIXMAN_CPPFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
|
||||||
|
endif( CMAKE_OSX_ARCHITECTURES )
|
||||||
|
endif(APPLE)
|
||||||
|
|
||||||
|
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||||
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||||
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||||
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||||
|
|
||||||
|
ExternalProject_Add( pixman
|
||||||
|
PREFIX "${PREFIX}"
|
||||||
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
URL http://cairographics.org/releases/pixman-${PIXMAN_RELEASE}.tar.gz
|
||||||
|
URL_MD5 ${PIXMAN_MD5}
|
||||||
|
STAMP_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
#SOURCE_DIR "${PREFIX}"
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
|
||||||
|
#PATCH_COMMAND "true"
|
||||||
|
CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} --enable-static=yes --enable-shared=no ${PIXMAN_CPPFLAGS} --disable-dependency-tracking
|
||||||
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
BUILD_COMMAND make
|
||||||
|
|
||||||
|
INSTALL_DIR "${PIXMAN_ROOT}"
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
)
|
|
@ -0,0 +1,63 @@
|
||||||
|
# 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 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
|
||||||
|
|
||||||
|
# Downloads and builds CAIRO
|
||||||
|
|
||||||
|
#-----<configure>----------------------------------------------------------------
|
||||||
|
|
||||||
|
set( PKGCONFIG_RELEASE 0.28 )
|
||||||
|
set( PKGCONFIG_MD5 aa3c86e67551adc3ac865160e34a2a0d ) # re-calc this on every RELEASE change
|
||||||
|
|
||||||
|
# The boost headers [and static libs if built] go here, at the top of KiCad
|
||||||
|
# source tree in boost_root.
|
||||||
|
set( PKGCONFIG_ROOT "${PROJECT_SOURCE_DIR}/pkgconfig_root" )
|
||||||
|
|
||||||
|
#-----</configure>---------------------------------------------------------------
|
||||||
|
|
||||||
|
find_package( BZip2 REQUIRED )
|
||||||
|
|
||||||
|
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
|
||||||
|
|
||||||
|
# <SOURCE_DIR> = ${PREFIX}/src/glew
|
||||||
|
# There is a Bazaar 'boost scratch repo' in <SOURCE_DIR>/boost and after committing pristine
|
||||||
|
# download, the patch is applied. This lets you regenerate a new patch at any time
|
||||||
|
# easily, simply by editing the working tree in <SOURCE_DIR> and doing "bzr diff" in there.
|
||||||
|
|
||||||
|
ExternalProject_Add( pkgconfig
|
||||||
|
PREFIX "${PREFIX}"
|
||||||
|
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
|
||||||
|
URL http://pkgconfig.freedesktop.org/releases/pkg-config-${PKGCONFIG_RELEASE}.tar.gz
|
||||||
|
URL_MD5 ${PKGCONFIG_MD5}
|
||||||
|
STAMP_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
#SOURCE_DIR "${PREFIX}"
|
||||||
|
BUILD_IN_SOURCE 1
|
||||||
|
|
||||||
|
#PATCH_COMMAND "true"
|
||||||
|
CONFIGURE_COMMAND ./configure --prefix=${PKGCONFIG_ROOT} --with-internal-glib --enable-shared=no --enable-static=yes --disable-silent-rules
|
||||||
|
#BINARY_DIR "${PREFIX}"
|
||||||
|
|
||||||
|
BUILD_COMMAND make
|
||||||
|
|
||||||
|
INSTALL_DIR "${PKGCONFIG_ROOT}"
|
||||||
|
INSTALL_COMMAND make install
|
||||||
|
)
|
1
TODO.txt
1
TODO.txt
|
@ -62,7 +62,6 @@ PCBNew
|
||||||
|
|
||||||
Dick's Final TODO List:
|
Dick's Final TODO List:
|
||||||
======================
|
======================
|
||||||
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
|
|
||||||
*) Get licensing cleaned up.
|
*) Get licensing cleaned up.
|
||||||
*) Re-arrange the repo architecture.
|
*) Re-arrange the repo architecture.
|
||||||
*) DLL-ization of pcbnew & eeschema
|
*) DLL-ization of pcbnew & eeschema
|
||||||
|
|
|
@ -34,5 +34,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
include_directories( BEFORE ${INC_BEFORE} )
|
||||||
include_directories(BEFORE ${INC_BEFORE})
|
|
||||||
include_directories(
|
include_directories(
|
||||||
./dialogs
|
./dialogs
|
||||||
./dialog_about
|
./dialog_about
|
||||||
|
@ -37,6 +36,7 @@ set(GAL_SRCS
|
||||||
gal/stroke_font.cpp
|
gal/stroke_font.cpp
|
||||||
gal/color4d.cpp
|
gal/color4d.cpp
|
||||||
view/wx_view_controls.cpp
|
view/wx_view_controls.cpp
|
||||||
|
geometry/hetriang.cpp
|
||||||
|
|
||||||
# OpenGL GAL
|
# OpenGL GAL
|
||||||
gal/opengl/opengl_gal.cpp
|
gal/opengl/opengl_gal.cpp
|
||||||
|
@ -62,7 +62,7 @@ if(WIN32 AND MSYS)
|
||||||
add_definitions(-DGLEW_STATIC)
|
add_definitions(-DGLEW_STATIC)
|
||||||
endif(WIN32 AND MSYS)
|
endif(WIN32 AND MSYS)
|
||||||
|
|
||||||
set(COMMON_ABOUT_DLG_SRCS
|
set( COMMON_ABOUT_DLG_SRCS
|
||||||
dialog_about/AboutDialog_main.cpp
|
dialog_about/AboutDialog_main.cpp
|
||||||
dialog_about/dialog_about.cpp
|
dialog_about/dialog_about.cpp
|
||||||
dialog_about/dialog_about_base.cpp
|
dialog_about/dialog_about_base.cpp
|
||||||
|
@ -78,7 +78,7 @@ set(COMMON_ABOUT_DLG_SRCS
|
||||||
dialogs/dialog_page_settings_base.cpp
|
dialogs/dialog_page_settings_base.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(COMMON_PAGE_LAYOUT_SRCS
|
set( COMMON_PAGE_LAYOUT_SRCS
|
||||||
page_layout/title_block_shapes.cpp
|
page_layout/title_block_shapes.cpp
|
||||||
page_layout/class_worksheet_dataitem.cpp
|
page_layout/class_worksheet_dataitem.cpp
|
||||||
page_layout/class_worksheet_layout.cpp
|
page_layout/class_worksheet_layout.cpp
|
||||||
|
@ -88,7 +88,7 @@ set(COMMON_PAGE_LAYOUT_SRCS
|
||||||
page_layout/page_layout_reader.cpp
|
page_layout/page_layout_reader.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(COMMON_SRCS
|
set( COMMON_SRCS
|
||||||
${COMMON_ABOUT_DLG_SRCS}
|
${COMMON_ABOUT_DLG_SRCS}
|
||||||
${COMMON_PAGE_LAYOUT_SRCS}
|
${COMMON_PAGE_LAYOUT_SRCS}
|
||||||
base_struct.cpp
|
base_struct.cpp
|
||||||
|
@ -153,17 +153,14 @@ if( NOT HAVE_STRTOKR )
|
||||||
set( COMMON_SRCS ${COMMON_SRCS} strtok_r.c )
|
set( COMMON_SRCS ${COMMON_SRCS} strtok_r.c )
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
enable_language(C CXX ASM)
|
|
||||||
set_source_files_properties(system/fcontext.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp")
|
|
||||||
|
|
||||||
set(COMMON_SRCS
|
set( COMMON_SRCS
|
||||||
${COMMON_SRCS}
|
${COMMON_SRCS}
|
||||||
view/view.cpp
|
view/view.cpp
|
||||||
view/view_item.cpp
|
view/view_item.cpp
|
||||||
view/view_group.cpp
|
view/view_group.cpp
|
||||||
|
|
||||||
math/math_util.cpp
|
math/math_util.cpp
|
||||||
system/fcontext.s
|
|
||||||
|
|
||||||
tool/tool_base.cpp
|
tool/tool_base.cpp
|
||||||
tool/tool_manager.cpp
|
tool/tool_manager.cpp
|
||||||
|
@ -179,9 +176,20 @@ set(COMMON_SRCS
|
||||||
geometry/shape_index.cpp
|
geometry/shape_index.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(common STATIC ${COMMON_SRCS})
|
|
||||||
|
|
||||||
set(PCB_COMMON_SRCS
|
# TODO: remove this whole "if test" on or after 14-Jan-2014 and remove the system/*.s
|
||||||
|
# sources if no one complains by then.
|
||||||
|
# boost::context library replaces this functionality:
|
||||||
|
if( false )
|
||||||
|
enable_language( C CXX ASM )
|
||||||
|
set_source_files_properties( system/fcontext.s PROPERTIES COMPILE_FLAGS "-x assembler-with-cpp" )
|
||||||
|
list( APPEND COMMON_SRCS system/fcontext.s )
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
add_library( common STATIC ${COMMON_SRCS} )
|
||||||
|
|
||||||
|
set( PCB_COMMON_SRCS
|
||||||
base_screen.cpp
|
base_screen.cpp
|
||||||
eda_text.cpp
|
eda_text.cpp
|
||||||
class_page_info.cpp
|
class_page_info.cpp
|
||||||
|
@ -235,7 +243,7 @@ set(PCB_COMMON_SRCS
|
||||||
fp_lib_table.cpp
|
fp_lib_table.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
set(PCB_COMMON_SRCS
|
set( PCB_COMMON_SRCS
|
||||||
${PCB_COMMON_SRCS}
|
${PCB_COMMON_SRCS}
|
||||||
../pcbnew/pcb_painter.cpp
|
../pcbnew/pcb_painter.cpp
|
||||||
)
|
)
|
||||||
|
@ -245,7 +253,7 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
|
||||||
COMPILE_DEFINITIONS "PCBNEW"
|
COMPILE_DEFINITIONS "PCBNEW"
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(pcbcommon STATIC ${PCB_COMMON_SRCS})
|
add_library( pcbcommon STATIC ${PCB_COMMON_SRCS} )
|
||||||
|
|
||||||
# auto-generate specctra_lexer.h and specctra_keywords.cpp
|
# auto-generate specctra_lexer.h and specctra_keywords.cpp
|
||||||
make_lexer(
|
make_lexer(
|
||||||
|
|
|
@ -221,6 +221,7 @@ void EDA_BASE_FRAME::LoadSettings()
|
||||||
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
|
// Once this is fully implemented, wxAuiManager will be used to maintain the persistance of
|
||||||
// the main frame and all it's managed windows and all of the legacy frame persistence
|
// the main frame and all it's managed windows and all of the legacy frame persistence
|
||||||
// position code can be removed.
|
// position code can be removed.
|
||||||
|
if( config )
|
||||||
config->Read( m_FrameName + entryPerspective, &m_perspective );
|
config->Read( m_FrameName + entryPerspective, &m_perspective );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -386,7 +386,7 @@ void DXF_PLOTTER::ThickSegment( const wxPoint& aStart, const wxPoint& aEnd, int
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Plot an arc in DXF format
|
/* Plot an arc in DXF format
|
||||||
* Filling is not supported
|
* Filling is not supported
|
||||||
*/
|
*/
|
||||||
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
|
void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, int radius,
|
||||||
|
@ -397,6 +397,14 @@ void DXF_PLOTTER::Arc( const wxPoint& centre, double StAngle, double EndAngle, i
|
||||||
if( radius <= 0 )
|
if( radius <= 0 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// In DXF, arcs are drawn CCW.
|
||||||
|
// In Kicad, arcs are CW or CCW
|
||||||
|
// If StAngle > EndAngle, it is CW. So transform it to CCW
|
||||||
|
if( StAngle > EndAngle )
|
||||||
|
{
|
||||||
|
EXCHG( StAngle, EndAngle );
|
||||||
|
}
|
||||||
|
|
||||||
DPOINT centre_dev = userToDeviceCoordinates( centre );
|
DPOINT centre_dev = userToDeviceCoordinates( centre );
|
||||||
double radius_dev = userToDeviceSize( radius );
|
double radius_dev = userToDeviceSize( radius );
|
||||||
|
|
||||||
|
@ -425,6 +433,7 @@ void DXF_PLOTTER::FlashPadOval( const wxPoint& pos, const wxSize& aSize, double
|
||||||
EXCHG( size.x, size.y );
|
EXCHG( size.x, size.y );
|
||||||
orient = AddAngles( orient, 900 );
|
orient = AddAngles( orient, 900 );
|
||||||
}
|
}
|
||||||
|
|
||||||
sketchOval( pos, size, orient, -1 );
|
sketchOval( pos, size, orient, -1 );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -133,7 +133,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
|
||||||
text->GetSize(),
|
text->GetSize(),
|
||||||
text->GetHorizJustify(), text->GetVertJustify(),
|
text->GetHorizJustify(), text->GetVertJustify(),
|
||||||
text->GetPenWidth(),
|
text->GetPenWidth(),
|
||||||
text->IsItalic(), text->IsBold() );
|
text->IsItalic(), text->IsBold(),
|
||||||
|
text->IsMultilineAllowed() );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -87,13 +87,13 @@ void DHEAD::append( EDA_ITEM* aNewElement )
|
||||||
|
|
||||||
void DHEAD::append( DHEAD& aList )
|
void DHEAD::append( DHEAD& aList )
|
||||||
{
|
{
|
||||||
wxCHECK_RET( aList.GetCount() != 0, wxT( "Attempt to append empty list." ) );
|
if( aList.first )
|
||||||
|
{
|
||||||
// Change the item's list to me.
|
// Change the item's list to me.
|
||||||
for( EDA_ITEM* item = aList.first; item != NULL; item = item->Next() )
|
for( EDA_ITEM* item = aList.first; item; item = item->Next() )
|
||||||
item->SetList( this );
|
item->SetList( this );
|
||||||
|
|
||||||
if( first ) // list is not empty, set last item's next to the first item in aList
|
if( first ) // this list is not empty, set last item's next to the first item in aList
|
||||||
{
|
{
|
||||||
wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) );
|
wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) );
|
||||||
|
|
||||||
|
@ -101,7 +101,7 @@ void DHEAD::append( DHEAD& aList )
|
||||||
aList.first->SetBack( last );
|
aList.first->SetBack( last );
|
||||||
last = aList.last;
|
last = aList.last;
|
||||||
}
|
}
|
||||||
else // list is empty, first and last are same as aList
|
else // this list is empty, first and last are same as aList
|
||||||
{
|
{
|
||||||
first = aList.first;
|
first = aList.first;
|
||||||
last = aList.last;
|
last = aList.last;
|
||||||
|
@ -112,6 +112,7 @@ void DHEAD::append( DHEAD& aList )
|
||||||
aList.count = 0;
|
aList.count = 0;
|
||||||
aList.first = NULL;
|
aList.first = NULL;
|
||||||
aList.last = NULL;
|
aList.last = NULL;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -228,10 +228,10 @@ void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
|
||||||
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
|
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
SetGridVisibility( !IsGridVisible() );
|
SetGridVisibility( !IsGridVisible() );
|
||||||
if( m_galCanvasActive )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
m_galCanvas->GetGAL()->SetGridVisibility( IsGridVisible() );
|
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
|
||||||
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
@ -387,11 +387,11 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
|
||||||
screen->SetGrid( id );
|
screen->SetGrid( id );
|
||||||
SetCrossHairPosition( RefPos( true ) );
|
SetCrossHairPosition( RefPos( true ) );
|
||||||
|
|
||||||
if( m_galCanvasActive )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
m_galCanvas->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
|
GetGalCanvas()->GetGAL()->SetGridSize( VECTOR2D( screen->GetGrid().m_Size.x,
|
||||||
screen->GetGrid().m_Size.y ) );
|
screen->GetGrid().m_Size.y ) );
|
||||||
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
|
@ -422,17 +422,17 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
|
||||||
|
|
||||||
GetScreen()->SetZoom( selectedZoom );
|
GetScreen()->SetZoom( selectedZoom );
|
||||||
|
|
||||||
if( m_galCanvasActive )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
// Apply computed view settings to GAL
|
// Apply computed view settings to GAL
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
KIGFX::GAL* gal = m_galCanvas->GetGAL();
|
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||||
|
|
||||||
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
||||||
double zoom = 1.0 / ( zoomFactor * GetZoom() );
|
double zoom = 1.0 / ( zoomFactor * GetZoom() );
|
||||||
|
|
||||||
view->SetScale( zoom );
|
view->SetScale( zoom );
|
||||||
m_galCanvas->Refresh();
|
GetGalCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
RedrawScreen( GetScrollCenterPosition(), false );
|
RedrawScreen( GetScrollCenterPosition(), false );
|
||||||
|
@ -636,7 +636,7 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList )
|
void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList )
|
||||||
{
|
{
|
||||||
if( m_messagePanel == NULL && !aList.empty() )
|
if( m_messagePanel == NULL )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
ClearMsgPanel();
|
ClearMsgPanel();
|
||||||
|
@ -954,8 +954,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
|
||||||
|
|
||||||
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
{
|
{
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
KIGFX::GAL* gal = m_galCanvas->GetGAL();
|
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||||
|
|
||||||
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
||||||
|
|
||||||
|
@ -965,7 +965,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
BASE_SCREEN* screen = GetScreen();
|
BASE_SCREEN* screen = GetScreen();
|
||||||
|
|
||||||
// Switch to GAL rendering
|
// Switch to GAL rendering
|
||||||
if( !m_galCanvasActive )
|
if( !IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
// Set up viewport
|
// Set up viewport
|
||||||
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
|
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
|
||||||
|
@ -981,7 +981,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Switch to standard rendering
|
// Switch to standard rendering
|
||||||
if( m_galCanvasActive )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
// Change view settings only if GAL was active previously
|
// Change view settings only if GAL was active previously
|
||||||
double zoom = 1.0 / ( zoomFactor * view->GetScale() );
|
double zoom = 1.0 / ( zoomFactor * view->GetScale() );
|
||||||
|
@ -993,17 +993,17 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
|
||||||
}
|
}
|
||||||
|
|
||||||
m_canvas->SetEvtHandlerEnabled( !aEnable );
|
m_canvas->SetEvtHandlerEnabled( !aEnable );
|
||||||
m_galCanvas->SetEvtHandlerEnabled( aEnable );
|
GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
|
||||||
|
|
||||||
// Switch panes
|
// Switch panes
|
||||||
m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
|
m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
|
||||||
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
|
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
|
||||||
m_auimgr.Update();
|
m_auimgr.Update();
|
||||||
|
|
||||||
m_galCanvasActive = aEnable;
|
SetGalCanvasActive( aEnable );
|
||||||
|
|
||||||
if( aEnable )
|
if( aEnable )
|
||||||
m_galCanvas->SetFocus();
|
GetGalCanvas()->SetFocus();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
//-----< BASE_SCREEN API moved here >--------------------------------------------
|
||||||
|
|
|
@ -602,6 +602,7 @@ void DrawGraphicHaloText( EDA_RECT* aClipBox, wxDC * aDC,
|
||||||
* Use a value min(aSize.x, aSize.y) / 5 for a bold text
|
* Use a value min(aSize.x, aSize.y) / 5 for a bold text
|
||||||
* @param aItalic = true to simulate an italic font
|
* @param aItalic = true to simulate an italic font
|
||||||
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
|
* @param aBold = true to use a bold font Useful only with default width value (aWidth = 0)
|
||||||
|
* @param aMultilineAllowed = true to plot text as multiline, otherwise single line
|
||||||
*/
|
*/
|
||||||
void PLOTTER::Text( const wxPoint& aPos,
|
void PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_COLOR_T aColor,
|
enum EDA_COLOR_T aColor,
|
||||||
|
@ -612,7 +613,8 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold )
|
bool aBold,
|
||||||
|
bool aMultilineAllowed )
|
||||||
{
|
{
|
||||||
int textPensize = aWidth;
|
int textPensize = aWidth;
|
||||||
|
|
||||||
|
@ -630,6 +632,42 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
if( aColor >= 0 )
|
if( aColor >= 0 )
|
||||||
SetColor( aColor );
|
SetColor( aColor );
|
||||||
|
|
||||||
|
if( aMultilineAllowed )
|
||||||
|
{
|
||||||
|
// EDA_TEXT needs for calculations of the position of every
|
||||||
|
// line according to orientation and justifications
|
||||||
|
EDA_TEXT* multilineText = new EDA_TEXT( aText );
|
||||||
|
multilineText->SetSize( aSize );
|
||||||
|
multilineText->SetTextPosition( aPos );
|
||||||
|
multilineText->SetOrientation( aOrient );
|
||||||
|
multilineText->SetHorizJustify( aH_justify );
|
||||||
|
multilineText->SetVertJustify( aV_justify );
|
||||||
|
multilineText->SetThickness( aWidth );
|
||||||
|
multilineText->SetMultilineAllowed( aMultilineAllowed );
|
||||||
|
|
||||||
|
std::vector<wxPoint> positions;
|
||||||
|
wxArrayString* list = wxStringSplit( aText, '\n' );
|
||||||
|
positions.reserve( list->Count() );
|
||||||
|
|
||||||
|
multilineText->GetPositionsOfLinesOfMultilineText(
|
||||||
|
positions, list->Count() );
|
||||||
|
|
||||||
|
for( unsigned ii = 0; ii < list->Count(); ii++ )
|
||||||
|
{
|
||||||
|
wxString& txt = list->Item( ii );
|
||||||
|
DrawGraphicText( NULL, NULL, positions[ii], aColor, txt,
|
||||||
|
aOrient, aSize,
|
||||||
|
aH_justify, aV_justify,
|
||||||
|
textPensize, aItalic,
|
||||||
|
aBold,
|
||||||
|
NULL,
|
||||||
|
this );
|
||||||
|
}
|
||||||
|
delete multilineText;
|
||||||
|
delete list;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
|
||||||
aOrient, aSize,
|
aOrient, aSize,
|
||||||
aH_justify, aV_justify,
|
aH_justify, aV_justify,
|
||||||
|
@ -637,6 +675,7 @@ void PLOTTER::Text( const wxPoint& aPos,
|
||||||
aBold,
|
aBold,
|
||||||
NULL,
|
NULL,
|
||||||
this );
|
this );
|
||||||
|
}
|
||||||
|
|
||||||
if( aWidth != textPensize )
|
if( aWidth != textPensize )
|
||||||
SetCurrentLineWidth( aWidth );
|
SetCurrentLineWidth( aWidth );
|
||||||
|
|
|
@ -295,7 +295,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
|
||||||
|
|
||||||
|
|
||||||
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
void EDA_TEXT::GetPositionsOfLinesOfMultilineText(
|
||||||
std::vector<wxPoint>& aPositions, int aLineCount )
|
std::vector<wxPoint>& aPositions, int aLineCount ) const
|
||||||
{
|
{
|
||||||
wxPoint pos = m_Pos; // Position of first line of the
|
wxPoint pos = m_Pos; // Position of first line of the
|
||||||
// multiline text according to
|
// multiline text according to
|
||||||
|
|
|
@ -61,27 +61,22 @@ static const wxChar* CommonConfigPath = wxT( "kicad_common" );
|
||||||
# define TMP_FILE "/tmp/kicad.tmp"
|
# define TMP_FILE "/tmp/kicad.tmp"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Just add new languages to the list. This macro will properly recalculate
|
|
||||||
* the size of the array. */
|
|
||||||
#define LANGUAGE_DESCR_COUNT ( sizeof( s_Language_List ) / sizeof( struct LANGUAGE_DESCR ) )
|
|
||||||
|
|
||||||
|
|
||||||
// some key strings used to store parameters in config
|
// some key strings used to store parameters in config
|
||||||
static wxString backgroundColorKey( wxT( "BackgroundColor" ) );
|
static const wxChar backgroundColorKey[] = wxT( "BackgroundColor" );
|
||||||
static wxString showPageLimitsKey( wxT( "ShowPageLimits" ) );
|
static const wxChar showPageLimitsKey[] = wxT( "ShowPageLimits" );
|
||||||
static wxString workingDirKey( wxT( "WorkingDir" ) ) ;
|
static const wxChar workingDirKey[] = wxT( "WorkingDir" );
|
||||||
static wxString languageCfgKey( wxT( "LanguageID" ) );
|
static const wxChar languageCfgKey[] = wxT( "LanguageID" );
|
||||||
static wxString kicadFpLibPath( wxT( "KicadFootprintLibraryPath" ) );
|
static const wxChar kicadFpLibPath[] = wxT( "KicadFootprintLibraryPath" );
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A small class to handle the list on existing translations.
|
* A small class to handle the list of existing translations.
|
||||||
* the locale translation is automatic.
|
* The locale translation is automatic.
|
||||||
* the selection of languages is mainly for maintainer's convenience
|
* The selection of languages is mainly for maintainer's convenience
|
||||||
* To add a support to a new translation:
|
* To add a support to a new translation:
|
||||||
* create a new icon (flag of the country) (see Lang_Fr.xpm as an example)
|
* create a new icon (flag of the country) (see Lang_Fr.xpm as an example)
|
||||||
* add a new item to s_Language_List[LANGUAGE_DESCR_COUNT]
|
* add a new item to s_Languages[].
|
||||||
* and set LANGUAGE_DESCR_COUNT to the new value
|
|
||||||
*/
|
*/
|
||||||
struct LANGUAGE_DESCR
|
struct LANGUAGE_DESCR
|
||||||
{
|
{
|
||||||
|
@ -103,12 +98,12 @@ struct LANGUAGE_DESCR
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Language list struct
|
* Variable s_Languages
|
||||||
* Note: because this list is not created on the fly, wxTranslation
|
* Note: because this list is not created on the fly, wxTranslation
|
||||||
* must be called when a language name must be displayed after translation.
|
* must be called when a language name must be displayed after translation.
|
||||||
* Do don change this behavior, because m_Lang_Label is also used as key in config
|
* Do not change this behavior, because m_Lang_Label is also used as key in config
|
||||||
*/
|
*/
|
||||||
static struct LANGUAGE_DESCR s_Language_List[] =
|
static LANGUAGE_DESCR s_Languages[] =
|
||||||
{
|
{
|
||||||
// Default language
|
// Default language
|
||||||
{
|
{
|
||||||
|
@ -262,6 +257,7 @@ static struct LANGUAGE_DESCR s_Language_List[] =
|
||||||
lang_jp_xpm,
|
lang_jp_xpm,
|
||||||
_( "Japanese" )
|
_( "Japanese" )
|
||||||
},
|
},
|
||||||
|
|
||||||
// Bulgarian language
|
// Bulgarian language
|
||||||
{
|
{
|
||||||
wxLANGUAGE_BULGARIAN,
|
wxLANGUAGE_BULGARIAN,
|
||||||
|
@ -290,28 +286,17 @@ EDA_APP::~EDA_APP()
|
||||||
SaveSettings();
|
SaveSettings();
|
||||||
|
|
||||||
// delete user datas
|
// delete user datas
|
||||||
if( m_projectSettings )
|
|
||||||
delete m_projectSettings;
|
delete m_projectSettings;
|
||||||
|
|
||||||
if( m_commonSettings )
|
|
||||||
delete m_commonSettings;
|
delete m_commonSettings;
|
||||||
|
|
||||||
delete m_settings;
|
delete m_settings;
|
||||||
|
|
||||||
if( m_Checker )
|
|
||||||
delete m_Checker;
|
delete m_Checker;
|
||||||
|
|
||||||
if( m_oneInstancePerFileChecker )
|
|
||||||
delete m_oneInstancePerFileChecker;
|
delete m_oneInstancePerFileChecker;
|
||||||
|
|
||||||
delete m_Locale;
|
delete m_Locale;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
{
|
{
|
||||||
wxString EnvLang;
|
|
||||||
|
|
||||||
m_Id = aId;
|
m_Id = aId;
|
||||||
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() );
|
m_Checker = new wxSingleInstanceChecker( aName.Lower() + wxT( "-" ) + wxGetUserId() );
|
||||||
|
|
||||||
|
@ -342,8 +327,11 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
SetVendorName( wxT( "KiCad" ) );
|
SetVendorName( wxT( "KiCad" ) );
|
||||||
SetAppName( aName.Lower() );
|
SetAppName( aName.Lower() );
|
||||||
SetTitle( aName );
|
SetTitle( aName );
|
||||||
|
|
||||||
m_settings = new wxConfig();
|
m_settings = new wxConfig();
|
||||||
|
|
||||||
wxASSERT( m_settings != NULL );
|
wxASSERT( m_settings != NULL );
|
||||||
|
|
||||||
m_commonSettings = new wxConfig( CommonConfigPath );
|
m_commonSettings = new wxConfig( CommonConfigPath );
|
||||||
wxASSERT( m_commonSettings != NULL );
|
wxASSERT( m_commonSettings != NULL );
|
||||||
|
|
||||||
|
@ -365,11 +353,11 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||||
|
|
||||||
// Search for the current selection
|
// Search for the current selection
|
||||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
if( s_Language_List[ii].m_Lang_Label == languageSel )
|
if( s_Languages[ii].m_Lang_Label == languageSel )
|
||||||
{
|
{
|
||||||
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
|
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -387,7 +375,6 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
|
||||||
|
|
||||||
void EDA_APP::SetHtmlHelpController( wxHtmlHelpController* aController )
|
void EDA_APP::SetHtmlHelpController( wxHtmlHelpController* aController )
|
||||||
{
|
{
|
||||||
if( m_HtmlCtrl )
|
|
||||||
delete m_HtmlCtrl;
|
delete m_HtmlCtrl;
|
||||||
|
|
||||||
m_HtmlCtrl = aController;
|
m_HtmlCtrl = aController;
|
||||||
|
@ -459,8 +446,8 @@ bool EDA_APP::SetBinDir()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Use unix notation for paths. I am not sure this is a good idea,
|
// Use unix notation for paths. I am not sure this is a good idea,
|
||||||
// but it simplify compatibility between Windows and Unices
|
// but it simplifies compatibility between Windows and Unices.
|
||||||
// However it is a potential problem in path handling under Windows
|
// However it is a potential problem in path handling under Windows.
|
||||||
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
m_BinDir.Replace( WIN_STRING_DIR_SEP, UNIX_STRING_DIR_SEP );
|
||||||
|
|
||||||
// Remove file name form command line:
|
// Remove file name form command line:
|
||||||
|
@ -471,9 +458,8 @@ bool EDA_APP::SetBinDir()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::SetDefaultSearchPaths( void )
|
void EDA_APP::SetDefaultSearchPaths()
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
wxString path = m_BinDir;
|
wxString path = m_BinDir;
|
||||||
wxPathList tmp;
|
wxPathList tmp;
|
||||||
|
|
||||||
|
@ -519,8 +505,8 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
#ifdef __WXMSW__
|
#ifdef __WXMSW__
|
||||||
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
|
tmp.AddEnvList( wxT( "PROGRAMFILES" ) );
|
||||||
#elif __WXMAC__
|
#elif __WXMAC__
|
||||||
tmp.Add( wxT( "/Library/Application Support" ) );
|
|
||||||
tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) );
|
tmp.Add( wxString( wxGetenv( wxT( "HOME" ) ) ) + wxT( "/Library/Application Support" ) );
|
||||||
|
tmp.Add( wxT( "/Library/Application Support" ) );
|
||||||
#else
|
#else
|
||||||
tmp.AddEnvList( wxT( "PATH" ) );
|
tmp.AddEnvList( wxT( "PATH" ) );
|
||||||
#endif
|
#endif
|
||||||
|
@ -529,7 +515,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
tmp.Add( wxT( DEFAULT_INSTALL_PATH ) );
|
tmp.Add( wxT( DEFAULT_INSTALL_PATH ) );
|
||||||
|
|
||||||
// Add kicad, kicad/share, share, and share/kicad to each possible base path.
|
// Add kicad, kicad/share, share, and share/kicad to each possible base path.
|
||||||
for( i = 0; i < tmp.GetCount(); i++ )
|
for( unsigned i = 0; i < tmp.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
fn = wxFileName( tmp[i], wxEmptyString );
|
fn = wxFileName( tmp[i], wxEmptyString );
|
||||||
|
|
||||||
|
@ -550,7 +536,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove all non-existent paths from the list.
|
// Remove all non-existent paths from the list.
|
||||||
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
for( unsigned i = 0; i < m_searchPaths.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
if( !wxFileName::IsDirReadable( m_searchPaths[i] ) )
|
||||||
{
|
{
|
||||||
|
@ -587,7 +573,7 @@ void EDA_APP::SetDefaultSearchPaths( void )
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add PCB library file path to search path list.
|
// Add PCB library file path to search path list.
|
||||||
if( ( m_Id == APP_PCBNEW_T ) || ( m_Id == APP_CVPCB_T ) )
|
if( m_Id == APP_PCBNEW_T || m_Id == APP_CVPCB_T )
|
||||||
{
|
{
|
||||||
fn.AppendDir( wxT( "modules" ) );
|
fn.AppendDir( wxT( "modules" ) );
|
||||||
|
|
||||||
|
@ -633,21 +619,20 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
|
||||||
{
|
{
|
||||||
wxASSERT( m_settings != NULL && m_commonSettings != NULL );
|
wxASSERT( m_settings != NULL && m_commonSettings != NULL );
|
||||||
|
|
||||||
wxString Line;
|
|
||||||
|
|
||||||
m_HelpSize.x = 500;
|
m_HelpSize.x = 500;
|
||||||
m_HelpSize.y = 400;
|
m_HelpSize.y = 400;
|
||||||
|
|
||||||
wxString languageSel;
|
wxString languageSel;
|
||||||
|
|
||||||
m_commonSettings->Read( languageCfgKey, &languageSel );
|
m_commonSettings->Read( languageCfgKey, &languageSel );
|
||||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||||
|
|
||||||
// Search for the current selection
|
// Search for the current selection
|
||||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
if( s_Language_List[ii].m_Lang_Label == languageSel )
|
if( s_Languages[ii].m_Lang_Label == languageSel )
|
||||||
{
|
{
|
||||||
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
|
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -660,9 +645,11 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
|
||||||
|
|
||||||
if( aReopenLastUsedDirectory )
|
if( aReopenLastUsedDirectory )
|
||||||
{
|
{
|
||||||
if( m_settings->Read( workingDirKey, &Line ) && wxDirExists( Line ) )
|
wxString dir;
|
||||||
|
|
||||||
|
if( m_settings->Read( workingDirKey, &dir ) && wxDirExists( dir ) )
|
||||||
{
|
{
|
||||||
wxSetWorkingDirectory( Line );
|
wxSetWorkingDirectory( dir );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -685,14 +672,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
|
||||||
|
|
||||||
while( 1 )
|
while( 1 )
|
||||||
{
|
{
|
||||||
upath = m_commonSettings->Read( wxString::Format( wxT( "LibraryPath%d" ), i ),
|
upath = m_commonSettings->Read(
|
||||||
wxT( "" ) );
|
wxString::Format( wxT( "LibraryPath%d" ), i ), wxT( "" ) );
|
||||||
|
|
||||||
if( upath.IsSameAs( wxT( "" ) ) )
|
if( upath.IsSameAs( wxT( "" ) ) )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
m_libSearchPaths.Add( upath );
|
m_libSearchPaths.Add( upath );
|
||||||
i ++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -700,6 +687,7 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
|
||||||
void EDA_APP::SaveSettings()
|
void EDA_APP::SaveSettings()
|
||||||
{
|
{
|
||||||
wxASSERT( m_settings != NULL );
|
wxASSERT( m_settings != NULL );
|
||||||
|
|
||||||
m_settings->Write( showPageLimitsKey, g_ShowPageLimits );
|
m_settings->Write( showPageLimitsKey, g_ShowPageLimits );
|
||||||
m_settings->Write( workingDirKey, wxGetCwd() );
|
m_settings->Write( workingDirKey, wxGetCwd() );
|
||||||
m_settings->Write( backgroundColorKey, (long) g_DrawBgColor );
|
m_settings->Write( backgroundColorKey, (long) g_DrawBgColor );
|
||||||
|
@ -731,6 +719,7 @@ bool EDA_APP::SetLanguage( bool first_time )
|
||||||
|
|
||||||
m_LanguageId = wxLANGUAGE_DEFAULT;
|
m_LanguageId = wxLANGUAGE_DEFAULT;
|
||||||
delete m_Locale;
|
delete m_Locale;
|
||||||
|
|
||||||
m_Locale = new wxLocale;
|
m_Locale = new wxLocale;
|
||||||
m_Locale->Init();
|
m_Locale->Init();
|
||||||
retv = false;
|
retv = false;
|
||||||
|
@ -746,11 +735,11 @@ bool EDA_APP::SetLanguage( bool first_time )
|
||||||
wxString languageSel;
|
wxString languageSel;
|
||||||
|
|
||||||
// Search for the current selection
|
// Search for the current selection
|
||||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
if( s_Language_List[ii].m_WX_Lang_Identifier == m_LanguageId )
|
if( s_Languages[ii].m_WX_Lang_Identifier == m_LanguageId )
|
||||||
{
|
{
|
||||||
languageSel = s_Language_List[ii].m_Lang_Label;
|
languageSel = s_Languages[ii].m_Lang_Label;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -762,11 +751,14 @@ bool EDA_APP::SetLanguage( bool first_time )
|
||||||
// Make a conversion double <=> string
|
// Make a conversion double <=> string
|
||||||
double dtst = 0.5;
|
double dtst = 0.5;
|
||||||
wxString msg;
|
wxString msg;
|
||||||
|
|
||||||
extern bool g_DisableFloatingPointLocalNotation; // See common.cpp
|
extern bool g_DisableFloatingPointLocalNotation; // See common.cpp
|
||||||
|
|
||||||
g_DisableFloatingPointLocalNotation = false;
|
g_DisableFloatingPointLocalNotation = false;
|
||||||
|
|
||||||
msg << dtst;
|
msg << dtst;
|
||||||
double result;
|
double result;
|
||||||
msg.ToDouble(&result);
|
msg.ToDouble( &result );
|
||||||
|
|
||||||
if( result != dtst ) // string to double encode/decode does not work! Bug detected
|
if( result != dtst ) // string to double encode/decode does not work! Bug detected
|
||||||
{
|
{
|
||||||
|
@ -788,27 +780,25 @@ bool EDA_APP::SetLanguage( bool first_time )
|
||||||
void EDA_APP::SetLanguageIdentifier( int menu_id )
|
void EDA_APP::SetLanguageIdentifier( int menu_id )
|
||||||
{
|
{
|
||||||
wxLogDebug( wxT( "Select language ID %d from %zd possible languages." ),
|
wxLogDebug( wxT( "Select language ID %d from %zd possible languages." ),
|
||||||
menu_id, LANGUAGE_DESCR_COUNT );
|
menu_id, DIM( s_Languages ) );
|
||||||
|
|
||||||
for( unsigned int ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
if( menu_id == s_Language_List[ii].m_KI_Lang_Identifier )
|
if( menu_id == s_Languages[ii].m_KI_Lang_Identifier )
|
||||||
{
|
{
|
||||||
m_LanguageId = s_Language_List[ii].m_WX_Lang_Identifier;
|
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void EDA_APP::SetLanguagePath( void )
|
void EDA_APP::SetLanguagePath()
|
||||||
{
|
{
|
||||||
size_t i;
|
|
||||||
|
|
||||||
// Add defined search paths to locale paths
|
// Add defined search paths to locale paths
|
||||||
if( !m_searchPaths.IsEmpty() )
|
if( !m_searchPaths.IsEmpty() )
|
||||||
{
|
{
|
||||||
for( i = 0; i < m_searchPaths.GetCount(); i++ )
|
for( unsigned i = 0; i < m_searchPaths.GetCount(); i++ )
|
||||||
{
|
{
|
||||||
wxFileName fn( m_searchPaths[i], wxEmptyString );
|
wxFileName fn( m_searchPaths[i], wxEmptyString );
|
||||||
|
|
||||||
|
@ -843,7 +833,6 @@ void EDA_APP::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||||
{
|
{
|
||||||
wxMenu* menu = NULL;
|
wxMenu* menu = NULL;
|
||||||
wxMenuItem* item;
|
wxMenuItem* item;
|
||||||
unsigned int ii;
|
|
||||||
|
|
||||||
item = MasterMenu->FindItem( ID_LANGUAGE_CHOICE );
|
item = MasterMenu->FindItem( ID_LANGUAGE_CHOICE );
|
||||||
|
|
||||||
|
@ -852,17 +841,17 @@ void EDA_APP::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||||
|
|
||||||
menu = new wxMenu;
|
menu = new wxMenu;
|
||||||
|
|
||||||
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
wxString label;
|
wxString label;
|
||||||
|
|
||||||
if( s_Language_List[ii].m_DoNotTranslate )
|
if( s_Languages[ii].m_DoNotTranslate )
|
||||||
label = s_Language_List[ii].m_Lang_Label;
|
label = s_Languages[ii].m_Lang_Label;
|
||||||
else
|
else
|
||||||
label = wxGetTranslation( s_Language_List[ii].m_Lang_Label );
|
label = wxGetTranslation( s_Languages[ii].m_Lang_Label );
|
||||||
|
|
||||||
AddMenuItem( menu, s_Language_List[ii].m_KI_Lang_Identifier,
|
AddMenuItem( menu, s_Languages[ii].m_KI_Lang_Identifier,
|
||||||
label, KiBitmap(s_Language_List[ii].m_Lang_Icon ),
|
label, KiBitmap(s_Languages[ii].m_Lang_Icon ),
|
||||||
wxITEM_CHECK );
|
wxITEM_CHECK );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -873,18 +862,18 @@ void EDA_APP::AddMenuLanguageList( wxMenu* MasterMenu )
|
||||||
KiBitmap( language_xpm ) );
|
KiBitmap( language_xpm ) );
|
||||||
|
|
||||||
// Set Check mark on current selected language
|
// Set Check mark on current selected language
|
||||||
for( ii = 0; ii < LANGUAGE_DESCR_COUNT; ii++ )
|
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
|
||||||
{
|
{
|
||||||
if( m_LanguageId == s_Language_List[ii].m_WX_Lang_Identifier )
|
if( m_LanguageId == s_Languages[ii].m_WX_Lang_Identifier )
|
||||||
menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, true );
|
menu->Check( s_Languages[ii].m_KI_Lang_Identifier, true );
|
||||||
else
|
else
|
||||||
menu->Check( s_Language_List[ii].m_KI_Lang_Identifier, false );
|
menu->Check( s_Languages[ii].m_KI_Lang_Identifier, false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString EDA_APP::FindFileInSearchPaths( const wxString& filename,
|
wxString EDA_APP::FindFileInSearchPaths(
|
||||||
const wxArrayString* subdirs )
|
const wxString& filename, const wxArrayString* subdirs )
|
||||||
{
|
{
|
||||||
size_t i, j;
|
size_t i, j;
|
||||||
wxFileName fn;
|
wxFileName fn;
|
||||||
|
@ -909,7 +898,7 @@ wxString EDA_APP::FindFileInSearchPaths( const wxString& filename,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
wxString EDA_APP::GetHelpFile( void )
|
wxString EDA_APP::GetHelpFile()
|
||||||
{
|
{
|
||||||
wxString fn;
|
wxString fn;
|
||||||
wxArrayString subdirs, altsubdirs;
|
wxArrayString subdirs, altsubdirs;
|
||||||
|
@ -950,6 +939,7 @@ wxString EDA_APP::GetHelpFile( void )
|
||||||
// Step 1 : Try to find help file in help/<canonical name>
|
// Step 1 : Try to find help file in help/<canonical name>
|
||||||
subdirs.Add( m_Locale->GetCanonicalName() );
|
subdirs.Add( m_Locale->GetCanonicalName() );
|
||||||
altsubdirs.Add( m_Locale->GetCanonicalName() );
|
altsubdirs.Add( m_Locale->GetCanonicalName() );
|
||||||
|
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||||
|
|
||||||
if( !fn )
|
if( !fn )
|
||||||
|
@ -964,6 +954,7 @@ wxString EDA_APP::GetHelpFile( void )
|
||||||
// wxLocale::GetName() does not return always the short name
|
// wxLocale::GetName() does not return always the short name
|
||||||
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
subdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||||
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
altsubdirs.Add( m_Locale->GetName().BeforeLast( '_' ) );
|
||||||
|
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||||
|
|
||||||
if( !fn )
|
if( !fn )
|
||||||
|
@ -977,6 +968,7 @@ wxString EDA_APP::GetHelpFile( void )
|
||||||
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
altsubdirs.RemoveAt( altsubdirs.GetCount() - 1 );
|
||||||
subdirs.Add( _T( "en" ) );
|
subdirs.Add( _T( "en" ) );
|
||||||
altsubdirs.Add( _T( "en" ) );
|
altsubdirs.Add( _T( "en" ) );
|
||||||
|
|
||||||
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
fn = FindFileInSearchPaths( m_HelpFileName, &altsubdirs );
|
||||||
|
|
||||||
if( !fn )
|
if( !fn )
|
||||||
|
@ -1002,6 +994,7 @@ wxString EDA_APP::ReturnLastVisitedLibraryPath( const wxString& aSubPathToSearch
|
||||||
if( pcount )
|
if( pcount )
|
||||||
{
|
{
|
||||||
unsigned ipath = 0;
|
unsigned ipath = 0;
|
||||||
|
|
||||||
if( m_libSearchPaths[0] == wxGetCwd() )
|
if( m_libSearchPaths[0] == wxGetCwd() )
|
||||||
ipath = 1;
|
ipath = 1;
|
||||||
|
|
||||||
|
@ -1207,3 +1200,4 @@ bool EDA_APP::SetFootprintLibTablePath()
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -273,8 +273,8 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
|
||||||
wxString::Format( wxT( "'%s' is not a valid FPID." ),
|
wxString::Format( wxT( "'%s' is not a valid FPID." ),
|
||||||
GetChars( aFootprintName ) ) );
|
GetChars( aFootprintName ) ) );
|
||||||
|
|
||||||
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
|
wxString libNickname = fpid.GetLibNickname();
|
||||||
wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() );
|
wxString footprintName = fpid.GetFootprintName();
|
||||||
|
|
||||||
if( libNickname == fp.GetNickname() && footprintName == fp.GetFootprintName() )
|
if( libNickname == fp.GetNickname() && footprintName == fp.GetFootprintName() )
|
||||||
return &fp;
|
return &fp;
|
||||||
|
|
|
@ -173,7 +173,7 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
|
||||||
FPID& fpid = (FPID&) ret->GetFPID();
|
FPID& fpid = (FPID&) ret->GetFPID();
|
||||||
|
|
||||||
// Catch any misbehaving plugin, which should be setting internal footprint name properly:
|
// Catch any misbehaving plugin, which should be setting internal footprint name properly:
|
||||||
wxASSERT( aFootprintName == FROM_UTF8( fpid.GetFootprintName().c_str() ) );
|
wxASSERT( aFootprintName == (wxString) fpid.GetFootprintName() );
|
||||||
|
|
||||||
// and clearing nickname
|
// and clearing nickname
|
||||||
wxASSERT( !fpid.GetLibNickname().size() );
|
wxASSERT( !fpid.GetLibNickname().size() );
|
||||||
|
@ -195,7 +195,7 @@ FP_LIB_TABLE::SAVE_T FP_LIB_TABLE::FootprintSave( const wxString& aNickname, con
|
||||||
// Try loading the footprint to see if it already exists, caller wants overwrite
|
// Try loading the footprint to see if it already exists, caller wants overwrite
|
||||||
// protection, which is atypical, not the default.
|
// protection, which is atypical, not the default.
|
||||||
|
|
||||||
wxString fpname = FROM_UTF8( aFootprint->GetFPID().GetFootprintName().c_str() );
|
wxString fpname = aFootprint->GetFPID().GetFootprintName();
|
||||||
|
|
||||||
std::auto_ptr<MODULE> m( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) );
|
std::auto_ptr<MODULE> m( row->plugin->FootprintLoad( row->GetFullURI( true ), fpname, row->GetProperties() ) );
|
||||||
|
|
||||||
|
@ -480,16 +480,17 @@ PROPERTIES* FP_LIB_TABLE::ParseOptions( const std::string& aOptionsList )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string FP_LIB_TABLE::FormatOptions( const PROPERTIES* aProperties )
|
UTF8 FP_LIB_TABLE::FormatOptions( const PROPERTIES* aProperties )
|
||||||
{
|
{
|
||||||
std::string ret;
|
UTF8 ret;
|
||||||
|
|
||||||
if( aProperties )
|
if( aProperties )
|
||||||
{
|
{
|
||||||
for( PROPERTIES::const_iterator it = aProperties->begin(); it != aProperties->end(); ++it )
|
for( PROPERTIES::const_iterator it = aProperties->begin(); it != aProperties->end(); ++it )
|
||||||
{
|
{
|
||||||
const std::string& name = it->first;
|
const std::string& name = it->first;
|
||||||
const std::string& value = it->second;
|
|
||||||
|
const UTF8& value = it->second;
|
||||||
|
|
||||||
if( ret.size() )
|
if( ret.size() )
|
||||||
ret += OPT_SEP;
|
ret += OPT_SEP;
|
||||||
|
@ -741,7 +742,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Cannot find footprint library file \"%s\" in any of the "
|
msg.Printf( _( "Cannot find footprint library file '%s' in any of the "
|
||||||
"KiCad legacy library search paths.\n" ),
|
"KiCad legacy library search paths.\n" ),
|
||||||
GetChars( fn.GetFullPath() ) );
|
GetChars( fn.GetFullPath() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -751,8 +752,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
module = pi->FootprintLoad( libPath,
|
module = pi->FootprintLoad( libPath, component->GetFPID().GetFootprintName() );
|
||||||
FROM_UTF8( component->GetFPID().GetFootprintName().c_str() ) );
|
|
||||||
|
|
||||||
if( module )
|
if( module )
|
||||||
{
|
{
|
||||||
|
@ -766,10 +766,10 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component `%s` footprint <%s> was not found in any legacy "
|
msg.Printf( _( "Component `%s` footprint '%s' was not found in any legacy "
|
||||||
"library.\n" ),
|
"library.\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -811,10 +811,10 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
{
|
{
|
||||||
if( aReporter )
|
if( aReporter )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component `%s` footprint <%s> legacy library path <%s > "
|
msg.Printf( _( "Component `%s` footprint '%s' legacy library path <%s > "
|
||||||
"was not found in the footprint library table.\n" ),
|
"was not found in the footprint library table.\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -828,10 +828,14 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
|
||||||
|
|
||||||
if( !newFPID.IsValid() )
|
if( !newFPID.IsValid() )
|
||||||
{
|
{
|
||||||
msg.Printf( _( "Component `%s` FPID <%s> is not valid.\n" ),
|
if( aReporter )
|
||||||
|
{
|
||||||
|
msg.Printf( _( "Component `%s` FPID '%s' is not valid.\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( FROM_UTF8( newFPID.Format().c_str() ) ) );
|
GetChars( newFPID.Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
}
|
||||||
|
|
||||||
retv = false;
|
retv = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -856,7 +860,7 @@ void FP_LIB_TABLE::SetProjectPathEnvVariable( const wxFileName& aPath )
|
||||||
else
|
else
|
||||||
path = aPath.GetPath();
|
path = aPath.GetPath();
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to <%s>." ),
|
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to '%s'." ),
|
||||||
GetChars( ProjectPathEnvVariableName() ), GetChars( path ) );
|
GetChars( ProjectPathEnvVariableName() ), GetChars( path ) );
|
||||||
wxSetEnv( ProjectPathEnvVariableName(), path );
|
wxSetEnv( ProjectPathEnvVariableName(), path );
|
||||||
}
|
}
|
||||||
|
@ -895,7 +899,7 @@ wxString FP_LIB_TABLE::GetProjectFileName( const wxFileName& aPath )
|
||||||
fn.SetName( defaultFileName );
|
fn.SetName( defaultFileName );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Project specific footprint library table file <%s>." ),
|
wxLogTrace( traceFpLibTable, wxT( "Project specific footprint library table file '%s'." ),
|
||||||
GetChars( fn.GetFullPath() ) );
|
GetChars( fn.GetFullPath() ) );
|
||||||
|
|
||||||
return fn.GetFullPath();
|
return fn.GetFullPath();
|
||||||
|
@ -913,7 +917,7 @@ bool FP_LIB_TABLE::LoadGlobalTable( FP_LIB_TABLE& aTable ) throw (IO_ERROR, PARS
|
||||||
|
|
||||||
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
|
if( !fn.DirExists() && !fn.Mkdir( 0x777, wxPATH_MKDIR_FULL ) )
|
||||||
{
|
{
|
||||||
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path <%s>." ),
|
THROW_IO_ERROR( wxString::Format( _( "Cannot create global library table path '%s'." ),
|
||||||
GetChars( fn.GetPath() ) ) );
|
GetChars( fn.GetPath() ) ) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -950,7 +954,7 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
|
||||||
|
|
||||||
fn.SetName( GetFileName() );
|
fn.SetName( GetFileName() );
|
||||||
|
|
||||||
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file <%s>." ),
|
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file '%s'." ),
|
||||||
GetChars( fn.GetFullPath() ) );
|
GetChars( fn.GetFullPath() ) );
|
||||||
|
|
||||||
return fn.GetFullPath();
|
return fn.GetFullPath();
|
||||||
|
|
|
@ -265,9 +265,9 @@ int FPID::SetRevision( const std::string& aRevision )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string FPID::Format() const
|
UTF8 FPID::Format() const
|
||||||
{
|
{
|
||||||
std::string ret;
|
UTF8 ret;
|
||||||
|
|
||||||
if( nickname.size() )
|
if( nickname.size() )
|
||||||
{
|
{
|
||||||
|
@ -287,9 +287,9 @@ std::string FPID::Format() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string FPID::GetFootprintNameAndRev() const
|
UTF8 FPID::GetFootprintNameAndRev() const
|
||||||
{
|
{
|
||||||
std::string ret;
|
UTF8 ret;
|
||||||
|
|
||||||
if( revision.size() )
|
if( revision.size() )
|
||||||
{
|
{
|
||||||
|
@ -301,11 +301,11 @@ std::string FPID::GetFootprintNameAndRev() const
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string FPID::Format( const std::string& aLogicalLib, const std::string& aFootprintName,
|
UTF8 FPID::Format( const std::string& aLogicalLib, const std::string& aFootprintName,
|
||||||
const std::string& aRevision )
|
const std::string& aRevision )
|
||||||
throw( PARSE_ERROR )
|
throw( PARSE_ERROR )
|
||||||
{
|
{
|
||||||
std::string ret;
|
UTF8 ret;
|
||||||
int offset;
|
int offset;
|
||||||
|
|
||||||
if( aLogicalLib.size() )
|
if( aLogicalLib.size() )
|
||||||
|
|
|
@ -147,12 +147,13 @@ BOX2D STROKE_FONT::computeBoundingBox( const GLYPH& aGLYPH, const VECTOR2D& aGLY
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle )
|
void STROKE_FONT::Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle )
|
||||||
{
|
{
|
||||||
// Context needs to be saved before any transformations
|
// Context needs to be saved before any transformations
|
||||||
m_gal->Save();
|
m_gal->Save();
|
||||||
|
|
||||||
m_gal->Translate( aPosition );
|
m_gal->Translate( aPosition );
|
||||||
|
m_gal->Rotate( -aRotationAngle );
|
||||||
|
|
||||||
// Single line height
|
// Single line height
|
||||||
int lineHeight = getInterline();
|
int lineHeight = getInterline();
|
||||||
|
@ -177,8 +178,6 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
m_gal->Rotate( -aRotationAngle );
|
|
||||||
|
|
||||||
m_gal->SetIsStroke( true );
|
m_gal->SetIsStroke( true );
|
||||||
m_gal->SetIsFill( false );
|
m_gal->SetIsFill( false );
|
||||||
|
|
||||||
|
@ -193,7 +192,7 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
|
||||||
{
|
{
|
||||||
size_t length = newlinePos - begin;
|
size_t length = newlinePos - begin;
|
||||||
|
|
||||||
drawSingleLineText( aText.Mid( begin, length ) );
|
drawSingleLineText( aText.substr( begin, length ) );
|
||||||
m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
|
m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
|
||||||
|
|
||||||
begin = newlinePos + 1;
|
begin = newlinePos + 1;
|
||||||
|
@ -201,14 +200,14 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
|
||||||
}
|
}
|
||||||
|
|
||||||
// Draw the last (or the only one) line
|
// Draw the last (or the only one) line
|
||||||
if( !aText.IsEmpty() )
|
if( !aText.empty() )
|
||||||
drawSingleLineText( aText.Mid( begin ) );
|
drawSingleLineText( aText.substr( begin ) );
|
||||||
|
|
||||||
m_gal->Restore();
|
m_gal->Restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void STROKE_FONT::drawSingleLineText( const wxString& aText )
|
void STROKE_FONT::drawSingleLineText( const UTF8& aText )
|
||||||
{
|
{
|
||||||
// By default the overbar is turned off
|
// By default the overbar is turned off
|
||||||
m_overbar = false;
|
m_overbar = false;
|
||||||
|
@ -255,12 +254,12 @@ void STROKE_FONT::drawSingleLineText( const wxString& aText )
|
||||||
xOffset = 0.0;
|
xOffset = 0.0;
|
||||||
}
|
}
|
||||||
|
|
||||||
for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); ++chIt )
|
for( UTF8::uni_iter chIt = aText.ubegin(), end = aText.uend(); chIt < end; ++chIt )
|
||||||
{
|
{
|
||||||
// Toggle overbar
|
// Toggle overbar
|
||||||
if( *chIt == '~' )
|
if( *chIt == '~' )
|
||||||
{
|
{
|
||||||
if( ++chIt == aText.end() )
|
if( ++chIt >= end )
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if( *chIt != '~' ) // It was a single tilda, it toggles overbar
|
if( *chIt != '~' ) // It was a single tilda, it toggles overbar
|
||||||
|
@ -282,6 +281,7 @@ void STROKE_FONT::drawSingleLineText( const wxString& aText )
|
||||||
VECTOR2D startOverbar( xOffset, -getInterline() * OVERBAR_HEIGHT );
|
VECTOR2D startOverbar( xOffset, -getInterline() * OVERBAR_HEIGHT );
|
||||||
VECTOR2D endOverbar( xOffset + glyphSize.x * bbox.GetEnd().x,
|
VECTOR2D endOverbar( xOffset + glyphSize.x * bbox.GetEnd().x,
|
||||||
-getInterline() * OVERBAR_HEIGHT );
|
-getInterline() * OVERBAR_HEIGHT );
|
||||||
|
|
||||||
m_gal->DrawLine( startOverbar, endOverbar );
|
m_gal->DrawLine( startOverbar, endOverbar );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -318,25 +318,25 @@ void STROKE_FONT::drawSingleLineText( const wxString& aText )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
VECTOR2D STROKE_FONT::computeTextSize( const wxString& aText ) const
|
VECTOR2D STROKE_FONT::computeTextSize( const UTF8& aText ) const
|
||||||
{
|
{
|
||||||
VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y );
|
VECTOR2D result = VECTOR2D( 0.0, m_glyphSize.y );
|
||||||
|
|
||||||
for( wxString::const_iterator chIt = aText.begin(); chIt != aText.end(); ++chIt )
|
for( UTF8::uni_iter it = aText.ubegin(), end = aText.uend(); it < end; ++it )
|
||||||
{
|
{
|
||||||
wxASSERT_MSG( *chIt != '\n',
|
wxASSERT_MSG( *it != '\n',
|
||||||
wxT( "This function is intended to work with single line strings" ) );
|
wxT( "This function is intended to work with single line strings" ) );
|
||||||
|
|
||||||
// If it is double tilda, then it is displayed as a single tilda
|
// If it is double tilda, then it is displayed as a single tilda
|
||||||
// If it is single tilda, then it is toggling overbar, so we need to skip it
|
// If it is single tilda, then it is toggling overbar, so we need to skip it
|
||||||
if( *chIt == '~' )
|
if( *it == '~' )
|
||||||
{
|
{
|
||||||
if( ++chIt == aText.end() )
|
if( ++it >= end )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Index in the bounding boxes table
|
// Index in the bounding boxes table
|
||||||
unsigned dd = *chIt - ' ';
|
unsigned dd = *it - ' ';
|
||||||
|
|
||||||
if( dd >= m_glyphBoundingBoxes.size() || dd < 0 )
|
if( dd >= m_glyphBoundingBoxes.size() || dd < 0 )
|
||||||
dd = '?' - ' ';
|
dd = '?' - ' ';
|
||||||
|
|
|
@ -0,0 +1,710 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
* Copyright (C) 2013 CERN
|
||||||
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <ttl/halfedge/hetriang.h>
|
||||||
|
#include <ttl/halfedge/hetraits.h>
|
||||||
|
#include <ttl/ttl.h>
|
||||||
|
#include <algorithm>
|
||||||
|
#include <fstream>
|
||||||
|
#include <limits>
|
||||||
|
|
||||||
|
|
||||||
|
using namespace hed;
|
||||||
|
using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
Triangulation* TTLtraits::triang_ = NULL;
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_ID
|
||||||
|
int Node::id_count = 0;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//#define DEBUG_HE
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
#include <iostream>
|
||||||
|
static void errorAndExit(char* message) {
|
||||||
|
cout << "\n!!! ERROR: "<< message << " !!!\n" << endl; exit(-1);
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
static EdgePtr getLeadingEdgeInTriangle(const EdgePtr& e) {
|
||||||
|
EdgePtr edge = e;
|
||||||
|
|
||||||
|
// Code: 3EF (assumes triangle)
|
||||||
|
if (!edge->isLeadingEdge()) {
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
if (!edge->isLeadingEdge())
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!edge->isLeadingEdge()) {
|
||||||
|
return EdgePtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
static void getLimits(NodesContainer::iterator first,
|
||||||
|
NodesContainer::iterator last,
|
||||||
|
int& xmin, int& ymin,
|
||||||
|
int& xmax, int& ymax) {
|
||||||
|
|
||||||
|
xmin = ymin = std::numeric_limits<int>::min();
|
||||||
|
xmax = ymax = std::numeric_limits<int>::max();
|
||||||
|
|
||||||
|
NodesContainer::iterator it;
|
||||||
|
for (it = first; it != last; ++it) {
|
||||||
|
xmin = min(xmin, (*it)->GetX());
|
||||||
|
ymin = min(ymin, (*it)->GetY());
|
||||||
|
xmax = max(xmax, (*it)->GetX());
|
||||||
|
ymax = max(ymax, (*it)->GetY());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
EdgePtr Triangulation::initTwoEnclosingTriangles(NodesContainer::iterator first,
|
||||||
|
NodesContainer::iterator last) {
|
||||||
|
|
||||||
|
int xmin, ymin, xmax, ymax;
|
||||||
|
getLimits(first, last, xmin, ymin, xmax, ymax);
|
||||||
|
|
||||||
|
// Add 10% of range:
|
||||||
|
double fac = 10.0;
|
||||||
|
double dx = (xmax-xmin)/fac;
|
||||||
|
double dy = (ymax-ymin)/fac;
|
||||||
|
|
||||||
|
NodePtr n1(new Node(xmin-dx,ymin-dy));
|
||||||
|
NodePtr n2(new Node(xmax+dx,ymin-dy));
|
||||||
|
NodePtr n3(new Node(xmax+dx,ymax+dy));
|
||||||
|
NodePtr n4(new Node(xmin-dx,ymax+dy));
|
||||||
|
|
||||||
|
// diagonal
|
||||||
|
EdgePtr e1d(new Edge); // lower
|
||||||
|
EdgePtr e2d(new Edge); // upper, the twin edge
|
||||||
|
|
||||||
|
// lower triangle
|
||||||
|
EdgePtr e11(new Edge);
|
||||||
|
EdgePtr e12(new Edge);
|
||||||
|
|
||||||
|
// upper triangle
|
||||||
|
EdgePtr e21(new Edge); // upper upper
|
||||||
|
EdgePtr e22(new Edge);
|
||||||
|
|
||||||
|
// lower triangle
|
||||||
|
e1d->setSourceNode(n3);
|
||||||
|
e1d->setNextEdgeInFace(e11);
|
||||||
|
e1d->setTwinEdge(e2d);
|
||||||
|
e1d->setAsLeadingEdge();
|
||||||
|
addLeadingEdge(e1d);
|
||||||
|
|
||||||
|
e11->setSourceNode(n1);
|
||||||
|
e11->setNextEdgeInFace(e12);
|
||||||
|
|
||||||
|
e12->setSourceNode(n2);
|
||||||
|
e12->setNextEdgeInFace(e1d);
|
||||||
|
|
||||||
|
// upper triangle
|
||||||
|
e2d->setSourceNode(n1);
|
||||||
|
e2d->setNextEdgeInFace(e21);
|
||||||
|
e2d->setTwinEdge(e1d);
|
||||||
|
e2d->setAsLeadingEdge();
|
||||||
|
addLeadingEdge(e2d);
|
||||||
|
|
||||||
|
e21->setSourceNode(n3);
|
||||||
|
e21->setNextEdgeInFace(e22);
|
||||||
|
|
||||||
|
e22->setSourceNode(n4);
|
||||||
|
e22->setNextEdgeInFace(e2d);
|
||||||
|
|
||||||
|
return e11;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::createDelaunay(NodesContainer::iterator first,
|
||||||
|
NodesContainer::iterator last) {
|
||||||
|
|
||||||
|
TTLtraits::triang_ = this;
|
||||||
|
cleanAll();
|
||||||
|
|
||||||
|
EdgePtr bedge = initTwoEnclosingTriangles(first, last);
|
||||||
|
Dart dc(bedge);
|
||||||
|
|
||||||
|
Dart d_iter = dc;
|
||||||
|
|
||||||
|
NodesContainer::iterator it;
|
||||||
|
for (it = first; it != last; ++it) {
|
||||||
|
ttl::insertNode<TTLtraits>(d_iter, *it);
|
||||||
|
}
|
||||||
|
|
||||||
|
// In general (e.g. for the triangle based data structure), the initial dart
|
||||||
|
// may have been changed.
|
||||||
|
// It is the users responsibility to get a valid boundary dart here.
|
||||||
|
// The half-edge data structure preserves the initial dart.
|
||||||
|
// (A dart at the boundary can also be found by trying to locate a
|
||||||
|
// triangle "outside" the triangulation.)
|
||||||
|
|
||||||
|
// Assumes rectangular domain
|
||||||
|
ttl::removeRectangularBoundary<TTLtraits>(dc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::removeTriangle(EdgePtr& edge) {
|
||||||
|
|
||||||
|
EdgePtr e1 = getLeadingEdgeInTriangle(edge);
|
||||||
|
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
if (!e1)
|
||||||
|
errorAndExit("Triangulation::removeTriangle: could not find leading edge");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
removeLeadingEdgeFromList(e1);
|
||||||
|
// cout << "No leading edges = " << leadingEdges_.size() << endl;
|
||||||
|
// Remove the triangle
|
||||||
|
EdgePtr e2 = e1->getNextEdgeInFace();
|
||||||
|
EdgePtr e3 = e2->getNextEdgeInFace();
|
||||||
|
|
||||||
|
if (e1->getTwinEdge())
|
||||||
|
e1->getTwinEdge()->setTwinEdge(EdgePtr());
|
||||||
|
if (e2->getTwinEdge())
|
||||||
|
e2->getTwinEdge()->setTwinEdge(EdgePtr());
|
||||||
|
if (e3->getTwinEdge())
|
||||||
|
e3->getTwinEdge()->setTwinEdge(EdgePtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::reverse_splitTriangle(EdgePtr& edge) {
|
||||||
|
|
||||||
|
// Reverse operation of splitTriangle
|
||||||
|
|
||||||
|
EdgePtr e1 = edge->getNextEdgeInFace();
|
||||||
|
EdgePtr le = getLeadingEdgeInTriangle(e1);
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
if (!le)
|
||||||
|
errorAndExit("Triangulation::removeTriangle: could not find leading edge");
|
||||||
|
#endif
|
||||||
|
removeLeadingEdgeFromList(le);
|
||||||
|
|
||||||
|
EdgePtr e2 = e1->getNextEdgeInFace()->getTwinEdge()->getNextEdgeInFace();
|
||||||
|
le = getLeadingEdgeInTriangle(e2);
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
if (!le)
|
||||||
|
errorAndExit("Triangulation::removeTriangle: could not find leading edge");
|
||||||
|
#endif
|
||||||
|
removeLeadingEdgeFromList(le);
|
||||||
|
|
||||||
|
EdgePtr e3 = edge->getTwinEdge()->getNextEdgeInFace()->getNextEdgeInFace();
|
||||||
|
le = getLeadingEdgeInTriangle(e3);
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
if (!le)
|
||||||
|
errorAndExit("Triangulation::removeTriangle: could not find leading edge");
|
||||||
|
#endif
|
||||||
|
removeLeadingEdgeFromList(le);
|
||||||
|
|
||||||
|
// The three triangles at the node have now been removed
|
||||||
|
// from the triangulation, but the arcs have not been deleted.
|
||||||
|
// Next delete the 6 half edges radiating from the node
|
||||||
|
// The node is maintained by handle and need not be deleted explicitly
|
||||||
|
|
||||||
|
// Create the new triangle
|
||||||
|
e1->setNextEdgeInFace(e2);
|
||||||
|
e2->setNextEdgeInFace(e3);
|
||||||
|
e3->setNextEdgeInFace(e1);
|
||||||
|
addLeadingEdge(e1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// This is a "template" for iterating the boundary
|
||||||
|
/*
|
||||||
|
static void iterateBoundary(const Dart& dart) {
|
||||||
|
cout << "Iterate boundary 2" << endl;
|
||||||
|
// input is a dart at the boundary
|
||||||
|
|
||||||
|
Dart dart_iter = dart;
|
||||||
|
do {
|
||||||
|
if (ttl::isBoundaryEdge(dart_iter))
|
||||||
|
dart_iter.alpha0().alpha1();
|
||||||
|
else
|
||||||
|
dart_iter.alpha2().alpha1();
|
||||||
|
|
||||||
|
} while(dart_iter != dart);
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
Dart Triangulation::createDart() {
|
||||||
|
|
||||||
|
// Return an arbitrary CCW dart
|
||||||
|
return Dart(*leadingEdges_.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
bool Triangulation::removeLeadingEdgeFromList(EdgePtr& leadingEdge) {
|
||||||
|
|
||||||
|
// Remove the edge from the list of leading edges,
|
||||||
|
// but don't delete it.
|
||||||
|
// Also set flag for leading edge to false.
|
||||||
|
// Must search from start of list. Since edges are added to the
|
||||||
|
// start of the list during triangulation, this operation will
|
||||||
|
// normally be fast (when used in the triangulation algorithm)
|
||||||
|
list<EdgePtr>::iterator it;
|
||||||
|
for (it = leadingEdges_.begin(); it != leadingEdges_.end(); ++it) {
|
||||||
|
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
if (edge == leadingEdge) {
|
||||||
|
|
||||||
|
edge->setAsLeadingEdge(false);
|
||||||
|
it = leadingEdges_.erase(it);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (it == leadingEdges_.end())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::cleanAll() {
|
||||||
|
leadingEdges_.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_FLAG
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// This is a "template" for accessing all nodes (but multiple tests)
|
||||||
|
void Triangulation::flagNodes(bool flag) const {
|
||||||
|
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
for (it = leadingEdges_.begin(); it != leadingEdges_.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
edge->getSourceNode()->SetFlag(flag);
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
list<NodePtr>* Triangulation::getNodes() const {
|
||||||
|
|
||||||
|
flagNodes(false);
|
||||||
|
list<NodePtr>* nodeList = new list<NodePtr>;
|
||||||
|
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
for (it = leadingEdges_.begin(); it != leadingEdges_.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
const NodePtr& node = edge->getSourceNode();
|
||||||
|
|
||||||
|
if (node->GetFlag() == false) {
|
||||||
|
nodeList->push_back(node);
|
||||||
|
node->SetFlag(true);
|
||||||
|
}
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return nodeList;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
list<EdgePtr>* Triangulation::getEdges(bool skip_boundary_edges) const {
|
||||||
|
|
||||||
|
// collect all arcs (one half edge for each arc)
|
||||||
|
// (boundary edges are also collected).
|
||||||
|
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
list<EdgePtr>* elist = new list<EdgePtr>;
|
||||||
|
for (it = leadingEdges_.begin(); it != leadingEdges_.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
EdgePtr twinedge = edge->getTwinEdge();
|
||||||
|
// only one of the half-edges
|
||||||
|
|
||||||
|
if ( (!twinedge && !skip_boundary_edges) ||
|
||||||
|
(twinedge && ((size_t)edge.get() > (size_t)twinedge.get())) )
|
||||||
|
elist->push_front(edge);
|
||||||
|
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return elist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
EdgePtr Triangulation::splitTriangle(EdgePtr& edge, NodePtr& point) {
|
||||||
|
|
||||||
|
// Add a node by just splitting a triangle into three triangles
|
||||||
|
// Assumes the half edge is located in the triangle
|
||||||
|
// Returns a half edge with source node as the new node
|
||||||
|
|
||||||
|
// double x, y, z;
|
||||||
|
// x = point.x();
|
||||||
|
// y = point.y();
|
||||||
|
// z = point.z();
|
||||||
|
|
||||||
|
// e#_n are new edges
|
||||||
|
// e# are existing edges
|
||||||
|
// e#_n and e##_n are new twin edges
|
||||||
|
// e##_n are edges incident to the new node
|
||||||
|
|
||||||
|
// Add the node to the structure
|
||||||
|
//NodePtr new_node(new Node(x,y,z));
|
||||||
|
|
||||||
|
NodePtr n1 = edge->getSourceNode();
|
||||||
|
EdgePtr e1 = edge;
|
||||||
|
|
||||||
|
EdgePtr e2 = edge->getNextEdgeInFace();
|
||||||
|
NodePtr n2 = e2->getSourceNode();
|
||||||
|
|
||||||
|
EdgePtr e3 = e2->getNextEdgeInFace();
|
||||||
|
NodePtr n3 = e3->getSourceNode();
|
||||||
|
|
||||||
|
EdgePtr e1_n(new Edge);
|
||||||
|
EdgePtr e11_n(new Edge);
|
||||||
|
EdgePtr e2_n(new Edge);
|
||||||
|
EdgePtr e22_n(new Edge);
|
||||||
|
EdgePtr e3_n(new Edge);
|
||||||
|
EdgePtr e33_n(new Edge);
|
||||||
|
|
||||||
|
e1_n->setSourceNode(n1);
|
||||||
|
e11_n->setSourceNode(point);
|
||||||
|
e2_n->setSourceNode(n2);
|
||||||
|
e22_n->setSourceNode(point);
|
||||||
|
e3_n->setSourceNode(n3);
|
||||||
|
e33_n->setSourceNode(point);
|
||||||
|
|
||||||
|
e1_n->setTwinEdge(e11_n);
|
||||||
|
e11_n->setTwinEdge(e1_n);
|
||||||
|
e2_n->setTwinEdge(e22_n);
|
||||||
|
e22_n->setTwinEdge(e2_n);
|
||||||
|
e3_n->setTwinEdge(e33_n);
|
||||||
|
e33_n->setTwinEdge(e3_n);
|
||||||
|
|
||||||
|
e1_n->setNextEdgeInFace(e33_n);
|
||||||
|
e2_n->setNextEdgeInFace(e11_n);
|
||||||
|
e3_n->setNextEdgeInFace(e22_n);
|
||||||
|
|
||||||
|
e11_n->setNextEdgeInFace(e1);
|
||||||
|
e22_n->setNextEdgeInFace(e2);
|
||||||
|
e33_n->setNextEdgeInFace(e3);
|
||||||
|
|
||||||
|
|
||||||
|
// and update old's next edge
|
||||||
|
e1->setNextEdgeInFace(e2_n);
|
||||||
|
e2->setNextEdgeInFace(e3_n);
|
||||||
|
e3->setNextEdgeInFace(e1_n);
|
||||||
|
|
||||||
|
// add the three new leading edges,
|
||||||
|
// Must remove the old leading edge from the list.
|
||||||
|
// Use the field telling if an edge is a leading edge
|
||||||
|
// NOTE: Must search in the list!!!
|
||||||
|
|
||||||
|
|
||||||
|
EdgePtr leadingEdge;
|
||||||
|
if (e1->isLeadingEdge())
|
||||||
|
leadingEdge = e1;
|
||||||
|
else if (e2->isLeadingEdge())
|
||||||
|
leadingEdge = e2;
|
||||||
|
else if(e3->isLeadingEdge())
|
||||||
|
leadingEdge = e3;
|
||||||
|
else
|
||||||
|
return EdgePtr();
|
||||||
|
|
||||||
|
removeLeadingEdgeFromList(leadingEdge);
|
||||||
|
|
||||||
|
addLeadingEdge(e1_n);
|
||||||
|
addLeadingEdge(e2_n);
|
||||||
|
addLeadingEdge(e3_n);
|
||||||
|
|
||||||
|
// Return a half edge incident to the new node (with the new node as source node)
|
||||||
|
|
||||||
|
return e11_n;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::swapEdge(EdgePtr& diagonal) {
|
||||||
|
|
||||||
|
// Note that diagonal is both input and output and it is always
|
||||||
|
// kept in counterclockwise direction (this is not required by all
|
||||||
|
// finctions in ttl:: now)
|
||||||
|
|
||||||
|
// Swap by rotating counterclockwise
|
||||||
|
// Use the same objects - no deletion or new objects
|
||||||
|
EdgePtr eL = diagonal;
|
||||||
|
EdgePtr eR = eL->getTwinEdge();
|
||||||
|
EdgePtr eL_1 = eL->getNextEdgeInFace();
|
||||||
|
EdgePtr eL_2 = eL_1->getNextEdgeInFace();
|
||||||
|
EdgePtr eR_1 = eR->getNextEdgeInFace();
|
||||||
|
EdgePtr eR_2 = eR_1->getNextEdgeInFace();
|
||||||
|
|
||||||
|
// avoid node to be dereferenced to zero and deleted
|
||||||
|
NodePtr nR = eR_2->getSourceNode();
|
||||||
|
NodePtr nL = eL_2->getSourceNode();
|
||||||
|
|
||||||
|
eL->setSourceNode(nR);
|
||||||
|
eR->setSourceNode(nL);
|
||||||
|
|
||||||
|
// and now 6 1-sewings
|
||||||
|
eL->setNextEdgeInFace(eL_2);
|
||||||
|
eL_2->setNextEdgeInFace(eR_1);
|
||||||
|
eR_1->setNextEdgeInFace(eL);
|
||||||
|
|
||||||
|
eR->setNextEdgeInFace(eR_2);
|
||||||
|
eR_2->setNextEdgeInFace(eL_1);
|
||||||
|
eL_1->setNextEdgeInFace(eR);
|
||||||
|
|
||||||
|
EdgePtr leL;
|
||||||
|
if (eL->isLeadingEdge())
|
||||||
|
leL = eL;
|
||||||
|
else if (eL_1->isLeadingEdge())
|
||||||
|
leL = eL_1;
|
||||||
|
else if (eL_2->isLeadingEdge())
|
||||||
|
leL = eL_2;
|
||||||
|
|
||||||
|
EdgePtr leR;
|
||||||
|
if (eR->isLeadingEdge())
|
||||||
|
leR = eR;
|
||||||
|
else if (eR_1->isLeadingEdge())
|
||||||
|
leR = eR_1;
|
||||||
|
else if (eR_2->isLeadingEdge())
|
||||||
|
leR = eR_2;
|
||||||
|
|
||||||
|
removeLeadingEdgeFromList(leL);
|
||||||
|
removeLeadingEdgeFromList(leR);
|
||||||
|
addLeadingEdge(eL);
|
||||||
|
addLeadingEdge(eR);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
////--------------------------------------------------------------------------
|
||||||
|
//static void printEdge(const Dart& dart, ostream& ofile) {
|
||||||
|
//
|
||||||
|
// Dart d0 = dart;
|
||||||
|
// d0.alpha0();
|
||||||
|
//
|
||||||
|
// ofile << dart.x() << " " << dart.y() << endl;
|
||||||
|
// ofile << d0.x() << " " << d0.y() << endl;
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------
|
||||||
|
bool Triangulation::checkDelaunay() const {
|
||||||
|
|
||||||
|
// ???? outputs !!!!
|
||||||
|
// ofstream os("qweND.dat");
|
||||||
|
const list<EdgePtr>& leadingEdges = getLeadingEdges();
|
||||||
|
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
bool ok = true;
|
||||||
|
int noNotDelaunay = 0;
|
||||||
|
|
||||||
|
for (it = leadingEdges.begin(); it != leadingEdges.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
EdgePtr twinedge = edge->getTwinEdge();
|
||||||
|
|
||||||
|
// only one of the half-edges
|
||||||
|
if (!twinedge || (size_t)edge.get() > (size_t)twinedge.get()) {
|
||||||
|
Dart dart(edge);
|
||||||
|
if (ttl::swapTestDelaunay<TTLtraits>(dart)) {
|
||||||
|
noNotDelaunay++;
|
||||||
|
|
||||||
|
//printEdge(dart,os); os << "\n";
|
||||||
|
ok = false;
|
||||||
|
//cout << "............. not Delaunay .... " << endl;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef DEBUG_HE
|
||||||
|
cout << "!!! Triangulation is NOT Delaunay: " << noNotDelaunay << " edges\n" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::optimizeDelaunay() {
|
||||||
|
|
||||||
|
// This function is also present in ttl where it is implemented
|
||||||
|
// generically.
|
||||||
|
// The implementation below is tailored for the half-edge data structure,
|
||||||
|
// and is thus more efficient
|
||||||
|
|
||||||
|
// Collect all interior edges (one half edge for each arc)
|
||||||
|
bool skip_boundary_edges = true;
|
||||||
|
list<EdgePtr>* elist = getEdges(skip_boundary_edges);
|
||||||
|
|
||||||
|
// Assumes that elist has only one half-edge for each arc.
|
||||||
|
bool cycling_check = true;
|
||||||
|
bool optimal = false;
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
while(!optimal) {
|
||||||
|
optimal = true;
|
||||||
|
for (it = elist->begin(); it != elist->end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
Dart dart(edge);
|
||||||
|
// Constrained edges should not be swapped
|
||||||
|
if (!edge->isConstrained() && ttl::swapTestDelaunay<TTLtraits>(dart, cycling_check)) {
|
||||||
|
optimal = false;
|
||||||
|
swapEdge(edge);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
delete elist;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
EdgePtr Triangulation::getInteriorNode() const {
|
||||||
|
|
||||||
|
const list<EdgePtr>& leadingEdges = getLeadingEdges();
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
for (it = leadingEdges.begin(); it != leadingEdges.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
// multiple checks, but only until found
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
if (edge->getTwinEdge()) {
|
||||||
|
|
||||||
|
if (!ttl::isBoundaryNode(Dart(edge)))
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return EdgePtr(); // no boundary nodes
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
static EdgePtr getBoundaryEdgeInTriangle(const EdgePtr& e) {
|
||||||
|
EdgePtr edge = e;
|
||||||
|
|
||||||
|
if (ttl::isBoundaryEdge(Dart(edge)))
|
||||||
|
return edge;
|
||||||
|
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
if (ttl::isBoundaryEdge(Dart(edge)))
|
||||||
|
return edge;
|
||||||
|
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
if (ttl::isBoundaryEdge(Dart(edge)))
|
||||||
|
return edge;
|
||||||
|
|
||||||
|
return EdgePtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
EdgePtr Triangulation::getBoundaryEdge() const {
|
||||||
|
|
||||||
|
// Get an arbitrary (CCW) boundary edge
|
||||||
|
// If the triangulation is closed, NULL is returned
|
||||||
|
|
||||||
|
const list<EdgePtr>& leadingEdges = getLeadingEdges();
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
EdgePtr edge;
|
||||||
|
|
||||||
|
for (it = leadingEdges.begin(); it != leadingEdges.end(); ++it) {
|
||||||
|
edge = getBoundaryEdgeInTriangle(*it);
|
||||||
|
|
||||||
|
if (edge)
|
||||||
|
return edge;
|
||||||
|
}
|
||||||
|
return EdgePtr();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
void Triangulation::printEdges(ofstream& os) const {
|
||||||
|
|
||||||
|
// Print source node and target node for each edge face by face,
|
||||||
|
// but only one of the half-edges.
|
||||||
|
|
||||||
|
const list<EdgePtr>& leadingEdges = getLeadingEdges();
|
||||||
|
list<EdgePtr>::const_iterator it;
|
||||||
|
for (it = leadingEdges.begin(); it != leadingEdges.end(); ++it) {
|
||||||
|
EdgePtr edge = *it;
|
||||||
|
|
||||||
|
for (int i = 0; i < 3; ++i) {
|
||||||
|
EdgePtr twinedge = edge->getTwinEdge();
|
||||||
|
|
||||||
|
// Print only one edge (the highest value of the pointer)
|
||||||
|
if (!twinedge || (size_t)edge.get() > (size_t)twinedge.get()) {
|
||||||
|
// Print source node and target node
|
||||||
|
NodePtr node = edge->getSourceNode();
|
||||||
|
os << node->GetX() << " " << node->GetY() << endl;
|
||||||
|
node = edge->getTargetNode();
|
||||||
|
os << node->GetX() << " " << node->GetY() << endl;
|
||||||
|
os << '\n'; // blank line
|
||||||
|
}
|
||||||
|
edge = edge->getNextEdgeInFace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -220,9 +220,7 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool unsupported_collision = true;
|
assert( 0 ); // unsupported_collision
|
||||||
|
|
||||||
assert( unsupported_collision == false );
|
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -599,25 +599,6 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
{
|
{
|
||||||
GRSetColorPen( aDC, aColor, aWidth );
|
GRSetColorPen( aDC, aColor, aWidth );
|
||||||
|
|
||||||
#if defined( USE_WX_GRAPHICS_CONTEXT ) || defined(__WXMAC__)
|
|
||||||
wxGraphicsContext* gc = wxGraphicsContext::Create( aDC );
|
|
||||||
wxASSERT( gc );
|
|
||||||
gc->Clip( aClipBox->GetX(), aClipBox->GetY(), aClipBox->GetRight(), aClipBox->GetHeight() );
|
|
||||||
wxGraphicsPath path = gc->CreatePath();
|
|
||||||
|
|
||||||
for( unsigned i = 0; i < aLines.size(); )
|
|
||||||
{
|
|
||||||
path.MoveToPoint( aLines[i].x, aLines[i].y );
|
|
||||||
i++;
|
|
||||||
path.AddLineToPoint( aLines[i].x, aLines[i].y );
|
|
||||||
i++;
|
|
||||||
}
|
|
||||||
|
|
||||||
gc->StrokePath( path );
|
|
||||||
gc->ResetClip();
|
|
||||||
delete gc;
|
|
||||||
#else
|
|
||||||
|
|
||||||
if( aClipBox )
|
if( aClipBox )
|
||||||
aClipBox->Inflate(aWidth/2);
|
aClipBox->Inflate(aWidth/2);
|
||||||
for( unsigned i = 0; i < aLines.size(); i += 2)
|
for( unsigned i = 0; i < aLines.size(); i += 2)
|
||||||
|
@ -633,7 +614,6 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
|
||||||
}
|
}
|
||||||
if( aClipBox )
|
if( aClipBox )
|
||||||
aClipBox->Inflate(-aWidth/2);
|
aClipBox->Inflate(-aWidth/2);
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -487,7 +487,7 @@ wxString RemoveTrailingZeros( const wxString& aString )
|
||||||
while( --i > 0 && retv[i] == wxChar( '0' ) )
|
while( --i > 0 && retv[i] == wxChar( '0' ) )
|
||||||
retv.RemoveLast();
|
retv.RemoveLast();
|
||||||
|
|
||||||
if( retv[i] == wxChar( '.' ) )
|
if( retv[i] == wxChar( '.' ) || retv[i] == wxChar( ',' ) )
|
||||||
retv.RemoveLast();
|
retv.RemoveLast();
|
||||||
|
|
||||||
return retv;
|
return retv;
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
#include <utf8.h>
|
#include <utf8.h>
|
||||||
|
|
||||||
/* THROW_IO_ERROR needs this, but it will soon be including this file, so until some
|
/* THROW_IO_ERROR needs this, but it includes this file, so until some
|
||||||
factoring of THROW_IO_ERROR into a separate header, defer and use the asserts.
|
factoring of THROW_IO_ERROR into a separate header, defer and use the asserts.
|
||||||
#include <richio.h>
|
#include <richio.h>
|
||||||
*/
|
*/
|
||||||
|
@ -33,7 +33,7 @@
|
||||||
|
|
||||||
/*
|
/*
|
||||||
These are not inlined so that code space is saved by encapsulating the
|
These are not inlined so that code space is saved by encapsulating the
|
||||||
creation of intermediate objects and referencing wxConvUTF8.
|
creation of intermediate objects and the referencing of wxConvUTF8.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -84,7 +84,7 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
|
||||||
if( screen->m_FirstRedraw )
|
if( screen->m_FirstRedraw )
|
||||||
SetCrossHairPosition( GetScrollCenterPosition() );
|
SetCrossHairPosition( GetScrollCenterPosition() );
|
||||||
|
|
||||||
if( !m_galCanvasActive )
|
if( !IsGalCanvasActive() )
|
||||||
RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
|
RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -194,18 +194,18 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
|
||||||
RedrawScreen( center, true );
|
RedrawScreen( center, true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( m_galCanvasActive )
|
if( IsGalCanvasActive() )
|
||||||
{
|
{
|
||||||
// Apply computed view settings to GAL
|
// Apply computed view settings to GAL
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
KIGFX::GAL* gal = m_galCanvas->GetGAL();
|
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
|
||||||
|
|
||||||
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
|
||||||
double zoom = 1.0 / ( zoomFactor * GetZoom() );
|
double zoom = 1.0 / ( zoomFactor * GetZoom() );
|
||||||
|
|
||||||
view->SetScale( zoom );
|
view->SetScale( zoom );
|
||||||
view->SetCenter( VECTOR2D( center ) );
|
view->SetCenter( VECTOR2D( center ) );
|
||||||
m_galCanvas->Refresh();
|
GetGalCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateStatusBar();
|
UpdateStatusBar();
|
||||||
|
|
|
@ -107,6 +107,7 @@ target_link_libraries( cvpcb
|
||||||
${GDI_PLUS_LIBRARIES}
|
${GDI_PLUS_LIBRARIES}
|
||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
|
${PIXMAN_LIBRARY}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Only for win32 cross compilation using MXE
|
# Only for win32 cross compilation using MXE
|
||||||
|
|
|
@ -48,5 +48,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
install(DIRECTORY complex_hierarchy ecc83 electric flat_hierarchy
|
install( DIRECTORY complex_hierarchy
|
||||||
|
ecc83 electric flat_hierarchy
|
||||||
kit-dev-coldfire-xilinx_5213 interf_u microwave
|
kit-dev-coldfire-xilinx_5213 interf_u microwave
|
||||||
pic_programmer pspice "sonde xilinx" test_xil_95108 video
|
pic_programmer pspice "sonde xilinx" test_xil_95108 video
|
||||||
DESTINATION ${KICAD_DEMOS}
|
DESTINATION ${KICAD_DEMOS}
|
||||||
COMPONENT resources
|
COMPONENT resources
|
||||||
PATTERN ".svn" EXCLUDE)
|
)
|
||||||
|
|
|
@ -49,5 +49,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -269,8 +269,8 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||||
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
|
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
|
||||||
{
|
{
|
||||||
item = (SCH_ITEM*) aList->GetPickedItem( ii );
|
item = (SCH_ITEM*) aList->GetPickedItem( ii );
|
||||||
|
wxASSERT( item );
|
||||||
|
|
||||||
if( item )
|
|
||||||
item->ClearFlags();
|
item->ClearFlags();
|
||||||
|
|
||||||
SCH_ITEM* image = (SCH_ITEM*) aList->GetPickedItemLink( ii );
|
SCH_ITEM* image = (SCH_ITEM*) aList->GetPickedItemLink( ii );
|
||||||
|
@ -278,10 +278,6 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||||
switch( aList->GetPickedItemStatus( ii ) )
|
switch( aList->GetPickedItemStatus( ii ) )
|
||||||
{
|
{
|
||||||
case UR_CHANGED: /* Exchange old and new data for each item */
|
case UR_CHANGED: /* Exchange old and new data for each item */
|
||||||
// tmp = item->Clone();
|
|
||||||
// *item = *image;
|
|
||||||
// *image = *tmp;
|
|
||||||
// delete tmp;
|
|
||||||
item->SwapData( image );
|
item->SwapData( image );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -67,5 +67,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -71,6 +71,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
|
||||||
double paramvalue = 0.0;
|
double paramvalue = 0.0;
|
||||||
double curr_value = 0.0;
|
double curr_value = 0.0;
|
||||||
parm_item_type state = POPVALUE;
|
parm_item_type state = POPVALUE;
|
||||||
|
|
||||||
for( unsigned ii = 0; ii < m_paramStack.size(); ii++ )
|
for( unsigned ii = 0; ii < m_paramStack.size(); ii++ )
|
||||||
{
|
{
|
||||||
AM_PARAM_ITEM item = m_paramStack[ii];
|
AM_PARAM_ITEM item = m_paramStack[ii];
|
||||||
|
@ -85,13 +86,20 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
|
||||||
|
|
||||||
case PUSHPARM:
|
case PUSHPARM:
|
||||||
// get the parameter from the aDcode
|
// get the parameter from the aDcode
|
||||||
if( aDcode && item.GetIndex() <= aDcode->GetParamCount() )
|
if( aDcode ) // should be always true here
|
||||||
|
{
|
||||||
|
if( item.GetIndex() <= aDcode->GetParamCount() )
|
||||||
curr_value = aDcode->GetParam( item.GetIndex() );
|
curr_value = aDcode->GetParam( item.GetIndex() );
|
||||||
else // Get parameter from local param definition
|
else // Get parameter from local param definition
|
||||||
{
|
{
|
||||||
const APERTURE_MACRO * am_parent = aDcode->GetMacro();
|
const APERTURE_MACRO * am_parent = aDcode->GetMacro();
|
||||||
curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() );
|
curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
wxLogDebug( wxT( "AM_PARAM::GetValue(): NULL param aDcode\n" ) );
|
||||||
|
}
|
||||||
// Fall through
|
// Fall through
|
||||||
case PUSHVALUE: // a value is on the stack:
|
case PUSHVALUE: // a value is on the stack:
|
||||||
if( item.GetType() == PUSHVALUE )
|
if( item.GetType() == PUSHVALUE )
|
||||||
|
|
|
@ -275,7 +275,7 @@ public:
|
||||||
* for efficiency reasons
|
* for efficiency reasons
|
||||||
*/
|
*/
|
||||||
void GetPositionsOfLinesOfMultilineText(
|
void GetPositionsOfLinesOfMultilineText(
|
||||||
std::vector<wxPoint>& aPositions, int aLineCount );
|
std::vector<wxPoint>& aPositions, int aLineCount ) const;
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Function Format
|
||||||
* outputs the object to \a aFormatter in s-expression form.
|
* outputs the object to \a aFormatter in s-expression form.
|
||||||
|
|
|
@ -339,7 +339,7 @@ public:
|
||||||
* @param aProperties is the PROPERTIES to format or NULL. If NULL the returned
|
* @param aProperties is the PROPERTIES to format or NULL. If NULL the returned
|
||||||
* string will be empty.
|
* string will be empty.
|
||||||
*/
|
*/
|
||||||
static std::string FormatOptions( const PROPERTIES* aProperties );
|
static UTF8 FormatOptions( const PROPERTIES* aProperties );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Function Format
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
#define _FPID_H_
|
#define _FPID_H_
|
||||||
|
|
||||||
#include <richio.h>
|
#include <richio.h>
|
||||||
|
#include <utf8.h>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class FPID
|
* Class FPID
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
*
|
*
|
||||||
* @author Dick Hollenbeck
|
* @author Dick Hollenbeck
|
||||||
*/
|
*/
|
||||||
class FPID // aka GUID
|
class FPID
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ public:
|
||||||
* Function GetLibNickname
|
* Function GetLibNickname
|
||||||
* returns the logical library name portion of a FPID.
|
* returns the logical library name portion of a FPID.
|
||||||
*/
|
*/
|
||||||
const std::string& GetLibNickname() const
|
const UTF8& GetLibNickname() const
|
||||||
{
|
{
|
||||||
return nickname;
|
return nickname;
|
||||||
}
|
}
|
||||||
|
@ -108,7 +108,7 @@ public:
|
||||||
* Function GetFootprintName
|
* Function GetFootprintName
|
||||||
* returns the footprint name, i.e. footprintName.
|
* returns the footprint name, i.e. footprintName.
|
||||||
*/
|
*/
|
||||||
const std::string& GetFootprintName() const { return footprint; }
|
const UTF8& GetFootprintName() const { return footprint; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetFootprintName
|
* Function SetFootprintName
|
||||||
|
@ -120,15 +120,15 @@ public:
|
||||||
|
|
||||||
int SetRevision( const std::string& aRevision );
|
int SetRevision( const std::string& aRevision );
|
||||||
|
|
||||||
const std::string& GetRevision() const { return revision; }
|
const UTF8& GetRevision() const { return revision; }
|
||||||
|
|
||||||
std::string GetFootprintNameAndRev() const;
|
UTF8 GetFootprintNameAndRev() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Function Format
|
||||||
* returns the fully formatted text of the FPID.
|
* returns the fully formatted text of the FPID.
|
||||||
*/
|
*/
|
||||||
std::string Format() const;
|
UTF8 Format() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function Format
|
* Function Format
|
||||||
|
@ -137,7 +137,7 @@ public:
|
||||||
*
|
*
|
||||||
* @throw PARSE_ERROR if any of the pieces are illegal.
|
* @throw PARSE_ERROR if any of the pieces are illegal.
|
||||||
*/
|
*/
|
||||||
static std::string Format( const std::string& aLibNickname, const std::string& aFootprintName,
|
static UTF8 Format( const std::string& aLibNickname, const std::string& aFootprintName,
|
||||||
const std::string& aRevision )
|
const std::string& aRevision )
|
||||||
throw( PARSE_ERROR );
|
throw( PARSE_ERROR );
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ public:
|
||||||
*/
|
*/
|
||||||
int compare( const FPID& aFPID ) const;
|
int compare( const FPID& aFPID ) const;
|
||||||
|
|
||||||
bool operator <( const FPID& aFPID ) const { return this->compare( aFPID ) < 0; }
|
bool operator < ( const FPID& aFPID ) const { return this->compare( aFPID ) < 0; }
|
||||||
bool operator >( const FPID& aFPID ) const { return this->compare( aFPID ) > 0; }
|
bool operator > ( const FPID& aFPID ) const { return this->compare( aFPID ) > 0; }
|
||||||
bool operator ==( const FPID& aFPID ) const { return this->compare( aFPID ) == 0; }
|
bool operator ==( const FPID& aFPID ) const { return this->compare( aFPID ) == 0; }
|
||||||
bool operator !=( const FPID& aFPID ) const { return !(*this == aFPID); }
|
bool operator !=( const FPID& aFPID ) const { return !(*this == aFPID); }
|
||||||
|
|
||||||
|
@ -192,9 +192,9 @@ public:
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::string nickname; ///< The nickname of the footprint library or empty.
|
UTF8 nickname; ///< The nickname of the footprint library or empty.
|
||||||
std::string footprint; ///< The name of the footprint in the logical library.
|
UTF8 footprint; ///< The name of the footprint in the logical library.
|
||||||
std::string revision; ///< The footprint revision.
|
UTF8 revision; ///< The footprint revision.
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
#ifndef STROKE_FONT_H_
|
#ifndef STROKE_FONT_H_
|
||||||
#define STROKE_FONT_H_
|
#define STROKE_FONT_H_
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <deque>
|
#include <deque>
|
||||||
|
#include <utf8.h>
|
||||||
|
|
||||||
#include <eda_text.h>
|
#include <eda_text.h>
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ public:
|
||||||
* @param aPosition is the text position in world coordinates.
|
* @param aPosition is the text position in world coordinates.
|
||||||
* @param aRotationAngle is the text rotation angle.
|
* @param aRotationAngle is the text rotation angle.
|
||||||
*/
|
*/
|
||||||
void Draw( const wxString& aText, const VECTOR2D& aPosition, double aRotationAngle );
|
void Draw( const UTF8& aText, const VECTOR2D& aPosition, double aRotationAngle );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Set the glyph size.
|
* @brief Set the glyph size.
|
||||||
|
@ -173,7 +173,7 @@ private:
|
||||||
*
|
*
|
||||||
* @param aText is the text to be drawn.
|
* @param aText is the text to be drawn.
|
||||||
*/
|
*/
|
||||||
void drawSingleLineText( const wxString& aText );
|
void drawSingleLineText( const UTF8& aText );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Compute the size of a given text.
|
* @brief Compute the size of a given text.
|
||||||
|
@ -181,20 +181,19 @@ private:
|
||||||
* @param aText is the text string.
|
* @param aText is the text string.
|
||||||
* @return is the text size.
|
* @return is the text size.
|
||||||
*/
|
*/
|
||||||
VECTOR2D computeTextSize( const wxString& aText ) const;
|
VECTOR2D computeTextSize( const UTF8& aText ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns number of lines for a given text.
|
* @brief Returns number of lines for a given text.
|
||||||
*
|
*
|
||||||
* @param aText is the text to be checked.
|
* @param aText is the text to be checked.
|
||||||
* @return Number of lines of aText.
|
* @return unsigned - The number of lines in aText.
|
||||||
*/
|
*/
|
||||||
unsigned int linesCount( const wxString& aText ) const
|
unsigned linesCount( const UTF8& aText ) const
|
||||||
{
|
{
|
||||||
wxString::const_iterator it, itEnd;
|
unsigned lines = 1;
|
||||||
unsigned int lines = 1;
|
|
||||||
|
|
||||||
for( it = aText.begin(), itEnd = aText.end(); it != itEnd; ++it )
|
for( UTF8::const_iterator it = aText.begin(), itEnd = aText.end(); it != itEnd; ++it )
|
||||||
{
|
{
|
||||||
if( *it == '\n' )
|
if( *it == '\n' )
|
||||||
++lines;
|
++lines;
|
||||||
|
@ -214,4 +213,4 @@ private:
|
||||||
};
|
};
|
||||||
} // namespace KIGFX
|
} // namespace KIGFX
|
||||||
|
|
||||||
#endif /* STROKE_FONT_H_ */
|
#endif // STROKE_FONT_H_
|
||||||
|
|
|
@ -34,22 +34,22 @@ static inline wxString FROM_UTF8( const char* cstring )
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetChars
|
* Function GetChars
|
||||||
* returns a wxChar* to the actual character data within a wxString, and is
|
* returns a wxChar* to the actual wxChar* data within a wxString, and is
|
||||||
* helpful for passing strings to wxString::Printf(wxT("%s"), GetChars(wxString) )
|
* helpful for passing strings to wxString::Printf() and wxString::Format().
|
||||||
|
* It can also be passed a UTF8 parameter which will be converted to wxString
|
||||||
|
* by the compiler.
|
||||||
* <p>
|
* <p>
|
||||||
* wxChar is defined to be
|
* Example: wxString::Format( wxT( "%s" ), GetChars( UTF( "some text" ) ) );
|
||||||
|
* <p>
|
||||||
|
* When wxWidgets is properly built for KiCad, a const wxChar* points to either:
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li> standard C style char when wxUSE_UNICODE==0 </li>
|
* <li> 32 bit unicode characters on linux/OSX or </li>
|
||||||
* <li> wchar_t when wxUSE_UNICODE==1 (the default). </li>
|
* <li> 16 bit UTF16 characters on windows. </li>
|
||||||
* </ul>
|
* </ul>
|
||||||
* i.e. it depends on how the wxWidgets library was compiled.
|
* Note that you cannot pass 8 bit strings to wxString::Format() or Printf() so this
|
||||||
* ( wxUSE_UNICODE is defined in wxWidgets, inside setup.h.
|
* is a useful conversion function to wxChar*, which is needed by wxString::Format().
|
||||||
* for version >= 2.9 wxUSE_UNICODE is always defined to 1 )
|
*
|
||||||
* There was a period
|
* @return const wxChar* - a pointer to the UNICODE or UTF16 (on windows) text.
|
||||||
* during the development of wxWidgets 2.9 when GetData() was missing, so this
|
|
||||||
* function was used to provide insulation from that design change. It may
|
|
||||||
* no longer be needed, and is harmless. GetData() seems to be an acceptable
|
|
||||||
* alternative in all cases now.
|
|
||||||
*/
|
*/
|
||||||
static inline const wxChar* GetChars( const wxString& s )
|
static inline const wxChar* GetChars( const wxString& s )
|
||||||
{
|
{
|
||||||
|
|
|
@ -253,7 +253,8 @@ public:
|
||||||
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
enum EDA_TEXT_VJUSTIFY_T aV_justify,
|
||||||
int aWidth,
|
int aWidth,
|
||||||
bool aItalic,
|
bool aItalic,
|
||||||
bool aBold );
|
bool aBold,
|
||||||
|
bool aMultilineAllowed = false );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Draw a marker (used for the drill map)
|
* Draw a marker (used for the drill map)
|
||||||
|
|
|
@ -29,8 +29,8 @@
|
||||||
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
|
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
|
||||||
|
|
||||||
|
|
||||||
#include <string>
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
#include <utf8.h>
|
||||||
|
|
||||||
// I really did not want to be dependent on wxWidgets in richio
|
// I really did not want to be dependent on wxWidgets in richio
|
||||||
// but the errorText needs to be wide char so wxString rules.
|
// but the errorText needs to be wide char so wxString rules.
|
||||||
|
|
|
@ -0,0 +1,150 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HALF_EDGE_DART_
|
||||||
|
#define _HALF_EDGE_DART_
|
||||||
|
|
||||||
|
|
||||||
|
#include <ttl/halfedge/hetriang.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace hed {
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// Dart class for the half-edge data structure
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** \class Dart
|
||||||
|
* \brief \b %Dart class for the half-edge data structure.
|
||||||
|
*
|
||||||
|
* See \ref api for a detailed description of how the member functions
|
||||||
|
* should be implemented.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Dart {
|
||||||
|
|
||||||
|
EdgePtr edge_;
|
||||||
|
bool dir_; // true if dart is counterclockwise in face
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Default constructor
|
||||||
|
Dart() { dir_ = true; }
|
||||||
|
|
||||||
|
/// Constructor
|
||||||
|
Dart(const EdgePtr& edge, bool dir = true) { edge_ = edge; dir_ = dir; }
|
||||||
|
|
||||||
|
/// Copy constructor
|
||||||
|
Dart(const Dart& dart) { edge_ = dart.edge_; dir_ = dart.dir_; }
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
~Dart() {}
|
||||||
|
|
||||||
|
/// Assignment operator
|
||||||
|
Dart& operator = (const Dart& dart) {
|
||||||
|
if (this == &dart)
|
||||||
|
return *this;
|
||||||
|
edge_ = dart.edge_;
|
||||||
|
dir_ = dart.dir_;
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Comparing dart objects
|
||||||
|
bool operator==(const Dart& dart) const {
|
||||||
|
if (dart.edge_ == edge_ && dart.dir_ == dir_)
|
||||||
|
return true;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Comparing dart objects
|
||||||
|
bool operator!=(const Dart& dart) const {
|
||||||
|
return !(dart==*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Maps the dart to a different node
|
||||||
|
Dart& alpha0() { dir_ = !dir_; return *this; }
|
||||||
|
|
||||||
|
/// Maps the dart to a different edge
|
||||||
|
Dart& alpha1() {
|
||||||
|
if (dir_) {
|
||||||
|
edge_ = edge_->getNextEdgeInFace()->getNextEdgeInFace();
|
||||||
|
dir_ = false;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
edge_ = edge_->getNextEdgeInFace();
|
||||||
|
dir_ = true;
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Maps the dart to a different triangle. \b Note: the dart is not changed if it is at the boundary!
|
||||||
|
Dart& alpha2() {
|
||||||
|
if (edge_->getTwinEdge()) {
|
||||||
|
edge_ = edge_->getTwinEdge();
|
||||||
|
dir_ = !dir_;
|
||||||
|
}
|
||||||
|
// else, the dart is at the boundary and should not be changed
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Utilities not required by TTL
|
||||||
|
// -----------------------------
|
||||||
|
|
||||||
|
/** @name Utilities not required by TTL */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
void init(const EdgePtr& edge, bool dir = true) { edge_ = edge; dir_ = dir; }
|
||||||
|
|
||||||
|
double x() const { return getNode()->GetX(); } // x-coordinate of source node
|
||||||
|
double y() const { return getNode()->GetY(); } // y-coordinate of source node
|
||||||
|
|
||||||
|
bool isCounterClockWise() const { return dir_; }
|
||||||
|
|
||||||
|
const NodePtr& getNode() const { return dir_ ? edge_->getSourceNode() : edge_->getTargetNode(); }
|
||||||
|
const NodePtr& getOppositeNode() const { return dir_ ? edge_->getTargetNode() : edge_->getSourceNode(); }
|
||||||
|
EdgePtr& getEdge() { return edge_; }
|
||||||
|
|
||||||
|
//@} // End of Utilities not required by TTL
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // End of hed namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,300 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HALF_EDGE_TRAITS_
|
||||||
|
#define _HALF_EDGE_TRAITS_
|
||||||
|
|
||||||
|
|
||||||
|
#include <ttl/halfedge/hetriang.h>
|
||||||
|
#include <ttl/halfedge/hedart.h>
|
||||||
|
|
||||||
|
|
||||||
|
namespace hed {
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// Traits class for the half-edge data structure
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** \struct TTLtraits
|
||||||
|
* \brief \b Traits class (static struct) for the half-edge data structure.
|
||||||
|
*
|
||||||
|
* The member functions are those required by different function templates
|
||||||
|
* in the TTL. Documentation is given here to explain what actions
|
||||||
|
* should be carried out on the actual data structure as required by the functions
|
||||||
|
* in the \ref ttl namespace.
|
||||||
|
*
|
||||||
|
* The source code of \c %HeTraits.h shows how the traits class is implemented for the
|
||||||
|
* half-edge data structure.
|
||||||
|
*
|
||||||
|
* \see \ref api
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
struct TTLtraits {
|
||||||
|
|
||||||
|
// The actual triangulation object
|
||||||
|
static Triangulation* triang_;
|
||||||
|
|
||||||
|
/** The floating point type used in calculations
|
||||||
|
* involving scalar products and cross products.
|
||||||
|
*/
|
||||||
|
typedef double real_type;
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
// ------------------------------- Geometric Predicates Group ---------------------------------
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @name Geometric Predicates */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Scalar product between two 2D vectors represented as darts.\n
|
||||||
|
*
|
||||||
|
* ttl_util::scalarProduct2d can be used.
|
||||||
|
*/
|
||||||
|
static real_type scalarProduct2d(const Dart& v1, const Dart& v2) {
|
||||||
|
Dart v10 = v1; v10.alpha0();
|
||||||
|
Dart v20 = v2; v20.alpha0();
|
||||||
|
return ttl_util::scalarProduct2d(v10.x()-v1.x(), v10.y()-v1.y(),
|
||||||
|
v20.x()-v2.x(), v20.y()-v2.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Scalar product between two 2D vectors.
|
||||||
|
* The first vector is represented by a dart \e v, and the second
|
||||||
|
* vector has direction from the source node of \e v to the point \e p.\n
|
||||||
|
*
|
||||||
|
* ttl_util::scalarProduct2d can be used.
|
||||||
|
*/
|
||||||
|
static real_type scalarProduct2d(const Dart& v, const NodePtr& p) {
|
||||||
|
Dart d0 = v; d0.alpha0();
|
||||||
|
return ttl_util::scalarProduct2d(d0.x() - v.x(), d0.y() - v.y(),
|
||||||
|
p->GetX() - v.x(), p->GetY() - v.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Cross product between two vectors in the plane represented as darts.
|
||||||
|
* The z-component of the cross product is returned.\n
|
||||||
|
*
|
||||||
|
* ttl_util::crossProduct2d can be used.
|
||||||
|
*/
|
||||||
|
static real_type crossProduct2d(const Dart& v1, const Dart& v2) {
|
||||||
|
Dart v10 = v1; v10.alpha0();
|
||||||
|
Dart v20 = v2; v20.alpha0();
|
||||||
|
return ttl_util::crossProduct2d(v10.x()-v1.x(), v10.y()-v1.y(),
|
||||||
|
v20.x()-v2.x(), v20.y()-v2.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Cross product between two vectors in the plane.
|
||||||
|
* The first vector is represented by a dart \e v, and the second
|
||||||
|
* vector has direction from the source node of \e v to the point \e p.
|
||||||
|
* The z-component of the cross product is returned.\n
|
||||||
|
*
|
||||||
|
* ttl_util::crossProduct2d can be used.
|
||||||
|
*/
|
||||||
|
static real_type crossProduct2d(const Dart& v, const NodePtr& p) {
|
||||||
|
Dart d0 = v; d0.alpha0();
|
||||||
|
return ttl_util::crossProduct2d(d0.x() - v.x(), d0.y() - v.y(),
|
||||||
|
p->GetX() - v.x(), p->GetY() - v.y());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Let \e n1 and \e n2 be the nodes associated with two darts, and let \e p
|
||||||
|
* be a point in the plane. Return a positive value if \e n1, \e n2,
|
||||||
|
* and \e p occur in counterclockwise order; a negative value if they occur
|
||||||
|
* in clockwise order; and zero if they are collinear.
|
||||||
|
*/
|
||||||
|
static real_type orient2d(const Dart& n1, const Dart& n2, const NodePtr& p) {
|
||||||
|
real_type pa[2]; real_type pb[2]; real_type pc[2];
|
||||||
|
pa[0] = n1.x(); pa[1] = n1.y();
|
||||||
|
pb[0] = n2.x(); pb[1] = n2.y();
|
||||||
|
pc[0] = p->GetX(); pc[1] = p->GetY();
|
||||||
|
return ttl_util::orient2dfast(pa, pb, pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** This is the same predicate as represented with the function above,
|
||||||
|
* but with a slighty different interface:
|
||||||
|
* The last parameter is given as a dart where the source node of the dart
|
||||||
|
* represents a point in the plane.
|
||||||
|
* This function is required for constrained triangulation.
|
||||||
|
*/
|
||||||
|
static real_type orient2d(const Dart& n1, const Dart& n2, const Dart& p) {
|
||||||
|
real_type pa[2]; real_type pb[2]; real_type pc[2];
|
||||||
|
pa[0] = n1.x(); pa[1] = n1.y();
|
||||||
|
pb[0] = n2.x(); pb[1] = n2.y();
|
||||||
|
pc[0] = p.x(); pc[1] = p.y();
|
||||||
|
return ttl_util::orient2dfast(pa, pb, pc);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@} // End of Geometric Predicates Group
|
||||||
|
|
||||||
|
|
||||||
|
// A rationale for directing these functions to traits is:
|
||||||
|
// e.g., constraints
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/* Checks if the edge associated with \e dart should be swapped
|
||||||
|
* according to the Delaunay criterion.<br>
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* This function is also present in the TTL as ttl::swapTestDelaunay.<br>
|
||||||
|
* Thus, the function can be implemented simply as:
|
||||||
|
* \code
|
||||||
|
* { return ttl::swapTestDelaunay<TTLtraits>(dart); }
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
//static bool swapTestDelaunay(const Dart& dart) {
|
||||||
|
// return ttl::swapTestDelaunay<TTLtraits>(dart);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/* Checks if the edge associated with \e dart can be swapped, i.e.,
|
||||||
|
* if the edge is a diagonal in a (strictly) convex quadrilateral.
|
||||||
|
* This function is also present as ttl::swappableEdge.
|
||||||
|
*/
|
||||||
|
//static bool swappableEdge(const Dart& dart) {
|
||||||
|
// return ttl::swappableEdge<TTLtraits>(dart);
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/* Checks if the edge associated with \e dart should be \e fixed, meaning
|
||||||
|
* that it should never be swapped. ??? Use when constraints.
|
||||||
|
*/
|
||||||
|
//static bool fixedEdge(const Dart& dart) {
|
||||||
|
// return dart.getEdge()->isConstrained();
|
||||||
|
//}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
// ----------------------- Functions for Delaunay Triangulation Group -------------------------
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @name Functions for Delaunay Triangulation */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Swaps the edge associated with \e dart in the actual data structure.
|
||||||
|
*
|
||||||
|
* <center>
|
||||||
|
* \image html swapEdge.gif
|
||||||
|
* </center>
|
||||||
|
*
|
||||||
|
* \param dart
|
||||||
|
* Some of the functions require a dart as output.
|
||||||
|
* If this is required by the actual function, the dart should be delivered
|
||||||
|
* back in a position as seen if it was glued to the edge when swapping (rotating)
|
||||||
|
* the edge CCW; see the figure.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* - If the edge is \e constrained, or if it should not be swapped for
|
||||||
|
* some other reason, this function need not do the actual swap of the edge.
|
||||||
|
* - Some functions in TTL require that \c swapEdge is implemented such that
|
||||||
|
* darts outside the quadrilateral are not affected by the swap.
|
||||||
|
*/
|
||||||
|
static void swapEdge(Dart& dart) {
|
||||||
|
if (!dart.getEdge()->isConstrained()) triang_->swapEdge(dart.getEdge());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Splits the triangle associated with \e dart in the actual data structure into
|
||||||
|
* three new triangles joining at \e point.
|
||||||
|
*
|
||||||
|
* <center>
|
||||||
|
* \image html splitTriangle.gif
|
||||||
|
* </center>
|
||||||
|
*
|
||||||
|
* \param dart
|
||||||
|
* Output: A CCW dart incident with the new node; see the figure.
|
||||||
|
*/
|
||||||
|
static void splitTriangle(Dart& dart, NodePtr point) {
|
||||||
|
EdgePtr edge = triang_->splitTriangle(dart.getEdge(), point);
|
||||||
|
dart.init(edge);
|
||||||
|
}
|
||||||
|
|
||||||
|
//@} // End of Functions for Delaunay Triangulation group
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
// --------------------------- Functions for removing nodes Group -----------------------------
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @name Functions for removing nodes */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** The reverse operation of TTLtraits::splitTriangle.
|
||||||
|
* This function is only required for functions that involve
|
||||||
|
* removal of interior nodes; see for example ttl::removeInteriorNode.
|
||||||
|
*
|
||||||
|
* <center>
|
||||||
|
* \image html reverse_splitTriangle.gif
|
||||||
|
* </center>
|
||||||
|
*/
|
||||||
|
static void reverse_splitTriangle(Dart& dart) {
|
||||||
|
triang_->reverse_splitTriangle(dart.getEdge());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//----------------------------------------------------------------------------------------------
|
||||||
|
/** Removes a triangle with an edge at the boundary of the triangulation
|
||||||
|
* in the actual data structure
|
||||||
|
*/
|
||||||
|
static void removeBoundaryTriangle(Dart& d) {
|
||||||
|
triang_->removeTriangle(d.getEdge());
|
||||||
|
}
|
||||||
|
|
||||||
|
//@} // End of Functions for removing nodes Group
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
}; // End of hed namespace
|
||||||
|
|
||||||
|
#endif
|
|
@ -0,0 +1,334 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
* Copyright (C) 2013 CERN
|
||||||
|
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _HE_TRIANG_H_
|
||||||
|
#define _HE_TRIANG_H_
|
||||||
|
|
||||||
|
|
||||||
|
#define TTL_USE_NODE_ID // Each node gets it's own unique id
|
||||||
|
#define TTL_USE_NODE_FLAG // Each node gets a flag (can be set to true or false)
|
||||||
|
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <vector>
|
||||||
|
#include <iostream>
|
||||||
|
#include <fstream>
|
||||||
|
#include <ttl/ttl.h>
|
||||||
|
#include <ttl/ttl_util.h>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
|
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
// The half-edge data structure
|
||||||
|
//--------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace hed {
|
||||||
|
// Helper typedefs
|
||||||
|
class Node;
|
||||||
|
class Edge;
|
||||||
|
typedef boost::shared_ptr<Node> NodePtr;
|
||||||
|
typedef boost::shared_ptr<Edge> EdgePtr;
|
||||||
|
typedef std::vector<NodePtr> NodesContainer;
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// Node class for data structures
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** \class Node
|
||||||
|
* \brief \b Node class for data structures (Inherits from HandleId)
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* - To enable node IDs, TTL_USE_NODE_ID must be defined.
|
||||||
|
* - To enable node flags, TTL_USE_NODE_FLAG must be defined.
|
||||||
|
* - TTL_USE_NODE_ID and TTL_USE_NODE_FLAG should only be enabled if this functionality is
|
||||||
|
* required by the application, because they increase the memory usage for each Node object.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Node {
|
||||||
|
|
||||||
|
protected:
|
||||||
|
#ifdef TTL_USE_NODE_FLAG
|
||||||
|
/// TTL_USE_NODE_FLAG must be defined
|
||||||
|
bool flag_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_ID
|
||||||
|
/// TTL_USE_NODE_ID must be defined
|
||||||
|
static int id_count;
|
||||||
|
|
||||||
|
/// A unique id for each node (TTL_USE_NODE_ID must be defined)
|
||||||
|
int id_;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int x_, y_;
|
||||||
|
|
||||||
|
unsigned int refCount_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Constructor
|
||||||
|
Node( int x = 0, int y = 0 ) :
|
||||||
|
#ifdef TTL_USE_NODE_FLAG
|
||||||
|
flag_( false ),
|
||||||
|
#endif
|
||||||
|
#ifdef TTL_USE_NODE_ID
|
||||||
|
id_( id_count++ ),
|
||||||
|
#endif
|
||||||
|
x_( x ), y_( y ), refCount_( 0 ) {}
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
~Node() {}
|
||||||
|
|
||||||
|
/// Returns the x-coordinate
|
||||||
|
int GetX() const { return x_; }
|
||||||
|
|
||||||
|
/// Returns the y-coordinate
|
||||||
|
int GetY() const { return y_; }
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_ID
|
||||||
|
/// Returns the id (TTL_USE_NODE_ID must be defined)
|
||||||
|
int Id() const { return id_; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_FLAG
|
||||||
|
/// Sets the flag (TTL_USE_NODE_FLAG must be defined)
|
||||||
|
void SetFlag(bool aFlag) { flag_ = aFlag; }
|
||||||
|
|
||||||
|
/// Returns the flag (TTL_USE_NODE_FLAG must be defined)
|
||||||
|
const bool& GetFlag() const { return flag_; }
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void IncRefCount() { refCount_++; }
|
||||||
|
void DecRefCount() { refCount_--; }
|
||||||
|
unsigned int GetRefCount() const { return refCount_; }
|
||||||
|
}; // End of class Node
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// Edge class in the half-edge data structure
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** \class Edge
|
||||||
|
* \brief \b %Edge class in the in the half-edge data structure.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Edge {
|
||||||
|
public:
|
||||||
|
/// Constructor
|
||||||
|
Edge() : weight_(0)
|
||||||
|
{ flags_.isLeadingEdge_ = false; flags_.isConstrained_ = false; }
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
virtual ~Edge() {}
|
||||||
|
|
||||||
|
/// Sets the source node
|
||||||
|
void setSourceNode(const NodePtr& node) { sourceNode_ = node; }
|
||||||
|
|
||||||
|
/// Sets the next edge in face
|
||||||
|
void setNextEdgeInFace(const EdgePtr& edge) { nextEdgeInFace_ = edge; }
|
||||||
|
|
||||||
|
/// Sets the twin edge
|
||||||
|
void setTwinEdge(const EdgePtr& edge) { twinEdge_ = edge; }
|
||||||
|
|
||||||
|
/// Sets the edge as a leading edge
|
||||||
|
void setAsLeadingEdge(bool val=true) { flags_.isLeadingEdge_ = val; }
|
||||||
|
|
||||||
|
/// Checks if an edge is a leading edge
|
||||||
|
bool isLeadingEdge() const { return flags_.isLeadingEdge_; }
|
||||||
|
|
||||||
|
/// Sets the edge as a constrained edge
|
||||||
|
void setConstrained(bool val=true) { flags_.isConstrained_ = val;
|
||||||
|
if (twinEdge_) twinEdge_->flags_.isConstrained_ = val; }
|
||||||
|
|
||||||
|
/// Checks if an edge is constrained
|
||||||
|
bool isConstrained() const { return flags_.isConstrained_; }
|
||||||
|
|
||||||
|
/// Returns the twin edge
|
||||||
|
const EdgePtr& getTwinEdge() const { return twinEdge_; };
|
||||||
|
|
||||||
|
/// Returns the next edge in face
|
||||||
|
const EdgePtr& getNextEdgeInFace() const { return nextEdgeInFace_; }
|
||||||
|
|
||||||
|
/// Retuns the source node
|
||||||
|
virtual const NodePtr& getSourceNode() const { return sourceNode_; }
|
||||||
|
|
||||||
|
/// Returns the target node
|
||||||
|
virtual const NodePtr& getTargetNode() const { return getNextEdgeInFace()->getSourceNode(); }
|
||||||
|
|
||||||
|
void setWeight( unsigned int weight ) { weight_ = weight; }
|
||||||
|
|
||||||
|
unsigned int getWeight() const { return weight_; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
NodePtr sourceNode_;
|
||||||
|
EdgePtr twinEdge_;
|
||||||
|
EdgePtr nextEdgeInFace_;
|
||||||
|
unsigned int weight_;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
bool isLeadingEdge_;
|
||||||
|
bool isConstrained_;
|
||||||
|
} flags_;
|
||||||
|
}; // End of class Edge
|
||||||
|
|
||||||
|
|
||||||
|
/** \class EdgeMST
|
||||||
|
* \brief \b %Specialization of Edge class to be used for Minimum Spanning Tree algorithm.
|
||||||
|
*/
|
||||||
|
class EdgeMST : public Edge
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
NodePtr target_;
|
||||||
|
|
||||||
|
public:
|
||||||
|
EdgeMST( const NodePtr& source, const NodePtr& target, unsigned int weight = 0 ) :
|
||||||
|
target_(target)
|
||||||
|
{ sourceNode_ = source; weight_ = weight; }
|
||||||
|
|
||||||
|
~EdgeMST() {};
|
||||||
|
|
||||||
|
/// @copydoc Edge::setSourceNode()
|
||||||
|
const NodePtr& getTargetNode() const { return target_; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
class Dart; // Forward declaration (class in this namespace)
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// Triangulation class in the half-edge data structure
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** \class Triangulation
|
||||||
|
* \brief \b %Triangulation class for the half-edge data structure with adaption to TTL.
|
||||||
|
*/
|
||||||
|
|
||||||
|
class Triangulation {
|
||||||
|
|
||||||
|
protected:
|
||||||
|
list<EdgePtr> leadingEdges_; // one half-edge for each arc
|
||||||
|
void addLeadingEdge(EdgePtr& edge) {
|
||||||
|
edge->setAsLeadingEdge();
|
||||||
|
leadingEdges_.push_front( edge );
|
||||||
|
}
|
||||||
|
bool removeLeadingEdgeFromList(EdgePtr& leadingEdge);
|
||||||
|
void cleanAll();
|
||||||
|
|
||||||
|
public:
|
||||||
|
/// Default constructor
|
||||||
|
Triangulation() {}
|
||||||
|
|
||||||
|
/// Copy constructor
|
||||||
|
Triangulation(const Triangulation& tr) {
|
||||||
|
std::cout << "Triangulation: Copy constructor not present - EXIT.";
|
||||||
|
exit(-1);
|
||||||
|
}
|
||||||
|
|
||||||
|
/// Destructor
|
||||||
|
~Triangulation() { cleanAll(); }
|
||||||
|
|
||||||
|
/// Creates a Delaunay triangulation from a set of points
|
||||||
|
void createDelaunay(NodesContainer::iterator first,
|
||||||
|
NodesContainer::iterator last);
|
||||||
|
|
||||||
|
/// Creates an initial Delaunay triangulation from two enclosing triangles
|
||||||
|
// When using rectangular boundary - loop through all points and expand.
|
||||||
|
// (Called from createDelaunay(...) when starting)
|
||||||
|
EdgePtr initTwoEnclosingTriangles(NodesContainer::iterator first,
|
||||||
|
NodesContainer::iterator last);
|
||||||
|
|
||||||
|
|
||||||
|
// These two functions are required by TTL for Delaunay triangulation
|
||||||
|
|
||||||
|
/// Swaps the edge associated with diagonal
|
||||||
|
void swapEdge(EdgePtr& diagonal);
|
||||||
|
|
||||||
|
/// Splits the triangle associated with edge into three new triangles joining at point
|
||||||
|
EdgePtr splitTriangle(EdgePtr& edge, NodePtr& point);
|
||||||
|
|
||||||
|
|
||||||
|
// Functions required by TTL for removing nodes in a Delaunay triangulation
|
||||||
|
|
||||||
|
/// Removes the boundary triangle associated with edge
|
||||||
|
void removeTriangle(EdgePtr& edge); // boundary triangle required
|
||||||
|
|
||||||
|
/// The reverse operation of removeTriangle
|
||||||
|
void reverse_splitTriangle(EdgePtr& edge);
|
||||||
|
|
||||||
|
/// Creates an arbitrary CCW dart
|
||||||
|
Dart createDart();
|
||||||
|
|
||||||
|
/// Returns a list of "triangles" (one leading half-edge for each triangle)
|
||||||
|
const list<EdgePtr>& getLeadingEdges() const { return leadingEdges_; }
|
||||||
|
|
||||||
|
/// Returns the number of triangles
|
||||||
|
int noTriangles() const { return (int)leadingEdges_.size(); }
|
||||||
|
|
||||||
|
/// Returns a list of half-edges (one half-edge for each arc)
|
||||||
|
list<EdgePtr>* getEdges(bool skip_boundary_edges = false) const;
|
||||||
|
|
||||||
|
#ifdef TTL_USE_NODE_FLAG
|
||||||
|
/// Sets flag in all the nodes
|
||||||
|
void flagNodes(bool flag) const;
|
||||||
|
|
||||||
|
/// Returns a list of nodes. This function requires TTL_USE_NODE_FLAG to be defined. \see Node.
|
||||||
|
list<NodePtr>* getNodes() const;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/// Swaps edges until the triangulation is Delaunay (constrained edges are not swapped)
|
||||||
|
void optimizeDelaunay();
|
||||||
|
|
||||||
|
/// Checks if the triangulation is Delaunay
|
||||||
|
bool checkDelaunay() const;
|
||||||
|
|
||||||
|
/// Returns an arbitrary interior node (as the source node of the returned edge)
|
||||||
|
EdgePtr getInteriorNode() const;
|
||||||
|
|
||||||
|
/// Returns an arbitrary boundary edge
|
||||||
|
EdgePtr getBoundaryEdge() const;
|
||||||
|
|
||||||
|
/// Print edges for plotting with, e.g., gnuplot
|
||||||
|
void printEdges(std::ofstream& os) const;
|
||||||
|
|
||||||
|
}; // End of class Triangulation
|
||||||
|
|
||||||
|
|
||||||
|
}; // End of hed namespace
|
||||||
|
|
||||||
|
#endif
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,632 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TTL_CONSTR_H_
|
||||||
|
#define _TTL_CONSTR_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <cmath>
|
||||||
|
|
||||||
|
|
||||||
|
// Debugging
|
||||||
|
#ifdef DEBUG_TTL_CONSTR_PLOT
|
||||||
|
#include <fstream>
|
||||||
|
static ofstream ofile_constr("qweCons.dat");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//using namespace std;
|
||||||
|
|
||||||
|
/** \brief Constrained Delaunay triangulation
|
||||||
|
*
|
||||||
|
* Basic generic algorithms in TTL for inserting a constrained edge between two existing nodes.\n
|
||||||
|
*
|
||||||
|
* See documentation for the namespace ttl for general requirements and assumptions.
|
||||||
|
*
|
||||||
|
* \author
|
||||||
|
* Øyvind Hjelle, oyvindhj@ifi.uio.no
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace ttl_constr {
|
||||||
|
|
||||||
|
// ??? A constant used to evluate a numerical expression against a user spesified
|
||||||
|
// roundoff-zero number
|
||||||
|
#ifdef DEBUG_TTL_CONSTR
|
||||||
|
static const double ROUNDOFFZERO = 0.0; // 0.1e-15;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/* Checks if \e dart has start and end points in \e dstart and \e dend.
|
||||||
|
*
|
||||||
|
* \param dart
|
||||||
|
* The dart that should be controlled to see if it's the constraint
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart with the startnode of the constraint as the startnode
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart with the endnode of the constraint as the startnode
|
||||||
|
*
|
||||||
|
* \retval bool
|
||||||
|
* A bool confirming that it's the constraint or not
|
||||||
|
*
|
||||||
|
* \using
|
||||||
|
* ttl::same_0_orbit
|
||||||
|
*/
|
||||||
|
template <class DartType>
|
||||||
|
bool isTheConstraint(const DartType& dart, const DartType& dstart, const DartType& dend) {
|
||||||
|
DartType d0 = dart;
|
||||||
|
d0.alpha0(); // CW
|
||||||
|
if ((ttl::same_0_orbit(dstart, dart) && ttl::same_0_orbit(dend, d0)) ||
|
||||||
|
(ttl::same_0_orbit(dstart, d0) && ttl::same_0_orbit(dend, dart))) {
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/* Checks if \e d1 and \e d2 are on the same side of the line between \e dstart and \e dend.
|
||||||
|
* (The start nodes of \e d1 and \e d2 represent an edge).
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart with the start node of the constraint as the source node of the dart.
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart with the end node of the constraint as the source node of the dart.
|
||||||
|
*
|
||||||
|
* \param d1
|
||||||
|
* A CCW dart with the first node as the start node of the dart.
|
||||||
|
*
|
||||||
|
* \param d2
|
||||||
|
* A CCW dart with the other node as the start node of the dart.
|
||||||
|
*
|
||||||
|
* \using
|
||||||
|
* TraitsType::orient2d
|
||||||
|
*/
|
||||||
|
template <class TraitsType, class DartType>
|
||||||
|
bool crossesConstraint(DartType& dstart, DartType& dend, DartType& d1, DartType& d2) {
|
||||||
|
|
||||||
|
typename TraitsType::real_type orient_1 = TraitsType::orient2d(dstart,d1,dend);
|
||||||
|
typename TraitsType::real_type orient_2 = TraitsType::orient2d(dstart,d2,dend);
|
||||||
|
// ??? Should we refine this? e.g. find if (dstart,dend) (d1,d2) represent the same edge
|
||||||
|
if ((orient_1 <= 0 && orient_2 <= 0) || (orient_1 >= 0 && orient_2 >= 0))
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/* Return the dart \e d making the smallest non-negative angle,
|
||||||
|
* as calculated with: orient2d(dstart, d.alpha0(), dend),
|
||||||
|
* at the 0-orbit of dstart.
|
||||||
|
* If (dstart,dend) is a CCW boundary edge \e d will be CW, otherwise CCW (since CCW in)
|
||||||
|
* at the 0-orbit of dstart.
|
||||||
|
*
|
||||||
|
* \par Assumes:
|
||||||
|
* - CCW dstart and dend, but returned dart can be CW at the boundary.
|
||||||
|
* - Boundary is convex?
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart dstart
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart dend
|
||||||
|
*
|
||||||
|
* \retval DartType
|
||||||
|
* The dart \e d making the smallest positive (or == 0) angle
|
||||||
|
*
|
||||||
|
* \using
|
||||||
|
* ttl::isBoundaryNode
|
||||||
|
* ttl::positionAtNextBoundaryEdge
|
||||||
|
* TraitsType::orient2d
|
||||||
|
*/
|
||||||
|
template <class TraitsType, class DartType>
|
||||||
|
DartType getAtSmallestAngle(const DartType& dstart, const DartType& dend) {
|
||||||
|
|
||||||
|
// - Must boundary be convex???
|
||||||
|
// - Handle the case where the constraint is already present???
|
||||||
|
// - Handle dstart and/or dend at the boundary
|
||||||
|
// (dstart and dend may define a boundary edge)
|
||||||
|
|
||||||
|
DartType d_iter = dstart;
|
||||||
|
if (ttl::isBoundaryNode(d_iter)) {
|
||||||
|
d_iter.alpha1(); // CW
|
||||||
|
ttl::positionAtNextBoundaryEdge(d_iter); // CCW (was rotated CW to the boundary)
|
||||||
|
}
|
||||||
|
|
||||||
|
// assume convex boundary; see comments
|
||||||
|
|
||||||
|
DartType d0 = d_iter;
|
||||||
|
d0.alpha0();
|
||||||
|
bool ccw = true; // the rotation later
|
||||||
|
typename TraitsType::real_type o_iter = TraitsType::orient2d(d_iter, d0, dend);
|
||||||
|
if (o_iter == 0) { // collinear BUT can be on "back side"
|
||||||
|
d0.alpha1().alpha0(); // CW
|
||||||
|
if (TraitsType::orient2d(dstart, dend, d0) > 0)
|
||||||
|
return d_iter; //(=dstart) collinear
|
||||||
|
else {
|
||||||
|
// collinear on "back side"
|
||||||
|
d_iter.alpha1().alpha2(); // assume convex boundary
|
||||||
|
ccw = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (o_iter < 0) {
|
||||||
|
// Prepare for rotating CW and with d_iter CW
|
||||||
|
d_iter.alpha1();
|
||||||
|
ccw = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Set first angle
|
||||||
|
d0 = d_iter; d0.alpha0();
|
||||||
|
o_iter = TraitsType::orient2d(dstart, d0, dend);
|
||||||
|
|
||||||
|
typename TraitsType::real_type o_next;
|
||||||
|
|
||||||
|
// Rotate towards the constraint CCW or CW.
|
||||||
|
// Here we assume that the boundary is convex.
|
||||||
|
DartType d_next = d_iter;
|
||||||
|
for (;;) {
|
||||||
|
d_next.alpha1(); // CW !!! (if ccw == true)
|
||||||
|
d0 = d_next; d0.alpha0();
|
||||||
|
o_next = TraitsType::orient2d(dstart, d0, dend);
|
||||||
|
|
||||||
|
if (ccw && o_next < 0) // and o_iter > 0
|
||||||
|
return d_iter;
|
||||||
|
else if (!ccw && o_next > 0)
|
||||||
|
return d_next; // CCW
|
||||||
|
else if (o_next == 0) {
|
||||||
|
if (ccw)
|
||||||
|
return d_next.alpha2(); // also ok if boundary
|
||||||
|
else
|
||||||
|
return d_next;
|
||||||
|
}
|
||||||
|
|
||||||
|
// prepare next
|
||||||
|
d_next.alpha2(); // CCW if ccw
|
||||||
|
d_iter = d_next; // also ok if boundary CCW if ccw == true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/* This function finds all the edges in the triangulation crossing
|
||||||
|
* the spesified constraint and puts them in a list.
|
||||||
|
* In the case of collinearity, an attempt is made to detect this.
|
||||||
|
* The first collinear node between dstart and dend is then returned.
|
||||||
|
*
|
||||||
|
* Strategy:
|
||||||
|
* - Iterate such that \e d_iter is always strictly "below" the constraint
|
||||||
|
* as seen with \e dstart to the left and \e dend to the right.
|
||||||
|
* - Add CCW darts, whose edges intersect the constrait, to a list.
|
||||||
|
* These edges are found by the orient2d predicate:
|
||||||
|
* If two nodes of an edge are on opposite sides of the constraint,
|
||||||
|
* the edge between them intersect.
|
||||||
|
* - Must handle collinnear cases, i.e., if a node falls on the constraint,
|
||||||
|
* and possibly restarting collection of edges. Detecting collinearity
|
||||||
|
* heavily relies on the orient2d predicate which is provided by the
|
||||||
|
* traits class.
|
||||||
|
*
|
||||||
|
* Action:
|
||||||
|
* 1) Find cone/opening angle containing \e dstart and \e dend
|
||||||
|
* 2) Find first edge from the first 0-orbit that intersects
|
||||||
|
* 3) Check which of the two opposite that intersects
|
||||||
|
*
|
||||||
|
* 1)
|
||||||
|
* Rotate CCW and find the (only) case where \e d_iter and \e d_next satisfy:
|
||||||
|
* - orient2d(d_iter, d_iter.alpha0(), dend) > 0
|
||||||
|
* - orient2d(d_next, d_next.alpha0(), dend) < 0
|
||||||
|
*
|
||||||
|
* - check if we are done, i.e., if (d_next.alpha0() == my_dend)
|
||||||
|
* - Note also the situation if, e.g., the constraint is a boundary edge in which case
|
||||||
|
* \e my_dend wil be CW
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart with the startnode of the constraint as the startnode
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart with the endnode of the constraint as the startnode
|
||||||
|
*
|
||||||
|
* \param elist
|
||||||
|
* A list where all the edges crossing the spesified constraint will be put
|
||||||
|
*
|
||||||
|
* \retval dartType
|
||||||
|
* Returns the next "collinear" starting node such that dend is returned when done.
|
||||||
|
*/
|
||||||
|
template <class TraitsType, class DartType, class ListType>
|
||||||
|
DartType findCrossingEdges(const DartType& dstart, const DartType& dend, ListType& elist) {
|
||||||
|
|
||||||
|
const DartType my_start = getAtSmallestAngle<TraitsType>(dstart, dend);
|
||||||
|
DartType my_end = getAtSmallestAngle<TraitsType>(dend, dstart);
|
||||||
|
|
||||||
|
DartType d_iter = my_start;
|
||||||
|
if (d_iter.alpha0().alpha2() == my_end)
|
||||||
|
return d_iter; // The constraint is an existing edge and we are done
|
||||||
|
|
||||||
|
// Facts/status so far:
|
||||||
|
// - my_start and my_end are now both CCW and the constraint is not a boundary edge.
|
||||||
|
// - Further, the constraint is not one single existing edge, but it might be a collection
|
||||||
|
// of collinear edges in which case we return the current collinear edge
|
||||||
|
// and calling this function until all are collected.
|
||||||
|
|
||||||
|
my_end.alpha1(); // CW! // ??? this is probably ok for testing now?
|
||||||
|
|
||||||
|
d_iter = my_start;
|
||||||
|
d_iter.alpha0().alpha1(); // alpha0 is downwards or along the constraint
|
||||||
|
|
||||||
|
// Facts:
|
||||||
|
// - d_iter is guaranteed to intersect, but can be in start point.
|
||||||
|
// - d_iter.alpha0() is not at dend yet
|
||||||
|
typename TraitsType::real_type orient = TraitsType::orient2d(dstart, d_iter, dend);
|
||||||
|
|
||||||
|
// Use round-off error/tolerance or rely on the orient2d predicate ???
|
||||||
|
// Make a warning message if orient != exact 0
|
||||||
|
if (orient == 0)
|
||||||
|
return d_iter;
|
||||||
|
|
||||||
|
#ifdef DEBUG_TTL_CONSTR
|
||||||
|
else if (fabs(orient) <= ROUNDOFFZERO) {
|
||||||
|
cout << "The darts are not exactly colinear, but |d1 x d2| <= " << ROUNDOFFZERO << endl;
|
||||||
|
return d_iter; // collinear, not done (and not collect in the list)
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Collect intersecting edges
|
||||||
|
// --------------------------
|
||||||
|
elist.push_back(d_iter); // The first with interior intersection point
|
||||||
|
|
||||||
|
// Facts, status so far:
|
||||||
|
// - The first intersecting edge is now collected
|
||||||
|
// (- d_iter.alpha0() is still not at dend)
|
||||||
|
|
||||||
|
// d_iter should always be the edge that intersects and be below or on the constraint
|
||||||
|
// One of the two edges opposite to d_iter must intersect, or we have collinearity
|
||||||
|
|
||||||
|
// Note: Almost collinear cases can be handled on the
|
||||||
|
// application side with orient2d. We should probably
|
||||||
|
// return an int and the application will set it to zero
|
||||||
|
for(;;) {
|
||||||
|
// assume orient have been calc. and collinearity has been tested,
|
||||||
|
// above the first time and below later
|
||||||
|
d_iter.alpha2().alpha1(); // 2a same node
|
||||||
|
|
||||||
|
DartType d0 = d_iter;
|
||||||
|
d0.alpha0(); // CW
|
||||||
|
if (d0 == my_end)
|
||||||
|
return dend; // WE ARE DONE (but can we enter an endless loop???)
|
||||||
|
|
||||||
|
// d_iter or d_iter.alpha0().alpha1() must intersect
|
||||||
|
orient = TraitsType::orient2d(dstart, d0, dend);
|
||||||
|
|
||||||
|
if (orient == 0)
|
||||||
|
return d0.alpha1();
|
||||||
|
|
||||||
|
#ifdef DEBUG_TTL_CONSTR
|
||||||
|
else if (fabs(orient) <= ROUNDOFFZERO) {
|
||||||
|
return d0.alpha1(); // CCW, collinear
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
else if (orient > 0) { // orient > 0 and still below
|
||||||
|
// This one must intersect!
|
||||||
|
d_iter = d0.alpha1();
|
||||||
|
}
|
||||||
|
elist.push_back(d_iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/* This function recives a constrained edge and a list of all the edges crossing a constraint.
|
||||||
|
* It then swaps the crossing edges away from the constraint. This is done according to a
|
||||||
|
* scheme suggested by Dyn, Goren & Rippa (slightly modified).
|
||||||
|
* The resulting triangulation is a constrained one, but not necessarily constrained Delaunay.
|
||||||
|
* In other to run optimization later to obtain a constrained Delaunay triangulation,
|
||||||
|
* the swapped edges are maintained in a list.
|
||||||
|
*
|
||||||
|
* Strategy :
|
||||||
|
* - Situation A: Run through the list and swap crossing edges away from the constraint.
|
||||||
|
* All the swapped edges are moved to the end of the list, and are "invisible" to this procedure.
|
||||||
|
* - Situation B: We may come in a situation where none of the crossing edges can be swapped away
|
||||||
|
* from the constraint.
|
||||||
|
* Then we follow the strategy of Dyn, Goren & Rippa and allow edges to be swapped,
|
||||||
|
* even if they are not swapped away from the constraint.
|
||||||
|
* These edges are NOT moved to the end of the list. They are later swapped to none-crossing
|
||||||
|
* edges when the locked situation is solved.
|
||||||
|
* - We keep on swapping edges in Situation B until we have iterated trough the list.
|
||||||
|
* We then resume Situation A.
|
||||||
|
* - This is done until the list is virtualy empty. The resulting \c elist has the constraint
|
||||||
|
* as the last element.
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart dstart
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart dend
|
||||||
|
*
|
||||||
|
* \param elist
|
||||||
|
* A list containing all the edges crossing the spesified constraint
|
||||||
|
*
|
||||||
|
* \using
|
||||||
|
* ttl::swappableEdge
|
||||||
|
* ttl::swapEdgeInList
|
||||||
|
* ttl::crossesConstraint
|
||||||
|
* ttl::isTheConstraint
|
||||||
|
*/
|
||||||
|
template <class TraitsType, class DartType>
|
||||||
|
void transformToConstraint(DartType& dstart, DartType& dend, std::list<DartType>& elist) {
|
||||||
|
|
||||||
|
typename list<DartType>::iterator it, used;
|
||||||
|
|
||||||
|
// We may enter in a situation where dstart and dend are altered because of a swap.
|
||||||
|
// (The general rule is that darts inside the actual quadrilateral can be changed,
|
||||||
|
// but not those outside.)
|
||||||
|
// So, we need some look-ahead strategies for dstart and dend and change these
|
||||||
|
// after a swap if necessary.
|
||||||
|
|
||||||
|
int dartsInList = (int)elist.size();
|
||||||
|
if (dartsInList == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool erase; // indicates if an edge is swapped away from the constraint such that it can be
|
||||||
|
// moved to the back of the list
|
||||||
|
bool locked = false;
|
||||||
|
do {
|
||||||
|
int noswap = 0;
|
||||||
|
it = elist.begin();
|
||||||
|
|
||||||
|
// counts how many edges that have been swapped per list-cycle
|
||||||
|
int counter = 1;
|
||||||
|
while(it != elist.end()) { // ??? change this test with counter > dartsInList
|
||||||
|
erase = false;
|
||||||
|
// Check if our virtual end of the list has been crossed. It breaks the
|
||||||
|
// while and starts all over again in the do-while loop
|
||||||
|
if (counter > dartsInList)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (ttl::swappableEdge<TraitsType, DartType>(*it, true)) {
|
||||||
|
// Dyn & Goren & Rippa 's notation:
|
||||||
|
// The node assosiated with dart *it is denoted u_m. u_m has edges crossing the constraint
|
||||||
|
// named w_1, ... , w_r . The other node to the edge assosiated with dart *it is w_s.
|
||||||
|
// We want to swap from edge u_m<->w_s to edge w_{s-1}<->w_{s+1}.
|
||||||
|
DartType op1 = *it;
|
||||||
|
DartType op2 = op1;
|
||||||
|
op1.alpha1().alpha0(); //finds dart with node w_{s-1}
|
||||||
|
op2.alpha2().alpha1().alpha0(); // (CW) finds dart with node w_{s+1}
|
||||||
|
DartType tmp = *it; tmp.alpha0(); // Dart with assosiated node opposite to node of *it allong edge
|
||||||
|
// If there is a locked situation we swap, even if the result is crossing the constraint
|
||||||
|
// If there is a looked situation, but we do an ordinary swap, it should be treated as
|
||||||
|
// if we were not in a locked situation!!
|
||||||
|
|
||||||
|
// The flag swap_away indicates if the edge is swapped away from the constraint such that
|
||||||
|
// it does not cross the constraint.
|
||||||
|
bool swap_away = (crossesConstraint<TraitsType>(dstart, dend, *it, tmp) &&
|
||||||
|
!crossesConstraint<TraitsType>(dstart, dend, op1, op2));
|
||||||
|
if (swap_away || locked) {
|
||||||
|
// Do a look-ahead to see if dstart and/or dend are in the quadrilateral
|
||||||
|
// If so, we mark it with a flag to make sure we update them after the swap
|
||||||
|
// (they may have been changed during the swap according to the general rule!)
|
||||||
|
bool start = false;
|
||||||
|
bool end = false;
|
||||||
|
|
||||||
|
DartType d = *it;
|
||||||
|
if (d.alpha1().alpha0() == dstart)
|
||||||
|
start = true;
|
||||||
|
d = *it;
|
||||||
|
if (d.alpha2().alpha1().alpha0().alpha1() == dend)
|
||||||
|
end = true;
|
||||||
|
|
||||||
|
// This is the only place swapping is called when inserting a constraint
|
||||||
|
ttl::swapEdgeInList<TraitsType, DartType>(it,elist);
|
||||||
|
|
||||||
|
// If we, during look-ahead, found that dstart and/or dend were in the quadrilateral,
|
||||||
|
// we update them.
|
||||||
|
if (end)
|
||||||
|
dend = *it;
|
||||||
|
if (start) {
|
||||||
|
dstart = *it;
|
||||||
|
dstart.alpha0().alpha2();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (swap_away) { // !locked || //it should be sufficient with swap_away ???
|
||||||
|
noswap++;
|
||||||
|
erase = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isTheConstraint(*it, dstart, dend)) {
|
||||||
|
// Move the constraint to the end of the list
|
||||||
|
DartType the_constraint = *it;
|
||||||
|
elist.erase(it);
|
||||||
|
elist.push_back(the_constraint);
|
||||||
|
return;
|
||||||
|
} //endif
|
||||||
|
} //endif
|
||||||
|
} //endif "swappable edge"
|
||||||
|
|
||||||
|
|
||||||
|
// Move the edge to the end of the list if it was swapped away from the constraint
|
||||||
|
if (erase) {
|
||||||
|
used = it;
|
||||||
|
elist.push_back(*it);
|
||||||
|
++it;
|
||||||
|
elist.erase(used);
|
||||||
|
--dartsInList;
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
++it;
|
||||||
|
++counter;
|
||||||
|
}
|
||||||
|
|
||||||
|
} //end while
|
||||||
|
|
||||||
|
if (noswap == 0)
|
||||||
|
locked = true;
|
||||||
|
|
||||||
|
} while (dartsInList != 0);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef DEBUG_TTL_CONSTR
|
||||||
|
// We will never enter here. (If elist is empty, we return above).
|
||||||
|
cout << "??????? ERROR 2, should never enter here ????????????????????????? SKIP ???? " << endl;
|
||||||
|
exit(-1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // End of ttl_constr namespace scope
|
||||||
|
|
||||||
|
|
||||||
|
namespace ttl { // (extension)
|
||||||
|
|
||||||
|
/** @name Constrained (Delaunay) Triangulation */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/** Inserts a constrained edge between two existing nodes in a triangulation.
|
||||||
|
* If the constraint falls on one or more existing nodes and this is detected by the
|
||||||
|
* predicate \c TraitsType::orient2d, which should return zero in this case, the
|
||||||
|
* constraint is split. Otherwise a degenerate triangle will be made along
|
||||||
|
* the constraint.
|
||||||
|
*
|
||||||
|
* \param dstart
|
||||||
|
* A CCW dart with the start node of the constraint as the source node
|
||||||
|
*
|
||||||
|
* \param dend
|
||||||
|
* A CCW dart with the end node of the constraint as the source node
|
||||||
|
*
|
||||||
|
* \param optimize_delaunay
|
||||||
|
* If set to \c true, the resulting triangulation will be
|
||||||
|
* a \e constrained \e Delaunay \e triangulation. If set to \c false, the resulting
|
||||||
|
* triangulation will not necessarily be of constrained Delaunay type.
|
||||||
|
*
|
||||||
|
* \retval DartType
|
||||||
|
* A dart representing the constrained edge.
|
||||||
|
*
|
||||||
|
* \require
|
||||||
|
* - \ref hed::TTLtraits::orient2d "TraitsType::orient2d" (DartType&, DartType&, PointType&)
|
||||||
|
* - \ref hed::TTLtraits::swapEdge "TraitsType::swapEdge" (DartType&)
|
||||||
|
*
|
||||||
|
* \using
|
||||||
|
* - ttl::optimizeDelaunay if \e optimize_delaunay is set to \c true
|
||||||
|
*
|
||||||
|
* \par Assumes:
|
||||||
|
* - The constrained edge must be inside the existing triangulation (and it cannot
|
||||||
|
* cross the boundary of the triangulation).
|
||||||
|
*/
|
||||||
|
template <class TraitsType, class DartType>
|
||||||
|
DartType insertConstraint(DartType& dstart, DartType& dend, bool optimize_delaunay) {
|
||||||
|
|
||||||
|
// Assumes:
|
||||||
|
// - It is the users responsibility to avoid crossing constraints
|
||||||
|
// - The constraint cannot cross the boundary, i.e., the boundary must be
|
||||||
|
// convex in the area of crossing edges.
|
||||||
|
// - dtart and dend are preserved (same node associated.)
|
||||||
|
|
||||||
|
|
||||||
|
// Find edges crossing the constraint and put them in elist.
|
||||||
|
// If findCrossingEdges reaches a Node lying on the constraint, this function
|
||||||
|
// calls itself recursively.
|
||||||
|
|
||||||
|
// RECURSION
|
||||||
|
list<DartType> elist;
|
||||||
|
DartType next_start = ttl_constr::findCrossingEdges<TraitsType>(dstart, dend, elist);
|
||||||
|
|
||||||
|
// If there are no crossing edges (elist is empty), we assume that the constraint
|
||||||
|
// is an existing edge.
|
||||||
|
// In this case, findCrossingEdges returns the constraint.
|
||||||
|
// Put the constraint in the list to fit with the procedures below
|
||||||
|
// (elist can also be empty in the case of invalid input data (the constraint is in
|
||||||
|
// a non-convex area) but this is the users responsibility.)
|
||||||
|
|
||||||
|
//by Thomas Sevaldrud if (elist.size() == 0)
|
||||||
|
//by Thomas Sevaldrud elist.push_back(next_start);
|
||||||
|
|
||||||
|
// findCrossingEdges stops if it finds a node lying on the constraint.
|
||||||
|
// A dart with this node as start node is returned
|
||||||
|
// We call insertConstraint recursivly until the received dart is dend
|
||||||
|
if (!ttl::same_0_orbit(next_start, dend)) {
|
||||||
|
|
||||||
|
#ifdef DEBUG_TTL_CONSTR_PLOT
|
||||||
|
cout << "RECURSION due to collinearity along constraint" << endl;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
insertConstraint<TraitsType,DartType>(next_start, dend, optimize_delaunay);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Swap edges such that the constraint edge is present in the transformed triangulation.
|
||||||
|
if (elist.size() > 0) // by Thomas Sevaldrud
|
||||||
|
ttl_constr::transformToConstraint<TraitsType>(dstart, next_start, elist);
|
||||||
|
|
||||||
|
#ifdef DEBUG_TTL_CONSTR_PLOT
|
||||||
|
cout << "size of elist = " << elist.size() << endl;
|
||||||
|
if (elist.size() > 0) {
|
||||||
|
DartType the_constraint = elist.back();
|
||||||
|
ofile_constr << the_constraint.x() << " " << the_constraint.y() << " " << 0 << endl;
|
||||||
|
the_constraint.alpha0();
|
||||||
|
ofile_constr << the_constraint.x() << " " << the_constraint.y() << " " << 0 << endl << endl;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// Optimize to constrained Delaunay triangulation if required.
|
||||||
|
typename list<DartType>::iterator end_opt = elist.end();
|
||||||
|
if (optimize_delaunay) {
|
||||||
|
|
||||||
|
// Indicate that the constrained edge, which is the last element in the list,
|
||||||
|
// should not be swapped
|
||||||
|
--end_opt;
|
||||||
|
ttl::optimizeDelaunay<TraitsType, DartType>(elist, end_opt);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(elist.size() == 0) // by Thomas Sevaldrud
|
||||||
|
return next_start; // by Thomas Sevaldrud
|
||||||
|
|
||||||
|
// Return the constraint, which is still the last element in the list
|
||||||
|
end_opt = elist.end();
|
||||||
|
--end_opt;
|
||||||
|
return *end_opt;
|
||||||
|
}
|
||||||
|
|
||||||
|
//@} // End of Constrained Triangulation Group
|
||||||
|
|
||||||
|
}; // End of ttl namespace scope (extension)
|
||||||
|
|
||||||
|
#endif // _TTL_CONSTR_H_
|
|
@ -0,0 +1,143 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 1998, 2000-2007, 2010, 2011, 2012, 2013 SINTEF ICT,
|
||||||
|
* Applied Mathematics, Norway.
|
||||||
|
*
|
||||||
|
* Contact information: E-mail: tor.dokken@sintef.no
|
||||||
|
* SINTEF ICT, Department of Applied Mathematics,
|
||||||
|
* P.O. Box 124 Blindern,
|
||||||
|
* 0314 Oslo, Norway.
|
||||||
|
*
|
||||||
|
* This file is part of TTL.
|
||||||
|
*
|
||||||
|
* TTL is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as
|
||||||
|
* published by the Free Software Foundation, either version 3 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* TTL 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 Affero General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU Affero General Public
|
||||||
|
* License along with TTL. If not, see
|
||||||
|
* <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* In accordance with Section 7(b) of the GNU Affero General Public
|
||||||
|
* License, a covered work must retain the producer line in every data
|
||||||
|
* file that is created or manipulated using TTL.
|
||||||
|
*
|
||||||
|
* Other Usage
|
||||||
|
* You can be released from the requirements of the license by purchasing
|
||||||
|
* a commercial license. Buying such a license is mandatory as soon as you
|
||||||
|
* develop commercial activities involving the TTL library without
|
||||||
|
* disclosing the source code of your own applications.
|
||||||
|
*
|
||||||
|
* This file may be used in accordance with the terms contained in a
|
||||||
|
* written agreement between you and SINTEF ICT.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _TTL_UTIL_H_
|
||||||
|
#define _TTL_UTIL_H_
|
||||||
|
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <algorithm>
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
# if _MSC_VER < 1300
|
||||||
|
# include <minmax.h>
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
//using namespace std;
|
||||||
|
|
||||||
|
|
||||||
|
/** \brief Utilities
|
||||||
|
*
|
||||||
|
* This name space contains utility functions for TTL.\n
|
||||||
|
*
|
||||||
|
* Point and vector algebra such as scalar product and cross product
|
||||||
|
* between vectors are implemented here.
|
||||||
|
* These functions are required by functions in the \ref ttl namespace,
|
||||||
|
* where they are assumed to be present in the \ref hed::TTLtraits "TTLtraits" class.
|
||||||
|
* Thus, the user can call these functions from the traits class.
|
||||||
|
* For efficiency reasons, the user may consider implementing these
|
||||||
|
* functions in the the API directly on the actual data structure;
|
||||||
|
* see \ref api.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* - Cross product between vectors in the xy-plane delivers a scalar,
|
||||||
|
* which is the z-component of the actual cross product
|
||||||
|
* (the x and y components are both zero).
|
||||||
|
*
|
||||||
|
* \see
|
||||||
|
* ttl and \ref api
|
||||||
|
*
|
||||||
|
* \author
|
||||||
|
* Øyvind Hjelle, oyvindhj@ifi.uio.no
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace ttl_util {
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
// ------------------------------ Computational Geometry Group ----------------------------------
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/** @name Computational geometry */
|
||||||
|
//@{
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/** Scalar product between two 2D vectors.
|
||||||
|
*
|
||||||
|
* \par Returns:
|
||||||
|
* \code
|
||||||
|
* dx1*dx2 + dy1*dy2
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
template <class real_type>
|
||||||
|
real_type scalarProduct2d(real_type dx1, real_type dy1, real_type dx2, real_type dy2) {
|
||||||
|
return dx1*dx2 + dy1*dy2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/** Cross product between two 2D vectors. (The z-component of the actual cross product.)
|
||||||
|
*
|
||||||
|
* \par Returns:
|
||||||
|
* \code
|
||||||
|
* dx1*dy2 - dy1*dx2
|
||||||
|
* \endcode
|
||||||
|
*/
|
||||||
|
template <class real_type>
|
||||||
|
real_type crossProduct2d(real_type dx1, real_type dy1, real_type dx2, real_type dy2) {
|
||||||
|
return dx1*dy2 - dy1*dx2;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//------------------------------------------------------------------------------------------------
|
||||||
|
/** Returns a positive value if the 2D nodes/points \e pa, \e pb, and
|
||||||
|
* \e pc occur in counterclockwise order; a negative value if they occur
|
||||||
|
* in clockwise order; and zero if they are collinear.
|
||||||
|
*
|
||||||
|
* \note
|
||||||
|
* - This is a finite arithmetic fast version. It can be made more robust using
|
||||||
|
* exact arithmetic schemes by Jonathan Richard Shewchuk. See
|
||||||
|
* http://www-2.cs.cmu.edu/~quake/robust.html
|
||||||
|
*/
|
||||||
|
template <class real_type>
|
||||||
|
real_type orient2dfast(real_type pa[2], real_type pb[2], real_type pc[2]) {
|
||||||
|
real_type acx = pa[0] - pc[0];
|
||||||
|
real_type bcx = pb[0] - pc[0];
|
||||||
|
real_type acy = pa[1] - pc[1];
|
||||||
|
real_type bcy = pb[1] - pc[1];
|
||||||
|
return acx * bcy - acy * bcx;
|
||||||
|
}
|
||||||
|
|
||||||
|
}; // End of ttl_util namespace scope
|
||||||
|
|
||||||
|
#endif // _TTL_UTIL_H_
|
|
@ -65,7 +65,7 @@ public:
|
||||||
/// For use with _() function on wx 2.8:
|
/// For use with _() function on wx 2.8:
|
||||||
UTF8( const wchar_t* txt );
|
UTF8( const wchar_t* txt );
|
||||||
|
|
||||||
explicit UTF8( const std::string& o ) :
|
UTF8( const std::string& o ) :
|
||||||
std::string( o )
|
std::string( o )
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -83,6 +83,23 @@ public:
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UTF8& operator=( const char* s )
|
||||||
|
{
|
||||||
|
std::string::operator=( s );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTF8& operator=( char c )
|
||||||
|
{
|
||||||
|
std::string::operator=( c );
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
UTF8 substr( size_t pos = 0, size_t len = npos ) const
|
||||||
|
{
|
||||||
|
return std::string::substr( pos, len );
|
||||||
|
}
|
||||||
|
|
||||||
operator wxString () const;
|
operator wxString () const;
|
||||||
|
|
||||||
/// This one is not in std::string, and one wonders why... might be a solid
|
/// This one is not in std::string, and one wonders why... might be a solid
|
||||||
|
|
|
@ -183,7 +183,7 @@ public:
|
||||||
* BOARD.
|
* BOARD.
|
||||||
* @param aBoard The BOARD to put into the frame.
|
* @param aBoard The BOARD to put into the frame.
|
||||||
*/
|
*/
|
||||||
void SetBoard( BOARD* aBoard );
|
virtual void SetBoard( BOARD* aBoard );
|
||||||
|
|
||||||
BOARD* GetBoard() const
|
BOARD* GetBoard() const
|
||||||
{
|
{
|
||||||
|
@ -191,8 +191,6 @@ public:
|
||||||
return m_Pcb;
|
return m_Pcb;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ViewReloadBoard( const BOARD* aBoard ) const;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function SetFootprintLibTable
|
* Function SetFootprintLibTable
|
||||||
* set the footprint library table to \a aFootprintLibTable.
|
* set the footprint library table to \a aFootprintLibTable.
|
||||||
|
@ -727,8 +725,6 @@ public:
|
||||||
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
|
||||||
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
|
||||||
|
|
||||||
virtual void UseGalCanvas( bool aEnable );
|
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -228,7 +228,7 @@ public:
|
||||||
const wxPoint& pos, const wxSize& size,
|
const wxPoint& pos, const wxSize& size,
|
||||||
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
|
||||||
|
|
||||||
~PCB_EDIT_FRAME();
|
virtual ~PCB_EDIT_FRAME();
|
||||||
|
|
||||||
void OnQuit( wxCommandEvent& event );
|
void OnQuit( wxCommandEvent& event );
|
||||||
|
|
||||||
|
@ -609,6 +609,13 @@ public:
|
||||||
*/
|
*/
|
||||||
void Show3D_Frame( wxCommandEvent& event );
|
void Show3D_Frame( wxCommandEvent& event );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function UseGalCanvas
|
||||||
|
* Enables/disables GAL canvas.
|
||||||
|
* @param aEnable determines if GAL should be active or not.
|
||||||
|
*/
|
||||||
|
void UseGalCanvas( bool aEnable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ChangeCanvas
|
* Function ChangeCanvas
|
||||||
* switches currently used canvas (default / Cairo / OpenGL).
|
* switches currently used canvas (default / Cairo / OpenGL).
|
||||||
|
@ -894,6 +901,15 @@ public:
|
||||||
*/
|
*/
|
||||||
bool Clear_Pcb( bool aQuery );
|
bool Clear_Pcb( bool aQuery );
|
||||||
|
|
||||||
|
/// @copydoc PCB_BASE_FRAME::SetBoard()
|
||||||
|
void SetBoard( BOARD* aBoard );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ViewReloadBoard
|
||||||
|
* adds all items from the current board to the VIEW, so they can be displayed by GAL.
|
||||||
|
*/
|
||||||
|
void ViewReloadBoard( const BOARD* aBoard ) const;
|
||||||
|
|
||||||
// Drc control
|
// Drc control
|
||||||
|
|
||||||
/* function GetDrcController
|
/* function GetDrcController
|
||||||
|
@ -961,6 +977,12 @@ public:
|
||||||
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
|
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
|
||||||
bool aExport3DFiles, const wxString & a3D_Subdir );
|
bool aExport3DFiles, const wxString & a3D_Subdir );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function ExportToIDF3
|
||||||
|
* will export the current BOARD to a IDFv3 board and lib files.
|
||||||
|
*/
|
||||||
|
void ExportToIDF3( wxCommandEvent& event );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function ExporttoSPECCTRA
|
* Function ExporttoSPECCTRA
|
||||||
* will export the current BOARD to a specctra dsn file. See
|
* will export the current BOARD to a specctra dsn file. See
|
||||||
|
|
|
@ -393,21 +393,21 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME
|
||||||
int m_toolId;
|
int m_toolId;
|
||||||
|
|
||||||
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
|
||||||
|
|
||||||
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
|
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
|
||||||
|
bool m_galCanvasActive; ///< whether to use new GAL engine
|
||||||
|
|
||||||
|
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
|
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
|
||||||
int m_LastGridSizeId;
|
int m_LastGridSizeId;
|
||||||
bool m_DrawGrid; // hide/Show grid
|
bool m_DrawGrid; // hide/Show grid
|
||||||
bool m_galCanvasActive; // whether to use new GAL engine
|
|
||||||
EDA_COLOR_T m_GridColor; // Grid color
|
EDA_COLOR_T m_GridColor; // Grid color
|
||||||
|
|
||||||
/// The area to draw on.
|
/// The area to draw on.
|
||||||
EDA_DRAW_PANEL* m_canvas;
|
EDA_DRAW_PANEL* m_canvas;
|
||||||
|
|
||||||
/// New type of area (GAL-based) to draw on.
|
|
||||||
EDA_DRAW_PANEL_GAL* m_galCanvas;
|
|
||||||
|
|
||||||
/// Tool ID of previously active draw tool bar button.
|
/// Tool ID of previously active draw tool bar button.
|
||||||
int m_lastDrawToolId;
|
int m_lastDrawToolId;
|
||||||
|
|
||||||
|
@ -979,20 +979,22 @@ public:
|
||||||
virtual void UseGalCanvas( bool aEnable );
|
virtual void UseGalCanvas( bool aEnable );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function IsNewCanvasActive
|
* Function IsGalCanvasActive
|
||||||
* is used to check which canvas (GAL-based or standard) is currently in use.
|
* is used to check which canvas (GAL-based or standard) is currently in use.
|
||||||
*
|
*
|
||||||
* @return True for GAL-based canvas, false for standard canvas.
|
* @return True for GAL-based canvas, false for standard canvas.
|
||||||
*/
|
*/
|
||||||
bool IsGalCanvasActive() { return m_galCanvasActive; }
|
bool IsGalCanvasActive() const { return m_galCanvasActive; }
|
||||||
|
void SetGalCanvasActive( bool aState ) { m_galCanvasActive = aState; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetCalCanvas
|
* Function GetGalCanvas
|
||||||
* returns a pointer to GAL-based canvas of given EDA draw frame.
|
* returns a pointer to GAL-based canvas of given EDA draw frame.
|
||||||
*
|
*
|
||||||
* @return Pointer to GAL-based canvas.
|
* @return Pointer to GAL-based canvas.
|
||||||
*/
|
*/
|
||||||
EDA_DRAW_PANEL_GAL* GetGalCanvas() { return m_galCanvas; }
|
EDA_DRAW_PANEL_GAL* GetGalCanvas() const { return m_galCanvas; }
|
||||||
|
void SetGalCanvas( EDA_DRAW_PANEL_GAL* aPanel ) { m_galCanvas = aPanel; }
|
||||||
|
|
||||||
DECLARE_EVENT_TABLE()
|
DECLARE_EVENT_TABLE()
|
||||||
};
|
};
|
||||||
|
|
|
@ -49,5 +49,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -13,7 +13,7 @@
|
||||||
#ifndef DRW_BASE_H
|
#ifndef DRW_BASE_H
|
||||||
#define DRW_BASE_H
|
#define DRW_BASE_H
|
||||||
|
|
||||||
#define DRW_VERSION "0.5.10"
|
#define DRW_VERSION "0.5.11"
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
|
@ -1683,7 +1683,7 @@ DRW_ImageDef* dxfRW::writeImage( DRW_Image* ent, std::string name )
|
||||||
writer->writeInt16( 282, ent->contrast );
|
writer->writeInt16( 282, ent->contrast );
|
||||||
writer->writeInt16( 283, ent->fade );
|
writer->writeInt16( 283, ent->fade );
|
||||||
writer->writeString( 360, idReactor );
|
writer->writeString( 360, idReactor );
|
||||||
id->reactors[idReactor] = ent->handle;
|
id->reactors[idReactor] = toHexStr( ent->handle );
|
||||||
return id;
|
return id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3817,9 +3817,9 @@ bool dxfRW::processImageDef()
|
||||||
std::string dxfRW::toHexStr( int n )
|
std::string dxfRW::toHexStr( int n )
|
||||||
{
|
{
|
||||||
#if defined(__APPLE__)
|
#if defined(__APPLE__)
|
||||||
std::string buffer( 9, '\0' );
|
char buffer[9] = { '\0' };
|
||||||
snprintf( &buffer[0], 9, "%X", n );
|
snprintf( buffer, 9, "%X", n );
|
||||||
return buffer;
|
return std::string( buffer );
|
||||||
#else
|
#else
|
||||||
std::ostringstream Convert;
|
std::ostringstream Convert;
|
||||||
Convert << std::uppercase << std::hex << n;
|
Convert << std::uppercase << std::hex << n;
|
||||||
|
|
|
@ -27,7 +27,7 @@ class dxfRW
|
||||||
public:
|
public:
|
||||||
dxfRW( const char* name );
|
dxfRW( const char* name );
|
||||||
~dxfRW();
|
~dxfRW();
|
||||||
// / reads the file specified in constructor
|
/// reads the file specified in constructor
|
||||||
/*!
|
/*!
|
||||||
* An interface must be provided. It is used by the class to signal various
|
* An interface must be provided. It is used by the class to signal various
|
||||||
* components being added.
|
* components being added.
|
||||||
|
@ -71,7 +71,7 @@ public:
|
||||||
|
|
||||||
void setEllipseParts( int parts ) { elParts = parts; } /*!< set parts munber when convert ellipse to polyline */
|
void setEllipseParts( int parts ) { elParts = parts; } /*!< set parts munber when convert ellipse to polyline */
|
||||||
private:
|
private:
|
||||||
// / used by read() to parse the content of the file
|
/// used by read() to parse the content of the file
|
||||||
bool processDxf();
|
bool processDxf();
|
||||||
bool processHeader();
|
bool processHeader();
|
||||||
bool processTables();
|
bool processTables();
|
||||||
|
|
|
@ -49,5 +49,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -0,0 +1,55 @@
|
||||||
|
=== modified file 'boost/asio/ssl/impl/context.ipp'
|
||||||
|
--- boost/asio/ssl/impl/context.ipp 2013-12-30 14:53:15 +0000
|
||||||
|
+++ boost/asio/ssl/impl/context.ipp 2013-12-30 19:08:01 +0000
|
||||||
|
@@ -236,19 +236,27 @@
|
||||||
|
boost::system::error_code context::clear_options(
|
||||||
|
context::options o, boost::system::error_code& ec)
|
||||||
|
{
|
||||||
|
-#if !defined(SSL_OP_NO_COMPRESSION)
|
||||||
|
+#if (OPENSSL_VERSION_NUMBER >= 0x009080DFL) \
|
||||||
|
+ && (OPENSSL_VERSION_NUMBER != 0x00909000L)
|
||||||
|
+# if !defined(SSL_OP_NO_COMPRESSION)
|
||||||
|
if ((o & context::no_compression) != 0)
|
||||||
|
{
|
||||||
|
-#if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
+# if (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
handle_->comp_methods = SSL_COMP_get_compression_methods();
|
||||||
|
-#endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
+# endif // (OPENSSL_VERSION_NUMBER >= 0x00908000L)
|
||||||
|
o ^= context::no_compression;
|
||||||
|
}
|
||||||
|
-#endif // !defined(SSL_OP_NO_COMPRESSION)
|
||||||
|
+# endif // !defined(SSL_OP_NO_COMPRESSION)
|
||||||
|
|
||||||
|
::SSL_CTX_clear_options(handle_, o);
|
||||||
|
|
||||||
|
ec = boost::system::error_code();
|
||||||
|
+#else // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
|
||||||
|
+ // && (OPENSSL_VERSION_NUMBER != 0x00909000L)
|
||||||
|
+ (void)o;
|
||||||
|
+ ec = boost::asio::error::operation_not_supported;
|
||||||
|
+#endif // (OPENSSL_VERSION_NUMBER >= 0x009080DFL)
|
||||||
|
+ // && (OPENSSL_VERSION_NUMBER != 0x00909000L)
|
||||||
|
return ec;
|
||||||
|
}
|
||||||
|
|
||||||
|
@@ -428,7 +436,8 @@
|
||||||
|
|
||||||
|
if (format == context_base::asn1)
|
||||||
|
{
|
||||||
|
- if (::SSL_CTX_use_certificate_ASN1(handle_, buffer_size(certificate),
|
||||||
|
+ if (::SSL_CTX_use_certificate_ASN1(handle_,
|
||||||
|
+ static_cast<int>(buffer_size(certificate)),
|
||||||
|
buffer_cast<const unsigned char*>(certificate)) == 1)
|
||||||
|
{
|
||||||
|
ec = boost::system::error_code();
|
||||||
|
@@ -929,7 +938,7 @@
|
||||||
|
{
|
||||||
|
return ::BIO_new_mem_buf(
|
||||||
|
const_cast<void*>(buffer_cast<const void*>(b)),
|
||||||
|
- buffer_size(b));
|
||||||
|
+ static_cast<int>(buffer_size(b)));
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // !defined(BOOST_ASIO_ENABLE_OLD_SSL)
|
||||||
|
|
|
@ -0,0 +1,72 @@
|
||||||
|
=== modified file 'libs/context/build/Jamfile.v2'
|
||||||
|
--- libs/context/build/Jamfile.v2 2013-12-29 11:28:14 +0000
|
||||||
|
+++ libs/context/build/Jamfile.v2 2013-12-29 11:31:05 +0000
|
||||||
|
@@ -414,6 +414,25 @@
|
||||||
|
;
|
||||||
|
|
||||||
|
alias asm_context_sources
|
||||||
|
+# : asm/make_i386_x86_64_sysv_macho_gas.S
|
||||||
|
+# asm/jump_i386_x86_64_sysv_macho_gas.S
|
||||||
|
+# : <address-model>32_64
|
||||||
|
+# <architecture>x86
|
||||||
|
+# <binary-format>mach-o
|
||||||
|
+# <target-os>darwin
|
||||||
|
+# <toolset>darwin
|
||||||
|
+# ;
|
||||||
|
+#
|
||||||
|
+#alias asm_context_sources
|
||||||
|
+ : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ : <address-model>32_64
|
||||||
|
+ <architecture>x86
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
: asm/make_x86_64_ms_pe_masm.asm
|
||||||
|
asm/jump_x86_64_ms_pe_masm.asm
|
||||||
|
dummy.cpp
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/jump_i386_x86_64_sysv_macho_gas.S 2013-12-29 11:33:46 +0000
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Sergue E. Leontiev 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+// Stub file for universal binary
|
||||||
|
+
|
||||||
|
+#if defined(__i386__)
|
||||||
|
+ #include "jump_i386_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__x86_64__)
|
||||||
|
+ #include "jump_x86_64_sysv_macho_gas.S"
|
||||||
|
+#else
|
||||||
|
+ #error "No arch's"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/make_i386_x86_64_sysv_macho_gas.S 2013-12-29 11:32:49 +0000
|
||||||
|
@@ -0,0 +1,16 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Sergue E. Leontiev 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+// Stub file for universal binary
|
||||||
|
+
|
||||||
|
+#if defined(__i386__)
|
||||||
|
+ #include "make_i386_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__x86_64__)
|
||||||
|
+ #include "make_x86_64_sysv_macho_gas.S"
|
||||||
|
+#else
|
||||||
|
+ #error "No arch's"
|
||||||
|
+#endif
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
=== modified file 'tools/build/v2/tools/gcc.jam'
|
||||||
|
--- tools/build/v2/tools/gcc.jam 2013-12-29 13:13:00 +0000
|
||||||
|
+++ tools/build/v2/tools/gcc.jam 2013-12-29 14:36:31 +0000
|
||||||
|
@@ -635,7 +635,7 @@
|
||||||
|
|
||||||
|
actions compile.asm
|
||||||
|
{
|
||||||
|
- "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||||
|
+ "$(CONFIG_COMMAND)" $(LANG) $(OPTIONS) -D$(DEFINES) $(USER_OPTIONS) -I"$(INCLUDES)" -c -o "$(<)" "$(>)"
|
||||||
|
}
|
||||||
|
|
||||||
|
# Class checking that we do not try to use the <runtime-link>static property
|
||||||
|
|
|
@ -0,0 +1,594 @@
|
||||||
|
--- libs/context/build/Jamfile.v2.orig 2013-03-03 13:39:59.684868916 +0100
|
||||||
|
+++ libs/context/build/Jamfile.v2 2013-03-03 15:09:09.893232829 +0100
|
||||||
|
@@ -282,6 +284,17 @@
|
||||||
|
;
|
||||||
|
|
||||||
|
alias asm_context_sources
|
||||||
|
+ : asm/make_i386_ms_pe_gas.S
|
||||||
|
+ asm/jump_i386_ms_pe_gas.S
|
||||||
|
+ dummy.cpp
|
||||||
|
+ : <address-model>32
|
||||||
|
+ <architecture>x86
|
||||||
|
+ <binary-format>pe
|
||||||
|
+ <target-os>windows
|
||||||
|
+ <toolset>gcc
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
: asm/make_i386_ms_pe_masm.asm
|
||||||
|
asm/jump_i386_ms_pe_masm.asm
|
||||||
|
dummy.cpp
|
||||||
|
@@ -379,6 +392,17 @@
|
||||||
|
;
|
||||||
|
|
||||||
|
alias asm_context_sources
|
||||||
|
+ : asm/make_x86_64_ms_pe_gas.S
|
||||||
|
+ asm/jump_x86_64_ms_pe_gas.S
|
||||||
|
+ dummy.cpp
|
||||||
|
+ : <address-model>64
|
||||||
|
+ <architecture>x86
|
||||||
|
+ <binary-format>pe
|
||||||
|
+ <target-os>windows
|
||||||
|
+ <toolset>gcc
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
: asm/make_x86_64_ms_pe_masm.asm
|
||||||
|
asm/jump_x86_64_ms_pe_masm.asm
|
||||||
|
dummy.cpp
|
||||||
|
--- libs/context/src/asm/make_i386_ms_pe_gas.S.orig 2013-03-03 13:41:28.645502113 +0100
|
||||||
|
+++ libs/context/src/asm/make_i386_ms_pe_gas.S 2013-03-03 14:39:27.590477410 +0100
|
||||||
|
@@ -0,0 +1,115 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Copyright Thomas Sailer 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/********************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 0h | 04h | 08h | 0ch | 010h | 014h | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | EDI | ESI | EBX | EBP | ESP | EIP | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 6 | 7 | 8 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 018h | 01ch | 020h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | limit | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 9 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 024h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * |fc_execpt| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 10 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 028h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * |fc_strage| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 11 | 12 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 02ch | 030h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | fc_mxcsr|fc_x87_cw| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.file "make_i386_ms_pe_gas.S"
|
||||||
|
+.text
|
||||||
|
+.p2align 4,,15
|
||||||
|
+.globl _make_fcontext
|
||||||
|
+.def _make_fcontext; .scl 2; .type 32; .endef
|
||||||
|
+_make_fcontext:
|
||||||
|
+ movl 0x04(%esp), %eax /* load 1. arg of make_fcontext, pointer to context stack (base) */
|
||||||
|
+ leal -0x34(%eax),%eax /* reserve space for fcontext_t at top of context stack */
|
||||||
|
+
|
||||||
|
+ /* shift address in EAX to lower 16 byte boundary */
|
||||||
|
+ /* == pointer to fcontext_t and address of context stack */
|
||||||
|
+ andl $-16, %eax
|
||||||
|
+
|
||||||
|
+ movl 0x04(%esp), %ecx /* load 1. arg of make_fcontext, pointer to context stack (base) */
|
||||||
|
+ movl %ecx, 0x18(%eax) /* save address of context stack (base) in fcontext_t */
|
||||||
|
+ movl 0x08(%esp), %edx /* load 2. arg of make_fcontext, context stack size */
|
||||||
|
+ movl %edx, 0x1c(%eax) /* save context stack size in fcontext_t */
|
||||||
|
+ negl %edx /* negate stack size for LEA instruction (== substraction) */
|
||||||
|
+ leal (%ecx,%edx),%ecx /* compute bottom address of context stack (limit) */
|
||||||
|
+ movl %ecx, 0x20(%eax) /* save address of context stack (limit) in fcontext_t */
|
||||||
|
+ movl 0x0c(%esp), %ecx /* load 3. arg of make_fcontext, pointer to context function */
|
||||||
|
+ movl %ecx, 0x14(%eax) /* save address of context function in fcontext_t */
|
||||||
|
+
|
||||||
|
+ stmxcsr 0x02c(%eax) /* save MMX control word */
|
||||||
|
+ fnstcw 0x030(%eax) /* save x87 control word */
|
||||||
|
+
|
||||||
|
+ leal -0x1c(%eax),%edx /* reserve space for last frame and seh on context stack, (ESP - 0x4) % 16 == 0 */
|
||||||
|
+ movl %edx, 0x10(%eax) /* save address in EDX as stack pointer for context function */
|
||||||
|
+
|
||||||
|
+ movl $finish, %ecx /* abs address of finish */
|
||||||
|
+ movl %ecx, (%edx) /* save address of finish as return address for context function */
|
||||||
|
+ /* entered after context function returns */
|
||||||
|
+
|
||||||
|
+ /* traverse current seh chain to get the last exception handler installed by Windows */
|
||||||
|
+ /* note that on Windows Server 2008 and 2008 R2, SEHOP is activated by default */
|
||||||
|
+ /* the exception handler chain is tested for the presence of ntdll.dll!FinalExceptionHandler */
|
||||||
|
+ /* at its end by RaiseException all seh andlers are disregarded if not present and the */
|
||||||
|
+ /* program is aborted */
|
||||||
|
+ movl %fs:(0x18), %ecx /* load NT_TIB into ECX */
|
||||||
|
+
|
||||||
|
+walk:
|
||||||
|
+ movl (%ecx), %edx /* load 'next' member of current SEH into EDX */
|
||||||
|
+ incl %edx /* test if 'next' of current SEH is last (== 0xffffffff) */
|
||||||
|
+ jz found
|
||||||
|
+ decl %edx
|
||||||
|
+ xchgl %ecx, %edx /* exchange content; ECX contains address of next SEH */
|
||||||
|
+ jmp walk /* inspect next SEH */
|
||||||
|
+
|
||||||
|
+found:
|
||||||
|
+ movl 0x04(%ecx), %ecx /* load 'handler' member of SEH == address of last SEH handler installed by Windows */
|
||||||
|
+ movl 0x10(%eax), %edx /* load address of stack pointer for context function */
|
||||||
|
+ movl %ecx, 0x18(%edx) /* save address in ECX as SEH handler for context */
|
||||||
|
+ movl $0xffffffff,%ecx /* set ECX to -1 */
|
||||||
|
+ movl %ecx, 0x14(%edx) /* save ECX as next SEH item */
|
||||||
|
+ leal 0x14(%edx), %ecx /* load address of next SEH item */
|
||||||
|
+ movl %ecx, 0x24(%eax) /* save next SEH */
|
||||||
|
+
|
||||||
|
+ ret
|
||||||
|
+
|
||||||
|
+finish:
|
||||||
|
+ /* ESP points to same address as ESP on entry of context function + 0x4 */
|
||||||
|
+ xorl %eax, %eax
|
||||||
|
+ movl %eax, (%esp) /* exit code is zero */
|
||||||
|
+ call __exit /* exit application */
|
||||||
|
+ hlt
|
||||||
|
+
|
||||||
|
+.def __exit; .scl 2; .type 32; .endef /* standard C library function */
|
||||||
|
--- libs/context/src/asm/jump_i386_ms_pe_gas.S.orig 2013-03-03 13:41:34.332670479 +0100
|
||||||
|
+++ libs/context/src/asm/jump_i386_ms_pe_gas.S 2013-03-03 14:35:35.634611625 +0100
|
||||||
|
@@ -0,0 +1,108 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Copyright Thomas Sailer 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/********************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 0h | 04h | 08h | 0ch | 010h | 014h | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | EDI | ESI | EBX | EBP | ESP | EIP | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 6 | 7 | 8 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 018h | 01ch | 020h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | limit | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 9 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 024h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * |fc_execpt| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 10 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 028h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * |fc_strage| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 11 | 12 | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | 02ch | 030h | | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * | fc_mxcsr|fc_x87_cw| | *
|
||||||
|
+ * -------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.file "jump_i386_ms_pe_gas.S"
|
||||||
|
+.text
|
||||||
|
+.p2align 4,,15
|
||||||
|
+.globl _jump_fcontext
|
||||||
|
+.def _jump_fcontext; .scl 2; .type 32; .endef
|
||||||
|
+_jump_fcontext:
|
||||||
|
+ movl 0x04(%esp), %ecx /* load address of the first fcontext_t arg */
|
||||||
|
+ movl %edi, (%ecx) /* save EDI */
|
||||||
|
+ movl %esi, 0x04(%ecx) /* save ESI */
|
||||||
|
+ movl %ebx, 0x08(%ecx) /* save EBX */
|
||||||
|
+ movl %ebp, 0x0c(%ecx) /* save EBP */
|
||||||
|
+
|
||||||
|
+ movl %fs:(0x18), %edx /* load NT_TIB */
|
||||||
|
+ movl (%edx), %eax /* load current SEH exception list */
|
||||||
|
+ movl %eax, 0x24(%ecx) /* save current exception list */
|
||||||
|
+ movl 0x04(%edx), %eax /* load current stack base */
|
||||||
|
+ movl %eax, 0x18(%ecx) /* save current stack base */
|
||||||
|
+ movl 0x08(%edx), %eax /* load current stack limit */
|
||||||
|
+ movl %eax, 0x20(%ecx) /* save current stack limit */
|
||||||
|
+ movl 0x10(%edx), %eax /* load fiber local storage */
|
||||||
|
+ movl %eax, 0x28(%ecx) /* save fiber local storage */
|
||||||
|
+
|
||||||
|
+ leal 0x04(%esp), %eax /* exclude the return address */
|
||||||
|
+ movl %eax, 0x10(%ecx) /* save as stack pointer */
|
||||||
|
+ movl (%esp), %eax /* load return address */
|
||||||
|
+ movl %eax, 0x14(%ecx) /* save return address */
|
||||||
|
+
|
||||||
|
+ movl 0x08(%esp), %edx /* load address of the second fcontext_t arg */
|
||||||
|
+ movl (%edx), %edi /* restore EDI */
|
||||||
|
+ movl 0x04(%edx), %esi /* restore ESI */
|
||||||
|
+ movl 0x08(%edx), %ebx /* restore EBX */
|
||||||
|
+ movl 0x0c(%edx), %ebp /* restore EBP */
|
||||||
|
+
|
||||||
|
+ movl 0x10(%esp), %eax /* check if fpu enve preserving was requested */
|
||||||
|
+ testl %eax, %eax
|
||||||
|
+ je 1f
|
||||||
|
+
|
||||||
|
+ stmxcsr 0x2c(%ecx) /* save MMX control word */
|
||||||
|
+ fnstcw 0x30(%ecx) /* save x87 control word */
|
||||||
|
+ ldmxcsr 0x2c(%edx) /* restore MMX control word */
|
||||||
|
+ fldcw 0x30(%edx) /* restore x87 control word */
|
||||||
|
+1:
|
||||||
|
+ movl %edx, %ecx
|
||||||
|
+ movl %fs:(0x18), %edx /* load NT_TIB */
|
||||||
|
+ movl 0x24(%ecx), %eax /* load SEH exception list */
|
||||||
|
+ movl %eax, (%edx) /* restore next SEH item */
|
||||||
|
+ movl 0x18(%ecx), %eax /* load stack base */
|
||||||
|
+ movl %eax, 0x04(%edx) /* restore stack base */
|
||||||
|
+ movl 0x20(%ecx), %eax /* load stack limit */
|
||||||
|
+ movl %eax, 0x08(%edx) /* restore stack limit */
|
||||||
|
+ movl 0x28(%ecx), %eax /* load fiber local storage */
|
||||||
|
+ movl %eax, 0x10(%edx) /* restore fiber local storage */
|
||||||
|
+
|
||||||
|
+ movl 0x0c(%esp), %eax /* use third arg as return value after jump */
|
||||||
|
+
|
||||||
|
+ movl 0x10(%ecx), %esp /* restore ESP */
|
||||||
|
+ movl %eax, 0x04(%esp) /* use third arg as first arg in context function */
|
||||||
|
+ movl 0x14(%ecx), %ecx /* fetch the address to return to */
|
||||||
|
+
|
||||||
|
+ jmp *%ecx /* indirect jump to context */
|
||||||
|
--- libs/context/src/asm/make_x86_64_ms_pe_gas.S.orig 2013-03-03 13:43:03.137299031 +0100
|
||||||
|
+++ libs/context/src/asm/make_x86_64_ms_pe_gas.S 2013-03-03 14:54:16.036775106 +0100
|
||||||
|
@@ -0,0 +1,132 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Copyright Thomas Sailer 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/****************************************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | R12 | R13 | R14 | R15 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | RDI | RSI | RBX | RBP | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 16 | 17 | 18 | 19 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x40 | 0x44 | 0x48 | 0x4c | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | RSP | RIP | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | 23 | 24 | 25 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x50 | 0x54 | 0x58 | 0x5c | 0x60 | 0x64 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | limit | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 26 | 27 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x68 | 0x6c | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | fbr_strg | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x70 | 0x74 | 0x78 | 0x7c | 0x80 | 0x84 | 0x88 | 0x8c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | fc_mxcsr|fc_x87_cw| fc_xmm | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x90 | 0x94 | 0x98 | 0x9c | 0xa0 | 0xa4 | 0xa8 | 0xac | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xb0 | 0xb4 | 0xb8 | 0xbc | 0xc0 | 0xc4 | 0xc8 | 0xcc | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xd0 | 0xd4 | 0xd8 | 0xdc | 0xe0 | 0xe4 | 0xe8 | 0xec | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xf0 | 0xf4 | 0xf8 | 0xfc | 0x100 | 0x104 | 0x108 | 0x10c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x110 | 0x114 | 0x118 | 0x11c | 0x120 | 0x124 | 0x128 | 0x12c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *************************************************************************************/
|
||||||
|
+
|
||||||
|
+.file "make_x86_64_ms_pe_gas.S"
|
||||||
|
+.text
|
||||||
|
+.p2align 4,,15
|
||||||
|
+.globl make_fcontext
|
||||||
|
+.def make_fcontext; .scl 2; .type 32; .endef
|
||||||
|
+.seh_proc make_fcontext
|
||||||
|
+make_fcontext:
|
||||||
|
+.seh_endprologue
|
||||||
|
+ leaq -0x130(%rcx),%rax /* reserve space for fcontext_t at top of context stack */
|
||||||
|
+
|
||||||
|
+ /* shift address in RAX to lower 16 byte boundary */
|
||||||
|
+ /* == pointer to fcontext_t and address of context stack */
|
||||||
|
+ andq $-16, %rax
|
||||||
|
+
|
||||||
|
+ movq %r8, 0x48(%rax) /* save address of context function in fcontext_t */
|
||||||
|
+ movq %rdx, 0x58(%rax) /* save context stack size in fcontext_t */
|
||||||
|
+ movq %rcx, 0x50(%rax) /* save address of context stack pointer (base) in fcontext_t */
|
||||||
|
+
|
||||||
|
+ negq %rdx /* negate stack size for LEA instruction (== substraction) */
|
||||||
|
+ leaq (%rcx,%rdx),%rcx /* compute bottom address of context stack (limit) */
|
||||||
|
+ movq %rcx, 0x60(%rax) /* save bottom address of context stack (limit) in fcontext_t */
|
||||||
|
+
|
||||||
|
+ stmxcsr 0x70(%rax) /* save MMX control and status word */
|
||||||
|
+ fnstcw 0x74(%rax) /* save x87 control word */
|
||||||
|
+
|
||||||
|
+ leaq -0x28(%rax),%rdx /* reserve 32byte shadow space + return address on stack, (RSP - 0x8) % 16 == 0 */
|
||||||
|
+ movq %rdx, 0x40(%rax) /* save address in RDX as stack pointer for context function */
|
||||||
|
+
|
||||||
|
+ leaq finish(%rip),%rcx /* compute abs address of label finish */
|
||||||
|
+ movq %rcx,(%rdx) /* save address of finish as return address for context function */
|
||||||
|
+ /* entered after context function returns */
|
||||||
|
+
|
||||||
|
+ ret
|
||||||
|
+
|
||||||
|
+finish:
|
||||||
|
+ /* RSP points to same address as RSP on entry of context function + 0x8 */
|
||||||
|
+ xorq %rcx, %rcx /* exit code is zero */
|
||||||
|
+ call _exit /* exit application */
|
||||||
|
+ hlt
|
||||||
|
+.seh_endproc
|
||||||
|
+
|
||||||
|
+.def _exit; .scl 2; .type 32; .endef /* standard C library function */
|
||||||
|
--- libs/context/src/asm/jump_x86_64_ms_pe_gas.S.orig 2013-03-03 13:42:57.753139784 +0100
|
||||||
|
+++ libs/context/src/asm/jump_x86_64_ms_pe_gas.S 2013-03-03 15:06:08.269856857 +0100
|
||||||
|
@@ -0,0 +1,189 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Copyright Thomas Sailer 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/****************************************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | R12 | R13 | R14 | R15 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | RDI | RSI | RBX | RBP | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 16 | 17 | 18 | 19 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x40 | 0x44 | 0x48 | 0x4c | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | RSP | RIP | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | 23 | 24 | 25 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x50 | 0x54 | 0x58 | 0x5c | 0x60 | 0x64 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | limit | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 26 | 27 | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x68 | 0x6c | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | fbr_strg | | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x70 | 0x74 | 0x78 | 0x7c | 0x80 | 0x84 | 0x88 | 0x8c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | fc_mxcsr|fc_x87_cw| fc_xmm | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x90 | 0x94 | 0x98 | 0x9c | 0xa0 | 0xa4 | 0xa8 | 0xac | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xb0 | 0xb4 | 0xb8 | 0xbc | 0xc0 | 0xc4 | 0xc8 | 0xcc | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xd0 | 0xd4 | 0xd8 | 0xdc | 0xe0 | 0xe4 | 0xe8 | 0xec | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0xf0 | 0xf4 | 0xf8 | 0xfc | 0x100 | 0x104 | 0x108 | 0x10c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 68 | 69 | 70 | 71 | 72 | 73 | 74 | 75 | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | 0x110 | 0x114 | 0x118 | 0x11c | 0x120 | 0x124 | 0x128 | 0x12c | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * | SEE registers (XMM6-XMM15) | *
|
||||||
|
+ * ---------------------------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *************************************************************************************/
|
||||||
|
+
|
||||||
|
+.file "jump_x86_64_ms_pe_gas.S"
|
||||||
|
+.text
|
||||||
|
+.p2align 4,,15
|
||||||
|
+.globl jump_fcontext
|
||||||
|
+.def jump_fcontext; .scl 2; .type 32; .endef
|
||||||
|
+.seh_proc jump_fcontext
|
||||||
|
+jump_fcontext:
|
||||||
|
+.seh_endprologue
|
||||||
|
+ movq %r12, (%rcx) /* save R12 */
|
||||||
|
+ movq %r13, 0x08(%rcx) /* save R13 */
|
||||||
|
+ movq %r14, 0x10(%rcx) /* save R14 */
|
||||||
|
+ movq %r15, 0x18(%rcx) /* save R15 */
|
||||||
|
+ movq %rdi, 0x20(%rcx) /* save RDI */
|
||||||
|
+ movq %rsi, 0x28(%rcx) /* save RSI */
|
||||||
|
+ movq %rbx, 0x30(%rcx) /* save RBX */
|
||||||
|
+ movq %rbp, 0x38(%rcx) /* save RBP */
|
||||||
|
+
|
||||||
|
+ movq %gs:(0x30), %r10 /* load NT_TIB */
|
||||||
|
+ movq 0x08(%r10), %rax /* load current stack base */
|
||||||
|
+ movq %rax, 0x50(%rcx) /* save current stack base */
|
||||||
|
+ movq 0x10(%r10), %rax /* load current stack limit */
|
||||||
|
+ movq %rax, 0x60(%rcx) /* save current stack limit */
|
||||||
|
+ movq 0x18(%r10), %rax /* load fiber local storage */
|
||||||
|
+ movq %rax, 0x68(%rcx) /* save fiber local storage */
|
||||||
|
+
|
||||||
|
+ testq %r9, %r9
|
||||||
|
+ je 1f
|
||||||
|
+
|
||||||
|
+ stmxcsr 0x70(%rcx) /* save MMX control and status word */
|
||||||
|
+ fnstcw 0x74(%rcx) /* save x87 control word */
|
||||||
|
+ /* save XMM storage */
|
||||||
|
+ /* save start address of SSE register block in R10 */
|
||||||
|
+ leaq 0x90(%rcx), %r10
|
||||||
|
+ /* shift address in R10 to lower 16 byte boundary */
|
||||||
|
+ /* == pointer to SEE register block */
|
||||||
|
+ andq $-16, %r10
|
||||||
|
+
|
||||||
|
+ movaps %xmm6, (%r10)
|
||||||
|
+ movaps %xmm7, 0x10(%r10)
|
||||||
|
+ movaps %xmm8, 0x20(%r10)
|
||||||
|
+ movaps %xmm9, 0x30(%r10)
|
||||||
|
+ movaps %xmm10, 0x40(%r10)
|
||||||
|
+ movaps %xmm11, 0x50(%r10)
|
||||||
|
+ movaps %xmm12, 0x60(%r10)
|
||||||
|
+ movaps %xmm13, 0x70(%r10)
|
||||||
|
+ movaps %xmm14, 0x80(%r10)
|
||||||
|
+ movaps %xmm15, 0x90(%r10)
|
||||||
|
+
|
||||||
|
+ ldmxcsr 0x70(%rdx) /* restore MMX control and status word */
|
||||||
|
+ fldcw 0x74(%rdx) /* restore x87 control word */
|
||||||
|
+ /* restore XMM storage */
|
||||||
|
+ /* save start address of SSE register block in R10 */
|
||||||
|
+ leaq 0x90(%rdx), %r10
|
||||||
|
+ /* shift address in R10 to lower 16 byte boundary */
|
||||||
|
+ /* == pointer to SEE register block */
|
||||||
|
+ andq $-16, %r10
|
||||||
|
+
|
||||||
|
+ movaps (%r10), %xmm6
|
||||||
|
+ movaps 0x10(%r10), %xmm7
|
||||||
|
+ movaps 0x20(%r10), %xmm8
|
||||||
|
+ movaps 0x30(%r10), %xmm9
|
||||||
|
+ movaps 0x40(%r10), %xmm10
|
||||||
|
+ movaps 0x50(%r10), %xmm11
|
||||||
|
+ movaps 0x60(%r10), %xmm12
|
||||||
|
+ movaps 0x70(%r10), %xmm13
|
||||||
|
+ movaps 0x80(%r10), %xmm14
|
||||||
|
+ movaps 0x90(%r10), %xmm15
|
||||||
|
+
|
||||||
|
+1:
|
||||||
|
+ leaq 0x08(%rsp), %rax /* exclude the return address */
|
||||||
|
+ movq %rax, 0x40(%rcx) /* save as stack pointer */
|
||||||
|
+ movq (%rsp), %rax /* load return address */
|
||||||
|
+ movq %rax, 0x48(%rcx) /* save return address */
|
||||||
|
+
|
||||||
|
+ movq (%rdx), %r12 /* restore R12 */
|
||||||
|
+ movq 0x08(%rdx), %r13 /* restore R13 */
|
||||||
|
+ movq 0x10(%rdx), %r14 /* restore R14 */
|
||||||
|
+ movq 0x18(%rdx), %r15 /* restore R15 */
|
||||||
|
+ movq 0x20(%rdx), %rdi /* restore RDI */
|
||||||
|
+ movq 0x28(%rdx), %rsi /* restore RSI */
|
||||||
|
+ movq 0x30(%rdx), %rbx /* restore RBX */
|
||||||
|
+ movq 0x38(%rdx), %rbp /* restore RBP */
|
||||||
|
+
|
||||||
|
+ movq %gs:(0x30), %r10 /* load NT_TIB */
|
||||||
|
+ movq 0x50(%rdx), %rax /* load stack base */
|
||||||
|
+ movq %rax, 0x08(%r10) /* restore stack base */
|
||||||
|
+ movq 0x60(%rdx), %rax /* load stack limit */
|
||||||
|
+ movq %rax, 0x10(%r10) /* restore stack limit */
|
||||||
|
+ movq 0x68(%rdx), %rax /* load fiber local storage */
|
||||||
|
+ movq %rax, 0x18(%r10) /* restore fiber local storage */
|
||||||
|
+
|
||||||
|
+ movq 0x40(%rdx), %rsp /* restore RSP */
|
||||||
|
+ movq 0x48(%rdx), %r10 /* fetch the address to returned to */
|
||||||
|
+
|
||||||
|
+ movq %r8, %rax /* use third arg as return value after jump */
|
||||||
|
+ movq %r8, %rcx /* use third arg as first arg in context function */
|
||||||
|
+
|
||||||
|
+ jmp *%r10 /* indirect jump to caller */
|
||||||
|
+.seh_endproc
|
|
@ -0,0 +1,782 @@
|
||||||
|
=== modified file 'libs/context/build/Jamfile.v2'
|
||||||
|
--- libs/context/build/Jamfile.v2 2013-12-30 19:16:18 +0000
|
||||||
|
+++ libs/context/build/Jamfile.v2 2014-01-03 18:10:41 +0000
|
||||||
|
@@ -188,6 +188,15 @@
|
||||||
|
<binary-format>elf
|
||||||
|
;
|
||||||
|
|
||||||
|
+alias asm_context_sources
|
||||||
|
+ : [ make asm/make_ppc32_sysv_macho_gas.o : asm/make_ppc32_sysv_macho_gas.S : @gas ]
|
||||||
|
+ [ make asm/jump_ppc32_sysv_macho_gas.o : asm/jump_ppc32_sysv_macho_gas.S : @gas ]
|
||||||
|
+ : <address-model>32
|
||||||
|
+ <architecture>power
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
# POWERPC_64
|
||||||
|
alias asm_context_sources
|
||||||
|
: asm/make_ppc64_sysv_elf_gas.S
|
||||||
|
@@ -215,6 +224,15 @@
|
||||||
|
<binary-format>elf
|
||||||
|
;
|
||||||
|
|
||||||
|
+alias asm_context_sources
|
||||||
|
+ : [ make asm/make_ppc64_sysv_macho_gas.o : asm/make_ppc64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ [ make asm/jump_ppc64_sysv_macho_gas.o : asm/jump_ppc64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ : <address-model>64
|
||||||
|
+ <architecture>power
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
# SPARC
|
||||||
|
alias asm_context_sources
|
||||||
|
: asm/make_sparc_sysv_elf_gas.S
|
||||||
|
@@ -414,6 +432,25 @@
|
||||||
|
;
|
||||||
|
|
||||||
|
alias asm_context_sources
|
||||||
|
+ : asm/make_i386_x86_64_sysv_macho_gas.S
|
||||||
|
+ asm/jump_i386_x86_64_sysv_macho_gas.S
|
||||||
|
+ : <address-model>32_64
|
||||||
|
+ <architecture>x86
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ <toolset>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
+ : [ make asm/make_i386_x86_64_sysv_macho_gas.o : asm/make_i386_x86_64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ [ make asm/jump_i386_x86_64_sysv_macho_gas.o : asm/jump_i386_x86_64_sysv_macho_gas.S : @gas ]
|
||||||
|
+ : <address-model>32_64
|
||||||
|
+ <architecture>x86
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
: asm/make_x86_64_ms_pe_masm.asm
|
||||||
|
asm/jump_x86_64_ms_pe_masm.asm
|
||||||
|
dummy.cpp
|
||||||
|
@@ -424,6 +461,25 @@
|
||||||
|
<toolset>intel
|
||||||
|
;
|
||||||
|
|
||||||
|
+#COMBINED
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
+ : asm/make_combined_sysv_macho_gas.S
|
||||||
|
+ asm/jump_combined_sysv_macho_gas.S
|
||||||
|
+ : <architecture>combined
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ <toolset>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
+alias asm_context_sources
|
||||||
|
+ : [ make asm/make_combined_sysv_macho_gas.o : asm/make_combined_sysv_macho_gas.S : @gas ]
|
||||||
|
+ [ make asm/jump_combined_sysv_macho_gas.o : asm/jump_combined_sysv_macho_gas.S : @gas ]
|
||||||
|
+ : <architecture>combined
|
||||||
|
+ <binary-format>mach-o
|
||||||
|
+ <target-os>darwin
|
||||||
|
+ ;
|
||||||
|
+
|
||||||
|
alias asm_context_sources
|
||||||
|
: asm/make_x86_64_ms_pe_masm.asm
|
||||||
|
asm/jump_x86_64_ms_pe_masm.asm
|
||||||
|
|
||||||
|
=== modified file 'libs/context/build/architecture.jam'
|
||||||
|
--- libs/context/build/architecture.jam 2013-12-30 19:16:18 +0000
|
||||||
|
+++ libs/context/build/architecture.jam 2014-01-02 10:47:09 +0000
|
||||||
|
@@ -71,6 +71,14 @@
|
||||||
|
{
|
||||||
|
return <architecture>x86 ;
|
||||||
|
}
|
||||||
|
+ else if [ configure.builds /boost/architecture//ppc : $(properties) : ppc ]
|
||||||
|
+ {
|
||||||
|
+ return <architecture>ppc ;
|
||||||
|
+ }
|
||||||
|
+ else if [ configure.builds /boost/architecture//combined : $(properties) : combined ]
|
||||||
|
+ {
|
||||||
|
+ return <architecture>combined ;
|
||||||
|
+ }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/jump_combined_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/jump_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/jump_combined_sysv_macho_gas.S 2014-01-03 17:46:02 +0000
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Sergue E. Leontiev 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+// Stub file for universal binary
|
||||||
|
+
|
||||||
|
+#if defined(__i386__)
|
||||||
|
+ #include "jump_i386_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__x86_64__)
|
||||||
|
+ #include "jump_x86_64_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__ppc__)
|
||||||
|
+ #include "jump_ppc32_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__ppc64__)
|
||||||
|
+ #include "jump_ppc64_sysv_macho_gas.S"
|
||||||
|
+#else
|
||||||
|
+ #error "No arch's"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/jump_ppc32_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/jump_ppc32_sysv_macho_gas.S 2014-01-03 15:18:19 +0000
|
||||||
|
@@ -0,0 +1,180 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/*******************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 84 | 88 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | CR | LR | PC | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 23 | 24 | 25 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 92 | 96 | 100 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | sp | size|<pad>| | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F14 | F15 | F16 | F17 | F18 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F19 | F20 | F21 | F22 | F23 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F24 | F25 | F26 | F27 | F28 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F29 | F30 | F31 | fpscr | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.machine ppc
|
||||||
|
+
|
||||||
|
+.text
|
||||||
|
+.globl _jump_fcontext
|
||||||
|
+.align 2
|
||||||
|
+_jump_fcontext:
|
||||||
|
+ stw r13, 0(r3) ; save R13
|
||||||
|
+ stw r14, 4(r3) ; save R14
|
||||||
|
+ stw r15, 8(r3) ; save R15
|
||||||
|
+ stw r16, 12(r3) ; save R16
|
||||||
|
+ stw r17, 16(r3) ; save R17
|
||||||
|
+ stw r18, 20(r3) ; save R18
|
||||||
|
+ stw r19, 24(r3) ; save R19
|
||||||
|
+ stw r20, 28(r3) ; save R20
|
||||||
|
+ stw r21, 32(r3) ; save R21
|
||||||
|
+ stw r22, 36(r3) ; save R22
|
||||||
|
+ stw r23, 40(r3) ; save R23
|
||||||
|
+ stw r24, 44(r3) ; save R24
|
||||||
|
+ stw r25, 48(r3) ; save R25
|
||||||
|
+ stw r26, 52(r3) ; save R26
|
||||||
|
+ stw r27, 56(r3) ; save R27
|
||||||
|
+ stw r28, 60(r3) ; save R28
|
||||||
|
+ stw r29, 64(r3) ; save R29
|
||||||
|
+ stw r30, 68(r3) ; save R30
|
||||||
|
+ stw r31, 72(r3) ; save R31
|
||||||
|
+ stw r1, 76(r3) ; save SP
|
||||||
|
+
|
||||||
|
+ mfcr r0 ; load CR
|
||||||
|
+ stw r0, 80(r3) ; save CR
|
||||||
|
+ mflr r0 ; load LR
|
||||||
|
+ stw r0, 84(r3) ; save LR
|
||||||
|
+ stw r0, 88(r3) ; save LR as PC
|
||||||
|
+
|
||||||
|
+ cmpwi cr7, r6, 0 ; test if fpu env should be preserved
|
||||||
|
+ beq cr7, l1
|
||||||
|
+
|
||||||
|
+ stfd f14, 104(r3) ; save F14
|
||||||
|
+ stfd f15, 112(r3) ; save F15
|
||||||
|
+ stfd f16, 120(r3) ; save F16
|
||||||
|
+ stfd f17, 128(r3) ; save F17
|
||||||
|
+ stfd f18, 136(r3) ; save F18
|
||||||
|
+ stfd f19, 144(r3) ; save F19
|
||||||
|
+ stfd f20, 152(r3) ; save F20
|
||||||
|
+ stfd f21, 160(r3) ; save F21
|
||||||
|
+ stfd f22, 168(r3) ; save F22
|
||||||
|
+ stfd f23, 176(r3) ; save F23
|
||||||
|
+ stfd f24, 184(r3) ; save F24
|
||||||
|
+ stfd f25, 192(r3) ; save F25
|
||||||
|
+ stfd f26, 200(r3) ; save F26
|
||||||
|
+ stfd f27, 208(r3) ; save F27
|
||||||
|
+ stfd f28, 216(r3) ; save F28
|
||||||
|
+ stfd f29, 224(r3) ; save F29
|
||||||
|
+ stfd f30, 232(r3) ; save F30
|
||||||
|
+ stfd f31, 240(r3) ; save F31
|
||||||
|
+ mffs f0 ; load FPSCR
|
||||||
|
+ stfd f0, 248(r3) ; save FPSCR
|
||||||
|
+
|
||||||
|
+ lfd f14, 104(r4) ; restore F14
|
||||||
|
+ lfd f15, 112(r4) ; restore F15
|
||||||
|
+ lfd f16, 120(r4) ; restore F16
|
||||||
|
+ lfd f17, 128(r4) ; restore F17
|
||||||
|
+ lfd f18, 136(r4) ; restore F18
|
||||||
|
+ lfd f19, 144(r4) ; restore F19
|
||||||
|
+ lfd f20, 152(r4) ; restore F20
|
||||||
|
+ lfd f21, 160(r4) ; restore F21
|
||||||
|
+ lfd f22, 168(r4) ; restore F22
|
||||||
|
+ lfd f23, 176(r4) ; restore F23
|
||||||
|
+ lfd f24, 184(r4) ; restore F24
|
||||||
|
+ lfd f25, 192(r4) ; restore F25
|
||||||
|
+ lfd f26, 200(r4) ; restore F26
|
||||||
|
+ lfd f27, 208(r4) ; restore F27
|
||||||
|
+ lfd f28, 216(r4) ; restore F28
|
||||||
|
+ lfd f29, 224(r4) ; restore F29
|
||||||
|
+ lfd f30, 232(r4) ; restore F30
|
||||||
|
+ lfd f31, 240(r4) ; restore F31
|
||||||
|
+ lfd f0, 248(r4) ; load FPSCR
|
||||||
|
+ mtfsf 0xff, f0 ; restore FPSCR
|
||||||
|
+l1:
|
||||||
|
+
|
||||||
|
+ lwz r13, 0(r4) ; restore R13
|
||||||
|
+ lwz r14, 4(r4) ; restore R14
|
||||||
|
+ lwz r15, 8(r4) ; restore R15
|
||||||
|
+ lwz r16, 12(r4) ; restore R16
|
||||||
|
+ lwz r17, 16(r4) ; restore R17
|
||||||
|
+ lwz r18, 20(r4) ; restore R18
|
||||||
|
+ lwz r19, 24(r4) ; restore R19
|
||||||
|
+ lwz r20, 28(r4) ; restore R20
|
||||||
|
+ lwz r21, 32(r4) ; restore R21
|
||||||
|
+ lwz r22, 36(r4) ; restore R22
|
||||||
|
+ lwz r23, 40(r4) ; restore R23
|
||||||
|
+ lwz r24, 44(r4) ; restore R24
|
||||||
|
+ lwz r25, 48(r4) ; restore R25
|
||||||
|
+ lwz r26, 52(r4) ; restore R26
|
||||||
|
+ lwz r27, 56(r4) ; restore R27
|
||||||
|
+ lwz r28, 60(r4) ; restore R28
|
||||||
|
+ lwz r29, 64(r4) ; restore R29
|
||||||
|
+ lwz r30, 68(r4) ; restore R30
|
||||||
|
+ lwz r31, 72(r4) ; restore R31
|
||||||
|
+ lwz r1, 76(r4) ; restore SP
|
||||||
|
+
|
||||||
|
+ lwz r0, 80(r4) ; load CR
|
||||||
|
+ mtcr r0 ; restore CR
|
||||||
|
+ lwz r0, 84(r4) ; load LR
|
||||||
|
+ mtlr r0 ; restore LR
|
||||||
|
+
|
||||||
|
+ mr r3, r5 ; use third arg as return value after jump
|
||||||
|
+ ; and as first arg in context function
|
||||||
|
+
|
||||||
|
+ lwz r0, 88(r4) ; load PC
|
||||||
|
+ mtctr r0 ; restore CTR
|
||||||
|
+
|
||||||
|
+ bctr ; jump to context
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/jump_ppc64_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/jump_ppc64_sysv_macho_gas.S 2014-01-03 17:54:53 +0000
|
||||||
|
@@ -0,0 +1,193 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/*******************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R13 | R14 | R15 | R16 | R17 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R18 | R19 | R20 | R21 | R22 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R23 | R24 | R25 | R26 | R27 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R28 | R29 | R30 | R31 | SP | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 41 | 42 | 43 | 44 | 45 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 160 | 164 | 168 | 172 | 176 | 180 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | CR | LR | PC | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 46 | 47 | 48 | 49 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 184 | 188 | 192 | 196 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F14 | F15 | F16 | F17 | F18 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F19 | F20 | F21 | F22 | F23 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F24 | F25 | F26 | F27 | F28 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F29 | F30 | F31 | fpscr | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.text
|
||||||
|
+.align 2
|
||||||
|
+.globl jump_fcontext
|
||||||
|
+
|
||||||
|
+_jump_fcontext:
|
||||||
|
+ std r13, 0(r3) ; save R13
|
||||||
|
+ std r14, 8(r3) ; save R14
|
||||||
|
+ std r15, 16(r3) ; save R15
|
||||||
|
+ std r16, 24(r3) ; save R16
|
||||||
|
+ std r17, 32(r3) ; save R17
|
||||||
|
+ std r18, 40(r3) ; save R18
|
||||||
|
+ std r19, 48(r3) ; save R19
|
||||||
|
+ std r20, 56(r3) ; save R20
|
||||||
|
+ std r21, 64(r3) ; save R21
|
||||||
|
+ std r22, 72(r3) ; save R22
|
||||||
|
+ std r23, 80(r3) ; save R23
|
||||||
|
+ std r24, 88(r3) ; save R24
|
||||||
|
+ std r25, 96(r3) ; save R25
|
||||||
|
+ std r26, 104(r3) ; save R26
|
||||||
|
+ std r27, 112(r3) ; save R27
|
||||||
|
+ std r28, 120(r3) ; save R28
|
||||||
|
+ std r29, 128(r3) ; save R29
|
||||||
|
+ std r30, 136(r3) ; save R30
|
||||||
|
+ std r31, 144(r3) ; save R31
|
||||||
|
+ std r1, 152(r3) ; save SP
|
||||||
|
+
|
||||||
|
+ mfcr r0 ; load CR
|
||||||
|
+ std r0, 160(r3) ; save CR
|
||||||
|
+ mflr r0 ; load LR
|
||||||
|
+ std r0, 168(r3) ; save LR
|
||||||
|
+ std r0, 176(r3) ; save LR as PC
|
||||||
|
+
|
||||||
|
+ cmpwi cr7, r6, 0 ; test if fpu env should be preserved
|
||||||
|
+ beq cr7, l1
|
||||||
|
+
|
||||||
|
+ stfd f14, 200(r3) ; save F14
|
||||||
|
+ stfd f15, 208(r3) ; save F15
|
||||||
|
+ stfd f16, 216(r3) ; save F16
|
||||||
|
+ stfd f17, 224(r3) ; save F17
|
||||||
|
+ stfd f18, 232(r3) ; save F18
|
||||||
|
+ stfd f19, 240(r3) ; save F19
|
||||||
|
+ stfd f20, 248(r3) ; save F20
|
||||||
|
+ stfd f21, 256(r3) ; save F21
|
||||||
|
+ stfd f22, 264(r3) ; save F22
|
||||||
|
+ stfd f23, 272(r3) ; save F23
|
||||||
|
+ stfd f24, 280(r3) ; save F24
|
||||||
|
+ stfd f25, 288(r3) ; save F25
|
||||||
|
+ stfd f26, 296(r3) ; save F26
|
||||||
|
+ stfd f27, 304(r3) ; save F27
|
||||||
|
+ stfd f28, 312(r3) ; save F28
|
||||||
|
+ stfd f29, 320(r3) ; save F29
|
||||||
|
+ stfd f30, 328(r3) ; save F30
|
||||||
|
+ stfd f31, 336(r3) ; save F31
|
||||||
|
+ mffs f0 ; load FPSCR
|
||||||
|
+ stfd f0, 344(r3) ; save FPSCR
|
||||||
|
+
|
||||||
|
+ lfd f14, 200(r4) ; restore F14
|
||||||
|
+ lfd f15, 208(r4) ; restore F15
|
||||||
|
+ lfd f16, 216(r4) ; restore F16
|
||||||
|
+ lfd f17, 224(r4) ; restore F17
|
||||||
|
+ lfd f18, 232(r4) ; restore F18
|
||||||
|
+ lfd f19, 240(r4) ; restore F19
|
||||||
|
+ lfd f20, 248(r4) ; restore F20
|
||||||
|
+ lfd f21, 256(r4) ; restore F21
|
||||||
|
+ lfd f22, 264(r4) ; restore F22
|
||||||
|
+ lfd f23, 272(r4) ; restore F23
|
||||||
|
+ lfd f24, 280(r4) ; restore F24
|
||||||
|
+ lfd f25, 288(r4) ; restore F25
|
||||||
|
+ lfd f26, 296(r4) ; restore F26
|
||||||
|
+ lfd f27, 304(r4) ; restore F27
|
||||||
|
+ lfd f28, 312(r4) ; restore F28
|
||||||
|
+ lfd f29, 320(r4) ; restore F29
|
||||||
|
+ lfd f30, 328(r4) ; restore F30
|
||||||
|
+ lfd f31, 336(r4) ; restore F31
|
||||||
|
+ lfd f0, 344(r4) ; load FPSCR
|
||||||
|
+ mtfsf 0xff, f0 ; restore FPSCR
|
||||||
|
+l1:
|
||||||
|
+
|
||||||
|
+ ld r13, 0(r4) ; restore R13
|
||||||
|
+ ld r14, 8(r4) ; restore R14
|
||||||
|
+ ld r15, 16(r4) ; restore R15
|
||||||
|
+ ld r16, 24(r4) ; restore R16
|
||||||
|
+ ld r17, 32(r4) ; restore R17
|
||||||
|
+ ld r18, 40(r4) ; restore R18
|
||||||
|
+ ld r19, 48(r4) ; restore R19
|
||||||
|
+ ld r20, 56(r4) ; restore R20
|
||||||
|
+ ld r21, 64(r4) ; restore R21
|
||||||
|
+ ld r22, 72(r4) ; restore R22
|
||||||
|
+ ld r23, 80(r4) ; restore R23
|
||||||
|
+ ld r24, 88(r4) ; restore R24
|
||||||
|
+ ld r25, 96(r4) ; restore R25
|
||||||
|
+ ld r26, 104(r4) ; restore R26
|
||||||
|
+ ld r27, 112(r4) ; restore R27
|
||||||
|
+ ld r28, 120(r4) ; restore R28
|
||||||
|
+ ld r29, 128(r4) ; restore R29
|
||||||
|
+ ld r30, 136(r4) ; restore r30
|
||||||
|
+ ld r31, 144(r4) ; restore r31
|
||||||
|
+ ld r1, 152(r4) ; restore SP
|
||||||
|
+
|
||||||
|
+ ld r0, 160(r4) ; load CR
|
||||||
|
+ mtcr r0 ; restore CR
|
||||||
|
+ ld r0, 168(r4) ; load LR
|
||||||
|
+ mtlr r0 ; restore LR
|
||||||
|
+
|
||||||
|
+ mr r3, r5 ; use third arg as return value after jump
|
||||||
|
+ ; and as first arg in context function
|
||||||
|
+
|
||||||
|
+ ld r0, 176(r4) ; load PC
|
||||||
|
+ mtctr r0 ; restore CTR
|
||||||
|
+
|
||||||
|
+ bctr ; jump to context
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/make_combined_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/make_combined_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/make_combined_sysv_macho_gas.S 2014-01-03 17:50:32 +0000
|
||||||
|
@@ -0,0 +1,20 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Sergue E. Leontiev 2013.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+// Stub file for universal binary
|
||||||
|
+
|
||||||
|
+#if defined(__i386__)
|
||||||
|
+ #include "make_i386_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__x86_64__)
|
||||||
|
+ #include "make_x86_64_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__ppc__)
|
||||||
|
+ #include "make_ppc32_sysv_macho_gas.S"
|
||||||
|
+#elif defined(__ppc64__)
|
||||||
|
+ #include "make_ppc64_sysv_macho_gas.S"
|
||||||
|
+#else
|
||||||
|
+ #error "No arch's"
|
||||||
|
+#endif
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/make_ppc32_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/make_ppc32_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/make_ppc32_sysv_macho_gas.S 2014-01-02 21:27:23 +0000
|
||||||
|
@@ -0,0 +1,109 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/*******************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R13 | R14 | R15 | R16 | R17 | R18 | R19 | R20 | R21 | R22 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R23 | R24 | R25 | R26 | R27 | R28 | R29 | R30 | R31 | SP | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 84 | 88 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | CR | LR | PC | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 23 | 24 | 25 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 92 | 96 | 100 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | sp | size|<pad>| | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 104 | 108 | 112 | 116 | 120 | 124 | 128 | 132 | 136 | 140 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F14 | F15 | F16 | F17 | F18 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 144 | 148 | 152 | 156 | 160 | 164 | 168 | 172 | 176 | 180 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F19 | F20 | F21 | F22 | F23 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 184 | 188 | 192 | 196 | 200 | 204 | 208 | 212 | 216 | 220 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F24 | F25 | F26 | F27 | F28 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 56 | 57 | 58 | 59 | 60 | 61 | 62 | 63 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 224 | 228 | 232 | 236 | 240 | 244 | 248 | 252 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F29 | F30 | F31 | fpscr | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.text
|
||||||
|
+.globl _make_fcontext
|
||||||
|
+.align 2
|
||||||
|
+_make_fcontext:
|
||||||
|
+ mflr r6 ; save return address into R6
|
||||||
|
+
|
||||||
|
+ mr r0, r3
|
||||||
|
+ subi r3, r3, 256 ; reserve space for fcontext_t at top of context stack
|
||||||
|
+
|
||||||
|
+ ; call align_stack, R3 contains address at 16 byte boundary after return
|
||||||
|
+ ; == pointer to fcontext_t and address of context stack
|
||||||
|
+ clrrwi r3, r3, 4
|
||||||
|
+
|
||||||
|
+ stw r0, 92(r3) ; save address of context stack (base) in fcontext_t
|
||||||
|
+ stw r4, 96(r3) ; save context stack size in fcontext_t
|
||||||
|
+ stw r5, 88(r3) ; save address of context function in fcontext_t
|
||||||
|
+
|
||||||
|
+ subi r0, r3, 64 ; reserve 64 bytes (linkage + parameter area), R4 % 16 == 0
|
||||||
|
+ stw r0, 76(r3) ; save address in R3 as stack pointer for context function
|
||||||
|
+
|
||||||
|
+ mflr r0 ; load LR
|
||||||
|
+ bl l1 ; jump to label 1
|
||||||
|
+l1:
|
||||||
|
+ mflr r4 ; load LR into R4
|
||||||
|
+ addi r4, r4, lo16((finish - .)+4) ; compute abs address of label finish
|
||||||
|
+ mtlr r0 ; restore LR
|
||||||
|
+ stw r4, 84(r3) ; save address of finish as return address for context function
|
||||||
|
+ ; entered after context function returns
|
||||||
|
+
|
||||||
|
+ mtlr r6 ; restore return address from R6
|
||||||
|
+
|
||||||
|
+ blr
|
||||||
|
+
|
||||||
|
+finish:
|
||||||
|
+ ; SP points to same address as SP on entry of context function
|
||||||
|
+ mflr r0 ; save return address into R0
|
||||||
|
+ stw r0, 4(r1) ; save return address on stack, set up stack frame
|
||||||
|
+ stwu r1, -16(r1) ; allocate stack space, SP % 16 == 0
|
||||||
|
+
|
||||||
|
+ li r3, 0 ; exit code is zero
|
||||||
|
+ bl __exit ; exit application
|
||||||
|
|
||||||
|
=== added file 'libs/context/src/asm/make_ppc64_sysv_macho_gas.S'
|
||||||
|
--- libs/context/src/asm/make_ppc64_sysv_macho_gas.S 1970-01-01 00:00:00 +0000
|
||||||
|
+++ libs/context/src/asm/make_ppc64_sysv_macho_gas.S 2014-01-03 18:04:45 +0000
|
||||||
|
@@ -0,0 +1,123 @@
|
||||||
|
+/*
|
||||||
|
+ Copyright Oliver Kowalke 2009.
|
||||||
|
+ Distributed under the Boost Software License, Version 1.0.
|
||||||
|
+ (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
|
+ http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
+*/
|
||||||
|
+
|
||||||
|
+/*******************************************************************
|
||||||
|
+ * *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 0 | 4 | 8 | 12 | 16 | 20 | 24 | 28 | 32 | 36 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R13 | R14 | R15 | R16 | R17 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 68 | 72 | 76 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R18 | R19 | R20 | R21 | R22 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 84 | 88 | 92 | 96 | 100 | 104 | 108 | 112 | 116 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R23 | R24 | R25 | R26 | R27 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 120 | 124 | 128 | 132 | 136 | 140 | 144 | 148 | 152 | 156 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | R28 | R29 | R30 | R31 | SP | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 40 | 41 | 42 | 43 | 44 | 45 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 160 | 164 | 168 | 172 | 176 | 180 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | CR | LR | PC | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 46 | 47 | 48 | 49 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 184 | 188 | 192 | 196 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | sp | size | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | 58 | 59 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 200 | 204 | 208 | 212 | 216 | 220 | 224 | 228 | 232 | 236 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F14 | F15 | F16 | F17 | F18 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | 68 | 69 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 240 | 244 | 248 | 252 | 256 | 260 | 264 | 268 | 272 | 276 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F19 | F20 | F21 | F22 | F23 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 70 | 71 | 72 | 73 | 74 | 75 | 76 | 77 | 78 | 79 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 280 | 284 | 288 | 292 | 296 | 300 | 304 | 308 | 312 | 316 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F24 | F25 | F26 | F27 | F28 | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 80 | 81 | 82 | 83 | 84 | 85 | 86 | 87 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | 320 | 324 | 328 | 332 | 336 | 340 | 344 | 348 | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * | F29 | F30 | F31 | fpscr | | *
|
||||||
|
+ * ------------------------------------------------------------- *
|
||||||
|
+ * *
|
||||||
|
+ * *****************************************************************/
|
||||||
|
+
|
||||||
|
+.text
|
||||||
|
+.globl _make_fcontext
|
||||||
|
+_make_fcontext:
|
||||||
|
+ mflr r6 ; save return address into R6
|
||||||
|
+
|
||||||
|
+ mr r0, r3
|
||||||
|
+ subi r3, r3, 352 ; reserve space for fcontext_t at top of context stack
|
||||||
|
+
|
||||||
|
+ ; call align_stack, R3 contains address at 16 byte boundary after return
|
||||||
|
+ ; == pointer to fcontext_t and address of context stack
|
||||||
|
+ clrrdi r3, r3, 4
|
||||||
|
+
|
||||||
|
+ std r0, 184(r3) ; save address of context stack (base) in fcontext_t
|
||||||
|
+ std r4, 192(r3) ; save context stack size in fcontext_t
|
||||||
|
+ std r5, 176(r3) ; save address of context function in fcontext_t
|
||||||
|
+
|
||||||
|
+ subi r0, r3, 64 ; 64 bytes on stack for parameter area (== 8 registers)
|
||||||
|
+ std r0, 152(r3) ; save the stack base
|
||||||
|
+
|
||||||
|
+ mflr r0 ; load LR
|
||||||
|
+ bl l1 ; jump to label 1
|
||||||
|
+l1:
|
||||||
|
+ mflr r4 ; load LR into R4
|
||||||
|
+ addi r4, r4, lo16((finish - .) + 4) ; compute abs address of label finish
|
||||||
|
+ mtlr r0 ; restore LR
|
||||||
|
+ std r4, 168(r3) ; save address of finish as return address for context function
|
||||||
|
+ ; entered after context function returns
|
||||||
|
+
|
||||||
|
+ mtlr r6 ; restore return address from R6
|
||||||
|
+
|
||||||
|
+ blr
|
||||||
|
+
|
||||||
|
+finish:
|
||||||
|
+ ; SP points to same address as SP on entry of context function
|
||||||
|
+ mflr r0 ; save return address into R0
|
||||||
|
+ stw r0, 8(r1) ; save return address on stack, set up stack frame
|
||||||
|
+ stwu r1, -32(r1) ; allocate stack space, SP % 16 == 0
|
||||||
|
+
|
||||||
|
+ li r3, 0 ; set return value to zero
|
||||||
|
+ bl __exit ; exit application
|
||||||
|
+ nop
|
||||||
|
|
|
@ -32,5 +32,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -55,6 +55,8 @@ set( PCBNEW_DIALOGS
|
||||||
dialogs/dialog_edit_module_text.cpp
|
dialogs/dialog_edit_module_text.cpp
|
||||||
dialogs/dialog_edit_module_text_base.cpp
|
dialogs/dialog_edit_module_text_base.cpp
|
||||||
dialogs/dialog_exchange_modules_base.cpp
|
dialogs/dialog_exchange_modules_base.cpp
|
||||||
|
dialogs/dialog_export_idf.cpp
|
||||||
|
dialogs/dialog_export_idf_base.cpp
|
||||||
dialogs/dialog_export_vrml_base.cpp
|
dialogs/dialog_export_vrml_base.cpp
|
||||||
dialogs/dialog_export_vrml.cpp
|
dialogs/dialog_export_vrml.cpp
|
||||||
dialogs/dialog_find_base.cpp
|
dialogs/dialog_find_base.cpp
|
||||||
|
@ -173,6 +175,7 @@ set( PCBNEW_CLASS_SRCS
|
||||||
event_handlers_tracks_vias_sizes.cpp
|
event_handlers_tracks_vias_sizes.cpp
|
||||||
export_d356.cpp
|
export_d356.cpp
|
||||||
export_gencad.cpp
|
export_gencad.cpp
|
||||||
|
export_idf.cpp
|
||||||
export_vrml.cpp
|
export_vrml.cpp
|
||||||
files.cpp
|
files.cpp
|
||||||
gen_drill_report_files.cpp
|
gen_drill_report_files.cpp
|
||||||
|
@ -183,6 +186,7 @@ set( PCBNEW_CLASS_SRCS
|
||||||
hotkeys.cpp
|
hotkeys.cpp
|
||||||
hotkeys_board_editor.cpp
|
hotkeys_board_editor.cpp
|
||||||
hotkeys_module_editor.cpp
|
hotkeys_module_editor.cpp
|
||||||
|
idf.cpp
|
||||||
initpcb.cpp
|
initpcb.cpp
|
||||||
layer_widget.cpp
|
layer_widget.cpp
|
||||||
librairi.cpp
|
librairi.cpp
|
||||||
|
@ -213,6 +217,8 @@ set( PCBNEW_CLASS_SRCS
|
||||||
print_board_functions.cpp
|
print_board_functions.cpp
|
||||||
printout_controler.cpp
|
printout_controler.cpp
|
||||||
ratsnest.cpp
|
ratsnest.cpp
|
||||||
|
ratsnest_data.cpp
|
||||||
|
ratsnest_viewitem.cpp
|
||||||
# specctra.cpp #moved in pcbcommon lib
|
# specctra.cpp #moved in pcbcommon lib
|
||||||
# specctra_export.cpp
|
# specctra_export.cpp
|
||||||
# specctra_keywords.cpp
|
# specctra_keywords.cpp
|
||||||
|
@ -374,6 +380,7 @@ if( KICAD_SCRIPTING_MODULES )
|
||||||
gal
|
gal
|
||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
|
${PIXMAN_LIBRARY}
|
||||||
${wxWidgets_LIBRARIES}
|
${wxWidgets_LIBRARIES}
|
||||||
${OPENGL_LIBRARIES}
|
${OPENGL_LIBRARIES}
|
||||||
${GDI_PLUS_LIBRARIES}
|
${GDI_PLUS_LIBRARIES}
|
||||||
|
@ -551,6 +558,7 @@ target_link_libraries( pcbnew
|
||||||
${PCBNEW_EXTRA_LIBS}
|
${PCBNEW_EXTRA_LIBS}
|
||||||
${GLEW_LIBRARIES}
|
${GLEW_LIBRARIES}
|
||||||
${CAIRO_LIBRARIES}
|
${CAIRO_LIBRARIES}
|
||||||
|
${PIXMAN_LIBRARY}
|
||||||
${Boost_LIBRARIES} # must follow GITHUB
|
${Boost_LIBRARIES} # must follow GITHUB
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -48,5 +48,7 @@
|
||||||
<true/>
|
<true/>
|
||||||
<key>NSHumanReadableCopyright</key>
|
<key>NSHumanReadableCopyright</key>
|
||||||
<string></string>
|
<string></string>
|
||||||
|
<key>NSHighResolutionCapable</key>
|
||||||
|
<string>True</string>
|
||||||
</dict>
|
</dict>
|
||||||
</plist>
|
</plist>
|
||||||
|
|
|
@ -54,6 +54,8 @@
|
||||||
#include <trigo.h>
|
#include <trigo.h>
|
||||||
#include <pcb_painter.h>
|
#include <pcb_painter.h>
|
||||||
#include <worksheet_viewitem.h>
|
#include <worksheet_viewitem.h>
|
||||||
|
#include <ratsnest_data.h>
|
||||||
|
#include <ratsnest_viewitem.h>
|
||||||
|
|
||||||
#include <tool/tool_manager.h>
|
#include <tool/tool_manager.h>
|
||||||
#include <tool/tool_dispatcher.h>
|
#include <tool/tool_dispatcher.h>
|
||||||
|
@ -79,6 +81,7 @@ const LAYER_NUM PCB_BASE_FRAME::GAL_LAYER_ORDER[] =
|
||||||
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
ITEM_GAL_LAYER( MOD_TEXT_FR_VISIBLE ),
|
||||||
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
ITEM_GAL_LAYER( MOD_REFERENCES_VISIBLE), ITEM_GAL_LAYER( MOD_VALUES_VISIBLE ),
|
||||||
|
|
||||||
|
ITEM_GAL_LAYER( RATSNEST_VISIBLE ),
|
||||||
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
ITEM_GAL_LAYER( VIAS_HOLES_VISIBLE ), ITEM_GAL_LAYER( PADS_HOLES_VISIBLE ),
|
||||||
ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
ITEM_GAL_LAYER( VIAS_VISIBLE ), ITEM_GAL_LAYER( PADS_VISIBLE ),
|
||||||
|
|
||||||
|
@ -149,10 +152,12 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( wxWindow* aParent, ID_DRAWFRAME_TYPE aFrameType,
|
||||||
m_FastGrid1 = 0;
|
m_FastGrid1 = 0;
|
||||||
m_FastGrid2 = 0;
|
m_FastGrid2 = 0;
|
||||||
|
|
||||||
m_galCanvas = new EDA_DRAW_PANEL_GAL( this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
SetGalCanvas( new EDA_DRAW_PANEL_GAL(
|
||||||
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
|
this, -1, wxPoint( 0, 0 ), m_FrameSize,
|
||||||
|
EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL ) );
|
||||||
|
|
||||||
// Hide by default, it has to be explicitly shown
|
// Hide by default, it has to be explicitly shown
|
||||||
m_galCanvas->Hide();
|
GetGalCanvas()->Hide();
|
||||||
|
|
||||||
m_auxiliaryToolBar = NULL;
|
m_auxiliaryToolBar = NULL;
|
||||||
}
|
}
|
||||||
|
@ -163,7 +168,7 @@ PCB_BASE_FRAME::~PCB_BASE_FRAME()
|
||||||
delete m_Collector;
|
delete m_Collector;
|
||||||
|
|
||||||
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
|
delete m_Pcb; // is already NULL for FOOTPRINT_EDIT_FRAME
|
||||||
delete m_galCanvas;
|
delete GetGalCanvas();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -171,82 +176,6 @@ void PCB_BASE_FRAME::SetBoard( BOARD* aBoard )
|
||||||
{
|
{
|
||||||
delete m_Pcb;
|
delete m_Pcb;
|
||||||
m_Pcb = aBoard;
|
m_Pcb = aBoard;
|
||||||
|
|
||||||
if( m_galCanvas )
|
|
||||||
{
|
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
|
||||||
|
|
||||||
try
|
|
||||||
{
|
|
||||||
ViewReloadBoard( m_Pcb );
|
|
||||||
}
|
|
||||||
catch( const std::exception& ex )
|
|
||||||
{
|
|
||||||
DBG(printf( "ViewReloadBoard: exception: %s\n", ex.what() );)
|
|
||||||
}
|
|
||||||
|
|
||||||
// update the tool manager with the new board and its view.
|
|
||||||
if( m_toolManager )
|
|
||||||
{
|
|
||||||
m_toolManager->SetEnvironment( m_Pcb, view, m_galCanvas->GetViewControls(), this );
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::MODEL_RELOAD );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::ViewReloadBoard( const BOARD* aBoard ) const
|
|
||||||
{
|
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
|
||||||
view->Clear();
|
|
||||||
|
|
||||||
// All the PCB drawable items should be added to the VIEW in order to be displayed
|
|
||||||
|
|
||||||
// Load zones
|
|
||||||
for( int i = 0; i < aBoard->GetAreaCount(); ++i )
|
|
||||||
view->Add( (KIGFX::VIEW_ITEM*) ( aBoard->GetArea( i ) ) );
|
|
||||||
|
|
||||||
// Load drawings
|
|
||||||
for( BOARD_ITEM* drawing = aBoard->m_Drawings; drawing; drawing = drawing->Next() )
|
|
||||||
view->Add( drawing );
|
|
||||||
|
|
||||||
// Load tracks
|
|
||||||
for( TRACK* track = aBoard->m_Track; track; track = track->Next() )
|
|
||||||
view->Add( track );
|
|
||||||
|
|
||||||
// Load modules and its additional elements
|
|
||||||
for( MODULE* module = aBoard->m_Modules; module; module = module->Next() )
|
|
||||||
{
|
|
||||||
// Load items that belong to a module
|
|
||||||
module->RunOnChildren( std::bind1st( std::mem_fun( &KIGFX::VIEW::Add ), view ) );
|
|
||||||
|
|
||||||
// Add the module itself
|
|
||||||
view->Add( module );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Segzones (equivalent of ZONE_CONTAINER for legacy boards)
|
|
||||||
for( SEGZONE* zone = aBoard->m_Zone; zone; zone = zone->Next() )
|
|
||||||
view->Add( zone );
|
|
||||||
|
|
||||||
// Add an entry for the worksheet layout
|
|
||||||
KIGFX::WORKSHEET_VIEWITEM* worksheet = new KIGFX::WORKSHEET_VIEWITEM(
|
|
||||||
std::string( aBoard->GetFileName().mb_str() ),
|
|
||||||
std::string( GetScreenDesc().mb_str() ),
|
|
||||||
&GetPageSettings(), &GetTitleBlock() );
|
|
||||||
BASE_SCREEN* screen = GetScreen();
|
|
||||||
if( screen != NULL )
|
|
||||||
{
|
|
||||||
worksheet->SetSheetNumber( GetScreen()->m_ScreenNumber );
|
|
||||||
worksheet->SetSheetCount( GetScreen()->m_NumberOfScreens );
|
|
||||||
}
|
|
||||||
|
|
||||||
view->Add( worksheet );
|
|
||||||
|
|
||||||
view->SetPanBoundary( worksheet->ViewBBox() );
|
|
||||||
view->RecacheAllItems( true );
|
|
||||||
|
|
||||||
if( m_galCanvasActive )
|
|
||||||
m_galCanvas->Refresh();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -510,11 +439,11 @@ void PCB_BASE_FRAME::OnTogglePadDrawMode( wxCommandEvent& aEvent )
|
||||||
|
|
||||||
// Apply new display options to the GAL canvas
|
// Apply new display options to the GAL canvas
|
||||||
KIGFX::PCB_PAINTER* painter =
|
KIGFX::PCB_PAINTER* painter =
|
||||||
static_cast<KIGFX::PCB_PAINTER*> ( m_galCanvas->GetView()->GetPainter() );
|
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
|
||||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
||||||
settings->LoadDisplayOptions( DisplayOpt );
|
settings->LoadDisplayOptions( DisplayOpt );
|
||||||
m_galCanvas->GetView()->RecacheAllItems( true );
|
GetGalCanvas()->GetView()->RecacheAllItems( true );
|
||||||
|
|
||||||
m_canvas->Refresh();
|
m_canvas->Refresh();
|
||||||
}
|
}
|
||||||
|
@ -584,21 +513,6 @@ void PCB_BASE_FRAME::OnUpdateSelectZoom( wxUpdateUIEvent& aEvent )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::UseGalCanvas( bool aEnable )
|
|
||||||
{
|
|
||||||
EDA_DRAW_FRAME::UseGalCanvas( aEnable );
|
|
||||||
|
|
||||||
ViewReloadBoard( m_Pcb );
|
|
||||||
|
|
||||||
if( aEnable )
|
|
||||||
{
|
|
||||||
m_toolManager->SetEnvironment( m_Pcb, m_galCanvas->GetView(),
|
|
||||||
m_galCanvas->GetViewControls(), this );
|
|
||||||
m_toolManager->ResetTools( TOOL_BASE::GAL_SWITCH );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
|
void PCB_BASE_FRAME::ProcessItemSelection( wxCommandEvent& aEvent )
|
||||||
{
|
{
|
||||||
int id = aEvent.GetId();
|
int id = aEvent.GetId();
|
||||||
|
@ -852,7 +766,7 @@ void PCB_BASE_FRAME::LoadSettings()
|
||||||
m_DisplayModText = FILLED;
|
m_DisplayModText = FILLED;
|
||||||
|
|
||||||
// Apply display settings for GAL
|
// Apply display settings for GAL
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
|
|
||||||
// Set rendering order and properties of layers
|
// Set rendering order and properties of layers
|
||||||
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
|
for( LAYER_NUM i = 0; (unsigned) i < sizeof(GAL_LAYER_ORDER) / sizeof(LAYER_NUM); ++i )
|
||||||
|
@ -892,6 +806,7 @@ void PCB_BASE_FRAME::LoadSettings()
|
||||||
view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
view->SetRequired( SOLDERMASK_N_BACK, ITEM_GAL_LAYER( PAD_BK_VISIBLE ) );
|
||||||
|
|
||||||
view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
view->SetLayerTarget( ITEM_GAL_LAYER( GP_OVERLAY ), KIGFX::TARGET_OVERLAY );
|
||||||
|
view->SetLayerTarget( ITEM_GAL_LAYER( RATSNEST_VISIBLE ), KIGFX::TARGET_OVERLAY );
|
||||||
|
|
||||||
// Apply layer coloring scheme & display options
|
// Apply layer coloring scheme & display options
|
||||||
if( view->GetPainter() )
|
if( view->GetPainter() )
|
||||||
|
|
|
@ -290,22 +290,19 @@ void TEXTE_PCB::TransformShapeWithClearanceToPolygonSet(
|
||||||
|
|
||||||
if( IsMultilineAllowed() )
|
if( IsMultilineAllowed() )
|
||||||
{
|
{
|
||||||
wxPoint pos = GetTextPosition();
|
|
||||||
wxArrayString* list = wxStringSplit( GetText(), '\n' );
|
wxArrayString* list = wxStringSplit( GetText(), '\n' );
|
||||||
wxPoint offset;
|
std::vector<wxPoint> positions;
|
||||||
|
positions.reserve( list->Count() );
|
||||||
|
GetPositionsOfLinesOfMultilineText( positions, list->Count() );
|
||||||
|
|
||||||
offset.y = GetInterline();
|
for( unsigned ii = 0; ii < list->Count(); ii++ )
|
||||||
RotatePoint( &offset, GetOrientation() );
|
|
||||||
|
|
||||||
for( unsigned i = 0; i<list->Count(); i++ )
|
|
||||||
{
|
{
|
||||||
wxString txt = list->Item( i );
|
wxString txt = list->Item( ii );
|
||||||
DrawGraphicText( NULL, NULL, pos, color,
|
DrawGraphicText( NULL, NULL, positions[ii], color,
|
||||||
txt, GetOrientation(), size,
|
txt, GetOrientation(), size,
|
||||||
GetHorizJustify(), GetVertJustify(),
|
GetHorizJustify(), GetVertJustify(),
|
||||||
GetThickness(), IsItalic(),
|
GetThickness(), IsItalic(),
|
||||||
true, addTextSegmToPoly );
|
true, addTextSegmToPoly );
|
||||||
pos += offset;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete list;
|
delete list;
|
||||||
|
|
|
@ -452,7 +452,7 @@ void PCB_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
|
||||||
BOARD_ITEM* item;
|
BOARD_ITEM* item;
|
||||||
bool not_found = false;
|
bool not_found = false;
|
||||||
bool reBuild_ratsnest = false;
|
bool reBuild_ratsnest = false;
|
||||||
KIGFX::VIEW* view = m_galCanvas->GetView();
|
KIGFX::VIEW* view = GetGalCanvas()->GetView();
|
||||||
|
|
||||||
// Undo in the reverse order of list creation: (this can allow stacked changes
|
// Undo in the reverse order of list creation: (this can allow stacked changes
|
||||||
// like the same item can be changes and deleted in the same complex command
|
// like the same item can be changes and deleted in the same complex command
|
||||||
|
|
|
@ -42,6 +42,7 @@
|
||||||
#include <pcb_netlist.h>
|
#include <pcb_netlist.h>
|
||||||
#include <reporter.h>
|
#include <reporter.h>
|
||||||
#include <base_units.h>
|
#include <base_units.h>
|
||||||
|
#include <ratsnest_data.h>
|
||||||
|
|
||||||
#include <pcbnew.h>
|
#include <pcbnew.h>
|
||||||
#include <colors_selection.h>
|
#include <colors_selection.h>
|
||||||
|
@ -102,11 +103,15 @@ BOARD::BOARD() :
|
||||||
m_NetClasses.GetDefault()->SetParams();
|
m_NetClasses.GetDefault()->SetParams();
|
||||||
|
|
||||||
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
|
SetCurrentNetClass( m_NetClasses.GetDefault()->GetName() );
|
||||||
|
|
||||||
|
m_ratsnest = new RN_DATA( this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BOARD::~BOARD()
|
BOARD::~BOARD()
|
||||||
{
|
{
|
||||||
|
delete m_ratsnest;
|
||||||
|
|
||||||
while( m_ZoneDescriptorList.size() )
|
while( m_ZoneDescriptorList.size() )
|
||||||
{
|
{
|
||||||
ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
|
ZONE_CONTAINER* area_to_remove = m_ZoneDescriptorList[0];
|
||||||
|
@ -2442,7 +2447,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ),
|
msg.Printf( _( "Checking netlist component footprint \"%s:%s:%s\".\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( component->GetTimeStamp() ),
|
GetChars( component->GetTimeStamp() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2460,7 +2465,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
|
msg.Printf( _( "Adding new component \"%s:%s\" footprint \"%s\".\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( component->GetTimeStamp() ),
|
GetChars( component->GetTimeStamp() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
|
|
||||||
if( aReporter->ReportWarnings() )
|
if( aReporter->ReportWarnings() )
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -2471,7 +2476,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
"footprint \"%s\".\n" ),
|
"footprint \"%s\".\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( component->GetTimeStamp() ),
|
GetChars( component->GetTimeStamp() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
|
|
||||||
if( aReporter->ReportErrors() )
|
if( aReporter->ReportErrors() )
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -2504,8 +2509,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
"\"%s\".\n" ),
|
"\"%s\".\n" ),
|
||||||
GetChars( footprint->GetReference() ),
|
GetChars( footprint->GetReference() ),
|
||||||
GetChars( footprint->GetPath() ),
|
GetChars( footprint->GetPath() ),
|
||||||
GetChars( FROM_UTF8( footprint->GetFPID().Format().c_str() ) ),
|
GetChars( footprint->GetFPID().Format() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
|
|
||||||
if( aReporter->ReportWarnings() )
|
if( aReporter->ReportWarnings() )
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -2516,7 +2521,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
"footprint \"%s\".\n" ),
|
"footprint \"%s\".\n" ),
|
||||||
GetChars( footprint->GetReference() ),
|
GetChars( footprint->GetReference() ),
|
||||||
GetChars( footprint->GetPath() ),
|
GetChars( footprint->GetPath() ),
|
||||||
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
|
GetChars( component->GetFPID().Format() ) );
|
||||||
|
|
||||||
if( aReporter->ReportErrors() )
|
if( aReporter->ReportErrors() )
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
|
@ -2750,7 +2755,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
|
||||||
msg.Printf( _( "** Error: Component \"%s\" pad '%s' not found in footprint \"%s\" **\n" ),
|
msg.Printf( _( "** Error: Component \"%s\" pad '%s' not found in footprint \"%s\" **\n" ),
|
||||||
GetChars( component->GetReference() ),
|
GetChars( component->GetReference() ),
|
||||||
GetChars( padname ),
|
GetChars( padname ),
|
||||||
footprint->GetFPID().Format().c_str() );
|
GetChars( footprint->GetFPID().Format() ) );
|
||||||
aReporter->Report( msg );
|
aReporter->Report( msg );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,6 +56,7 @@ class MARKER_PCB;
|
||||||
class MSG_PANEL_ITEM;
|
class MSG_PANEL_ITEM;
|
||||||
class NETLIST;
|
class NETLIST;
|
||||||
class REPORTER;
|
class REPORTER;
|
||||||
|
class RN_DATA;
|
||||||
|
|
||||||
|
|
||||||
// non-owning container of item candidates when searching for items on the same track.
|
// non-owning container of item candidates when searching for items on the same track.
|
||||||
|
@ -225,6 +226,7 @@ private:
|
||||||
|
|
||||||
EDA_RECT m_BoundingBox;
|
EDA_RECT m_BoundingBox;
|
||||||
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
|
NETINFO_LIST m_NetInfo; ///< net info list (name, design constraints ..
|
||||||
|
RN_DATA* m_ratsnest;
|
||||||
|
|
||||||
BOARD_DESIGN_SETTINGS m_designSettings;
|
BOARD_DESIGN_SETTINGS m_designSettings;
|
||||||
ZONE_SETTINGS m_zoneSettings;
|
ZONE_SETTINGS m_zoneSettings;
|
||||||
|
@ -355,6 +357,16 @@ public:
|
||||||
*/
|
*/
|
||||||
BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem );
|
BOARD_ITEM* Remove( BOARD_ITEM* aBoardItem );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function GetRatsnest()
|
||||||
|
* returns list of missing connections between components/tracks.
|
||||||
|
* @return RATSNEST* is an object that contains informations about missing connections.
|
||||||
|
*/
|
||||||
|
RN_DATA* GetRatsnest() const
|
||||||
|
{
|
||||||
|
return m_ratsnest;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function DeleteMARKERs
|
* Function DeleteMARKERs
|
||||||
* deletes ALL MARKERS from the board.
|
* deletes ALL MARKERS from the board.
|
||||||
|
|
|
@ -116,8 +116,9 @@ public:
|
||||||
void SetEndY( int y ) { m_End.y = y; }
|
void SetEndY( int y ) { m_End.y = y; }
|
||||||
void SetEndX( int x ) { m_End.x = x; }
|
void SetEndX( int x ) { m_End.x = x; }
|
||||||
|
|
||||||
// Arc attributes are read only, since they are "calculated" from
|
// Some attributes are read only, since they are "calculated" from
|
||||||
// m_Start, m_End, and m_Angle. No Set...() functions.
|
// m_Start, m_End, and m_Angle.
|
||||||
|
// No Set...() function for these attributes.
|
||||||
|
|
||||||
const wxPoint& GetCenter() const { return m_Start; }
|
const wxPoint& GetCenter() const { return m_Start; }
|
||||||
const wxPoint& GetArcStart() const { return m_End; }
|
const wxPoint& GetArcStart() const { return m_End; }
|
||||||
|
@ -140,6 +141,17 @@ public:
|
||||||
return KiROUND( radius );
|
return KiROUND( radius );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Initialize the start arc point. can be used for circles
|
||||||
|
* to initialize one point of the cicumference
|
||||||
|
*/
|
||||||
|
void SetArcStart( const wxPoint& aArcStartPoint )
|
||||||
|
{ m_End = aArcStartPoint; }
|
||||||
|
|
||||||
|
/** For arcs and circles:
|
||||||
|
*/
|
||||||
|
void SetCenter( const wxPoint& aCenterPoint ) { m_Start = aCenterPoint; }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Function GetParentModule
|
* Function GetParentModule
|
||||||
* returns a pointer to the parent module, or NULL if DRAWSEGMENT does not
|
* returns a pointer to the parent module, or NULL if DRAWSEGMENT does not
|
||||||
|
|
|
@ -404,25 +404,27 @@ void PCB_LAYER_WIDGET::OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool is
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
|
void PCB_LAYER_WIDGET::OnRenderColorChange( int aId, EDA_COLOR_T aColor )
|
||||||
{
|
{
|
||||||
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
|
myframe->GetBoard()->SetVisibleElementColor( aId, aColor );
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
void PCB_LAYER_WIDGET::OnRenderEnable( int aId, bool isEnabled )
|
||||||
{
|
{
|
||||||
BOARD* brd = myframe->GetBoard();
|
BOARD* brd = myframe->GetBoard();
|
||||||
brd->SetElementVisibility( aId, isEnabled );
|
brd->SetElementVisibility( aId, isEnabled );
|
||||||
|
|
||||||
EDA_DRAW_PANEL_GAL *galCanvas = myframe->GetGalCanvas();
|
EDA_DRAW_PANEL_GAL* galCanvas = myframe->GetGalCanvas();
|
||||||
if( galCanvas )
|
if( galCanvas )
|
||||||
{
|
{
|
||||||
KIGFX::VIEW* view = galCanvas->GetView();
|
KIGFX::VIEW* view = galCanvas->GetView();
|
||||||
view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
|
view->SetLayerVisible( ITEM_GAL_LAYER( aId ), isEnabled );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( myframe->IsGalCanvasActive() )
|
if( galCanvas && myframe->IsGalCanvasActive() )
|
||||||
galCanvas->Refresh();
|
galCanvas->Refresh();
|
||||||
else
|
else
|
||||||
myframe->GetCanvas()->Refresh();
|
myframe->GetCanvas()->Refresh();
|
||||||
|
|
|
@ -205,40 +205,3 @@ EDA_ITEM* TEXTE_PCB::Clone() const
|
||||||
{
|
{
|
||||||
return new TEXTE_PCB( *this );
|
return new TEXTE_PCB( *this );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const BOX2I TEXTE_PCB::ViewBBox() const
|
|
||||||
{
|
|
||||||
EDA_RECT rect = GetTextBox();
|
|
||||||
|
|
||||||
if( m_Orient != 0.0 )
|
|
||||||
{
|
|
||||||
// If the text is rotated, we need to take it into account
|
|
||||||
wxPoint p1 = rect.GetOrigin();
|
|
||||||
wxPoint p2 = wxPoint( p1.x + rect.GetWidth(), p1.y );
|
|
||||||
wxPoint p3 = rect.GetEnd();
|
|
||||||
wxPoint p4 = wxPoint( p1.x, p1.y + rect.GetHeight() );
|
|
||||||
|
|
||||||
// Transform all the corners of the bounding box according to the rotation angle
|
|
||||||
RotatePoint( &p1, m_Pos, -m_Orient );
|
|
||||||
RotatePoint( &p2, m_Pos, -m_Orient );
|
|
||||||
RotatePoint( &p3, m_Pos, -m_Orient );
|
|
||||||
RotatePoint( &p4, m_Pos, -m_Orient );
|
|
||||||
|
|
||||||
// Find the new bounding box origin and dimensions
|
|
||||||
int minX = std::min( std::min( p1.x, p2.x ), std::min( p3.x, p4.x ) );
|
|
||||||
int minY = std::min( std::min( p1.y, p2.y ), std::min( p3.y, p4.y ) );
|
|
||||||
int maxX = std::max( std::max( p1.x, p2.x ), std::max( p3.x, p4.x ) );
|
|
||||||
int maxY = std::max( std::max( p1.y, p2.y ), std::max( p3.y, p4.y ) );
|
|
||||||
|
|
||||||
int width = maxX - minX;
|
|
||||||
int height = maxY - minY;
|
|
||||||
|
|
||||||
return BOX2I( VECTOR2I( minX, minY ), VECTOR2I( width, height ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
return BOX2I( rect.GetOrigin(), rect.GetSize() );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,6 @@ public:
|
||||||
|
|
||||||
EDA_ITEM* Clone() const;
|
EDA_ITEM* Clone() const;
|
||||||
|
|
||||||
/// @copydoc VIEW_ITEM::ViewBBox()
|
|
||||||
virtual const BOX2I ViewBBox() const;
|
|
||||||
|
|
||||||
#if defined(DEBUG)
|
#if defined(DEBUG)
|
||||||
virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -1154,12 +1154,18 @@ void TRACK::GetMsgPanelInfoBase( std::vector< MSG_PANEL_ITEM >& aList )
|
||||||
LAYER_NUM top_layer, bottom_layer;
|
LAYER_NUM top_layer, bottom_layer;
|
||||||
|
|
||||||
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
Via->ReturnLayerPair( &top_layer, &bottom_layer );
|
||||||
|
if( board )
|
||||||
msg = board->GetLayerName( top_layer ) + wxT( "/" )
|
msg = board->GetLayerName( top_layer ) + wxT( "/" )
|
||||||
+ board->GetLayerName( bottom_layer );
|
+ board->GetLayerName( bottom_layer );
|
||||||
|
else
|
||||||
|
msg.Printf(wxT("%d/%d"), top_layer, bottom_layer );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if( board )
|
||||||
msg = board->GetLayerName( m_Layer );
|
msg = board->GetLayerName( m_Layer );
|
||||||
|
else
|
||||||
|
msg.Printf(wxT("%d"), m_Layer );
|
||||||
}
|
}
|
||||||
|
|
||||||
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
|
aList.push_back( MSG_PANEL_ITEM( _( "Layer" ), msg, BROWN ) );
|
||||||
|
|
|
@ -480,32 +480,12 @@ bool ZONE_CONTAINER::HitTest( const wxPoint& aPosition )
|
||||||
// Zones outlines have no thickness, so it Hit Test functions
|
// Zones outlines have no thickness, so it Hit Test functions
|
||||||
// we must have a default distance between the test point
|
// we must have a default distance between the test point
|
||||||
// and a corner or a zone edge:
|
// and a corner or a zone edge:
|
||||||
#define MIN_DIST_IN_MILS 10
|
#define MAX_DIST_IN_MM 0.25
|
||||||
|
|
||||||
bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
||||||
{
|
{
|
||||||
m_CornerSelection = -1; // Set to not found
|
int distmax = Millimeter2iu( MAX_DIST_IN_MM );
|
||||||
|
m_CornerSelection = m_Poly->HitTestForCorner( refPos, distmax );
|
||||||
// distance (in internal units) to detect a corner in a zone outline.
|
|
||||||
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
|
|
||||||
|
|
||||||
wxPoint delta;
|
|
||||||
unsigned lim = m_Poly->m_CornersList.GetCornersCount();
|
|
||||||
|
|
||||||
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
|
||||||
{
|
|
||||||
delta.x = refPos.x - m_Poly->m_CornersList.GetX( item_pos );
|
|
||||||
delta.y = refPos.y - m_Poly->m_CornersList.GetY( item_pos );
|
|
||||||
|
|
||||||
// Calculate a distance:
|
|
||||||
int dist = std::max( abs( delta.x ), abs( delta.y ) );
|
|
||||||
|
|
||||||
if( dist < min_dist ) // this corner is a candidate:
|
|
||||||
{
|
|
||||||
m_CornerSelection = item_pos;
|
|
||||||
min_dist = dist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_CornerSelection >= 0;
|
return m_CornerSelection >= 0;
|
||||||
}
|
}
|
||||||
|
@ -513,44 +493,8 @@ bool ZONE_CONTAINER::HitTestForCorner( const wxPoint& refPos )
|
||||||
|
|
||||||
bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
bool ZONE_CONTAINER::HitTestForEdge( const wxPoint& refPos )
|
||||||
{
|
{
|
||||||
unsigned lim = m_Poly->m_CornersList.GetCornersCount();
|
int distmax = Millimeter2iu( MAX_DIST_IN_MM );
|
||||||
|
m_CornerSelection = m_Poly->HitTestForEdge( refPos, distmax );
|
||||||
m_CornerSelection = -1; // Set to not found
|
|
||||||
|
|
||||||
// distance (in internal units) to detect a zone outline
|
|
||||||
int min_dist = MIN_DIST_IN_MILS*IU_PER_MILS;
|
|
||||||
|
|
||||||
unsigned first_corner_pos = 0;
|
|
||||||
|
|
||||||
for( unsigned item_pos = 0; item_pos < lim; item_pos++ )
|
|
||||||
{
|
|
||||||
unsigned end_segm = item_pos + 1;
|
|
||||||
|
|
||||||
/* the last corner of the current outline is tested
|
|
||||||
* the last segment of the current outline starts at current corner, and ends
|
|
||||||
* at the first corner of the outline
|
|
||||||
*/
|
|
||||||
if( m_Poly->m_CornersList.IsEndContour ( item_pos ) || end_segm >= lim )
|
|
||||||
{
|
|
||||||
unsigned tmp = first_corner_pos;
|
|
||||||
first_corner_pos = end_segm; // first_corner_pos is now the beginning of the next outline
|
|
||||||
end_segm = tmp; // end_segm is the beginning of the current outline
|
|
||||||
}
|
|
||||||
|
|
||||||
// test the dist between segment and ref point
|
|
||||||
int dist = KiROUND( GetPointToLineSegmentDistance(
|
|
||||||
refPos.x, refPos.y,
|
|
||||||
m_Poly->m_CornersList.GetX( item_pos ),
|
|
||||||
m_Poly->m_CornersList.GetY( item_pos ),
|
|
||||||
m_Poly->m_CornersList.GetX( end_segm ),
|
|
||||||
m_Poly->m_CornersList.GetY( end_segm ) ) );
|
|
||||||
|
|
||||||
if( dist < min_dist )
|
|
||||||
{
|
|
||||||
m_CornerSelection = item_pos;
|
|
||||||
min_dist = dist;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return m_CornerSelection >= 0;
|
return m_CornerSelection >= 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -117,7 +117,7 @@ void DIALOG_MODULE_MODULE_EDITOR::initModeditProperties()
|
||||||
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
|
m_ReferenceCtrl->SetValue( m_referenceCopy->GetText() );
|
||||||
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
||||||
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
m_ValueCtrl->SetValue( m_valueCopy->GetText() );
|
||||||
m_FootprintNameCtrl->SetValue( FROM_UTF8( m_currentModule->GetFPID().Format().c_str() ) );
|
m_FootprintNameCtrl->SetValue( m_currentModule->GetFPID().Format() );
|
||||||
|
|
||||||
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );
|
m_AttributsCtrl->SetItemToolTip( 0, _( "Use this attribute for most non SMD components" ) );
|
||||||
m_AttributsCtrl->SetItemToolTip( 1,
|
m_AttributsCtrl->SetItemToolTip( 1,
|
||||||
|
|
|
@ -183,11 +183,13 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
|
||||||
if ( m_module)
|
if ( m_module)
|
||||||
m_parent->SaveCopyInUndoList( m_module, UR_CHANGED );
|
m_parent->SaveCopyInUndoList( m_module, UR_CHANGED );
|
||||||
|
|
||||||
|
#ifndef USE_WX_OVERLAY
|
||||||
if( m_dc ) //Erase old text on screen
|
if( m_dc ) //Erase old text on screen
|
||||||
{
|
{
|
||||||
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
|
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
|
||||||
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
|
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
m_currentText->SetText( m_Name->GetValue() );
|
m_currentText->SetText( m_Name->GetValue() );
|
||||||
m_currentText->SetItalic( m_Style->GetSelection() == 1 );
|
m_currentText->SetItalic( m_Style->GetSelection() == 1 );
|
||||||
|
@ -238,11 +240,15 @@ void DialogEditModuleText::OnOkClick( wxCommandEvent& event )
|
||||||
|
|
||||||
m_currentText->SetDrawCoord();
|
m_currentText->SetDrawCoord();
|
||||||
|
|
||||||
|
#ifndef USE_WX_OVERLAY
|
||||||
if( m_dc ) // Display new text
|
if( m_dc ) // Display new text
|
||||||
{
|
{
|
||||||
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
|
m_currentText->Draw( m_parent->GetCanvas(), m_dc, GR_XOR,
|
||||||
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
|
(m_currentText->IsMoving()) ? MoveVector : wxPoint( 0, 0 ) );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
m_parent->Refresh();
|
||||||
|
#endif
|
||||||
|
|
||||||
m_parent->OnModify();
|
m_parent->OnModify();
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,121 @@
|
||||||
|
/**
|
||||||
|
* @file dialog_export_idf.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Cirilo Bernardo
|
||||||
|
*
|
||||||
|
* 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 <wxPcbStruct.h>
|
||||||
|
#include <appl_wxstruct.h>
|
||||||
|
#include <pcbnew.h>
|
||||||
|
#include <class_board.h>
|
||||||
|
|
||||||
|
// IDF export header generated by wxFormBuilder
|
||||||
|
#include <dialog_export_idf_base.h>
|
||||||
|
|
||||||
|
#define OPTKEY_IDF_THOU wxT( "IDFExportThou" )
|
||||||
|
|
||||||
|
|
||||||
|
bool Export_IDF3( BOARD *aPcb, const wxString & aFullFileName, double aUseThou );
|
||||||
|
|
||||||
|
|
||||||
|
class DIALOG_EXPORT_IDF3: public DIALOG_EXPORT_IDF3_BASE
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
PCB_EDIT_FRAME* m_parent;
|
||||||
|
wxConfig* m_config;
|
||||||
|
bool m_idfThouOpt; // remember last preference for units in THOU
|
||||||
|
|
||||||
|
void OnCancelClick( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
EndModal( wxID_CANCEL );
|
||||||
|
}
|
||||||
|
void OnOkClick( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
EndModal( wxID_OK );
|
||||||
|
}
|
||||||
|
|
||||||
|
public:
|
||||||
|
DIALOG_EXPORT_IDF3( PCB_EDIT_FRAME* parent ) :
|
||||||
|
DIALOG_EXPORT_IDF3_BASE( parent )
|
||||||
|
{
|
||||||
|
m_parent = parent;
|
||||||
|
m_config = wxGetApp().GetSettings();
|
||||||
|
SetFocus();
|
||||||
|
m_idfThouOpt = false;
|
||||||
|
m_config->Read( OPTKEY_IDF_THOU, &m_idfThouOpt );
|
||||||
|
m_chkThou->SetValue( m_idfThouOpt );
|
||||||
|
|
||||||
|
GetSizer()->SetSizeHints( this );
|
||||||
|
Centre();
|
||||||
|
}
|
||||||
|
|
||||||
|
~DIALOG_EXPORT_IDF3()
|
||||||
|
{
|
||||||
|
m_idfThouOpt = m_chkThou->GetValue();
|
||||||
|
m_config->Write( OPTKEY_IDF_THOU, m_idfThouOpt );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool GetThouOption()
|
||||||
|
{
|
||||||
|
return m_chkThou->GetValue();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxFilePickerCtrl* FilePicker()
|
||||||
|
{
|
||||||
|
return m_filePickerIDF;
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function OnExportIDF3
|
||||||
|
* will export the current BOARD to IDF board and lib files.
|
||||||
|
*/
|
||||||
|
void PCB_EDIT_FRAME::ExportToIDF3( wxCommandEvent& event )
|
||||||
|
{
|
||||||
|
wxFileName fn;
|
||||||
|
|
||||||
|
// Build default file name
|
||||||
|
fn = GetBoard()->GetFileName();
|
||||||
|
fn.SetExt( wxT( "emn" ) );
|
||||||
|
|
||||||
|
DIALOG_EXPORT_IDF3 dlg( this );
|
||||||
|
dlg.FilePicker()->SetPath( fn.GetFullPath() );
|
||||||
|
|
||||||
|
if ( dlg.ShowModal() != wxID_OK )
|
||||||
|
return;
|
||||||
|
|
||||||
|
bool thou = dlg.GetThouOption();
|
||||||
|
|
||||||
|
wxBusyCursor dummy;
|
||||||
|
|
||||||
|
wxString fullFilename = dlg.FilePicker()->GetPath();
|
||||||
|
|
||||||
|
if ( !Export_IDF3( GetBoard(), fullFilename, thou ) )
|
||||||
|
{
|
||||||
|
wxString msg = _("Unable to create ") + fullFilename;
|
||||||
|
wxMessageBox( msg );
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,49 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#include "dialog_export_idf_base.h"
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
DIALOG_EXPORT_IDF3_BASE::DIALOG_EXPORT_IDF3_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* bSizerIDFFile;
|
||||||
|
bSizerIDFFile = new wxBoxSizer( wxVERTICAL );
|
||||||
|
|
||||||
|
m_txtBrdFile = new wxStaticText( this, wxID_ANY, wxT("IDF Board file"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
m_txtBrdFile->Wrap( -1 );
|
||||||
|
bSizerIDFFile->Add( m_txtBrdFile, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
m_filePickerIDF = new wxFilePickerCtrl( this, wxID_ANY, wxEmptyString, wxT("Select a board file"), wxT("*.emn"), wxDefaultPosition, wxDefaultSize, wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL );
|
||||||
|
m_filePickerIDF->SetMinSize( wxSize( 420,30 ) );
|
||||||
|
|
||||||
|
bSizerIDFFile->Add( m_filePickerIDF, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
m_chkThou = new wxCheckBox( this, wxID_ANY, wxT("unit: THOU"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||||
|
bSizerIDFFile->Add( m_chkThou, 0, wxALL, 5 );
|
||||||
|
|
||||||
|
m_sdbSizer1 = new wxStdDialogButtonSizer();
|
||||||
|
m_sdbSizer1OK = new wxButton( this, wxID_OK );
|
||||||
|
m_sdbSizer1->AddButton( m_sdbSizer1OK );
|
||||||
|
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
|
||||||
|
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
|
||||||
|
m_sdbSizer1->Realize();
|
||||||
|
|
||||||
|
bSizerIDFFile->Add( m_sdbSizer1, 1, wxEXPAND, 5 );
|
||||||
|
|
||||||
|
|
||||||
|
this->SetSizer( bSizerIDFFile );
|
||||||
|
this->Layout();
|
||||||
|
|
||||||
|
this->Centre( wxBOTH );
|
||||||
|
}
|
||||||
|
|
||||||
|
DIALOG_EXPORT_IDF3_BASE::~DIALOG_EXPORT_IDF3_BASE()
|
||||||
|
{
|
||||||
|
}
|
|
@ -0,0 +1,383 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
|
||||||
|
<wxFormBuilder_Project>
|
||||||
|
<FileVersion major="1" minor="11" />
|
||||||
|
<object class="Project" expanded="1">
|
||||||
|
<property name="class_decoration"></property>
|
||||||
|
<property name="code_generation">C++</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="event_generation">connect</property>
|
||||||
|
<property name="file">dialog_export_idf_base</property>
|
||||||
|
<property name="first_id">1000</property>
|
||||||
|
<property name="help_provider">none</property>
|
||||||
|
<property name="internationalize">0</property>
|
||||||
|
<property name="name">dialog_export_idf3_base</property>
|
||||||
|
<property name="namespace"></property>
|
||||||
|
<property name="path">.</property>
|
||||||
|
<property name="precompiled_header"></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">1</property>
|
||||||
|
<property name="use_microsoft_bom">0</property>
|
||||||
|
<object class="Dialog" expanded="1">
|
||||||
|
<property name="aui_managed">0</property>
|
||||||
|
<property name="aui_manager_style">wxAUI_MGR_DEFAULT</property>
|
||||||
|
<property name="bg"></property>
|
||||||
|
<property name="center">wxBOTH</property>
|
||||||
|
<property name="context_help"></property>
|
||||||
|
<property name="context_menu">1</property>
|
||||||
|
<property name="enabled">1</property>
|
||||||
|
<property name="event_handler">impl_virtual</property>
|
||||||
|
<property name="extra_style"></property>
|
||||||
|
<property name="fg"></property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">DIALOG_EXPORT_IDF3_BASE</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="size">458,177</property>
|
||||||
|
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
|
||||||
|
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
|
||||||
|
<property name="title">Export IDFv3</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnActivate"></event>
|
||||||
|
<event name="OnActivateApp"></event>
|
||||||
|
<event name="OnAuiFindManager"></event>
|
||||||
|
<event name="OnAuiPaneButton"></event>
|
||||||
|
<event name="OnAuiPaneClose"></event>
|
||||||
|
<event name="OnAuiPaneMaximize"></event>
|
||||||
|
<event name="OnAuiPaneRestore"></event>
|
||||||
|
<event name="OnAuiRender"></event>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnClose"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnHibernate"></event>
|
||||||
|
<event name="OnIconize"></event>
|
||||||
|
<event name="OnIdle"></event>
|
||||||
|
<event name="OnInitDialog"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<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">
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">bSizerIDFFile</property>
|
||||||
|
<property name="orient">wxVERTICAL</property>
|
||||||
|
<property name="permission">none</property>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxStaticText" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<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="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">IDF Board file</property>
|
||||||
|
<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"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_txtBrdFile</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<property name="wrap">-1</property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<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>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxFilePickerCtrl" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<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="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="max_size"></property>
|
||||||
|
<property name="maximize_button">0</property>
|
||||||
|
<property name="maximum_size"></property>
|
||||||
|
<property name="message">Select a board file</property>
|
||||||
|
<property name="min_size"></property>
|
||||||
|
<property name="minimize_button">0</property>
|
||||||
|
<property name="minimum_size">420,30</property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_filePickerIDF</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style">wxFLP_OVERWRITE_PROMPT|wxFLP_SAVE|wxFLP_USE_TEXTCTRL</property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="validator_data_type"></property>
|
||||||
|
<property name="validator_style">wxFILTER_NONE</property>
|
||||||
|
<property name="validator_type">wxDefaultValidator</property>
|
||||||
|
<property name="validator_variable"></property>
|
||||||
|
<property name="value"></property>
|
||||||
|
<property name="wildcard">*.emn</property>
|
||||||
|
<property name="window_extra_style"></property>
|
||||||
|
<property name="window_name"></property>
|
||||||
|
<property name="window_style"></property>
|
||||||
|
<event name="OnChar"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnFileChanged"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<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>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxALL</property>
|
||||||
|
<property name="proportion">0</property>
|
||||||
|
<object class="wxCheckBox" expanded="1">
|
||||||
|
<property name="BottomDockable">1</property>
|
||||||
|
<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="checked">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="fg"></property>
|
||||||
|
<property name="floatable">1</property>
|
||||||
|
<property name="font"></property>
|
||||||
|
<property name="gripper">0</property>
|
||||||
|
<property name="hidden">0</property>
|
||||||
|
<property name="id">wxID_ANY</property>
|
||||||
|
<property name="label">unit: THOU</property>
|
||||||
|
<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"></property>
|
||||||
|
<property name="moveable">1</property>
|
||||||
|
<property name="name">m_chkThou</property>
|
||||||
|
<property name="pane_border">1</property>
|
||||||
|
<property name="pane_position"></property>
|
||||||
|
<property name="pane_size"></property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<property name="pin_button">1</property>
|
||||||
|
<property name="pos"></property>
|
||||||
|
<property name="resize">Resizable</property>
|
||||||
|
<property name="show">1</property>
|
||||||
|
<property name="size"></property>
|
||||||
|
<property name="style"></property>
|
||||||
|
<property name="subclass"></property>
|
||||||
|
<property name="toolbar_pane">0</property>
|
||||||
|
<property name="tooltip"></property>
|
||||||
|
<property name="validator_data_type"></property>
|
||||||
|
<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="OnChar"></event>
|
||||||
|
<event name="OnCheckBox"></event>
|
||||||
|
<event name="OnEnterWindow"></event>
|
||||||
|
<event name="OnEraseBackground"></event>
|
||||||
|
<event name="OnKeyDown"></event>
|
||||||
|
<event name="OnKeyUp"></event>
|
||||||
|
<event name="OnKillFocus"></event>
|
||||||
|
<event name="OnLeaveWindow"></event>
|
||||||
|
<event name="OnLeftDClick"></event>
|
||||||
|
<event name="OnLeftDown"></event>
|
||||||
|
<event name="OnLeftUp"></event>
|
||||||
|
<event name="OnMiddleDClick"></event>
|
||||||
|
<event name="OnMiddleDown"></event>
|
||||||
|
<event name="OnMiddleUp"></event>
|
||||||
|
<event name="OnMotion"></event>
|
||||||
|
<event name="OnMouseEvents"></event>
|
||||||
|
<event name="OnMouseWheel"></event>
|
||||||
|
<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>
|
||||||
|
</object>
|
||||||
|
<object class="sizeritem" expanded="1">
|
||||||
|
<property name="border">5</property>
|
||||||
|
<property name="flag">wxEXPAND</property>
|
||||||
|
<property name="proportion">1</property>
|
||||||
|
<object class="wxStdDialogButtonSizer" expanded="1">
|
||||||
|
<property name="Apply">0</property>
|
||||||
|
<property name="Cancel">1</property>
|
||||||
|
<property name="ContextHelp">0</property>
|
||||||
|
<property name="Help">0</property>
|
||||||
|
<property name="No">0</property>
|
||||||
|
<property name="OK">1</property>
|
||||||
|
<property name="Save">0</property>
|
||||||
|
<property name="Yes">0</property>
|
||||||
|
<property name="minimum_size"></property>
|
||||||
|
<property name="name">m_sdbSizer1</property>
|
||||||
|
<property name="permission">protected</property>
|
||||||
|
<event name="OnApplyButtonClick"></event>
|
||||||
|
<event name="OnCancelButtonClick"></event>
|
||||||
|
<event name="OnContextHelpButtonClick"></event>
|
||||||
|
<event name="OnHelpButtonClick"></event>
|
||||||
|
<event name="OnNoButtonClick"></event>
|
||||||
|
<event name="OnOKButtonClick"></event>
|
||||||
|
<event name="OnSaveButtonClick"></event>
|
||||||
|
<event name="OnYesButtonClick"></event>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</object>
|
||||||
|
</wxFormBuilder_Project>
|
|
@ -0,0 +1,52 @@
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
// C++ code generated with wxFormBuilder (version Oct 8 2012)
|
||||||
|
// http://www.wxformbuilder.org/
|
||||||
|
//
|
||||||
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#ifndef __DIALOG_EXPORT_IDF_BASE_H__
|
||||||
|
#define __DIALOG_EXPORT_IDF_BASE_H__
|
||||||
|
|
||||||
|
#include <wx/artprov.h>
|
||||||
|
#include <wx/xrc/xmlres.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/filepicker.h>
|
||||||
|
#include <wx/checkbox.h>
|
||||||
|
#include <wx/sizer.h>
|
||||||
|
#include <wx/button.h>
|
||||||
|
#include <wx/dialog.h>
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
/// Class DIALOG_EXPORT_IDF3_BASE
|
||||||
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
class DIALOG_EXPORT_IDF3_BASE : public DIALOG_SHIM
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
|
||||||
|
protected:
|
||||||
|
wxStaticText* m_txtBrdFile;
|
||||||
|
wxFilePickerCtrl* m_filePickerIDF;
|
||||||
|
wxCheckBox* m_chkThou;
|
||||||
|
wxStdDialogButtonSizer* m_sdbSizer1;
|
||||||
|
wxButton* m_sdbSizer1OK;
|
||||||
|
wxButton* m_sdbSizer1Cancel;
|
||||||
|
|
||||||
|
public:
|
||||||
|
|
||||||
|
DIALOG_EXPORT_IDF3_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = wxT("Export IDFv3"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 458,177 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
|
||||||
|
~DIALOG_EXPORT_IDF3_BASE();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif //__DIALOG_EXPORT_IDF_BASE_H__
|
|
@ -583,6 +583,8 @@ private:
|
||||||
{
|
{
|
||||||
FP_TBL_MODEL* tbl = cur_model();
|
FP_TBL_MODEL* tbl = cur_model();
|
||||||
|
|
||||||
|
if( tbl->GetNumberRows() )
|
||||||
|
{
|
||||||
int curRow = getCursorRow();
|
int curRow = getCursorRow();
|
||||||
ROW& row = tbl->rows[curRow];
|
ROW& row = tbl->rows[curRow];
|
||||||
|
|
||||||
|
@ -599,6 +601,13 @@ private:
|
||||||
m_cur_grid->AutoSizeColumn( COL_NICKNAME, false );
|
m_cur_grid->AutoSizeColumn( COL_NICKNAME, false );
|
||||||
m_cur_grid->AutoSizeColumn( COL_URI, false );
|
m_cur_grid->AutoSizeColumn( COL_URI, false );
|
||||||
m_cur_grid->AutoSizeColumn( COL_TYPE, false );
|
m_cur_grid->AutoSizeColumn( COL_TYPE, false );
|
||||||
|
|
||||||
|
// On Windows, the grid is not refresh,
|
||||||
|
// so force resfresh after a change
|
||||||
|
#ifdef __WINDOWS__
|
||||||
|
Refresh();
|
||||||
|
#endif
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -607,7 +616,7 @@ private:
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCancelButtonClick( wxCloseEvent& event )
|
void onCancelCaptionButtonClick( wxCloseEvent& event )
|
||||||
{
|
{
|
||||||
EndModal( 0 );
|
EndModal( 0 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -190,7 +190,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
|
||||||
this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
|
this->Connect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
|
||||||
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
m_auinotebook->Connect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||||
m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
m_append_button->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||||
|
@ -205,7 +205,7 @@ DIALOG_FP_LIB_TABLE_BASE::DIALOG_FP_LIB_TABLE_BASE( wxWindow* parent, wxWindowID
|
||||||
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
|
DIALOG_FP_LIB_TABLE_BASE::~DIALOG_FP_LIB_TABLE_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelButtonClick ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_LIB_TABLE_BASE::onCancelCaptionButtonClick ) );
|
||||||
this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
|
this->Disconnect( wxEVT_KEY_DOWN, wxKeyEventHandler( DIALOG_FP_LIB_TABLE_BASE::onKeyDown ) );
|
||||||
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
m_auinotebook->Disconnect( wxEVT_COMMAND_AUINOTEBOOK_PAGE_CHANGED, wxAuiNotebookEventHandler( DIALOG_FP_LIB_TABLE_BASE::pageChangedHandler ), NULL, this );
|
||||||
m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
m_append_button->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_LIB_TABLE_BASE::appendRowHandler ), NULL, this );
|
||||||
|
|
|
@ -20,8 +20,10 @@
|
||||||
<property name="path">.</property>
|
<property name="path">.</property>
|
||||||
<property name="precompiled_header"></property>
|
<property name="precompiled_header"></property>
|
||||||
<property name="relative_path">1</property>
|
<property name="relative_path">1</property>
|
||||||
|
<property name="skip_lua_events">1</property>
|
||||||
<property name="skip_php_events">1</property>
|
<property name="skip_php_events">1</property>
|
||||||
<property name="skip_python_events">1</property>
|
<property name="skip_python_events">1</property>
|
||||||
|
<property name="ui_table">UI</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">
|
||||||
|
@ -59,7 +61,7 @@
|
||||||
<event name="OnAuiPaneRestore"></event>
|
<event name="OnAuiPaneRestore"></event>
|
||||||
<event name="OnAuiRender"></event>
|
<event name="OnAuiRender"></event>
|
||||||
<event name="OnChar"></event>
|
<event name="OnChar"></event>
|
||||||
<event name="OnClose">onCancelButtonClick</event>
|
<event name="OnClose">onCancelCaptionButtonClick</event>
|
||||||
<event name="OnEnterWindow"></event>
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground"></event>
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnHibernate"></event>
|
<event name="OnHibernate"></event>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Apr 30 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -57,7 +57,7 @@ class DIALOG_FP_LIB_TABLE_BASE : public DIALOG_SHIM
|
||||||
wxButton* m_sdbSizer1Cancel;
|
wxButton* m_sdbSizer1Cancel;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void onCancelButtonClick( wxCloseEvent& event ) = 0;
|
virtual void onCancelCaptionButtonClick( wxCloseEvent& event ) = 0;
|
||||||
virtual void onKeyDown( wxKeyEvent& event ) = 0;
|
virtual void onKeyDown( wxKeyEvent& event ) = 0;
|
||||||
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
|
virtual void pageChangedHandler( wxAuiNotebookEvent& event ) = 0;
|
||||||
virtual void appendRowHandler( wxMouseEvent& event ) = 0;
|
virtual void appendRowHandler( wxMouseEvent& event ) = 0;
|
||||||
|
|
|
@ -84,7 +84,7 @@ public:
|
||||||
for( PROPERTIES::const_iterator it = props->begin(); it != props->end(); ++it, ++row )
|
for( PROPERTIES::const_iterator it = props->begin(); it != props->end(); ++it, ++row )
|
||||||
{
|
{
|
||||||
m_grid->SetCellValue( row, 0, FROM_UTF8( it->first.c_str() ) );
|
m_grid->SetCellValue( row, 0, FROM_UTF8( it->first.c_str() ) );
|
||||||
m_grid->SetCellValue( row, 1, FROM_UTF8( it->second.c_str() ) );
|
m_grid->SetCellValue( row, 1, it->second );
|
||||||
}
|
}
|
||||||
|
|
||||||
delete props;
|
delete props;
|
||||||
|
@ -184,7 +184,7 @@ private:
|
||||||
for( int row = 0; row<rowCount; ++row )
|
for( int row = 0; row<rowCount; ++row )
|
||||||
{
|
{
|
||||||
string name = TO_UTF8( m_grid->GetCellValue( row, 0 ).Trim( false ).Trim() );
|
string name = TO_UTF8( m_grid->GetCellValue( row, 0 ).Trim( false ).Trim() );
|
||||||
string value = TO_UTF8( m_grid->GetCellValue( row, 1 ).Trim( false ).Trim() );
|
UTF8 value = m_grid->GetCellValue( row, 1 ).Trim( false ).Trim();
|
||||||
|
|
||||||
if( name.size() )
|
if( name.size() )
|
||||||
{
|
{
|
||||||
|
@ -192,9 +192,7 @@ private:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string options = FP_LIB_TABLE::FormatOptions( &props );
|
return FP_LIB_TABLE::FormatOptions( &props );
|
||||||
|
|
||||||
return FROM_UTF8( options.c_str() );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void saveColSizes()
|
void saveColSizes()
|
||||||
|
@ -261,11 +259,11 @@ private:
|
||||||
if( event.IsSelection() )
|
if( event.IsSelection() )
|
||||||
{
|
{
|
||||||
string option = TO_UTF8( event.GetString() );
|
string option = TO_UTF8( event.GetString() );
|
||||||
string help_text;
|
UTF8 help_text;
|
||||||
|
|
||||||
if( m_choices.Value( option.c_str(), &help_text ) )
|
if( m_choices.Value( option.c_str(), &help_text ) )
|
||||||
{
|
{
|
||||||
wxString page = FROM_UTF8( help_text.c_str() );
|
wxString page = help_text;
|
||||||
|
|
||||||
m_html->SetPage( page );
|
m_html->SetPage( page );
|
||||||
}
|
}
|
||||||
|
@ -375,7 +373,7 @@ private:
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
||||||
void onCancelButtonClick( wxCloseEvent& event )
|
void onCancelCaptionButtonClick( wxCloseEvent& event )
|
||||||
{
|
{
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -130,7 +130,7 @@ DIALOG_FP_PLUGIN_OPTIONS_BASE::DIALOG_FP_PLUGIN_OPTIONS_BASE( wxWindow* parent,
|
||||||
this->Centre( wxBOTH );
|
this->Centre( wxBOTH );
|
||||||
|
|
||||||
// Connect Events
|
// Connect Events
|
||||||
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onCancelButtonClick ) );
|
this->Connect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onCancelCaptionButtonClick ) );
|
||||||
m_add_row->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onAppendRow ), NULL, this );
|
m_add_row->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onAppendRow ), NULL, this );
|
||||||
m_delete_row->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onDeleteRow ), NULL, this );
|
m_delete_row->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onDeleteRow ), NULL, this );
|
||||||
m_move_up->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onMoveUp ), NULL, this );
|
m_move_up->Connect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onMoveUp ), NULL, this );
|
||||||
|
@ -145,7 +145,7 @@ DIALOG_FP_PLUGIN_OPTIONS_BASE::DIALOG_FP_PLUGIN_OPTIONS_BASE( wxWindow* parent,
|
||||||
DIALOG_FP_PLUGIN_OPTIONS_BASE::~DIALOG_FP_PLUGIN_OPTIONS_BASE()
|
DIALOG_FP_PLUGIN_OPTIONS_BASE::~DIALOG_FP_PLUGIN_OPTIONS_BASE()
|
||||||
{
|
{
|
||||||
// Disconnect Events
|
// Disconnect Events
|
||||||
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onCancelButtonClick ) );
|
this->Disconnect( wxEVT_CLOSE_WINDOW, wxCloseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onCancelCaptionButtonClick ) );
|
||||||
m_add_row->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onAppendRow ), NULL, this );
|
m_add_row->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onAppendRow ), NULL, this );
|
||||||
m_delete_row->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onDeleteRow ), NULL, this );
|
m_delete_row->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onDeleteRow ), NULL, this );
|
||||||
m_move_up->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onMoveUp ), NULL, this );
|
m_move_up->Disconnect( wxEVT_LEFT_DOWN, wxMouseEventHandler( DIALOG_FP_PLUGIN_OPTIONS_BASE::onMoveUp ), NULL, this );
|
||||||
|
|
|
@ -61,7 +61,7 @@
|
||||||
<event name="OnAuiPaneRestore"></event>
|
<event name="OnAuiPaneRestore"></event>
|
||||||
<event name="OnAuiRender"></event>
|
<event name="OnAuiRender"></event>
|
||||||
<event name="OnChar"></event>
|
<event name="OnChar"></event>
|
||||||
<event name="OnClose">onCancelButtonClick</event>
|
<event name="OnClose">onCancelCaptionButtonClick</event>
|
||||||
<event name="OnEnterWindow"></event>
|
<event name="OnEnterWindow"></event>
|
||||||
<event name="OnEraseBackground"></event>
|
<event name="OnEraseBackground"></event>
|
||||||
<event name="OnHibernate"></event>
|
<event name="OnHibernate"></event>
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
///////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////
|
||||||
// C++ code generated with wxFormBuilder (version Nov 5 2013)
|
// C++ code generated with wxFormBuilder (version Nov 6 2013)
|
||||||
// http://www.wxformbuilder.org/
|
// http://www.wxformbuilder.org/
|
||||||
//
|
//
|
||||||
// PLEASE DO "NOT" EDIT THIS FILE!
|
// PLEASE DO "NOT" EDIT THIS FILE!
|
||||||
|
@ -53,7 +53,7 @@ class DIALOG_FP_PLUGIN_OPTIONS_BASE : public DIALOG_SHIM
|
||||||
wxButton* m_sdbSizer1Cancel;
|
wxButton* m_sdbSizer1Cancel;
|
||||||
|
|
||||||
// Virtual event handlers, overide them in your derived class
|
// Virtual event handlers, overide them in your derived class
|
||||||
virtual void onCancelButtonClick( wxCloseEvent& event ) = 0;
|
virtual void onCancelCaptionButtonClick( wxCloseEvent& event ) = 0;
|
||||||
virtual void onAppendRow( wxMouseEvent& event ) = 0;
|
virtual void onAppendRow( wxMouseEvent& event ) = 0;
|
||||||
virtual void onDeleteRow( wxMouseEvent& event ) = 0;
|
virtual void onDeleteRow( wxMouseEvent& event ) = 0;
|
||||||
virtual void onMoveUp( wxMouseEvent& event ) = 0;
|
virtual void onMoveUp( wxMouseEvent& event ) = 0;
|
||||||
|
|
|
@ -153,7 +153,7 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
int id = event.GetId();
|
int id = event.GetId();
|
||||||
bool state = event.IsChecked();
|
bool state = event.IsChecked();
|
||||||
KIGFX::PCB_PAINTER* painter =
|
KIGFX::PCB_PAINTER* painter =
|
||||||
static_cast<KIGFX::PCB_PAINTER*> ( m_galCanvas->GetView()->GetPainter() );
|
static_cast<KIGFX::PCB_PAINTER*> ( GetGalCanvas()->GetView()->GetPainter() );
|
||||||
KIGFX::PCB_RENDER_SETTINGS* settings =
|
KIGFX::PCB_RENDER_SETTINGS* settings =
|
||||||
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
static_cast<KIGFX::PCB_RENDER_SETTINGS*> ( painter->GetSettings() );
|
||||||
bool recache = false;
|
bool recache = false;
|
||||||
|
@ -259,9 +259,9 @@ void PCB_EDIT_FRAME::OnSelectOptionToolbar( wxCommandEvent& event )
|
||||||
{
|
{
|
||||||
// Apply new display options to the GAL canvas
|
// Apply new display options to the GAL canvas
|
||||||
settings->LoadDisplayOptions( DisplayOpt );
|
settings->LoadDisplayOptions( DisplayOpt );
|
||||||
m_galCanvas->GetView()->RecacheAllItems( true );
|
GetGalCanvas()->GetView()->RecacheAllItems( true );
|
||||||
}
|
}
|
||||||
|
|
||||||
if( IsGalCanvasActive() )
|
if( IsGalCanvasActive() )
|
||||||
m_galCanvas->Refresh();
|
GetGalCanvas()->Refresh();
|
||||||
}
|
}
|
||||||
|
|
|
@ -187,11 +187,13 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
|
||||||
if( m_SelectedPCBText->GetFlags() != 0 )
|
if( m_SelectedPCBText->GetFlags() != 0 )
|
||||||
m_SelectedPCBText->SetFlags( IN_EDIT );
|
m_SelectedPCBText->SetFlags( IN_EDIT );
|
||||||
|
|
||||||
|
#ifndef USE_WX_OVERLAY
|
||||||
// Erase old text on screen if context is available
|
// Erase old text on screen if context is available
|
||||||
if( m_DC )
|
if( m_DC )
|
||||||
{
|
{
|
||||||
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_XOR );
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
// Set the new text content
|
// Set the new text content
|
||||||
if( !m_TextContentCtrl->GetValue().IsEmpty() )
|
if( !m_TextContentCtrl->GetValue().IsEmpty() )
|
||||||
|
@ -268,12 +270,15 @@ void DIALOG_PCB_TEXT_PROPERTIES::OnOkClick( wxCommandEvent& event )
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifndef USE_WX_OVERLAY
|
||||||
// Finally, display new text if there is a context to do so
|
// Finally, display new text if there is a context to do so
|
||||||
if( m_DC )
|
if( m_DC )
|
||||||
{
|
{
|
||||||
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
|
m_SelectedPCBText->Draw( m_Parent->GetCanvas(), m_DC, GR_OR );
|
||||||
}
|
}
|
||||||
|
#else
|
||||||
|
m_parent->Refresh();
|
||||||
|
#endif
|
||||||
m_Parent->OnModify();
|
m_Parent->OnModify();
|
||||||
EndModal( 1 );
|
EndModal( 1 );
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,8 @@ void DRC::RunTests( wxTextCtrl* aMessages )
|
||||||
wxSafeYield();
|
wxSafeYield();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_mainWindow->Fill_All_Zones( aMessages->GetParent(), false );
|
m_mainWindow->Fill_All_Zones( aMessages ? aMessages->GetParent() : m_mainWindow,
|
||||||
|
false );
|
||||||
|
|
||||||
// test zone clearances to other zones
|
// test zone clearances to other zones
|
||||||
if( aMessages )
|
if( aMessages )
|
||||||
|
|
|
@ -93,9 +93,6 @@ typedef boost::optional<double> opt_double;
|
||||||
typedef boost::optional<bool> opt_bool;
|
typedef boost::optional<bool> opt_bool;
|
||||||
|
|
||||||
|
|
||||||
const wxChar* traceEaglePlugin = wxT( "KicadEaglePlugin" );
|
|
||||||
|
|
||||||
|
|
||||||
/// segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
|
/// segment (element) of our XPATH into the Eagle XML document tree in PTREE form.
|
||||||
struct TRIPLET
|
struct TRIPLET
|
||||||
{
|
{
|
||||||
|
@ -2714,8 +2711,8 @@ void EAGLE_PLUGIN::centerBoard()
|
||||||
{
|
{
|
||||||
if( m_props )
|
if( m_props )
|
||||||
{
|
{
|
||||||
string page_width;
|
UTF8 page_width;
|
||||||
string page_height;
|
UTF8 page_height;
|
||||||
|
|
||||||
if( m_props->Value( "page_width", &page_width ) &&
|
if( m_props->Value( "page_width", &page_width ) &&
|
||||||
m_props->Value( "page_height", &page_height ) )
|
m_props->Value( "page_height", &page_height ) )
|
||||||
|
@ -2741,6 +2738,18 @@ wxDateTime EAGLE_PLUGIN::getModificationTime( const wxString& aPath )
|
||||||
{
|
{
|
||||||
wxFileName fn( aPath );
|
wxFileName fn( aPath );
|
||||||
|
|
||||||
|
// Do not call wxFileName::GetModificationTime() on a non-existent file, because
|
||||||
|
// if it fails, wx's implementation calls the crap wxLogSysError() which
|
||||||
|
// eventually infects our UI with an unwanted popup window, so don't let it fail.
|
||||||
|
if( !fn.IsFileReadable() )
|
||||||
|
{
|
||||||
|
wxString msg = wxString::Format(
|
||||||
|
_( "File '%s' is not readable." ),
|
||||||
|
GetChars( aPath ) );
|
||||||
|
|
||||||
|
THROW_IO_ERROR( msg );
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
// update the writable flag while we have a wxFileName, in a network this
|
// update the writable flag while we have a wxFileName, in a network this
|
||||||
// is possibly quite dynamic anyway.
|
// is possibly quite dynamic anyway.
|
||||||
|
@ -2770,8 +2779,6 @@ void EAGLE_PLUGIN::cacheLib( const wxString& aLibPath )
|
||||||
|
|
||||||
if( aLibPath != m_lib_path || load )
|
if( aLibPath != m_lib_path || load )
|
||||||
{
|
{
|
||||||
wxLogTrace( traceEaglePlugin, wxT( "Loading '%s'" ), TO_UTF8( aLibPath ) );
|
|
||||||
|
|
||||||
PTREE doc;
|
PTREE doc;
|
||||||
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
LOCALE_IO toggle; // toggles on, then off, the C locale.
|
||||||
|
|
||||||
|
@ -2866,10 +2873,10 @@ void EAGLE_PLUGIN::FootprintLibOptions( PROPERTIES* aListToAppendTo ) const
|
||||||
PLUGIN::FootprintLibOptions( aListToAppendTo );
|
PLUGIN::FootprintLibOptions( aListToAppendTo );
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(*aListToAppendTo)["ignore_duplicates"] = wxString( _(
|
(*aListToAppendTo)["ignore_duplicates"] = UTF8( _(
|
||||||
"Ignore duplicately named footprints within the same Eagle library. "
|
"Ignore duplicately named footprints within the same Eagle library. "
|
||||||
"Only the first similarly named footprint will be loaded."
|
"Only the first similarly named footprint will be loaded."
|
||||||
)).utf8_str();
|
));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -63,9 +63,9 @@ bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
||||||
if( aTrackItem->GetShape() == VIA_MICROVIA )
|
if( aTrackItem->GetShape() == VIA_MICROVIA )
|
||||||
{
|
{
|
||||||
if( net )
|
if( net )
|
||||||
new_width = net->GetViaSize();
|
|
||||||
else
|
|
||||||
new_width = net->GetMicroViaSize();
|
new_width = net->GetMicroViaSize();
|
||||||
|
else
|
||||||
|
new_width = GetBoard()->GetCurrentMicroViaSize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,357 @@
|
||||||
|
/**
|
||||||
|
* @file export_idf.cpp
|
||||||
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||||
|
*
|
||||||
|
* Copyright (C) 2013 Cirilo Bernardo
|
||||||
|
*
|
||||||
|
* 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 <list>
|
||||||
|
#include <wxPcbStruct.h>
|
||||||
|
#include <macros.h>
|
||||||
|
#include <pcbnew.h>
|
||||||
|
#include <class_board.h>
|
||||||
|
#include <class_module.h>
|
||||||
|
#include <class_edge_mod.h>
|
||||||
|
#include <idf.h>
|
||||||
|
|
||||||
|
// assumed default graphical line thickness: 10000 IU == 0.1mm
|
||||||
|
#define LINE_WIDTH (100000)
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function idf_export_outline
|
||||||
|
* retrieves line segment information from the edge layer and compiles
|
||||||
|
* the data into a form which can be output as an IDFv3 compliant
|
||||||
|
* BOARD_OUTLINE section.
|
||||||
|
*/
|
||||||
|
static void idf_export_outline( BOARD* aPcb, IDF_BOARD& aIDFBoard )
|
||||||
|
{
|
||||||
|
double scale = aIDFBoard.GetScale();
|
||||||
|
|
||||||
|
DRAWSEGMENT* graphic; // KiCad graphical item
|
||||||
|
IDF_POINT sp, ep; // start and end points from KiCad item
|
||||||
|
|
||||||
|
std::list< IDF_SEGMENT* > lines; // IDF intermediate form of KiCad graphical item
|
||||||
|
IDF_OUTLINE outline; // graphical items forming an outline or cutout
|
||||||
|
|
||||||
|
// NOTE: IMPLEMENTATION
|
||||||
|
// If/when component cutouts are allowed, we must implement them separately. Cutouts
|
||||||
|
// must be added to the board outline section and not to the Other Outline section.
|
||||||
|
// The module cutouts should be handled via the idf_export_module() routine.
|
||||||
|
|
||||||
|
double offX, offY;
|
||||||
|
aIDFBoard.GetOffset( offX, offY );
|
||||||
|
|
||||||
|
// Retrieve segments and arcs from the board
|
||||||
|
for( BOARD_ITEM* item = aPcb->m_Drawings; item; item = item->Next() )
|
||||||
|
{
|
||||||
|
if( item->Type() != PCB_LINE_T || item->GetLayer() != EDGE_N )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
graphic = (DRAWSEGMENT*) item;
|
||||||
|
|
||||||
|
switch( graphic->GetShape() )
|
||||||
|
{
|
||||||
|
case S_SEGMENT:
|
||||||
|
{
|
||||||
|
sp.x = graphic->GetStart().x * scale + offX;
|
||||||
|
sp.y = -graphic->GetStart().y * scale + offY;
|
||||||
|
ep.x = graphic->GetEnd().x * scale + offX;
|
||||||
|
ep.y = -graphic->GetEnd().y * scale + offY;
|
||||||
|
IDF_SEGMENT* seg = new IDF_SEGMENT( sp, ep );
|
||||||
|
|
||||||
|
if( seg )
|
||||||
|
lines.push_back( seg );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case S_ARC:
|
||||||
|
{
|
||||||
|
sp.x = graphic->GetCenter().x * scale + offX;
|
||||||
|
sp.y = -graphic->GetCenter().y * scale + offY;
|
||||||
|
ep.x = graphic->GetArcStart().x * scale + offX;
|
||||||
|
ep.y = -graphic->GetArcStart().y * scale + offY;
|
||||||
|
IDF_SEGMENT* seg = new IDF_SEGMENT( sp, ep, -graphic->GetAngle() / 10.0, true );
|
||||||
|
|
||||||
|
if( seg )
|
||||||
|
lines.push_back( seg );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case S_CIRCLE:
|
||||||
|
{
|
||||||
|
sp.x = graphic->GetCenter().x * scale + offX;
|
||||||
|
sp.y = -graphic->GetCenter().y * scale + offY;
|
||||||
|
ep.x = sp.x - graphic->GetRadius() * scale;
|
||||||
|
ep.y = sp.y;
|
||||||
|
// Circles must always have an angle of +360 deg. to appease
|
||||||
|
// quirky MCAD implementations of IDF.
|
||||||
|
IDF_SEGMENT* seg = new IDF_SEGMENT( sp, ep, 360.0, true );
|
||||||
|
|
||||||
|
if( seg )
|
||||||
|
lines.push_back( seg );
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// if there is no outline then use the bounding box
|
||||||
|
if( lines.empty() )
|
||||||
|
{
|
||||||
|
goto UseBoundingBox;
|
||||||
|
}
|
||||||
|
|
||||||
|
// get the board outline and write it out
|
||||||
|
// note: we do not use a try/catch block here since we intend
|
||||||
|
// to simply ignore unclosed loops and continue processing
|
||||||
|
// until we're out of segments to process
|
||||||
|
IDF3::GetOutline( lines, outline );
|
||||||
|
|
||||||
|
if( outline.empty() )
|
||||||
|
goto UseBoundingBox;
|
||||||
|
|
||||||
|
aIDFBoard.AddOutline( outline );
|
||||||
|
|
||||||
|
// get all cutouts and write them out
|
||||||
|
while( !lines.empty() )
|
||||||
|
{
|
||||||
|
IDF3::GetOutline( lines, outline );
|
||||||
|
|
||||||
|
if( outline.empty() )
|
||||||
|
continue;
|
||||||
|
|
||||||
|
aIDFBoard.AddOutline( outline );
|
||||||
|
}
|
||||||
|
|
||||||
|
return;
|
||||||
|
|
||||||
|
UseBoundingBox:
|
||||||
|
|
||||||
|
// clean up if necessary
|
||||||
|
while( !lines.empty() )
|
||||||
|
{
|
||||||
|
delete lines.front();
|
||||||
|
lines.pop_front();
|
||||||
|
}
|
||||||
|
|
||||||
|
outline.Clear();
|
||||||
|
|
||||||
|
// fetch a rectangular bounding box for the board;
|
||||||
|
// there is always some uncertainty in the board dimensions
|
||||||
|
// computed via ComputeBoundingBox() since this depends on the
|
||||||
|
// individual module entities.
|
||||||
|
EDA_RECT bbbox = aPcb->ComputeBoundingBox( true );
|
||||||
|
|
||||||
|
// convert to mm and compensate for an assumed LINE_WIDTH line thickness
|
||||||
|
double x = ( bbbox.GetOrigin().x + LINE_WIDTH / 2 ) * scale + offX;
|
||||||
|
double y = ( bbbox.GetOrigin().y + LINE_WIDTH / 2 ) * scale + offY;
|
||||||
|
double dx = ( bbbox.GetSize().x - LINE_WIDTH ) * scale;
|
||||||
|
double dy = ( bbbox.GetSize().y - LINE_WIDTH ) * scale;
|
||||||
|
|
||||||
|
double px[4], py[4];
|
||||||
|
px[0] = x;
|
||||||
|
py[0] = y;
|
||||||
|
|
||||||
|
px[1] = x;
|
||||||
|
py[1] = y + dy;
|
||||||
|
|
||||||
|
px[2] = x + dx;
|
||||||
|
py[2] = y + dy;
|
||||||
|
|
||||||
|
px[3] = x + dx;
|
||||||
|
py[3] = y;
|
||||||
|
|
||||||
|
IDF_POINT p1, p2;
|
||||||
|
|
||||||
|
p1.x = px[3];
|
||||||
|
p1.y = py[3];
|
||||||
|
p2.x = px[0];
|
||||||
|
p2.y = py[0];
|
||||||
|
|
||||||
|
outline.push( new IDF_SEGMENT( p1, p2 ) );
|
||||||
|
|
||||||
|
for( int i = 1; i < 4; ++i )
|
||||||
|
{
|
||||||
|
p1.x = px[i - 1];
|
||||||
|
p1.y = py[i - 1];
|
||||||
|
p2.x = px[i];
|
||||||
|
p2.y = py[i];
|
||||||
|
|
||||||
|
outline.push( new IDF_SEGMENT( p1, p2 ) );
|
||||||
|
}
|
||||||
|
|
||||||
|
aIDFBoard.AddOutline( outline );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function idf_export_module
|
||||||
|
* retrieves information from all board modules, adds drill holes to
|
||||||
|
* the DRILLED_HOLES or BOARD_OUTLINE section as appropriate,
|
||||||
|
* compiles data for the PLACEMENT section and compiles data for
|
||||||
|
* the library ELECTRICAL section.
|
||||||
|
*/
|
||||||
|
static void idf_export_module( BOARD* aPcb, MODULE* aModule,
|
||||||
|
IDF_BOARD& aIDFBoard )
|
||||||
|
{
|
||||||
|
// Reference Designator
|
||||||
|
std::string crefdes = TO_UTF8( aModule->GetReference() );
|
||||||
|
|
||||||
|
if( crefdes.empty() || !crefdes.compare( "~" ) )
|
||||||
|
{
|
||||||
|
std::string cvalue = TO_UTF8( aModule->GetValue() );
|
||||||
|
|
||||||
|
// if both the RefDes and Value are empty or set to '~' the board owns the part,
|
||||||
|
// otherwise associated parts of the module must be marked NOREFDES.
|
||||||
|
if( cvalue.empty() || !cvalue.compare( "~" ) )
|
||||||
|
crefdes = "BOARD";
|
||||||
|
else
|
||||||
|
crefdes = "NOREFDES";
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: If module cutouts are supported we must add code here
|
||||||
|
// for( EDA_ITEM* item = aModule->GraphicalItems(); item != NULL; item = item->Next() )
|
||||||
|
// {
|
||||||
|
// if( ( item->Type() != PCB_MODULE_EDGE_T )
|
||||||
|
// || (item->GetLayer() != EDGE_N ) ) continue;
|
||||||
|
// code to export cutouts
|
||||||
|
// }
|
||||||
|
|
||||||
|
// Export pads
|
||||||
|
double drill, x, y;
|
||||||
|
double scale = aIDFBoard.GetScale();
|
||||||
|
IDF3::KEY_PLATING kplate;
|
||||||
|
std::string pintype;
|
||||||
|
std::string tstr;
|
||||||
|
|
||||||
|
double dx, dy;
|
||||||
|
|
||||||
|
aIDFBoard.GetOffset( dx, dy );
|
||||||
|
|
||||||
|
for( D_PAD* pad = aModule->Pads(); pad; pad = pad->Next() )
|
||||||
|
{
|
||||||
|
drill = (double) pad->GetDrillSize().x * scale;
|
||||||
|
x = pad->GetPosition().x * scale + dx;
|
||||||
|
y = -pad->GetPosition().y * scale + dy;
|
||||||
|
|
||||||
|
// Export the hole on the edge layer
|
||||||
|
if( drill > 0.0 )
|
||||||
|
{
|
||||||
|
// plating
|
||||||
|
if( pad->GetAttribute() == PAD_HOLE_NOT_PLATED )
|
||||||
|
kplate = IDF3::NPTH;
|
||||||
|
else
|
||||||
|
kplate = IDF3::PTH;
|
||||||
|
|
||||||
|
// hole type
|
||||||
|
tstr = TO_UTF8( pad->GetPadName() );
|
||||||
|
|
||||||
|
if( tstr.empty() || !tstr.compare( "0" ) || !tstr.compare( "~" )
|
||||||
|
|| ( kplate == IDF3::NPTH ) || ( pad->GetDrillShape() == PAD_OVAL ) )
|
||||||
|
pintype = "MTG";
|
||||||
|
else
|
||||||
|
pintype = "PIN";
|
||||||
|
|
||||||
|
// fields:
|
||||||
|
// 1. hole dia. : float
|
||||||
|
// 2. X coord : float
|
||||||
|
// 3. Y coord : float
|
||||||
|
// 4. plating : PTH | NPTH
|
||||||
|
// 5. Assoc. part : BOARD | NOREFDES | PANEL | {"refdes"}
|
||||||
|
// 6. type : PIN | VIA | MTG | TOOL | { "other" }
|
||||||
|
// 7. owner : MCAD | ECAD | UNOWNED
|
||||||
|
if( ( pad->GetDrillShape() == PAD_OVAL )
|
||||||
|
&& ( pad->GetDrillSize().x != pad->GetDrillSize().y ) )
|
||||||
|
{
|
||||||
|
// NOTE: IDF does not have direct support for slots;
|
||||||
|
// slots are implemented as a board cutout and we
|
||||||
|
// cannot represent plating or reference designators
|
||||||
|
|
||||||
|
double dlength = pad->GetDrillSize().y * scale;
|
||||||
|
|
||||||
|
// NOTE: The orientation of modules and pads have
|
||||||
|
// the opposite sense due to KiCad drawing on a
|
||||||
|
// screen with a LH coordinate system
|
||||||
|
double angle = pad->GetOrientation() / 10.0;
|
||||||
|
|
||||||
|
if( dlength < drill )
|
||||||
|
{
|
||||||
|
std::swap( drill, dlength );
|
||||||
|
angle += M_PI2;
|
||||||
|
}
|
||||||
|
|
||||||
|
// NOTE: KiCad measures a slot's length from end to end
|
||||||
|
// rather than between the centers of the arcs
|
||||||
|
dlength -= drill;
|
||||||
|
|
||||||
|
aIDFBoard.AddSlot( drill, dlength, angle, x, y );
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
aIDFBoard.AddDrill( drill, x, y, kplate, crefdes, pintype, IDF3::ECAD );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO
|
||||||
|
// add to the library item list
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Function Export_IDF3
|
||||||
|
* generates IDFv3 compliant board (*.emn) and library (*.emp)
|
||||||
|
* files representing the user's PCB design.
|
||||||
|
*/
|
||||||
|
bool Export_IDF3( BOARD* aPcb, const wxString& aFullFileName, double aUseThou )
|
||||||
|
{
|
||||||
|
IDF_BOARD idfBoard;
|
||||||
|
|
||||||
|
SetLocaleTo_C_standard();
|
||||||
|
|
||||||
|
// NOTE:
|
||||||
|
// XXX We may enclose all this in a TRY .. CATCH block
|
||||||
|
idfBoard.Setup( aPcb->GetFileName(), aFullFileName, aUseThou,
|
||||||
|
aPcb->GetDesignSettings().GetBoardThickness() );
|
||||||
|
|
||||||
|
// set up the global offsets
|
||||||
|
EDA_RECT bbox = aPcb->ComputeBoundingBox( true );
|
||||||
|
idfBoard.SetOffset( bbox.Centre().x * idfBoard.GetScale(),
|
||||||
|
bbox.Centre().y * idfBoard.GetScale() );
|
||||||
|
|
||||||
|
// Export the board outline
|
||||||
|
idf_export_outline( aPcb, idfBoard );
|
||||||
|
|
||||||
|
// Output the drill holes and module (library) data.
|
||||||
|
for( MODULE* module = aPcb->m_Modules; module != 0; module = module->Next() )
|
||||||
|
idf_export_module( aPcb, module, idfBoard );
|
||||||
|
|
||||||
|
idfBoard.Finish();
|
||||||
|
|
||||||
|
SetLocaleTo_Default();
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
|
@ -479,9 +479,11 @@ int PCB_EDIT_FRAME::DoGenFootprintsPositionFile( const wxString& aFullFileName,
|
||||||
for( int ii = 0; ii < moduleCount; ii++ )
|
for( int ii = 0; ii < moduleCount; ii++ )
|
||||||
{
|
{
|
||||||
wxPoint module_pos;
|
wxPoint module_pos;
|
||||||
|
|
||||||
const wxString& ref = list[ii].m_Reference;
|
const wxString& ref = list[ii].m_Reference;
|
||||||
const wxString& val = list[ii].m_Value;
|
const wxString& val = list[ii].m_Value;
|
||||||
const wxString& pkg = FROM_UTF8( list[ii].m_Module->GetFPID().Format().c_str() );
|
const wxString& pkg = list[ii].m_Module->GetFPID().Format();
|
||||||
|
|
||||||
sprintf( line, "%-8.8s %-16.16s %-16.16s",
|
sprintf( line, "%-8.8s %-16.16s %-16.16s",
|
||||||
TO_UTF8( ref ), TO_UTF8( val ), TO_UTF8( pkg ) );
|
TO_UTF8( ref ), TO_UTF8( val ), TO_UTF8( pkg ) );
|
||||||
|
|
||||||
|
|
|
@ -166,7 +166,7 @@ MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
string fp_name = TO_UTF8( aFootprintName );
|
UTF8 fp_name = aFootprintName;
|
||||||
|
|
||||||
MODULE_CITER it = m_gh_cache->find( fp_name );
|
MODULE_CITER it = m_gh_cache->find( fp_name );
|
||||||
|
|
||||||
|
@ -321,20 +321,20 @@ void GITHUB_PLUGIN::FootprintLibOptions( PROPERTIES* aListToAppendTo ) const
|
||||||
// inherit options supported by all PLUGINs.
|
// inherit options supported by all PLUGINs.
|
||||||
PLUGIN::FootprintLibOptions( aListToAppendTo );
|
PLUGIN::FootprintLibOptions( aListToAppendTo );
|
||||||
|
|
||||||
(*aListToAppendTo)[ PRETTY_DIR ] = wxString( _(
|
(*aListToAppendTo)[ PRETTY_DIR ] = UTF8( _(
|
||||||
"Set this property to a directory where footprints are to be written as pretty "
|
"Set this property to a directory where footprints are to be written as pretty "
|
||||||
"footprints when saving to this library. Anything saved will take precedence over "
|
"footprints when saving to this library. Anything saved will take precedence over "
|
||||||
"footprints by the same name in the github repo. These saved footprints can then "
|
"footprints by the same name in the github repo. These saved footprints can then "
|
||||||
"be sent to the library maintainer as updates. "
|
"be sent to the library maintainer as updates. "
|
||||||
"<p>The directory <b>must</b> have a <b>.pretty</b> file extension because the "
|
"<p>The directory <b>must</b> have a <b>.pretty</b> file extension because the "
|
||||||
"format of the save is pretty.</p>"
|
"format of the save is pretty.</p>"
|
||||||
)).utf8_str();
|
));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
(*aListToAppendTo)["cache_github_zip_in_this_dir"] = wxString( _(
|
(*aListToAppendTo)["cache_github_zip_in_this_dir"] = UTF8( _(
|
||||||
"Set this property to a directory where the github *.zip file will be cached. "
|
"Set this property to a directory where the github *.zip file will be cached. "
|
||||||
"This should speed up subsequent visits to this library."
|
"This should speed up subsequent visits to this library."
|
||||||
)).utf8_str();
|
));
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -356,11 +356,11 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
|
||||||
|
|
||||||
if( aProperties )
|
if( aProperties )
|
||||||
{
|
{
|
||||||
string pretty_dir;
|
UTF8 pretty_dir;
|
||||||
|
|
||||||
if( aProperties->Value( PRETTY_DIR, &pretty_dir ) )
|
if( aProperties->Value( PRETTY_DIR, &pretty_dir ) )
|
||||||
{
|
{
|
||||||
wxString wx_pretty_dir = FROM_UTF8( pretty_dir.c_str() );
|
wxString wx_pretty_dir = pretty_dir;
|
||||||
|
|
||||||
wx_pretty_dir = FP_LIB_TABLE::ExpandSubstitutions( wx_pretty_dir );
|
wx_pretty_dir = FP_LIB_TABLE::ExpandSubstitutions( wx_pretty_dir );
|
||||||
|
|
||||||
|
@ -409,7 +409,7 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
|
||||||
|
|
||||||
if( fn.GetExt() == kicad_mod )
|
if( fn.GetExt() == kicad_mod )
|
||||||
{
|
{
|
||||||
string fp_name = TO_UTF8( fn.GetName() ); // omit extension & path
|
UTF8 fp_name = fn.GetName(); // omit extension & path
|
||||||
|
|
||||||
m_gh_cache->insert( fp_name, entry );
|
m_gh_cache->insert( fp_name, entry );
|
||||||
}
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue