Commit 537d82fb authored by Maciej Suminski's avatar Maciej Suminski

Upstream merge.

parents 3dc9f295 54bbba6c
......@@ -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"
)
option( KICAD_BUILD_STATIC
"Builds Kicad and all libraries static (except wx-widgets)"
)
# when option KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES is enabled:
# PYTHON_EXECUTABLE can be defined when invoking cmake
# ( 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
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_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 )
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 )
if( WIN32 AND MSYS AND NOT CMAKE_CROSSCOMPILING )
# fixme: it is needed only with MSYS+MINGW32? or always under MINGW
if (${CMAKE_SIZEOF_VOID_P} MATCHES 4)
set(CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0)
if( ${CMAKE_SIZEOF_VOID_P} MATCHES 4 )
set( CMAKE_CXX_USE_RESPONSE_FILE_FOR_INCLUDES 0 )
endif()
endif()
......@@ -157,7 +169,12 @@ if( CMAKE_COMPILER_IS_GNUCXX )
set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-local-typedefs" )
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 )
add_definitions( -DKICAD_KEEPCASE )
......@@ -242,6 +259,19 @@ include( Functions )
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.
#================================================
......@@ -256,6 +286,23 @@ add_definitions(-DWX_COMPATIBILITY)
find_package( OpenGL QUIET )
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 #
#####################
......@@ -272,7 +319,6 @@ check_find_package_result(CAIRO_FOUND "Cairo")
#################################################
include( download_boost )
##########################
# Find wxWidgets library #
##########################
......@@ -484,7 +530,7 @@ if( UNIX )
set( UNIX_MIME_DIR resources/linux/mime )
set( UNIX_MIMELNK_FILES ${UNIX_MIME_DIR}/mimelnk )
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 )
# Install Mimelnk directory
......@@ -494,7 +540,7 @@ if( UNIX )
)
# Install Mime directory
install( DIRECTORY ${UNIX_ICONS_FILES}
install( DIRECTORY ${UNIX_ICON_FILES}
DESTINATION ${CMAKE_INSTALL_PREFIX}/share
COMPONENT resources
)
......
......@@ -30,8 +30,15 @@ macro( create_bzr_version_header )
set( _Bazaar_SAVED_LC_ALL "$ENV{LC_ALL}" )
set( ENV{LC_ALL} C )
# Get the tree revison
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
ERROR_VARIABLE _bazaar_log_error
RESULT_VARIABLE _bazaar_log_result
......
......@@ -36,17 +36,21 @@
# Consider it a benchmark when writing your own feature tests.
#
macro(perform_feature_checks)
macro( perform_feature_checks )
include(CheckIncludeFile)
#include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckSymbolExists)
include(CheckIncludeFileCXX)
include(CheckCXXSymbolExists)
include(CheckCXXSourceCompiles)
include( CheckIncludeFile )
#include( CheckFunctionExists )
include( CheckLibraryExists )
include( CheckSymbolExists )
include( CheckIncludeFileCXX )
include( CheckCXXSymbolExists )
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
# 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
# appear to cause any problems with other compilers, that doesn't
# 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
# 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
# included in pyport.h which is where the problem ocurrs without this
# fix.
check_include_file("stdint.h" HAVE_STDINT_H)
check_include_file( "stdint.h" HAVE_STDINT_H )
if( HAVE_STDINT_H )
add_definitions( -DHAVE_STDINT_H )
......@@ -73,40 +77,41 @@ macro(perform_feature_checks)
# re-introduce this.
# check_include_file("strings.h" HAVE_STRINGS_H)
check_symbol_exists(strcasecmp "string.h" HAVE_STRCASECMP)
check_symbol_exists(strcasecmp "strings.h" HAVE_STRCASECMP)
check_symbol_exists(strncasecmp "string.h" HAVE_STRNCASECMP)
check_symbol_exists(strncasecmp "strings.h" HAVE_STRNCASECMP)
check_symbol_exists( strcasecmp "string.h" HAVE_STRCASECMP )
check_symbol_exists( strcasecmp "strings.h" HAVE_STRCASECMP )
check_symbol_exists( strncasecmp "string.h" HAVE_STRNCASECMP )
check_symbol_exists( strncasecmp "strings.h" HAVE_STRNCASECMP )
check_symbol_exists( strtok_r "string.h" HAVE_STRTOKR )
# 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_include_file("math.h" HAVE_MATH_H)
check_include_file( "math.h" HAVE_MATH_H )
# Check for functions in C++ cmath.
check_include_file_cxx(cmath HAVE_CXX_CMATH)
check_cxx_symbol_exists(asinh cmath HAVE_CMATH_ASINH )
check_cxx_symbol_exists(acosh cmath HAVE_CMATH_ACOSH )
check_cxx_symbol_exists(atanh cmath HAVE_CMATH_ATANH )
check_include_file_cxx( cmath HAVE_CXX_CMATH )
check_cxx_symbol_exists( asinh cmath HAVE_CMATH_ASINH )
check_cxx_symbol_exists( acosh cmath HAVE_CMATH_ACOSH )
check_cxx_symbol_exists( atanh cmath HAVE_CMATH_ATANH )
# CMakes check_cxx_symbol_exists() doesn't work for templates so we must create a
# 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_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_symbol_exists( clock_gettime "time.h" HAVE_CLOCK_GETTIME ) non-standard library, does not work
check_library_exists( rt clock_gettime "" HAVE_CLOCK_GETTIME )
# 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
# 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.
configure_file(${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${CMAKE_BINARY_DIR}/config.h)
configure_file( ${PROJECT_SOURCE_DIR}/CMakeModules/config.h.cmake
${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.
# Chosen libraries are based on AVHTTP requirements, and possibly
# unit_test_framework for its own worth.
# tool_manager.cpp -> coroutine -> context (_jump_fcontext) (on OSX)
set( BOOST_LIBS_BUILT
#context
context
#coroutine
date_time
#exception
......@@ -55,7 +57,6 @@ set( BOOST_LIBS_BUILT
thread
#unit_test_framework
)
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
......@@ -88,6 +89,16 @@ endfunction()
string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT}" )
#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( MSYS )
# The Boost system does not build properly on MSYS using bootstrap.sh. Running
......@@ -101,18 +112,62 @@ if( MINGW )
foreach( lib ${boost_libs_list} )
set( b2_libs ${b2_libs} --with-${lib} )
endforeach()
unset( PIC_STUFF )
unset( BOOST_CFLAGS )
else()
string( REGEX REPLACE "\\;" "," libs_csv "${boost_libs_list}" )
#message( STATUS "libs_csv:${libs_csv}" )
set( bootstrap ./bootstrap.sh --with-libraries=${libs_csv} )
# 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" )
unset( b2_libs )
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
PREFIX "${PREFIX}"
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
# to ignore previously applied patches
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_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
# replacing them below.
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${BOOST_ROOT}"
......@@ -139,10 +221,14 @@ ExternalProject_Add( boost
BUILD_COMMAND ./b2
variant=release
threading=multi
toolset=gcc
${PIC_STUFF}
${BOOST_CFLAGS}
${BOOST_TOOLSET}
${BOOST_CXXFLAGS}
${BOOST_LINKFLAGS}
${BOOST_ADDRESSMODEL}
${BOOST_ARCHITECTURE}
${b2_libs}
#link=static
${BOOST_LINKTYPE}
--prefix=<INSTALL_DIR>
install
......@@ -175,8 +261,8 @@ endif()
set( boost_libs "" )
set_boost_lib_names( "${BOOST_LIBS_BUILT}" boost_libs )
set( Boost_LIBRARIES ${boost_libs} CACHE FILEPATH "Boost libraries directory" )
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" CACHE FILEPATH "Boost include directory" )
set( Boost_LIBRARIES ${boost_libs} )
set( Boost_INCLUDE_DIR "${BOOST_INCLUDE}" )
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
# 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'"
DEPENDERS bzr_commit_boost
)
......
# 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
)
# 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"
)
# 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
)
# 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
)
# 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
)
......@@ -62,7 +62,6 @@ PCBNew
Dick's Final TODO List:
======================
*) Apply Fabrizio and Alexander's linux desktop patches after unifying them.
*) Get licensing cleaned up.
*) Re-arrange the repo architecture.
*) DLL-ization of pcbnew & eeschema
......
......@@ -34,5 +34,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
include_directories(BEFORE ${INC_BEFORE})
include_directories( BEFORE ${INC_BEFORE} )
include_directories(
./dialogs
./dialog_about
......@@ -37,6 +36,7 @@ set(GAL_SRCS
gal/stroke_font.cpp
gal/color4d.cpp
view/wx_view_controls.cpp
geometry/hetriang.cpp
# OpenGL GAL
gal/opengl/opengl_gal.cpp
......@@ -62,7 +62,7 @@ if(WIN32 AND MSYS)
add_definitions(-DGLEW_STATIC)
endif(WIN32 AND MSYS)
set(COMMON_ABOUT_DLG_SRCS
set( COMMON_ABOUT_DLG_SRCS
dialog_about/AboutDialog_main.cpp
dialog_about/dialog_about.cpp
dialog_about/dialog_about_base.cpp
......@@ -78,7 +78,7 @@ set(COMMON_ABOUT_DLG_SRCS
dialogs/dialog_page_settings_base.cpp
)
set(COMMON_PAGE_LAYOUT_SRCS
set( COMMON_PAGE_LAYOUT_SRCS
page_layout/title_block_shapes.cpp
page_layout/class_worksheet_dataitem.cpp
page_layout/class_worksheet_layout.cpp
......@@ -88,7 +88,7 @@ set(COMMON_PAGE_LAYOUT_SRCS
page_layout/page_layout_reader.cpp
)
set(COMMON_SRCS
set( COMMON_SRCS
${COMMON_ABOUT_DLG_SRCS}
${COMMON_PAGE_LAYOUT_SRCS}
base_struct.cpp
......@@ -153,17 +153,14 @@ if( NOT HAVE_STRTOKR )
set( COMMON_SRCS ${COMMON_SRCS} strtok_r.c )
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}
view/view.cpp
view/view_item.cpp
view/view_group.cpp
math/math_util.cpp
system/fcontext.s
tool/tool_base.cpp
tool/tool_manager.cpp
......@@ -179,9 +176,20 @@ set(COMMON_SRCS
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
eda_text.cpp
class_page_info.cpp
......@@ -235,7 +243,7 @@ set(PCB_COMMON_SRCS
fp_lib_table.cpp
)
set(PCB_COMMON_SRCS
set( PCB_COMMON_SRCS
${PCB_COMMON_SRCS}
../pcbnew/pcb_painter.cpp
)
......@@ -245,7 +253,7 @@ set_source_files_properties( ${PCB_COMMON_SRCS} PROPERTIES
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
make_lexer(
......
......@@ -221,7 +221,8 @@ void EDA_BASE_FRAME::LoadSettings()
// 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
// position code can be removed.
config->Read( m_FrameName + entryPerspective, &m_perspective );
if( config )
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
*/
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 )
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 );
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 );
orient = AddAngles( orient, 900 );
}
sketchOval( pos, size, orient, -1 );
}
......
......@@ -133,7 +133,8 @@ void PlotWorkSheet( PLOTTER* plotter, const TITLE_BLOCK& aTitleBlock,
text->GetSize(),
text->GetHorizJustify(), text->GetVertJustify(),
text->GetPenWidth(),
text->IsItalic(), text->IsBold() );
text->IsItalic(), text->IsBold(),
text->IsMultilineAllowed() );
}
break;
......
......@@ -87,31 +87,32 @@ void DHEAD::append( EDA_ITEM* aNewElement )
void DHEAD::append( DHEAD& aList )
{
wxCHECK_RET( aList.GetCount() != 0, wxT( "Attempt to append empty list." ) );
// Change the item's list to me.
for( EDA_ITEM* item = aList.first; item != NULL; item = item->Next() )
item->SetList( this );
if( first ) // list is not empty, set last item's next to the first item in aList
if( aList.first )
{
wxCHECK_RET( last != NULL, wxT( "Last list element not set." ) );
// Change the item's list to me.
for( EDA_ITEM* item = aList.first; item; item = item->Next() )
item->SetList( this );
last->SetNext( aList.first );
aList.first->SetBack( last );
last = aList.last;
}
else // list is empty, first and last are same as aList
{
first = aList.first;
last = aList.last;
}
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." ) );
count += aList.count;
last->SetNext( aList.first );
aList.first->SetBack( last );
last = aList.last;
}
else // this list is empty, first and last are same as aList
{
first = aList.first;
last = aList.last;
}
aList.count = 0;
aList.first = NULL;
aList.last = NULL;
count += aList.count;
aList.count = 0;
aList.first = NULL;
aList.last = NULL;
}
}
......
......@@ -228,10 +228,10 @@ void EDA_DRAW_FRAME::SkipNextLeftButtonReleaseEvent()
void EDA_DRAW_FRAME::OnToggleGridState( wxCommandEvent& aEvent )
{
SetGridVisibility( !IsGridVisible() );
if( m_galCanvasActive )
if( IsGalCanvasActive() )
{
m_galCanvas->GetGAL()->SetGridVisibility( IsGridVisible() );
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
GetGalCanvas()->GetGAL()->SetGridVisibility( IsGridVisible() );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
m_canvas->Refresh();
......@@ -387,11 +387,11 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
screen->SetGrid( id );
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 ) );
m_galCanvas->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
GetGalCanvas()->GetView()->MarkTargetDirty( KIGFX::TARGET_NONCACHED );
}
m_canvas->Refresh();
......@@ -422,17 +422,17 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
GetScreen()->SetZoom( selectedZoom );
if( m_galCanvasActive )
if( IsGalCanvasActive() )
{
// Apply computed view settings to GAL
KIGFX::VIEW* view = m_galCanvas->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL();
KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
double zoom = 1.0 / ( zoomFactor * GetZoom() );
view->SetScale( zoom );
m_galCanvas->Refresh();
GetGalCanvas()->Refresh();
}
else
RedrawScreen( GetScrollCenterPosition(), false );
......@@ -636,7 +636,7 @@ void EDA_DRAW_FRAME::ClearMsgPanel( void )
void EDA_DRAW_FRAME::SetMsgPanel( const MSG_PANEL_ITEMS& aList )
{
if( m_messagePanel == NULL && !aList.empty() )
if( m_messagePanel == NULL )
return;
ClearMsgPanel();
......@@ -954,8 +954,8 @@ void EDA_DRAW_FRAME::AdjustScrollBars( const wxPoint& aCenterPositionIU )
void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
{
KIGFX::VIEW* view = m_galCanvas->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL();
KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
......@@ -965,7 +965,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
BASE_SCREEN* screen = GetScreen();
// Switch to GAL rendering
if( !m_galCanvasActive )
if( !IsGalCanvasActive() )
{
// Set up viewport
double zoom = 1.0 / ( zoomFactor * m_canvas->GetZoom() );
......@@ -981,7 +981,7 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
else
{
// Switch to standard rendering
if( m_galCanvasActive )
if( IsGalCanvasActive() )
{
// Change view settings only if GAL was active previously
double zoom = 1.0 / ( zoomFactor * view->GetScale() );
......@@ -993,17 +993,17 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
}
m_canvas->SetEvtHandlerEnabled( !aEnable );
m_galCanvas->SetEvtHandlerEnabled( aEnable );
GetGalCanvas()->SetEvtHandlerEnabled( aEnable );
// Switch panes
m_auimgr.GetPane( wxT( "DrawFrame" ) ).Show( !aEnable );
m_auimgr.GetPane( wxT( "DrawFrameGal" ) ).Show( aEnable );
m_auimgr.Update();
m_galCanvasActive = aEnable;
SetGalCanvasActive( aEnable );
if( aEnable )
m_galCanvas->SetFocus();
GetGalCanvas()->SetFocus();
}
//-----< 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
* @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 aMultilineAllowed = true to plot text as multiline, otherwise single line
*/
void PLOTTER::Text( const wxPoint& aPos,
enum EDA_COLOR_T aColor,
......@@ -612,7 +613,8 @@ void PLOTTER::Text( const wxPoint& aPos,
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold )
bool aBold,
bool aMultilineAllowed )
{
int textPensize = aWidth;
......@@ -630,13 +632,50 @@ void PLOTTER::Text( const wxPoint& aPos,
if( aColor >= 0 )
SetColor( aColor );
DrawGraphicText( NULL, NULL, aPos, aColor, aText,
aOrient, aSize,
aH_justify, aV_justify,
textPensize, aItalic,
aBold,
NULL,
this );
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,
aOrient, aSize,
aH_justify, aV_justify,
textPensize, aItalic,
aBold,
NULL,
this );
}
if( aWidth != textPensize )
SetCurrentLineWidth( aWidth );
......
......@@ -295,7 +295,7 @@ void EDA_TEXT::Draw( EDA_RECT* aClipBox, wxDC* aDC, const wxPoint& aOffset,
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
// multiline text according to
......
This diff is collapsed.
......@@ -273,8 +273,8 @@ FOOTPRINT_INFO* FOOTPRINT_LIST::GetModuleInfo( const wxString& aFootprintName )
wxString::Format( wxT( "'%s' is not a valid FPID." ),
GetChars( aFootprintName ) ) );
wxString libNickname = FROM_UTF8( fpid.GetLibNickname().c_str() );
wxString footprintName = FROM_UTF8( fpid.GetFootprintName().c_str() );
wxString libNickname = fpid.GetLibNickname();
wxString footprintName = fpid.GetFootprintName();
if( libNickname == fp.GetNickname() && footprintName == fp.GetFootprintName() )
return &fp;
......
......@@ -173,7 +173,7 @@ MODULE* FP_LIB_TABLE::FootprintLoad( const wxString& aNickname, const wxString&
FPID& fpid = (FPID&) ret->GetFPID();
// 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
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
// 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() ) );
......@@ -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 )
{
for( PROPERTIES::const_iterator it = aProperties->begin(); it != aProperties->end(); ++it )
{
const std::string& name = it->first;
const std::string& value = it->second;
const UTF8& value = it->second;
if( ret.size() )
ret += OPT_SEP;
......@@ -741,7 +742,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
{
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" ),
GetChars( fn.GetFullPath() ) );
aReporter->Report( msg );
......@@ -751,8 +752,7 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
continue;
}
module = pi->FootprintLoad( libPath,
FROM_UTF8( component->GetFPID().GetFootprintName().c_str() ) );
module = pi->FootprintLoad( libPath, component->GetFPID().GetFootprintName() );
if( module )
{
......@@ -766,10 +766,10 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
{
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" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
GetChars( component->GetFPID().Format() ) );
aReporter->Report( msg );
}
......@@ -811,10 +811,10 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
{
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" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( component->GetFPID().Format().c_str() ) ) );
GetChars( component->GetFPID().Format() ) );
aReporter->Report( msg );
}
......@@ -828,10 +828,14 @@ bool FP_LIB_TABLE::ConvertFromLegacy( NETLIST& aNetList, const wxArrayString& aL
if( !newFPID.IsValid() )
{
msg.Printf( _( "Component `%s` FPID <%s> is not valid.\n" ),
GetChars( component->GetReference() ),
GetChars( FROM_UTF8( newFPID.Format().c_str() ) ) );
aReporter->Report( msg );
if( aReporter )
{
msg.Printf( _( "Component `%s` FPID '%s' is not valid.\n" ),
GetChars( component->GetReference() ),
GetChars( newFPID.Format() ) );
aReporter->Report( msg );
}
retv = false;
}
else
......@@ -856,7 +860,7 @@ void FP_LIB_TABLE::SetProjectPathEnvVariable( const wxFileName& aPath )
else
path = aPath.GetPath();
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to <%s>." ),
wxLogTrace( traceFpLibTable, wxT( "Setting env %s to '%s'." ),
GetChars( ProjectPathEnvVariableName() ), GetChars( path ) );
wxSetEnv( ProjectPathEnvVariableName(), path );
}
......@@ -895,7 +899,7 @@ wxString FP_LIB_TABLE::GetProjectFileName( const wxFileName& aPath )
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() ) );
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 ) )
{
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() ) ) );
}
......@@ -950,7 +954,7 @@ wxString FP_LIB_TABLE::GetGlobalTableFileName()
fn.SetName( GetFileName() );
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file <%s>." ),
wxLogTrace( traceFpLibTable, wxT( "Global footprint library table file '%s'." ),
GetChars( 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() )
{
......@@ -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() )
{
......@@ -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 )
throw( PARSE_ERROR )
{
std::string ret;
UTF8 ret;
int offset;
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
m_gal->Save();
m_gal->Translate( aPosition );
m_gal->Rotate( -aRotationAngle );
// Single line height
int lineHeight = getInterline();
......@@ -177,8 +178,6 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
break;
}
m_gal->Rotate( -aRotationAngle );
m_gal->SetIsStroke( true );
m_gal->SetIsFill( false );
......@@ -193,7 +192,7 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
{
size_t length = newlinePos - begin;
drawSingleLineText( aText.Mid( begin, length ) );
drawSingleLineText( aText.substr( begin, length ) );
m_gal->Translate( VECTOR2D( 0.0, lineHeight ) );
begin = newlinePos + 1;
......@@ -201,20 +200,20 @@ void STROKE_FONT::Draw( const wxString& aText, const VECTOR2D& aPosition, double
}
// Draw the last (or the only one) line
if( !aText.IsEmpty() )
drawSingleLineText( aText.Mid( begin ) );
if( !aText.empty() )
drawSingleLineText( aText.substr( begin ) );
m_gal->Restore();
}
void STROKE_FONT::drawSingleLineText( const wxString& aText )
void STROKE_FONT::drawSingleLineText( const UTF8& aText )
{
// By default the overbar is turned off
m_overbar = false;
double xOffset;
VECTOR2D glyphSize( m_glyphSize );
double xOffset;
VECTOR2D glyphSize( m_glyphSize );
// Compute the text size
VECTOR2D textSize = computeTextSize( aText );
......@@ -255,12 +254,12 @@ void STROKE_FONT::drawSingleLineText( const wxString& aText )
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
if( *chIt == '~' )
{
if( ++chIt == aText.end() )
if( ++chIt >= end )
break;
if( *chIt != '~' ) // It was a single tilda, it toggles overbar
......@@ -275,13 +274,14 @@ void STROKE_FONT::drawSingleLineText( const wxString& aText )
dd = '?' - ' ';
GLYPH& glyph = m_glyphs[dd];
BOX2D& bbox = m_glyphBoundingBoxes[dd];
BOX2D& bbox = m_glyphBoundingBoxes[dd];
if( m_overbar )
{
VECTOR2D startOverbar( xOffset, -getInterline() * OVERBAR_HEIGHT );
VECTOR2D endOverbar( xOffset + glyphSize.x * bbox.GetEnd().x,
-getInterline() * OVERBAR_HEIGHT );
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 );
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" ) );
// 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( *chIt == '~' )
if( *it == '~' )
{
if( ++chIt == aText.end() )
if( ++it >= end )
break;
}
// Index in the bounding boxes table
unsigned dd = *chIt - ' ';
unsigned dd = *it - ' ';
if( dd >= m_glyphBoundingBoxes.size() || dd < 0 )
dd = '?' - ' ';
......
This diff is collapsed.
......@@ -160,69 +160,67 @@ bool CollideShapes( const SHAPE* aA, const SHAPE* aB, int aClearance,
{
switch( aA->Type() )
{
case SH_RECT:
switch( aB->Type() )
{
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_RECT:
switch( aB->Type() )
{
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_RECT*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
default:
break;
}
default:
break;
}
break;
case SH_CIRCLE:
switch( aB->Type() )
{
case SH_RECT:
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
*static_cast<const SHAPE_CIRCLE*>( aA ), aClearance, aNeedMTV, aMTV );
case SH_CIRCLE:
switch( aB->Type() )
{
case SH_RECT:
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
*static_cast<const SHAPE_CIRCLE*>( aA ), aClearance, aNeedMTV, aMTV );
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
*static_cast<const SHAPE_CIRCLE*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN *>( aB ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN *>( aB ), aClearance, aNeedMTV, aMTV );
default:
break;
}
default:
break;
}
break;
case SH_LINE_CHAIN:
switch( aB->Type() )
{
case SH_RECT:
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aB ),
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
switch( aB->Type() )
{
case SH_RECT:
return Collide( *static_cast<const SHAPE_RECT*>( aB ),
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_LINE_CHAIN*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
case SH_CIRCLE:
return Collide( *static_cast<const SHAPE_CIRCLE*>( aB ),
*static_cast<const SHAPE_LINE_CHAIN*>( aA ), aClearance, aNeedMTV, aMTV );
default:
break;
}
break;
case SH_LINE_CHAIN:
return Collide( *static_cast<const SHAPE_LINE_CHAIN*>( aA ),
*static_cast<const SHAPE_LINE_CHAIN*>( aB ), aClearance, aNeedMTV, aMTV );
default:
break;
}
}
break;
bool unsupported_collision = true;
default:
break;
}
assert( unsupported_collision == false );
assert( 0 ); // unsupported_collision
return false;
}
......
......@@ -599,25 +599,6 @@ void GRLineArray( EDA_RECT* aClipBox, wxDC* aDC, std::vector<wxPoint>& aLines,
{
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 )
aClipBox->Inflate(aWidth/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 )
aClipBox->Inflate(-aWidth/2);
#endif
}
......
......@@ -487,7 +487,7 @@ wxString RemoveTrailingZeros( const wxString& aString )
while( --i > 0 && retv[i] == wxChar( '0' ) )
retv.RemoveLast();
if( retv[i] == wxChar( '.' ) )
if( retv[i] == wxChar( '.' ) || retv[i] == wxChar( ',' ) )
retv.RemoveLast();
return retv;
......
......@@ -24,7 +24,7 @@
#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.
#include <richio.h>
*/
......@@ -33,7 +33,7 @@
/*
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 )
SetCrossHairPosition( GetScrollCenterPosition() );
if( !m_galCanvasActive )
if( !IsGalCanvasActive() )
RedrawScreen( GetScrollCenterPosition(), aWarpPointer );
}
......@@ -194,18 +194,18 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
RedrawScreen( center, true );
}
if( m_galCanvasActive )
if( IsGalCanvasActive() )
{
// Apply computed view settings to GAL
KIGFX::VIEW* view = m_galCanvas->GetView();
KIGFX::GAL* gal = m_galCanvas->GetGAL();
KIGFX::VIEW* view = GetGalCanvas()->GetView();
KIGFX::GAL* gal = GetGalCanvas()->GetGAL();
double zoomFactor = gal->GetWorldScale() / gal->GetZoomFactor();
double zoom = 1.0 / ( zoomFactor * GetZoom() );
view->SetScale( zoom );
view->SetCenter( VECTOR2D( center ) );
m_galCanvas->Refresh();
GetGalCanvas()->Refresh();
}
UpdateStatusBar();
......
......@@ -107,6 +107,7 @@ target_link_libraries( cvpcb
${GDI_PLUS_LIBRARIES}
${GLEW_LIBRARIES}
${CAIRO_LIBRARIES}
${PIXMAN_LIBRARY}
)
# Only for win32 cross compilation using MXE
......
......@@ -48,5 +48,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
install(DIRECTORY complex_hierarchy ecc83 electric flat_hierarchy
kit-dev-coldfire-xilinx_5213 interf_u microwave
pic_programmer pspice "sonde xilinx" test_xil_95108 video
DESTINATION ${KICAD_DEMOS}
COMPONENT resources
PATTERN ".svn" EXCLUDE)
install( DIRECTORY complex_hierarchy
ecc83 electric flat_hierarchy
kit-dev-coldfire-xilinx_5213 interf_u microwave
pic_programmer pspice "sonde xilinx" test_xil_95108 video
DESTINATION ${KICAD_DEMOS}
COMPONENT resources
)
......@@ -49,5 +49,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
......@@ -269,19 +269,15 @@ void SCH_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool aRed
for( int ii = aList->GetCount() - 1; ii >= 0; ii-- )
{
item = (SCH_ITEM*) aList->GetPickedItem( ii );
wxASSERT( item );
if( item )
item->ClearFlags();
item->ClearFlags();
SCH_ITEM* image = (SCH_ITEM*) aList->GetPickedItemLink( ii );
switch( aList->GetPickedItemStatus( ii ) )
{
case UR_CHANGED: /* Exchange old and new data for each item */
// tmp = item->Clone();
// *item = *image;
// *image = *tmp;
// delete tmp;
item->SwapData( image );
break;
......
......@@ -67,5 +67,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
......@@ -71,6 +71,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
double paramvalue = 0.0;
double curr_value = 0.0;
parm_item_type state = POPVALUE;
for( unsigned ii = 0; ii < m_paramStack.size(); ii++ )
{
AM_PARAM_ITEM item = m_paramStack[ii];
......@@ -85,12 +86,19 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
case PUSHPARM:
// get the parameter from the aDcode
if( aDcode && item.GetIndex() <= aDcode->GetParamCount() )
curr_value = aDcode->GetParam( item.GetIndex() );
else // Get parameter from local param definition
if( aDcode ) // should be always true here
{
if( item.GetIndex() <= aDcode->GetParamCount() )
curr_value = aDcode->GetParam( item.GetIndex() );
else // Get parameter from local param definition
{
const APERTURE_MACRO * am_parent = aDcode->GetMacro();
curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() );
}
}
else
{
const APERTURE_MACRO * am_parent = aDcode->GetMacro();
curr_value = am_parent->GetLocalParam( aDcode, item.GetIndex() );
wxLogDebug( wxT( "AM_PARAM::GetValue(): NULL param aDcode\n" ) );
}
// Fall through
case PUSHVALUE: // a value is on the stack:
......
......@@ -275,7 +275,7 @@ public:
* for efficiency reasons
*/
void GetPositionsOfLinesOfMultilineText(
std::vector<wxPoint>& aPositions, int aLineCount );
std::vector<wxPoint>& aPositions, int aLineCount ) const;
/**
* Function Format
* 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
* string will be empty.
*/
static std::string FormatOptions( const PROPERTIES* aProperties );
static UTF8 FormatOptions( const PROPERTIES* aProperties );
/**
* Function Format
......
......@@ -27,7 +27,7 @@
#define _FPID_H_
#include <richio.h>
#include <utf8.h>
/**
* Class FPID
......@@ -53,7 +53,7 @@
*
* @author Dick Hollenbeck
*/
class FPID // aka GUID
class FPID
{
public:
......@@ -88,7 +88,7 @@ public:
* Function GetLibNickname
* returns the logical library name portion of a FPID.
*/
const std::string& GetLibNickname() const
const UTF8& GetLibNickname() const
{
return nickname;
}
......@@ -108,7 +108,7 @@ public:
* Function GetFootprintName
* returns the footprint name, i.e. footprintName.
*/
const std::string& GetFootprintName() const { return footprint; }
const UTF8& GetFootprintName() const { return footprint; }
/**
* Function SetFootprintName
......@@ -120,15 +120,15 @@ public:
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
* returns the fully formatted text of the FPID.
*/
std::string Format() const;
UTF8 Format() const;
/**
* Function Format
......@@ -137,7 +137,7 @@ public:
*
* @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 )
throw( PARSE_ERROR );
......@@ -182,8 +182,8 @@ public:
*/
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 == aFPID); }
......@@ -192,9 +192,9 @@ public:
#endif
protected:
std::string nickname; ///< The nickname of the footprint library or empty.
std::string footprint; ///< The name of the footprint in the logical library.
std::string revision; ///< The footprint revision.
UTF8 nickname; ///< The nickname of the footprint library or empty.
UTF8 footprint; ///< The name of the footprint in the logical library.
UTF8 revision; ///< The footprint revision.
};
......
......@@ -29,8 +29,8 @@
#ifndef STROKE_FONT_H_
#define STROKE_FONT_H_
#include <string>
#include <deque>
#include <utf8.h>
#include <eda_text.h>
......@@ -70,7 +70,7 @@ public:
* @param aPosition is the text position in world coordinates.
* @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.
......@@ -173,7 +173,7 @@ private:
*
* @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.
......@@ -181,20 +181,19 @@ private:
* @param aText is the text string.
* @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.
*
* @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 int lines = 1;
unsigned 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' )
++lines;
......@@ -214,4 +213,4 @@ private:
};
} // namespace KIGFX
#endif /* STROKE_FONT_H_ */
#endif // STROKE_FONT_H_
......@@ -34,22 +34,22 @@ static inline wxString FROM_UTF8( const char* cstring )
/**
* Function GetChars
* returns a wxChar* to the actual character data within a wxString, and is
* helpful for passing strings to wxString::Printf(wxT("%s"), GetChars(wxString) )
* returns a wxChar* to the actual wxChar* data within a wxString, and is
* 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>
* 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>
* <li> standard C style char when wxUSE_UNICODE==0 </li>
* <li> wchar_t when wxUSE_UNICODE==1 (the default). </li>
* <li> 32 bit unicode characters on linux/OSX or </li>
* <li> 16 bit UTF16 characters on windows. </li>
* </ul>
* i.e. it depends on how the wxWidgets library was compiled.
* ( wxUSE_UNICODE is defined in wxWidgets, inside setup.h.
* for version >= 2.9 wxUSE_UNICODE is always defined to 1 )
* There was a period
* 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.
* Note that you cannot pass 8 bit strings to wxString::Format() or Printf() so this
* is a useful conversion function to wxChar*, which is needed by wxString::Format().
*
* @return const wxChar* - a pointer to the UNICODE or UTF16 (on windows) text.
*/
static inline const wxChar* GetChars( const wxString& s )
{
......
......@@ -253,7 +253,8 @@ public:
enum EDA_TEXT_VJUSTIFY_T aV_justify,
int aWidth,
bool aItalic,
bool aBold );
bool aBold,
bool aMultilineAllowed = false );
/**
* Draw a marker (used for the drill map)
......
......@@ -29,8 +29,8 @@
// "richio" after its author, Richard Hollenbeck, aka Dick Hollenbeck.
#include <string>
#include <vector>
#include <utf8.h>
// I really did not want to be dependent on wxWidgets in richio
// but the errorText needs to be wide char so wxString rules.
......
/*
* 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
/*
* 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:
UTF8( const wchar_t* txt );
explicit UTF8( const std::string& o ) :
UTF8( const std::string& o ) :
std::string( o )
{
}
......@@ -83,6 +83,23 @@ public:
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;
/// This one is not in std::string, and one wonders why... might be a solid
......
......@@ -183,7 +183,7 @@ public:
* BOARD.
* @param aBoard The BOARD to put into the frame.
*/
void SetBoard( BOARD* aBoard );
virtual void SetBoard( BOARD* aBoard );
BOARD* GetBoard() const
{
......@@ -191,8 +191,6 @@ public:
return m_Pcb;
}
void ViewReloadBoard( const BOARD* aBoard ) const;
/**
* Function SetFootprintLibTable
* set the footprint library table to \a aFootprintLibTable.
......@@ -727,8 +725,6 @@ public:
void OnUpdateSelectGrid( wxUpdateUIEvent& aEvent );
void OnUpdateSelectZoom( wxUpdateUIEvent& aEvent );
virtual void UseGalCanvas( bool aEnable );
DECLARE_EVENT_TABLE()
};
......
......@@ -228,7 +228,7 @@ public:
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~PCB_EDIT_FRAME();
virtual ~PCB_EDIT_FRAME();
void OnQuit( wxCommandEvent& event );
......@@ -609,6 +609,13 @@ public:
*/
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
* switches currently used canvas (default / Cairo / OpenGL).
......@@ -894,6 +901,15 @@ public:
*/
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
/* function GetDrcController
......@@ -961,6 +977,12 @@ public:
bool ExportVRML_File( const wxString & aFullFileName, double aMMtoWRMLunit,
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
* will export the current BOARD to a specctra dsn file. See
......
......@@ -390,24 +390,24 @@ class EDA_DRAW_FRAME : public EDA_BASE_FRAME
friend class EDA_DRAW_PANEL;
///< Id of active button on the vertical toolbar.
int m_toolId;
int m_toolId;
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
bool m_snapToGrid; ///< Indicates if cursor should be snapped to grid.
BASE_SCREEN* m_currentScreen; ///< current used SCREEN
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:
EDA_HOTKEY_CONFIG* m_HotkeysZoomAndGridList;
int m_LastGridSizeId;
bool m_DrawGrid; // hide/Show grid
bool m_galCanvasActive; // whether to use new GAL engine
EDA_COLOR_T m_GridColor; // Grid color
/// The area to draw on.
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.
int m_lastDrawToolId;
......@@ -979,20 +979,22 @@ public:
virtual void UseGalCanvas( bool aEnable );
/**
* Function IsNewCanvasActive
* Function IsGalCanvasActive
* is used to check which canvas (GAL-based or standard) is currently in use.
*
* @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.
*
* @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()
};
......
......@@ -49,5 +49,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
......@@ -13,7 +13,7 @@
#ifndef DRW_BASE_H
#define DRW_BASE_H
#define DRW_VERSION "0.5.10"
#define DRW_VERSION "0.5.11"
#include <string>
#include <cmath>
......
......@@ -1683,7 +1683,7 @@ DRW_ImageDef* dxfRW::writeImage( DRW_Image* ent, std::string name )
writer->writeInt16( 282, ent->contrast );
writer->writeInt16( 283, ent->fade );
writer->writeString( 360, idReactor );
id->reactors[idReactor] = ent->handle;
id->reactors[idReactor] = toHexStr( ent->handle );
return id;
}
......@@ -3817,9 +3817,9 @@ bool dxfRW::processImageDef()
std::string dxfRW::toHexStr( int n )
{
#if defined(__APPLE__)
std::string buffer( 9, '\0' );
snprintf( &buffer[0], 9, "%X", n );
return buffer;
char buffer[9] = { '\0' };
snprintf( buffer, 9, "%X", n );
return std::string( buffer );
#else
std::ostringstream Convert;
Convert << std::uppercase << std::hex << n;
......
......@@ -27,7 +27,7 @@ class dxfRW
public:
dxfRW( const char* name );
~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
* components being added.
......@@ -71,7 +71,7 @@ public:
void setEllipseParts( int parts ) { elParts = parts; } /*!< set parts munber when convert ellipse to polyline */
private:
// / used by read() to parse the content of the file
/// used by read() to parse the content of the file
bool processDxf();
bool processHeader();
bool processTables();
......
......@@ -49,5 +49,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
=== 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)
=== 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
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -32,5 +32,7 @@
<true/>
<key>NSHumanReadableCopyright</key>
<string></string>
<key>NSHighResolutionCapable</key>
<string>True</string>
</dict>
</plist>
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment