Commit cf01c580 authored by Garth Corral's avatar Garth Corral

Merge trunk @ 5386

parents 0bebc34a f0a52644
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -28,9 +28,13 @@ ...@@ -28,9 +28,13 @@
#include "vrml_aux.h" #include "vrml_aux.h"
char SkipGetChar( FILE* File )
static int SkipGetChar ( FILE* File );
static int SkipGetChar( FILE* File )
{ {
char c; int c;
bool re_parse; bool re_parse;
if( ( c = fgetc( File ) ) == EOF ) if( ( c = fgetc( File ) ) == EOF )
...@@ -92,7 +96,7 @@ char SkipGetChar( FILE* File ) ...@@ -92,7 +96,7 @@ char SkipGetChar( FILE* File )
char* GetNextTag( FILE* File, char* tag ) char* GetNextTag( FILE* File, char* tag )
{ {
char c = SkipGetChar( File ); int c = SkipGetChar( File );
if( c == EOF ) if( c == EOF )
{ {
...@@ -136,7 +140,7 @@ char* GetNextTag( FILE* File, char* tag ) ...@@ -136,7 +140,7 @@ char* GetNextTag( FILE* File, char* tag )
int read_NotImplemented( FILE* File, char closeChar ) int read_NotImplemented( FILE* File, char closeChar )
{ {
char c; int c;
// DBG( printf( "look for %c\n", closeChar) ); // DBG( printf( "look for %c\n", closeChar) );
while( ( c = fgetc( File ) ) != EOF ) while( ( c = fgetc( File ) ) != EOF )
...@@ -189,7 +193,7 @@ int parseVertex( FILE* File, glm::vec3& dst_vertex ) ...@@ -189,7 +193,7 @@ int parseVertex( FILE* File, glm::vec3& dst_vertex )
dst_vertex.y = b; dst_vertex.y = b;
dst_vertex.z = c; dst_vertex.z = c;
char s = SkipGetChar( File ); int s = SkipGetChar( File );
if( s != EOF ) if( s != EOF )
{ {
......
...@@ -49,7 +49,6 @@ ...@@ -49,7 +49,6 @@
#include <wx/glcanvas.h> #include <wx/glcanvas.h>
int read_NotImplemented( FILE* File, char closeChar); int read_NotImplemented( FILE* File, char closeChar);
char SkipGetChar ( FILE* File );
int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector); int parseVertexList( FILE* File, std::vector< glm::vec3 > &dst_vector);
int parseVertex( FILE* File, glm::vec3 &dst_vertex ); int parseVertex( FILE* File, glm::vec3 &dst_vertex );
int parseFloat( FILE* File, float *dst_float ); int parseFloat( FILE* File, float *dst_float );
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2014 Mario Luzeiro <mrluzeiro@gmail.com> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -93,7 +93,7 @@ void VRML1_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 ...@@ -93,7 +93,7 @@ void VRML1_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) ) if( ( *text == '}' ) || ( *text == ']' ) )
{ {
continue; continue;
} }
...@@ -187,7 +187,7 @@ int VRML1_MODEL_PARSER::readMaterial() ...@@ -187,7 +187,7 @@ int VRML1_MODEL_PARSER::readMaterial()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -235,7 +235,7 @@ int VRML1_MODEL_PARSER::readCoordinate3() ...@@ -235,7 +235,7 @@ int VRML1_MODEL_PARSER::readCoordinate3()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -263,7 +263,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet() ...@@ -263,7 +263,7 @@ int VRML1_MODEL_PARSER::readIndexedFaceSet()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
......
...@@ -88,14 +88,13 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 ...@@ -88,14 +88,13 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
glScalef( matScale.x, matScale.y, matScale.z ); glScalef( matScale.x, matScale.y, matScale.z );
// Switch the locale to standard C (needed to print floating point numbers like 1.3) LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats
SetLocaleTo_C_standard();
childs.clear(); childs.clear();
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == '}' ) || ( *text == ']' ) ) if( ( *text == '}' ) || ( *text == ']' ) )
{ {
continue; continue;
} }
...@@ -117,7 +116,6 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3 ...@@ -117,7 +116,6 @@ void VRML2_MODEL_PARSER::Load( const wxString& aFilename, double aVrmlunits_to_3
} }
fclose( m_file ); fclose( m_file );
SetLocaleTo_Default(); // revert to the current locale
// DBG( printf( "chils size:%lu\n", childs.size() ) ); // DBG( printf( "chils size:%lu\n", childs.size() ) );
...@@ -140,7 +138,7 @@ int VRML2_MODEL_PARSER::read_Transform() ...@@ -140,7 +138,7 @@ int VRML2_MODEL_PARSER::read_Transform()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -259,7 +257,7 @@ int VRML2_MODEL_PARSER::read_DEF() ...@@ -259,7 +257,7 @@ int VRML2_MODEL_PARSER::read_DEF()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
// DBG( printf( " skiping %c\n", *text) ); // DBG( printf( " skiping %c\n", *text) );
continue; continue;
...@@ -316,7 +314,7 @@ int VRML2_MODEL_PARSER::read_Shape() ...@@ -316,7 +314,7 @@ int VRML2_MODEL_PARSER::read_Shape()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -363,7 +361,7 @@ int VRML2_MODEL_PARSER::read_Appearance() ...@@ -363,7 +361,7 @@ int VRML2_MODEL_PARSER::read_Appearance()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -468,7 +466,7 @@ int VRML2_MODEL_PARSER::read_Material() ...@@ -468,7 +466,7 @@ int VRML2_MODEL_PARSER::read_Material()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -561,7 +559,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet() ...@@ -561,7 +559,7 @@ int VRML2_MODEL_PARSER::read_IndexedFaceSet()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -744,7 +742,7 @@ int VRML2_MODEL_PARSER::read_Color() ...@@ -744,7 +742,7 @@ int VRML2_MODEL_PARSER::read_Color()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -774,7 +772,7 @@ int VRML2_MODEL_PARSER::read_Normal() ...@@ -774,7 +772,7 @@ int VRML2_MODEL_PARSER::read_Normal()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
...@@ -812,7 +810,7 @@ int VRML2_MODEL_PARSER::read_Coordinate() ...@@ -812,7 +810,7 @@ int VRML2_MODEL_PARSER::read_Coordinate()
while( GetNextTag( m_file, text ) ) while( GetNextTag( m_file, text ) )
{ {
if( ( text == NULL ) || ( *text == ']' ) ) if( *text == ']' )
{ {
continue; continue;
} }
......
...@@ -425,6 +425,7 @@ set( wxWidgets_CONFIG_OPTIONS --static=no ) ...@@ -425,6 +425,7 @@ set( wxWidgets_CONFIG_OPTIONS --static=no )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN ) if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( webkitlib "webview" ) set( webkitlib "webview" )
add_definitions( -DKICAD_USE_WEBKIT )
else() else()
set( webkitlib "" ) set( webkitlib "" )
endif() endif()
......
...@@ -37,6 +37,7 @@ ...@@ -37,6 +37,7 @@
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
#include <potracelib.h> #include <potracelib.h>
#include <auxiliary.h> #include <auxiliary.h>
#include <common.h>
#include <bitmap2component.h> #include <bitmap2component.h>
...@@ -158,6 +159,12 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile, ...@@ -158,6 +159,12 @@ int bitmap2component( potrace_bitmap_t* aPotrace_bitmap, FILE* aOutfile,
st = potrace_trace( param, aPotrace_bitmap ); st = potrace_trace( param, aPotrace_bitmap );
if( !st || st->status != POTRACE_STATUS_OK ) if( !st || st->status != POTRACE_STATUS_OK )
{ {
if( st )
{
potrace_state_free( st );
}
potrace_param_free( param );
fprintf( stderr, "Error tracing bitmap: %s\n", strerror( errno ) ); fprintf( stderr, "Error tracing bitmap: %s\n", strerror( errno ) );
return 1; return 1;
} }
...@@ -431,7 +438,7 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer ) ...@@ -431,7 +438,7 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
potrace_dpoint_t( *c )[3]; potrace_dpoint_t( *c )[3];
setlocale( LC_NUMERIC, "C" ); // Switch the locale to standard C LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats
// The layer name has meaning only for .kicad_mod files. // The layer name has meaning only for .kicad_mod files.
// For these files the header creates 2 invisible texts: value and ref // For these files the header creates 2 invisible texts: value and ref
...@@ -524,8 +531,6 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer ) ...@@ -524,8 +531,6 @@ void BITMAPCONV_INFO::CreateOutputFile( BMP2CMP_MOD_LAYER aModLayer )
} }
OuputFileEnd(); OuputFileEnd();
setlocale( LC_NUMERIC, "" ); // revert to the current locale
} }
......
...@@ -49,7 +49,7 @@ enum textbox { ...@@ -49,7 +49,7 @@ enum textbox {
EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType )
{ {
InitVars(); initVars();
m_StructType = idType; m_StructType = idType;
m_Parent = parent; m_Parent = parent;
} }
...@@ -57,14 +57,14 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType ) ...@@ -57,14 +57,14 @@ EDA_ITEM::EDA_ITEM( EDA_ITEM* parent, KICAD_T idType )
EDA_ITEM::EDA_ITEM( KICAD_T idType ) EDA_ITEM::EDA_ITEM( KICAD_T idType )
{ {
InitVars(); initVars();
m_StructType = idType; m_StructType = idType;
} }
EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
{ {
InitVars(); initVars();
m_StructType = base.m_StructType; m_StructType = base.m_StructType;
m_Parent = base.m_Parent; m_Parent = base.m_Parent;
m_Flags = base.m_Flags; m_Flags = base.m_Flags;
...@@ -75,7 +75,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base ) ...@@ -75,7 +75,7 @@ EDA_ITEM::EDA_ITEM( const EDA_ITEM& base )
} }
void EDA_ITEM::InitVars() void EDA_ITEM::initVars()
{ {
m_StructType = TYPE_NOT_INIT; m_StructType = TYPE_NOT_INIT;
Pnext = NULL; // Linked list: Link (next struct) Pnext = NULL; // Linked list: Link (next struct)
......
...@@ -83,7 +83,7 @@ std::string Double2Str( double aValue ) ...@@ -83,7 +83,7 @@ std::string Double2Str( double aValue )
len = sprintf( buf, "%.16g", aValue ); len = sprintf( buf, "%.16g", aValue );
} }
return std::string( buf, len );; return std::string( buf, len );
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2013-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2015 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 * This program is free software; you can redistribute it and/or
...@@ -72,7 +72,6 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType, ...@@ -72,7 +72,6 @@ EDA_BASE_FRAME::EDA_BASE_FRAME( wxWindow* aParent, FRAME_T aFrameType,
m_Ident = aFrameType; m_Ident = aFrameType;
m_mainToolBar = NULL; m_mainToolBar = NULL;
m_FrameIsActive = true;
m_hasAutoSave = false; m_hasAutoSave = false;
m_autoSaveState = false; m_autoSaveState = false;
m_autoSaveInterval = -1; m_autoSaveInterval = -1;
......
...@@ -197,7 +197,7 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg ) ...@@ -197,7 +197,7 @@ bool BITMAP_BASE::LoadData( LINE_READER& aLine, wxString& aErrorMsg )
} }
EDA_RECT BITMAP_BASE::GetBoundingBox() const const EDA_RECT BITMAP_BASE::GetBoundingBox() const
{ {
EDA_RECT rect; EDA_RECT rect;
......
...@@ -411,14 +411,14 @@ public: ...@@ -411,14 +411,14 @@ public:
// wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or // wxModalEventLoop depends on this (so we can't just use ON_BLOCK_EXIT or
// something similar here) // something similar here)
#if wxUSE_EXCEPTIONS #if wxUSE_EXCEPTIONS
for ( ;; ) for( ; ; )
{ {
try try
{ {
#endif // wxUSE_EXCEPTIONS #endif // wxUSE_EXCEPTIONS
// this is the event loop itself // this is the event loop itself
for ( ;; ) for( ; ; )
{ {
// generate and process idle events for as long as we don't // generate and process idle events for as long as we don't
// have anything else to do // have anything else to do
...@@ -446,7 +446,7 @@ public: ...@@ -446,7 +446,7 @@ public:
// handlers endlessly generate new events but they shouldn't do // handlers endlessly generate new events but they shouldn't do
// this in a well-behaved program and we shouldn't just discard the // this in a well-behaved program and we shouldn't just discard the
// events we already have, they might be important. // events we already have, they might be important.
for ( ;; ) for( ; ; )
{ {
bool hasMoreEvents = false; bool hasMoreEvents = false;
if ( wxTheApp && wxTheApp->HasPendingEvents() ) if ( wxTheApp && wxTheApp->HasPendingEvents() )
......
...@@ -41,7 +41,7 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem ...@@ -41,7 +41,7 @@ DIALOG_IMAGE_EDITOR::DIALOG_IMAGE_EDITOR( wxWindow* aParent, BITMAP_BASE* aItem
m_buttonUndoLast->Enable( false ); m_buttonUndoLast->Enable( false );
wxString msg; wxString msg;
msg.Printf( wxT("%f"), m_workingImage->m_Scale ); msg.Printf( wxT("%f"), m_workingImage->m_Scale );
m_textCtrlScale->SetValue( msg );; m_textCtrlScale->SetValue( msg );
GetSizer()->SetSizeHints( this ); GetSizer()->SetSizeHints( this );
Layout(); Layout();
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -226,8 +226,6 @@ void EDA_DRAW_FRAME::EraseMsgBox() ...@@ -226,8 +226,6 @@ void EDA_DRAW_FRAME::EraseMsgBox()
void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event ) void EDA_DRAW_FRAME::OnActivate( wxActivateEvent& event )
{ {
m_FrameIsActive = event.GetActive();
if( m_canvas ) if( m_canvas )
m_canvas->SetCanStartBlock( -1 ); m_canvas->SetCanStartBlock( -1 );
......
...@@ -815,11 +815,12 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd ...@@ -815,11 +815,12 @@ void OPENGL_GAL::drawLineQuad( const VECTOR2D& aStartPoint, const VECTOR2D& aEnd
VECTOR2D startEndVector = aEndPoint - aStartPoint; VECTOR2D startEndVector = aEndPoint - aStartPoint;
double lineLength = startEndVector.EuclideanNorm(); double lineLength = startEndVector.EuclideanNorm();
double scale = 0.5 * lineWidth / lineLength;
if( lineLength <= 0.0 ) if( lineLength <= 0.0 )
return; return;
double scale = 0.5 * lineWidth / lineLength;
// The perpendicular vector also needs transformations // The perpendicular vector also needs transformations
glm::vec4 vector = currentManager->GetTransformation() * glm::vec4 vector = currentManager->GetTransformation() *
glm::vec4( -startEndVector.y * scale, startEndVector.x * scale, 0.0, 0.0 ); glm::vec4( -startEndVector.y * scale, startEndVector.x * scale, 0.0, 0.0 );
......
...@@ -65,7 +65,7 @@ void GRID_TRICKS::getSelectedArea() ...@@ -65,7 +65,7 @@ void GRID_TRICKS::getSelectedArea()
wxArrayInt cols = m_grid->GetSelectedCols(); wxArrayInt cols = m_grid->GetSelectedCols();
wxArrayInt rows = m_grid->GetSelectedRows(); wxArrayInt rows = m_grid->GetSelectedRows();
DBG(printf("topLeft.Count():%zd botRight:Count():%zd\n", topLeft.Count(), botRight.Count() );) DBG(printf("topLeft.Count():%d botRight:Count():%d\n", int( topLeft.Count() ), int( botRight.Count() ) );)
if( topLeft.Count() && botRight.Count() ) if( topLeft.Count() && botRight.Count() )
{ {
......
...@@ -125,7 +125,7 @@ struct APP_SINGLE_TOP : public wxApp ...@@ -125,7 +125,7 @@ struct APP_SINGLE_TOP : public wxApp
{ {
wxLogError( wxT( "Unhandled exception class: %s what: %s" ), wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );; GetChars( FROM_UTF8( e.what() ) ) );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
...@@ -158,7 +158,7 @@ struct APP_SINGLE_TOP : public wxApp ...@@ -158,7 +158,7 @@ struct APP_SINGLE_TOP : public wxApp
{ {
wxLogError( wxT( "Unhandled exception class: %s what: %s" ), wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );; GetChars( FROM_UTF8( e.what() ) ) );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
......
...@@ -10,7 +10,6 @@ add_definitions( -DCVPCB ) ...@@ -10,7 +10,6 @@ add_definitions( -DCVPCB )
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN ) if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" ) set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif() endif()
......
...@@ -218,7 +218,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event ) ...@@ -218,7 +218,7 @@ void CVPCB_MAINFRAME::AutomaticFootprintMatching( wxCommandEvent& event )
bool equ_is_unique = true; bool equ_is_unique = true;
unsigned next = idx+1; unsigned next = idx+1;
unsigned previous = idx-1; int previous = idx-1;
if( next < equiv_List.size() && if( next < equiv_List.size() &&
equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue ) equivItem.m_ComponentValue == equiv_List[next].m_ComponentValue )
......
...@@ -306,7 +306,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles() ...@@ -306,7 +306,7 @@ bool CVPCB_MAINFRAME::ReadNetListAndLinkFiles()
if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy()) if( component->GetFPID().IsLegacy() || component->GetAltFPID().IsLegacy())
continue; continue;
m_indexes.push_back( ii );; m_indexes.push_back( ii );
} }
// If a n assignment conflict is found, // If a n assignment conflict is found,
......
...@@ -1055,7 +1055,7 @@ bool LIB_PART::LoadFootprints( LINE_READER& aLineReader, wxString& aErrorMsg ) ...@@ -1055,7 +1055,7 @@ bool LIB_PART::LoadFootprints( LINE_READER& aLineReader, wxString& aErrorMsg )
} }
EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const const EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const
{ {
EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
...@@ -1080,7 +1080,7 @@ EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const ...@@ -1080,7 +1080,7 @@ EDA_RECT LIB_PART::GetBoundingBox( int aUnit, int aConvert ) const
} }
EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const const EDA_RECT LIB_PART::GetBodyBoundingBox( int aUnit, int aConvert ) const
{ {
EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); EDA_RECT bBox( wxPoint( 0, 0 ), wxSize( 0, 0 ) );
......
...@@ -296,7 +296,7 @@ public: ...@@ -296,7 +296,7 @@ public:
* if aConvert == 0 Convert is non used * if aConvert == 0 Convert is non used
* Invisible fields are not taken in account * Invisible fields are not taken in account
**/ **/
EDA_RECT GetBoundingBox( int aUnit, int aConvert ) const; const EDA_RECT GetBoundingBox( int aUnit, int aConvert ) const;
/** /**
* Function GetBodyBoundingBox * Function GetBodyBoundingBox
...@@ -307,7 +307,7 @@ public: ...@@ -307,7 +307,7 @@ public:
* if aConvert == 0 Convert is non used * if aConvert == 0 Convert is non used
* Fields are not taken in account * Fields are not taken in account
**/ **/
EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert ) const; const EDA_RECT GetBodyBoundingBox( int aUnit, int aConvert ) const;
/** /**
* Function SaveDateAndTime * Function SaveDateAndTime
......
...@@ -550,7 +550,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers() ...@@ -550,7 +550,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::initBuffers()
if( !it->m_Visible ) if( !it->m_Visible )
fld.SetVisible( false ); fld.SetVisible( false );
else else
fld.SetVisible( true );; fld.SetVisible( true );
} }
else else
{ {
......
...@@ -118,14 +118,14 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event ) ...@@ -118,14 +118,14 @@ void DIALOG_LIB_EDIT_PIN::OnPropertiesChange( wxCommandEvent& event )
if( ! IsShown() ) // do nothing at init time if( ! IsShown() ) // do nothing at init time
return; return;
int pinNameSize = ValueFromString( g_UserUnit, GetNameTextSize() ); int pinNameSize = ValueFromString( g_UserUnit, GetPinNameTextSize() );
int pinNumSize = ValueFromString( g_UserUnit, GetPadNameTextSize()); int pinNumSize = ValueFromString( g_UserUnit, GetPadNameTextSize());
int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() ); int pinOrient = LIB_PIN::GetOrientationCode( GetOrientation() );
int pinLength = ValueFromString( g_UserUnit, GetLength() ); int pinLength = ValueFromString( g_UserUnit, GetLength() );
int pinShape = LIB_PIN::GetStyleCode( GetStyle() ); int pinShape = LIB_PIN::GetStyleCode( GetStyle() );
int pinType = GetElectricalType(); int pinType = GetElectricalType();
m_dummyPin->SetName( GetName() ); m_dummyPin->SetName( GetPinName() );
m_dummyPin->SetNameTextSize( pinNameSize ); m_dummyPin->SetNameTextSize( pinNameSize );
m_dummyPin->SetNumber( GetPadName() ); m_dummyPin->SetNumber( GetPadName() );
m_dummyPin->SetNumberTextSize( pinNumSize ); m_dummyPin->SetNumberTextSize( pinNumSize );
......
...@@ -71,19 +71,19 @@ public: ...@@ -71,19 +71,19 @@ public:
void SetStyle( int style ) { m_choiceStyle->SetSelection( style ); } void SetStyle( int style ) { m_choiceStyle->SetSelection( style ); }
int GetStyle( void ) { return m_choiceStyle->GetSelection(); } int GetStyle( void ) { return m_choiceStyle->GetSelection(); }
void SetName( const wxString& name ) { m_textPinName->SetValue( name ); } void SetPinName( const wxString& name ) { m_textPinName->SetValue( name ); }
wxString GetName( void ) { return m_textPinName->GetValue(); } wxString GetPinName( void ) { return m_textPinName->GetValue(); }
void SetNameTextSize( const wxString& size ) void SetPinNameTextSize( const wxString& size )
{ {
m_textPinNameTextSize->SetValue( size ); m_textPinNameTextSize->SetValue( size );
} }
wxString GetNameTextSize( void ) wxString GetPinNameTextSize( void )
{ {
return m_textPinNameTextSize->GetValue(); return m_textPinNameTextSize->GetValue();
} }
void SetNameTextSizeUnits( const wxString& units ) void SetPinNameTextSizeUnits( const wxString& units )
{ {
m_staticNameTextSizeUnits->SetLabel( units ); m_staticNameTextSizeUnits->SetLabel( units );
} }
......
...@@ -1919,38 +1919,44 @@ void LIB_PIN::SetWidth( int aWidth ) ...@@ -1919,38 +1919,44 @@ void LIB_PIN::SetWidth( int aWidth )
void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList ) void LIB_PIN::GetMsgPanelInfo( MSG_PANEL_ITEMS& aList )
{ {
wxString Text; wxString text;
LIB_ITEM::GetMsgPanelInfo( aList ); LIB_ITEM::GetMsgPanelInfo( aList );
aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Name" ), m_name, DARKCYAN ) );
if( m_number == 0 ) if( m_number == 0 )
Text = wxT( "?" ); text = wxT( "?" );
else else
PinStringNum( Text ); PinStringNum( text );
aList.push_back( MSG_PANEL_ITEM( _( "Number" ), Text, DARKCYAN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Number" ), text, DARKCYAN ) );
aList.push_back( MSG_PANEL_ITEM( _( "Type" ), aList.push_back( MSG_PANEL_ITEM( _( "Type" ),
wxGetTranslation( pin_electrical_type_names[ m_type ] ), wxGetTranslation( pin_electrical_type_names[ m_type ] ),
RED ) ); RED ) );
Text = wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), Text, BLUE ) ); int styleCodeIndex = GetStyleCodeIndex( m_shape );
if( styleCodeIndex >= 0 )
text = wxGetTranslation( pin_style_names[ styleCodeIndex ] );
else
text = wxT( "?" );
aList.push_back( MSG_PANEL_ITEM( _( "Style" ), text, BLUE ) );
if( IsVisible() ) if( IsVisible() )
Text = _( "Yes" ); text = _( "Yes" );
else else
Text = _( "No" ); text = _( "No" );
aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), Text, DARKGREEN ) ); aList.push_back( MSG_PANEL_ITEM( _( "Visible" ), text, DARKGREEN ) );
// Display pin length // Display pin length
Text = StringFromValue( g_UserUnit, m_length, true ); text = StringFromValue( g_UserUnit, m_length, true );
aList.push_back( MSG_PANEL_ITEM( _( "Length" ), Text, MAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Length" ), text, MAGENTA ) );
Text = wxGetTranslation( pin_orientation_names[ GetOrientationCodeIndex( m_orientation ) ] ); text = wxGetTranslation( pin_orientation_names[ GetOrientationCodeIndex( m_orientation ) ] );
aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), Text, DARKMAGENTA ) ); aList.push_back( MSG_PANEL_ITEM( _( "Orientation" ), text, DARKMAGENTA ) );
} }
...@@ -2201,11 +2207,18 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const ...@@ -2201,11 +2207,18 @@ BITMAP_DEF LIB_PIN::GetMenuImage() const
wxString LIB_PIN::GetSelectMenuText() const wxString LIB_PIN::GetSelectMenuText() const
{ {
wxString tmp; wxString tmp;
wxString style;
int styleCode = GetStyleCodeIndex( m_shape );
if( styleCode >= 0 )
style = wxGetTranslation( pin_style_names[ styleCode ] );
else
style = wxT( "?" );
tmp.Printf( _( "Pin %s, %s, %s" ), tmp.Printf( _( "Pin %s, %s, %s" ),
GetChars( GetNumberString() ), GetChars( GetNumberString() ),
GetChars( GetTypeString() ), GetChars( GetTypeString() ),
GetChars( wxGetTranslation( pin_style_names[ GetStyleCodeIndex( m_shape ) ] ) ) GetChars( style )
); );
return tmp; return tmp;
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors.
* *
...@@ -110,9 +110,9 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -110,9 +110,9 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(), dlg.SetElectricalTypeList( LIB_PIN::GetElectricalTypeNames(),
LIB_PIN::GetElectricalTypeSymbols() ); LIB_PIN::GetElectricalTypeSymbols() );
dlg.SetElectricalType( pin->GetType() ); dlg.SetElectricalType( pin->GetType() );
dlg.SetName( pin->GetName() ); dlg.SetPinName( pin->GetName() );
dlg.SetNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) ); dlg.SetPinNameTextSize( StringFromValue( g_UserUnit, pin->GetNameTextSize() ) );
dlg.SetNameTextSizeUnits( units ); dlg.SetPinNameTextSizeUnits( units );
dlg.SetPadName( pin->GetNumberString() ); dlg.SetPadName( pin->GetNumberString() );
dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) ); dlg.SetPadNameTextSize( StringFromValue( g_UserUnit, pin->GetNumberTextSize() ) );
...@@ -132,7 +132,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -132,7 +132,6 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
dlg.Layout(); dlg.Layout();
dlg.Fit(); dlg.Fit();
dlg.SetMinSize( dlg.GetSize() ); dlg.SetMinSize( dlg.GetSize() );
// dlg.SetLastSizeAndPosition(); // done in DIALOG_SHIM::Show()
if( dlg.ShowModal() == wxID_CANCEL ) if( dlg.ShowModal() == wxID_CANCEL )
{ {
...@@ -145,7 +144,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -145,7 +144,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
} }
// Save the pin properties to use for the next new pin. // Save the pin properties to use for the next new pin.
LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetNameTextSize() ); LastPinNameSize = ValueFromString( g_UserUnit, dlg.GetPinNameTextSize() );
LastPinNumSize = ValueFromString( g_UserUnit, dlg.GetPadNameTextSize() ); LastPinNumSize = ValueFromString( g_UserUnit, dlg.GetPadNameTextSize() );
LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() ); LastPinOrient = LIB_PIN::GetOrientationCode( dlg.GetOrientation() );
LastPinLength = ValueFromString( g_UserUnit, dlg.GetLength() ); LastPinLength = ValueFromString( g_UserUnit, dlg.GetLength() );
...@@ -156,7 +155,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event ) ...@@ -156,7 +155,7 @@ void LIB_EDIT_FRAME::OnEditPin( wxCommandEvent& event )
LastPinVisible = dlg.GetVisible(); LastPinVisible = dlg.GetVisible();
pin->EnableEditMode( true, m_editPinsPerPartOrConvert ); pin->EnableEditMode( true, m_editPinsPerPartOrConvert );
pin->SetName( dlg.GetName() ); pin->SetName( dlg.GetPinName() );
pin->SetNameTextSize( GetLastPinNameSize() ); pin->SetNameTextSize( GetLastPinNameSize() );
pin->SetNumber( dlg.GetPadName() ); pin->SetNumber( dlg.GetPadName() );
pin->SetNumberTextSize( GetLastPinNumSize() ); pin->SetNumberTextSize( GetLastPinNumSize() );
......
...@@ -125,22 +125,20 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC, ...@@ -125,22 +125,20 @@ void SCH_MARKER::Draw( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
} }
bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, wxPoint * aFindLocation ) bool SCH_MARKER::Matches( wxFindReplaceData& aSearchData, void* aAuxData,
wxPoint * aFindLocation )
{ {
if( !SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ) if( SCH_ITEM::Matches( m_drc.GetErrorText(), aSearchData ) ||
{ SCH_ITEM::Matches( m_drc.GetMainText(), aSearchData ) ||
if( SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) ) SCH_ITEM::Matches( m_drc.GetAuxiliaryText(), aSearchData ) )
{ {
if( aFindLocation ) if( aFindLocation )
*aFindLocation = m_Pos; *aFindLocation = m_Pos;
return true; return true;
} }
return false;
}
if( aFindLocation ) return false;
*aFindLocation = m_Pos;
return true;
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -89,13 +89,16 @@ public: ...@@ -89,13 +89,16 @@ public:
void Rotate( wxPoint aPosition ); void Rotate( wxPoint aPosition );
/** /**
* Function Matches, virtual from the base class EDA_ITEM
* Compare DRC marker main and auxiliary text against search string. * Compare DRC marker main and auxiliary text against search string.
* *
* @param aSearchData - Criteria to search against. * @param aSearchData - Criteria to search against.
* @param aAuxData A pointer to optional data required for the search or NULL
* if not used.
* @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL. * @param aFindLocation - a wxPoint where to put the location of matched item. can be NULL.
* @return True if the DRC main or auxiliary text matches the search criteria. * @return True if the DRC main or auxiliary text matches the search criteria.
*/ */
bool Matches( wxFindReplaceData& aSearchData, wxPoint* aFindLocation ); bool Matches( wxFindReplaceData& aSearchData, void* aAuxData, wxPoint* aFindLocation );
void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ); void GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList );
......
...@@ -172,7 +172,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event ) ...@@ -172,7 +172,7 @@ void GERBER_LAYER_WIDGET::onPopupSelection( wxCommandEvent& event )
{ {
int rowCount; int rowCount;
int menuId = event.GetId(); int menuId = event.GetId();
bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;; bool visible = (menuId == ID_SHOW_ALL_LAYERS) ? true : false;
long visibleLayers = 0; long visibleLayers = 0;
bool force_active_layer_visible; bool force_active_layer_visible;
......
...@@ -172,7 +172,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event ) ...@@ -172,7 +172,7 @@ void GERBVIEW_FRAME::ExportDataInPcbnewFormat( wxCommandEvent& event )
} }
wxString fileName; wxString fileName;
wxString path = wxGetCwd();; wxString path = wxGetCwd();
wxFileDialog filedlg( this, _( "Board file name:" ), wxFileDialog filedlg( this, _( "Board file name:" ),
path, fileName, PcbFileWildcard, path, fileName, PcbFileWildcard,
......
...@@ -269,11 +269,6 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -269,11 +269,6 @@ void GERBVIEW_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->SetPath( wxT( "drl_files" ) ); aCfg->SetPath( wxT( "drl_files" ) );
m_drillFileHistory.Load( *aCfg ); m_drillFileHistory.Load( *aCfg );
aCfg->SetPath( wxT( ".." ) ); aCfg->SetPath( wxT( ".." ) );
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in config,
// but forget to back to current locale. So we call SetLocaleTo_Default
SetLocaleTo_Default();
} }
......
...@@ -186,7 +186,7 @@ protected: ...@@ -186,7 +186,7 @@ protected:
private: private:
void InitVars(); void initVars();
public: public:
...@@ -428,6 +428,7 @@ public: ...@@ -428,6 +428,7 @@ public:
/** /**
* Function Matches * Function Matches
* compares \a aText against search criteria in \a aSearchData. * compares \a aText against search criteria in \a aSearchData.
* Helper function used in search and replace dialog
* *
* @param aText A reference to a wxString object containing the string to test. * @param aText A reference to a wxString object containing the string to test.
* @param aSearchData The criteria to search against. * @param aSearchData The criteria to search against.
......
...@@ -140,7 +140,7 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) ); ...@@ -140,7 +140,7 @@ public: BITMAP_BASE( const wxPoint& pos = wxPoint( 0, 0 ) );
* schematic coordinate system. It is OK to overestimate the size * schematic coordinate system. It is OK to overestimate the size
* by a few counts. * by a few counts.
*/ */
EDA_RECT GetBoundingBox() const; const EDA_RECT GetBoundingBox() const;
void DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos ); void DrawBitmap( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPos );
......
...@@ -64,7 +64,7 @@ public: ...@@ -64,7 +64,7 @@ public:
const wxString& GetTitle() const const wxString& GetTitle() const
{ {
return getTbText( titleIdx );; return getTbText( titleIdx );
} }
/** /**
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2009 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2009-2015 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -118,7 +118,6 @@ protected: ...@@ -118,7 +118,6 @@ protected:
wxSize m_FrameSize; wxSize m_FrameSize;
wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar wxAuiToolBar* m_mainToolBar; ///< Standard horizontal Toolbar
bool m_FrameIsActive;
wxString m_FrameName; ///< name used for writing and reading setup wxString m_FrameName; ///< name used for writing and reading setup
///< It is "SchematicFrame", "PcbFrame" .... ///< It is "SchematicFrame", "PcbFrame" ....
wxString m_AboutTitle; ///< Name of program displayed in About. wxString m_AboutTitle; ///< Name of program displayed in About.
...@@ -200,8 +199,6 @@ public: ...@@ -200,8 +199,6 @@ public:
wxString GetName() const { return m_FrameName; } wxString GetName() const { return m_FrameName; }
bool IsActive() const { return m_FrameIsActive; }
bool IsType( FRAME_T aType ) const { return m_Ident == aType; } bool IsType( FRAME_T aType ) const { return m_Ident == aType; }
void GetKicadHelp( wxCommandEvent& event ); void GetKicadHelp( wxCommandEvent& event );
......
...@@ -271,7 +271,7 @@ struct APP_KICAD : public wxApp ...@@ -271,7 +271,7 @@ struct APP_KICAD : public wxApp
{ {
wxLogError( wxT( "Unhandled exception class: %s what: %s" ), wxLogError( wxT( "Unhandled exception class: %s what: %s" ),
GetChars( FROM_UTF8( typeid(e).name() )), GetChars( FROM_UTF8( typeid(e).name() )),
GetChars( FROM_UTF8( e.what() ) ) );; GetChars( FROM_UTF8( e.what() ) ) );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& ioe )
{ {
......
...@@ -84,7 +84,7 @@ public: ...@@ -84,7 +84,7 @@ public:
* may be called soon after ComputeBoundingBox() to return the same EDA_RECT, * may be called soon after ComputeBoundingBox() to return the same EDA_RECT,
* as long as the CLASS_PL_EDITOR_LAYOUT has not changed. * as long as the CLASS_PL_EDITOR_LAYOUT has not changed.
*/ */
EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override const EDA_RECT GetBoundingBox() const { return m_BoundingBox; } // override
void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; } void SetBoundingBox( const EDA_RECT& aBox ) { m_BoundingBox = aBox; }
......
...@@ -198,7 +198,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem ) ...@@ -198,7 +198,7 @@ void PROPERTIES_FRAME::CopyPrmsFromItemToPanel( WORKSHEET_DATAITEM* aItem )
WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem; WORKSHEET_DATAITEM_TEXT* item = (WORKSHEET_DATAITEM_TEXT*) aItem;
item->m_FullText = item->m_TextBase; item->m_FullText = item->m_TextBase;
// Replace our '\' 'n' sequence by the EOL char // Replace our '\' 'n' sequence by the EOL char
item->ReplaceAntiSlashSequence();; item->ReplaceAntiSlashSequence();
m_textCtrlText->SetValue( item->m_FullText ); m_textCtrlText->SetValue( item->m_FullText );
msg.Printf( wxT("%d"), item->m_IncrementLabel ); msg.Printf( wxT("%d"), item->m_IncrementLabel );
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
/* /*
* This program source code file is part of KICAD, a free EDA CAD application. * This program source code file is part of KICAD, a free EDA CAD application.
* *
* Copyright (C) 12011 jean-pierre.charras * Copyright (C) 2011 jean-pierre.charras
* Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2011 Kicad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
...@@ -83,10 +83,12 @@ void PCB_CALCULATOR_FRAME::TransfAttenuatorDataToPanel() ...@@ -83,10 +83,12 @@ void PCB_CALCULATOR_FRAME::TransfAttenuatorDataToPanel()
m_AttValueCtrl->Enable( m_currAttenuator->m_Attenuation_Enable ); m_AttValueCtrl->Enable( m_currAttenuator->m_Attenuation_Enable );
m_ZinValueCtrl->Enable( m_currAttenuator->m_Zin_Enable ); m_ZinValueCtrl->Enable( m_currAttenuator->m_Zin_Enable );
if( m_currAttenuator->m_Zin_Enable ) if( m_currAttenuator->m_Zin_Enable )
msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zin ); msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zin );
else else
msg.Clear();; msg.Clear();
m_ZinValueCtrl->SetValue( msg ); m_ZinValueCtrl->SetValue( msg );
msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zout ); msg.Printf( wxT( "%g" ), m_currAttenuator->m_Zout );
......
...@@ -373,7 +373,6 @@ endif() ...@@ -373,7 +373,6 @@ endif()
if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN ) if( KICAD_USE_WEBKIT AND BUILD_GITHUB_PLUGIN )
set( WEBVIEWER_WXLIB "webviewer" ) set( WEBVIEWER_WXLIB "webviewer" )
add_definitions( -DKICAD_USE_WEBKIT )
endif() endif()
......
...@@ -652,8 +652,7 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD ...@@ -652,8 +652,7 @@ int getOptimalModulePlacement( PCB_EDIT_FRAME* aFrame, MODULE* aModule, wxDC* aD
CurrPosition = initialPos; CurrPosition = initialPos;
// Undraw the current footprint // Undraw the current footprint
g_Offset_Module = wxPoint( 0, 0 ); aModule->DrawOutlinesWhenMoving( aFrame->GetCanvas(), aDC, wxPoint( 0, 0 ) );
DrawModuleOutlines( aFrame->GetCanvas(), aDC, aModule );
g_Offset_Module = mod_pos - CurrPosition; g_Offset_Module = mod_pos - CurrPosition;
......
...@@ -767,11 +767,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -767,11 +767,6 @@ void PCB_BASE_FRAME::LoadSettings( wxConfigBase* aCfg )
if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH ) if( m_DisplayOptions.m_DisplayModText < LINE || m_DisplayOptions.m_DisplayModText > SKETCH )
m_DisplayOptions.m_DisplayModText = FILLED; m_DisplayOptions.m_DisplayModText = FILLED;
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in config,
// but forget to back to current locale. So we call SetLocaleTo_Default
SetLocaleTo_Default( );
} }
......
...@@ -532,7 +532,7 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset ...@@ -532,7 +532,7 @@ static void drawPickedItems( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint aOffset
{ {
case PCB_MODULE_T: case PCB_MODULE_T:
frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK; frame->GetBoard()->m_Status_Pcb &= ~RATSNEST_ITEM_LOCAL_OK;
DrawModuleOutlines( aPanel, aDC, (MODULE*) item ); ((MODULE*) item)->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
break; break;
case PCB_LINE_T: case PCB_LINE_T:
......
...@@ -6,11 +6,11 @@ ...@@ -6,11 +6,11 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* *
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -1212,10 +1212,12 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData, ...@@ -1212,10 +1212,12 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const NETINFO_ITEM* BOARD::FindNet( int aNetcode ) const
{ {
// the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1. // the first valid netcode is 1 and the last is m_NetInfo.GetCount()-1.
// zero is reserved for "no connection" and is not used. // zero is reserved for "no connection" and is not actually a net.
// NULL is returned for non valid netcodes // NULL is returned for non valid netcodes
if( aNetcode == NETINFO_LIST::UNCONNECTED ) wxASSERT( m_NetInfo.GetNetCount() > 0 ); // net zero should exist
if( aNetcode == NETINFO_LIST::UNCONNECTED && m_NetInfo.GetNetCount() == 0 )
return &NETINFO_LIST::ORPHANED; return &NETINFO_LIST::ORPHANED;
else else
return m_NetInfo.GetNetItem( aNetcode ); return m_NetInfo.GetNetItem( aNetcode );
...@@ -2459,14 +2461,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2459,14 +2461,14 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
} }
} }
// If needed, remove the single pad nets: // We need the pad list, for next tests.
if( aDeleteSinglePadNets && !aNetlist.IsDryRun() ) // padlist is the list of pads, sorted by netname.
{
BuildListOfNets(); BuildListOfNets();
std::vector<D_PAD*> padlist = GetPads(); std::vector<D_PAD*> padlist = GetPads();
// padlist is the list of pads, sorted by netname. // If needed, remove the single pad nets:
if( aDeleteSinglePadNets && !aNetlist.IsDryRun() )
{
int count = 0; int count = 0;
wxString netname; wxString netname;
D_PAD* pad = NULL; D_PAD* pad = NULL;
...@@ -2482,6 +2484,28 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2482,6 +2484,28 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
if( netname != pad->GetNetname() ) // End of net if( netname != pad->GetNetname() ) // End of net
{ {
if( previouspad && count == 1 ) if( previouspad && count == 1 )
{
// First, see if we have a copper zone attached to this pad.
// If so, this is not really a single pad net
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetArea( ii );
if( !zone->IsOnCopperLayer() )
continue;
if( zone->GetIsKeepout() )
continue;
if( zone->GetNet() == previouspad->GetNet() )
{
count++;
break;
}
}
if( count == 1 ) // Really one pad, and nothing else
{ {
if( aReporter && aReporter->ReportAll() ) if( aReporter && aReporter->ReportAll() )
{ {
...@@ -2494,6 +2518,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2494,6 +2518,8 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED ); previouspad->SetNetCode( NETINFO_LIST::UNCONNECTED );
} }
}
netname = pad->GetNetname(); netname = pad->GetNetname();
count = 1; count = 1;
} }
...@@ -2515,6 +2541,10 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2515,6 +2541,10 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
// They should exist in footprints, otherwise the footprint is wrong // They should exist in footprints, otherwise the footprint is wrong
// note also references or time stamps are updated, so we use only // note also references or time stamps are updated, so we use only
// the reference to find a footprint // the reference to find a footprint
//
// Also verify if zones have acceptable nets, i.e. nets with pads.
// Zone with no pad belongs to a "dead" net which happens after changes in schematic
// when no more pad use this net name.
if( aReporter && aReporter->ReportErrors() ) if( aReporter && aReporter->ReportErrors() )
{ {
wxString padname; wxString padname;
...@@ -2543,6 +2573,22 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets, ...@@ -2543,6 +2573,22 @@ void BOARD::ReplaceNetlist( NETLIST& aNetlist, bool aDeleteSinglePadNets,
aReporter->Report( msg ); aReporter->Report( msg );
} }
} }
// Test copper zones to detect "dead" nets (nets without any pad):
for( int ii = 0; ii < GetAreaCount(); ii++ )
{
ZONE_CONTAINER* zone = GetArea( ii );
if( !zone->IsOnCopperLayer() || zone->GetIsKeepout() )
continue;
if( zone->GetNet()->GetNodesCount() == 0 )
{
msg.Printf( _( "* Warning: copper zone (net name '%s'): net has no pad*\n" ),
GetChars( zone->GetNet()->GetNetname() ) );
aReporter->Report( msg );
}
}
} }
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -50,10 +50,10 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem ) ...@@ -50,10 +50,10 @@ BOARD_CONNECTED_ITEM::BOARD_CONNECTED_ITEM( const BOARD_CONNECTED_ITEM& aItem )
void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode ) void BOARD_CONNECTED_ITEM::SetNetCode( int aNetCode )
{ {
assert( aNetCode >= 0 ); // assert( aNetCode >= 0 );
BOARD* board = GetBoard(); BOARD* board = GetBoard();
if( board ) if( ( aNetCode >= 0 ) && board )
m_netinfo = board->FindNet( aNetCode ); m_netinfo = board->FindNet( aNetCode );
else else
m_netinfo = &NETINFO_LIST::ORPHANED; m_netinfo = &NETINFO_LIST::ORPHANED;
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -75,8 +75,10 @@ wxString DRC_ITEM::GetErrorText() const ...@@ -75,8 +75,10 @@ wxString DRC_ITEM::GetErrorText() const
return wxString( _( "Copper area inside copper area" ) ); return wxString( _( "Copper area inside copper area" ) );
case COPPERAREA_CLOSE_TO_COPPERAREA: case COPPERAREA_CLOSE_TO_COPPERAREA:
return wxString( _( "Copper areas intersect or are too close" ) ); return wxString( _( "Copper areas intersect or are too close" ) );
case DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE:
return wxString( _( "Copper area has a nonexistent net name" ) ); case DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE:
return wxString( _( "Copper area belongs a net which has no pads. This is strange" ) );
case DRCE_HOLE_NEAR_PAD: case DRCE_HOLE_NEAR_PAD:
return wxString( _( "Hole near pad" ) ); return wxString( _( "Hole near pad" ) );
case DRCE_HOLE_NEAR_TRACK: case DRCE_HOLE_NEAR_TRACK:
......
...@@ -45,7 +45,6 @@ ...@@ -45,7 +45,6 @@
#include <3d_struct.h> #include <3d_struct.h>
#include <msgpanel.h> #include <msgpanel.h>
#include <drag.h>
#include <class_board.h> #include <class_board.h>
#include <class_edge_mod.h> #include <class_edge_mod.h>
#include <class_module.h> #include <class_module.h>
......
...@@ -280,6 +280,18 @@ public: ...@@ -280,6 +280,18 @@ public:
GR_DRAWMODE aDrawMode, GR_DRAWMODE aDrawMode,
const wxPoint& aOffset = ZeroOffset ); const wxPoint& aOffset = ZeroOffset );
/**
* Function DrawOutlinesWhenMoving
* draws in XOR mode the footprint when moving it to the \a aDC.
* To speed up the drawing, only a simplified shape is drawn
* @param aPanel = draw panel, Used to know the clip box
* @param aDC = Current Device Context
* @param aMoveVector = the offset between the curr position and
* the draw position.
*/
void DrawOutlinesWhenMoving( EDA_DRAW_PANEL* aPanel,
wxDC* aDC, const wxPoint& aMoveVector );
/** /**
* function ReadandInsert3DComponentShape * function ReadandInsert3DComponentShape
* read the 3D component shape(s) of the footprint (physical shape) * read the 3D component shape(s) of the footprint (physical shape)
......
...@@ -320,7 +320,7 @@ public: ...@@ -320,7 +320,7 @@ public:
return NULL; return NULL;
} }
///> Constant that holds the unconnected net number ///> Constant that holds the unconnected net number (typically 0)
static const int UNCONNECTED; static const int UNCONNECTED;
///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no ///> NETINFO_ITEM meaning that there was no net assigned for an item, as there was no
......
...@@ -80,10 +80,7 @@ void NETINFO_ITEM::Draw( EDA_DRAW_PANEL* panel, ...@@ -80,10 +80,7 @@ void NETINFO_ITEM::Draw( EDA_DRAW_PANEL* panel,
void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{ {
int count;
wxString txt; wxString txt;
MODULE* module;
D_PAD* pad;
double lengthnet = 0.0; // This is the lenght of tracks on pcb double lengthnet = 0.0; // This is the lenght of tracks on pcb
double lengthPadToDie = 0.0; // this is the lenght of internal ICs connections double lengthPadToDie = 0.0; // this is the lenght of internal ICs connections
...@@ -92,12 +89,17 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -92,12 +89,17 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
txt.Printf( wxT( "%d" ), GetNet() ); txt.Printf( wxT( "%d" ), GetNet() );
aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "Net Code" ), txt, RED ) );
count = 0; // Warning: for netcode == NETINFO_LIST::ORPHANED, the parent or the board
module = m_parent->GetBoard()->m_Modules; // can be NULL
BOARD * board = m_parent ? m_parent->GetBoard() : NULL;
if( board == NULL )
return;
for( ; module != 0; module = module->Next() ) int count = 0;
for( MODULE* module = board->m_Modules; module != NULL; module = module->Next() )
{ {
for( pad = module->Pads(); pad != 0; pad = pad->Next() ) for( D_PAD* pad = module->Pads(); pad != 0; pad = pad->Next() )
{ {
if( pad->GetNetCode() == GetNet() ) if( pad->GetNetCode() == GetNet() )
{ {
...@@ -112,7 +114,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -112,7 +114,7 @@ void NETINFO_ITEM::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
count = 0; count = 0;
for( const TRACK *track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() ) for( const TRACK *track = board->m_Track; track != NULL; track = track->Next() )
{ {
if( track->Type() == PCB_VIA_T ) if( track->Type() == PCB_VIA_T )
{ {
......
...@@ -678,7 +678,7 @@ void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint, ...@@ -678,7 +678,7 @@ void D_PAD::GetOblongDrillGeometry( wxPoint& aStartPoint,
// of an equivalent segment which have the same position and width as the hole // of an equivalent segment which have the same position and width as the hole
int delta_cx, delta_cy; int delta_cx, delta_cy;
wxSize halfsize = GetDrillSize();; wxSize halfsize = GetDrillSize();
halfsize.x /= 2; halfsize.x /= 2;
halfsize.y /= 2; halfsize.y /= 2;
......
...@@ -207,7 +207,7 @@ public: ...@@ -207,7 +207,7 @@ public:
void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer, void TransformShapeWithClearanceToPolygon( CPOLYGONS_LIST& aCornerBuffer,
int aClearanceValue, int aClearanceValue,
int aCircleToSegmentsCount, int aCircleToSegmentsCount,
double aCorrectionFactor ) const;; double aCorrectionFactor ) const;
/** /**
* Function GetClearance * Function GetClearance
......
...@@ -257,7 +257,7 @@ void PCB_LAYER_WIDGET::ReFillRender() ...@@ -257,7 +257,7 @@ void PCB_LAYER_WIDGET::ReFillRender()
{ {
LAYER_WIDGET::ROW renderRow = s_render_rows[row]; LAYER_WIDGET::ROW renderRow = s_render_rows[row];
if( !isAllowedInFpMode( renderRow.id ) ) if( m_fp_editor_mode && !isAllowedInFpMode( renderRow.id ) )
continue; continue;
renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip ); renderRow.tooltip = wxGetTranslation( s_render_rows[row].tooltip );
...@@ -284,7 +284,7 @@ void PCB_LAYER_WIDGET::SyncRenderStates() ...@@ -284,7 +284,7 @@ void PCB_LAYER_WIDGET::SyncRenderStates()
{ {
int rowId = s_render_rows[row].id; int rowId = s_render_rows[row].id;
if( !isAllowedInFpMode( rowId ) ) if( m_fp_editor_mode && !isAllowedInFpMode( rowId ) )
continue; continue;
// this does not fire a UI event // this does not fire a UI event
......
...@@ -74,7 +74,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source ) ...@@ -74,7 +74,7 @@ void TEXTE_PCB::Copy( TEXTE_PCB* source )
m_Bold = source->m_Bold; m_Bold = source->m_Bold;
m_HJustify = source->m_HJustify; m_HJustify = source->m_HJustify;
m_VJustify = source->m_VJustify; m_VJustify = source->m_VJustify;
m_MultilineAllowed = m_MultilineAllowed; m_MultilineAllowed = source->m_MultilineAllowed;
m_Text = source->m_Text; m_Text = source->m_Text;
} }
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -625,27 +625,21 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList ) ...@@ -625,27 +625,21 @@ void ZONE_CONTAINER::GetMsgPanelInfo( std::vector< MSG_PANEL_ITEM >& aList )
{ {
if( GetNetCode() >= 0 ) if( GetNetCode() >= 0 )
{ {
NETINFO_ITEM* equipot = GetNet(); NETINFO_ITEM* net = GetNet();
if( equipot ) if( net )
msg = equipot->GetNetname(); msg = net->GetNetname();
else else // Should not occur
msg = wxT( "<noname>" ); msg = _( "<unknown>" );
} }
else // a netcode < 0 is an error else // a netcode < 0 is an error
{ msg = wxT( "<error>" );
msg = wxT( " [" );
msg << GetNetname() + wxT( "]" );
msg << wxT( " <" ) << _( "Not Found" ) << wxT( ">" );
}
aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "NetName" ), msg, RED ) );
#if 1
// Display net code : (useful in test or debug) // Display net code : (useful in test or debug)
msg.Printf( wxT( "%d" ), GetNetCode() ); msg.Printf( wxT( "%d" ), GetNetCode() );
aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) ); aList.push_back( MSG_PANEL_ITEM( _( "NetCode" ), msg, RED ) );
#endif
// Display priority level // Display priority level
msg.Printf( wxT( "%d" ), GetPriority() ); msg.Printf( wxT( "%d" ), GetPriority() );
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2011 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -578,7 +578,6 @@ public: ...@@ -578,7 +578,6 @@ public:
void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; } void SetDoNotAllowVias( bool aEnable ) { m_doNotAllowVias = aEnable; }
void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; } void SetDoNotAllowTracks( bool aEnable ) { m_doNotAllowTracks = aEnable; }
#if defined(DEBUG) #if defined(DEBUG)
virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override virtual void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
#endif #endif
...@@ -632,8 +631,8 @@ private: ...@@ -632,8 +631,8 @@ private:
/// The index of the corner being moved or -1 if no corner is selected. /// The index of the corner being moved or -1 if no corner is selected.
int m_CornerSelection; int m_CornerSelection;
int m_localFlgs; ///< Flags used in polygon calculations. /// Variable used in polygon calculations.
int m_localFlgs;
/** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used. /** Segments used to fill the zone (#m_FillMode ==1 ), when fill zone by segment is used.
* In this case the segments have #m_ZoneMinThickness width. * In this case the segments have #m_ZoneMinThickness width.
......
...@@ -45,6 +45,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline ) ...@@ -45,6 +45,7 @@ void PCB_EDIT_FRAME::ExecuteRemoteCommand( const char* cmdline )
wxPoint pos; wxPoint pos;
strncpy( line, cmdline, sizeof(line) - 1 ); strncpy( line, cmdline, sizeof(line) - 1 );
line[sizeof(line) - 1] = 0;
idcmd = strtok( line, " \n\r" ); idcmd = strtok( line, " \n\r" );
text = strtok( NULL, " \n\r" ); text = strtok( NULL, " \n\r" );
......
...@@ -431,7 +431,7 @@ void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes() ...@@ -431,7 +431,7 @@ void DIALOG_DESIGN_RULES::InitializeRulesSelectionBoxes()
m_leftClassChoice->Select( 0 ); m_leftClassChoice->Select( 0 );
m_buttonRightToLeft->Enable( false ); m_buttonRightToLeft->Enable( false );
m_buttonLeftToRight->Enable( false );; m_buttonLeftToRight->Enable( false );
FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() ); FillListBoxWithNetNames( m_leftListCtrl, m_leftClassChoice->GetStringSelection() );
FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() ); FillListBoxWithNetNames( m_rightListCtrl, m_rightClassChoice->GetStringSelection() );
...@@ -821,7 +821,7 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event ) ...@@ -821,7 +821,7 @@ void DIALOG_DESIGN_RULES::OnRightCBSelection( wxCommandEvent& event )
if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() ) if( m_leftClassChoice->GetStringSelection() == m_rightClassChoice->GetStringSelection() )
{ {
m_buttonRightToLeft->Enable( false ); m_buttonRightToLeft->Enable( false );
m_buttonLeftToRight->Enable( false );; m_buttonLeftToRight->Enable( false );
} }
else else
{ {
......
...@@ -188,7 +188,7 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event ) ...@@ -188,7 +188,7 @@ void DIALOG_FREEROUTE::OnLaunchButtonClick( wxCommandEvent& event )
command = value + wxFileName::GetPathSeparator(); command = value + wxFileName::GetPathSeparator();
command << wxT("bin\\java"); command << wxT("bin\\java");
#else // __WINDOWS__ #else // __WINDOWS__
command = wxT( "java" );; command = wxT( "java" );
#endif #endif
command << wxT(" -jar "); command << wxT(" -jar ");
......
...@@ -49,10 +49,10 @@ class CONNECTIONS; ...@@ -49,10 +49,10 @@ class CONNECTIONS;
/* /*
* a DRAG_LIST manages the list of track segments to modify * a DRAG_LIST manages the list of track segments to modify
* when the pad or the module is moving * when the pad or the module is moving in drag mode
*/ */
/* /**
* a DRAG_SEGM_PICKER manage one track segment or a via * a DRAG_SEGM_PICKER manage one track segment or a via
*/ */
class DRAG_SEGM_PICKER class DRAG_SEGM_PICKER
...@@ -65,7 +65,7 @@ public: ...@@ -65,7 +65,7 @@ public:
D_PAD* m_Pad_End; // pointer to the moving pad D_PAD* m_Pad_End; // pointer to the moving pad
// if the end point should follow this pad // if the end point should follow this pad
// or NULL // or NULL
bool m_Flag; // flag used in drag vias and drag track segment functions int m_TempFlags; // flag used in drag vias and drag track segment functions
private: private:
double m_RotationOffset; // initial orientation of the parent module double m_RotationOffset; // initial orientation of the parent module
......
...@@ -56,7 +56,7 @@ DRAG_SEGM_PICKER::DRAG_SEGM_PICKER( TRACK* aTrack ) ...@@ -56,7 +56,7 @@ DRAG_SEGM_PICKER::DRAG_SEGM_PICKER( TRACK* aTrack )
m_endInitialValue = m_Track->GetEnd(); m_endInitialValue = m_Track->GetEnd();
m_Pad_Start = m_Track->GetState( START_ON_PAD ) ? (D_PAD*)m_Track->start : NULL; m_Pad_Start = m_Track->GetState( START_ON_PAD ) ? (D_PAD*)m_Track->start : NULL;
m_Pad_End = m_Track->GetState( END_ON_PAD ) ? (D_PAD*)m_Track->end : NULL; m_Pad_End = m_Track->GetState( END_ON_PAD ) ? (D_PAD*)m_Track->end : NULL;
m_Flag = 0; m_TempFlags = 0;
m_RotationOffset = 0.0; m_RotationOffset = 0.0;
m_Flipped = false; m_Flipped = false;
} }
...@@ -320,16 +320,16 @@ void AddSegmentToDragList( int flag, TRACK* aTrack ) ...@@ -320,16 +320,16 @@ void AddSegmentToDragList( int flag, TRACK* aTrack )
DRAG_SEGM_PICKER wrapper( aTrack ); DRAG_SEGM_PICKER wrapper( aTrack );
if( flag & STARTPOINT ) if( flag & STARTPOINT )
wrapper.m_Flag |= 1; {
wrapper.m_TempFlags |= STARTPOINT;
if( flag & ENDPOINT )
wrapper.m_Flag |= 2;
if( flag & STARTPOINT )
aTrack->SetFlags( STARTPOINT ); aTrack->SetFlags( STARTPOINT );
}
if( flag & ENDPOINT ) if( flag & ENDPOINT )
{
wrapper.m_TempFlags |= ENDPOINT;
aTrack->SetFlags( ENDPOINT ); aTrack->SetFlags( ENDPOINT );
}
g_DragSegmentList.push_back( wrapper ); g_DragSegmentList.push_back( wrapper );
} }
...@@ -411,10 +411,10 @@ void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC ) ...@@ -411,10 +411,10 @@ void UndrawAndMarkSegmentsToDrag( EDA_DRAW_PANEL* aCanvas, wxDC* aDC )
track->SetState( IN_EDIT, false ); track->SetState( IN_EDIT, false );
track->SetFlags( IS_DRAGGED ); track->SetFlags( IS_DRAGGED );
if( g_DragSegmentList[ii].m_Flag & STARTPOINT ) if( g_DragSegmentList[ii].m_TempFlags & STARTPOINT )
track->SetFlags( STARTPOINT ); track->SetFlags( STARTPOINT );
if( g_DragSegmentList[ii].m_Flag & ENDPOINT ) if( g_DragSegmentList[ii].m_TempFlags & ENDPOINT )
track->SetFlags( ENDPOINT ); track->SetFlags( ENDPOINT );
track->Draw( aCanvas, aDC, GR_XOR ); track->Draw( aCanvas, aDC, GR_XOR );
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2004-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2014 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2014 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -564,6 +564,10 @@ void DRC::testZones() ...@@ -564,6 +564,10 @@ void DRC::testZones()
// if a netcode is < 0 the netname was not found when reading a netlist // if a netcode is < 0 the netname was not found when reading a netlist
// if a netcode is == 0 the netname is void, and the zone is not connected. // if a netcode is == 0 the netname is void, and the zone is not connected.
// This is allowed, but i am not sure this is a good idea // This is allowed, but i am not sure this is a good idea
//
// In recent Pcbnew versions, the netcode is always >= 0, but an internal net name
// is stored, and initalized from the file or the zone properpies editor.
// if it differs from the net name from net code, there is a DRC issue
for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ ) for( int ii = 0; ii < m_pcb->GetAreaCount(); ii++ )
{ {
ZONE_CONTAINER* test_area = m_pcb->GetArea( ii ); ZONE_CONTAINER* test_area = m_pcb->GetArea( ii );
...@@ -571,13 +575,21 @@ void DRC::testZones() ...@@ -571,13 +575,21 @@ void DRC::testZones()
if( !test_area->IsOnCopperLayer() ) if( !test_area->IsOnCopperLayer() )
continue; continue;
if( test_area->GetNetCode() < 0 ) int netcode = test_area->GetNetCode();
// a netcode < 0 or > 0 and no pad in net is a error or strange
// perhaps a "dead" net, which happens when all pads in this net were removed
// Remark: a netcode < 0 should not happen (this is more a bug somewhere)
int pads_in_net = (test_area->GetNetCode() > 0) ?
test_area->GetNet()->GetNodesCount() : 1;
if( ( netcode < 0 ) || pads_in_net == 0 )
{ {
m_currentMarker = fillMarker( test_area, m_currentMarker = fillMarker( test_area,
DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE, m_currentMarker ); DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE, m_currentMarker );
m_pcb->Add( m_currentMarker ); m_pcb->Add( m_currentMarker );
m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker ); m_mainWindow->GetGalCanvas()->GetView()->Add( m_currentMarker );
m_currentMarker = 0; m_currentMarker = NULL;
} }
} }
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2007 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
#define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR 21 ///< micro via's layer pair incorrect (layers must be adjacent) #define DRCE_MICRO_VIA_INCORRECT_LAYER_PAIR 21 ///< micro via's layer pair incorrect (layers must be adjacent)
#define COPPERAREA_INSIDE_COPPERAREA 22 ///< copper area outlines intersect #define COPPERAREA_INSIDE_COPPERAREA 22 ///< copper area outlines intersect
#define COPPERAREA_CLOSE_TO_COPPERAREA 23 ///< copper area outlines are too close #define COPPERAREA_CLOSE_TO_COPPERAREA 23 ///< copper area outlines are too close
#define DRCE_NON_EXISTANT_NET_FOR_ZONE_OUTLINE 24 ///< copper area outline has an incorrect netcode due to a netname not found #define DRCE_SUSPICIOUS_NET_FOR_ZONE_OUTLINE 24 ///< copper area has a net but no pads in nets, which is suspicious
#define DRCE_HOLE_NEAR_PAD 25 ///< hole too close to pad #define DRCE_HOLE_NEAR_PAD 25 ///< hole too close to pad
#define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track #define DRCE_HOLE_NEAR_TRACK 26 ///< hole too close to track
#define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width #define DRCE_TOO_SMALL_TRACK_WIDTH 27 ///< Too small track width
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Miguel Angel Ajo Pelayo <miguelangel@nbee.es> * Copyright (C) 2012-2015 Miguel Angel Ajo Pelayo <miguelangel@nbee.es>
* Copyright (C) 2012 Jean-Pierre Charras, jaen-pierre.charras * Copyright (C) 2012-2015 Jean-Pierre Charras, jaen-pierre.charras
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2011 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -440,7 +440,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event ) ...@@ -440,7 +440,7 @@ void FOOTPRINT_WIZARD_FRAME::OnActivate( wxActivateEvent& event )
EDA_DRAW_FRAME::OnActivate( event ); EDA_DRAW_FRAME::OnActivate( event );
// Ensure we do not have old selection: // Ensure we do not have old selection:
if( !m_FrameIsActive ) if( !event.GetActive() )
return; return;
bool footprintWizardsChanged = false; bool footprintWizardsChanged = false;
......
...@@ -101,7 +101,7 @@ bool GITHUB_GETLIBLIST::GetLibraryList( wxArrayString& aList ) ...@@ -101,7 +101,7 @@ bool GITHUB_GETLIBLIST::GetLibraryList( wxArrayString& aList )
// The URL lib names are relative to the server name. // The URL lib names are relative to the server name.
// so add the server name to them. // so add the server name to them.
wxURI repo( m_repoURL ); wxURI repo( m_repoURL );
wxString urlPrefix = wxT( "https://" ) + repo.GetServer() + wxT( "/" );; wxString urlPrefix = wxT( "https://" ) + repo.GetServer() + wxT( "/" );
wxString errorMsg; wxString errorMsg;
const char sep = ','; // Separator fields, in json returned file const char sep = ','; // Separator fields, in json returned file
......
...@@ -185,6 +185,7 @@ void LEGACY_NETLIST_READER::loadNet( char* aText, COMPONENT* aComponent ) throw( ...@@ -185,6 +185,7 @@ void LEGACY_NETLIST_READER::loadNet( char* aText, COMPONENT* aComponent ) throw(
char line[256]; char line[256];
strncpy( line, aText, sizeof( line ) ); strncpy( line, aText, sizeof( line ) );
line[ sizeof(line) - 1 ] = '\0';
if( ( p = strtok( line, " ()\t\n" ) ) == NULL ) if( ( p = strtok( line, " ()\t\n" ) ) == NULL )
{ {
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
/* /**
* @file modules.cpp * @file modules.cpp
*/ */
...@@ -40,7 +40,6 @@ ...@@ -40,7 +40,6 @@
#include <class_module.h> #include <class_module.h>
#include <pcbnew.h> #include <pcbnew.h>
#include <protos.h>
#include <drag.h> #include <drag.h>
...@@ -166,7 +165,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC ) ...@@ -166,7 +165,7 @@ void Abort_MoveOrCopyModule( EDA_DRAW_PANEL* Panel, wxDC* DC )
if( module ) if( module )
{ {
// Erase the current footprint on screen // Erase the current footprint on screen
DrawModuleOutlines( Panel, DC, module ); module->DrawOutlinesWhenMoving( Panel, DC, g_Offset_Module );
/* If a move command: return to old position /* If a move command: return to old position
* If a copy command, delete the new footprint * If a copy command, delete the new footprint
...@@ -239,12 +238,12 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, ...@@ -239,12 +238,12 @@ void MoveFootprint( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
/* Erase current footprint. */ /* Erase current footprint. */
if( aErase ) if( aErase )
{ {
DrawModuleOutlines( aPanel, aDC, module ); module->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
} }
/* Redraw the module at the new position. */ /* Redraw the module at the new position. */
g_Offset_Module = module->GetPosition() - aPanel->GetParent()->GetCrossHairPosition(); g_Offset_Module = module->GetPosition() - aPanel->GetParent()->GetCrossHairPosition();
DrawModuleOutlines( aPanel, aDC, module ); module->DrawOutlinesWhenMoving( aPanel, aDC, g_Offset_Module );
DrawSegmentWhileMovingFootprint( aPanel, aDC ); DrawSegmentWhileMovingFootprint( aPanel, aDC );
} }
...@@ -323,7 +322,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -323,7 +322,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
/* Erase footprint and draw outline if it has been already drawn. */ /* Erase footprint and draw outline if it has been already drawn. */
if( DC ) if( DC )
{ {
DrawModuleOutlines( m_canvas, DC, Module ); Module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
DrawSegmentWhileMovingFootprint( m_canvas, DC ); DrawSegmentWhileMovingFootprint( m_canvas, DC );
} }
} }
...@@ -347,7 +346,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC ) ...@@ -347,7 +346,7 @@ void PCB_EDIT_FRAME::Change_Side_Module( MODULE* Module, wxDC* DC )
{ {
if( DC ) if( DC )
{ {
DrawModuleOutlines( m_canvas, DC, Module ); Module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
DrawSegmentWhileMovingFootprint( m_canvas, DC ); DrawSegmentWhileMovingFootprint( m_canvas, DC );
} }
...@@ -459,7 +458,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool ...@@ -459,7 +458,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
{ {
if( DC ) if( DC )
{ {
DrawModuleOutlines( m_canvas, DC, module ); module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
DrawSegmentWhileMovingFootprint( m_canvas, DC ); DrawSegmentWhileMovingFootprint( m_canvas, DC );
} }
} }
...@@ -486,7 +485,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool ...@@ -486,7 +485,7 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
else else
{ {
// Beiing moved: just redraw it // Beiing moved: just redraw it
DrawModuleOutlines( m_canvas, DC, module ); module->DrawOutlinesWhenMoving( m_canvas, DC, g_Offset_Module );
DrawSegmentWhileMovingFootprint( m_canvas, DC ); DrawSegmentWhileMovingFootprint( m_canvas, DC );
} }
...@@ -496,35 +495,31 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool ...@@ -496,35 +495,31 @@ void PCB_BASE_FRAME::Rotate_Module( wxDC* DC, MODULE* module, double angle, bool
} }
/*************************************************/ // Redraw in XOR mode the outlines of the module.
/* Redraw in XOR mode the outlines of a module. */ void MODULE::DrawOutlinesWhenMoving( EDA_DRAW_PANEL* panel, wxDC* DC,
/*************************************************/ const wxPoint& aMoveVector )
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module )
{ {
int pad_fill_tmp; int pad_fill_tmp;
D_PAD* pt_pad; D_PAD* pt_pad;
if( module == NULL ) DrawEdgesOnly( panel, DC, aMoveVector, GR_XOR );
return;
module->DrawEdgesOnly( panel, DC, g_Offset_Module, GR_XOR );
DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions(); DISPLAY_OPTIONS* displ_opts = (DISPLAY_OPTIONS*)panel->GetDisplayOptions();
// Show pads in sketch mode to speedu up drawings // Show pads in sketch mode to speedu up drawings
pad_fill_tmp = displ_opts->m_DisplayPadFill; pad_fill_tmp = displ_opts->m_DisplayPadFill;
displ_opts->m_DisplayPadFill = true; displ_opts->m_DisplayPadFill = true;
pt_pad = module->Pads(); pt_pad = Pads();
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
pt_pad->Draw( panel, DC, GR_XOR, g_Offset_Module ); pt_pad->Draw( panel, DC, GR_XOR, aMoveVector );
displ_opts->m_DisplayPadFill = pad_fill_tmp; displ_opts->m_DisplayPadFill = pad_fill_tmp;
if( displ_opts->m_Show_Module_Ratsnest && panel ) if( displ_opts->m_Show_Module_Ratsnest )
{ {
PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent(); PCB_BASE_FRAME* frame = (PCB_BASE_FRAME*) panel->GetParent();
frame->build_ratsnest_module( module ); frame->build_ratsnest_module( this );
frame->TraceModuleRatsNest( DC ); frame->TraceModuleRatsNest( DC );
} }
} }
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2008-2011 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2004-2012 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2004-2015 KiCad Developers, see change_log.txt for contributors.
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
...@@ -551,7 +551,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event ) ...@@ -551,7 +551,7 @@ void FOOTPRINT_VIEWER_FRAME::OnActivate( wxActivateEvent& event )
EDA_DRAW_FRAME::OnActivate( event ); EDA_DRAW_FRAME::OnActivate( event );
// Ensure we do not have old selection: // Ensure we do not have old selection:
if( ! m_FrameIsActive ) if( !event.GetActive() )
return; return;
// Ensure we have the right library list: // Ensure we have the right library list:
......
...@@ -112,6 +112,17 @@ void PCB_PARSER::init() ...@@ -112,6 +112,17 @@ void PCB_PARSER::init()
} }
void PCB_PARSER::pushValueIntoMap( int aIndex, int aValue )
{
// Add aValue in netcode mapping (m_netCodes) at index aNetCode
// ensure there is room in m_netCodes for that, and add room if needed.
if( (int)m_netCodes.size() <= aIndex )
m_netCodes.resize( aIndex+1 );
m_netCodes[aIndex] = aValue;
}
double PCB_PARSER::parseDouble() throw( IO_ERROR ) double PCB_PARSER::parseDouble() throw( IO_ERROR )
{ {
char* tmp; char* tmp;
...@@ -1194,7 +1205,7 @@ void PCB_PARSER::parseNETINFO_ITEM() throw( IO_ERROR, PARSE_ERROR ) ...@@ -1194,7 +1205,7 @@ void PCB_PARSER::parseNETINFO_ITEM() throw( IO_ERROR, PARSE_ERROR )
m_board->AppendNet( net ); m_board->AppendNet( net );
// Store the new code mapping // Store the new code mapping
m_netCodes[netCode] = net->GetNet(); pushValueIntoMap( netCode, net->GetNet() );
} }
} }
...@@ -2526,6 +2537,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2526,6 +2537,8 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
int hatchPitch = Mils2iu( CPolyLine::GetDefaultHatchPitchMils() ); int hatchPitch = Mils2iu( CPolyLine::GetDefaultHatchPitchMils() );
wxPoint pt; wxPoint pt;
T token; T token;
int tmp;
wxString netnameFromfile; // the zone net name find in file
// bigger scope since each filled_polygon is concatenated in here // bigger scope since each filled_polygon is concatenated in here
CPOLYGONS_LIST pts; CPOLYGONS_LIST pts;
...@@ -2545,20 +2558,19 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2545,20 +2558,19 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
// Init the net code only, not the netname, to be sure // Init the net code only, not the netname, to be sure
// the zone net name is the name read in file. // the zone net name is the name read in file.
// (When mismatch, the user will be prompted in DRC, to fix the actual name) // (When mismatch, the user will be prompted in DRC, to fix the actual name)
zone->SetNetCode( getNetCode( parseInt( "net number" ) ) ); tmp = getNetCode( parseInt( "net number" ) );
if( tmp < 0 )
tmp = 0;
zone->SetNetCode( tmp );
NeedRIGHT(); NeedRIGHT();
break; break;
case T_net_name: case T_net_name:
NeedSYMBOLorNUMBER(); NeedSYMBOLorNUMBER();
if( zone->GetNet()->GetNetname() != FromUTF8() ) netnameFromfile = FromUTF8();
{
wxString msg;
msg.Printf( _( "There is a zone that belongs to a not existing net"
"(%s), you should verify it." ), GetChars( FromUTF8() ) );
DisplayError( NULL, msg );
zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
}
NeedRIGHT(); NeedRIGHT();
break; break;
...@@ -2829,10 +2841,45 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR ) ...@@ -2829,10 +2841,45 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
if( pts.GetCornersCount() ) if( pts.GetCornersCount() )
zone->AddFilledPolysList( pts ); zone->AddFilledPolysList( pts );
// Ensure keepout does not have a net (which have no sense for a keepout zone) // Ensure keepout and non copper zones do not have a net
if( zone->GetIsKeepout() ) // (which have no sense for these zones)
// the netcode 0 is used for these zones
bool zone_has_net = zone->IsOnCopperLayer() && !zone->GetIsKeepout();
if( !zone_has_net )
zone->SetNetCode( NETINFO_LIST::UNCONNECTED ); zone->SetNetCode( NETINFO_LIST::UNCONNECTED );
// Ensure the zone net name is valid, and matches the net code, for copper zones
if( zone_has_net && ( zone->GetNet()->GetNetname() != netnameFromfile ) )
{
// Can happens which old boards, with nonexistent nets ...
// or after being edited by hand
// We try to fix the mismatch.
NETINFO_ITEM* net = m_board->FindNet( netnameFromfile );
if( net ) // An existing net has the same net name. use it for the zone
zone->SetNetCode( net->GetNet() );
else // Not existing net: add a new net to keep trace of the zone netname
{
int newnetcode = m_board->GetNetCount();
net = new NETINFO_ITEM( m_board, netnameFromfile, newnetcode );
m_board->AppendNet( net );
// Store the new code mapping
pushValueIntoMap( newnetcode, net->GetNet() );
// and update the zone netcode
zone->SetNetCode( net->GetNet() );
// Prompt the user
wxString msg;
msg.Printf( _( "There is a zone that belongs to a not existing net\n"
"\"%s\"\n"
"you should verify and edit it (run DRC test)." ),
GetChars( netnameFromfile ) );
DisplayError( NULL, msg );
}
}
return zone.release(); return zone.release();
} }
......
...@@ -69,15 +69,24 @@ class PCB_PARSER : public PCB_LEXER ...@@ -69,15 +69,24 @@ class PCB_PARSER : public PCB_LEXER
std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded std::vector<int> m_netCodes; ///< net codes mapping for boards being loaded
///> Converts net code using the mapping table if available, ///> Converts net code using the mapping table if available,
///> otherwise returns unchanged net code ///> otherwise returns unchanged net code if < 0 or if is is out of range
inline int getNetCode( int aNetCode ) inline int getNetCode( int aNetCode )
{ {
if( aNetCode < (int) m_netCodes.size() ) if( ( aNetCode >= 0 ) && ( aNetCode < (int) m_netCodes.size() ) )
return m_netCodes[aNetCode]; return m_netCodes[aNetCode];
return aNetCode; return aNetCode;
} }
/**
* function pushValueIntoMap
* Add aValue value in netcode mapping (m_netCodes) at index aIndex
* ensure there is room in m_netCodes for that, and add room if needed.
* @param aIndex = the index ( expected >=0 )of the location to use in m_netCodes
* @param aValue = the netcode value to map
*/
void pushValueIntoMap( int aIndex, int aValue );
/** /**
* Function init * Function init
* clears and re-establishes m_layerMap with the default layer names. * clears and re-establishes m_layerMap with the default layer names.
......
...@@ -754,11 +754,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg ) ...@@ -754,11 +754,6 @@ void PCB_EDIT_FRAME::LoadSettings( wxConfigBase* aCfg )
aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption ); aCfg->Read( PCB_MAGNETIC_TRACKS_OPT, &g_MagneticTrackOption );
aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools ); aCfg->Read( SHOW_MICROWAVE_TOOLS, &m_show_microwave_tools );
aCfg->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools ); aCfg->Read( SHOW_LAYER_MANAGER_TOOLS, &m_show_layer_manager_tools );
// WxWidgets 2.9.1 seems call setlocale( LC_NUMERIC, "" )
// when reading doubles in cfg,
// but forget to back to current locale. So we call SetLocaleTo_Default
SetLocaleTo_Default( );
} }
......
...@@ -61,8 +61,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel, ...@@ -61,8 +61,6 @@ void DrawTraces( EDA_DRAW_PANEL* panel,
int nbsegment, int nbsegment,
GR_DRAWMODE mode_color ); GR_DRAWMODE mode_color );
void DrawModuleOutlines( EDA_DRAW_PANEL* panel, wxDC* DC, MODULE* module );
void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition, void ShowNewTrackWhenMovingCursor( EDA_DRAW_PANEL* aPanel, wxDC* aDC, const wxPoint& aPosition,
bool aErase ); bool aErase );
......
...@@ -883,7 +883,7 @@ void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef, ...@@ -883,7 +883,7 @@ void PCB_BASE_FRAME::BuildAirWiresTargetsList( BOARD_CONNECTED_ITEM* aItemRef,
if( track->GetNetCode() < net_code ) if( track->GetNetCode() < net_code )
continue; continue;
if( track->GetNetCode() > net_code ) if( track->GetNetCode() > net_code )
break;; break;
if( !track->GetSubNet() || (track->GetSubNet() != subnet) ) if( !track->GetSubNet() || (track->GetSubNet() != subnet) )
{ {
......
...@@ -51,7 +51,7 @@ int main( int argc, char** argv ) ...@@ -51,7 +51,7 @@ int main( int argc, char** argv )
SPECCTRA_DB db; SPECCTRA_DB db;
bool failed = false; bool failed = false;
SetLocaleTo_C_standard( ); // Switch the locale to standard C LOCALE_IO toggle; // Temporary switch the locale to standard C to r/w floats
if( argc == 2 ) if( argc == 2 )
{ {
...@@ -87,8 +87,6 @@ int main( int argc, char** argv ) ...@@ -87,8 +87,6 @@ int main( int argc, char** argv )
DSN::SESSION* ses = db.GetSESSION(); DSN::SESSION* ses = db.GetSESSION();
ses->Format( &db, 0 ); ses->Format( &db, 0 );
#endif #endif
SetLocaleTo_Default( ); // revert to the current locale
} }
//-----<dummy code>--------------------------------------------------- //-----<dummy code>---------------------------------------------------
......
/* /*
* This program source code file is part of KiCad, a free EDA CAD application. * This program source code file is part of KiCad, a free EDA CAD application.
* *
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@verizon.net>
* 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 * This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License * modify it under the terms of the GNU General Public License
......
...@@ -611,7 +611,7 @@ int CPolyLine::GetEndContour( int ic ) ...@@ -611,7 +611,7 @@ int CPolyLine::GetEndContour( int ic )
} }
EDA_RECT CPolyLine::GetBoundingBox() const EDA_RECT CPolyLine::GetBoundingBox()
{ {
int xmin = INT_MAX; int xmin = INT_MAX;
int ymin = INT_MAX; int ymin = INT_MAX;
...@@ -634,7 +634,7 @@ EDA_RECT CPolyLine::GetBoundingBox() ...@@ -634,7 +634,7 @@ EDA_RECT CPolyLine::GetBoundingBox()
} }
EDA_RECT CPolyLine::GetBoundingBox( int icont ) const EDA_RECT CPolyLine::GetBoundingBox( int icont )
{ {
int xmin = INT_MAX; int xmin = INT_MAX;
int ymin = INT_MAX; int ymin = INT_MAX;
......
...@@ -355,14 +355,14 @@ public: ...@@ -355,14 +355,14 @@ public:
/** /**
* @return the full bounding box of polygons * @return the full bounding box of polygons
*/ */
EDA_RECT GetBoundingBox(); const EDA_RECT GetBoundingBox();
/** /**
* @return the bounding box of a given polygon * @return the bounding box of a given polygon
* @param icont = the index of the polygon contour * @param icont = the index of the polygon contour
* (0 = main contour, 1 ... n = other contours, usually holes) * (0 = main contour, 1 ... n = other contours, usually holes)
*/ */
EDA_RECT GetBoundingBox( int icont ); const EDA_RECT GetBoundingBox( int icont );
void Copy( const CPolyLine* src ); void Copy( const CPolyLine* src );
bool TestPointInside( int x, int y ); bool TestPointInside( int x, int y );
......
...@@ -186,6 +186,7 @@ PyObject* wx2PyString( const wxString& src ) ...@@ -186,6 +186,7 @@ PyObject* wx2PyString( const wxString& src )
void wxSetDefaultPyEncoding( const char* encoding ) void wxSetDefaultPyEncoding( const char* encoding )
{ {
strncpy( wxPythonEncoding, encoding, WX_DEFAULTENCODING_SIZE ); strncpy( wxPythonEncoding, encoding, WX_DEFAULTENCODING_SIZE );
wxPythonEncoding[ WX_DEFAULTENCODING_SIZE - 1 ] = '\0';
} }
......
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