Commit 1112681a authored by Tomasz Włostowski's avatar Tomasz Włostowski

Merge branch 'bzr/master'

parents ae9eacb2 6312f838
......@@ -84,7 +84,6 @@ void S3D_MASTER::ObjectCoordsTo3DUnits( std::vector< S3D_VERTEX >& aVertices )
}
/* adjust offset position (offset is given in UNIT 3D (0.1 inch) */
#define SCALE_3D_CONV ((IU_PER_MILS * 1000) / UNITS3D_TO_UNITSPCB)
aVertices[ii].x += m_MatPosition.x * SCALE_3D_CONV;
aVertices[ii].y += m_MatPosition.y * SCALE_3D_CONV;
aVertices[ii].z += m_MatPosition.z * SCALE_3D_CONV;
......
......@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com>
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 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
......@@ -46,8 +46,8 @@ S3D_MESH::S3D_MESH()
m_translation = glm::vec3( 0.0f, 0.0f, 0.0f );
m_rotation = glm::vec4( 0.0f, 0.0f, 0.0f, 0.0f );
m_scale = glm::vec3( 1.0f, 1.0f, 1.0f );
m_scaleOrientation = glm::vec4( 0.0f, 0.0f, 1.0f, 0.0f ); // not used
m_center = glm::vec3( 0.0f, 0.0f, 0.0f ); // not used
m_scaleOrientation = glm::vec4( 0.0f, 0.0f, 1.0f, 0.0f ); // not used
m_center = glm::vec3( 0.0f, 0.0f, 0.0f ); // not used
}
......@@ -55,10 +55,11 @@ S3D_MESH::~S3D_MESH()
{
for( unsigned int idx = 0; idx < childs.size(); idx++ )
{
delete childs[idx];
delete childs[idx];
}
}
void S3D_MESH::openGL_RenderAllChilds()
{
//DBG( printf( "openGL_RenderAllChilds") );
......@@ -82,7 +83,6 @@ void S3D_MESH::openGL_RenderAllChilds()
SetOpenGlDefaultMaterial();
glPopMatrix();
}
......@@ -94,15 +94,10 @@ void S3D_MESH::openGL_Render()
&& g_Parm_3D_Visu.GetFlag( FL_RENDER_SMOOTH );
if( m_Materials )
{
m_Materials->SetOpenGLMaterial( 0, useMaterial );
}
if( m_CoordIndex.size() == 0)
{
if( m_CoordIndex.size() == 0 )
return;
}
glPushMatrix();
glTranslatef( m_translation.x, m_translation.y, m_translation.z );
......@@ -117,9 +112,7 @@ void S3D_MESH::openGL_Render()
if( m_PerVertexNormalsNormalized.size() == 0 )
{
if( smoothShapes )
{
calcPerPointNormals();
}
}
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
......@@ -127,17 +120,21 @@ void S3D_MESH::openGL_Render()
if( m_MaterialIndex.size() > 1 )
{
if( m_Materials )
{
m_Materials->SetOpenGLMaterial( m_MaterialIndex[idx], useMaterial );
}
}
switch( m_CoordIndex[idx].size() )
{
case 3: glBegin( GL_TRIANGLES );break;
case 4: glBegin( GL_QUADS ); break;
default: glBegin( GL_POLYGON ); break;
case 3:
glBegin( GL_TRIANGLES );
break;
case 4:
glBegin( GL_QUADS );
break;
default:
glBegin( GL_POLYGON );
break;
}
......@@ -187,34 +184,36 @@ void S3D_MESH::openGL_Render()
}
void S3D_MESH::calcPointNormalized ()
void S3D_MESH::calcPointNormalized()
{
//DBG( printf( "calcPointNormalized\n" ) );
if( isPointNormalizedComputed == true )
{
return;
}
isPointNormalizedComputed = true;
if( m_PerVertexNormalsNormalized.size() > 0 )
{
return;
}
m_PointNormalized.clear();
float biggerPoint = 0.0f;
for( unsigned int i = 0; i< m_Point.size(); i++ )
{
if( fabs( m_Point[i].x ) > biggerPoint) biggerPoint = fabs( m_Point[i].x );
if( fabs( m_Point[i].y ) > biggerPoint) biggerPoint = fabs( m_Point[i].y );
if( fabs( m_Point[i].z ) > biggerPoint) biggerPoint = fabs( m_Point[i].z );
if( fabs( m_Point[i].x ) > biggerPoint )
biggerPoint = fabs( m_Point[i].x );
if( fabs( m_Point[i].y ) > biggerPoint )
biggerPoint = fabs( m_Point[i].y );
if( fabs( m_Point[i].z ) > biggerPoint )
biggerPoint = fabs( m_Point[i].z );
}
biggerPoint = 1.0 / biggerPoint;
for( unsigned int i= 0; i< m_Point.size(); i++ )
for( unsigned int i = 0; i < m_Point.size(); i++ )
{
glm::vec3 p;
p = m_Point[i] * biggerPoint;
......@@ -237,30 +236,22 @@ bool IsClockwise( glm::vec3 v0, glm::vec3 v1, glm::vec3 v2 )
}
void S3D_MESH::calcPerFaceNormals ()
void S3D_MESH::calcPerFaceNormals()
{
//DBG( printf( "calcPerFaceNormals" ) );
if( isPerFaceNormalsComputed == true )
{
return;
}
isPerFaceNormalsComputed = true;
isPerFaceNormalsComputed = true;
if( m_PerVertexNormalsNormalized.size() > 0 )
{
return;
}
bool haveAlreadyNormals_from_model_file = false;
if( m_PerFaceNormalsNormalized.size() > 0 )
{
haveAlreadyNormals_from_model_file = true;
}
m_PerFaceNormalsRaw.clear();
m_PerFaceSquaredArea.clear();
......@@ -268,9 +259,15 @@ void S3D_MESH::calcPerFaceNormals ()
//DBG( printf("m_CoordIndex.size %u\n", m_CoordIndex.size()) );
//DBG( printf("m_PointNormalized.size %u\n", m_PointNormalized.size()) );
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
// There are no points defined for the coordIndex
if( m_PointNormalized.size() == 0 )
{
m_CoordIndex.clear();
return;
}
for( unsigned int idx = 0; idx < m_CoordIndex.size(); idx++ )
{
// User normalized and multiply to get better resolution
glm::vec3 v0 = m_PointNormalized[m_CoordIndex[idx][0]];
glm::vec3 v1 = m_PointNormalized[m_CoordIndex[idx][1]];
......@@ -300,14 +297,10 @@ void S3D_MESH::calcPerFaceNormals ()
float area = glm::dot( cross_prod, cross_prod );
if( cross_prod[2] < 0.0 )
{
area = -area;
}
if( area < FLT_EPSILON )
{
area = FLT_EPSILON * 2.0f;
}
m_PerFaceSquaredArea.push_back( area );
......@@ -315,52 +308,55 @@ void S3D_MESH::calcPerFaceNormals ()
if( haveAlreadyNormals_from_model_file == false )
{
// normalize vertex normal
float l = glm::length( cross_prod );
if( l > FLT_EPSILON ) // avoid division by zero
{
cross_prod = cross_prod / l;
cross_prod = cross_prod / l;
}
else
{
// Cannot calc normal
if( ( cross_prod.x > cross_prod.y ) && ( cross_prod.x > cross_prod.z ) )
{
cross_prod.x = 1.0; cross_prod.y = 0.0; cross_prod.z = 0.0;
} else if( ( cross_prod.y > cross_prod.x ) && ( cross_prod.y > cross_prod.z ))
cross_prod.x = 1.0;
cross_prod.y = 0.0;
cross_prod.z = 0.0;
}
else if( ( cross_prod.y > cross_prod.x ) && ( cross_prod.y > cross_prod.z ) )
{
cross_prod.x = 0.0; cross_prod.y = 1.0; cross_prod.z = 0.0;
} else
cross_prod.x = 0.0;
cross_prod.y = 1.0;
cross_prod.z = 0.0;
}
else
{
cross_prod.x = 0.0; cross_prod.y = 1.0; cross_prod.z = 0.0;
cross_prod.x = 0.0;
cross_prod.y = 0.0;
cross_prod.z = 1.0;
}
}
m_PerFaceNormalsNormalized.push_back( cross_prod );
}
}
}
// http://www.bytehazard.com/code/vertnorm.html
// http://www.emeyex.com/site/tuts/VertexNormals.pdf
void S3D_MESH::calcPerPointNormals ()
void S3D_MESH::calcPerPointNormals()
{
//DBG( printf( "calcPerPointNormals" ) );
if( isPerPointNormalsComputed == true )
{
return;
}
isPerPointNormalsComputed = true;
if( m_PerVertexNormalsNormalized.size() > 0 )
{
return;
}
m_PerFaceVertexNormals.clear();
......@@ -371,6 +367,7 @@ void S3D_MESH::calcPerPointNormals ()
#ifdef USE_OPENMP
#pragma omp parallel for
#endif /* USE_OPENMP */
for( unsigned int each_face_A_idx = 0; each_face_A_idx < m_CoordIndex.size(); each_face_A_idx++ )
{
// n = face A facet normal
......@@ -390,15 +387,16 @@ void S3D_MESH::calcPerPointNormals ()
for( unsigned int each_face_B_idx = 0; each_face_B_idx < m_CoordIndex.size(); each_face_B_idx++ )
{
//if A != B { // ignore self
if ( each_face_A_idx != each_face_B_idx)
if( each_face_A_idx != each_face_B_idx )
{
if( (m_CoordIndex[each_face_B_idx][0] == vertexIndex) ||
(m_CoordIndex[each_face_B_idx][1] == vertexIndex) ||
(m_CoordIndex[each_face_B_idx][2] == vertexIndex) )
if( (m_CoordIndex[each_face_B_idx][0] == vertexIndex)
|| (m_CoordIndex[each_face_B_idx][1] == vertexIndex)
|| (m_CoordIndex[each_face_B_idx][2] == vertexIndex) )
{
glm::vec3 vector_face_B = m_PerFaceNormalsNormalized[each_face_B_idx];
float dot_prod = glm::dot(vector_face_A, vector_face_B);
float dot_prod = glm::dot( vector_face_A, vector_face_B );
if( dot_prod > 0.05f )
{
face_A_normals[each_vert_A_idx] += m_PerFaceNormalsRaw[each_face_B_idx] * (m_PerFaceSquaredArea[each_face_B_idx] * dot_prod);
......@@ -411,10 +409,7 @@ void S3D_MESH::calcPerPointNormals ()
float l = glm::length( face_A_normals[each_vert_A_idx] );
if( l > FLT_EPSILON ) // avoid division by zero
{
face_A_normals[each_vert_A_idx] /= l;
}
}
}
}
......@@ -42,6 +42,14 @@
*/
#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100)
/**
* scaling factor for 3D shape offset ( S3D_MASTER::m_MatPosition member )
* Was in inches in legacy version, and, due to a mistake, still in inches
* in .kicad_pcb files (which are using mm)
* so this scaling convert file units (inch) to 3D units (0.1 inch), only
* for S3D_MASTER::m_MatPosition parameter
*/
#define SCALE_3D_CONV 10
class S3D_MASTER;
class STRUCT_3D_SHAPE;
......
......@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 Tuomas Vaherkoski <tuomasvaherkoski@gmail.com>
* Copyright (C) 1992-2013 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 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
......@@ -45,7 +45,7 @@ class X3D_MODEL_PARSER;
class S3D_MODEL_PARSER
{
public:
S3D_MODEL_PARSER(S3D_MASTER* aMaster) :
S3D_MODEL_PARSER( S3D_MASTER* aMaster ) :
master( aMaster )
{}
......@@ -96,7 +96,7 @@ public:
void Load( const wxString& aFilename, double aVrmlunits_to_3Dunits );
typedef std::map< wxString, wxString > PROPERTY_MAP;
typedef std::vector< wxXmlNode* > NODE_LIST;
typedef std::vector< wxXmlNode* > NODE_LIST;
/**
* Function GetChildsByName
......@@ -125,9 +125,9 @@ public:
wxString VRML2_representation();
private:
wxString m_Filename;
S3D_MESH *m_model;
std::vector<S3D_MESH *> childs;
wxString m_Filename;
S3D_MESH* m_model;
std::vector< S3D_MESH* > childs;
std::vector< wxString > vrml_materials;
std::vector< wxString > vrml_points;
......@@ -142,6 +142,7 @@ private:
};
typedef std::map< std::string, std::vector< glm::vec3 > > VRML2_COORDINATE_MAP;
/**
* class VRML2_MODEL_PARSER
......@@ -165,25 +166,30 @@ public:
private:
int read_Transform();
int read_DEF();
int read_DEF_Coordinate();
int read_Shape();
int read_Appearance();
int read_material();
int read_Material();
int read_IndexedFaceSet();
int read_IndexedLineSet();
int read_Coordinate();
int read_CoordinateDef();
int read_Normal();
int read_NormalIndex();
int read_Color();
int read_coordIndex();
int read_colorIndex();
bool m_normalPerVertex;
bool colorPerVertex;
S3D_MESH *m_model;
std::vector<S3D_MESH *> childs;
FILE *m_file;
S3D_MATERIAL *m_Materials;
wxString m_Filename;
int read_USE();
bool m_normalPerVertex;
bool colorPerVertex;
S3D_MESH* m_model;
std::vector< S3D_MESH* > childs;
FILE* m_file;
S3D_MATERIAL* m_Materials;
wxString m_Filename;
VRML2_COORDINATE_MAP m_defCoordinateMap;
};
......@@ -224,13 +230,13 @@ private:
int readIndexedFaceSet_coordIndex();
int readIndexedFaceSet_materialIndex();
bool m_normalPerVertex;
bool colorPerVertex;
S3D_MESH *m_model;
std::vector<S3D_MESH *> childs;
S3D_MATERIAL *m_Materials;
FILE *m_file;
wxString m_Filename;
bool m_normalPerVertex;
bool colorPerVertex;
S3D_MESH* m_model;
std::vector< S3D_MESH* > childs;
S3D_MATERIAL* m_Materials;
FILE* m_file;
wxString m_Filename;
};
/**
......@@ -246,8 +252,8 @@ public:
void Load( const wxString& aFilename, double aVrmlunits_to_3Dunits );
private:
VRML1_MODEL_PARSER *vrml1_parser;
VRML2_MODEL_PARSER *vrml2_parser;
VRML1_MODEL_PARSER* vrml1_parser;
VRML2_MODEL_PARSER* vrml2_parser;
};
......
......@@ -75,9 +75,6 @@ void VRML1_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y,
GetMaster()->m_MatPosition.z );
#define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB )
// glPushMatrix();
glTranslatef( matPos.x * SCALE_3D_CONV, matPos.y * SCALE_3D_CONV, matPos.z * SCALE_3D_CONV );
......
This diff is collapsed.
......@@ -79,10 +79,6 @@ void X3D_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3Du
glm::vec3 matPos( GetMaster()->m_MatPosition.x, GetMaster()->m_MatPosition.y,
GetMaster()->m_MatPosition.z );
#define SCALE_3D_CONV ( (IU_PER_MILS * 1000.0f) / UNITS3D_TO_UNITSPCB )
glTranslatef( matPos.x * SCALE_3D_CONV, matPos.y * SCALE_3D_CONV, matPos.z * SCALE_3D_CONV );
glRotatef( -matRot.z, 0.0f, 0.0f, 1.0f );
......
......@@ -635,7 +635,6 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
# FindPythonInterp unless the user specifically defined a custom path.
if( NOT PYTHON_SITE_PACKAGE_PATH )
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix='')"
# execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print\"%s\"%distutils.sysconfig.get_python_lib()"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
......@@ -662,6 +661,33 @@ if( KICAD_SCRIPTING OR KICAD_SCRIPTING_MODULES )
find_package( PythonLibs 2.6 )
if( KICAD_SCRIPTING_WXPYTHON )
# Check to see if the correct version of wxPython is installed based on the version of
# wxWidgets found. At least the major an minor version should match.
set( _wxpy_version "${wxWidgets_VERSION_MAJOR}.${wxWidgets_VERSION_MINOR}" )
set( _py_cmd "import wxversion;print wxversion.checkInstalled('${_wxpy_version}')" )
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "${_py_cmd}"
RESULT_VARIABLE WXPYTHON_VERSION_RESULT
OUTPUT_VARIABLE WXPYTHON_VERSION_FOUND
OUTPUT_STRIP_TRAILING_WHITESPACE
)
# message( STATUS "WXPYTHON_VERSION_FOUND: ${WXPYTHON_VERSION_FOUND}" )
# message( STATUS "WXPYTHON_VERSION_RESULT: ${WXPYTHON_VERSION_RESULT}" )
# Check to see if any version of wxPython is installed on the system.
if( WXPYTHON_VERSION_RESULT GREATER 0 )
message( FATAL_ERROR "wxPython does not appear to be installed on the system." )
endif()
if( NOT WXPYTHON_VERSION_FOUND STREQUAL "True" )
message( FATAL_ERROR "wxPython version ${_wxpy_version} does not appear to be installed on the system." )
else()
set( WXPYTHON_VERSION_FOUND "${_wxpy_version}"
CACHE STRING "wxPython version found." )
endif()
endif()
#message( STATUS "PYTHON_INCLUDE_DIRS:${PYTHON_INCLUDE_DIRS}" )
# Infrequently needed headers go at end of search paths, append to INC_AFTER which
......
......@@ -70,6 +70,11 @@
#define KICAD_DATA_PATH "@CMAKE_INSTALL_PREFIX@/@KICAD_DATA@"
#endif
/// The wxPython version found during configuration.
#if defined( KICAD_SCRIPTING_WXPYTHON )
#define WXPYTHON_VERSION "@WXPYTHON_VERSION_FOUND@"
#endif
/// When defined, build the GITHUB_PLUGIN for pcbnew.
#cmakedefine BUILD_GITHUB_PLUGIN
......
......@@ -489,9 +489,7 @@ void HPGL_PLOTTER::FlashPadCircle( const wxPoint& pos, int diametre,
DPOINT pos_dev = userToDeviceCoordinates( pos );
int delta = KiROUND( penDiameter - penOverlap );
int radius = diametre / 2;
radius = ( diametre - KiROUND( penDiameter ) ) / 2;
int radius = ( diametre - KiROUND( penDiameter ) ) / 2;
if( radius < 0 )
radius = 0;
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013-2014 CERN
* Copyright (C) 2013-2015 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
......@@ -28,6 +29,7 @@
#include <wx/event.h>
#include <wx/colour.h>
#include <wx/filename.h>
#include <confirm.h>
#include <class_draw_panel_gal.h>
#include <view/view.h>
......@@ -116,30 +118,30 @@ void EDA_DRAW_PANEL_GAL::onPaint( wxPaintEvent& WXUNUSED( aEvent ) )
m_pendingRefresh = false;
m_lastRefresh = wxGetLocalTimeMillis();
if( !m_drawing )
{
m_drawing = true;
if( m_drawing )
return;
m_view->UpdateItems();
m_gal->BeginDrawing();
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
m_drawing = true;
if( m_view->IsDirty() )
{
m_view->ClearTargets();
m_view->UpdateItems();
m_gal->BeginDrawing();
m_gal->ClearScreen( m_painter->GetSettings()->GetBackgroundColor() );
// Grid has to be redrawn only when the NONCACHED target is redrawn
if( m_view->IsTargetDirty( KIGFX::TARGET_NONCACHED ) )
if( m_view->IsDirty() )
{
m_view->ClearTargets();
// Grid has to be redrawn only when the NONCACHED target is redrawn
if( m_view->IsTargetDirty( KIGFX::TARGET_NONCACHED ) )
m_gal->DrawGrid();
m_view->Redraw();
}
m_view->Redraw();
}
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
m_gal->EndDrawing();
m_gal->DrawCursor( m_viewControls->GetCursorPosition() );
m_gal->EndDrawing();
m_drawing = false;
}
m_drawing = false;
}
......@@ -233,7 +235,8 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
void EDA_DRAW_PANEL_GAL::StartDrawing()
{
m_pendingRefresh = false;
m_drawing = false;
m_pendingRefresh = true;
Connect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
wxPaintEvent redrawEvent;
......@@ -243,7 +246,8 @@ void EDA_DRAW_PANEL_GAL::StartDrawing()
void EDA_DRAW_PANEL_GAL::StopDrawing()
{
m_pendingRefresh = true;
m_pendingRefresh = false;
m_drawing = true;
m_refreshTimer.Stop();
Disconnect( wxEVT_PAINT, wxPaintEventHandler( EDA_DRAW_PANEL_GAL::onPaint ), NULL, this );
}
......@@ -271,41 +275,54 @@ void EDA_DRAW_PANEL_GAL::SetTopLayer( LAYER_ID aLayer )
}
void EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
bool EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
{
// Do not do anything if the currently used GAL is correct
if( aGalType == m_backend && m_gal != NULL )
return;
return true;
// Prevent refreshing canvas during backend switch
StopDrawing();
delete m_gal;
KIGFX::GAL* new_gal = NULL;
switch( aGalType )
try
{
case GAL_TYPE_OPENGL:
m_gal = new KIGFX::OPENGL_GAL( this, this, this );
break;
switch( aGalType )
{
case GAL_TYPE_OPENGL:
new_gal = new KIGFX::OPENGL_GAL( this, this, this );
break;
case GAL_TYPE_CAIRO:
m_gal = new KIGFX::CAIRO_GAL( this, this, this );
break;
case GAL_TYPE_CAIRO:
new_gal = new KIGFX::CAIRO_GAL( this, this, this );
break;
case GAL_TYPE_NONE:
return;
}
case GAL_TYPE_NONE:
return false;
}
wxSize size = GetClientSize();
m_gal->ResizeScreen( size.GetX(), size.GetY() );
delete m_gal;
m_gal = new_gal;
if( m_painter )
m_painter->SetGAL( m_gal );
wxSize size = GetClientSize();
m_gal->ResizeScreen( size.GetX(), size.GetY() );
if( m_view )
m_view->SetGAL( m_gal );
if( m_painter )
m_painter->SetGAL( m_gal );
if( m_view )
m_view->SetGAL( m_gal );
m_backend = aGalType;
}
catch (std::runtime_error& err)
{
DisplayError( m_parent, wxString( err.what() ) );
return false;
}
m_backend = aGalType;
return true;
}
......
......@@ -391,7 +391,7 @@ void FP_LIB_TABLE::Format( OUTPUTFORMATTER* out, int nestLevel ) const
void FP_LIB_TABLE::ROW::Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR )
throw( IO_ERROR, boost::interprocess::lock_exception )
{
out->Print( nestLevel, "(lib (name %s)(type %s)(uri %s)(options %s)(descr %s))\n",
out->Quotew( GetNickName() ).c_str(),
......@@ -665,7 +665,7 @@ bool FP_LIB_TABLE::IsEmpty( bool aIncludeFallback )
MODULE* FP_LIB_TABLE::FootprintLoadWithOptionalNickname( const FPID& aFootprintId )
throw( IO_ERROR, PARSE_ERROR )
throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception )
{
wxString nickname = aFootprintId.GetLibNickname();
wxString fpname = aFootprintId.GetFootprintName();
......
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013-2015 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
......@@ -24,13 +24,14 @@
/**
* @file opengl_compositor.cpp
* @brief Class that handles multitarget rendering (ie. to different textures/surfaces) and
* @brief Class that handles multitarget rendering (i.e. to different textures/surfaces) and
* later compositing into a single image (OpenGL flavour).
*/
#include <gal/opengl/opengl_compositor.h>
#include <wx/msgdlg.h>
#include <confirm.h>
#include <stdexcept>
#include <cassert>
using namespace KIGFX;
......@@ -89,7 +90,7 @@ void OPENGL_COMPOSITOR::Resize( unsigned int aWidth, unsigned int aHeight )
unsigned int OPENGL_COMPOSITOR::CreateBuffer()
{
wxASSERT( m_initialized );
assert( m_initialized );
unsigned int maxBuffers;
......@@ -98,10 +99,9 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
if( usedBuffers() >= maxBuffers )
{
DisplayError( NULL, wxT( "Cannot create more framebuffers. OpenGL rendering "
throw std::runtime_error("Cannot create more framebuffers. OpenGL rendering "
"backend requires at least 3 framebuffers. You may try to update/change "
"your graphic drivers." ) );
return 0; // Unfortunately we have no more free buffers left
"your graphic drivers.");
}
// GL_COLOR_ATTACHMENTn are consecutive integers
......@@ -133,38 +133,38 @@ unsigned int OPENGL_COMPOSITOR::CreateBuffer()
switch( status )
{
case GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_EXT:
DisplayError( NULL,wxT( "Cannot create the framebuffer." ) );
throw std::runtime_error( "Cannot create the framebuffer." );
break;
case GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_EXT:
DisplayError( NULL, wxT( "The framebuffer attachment points are incomplete." ) );
throw std::runtime_error( "The framebuffer attachment points are incomplete." );
break;
case GL_FRAMEBUFFER_INCOMPLETE_DRAW_BUFFER_EXT:
DisplayError( NULL, wxT( "The framebuffer does not have at least "
"one image attached to it." ) );
throw std::runtime_error( "The framebuffer does not have at least one "
"image attached to it." );
break;
case GL_FRAMEBUFFER_INCOMPLETE_READ_BUFFER_EXT:
DisplayError( NULL, wxT( "The framebuffer read buffer is incomplete." ) );
throw std::runtime_error( "The framebuffer read buffer is incomplete." );
break;
case GL_FRAMEBUFFER_UNSUPPORTED_EXT:
DisplayError( NULL, wxT( "The combination of internal formats of the attached images "
"violates an implementation-dependent set of restrictions." ) );
throw std::runtime_error( "The combination of internal formats of the attached "
"images violates an implementation-dependent set of restrictions." );
break;
case GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT:
DisplayError( NULL, wxT( "GL_RENDERBUFFER_SAMPLES is not the same "
"for all attached renderbuffers" ) );
throw std::runtime_error( "GL_RENDERBUFFER_SAMPLES is not the same for "
"all attached renderbuffers" );
break;
case GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT:
DisplayError( NULL, wxT( "Framebuffer incomplete layer targets errors." ) );
throw std::runtime_error( "Framebuffer incomplete layer targets errors." );
break;
default:
DisplayError( NULL, wxT( "Cannot create the framebuffer." ) );
throw std::runtime_error( "Cannot create the framebuffer." );
break;
}
......@@ -211,7 +211,7 @@ void OPENGL_COMPOSITOR::SetBuffer( unsigned int aBufferHandle )
void OPENGL_COMPOSITOR::ClearBuffer()
{
wxASSERT( m_initialized );
assert( m_initialized );
glClearColor( 0.0f, 0.0f, 0.0f, 0.0f );
glClear( GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT );
......@@ -220,8 +220,8 @@ void OPENGL_COMPOSITOR::ClearBuffer()
void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
{
wxASSERT( m_initialized );
wxASSERT( aBufferHandle != 0 && aBufferHandle <= usedBuffers() );
assert( m_initialized );
assert( aBufferHandle != 0 && aBufferHandle <= usedBuffers() );
// Switch to the main framebuffer and blit the scene
glBindFramebufferEXT( GL_FRAMEBUFFER, DIRECT_RENDERING );
......@@ -267,7 +267,7 @@ void OPENGL_COMPOSITOR::DrawBuffer( unsigned int aBufferHandle )
void OPENGL_COMPOSITOR::clean()
{
wxASSERT( m_initialized );
assert( m_initialized );
glBindFramebufferEXT( GL_FRAMEBUFFER, DIRECT_RENDERING );
m_currentFbo = DIRECT_RENDERING;
......
......@@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors.
* Copyright (C) 2013 CERN
* Copyright (C) 2013-2015 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* Graphics Abstraction Layer (GAL) for OpenGL
......@@ -31,7 +31,6 @@
#include <wx/log.h>
#include <macros.h>
#include <confirm.h>
#ifdef __WXDEBUG__
#include <profile.h>
#endif /* __WXDEBUG__ */
......@@ -51,6 +50,9 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
wxEvtHandler* aPaintListener, const wxString& aName ) :
wxGLCanvas( aParent, wxID_ANY, (int*) glAttributes, wxDefaultPosition, wxDefaultSize,
wxEXPAND, aName ),
parentWindow( aParent ),
mouseListener( aMouseListener ),
paintListener( aPaintListener ),
cachedManager( true ),
nonCachedManager( false ),
overlayManager( false )
......@@ -59,14 +61,29 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
if( glContext == NULL )
glContext = new wxGLContext( this );
parentWindow = aParent;
mouseListener = aMouseListener;
paintListener = aPaintListener;
aParent->Show(); // wxWidgets require the window to be visible to set its GL context
// Initialize GLEW, FBOs & VBOs
SetCurrent( *glContext );
initGlew();
// Prepare shaders
if( !shader.LoadBuiltinShader( 0, SHADER_TYPE_VERTEX ) )
throw std::runtime_error( "Cannot compile vertex shader!" );
if( !shader.LoadBuiltinShader( 1, SHADER_TYPE_FRAGMENT ) )
throw std::runtime_error( "Cannot compile fragment shader!" );
if( !shader.Link() )
throw std::runtime_error( "Cannot link the shaders!" );
// Make VBOs use shaders
cachedManager.SetShader( shader );
nonCachedManager.SetShader( shader );
overlayManager.SetShader( shader );
// Initialize the flags
isGlewInitialized = false;
isFramebufferInitialized = false;
isShaderInitialized = false;
isGrouping = false;
groupCounter = 0;
......@@ -100,10 +117,7 @@ OPENGL_GAL::OPENGL_GAL( wxWindow* aParent, wxEvtHandler* aMouseListener,
InitTesselatorCallbacks( tesselator );
if( tesselator == NULL )
{
DisplayError( parentWindow, wxT( "Could not create the tesselator" ) );
exit( 1 );
}
throw std::runtime_error( "Could not create the tesselator" );
gluTessProperty( tesselator, GLU_TESS_WINDING_RULE, GLU_TESS_WINDING_POSITIVE );
......@@ -123,13 +137,8 @@ OPENGL_GAL::~OPENGL_GAL()
void OPENGL_GAL::BeginDrawing()
{
SetCurrent( *glContext );
clientDC = new wxClientDC( this );
// Initialize GLEW, FBOs & VBOs
if( !isGlewInitialized )
initGlew();
// Set up the view port
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
......@@ -148,35 +157,6 @@ void OPENGL_GAL::BeginDrawing()
isFramebufferInitialized = true;
}
// Compile the shaders
if( !isShaderInitialized )
{
if( !shader.LoadBuiltinShader( 0, SHADER_TYPE_VERTEX ) )
{
DisplayError( parentWindow, wxT( "Cannot compile vertex shader!" ) );
exit( 1 );
}
if( !shader.LoadBuiltinShader( 1, SHADER_TYPE_FRAGMENT ) )
{
DisplayError( parentWindow, wxT( "Cannot compile fragment shader!" ) );
exit( 1 );
}
if( !shader.Link() )
{
DisplayError( parentWindow, wxT( "Cannot link the shaders!" ) );
exit( 1 );
}
// Make VBOs use shaders
cachedManager.SetShader( shader );
nonCachedManager.SetShader( shader );
overlayManager.SetShader( shader );
isShaderInitialized = true;
}
// Disable 2D Textures
glDisable( GL_TEXTURE_2D );
......@@ -509,7 +489,7 @@ void OPENGL_GAL::DrawPolygon( const std::deque<VECTOR2D>& aPointList )
boost::shared_array<GLdouble> points( new GLdouble[3 * aPointList.size()] );
int v = 0;
for( std::deque<VECTOR2D>::const_iterator it = aPointList.begin(); it != aPointList.end(); it++ )
for( std::deque<VECTOR2D>::const_iterator it = aPointList.begin(); it != aPointList.end(); ++it )
{
points[v] = it->x;
points[v + 1] = it->y;
......@@ -815,7 +795,7 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
if( lineLength <= 0.0 )
return;
double scale = 0.5 * lineWidth / lineLength;
// The perpendicular vector also needs transformations
......@@ -941,8 +921,7 @@ void OPENGL_GAL::initGlew()
if( GLEW_OK != err )
{
DisplayError( parentWindow, wxString::FromUTF8( (char*) glewGetErrorString( err ) ) );
exit( 1 );
throw std::runtime_error( (const char*) glewGetErrorString( err ) );
}
else
{
......@@ -952,30 +931,17 @@ void OPENGL_GAL::initGlew()
// Check the OpenGL version (minimum 2.1 is required)
if( GLEW_VERSION_2_1 )
{
wxLogInfo( wxT( "OpenGL 2.1 supported." ) );
}
else
{
DisplayError( parentWindow, wxT( "OpenGL 2.1 or higher is required!" ) );
exit( 1 );
}
throw std::runtime_error( "OpenGL 2.1 or higher is required!" );
// Framebuffers have to be supported
if( !GLEW_EXT_framebuffer_object )
{
DisplayError( parentWindow, wxT( "Framebuffer objects are not supported!" ) );
exit( 1 );
}
throw std::runtime_error( "Framebuffer objects are not supported!" );
// Vertex buffer has to be supported
if( !GLEW_ARB_vertex_buffer_object )
{
DisplayError( parentWindow, wxT( "Vertex buffer objects are not supported!" ) );
exit( 1 );
}
isGlewInitialized = true;
throw std::runtime_error( "Vertex buffer objects are not supported!" );
}
......@@ -1058,12 +1024,8 @@ void CALLBACK EdgeCallback( GLboolean aEdgeFlag )
void CALLBACK ErrorCallback( GLenum aErrorCode )
{
const GLubyte* eString = gluErrorString( aErrorCode );
DisplayError( NULL, wxT( "Tessellation error: " ) +
wxString( (const char*)( eString ), wxConvUTF8 ) );
exit( 1 );
//throw std::runtime_error( std::string( "Tessellation error: " ) +
//std::string( (const char*) gluErrorString( aErrorCode ) );
}
......
......@@ -28,10 +28,10 @@
#include <iostream>
#include <fstream>
#include <stdexcept>
#include <wx/log.h>
#include <wx/gdicmn.h>
#include <confirm.h>
#include <cstring>
#include <cassert>
#include <gal/opengl/shader.h>
#include "shader_src.h"
......@@ -55,7 +55,7 @@ SHADER::~SHADER()
{
// Delete the shaders and the program
for( std::deque<GLuint>::iterator it = shaderNumbers.begin(); it != shaderNumbers.end();
it++ )
++it )
{
glDeleteShader( *it );
}
......@@ -102,8 +102,7 @@ bool SHADER::Link()
glGetObjectParameterivARB( programNumber, GL_OBJECT_LINK_STATUS_ARB,
(GLint*) &isShaderLinked );
#ifdef __WXDEBUG__
#ifdef DEBUG
if( !isShaderLinked )
{
int maxLength;
......@@ -115,8 +114,7 @@ bool SHADER::Link()
std::cerr << linkInfoLog;
delete[] linkInfoLog;
}
#endif /* __WXDEBUG__ */
#endif /* DEBUG */
return isShaderLinked;
}
......@@ -127,9 +125,7 @@ int SHADER::AddParameter( const std::string& aParameterName )
GLint location = glGetUniformLocation( programNumber, aParameterName.c_str() );
if( location != -1 )
{
parameterLocation.push_back( location );
}
return location;
}
......@@ -167,7 +163,7 @@ void SHADER::programInfo( GLuint aProgram )
GLchar* glInfoLog = new GLchar[glInfoLogLength];
glGetProgramInfoLog( aProgram, glInfoLogLength, &writtenChars, glInfoLog );
wxLogInfo( wxString::FromUTF8( (char*) glInfoLog ) );
std::cerr << glInfoLog << std::endl;
delete[] glInfoLog;
}
......@@ -188,7 +184,7 @@ void SHADER::shaderInfo( GLuint aShader )
GLchar* glInfoLog = new GLchar[glInfoLogLength];
glGetShaderInfoLog( aShader, glInfoLogLength, &writtenChars, glInfoLog );
wxLogInfo( wxString::FromUTF8( (char*) glInfoLog ) );
std::cerr << glInfoLog << std::endl;
delete[] glInfoLog;
}
......@@ -202,11 +198,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
std::string shaderSource;
if( !inputFile )
{
DisplayError( NULL, wxString::FromUTF8( "Can't read the shader source: " ) +
wxString( aShaderSourceName.c_str(), wxConvUTF8 ) );
exit( 1 );
}
throw std::runtime_error( "Can't read the shader source: " + aShaderSourceName );
std::string shaderSourceLine;
......@@ -223,10 +215,7 @@ std::string SHADER::readSource( std::string aShaderSourceName )
bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderType )
{
if( isShaderLinked )
{
wxLogDebug( wxT( "Shader is already linked!" ) );
}
assert( !isShaderLinked );
// Create the program
if( !isProgramCreated )
......@@ -244,7 +233,7 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
// Copy to char array
char* source = new char[aShaderSource.size() + 1];
strcpy( source, aShaderSource.c_str() );
strncpy( source, aShaderSource.c_str(), aShaderSource.size() + 1 );
const char** source_ = (const char**) ( &source );
// Attach the source
......@@ -261,11 +250,8 @@ bool SHADER::addSource( const std::string& aShaderSource, SHADER_TYPE aShaderTyp
if( status != GL_TRUE )
{
DisplayError( NULL, wxT( "Shader compilation error" ) );
shaderInfo( shaderNumber );
return false;
throw std::runtime_error( "Shader compilation error" );
}
glAttachShader( programNumber, shaderNumber );
......
......@@ -231,13 +231,13 @@ int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength,
while( isdigit( *str1 ) )
{
nb1 = nb1 * 10 + (int) *str1 - '0';
str1++;
++str1;
}
while( isdigit( *str2 ) )
{
nb2 = nb2 * 10 + (int) *str2 - '0';
str2++;
++str2;
}
if( nb1 < nb2 )
......@@ -270,8 +270,8 @@ int StrNumCmp( const wxString& aString1, const wxString& aString2, int aLength,
return 0;
}
str1++;
str2++;
++str1;
++str2;
}
return 0;
......
......@@ -222,22 +222,20 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
if( !evt ) {
if( !evt )
{
// Try to find the submenu which holds the selected item
wxMenu*menu = NULL;
wxMenu* menu = NULL;
FindItem( m_selected, &menu );
if( menu )
if( menu && menu != this )
{
menu->ProcessEvent( aEvent );
return;
}
assert( false ); // The event should be handled above
}
#else
#endif
evt = m_customHandler( aEvent );
#endif /* else __WINDOWS__ */
// Handling non-action menu entries (e.g. items in clarification list)
if( !evt )
......
......@@ -101,7 +101,7 @@ struct TOOL_MANAGER::TOOL_STATE
CONTEXT_MENU_TRIGGER contextMenuTrigger;
/// Tool execution context
COROUTINE<int, TOOL_EVENT&>* cofunc;
COROUTINE<int, const TOOL_EVENT&>* cofunc;
/// The event that triggered the execution/wakeup of the tool after Wait() call
TOOL_EVENT wakeupEvent;
......@@ -464,7 +464,7 @@ optional<TOOL_EVENT> TOOL_MANAGER::ScheduleWait( TOOL_BASE* aTool,
}
void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
void TOOL_MANAGER::dispatchInternal( const TOOL_EVENT& aEvent )
{
// iterate over all registered tools
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
......@@ -512,7 +512,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
// as the state changes, the transition table has to be set up again
st->transitions.clear();
st->cofunc = new COROUTINE<int, TOOL_EVENT&>( tr.second );
st->cofunc = new COROUTINE<int, const TOOL_EVENT&>( tr.second );
// got match? Run the handler.
st->cofunc->Call( aEvent );
......@@ -529,7 +529,7 @@ void TOOL_MANAGER::dispatchInternal( TOOL_EVENT& aEvent )
}
bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::dispatchStandardEvents( const TOOL_EVENT& aEvent )
{
if( aEvent.Action() == TA_KEY_PRESSED )
{
......@@ -542,7 +542,7 @@ bool TOOL_MANAGER::dispatchStandardEvents( TOOL_EVENT& aEvent )
}
bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::dispatchActivation( const TOOL_EVENT& aEvent )
{
if( aEvent.IsActivate() )
{
......@@ -559,7 +559,7 @@ bool TOOL_MANAGER::dispatchActivation( TOOL_EVENT& aEvent )
}
void TOOL_MANAGER::dispatchContextMenu( TOOL_EVENT& aEvent )
void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
{
BOOST_FOREACH( TOOL_ID toolId, m_activeTools )
{
......@@ -614,7 +614,7 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
}
bool TOOL_MANAGER::ProcessEvent( TOOL_EVENT& aEvent )
bool TOOL_MANAGER::ProcessEvent( const TOOL_EVENT& aEvent )
{
// Early dispatch of events destined for the TOOL_MANAGER
if( !dispatchStandardEvents( aEvent ) )
......
......@@ -179,7 +179,6 @@ class COMPONENTS_LISTBOX : public ITEMS_LISTBOX_BASE
{
public:
wxArrayString m_ComponentList;
CVPCB_MAINFRAME* m_Parent;
public:
......
......@@ -756,7 +756,7 @@ bool PART_LIB::SaveHeader( OUTPUTFORMATTER& aFormatter )
}
PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR )
PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer )
{
std::auto_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_EESCHEMA, aFileName ) );
......@@ -784,7 +784,7 @@ PART_LIB* PART_LIB::LoadLibrary( const wxString& aFileName ) throw( IO_ERROR )
}
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName ) throw( IO_ERROR )
PART_LIB* PART_LIBS::AddLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer )
{
PART_LIB* lib;
......@@ -979,7 +979,8 @@ void PART_LIBS::RemoveCacheLibrary()
void PART_LIBS::LibNamesAndPaths( PROJECT* aProject, bool doSave,
wxString* aPaths, wxArrayString* aNames ) throw( IO_ERROR )
wxString* aPaths, wxArrayString* aNames )
throw( IO_ERROR, boost::bad_pointer )
{
wxString pro = aProject->GetProjectFullName();
......
......@@ -123,7 +123,7 @@ public:
* @param aFileName - File name object of part library.
* @throw IO_ERROR if there's any problem loading.
*/
PART_LIB* AddLibrary( const wxString& aFileName ) throw( IO_ERROR );
PART_LIB* AddLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer );
/**
* Function AddLibrary
......@@ -160,7 +160,8 @@ public:
* (without paths).
*/
static void LibNamesAndPaths( PROJECT* aProject, bool doSave,
wxString* aPaths, wxArrayString* aNames=NULL ) throw( IO_ERROR );
wxString* aPaths, wxArrayString* aNames=NULL )
throw( IO_ERROR, boost::bad_pointer );
/**
* Function cacheName
......@@ -545,7 +546,7 @@ public:
* the caller.
* @throw IO_ERROR if there's any problem loading the library.
*/
static PART_LIB* LoadLibrary( const wxString& aFileName ) throw( IO_ERROR );
static PART_LIB* LoadLibrary( const wxString& aFileName ) throw( IO_ERROR, boost::bad_pointer );
};
......
......@@ -81,7 +81,16 @@ void DIALOG_CHOOSE_COMPONENT::OnSearchBoxChange( wxCommandEvent& aEvent )
{
m_search_container->UpdateSearchTerm( m_searchBox->GetLineText( 0 ) );
updateSelection();
// On Windows, but not on Linux, the focus is given to
// the m_libraryComponentTree, after modificatuons.
// We want the focus for m_searchBox.
//
// We cannot call SetFocus on Linux because it changes the current text selection
// and the text edit cursor position.
#ifdef __WINDOWS__
m_searchBox->SetFocus();
#endif
}
......
......@@ -142,6 +142,8 @@ GBR_TO_PCB_EXPORTER::GBR_TO_PCB_EXPORTER( GERBVIEW_FRAME* aFrame, const wxString
{
m_gerbview_frame = aFrame;
m_pcb_file_name = aFileName;
m_fp = NULL;
m_pcbCopperLayersCount = 2;
}
......
......@@ -66,7 +66,7 @@ public:
* Switches method of rendering graphics.
* @param aGalType is a type of rendering engine that you want to use.
*/
void SwitchBackend( GalType aGalType );
bool SwitchBackend( GalType aGalType );
/**
* Function GetBackend
......
......@@ -31,6 +31,7 @@
#include <map>
#include <io_mgr.h>
#include <project.h>
#include <boost/interprocess/exceptions.hpp>
#define FP_LATE_ENVVAR 1 ///< late=1/early=0 environment variable expansion
......@@ -221,7 +222,7 @@ public:
* Actual indentation will be 2 spaces for each nestLevel.
*/
void Format( OUTPUTFORMATTER* out, int nestLevel ) const
throw( IO_ERROR );
throw( IO_ERROR, boost::interprocess::lock_exception );
private:
......@@ -468,7 +469,7 @@ public:
* @throw PARSE_ERROR if @a aFootprintId is not parsed OK.
*/
MODULE* FootprintLoadWithOptionalNickname( const FPID& aFootprintId )
throw( IO_ERROR, PARSE_ERROR );
throw( IO_ERROR, PARSE_ERROR, boost::interprocess::lock_exception );
/**
* Function GetDescription
......
......@@ -277,9 +277,7 @@ private:
SHADER shader; ///< There is only one shader used for different objects
// Internal flags
bool isGlewInitialized; ///< Is GLEW initialized?
bool isFramebufferInitialized; ///< Are the framebuffers initialized?
bool isShaderInitialized; ///< Was the shader initialized?
bool isGrouping; ///< Was a group started?
// Polygon tesselation
......
......@@ -71,7 +71,8 @@ public:
{
}
MSG_PANEL_ITEM()
MSG_PANEL_ITEM() :
m_Pad( MSG_PANEL_DEFAULT_PAD )
{
}
......
......@@ -51,7 +51,7 @@ enum TOOL_TYPE
/// Unique identifier for tools
typedef int TOOL_ID;
typedef DELEGATE<int, TOOL_EVENT&> TOOL_STATE_FUNC;
typedef DELEGATE<int, const TOOL_EVENT&> TOOL_STATE_FUNC;
/**
* Class TOOL_BASE
......
......@@ -70,7 +70,7 @@ public:
* No conditions means any event.
*/
template <class T>
void Go( int (T::* aStateFunc)( TOOL_EVENT& ),
void Go( int (T::* aStateFunc)( const TOOL_EVENT& ),
const TOOL_EVENT_LIST& aConditions = TOOL_EVENT( TC_ANY, TA_ANY ) );
/**
......@@ -110,7 +110,7 @@ private:
// hide TOOL_MANAGER implementation
template <class T>
void TOOL_INTERACTIVE::Go( int (T::* aStateFunc)( TOOL_EVENT& ),
void TOOL_INTERACTIVE::Go( int (T::* aStateFunc)( const TOOL_EVENT& ),
const TOOL_EVENT_LIST& aConditions )
{
TOOL_STATE_FUNC sptr( static_cast<T*>( this ), aStateFunc );
......
......@@ -169,7 +169,7 @@ public:
* Propagates an event to tools that requested events of matching type(s).
* @param aEvent is the event to be processed.
*/
bool ProcessEvent( TOOL_EVENT& aEvent );
bool ProcessEvent( const TOOL_EVENT& aEvent );
/**
* Puts an event to the event queue to be processed at the end of event processing cycle.
......@@ -309,7 +309,7 @@ private:
* Function dispatchInternal
* Passes an event at first to the active tools, then to all others.
*/
void dispatchInternal( TOOL_EVENT& aEvent );
void dispatchInternal( const TOOL_EVENT& aEvent );
/**
* Function dispatchStandardEvents()
......@@ -317,7 +317,7 @@ private:
* @param aEvent is the event to be processed.
* @return False if the event was processed and should not go any further.
*/
bool dispatchStandardEvents( TOOL_EVENT& aEvent );
bool dispatchStandardEvents( const TOOL_EVENT& aEvent );
/**
* Function dispatchActivation()
......@@ -325,13 +325,13 @@ private:
* @param aEvent is an event to be tested.
* @return True if a tool was invoked, false otherwise.
*/
bool dispatchActivation( TOOL_EVENT& aEvent );
bool dispatchActivation( const TOOL_EVENT& aEvent );
/**
* Function dispatchContextMenu()
* Handles context menu related events.
*/
void dispatchContextMenu( TOOL_EVENT& aEvent );
void dispatchContextMenu( const TOOL_EVENT& aEvent );
/**
* Function invokeTool()
......
......@@ -492,7 +492,14 @@ public:
{
wxASSERT( aLayer < (int) m_layers.size() );
return m_layers.at( aLayer ).target == TARGET_CACHED;
try
{
return m_layers.at( aLayer ).target == TARGET_CACHED;
}
catch( std::out_of_range )
{
return false;
}
}
/**
......
......@@ -848,12 +848,14 @@ public:
/**
* Function AppendBoardFile
* appends a board file onto the current one, creating God knows what.
* the main purpose is only to allow panelizing boards.
*/
bool AppendBoardFile( const wxString& aFullFileName, int aCtl );
/**
* Function SavePcbFile
* writes the board data structures to \a a aFileName
* Creates backup when requested and update flags (modified and saved flgs)
*
* @param aFileName The file name to write or wxEmptyString to prompt user for
* file name.
......@@ -864,8 +866,18 @@ public:
*/
bool SavePcbFile( const wxString& aFileName, bool aCreateBackupFile = CREATE_BACKUP_FILE );
int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File );
/**
* Function SavePcbCopy
* writes the board data structures to \a a aFileName
* but unlike SavePcbFile, does not make anything else
* (no backup, borad fliename change, no flag changes ...)
* Used under a project mgr to save under a new name the current board
*
* When not under a project mgr, the full SavePcbFile is used.
* @param aFileName The file name to write.
* @return True if file was saved successfully.
*/
bool SavePcbCopy( const wxString& aFileName );
// BOARD handling
......
......@@ -170,6 +170,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList();
idx = m_treePagelayout->GetSelectedItemIndex();
item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_SEGMENT, idx );
if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
{
RemoveLastCommandInUndoList();
......@@ -199,6 +200,7 @@ void PL_EDITOR_FRAME::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList();
idx = m_treePagelayout->GetSelectedItemIndex();
item = AddPageLayoutItem( WORKSHEET_DATAITEM::WS_RECT, idx );
if( InvokeDialogNewItem( this, item ) == wxID_CANCEL )
{
RemoveLastCommandInUndoList();
......@@ -353,10 +355,11 @@ static void moveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPositio
// (does not happen each time the mouse is moved, because the
// item is placed on grid)
// to avoid useless computation time.
if( aPanel && ( previous_position != position ) )
if( previous_position != position )
aPanel->Refresh();
}
/*
* Function abortMoveItem: called when an item is currently moving,
* and when the user aborts the move command.
......@@ -367,7 +370,7 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
PL_EDITOR_SCREEN* screen = (PL_EDITOR_SCREEN*) aPanel->GetScreen();
WORKSHEET_DATAITEM *item = screen->GetCurItem();
if( (item->GetFlags() & NEW_ITEM ) )
if( item->GetFlags() & NEW_ITEM )
{
PL_EDITOR_FRAME* plframe = (PL_EDITOR_FRAME*) aPanel->GetParent();
plframe->RemoveLastCommandInUndoList();
......@@ -394,6 +397,7 @@ static void abortMoveItem( EDA_DRAW_PANEL* aPanel, wxDC* aDC )
aPanel->Refresh();
}
void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
{
wxCHECK_RET( aItem != NULL, wxT( "Cannot move NULL item" ) );
......@@ -411,6 +415,7 @@ void PL_EDITOR_FRAME::MoveItem( WORKSHEET_DATAITEM* aItem )
{
SetCrossHairPosition( initialPositionUi, false );
initialCursorPosition = GetCrossHairPosition();
if( m_canvas->IsPointOnDisplay( initialCursorPosition ) )
{
m_canvas->MoveCursorToCrossHair();
......@@ -443,7 +448,7 @@ void PL_EDITOR_FRAME::PlaceItem( WORKSHEET_DATAITEM* aItem )
{
aItem->MoveStartPointTo( initialPosition );
}
else if( (aItem->GetFlags() & LOCATE_ENDPOINT) )
else if( aItem->GetFlags() & LOCATE_ENDPOINT )
{
aItem->MoveEndPointTo( initialPosition );
}
......@@ -471,12 +476,14 @@ void PL_EDITOR_FRAME::OnSelectCoordOriginCorner( wxCommandEvent& event )
m_canvas->Refresh();
}
void PL_EDITOR_FRAME::OnSelectTitleBlockDisplayMode( wxCommandEvent& event )
{
WORKSHEET_DATAITEM::m_SpecialMode = (event.GetId() == ID_SHOW_PL_EDITOR_MODE);
m_canvas->Refresh();
}
void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
{
Close( true );
......@@ -485,7 +492,7 @@ void PL_EDITOR_FRAME::OnQuit( wxCommandEvent& event )
void PL_EDITOR_FRAME::ToPlotter(wxCommandEvent& event)
{
wxMessageBox( wxT("Not yet available"));
wxMessageBox( wxT( "Not yet available" ) );
}
......@@ -533,6 +540,7 @@ void PL_EDITOR_FRAME::ToPrinter(wxCommandEvent& event)
InvokeDialogPrint( this, s_PrintData, s_pageSetupData );
}
void PL_EDITOR_FRAME::OnTreeSelection( wxTreeEvent& event )
{
WORKSHEET_DATAITEM* item = GetSelectedItem();
......@@ -543,11 +551,15 @@ void PL_EDITOR_FRAME::OnTreeSelection( wxTreeEvent& event )
m_canvas->Refresh();
}
void PL_EDITOR_FRAME::OnTreeMiddleClick( wxTreeEvent& event )
{
}
extern void AddNewItemsCommand( wxMenu* aMainMenu );
void PL_EDITOR_FRAME::OnTreeRightClick( wxTreeEvent& event )
{
m_treePagelayout->SelectCell( event.GetItem() );
......@@ -568,6 +580,7 @@ void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplayNormalMode( wxUpdateUIEvent& even
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == false );
}
void PL_EDITOR_FRAME::OnUpdateTitleBlockDisplaySpecialMode( wxUpdateUIEvent& event )
{
event.Check( WORKSHEET_DATAITEM::m_SpecialMode == true );
......
......@@ -358,7 +358,7 @@ void RECTWAVEGUIDE::show_results()
continue;
if( f >= ( fc( m, n ) ) )
{
sprintf( txt, "H(%u,%u) ", m, n );
sprintf( txt, "H(%d,%d) ", m, n );
if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN )
strcat( text, txt );
else
......@@ -384,7 +384,7 @@ void RECTWAVEGUIDE::show_results()
{
if( f >= fc( m, n ) )
{
sprintf( txt, "E(%u,%u) ", m, n );
sprintf( txt, "E(%d,%d) ", m, n );
if( (strlen( text ) + strlen( txt ) + 5) < MAXSTRLEN )
strcat( text, txt );
else
......
......@@ -314,6 +314,32 @@ bool BOARD::SetLayerDescr( LAYER_ID aIndex, const LAYER& aLayer )
return false;
}
#include <stdio.h>
const LAYER_ID BOARD::GetLayerID(wxString aLayerName) const
{
// Look for the BOARD specific copper layer names
for( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
{
if ( IsCopperLayer( layer ) &&
( m_Layer[ layer ].m_name == aLayerName) )
{
return ToLAYER_ID( layer );
}
}
// Otherwise fall back to the system standard layer names
for ( LAYER_NUM layer = 0; layer < LAYER_ID_COUNT; ++layer )
{
if ( GetStandardLayerName( ToLAYER_ID( layer ) ) == aLayerName )
{
return ToLAYER_ID( layer );
}
}
return UNDEFINED_LAYER;
}
const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
{
......@@ -331,7 +357,6 @@ const wxString BOARD::GetLayerName( LAYER_ID aLayer ) const
return GetStandardLayerName( aLayer );
}
bool BOARD::SetLayerName( LAYER_ID aLayer, const wxString& aLayerName )
{
if( !IsCopperLayer( aLayer ) )
......@@ -2179,7 +2204,6 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
wxString msg;
D_PAD* pad;
MODULE* footprint;
COMPONENT_NET net;
if( !IsEmpty() )
{
......@@ -2375,24 +2399,21 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// At this point, the component footprint is updated. Now update the nets.
for( pad = footprint->Pads(); pad; pad = pad->Next() )
{
net = component->GetNet( pad->GetPadName() );
COMPONENT_NET net = component->GetNet( pad->GetPadName() );
if( !net.IsValid() ) // Footprint pad had no net.
{
if( !pad->GetNetname().IsEmpty() )
if( aReporter && aReporter->ReportAll() && !pad->GetNetname().IsEmpty() )
{
if( aReporter && aReporter->ReportAll() )
{
msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( pad->GetPadName() ) );
aReporter->Report( msg );
}
if( !aNetlist.IsDryRun() )
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
msg.Printf( _( "Clearing component \"%s:%s\" pin \"%s\" net name.\n" ),
GetChars( footprint->GetReference() ),
GetChars( footprint->GetPath() ),
GetChars( pad->GetPadName() ) );
aReporter->Report( msg );
}
if( !aNetlist.IsDryRun() )
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
else // Footprint pad has a net.
{
......@@ -2559,7 +2580,7 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// Explore all pins/pads in component
for( unsigned jj = 0; jj < component->GetNetCount(); jj++ )
{
net = component->GetNet( jj );
COMPONENT_NET net = component->GetNet( jj );
padname = net.GetPinName();
if( footprint->FindPadByName( padname ) )
......
......@@ -621,6 +621,18 @@ public:
*/
void ConvertBrdLayerToPolygonalContours( LAYER_ID aLayer, CPOLYGONS_LIST& aOutlines );
/**
* Function GetLayerID
* returns the ID of a layer given by aLayerName. Copper layers may
* have custom names.
*
* @param aLayerName = A layer name, like wxT("B.Cu"), etc.
*
* @return LAYER_ID - the layer id, which for copper layers may
* be custom, else standard.
*/
const LAYER_ID GetLayerID( wxString aLayerName ) const;
/**
* Function GetLayerName
* returns the name of a layer given by aLayer. Copper layers may
......
......@@ -50,7 +50,10 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem )
void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
{
// assert( aNetCode >= 0 );
// if aNetCode < 0 ( typically NETINFO_LIST::FORCE_ORPHANED )
// or no parent board,
// set the m_netinfo to the dummy NETINFO_LIST::ORPHANED
BOARD* board = GetBoard();
if( ( aNetCode >= 0 ) && board )
......
......@@ -82,6 +82,8 @@ BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :
m_PcbTextSize = wxSize( DEFAULT_TEXT_PCB_SIZE,
DEFAULT_TEXT_PCB_SIZE ); // current Pcb (not module) Text size
m_useCustomTrackVia = false;
m_customTrackWidth = DMils2iu( 100 );
m_TrackMinWidth = DMils2iu( 100 ); // track min value for width (min copper size value)
m_ViasMinSize = DMils2iu( 350 ); // vias (not micro vias) min diameter
m_ViasMinDrill = DMils2iu( 200 ); // vias (not micro vias) min drill diameter
......
......@@ -529,8 +529,11 @@ bool DRAWSEGMENT::HitTest( const wxPoint& aPosition ) const
return true;
break;
case S_POLYGON: // not yet handled
break;
default:
wxASSERT( 0 );
wxASSERT_MSG( 0, wxString::Format( "unknown DRAWSEGMENT shape: %d", m_Shape ) );
break;
}
......@@ -582,9 +585,15 @@ bool DRAWSEGMENT::HitTest( const EDA_RECT& aRect, bool aContained, int aAccuracy
break;
case S_CURVE:
case S_POLYGON: // not yet handled
break;
default:
;
wxASSERT_MSG( 0, wxString::Format( "unknown DRAWSEGMENT shape: %d", m_Shape ) );
break;
}
return false;
}
......
......@@ -112,8 +112,6 @@ MODULE::MODULE( const MODULE& aModule ) :
m_Value->SetParent( this );
// Copy auxiliary data: Pads
// m_Pads.DeleteAll();
for( D_PAD* pad = aModule.m_Pads; pad; pad = pad->Next() )
{
D_PAD* newpad = new D_PAD( *pad );
......@@ -800,14 +798,21 @@ EDA_ITEM* MODULE::Clone() const
void MODULE::RunOnChildren( boost::function<void (BOARD_ITEM*)> aFunction )
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
aFunction( static_cast<BOARD_ITEM*>( pad ) );
try
{
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
aFunction( static_cast<BOARD_ITEM*>( pad ) );
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
aFunction( drawing );
for( BOARD_ITEM* drawing = m_Drawings; drawing; drawing = drawing->Next() )
aFunction( drawing );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
aFunction( static_cast<BOARD_ITEM*>( m_Reference ) );
aFunction( static_cast<BOARD_ITEM*>( m_Value ) );
}
catch( boost::bad_function_call& e )
{
DisplayError( NULL, wxT( "Error running MODULE::RunOnChildren" ) );
}
}
......
......@@ -320,9 +320,14 @@ public:
return NULL;
}
///> Constant that holds the unconnected net number (typically 0)
///> Constant that holds the "unconnected net" number (typically 0)
///> all items "connected" to this net are actually not connected items
static const int UNCONNECTED;
///> Constant that forces initialization of a netinfo item to the NETINFO_ITEM ORPHANED
///> (typically -1) when calling SetNetCode od board connected items
static const int FORCE_ORPHANED;
///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no
///> board storing net list available.
static NETINFO_ITEM ORPHANED;
......
......@@ -292,4 +292,6 @@ NETINFO_ITEM* NETINFO_MAPPING::iterator::operator->() const
const int NETINFO_LIST::UNCONNECTED = 0;
const int NETINFO_LIST::FORCE_ORPHANED = -1;
NETINFO_ITEM NETINFO_LIST::ORPHANED = NETINFO_ITEM( NULL, wxEmptyString, NETINFO_LIST::UNCONNECTED );
......@@ -25,6 +25,8 @@
#include <collectors.h>
#include <pcbnew.h>
#include <tools/common_actions.h>
#include <pcb_draw_panel_gal.h>
/* Execute a remote command send by Eeschema via a socket,
* port KICAD_PCB_PORT_SERVICE_NUMBER
......@@ -127,8 +129,17 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
if( module ) // if found, center the module on screen, and redraw the screen.
{
SetCrossHairPosition( pos );
RedrawScreen( pos, false );
if( IsGalCanvasActive() )
{
GetGalCanvas()->GetView()->SetCenter( VECTOR2D( module->GetPosition() ) );
m_toolManager->RunAction( COMMON_ACTIONS::selectionClear, true );
m_toolManager->RunAction( COMMON_ACTIONS::selectItem, true, module );
}
else
{
SetCrossHairPosition( pos );
RedrawScreen( pos, false );
}
}
}
......
......@@ -27,6 +27,10 @@
DIALOG_ENUM_PADS::DIALOG_ENUM_PADS( wxWindow* aParent ) :
DIALOG_ENUM_PADS_BASE( aParent )
{
// Calling SetSizeHints after all widgets are built is mandatory
// to set the correct size of the dialog
GetSizer()->SetSizeHints( this );
Center();
}
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -9,43 +9,46 @@
///////////////////////////////////////////////////////////////////////////
DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bPrefixSizer;
bPrefixSizer = new wxBoxSizer( wxHORIZONTAL );
m_lblInfo = new wxStaticText( this, wxID_ANY, _("Pad names are restricted to 4 characters (including number)."), wxDefaultPosition, wxDefaultSize, 0 );
m_lblInfo->Wrap( -1 );
bMainSizer->Add( m_lblInfo, 0, wxALL|wxALIGN_CENTER_HORIZONTAL, 5 );
bMainSizer->Add( 0, 0, 0, wxTOP|wxBOTTOM, 5 );
wxFlexGridSizer* fgSizer;
fgSizer = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizer->AddGrowableCol( 1 );
fgSizer->SetFlexibleDirection( wxBOTH );
fgSizer->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_lblPadPrefix = new wxStaticText( this, wxID_ANY, _("Pad name prefix:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblPadPrefix->Wrap( -1 );
bPrefixSizer->Add( m_lblPadPrefix, 1, wxALL, 5 );
fgSizer->Add( m_lblPadPrefix, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_padPrefix = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, 0 );
m_padPrefix->SetMaxLength( 4 );
bPrefixSizer->Add( m_padPrefix, 0, wxALL, 5 );
bMainSizer->Add( bPrefixSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bPadNumSizer;
bPadNumSizer = new wxBoxSizer( wxHORIZONTAL );
fgSizer->Add( m_padPrefix, 0, wxALL|wxEXPAND|wxALIGN_CENTER_VERTICAL, 5 );
m_lblPadStartNum = new wxStaticText( this, wxID_ANY, _("First pad number:"), wxDefaultPosition, wxDefaultSize, 0 );
m_lblPadStartNum->Wrap( -1 );
bPadNumSizer->Add( m_lblPadStartNum, 1, wxALL, 5 );
fgSizer->Add( m_lblPadStartNum, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_padStartNum = new wxSpinCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxDefaultSize, wxSP_ARROW_KEYS, 0, 999, 1 );
bPadNumSizer->Add( m_padStartNum, 0, wxALL, 5 );
fgSizer->Add( m_padStartNum, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bPadNumSizer, 1, wxEXPAND, 5 );
bMainSizer->Add( fgSizer, 1, wxEXPAND|wxALL, 5 );
m_lblInfo = new wxStaticText( this, wxID_ANY, _("Pad names are restricted to 4 characters (including number)."), wxDefaultPosition, wxDefaultSize, 0 );
m_lblInfo->Wrap( 320 );
bMainSizer->Add( m_lblInfo, 0, wxALL, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_stdButtons = new wxStdDialogButtonSizer();
m_stdButtonsOK = new wxButton( this, wxID_OK );
......@@ -54,7 +57,7 @@ DIALOG_ENUM_PADS_BASE::DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id, c
m_stdButtons->AddButton( m_stdButtonsCancel );
m_stdButtons->Realize();
bMainSizer->Add( m_stdButtons, 2, wxEXPAND, 5 );
bMainSizer->Add( m_stdButtons, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
......
This diff is collapsed.
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 30 2013)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -11,6 +11,9 @@
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
class DIALOG_SHIM;
#include "dialog_shim.h"
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
......@@ -18,8 +21,9 @@
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/sizer.h>
#include <wx/statline.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -29,23 +33,24 @@
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_ENUM_PADS_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_ENUM_PADS_BASE : public wxDialog
class DIALOG_ENUM_PADS_BASE : public DIALOG_SHIM
{
private:
protected:
wxStaticText* m_lblInfo;
wxStaticText* m_lblPadPrefix;
wxTextCtrl* m_padPrefix;
wxStaticText* m_lblPadStartNum;
wxSpinCtrl* m_padStartNum;
wxStaticText* m_lblInfo;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_stdButtons;
wxButton* m_stdButtonsOK;
wxButton* m_stdButtonsCancel;
public:
DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pad enumeration settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,240 ), long style = wxDEFAULT_DIALOG_STYLE );
DIALOG_ENUM_PADS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Pad enumeration settings"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 340,187 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_ENUM_PADS_BASE();
};
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -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">
......@@ -236,7 +238,88 @@
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxEXPAND | wxALL</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_ANY</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_staticline1</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style">wxLI_HORIZONTAL</property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">0</property>
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">0</property>
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -51,6 +51,9 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
bSizerMain->Add( m_footprintWizardsGrid, 1, wxALL|wxEXPAND, 5 );
m_staticline1 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerMain->Add( m_staticline1, 0, wxEXPAND | wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
......@@ -58,7 +61,7 @@ DIALOG_FOOTPRINT_WIZARD_LIST_BASE::DIALOG_FOOTPRINT_WIZARD_LIST_BASE( wxWindow*
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND, 5 );
bSizerMain->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bSizerMain );
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Oct 8 2012)
// C++ code generated with wxFormBuilder (version Jun 5 2014)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
......@@ -20,6 +20,7 @@ class DIALOG_SHIM;
#include <wx/font.h>
#include <wx/grid.h>
#include <wx/gdicmn.h>
#include <wx/statline.h>
#include <wx/sizer.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -36,6 +37,7 @@ class DIALOG_FOOTPRINT_WIZARD_LIST_BASE : public DIALOG_SHIM
protected:
wxGrid* m_footprintWizardsGrid;
wxStaticLine* m_staticline1;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
......
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<wxFormBuilder_Project>
<FileVersion major="1" minor="11" />
<FileVersion major="1" minor="13" />
<object class="Project" expanded="1">
<property name="class_decoration"></property>
<property name="code_generation">C++</property>
......@@ -44,7 +44,7 @@
<property name="minimum_size"></property>
<property name="name">DIALOG_FP_PLUGIN_OPTIONS_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="size">678,342</property>
<property name="style">wxCAPTION|wxCLOSE_BOX|wxDEFAULT_DIALOG_STYLE|wxMAXIMIZE_BOX|wxRESIZE_BORDER</property>
<property name="subclass">DIALOG_SHIM; dialog_shim.h</property>
<property name="title"></property>
......
......@@ -185,7 +185,11 @@ public:
colors[ VRML_COLOR_TIN ] = VRML_COLOR( .749, .756, .761, .749, .756, .761,
0, 0, 0, 0.8, 0, 0.8 );
precision = 5;
plainPCB = false;
SetScale( 1.0 );
SetOffset( 0.0, 0.0 );
s_text_layer = F_Cu;
s_text_width = 1;
}
VRML_COLOR& GetColor( VRML_COLOR_INDEX aIndex )
......@@ -889,11 +893,11 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
const CPOLYGONS_LIST& poly = zone->GetFilledPolysList();
int nvert = poly.GetCornersCount();
int i = 0;
bool cutout = false;
while( i < nvert )
{
int seg = vl->NewContour();
bool first = true;
if( seg < 0 )
break;
......@@ -914,10 +918,10 @@ static void export_vrml_zones( MODEL_VRML& aModel, BOARD* aPcb )
// KiCad ensures that the first polygon is the outline
// and all others are holes
vl->EnsureWinding( seg, first ? false : true );
vl->EnsureWinding( seg, cutout );
if( first )
first = false;
if( !cutout )
cutout = true;
++i;
}
......
......@@ -327,14 +327,20 @@ void PCB_EDIT_FRAME::Files_io( wxCommandEvent& event )
break;
}
// Fall through
case ID_SAVE_BOARD_AS:
case ID_COPY_BOARD_AS:
case ID_SAVE_BOARD_AS:
{
wxString pro_dir = wxPathOnly( Prj().GetProjectFullName() );
wxFileName fn( pro_dir, _( "noname" ), KiCadPcbFileExtension );
wxString filename = fn.GetFullPath();
if( AskSaveBoardFileName( this, &filename ) )
SavePcbFile( filename, true );
{
if( id == ID_COPY_BOARD_AS )
SavePcbCopy( filename );
else
SavePcbFile( filename, NO_BACKUP_FILE );
}
}
break;
......@@ -412,7 +418,7 @@ bool PCB_EDIT_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( response == wxID_CANCEL )
return false;
else if( response == wxID_YES )
SavePcbFile( GetBoard()->GetFileName(), true );
SavePcbFile( GetBoard()->GetFileName(), CREATE_BACKUP_FILE );
else
{
// response == wxID_NO, fall thru
......@@ -660,6 +666,8 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
wxString backupFileName;
// aCreateBackupFile == false is mainly used to write autosave files
// or new files in save as... command
if( aCreateBackupFile )
{
backupFileName = create_backup_file( aFileName );
......@@ -733,6 +741,58 @@ bool PCB_EDIT_FRAME::SavePcbFile( const wxString& aFileName, bool aCreateBackupF
}
bool PCB_EDIT_FRAME::SavePcbCopy( const wxString& aFileName )
{
wxFileName pcbFileName = aFileName;
// Ensure the file ext is the right ext:
pcbFileName.SetExt( KiCadPcbFileExtension );
if( !IsWritable( pcbFileName ) )
{
wxString msg = wxString::Format( _(
"No access rights to write to file '%s'" ),
GetChars( pcbFileName.GetFullPath() )
);
DisplayError( this, msg );
return false;
}
GetBoard()->m_Status_Pcb &= ~CONNEXION_OK;
GetBoard()->SynchronizeNetsAndNetClasses();
// Select default Netclass before writing file.
// Useful to save default values in headers
SetCurrentNetClass( NETCLASS::Default );
try
{
PLUGIN::RELEASER pi( IO_MGR::PluginFind( IO_MGR::KICAD ) );
wxASSERT( pcbFileName.IsAbsolute() );
pi->Save( pcbFileName.GetFullPath(), GetBoard(), NULL );
}
catch( const IO_ERROR& ioe )
{
wxString msg = wxString::Format( _(
"Error saving board file '%s'.\n%s" ),
GetChars( pcbFileName.GetFullPath() ),
GetChars( ioe.errorText )
);
DisplayError( this, msg );
return false;
}
DisplayInfoMessage( this, wxString::Format( _( "Board copied to:\n'%s'" ),
GetChars( pcbFileName.GetFullPath() ) ) );
return true;
}
bool PCB_EDIT_FRAME::doAutoSave()
{
wxFileName tmpFileName = Prj().AbsolutePath( GetBoard()->GetFileName() );
......
......@@ -110,8 +110,7 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
if( module )
{
// Add the object to board
module->SetParent( (EDA_ITEM*) GetBoard() );
GetBoard()->m_Modules.Append( module );
GetBoard()->Add( module, ADD_APPEND );
module->SetPosition( wxPoint( 0, 0 ) );
}
else
......
......@@ -379,7 +379,7 @@ void GITHUB_PLUGIN::FootprintLibOptions( PROPERTIES* aListToAppendTo ) const
}
void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aProperties ) throw( IO_ERROR )
void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aProperties )
{
// This is edge triggered based on a change in 'aLibraryPath',
// usually it does nothing. When the edge fires, m_pretty_dir is set
......
......@@ -200,7 +200,7 @@ protected:
void init( const PROPERTIES* aProperties );
void cacheLib( const wxString& aLibraryPath, const PROPERTIES* aProperties ) throw( IO_ERROR );
void cacheLib( const wxString& aLibraryPath, const PROPERTIES* aProperties );
/**
* Function repoURL_zipURL
......
......@@ -88,7 +88,6 @@ void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass )
class FP_CACHE_ITEM
{
wxFileName m_file_name; ///< The the full file name and path of the footprint to cache.
bool m_writable; ///< Writability status of the footprint file.
wxDateTime m_mod_time; ///< The last file modified time stamp.
std::auto_ptr<MODULE> m_module;
......
......@@ -98,7 +98,8 @@ void LEGACY_NETLIST_READER::LoadNetlist() throw ( IO_ERROR, PARSE_ERROR )
}
COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText ) throw( PARSE_ERROR )
COMPONENT* LEGACY_NETLIST_READER::loadComponent( char* aText )
throw( PARSE_ERROR, boost::bad_pointer )
{
char* text;
wxString msg;
......
......@@ -96,12 +96,13 @@ bool FOOTPRINT_EDIT_FRAME::Load_Module_From_BOARD( MODULE* aModule )
newModule->ClearFlags();
// Clear references to net info, because the footprint editor
// Clear references to any net info, because the footprint editor
// does know any thing about nets handled by the current edited board.
// Morever the main board can change or the net info relative to this main board
// can change while editing this footprint in the footprint editor
// Morever we do not want to save any reference to an unknown net when
// saving the footprint in lib cache
// so we force the ORPHANED dummy net info for all pads
for( D_PAD* pad = newModule->Pads(); pad; pad = pad->Next() )
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
pad->SetNetCode( NETINFO_LIST::FORCE_ORPHANED );
SetCrossHairPosition( wxPoint( 0, 0 ) );
PlaceModule( newModule, NULL );
......@@ -269,6 +270,7 @@ MODULE* PCB_BASE_FRAME::LoadModuleFromLibrary( const wxString& aLibrary,
if( module )
{
GetBoard()->Add( module, ADD_APPEND );
lastComponentName = moduleName;
AddHistoryComponentName( HistoryList, moduleName );
......@@ -328,7 +330,16 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const FPID& aFootprintId )
wxCHECK_MSG( fptbl, NULL, wxT( "Cannot look up FPID in NULL FP_LIB_TABLE." ) );
return fptbl->FootprintLoadWithOptionalNickname( aFootprintId );
MODULE* module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId );
// Clear all references to any net info, to be sure there is no broken links
// to any netinfo list (should be not needed, but...)
#if 0 // FIXME : currently crashes Pcbnew. should not.
for( D_PAD* pad = module->Pads(); pad; pad = pad->Next() )
pad->SetNetCode( NETINFO_LIST::FORCE_ORPHANED );
#endif
return module;
}
......
......@@ -111,14 +111,29 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Save current board" ),
KiBitmap( save_xpm ) );
if( Kiface().IsSingle() ) // not when under a project mgr
// Save as menu:
// under a project mgr we do not want to modify the board filename
// to keep consistency with the project mgr which expects files names same as prj name
// for main files
// when not under a project mgr, we are free to change filenames, cwd ...
if( Kiface().IsSingle() ) // not when under a project mgr (pcbnew is run as stand alone)
{
text = AddHotkeyName( _( "Sa&ve As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
AddMenuItem( filesMenu, ID_SAVE_BOARD_AS, text,
_( "Save the current board as..." ),
KiBitmap( save_as_xpm ) );
filesMenu->AppendSeparator();
}
// under a project mgr, we can save a copy of the board,
// but do not change the current board file name
else
{
text = AddHotkeyName( _( "Sa&ve Copy As..." ), g_Board_Editor_Hokeys_Descr, HK_SAVE_BOARD_AS );
AddMenuItem( filesMenu, ID_COPY_BOARD_AS, text,
_( "Save a copy of the current board as..." ),
KiBitmap( save_as_xpm ) );
}
filesMenu->AppendSeparator();
AddMenuItem( filesMenu, ID_MENU_READ_BOARD_BACKUP_FILE,
_( "Revert to Last" ),
......
......@@ -120,8 +120,8 @@ BOARD_ITEM* FOOTPRINT_EDIT_FRAME::ModeditLocateAndDisplay( int aHotKeyCode )
{
wxMenu itemMenu;
// Give a title to the selection menu. This is also a cancel menu item *
wxMenuItem* item_title = new wxMenuItem( &itemMenu, -1, _( "Selection Clarification" ) );
// Give a title to the selection menu. It also allow to close the popup menu without any action
wxMenuItem* item_title = new wxMenuItem( &itemMenu, wxID_NONE, _( "Selection Clarification" ) );
#ifdef __WINDOWS__
wxFont bold_font( *wxNORMAL_FONT );
......@@ -195,7 +195,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
{
int id = event.GetId();
wxPoint pos;
bool redraw = false;
INSTALL_UNBUFFERED_DC( dc, m_canvas );
......@@ -308,7 +307,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
if( GetBoard()->m_Modules )
......@@ -317,8 +315,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
Zoom_Automatique( false );
}
if( IsGalCanvasActive() )
updateView();
updateView();
m_canvas->Refresh();
GetScreen()->ClrModify();
}
......@@ -349,18 +347,18 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition( wxPoint( 0, 0 ) );
// Add the new object to board
module->SetParent( (EDA_ITEM*)GetBoard() );
GetBoard()->m_Modules.Append( module );
GetBoard()->Add( module, ADD_APPEND );
// Initialize data relative to nets and netclasses (for a new
// module the defaults are used)
// This is mandatory to handle and draw pads
GetBoard()->BuildListOfNets();
redraw = true;
module->SetPosition( wxPoint( 0, 0 ) );
module->ClearFlags();
Zoom_Automatique( false );
updateView();
m_canvas->Refresh();
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
......@@ -492,13 +490,13 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition( wxPoint( 0, 0 ) );
Import_Module();
redraw = true;
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
GetScreen()->ClrModify();
Zoom_Automatique( false );
m_canvas->Refresh();
if( m_Draw3DFrame )
m_Draw3DFrame->NewDisplay();
......@@ -532,7 +530,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
SetCrossHairPosition( wxPoint( 0, 0 ) );
LoadModuleFromLibrary( GetCurrentLib(), Prj().PcbFootprintLibs(), true );
redraw = true;
if( GetBoard()->m_Modules )
GetBoard()->m_Modules->ClearFlags();
......@@ -564,7 +561,9 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
m_Draw3DFrame->NewDisplay();
GetScreen()->ClrModify();
updateView();
m_canvas->Refresh();
break;
......@@ -600,24 +599,22 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_ROTATE_MODULE_COUNTERCLOCKWISE:
m_canvas->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), 900, true );
redraw = true;
m_canvas->Refresh();
break;
case ID_POPUP_PCB_ROTATE_MODULE_CLOCKWISE:
m_canvas->MoveCursorToCrossHair();
Rotate_Module( NULL, (MODULE*) GetScreen()->GetCurItem(), -900, true );
redraw = true;
m_canvas->Refresh();
break;
case ID_POPUP_PCB_EDIT_MODULE_PRMS:
{
DIALOG_MODULE_MODULE_EDITOR dialog( this, (MODULE*) GetScreen()->GetCurItem() );
int ret = dialog.ShowModal();
dialog.ShowModal();
GetScreen()->GetCurItem()->ClearFlags();
m_canvas->MoveCursorToCrossHair();
if( ret > 0 )
m_canvas->Refresh();
m_canvas->Refresh();
}
break;
......@@ -696,6 +693,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_MODEDIT_ENTER_EDGE_WIDTH:
{
EDGE_MODULE* edge = NULL;
if( GetScreen()->GetCurItem()
&& ( GetScreen()->GetCurItem()->Type() == PCB_MODULE_EDGE_T ) )
{
......@@ -739,7 +737,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_MODEDIT_MODULE_MIRROR:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Transform( (MODULE*) GetScreen()->GetCurItem(), id );
redraw = true;
m_canvas->Refresh();
break;
case ID_PCB_DRAWINGS_WIDTHS_SETUP:
......@@ -811,9 +809,6 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) );
break;
}
if( redraw )
m_canvas->Refresh();
}
......
......@@ -126,9 +126,9 @@ NETLIST_READER* NETLIST_READER::GetNetlistReader( NETLIST* aNetlist,
default: // Unrecognized format:
break;
}
delete cmpFileReader;
return NULL;
}
......
......@@ -214,7 +214,7 @@ class LEGACY_NETLIST_READER : public NETLIST_READER
* @return the new component created by parsing \a aLine
* @throw PARSE_ERROR when \a aLine is not a valid component description.
*/
COMPONENT* loadComponent( char* aText ) throw( PARSE_ERROR );
COMPONENT* loadComponent( char* aText ) throw( PARSE_ERROR, boost::bad_pointer );
/**
* Function loadFootprintFilters
......
......@@ -161,9 +161,10 @@ void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
// Add the new pad to end of the module pad list.
aModule->Pads().PushBack( pad );
// Update the pad properties.
// Update the pad properties,
// and keep NETINFO_LIST::ORPHANED as net info
// which is the default when nets cannot be handled.
Import_Pad_Settings( pad, false );
pad->SetNetCode( NETINFO_LIST::UNCONNECTED );
pad->SetPosition( GetCrossHairPosition() );
......
......@@ -300,7 +300,7 @@ void PCB_PARSER::parseEDA_TEXT( EDA_TEXT* aText ) throw( PARSE_ERROR )
}
S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR )
S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR, IO_ERROR )
{
wxCHECK_MSG( CurTok() == T_model, NULL,
wxT( "Cannot parse " ) + GetTokenString( CurTok() ) + wxT( " as S3D_MASTER." ) );
......
......@@ -185,7 +185,7 @@ class PCB_PARSER : public PCB_LEXER
*/
void parseEDA_TEXT( EDA_TEXT* aText ) throw( PARSE_ERROR );
S3D_MASTER* parse3DModel() throw( PARSE_ERROR );
S3D_MASTER* parse3DModel() throw( PARSE_ERROR, IO_ERROR );
/**
* Function parseDouble
......@@ -219,7 +219,7 @@ class PCB_PARSER : public PCB_LEXER
return KiROUND( parseDouble() * IU_PER_MM );
}
inline int parseBoardUnits( const char* aExpected ) throw( PARSE_ERROR )
inline int parseBoardUnits( const char* aExpected ) throw( PARSE_ERROR, IO_ERROR )
{
// Use here KiROUND, not KIROUND (see comments about them)
// when having a function as argument, because it will be called twice
......
......@@ -120,6 +120,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
EVT_MENU( ID_APPEND_FILE, PCB_EDIT_FRAME::Files_io )
EVT_MENU( ID_SAVE_BOARD_AS, PCB_EDIT_FRAME::Files_io )
EVT_MENU( ID_COPY_BOARD_AS, PCB_EDIT_FRAME::Files_io )
EVT_MENU_RANGE( wxID_FILE1, wxID_FILE9, PCB_EDIT_FRAME::OnFileHistory )
EVT_MENU( ID_GEN_PLOT, PCB_EDIT_FRAME::ToPlotter )
......@@ -693,24 +694,26 @@ void PCB_EDIT_FRAME::UseGalCanvas( bool aEnable )
void PCB_EDIT_FRAME::SwitchCanvas( wxCommandEvent& aEvent )
{
int id = aEvent.GetId();
bool use_gal = false;
switch( id )
{
case ID_MENU_CANVAS_DEFAULT:
Compile_Ratsnest( NULL, true );
UseGalCanvas( false );
break;
case ID_MENU_CANVAS_CAIRO:
GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
UseGalCanvas( true );
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_CAIRO );
break;
case ID_MENU_CANVAS_OPENGL:
GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
UseGalCanvas( true );
use_gal = GetGalCanvas()->SwitchBackend( EDA_DRAW_PANEL_GAL::GAL_TYPE_OPENGL );
break;
}
if( !use_gal )
Compile_Ratsnest( NULL, true );
UseGalCanvas( use_gal );
}
......
......@@ -3,7 +3,7 @@
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 1992-2015 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
......@@ -109,57 +109,46 @@ static struct IFACE : public KIFACE_I
wxWindow* CreateWindow( wxWindow* aParent, int aClassId, KIWAY* aKiway, int aCtlBits = 0 )
{
wxWindow* frame = NULL;
switch( aClassId )
{
case FRAME_PCB:
{
PCB_EDIT_FRAME* frame = new PCB_EDIT_FRAME( aKiway, aParent );
frame = dynamic_cast< wxWindow* >( new PCB_EDIT_FRAME( aKiway, aParent ) );
#if defined(KICAD_SCRIPTING)
// give the scripting helpers access to our frame
ScriptingSetPcbEditFrame( frame );
#if defined( KICAD_SCRIPTING )
// give the scripting helpers access to our frame
ScriptingSetPcbEditFrame( (PCB_EDIT_FRAME*) frame );
#endif
if( Kiface().IsSingle() )
{
// only run this under single_top, not under a project manager.
CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER );
}
return frame;
if( Kiface().IsSingle() )
{
// only run this under single_top, not under a project manager.
CreateServer( frame, KICAD_PCB_PORT_SERVICE_NUMBER );
}
break;
case FRAME_PCB_MODULE_EDITOR:
{
FOOTPRINT_EDIT_FRAME* frame = new FOOTPRINT_EDIT_FRAME( aKiway, aParent );
return frame;
}
frame = dynamic_cast< wxWindow* >( new FOOTPRINT_EDIT_FRAME( aKiway, aParent ) );
break;
case FRAME_PCB_MODULE_VIEWER:
case FRAME_PCB_MODULE_VIEWER_MODAL:
{
FOOTPRINT_VIEWER_FRAME* frame = new FOOTPRINT_VIEWER_FRAME(
aKiway, aParent, FRAME_T( aClassId ) );
return frame;
}
frame = dynamic_cast< wxWindow* >( new FOOTPRINT_VIEWER_FRAME( aKiway, aParent,
FRAME_T( aClassId ) ) );
break;
case FRAME_PCB_FOOTPRINT_WIZARD_MODAL:
{
FOOTPRINT_WIZARD_FRAME* frame = new FOOTPRINT_WIZARD_FRAME(
aKiway, aParent, FRAME_T( aClassId ) );
return frame;
}
frame = dynamic_cast< wxWindow* >( new FOOTPRINT_WIZARD_FRAME( aKiway, aParent,
FRAME_T( aClassId ) ) );
break;
default:
;
}
return NULL;
return frame;
}
/**
......@@ -193,13 +182,13 @@ KIFACE_I& Kiface() { return kiface; }
// KIFACE_GETTER's actual spelling is a substitution macro found in kiway.h.
// KIFACE_GETTER will not have name mangling due to declaration in kiway.h.
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
MY_API( KIFACE* ) KIFACE_GETTER( int* aKIFACEversion, int aKiwayVersion, PGM_BASE* aProgram )
{
process = (PGM_BASE*) aProgram;
return &kiface;
}
#if defined(BUILD_KIWAY_DLL)
#if defined( BUILD_KIWAY_DLL )
PGM_BASE& Pgm()
{
wxASSERT( process ); // KIFACE_GETTER has already been called.
......@@ -208,7 +197,7 @@ PGM_BASE& Pgm()
#endif
#if defined(KICAD_SCRIPTING)
#if defined( KICAD_SCRIPTING )
static bool scriptingSetup()
{
wxString path_frag;
......@@ -218,7 +207,7 @@ static bool scriptingSetup()
const wxString python_us( "python27_us" );
// Build our python path inside kicad
wxString kipython = FindKicadFile( python_us + wxT("/python.exe") );
wxString kipython = FindKicadFile( python_us + wxT( "/python.exe" ) );
//we need only the path:
wxFileName fn( kipython );
......@@ -231,19 +220,20 @@ static bool scriptingSetup()
if( !wxGetEnv( wxT( "PYTHONPATH" ), &ppath ) || !ppath.Contains( python_us ) )
{
ppath << kipython << wxT("/pylib;");
ppath << kipython << wxT("/lib;");
ppath << kipython << wxT("/dll");
ppath << kipython << wxT( "/pylib;" );
ppath << kipython << wxT( "/lib;" );
ppath << kipython << wxT( "/dll" );
wxSetEnv( wxT( "PYTHONPATH" ), ppath );
DBG( std::cout << "set PYTHONPATH to " << TO_UTF8(ppath) << "\n"; )
// DBG( std::cout << "set PYTHONPATH to " << TO_UTF8( ppath ) << "\n"; )
// Add python executable path:
wxGetEnv( wxT( "PATH" ), &ppath );
if( !ppath.Contains( python_us ) )
{
kipython << wxT(";") << ppath;
kipython << wxT( ";" ) << ppath;
wxSetEnv( wxT( "PATH" ), kipython );
DBG( std::cout << "set PATH to " << TO_UTF8(kipython) << "\n"; )
// DBG( std::cout << "set PATH to " << TO_UTF8( kipython ) << "\n"; )
}
}
}
......@@ -263,14 +253,20 @@ static bool scriptingSetup()
// Add default paths to PYTHONPATH
wxString pypath;
// User scripting folder (~/Library/Application Support/kicad/scripting/plugins)
pypath = GetOSXKicadUserDataDir() + wxT( "/scripting/plugins" );
// Machine scripting folder (/Library/Application Support/kicad/scripting/plugins)
pypath += wxT( ":" ) + GetOSXKicadMachineDataDir() + wxT( "/scripting/plugins" );
// Bundle scripting folder (<kicad.app>/Contents/SharedSupport/scripting/plugins)
pypath += wxT( ":" ) + GetOSXKicadDataDir() + wxT( "/scripting/plugins" );
// Bundle wxPython folder (<kicad.app>/Contents/Frameworks/python/site-packages)
pypath += wxT( ":" ) + Pgm().GetExecutablePath() + wxT( "Contents/Frameworks/python/site-packages" );
pypath += wxT( ":" ) + Pgm().GetExecutablePath() +
wxT( "Contents/Frameworks/python/site-packages" );
// Original content of $PYTHONPATH
if( wxGetenv("PYTHONPATH") != NULL )
{
......@@ -289,6 +285,7 @@ static bool scriptingSetup()
wxLogSysError( wxT( "pcbnewInitPythonScripting() failed." ) );
return false;
}
return true;
}
#endif // KICAD_SCRIPTING
......
......@@ -21,6 +21,7 @@ enum pcbnew_ids
ID_OPEN_MODULE_VIEWER,
ID_READ_NETLIST,
ID_SET_RELATIVE_OFFSET,
ID_COPY_BOARD_AS,
// Right vertical tool bar command IDs.
ID_PCB_HIGHLIGHT_BUTT,
......
......@@ -725,7 +725,7 @@ void ROUTER_TOOL::performRouting()
}
int ROUTER_TOOL::Main( TOOL_EVENT& aEvent )
int ROUTER_TOOL::Main( const TOOL_EVENT& aEvent )
{
VIEW_CONTROLS* ctls = getViewControls();
PCB_EDIT_FRAME* frame = getEditFrame<PCB_EDIT_FRAME>();
......
......@@ -41,7 +41,7 @@ public:
~ROUTER_TOOL();
void Reset( RESET_REASON aReason );
int Main( TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
private:
PNS_ITEM* pickSingleItem( const VECTOR2I& aWhere, int aNet = -1, int aLayer = -1 );
......
......@@ -294,7 +294,7 @@ void SPECCTRA_DB::LoadSESSION( const wxString& filename ) throw( IO_ERROR )
}
void SPECCTRA_DB::doPCB( PCB* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doPCB( PCB* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -602,7 +602,8 @@ void SPECCTRA_DB::doLAYER_PAIR( LAYER_PAIR* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth )
throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -755,7 +756,7 @@ L_place:
}
void SPECCTRA_DB::doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IO_ERROR, boost::bad_pointer )
{
/*
<structure_out_descriptor >::=
......@@ -798,7 +799,7 @@ void SPECCTRA_DB::doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -974,7 +975,7 @@ void SPECCTRA_DB::doWINDOW( WINDOW* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doBOUNDARY( BOUNDARY* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doBOUNDARY( BOUNDARY* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -1196,7 +1197,7 @@ void SPECCTRA_DB::doVIA( VIA* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doCONTROL( CONTROL* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doCONTROL( CONTROL* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -1520,7 +1521,7 @@ void SPECCTRA_DB::doPLACE_RULE( PLACE_RULE* growth, bool expect_object_type ) th
#endif
void SPECCTRA_DB::doREGION( REGION* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doREGION( REGION* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -1589,7 +1590,7 @@ void SPECCTRA_DB::doREGION( REGION* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -1862,7 +1863,7 @@ void SPECCTRA_DB::doPLACE( PLACE* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doCOMPONENT( COMPONENT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doCOMPONENT( COMPONENT* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -1892,7 +1893,7 @@ void SPECCTRA_DB::doCOMPONENT( COMPONENT* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -1947,7 +1948,7 @@ void SPECCTRA_DB::doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doPADSTACK( PADSTACK* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doPADSTACK( PADSTACK* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -2047,7 +2048,7 @@ void SPECCTRA_DB::doPADSTACK( PADSTACK* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doSHAPE( SHAPE* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doSHAPE( SHAPE* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2130,7 +2131,7 @@ L_done_that:
}
void SPECCTRA_DB::doIMAGE( IMAGE* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doIMAGE( IMAGE* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
......@@ -2273,7 +2274,7 @@ void SPECCTRA_DB::doPIN( PIN* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doLIBRARY( LIBRARY* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doLIBRARY( LIBRARY* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2327,7 +2328,7 @@ void SPECCTRA_DB::doLIBRARY( LIBRARY* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doNET( NET* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doNET( NET* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok = NextTok();
PIN_REFS* pin_refs;
......@@ -2467,7 +2468,7 @@ L_pins:
}
void SPECCTRA_DB::doTOPOLOGY( TOPOLOGY* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doTOPOLOGY( TOPOLOGY* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2505,7 +2506,7 @@ void SPECCTRA_DB::doTOPOLOGY( TOPOLOGY* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2615,7 +2616,7 @@ void SPECCTRA_DB::doCLASS( CLASS* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doNETWORK( NETWORK* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doNETWORK( NETWORK* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2678,7 +2679,7 @@ void SPECCTRA_DB::doCOMP_ORDER( COMP_ORDER* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doFROMTO( FROMTO* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doFROMTO( FROMTO* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2764,7 +2765,7 @@ void SPECCTRA_DB::doFROMTO( FROMTO* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doWIRE( WIRE* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doWIRE( WIRE* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -2989,7 +2990,7 @@ void SPECCTRA_DB::doWIRE_VIA( WIRE_VIA* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doWIRING( WIRING* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doWIRING( WIRING* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -3083,7 +3084,7 @@ void SPECCTRA_DB::doANCESTOR( ANCESTOR* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doHISTORY( HISTORY* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doHISTORY( HISTORY* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -3139,7 +3140,7 @@ void SPECCTRA_DB::doHISTORY( HISTORY* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doSESSION( SESSION* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doSESSION( SESSION* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -3257,7 +3258,7 @@ void SPECCTRA_DB::doWAS_IS( WAS_IS* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......@@ -3340,7 +3341,7 @@ void SPECCTRA_DB::doROUTE( ROUTE* growth ) throw( IO_ERROR )
}
void SPECCTRA_DB::doNET_OUT( NET_OUT* growth ) throw( IO_ERROR )
void SPECCTRA_DB::doNET_OUT( NET_OUT* growth ) throw( IO_ERROR, boost::bad_pointer )
{
T tok;
......
......@@ -3690,57 +3690,57 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
*/
void readTIME( time_t* time_stamp ) throw( IO_ERROR );
void doPCB( PCB* growth ) throw( IO_ERROR );
void doPCB( PCB* growth ) throw( IO_ERROR, boost::bad_pointer );
void doPARSER( PARSER* growth ) throw( IO_ERROR );
void doRESOLUTION( UNIT_RES* growth ) throw( IO_ERROR );
void doUNIT( UNIT_RES* growth ) throw( IO_ERROR );
void doSTRUCTURE( STRUCTURE* growth ) throw( IO_ERROR );
void doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IO_ERROR );
void doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth ) throw( IO_ERROR );
void doSTRUCTURE_OUT( STRUCTURE_OUT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doLAYER_NOISE_WEIGHT( LAYER_NOISE_WEIGHT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doLAYER_PAIR( LAYER_PAIR* growth ) throw( IO_ERROR );
void doBOUNDARY( BOUNDARY* growth ) throw( IO_ERROR );
void doBOUNDARY( BOUNDARY* growth ) throw( IO_ERROR, boost::bad_pointer );
void doRECTANGLE( RECTANGLE* growth ) throw( IO_ERROR );
void doPATH( PATH* growth ) throw( IO_ERROR );
void doSTRINGPROP( STRINGPROP* growth ) throw( IO_ERROR );
void doTOKPROP( TOKPROP* growth ) throw( IO_ERROR );
void doVIA( VIA* growth ) throw( IO_ERROR );
void doCONTROL( CONTROL* growth ) throw( IO_ERROR );
void doCONTROL( CONTROL* growth ) throw( IO_ERROR, boost::bad_pointer );
void doLAYER( LAYER* growth ) throw( IO_ERROR );
void doRULE( RULE* growth ) throw( IO_ERROR );
void doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR );
void doKEEPOUT( KEEPOUT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doCIRCLE( CIRCLE* growth ) throw( IO_ERROR );
void doQARC( QARC* growth ) throw( IO_ERROR );
void doWINDOW( WINDOW* growth ) throw( IO_ERROR );
void doCONNECT( CONNECT* growth ) throw( IO_ERROR );
void doREGION( REGION* growth ) throw( IO_ERROR );
void doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR );
void doREGION( REGION* growth ) throw( IO_ERROR, boost::bad_pointer );
void doCLASS_CLASS( CLASS_CLASS* growth ) throw( IO_ERROR, boost::bad_pointer );
void doLAYER_RULE( LAYER_RULE* growth ) throw( IO_ERROR );
void doCLASSES( CLASSES* growth ) throw( IO_ERROR );
void doGRID( GRID* growth ) throw( IO_ERROR );
void doPLACE( PLACE* growth ) throw( IO_ERROR );
void doCOMPONENT( COMPONENT* growth ) throw( IO_ERROR );
void doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR );
void doCOMPONENT( COMPONENT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doPLACEMENT( PLACEMENT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doPROPERTIES( PROPERTIES* growth ) throw( IO_ERROR );
void doPADSTACK( PADSTACK* growth ) throw( IO_ERROR );
void doSHAPE( SHAPE* growth ) throw( IO_ERROR );
void doIMAGE( IMAGE* growth ) throw( IO_ERROR );
void doLIBRARY( LIBRARY* growth ) throw( IO_ERROR );
void doPADSTACK( PADSTACK* growth ) throw( IO_ERROR, boost::bad_pointer );
void doSHAPE( SHAPE* growth ) throw( IO_ERROR, boost::bad_pointer );
void doIMAGE( IMAGE* growth ) throw( IO_ERROR, boost::bad_pointer );
void doLIBRARY( LIBRARY* growth ) throw( IO_ERROR, boost::bad_pointer );
void doPIN( PIN* growth ) throw( IO_ERROR );
void doNET( NET* growth ) throw( IO_ERROR );
void doNETWORK( NETWORK* growth ) throw( IO_ERROR );
void doCLASS( CLASS* growth ) throw( IO_ERROR );
void doTOPOLOGY( TOPOLOGY* growth ) throw( IO_ERROR );
void doFROMTO( FROMTO* growth ) throw( IO_ERROR );
void doNET( NET* growth ) throw( IO_ERROR, boost::bad_pointer );
void doNETWORK( NETWORK* growth ) throw( IO_ERROR, boost::bad_pointer );
void doCLASS( CLASS* growth ) throw( IO_ERROR, boost::bad_pointer );
void doTOPOLOGY( TOPOLOGY* growth ) throw( IO_ERROR, boost::bad_pointer );
void doFROMTO( FROMTO* growth ) throw( IO_ERROR, boost::bad_pointer );
void doCOMP_ORDER( COMP_ORDER* growth ) throw( IO_ERROR );
void doWIRE( WIRE* growth ) throw( IO_ERROR );
void doWIRE( WIRE* growth ) throw( IO_ERROR, boost::bad_pointer );
void doWIRE_VIA( WIRE_VIA* growth ) throw( IO_ERROR );
void doWIRING( WIRING* growth ) throw( IO_ERROR );
void doSESSION( SESSION* growth ) throw( IO_ERROR );
void doWIRING( WIRING* growth ) throw( IO_ERROR, boost::bad_pointer );
void doSESSION( SESSION* growth ) throw( IO_ERROR, boost::bad_pointer );
void doANCESTOR( ANCESTOR* growth ) throw( IO_ERROR );
void doHISTORY( HISTORY* growth ) throw( IO_ERROR );
void doROUTE( ROUTE* growth ) throw( IO_ERROR );
void doHISTORY( HISTORY* growth ) throw( IO_ERROR, boost::bad_pointer );
void doROUTE( ROUTE* growth ) throw( IO_ERROR, boost::bad_pointer );
void doWAS_IS( WAS_IS* growth ) throw( IO_ERROR );
void doNET_OUT( NET_OUT* growth ) throw( IO_ERROR );
void doNET_OUT( NET_OUT* growth ) throw( IO_ERROR, boost::bad_pointer );
void doSUPPLY_PIN( SUPPLY_PIN* growth ) throw( IO_ERROR );
//-----<FromBOARD>-------------------------------------------------------
......@@ -3752,7 +3752,7 @@ class SPECCTRA_DB : public SPECCTRA_LEXER
* @param aBoard The BOARD to get information from in order to make the BOUNDARY.
* @param aBoundary The empty BOUNDARY to fill in.
*/
void fillBOUNDARY( BOARD* aBoard, BOUNDARY* aBoundary ) throw( IO_ERROR );
void fillBOUNDARY( BOARD* aBoard, BOUNDARY* aBoundary ) throw( IO_ERROR, boost::bad_pointer );
/**
* Function makeIMAGE
......@@ -3933,7 +3933,7 @@ public:
*
* @param aBoard The BOARD to convert to a PCB.
*/
void FromBOARD( BOARD* aBoard ) throw( IO_ERROR );
void FromBOARD( BOARD* aBoard ) throw( IO_ERROR, boost::bad_ptr_container_operation );
/**
* Function FromSESSION
......
......@@ -889,7 +889,8 @@ static void makeCircle( PATH* aPath, DRAWSEGMENT* aGraphic )
}
void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary ) throw( IO_ERROR )
void SPECCTRA_DB::fillBOUNDARY( BOARD* aBoard, BOUNDARY* boundary )
throw( IO_ERROR, boost::bad_pointer )
{
PCB_TYPE_COLLECTOR items;
......@@ -1369,7 +1370,8 @@ typedef std::set<std::string> STRINGSET;
typedef std::pair<STRINGSET::iterator, bool> STRINGSET_PAIR;
void SPECCTRA_DB::FromBOARD( BOARD* aBoard ) throw( IO_ERROR )
void SPECCTRA_DB::FromBOARD( BOARD* aBoard )
throw( IO_ERROR, boost::bad_ptr_container_operation )
{
PCB_TYPE_COLLECTOR items;
......
......@@ -52,7 +52,8 @@
#include <class_module.h>
DRAWING_TOOL::DRAWING_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveDrawing" ), m_editModules( false )
TOOL_INTERACTIVE( "pcbnew.InteractiveDrawing" ), m_view( NULL ),
m_controls( NULL ), m_board( NULL ), m_frame( NULL ), m_editModules( false ), m_lineWidth( 1 )
{
}
......@@ -74,7 +75,7 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
}
int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
{
boost::optional<VECTOR2D> startingPoint;
......@@ -135,7 +136,7 @@ int DRAWING_TOOL::DrawLine( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
{
if( m_editModules )
{
......@@ -184,7 +185,7 @@ int DRAWING_TOOL::DrawCircle( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
{
if( m_editModules )
{
......@@ -233,7 +234,7 @@ int DRAWING_TOOL::DrawArc( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceText( const TOOL_EVENT& aEvent )
{
if( m_editModules )
return placeTextModule();
......@@ -242,7 +243,7 @@ int DRAWING_TOOL::PlaceText( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
{
DIMENSION* dimension = NULL;
int width, maxThickness;
......@@ -421,7 +422,7 @@ int DRAWING_TOOL::DrawDimension( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_PCB_ZONES_BUTT, wxCURSOR_PENCIL, _( "Add zones" ) );
......@@ -429,7 +430,7 @@ int DRAWING_TOOL::DrawZone( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
int DRAWING_TOOL::DrawKeepout( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_PCB_KEEPOUT_AREA_BUTT, wxCURSOR_PENCIL, _( "Add keepout" ) );
......@@ -437,7 +438,7 @@ int DRAWING_TOOL::DrawKeepout( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceTarget( const TOOL_EVENT& aEvent )
{
PCB_TARGET* target = new PCB_TARGET( m_board );
......@@ -525,7 +526,7 @@ int DRAWING_TOOL::PlaceTarget( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceModule( const TOOL_EVENT& aEvent )
{
MODULE* module = NULL;
......@@ -635,7 +636,7 @@ int DRAWING_TOOL::PlaceModule( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
{
DIALOG_DXF_IMPORT dlg( m_frame );
int dlgResult = dlg.ShowModal();
......@@ -825,7 +826,7 @@ int DRAWING_TOOL::PlaceDXF( TOOL_EVENT& aEvent )
}
int DRAWING_TOOL::SetAnchor( TOOL_EVENT& aEvent )
int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
{
assert( m_editModules );
......@@ -901,7 +902,7 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
// Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape );
aGraphic->SetWidth( lineWidth );
aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( aStartingPoint->x, aStartingPoint->y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer );
......@@ -963,8 +964,8 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
{
// Init the new item attributes
aGraphic->SetShape( (STROKE_T) aShape );
lineWidth = getSegmentWidth( layer );
aGraphic->SetWidth( lineWidth );
m_lineWidth = getSegmentWidth( layer );
aGraphic->SetWidth( m_lineWidth );
aGraphic->SetStart( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetEnd( wxPoint( cursorPos.x, cursorPos.y ) );
aGraphic->SetLayer( layer );
......@@ -1012,17 +1013,17 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
else if( evt->IsAction( &COMMON_ACTIONS::incWidth ) )
{
lineWidth += WIDTH_STEP;
aGraphic->SetWidth( lineWidth );
m_lineWidth += WIDTH_STEP;
aGraphic->SetWidth( m_lineWidth );
updatePreview = true;
}
else if( evt->IsAction( &COMMON_ACTIONS::decWidth ) )
{
if( lineWidth > (unsigned) WIDTH_STEP )
if( m_lineWidth > (unsigned) WIDTH_STEP )
{
lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( lineWidth );
m_lineWidth -= WIDTH_STEP;
aGraphic->SetWidth( m_lineWidth );
updatePreview = true;
}
}
......
......@@ -58,7 +58,7 @@ public:
* to click at least two times to determine the origin and the end for a line. If there are
* more clicks, the line is drawn as a continous polyline.
*/
int DrawLine( TOOL_EVENT& aEvent );
int DrawLine( const TOOL_EVENT& aEvent );
/**
* Function DrawCircle()
......@@ -66,7 +66,7 @@ public:
* to first click on a point that is going to be used as the center of the circle. The second
* click determines the circle radius.
*/
int DrawCircle( TOOL_EVENT& aEvent );
int DrawCircle( const TOOL_EVENT& aEvent );
/**
* Function DrawArc()
......@@ -74,14 +74,14 @@ public:
* to first click on a point that is going to be used as the center of the arc. The second
* click determines the origin and radius, the third one - the angle.
*/
int DrawArc( TOOL_EVENT& aEvent );
int DrawArc( const TOOL_EVENT& aEvent );
/**
* Function PlaceText()
* Displays a dialog that allows to input text and its settings and then lets the user decide
* where to place the text in editor.
*/
int PlaceText( TOOL_EVENT& aEvent );
int PlaceText( const TOOL_EVENT& aEvent );
/**
* Function DrawDimension()
......@@ -89,7 +89,7 @@ public:
* to first click on a point that is going to be used as the origin of the dimension.
* The second click determines the end and the third click modifies its height.
*/
int DrawDimension( TOOL_EVENT& aEvent );
int DrawDimension( const TOOL_EVENT& aEvent );
/**
* Function DrawZone()
......@@ -98,7 +98,7 @@ public:
* as a boundary polygon of the zone. Double click or clicking on the origin of the boundary
* polyline finishes the drawing.
*/
int DrawZone( TOOL_EVENT& aEvent );
int DrawZone( const TOOL_EVENT& aEvent );
/**
* Function DrawKeepout()
......@@ -107,31 +107,31 @@ public:
* be used as a boundary polygon of the area. Double click or clicking on the origin of the
* boundary polyline finishes the drawing.
*/
int DrawKeepout( TOOL_EVENT& aEvent );
int DrawKeepout( const TOOL_EVENT& aEvent );
/**
* Function PlaceTarget()
* Allows user to place a layer alignment target.
*/
int PlaceTarget( TOOL_EVENT& aEvent );
int PlaceTarget( const TOOL_EVENT& aEvent );
/**
* Function PlaceModule()
* Displays a dialog to select a module to be added and allows the user to set its position.
*/
int PlaceModule( TOOL_EVENT& aEvent );
int PlaceModule( const TOOL_EVENT& aEvent );
/**
* Function PlaceDXF()
* Places a drawing imported from a DXF file in module editor.
*/
int PlaceDXF( TOOL_EVENT& aEvent );
int PlaceDXF( const TOOL_EVENT& aEvent );
/**
* Function SetAnchor()
* Places the footprint anchor (only in module editor).
*/
int SetAnchor( TOOL_EVENT& aEvent );
int SetAnchor( const TOOL_EVENT& aEvent );
/**
* Function EditModules()
......@@ -203,7 +203,7 @@ private:
bool m_editModules;
/// Stores the current line width for multisegment drawing.
unsigned int lineWidth;
unsigned int m_lineWidth;
// How does line width change after one -/+ key press.
static const int WIDTH_STEP = 100000;
......
......@@ -43,7 +43,8 @@
#include "edit_tool.h"
EDIT_TOOL::EDIT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ), m_editModules( false )
TOOL_INTERACTIVE( "pcbnew.InteractiveEdit" ), m_selectionTool( NULL ),
m_dragging( false ), m_editModules( false ), m_updateFlag( KIGFX::VIEW_ITEM::NONE )
{
}
......@@ -51,6 +52,7 @@ EDIT_TOOL::EDIT_TOOL() :
void EDIT_TOOL::Reset( RESET_REASON aReason )
{
m_dragging = false;
m_updateFlag = KIGFX::VIEW_ITEM::NONE;
}
......@@ -81,7 +83,7 @@ bool EDIT_TOOL::Init()
}
int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -238,7 +240,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
......@@ -307,7 +309,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
......@@ -361,7 +363,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
PCB_BASE_FRAME* editFrame = getEditFrame<PCB_BASE_FRAME>();
......@@ -415,7 +417,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
}
int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......
......@@ -61,35 +61,35 @@ public:
* Main loop in which events are handled.
* @param aEvent is the handled event.
*/
int Main( TOOL_EVENT& aEvent );
int Main( const TOOL_EVENT& aEvent );
/**
* Function Edit()
*
* Displays properties window for the selected object.
*/
int Properties( TOOL_EVENT& aEvent );
int Properties( const TOOL_EVENT& aEvent );
/**
* Function Rotate()
*
* Rotates currently selected items.
*/
int Rotate( TOOL_EVENT& aEvent );
int Rotate( const TOOL_EVENT& aEvent );
/**
* Function Flip()
*
* Rotates currently selected items. The rotation point is the current cursor position.
*/
int Flip( TOOL_EVENT& aEvent );
int Flip( const TOOL_EVENT& aEvent );
/**
* Function Remove()
*
* Deletes currently selected items. The rotation point is the current cursor position.
*/
int Remove( TOOL_EVENT& aEvent );
int Remove( const TOOL_EVENT& aEvent );
/**
* Function EditModules()
......
......@@ -47,7 +47,8 @@
#include <wx/defs.h>
MODULE_TOOLS::MODULE_TOOLS() :
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" )
TOOL_INTERACTIVE( "pcbnew.ModuleEditor" ), m_view( NULL ), m_controls( NULL ),
m_board( NULL ), m_frame( NULL )
{
}
......@@ -119,7 +120,7 @@ static wxString getNextPadName( MODULE* aModule )
}
int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
{
m_frame->SetToolID( ID_MODEDIT_PAD_TOOL, wxCURSOR_PENCIL, _( "Add pads" ) );
......@@ -222,7 +223,7 @@ int MODULE_TOOLS::PlacePad( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
{
std::list<D_PAD*> pads;
std::set<D_PAD*> allPads;
......@@ -329,7 +330,7 @@ int MODULE_TOOLS::EnumeratePads( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_toolMgr->GetTool<SELECTION_TOOL>()->GetSelection();
......@@ -401,7 +402,7 @@ int MODULE_TOOLS::CopyItems( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
{
// Parse clipboard
PCB_IO io( CTL_FOR_CLIPBOARD );
......@@ -533,7 +534,7 @@ int MODULE_TOOLS::PasteItems( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......@@ -570,7 +571,7 @@ int MODULE_TOOLS::ModuleTextOutlines( TOOL_EVENT& aEvent )
}
int MODULE_TOOLS::ModuleEdgeOutlines( TOOL_EVENT& aEvent )
int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
{
KIGFX::PCB_PAINTER* painter =
static_cast<KIGFX::PCB_PAINTER*>( m_frame->GetGalCanvas()->GetView()->GetPainter() );
......
......@@ -55,41 +55,41 @@ public:
* Function PlacePad()
* Places a pad in module editor.
*/
int PlacePad( TOOL_EVENT& aEvent );
int PlacePad( const TOOL_EVENT& aEvent );
/**
* Function EnumeratePads()
* Tool for quick pad enumeration.
*/
int EnumeratePads( TOOL_EVENT& aEvent );
int EnumeratePads( const TOOL_EVENT& aEvent );
/**
* Function CopyItems()
*
* Copies selected items to the clipboard. Works only in "edit modules" mode.
*/
int CopyItems( TOOL_EVENT& aEvent );
int CopyItems( const TOOL_EVENT& aEvent );
/**
* Function PastePad()
*
* Pastes items from the clipboard. Works only in "edit modules" mode.
*/
int PasteItems( TOOL_EVENT& aEvent );
int PasteItems( const TOOL_EVENT& aEvent );
/**
* Function ModuleTextOutlines()
*
* Toggles display mode for module texts (outline/filled).
*/
int ModuleTextOutlines( TOOL_EVENT& aEvent );
int ModuleTextOutlines( const TOOL_EVENT& aEvent );
/**
* Function ModuleEdgeOutlines()
*
* Toggles display mode for module edges (outline/filled).
*/
int ModuleEdgeOutlines( TOOL_EVENT& aEvent );
int ModuleEdgeOutlines( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
......@@ -47,7 +47,7 @@ public:
PCB_EDITOR_CONTROL::PCB_EDITOR_CONTROL() :
TOOL_INTERACTIVE( "pcbnew.EditorControl" )
TOOL_INTERACTIVE( "pcbnew.EditorControl" ), m_frame( NULL )
{
}
......@@ -75,7 +75,7 @@ bool PCB_EDITOR_CONTROL::Init()
// Track & via size control
int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() + 1;
......@@ -96,7 +96,7 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int widthIndex = board->GetDesignSettings().GetTrackWidthIndex() - 1;
......@@ -117,7 +117,7 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() + 1;
......@@ -138,7 +138,7 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
int sizeIndex = board->GetDesignSettings().GetViaSizeIndex() - 1;
......@@ -160,7 +160,7 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( TOOL_EVENT& aEvent )
// Zone actions
int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
......@@ -181,7 +181,7 @@ int PCB_EDITOR_CONTROL::ZoneFill( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneFillAll( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
......@@ -199,7 +199,7 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
......@@ -220,7 +220,7 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::ZoneUnfillAll( TOOL_EVENT& aEvent )
int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
{
BOARD* board = getModel<BOARD>();
......@@ -238,6 +238,20 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( TOOL_EVENT& aEvent )
}
int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
{
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
const SELECTION& selection = selTool->GetSelection();
if( selection.Size() == 1 )
m_frame->SendMessageToEESCHEMA( selection.Item<BOARD_ITEM>( 0 ) );
setTransitions();
return 0;
}
void PCB_EDITOR_CONTROL::setTransitions()
{
// Track & via size control
......@@ -251,4 +265,6 @@ void PCB_EDITOR_CONTROL::setTransitions()
Go( &PCB_EDITOR_CONTROL::ZoneFillAll, COMMON_ACTIONS::zoneFillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfill, COMMON_ACTIONS::zoneUnfill.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::ZoneUnfillAll, COMMON_ACTIONS::zoneUnfillAll.MakeEvent() );
Go( &PCB_EDITOR_CONTROL::SelectionCrossProbe, SELECTION_TOOL::SelectedEvent );
}
......@@ -46,16 +46,19 @@ public:
bool Init();
// Track & via size control
int TrackWidthInc( TOOL_EVENT& aEvent );
int TrackWidthDec( TOOL_EVENT& aEvent );
int ViaSizeInc( TOOL_EVENT& aEvent );
int ViaSizeDec( TOOL_EVENT& aEvent );
int TrackWidthInc( const TOOL_EVENT& aEvent );
int TrackWidthDec( const TOOL_EVENT& aEvent );
int ViaSizeInc( const TOOL_EVENT& aEvent );
int ViaSizeDec( const TOOL_EVENT& aEvent );
// Zone actions
int ZoneFill( TOOL_EVENT& aEvent );
int ZoneFillAll( TOOL_EVENT& aEvent );
int ZoneUnfill( TOOL_EVENT& aEvent );
int ZoneUnfillAll( TOOL_EVENT& aEvent );
int ZoneFill( const TOOL_EVENT& aEvent );
int ZoneFillAll( const TOOL_EVENT& aEvent );
int ZoneUnfill( const TOOL_EVENT& aEvent );
int ZoneUnfillAll( const TOOL_EVENT& aEvent );
///> Notifies eeschema about the selected item.
int SelectionCrossProbe( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
This diff is collapsed.
......@@ -47,40 +47,40 @@ public:
bool Init();
// View controls
int ZoomInOut( TOOL_EVENT& aEvent );
int ZoomInOutCenter( TOOL_EVENT& aEvent );
int ZoomCenter( TOOL_EVENT& aEvent );
int ZoomFitScreen( TOOL_EVENT& aEvent );
int ZoomInOut( const TOOL_EVENT& aEvent );
int ZoomInOutCenter( const TOOL_EVENT& aEvent );
int ZoomCenter( const TOOL_EVENT& aEvent );
int ZoomFitScreen( const TOOL_EVENT& aEvent );
// Display modes
int TrackDisplayMode( TOOL_EVENT& aEvent );
int PadDisplayMode( TOOL_EVENT& aEvent );
int ViaDisplayMode( TOOL_EVENT& aEvent );
int ZoneDisplayMode( TOOL_EVENT& aEvent );
int HighContrastMode( TOOL_EVENT& aEvent );
int HighContrastInc( TOOL_EVENT& aEvent );
int HighContrastDec( TOOL_EVENT& aEvent );
int TrackDisplayMode( const TOOL_EVENT& aEvent );
int PadDisplayMode( const TOOL_EVENT& aEvent );
int ViaDisplayMode( const TOOL_EVENT& aEvent );
int ZoneDisplayMode( const TOOL_EVENT& aEvent );
int HighContrastMode( const TOOL_EVENT& aEvent );
int HighContrastInc( const TOOL_EVENT& aEvent );
int HighContrastDec( const TOOL_EVENT& aEvent );
// Layer control
int LayerSwitch( TOOL_EVENT& aEvent );
int LayerNext( TOOL_EVENT& aEvent );
int LayerPrev( TOOL_EVENT& aEvent );
int LayerAlphaInc( TOOL_EVENT& aEvent );
int LayerAlphaDec( TOOL_EVENT& aEvent );
int LayerSwitch( const TOOL_EVENT& aEvent );
int LayerNext( const TOOL_EVENT& aEvent );
int LayerPrev( const TOOL_EVENT& aEvent );
int LayerAlphaInc( const TOOL_EVENT& aEvent );
int LayerAlphaDec( const TOOL_EVENT& aEvent );
// Grid control
int GridFast1( TOOL_EVENT& aEvent );
int GridFast2( TOOL_EVENT& aEvent );
int GridNext( TOOL_EVENT& aEvent );
int GridPrev( TOOL_EVENT& aEvent );
int GridSetOrigin( TOOL_EVENT& aEvent );
int GridFast1( const TOOL_EVENT& aEvent );
int GridFast2( const TOOL_EVENT& aEvent );
int GridNext( const TOOL_EVENT& aEvent );
int GridPrev( const TOOL_EVENT& aEvent );
int GridSetOrigin( const TOOL_EVENT& aEvent );
// Miscellaneous
int ResetCoords( TOOL_EVENT& aEvent );
int SwitchCursor( TOOL_EVENT& aEvent );
int SwitchUnits( TOOL_EVENT& aEvent );
int ShowHelp( TOOL_EVENT& aEvent );
int ToBeDone( TOOL_EVENT& aEvent );
int ResetCoords( const TOOL_EVENT& aEvent );
int SwitchCursor( const TOOL_EVENT& aEvent );
int SwitchUnits( const TOOL_EVENT& aEvent );
int ShowHelp( const TOOL_EVENT& aEvent );
int ToBeDone( const TOOL_EVENT& aEvent );
private:
///> Sets up handlers for various events.
......
......@@ -34,7 +34,7 @@
#include <boost/foreach.hpp>
PLACEMENT_TOOL::PLACEMENT_TOOL() :
TOOL_INTERACTIVE( "pcbnew.Placement" )
TOOL_INTERACTIVE( "pcbnew.Placement" ), m_selectionTool( NULL )
{
}
......@@ -72,7 +72,7 @@ bool PLACEMENT_TOOL::Init()
}
int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -115,7 +115,7 @@ int PLACEMENT_TOOL::AlignTop( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -158,7 +158,7 @@ int PLACEMENT_TOOL::AlignBottom( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -201,7 +201,7 @@ int PLACEMENT_TOOL::AlignLeft( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::AlignRight( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -256,7 +256,7 @@ static bool compareY( const BOARD_ITEM* aA, const BOARD_ITEM* aB )
}
int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -305,7 +305,7 @@ int PLACEMENT_TOOL::DistributeHorizontally( TOOL_EVENT& aEvent )
}
int PLACEMENT_TOOL::DistributeVertically( TOOL_EVENT& aEvent )
int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......
This diff is collapsed.
......@@ -219,7 +219,7 @@ bool POINT_EDITOR::Init()
}
int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent )
int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
{
const SELECTION& selection = m_selectionTool->GetSelection();
......@@ -797,8 +797,8 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
void POINT_EDITOR::setTransitions()
{
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, m_selectionTool->UnselectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, SELECTION_TOOL::SelectedEvent );
Go( &POINT_EDITOR::OnSelectionChange, SELECTION_TOOL::UnselectedEvent );
}
......
......@@ -53,7 +53,7 @@ public:
*
* Change selection event handler.
*/
int OnSelectionChange( TOOL_EVENT& aEvent );
int OnSelectionChange( const TOOL_EVENT& aEvent );
private:
///> Selection tool used for obtaining selected items
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -950,7 +950,7 @@ void IDF3::GetOutline( std::list<IDF_SEGMENT*>& aLines,
PrintSeg( *bl );
#endif
aOutline.push( *bl );
aLines.erase( bl );
bl = aLines.erase( bl );
}
continue;
......@@ -982,7 +982,7 @@ void IDF3::GetOutline( std::list<IDF_SEGMENT*>& aLines,
printSeg( *bl );
#endif
aOutline.push( *bl );
aLines.erase( bl );
bl = aLines.erase( bl );
}
continue;
......
......@@ -426,14 +426,13 @@ void make_vcyl( bool inch, bool axial, double dia, double length,
void make_hcyl( bool inch, bool axial, double dia, double length,
double z, double wireDia )
{
bool ok = false;
stringstream tstr;
string line;
double pitch = 0.0;
double lead = 0.0; // lead length for radial leads
ok = false;
bool ok = false;
while( !ok )
{
if( axial )
......
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