Commit c3c7b2e9 authored by Maciej Suminski's avatar Maciej Suminski

Merged the netnames branch.

parents 8f054a60 7f6bc781
......@@ -59,7 +59,7 @@ void S3D_MATERIAL::SetMaterial()
void S3D_MASTER::Copy( S3D_MASTER* pattern )
{
m_Shape3DName = pattern->m_Shape3DName;
SetShape3DName( pattern->GetShape3DName() );
m_MatScale = pattern->m_MatScale;
m_MatRotation = pattern->m_MatRotation;
m_MatPosition = pattern->m_MatPosition;
......@@ -74,6 +74,7 @@ S3D_MASTER::S3D_MASTER( EDA_ITEM* aParent ) :
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL;
m_Materials = NULL;
m_ShapeType = FILE3D_NONE;
}
......@@ -96,6 +97,45 @@ S3D_MASTER:: ~S3D_MASTER()
}
bool S3D_MASTER::Is3DType( enum FILE3D_TYPE aShapeType )
{
// type 'none' is not valid and will always return false
if( aShapeType == FILE3D_NONE )
return false;
// no one is interested if we have no file
if( m_Shape3DName.empty() )
return false;
if( aShapeType == m_ShapeType )
return true;
return false;
}
void S3D_MASTER::SetShape3DName( const wxString& aShapeName )
{
m_ShapeType = FILE3D_NONE;
m_Shape3DName = aShapeName;
if( m_Shape3DName.empty() )
return;
wxFileName fn = m_Shape3DName;
wxString ext = fn.GetExt();
if( ext == wxT( "wrl" ) || ext == wxT( "x3d" ) )
m_ShapeType = FILE3D_VRML;
else if( ext == wxT( "idf" ) )
m_ShapeType = FILE3D_IDF;
else
m_ShapeType = FILE3D_UNKNOWN;
return;
}
STRUCT_3D_SHAPE::STRUCT_3D_SHAPE( EDA_ITEM* aParent ) :
EDA_ITEM( aParent, NOT_USED )
{
......
......@@ -857,7 +857,7 @@ void MODULE::ReadAndInsert3DComponentShape( EDA_3D_CANVAS* glcanvas )
for( ; struct3D != NULL; struct3D = struct3D->Next() )
{
if( !struct3D->m_Shape3DName.IsEmpty() )
if( struct3D->Is3DType( S3D_MASTER::FILE3D_VRML ) )
struct3D->ReadData();
}
......
......@@ -141,8 +141,6 @@ void EDA_3D_FRAME::Exit3DFrame( wxCommandEvent& event )
void EDA_3D_FRAME::OnCloseWindow( wxCloseEvent& Event )
{
SaveSettings();
if( Parent() )
Parent()->m_Draw3DFrame = NULL;
......
......@@ -92,13 +92,24 @@ public:
class S3D_MASTER : public EDA_ITEM
{
public:
wxString m_Shape3DName; /* 3D shape name in 3D library */
S3D_VERTEX m_MatScale;
S3D_VERTEX m_MatRotation;
S3D_VERTEX m_MatPosition;
STRUCT_3D_SHAPE* m_3D_Drawings;
S3D_MATERIAL* m_Materials;
enum FILE3D_TYPE
{
FILE3D_NONE = 0,
FILE3D_VRML,
FILE3D_IDF,
FILE3D_UNKNOWN
};
private:
wxString m_Shape3DName; /* 3D shape name in 3D library */
FILE3D_TYPE m_ShapeType;
public:
S3D_MASTER( EDA_ITEM* aParent );
~S3D_MASTER();
......@@ -120,6 +131,20 @@ public:
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif
/**
* Function Is3DType
* returns true if the argument matches the type of model referred to
* by m_Shape3DName
*/
bool Is3DType( enum FILE3D_TYPE aShapeType );
const wxString& GetShape3DName( void )
{
return m_Shape3DName;
}
void SetShape3DName( const wxString& aShapeName );
};
......
......@@ -36,8 +36,10 @@
#include <queue>
#include <vector>
#include "3d_struct.h"
#include "modelparsers.h"
#include <3d_struct.h>
#include <modelparsers.h>
#include <xnode.h>
X3D_MODEL_PARSER::X3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
S3D_MODEL_PARSER( aMaster )
......@@ -54,13 +56,13 @@ void X3D_MODEL_PARSER::Load( const wxString aFilename )
if( !doc.Load( aFilename ) )
{
wxLogError( wxT( "Error while parsing file <%s>" ), GetChars( aFilename ) );
wxLogError( wxT( "Error while parsing file '%s'" ), GetChars( aFilename ) );
return;
}
if( doc.GetRoot()->GetName() != wxT( "X3D" ) )
{
wxLogError( wxT( "Filetype is not X3D <%s>" ), GetChars( aFilename ) );
wxLogError( wxT( "Filetype is not X3D '%s'" ), GetChars( aFilename ) );
return;
}
......@@ -85,24 +87,25 @@ wxString X3D_MODEL_PARSER::VRML_representation()
for( unsigned i = 0; i < vrml_points.size(); i++ )
{
output += wxT( "Shape {\n"
" appearance Appearance {\n"
" material Material {\n" ) +
vrml_materials[i] +
wxT( " }\n"
" }\n"
" geometry IndexedFaceSet {\n"
" solid TRUE\n"
" coord Coordinate {\n"
" point [\n") +
vrml_points[i] +
wxT( " ]\n"
" }\n"
" coordIndex [\n" ) +
vrml_coord_indexes[i] +
wxT( " ]\n"
" }\n"
"},\n" );
output +=
wxT( "Shape {\n"
" appearance Appearance {\n"
" material Material {\n" ) +
vrml_materials[i] +
wxT( " }\n"
" }\n"
" geometry IndexedFaceSet {\n"
" solid TRUE\n"
" coord Coordinate {\n"
" point [\n") +
vrml_points[i] +
wxT( " ]\n"
" }\n"
" coordIndex [\n" ) +
vrml_coord_indexes[i] +
wxT( " ]\n"
" }\n"
"},\n" );
}
return output;
......@@ -115,6 +118,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
{
// Breadth-first search (BFS)
std::queue< wxXmlNode* > found;
found.push( aParent );
while( !found.empty() )
......@@ -140,7 +144,7 @@ void X3D_MODEL_PARSER::GetChildsByName( wxXmlNode* aParent,
void X3D_MODEL_PARSER::GetNodeProperties( wxXmlNode* aNode, PROPERTY_MAP& aProps )
{
wxXmlProperty *prop;
wxXmlAttribute* prop;
for( prop = aNode->GetAttributes();
prop != NULL;
......@@ -167,6 +171,7 @@ void X3D_MODEL_PARSER::readTransform( wxXmlNode* aTransformNode )
childnodes.clear();
PROPERTY_MAP properties;
GetNodeProperties( aTransformNode, properties );
GetChildsByName( aTransformNode, wxT("IndexedFaceSet"), childnodes );
......@@ -252,7 +257,7 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
wxString vrml_material;
PROPERTY_MAP::const_iterator p = ++properties.begin(); // skip DEF
for(;p != properties.end();p++)
for( ; p != properties.end(); p++ )
{
vrml_material.Append( p->first + wxT( " " ) + p->second + wxT( "\n" ) );
}
......@@ -270,8 +275,8 @@ void X3D_MODEL_PARSER::readMaterial( wxXmlNode* aMatNode )
{
if( material->m_Name == mat_name )
{
wxString vrml_material;
vrml_material.Append( wxString::Format( wxT( "specularColor %f %f %f\n" ),
material->m_SpecularColor.x,
material->m_SpecularColor.y,
......@@ -457,6 +462,7 @@ void X3D_MODEL_PARSER::readIndexedFaceSet( wxXmlNode* aFaceNode,
while( index_tokens.HasMoreTokens() )
{
long index = 0;
index_tokens.GetNextToken().ToLong( &index );
// -1 marks the end of polygon
......
This diff is collapsed.
......@@ -144,12 +144,10 @@
# Helper macro to control the debugging output globally. There are
# two versions for controlling how verbose your output should be.
MACRO(DBG_MSG _MSG)
# MESSAGE(STATUS
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
# MESSAGE(WARNING "${_MSG}")
ENDMACRO(DBG_MSG)
MACRO(DBG_MSG_V _MSG)
# MESSAGE(STATUS
# "${CMAKE_CURRENT_LIST_FILE}(${CMAKE_CURRENT_LIST_LINE}): ${_MSG}")
# MESSAGE(WARNING "${_MSG}")
ENDMACRO(DBG_MSG_V)
# Clear return values in case the module is loaded more than once.
......@@ -201,18 +199,24 @@ ENDIF(EXISTS "${wxWidgets_CURRENT_LIST_DIR}/UsewxWidgets.cmake")
#=====================================================================
#=====================================================================
IF(WIN32 AND NOT CYGWIN AND NOT MSYS)
IF(WIN32 AND NOT CYGWIN AND NOT MSYS AND NOT CMAKE_HOST_UNIX )
DBG_MSG( "setting win32 style" )
SET(wxWidgets_FIND_STYLE "win32")
ELSE(WIN32 AND NOT CYGWIN AND NOT MSYS)
IF(UNIX OR MSYS)
ELSE()
IF(CMAKE_HOST_UNIX OR MSYS)
DBG_MSG( "unix style" )
SET(wxWidgets_FIND_STYLE "unix")
ENDIF(UNIX OR MSYS)
ENDIF(WIN32 AND NOT CYGWIN AND NOT MSYS)
ENDIF()
ENDIF()
#=====================================================================
# WIN32_FIND_STYLE
#=====================================================================
IF(wxWidgets_FIND_STYLE STREQUAL "win32")
DBG_MSG("Using win32 path")
# Useful common wx libs needed by almost all components.
SET(wxWidgets_COMMON_LIBRARIES png tiff jpeg zlib regex expat)
......@@ -271,9 +275,13 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
MARK_AS_ADVANCED(WX_${LIB}${_DBG})
ENDFOREACH(LIB)
DBG_MSG( "WX_LIB_DIR:${WX_LIB_DIR}" )
# Find wxWidgets multilib base libraries.
FIND_LIBRARY(WX_base${_DBG}
NAMES
wxbase31${_UCD}${_DBG}
wxbase30${_UCD}${_DBG}
wxbase29${_UCD}${_DBG}
wxbase28${_UCD}${_DBG}
wxbase27${_UCD}${_DBG}
......@@ -286,6 +294,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
FOREACH(LIB net odbc xml)
FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES
wxbase31${_UCD}${_DBG}_${LIB}
wxbase30${_UCD}${_DBG}_${LIB}
wxbase29${_UCD}${_DBG}_${LIB}
wxbase28${_UCD}${_DBG}_${LIB}
wxbase27${_UCD}${_DBG}_${LIB}
......@@ -300,6 +310,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# Find wxWidgets monolithic library.
FIND_LIBRARY(WX_mono${_DBG}
NAMES
wxmsw${_UNV}31${_UCD}${_DBG}
wxmsw${_UNV}30${_UCD}${_DBG}
wxmsw${_UNV}29${_UCD}${_DBG}
wxmsw${_UNV}28${_UCD}${_DBG}
wxmsw${_UNV}27${_UCD}${_DBG}
......@@ -315,6 +327,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
stc ribbon propgrid)
FIND_LIBRARY(WX_${LIB}${_DBG}
NAMES
wxmsw${_UNV}31${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}30${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}29${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}28${_UCD}${_DBG}_${LIB}
wxmsw${_UNV}27${_UCD}${_DBG}_${LIB}
......@@ -428,6 +442,9 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
D:/
$ENV{ProgramFiles}
PATH_SUFFIXES
wxWidgets-3.1.0
wxWidgets-3.0.0
wxWidgets-2.9.5
wxWidgets-2.9.4
wxWidgets-2.9.3
wxWidgets-2.9.2
......@@ -463,6 +480,8 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# If wxWidgets_ROOT_DIR changed, clear lib dir.
IF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
DBG_MSG( "WX_ROOT_DIR != wxWidgets_ROOT_DIR" )
SET(WX_ROOT_DIR ${wxWidgets_ROOT_DIR}
CACHE INTERNAL "wxWidgets_ROOT_DIR")
SET(wxWidgets_LIB_DIR "wxWidgets_LIB_DIR-NOTFOUND"
......@@ -470,15 +489,19 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
ENDIF(NOT WX_ROOT_DIR STREQUAL wxWidgets_ROOT_DIR)
IF(WX_ROOT_DIR)
DBG_MSG( "WX_ROOT_DIR == wxWidgets_ROOT_DIR" )
# Select one default tree inside the already determined wx tree.
# Prefer static/shared order usually consistent with build
# settings.
IF(MINGW)
DBG_MSG( "MINGW" )
SET(WX_LIB_DIR_PREFIX gcc)
ELSE(MINGW)
SET(WX_LIB_DIR_PREFIX vc)
ENDIF(MINGW)
IF(BUILD_SHARED_LIBS)
DBG_MSG( "BUILD_SHARED_LIBS" )
FIND_PATH(wxWidgets_LIB_DIR
NAMES
msw/wx/setup.h
......@@ -496,6 +519,7 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
NO_DEFAULT_PATH
)
ELSE(BUILD_SHARED_LIBS)
DBG_MSG( "!BUILD_SHARED_LIBS WX_LIB_DIR:${WX_LIB_DIR}" )
FIND_PATH(wxWidgets_LIB_DIR
NAMES
msw/wx/setup.h
......@@ -613,7 +637,11 @@ IF(wxWidgets_FIND_STYLE STREQUAL "win32")
# UNIX_FIND_STYLE
#=====================================================================
ELSE(wxWidgets_FIND_STYLE STREQUAL "win32")
DBG_MSG("NOT win32 path")
IF(wxWidgets_FIND_STYLE STREQUAL "unix")
DBG_MSG("unix find style")
#-----------------------------------------------------------------
# UNIX: Helper MACROS
#-----------------------------------------------------------------
......
......@@ -51,21 +51,23 @@
#cmakedefine HAVE_FGETC_NOLOCK
// Warning!!! Using wxGraphicContext for rendering is experimental.
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
#cmakedefine USE_WX_GRAPHICS_CONTEXT 1
#cmakedefine USE_IMAGES_IN_MENUS 1
#cmakedefine USE_IMAGES_IN_MENUS 1
/// The legacy file format revision of the *.brd file created by this build
#define LEGACY_BOARD_FILE_VERSION 2
#define LEGACY_BOARD_FILE_VERSION 2
/// The install prefix defined in CMAKE_INSTALL_PREFIX.
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX"
#define DEFAULT_INSTALL_PATH "@CMAKE_INSTALL_PREFIX@"
/// Default footprint library install path when installed with `make install`.
#define DEFAULT_FP_LIB_PATH "@KICAD_FP_LIB_INSTALL_PATH@"
#define DEFAULT_FP_LIB_PATH "@KICAD_FP_LIB_INSTALL_PATH@"
/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN
/// Name of repo from which this build came.
#define KICAD_REPO_NAME "@KICAD_REPO_NAME@"
#endif // CONFIG_H_
......@@ -92,7 +92,7 @@ string( REPLACE "unit_test_framework" "test" boost_libs_list "${BOOST_LIBS_BUILT
# Default Toolset
set( BOOST_TOOLSET "toolset=gcc" )
if( KICAD_BUILD_STATIC )
if( KICAD_BUILD_STATIC OR APPLE )
set( BOOST_LINKTYPE "link=static" )
else()
unset( BOOST_LINKTYPE )
......@@ -170,10 +170,20 @@ endif()
ExternalProject_Add( boost
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
INSTALL_DIR "${BOOST_ROOT}"
URL http://downloads.sourceforge.net/project/boost/boost/${BOOST_RELEASE}/boost_${BOOST_VERS}.tar.bz2
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
TIMEOUT 600 # 10 minutes
URL_MD5 ${BOOST_MD5}
# If download fails, then enable "LOG_DOWNLOAD ON" and try again.
# Upon a second failure with logging enabled, then look at these logs:
# <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-out.log
# <src>/.downloads-by-cmake$ less /tmp/product/.downloads-by-cmake/boost_1_54_0/src/boost-stamp/boost-download-err.log
# If out.log does not show 100%, then try increasing TIMEOUT even more, or download the URL manually and put it
# into <src>/.downloads-by-cmake/ dir.
# LOG_DOWNLOAD ON
INSTALL_DIR "${BOOST_ROOT}"
# The patch command executes with the working directory set to <SOURCE_DIR>
# Revert the branch to pristine before applying patch sets as bzr patch
......
......@@ -37,11 +37,20 @@ find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/cairo )
if ( KICAD_BUILD_STATIC )
set( CAIRO_BUILDTYPE --disable-shared )
endif( KICAD_BUILD_STATIC )
if (APPLE)
set( CAIRO_CFLAGS "CFLAGS=" )
set( CAIRO_LDFLAGS "LDFLAGS=-framework CoreServices -framework Cocoa" )
set( CAIRO_OPTS --enable-ft=no )
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 )
set( CAIRO_CFLAGS "${CAIRO_CFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" )
set( CAIRO_LDFLAGS "${CAIRO_LDFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES}" )
endif( CMAKE_OSX_ARCHITECTURES )
if( CMAKE_CXX_COMPILER_ID MATCHES "Clang" )
......@@ -72,8 +81,9 @@ ExternalProject_Add( cairo
BUILD_IN_SOURCE 1
#SOURCE_DIR "${PREFIX}"
#PATCH_COMMAND ""
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${CAIRO_ROOT}"
CONFIGURE_COMMAND ./configure --prefix=${CAIRO_ROOT} --enable-static --disable-shared
CONFIGURE_COMMAND ./configure --prefix=${CAIRO_ROOT} --enable-static ${CAIRO_BUILDTYPE}
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
......@@ -84,8 +94,8 @@ ExternalProject_Add( cairo
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND make
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${CAIRO_ROOT}"
INSTALL_COMMAND make install
INSTALL_COMMAND $(MAKE) install
)
......@@ -60,13 +60,28 @@ ExternalProject_Add( glew
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${GLEW_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ""
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND make ${GLEW_CFLAGS} ${GLEW_LDFLAGS} ${GLEW_STRIP}
BUILD_COMMAND $(MAKE) ${GLEW_CFLAGS} ${GLEW_LDFLAGS} ${GLEW_STRIP}
INSTALL_DIR "${GLEW_ROOT}"
INSTALL_COMMAND $(MAKE) GLEW_DEST="${GLEW_ROOT}" install
)
#
# Optional Steps
#
INSTALL_DIR "${GLEW_ROOT}"
INSTALL_COMMAND make GLEW_DEST="${GLEW_ROOT}" install && ranlib "${GLEW_ROOT}/lib/libGLEW.a"
if( APPLE )
# On OSX is needed to run ranlib to make .a indexes for all platforms
ExternalProject_Add_Step( glew glew_osx_ranlib
COMMAND ranlib "${GLEW_ROOT}/lib/libGLEW.a"
COMMENT "ranlib ${GLEW_ROOT}/lib/libGLEW.a - Needed on OSX only"
DEPENDEES install
)
endif()
......@@ -43,6 +43,12 @@ if (APPLE)
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
if (KICAD_BUILD_STATIC)
set(LIBPNG_OPTS --enable-static --disable-shared)
else()
set(LIBPNG_OPTS --enable-static --enable-shared)
endif(KICAD_BUILD_STATIC)
# <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
......@@ -59,11 +65,12 @@ ExternalProject_Add( libpng
BUILD_IN_SOURCE 1
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} --enable-static --disable-shared ${LIBPNG_CFLAGS} --disable-dependency-tracking
CONFIGURE_COMMAND ./configure --prefix=${LIBPNG_ROOT} ${LIBPNG_OPTS} ${LIBPNG_CFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBPNG_ROOT}"
BUILD_COMMAND make
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${LIBPNG_ROOT}"
INSTALL_COMMAND make install
INSTALL_COMMAND $(MAKE) install
)
......@@ -37,12 +37,22 @@ find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/pixman )
set(PIXMAN_CPPFLAGS "CFLAGS=")
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
set(PIXMAN_CPPFLAGS "CFLAGS=-arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -arch ${CMAKE_OSX_ARCHITECTURES} -fno-common -mmacosx-version-min=10.5")
else()
set(PIXMAN_CPPFLAGS "${PIXMAN_CPPFLAGS} -fno-common -mmacosx-version-min=10.5")
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
if (KICAD_BUILD_STATIC)
set(PIXMAN_OPTS --enable-static=yes --enable-shared=no)
else()
set(PIXMAN_OPTS --enable-static=yes --enable-shared=yes)
endif(KICAD_BUILD_STATIC)
# <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
......@@ -58,12 +68,14 @@ ExternalProject_Add( pixman
#SOURCE_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PIXMAN_ROOT}"
#PATCH_COMMAND "true"
CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} --enable-static=yes --enable-shared=no ${PIXMAN_CPPFLAGS} --disable-dependency-tracking
CONFIGURE_COMMAND ./configure --prefix=${PIXMAN_ROOT} ${PIXMAN_OPTS} ${PIXMAN_CPPFLAGS} --disable-dependency-tracking
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND make
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${PIXMAN_ROOT}"
INSTALL_COMMAND make install
INSTALL_COMMAND $(MAKE) install
)
......@@ -37,6 +37,12 @@ find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/pkgconfig )
if ( KICAD_BUILD_STATIC )
set( PKGCONFIG_BUILDTYPE --enable-shared=no --enable-static=yes )
else()
set( PKGCONFIG_BUILDTYPE --enable-shared=yes --enable-static=yes )
endif( KICAD_BUILD_STATIC )
# <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
......@@ -53,11 +59,20 @@ ExternalProject_Add( pkgconfig
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
CONFIGURE_COMMAND ./configure --prefix=${PKGCONFIG_ROOT} --with-internal-glib ${PKGCONFIG_BUILDTYPE} --disable-silent-rules
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND make
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${PKGCONFIG_ROOT}"
BUILD_COMMAND $(MAKE)
INSTALL_DIR "${PKGCONFIG_ROOT}"
INSTALL_COMMAND make install
INSTALL_COMMAND $(MAKE) install
)
ExternalProject_Add_Step( pkgconfig pkgconfig_cleanup
COMMAND ${CMAKE_COMMAND} -E remove_directory "${PKGCONFIG_ROOT}"
COMMENT "pkgconfig - cleanup destination before proceeding in install"
DEPENDEES build
)
# 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 LIBWX
#-----<configure>----------------------------------------------------------------
set( LIBWX_RELEASE 3.0.0 )
set( LIBWX_MD5 241998efc12205172ed24c18788ea2cd ) # 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( LIBWX_ROOT "${PROJECT_SOURCE_DIR}/libwx_root" )
#-----</configure>---------------------------------------------------------------
find_package( BZip2 REQUIRED )
set( PREFIX ${DOWNLOAD_DIR}/libwx )
if (APPLE)
if( CMAKE_OSX_ARCHITECTURES )
STRING(REGEX REPLACE " -arch " "," LIBWX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES})
SET( LIBWX_ARCHITECTURES --enable-universal_binary=${LIBWX_ARCHITECTURES})
endif( CMAKE_OSX_ARCHITECTURES )
endif(APPLE)
if ( KICAD_BUILD_STATIC )
set( LIBWX_BUILDTYPE "--disable-shared" )
endif( KICAD_BUILD_STATIC )
# <SOURCE_DIR> = ${PREFIX}/src/libwx
# 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( libwx
PREFIX "${PREFIX}"
DOWNLOAD_DIR "${DOWNLOAD_DIR}"
URL http://downloads.sourceforge.net/project/wxwindows/${LIBWX_RELEASE}/wxWidgets-${LIBWX_RELEASE}.tar.bz2
URL_MD5 ${LIBWX_MD5}
STAMP_DIR "${PREFIX}"
BUILD_IN_SOURCE 1
PATCH_COMMAND bzr revert
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxwidgets-3.0.0_macosx.patch"
COMMAND bzr patch -p0 "${PROJECT_SOURCE_DIR}/patches/wxwidgets-3.0.0_macosx_bug_15908.patch"
UPDATE_COMMAND ${CMAKE_COMMAND} -E remove_directory "${LIBWX_ROOT}"
CONFIGURE_COMMAND ./configure --prefix=${LIBWX_ROOT} -with-opengl --enable-aui --enable-debug_info -with-expat=builtin --with-regex=builtin --enable-utf8 ${LIBWX_ARCHITECTURES} ${LIBWX_BUILDTYPE}
#BINARY_DIR "${PREFIX}"
BUILD_COMMAND $(MAKE) VERBOSE=1
INSTALL_DIR "${LIBWX_ROOT}"
INSTALL_COMMAND make install
)
#SET directories
set(wxWidgets_BIN_DIR ${LIBWX_ROOT}/bin)
set(wxWidgets_CONFIG_EXECUTABLE ${LIBWX_ROOT}/bin/wx-config)
set(wxWidgets_INCLUDE_DIRS ${LIBWX_ROOT}/include)
set(wxWidgets_LIBRARY_DIRS ${LIBWX_ROOT}/lib)
ExternalProject_Add_Step( libwx bzr_commit_libwx
COMMAND bzr ci -q -m pristine <SOURCE_DIR>
COMMENT "committing pristine libwx files to 'libwx scratch repo'"
DEPENDERS patch
)
ExternalProject_Add_Step( libwx bzr_add_libwx
COMMAND bzr add -q ${PREFIX}/src/libwx
COMMENT "adding pristine libwx files to 'libwx scratch repo'"
DEPENDERS bzr_commit_libwx
)
ExternalProject_Add_Step( libwx bzr_init_libwx
COMMAND bzr init -q <SOURCE_DIR>
COMMENT "creating 'libwx scratch repo' specifically for libwx to track libwx patches"
DEPENDERS bzr_add_libwx
DEPENDEES download
)
######
# Now is time to search what we have built
######
ExternalProject_Add_Step( libwx libwx_recursive_message
COMMAND cmake .
COMMENT "*** RERUN CMAKE - wxWidgets built, now reissue a cmake to build Kicad"
DEPENDEES install
)
......@@ -134,7 +134,7 @@ On either cmake command line shown below, you can optionally include
-DCMAKE_INSTALL_PREFIX=<finallInstallDir>
If windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DKICAD_TESTING_VERSION=ON -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Release -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
If linux, run instead the following command:
cmake -DCMAKE_BUILD_TYPE=Release ../../
......@@ -167,7 +167,7 @@ Although normally you do not install the Debug binaries, you can debug them
where they were built.
If windows, run the following command:
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DKICAD_TESTING_VERSION=ON -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
cmake -G "MSYS Makefiles" -DCMAKE_BUILD_TYPE=Debug -DwxWidgets_ROOT_DIR=<wxInstallDir> ../../
where <wxInstallDir> is <wxWidgets path>/Release
If linux, run instead the following command:
......
......@@ -88,15 +88,11 @@ All of the configuration settings below are specific to the KiCad project.
If for any reason you add or remove a build option to the KiCad CMake files,
please update the list below.
KICAD_STABLE_VERSION (ON/OFF)
-----------------------------
This option enables or disables the stable version string to be created and
used when building KiCad. It is mutually exclusive with KICAD_TESTING_VERSION.
KICAD_TESTING_VERSION (ON/OFF)
------------------------------
This option enables or disables the testing version string to be created and
used when building KiCad. It is mutually exclusive with KICAD_STABLE_VERSION.
KICAD_SKIP_BOOST (ON/OFF)
--------------------------
Skips building the required boost library components.
WARNING: KiCad developers strongly advise you to build the bundled boost library, as it is
known to work with KiCad. Other versions may contain bugs that may result in KiCad errors.
USE_WX_GRAPHICS_CONTEXT (ON/OFF)
--------------------------------
......
......@@ -149,8 +149,7 @@ command line enter the following commands:
To create a release build of KiCad, run the following command:
#cd build
#cmake -G "MSYS Makefiles" \ # Back slashes are not required
-DCMAKE_BUILD_TYPE=Release \ # and are for formatting only.
-DKICAD_TESTING_VERSION=ON ../../
-DCMAKE_BUILD_TYPE=Release ../../ \ # and are for formatting only.
If the configuration fails, you have failed to install the required software
on you system. The error message should give you a good indication of what is
......@@ -187,8 +186,7 @@ To create a debug version of KiCad, enter the following commands:
#cd <kicadSource>/build/debug
#cmake -G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Debug \
-DKICAD_TESTING_VERSION=ON ../../
-DCMAKE_BUILD_TYPE=Debug ../../
#make
Generally speaking you do not install debug binaries. They can be debugged in
......@@ -209,8 +207,7 @@ compile the source as described above.
#cmake -G "MSYS Makefiles" \
-DCMAKE_BUILD_TYPE=Release \
-DKICAD_PYTHON_SCRIPTING=ON \
-DKICAD_PYTHON_MODULES=ON \
-DKICAD_TESTING_VERSION=ON ../../
-DKICAD_PYTHON_MODULES=ON ../../
You only need to include the KICAD_PYTHON_MODULES option if you want to
install the python modules that ship with KiCad. Also note that the wxPython
......
......@@ -115,7 +115,7 @@ user@mac-osx$ make
It is also possible to give all the options on the commandline and not to edit the CMakeCache.txt. This is a oneliner for Leopard and up:
cmake ~/Repositories/testing -DKICAD_TESTING_VERSION=ON -DCMAKE_OSX_ARCHITECTURES="i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" -DCMAKE_CXX_FLAGS="-D__ASSERTMACROS__" -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
cmake ~/Repositories/testing -DCMAKE_OSX_ARCHITECTURES="i386 -arch x86_64 -isysroot /Developer/SDKs/MacOSX10.6.sdk -mmacosx-version-min=10.6" -DCMAKE_CXX_FLAGS="-D__ASSERTMACROS__" -DCMAKE_OSX_SYSROOT="/Developer/SDKs/MacOSX10.6.sdk"
Optional compiler cache
~~~~~~~~~~~~~~~~~~~~~~~
......
......@@ -281,8 +281,8 @@ void BM2CMP_FRAME::Binarize( double aThreshold )
int w = m_Greyscale_Image.GetWidth();
unsigned int threshold = (int)(aThreshold * 256);
for( int y = 1; y < h; y++ )
for( int x = 1; x < w; x++ )
for( int y = 0; y < h; y++ )
for( int x = 0; x < w; x++ )
{
pixin = m_Greyscale_Image.GetGreen( x, y );
......@@ -303,8 +303,8 @@ void BM2CMP_FRAME::NegateGreyscaleImage( )
int h = m_Greyscale_Image.GetHeight();
int w = m_Greyscale_Image.GetWidth();
for( int y = 1; y < h; y++ )
for( int x = 1; x < w; x++ )
for( int y = 0; y < h; y++ )
for( int x = 0; x < w; x++ )
{
pix = m_Greyscale_Image.GetGreen( x, y );
pix = ~pix;
......@@ -512,7 +512,7 @@ void BM2CMP_FRAME::ExportFile( FILE* aOutfile, int aFormat )
}
/* fill the bitmap with data */
for( int y = 0; y<h; y++ )
for( int y = 0; y < h; y++ )
{
for( int x = 0; x<w; x++ )
{
......
#!/bin/bash
#
# make icons using Inkscape
# create output directories
cd ../resources/linux/mime/icons/hicolor
rm -r *
mkdir scalable
echo -e '\E[0;34m'"Directory \"scalable\" for .svg icons was created."
# copy sources to the scalable dir
cd ../../../../../bitmaps_png/sources
cp icon_kicad.svg ../../resources/linux/mime/icons/hicolor/scalable/kicad.svg
cp icon_pcbnew.svg ../../resources/linux/mime/icons/hicolor/scalable/pcbnew.svg
cp icon_eeschema.svg ../../resources/linux/mime/icons/hicolor/scalable/eeschema.svg
echo -e '\E[0;34m'"Sources of icons was copied."
# convert .svg files into .png files
cd ../../resources/linux/mime/icons/hicolor/scalable
SIZES="16x16
22x22
24x24
32x32
48x48"
for size in $SIZES
do
sz=${size%x*}
echo -e '\E[0;32m'"\nMaking the mimetypes icons with size $size."
mkdir ../$size
echo -e '\E[0;34m'"Directory $size was created."
mkdir ../$size/mimetypes
echo -e '\E[0;34m'"Subdirectory \"mimetypes\" was created."
tput sgr0
inkscape -f kicad.svg -e ../$size/mimetypes/application-x-kicad-project.png -w $sz -h $sz --export-area-snap
inkscape -f eeschema.svg -e ../$size/mimetypes/application-x-kicad-eeschema.png -w $sz -h $sz --export-area-snap
inkscape -f pcbnew.svg -e ../$size/mimetypes/application-x-kicad-pcbnew.png -w $sz -h $sz --export-area-snap
echo -e '\E[0;34m'"Icons with size $size was created."
if [ $sz -eq 48 ]
then
echo -e '\E[0;32m'"\nMaking the applications icons with size $size."
mkdir ../$size/apps
echo -e '\E[0;34m'"Subdirectory \"apps\" was created."
tput sgr0
inkscape -f kicad.svg -e ../$size/apps/kicad.png -w $sz -h $sz --export-area-snap
inkscape -f eeschema.svg -e ../$size/apps/eeschema.png -w $sz -h $sz --export-area-snap
inkscape -f pcbnew.svg -e ../$size/apps/pcbnew.png -w $sz -h $sz --export-area-snap
echo -e '\E[0;34m'"Icons with size $size was created."
tput sgr0
fi
done
......@@ -377,3 +377,18 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
return aString;
}
/**
* Function AngleToStringDegrees
* is a helper to convert the \a double \a aAngle (in internal unit)
* to a string in degrees
*/
wxString AngleToStringDegrees( double aAngle )
{
wxString text;
text.Printf( wxT( "%.3f" ), aAngle/10.0 );
StripTrailingZeros( text, 1 );
return text;
}
......@@ -51,13 +51,13 @@
#define DEFAULT_AUTO_SAVE_INTERVAL 600
const wxChar* traceAutoSave = wxT( "KicadAutoSave" );
const wxChar traceAutoSave[] = wxT( "KicadAutoSave" );
/// Configuration file entry name for auto save interval.
static const wxChar* entryAutoSaveInterval = wxT( "AutoSaveInterval" );
static const wxChar entryAutoSaveInterval[] = wxT( "AutoSaveInterval" );
/// Configuration file entry for wxAuiManger perspective.
static const wxChar* entryPerspective = wxT( "Perspective" );
static const wxChar entryPerspective[] = wxT( "Perspective" );
......@@ -141,6 +141,19 @@ bool EDA_BASE_FRAME::ProcessEvent( wxEvent& aEvent )
}
bool EDA_BASE_FRAME::Show( bool show )
{
if( !show ) // closing
{
SaveSettings(); // virtual, wxFrame specific
}
int ret = wxFrame::Show( show );
return ret;
}
void EDA_BASE_FRAME::onAutoSaveTimer( wxTimerEvent& aEvent )
{
if( !doAutoSave() )
......@@ -231,7 +244,7 @@ void EDA_BASE_FRAME::SaveSettings()
wxString text;
wxConfig* config = wxGetApp().GetSettings();
if( ( config == NULL ) || IsIconized() )
if( !config || IsIconized() )
return;
m_FrameSize = GetSize();
......@@ -258,10 +271,15 @@ void EDA_BASE_FRAME::SaveSettings()
config->Write( text, m_autoSaveInterval );
}
// 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->Write( m_FrameName + entryPerspective, m_auimgr.SavePerspective() );
// 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.
wxString perspective = m_auimgr.SavePerspective();
// printf( "perspective(%s): %s\n",
// TO_UTF8( m_FrameName + entryPerspective ), TO_UTF8( perspective ) );
config->Write( m_FrameName + entryPerspective, perspective );
}
......@@ -270,6 +288,7 @@ void EDA_BASE_FRAME::PrintMsg( const wxString& text )
SetStatusText( text );
}
void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxFileHistory * aFileHistory )
{
......@@ -283,7 +302,7 @@ void EDA_BASE_FRAME::UpdateFileHistory( const wxString& FullFileName,
wxString EDA_BASE_FRAME::GetFileFromHistory( int cmdId, const wxString& type,
wxFileHistory * aFileHistory )
wxFileHistory* aFileHistory )
{
wxString fn, msg;
size_t i;
......@@ -480,7 +499,12 @@ static inline const char* KICAD_BUILD_OPTIONS_SIGNATURE()
" (release,"
#endif
__WX_BO_UNICODE __ABI_VERSION __BO_COMPILER __WX_BO_STL
__WX_BO_WXWIN_COMPAT_2_6 __WX_BO_WXWIN_COMPAT_2_8 ")"
#if !wxCHECK_VERSION( 3, 0, 0 )
__WX_BO_WXWIN_COMPAT_2_6
#endif
__WX_BO_WXWIN_COMPAT_2_8 ")"
;
}
......
......@@ -6,14 +6,7 @@
#endif
#ifndef KICAD_BUILD_VERSION
# define KICAD_BUILD_VERSION "(2013-jul-14)"
#endif
#if defined KICAD_STABLE_VERSION
# define VERSION_STABILITY "stable"
#else
# define VERSION_STABILITY "product"
# define KICAD_BUILD_VERSION "(2014-jan-25)"
#endif
/**
......@@ -25,7 +18,7 @@ wxString GetBuildVersion()
wxString msg = wxString::Format(
wxT( "%s-%s" ),
wxT( KICAD_BUILD_VERSION ),
wxT( VERSION_STABILITY )
wxT( KICAD_REPO_NAME )
);
return msg;
......
......@@ -41,7 +41,12 @@ void LAYER_SELECTOR::SetBitmapLayer( wxBitmap& aLayerbmp, LAYER_NUM aLayer )
// Prepare Bitmap
bmpDC.SelectObject( aLayerbmp );
brush.SetColour( MakeColour( GetLayerColor( aLayer ) ) );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
bmpDC.SetBrush( brush );
bmpDC.DrawRectangle( 0, 0, aLayerbmp.GetWidth(), aLayerbmp.GetHeight() );
......
......@@ -203,7 +203,7 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
* which should be represented by the same icon.
*/
// The developers
// The core developers
info.AddDeveloper(
new Contributor( wxT( "Jean-Pierre Charras" ), wxT( "jp.charras@wanadoo.fr" ) ) );
info.AddDeveloper(
......@@ -214,6 +214,8 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
// alphabetically by last name after main 3 above:
info.AddDeveloper(
new Contributor( wxT( "Frank Bennett" ), wxT( "bennett78@lpbroadband.net" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Cirilo Bernardo" ), wxT( "cirilo_bernardo@yahoo.com" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Jonas Diemer" ), wxT( "diemer@gmx.de" ) ) );
info.AddDeveloper(
......@@ -222,12 +224,6 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
new Contributor( wxT( "Hauptmech" ), wxT( "hauptmech@gmail.com" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Jerry Jacobs" ), wxT( "xor.gate.engineering@gmail.com" ) ) );
/*
info.AddDeveloper(
new Contributor( wxT( "KBool Library" ), wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) );
*/
info.AddDeveloper(
new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) );
info.AddDeveloper(
......@@ -240,10 +236,14 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Brian Sidebotham" ), wxT( "brian.sidebotham@gmail.com" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Orson (Maciej Suminski)" ), wxT( "maciej.suminski@cern.ch" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Rafael Sokolowski" ), wxT( "rafael.sokolowski@web.de" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );
info.AddDeveloper(
new Contributor( wxT( "Tomasz Wlostowski" ), wxT( "tomasz.wlostowski@cern.ch" ) ) );
// The document writers
info.AddDocWriter(
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -343,7 +343,7 @@ DIALOG_PAGES_SETTINGS_BASE::DIALOG_PAGES_SETTINGS_BASE( wxWindow* parent, wxWind
wxBoxSizer* bSizerFilename;
bSizerFilename = new wxBoxSizer( wxVERTICAL );
m_staticTextfilename = new wxStaticText( this, wxID_ANY, _("Page layout file description"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextfilename = new wxStaticText( this, wxID_ANY, _("Page layout description file"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextfilename->Wrap( -1 );
bSizerFilename->Add( m_staticTextfilename, 0, wxRIGHT|wxLEFT, 5 );
......
......@@ -20,8 +20,10 @@
<property name="path">.</property>
<property name="precompiled_header"></property>
<property name="relative_path">1</property>
<property name="skip_lua_events">1</property>
<property name="skip_php_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_microsoft_bom">0</property>
<object class="Dialog" expanded="1">
......@@ -4173,7 +4175,7 @@
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="label">Page layout file description</property>
<property name="label">Page layout description file</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Nov 6 2013)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......
......@@ -118,6 +118,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( wxWindow* aParent,
m_snapToGrid = true;
m_MsgFrameHeight = EDA_MSG_PANEL::GetRequiredHeight();
m_auimgr.SetFlags(wxAUI_MGR_DEFAULT|wxAUI_MGR_LIVE_RESIZE);
CreateStatusBar( 6 );
// set the size of the status bar subwindows:
......
......@@ -13,19 +13,10 @@ static const wxString HOSTNAME( wxT( "localhost" ) );
// buffer for read and write data in socket connections
#define IPC_BUF_SIZE 4096
static char client_ipc_buffer[IPC_BUF_SIZE];
static wxSocketServer* server;
void (*RemoteFct)(const char* cmd);
void SetupServerFunction( void (*remotefct)(const char* remotecmd) )
{
RemoteFct = remotefct;
}
/**********************************/
/* Routines related to the server */
......@@ -75,10 +66,7 @@ void EDA_DRAW_FRAME::OnSockRequest( wxSocketEvent& evt )
sock->Read( client_ipc_buffer + 1, IPC_BUF_SIZE - 2 );
len = 1 + sock->LastCount();
client_ipc_buffer[len] = 0;
if( RemoteFct )
RemoteFct( client_ipc_buffer );
ExecuteRemoteCommand( client_ipc_buffer );
break;
case wxSOCKET_LOST:
......
......@@ -57,11 +57,6 @@
static const wxChar* CommonConfigPath = wxT( "kicad_common" );
#ifdef __UNIX__
# define TMP_FILE "/tmp/kicad.tmp"
#endif
// some key strings used to store parameters in config
static const wxChar backgroundColorKey[] = wxT( "BackgroundColor" );
static const wxChar showPageLimitsKey[] = wxT( "ShowPageLimits" );
......@@ -90,7 +85,7 @@ struct LANGUAGE_DESCR
BITMAP_DEF m_Lang_Icon;
/// Labels used in menus
const wxChar* m_Lang_Label;
wxString m_Lang_Label;
/// Set to true if the m_Lang_Label must not be translated
bool m_DoNotTranslate;
......@@ -274,7 +269,7 @@ EDA_APP::EDA_APP()
m_oneInstancePerFileChecker = NULL;
m_HtmlCtrl = NULL;
m_settings = NULL;
m_LanguageId = wxLANGUAGE_DEFAULT;
setLanguageId( wxLANGUAGE_DEFAULT );
m_Locale = NULL;
m_projectSettings = NULL;
m_commonSettings = NULL;
......@@ -350,14 +345,15 @@ void EDA_APP::InitEDA_Appl( const wxString& aName, EDA_APP_T aId )
// Internationalization: loading the kicad suitable Dictionary
wxString languageSel;
m_commonSettings->Read( languageCfgKey, &languageSel);
m_LanguageId = wxLANGUAGE_DEFAULT;
setLanguageId( wxLANGUAGE_DEFAULT );
// Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{
if( s_Languages[ii].m_Lang_Label == languageSel )
{
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break;
}
}
......@@ -625,14 +621,14 @@ void EDA_APP::GetSettings( bool aReopenLastUsedDirectory )
wxString languageSel;
m_commonSettings->Read( languageCfgKey, &languageSel );
m_LanguageId = wxLANGUAGE_DEFAULT;
setLanguageId( wxLANGUAGE_DEFAULT );
// Search for the current selection
for( unsigned ii = 0; ii < DIM( s_Languages ); ii++ )
{
if( s_Languages[ii].m_Lang_Label == languageSel )
{
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break;
}
}
......@@ -704,9 +700,7 @@ bool EDA_APP::SetLanguage( bool first_time )
// dictionary file name without extend (full name is kicad.mo)
wxString DictionaryName( wxT( "kicad" ) );
if( m_Locale )
delete m_Locale;
delete m_Locale;
m_Locale = new wxLocale;
#if wxCHECK_VERSION( 2, 9, 0 )
......@@ -717,7 +711,7 @@ bool EDA_APP::SetLanguage( bool first_time )
{
wxLogDebug( wxT( "This language is not supported by the system." ) );
m_LanguageId = wxLANGUAGE_DEFAULT;
setLanguageId( wxLANGUAGE_DEFAULT );
delete m_Locale;
m_Locale = new wxLocale;
......@@ -786,7 +780,7 @@ void EDA_APP::SetLanguageIdentifier( int menu_id )
{
if( menu_id == s_Languages[ii].m_KI_Lang_Identifier )
{
m_LanguageId = s_Languages[ii].m_WX_Lang_Identifier;
setLanguageId( s_Languages[ii].m_WX_Lang_Identifier );
break;
}
}
......
......@@ -205,6 +205,16 @@ bool FOOTPRINT_LIST::ReadFootprintFiles( FP_LIB_TABLE* aTable, const wxString* a
#if USE_WORKER_THREADS
// Even though the PLUGIN API implementation is the place for the
// locale toggling, in order to keep LOCAL_IO::C_count at 1 or greater
// for the duration of all helper threads, we increment by one here via instantiation.
// Only done here because of the multi-threaded nature of this code.
// Without this C_count skips in and out of "equal to zero" and causes
// needless locale toggling among the threads, based on which of them
// are in a PLUGIN::FootprintLoad() function. And that is occasionally
// none of them.
LOCALE_IO top_most_nesting;
// Something which will not invoke a thread copy constructor, one of many ways obviously:
typedef boost::ptr_vector< boost::thread > MYTHREADS;
......
......@@ -626,11 +626,15 @@ const FP_LIB_TABLE::ROW* FP_LIB_TABLE::FindRow( const wxString& aNickname )
if( !row )
{
wxString msg = wxString::Format( _( "lib table contains no logical lib '%s'" ),
GetChars( aNickname ) );
wxString msg = wxString::Format(
_( "fp-lib-table files contain no lib with nickname '%s'" ),
GetChars( aNickname ) );
THROW_IO_ERROR( msg );
}
// We've been 'lazy' up until now, but it cannot be deferred any longer,
// instantiate a PLUGIN of the proper kind if it is not already in this ROW.
if( !row->plugin )
row->setPlugin( IO_MGR::PluginFind( row->type ) );
......
......@@ -396,15 +396,22 @@ void GRSetBrush( wxDC* DC, EDA_COLOR_T Color, bool fill )
|| s_DC_lastbrushfill != fill
|| s_DC_lastDC != DC )
{
wxBrush DrawBrush;
DrawBrush.SetColour( MakeColour( Color ) );
wxBrush brush;
brush.SetColour( MakeColour( Color ) );
if( fill )
DrawBrush.SetStyle( wxSOLID );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
else
brush.SetStyle( wxBRUSHSTYLE_TRANSPARENT );
#else
brush.SetStyle( wxSOLID );
else
DrawBrush.SetStyle( wxTRANSPARENT );
brush.SetStyle( wxTRANSPARENT );
#endif
DC->SetBrush( DrawBrush );
DC->SetBrush( brush );
s_DC_lastbrushcolor = Color;
s_DC_lastbrushfill = fill;
......@@ -1444,12 +1451,12 @@ EDA_COLOR_T ColorMix( EDA_COLOR_T aColor1, EDA_COLOR_T aColor2 )
}
EDA_COLOR_T ColorByName( const wxChar *aName )
EDA_COLOR_T ColorByName( const wxString& aName )
{
// look for a match in the palette itself
for( EDA_COLOR_T trying = BLACK; trying < NBCOLORS; trying = NextColor(trying) )
{
if( 0 == wxStricmp( aName, g_ColorRefs[trying].m_Name ) )
if( 0 == aName.CmpNoCase( g_ColorRefs[trying].m_Name ) )
return trying;
}
......
......@@ -239,7 +239,12 @@ void EDA_MSG_PANEL::erase( wxDC* aDC )
pen.SetColour( color );
brush.SetColour( color );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
aDC->SetPen( pen );
aDC->SetBrush( brush );
......
......@@ -430,7 +430,7 @@ const wxPoint WORKSHEET_DATAITEM_POLYPOLYGON::GetCornerPositionUi( unsigned aIdx
return wxPoint( int(pos.x), int(pos.y) );
}
WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxChar* aTextBase ) :
WORKSHEET_DATAITEM_TEXT::WORKSHEET_DATAITEM_TEXT( const wxString& aTextBase ) :
WORKSHEET_DATAITEM( WS_TEXT )
{
m_TextBase = aTextBase;
......
......@@ -36,7 +36,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
const wxString traceFindItem( wxT( "KicadFindItem" ) );
......
......@@ -160,14 +160,23 @@ void WinEDA_SelColorFrame::Init_Dialog( int aOldColor )
butt_ID = ID_COLOR_BLACK + ii;
wxMemoryDC iconDC;
wxBitmap ButtBitmap( w, h );
wxBrush Brush;
wxBrush brush;
iconDC.SelectObject( ButtBitmap );
EDA_COLOR_T buttcolor = g_ColorRefs[ii].m_Numcolor;
iconDC.SetPen( *wxBLACK_PEN );
ColorSetBrush( &Brush, buttcolor );
Brush.SetStyle( wxSOLID );
ColorSetBrush( &brush, buttcolor );
#if wxCHECK_VERSION( 3, 0, 0 )
brush.SetStyle( wxBRUSHSTYLE_SOLID );
#else
brush.SetStyle( wxSOLID );
#endif
iconDC.SetBrush( brush );
iconDC.SetBrush( Brush );
iconDC.SetBackground( *wxGREY_BRUSH );
iconDC.Clear();
iconDC.DrawRoundedRectangle( 0, 0, w, h, (double) h / 3 );
......
......@@ -211,31 +211,33 @@ wxString DateAndTime()
}
int StrNumCmp( const wxChar* aString1, const wxChar* aString2, int aLength, bool aIgnoreCase )
int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength, bool aIgnoreCase )
{
int i;
int nb1 = 0, nb2 = 0;
if( ( aString1 == NULL ) || ( aString2 == NULL ) )
wxString::const_iterator str1 = aString1.begin(), str2 = aString2.begin();
if( ( str1 == aString1.end() ) || ( str2 == aString2.end() ) )
return 0;
for( i = 0; i < aLength; i++ )
{
if( isdigit( *aString1 ) && isdigit( *aString2 ) ) /* digit found */
if( isdigit( *str1 ) && isdigit( *str2 ) ) /* digit found */
{
nb1 = 0;
nb2 = 0;
while( isdigit( *aString1 ) )
while( isdigit( *str1 ) )
{
nb1 = nb1 * 10 + *aString1 - '0';
aString1++;
nb1 = nb1 * 10 + (int) *str1 - '0';
str1++;
}
while( isdigit( *aString2 ) )
while( isdigit( *str2 ) )
{
nb2 = nb2 * 10 + *aString2 - '0';
aString2++;
nb2 = nb2 * 10 + (int) *str2 - '0';
str2++;
}
if( nb1 < nb2 )
......@@ -247,29 +249,29 @@ int StrNumCmp( const wxChar* aString1, const wxChar* aString2, int aLength, bool
if( aIgnoreCase )
{
if( toupper( *aString1 ) < toupper( *aString2 ) )
if( toupper( *str1 ) < toupper( *str2 ) )
return -1;
if( toupper( *aString1 ) > toupper( *aString2 ) )
if( toupper( *str1 ) > toupper( *str2 ) )
return 1;
if( ( *aString1 == 0 ) && ( *aString2 == 0 ) )
if( ( *str1 == 0 ) && ( *str2 == 0 ) )
return 0;
}
else
{
if( *aString1 < *aString2 )
if( *str1 < *str2 )
return -1;
if( *aString1 > *aString2 )
if( *str1 > *str2 )
return 1;
if( ( *aString1 == 0 ) && ( *aString2 == 0 ) )
if( ( str1 == aString1.end() ) && ( str2 == aString2.end() ) )
return 0;
}
aString1++;
aString2++;
str1++;
str2++;
}
return 0;
......@@ -477,18 +479,3 @@ bool ReplaceIllegalFileNameChars( std::string* aName )
return changed;
}
wxString RemoveTrailingZeros( const wxString& aString )
{
wxString retv = aString;
int i = retv.Length();
while( --i > 0 && retv[i] == wxChar( '0' ) )
retv.RemoveLast();
if( retv[i] == wxChar( '.' ) || retv[i] == wxChar( ',' ) )
retv.RemoveLast();
return retv;
}
/*
Boost::Context assembly wrapper - done to avoid compiling the whole boost binary library
which may be unpleasant, in particular under Windows (we don't support VC++, while boost::context
does not support mingw */
#ifdef __APPLE__
#if __i386__
#include "jump_i386_sysv_macho_gas.S"
#include "make_i386_sysv_macho_gas.S"
#elif __x86_64__
#include "jump_x86_64_sysv_macho_gas.S"
#include "make_x86_64_sysv_macho_gas.S"
#else
#error "Missing make_fcontext & jump_fcontext routines for this architecture"
#endif
#else
#if __i386__
#ifdef __WIN32__
#include "jump_i386_pe_gas.S"
#include "make_i386_pe_gas.S"
#else
#include "jump_i386_sysv_elf_gas.S"
#include "make_i386_sysv_elf_gas.S"
#endif
#elif __x86_64__
#include "jump_x86_64_sysv_elf_gas.S"
#include "make_x86_64_sysv_elf_gas.S"
#elif __arm__
#include "jump_arm_aapcs_elf_gas.S"
#include "make_arm_aapcs_elf_gas.S"
#else
#error "Missing make_fcontext & jump_fcontext routines for this architecture"
#endif
#endif
/*
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 | *
* ------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| *
* ------------------------------------------------------------- *
* | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 10 | | *
* ------------------------------------------------------------- *
* | 0x28| | *
* ------------------------------------------------------------- *
* | pc | | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 11 | 12 | | *
* ------------------------------------------------------------- *
* | 0x2c| 0x30| | *
* ------------------------------------------------------------- *
* | sp | size| | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | *
* ------------------------------------------------------------- *
* | 0x34| 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58 | *
* ------------------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 23 | 24 | 25 | 26 | 27 | 28 | | *
* ------------------------------------------------------------- *
* | 0x5c| 0x60| 0x64| 0x68| 0x6c| 0x70| | *
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,%function
jump_fcontext:
stmia a1, {v1-v8,sp-lr} @ save V1-V8,SP-LR
str lr, [a1,#40] @ save LR as PC
#if (defined(__VFP_FP__) && !defined(__SOFTFP__))
cmp a4, #0 @ test if fpu env should be preserved
beq 1f
mov a4, a1
add a4, #52
vstmia a4, {d8-d15} @ save S16-S31
mov a4, a2
add a4, #52
vldmia a4, {d8-d15} @ restore S16-S31
1:
#endif
mov a1, a3 @ use third arg as return value after jump
@ and as first arg in context function
ldmia a2, {v1-v8,sp-pc} @ restore v1-V8,SP-PC
.size jump_fcontext,.-jump_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
/* 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)
*/
.global _jump_fcontext
.text
.align 2
_jump_fcontext:
mov 0x4(%esp),%ecx
mov %edi,(%ecx)
mov %esi,0x4(%ecx)
mov %ebx,0x8(%ecx)
mov %ebp,0xc(%ecx)
mov %fs:0x18,%edx
mov (%edx),%eax
mov %eax,0x24(%ecx)
mov 0x4(%edx),%eax
mov %eax,0x18(%ecx)
mov 0x8(%edx),%eax
mov %eax,0x20(%ecx)
mov 0x10(%edx),%eax
mov %eax,0x28(%ecx)
lea 0x4(%esp),%eax
mov %eax,0x10(%ecx)
mov (%esp),%eax
mov %eax,0x14(%ecx)
mov 0x8(%esp),%edx
mov (%edx),%edi
mov 0x4(%edx),%esi
mov 0x8(%edx),%ebx
mov 0xc(%edx),%ebp
mov 0x10(%esp),%eax
test %eax,%eax
je _jump_fcontext+0x5f
stmxcsr 0x2c(%ecx)
fnstcw 0x30(%ecx)
ldmxcsr 0x2c(%edx)
fldcw 0x30(%edx)
mov %edx,%ecx
mov %fs:0x18,%edx
mov 0x24(%ecx),%eax
mov %eax,(%edx)
mov 0x18(%ecx),%eax
mov %eax,0x4(%edx)
mov 0x20(%ecx),%eax
mov %eax,0x8(%edx)
mov 0x28(%ecx),%eax
mov %eax,0x10(%edx)
mov 0xc(%esp),%eax
mov 0x10(%ecx),%esp
mov %eax,0x4(%esp)
mov 0x14(%ecx),%ecx
jmp *%ecx
/*
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 | *
* -------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
* -------------------------------------------------------------- *
* | EDI | ESI | EBX | EBP | ESP | EIP | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 6 | 7 | | *
* -------------------------------------------------------------- *
* | 0x18 | 0x1c | | *
* -------------------------------------------------------------- *
* | sp | size | | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 8 | 9 | | *
* -------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* -------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* -------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl jump_fcontext
.align 2
.type jump_fcontext,@function
jump_fcontext:
movl 0x4(%esp), %ecx /* load address of the first fcontext_t arg */
movl %edi, (%ecx) /* save EDI */
movl %esi, 0x4(%ecx) /* save ESI */
movl %ebx, 0x8(%ecx) /* save EBX */
movl %ebp, 0xc(%ecx) /* save EBP */
leal 0x4(%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 0x8(%esp), %edx /* load address of the second fcontext_t arg */
movl (%edx), %edi /* restore EDI */
movl 0x4(%edx), %esi /* restore ESI */
movl 0x8(%edx), %ebx /* restore EBX */
movl 0xc(%edx), %ebp /* restore EBP */
movl 0x10(%esp), %eax /* check if fpu enve preserving was requested */
test %eax, %eax
je 1f
stmxcsr 0x20(%ecx) /* save MMX control and status word */
fnstcw 0x24(%ecx) /* save x87 control word */
ldmxcsr 0x20(%edx) /* restore MMX control and status word */
fldcw 0x24(%edx) /* restore x87 control word */
1:
movl 0xc(%esp), %eax /* use third arg as return value after jump */
movl 0x10(%edx), %esp /* restore ESP */
movl %eax, 0x4(%esp) /* use third arg as first arg in context function */
movl 0x14(%edx), %edx /* fetch the address to return to */
jmp *%edx /* indirect jump to context */
.size jump_fcontext,.-jump_fcontext
/*
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 | *
* -------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
* -------------------------------------------------------------- *
* | EDI | ESI | EBX | EBP | ESP | EIP | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 6 | 7 | | *
* -------------------------------------------------------------- *
* | 0x18 | 0x1c | | *
* -------------------------------------------------------------- *
* | sp | size | | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 8 | 9 | | *
* -------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* -------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* -------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl _jump_fcontext
.align 2
_jump_fcontext:
movl 0x4(%esp), %ecx /* load address of the first fcontext_t arg */
movl %edi, (%ecx) /* save EDI */
movl %esi, 0x4(%ecx) /* save ESI */
movl %ebx, 0x8(%ecx) /* save EBX */
movl %ebp, 0xc(%ecx) /* save EBP */
leal 0x4(%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 0x8(%esp), %edx /* load address of the second fcontext_t arg */
movl (%edx), %edi /* restore EDI */
movl 0x4(%edx), %esi /* restore ESI */
movl 0x8(%edx), %ebx /* restore EBX */
movl 0xc(%edx), %ebp /* restore EBP */
movl 0x10(%esp), %eax /* check if fpu enve preserving was requested */
test %eax, %eax
je 1f
stmxcsr 0x20(%ecx) /* save MMX control and status word */
fnstcw 0x24(%ecx) /* save x87 control word */
ldmxcsr 0x20(%edx) /* restore MMX control and status word */
fldcw 0x24(%edx) /* restore x87 control word */
1:
movl 0xc(%esp), %eax /* use third arg as return value after jump */
movl 0x10(%edx), %esp /* restore ESP */
movl %eax, 0x4(%esp) /* use third arg as first arg in context function */
movl 0x14(%edx), %edx /* fetch the address to return to */
jmp *%edx /* indirect jump to context */
/*
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 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | RBX | R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBP | RSP | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | | *
* ---------------------------------------------------------------------------------- *
* | 0x40 | 0x44 | 0x48 | 0x4c | | *
* ---------------------------------------------------------------------------------- *
* | sp | size | | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 20 | 21 | | *
* ---------------------------------------------------------------------------------- *
* | 0x50 | 0x54 | | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* ---------------------------------------------------------------------------------- *
* *
* **************************************************************************************/
.text
.globl jump_fcontext
.type jump_fcontext,@function
.align 8
jump_fcontext:
movq %rbx, (%rdi) /* save RBX */
movq %r12, 0x8(%rdi) /* save R12 */
movq %r13, 0x10(%rdi) /* save R13 */
movq %r14, 0x18(%rdi) /* save R14 */
movq %r15, 0x20(%rdi) /* save R15 */
movq %rbp, 0x28(%rdi) /* save RBP */
cmp $0, %rcx
je 1f
stmxcsr 0x50(%rdi) /* save MMX control and status word */
fnstcw 0x54(%rdi) /* save x87 control word */
ldmxcsr 0x50(%rsi) /* restore MMX control and status word */
fldcw 0x54(%rsi) /* restore x87 control word */
1:
leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */
movq %rax, 0x30(%rdi) /* save as stack pointer */
movq (%rsp), %rax /* save return address */
movq %rax, 0x38(%rdi) /* save return address as RIP */
movq (%rsi), %rbx /* restore RBX */
movq 0x8(%rsi), %r12 /* restore R12 */
movq 0x10(%rsi), %r13 /* restore R13 */
movq 0x18(%rsi), %r14 /* restore R14 */
movq 0x20(%rsi), %r15 /* restore R15 */
movq 0x28(%rsi), %rbp /* restore RBP */
movq 0x30(%rsi), %rsp /* restore RSP */
movq 0x38(%rsi), %rcx /* fetch the address to return to */
movq %rdx, %rax /* use third arg as return value after jump */
movq %rdx, %rdi /* use third arg as first arg in context function */
jmp *%rcx /* indirect jump to context */
.size jump_fcontext,.-jump_fcontext
/*
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 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | RBX | R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBP | RSP | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | | *
* ---------------------------------------------------------------------------------- *
* | 0x40 | 0x44 | 0x48 | 0x4c | | *
* ---------------------------------------------------------------------------------- *
* | sp | size | | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 20 | 21 | | *
* ---------------------------------------------------------------------------------- *
* | 0x50 | 0x54 | | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* ---------------------------------------------------------------------------------- *
* *
* **************************************************************************************/
.text
.globl _jump_fcontext
.align 8
_jump_fcontext:
movq %rbx, (%rdi) /* save RBX */
movq %r12, 0x8(%rdi) /* save R12 */
movq %r13, 0x10(%rdi) /* save R13 */
movq %r14, 0x18(%rdi) /* save R14 */
movq %r15, 0x20(%rdi) /* save R15 */
movq %rbp, 0x28(%rdi) /* save RBP */
cmp $0, %rcx
je 1f
stmxcsr 0x50(%rdi) /* save MMX control and status word */
fnstcw 0x54(%rdi) /* save x87 control word */
ldmxcsr 0x50(%rsi) /* restore MMX control and status word */
fldcw 0x54(%rsi) /* restore x87 control word */
1:
leaq 0x8(%rsp), %rax /* exclude the return address and save as stack pointer */
movq %rax, 0x30(%rdi) /* save as stack pointer */
movq (%rsp), %rax /* save return address */
movq %rax, 0x38(%rdi) /* save return address as RIP */
movq (%rsi), %rbx /* restore RBX */
movq 0x8(%rsi), %r12 /* restore R12 */
movq 0x10(%rsi), %r13 /* restore R13 */
movq 0x18(%rsi), %r14 /* restore R14 */
movq 0x20(%rsi), %r15 /* restore R15 */
movq 0x28(%rsi), %rbp /* restore RBP */
movq 0x30(%rsi), %rsp /* restore RSP */
movq 0x38(%rsi), %rcx /* fetch the address to return to */
movq %rdx, %rax /* use third arg as return value after jump */
movq %rdx, %rdi /* use third arg as first arg in context function */
jmp *%rcx /* indirect jump to context */
/*
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 | *
* ------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10| 0x14| 0x18| 0x1c| 0x20| 0x24| *
* ------------------------------------------------------------- *
* | v1 | v2 | v3 | v4 | v5 | v6 | v7 | v8 | sp | lr | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 10 | | *
* ------------------------------------------------------------- *
* | 0x28| | *
* ------------------------------------------------------------- *
* | pc | | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 11 | 12 | | *
* ------------------------------------------------------------- *
* | 0x2c| 0x30| | *
* ------------------------------------------------------------- *
* | sp | size| | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | *
* ------------------------------------------------------------- *
* | 0x34| 0x38|0x3c| 0x40| 0x44| 0x48| 0x4c| 0x50| 0x54| 0x58 | *
* ------------------------------------------------------------- *
* | s16 | s17 | s18 | s19 | s20 | s21 | s22 | s23 | s24 | s25 | *
* ------------------------------------------------------------- *
* ------------------------------------------------------------- *
* | 23 | 24 | 25 | 26 | 27 | 28 | | *
* ------------------------------------------------------------- *
* | 0x5c| 0x60| 0x64| 0x68| 0x6c| 0x70| | *
* ------------------------------------------------------------- *
* | s26 | s27 | s28 | s29 | s30 | s31 | | *
* ------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl make_fcontext
.align 2
.type make_fcontext,%function
make_fcontext:
mov a4, a1 @ save address of context stack (base) A4
sub a1, a1, #116 @ reserve space for fcontext_t at top of context stack
@ shift address in A1 to lower 16 byte boundary
@ == pointer to fcontext_t and address of context stack
bic a1, a1, #15
str a4, [a1,#44] @ save address of context stack (base) in fcontext_t
str a2, [a1,#48] @ save context stack size in fcontext_t
str a3, [a1,#40] @ save address of context function in fcontext_t
str a1, [a1,#32] @ save address in A4 as stack pointer for context function
adr a2, finish @ compute abs address of label finish
str a2, [a1,#36] @ save address of finish as return address for context function
@ entered after context function returns
bx lr
finish:
@ SP points to same addras SP on entry of context function
mov a1, #0 @ exit code is zero
bl _exit@PLT @ exit application
.size make_fcontext,.-make_fcontext
/* Mark that we don't need executable stack. */
.section .note.GNU-stack,"",%progbits
/* 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)
*/
.global _make_fcontext
.text
.align 2
_make_fcontext:
mov 0x4(%esp),%eax
lea -0x34(%eax),%eax
and $0xfffffff0,%eax
mov 0x4(%esp),%ecx
mov %ecx,0x18(%eax)
mov 0x8(%esp),%edx
mov %edx,0x1c(%eax)
neg %edx
lea (%edx,%ecx,1),%ecx
mov %ecx,0x20(%eax)
mov 0xc(%esp),%ecx
mov %ecx,0x14(%eax)
stmxcsr 0x2c(%eax)
fnstcw 0x30(%eax)
lea -0x1c(%eax),%edx
mov %edx,0x10(%eax)
mov $0x0,%ecx
mov %ecx,(%edx)
mov %fs:0x18,%ecx
mov (%ecx),%edx
inc %edx
je _make_fcontext+0x4c // <_make_fcontext+0x4c>
dec %edx
xchg %edx,%ecx
jmp _make_fcontext+0x42 // <_make_fcontext+0x42>
mov 0x4(%ecx),%ecx
mov 0x10(%eax),%edx
mov %ecx,0x18(%edx)
mov $0xffffffff,%ecx
mov %ecx,0x14(%edx)
lea 0x14(%edx),%ecx
mov %ecx,0x24(%eax)
ret
finish:
xor %eax,%eax
mov %eax,(%esp)
call finish+0xa
hlt
/*
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 | *
* -------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
* -------------------------------------------------------------- *
* | EDI | ESI | EBX | EBP | ESP | EIP | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 6 | 7 | | *
* -------------------------------------------------------------- *
* | 0x18 | 0x1c | | *
* -------------------------------------------------------------- *
* | sp | size | | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 8 | 9 | | *
* -------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* -------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* -------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl make_fcontext
.align 2
.type make_fcontext,@function
make_fcontext:
movl 0x4(%esp), %eax /* load 1. arg of make_fcontext, pointer to context stack (base) */
leal -0x28(%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 0x4(%esp), %edx /* load 1. arg of make_fcontext, pointer to context stack (base) */
movl %edx, 0x18(%eax) /* save address of context stack (base) in fcontext_t */
movl 0x8(%esp), %edx /* load 2. arg of make_fcontext, context stack size */
movl %edx, 0x1c(%eax) /* save stack size in fcontext_t */
movl 0xc(%esp), %edx /* load 3. arg of make_fcontext, pointer to context function */
movl %edx, 0x14(%eax) /* save address of context function in fcontext_t */
stmxcsr 0x20(%eax) /* save MMX control and status word */
fnstcw 0x24(%eax) /* save x87 control word */
leal -0x8(%eax), %edx /* reserve space for the last frame on context stack; (ESP - 0x4) % 16 == 0 */
movl %edx, 0x10(%eax) /* save address in EDX as stack pointer for context function */
call 1f
1: popl %ecx /* address of label 2 */
addl $finish-1b, %ecx /* compute abs address of label finish */
movl %ecx, (%edx) /* save address of finish as return address for context functions */
/* entered after context function returns */
ret
finish:
/* ESP points to same address as ESP on entry of context function + 0x4 */
call 2f
2: popl %ebx /* address of label 3 */
addl $_GLOBAL_OFFSET_TABLE_+[.-2b], %ebx /* compute address of GOT and store it in EBX */
xorl %eax, %eax
movl %eax, (%esp) /* exit code is zero */
call _exit@PLT /* exit application */
hlt
.size make_fcontext,.-make_fcontext
/*
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 | *
* -------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | *
* -------------------------------------------------------------- *
* | EDI | ESI | EBX | EBP | ESP | EIP | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 6 | 7 | | *
* -------------------------------------------------------------- *
* | 0x18 | 0x1c | | *
* -------------------------------------------------------------- *
* | sp | size | | *
* -------------------------------------------------------------- *
* -------------------------------------------------------------- *
* | 8 | 9 | | *
* -------------------------------------------------------------- *
* | 0x20 | 0x24 | | *
* -------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* -------------------------------------------------------------- *
* *
* *****************************************************************/
.text
.globl _make_fcontext
.align 2
_make_fcontext:
movl 0x4(%esp), %eax /* load 1. arg of make_fcontext, pointer to context stack (base) */
leal -0x28(%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 0x4(%esp), %edx /* load 1. arg of make_fcontext, pointer to context stack (base) */
movl %edx, 0x18(%eax) /* save address of stack pointer (base) in fcontext_t */
movl 0x8(%esp), %edx /* load 2. arg of make_fcontext, context stack size */
movl %edx, 0x1c(%eax) /* save stack size in fcontext_t */
movl 0xc(%esp), %edx /* load 3. arg of make_fcontext, pointer to context function */
movl %edx, 0x14(%eax) /* save address of context fcuntion in fcontext_t */
stmxcsr 0x20(%eax) /* save MMX control and status word */
fnstcw 0x24(%eax) /* save x87 control word */
leal -0x14(%eax), %edx /* reserve space for the last frame on context stack */
movl %edx, 0x10(%eax) /* save address in EDX as stack pointer for context function */
call 1f
1: popl %ecx /* address of label 1 */
addl $finish-1b, %ecx /* compute abs address of label finish */
movl %ecx, (%edx) /* save address of finish as return address for context function */
/* entered after context function returns */
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
/*
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 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | RBX | R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBP | RSP | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | | *
* ---------------------------------------------------------------------------------- *
* | 0x40 | 0x44 | 0x48 | 0x4c | | *
* ---------------------------------------------------------------------------------- *
* | sp | size | | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 20 | 21 | | *
* ---------------------------------------------------------------------------------- *
* | 0x50 | 0x54 | | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* ---------------------------------------------------------------------------------- *
* *
* **************************************************************************************/
.text
.globl make_fcontext
#ifndef __APPLE__
.type make_fcontext,@function
#endif
.align 8
make_fcontext:
leaq -0x58(%rdi), %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 %rdi, 0x40(%rax) /* save address of context stack pointer (base) in fcontext_t */
movq %rsi, 0x48(%rax) /* save context stack size in fcontext_t */
movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */
stmxcsr 0x50(%rax) /* save MMX control and status word */
fnstcw 0x54(%rax) /* save x87 control word */
leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */
movq %rdx, 0x30(%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 /* return pointer to fcontext_t placed on context stack */
finish:
/* RSP points to same address as RSP on entry of context function + 0x8 */
xorq %rdi, %rdi /* exit code is zero */
call _exit@PLT /* exit application */
hlt
#ifndef __APPLE__
.size make_fcontext,.-make_fcontext
#endif
/*
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 | *
* ---------------------------------------------------------------------------------- *
* | 0x0 | 0x4 | 0x8 | 0xc | 0x10 | 0x14 | 0x18 | 0x1c | *
* ---------------------------------------------------------------------------------- *
* | RBX | R12 | R13 | R14 | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | *
* ---------------------------------------------------------------------------------- *
* | 0x20 | 0x24 | 0x28 | 0x2c | 0x30 | 0x34 | 0x38 | 0x3c | *
* ---------------------------------------------------------------------------------- *
* | R15 | RBP | RSP | RIP | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 16 | 17 | 18 | 19 | | *
* ---------------------------------------------------------------------------------- *
* | 0x40 | 0x44 | 0x48 | 0x4c | | *
* ---------------------------------------------------------------------------------- *
* | sp | size | | *
* ---------------------------------------------------------------------------------- *
* ---------------------------------------------------------------------------------- *
* | 20 | 21 | | *
* ---------------------------------------------------------------------------------- *
* | 0x50 | 0x54 | | *
* ---------------------------------------------------------------------------------- *
* | fc_mxcsr|fc_x87_cw| | *
* ---------------------------------------------------------------------------------- *
* *
* **************************************************************************************/
.text
.globl _make_fcontext
.align 8
_make_fcontext:
leaq -0x58(%rdi), %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 */
movabs $-16, %r8
andq %r8, %rax
movq %rdi, 0x40(%rax) /* save address of stack pointer (base) in fcontext_t */
movq %rsi, 0x48(%rax) /* save stack size in fcontext_t */
movq %rdx, 0x38(%rax) /* save address of context function in fcontext_t */
stmxcsr 0x50(%rax) /* save MMX control and status word */
fnstcw 0x54(%rax) /* save x87 control word */
leaq -0x8(%rax), %rdx /* reserve space for the return address on context stack, (RSP - 0x8) % 16 == 0 */
movq %rdx, 0x30(%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 /* return pointer to fcontext_t placed on context stack */
finish:
/* RSP points to same address as RSP on entry of context function + 0x8 */
xorq %rdi, %rdi /* exit code is zero */
call __exit /* exit application */
......@@ -97,4 +97,5 @@ const wxString PSFileWildcard( _( "PostScript files (.ps)|*.ps" ) );
const wxString ReportFileWildcard = _( "Report files (*.rpt)|*.rpt" );
const wxString FootprintPlaceFileWildcard = _( "Footprint place files (*.pos)|*.pos" );
const wxString Shapes3DFileWildcard( _( "Vrml and x3d files (*.wrl *.x3d)|*.wrl;*.x3d" ) );
const wxString IDF3DFileWildcard( _( "IDFv3 component files (*.idf)|*.idf" ) );
const wxString TextWildcard( _( "Text files (*.txt)|*.txt" ) );
......@@ -94,10 +94,24 @@ void EDA_DRAW_FRAME::DrawWorkSheet( wxDC* aDC, BASE_SCREEN* aScreen, int aLineWi
TITLE_BLOCK t_block = GetTitleBlock();
EDA_COLOR_T color = RED;
wxPoint origin = aDC->GetDeviceOrigin();
if( aScreen->m_IsPrinting && origin.y > 0 )
{
aDC->SetDeviceOrigin( 0, 0 );
aDC->SetAxisOrientation( true, false );
}
DrawPageLayout( aDC, m_canvas->GetClipBox(), pageInfo,
GetScreenDesc(), aFilename, t_block,
aScreen->m_NumberOfScreens, aScreen->m_ScreenNumber,
aLineWidth, aScalar, color, color );
if( aScreen->m_IsPrinting && origin.y > 0 )
{
aDC->SetDeviceOrigin( origin.x, origin.y );
aDC->SetAxisOrientation( true, true );
}
}
......
......@@ -26,7 +26,7 @@
#include <xnode.h>
#include <macros.h>
typedef wxXmlProperty XATTR;
typedef wxXmlAttribute XATTR;
void XNODE::Format( OUTPUTFORMATTER* out, int nestLevel ) throw( IO_ERROR )
......
......@@ -158,7 +158,6 @@ void DISPLAY_FOOTPRINTS_FRAME::OnCloseWindow( wxCloseEvent& event )
if( m_Draw3DFrame )
m_Draw3DFrame->Close( true );
SaveSettings();
Destroy();
}
......
......@@ -337,7 +337,6 @@ void CVPCB_MAINFRAME::OnCloseWindow( wxCloseEvent& Event )
m_DisplayFootprintFrame->Close( true );
m_modified = false;
SaveSettings();
Destroy();
return;
}
......@@ -748,11 +747,11 @@ void CVPCB_MAINFRAME::DisplayStatus()
bool CVPCB_MAINFRAME::LoadFootprintFiles()
{
// Check if there are footprint libraries in project file.
if( m_ModuleLibNames.GetCount() == 0 )
// Check if there are footprint libraries in the footprint library table.
if( m_footprintLibTable == NULL || !m_footprintLibTable->GetLogicalLibs().size() )
{
wxMessageBox( _( "No PCB footprint libraries are listed in the current project file." ),
_( "Project File Error" ), wxOK | wxICON_ERROR );
wxMessageBox( _( "No PCB footprint libraries are listed in the current footprint "
"library table." ), _( "Configuration Error" ), wxOK | wxICON_ERROR );
return false;
}
......
This diff is collapsed.
EESchema-LIBRARY Version 2.3 Date: 21/05/2010 09:45:35
EESchema-LIBRARY Version 2.3
#encoding utf-8
#
# +12C
#
DEF +12C #PWR 0 0 N Y 1 F P
F0 "#PWR" 0 -30 30 H I C CNN
F1 "+12C" 0 110 40 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X +12C 1 0 0 0 U 30 30 0 0 W N
C 0 60 20 0 1 0 N
......@@ -17,6 +20,8 @@ ENDDEF
DEF +12V #PWR 0 0 N Y 1 F P
F0 "#PWR" 0 -50 20 H I C CNN
F1 "+12V" 0 100 30 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X +12V 1 0 0 0 U 20 30 0 0 W N
C 0 60 20 0 1 0 N
......@@ -29,6 +34,8 @@ ENDDEF
DEF -VAA #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 100 20 H I C CNN
F1 "-VAA" 0 100 30 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X -VAA 1 0 0 0 U 20 20 0 0 W N
P 3 0 1 0 0 0 0 50 0 50 N
......@@ -41,6 +48,8 @@ ENDDEF
DEF 7805 U 0 30 N Y 1 F N
F0 "U" 150 -196 60 H V C CNN
F1 "7805" 0 200 60 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
ALIAS LM7805 LM7812 78L05
DRAW
S -200 -150 200 150 0 1 0 N
......@@ -53,16 +62,18 @@ ENDDEF
# C
#
DEF C C 0 10 N Y 1 F N
F0 "C" 50 100 50 H V L CNN
F1 "C" 50 -100 50 H V L CNN
F0 "C" 0 100 40 H V L CNN
F1 "C" 6 -85 40 H V L CNN
F2 "" 38 -150 30 H V C CNN
F3 "" 0 100 30 H V C CNN
$FPLIST
SM*
C?
C1-1
$ENDFPLIST
DRAW
P 2 0 1 10 -100 -30 100 -30 N
P 2 0 1 10 -100 30 100 30 N
P 2 0 1 20 -80 -30 80 -30 N
P 2 0 1 20 -80 30 80 30 N
X ~ 1 0 200 170 D 40 40 1 1 P
X ~ 2 0 -200 170 U 40 40 1 1 P
ENDDRAW
......@@ -73,6 +84,8 @@ ENDDEF
DEF CONN_2 P 0 40 Y N 1 F N
F0 "P" -50 0 40 V V C CNN
F1 "CONN_2" 50 0 40 V V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
S -100 150 100 -150 0 1 0 N
X P1 1 -350 100 250 R 60 60 1 1 P I
......@@ -83,15 +96,17 @@ ENDDEF
# CP
#
DEF CP C 0 10 N N 1 F N
F0 "C" 50 100 50 H V L CNN
F1 "CP" 50 -100 50 H V L CNN
F0 "C" 50 100 40 H V L CNN
F1 "CP" 50 -100 40 H V L CNN
F2 "" 100 -150 30 H V C CNN
F3 "" 50 100 30 H V C CNN
ALIAS CAPAPOL
$FPLIST
CP*
SM*
$ENDFPLIST
DRAW
P 4 0 1 8 -100 50 -100 -50 100 -50 100 50 N
P 4 0 1 8 -80 50 -80 -50 80 -50 80 50 N
P 4 0 1 0 -50 50 -50 -20 50 -20 50 50 F
X ~ 1 0 200 150 D 40 40 1 1 P
X ~ 2 0 -200 150 U 40 40 1 1 P
......@@ -103,6 +118,8 @@ ENDDEF
DEF DIODE D 0 40 N N 1 F N
F0 "D" 0 100 40 H V C CNN
F1 "DIODE" 0 -100 40 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
$FPLIST
D?
S*
......@@ -120,6 +137,8 @@ ENDDEF
DEF ~GND #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 0 30 H I C CNN
F1 "GND" 0 -70 30 H I C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
P 4 0 1 0 -50 0 0 -50 50 0 -50 0 N
X GND 1 0 0 0 U 30 30 1 1 W N
......@@ -131,6 +150,8 @@ ENDDEF
DEF HT #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 120 20 H I C CNN
F1 "HT" 0 90 30 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X HT 1 0 0 0 U 20 20 0 0 W N
P 3 0 1 0 0 0 0 40 0 40 N
......@@ -143,6 +164,8 @@ ENDDEF
DEF ICL7660 U 0 40 Y Y 1 F N
F0 "U" 200 400 70 H V L CNN
F1 "ICL7660" 50 -450 70 H V L CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
S -550 -350 550 350 0 1 0 N
X CAP+ 2 -850 250 300 R 60 60 1 1 I
......@@ -160,7 +183,9 @@ ENDDEF
DEF LM358 U 0 20 Y Y 2 F N
F0 "U" -50 200 60 H V L CNN
F1 "LM358" -50 -250 60 H V L CNN
ALIAS OP275 LMC6062 LMC6082 MC33178 LM358N TL072 TL082
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
ALIAS LMC6062 LMC6082 LM358N TL072 TL082
DRAW
P 4 0 1 6 -200 200 200 0 -200 -200 -200 200 f
X V- 4 -100 -400 250 U 40 40 0 1 W
......@@ -180,16 +205,17 @@ DEF MPSA42 Q 0 40 Y N 1 F N
F0 "Q" 150 -150 60 H V L CNN
F1 "MPSA42" 150 150 60 H V L CNN
F2 "TO92-CBE" 150 0 30 H I C CNN
F3 "" 0 0 60 H V C CNN
$FPLIST
TO92-CBE
$ENDFPLIST
DRAW
C 50 0 111 0 1 10 N
P 2 0 1 0 0 0 100 100 N
P 3 0 1 10 0 75 0 -75 0 -75 F
P 3 0 1 0 25 -25 0 0 0 0 N
P 3 0 1 0 100 -100 65 -65 65 -65 N
P 5 0 1 0 25 -25 50 -75 75 -50 25 -25 25 -25 F
P 3 0 1 10 0 75 0 -75 0 -75 N
P 3 0 1 0 50 -50 0 0 0 0 N
P 3 0 1 0 90 -90 100 -100 100 -100 N
P 5 0 1 0 90 -90 70 -30 30 -70 90 -90 90 -90 F
X B B -200 0 200 R 40 40 1 1 I
X C C 100 200 100 D 40 40 1 1 P
X E E 100 -200 100 U 40 40 1 1 P
......@@ -202,6 +228,7 @@ DEF MPSA92 Q 0 40 Y N 1 F N
F0 "Q" 150 -150 60 H V L CNN
F1 "MPSA92" 150 150 60 H V L CNN
F2 "TO92-CBE" 150 0 30 H I C CNN
F3 "" 0 0 60 H V C CNN
$FPLIST
TO92-CBE
$ENDFPLIST
......@@ -223,6 +250,8 @@ ENDDEF
DEF POT RV 0 40 Y N 1 F N
F0 "RV" 0 -100 50 H V C CNN
F1 "POT" 0 0 50 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
S -150 50 150 -50 0 1 0 N
P 3 0 1 0 0 50 -20 70 20 70 F
......@@ -235,20 +264,23 @@ ENDDEF
# PWR_FLAG
#
DEF PWR_FLAG #FLG 0 0 N N 1 F P
F0 "#FLG" 0 270 30 H I C CNN
F1 "PWR_FLAG" 0 230 30 H V C CNN
F0 "#FLG" 0 95 30 H I C CNN
F1 "PWR_FLAG" 0 180 30 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X pwr 1 0 0 0 U 20 20 0 0 w
P 3 0 1 0 0 0 0 100 0 100 N
P 5 0 1 0 0 100 -100 150 0 200 100 150 0 100 N
P 6 0 1 0 0 0 0 50 -75 100 0 150 75 100 0 50 N
ENDDRAW
ENDDEF
#
# R
#
DEF R R 0 0 N Y 1 F N
F0 "R" 80 0 50 V V C CNN
F1 "R" 0 0 50 V V C CNN
F0 "R" 80 0 40 V V C CNN
F1 "R" 7 1 40 V V C CNN
F2 "" -70 0 30 V V C CNN
F3 "" 0 0 30 H V C CNN
$FPLIST
R?
SM0603
......@@ -268,6 +300,8 @@ ENDDEF
DEF VCC #PWR 0 0 Y Y 1 F P
F0 "#PWR" 0 100 30 H I C CNN
F1 "VCC" 0 100 30 H V C CNN
F2 "" 0 0 60 H V C CNN
F3 "" 0 0 60 H V C CNN
DRAW
X VCC 1 0 0 0 U 20 20 0 0 W N
C 0 50 20 0 1 0 N
......
update=12/03/2011 18:54:54
update=25/01/2014 08:37:41
version=1
last_client=pcbnew
last_client=kicad
[cvpcb]
version=1
NetITyp=0
NetIExt=.net
PkgIExt=.pkg
NetDir=
LibDir=
NetType=0
NetIExt=net
[cvpcb/libraries]
EquName1=devcms
[general]
version=1
[eeschema]
version=1
LibDir=F:\\kicad\\share\\library
NetFmt=1
HPGLSpd=20
HPGLDm=15
HPGLNum=1
offX_A4=0
offY_A4=0
offX_A3=0
offY_A3=0
offX_A2=0
offY_A2=0
offX_A1=0
offY_A1=0
offX_A0=0
offY_A0=0
offX_A=0
offY_A=0
offX_B=0
offY_B=0
offX_C=0
offY_C=0
offX_D=0
offY_D=0
offX_E=0
offY_E=0
PageLayoutDescrFile=
SubpartIdSeparator=0
SubpartFirstId=65
LibDir=F:/kicad/share/library
NetFmtName=
RptD_X=0
RptD_Y=100
RptLab=1
SimCmd=
UseNetN=0
LabSize=60
PrintMonochrome=1
ShowSheetReferenceAndTitleBlock=1
[eeschema/libraries]
LibName1=power
LibName2=device
......@@ -59,30 +28,25 @@ LibName7=interface
LibName8=special
[pcbnew]
version=1
PadDrlX=320
PadDimH=600
PadDimV=600
BoardThickness=630
TxtPcbV=800
TxtPcbH=600
TxtModV=600
TxtModH=600
TxtModW=120
VEgarde=100
DrawLar=150
EdgeLar=150
TxtLar=120
MSegLar=150
PageLayoutDescrFile=
LastNetListRead=
UseCmpFile=1
PadDrill=0.8128
PadDrillOvalY=0.8128
PadSizeH=2.286
PadSizeV=2.286
PcbTextSizeV=2
PcbTextSizeH=2
PcbTextThickness=0.3
ModuleTextSizeV=1
ModuleTextSizeH=1
ModuleTextSizeThickness=0.2
SolderMaskClearance=0.254
SolderMaskMinWidth=0
DrawSegmentWidth=0.3
BoardOutlineThickness=0.09999999999999999
ModuleOutlineThickness=0.2
[pcbnew/libraries]
LibDir=
LibName1=sockets
LibName2=connect
LibName3=discret
LibName4=pin_array
LibName5=divers
LibName6=libcms
LibName7=display
LibName8=valves
LibName9=led
LibName10=dip_sockets
[general]
version=1
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
* EESchema Netlist Version 1.1 (Spice format) creation date: 05/01/2014 19:00:38
* To exclude a component from the Spice Netlist add [Spice_Netlist_Enabled] user FIELD set to: N
* To reorder the component spice node sequence add [Spice_Node_Sequence] user FIELD and define sequence: 2,1,0
*Sheet Name:/
R12 /VOUT Net-_L1-Pad1_ 22K
R11 +12V Net-_L1-Pad1_ 100
L1 Net-_L1-Pad1_ /VOUT 100mH
R10 Net-_C3-Pad1_ Net-_Q3-Pad3_ 220
C3 Net-_C3-Pad1_ 0 10uF
C2 Net-_C2-Pad1_ 0 1nF
R8 Net-_Q3-Pad3_ 0 2.2K
Q3 /VOUT Net-_C2-Pad1_ Net-_Q3-Pad3_ Net-_Q3-Pad3_ Q2N2222
V2 Net-_C1-Pad2_ 0 AC 0.1
C1 /VIN Net-_C1-Pad2_ 1UF
V1 +12V 0 DC 12V
R2 /VIN 0 10K
R6 +12V /VIN 22K
R5 +12V Net-_Q2-Pad2_ 22K
R1 Net-_Q2-Pad2_ 0 10K
R7 Net-_Q1-Pad3_ 0 470
R4 +12V Net-_C2-Pad1_ 1K
R3 +12V Net-_Q1-Pad1_ 1K
Q2 Net-_C2-Pad1_ Net-_Q2-Pad2_ Net-_Q1-Pad3_ Net-_Q1-Pad3_ Q2N2222
Q1 Net-_Q1-Pad1_ /VIN Net-_Q1-Pad3_ Net-_Q1-Pad3_ Q2N2222
No circuit simulation currently defined
\ No newline at end of file
.model Q2N2222 npn (bf=200)
.print tran v(nodes)
.print dc v(nodes)
.tran 10 10000 10 > pspice.dat
.end
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.
update=07/03/2011 07:11:33
update=09/01/2014 18:43:43
version=1
last_client=cvpcb
last_client=kicad
[pcbnew]
version=1
LibDir=
......@@ -118,12 +118,10 @@ LibName8=memory
LibName9=xilinx
LibName10=special
LibName11=analog_switches
[general]
version=1
RootSch=carte_test.sch
BoardNm=carte_test.brd
[cvpcb]
version=1
NetIExt=.net
[cvpcb/libraries]
EquName1=devcms
[general]
version=1
This diff is collapsed.
......@@ -34,7 +34,6 @@
#include <general.h>
#include <class_library.h>
#include <protos.h>
#include <libeditframe.h>
......
......@@ -36,7 +36,6 @@
#include <lib_draw_item.h>
#include <lib_pin.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>
#include <sch_junction.h>
#include <sch_line.h>
......
......@@ -36,7 +36,6 @@
#include <wxEeschemaStruct.h>
#include <general.h>
#include <protos.h>
#include <sch_bus_entry.h>
......
......@@ -37,7 +37,6 @@
#include <richio.h>
#include <general.h>
#include <protos.h>
#include <template_fieldnames.h>
#include <transform.h>
#include <class_library.h>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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