Remove all debugging output that cannot be disabled.

The use of printf, wxLogDebug, and std::err/std::out causes excessive
debugging output which makes finding specific debugging messages more
difficult than it needs to be.

There is still some debugging output in test code that really needs to
be moved into a unit test.

Add debugging output section to the coding policy regarding debugging
output.
This commit is contained in:
Wayne Stambaugh 2020-08-18 10:17:16 -04:00
parent 4cc820f550
commit ede39780e2
99 changed files with 231 additions and 1146 deletions

View File

@ -433,26 +433,10 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR
else else
aWarningReporter->Report( wxEmptyString ); aWarningReporter->Report( wxEmptyString );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_stopCreateBoardPolyTime = GetRunningMicroSecs();
unsigned stats_startCreateLayersTime = stats_stopCreateBoardPolyTime;
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Create layers" ) ); aStatusReporter->Report( _( "Create layers" ) );
createLayers( aStatusReporter ); createLayers( aStatusReporter );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_stopCreateLayersTime = GetRunningMicroSecs();
printf( "BOARD_ADAPTER::InitSettings times\n" );
printf( " CreateBoardPoly: %.3f ms\n",
(float)( stats_stopCreateBoardPolyTime - stats_startCreateBoardPolyTime ) / 1e3 );
printf( " CreateLayers and holes: %.3f ms\n",
(float)( stats_stopCreateLayersTime - stats_startCreateLayersTime ) / 1e3 );
printf( "\n" );
#endif
} }

View File

@ -170,11 +170,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( m_stats_nr_vias ) if( m_stats_nr_vias )
m_stats_via_med_hole_diameter /= (float)m_stats_nr_vias; m_stats_via_med_hole_diameter /= (float)m_stats_nr_vias;
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T01: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Prepare copper layers index and containers // Prepare copper layers index and containers
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
std::vector< PCB_LAYER_ID > layer_id; std::vector< PCB_LAYER_ID > layer_id;
@ -204,11 +199,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T02: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Create tracks and vias" ) ); aStatusReporter->Report( _( "Create tracks and vias" ) );
@ -242,11 +232,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T03: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Create VIAS and THTs objects and add it to holes containers // Create VIAS and THTs objects and add it to holes containers
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
@ -332,11 +317,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T04: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Create VIAS and THTs objects and add it to holes containers // Create VIAS and THTs objects and add it to holes containers
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
@ -433,11 +413,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T05: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Creates vertical outline contours of the tracks and add it to the poly of the layer // Creates vertical outline contours of the tracks and add it to the poly of the layer
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
@ -471,11 +446,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T06: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add holes of modules // Add holes of modules
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Modules() )
@ -509,11 +479,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( m_stats_nr_holes ) if( m_stats_nr_holes )
m_stats_hole_med_diameter /= (float)m_stats_nr_holes; m_stats_hole_med_diameter /= (float)m_stats_nr_holes;
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T07: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add contours of the pad holes (pads can be Circle or Segment holes) // Add contours of the pad holes (pads can be Circle or Segment holes)
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
for( MODULE* module : m_board->Modules() ) for( MODULE* module : m_board->Modules() )
@ -541,11 +506,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T08: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add modules PADs objects to containers // Add modules PADs objects to containers
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
{ {
@ -572,11 +532,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T09: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add modules PADs poly contourns (vertical outlines) // Add modules PADs poly contourns (vertical outlines)
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) ) && ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
@ -601,11 +556,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T10: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add graphic item on copper layers to object containers // Add graphic item on copper layers to object containers
for( PCB_LAYER_ID curr_layer_id : layer_id ) for( PCB_LAYER_ID curr_layer_id : layer_id )
{ {
@ -653,11 +603,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T11: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Add graphic item on copper layers to poly contourns (vertical outlines) // Add graphic item on copper layers to poly contourns (vertical outlines)
if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) ) && ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
@ -694,11 +639,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T12: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
if( GetFlag( FL_ZONE ) ) if( GetFlag( FL_ZONE ) )
{ {
if( aStatusReporter ) if( aStatusReporter )
@ -752,11 +692,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "fill zones T13: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
if( GetFlag( FL_ZONE ) && GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) if( GetFlag( FL_ZONE ) && GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS )
&& ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) ) && ( m_render_engine == RENDER_ENGINE::OPENGL_LEGACY ) )
{ {
@ -776,11 +711,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T14: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Simplify layer polygons // Simplify layer polygons
if( aStatusReporter ) if( aStatusReporter )
@ -820,11 +750,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) ); std::this_thread::sleep_for( std::chrono::milliseconds( 10 ) );
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T15: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
start_Time = GetRunningMicroSecs();
#endif
// Simplify holes polygon contours // Simplify holes polygon contours
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
if( aStatusReporter ) if( aStatusReporter )
@ -845,12 +770,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "T16: %.3f ms\n", (float)( GetRunningMicroSecs() - start_Time ) / 1e3 );
#endif
// End Build Copper layers // End Build Copper layers
// This will make a union of all added contourns // This will make a union of all added contourns
m_through_inner_holes_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); m_through_inner_holes_poly.Simplify( SHAPE_POLY_SET::PM_FAST );
m_through_outer_holes_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); m_through_outer_holes_poly.Simplify( SHAPE_POLY_SET::PM_FAST );
@ -859,17 +780,9 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
m_through_outer_ring_holes_vias_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); m_through_outer_ring_holes_vias_poly.Simplify( SHAPE_POLY_SET::PM_FAST );
//m_through_inner_holes_vias_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); // Not in use //m_through_inner_holes_vias_poly.Simplify( SHAPE_POLY_SET::PM_FAST ); // Not in use
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endCopperLayersTime = GetRunningMicroSecs();
#endif
// Build Tech layers // Build Tech layers
// Based on: https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_draw.cpp#L1059 // Based on: https://github.com/KiCad/kicad-source-mirror/blob/master/3d-viewer/3d_draw.cpp#L1059
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_startTechLayersTime = GetRunningMicroSecs();
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Build Tech layers" ) ); aStatusReporter->Report( _( "Build Tech layers" ) );
@ -1051,16 +964,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
} }
// End Build Tech layers // End Build Tech layers
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endTechLayersTime = GetRunningMicroSecs();
#endif
// Build BVH (Bounding volume hierarchy) for holes and vias // Build BVH (Bounding volume hierarchy) for holes and vias
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_startHolesBVHTime = GetRunningMicroSecs();
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Build BVH for holes and vias" ) ); aStatusReporter->Report( _( "Build BVH for holes and vias" ) );
@ -1081,24 +986,4 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter )
if( m_layers_container2D[F_Mask] ) if( m_layers_container2D[F_Mask] )
m_layers_container2D[F_Mask]->BuildBVH(); m_layers_container2D[F_Mask]->BuildBVH();
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endHolesBVHTime = GetRunningMicroSecs();
printf( "BOARD_ADAPTER::createLayers times\n" );
printf( " Copper Layers: %.3f ms\n",
(float)( stats_endCopperLayersTime - stats_startCopperLayersTime ) / 1e3 );
printf( " Holes BVH creation: %.3f ms\n",
(float)( stats_endHolesBVHTime - stats_startHolesBVHTime ) / 1e3 );
printf( " Tech Layers: %.3f ms\n",
(float)( stats_endTechLayersTime - stats_startTechLayersTime ) / 1e3 );
printf( "Statistics:\n" );
printf( " m_stats_nr_tracks %u\n", m_stats_nr_tracks );
printf( " m_stats_nr_vias %u\n", m_stats_nr_vias );
printf( " m_stats_nr_holes %u\n", m_stats_nr_holes );
printf( " m_stats_via_med_hole_diameter (3DU) %f\n", m_stats_via_med_hole_diameter );
printf( " m_stats_hole_med_diameter (3DU) %f\n", m_stats_hole_med_diameter );
printf( " m_calc_seg_min_factor3DU (3DU) %f\n", m_calc_seg_min_factor3DU );
printf( " m_calc_seg_max_factor3DU (3DU) %f\n", m_calc_seg_max_factor3DU );
#endif
} }

View File

@ -342,25 +342,13 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
COBJECT2D_STATS::Instance().ResetStats(); COBJECT2D_STATS::Instance().ResetStats();
#ifdef PRINT_STATISTICS_3D_VIEWER
printf("InitSettings...\n");
#endif
unsigned stats_startReloadTime = GetRunningMicroSecs(); unsigned stats_startReloadTime = GetRunningMicroSecs();
m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter ); m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endReloadTime = GetRunningMicroSecs();
#endif
SFVEC3F camera_pos = m_boardAdapter.GetBoardCenter3DU(); SFVEC3F camera_pos = m_boardAdapter.GetBoardCenter3DU();
m_camera.SetBoardLookAtPos( camera_pos ); m_camera.SetBoardLookAtPos( camera_pos );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_start_OpenGL_Load_Time = GetRunningMicroSecs();
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Load OpenGL: board" ) ); aStatusReporter->Report( _( "Load OpenGL: board" ) );
@ -615,35 +603,13 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
layer_z_top ); layer_z_top );
}// for each layer on map }// for each layer on map
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_end_OpenGL_Load_Time = GetRunningMicroSecs();
#endif
// Load 3D models // Load 3D models
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_start_models_Load_Time = GetRunningMicroSecs();
#endif
if( aStatusReporter ) if( aStatusReporter )
aStatusReporter->Report( _( "Loading 3D models" ) ); aStatusReporter->Report( _( "Loading 3D models" ) );
load_3D_models( aStatusReporter ); load_3D_models( aStatusReporter );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_end_models_Load_Time = GetRunningMicroSecs();
printf( "C3D_RENDER_OGL_LEGACY::reload times:\n" );
printf( " Reload board: %.3f ms\n",
(float)( stats_endReloadTime - stats_startReloadTime ) / 1000.0f );
printf( " Loading to openGL: %.3f ms\n",
(float)( stats_end_OpenGL_Load_Time - stats_start_OpenGL_Load_Time ) / 1000.0f );
printf( " Loading 3D models: %.3f ms\n",
(float)( stats_end_models_Load_Time - stats_start_models_Load_Time ) / 1000.0f );
COBJECT2D_STATS::Instance().PrintStats();
#endif
if( aStatusReporter ) if( aStatusReporter )
{ {
// Calculation time in seconds // Calculation time in seconds

View File

@ -305,35 +305,6 @@ CBVH_PBRT::CBVH_PBRT( const CGENERICCONTAINER &aObjectContainer,
flattenBVHTree( root, &offset ); flattenBVHTree( root, &offset );
wxASSERT( offset == (unsigned int)totalNodes ); wxASSERT( offset == (unsigned int)totalNodes );
#ifdef PRINT_STATISTICS_3D_VIEWER
uint32_t treeBytes = totalNodes * sizeof( LinearBVHNode ) + sizeof( *this ) +
m_primitives.size() * sizeof( m_primitives[0] ) +
m_addresses_pointer_to_mm_free.size() * sizeof( void * );
printf( "////////////////////////////////////////////////////////////////////////////////\n" );
printf( "Creating a CBVH_PBRT from %u objects ", (unsigned int)m_primitives.size() );
switch( m_splitMethod )
{
case SPLITMETHOD::MIDDLE:
printf( "using SPLITMETHOD::MIDDLE\n" );
break;
case SPLITMETHOD::EQUALCOUNTS:
printf( "using SPLITMETHOD::EQUALCOUNTS\n" );
break;
case SPLITMETHOD::SAH:
printf( "using SPLITMETHOD::SAH\n" );
break;
case SPLITMETHOD::HLBVH:
printf( "using SPLITMETHOD::HLBVH\n" );
break;
}
printf( " BVH created with %d nodes (%.2f MB)\n",
totalNodes, float(treeBytes) / (1024.f * 1024.f) );
printf( "////////////////////////////////////////////////////////////////////////////////\n\n" );
#endif
} }

View File

@ -266,19 +266,10 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
COBJECT2D_STATS::Instance().ResetStats(); COBJECT2D_STATS::Instance().ResetStats();
COBJECT3D_STATS::Instance().ResetStats(); COBJECT3D_STATS::Instance().ResetStats();
#ifdef PRINT_STATISTICS_3D_VIEWER
printf("InitSettings...\n");
#endif
unsigned stats_startReloadTime = GetRunningMicroSecs(); unsigned stats_startReloadTime = GetRunningMicroSecs();
m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter ); m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endReloadTime = GetRunningMicroSecs();
unsigned stats_startConvertTime = GetRunningMicroSecs();
#endif
SFVEC3F camera_pos = m_boardAdapter.GetBoardCenter3DU(); SFVEC3F camera_pos = m_boardAdapter.GetBoardCenter3DU();
m_camera.SetBoardLookAtPos( camera_pos ); m_camera.SetBoardLookAtPos( camera_pos );
@ -290,10 +281,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
// Create and add the outline board // Create and add the outline board
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
#ifdef PRINT_STATISTICS_3D_VIEWER
printf("Create outline board...\n");
#endif
delete m_outlineBoard2dObjects; delete m_outlineBoard2dObjects;
m_outlineBoard2dObjects = new CCONTAINER2D; m_outlineBoard2dObjects = new CCONTAINER2D;
@ -452,10 +439,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
// Add layers maps (except B_Mask and F_Mask) // Add layers maps (except B_Mask and F_Mask)
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
#ifdef PRINT_STATISTICS_3D_VIEWER
printf("Add layers maps...\n");
#endif
for( MAP_CONTAINER_2D::const_iterator ii = m_boardAdapter.GetMapLayers().begin(); for( MAP_CONTAINER_2D::const_iterator ii = m_boardAdapter.GetMapLayers().begin();
ii != m_boardAdapter.GetMapLayers().end(); ii != m_boardAdapter.GetMapLayers().end();
++ii ) ++ii )
@ -983,11 +966,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
// Create an accelerator // Create an accelerator
// ///////////////////////////////////////////////////////////////////////// // /////////////////////////////////////////////////////////////////////////
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_startAcceleratorTime = GetRunningMicroSecs();
#endif
if( m_accelerator ) if( m_accelerator )
{ {
delete m_accelerator; delete m_accelerator;
@ -996,37 +974,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin
m_accelerator = new CBVH_PBRT( m_object_container ); m_accelerator = new CBVH_PBRT( m_object_container );
#ifdef PRINT_STATISTICS_3D_VIEWER
unsigned stats_endAcceleratorTime = GetRunningMicroSecs();
#endif
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "C3D_RENDER_RAYTRACING::reload times:\n" );
printf( " Reload board: %.3f ms\n", (float)( stats_endReloadTime -
stats_startReloadTime ) /
1000.0f );
printf( " Convert to 3D objects: %.3f ms\n", (float)( stats_endConvertTime -
stats_startConvertTime ) /
1000.0f );
printf( " Accelerator construction: %.3f ms\n", (float)( stats_endAcceleratorTime -
stats_startAcceleratorTime ) /
1000.0f );
printf( " Load and add 3D models: %.3f ms\n", (float)( stats_endLoad3DmodelsTime -
stats_startLoad3DmodelsTime ) /
1000.0f );
printf( "Optimizations\n" );
printf( " m_stats_converted_dummy_to_plane: %u\n",
m_stats_converted_dummy_to_plane );
printf( " m_stats_converted_roundsegment2d_to_roundsegment: %u\n",
m_stats_converted_roundsegment2d_to_roundsegment );
COBJECT2D_STATS::Instance().PrintStats();
COBJECT3D_STATS::Instance().PrintStats();
#endif
if( aStatusReporter ) if( aStatusReporter )
{ {
// Calculation time in seconds // Calculation time in seconds

View File

@ -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-2017 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2017 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -32,6 +32,7 @@
#include "../../3d_fastmath.h" #include "../../3d_fastmath.h"
#include <cstdio> #include <cstdio>
#include <wx/debug.h> #include <wx/debug.h>
#include <wx/log.h>
#include <cmath> #include <cmath>
@ -88,7 +89,8 @@ void RAY::Init( const SFVEC3F& o, const SFVEC3F& d )
{ {
m_Classification = RAY_CLASSIFICATION::MMM; m_Classification = RAY_CLASSIFICATION::MMM;
} }
else if( m_Dir.z > 0 ){ else if( m_Dir.z > 0 )
{
m_Classification = RAY_CLASSIFICATION::MMP; m_Classification = RAY_CLASSIFICATION::MMP;
} }
else//( m_Dir.z >= 0 ) else//( m_Dir.z >= 0 )
@ -397,6 +399,6 @@ bool RAYSEG2D::IntersectCircle( const SFVEC2F &aCenter,
void RAY::debug() const void RAY::debug() const
{ {
printf("O(%f, %f, %f) D(%f, %f, %f)\n", m_Origin.x, m_Origin.y, m_Origin.z, wxLogDebug( "O(%f, %f, %f) D(%f, %f, %f)\n", m_Origin.x, m_Origin.y, m_Origin.z,
m_Dir.x, m_Dir.y, m_Dir.z ); m_Dir.x, m_Dir.y, m_Dir.z );
} }

View File

@ -64,11 +64,9 @@ const std::map<OBJECT2D_TYPE, const char*> objectTypeNames
void COBJECT2D_STATS::PrintStats() void COBJECT2D_STATS::PrintStats()
{ {
printf( "OBJ2D Statistics:\n" );
for( auto& objectType : objectTypeNames ) for( auto& objectType : objectTypeNames )
{ {
printf( " %20s %u\n", objectType.second, wxLogDebug( " %20s %u\n", objectType.second,
m_counter[static_cast<int>( objectType.first )] ); m_counter[static_cast<int>( objectType.first )] );
} }
} }

View File

@ -701,21 +701,6 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks(
blockY -= blockAdvance.y; blockY -= blockAdvance.y;
topToBottom += topToBottom_inc; topToBottom += topToBottom_inc;
} }
#ifdef PRINT_STATISTICS_3D_VIEWER
printf( "////////////////////////////////////////////////////////////////////////////////\n" );
printf( "Convert_path_polygon_to_polygon_blocks_and_dummy_blocks\n" );
printf( " grid_divisions (%u, %u)\n", grid_divisions.x, grid_divisions.y );
printf( " N Total Blocks %u\n", grid_divisions.x * grid_divisions.y );
printf( " N Empty Blocks %u\n", stats_n_empty_blocks );
printf( " N Dummy Blocks %u\n", stats_n_dummy_blocks );
printf( " N Polyg Blocks %u\n", stats_n_poly_blocks );
printf( " Med N Seg Poly %u\n", stats_sum_size_of_polygons / stats_n_poly_blocks );
printf( " medOfTheSquaresSegmentLength %f\n", medOfTheSquaresSegmentLength );
printf( " minSegmentLength %f\n", minSegmentLength );
printf( " aDivFactor %f\n", aDivFactor );
printf( "////////////////////////////////////////////////////////////////////////////////\n" );
#endif
} }

View File

@ -395,6 +395,6 @@ void CBBOX::ApplyTransformationAA( glm::mat4 aTransformMatrix )
void CBBOX::debug() const void CBBOX::debug() const
{ {
printf( "min(%f, %f, %f) - max(%f, %f, %f)\n", m_min.x, m_min.y, m_min.z, wxLogDebug( "min(%f, %f, %f) - max(%f, %f, %f)\n", m_min.x, m_min.y, m_min.z,
m_max.x, m_max.y, m_max.z ); m_max.x, m_max.y, m_max.z );
} }

View File

@ -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-2016 Mario Luzeiro <mrluzeiro@ua.pt> * Copyright (C) 2015-2016 Mario Luzeiro <mrluzeiro@ua.pt>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -63,11 +63,11 @@ const std::map<OBJECT3D_TYPE, const char*> objectTypeNames
void COBJECT3D_STATS::PrintStats() void COBJECT3D_STATS::PrintStats()
{ {
printf( "OBJ3D Statistics:\n" ); wxLogDebug( "OBJ3D Statistics:\n" );
for( auto& objectType : objectTypeNames ) for( auto& objectType : objectTypeNames )
{ {
printf( " %20s %u\n", objectType.second, wxLogDebug( " %20s %u\n", objectType.second,
m_counter[static_cast<int>( objectType.first )] ); m_counter[static_cast<int>( objectType.first )] );
} }
} }

View File

@ -119,7 +119,6 @@ const int *COGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode
} }
else else
{ {
DBG( printf("GetAttributesList: AntiAliasing is not supported.\n") );
aAntiAliasingMode = ANTIALIASING_MODE::AA_NONE; aAntiAliasingMode = ANTIALIASING_MODE::AA_NONE;
} }
} }

View File

@ -527,7 +527,29 @@ means that source files must be copyrighted and not be released into
the public domain. Each source file has one or more owners. the public domain. Each source file has one or more owners.
# 6. Header Files # {#header_files} # 6. Debugging Output {#debugging_output}
Debugging output is a common method for validating code. However, it
should not always active in debug builds. This makes it difficult for
other developers to see their debugging output and can have a significant
impact on the performance of debug builds. I you need to use debugging
output, use [wxLogDebug] instead of `printf` or C++ output stream. If
you accidentally leave the debugging output in the source, it will expand
to nothing on release builds. All debugging output code should be removed
from the source tree before pushing changes to the main KiCad repo. Do not
comment out debugging output. This just adds more cruft to the code base.
If you need to leave debugging output for, future testing, use tracing
output (see 6.1).
## 6.1 Using Tracing for Debugging Output {#tracing_output}
There are occasions when you want to see debugging output to ensure
existing code performs as expected. In this case, use [wxLogTrace] which
allows debugging output to be controlled by the `WXTRACE` environment
variable. When using [wxLogTrace][wxLogTrace], the trace environment
variable string should be documented by either adding it to the
`trace_helper.{h/cpp}` source files or locally using the [Doxygen][Doxygen]
comment `\ingroup trace_env_vars`.
# 7. Header Files # {#header_files}
Project \*.h source files should: Project \*.h source files should:
- contain a license statement - contain a license statement
@ -537,7 +559,7 @@ Project \*.h source files should:
The license statement was described above. The license statement was described above.
## 6.1 Nested Include #ifndef ## {#nested_include} ## 7.1 Nested Include #ifndef ## {#nested_include}
Each header file should include an \#ifndef which is commonly used to Each header file should include an \#ifndef which is commonly used to
prevent compiler errors in the case where the header file is seen prevent compiler errors in the case where the header file is seen
multiple times in the code stream presented to the compiler. Just multiple times in the code stream presented to the compiler. Just
@ -561,7 +583,7 @@ the very bottom of the file. It is important that it wrap any nested
\#include statements, so that the compiler can skip them if the \#include statements, so that the compiler can skip them if the
\#ifndef evaluates to false, which will reduce compilation time. \#ifndef evaluates to false, which will reduce compilation time.
## 6.2 Headers Without Unsatisfied Dependencies ## {#header_depends} ## 7.2 Headers Without Unsatisfied Dependencies ## {#header_depends}
Any header file should include other headers that it depends on. (Note: Any header file should include other headers that it depends on. (Note:
KiCad is not at this point now, but this section is a goal of the KiCad is not at this point now, but this section is a goal of the
project.) project.)
@ -598,13 +620,13 @@ is exposed in the header file, merely by including that one header
file. file.
# 7. When in Doubt... # {#when_in_doubt} # 8. When in Doubt... # {#when_in_doubt}
When editing existing source code files and there are multiple acceptable When editing existing source code files and there are multiple acceptable
code formatting options or no formatting is defined, follow the existing code formatting options or no formatting is defined, follow the existing
formatting in the file. formatting in the file.
# 8. I Wrote X Lines of Code Before I Read This Document # {#x_lines} # 9. I Wrote X Lines of Code Before I Read This Document # {#x_lines}
It's OK. We all make mistakes. Fortunately, KiCad provides a It's OK. We all make mistakes. Fortunately, KiCad provides a
configuration file for the code beautifier uncrustify. Uncrustify won't configuration file for the code beautifier uncrustify. Uncrustify won't
fix your naming problems but it does a pretty decent job of formatting fix your naming problems but it does a pretty decent job of formatting
@ -618,7 +640,7 @@ uncrustify [website][uncrustify] for more information.
[uncrustify]: http://uncrustify.sourceforge.net/ [uncrustify]: http://uncrustify.sourceforge.net/
# 9. Show Me an Example # {#show_me_an_example} # 10. Show Me an Example # {#show_me_an_example}
Nothing drives the point home like an example. The source file richio.h Nothing drives the point home like an example. The source file richio.h
below was taken directly from the KiCad source. below was taken directly from the KiCad source.
@ -877,7 +899,7 @@ below was taken directly from the KiCad source.
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
# 10. Resources # {#resources} # 11. Resources # {#resources}
There are plenty of excellent resources on the Internet on C++ coding There are plenty of excellent resources on the Internet on C++ coding
styles and coding do's and don'ts. Here are a few useful ones. In most styles and coding do's and don'ts. Here are a few useful ones. In most
cases, the coding styles do not follow the KiCad coding style but there cases, the coding styles do not follow the KiCad coding style but there
@ -895,3 +917,6 @@ learn something new.
[kernel]:https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/process/coding-style.rst [kernel]:https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/tree/Documentation/process/coding-style.rst
[overloading]:http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html [overloading]:http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html
[style]:http://en.wikipedia.org/wiki/Programming_style [style]:http://en.wikipedia.org/wiki/Programming_style
[wxLogDebug]:https://docs.wxwidgets.org/3.0/group__group__funcmacro__log.html#ga9c530ae20eb423744f90874d2c97d02b
[wxLogTrace]:https://docs.wxwidgets.org/3.0/group__group__funcmacro__log.html#gae28a46b220921cd87a6f75f0842294c5
[Doxygen]:https://www.doxygen.nl/index.html

View File

@ -96,11 +96,6 @@ void EDA_ITEM::SetModified()
const EDA_RECT EDA_ITEM::GetBoundingBox() const const EDA_RECT EDA_ITEM::GetBoundingBox() const
{ {
#if defined(DEBUG)
printf( "Missing GetBoundingBox()\n" );
Show( 0, std::cout ); // tell me which classes still need GetBoundingBox support
#endif
// return a zero-sized box per default. derived classes should override // return a zero-sized box per default. derived classes should override
// this // this
return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) );

View File

@ -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) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2020 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
@ -269,13 +269,6 @@ void DIALOG_SHIM::ResetSize()
bool DIALOG_SHIM::Enable( bool enable ) bool DIALOG_SHIM::Enable( bool enable )
{ {
// so we can do logging of this state change: // so we can do logging of this state change:
#if 0 && defined(DEBUG)
const char* type_id = typeid( *this ).name();
printf( "DIALOG_SHIM %s: %s\n", type_id, enable ? "enabled" : "disabled" );
fflush(0); //Needed on msys2 to immediately print the message
#endif
return wxDialog::Enable( enable ); return wxDialog::Enable( enable );
} }
@ -364,16 +357,12 @@ int DIALOG_SHIM::ShowQuasiModal()
// Get the optimal parent // Get the optimal parent
wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() ); wxWindow* parent = GetParentForModalDialog( GetParent(), GetWindowStyle() );
// Show the optimal parent
DBG( if( parent ) printf( "%s: optimal parent: %s\n", __func__, typeid(*parent).name() );)
wxASSERT_MSG( !m_qmodal_parent_disabler, wxASSERT_MSG( !m_qmodal_parent_disabler,
wxT( "Caller using ShowQuasiModal() twice on same window?" ) ); wxT( "Caller using ShowQuasiModal() twice on same window?" ) );
// quasi-modal: disable only my "optimal" parent // quasi-modal: disable only my "optimal" parent
m_qmodal_parent_disabler = new WDO_ENABLE_DISABLE( parent ); m_qmodal_parent_disabler = new WDO_ENABLE_DISABLE( parent );
// Apple in its infinite wisdom will raise a disabled window before even passing // Apple in its infinite wisdom will raise a disabled window before even passing
// us the event, so we have no way to stop it. Instead, we must set an order on // us the event, so we have no way to stop it. Instead, we must set an order on
// the windows so that the quasi-modal will be pushed in front of the disabled // the windows so that the quasi-modal will be pushed in front of the disabled

View File

@ -3,7 +3,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-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2007-2020 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
@ -776,7 +776,6 @@ exit: // single point of exit, no returns elsewhere please.
next = head; next = head;
// printf("tok:\"%s\"\n", curText.c_str() );
return curTok; return curTok;
} }

View File

@ -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) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2012-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2012-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2017 CERN. * Copyright (C) 2017 CERN.
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* *
@ -598,7 +598,6 @@ wxSize ETEXT::ConvertSize() const
} }
else else
{ {
wxLogDebug( "Invalid font name \"%s\"", fontName );
textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() );
} }
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -196,8 +196,8 @@ void EDA_BASE_FRAME::SetShutdownBlockReason( const wxString& aReason )
if( !ShutdownBlockReasonCreate( GetHandle(), aReason.wc_str() ) ) if( !ShutdownBlockReasonCreate( GetHandle(), aReason.wc_str() ) )
{ {
// Nothing bad happens if this fails, at worst it uses a generic application is preventing shutdown message // Nothing bad happens if this fails, at worst it uses a generic application is
wxLogDebug( wxT( "ShutdownBlockReasonCreate failed to set reason: %s" ), aReason ); // preventing shutdown message
} }
#endif #endif
} }
@ -460,8 +460,6 @@ void EDA_BASE_FRAME::LoadWindowSettings( WINDOW_SETTINGS* aCfg )
wxDisplay display( index ); wxDisplay display( index );
wxRect clientSize = display.GetClientArea(); wxRect clientSize = display.GetClientArea();
wxLogDebug( "Client size (%d, %d)", clientSize.width, clientSize.height );
m_FramePos = wxDefaultPosition; m_FramePos = wxDefaultPosition;
// Ensure the window fits on the display, since the other one could have been larger // Ensure the window fits on the display, since the other one could have been larger

View File

@ -2,6 +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 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -63,10 +65,6 @@ void CACHED_CONTAINER::SetItem( VERTEX_ITEM* aItem )
// Get the previously set offset if the item was stored previously // Get the previously set offset if the item was stored previously
m_chunkOffset = itemSize > 0 ? aItem->GetOffset() : -1; m_chunkOffset = itemSize > 0 ? aItem->GetOffset() : -1;
#if CACHED_CONTAINER_TEST > 1
wxLogDebug( wxT( "Adding/editing item 0x%08lx (size %d)" ), (long) m_item, itemSize );
#endif
} }
@ -97,7 +95,6 @@ void CACHED_CONTAINER::FinishItem()
m_chunkOffset = 0; m_chunkOffset = 0;
#if CACHED_CONTAINER_TEST > 1 #if CACHED_CONTAINER_TEST > 1
wxLogDebug( wxT( "Finishing item 0x%08lx (size %d)" ), (long) m_item, itemSize );
test(); test();
#endif #endif
} }
@ -156,10 +153,6 @@ void CACHED_CONTAINER::Delete( VERTEX_ITEM* aItem )
int offset = aItem->GetOffset(); int offset = aItem->GetOffset();
#if CACHED_CONTAINER_TEST > 1
wxLogDebug( wxT( "Removing 0x%08lx (size %d offset %d)" ), (long) aItem, size, offset );
#endif
// Insert a free memory chunk entry in the place where item was stored // Insert a free memory chunk entry in the place where item was stored
addFreeChunk( offset, size ); addFreeChunk( offset, size );
@ -215,10 +208,6 @@ bool CACHED_CONTAINER::reallocate( unsigned int aSize )
unsigned int itemSize = m_item->GetSize(); unsigned int itemSize = m_item->GetSize();
#if CACHED_CONTAINER_TEST > 2
wxLogDebug( wxT( "Resize %p from %d to %d" ), m_item, itemSize, aSize );
#endif
// Find a free space chunk >= aSize // Find a free space chunk >= aSize
FREE_CHUNK_MAP::iterator newChunk = m_freeChunks.lower_bound( aSize ); FREE_CHUNK_MAP::iterator newChunk = m_freeChunks.lower_bound( aSize );
@ -256,10 +245,6 @@ bool CACHED_CONTAINER::reallocate( unsigned int aSize )
// Check if the item was previously stored in the container // Check if the item was previously stored in the container
if( itemSize > 0 ) if( itemSize > 0 )
{ {
#if CACHED_CONTAINER_TEST > 3
wxLogDebug( wxT( "Moving 0x%08x from 0x%08x to 0x%08x" ),
(int) m_item, oldChunkOffset, newChunkOffset );
#endif
// The item was reallocated, so we have to copy all the old data to the new place // The item was reallocated, so we have to copy all the old data to the new place
memcpy( &m_vertices[newChunkOffset], &m_vertices[m_chunkOffset], itemSize * VERTEX_SIZE ); memcpy( &m_vertices[newChunkOffset], &m_vertices[m_chunkOffset], itemSize * VERTEX_SIZE );
@ -363,10 +348,6 @@ void CACHED_CONTAINER::mergeFreeChunks()
// Add the last one // Add the last one
m_freeChunks.insert( std::make_pair( size, offset ) ); m_freeChunks.insert( std::make_pair( size, offset ) );
#ifdef __WXDEBUG__
totalTime.Stop();
wxLogDebug( "Merged free chunks / %.1f ms", totalTime.msecs() );
#endif /* __WXDEBUG__ */
#if CACHED_CONTAINER_TEST > 0 #if CACHED_CONTAINER_TEST > 0
test(); test();
#endif #endif
@ -385,42 +366,11 @@ void CACHED_CONTAINER::addFreeChunk( unsigned int aOffset, unsigned int aSize )
void CACHED_CONTAINER::showFreeChunks() void CACHED_CONTAINER::showFreeChunks()
{ {
#ifdef __WXDEBUG__
FREE_CHUNK_MAP::iterator it;
wxLogDebug( wxT( "Free chunks:" ) );
for( it = m_freeChunks.begin(); it != m_freeChunks.end(); ++it )
{
unsigned int offset = getChunkOffset( *it );
unsigned int size = getChunkSize( *it );
assert( size > 0 );
wxLogDebug( wxT( "[0x%08x-0x%08x] (size %d)" ),
offset, offset + size - 1, size );
}
#endif /* __WXDEBUG__ */
} }
void CACHED_CONTAINER::showUsedChunks() void CACHED_CONTAINER::showUsedChunks()
{ {
#ifdef __WXDEBUG__
ITEMS::iterator it;
wxLogDebug( wxT( "Used chunks:" ) );
for( it = m_items.begin(); it != m_items.end(); ++it )
{
VERTEX_ITEM* item = *it;
unsigned int offset = item->GetOffset();
unsigned int size = item->GetSize();
assert( size > 0 );
wxLogDebug( wxT( "[0x%08x-0x%08x] @ 0x%p (size %d)" ),
offset, offset + size - 1, item, size );
}
#endif /* __WXDEBUG__ */
} }

View File

@ -2,6 +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 2013-2017 CERN * Copyright 2013-2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -44,10 +46,10 @@ CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU( unsigned int aSize ) :
wxString vendor( glGetString(GL_VENDOR) ); wxString vendor( glGetString(GL_VENDOR) );
// workaround for intel GPU drivers: disable glCopyBuffer, causes crashes/freezes on certain driver versions // workaround for intel GPU drivers: disable glCopyBuffer, causes crashes/freezes on
// certain driver versions
if( vendor.Contains ( "Intel " ) || vendor.Contains ( "etnaviv" ) ) if( vendor.Contains ( "Intel " ) || vendor.Contains ( "etnaviv" ) )
{ {
wxLogDebug( "Disabling glCopyBuffer(), on %s GPU.\n", vendor );
m_useCopyBuffer = false; m_useCopyBuffer = false;
} }

View File

@ -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) 2012 Torsten Hueter, torstenhtr <at> gmx.de * Copyright (C) 2012 Torsten Hueter, torstenhtr <at> gmx.de
* Copyright (C) 2012 Kicad Developers, see change_log.txt for contributors. * Copyright (C) 2012-2020 Kicad Developers, see change_log.txt for contributors.
* *
* Graphics Abstraction Layer (GAL) for OpenGL * Graphics Abstraction Layer (GAL) for OpenGL
* *
@ -185,8 +185,6 @@ void SHADER::programInfo( GLuint aProgram )
GLchar* glInfoLog = new GLchar[glInfoLogLength]; GLchar* glInfoLog = new GLchar[glInfoLogLength];
glGetProgramInfoLog( aProgram, glInfoLogLength, &writtenChars, glInfoLog ); glGetProgramInfoLog( aProgram, glInfoLogLength, &writtenChars, glInfoLog );
std::cerr << glInfoLog << std::endl;
delete[] glInfoLog; delete[] glInfoLog;
} }
} }
@ -206,8 +204,6 @@ void SHADER::shaderInfo( GLuint aShader )
GLchar* glInfoLog = new GLchar[glInfoLogLength]; GLchar* glInfoLog = new GLchar[glInfoLogLength];
glGetShaderInfoLog( aShader, glInfoLogLength, &writtenChars, glInfoLog ); glGetShaderInfoLog( aShader, glInfoLogLength, &writtenChars, glInfoLog );
std::cerr << glInfoLog << std::endl;
delete[] glInfoLog; delete[] glInfoLog;
} }
} }

View File

@ -26,6 +26,8 @@
#include <GL/glew.h> #include <GL/glew.h>
#include <stdexcept> #include <stdexcept>
#include <wx/log.h> // wxLogDebug
int checkGlError( const std::string& aInfo, bool aThrow ) int checkGlError( const std::string& aInfo, bool aThrow )
{ {
@ -127,13 +129,13 @@ static void GLAPIENTRY debugMsgCallback( GLenum aSource, GLenum aType, GLuint aI
{ {
switch( aSeverity ) switch( aSeverity )
{ {
case GL_DEBUG_SEVERITY_HIGH: printf( "OpenGL ERROR: " ); break; case GL_DEBUG_SEVERITY_HIGH: wxLogDebug( "OpenGL ERROR: " ); break;
case GL_DEBUG_SEVERITY_MEDIUM: printf( "OpenGL WARNING: " ); break; case GL_DEBUG_SEVERITY_MEDIUM: wxLogDebug( "OpenGL WARNING: " ); break;
case GL_DEBUG_SEVERITY_LOW: printf( "OpenGL INFO: " ); break; case GL_DEBUG_SEVERITY_LOW: wxLogDebug( "OpenGL INFO: " ); break;
case GL_DEBUG_SEVERITY_NOTIFICATION: return; case GL_DEBUG_SEVERITY_NOTIFICATION: return;
} }
printf( "%s\n", aMessage ); wxLogDebug( "%s\n", aMessage );
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
* Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2008-2017 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -81,16 +81,6 @@ wxString EDA_FILE_SELECTOR( const wxString& aTitle,
wxSetWorkingDirectory( defaultpath ); wxSetWorkingDirectory( defaultpath );
#if 0 && defined (DEBUG)
printf( "defaultpath=\"%s\" defaultname=\"%s\" Ext=\"%s\" Mask=\"%s\" flag=%d keep_working_directory=%d\n",
TO_UTF8( defaultpath ),
TO_UTF8( defaultname ),
TO_UTF8( aExtension ),
TO_UTF8( aWildcard ),
aStyle,
aKeepWorkingDirectory );
#endif
fullfilename = wxFileSelector( aTitle, defaultpath, defaultname, fullfilename = wxFileSelector( aTitle, defaultpath, defaultname,
dotted_Ext, aWildcard, dotted_Ext, aWildcard,
aStyle, // open mode wxFD_OPEN, wxFD_SAVE .. aStyle, // open mode wxFD_OPEN, wxFD_SAVE ..

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2015 Mark Roszko <mark.roszko@gmail.com> * Copyright (C) 2015 Mark Roszko <mark.roszko@gmail.com>
* Copyright (C) 2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2016 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2020 KiCad Developers, see CHANGELOG.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
@ -165,8 +165,6 @@ void KICAD_CURL::Init()
init_locks(); init_locks();
//wxLogDebug( "Using %s", GetVersion() );
s_initialized = true; s_initialized = true;
} }
} }

View File

@ -116,10 +116,6 @@ void LIB_TREE_MODEL_ADAPTER::SaveColWidths()
auto cfg = Kiface().KifaceSettings(); auto cfg = Kiface().KifaceSettings();
cfg->m_LibTree.column_width = m_widget->GetColumn( PART_COL )->GetWidth(); cfg->m_LibTree.column_width = m_widget->GetColumn( PART_COL )->GetWidth();
} }
else
{
wxLogDebug( "Error saving column size, tree view doesn't exist" );
}
} }

View File

@ -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 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2014-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2014-2020 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
@ -63,8 +63,6 @@ LSET::LSET( unsigned aIdCount, int aFirst, ... ) :
{ {
PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int ); PCB_LAYER_ID id = (PCB_LAYER_ID) va_arg( ap, int );
// printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT );
assert( unsigned( id ) < PCB_LAYER_ID_COUNT ); assert( unsigned( id ) < PCB_LAYER_ID_COUNT );
set( id ); set( id );

View File

@ -262,12 +262,6 @@ void PROJECT::SetElem( ELEM_T aIndex, _ELEM* aElem )
if( unsigned( aIndex ) < arrayDim( m_elems ) ) if( unsigned( aIndex ) < arrayDim( m_elems ) )
{ {
#if defined(DEBUG) && 0
if( aIndex == ELEM_SCH_PART_LIBS )
{
printf( "%s: &m_elems[%i]:%p aElem:%p\n", __func__, aIndex, &m_elems[aIndex], aElem );
}
#endif
delete m_elems[aIndex]; delete m_elems[aIndex];
m_elems[aIndex] = aElem; m_elems[aIndex] = aElem;
} }

View File

@ -3,7 +3,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) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2013 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2013-2020 KiCad Developers, see CHANGELOG.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,8 +60,6 @@ inline void scanList( PTREE* aTree, DSNLEXER* aLexer )
const char* key = aLexer->CurText(); const char* key = aLexer->CurText();
//D(printf( "%s: '%s'\n", __func__, key );)
PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second; PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second;
if( tok != DSN_RIGHT ) if( tok != DSN_RIGHT )
@ -81,8 +79,6 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer )
{ {
const char* key = aLexer->CurText(); const char* key = aLexer->CurText();
//D(printf( "%s: '%s'\n", __func__, key );)
aTree->push_back( PTREE::value_type( key, PTREE() ) ); aTree->push_back( PTREE::value_type( key, PTREE() ) );
} }

View File

@ -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) 2013-2019 CERN * Copyright (C) 2013-2019 CERN
* Copyright (C) 2013-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2013-2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
@ -267,9 +267,8 @@ void ACTION_MENU::UpdateAll()
{ {
update(); update();
} }
catch( std::exception& e ) catch( std::exception& )
{ {
wxLogDebug( wxString::Format( "ACTION_MENU update handler exception: %s", e.what() ) );
} }
if( m_tool ) if( m_tool )
@ -560,9 +559,8 @@ void ACTION_MENU::runOnSubmenus( std::function<void(ACTION_MENU*)> aFunction )
m->runOnSubmenus( aFunction ); m->runOnSubmenus( aFunction );
} ); } );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
wxLogDebug( wxString::Format( "ACTION_MENU runOnSubmenus exception: %s", e.what() ) );
} }
} }

View File

@ -80,9 +80,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_cancelHandler)(); (*m_cancelHandler)();
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PICKER_TOOL cancel handler error: " << e.what() << std::endl;
} }
} }
@ -108,9 +107,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
getNext = (*m_clickHandler)( *m_picked ); getNext = (*m_clickHandler)( *m_picked );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PICKER_TOOL click handler error: " << e.what() << std::endl;
finalize_state = EXCEPTION_CANCEL; finalize_state = EXCEPTION_CANCEL;
break; break;
} }
@ -133,9 +131,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_motionHandler)( cursorPos ); (*m_motionHandler)( cursorPos );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PICKER_TOOL motion handler error: " << e.what() << std::endl;
} }
} }
} }
@ -160,9 +157,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_finalizeHandler)( finalize_state ); (*m_finalizeHandler)( finalize_state );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PICKER_TOOL finalize handler error: " << e.what() << std::endl;
} }
} }

View File

@ -169,10 +169,6 @@ void mpInfoLayer::Plot( wxDC& dc, mpWindow& w )
if( (m_winX != scrx) || (m_winY != scry) ) if( (m_winX != scrx) || (m_winY != scry) )
{ {
#ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d", m_winX, m_winY, scrx, scry);
#endif
if( m_winX > 1 ) if( m_winX > 1 )
m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) ); m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) );
@ -250,10 +246,6 @@ void mpInfoCoords::Plot( wxDC& dc, mpWindow& w )
if( (m_winX != scrx) || (m_winY != scry) ) if( (m_winX != scrx) || (m_winY != scry) )
{ {
#ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d", m_winX, m_winY, scrx, scry);
#endif
if( m_winX > 1 ) if( m_winX > 1 )
m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) ); m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) );
@ -319,10 +311,6 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
if( (m_winX != scrx) || (m_winY != scry) ) if( (m_winX != scrx) || (m_winY != scry) )
{ {
#ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "mpInfoLayer::Plot() screen size has changed from %d x %d to %d x %d", m_winX, m_winY, scrx, scry);
#endif
if( m_winX > 1 ) if( m_winX > 1 )
m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) ); m_dim.x = (int) floor( (double) (m_dim.x * scrx / m_winX) );
@ -362,9 +350,6 @@ void mpInfoLegend::Plot( wxDC& dc, mpWindow& w )
textX = textX =
( textX > (tmpX + baseWidth) ) ? textX : (tmpX + baseWidth + mpLEGEND_MARGIN); ( textX > (tmpX + baseWidth) ) ? textX : (tmpX + baseWidth + mpLEGEND_MARGIN);
textY += (tmpY); textY += (tmpY);
#ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "mpInfoLegend::Plot() Adding layer %d: %s", p, label.c_str());
#endif
} }
} }
@ -872,8 +857,6 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) ); m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) );
// printf("minV %.10f maxV %.10f %.10f %.10f\n", minV, maxV, minVvis, maxVvis);
m_tickValues.clear(); m_tickValues.clear();
m_tickLabels.clear(); m_tickLabels.clear();
@ -884,9 +867,6 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
{ {
double curr_step = fabs( maxVvis - minVvis ) / (double) i; double curr_step = fabs( maxVvis - minVvis ) / (double) i;
double base = pow( 10, floor( log10( curr_step ) ) ); double base = pow( 10, floor( log10( curr_step ) ) );
// printf("base %.3f\n", base);
double stepInt = floor( curr_step / base ) * base; double stepInt = floor( curr_step / base ) * base;
double err = fabs( curr_step - stepInt ); double err = fabs( curr_step - stepInt );
@ -895,15 +875,12 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
minErr = err; minErr = err;
bestStep = stepInt; bestStep = stepInt;
} }
// printf("curr_step %d %.3f %.3f best %.3f\n",i, curr_step, stepInt, bestStep);
} }
double v = floor( minVvis / bestStep ) * bestStep; double v = floor( minVvis / bestStep ) * bestStep;
double zeroOffset = 100000000.0; double zeroOffset = 100000000.0;
// printf("maxVVis %.3f\n", maxVvis);
while( v < maxVvis ) while( v < maxVvis )
{ {
@ -912,7 +889,6 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w )
if( fabs( v ) < zeroOffset ) if( fabs( v ) < zeroOffset )
zeroOffset = fabs( v ); zeroOffset = fabs( v );
// printf("tick %.3f\n", v);
v += bestStep; v += bestStep;
} }
@ -967,7 +943,6 @@ int mpScaleBase::getLabelDecimalDigits( int maxDigits )
void mpScaleBase::computeLabelExtents( wxDC& dc, mpWindow& w ) void mpScaleBase::computeLabelExtents( wxDC& dc, mpWindow& w )
{ {
// printf("test: %d %d %d\n", countDecimalDigits(1.0), countDecimalDigits(1.1), countDecimalDigits(1.22231));
m_maxLabelHeight = 0; m_maxLabelHeight = 0;
m_maxLabelWidth = 0; m_maxLabelWidth = 0;
@ -1067,8 +1042,6 @@ void mpScaleY::getVisibleDataRange( mpWindow& w, double& minV, double& maxV )
double pymin = w.p2y( minYpx ); double pymin = w.p2y( minYpx );
double pymax = w.p2y( maxYpx ); double pymax = w.p2y( maxYpx );
// printf("PYmin %.3f PYmax %.3f\n", pymin, pymax);
minV = TransformFromPlot( pymax ); minV = TransformFromPlot( pymax );
maxV = TransformFromPlot( pymin ); maxV = TransformFromPlot( pymin );
} }
@ -1082,7 +1055,6 @@ void mpScaleY::computeSlaveTicks( mpWindow& w )
m_tickValues.clear(); m_tickValues.clear();
m_tickLabels.clear(); m_tickLabels.clear();
// printf("NTicks %d\n", m_masterScale->m_tickValues.size());
double p0 = m_masterScale->TransformToPlot( m_masterScale->m_tickValues[0] ); double p0 = m_masterScale->TransformToPlot( m_masterScale->m_tickValues[0] );
double p1 = m_masterScale->TransformToPlot( m_masterScale->m_tickValues[1] ); double p1 = m_masterScale->TransformToPlot( m_masterScale->m_tickValues[1] );
@ -1127,8 +1099,6 @@ void mpScaleY::computeSlaveTicks( mpWindow& w )
void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
{ {
// printf("this %p master %p\n", this, m_masterScale);
if( m_masterScale ) if( m_masterScale )
{ {
computeSlaveTicks( w ); computeSlaveTicks( w );
@ -1140,15 +1110,11 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
double minV, maxV, minVvis, maxVvis; double minV, maxV, minVvis, maxVvis;
GetDataRange( minV, maxV ); GetDataRange( minV, maxV );
getVisibleDataRange( w, minVvis, maxVvis ); getVisibleDataRange( w, minVvis, maxVvis );
// printf("vdr %.10f %.10f\n", minVvis, maxVvis);
m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) ); m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) );
m_tickValues.clear(); m_tickValues.clear();
m_tickLabels.clear(); m_tickLabels.clear();
double minErr = 1000000000000.0; double minErr = 1000000000000.0;
double bestStep = 1.0; double bestStep = 1.0;
@ -1156,9 +1122,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
{ {
double curr_step = fabs( maxVvis - minVvis ) / (double) i; double curr_step = fabs( maxVvis - minVvis ) / (double) i;
double base = pow( 10, floor( log10( curr_step ) ) ); double base = pow( 10, floor( log10( curr_step ) ) );
// printf("base %.3f\n", base);
double stepInt = floor( curr_step / base ) * base; double stepInt = floor( curr_step / base ) * base;
double err = fabs( curr_step - stepInt ); double err = fabs( curr_step - stepInt );
@ -1167,15 +1130,12 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
minErr = err; minErr = err;
bestStep = stepInt; bestStep = stepInt;
} }
// printf("curr_step %d %.3f %.3f best %.3f\n",i, curr_step, stepInt, bestStep);
} }
double v = floor( minVvis / bestStep ) * bestStep; double v = floor( minVvis / bestStep ) * bestStep;
double zeroOffset = 100000000.0; double zeroOffset = 100000000.0;
// printf("v %.3f maxVVis %.3f\n", v, maxVvis);
const int iterLimit = 1000; const int iterLimit = 1000;
int i = 0; int i = 0;
@ -1187,7 +1147,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
if( fabs( v ) < zeroOffset ) if( fabs( v ) < zeroOffset )
zeroOffset = fabs( v ); zeroOffset = fabs( v );
// printf("tick %.3f %d\n", v, m_tickValues.size());
v += bestStep; v += bestStep;
i++; i++;
} }
@ -1213,7 +1172,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w )
// end = n0 + // end = n0 +
// n0 = floor( (w.GetPosX() ) / step ) * step ; // n0 = floor( (w.GetPosX() ) / step ) * step ;
// printf("zeroOffset:%.3f tickjs : %d\n", zeroOffset, m_tickValues.size());
updateTickLabels( dc, w ); updateTickLabels( dc, w );
// labelStep = ceil(((double) m_maxLabelWidth + mpMIN_X_AXIS_LABEL_SEPARATION)/(w.GetScaleX()*step))*step; // labelStep = ceil(((double) m_maxLabelWidth + mpMIN_X_AXIS_LABEL_SEPARATION)/(w.GetScaleX()*step))*step;
@ -1224,9 +1182,6 @@ void mpScaleXBase::getVisibleDataRange( mpWindow& w, double& minV, double& maxV
{ {
wxCoord startPx = m_drawOutsideMargins ? 0 : w.GetMarginLeft(); wxCoord startPx = m_drawOutsideMargins ? 0 : w.GetMarginLeft();
wxCoord endPx = m_drawOutsideMargins ? w.GetScrX() : w.GetScrX() - w.GetMarginRight(); wxCoord endPx = m_drawOutsideMargins ? w.GetScrX() : w.GetScrX() - w.GetMarginRight();
// printf("getVisibleDataRange\n");
double pxmin = w.p2x( startPx ); double pxmin = w.p2x( startPx );
double pxmax = w.p2x( endPx ); double pxmax = w.p2x( endPx );
@ -1245,9 +1200,6 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w )
// double decades = log( maxV / minV ) / log(10); // double decades = log( maxV / minV ) / log(10);
double minDecade = pow( 10, floor( log10( minV ) ) ); double minDecade = pow( 10, floor( log10( minV ) ) );
double maxDecade = pow( 10, ceil( log10( maxV ) ) ); double maxDecade = pow( 10, ceil( log10( maxV ) ) );
// printf("test: %d %d %d\n", countDecimalDigits(1.0), countDecimalDigits(1.1), countDecimalDigits(1.22231));
double visibleDecades = log( maxVvis / minVvis ) / log( 10 ); double visibleDecades = log( maxVvis / minVvis ) / log( 10 );
double d; double d;
@ -1261,7 +1213,6 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w )
for( d = minDecade; d<=maxDecade; d *= 10.0 ) for( d = minDecade; d<=maxDecade; d *= 10.0 )
{ {
// printf("d %.1f\n",d );
m_tickLabels.emplace_back( d ); m_tickLabels.emplace_back( d );
for( double dd = d; dd < d * 10; dd += d ) for( double dd = d; dd < d * 10; dd += d )
@ -1354,13 +1305,10 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
wxCoord minYpx = m_drawOutsideMargins ? 0 : w.GetMarginTop(); wxCoord minYpx = m_drawOutsideMargins ? 0 : w.GetMarginTop();
wxCoord maxYpx = m_drawOutsideMargins ? w.GetScrY() : w.GetScrY() - w.GetMarginBottom(); wxCoord maxYpx = m_drawOutsideMargins ? w.GetScrY() : w.GetScrY() - w.GetMarginBottom();
// printf("StartPx %d endPx %d ordy %d maxy %d\n", startPx, endPx, orgy, maxYpx);
// int tmp=-65535; // int tmp=-65535;
int labelH = m_maxLabelHeight; // Control labels heigth to decide where to put axis name (below labels or on top of axis) int labelH = m_maxLabelHeight; // Control labels heigth to decide where to put axis name (below labels or on top of axis)
// int maxExtent = tc.MaxLabelWidth(); // int maxExtent = tc.MaxLabelWidth();
// printf("Ticks : %d\n",labelCount());
for( int n = 0; n < tickCount(); n++ ) for( int n = 0; n < tickCount(); n++ )
{ {
double tp = getTickPos( n ); double tp = getTickPos( n );
@ -1372,10 +1320,6 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
const int p = (int) ( ( px - w.GetPosX() ) * w.GetScaleX() ); const int p = (int) ( ( px - w.GetPosX() ) * w.GetScaleX() );
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( wxT( "mpScaleX::Plot: n: %f -> p = %d" ), n, p );
#endif
if( (p >= startPx) && (p <= endPx) ) if( (p >= startPx) && (p <= endPx) )
{ {
if( m_ticks ) // draw axis ticks if( m_ticks ) // draw axis ticks
@ -1392,7 +1336,6 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
if( (m_flags == mpALIGN_BOTTOM) && !m_drawOutsideMargins ) if( (m_flags == mpALIGN_BOTTOM) && !m_drawOutsideMargins )
{ {
// printf("d1");
m_pen.SetStyle( wxPENSTYLE_DOT ); m_pen.SetStyle( wxPENSTYLE_DOT );
dc.SetPen( m_pen ); dc.SetPen( m_pen );
dc.DrawLine( p, orgy + 4, p, minYpx ); dc.DrawLine( p, orgy + 4, p, minYpx );
@ -1404,12 +1347,10 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
{ {
if( (m_flags == mpALIGN_TOP) && !m_drawOutsideMargins ) if( (m_flags == mpALIGN_TOP) && !m_drawOutsideMargins )
{ {
// printf("d2");
dc.DrawLine( p, orgy - 4, p, maxYpx ); dc.DrawLine( p, orgy - 4, p, maxYpx );
} }
else else
{ {
// printf("d3");
dc.DrawLine( p, minYpx, p, maxYpx ); // 0/*-w.GetScrY()*/, p, w.GetScrY() ); dc.DrawLine( p, minYpx, p, maxYpx ); // 0/*-w.GetScrY()*/, p, w.GetScrY() );
} }
} }
@ -1425,8 +1366,8 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
dc.DrawLine( startPx, minYpx, endPx, minYpx ); dc.DrawLine( startPx, minYpx, endPx, minYpx );
dc.DrawLine( startPx, maxYpx, endPx, maxYpx ); dc.DrawLine( startPx, maxYpx, endPx, maxYpx );
// printf("Labels : %d\n",labelCount()); // Actually draw labels, taking care of not overlapping them, and distributing them
// Actually draw labels, taking care of not overlapping them, and distributing them regularly // regularly
for( int n = 0; n < labelCount(); n++ ) for( int n = 0; n < labelCount(); n++ )
{ {
double tp = getLabelPos( n ); double tp = getLabelPos( n );
@ -1441,11 +1382,6 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w )
const int p = (int) ( ( px - w.GetPosX() ) * w.GetScaleX() ); const int p = (int) ( ( px - w.GetPosX() ) * w.GetScaleX() );
// printf("p %d %.1f\n", p, px);
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( wxT( "mpScaleX::Plot: n_label = %f -> p_label = %d" ), n, p );
#endif
if( (p >= startPx) && (p <= endPx) ) if( (p >= startPx) && (p <= endPx) )
{ {
// Write ticks labels in s string // Write ticks labels in s string
@ -1527,7 +1463,6 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w )
m_offset = -m_minV; m_offset = -m_minV;
m_scale = 1.0 / ( m_maxV - m_minV ); m_scale = 1.0 / ( m_maxV - m_minV );
// printf("Plot Y-scale\n");
recalculateTicks( dc, w ); recalculateTicks( dc, w );
if( m_visible ) if( m_visible )
@ -1582,11 +1517,8 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w )
s.Printf( fmt, n ); s.Printf( fmt, n );
dc.GetTextExtent( s, &tx, &labelHeigth ); dc.GetTextExtent( s, &tx, &labelHeigth );
// printf("Y-ticks: %d\n", tickCount());
for( n = 0; n < tickCount(); n++ ) for( n = 0; n < tickCount(); n++ )
{ {
// printf("Tick %d\n", n);
double tp = getTickPos( n ); double tp = getTickPos( n );
double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin);
@ -1623,11 +1555,8 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w )
} }
} }
// printf("Y-ticks: %d\n", tickCount());
for( n = 0; n < labelCount(); n++ ) for( n = 0; n < labelCount(); n++ )
{ {
// printf("Tick %d\n", n);
double tp = getLabelPos( n ); double tp = getLabelPos( n );
double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin);
@ -1906,14 +1835,6 @@ void mpWindow::OnMouseMove( wxMouseEvent& event )
if( updateRequired ) if( updateRequired )
UpdateAll(); UpdateAll();
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "[mpWindow::OnMouseMove] Ax:%i Ay:%i m_posX:%f m_posY:%f",
Ax,
Ay,
m_posX,
m_posY );
#endif
} }
else else
{ {
@ -1980,20 +1901,9 @@ void mpWindow::OnMouseLeftDown( wxMouseEvent& event )
m_mouseLClick.x = event.GetX(); m_mouseLClick.x = event.GetX();
m_mouseLClick.y = event.GetY(); m_mouseLClick.y = event.GetY();
m_zooming = true; m_zooming = true;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::OnMouseLeftDown() X = %d , Y = %d", event.GetX(), event.GetY() ); /*m_mouseLClick.x, m_mouseLClick.y);*/
#endif
wxPoint pointClicked = event.GetPosition(); wxPoint pointClicked = event.GetPosition();
m_movingInfoLayer = IsInsideInfoLayer( pointClicked ); m_movingInfoLayer = IsInsideInfoLayer( pointClicked );
if( m_movingInfoLayer != NULL )
{
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::OnMouseLeftDown() started moving layer %lx",
(long int) m_movingInfoLayer ); /*m_mouseLClick.x, m_mouseLClick.y);*/
#endif
}
event.Skip(); event.Skip();
} }
@ -2074,10 +1984,8 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
if( m_lockaspect ) if( m_lockaspect )
{ {
#ifdef MATHPLOT_DO_LOGGING // Keep the lowest "scale" to fit the whole range required by that axis (to actually
wxLogMessage( "mpWindow::Fit()(lock) m_scaleX=%f,m_scaleY=%f", m_scaleX, m_scaleY ); // "fit"!):
#endif
// Keep the lowest "scale" to fit the whole range required by that axis (to actually "fit"!):
double s = m_scaleX < m_scaleY ? m_scaleX : m_scaleY; double s = m_scaleX < m_scaleY ? m_scaleX : m_scaleY;
m_scaleX = s; m_scaleX = s;
m_scaleY = s; m_scaleY = s;
@ -2093,24 +2001,6 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax,
m_posY = (yMin + yMax) / 2 + ( (m_scrY - m_marginTop - m_marginBottom) / 2 + m_marginTop ) / m_posY = (yMin + yMax) / 2 + ( (m_scrY - m_marginTop - m_marginBottom) / 2 + m_marginTop ) /
m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY; m_scaleY; // m_posY = (yMin+yMax)/2 + (m_scrY/2)/m_scaleY;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::Fit() m_desiredXmin=%f m_desiredXmax=%f m_desiredYmin=%f m_desiredYmax=%f",
xMin,
xMax,
yMin,
yMax );
wxLogMessage(
"mpWindow::Fit() m_scaleX = %f , m_scrX = %d,m_scrY=%d, Ax=%f, Ay=%f, m_posX=%f, m_posY=%f",
m_scaleX,
m_scrX,
m_scrY,
Ax,
Ay,
m_posX,
m_posY );
#endif
// It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!! // It is VERY IMPORTANT to DO NOT call Refresh if we are drawing to the printer!!
// Otherwise, the DC dimensions will be those of the window instead of the printer device // Otherwise, the DC dimensions will be those of the window instead of the printer device
if( printSizeX==NULL || printSizeY==NULL ) if( printSizeX==NULL || printSizeY==NULL )
@ -2131,11 +2021,6 @@ void mpWindow::DoZoomInXCalc( const int staticXpixel )
// Adjust desired // Adjust desired
m_desiredXmin = m_posX; m_desiredXmin = m_posX;
m_desiredXmax = m_posX + ( m_scrX - (m_marginLeft + m_marginRight) ) / m_scaleX; m_desiredXmax = m_posX + ( m_scrX - (m_marginLeft + m_marginRight) ) / m_scaleX;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::DoZoomInXCalc() prior X coord: (%f), new X coord: (%f) SHOULD BE EQUAL!!",
staticX, p2x( staticXpixel ) );
#endif
} }
@ -2151,11 +2036,6 @@ void mpWindow::DoZoomInYCalc( const int staticYpixel )
// Adjust desired // Adjust desired
m_desiredYmax = m_posY; m_desiredYmax = m_posY;
m_desiredYmin = m_posY - ( m_scrY - (m_marginTop + m_marginBottom) ) / m_scaleY; m_desiredYmin = m_posY - ( m_scrY - (m_marginTop + m_marginBottom) ) / m_scaleY;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::DoZoomInYCalc() prior Y coord: (%f), new Y coord: (%f) SHOULD BE EQUAL!!",
staticY, p2y( staticYpixel ) );
#endif
} }
@ -2171,11 +2051,6 @@ void mpWindow::DoZoomOutXCalc( const int staticXpixel )
// Adjust desired // Adjust desired
m_desiredXmin = m_posX; m_desiredXmin = m_posX;
m_desiredXmax = m_posX + ( m_scrX - (m_marginLeft + m_marginRight) ) / m_scaleX; m_desiredXmax = m_posX + ( m_scrX - (m_marginLeft + m_marginRight) ) / m_scaleX;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::DoZoomOutXCalc() prior X coord: (%f), new X coord: (%f) SHOULD BE EQUAL!!",
staticX, p2x( staticXpixel ) );
#endif
} }
@ -2191,11 +2066,6 @@ void mpWindow::DoZoomOutYCalc( const int staticYpixel )
// Adjust desired // Adjust desired
m_desiredYmax = m_posY; m_desiredYmax = m_posY;
m_desiredYmin = m_posY - ( m_scrY - (m_marginTop + m_marginBottom) ) / m_scaleY; m_desiredYmin = m_posY - ( m_scrY - (m_marginTop + m_marginBottom) ) / m_scaleY;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::DoZoomOutYCalc() prior Y coord: (%f), new Y coord: (%f) SHOULD BE EQUAL!!",
staticY, p2y( staticYpixel ) );
#endif
} }
@ -2326,12 +2196,6 @@ void mpWindow::ZoomIn( const wxPoint& centerPoint, double zoomFactor )
m_desiredYmax = m_posY; m_desiredYmax = m_posY;
m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY; m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
AdjustLimitedView(); AdjustLimitedView();
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::ZoomIn() prior coords: (%f,%f), new coords: (%f,%f) SHOULD BE EQUAL!!",
prior_layer_x, prior_layer_y, p2x( c.x ), p2y( c.y ) );
#endif
UpdateAll(); UpdateAll();
} }
@ -2370,21 +2234,12 @@ void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor )
m_desiredYmax = m_posY; m_desiredYmax = m_posY;
m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY; m_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY;
// printf("desired xmin %.1f ymin %.1f xmax %.1f ymax %.1f l %d\n", m_desiredXmin, m_desiredYmin, m_desiredXmax, m_desiredYmax, !!m_enableLimitedView);
// printf("current xmin %.1f ymin %.1f xmax %.1f ymax %.1f\n", m_minX, m_minY, m_maxX, m_maxY);
if( !CheckXLimits( m_desiredXmax, if( !CheckXLimits( m_desiredXmax,
m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) ) m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) )
{ {
// printf("call fit()\n");
Fit(); Fit();
} }
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage(
"mpWindow::ZoomOut() prior coords: (%f,%f), new coords: (%f,%f) SHOULD BE EQUAL!!",
prior_layer_x, prior_layer_y, p2x( c.x ), p2y( c.y ) );
#endif
UpdateAll(); UpdateAll();
} }
@ -2431,10 +2286,6 @@ void mpWindow::ZoomRect( wxPoint p0, wxPoint p1 )
double zoom_y_min = p0y<p1y ? p0y : p1y; double zoom_y_min = p0y<p1y ? p0y : p1y;
double zoom_y_max = p0y>p1y ? p0y : p1y; double zoom_y_max = p0y>p1y ? p0y : p1y;
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "Zoom: (%f,%f)-(%f,%f)", zoom_x_min, zoom_y_min, zoom_x_max, zoom_y_max );
#endif
Fit( zoom_x_min, zoom_x_max, zoom_y_min, zoom_y_max ); Fit( zoom_x_min, zoom_x_max, zoom_y_min, zoom_y_max );
AdjustLimitedView(); AdjustLimitedView();
} }
@ -2496,9 +2347,6 @@ void mpWindow::OnSize( wxSizeEvent& WXUNUSED( event ) )
{ {
// Try to fit again with the new window size: // Try to fit again with the new window size:
Fit( m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax ); Fit( m_desiredXmin, m_desiredXmax, m_desiredYmin, m_desiredYmax );
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::OnSize() m_scrX = %d, m_scrY = %d", m_scrX, m_scrY );
#endif // MATHPLOT_DO_LOGGING
} }
@ -2568,10 +2416,6 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
dc.GetSize( &m_scrX, &m_scrY ); // This is the size of the visible area only! dc.GetSize( &m_scrX, &m_scrY ); // This is the size of the visible area only!
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "[mpWindow::OnPaint] vis.area: x %i y%i", m_scrX, m_scrY );
#endif
// Selects direct or buffered draw: // Selects direct or buffered draw:
wxDC* trgDc; wxDC* trgDc;
@ -2654,9 +2498,6 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
// void mpWindow::OnScroll2(wxScrollWinEvent &event) // void mpWindow::OnScroll2(wxScrollWinEvent &event)
// { // {
// #ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "[mpWindow::OnScroll2] Init: m_posX=%f m_posY=%f, sc_pos = %d",m_posX,m_posY, event.GetPosition());
// #endif
//// If scrollbars are not enabled, Skip operation //// If scrollbars are not enabled, Skip operation
// if (!m_enableScrollBars) { // if (!m_enableScrollBars) {
// event.Skip(); // event.Skip();
@ -2691,11 +2532,6 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( event ) )
//// //m_posY = m_maxY - (double)py / GetScaleY() - (double)(height>>1)/GetScaleY(); //// //m_posY = m_maxY - (double)py / GetScaleY() - (double)(height>>1)/GetScaleY();
//// // m_posY = p2y(py);//m_maxY - (double)(py /*+ (m_scrY)*/)/GetScaleY(); //// // m_posY = p2y(py);//m_maxY - (double)(py /*+ (m_scrY)*/)/GetScaleY();
//// }*/ //// }*/
// #ifdef MATHPLOT_DO_LOGGING
// int px, py;
// GetViewStart( &px, &py);
// wxLogMessage( "[mpWindow::OnScroll2] End: m_posX = %f, m_posY = %f, px = %f, py = %f",m_posX, m_posY, px, py);
// #endif
// //
// UpdateAll(); // UpdateAll();
//// event.Skip(); //// event.Skip();
@ -2727,9 +2563,6 @@ void mpWindow::SetMPScrollbars( bool status )
// m_scroll.y = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY); // m_scroll.y = (int) floor((m_maxY - m_posY /*- m_minY*/)*m_scaleY);
// int scrollWidth = (int) floor(((m_maxX - m_minX) - (m_desiredXmax - m_desiredXmin))*m_scaleX); // int scrollWidth = (int) floor(((m_maxX - m_minX) - (m_desiredXmax - m_desiredXmin))*m_scaleX);
// int scrollHeight = (int) floor(((m_maxY - m_minY) - (m_desiredYmax - m_desiredYmin))*m_scaleY); // int scrollHeight = (int) floor(((m_maxY - m_minY) - (m_desiredYmax - m_desiredYmin))*m_scaleY);
// #ifdef MATHPLOT_DO_LOGGING
// wxLogMessage( "mpWindow::SetMPScrollbars() scrollWidth = %d, scrollHeight = %d", scrollWidth, scrollHeight);
// #endif
// if(status) { // if(status) {
// SetScrollbars(1, // SetScrollbars(1,
// 1, // 1,
@ -2785,12 +2618,6 @@ bool mpWindow::UpdateBBox()
// node = node->GetNext(); // node = node->GetNext();
} }
#ifdef MATHPLOT_DO_LOGGING
wxLogDebug( wxT(
"[mpWindow::UpdateBBox] Bounding box: Xmin = %f, Xmax = %f, Ymin = %f, YMax = %f" ), m_minX, m_maxX, m_minY,
m_maxY );
#endif // MATHPLOT_DO_LOGGING
return first == false; return first == false;
#endif #endif
} }
@ -2840,9 +2667,6 @@ bool mpWindow::UpdateBBox()
* *
* SetScrollbars( 1, 1, sx, sy, px, py, true); * SetScrollbars( 1, 1, sx, sy, px, py, true);
* *
* #ifdef MATHPLOT_DO_LOGGING
* wxLogMessage( "[mpWindow::UpdateAll] Size:%ix%i ScrollBars:%i,%i",sx,sy,px,py);
* #endif
* } * }
* *
* FitInside(); * FitInside();
@ -3153,16 +2977,9 @@ mpInfoLayer* mpWindow::IsInsideInfoLayer( wxPoint& point )
for( li = m_layers.begin(); li != m_layers.end(); li++ ) for( li = m_layers.begin(); li != m_layers.end(); li++ )
{ {
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::IsInsideInfoLayer() examinining layer = %p", (*li) );
#endif // MATHPLOT_DO_LOGGING
if( (*li)->IsInfo() ) if( (*li)->IsInfo() )
{ {
mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li); mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li);
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "mpWindow::IsInsideInfoLayer() layer = %p", (*li) );
#endif // MATHPLOT_DO_LOGGING
if( tmpLyr->Inside( point ) ) if( tmpLyr->Inside( point ) )
{ {
@ -3280,9 +3097,6 @@ void mpWindow::SetColourTheme( const wxColour& bgColour,
* } * }
* // Draw inside margins * // Draw inside margins
* double marginScaleX = ((double)(m_scrX - m_marginLeft - m_marginRight))/m_scrX; * double marginScaleX = ((double)(m_scrX - m_marginLeft - m_marginRight))/m_scrX;
* #ifdef MATHPLOT_DO_LOGGING
* wxLogMessage(wxT("x2p ScrX = %d, marginRight = %d, marginLeft = %d, marginScaleX = %f"), m_scrX, m_marginRight, m_marginLeft, marginScaleX);
* #endif // MATHPLOT_DO_LOGGING
* return (wxCoord) (int)(((x-m_posX) * m_scaleX)*marginScaleX) - m_marginLeft; * return (wxCoord) (int)(((x-m_posX) * m_scaleX)*marginScaleX) - m_marginLeft;
* } * }
* *
@ -3293,9 +3107,6 @@ void mpWindow::SetColourTheme( const wxColour& bgColour,
* } * }
* // Draw inside margins * // Draw inside margins
* double marginScaleY = ((double)(m_scrY - m_marginTop - m_marginBottom))/m_scrY; * double marginScaleY = ((double)(m_scrY - m_marginTop - m_marginBottom))/m_scrY;
* #ifdef MATHPLOT_DO_LOGGING
* wxLogMessage(wxT("y2p ScrY = %d, marginTop = %d, marginBottom = %d, marginScaleY = %f"), m_scrY, m_marginTop, m_marginBottom, marginScaleY);
* #endif // MATHPLOT_DO_LOGGING
* return (wxCoord) ((int)((m_posY-y) * m_scaleY)*marginScaleY) - m_marginTop; * return (wxCoord) ((int)((m_posY-y) * m_scaleY)*marginScaleY) - m_marginTop;
* } * }
*/ */
@ -3311,7 +3122,6 @@ IMPLEMENT_DYNAMIC_CLASS( mpFXYVector, mpFXY )
mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags ) mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags )
{ {
m_index = 0; m_index = 0;
// printf("FXYVector::FXYVector!\n");
m_minX = -1; m_minX = -1;
m_maxX = 1; m_maxX = 1;
m_minY = -1; m_minY = -1;
@ -3409,17 +3219,12 @@ void mpFXYVector::SetData( const std::vector<double>& xs, const std::vector<doub
{ {
// Check if the data vectora are of the same size // Check if the data vectora are of the same size
if( xs.size() != ys.size() ) if( xs.size() != ys.size() )
{
wxLogError( "wxMathPlot error: X and Y vector are not of the same length!" );
return; return;
}
// Copy the data: // Copy the data:
m_xs = xs; m_xs = xs;
m_ys = ys; m_ys = ys;
// printf("FXYVector::setData %d %d\n", xs.size(), ys.size());
// Update internal variables for the bounding box. // Update internal variables for the bounding box.
if( xs.size()>0 ) if( xs.size()>0 )
{ {
@ -3447,9 +3252,6 @@ void mpFXYVector::SetData( const std::vector<double>& xs, const std::vector<doub
if( *it>m_maxY ) if( *it>m_maxY )
m_maxY = *it; m_maxY = *it;
} }
// printf("minX %.10f maxX %.10f\n ", m_minX, m_maxX );
// printf("minY %.10f maxY %.10f\n ", m_minY, m_maxY );
} }
else else
{ {
@ -3545,12 +3347,6 @@ bool mpPrintout::OnPrintPage( int page )
m_prnY -= (2 * marginY); m_prnY -= (2 * marginY);
trgDc->SetDeviceOrigin( marginX, marginY ); trgDc->SetDeviceOrigin( marginX, marginY );
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( wxT( "Print Size: %d x %d\n" ), m_prnX, m_prnY );
wxLogMessage( wxT( "Screen Size: %d x %d\n" ), plotWindow->GetScrX(),
plotWindow->GetScrY() );
#endif
// Set the scale according to the page: // Set the scale according to the page:
plotWindow->Fit( plotWindow->Fit(
plotWindow->GetDesiredXmin(), plotWindow->GetDesiredXmin(),
@ -3623,8 +3419,6 @@ void mpMovableObject::ShapeUpdated()
// Just in case... // Just in case...
if( m_shape_xs.size()!=m_shape_ys.size() ) if( m_shape_xs.size()!=m_shape_ys.size() )
{ {
wxLogError( wxT(
"[mpMovableObject::ShapeUpdated] Error, m_shape_xs and m_shape_ys have different lengths!" ) );
} }
else else
{ {
@ -3776,21 +3570,15 @@ void mpCovarianceEllipse::RecalculateShape()
m_shape_xs.clear(); m_shape_xs.clear();
m_shape_ys.clear(); m_shape_ys.clear();
// Preliminar checks: // Preliminary checks:
if( m_quantiles<0 ) if( m_quantiles<0 )
{ return;
wxLogError( wxT( "[mpCovarianceEllipse] Error: quantiles must be non-negative" ) ); return;
}
if( m_cov_00<0 ) if( m_cov_00<0 )
{ return;
wxLogError( wxT( "[mpCovarianceEllipse] Error: cov(0,0) must be non-negative" ) ); return;
}
if( m_cov_11<0 ) if( m_cov_11<0 )
{ return;
wxLogError( wxT( "[mpCovarianceEllipse] Error: cov(1,1) must be non-negative" ) ); return;
}
m_shape_xs.resize( m_segments, 0 ); m_shape_xs.resize( m_segments, 0 );
m_shape_ys.resize( m_segments, 0 ); m_shape_ys.resize( m_segments, 0 );
@ -3803,9 +3591,7 @@ void mpCovarianceEllipse::RecalculateShape()
double D = b * b - 4 * c; double D = b * b - 4 * c;
if( D<0 ) if( D<0 )
{ return;
wxLogError( wxT( "[mpCovarianceEllipse] Error: cov is not positive definite" ) ); return;
}
double eigenVal0 = 0.5 * ( -b + sqrt( D ) ); double eigenVal0 = 0.5 * ( -b + sqrt( D ) );
double eigenVal1 = 0.5 * ( -b - sqrt( D ) ); double eigenVal1 = 0.5 * ( -b - sqrt( D ) );
@ -3887,12 +3673,7 @@ void mpPolygon::setPoints( const std::vector<double>& points_xs,
const std::vector<double>& points_ys, const std::vector<double>& points_ys,
bool closedShape ) bool closedShape )
{ {
if( points_xs.size()!=points_ys.size() ) if( points_xs.size()==points_ys.size() )
{
wxLogError( wxT(
"[mpPolygon] Error: points_xs and points_ys must have the same number of elements" ) );
}
else
{ {
m_shape_xs = points_xs; m_shape_xs = points_xs;
m_shape_ys = points_ys; m_shape_ys = points_ys;
@ -3920,11 +3701,7 @@ void mpBitmapLayer::GetBitmapCopy( wxImage& outBmp ) const
void mpBitmapLayer::SetBitmap( const wxImage& inBmp, double x, double y, double lx, double ly ) void mpBitmapLayer::SetBitmap( const wxImage& inBmp, double x, double y, double lx, double ly )
{ {
if( !inBmp.Ok() ) if( inBmp.Ok() )
{
wxLogError( wxT( "[mpBitmapLayer] Assigned bitmap is not Ok()!" ) );
}
else
{ {
m_bitmap = inBmp; // .GetSubBitmap( wxRect(0, 0, inBmp.GetWidth(), inBmp.GetHeight())); m_bitmap = inBmp; // .GetSubBitmap( wxRect(0, 0, inBmp.GetWidth(), inBmp.GetHeight()));
m_min_x = x; m_min_x = x;
@ -3999,19 +3776,6 @@ void mpBitmapLayer::Plot( wxDC& dc, mpWindow& w )
wxCoord b_width = (wxCoord) ( (dx1 - dx0 + 1) / screenPixelX ); wxCoord b_width = (wxCoord) ( (dx1 - dx0 + 1) / screenPixelX );
wxCoord b_height = (wxCoord) ( (dy1 - dy0 + 1) / screenPixelY ); wxCoord b_height = (wxCoord) ( (dy1 - dy0 + 1) / screenPixelY );
#ifdef MATHPLOT_DO_LOGGING
wxLogMessage( "[mpBitmapLayer::Plot] screenPixel: x=%f y=%f d_width=%ix%i",
screenPixelX,
screenPixelY,
d_width,
d_height );
wxLogMessage( "[mpBitmapLayer::Plot] offset: x=%i y=%i bmpWidth=%ix%i",
offset_x,
offset_y,
b_width,
b_height );
#endif
// Is there any visible region? // Is there any visible region?
if( d_width>0 && d_height>0 ) if( d_width>0 && d_height>0 )
{ {
@ -4101,7 +3865,6 @@ void mpFXY::SetScale( mpScaleBase* scaleX, mpScaleBase* scaleY )
m_scaleX = scaleX; m_scaleX = scaleX;
m_scaleY = scaleY; m_scaleY = scaleY;
// printf("SetScales : %p %p\n", scaleX, scaleY);
UpdateScales(); UpdateScales();
} }

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -1078,8 +1078,6 @@ void CVPCB_MAINFRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
{ {
const std::string& payload = mail.GetPayload(); const std::string& payload = mail.GetPayload();
//DBG(printf( "%s: %s\n", __func__, payload.c_str() );)
switch( mail.Command() ) switch( mail.Command() )
{ {
case MAIL_EESCHEMA_NETLIST: case MAIL_EESCHEMA_NETLIST:

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras * Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -141,8 +141,6 @@ bool CVPCB_MAINFRAME::ReadNetListAndFpFiles( const std::string& aNetlist )
switch( guess ) switch( guess )
{ {
case 0: case 0:
DBG(printf("%s: guessed OK ref:%s fpid:%s\n", __func__,
TO_UTF8( component->GetReference() ), component->GetFPID().Format().c_str() );)
m_modified = true; m_modified = true;
break; break;

View File

@ -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) 2019 Ian McInerney <Ian.S.McInerney@ieee.org> * Copyright (C) 2019 Ian McInerney <Ian.S.McInerney@ieee.org>
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the * under the terms of the GNU General Public License as published by the
@ -86,14 +86,10 @@ int CVPCB_ASSOCIATION_TOOL::CopyAssoc( const TOOL_EVENT& aEvent )
if( wxTheClipboard->Open() ) if( wxTheClipboard->Open() )
{ {
if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) );
wxLogDebug( "Failed to copy data to clipboard" );
wxTheClipboard->Flush(); wxTheClipboard->Flush();
wxTheClipboard->Close(); wxTheClipboard->Close();
} }
else
wxLogDebug( "Failed to open the clipboard" );
return 0; return 0;
} }
@ -126,7 +122,6 @@ int CVPCB_ASSOCIATION_TOOL::CutAssoc( const TOOL_EVENT& aEvent )
{ {
if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) )
{ {
wxLogDebug( "Failed to cut data to clipboard" );
wxTheClipboard->Close(); wxTheClipboard->Close();
return 0; return 0;
} }
@ -136,7 +131,6 @@ int CVPCB_ASSOCIATION_TOOL::CutAssoc( const TOOL_EVENT& aEvent )
} }
else else
{ {
wxLogDebug( "Failed to open the clipboard" );
return 0; return 0;
} }
@ -166,7 +160,6 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent )
} }
else else
{ {
wxLogDebug( "Failed to open the clipboard" );
return 0; return 0;
} }
@ -184,6 +177,7 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent )
return 0; return 0;
} }
void CVPCB_ASSOCIATION_TOOL::Reset( RESET_REASON aReason ) void CVPCB_ASSOCIATION_TOOL::Reset( RESET_REASON aReason )
{ {
m_frame = getEditFrame<CVPCB_MAINFRAME>(); m_frame = getEditFrame<CVPCB_MAINFRAME>();

View File

@ -596,11 +596,4 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress )
// of the HTML_MESSAGE_BOX. // of the HTML_MESSAGE_BOX.
THROW_PARSE_ERROR( wxEmptyString, __func__, TO_UTF8( libs_not_found ), 0, 0 ); THROW_PARSE_ERROR( wxEmptyString, __func__, TO_UTF8( libs_not_found ), 0, 0 );
} }
#if defined(DEBUG) && 1
printf( "%s: lib_names:\n", __func__ );
for( PART_LIBS::const_iterator it = begin(); it < end(); ++it )
printf( " %s\n", TO_UTF8( it->GetName() ) );
#endif
} }

View File

@ -489,9 +489,8 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail )
SCH_EDITOR_CONTROL* controlTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>(); SCH_EDITOR_CONTROL* controlTool = m_toolManager->GetTool<SCH_EDITOR_CONTROL>();
controlTool->BackAnnotateFootprints( payload ); controlTool->BackAnnotateFootprints( payload );
} }
catch( const IO_ERROR& DBG( ioe ) ) catch( const IO_ERROR& )
{ {
DBG( printf( "%s: ioe:%s\n", __func__, TO_UTF8( ioe.What() ) );)
} }
break; break;

View File

@ -348,7 +348,6 @@ void DIALOG_BOM::installGeneratorsList()
for( const auto& path : pluginPaths ) for( const auto& path : pluginPaths )
{ {
wxLogDebug( wxString::Format( "Searching directory %s for BOM generators", path ) );
wxDir dir( path ); wxDir dir( path );
if( !dir.IsOpened() ) if( !dir.IsOpened() )
@ -362,7 +361,7 @@ void DIALOG_BOM::installGeneratorsList()
{ {
try try
{ {
wxLogTrace( BOM_TRACE, wxString::Format( "Checking if %s is a BOM generator", fileName ) ); wxLogTrace( BOM_TRACE,"Checking if %s is a BOM generator", fileName );
if( BOM_GENERATOR_HANDLER::IsValidGenerator( fileName ) ) if( BOM_GENERATOR_HANDLER::IsValidGenerator( fileName ) )
{ {

View File

@ -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) 2015-2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2020 KiCad Developers, see CHANGELOG.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
@ -397,22 +397,6 @@ bool SCH_PRINTOUT::OnBeginDocument( int startPage, int endPage )
if( !wxPrintout::OnBeginDocument( startPage, endPage ) ) if( !wxPrintout::OnBeginDocument( startPage, endPage ) )
return false; return false;
#ifdef DEBUG
EESCHEMA_SETTINGS* cfg = m_parent->eeconfig();
wxLogDebug( wxT( "Printer name: " ) +
m_parent->GetPageSetupData().GetPrintData().GetPrinterName() );
wxLogDebug( wxT( "Paper ID: %d" ),
m_parent->GetPageSetupData().GetPrintData().GetPaperId() );
wxLogDebug( wxT( "Color: %d" ),
(int)m_parent->GetPageSetupData().GetPrintData().GetColour() );
wxLogDebug( wxT( "Monochrome: %d" ), cfg->m_Printing.monochrome );
wxLogDebug( wxT( "Orientation: %d:" ),
m_parent->GetPageSetupData().GetPrintData().GetOrientation() );
wxLogDebug( wxT( "Quality: %d"),
m_parent->GetPageSetupData().GetPrintData().GetQuality() );
#endif
return true; return true;
} }
@ -446,9 +430,6 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen )
fitRect = GetLogicalPaperRect(); fitRect = GetLogicalPaperRect();
wxLogDebug( wxT( "Fit rectangle: x = %d, y = %d, w = %d, h = %d" ),
fitRect.x, fitRect.y, fitRect.width, fitRect.height );
// When is the actual paper size does not match the schematic page size, the drawing will // When is the actual paper size does not match the schematic page size, the drawing will
// not be centered on X or Y axis. Give a draw offset to center the schematic page on the // not be centered on X or Y axis. Give a draw offset to center the schematic page on the
// paper draw area. // paper draw area.

View File

@ -74,10 +74,9 @@ void PARAM_CFG_FIELDNAMES::ReadParam( wxConfigBase* aConfig ) const
{ {
m_Pt_param->Parse( &lexer, false ); m_Pt_param->Parse( &lexer, false );
} }
catch( const IO_ERROR& DBG( e ) ) catch( const IO_ERROR& )
{ {
// @todo show error msg // @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
} }
} }
} }
@ -391,10 +390,8 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg )
{ {
m_templateFieldNames.Parse( &lexer, true ); m_templateFieldNames.Parse( &lexer, true );
} }
catch( const IO_ERROR& DBG( e ) ) catch( const IO_ERROR& )
{ {
// @todo show error msg
DBG( printf( "templatefieldnames parsing error: '%s'\n", TO_UTF8( e.What() ) ); )
} }
} }
} }

View File

@ -344,13 +344,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const
wxPoint normEnd = m_ArcEnd - m_Pos; wxPoint normEnd = m_ArcEnd - m_Pos;
if( ( normStart == nullPoint ) || ( normEnd == nullPoint ) || ( m_Radius == 0 ) ) if( ( normStart == nullPoint ) || ( normEnd == nullPoint ) || ( m_Radius == 0 ) )
{
wxLogDebug( wxT("Invalid arc drawing definition, center(%d, %d), start(%d, %d), "
"end(%d, %d), radius %d" ),
m_Pos.x, m_Pos.y, m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
m_ArcEnd.y, m_Radius );
return rect; return rect;
}
endPos = DefaultTransform.TransformCoordinate( m_ArcEnd ); endPos = DefaultTransform.TransformCoordinate( m_ArcEnd );
startPos = DefaultTransform.TransformCoordinate( m_ArcStart ); startPos = DefaultTransform.TransformCoordinate( m_ArcStart );

View File

@ -1309,7 +1309,6 @@ void LIB_PIN::CalcEdit( const wxPoint& aPosition )
{ {
if( IsMoving() ) if( IsMoving() )
{ {
DBG(printf("MOVEPIN\n");)
MoveTo( aPosition ); MoveTo( aPosition );
} }
} }

View File

@ -114,9 +114,8 @@ SEARCH_STACK* PROJECT::SchSearchS()
{ {
PART_LIBS::LibNamesAndPaths( this, false, &libDir ); PART_LIBS::LibNamesAndPaths( this, false, &libDir );
} }
catch( const IO_ERROR& DBG( ioe ) ) catch( const IO_ERROR& )
{ {
DBG(printf( "%s: %s\n", __func__, TO_UTF8( ioe.What() ) );)
} }
if( !!libDir ) if( !!libDir )

View File

@ -301,9 +301,6 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin )
return; return;
} }
} }
wxLogDebug( wxT( "Fix me: attempt to remove label %s which is not in sheet %s." ),
aSheetPin->GetShownText(), m_fields[ SHEETNAME ].GetText() );
} }
@ -1017,8 +1014,6 @@ void SCH_SHEET::Plot( PLOTTER* aPlotter )
SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem ) SCH_SHEET& SCH_SHEET::operator=( const SCH_ITEM& aItem )
{ {
wxLogDebug( wxT( "Sheet assignment operator." ) );
wxCHECK_MSG( Type() == aItem.Type(), *this, wxCHECK_MSG( Type() == aItem.Type(), *this,
wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) + wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) +
GetClass() ); GetClass() );

View File

@ -59,12 +59,6 @@ void SCH_EDITOR_CONTROL::BackAnnotateFootprints( const std::string& aChangedSetO
{ {
Scan( &doc, &lexer ); Scan( &doc, &lexer );
#if defined(DEBUG) && 0
STRING_FORMATTER sf;
Format( &sf, 0, 0, doc );
printf( "%s: '%s'\n", __func__, sf.GetString().c_str() );
#endif
CPTREE& back_anno = doc.get_child( "back_annotation" ); CPTREE& back_anno = doc.get_child( "back_annotation" );
wxString footprint; wxString footprint;

View File

@ -7,7 +7,7 @@
* *
* Copyright (C) 1992-2017 Jean-Pierre Charras <jp.charras at wanadoo.fr> * Copyright (C) 1992-2017 Jean-Pierre Charras <jp.charras at wanadoo.fr>
* Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -31,6 +31,9 @@
#include <am_primitive.h> #include <am_primitive.h>
#include <macros.h> #include <macros.h>
#include <wx/debug.h>
extern int ReadInt( char*& text, bool aSkipSeparator = true ); extern int ReadInt( char*& text, bool aSkipSeparator = true );
extern double ReadDouble( char*& text, bool aSkipSeparator = true ); extern double ReadDouble( char*& text, bool aSkipSeparator = true );
extern double Evaluate( AM_PARAM_EVAL_STACK& aExp ); extern double Evaluate( AM_PARAM_EVAL_STACK& aExp );
@ -116,7 +119,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
} }
else else
{ {
wxLogDebug( wxT( "AM_PARAM::GetValue(): NULL param aDcode\n" ) ); wxFAIL_MSG( "AM_PARAM::GetValue(): NULL param aDcode" );
} }
ops.push_back( AM_PARAM_EVAL( curr_value ) ); ops.push_back( AM_PARAM_EVAL( curr_value ) );
@ -128,8 +131,10 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const
break; break;
default: default:
wxLogDebug( "AM_PARAM::GetValue(): dcode %d prm %d/%d: unexpected type %d", wxFAIL_MSG( wxString::Format( "AM_PARAM::GetValue(): dcode %d prm %d/%d: "
aDcode ? aDcode->m_Num_Dcode : -1, ii, m_paramStack.size(), item.GetType() ); "unexpected type %d",
aDcode ? aDcode->m_Num_Dcode : -1, ii,
m_paramStack.size(), item.GetType() ) );
break; break;
} }
} }

View File

@ -433,7 +433,6 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent,
case AMP_UNKNOWN: case AMP_UNKNOWN:
default: default:
DBG( printf( "AM_PRIMITIVE::DrawBasicShape() err: unknown prim id %d\n",primitive_id) );
break; break;
} }
} }

View File

@ -260,7 +260,6 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector<wxString>& aFileSet, in
if( !wxFileExists( path ) && wxDirExists( path ) ) if( !wxFileExists( path ) && wxDirExists( path ) )
{ {
wxLogDebug( wxT( "MRU path: %s." ), GetChars( path ) );
m_mruPath = path; m_mruPath = path;
return true; return true;
} }
@ -455,7 +454,8 @@ void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState )
break; break;
default: default:
wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aLayerID ); wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d",
aLayerID ) );
} }
if( dcodes_changed ) if( dcodes_changed )
@ -759,7 +759,7 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const
case LAYER_GERBVIEW_BACKGROUND: return true; case LAYER_GERBVIEW_BACKGROUND: return true;
default: default:
wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID ); wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d", aLayerID ) );
} }
return true; return true;
@ -821,7 +821,8 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( int aLayerID )
break; break;
default: default:
wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID ); wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d",
aLayerID ) );
} }
return color; return color;
@ -865,7 +866,8 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor )
break; break;
default: default:
wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aLayerID ); wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d",
aLayerID ) );
} }
} }

View File

@ -8,8 +8,6 @@ class MyClass
public: public:
int MyMethod( const string& arg ) int MyMethod( const string& arg )
{ {
printf( "MyClass(this = %p)::MyMethod() called with string '%s', length %d\n", this,
arg.c_str(), arg.length() );
return arg.length(); return arg.length();
} }
}; };
@ -29,6 +27,5 @@ main()
retval1 = ptr1( "apples" ); retval1 = ptr1( "apples" );
retval2 = ptr2( "cherries" ); retval2 = ptr2( "cherries" );
printf( "Object 1 returned %d, object 2 returned %d\n", retval1, retval2 );
return 0; return 0;
} }

View File

@ -2,6 +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) 2013 CERN * Copyright (C) 2013 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -94,8 +96,6 @@ SHAPE* SHAPE_FILE_IO::Read()
fscanf(m_file,"%d %s", &type, tmp); fscanf(m_file,"%d %s", &type, tmp);
printf("create shape %d\n", type);
switch(type) switch(type)
{ {
case SHAPE::LINE_CHAIN: case SHAPE::LINE_CHAIN:

View File

@ -58,7 +58,6 @@ MD5_HASH& MD5_HASH::operator=( const MD5_HASH& aOther )
void MD5_HASH::Init() void MD5_HASH::Init()
{ {
//printf("%p init\n", this);
m_valid = false; m_valid = false;
md5_init(&m_ctx); md5_init(&m_ctx);
} }
@ -75,7 +74,6 @@ void MD5_HASH::Hash ( int value )
void MD5_HASH::Finalize() void MD5_HASH::Finalize()
{ {
//printf("%p final\n", this);
md5_final(&m_ctx, m_hash); md5_final(&m_ctx, m_hash);
m_valid = true; m_valid = true;

View File

@ -5,7 +5,7 @@
* 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 change_log.txt for contributors. * Copyright (C) 1992-2020 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
@ -566,7 +566,7 @@ int AR_AUTOPLACER::testModuleOnBoard( MODULE* aModule, bool TstOtherSide, const
int diag = //testModuleByPolygon( aModule, side, aOffset ); int diag = //testModuleByPolygon( aModule, side, aOffset );
testRectangle( fpBBox, side ); testRectangle( fpBBox, side );
//printf("test %p diag %d\n", aModule, diag);fflush(0);
if( diag != AR_FREE_CELL ) if( diag != AR_FREE_CELL )
return diag; return diag;
@ -731,8 +731,6 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aModule, const wxPoi
if( !nearest ) if( !nearest )
continue; continue;
//printf("pad %s nearest %s\n", (const char *)aModule->GetReference().c_str(), (const char *)nearest->GetParent()->GetReference().c_str());
start = VECTOR2I( pad->GetPosition() ) - VECTOR2I(aOffset); start = VECTOR2I( pad->GetPosition() ) - VECTOR2I(aOffset);
end = VECTOR2I( nearest->GetPosition() ); end = VECTOR2I( nearest->GetPosition() );
@ -893,8 +891,6 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules,
memopos = m_curPosition; memopos = m_curPosition;
//printf("set grid: %d\n", m_gridSize);
m_matrix.m_GridRouting = m_gridSize; //(int) m_frame->GetScreen()->GetGridSize().x; m_matrix.m_GridRouting = m_gridSize; //(int) m_frame->GetScreen()->GetGridSize().x;
// Ensure Board.m_GridRouting has a reasonable value: // Ensure Board.m_GridRouting has a reasonable value:
@ -984,8 +980,6 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector<MODULE*> aModules,
// Try orientations 90, 180, 270 degrees from initial orientation // Try orientations 90, 180, 270 degrees from initial orientation
rotAllowed = module->GetPlacementCost180(); rotAllowed = module->GetPlacementCost180();
//printf("rotAllowed %d\n", rotAllowed);
if( rotAllowed != 0 ) if( rotAllowed != 0 )
{ {
rotateModule( module, 1800.0, true ); rotateModule( module, 1800.0, true );
@ -1063,7 +1057,6 @@ end_of_tst:
if( bestRotation != module->GetOrientation() ) if( bestRotation != module->GetOrientation() )
{ {
//printf("best rotation %d\n", bestRotation );
rotateModule( module, bestRotation, false ); rotateModule( module, bestRotation, false );
} }

View File

@ -5,7 +5,7 @@
* 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-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 1992-2020 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
@ -310,9 +310,6 @@ void AR_MATRIX::drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYE
int cx, cy, dx, dy; int cx, cy, dx, dy;
//printf("segmQcq %d %d %d %d\n", ux0, uy0, ux1, uy1);
SetCellOperation( op_logic ); SetCellOperation( op_logic );
// Make coordinate ux1 tj > ux0 to simplify calculations // Make coordinate ux1 tj > ux0 to simplify calculations
@ -381,9 +378,6 @@ void AR_MATRIX::drawSegmentQcq( int ux0, int uy0, int ux1, int uy1, int lg, LAYE
RotatePoint( &dx, &dy, angle ); // dx = length, dy = 0 RotatePoint( &dx, &dy, angle ); // dx = length, dy = 0
//printf("col_min %d max %d row_min %d max %d\n", col_min, col_max, row_min, row_max);
for( col = col_min; col <= col_max; col++ ) for( col = col_min; col <= col_max; col++ )
{ {
int64_t cxr; int64_t cxr;
@ -797,8 +791,6 @@ void AR_MATRIX::TraceSegmentPcb(
int ux1 = pt_segm->GetEnd().x - GetBrdCoordOrigin().x; int ux1 = pt_segm->GetEnd().x - GetBrdCoordOrigin().x;
int uy1 = pt_segm->GetEnd().y - GetBrdCoordOrigin().y; int uy1 = pt_segm->GetEnd().y - GetBrdCoordOrigin().y;
//printf("traceSegm %d %d %d %d\n", ux0, uy0, ux1, uy1);
LAYER_NUM layer = UNDEFINED_LAYER; // Draw on all layers LAYER_NUM layer = UNDEFINED_LAYER; // Draw on all layers
switch( pt_segm->GetShape() ) switch( pt_segm->GetShape() )

View File

@ -2,6 +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) 2016-2018 CERN * Copyright (C) 2016-2018 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -198,10 +200,6 @@ bool CN_CONNECTIVITY_ALGO::Add( BOARD_ITEM* aItem )
void CN_CONNECTIVITY_ALGO::searchConnections() void CN_CONNECTIVITY_ALGO::searchConnections()
{ {
#ifdef CONNECTIVITY_DEBUG
printf("Search start\n");
#endif
#ifdef PROFILE #ifdef PROFILE
PROF_COUNTER garbage_collection( "garbage-collection" ); PROF_COUNTER garbage_collection( "garbage-collection" );
#endif #endif
@ -282,11 +280,6 @@ void CN_CONNECTIVITY_ALGO::searchConnections()
#endif #endif
m_itemList.ClearDirtyFlags(); m_itemList.ClearDirtyFlags();
#ifdef CONNECTIVITY_DEBUG
printf("Search end\n");
#endif
} }
@ -395,16 +388,6 @@ const CN_CONNECTIVITY_ALGO::CLUSTERS CN_CONNECTIVITY_ALGO::SearchClusters( CLUST
return a->OriginNet() < b->OriginNet(); return a->OriginNet() < b->OriginNet();
} ); } );
#ifdef CONNECTIVITY_DEBUG
printf("Active clusters: %d\n", clusters.size() );
for( auto cl : clusters )
{
printf( "Net %d\n", cl->OriginNet() );
cl->Dump();
}
#endif
return clusters; return clusters;
} }

View File

@ -150,12 +150,12 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const
void CN_ITEM::Dump() void CN_ITEM::Dump()
{ {
printf(" valid: %d, connected: \n", !!Valid()); wxLogDebug(" valid: %d, connected: \n", !!Valid());
for( auto i : m_connected ) for( auto i : m_connected )
{ {
TRACK* t = static_cast<TRACK*>( i->Parent() ); TRACK* t = static_cast<TRACK*>( i->Parent() );
printf( " - %p %d\n", t, t->Type() ); wxLogDebug( " - %p %d\n", t, t->Type() );
} }
} }
@ -449,7 +449,7 @@ void CN_CLUSTER::Dump()
{ {
wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(), wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() ); item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(), wxLogTrace( "CN", "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(),
item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() ); item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() );
item->Dump(); item->Dump();
} }

View File

@ -537,14 +537,6 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers )
} }
} }
#if 0 && defined(DEBUG)
printf( "m_cu_map:\n" );
for( unsigned i=0; i<arrayDim(m_cu_map); ++i )
{
printf( "\t[%d]:%d\n", i, m_cu_map[i] );
}
#endif
// Set the layer names and cu count if we're loading a board. // Set the layer names and cu count if we're loading a board.
if( m_board ) if( m_board )
{ {
@ -1019,7 +1011,6 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
{ {
if( element->GetName() != "element" ) if( element->GetName() != "element" )
{ {
wxLogDebug( "expected: <element> read <%s>. Skip it", element->GetName() );
// Get next item // Get next item
element = element->GetNext(); element = element->GetNext();
continue; continue;
@ -1115,7 +1106,6 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements )
{ {
if( attribute->GetName() != "attribute" ) if( attribute->GetName() != "attribute" )
{ {
wxLogDebug( "expected: <attribute> read <%s>. Skip it", attribute->GetName() );
attribute = attribute->GetNext(); attribute = attribute->GetNext();
continue; continue;
} }
@ -2431,8 +2421,6 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals )
const wxString& pad = netItem->GetAttribute( "pad" ); const wxString& pad = netItem->GetAttribute( "pad" );
wxString key = makeKey( reference, pad ) ; wxString key = makeKey( reference, pad ) ;
// D(printf( "adding refname:'%s' pad:'%s' netcode:%d netname:'%s'\n", reference.c_str(), pad.c_str(), netCode, netName.c_str() );)
m_pads_to_nets[ key ] = ENET( netCode, netName ); m_pads_to_nets[ key ] = ENET( netCode, netName );
m_xpath->pop(); m_xpath->pop();
@ -2579,9 +2567,6 @@ void EAGLE_PLUGIN::centerBoard()
int desired_x = ( w - bbbox.GetWidth() ) / 2; int desired_x = ( w - bbbox.GetWidth() ) / 2;
int desired_y = ( h - bbbox.GetHeight() ) / 2; int desired_y = ( h - bbbox.GetHeight() ) / 2;
DBG(printf( "bbox.width:%d bbox.height:%d w:%d h:%d desired_x:%d desired_y:%d\n",
bbbox.GetWidth(), bbbox.GetHeight(), w, h, desired_x, desired_y );)
m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) ); m_board->Move( wxPoint( desired_x - bbbox.GetX(), desired_y - bbbox.GetY() ) );
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net> * Copyright (C) 2015 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2017-2020 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
@ -73,7 +73,6 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
wxLogDebug( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id );
break; break;
} }
} }

View File

@ -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-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2007-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -230,7 +230,6 @@ void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
break; break;
default: default:
wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") );
break; break;
} }
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2009-2013 Lorenzo Mercantonio * Copyright (C) 2009-2013 Lorenzo Mercantonio
* Copyright (C) 2014-2017 Cirilo Bernardo * Copyright (C) 2014-2017 Cirilo Bernardo
* Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras jp.charras at wanadoo.fr
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2020 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
@ -1492,10 +1492,6 @@ static void export_vrml_module( MODEL_VRML& aModel, BOARD* aPcb,
if( srcModTime != destModTime ) if( srcModTime != destModTime )
{ {
wxLogDebug( "Copying 3D model %s to %s.",
GetChars( srcFile.GetFullPath() ),
GetChars( dstFile.GetFullPath() ) );
wxString fileExt = srcFile.GetExt(); wxString fileExt = srcFile.GetExt();
fileExt.LowerCase(); fileExt.LowerCase();
@ -1738,29 +1734,11 @@ static void create_vrml_plane( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) ) if( !( *layer ).Get2DTriangles( vertices, idxPlane, top_z, aTopPlane ) )
{ {
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] no vertex data";
wxLogDebug( "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return; return;
} }
if( ( idxPlane.size() % 3 ) ) if( ( idxPlane.size() % 3 ) )
{ {
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] index lists are not a multiple of 3 (not a triangle list)";
wxLogDebug( "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a triangle list)" ) ); throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a triangle list)" ) );
} }
@ -1825,30 +1803,13 @@ static void create_vrml_shell( IFSG_TRANSFORM& PcbOutput, VRML_COLOR_INDEX color
if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z ) if( !( *layer ).Get3DTriangles( vertices, idxPlane, idxSide, top_z, bottom_z )
|| idxPlane.empty() || idxSide.empty() ) || idxPlane.empty() || idxSide.empty() )
{ {
#ifdef DEBUG
do {
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [INFO] no vertex data";
wxLogDebug( "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
return; return;
} }
if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) ) if( ( idxPlane.size() % 3 ) || ( idxSide.size() % 3 ) )
{ {
#ifdef DEBUG throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a "
do { "triangle list)" ) );
std::ostringstream ostr;
ostr << __FILE__ << ": " << __FUNCTION__ << ": " << __LINE__ << "\n";
ostr << " * [BUG] index lists are not a multiple of 3 (not a triangle list)";
wxLogDebug( "%s\n", ostr.str().c_str() );
} while( 0 );
#endif
throw( std::runtime_error( "[BUG] index lists are not a multiple of 3 (not a triangle list)" ) );
} }
std::vector< SGPOINT > vlist; std::vector< SGPOINT > vlist;

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com> * Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 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
@ -359,7 +359,6 @@ bool PCB_EDIT_FRAME::Files_io_from_id( int id )
} }
default: default:
wxLogDebug( wxT( "File_io Internal Error" ) );
return false; return false;
} }
} }

View File

@ -1,7 +1,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) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -312,7 +312,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) ); wxFAIL_MSG( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" );
break; break;
} }
} }
@ -345,8 +345,8 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule )
BASIC_FOOTPRINT_INFO footprintInfo( aModule ); BASIC_FOOTPRINT_INFO footprintInfo( aModule );
wxDataViewItem treeItem = m_adapter->FindItem( oldFPID ); wxDataViewItem treeItem = m_adapter->FindItem( oldFPID );
if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported from file if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported
// therefore not yet in tree. // from file therefore not yet in tree.
{ {
static_cast<LIB_TREE_NODE_LIB_ID*>( treeItem.GetID() )->Update( &footprintInfo ); static_cast<LIB_TREE_NODE_LIB_ID*>( treeItem.GetID() )->Update( &footprintInfo );
m_treePane->GetLibTree()->RefreshLibTree(); m_treePane->GetLibTree()->RefreshLibTree();

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es * Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es
* Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2004-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2004-2020 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
@ -64,8 +64,9 @@ void FOOTPRINT_WIZARD_FRAME::Process_Special_Functions( wxCommandEvent& event )
break; break;
default: default:
wxLogDebug( wxT( "FOOTPRINT_WIZARD_FRAME::Process_Special_Functions error: id = %d" ), wxFAIL_MSG( wxString::Format(
event.GetId() ); "FOOTPRINT_WIZARD_FRAME::Process_Special_Functions error: id = %d",
event.GetId() ) );
break; break;
} }
} }
@ -113,10 +114,6 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint()
GetBoard()->Add( module, ADD_MODE::APPEND ); GetBoard()->Add( module, ADD_MODE::APPEND );
module->SetPosition( wxPoint( 0, 0 ) ); module->SetPosition( wxPoint( 0, 0 ) );
} }
else
{
DBG(printf( "footprintWizard->GetFootprint() returns NULL\n" );)
}
updateView(); updateView();
GetCanvas()->Refresh(); GetCanvas()->Refresh();

View File

@ -3,7 +3,7 @@
* *
* 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 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2015-2020 KiCad Developers, see CHANGELOG.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
@ -214,8 +214,6 @@ bool GITHUB_GETLIBLIST::remoteGetJSON( const std::string& aFullURLCommand, wxStr
{ {
KICAD_CURL_EASY kcurl; KICAD_CURL_EASY kcurl;
wxLogDebug( wxT( "Attempting to download: " ) + aFullURLCommand );
kcurl.SetURL( aFullURLCommand ); kcurl.SetURL( aFullURLCommand );
kcurl.SetUserAgent( "http://kicad-pcb.org" ); kcurl.SetUserAgent( "http://kicad-pcb.org" );
kcurl.SetHeader( "Accept", m_option_string ); kcurl.SetHeader( "Accept", m_option_string );

View File

@ -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 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 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
@ -142,7 +142,6 @@ void GITHUB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx
{ {
try try
{ {
//D(printf("%s: this:%p aLibPath:\"%s\"\n", __func__, this, TO_UTF8(aLibraryPath) );)
cacheLib( aLibPath, aProperties ); cacheLib( aLibPath, aProperties );
typedef std::set<wxString> MYSET; typedef std::set<wxString> MYSET;
@ -188,8 +187,6 @@ void GITHUB_PLUGIN::PrefetchLib(
MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath,
const wxString& aFootprintName, const PROPERTIES* aProperties ) const wxString& aFootprintName, const PROPERTIES* aProperties )
{ {
// D(printf("%s: this:%p aLibraryPath:\"%s\"\n", __func__, this, TO_UTF8(aLibraryPath) );)
// clear or set to valid the variable m_pretty_dir // clear or set to valid the variable m_pretty_dir
cacheLib( aLibraryPath, aProperties ); cacheLib( aLibraryPath, aProperties );
@ -420,7 +417,6 @@ void GITHUB_PLUGIN::cacheLib( const wxString& aLibraryPath, const PROPERTIES* aP
// operator==( wxString, wxChar* ) does not exist, construct wxString once here. // operator==( wxString, wxChar* ) does not exist, construct wxString once here.
const wxString kicad_mod( "kicad_mod" ); const wxString kicad_mod( "kicad_mod" );
//D(printf("%s: this:%p m_lib_path:'%s' aLibraryPath:'%s'\n", __func__, this, TO_UTF8( m_lib_path), TO_UTF8(aLibraryPath) );)
m_gh_cache = new GH_CACHE(); m_gh_cache = new GH_CACHE();
// INIT_LOGGER( "/tmp", "test.log" ); // INIT_LOGGER( "/tmp", "test.log" );
@ -482,7 +478,6 @@ long long GITHUB_PLUGIN::GetLibraryTimestamp( const wxString& aLibraryPath ) con
bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL ) bool GITHUB_PLUGIN::repoURL_zipURL( const wxString& aRepoURL, std::string* aZipURL )
{ {
// e.g. "https://github.com/liftoff-sr/pretty_footprints" // e.g. "https://github.com/liftoff-sr/pretty_footprints"
//D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );)
wxURI repo( aRepoURL ); wxURI repo( aRepoURL );
@ -565,8 +560,6 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL )
THROW_IO_ERROR( msg ); THROW_IO_ERROR( msg );
} }
wxLogDebug( wxT( "Attempting to download: " ) + zip_url );
KICAD_CURL_EASY kcurl; // this can THROW_IO_ERROR KICAD_CURL_EASY kcurl; // this can THROW_IO_ERROR
kcurl.SetURL( zip_url.c_str() ); kcurl.SetURL( zip_url.c_str() );

View File

@ -3,7 +3,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) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2010 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2010-2020 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
@ -576,7 +576,6 @@ wxSize LAYER_WIDGET::GetBestSize() const
for( int i = 0; i < LYR_COLUMN_COUNT; ++i ) for( int i = 0; i < LYR_COLUMN_COUNT; ++i )
{ {
totWidth += widths[i] + m_LayersFlexGridSizer->GetHGap(); totWidth += widths[i] + m_LayersFlexGridSizer->GetHGap();
// printf("widths[%d]:%d\n", i, widths[i] );
} }
} }
@ -603,7 +602,6 @@ wxSize LAYER_WIDGET::GetBestSize() const
for( int i = 0; i < RND_COLUMN_COUNT; ++i ) for( int i = 0; i < RND_COLUMN_COUNT; ++i )
{ {
totWidth += widths[i] + m_RenderFlexGridSizer->GetHGap(); totWidth += widths[i] + m_RenderFlexGridSizer->GetHGap();
// printf("widths[%d]:%d\n", i, widths[i] );
} }
} }
// account for the parent's frame, this one has void space of 10 PLUS a border: // account for the parent's frame, this one has void space of 10 PLUS a border:
@ -868,36 +866,29 @@ class MYFRAME : public wxFrame
void OnLayerColorChange( int aLayer, COLOR4D aColor ) void OnLayerColorChange( int aLayer, COLOR4D aColor )
{ {
printf( "OnLayerColorChange( aLayer:%d, aColor:%d )\n", aLayer, aColor );
/* a test trigger only /* a test trigger only
if( aLayer == 2 ) if( aLayer == 2 )
{ {
ClearLayerRows(); ClearLayerRows();
printf(" GetLayerRowCount(): %d\n", GetLayerRowCount() );
} }
*/ */
} }
bool OnLayerSelect( LAYER_NUM aLayer ) bool OnLayerSelect( LAYER_NUM aLayer )
{ {
printf( "OnLayerSelect( aLayer:%d )\n", aLayer );
return true; return true;
} }
void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal ) void OnLayerVisible( LAYER_NUM aLayer, bool isVisible, bool isFinal )
{ {
printf( "OnLayerVisible( aLayer:%d, isVisible:%d isFinal:%d)\n", aLayer, isVisible, isFinal );
} }
void OnRenderColorChange( int aId, COLOR4D aColor ) void OnRenderColorChange( int aId, COLOR4D aColor )
{ {
printf( "OnRenderColorChange( aId:%d, aColor:%d )\n", aId, aColor );
} }
void OnRenderEnable( int aId, bool isEnabled ) void OnRenderEnable( int aId, bool isEnabled )
{ {
printf( "OnRenderEnable( aId:%d, isEnabled:%d )\n", aId, isEnabled );
} }
}; };

View File

@ -222,7 +222,6 @@ static inline char* ReadLine( LINE_READER* rdr, const char* caller )
char* ret = rdr->ReadLine(); char* ret = rdr->ReadLine();
const char* line = rdr->Line(); const char* line = rdr->Line();
printf( "%-6u %s: %s", rdr->LineNumber(), caller, line );
#if 0 // trap #if 0 // trap
if( !strcmp( "loadSETUP", caller ) && !strcmp( "$EndSETUP\n", line ) ) if( !strcmp( "loadSETUP", caller ) && !strcmp( "$EndSETUP\n", line ) )
@ -611,7 +610,6 @@ void LEGACY_PLUGIN::loadGENERAL()
LEG_MASK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) ); LEG_MASK enabledLayers = hexParse( line + SZ( "EnabledLayers" ) );
LSET new_mask = leg_mask2new( m_cu_count, enabledLayers ); LSET new_mask = leg_mask2new( m_cu_count, enabledLayers );
//DBG( printf( "EnabledLayers: %s\n", new_mask.FmtHex().c_str() );)
m_board->SetEnabledLayers( new_mask ); m_board->SetEnabledLayers( new_mask );
// layer visibility equals layer usage, unless overridden later via "VisibleLayers" // layer visibility equals layer usage, unless overridden later via "VisibleLayers"

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -271,11 +271,8 @@ MODULE* PCB_BASE_FRAME::SelectFootprintFromLibTree( LIB_ID aPreselect )
{ {
module = loadFootprint( fpid ); module = loadFootprint( fpid );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& )
{ {
wxLogDebug( wxT( "Error loading footprint '%s'.\n\nError: %s" ),
fpid.Format().c_str(),
ioe.What() );
} }
if( module ) if( module )
@ -296,10 +293,8 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& aFootprintId )
{ {
module = loadFootprint( aFootprintId ); module = loadFootprint( aFootprintId );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
aFootprintId.Format().c_str(), GetChars( ioe.What() ) );
} }
return module; return module;
@ -317,10 +312,8 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const LIB_ID& aFootprintId )
{ {
module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId ); module = fptbl->FootprintLoadWithOptionalNickname( aFootprintId );
} }
catch( const IO_ERROR& ioe ) catch( const IO_ERROR& )
{ {
wxLogDebug( wxT( "An error occurred attemping to load footprint '%s'.\n\nError: %s" ),
aFootprintId.Format().c_str(), GetChars( ioe.What() ) );
} }
// If the module is found, clear all net info, // If the module is found, clear all net info,

View File

@ -1,7 +1,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) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -172,7 +172,7 @@ void NETINFO_LIST::Show() const
NETNAMES_MAP::const_iterator it, itEnd; NETNAMES_MAP::const_iterator it, itEnd;
for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it ) for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it )
{ {
printf( "[%d]: netcode:%d netname:<%s>\n", wxLogDebug( "[%d]: netcode:%d netname:<%s>\n",
i++, i++,
it->second->GetNet(), it->second->GetNet(),
TO_UTF8( it->second->GetNetname() ) ); TO_UTF8( it->second->GetNetname() ) );

View File

@ -168,8 +168,8 @@ void KICAD_NETLIST_PARSER::Parse()
if( plevel != 0 ) if( plevel != 0 )
{ {
wxLogDebug( wxT( "KICAD_NETLIST_PARSER::Parse(): bad parenthesis count (count = %d"), wxFAIL_MSG( wxString::Format( "KICAD_NETLIST_PARSER::Parse(): bad parenthesis "
plevel ); "count (count = %d", plevel ) );
} }
} }

View File

@ -252,14 +252,11 @@ LIBEVAL::VALUE PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx )
if( !m_isEnum ) if( !m_isEnum )
{ {
//printf("item %p Get string '%s'\n", item, (const char*) it->second->Name().c_str() );
str = item->Get<wxString>( it->second );
} }
else else
{ {
const wxAny& any = item->Get( it->second ); const wxAny& any = item->Get( it->second );
any.GetAs<wxString>( &str ); any.GetAs<wxString>( &str );
//printf("item %p get enum: '%s'\n", item , (const char*) str.c_str() );
} }
return LIBEVAL::VALUE( str ); return LIBEVAL::VALUE( str );
@ -310,7 +307,6 @@ std::unique_ptr<LIBEVAL::VAR_REF> PCB_EXPR_UCODE::CreateVarRef( const wxString&
if( prop ) if( prop )
{ {
//printf("Field '%s' class %s ptr %p haschoices %d typeid %s\n", field.c_str(), (const char *) cls.name.c_str(), prop, !!prop->HasChoices(), typeid(*prop).name() );
vref->AddAllowedClass( cls.type, prop ); vref->AddAllowedClass( cls.type, prop );
if( prop->TypeHash() == TYPE_HASH( int ) ) if( prop->TypeHash() == TYPE_HASH( int ) )

View File

@ -99,21 +99,6 @@ void PCB_PARSER::init()
m_layerMasks[ key ] = LSET( PCB_LAYER_ID( In15_Cu - i ) ); m_layerMasks[ key ] = LSET( PCB_LAYER_ID( In15_Cu - i ) );
} }
#if defined(DEBUG) && 0
printf( "m_layerMasks:\n" );
for( LSET_MAP::const_iterator it = m_layerMasks.begin(); it != m_layerMasks.end(); ++it )
{
printf( " [%s] == 0x%s\n", it->first.c_str(), it->second.FmtHex().c_str() );
}
printf( "m_layerIndices:\n" );
for( LAYER_ID_MAP::const_iterator it = m_layerIndices.begin(); it != m_layerIndices.end(); ++it )
{
printf( " [%s] == %d\n", it->first.c_str(), it->second );
}
#endif
} }
@ -863,8 +848,6 @@ void PCB_PARSER::parseGeneralSection()
break; break;
default: // Skip everything but the board thickness. default: // Skip everything but the board thickness.
//wxLogDebug( wxT( "Skipping general section token %s " ), GetChars( GetTokenString( token ) ) );
while( ( token = NextTok() ) != T_RIGHT ) while( ( token = NextTok() ) != T_RIGHT )
{ {
if( !IsSymbol( token ) && token != T_NUMBER ) if( !IsSymbol( token ) && token != T_NUMBER )
@ -1467,15 +1450,6 @@ T PCB_PARSER::lookUpLayer( const M& aMap )
if( it == aMap.end() ) if( it == aMap.end() )
{ {
#if 0 && defined(DEBUG)
// dump the whole darn table, there's something wrong with it.
for( it = aMap.begin(); it != aMap.end(); ++it )
{
wxLogDebug( &aMap == (void*)&m_layerIndices ? wxT( "lm[%s] = %d" ) :
wxT( "lm[%s] = %08X" ), it->first.c_str(), it->second );
}
#endif
m_undefinedLayers.insert( curText ); m_undefinedLayers.insert( curText );
return Rescue; return Rescue;
} }

View File

@ -4,7 +4,7 @@
* Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.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@gmail.com> * Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
* Copyright (C) 1992-2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -83,8 +83,6 @@ void PCB_EDIT_FRAME::InstallPreferences( PAGED_DIALOG* aParent,
bool PCB_EDIT_FRAME::LoadProjectSettings() bool PCB_EDIT_FRAME::LoadProjectSettings()
{ {
wxLogDebug( wxT( "Loading project '%s' settings." ), GetChars( Prj().GetProjectFullName() ) );
PROJECT_FILE& project = Prj().GetProjectFile(); PROJECT_FILE& project = Prj().GetProjectFile();
PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings(); PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings();

View File

@ -69,9 +69,6 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
auto l0 = m_world->AssembleLine( li, &segIndex ); auto l0 = m_world->AssembleLine( li, &segIndex );
// printf( "solid %p jt %p fanout %d segs %d\n", solid, jt, jt->LinkCount(),
/// l0.SegmentCount() );
DRAGGED_CONNECTION cn; DRAGGED_CONNECTION cn;
cn.origLine = l0; cn.origLine = l0;
@ -81,8 +78,6 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives )
} }
} }
// printf( "Total: %d conns to drag\n", m_conns.size() );
return true; return true;
} }

View File

@ -173,12 +173,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
line.Intersect( aObstacle, ips ); line.Intersect( aObstacle, ips );
/* for( auto p : ips )
{
printf("gif %d %d our %d their %d\n", p.p.x, p.p.y, p.our.Index(), p.their.Index() );
}*/
for( int i = 0; i < line.SegmentCount(); i++ ) for( int i = 0; i < line.SegmentCount(); i++ )
{ {
const SEG& a = line.CSegment(i); const SEG& a = line.CSegment(i);
@ -190,7 +184,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
const SEG& so = aObstacle.CSegment(j); const SEG& so = aObstacle.CSegment(j);
if( so.Contains( a ) ) if( so.Contains( a ) )
{ {
// printf("discard seg %d\n", i );
over = true; over = true;
break; break;
} }
@ -203,9 +196,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
bool a_in = aObstacle.PointInside( a.A );// && !aObstacle.PointOnEdge( a.A ); bool a_in = aObstacle.PointInside( a.A );// && !aObstacle.PointOnEdge( a.A );
bool b_in = aObstacle.PointInside( a.B );// && !aObstacle.PointOnEdge( a.B ); bool b_in = aObstacle.PointInside( a.B );// && !aObstacle.PointOnEdge( a.B );
// printf("i %d a %d %d %d %d [%d %d] a_in %d b_in %d\n", i, a.A.x, a.A.y, a.B.x, a.B.y, a.A.x- a.B.x, a.A.y - a.B.y, !!a_in, !!b_in );
if( a_in ^ b_in ) // segment crosses hull boundary if( a_in ^ b_in ) // segment crosses hull boundary
{ {
for( int j = 0; j < aObstacle.SegmentCount(); j++ ) for( int j = 0; j < aObstacle.SegmentCount(); j++ )
@ -222,9 +212,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
else else
p = aObstacle.CSegment(j).Intersect( a ); p = aObstacle.CSegment(j).Intersect( a );
//printf("- cont_a %d cont_b %d p %d\n", !!cont_a, !!cont_b, p ? 1 : 0 );
if( p ) if( p )
{ {
SHAPE_LINE_CHAIN::INTERSECTION ip; SHAPE_LINE_CHAIN::INTERSECTION ip;
@ -232,7 +219,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
ip.their = aObstacle.CSegment(j); ip.their = aObstacle.CSegment(j);
ip.p = *p; ip.p = *p;
ips.push_back(ip); ips.push_back(ip);
//printf("chb %d %d\n", p->x, p->y);
} }
} }
} }
@ -261,6 +247,7 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
const SEG& os = aObstacle.CSegment(j); const SEG& os = aObstacle.CSegment(j);
auto p = os.Intersect(a); auto p = os.Intersect(a);
if( p ) if( p )
{ {
SHAPE_LINE_CHAIN::INTERSECTION ip; SHAPE_LINE_CHAIN::INTERSECTION ip;
@ -268,7 +255,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre,
ip.their = aObstacle.CSegment(j); ip.their = aObstacle.CSegment(j);
ip.p = *p; ip.p = *p;
ips.push_back(ip); ips.push_back(ip);
// printf("gif %d %d\n", p->x, p->y);
} }
} }

View File

@ -1019,7 +1019,6 @@ bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VEC
{ {
auto c = new PRESERVE_VERTEX_CONSTRAINT( aWorld, aV ); auto c = new PRESERVE_VERTEX_CONSTRAINT( aWorld, aV );
opt.AddConstraint( c ); opt.AddConstraint( c );
//printf("pres-v %d %d\n", aV.x, aV.y );
} }
if ( aEffortLevel & KEEP_TOPOLOGY ) if ( aEffortLevel & KEEP_TOPOLOGY )
@ -1372,15 +1371,12 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur,
int step = initial; int step = initial;
int current = step; int current = step;
//printf("step %d\n", step);
SHAPE_LINE_CHAIN snew; SHAPE_LINE_CHAIN snew;
while (step > 1) while (step > 1)
{ {
LINE l ( cur ); LINE l ( cur );
//printf("current %d l %d\n", current, guide.Length() );
snew.Clear(); snew.Clear();
snew.Append( a.A ); snew.Append( a.A );
snew.Append( a.B + (a.A - a.B).Resize( current ) ); snew.Append( a.B + (a.A - a.B).Resize( current ) );

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2014 CERN * Copyright (C) 2013-2014 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it

View File

@ -2,7 +2,7 @@
* KiRouter - a push-and-(sometimes-)shove PCB router * KiRouter - a push-and-(sometimes-)shove PCB router
* *
* Copyright (C) 2013-2014 CERN * Copyright (C) 2013-2014 CERN
* Copyright (C) 2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2016-2020 KiCad Developers, see AUTHORS.txt for contributors.
* Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * Author: Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software: you can redistribute it and/or modify it * This program is free software: you can redistribute it and/or modify it
@ -225,23 +225,15 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath )
if( s_ccw != STUCK ) if( s_ccw != STUCK )
s_ccw = singleStep( path_ccw, false ); s_ccw = singleStep( path_ccw, false );
//Dbg()->AddLine( path_cw.CLine(), 2, 10000 );
//printf("iter %d s_cw %d s_ccw %d\n", m_iteration, s_cw, s_ccw );
auto old = path_cw.CLine(); auto old = path_cw.CLine();
if( clipToLoopStart( path_cw.Line() )) if( clipToLoopStart( path_cw.Line() ))
{ {
//printf("ClipCW\n");
//Dbg()->AddLine( old, 1, 40000 );
s_cw = ALMOST_DONE; s_cw = ALMOST_DONE;
} }
if( clipToLoopStart( path_ccw.Line() )) if( clipToLoopStart( path_ccw.Line() ))
{ {
//printf("ClipCCW\n");
s_ccw = ALMOST_DONE; s_ccw = ALMOST_DONE;
} }

View File

@ -3,7 +3,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-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2011 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2007-2015 KiCad Developers, see change_log.txt for contributors. * Copyright (C) 2007-2020 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
@ -3564,8 +3564,6 @@ UNIT_RES UNIT_RES::Default( NULL, T_resolution );
int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs ) int PADSTACK::Compare( PADSTACK* lhs, PADSTACK* rhs )
{ {
// printf( "PADSTACK::Compare( %p, %p)\n", lhs, rhs );
if( !lhs->hash.size() ) if( !lhs->hash.size() )
lhs->hash = lhs->makeHash(); lhs->hash = lhs->makeHash();
@ -3596,8 +3594,6 @@ int IMAGE::Compare( IMAGE* lhs, IMAGE* rhs )
int result = lhs->hash.compare( rhs->hash ); int result = lhs->hash.compare( rhs->hash );
// printf("\"%s\" \"%s\" ret=%d\n", lhs->hash.c_str(), rhs->hash.c_str(), result );
return result; return result;
} }

View File

@ -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-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2015-2017 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2015-2020 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
@ -767,8 +767,6 @@ IMAGE* SPECCTRA_DB::makeIMAGE( BOARD* aBoard, MODULE* aModule )
case S_RECT: case S_RECT:
case S_ARC: case S_ARC:
default: default:
DBG( printf( "makeIMAGE(): unsupported shape %s\n",
TO_UTF8( BOARD_ITEM::ShowShape( graphic->GetShape() ) ) ); )
continue; continue;
} }
} }

View File

@ -636,7 +636,6 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent )
if( editModules && ( !board() || !module() ) ) if( editModules && ( !board() || !module() ) )
{ {
wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") );
return 0; return 0;
} }

View File

@ -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 CERN * Copyright (C) 2015 CERN
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2020 KiCad Developers, see AUTHORS.txt for contributors.
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -68,9 +68,8 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_cancelHandler)(); (*m_cancelHandler)();
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PCBNEW_PICKER_TOOL cancelHandler error: " << e.what() << std::endl;
} }
} }
@ -95,9 +94,8 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
getNext = (*m_clickHandler)( *m_picked ); getNext = (*m_clickHandler)( *m_picked );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PCBNEW_PICKER_TOOL clickHandler error: " << e.what() << std::endl;
finalize_state = EXCEPTION_CANCEL; finalize_state = EXCEPTION_CANCEL;
break; break;
} }
@ -120,9 +118,8 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_motionHandler)( cursorPos ); (*m_motionHandler)( cursorPos );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PCBNEW_PICKER_TOOL motion handler error: " << e.what() << std::endl;
} }
} }
} }
@ -148,9 +145,8 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent )
{ {
(*m_finalizeHandler)( finalize_state ); (*m_finalizeHandler)( finalize_state );
} }
catch( std::exception& e ) catch( std::exception& )
{ {
std::cerr << "PCBNEW_PICKER_TOOL finalizeHandler error: " << e.what() << std::endl;
} }
} }

View File

@ -5,7 +5,7 @@
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com> * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2016 CERN * Copyright (C) 2016 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch> * @author Maciej Suminski <maciej.suminski@cern.ch>
* Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -307,7 +307,8 @@ void PCB_BASE_EDIT_FRAME::SaveCopyInUndoList( const PICKED_ITEMS_LIST& aItemsLis
default: default:
{ {
wxLogDebug( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command ); wxFAIL_MSG( wxString::Format( "SaveCopyInUndoList() error (unknown code %X)",
command ) );
} }
break; break;
@ -569,8 +570,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool
break; break;
default: default:
wxLogDebug( wxT( "PutDataInPreviousState() error (unknown code %X)" ), wxFAIL_MSG( wxString::Format( "PutDataInPreviousState() error (unknown code %X)",
aList->GetPickedItemStatus( ii ) ); aList->GetPickedItemStatus( ii ) ) );
break; break;
} }
} }

View File

@ -1,7 +1,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) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2018-2020 KiCad Developers, see CHANGELOG.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
@ -53,12 +53,8 @@ public:
int CountTo( int n ) int CountTo( int n )
{ {
printf( "%s: Coroutine says hi. I will count from 1 to %d and yield each value.\n",
__FUNCTION__, n );
for( int i = 1; i <= n; i++ ) for( int i = 1; i <= n; i++ )
{ {
printf( "%s: Yielding %d\n", __FUNCTION__, i );
m_cofunc->KiYield( i ); m_cofunc->KiYield( i );
} }
@ -68,16 +64,12 @@ public:
void Run() void Run()
{ {
m_cofunc = std::make_unique<MyCoroutine>( this, &CoroutineExample::CountTo ); m_cofunc = std::make_unique<MyCoroutine>( this, &CoroutineExample::CountTo );
printf( "%s: Calling coroutine that will count from 1 to 5.\n", __FUNCTION__ );
m_cofunc->Call( m_count ); m_cofunc->Call( m_count );
while( m_cofunc->Running() ) while( m_cofunc->Running() )
{ {
printf( "%s: Got value: %d\n", __FUNCTION__, m_cofunc->ReturnValue() );
m_cofunc->Resume(); m_cofunc->Resume();
} }
printf( "%s: Done!\n", __FUNCTION__ );
} }
std::unique_ptr<MyCoroutine> m_cofunc; std::unique_ptr<MyCoroutine> m_cofunc;

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com * Copyright (C) 2007 Dick Hollenbeck, dick@softplc.com
* Copyright (C) 2019 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2019-2020 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
@ -910,7 +910,6 @@ bool DRC::checkClearancePadToPad( D_PAD* aRefPad, D_PAD* aPad, int aMinClearance
break; break;
default: default:
wxLogDebug( wxT( "DRC::checkClearancePadToPad: unexpected pad shape %d" ), aPad->GetShape() );
break; break;
} }
} }

View File

@ -43,11 +43,10 @@ void drcPrintDebugMessage( int level, wxString msg, const char *function, int li
if( wxGetEnv( "DRC_DEBUG", &valueStr ) ) if( wxGetEnv( "DRC_DEBUG", &valueStr ) )
{ {
int setLevel = wxAtoi( valueStr ); int setLevel = wxAtoi( valueStr );
if( level <= setLevel )
fprintf(stderr,"[%-30s:%-5d] %s", function, line, (const char *) msg.c_str() );
} }
} }
test::DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) : test::DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings ) :
m_board( aBoard ), m_board( aBoard ),
m_designSettings ( aSettings ), m_designSettings ( aSettings ),
@ -57,10 +56,12 @@ test::DRC_ENGINE::DRC_ENGINE( BOARD* aBoard, BOARD_DESIGN_SETTINGS *aSettings )
} }
test::DRC_ENGINE::~DRC_ENGINE() test::DRC_ENGINE::~DRC_ENGINE()
{ {
} }
test::DRC_REPORT::~DRC_REPORT() test::DRC_REPORT::~DRC_REPORT()
{ {
for( auto item : m_entries ) for( auto item : m_entries )
@ -70,6 +71,7 @@ test::DRC_REPORT::~DRC_REPORT()
} }
} }
/*void test::DRC_ENGINE::AddMarker( MARKER_PCB* aMarker ) /*void test::DRC_ENGINE::AddMarker( MARKER_PCB* aMarker )
{ {
if( m_designSettings->Ignore( aMarker->GetRCItem()->GetErrorCode() ) ) if( m_designSettings->Ignore( aMarker->GetRCItem()->GetErrorCode() ) )
@ -81,6 +83,7 @@ test::DRC_REPORT::~DRC_REPORT()
m_markers.push_back( aMarker ); m_markers.push_back( aMarker );
}*/ }*/
bool test::DRC_ENGINE::LoadRules( wxFileName aPath ) bool test::DRC_ENGINE::LoadRules( wxFileName aPath )
{ {
@ -301,6 +304,7 @@ void test::DRC_ENGINE::ReportProgress( double aProgress )
m_progressReporter->SetCurrentProgress( aProgress ); m_progressReporter->SetCurrentProgress( aProgress );
} }
void test::DRC_ENGINE::ReportStage ( const wxString& aStageName, int index, int total ) void test::DRC_ENGINE::ReportStage ( const wxString& aStageName, int index, int total )
{ {
if( !m_progressReporter ) if( !m_progressReporter )
@ -309,6 +313,7 @@ void test::DRC_ENGINE::ReportStage ( const wxString& aStageName, int index, int
m_progressReporter->BeginPhase( index ); // fixme: coalesce all stages/test providers m_progressReporter->BeginPhase( index ); // fixme: coalesce all stages/test providers
} }
#if 0 #if 0
test::DRC_CONSTRAINT test::DRC_ENGINE::GetWorstGlobalConstraint( test::DRC_CONSTRAINT_TYPE_T ruleID ) test::DRC_CONSTRAINT test::DRC_ENGINE::GetWorstGlobalConstraint( test::DRC_CONSTRAINT_TYPE_T ruleID )
{ {
@ -329,6 +334,7 @@ test::DRC_CONSTRAINT test::DRC_ENGINE::GetWorstGlobalConstraint( test::DRC_CONST
} }
#endif #endif
std::vector<test::DRC_CONSTRAINT> test::DRC_ENGINE::QueryConstraintsById( test::DRC_CONSTRAINT_TYPE_T constraintID ) std::vector<test::DRC_CONSTRAINT> test::DRC_ENGINE::QueryConstraintsById( test::DRC_CONSTRAINT_TYPE_T constraintID )
{ {
std::vector<test::DRC_CONSTRAINT> rv; std::vector<test::DRC_CONSTRAINT> rv;

View File

@ -53,7 +53,6 @@ int main( int argc, char *argv[] )
} }
catch( PARSE_ERROR& err ) catch( PARSE_ERROR& err )
{ {
printf("Can't load DRC rules: %s\n", (const char*) err.What().c_str() );
return -1; return -1;
} }

View File

@ -66,18 +66,14 @@ BOOST_AUTO_TEST_CASE( Orientation )
{ {
TRANSFORM t = m_symbol.GetTransform(); TRANSFORM t = m_symbol.GetTransform();
wxLogDebug( "Angle 0: x1 = %d, y1 = %d, x2 = %d, y2 = %d", t.x1, t.y1, t.x2, t.y2 );
m_symbol.SetOrientation( CMP_ORIENT_90 ); m_symbol.SetOrientation( CMP_ORIENT_90 );
t = m_symbol.GetTransform(); t = m_symbol.GetTransform();
wxLogDebug( "Angle 90: x1 = %d, y1 = %d, x2 = %d, y2 = %d", t.x1, t.y1, t.x2, t.y2 );
m_symbol.SetTransform( TRANSFORM() ); m_symbol.SetTransform( TRANSFORM() );
m_symbol.SetOrientation( CMP_ORIENT_180 ); m_symbol.SetOrientation( CMP_ORIENT_180 );
t = m_symbol.GetTransform(); t = m_symbol.GetTransform();
wxLogDebug( "Angle 180: x1 = %d, y1 = %d, x2 = %d, y2 = %d", t.x1, t.y1, t.x2, t.y2 );
m_symbol.SetTransform( TRANSFORM() ); m_symbol.SetTransform( TRANSFORM() );
m_symbol.SetOrientation( CMP_ORIENT_270 ); m_symbol.SetOrientation( CMP_ORIENT_270 );
t = m_symbol.GetTransform(); t = m_symbol.GetTransform();
wxLogDebug( "Angle 270: x1 = %d, y1 = %d, x2 = %d, y2 = %d", t.x1, t.y1, t.x2, t.y2 );
} }

View File

@ -27,11 +27,11 @@ bool testEvalExpr( const std::string expr, LIBEVAL::VALUE expectedResult, bool e
{ {
if ( expectError ) if ( expectError )
{ {
printf("result: OK (expected parse error)\n");
ok = true; ok = true;
return ok; return ok;
} else { }
printf("result: FAIL: %s\n", compiler.GetErrorStatus().Format().c_str() ); else
{
ok = false; ok = false;
} }
} }
@ -44,26 +44,6 @@ bool testEvalExpr( const std::string expr, LIBEVAL::VALUE expectedResult, bool e
ok = (result == expectedResult); ok = (result == expectedResult);
} }
if( expectedResult.GetType() == LIBEVAL::VT_NUMERIC )
{
printf( "result: %s (got %.10f expected: %.10f)\n",
ok ? "OK" : "FAIL",
result.AsDouble(),
expectedResult.AsDouble() );
}
else
{
printf( "result: %s (got '%ls' expected: '%ls')\n",
ok ? "OK" : "FAIL",
GetChars( result.AsString() ),
GetChars( expectedResult.AsString() ) );
}
if (!ok )
{
printf("Offending code dump: \n%s\n", ucode.Dump().c_str() );
}
return ok; return ok;
} }
@ -100,26 +80,15 @@ int main( int argc, char *argv[] )
NETCLASSPTR netclass1( new NETCLASS("HV") ); NETCLASSPTR netclass1( new NETCLASS("HV") );
NETCLASSPTR netclass2( new NETCLASS("otherClass" ) ); NETCLASSPTR netclass2( new NETCLASS("otherClass" ) );
printf("netcl1 classname '%s'\n", (const char *) netclass1->GetName().c_str() );
auto net1info = new NETINFO_ITEM( &brd, "net1", 1); auto net1info = new NETINFO_ITEM( &brd, "net1", 1);
auto net2info = new NETINFO_ITEM( &brd, "net2", 2); auto net2info = new NETINFO_ITEM( &brd, "net2", 2);
net1info->SetClass( netclass1 ); net1info->SetClass( netclass1 );
net2info->SetClass( netclass2 ); net2info->SetClass( netclass2 );
printf("netX classname '%s'\n", net1info->GetClassName().c_str() );
printf("net1 class %p %p\n", net1info->GetNetClass(), netclass1.get() );
TRACK trackA(&brd); TRACK trackA(&brd);
TRACK trackB(&brd); TRACK trackB(&brd);
printf("net1 classname '%s'\n", (const char*) net1info->GetClassName().c_str() );
trackA.SetNet( net1info ); trackA.SetNet( net1info );
trackB.SetNet( net2info ); trackB.SetNet( net2info );
@ -128,9 +97,6 @@ int main( int argc, char *argv[] )
trackA.SetWidth( Mils2iu( 10 )); trackA.SetWidth( Mils2iu( 10 ));
trackB.SetWidth( Mils2iu( 20 )); trackB.SetWidth( Mils2iu( 20 ));
printf( "TrkA %p netclass '%s'\n", &trackA, (const char*) trackA.GetNetClassName().c_str() );
printf( "TrkB %p netclass '%s'\n", &trackB, (const char*) trackB.GetNetClassName().c_str() );
// testEvalExpr( "A.onlayer('F.Cu') || A.onlayer('B.Cu')", VAL( 1.0 ), false, &trackA, &trackB ); // testEvalExpr( "A.onlayer('F.Cu') || A.onlayer('B.Cu')", VAL( 1.0 ), false, &trackA, &trackB );
testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB ); testEvalExpr( "A.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB );
return 0; return 0;

View File

@ -1,7 +1,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) 2018 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2018-2020 KiCad Developers, see CHANGELOG.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
@ -87,21 +87,13 @@ static void CheckArcGeom( const SHAPE_ARC& aArc, const ARC_PROPERTIES& aProps )
/// All arcs are solid /// All arcs are solid
BOOST_CHECK_EQUAL( aArc.IsSolid(), true ); BOOST_CHECK_EQUAL( aArc.IsSolid(), true );
/// Test bouding box
#if 0 // Only for debug.
printf("abox %d %d %d %d prp %d %d %d %d\n",
aArc.BBox().GetX(), aArc.BBox().GetY(), aArc.BBox().GetSize().x, aArc.BBox().GetSize().y,
aProps.m_bbox.GetX(),aProps.m_bbox.GetY(),
aProps.m_bbox.GetSize().x, aProps.m_bbox.GetSize().y );
fflush(0);
#endif
BOOST_CHECK_PREDICATE( BOOST_CHECK_PREDICATE(
KI_TEST::IsBoxWithinTol<BOX2I>, ( aArc.BBox() )( aProps.m_bbox )( pos_tol ) ); KI_TEST::IsBoxWithinTol<BOX2I>, ( aArc.BBox() )( aProps.m_bbox )( pos_tol ) );
/// Collisions will be checked elsewhere. /// Collisions will be checked elsewhere.
} }
/** /**
* Check an arcs geometry and other class functions * Check an arcs geometry and other class functions
*/ */
@ -145,6 +137,7 @@ BOOST_AUTO_TEST_CASE( NullCtor )
CheckArc( arc, null_props ); CheckArc( arc, null_props );
} }
/** /**
* Info to set up an arc by centre, start point and angle * Info to set up an arc by centre, start point and angle
* *
@ -157,6 +150,7 @@ struct ARC_CENTRE_PT_ANGLE
double m_center_angle; double m_center_angle;
}; };
struct ARC_CPA_CASE struct ARC_CPA_CASE
{ {
/// The text context name /// The text context name
@ -172,6 +166,7 @@ struct ARC_CPA_CASE
ARC_PROPERTIES m_properties; ARC_PROPERTIES m_properties;
}; };
static const std::vector<ARC_CPA_CASE> arc_cases = { static const std::vector<ARC_CPA_CASE> arc_cases = {
{ {
"C(0,0) 114 + 360 degree", "C(0,0) 114 + 360 degree",
@ -316,6 +311,7 @@ static const std::vector<ARC_CPA_CASE> arc_cases = {
}, },
}; };
BOOST_AUTO_TEST_CASE( BasicCPAGeom ) BOOST_AUTO_TEST_CASE( BasicCPAGeom )
{ {
for( const auto& c : arc_cases ) for( const auto& c : arc_cases )
@ -361,6 +357,7 @@ bool ArePolylineEndPointsNearCircle(
return GEOM_TEST::ArePointsNearCircle( points, aCentre, aRad, aTolEnds ); return GEOM_TEST::ArePointsNearCircle( points, aCentre, aRad, aTolEnds );
} }
/** /**
* Predicate for checking a polyline has all the segment mid points on * Predicate for checking a polyline has all the segment mid points on
* (near) a circle of given centre and radius * (near) a circle of given centre and radius

View File

@ -1,7 +1,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) 2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2019-2020 KiCad Developers, see CHANGELOG.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
@ -92,16 +92,12 @@ static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult,
context.SetItems( itemA, itemB ); context.SetItems( itemA, itemB );
printf( "Expr: '%s'\n", (const char*) expr.c_str() );
bool error = !compiler.Compile( expr, &ucode, &preflightContext ); bool error = !compiler.Compile( expr, &ucode, &preflightContext );
BOOST_CHECK_EQUAL( error, expectError ); BOOST_CHECK_EQUAL( error, expectError );
if( error != expectError ) if( error != expectError )
{ {
printf( "result: FAIL: %s (code pos: %d)\n",
(const char*) compiler.GetError().message.c_str(), compiler.GetError().srcPos );
return false; return false;
} }
@ -120,18 +116,10 @@ static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult,
if( expectedResult.GetType() == LIBEVAL::VT_NUMERIC ) if( expectedResult.GetType() == LIBEVAL::VT_NUMERIC )
{ {
BOOST_CHECK_EQUAL( result.AsDouble(), expectedResult.AsDouble() ); BOOST_CHECK_EQUAL( result.AsDouble(), expectedResult.AsDouble() );
/*printf( "result: %s (got %.10f expected: %.10f)\n",
ok ? "OK" : "FAIL",
result.AsDouble(),
expectedResult.AsDouble() );*/
} }
else else
{ {
BOOST_CHECK_EQUAL( result.AsString(), expectedResult.AsString() ); BOOST_CHECK_EQUAL( result.AsString(), expectedResult.AsString() );
/*printf( "result: %s (got '%ls' expected: '%ls')\n",
ok ? "OK" : "FAIL",
GetChars( result.AsString() ),
GetChars( expectedResult.AsString() ) );*/
} }

View File

@ -72,10 +72,8 @@ bool parse( std::istream& aStream, bool aVerbose )
duration = timer.SinceStart<PARSE_DURATION>(); duration = timer.SinceStart<PARSE_DURATION>();
} }
catch( const IO_ERROR& parse_error ) catch( const IO_ERROR& )
{ {
std::cerr << parse_error.Problem() << std::endl;
std::cerr << parse_error.Where() << std::endl;
} }
if( aVerbose ) if( aVerbose )

View File

@ -3,7 +3,7 @@
* *
* Copyright (C) 2017 CERN * Copyright (C) 2017 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* Copyright (C) 2019 KiCad Developers, see CHANGELOG.TXT for contributors. * Copyright (C) 2019-2020 KiCad Developers, see CHANGELOG.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
@ -63,8 +63,6 @@ int polygon_gererator_main( int argc, char* argv[] )
{ {
if( argc < 2 ) if( argc < 2 )
{ {
printf( "A sample tool for dumping board geometry as a set of polygons.\n" );
printf( "Usage : %s board_file.kicad_pcb\n\n", argv[0] );
return KI_TEST::RET_CODES::BAD_CMDLINE; return KI_TEST::RET_CODES::BAD_CMDLINE;
} }
@ -82,8 +80,6 @@ int polygon_gererator_main( int argc, char* argv[] )
for( unsigned net = 0; net < brd->GetNetCount(); net++ ) for( unsigned net = 0; net < brd->GetNetCount(); net++ )
{ {
printf( "net %d\n", net );
for( auto track : brd->Tracks() ) for( auto track : brd->Tracks() )
process( track, net ); process( track, net );
@ -95,8 +91,6 @@ int polygon_gererator_main( int argc, char* argv[] )
for( auto zone : brd->Zones() ) for( auto zone : brd->Zones() )
process( zone, net ); process( zone, net );
printf( "endnet\n" );
} }
return KI_TEST::RET_CODES::OK; return KI_TEST::RET_CODES::OK;

View File

@ -2,6 +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) 2017 CERN * Copyright (C) 2017 CERN
* Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors.
*
* @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com> * @author Alejandro García Montoro <alejandro.garciamontoro@gmail.com>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -99,7 +101,6 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul
{ {
edgeList[i].index = i; edgeList[i].index = i;
edgeList[i].next = &edgeList[ (i != lc.SegmentCount() - 1) ? i + 1 : 0 ]; edgeList[i].next = &edgeList[ (i != lc.SegmentCount() - 1) ? i + 1 : 0 ];
//printf("n %p\n", edgeList[i].next);
} }
std::unordered_set<EDGE_LIST_ENTRY*> queue; std::unordered_set<EDGE_LIST_ENTRY*> queue;
@ -121,8 +122,6 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul
if( e1 > e2 ) if( e1 > e2 )
std::swap(e1, e2); std::swap(e1, e2);
// printf("e1 %d e2 %d\n", e1, e2 ) ;
int e1_prev = e1 - 1; int e1_prev = e1 - 1;
if (e1_prev < 0) if (e1_prev < 0)
e1_prev = lc.SegmentCount() - 1; e1_prev = lc.SegmentCount() - 1;
@ -150,8 +149,6 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul
{ {
if ( edgeList[i].next ) if ( edgeList[i].next )
queue.insert ( &edgeList[i] ); queue.insert ( &edgeList[i] );
//else
//printf("Skip %d\n", i);
} }
auto edgeBuf = std::make_unique<EDGE_LIST_ENTRY* []>( lc.SegmentCount() ); auto edgeBuf = std::make_unique<EDGE_LIST_ENTRY* []>( lc.SegmentCount() );
@ -164,8 +161,9 @@ aResult->clear();
auto e_first = (*queue.begin()); auto e_first = (*queue.begin());
auto e = e_first; auto e = e_first;
int cnt=0; int cnt=0;
do {
// printf("e %p cnt %d IDX %d\n", e, cnt, e->index); do
{
edgeBuf[cnt++] = e; edgeBuf[cnt++] = e;
e = e->next; e = e->next;
} while( e != e_first ); } while( e != e_first );
@ -175,13 +173,11 @@ aResult->clear();
for(int i = 0; i < cnt ;i++) for(int i = 0; i < cnt ;i++)
{ {
auto p = lc.CPoint(edgeBuf[i]->index); auto p = lc.CPoint(edgeBuf[i]->index);
// printf("append %d %d\n", p.x, p.y);
outl.Append( p ); outl.Append( p );
queue.erase( edgeBuf[i] ); queue.erase( edgeBuf[i] );
} }
// auto p_last = lc.Point( edgeBuf[cnt-1]->index + 1 ); // auto p_last = lc.Point( edgeBuf[cnt-1]->index + 1 );
//printf("appendl %d %d\n", p_last.x, p_last.y);
// outl.Append( p_last ); // outl.Append( p_last );
outl.SetClosed(true); outl.SetClosed(true);
@ -247,7 +243,6 @@ int polygon_triangulation_main( int argc, char *argv[] )
poly.CacheTriangulation(); poly.CacheTriangulation();
(void) poly; (void) poly;
printf( "zone %zu/%d\n", ( areaId + 1 ), brd->GetAreaCount() );
#if 0 #if 0
PROF_COUNTER unfrac("unfrac"); PROF_COUNTER unfrac("unfrac");
poly.Unfracture( SHAPE_POLY_SET::PM_FAST ); poly.Unfracture( SHAPE_POLY_SET::PM_FAST );

View File

@ -69,10 +69,8 @@ std::unique_ptr<BOARD_ITEM> ReadBoardItemFromStream( std::istream& aStream )
{ {
board.reset( parser.Parse() ); board.reset( parser.Parse() );
} }
catch( const IO_ERROR& parse_error ) catch( const IO_ERROR& )
{ {
std::cerr << parse_error.Problem() << std::endl;
std::cerr << parse_error.Where() << std::endl;
} }
return board; return board;

View File

@ -1,7 +1,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) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 1992-2020 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
@ -121,7 +121,6 @@ program;
PGM_BASE& Pgm() PGM_BASE& Pgm()
{ {
printf("Pgm @ %p\n", &program );
return program; return program;
} }

View File

@ -1,7 +1,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) 2013-2017 CERN * Copyright (C) 2013-2020 CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch> * @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* *
* This program is free software; you can redistribute it and/or * This program is free software; you can redistribute it and/or
@ -149,7 +149,6 @@ BOARD* PCB_TEST_FRAME::LoadAndDisplayBoard( const std::string& filename )
wxString msg = wxString::Format( _( "Error loading board.\n%s" ), wxString msg = wxString::Format( _( "Error loading board.\n%s" ),
ioe.Problem() ); ioe.Problem() );
printf( "%s\n", (const char*) msg.mb_str() );
return nullptr; return nullptr;
} }

View File

@ -103,7 +103,6 @@ int COMBINED_UTILITY::HandleCommandLine( int argc, char** argv ) const
if( !func ) if( !func )
{ {
std::cerr << "Tool " << arg1 << " not found." << std::endl;
return RET_CODES::UNKNOWN_TOOL; return RET_CODES::UNKNOWN_TOOL;
} }

View File

@ -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 Cirilo Bernardo * Copyright (C) 2014 Cirilo Bernardo
* Copyright (C) 2018 KiCad Developers, see AUTHORS.txt for contributors. * Copyright (C) 2018-2020 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
@ -138,16 +138,9 @@ bool DXF2IDF::WriteOutline( FILE* aFile, bool isInch )
if( outline.empty() ) if( outline.empty() )
{ {
std::cerr << "* DXF2IDF::WriteOutline(): no valid outline in file\n";
return false; return false;
} }
if( !lines.empty() )
{
std::cerr << "* DXF2IDF::WriteOutline(): WARNING: more than 1 outline in file\n";
std::cerr << "* Only the first outline will be used\n";
}
char loopDir = '1'; char loopDir = '1';
if( outline.IsCCW() ) if( outline.IsCCW() )
@ -160,7 +153,6 @@ bool DXF2IDF::WriteOutline( FILE* aFile, bool isInch )
{ {
if( !outline.front()->IsCircle() ) if( !outline.front()->IsCircle() )
{ {
std::cerr << "* DXF2IDF::WriteOutline(): bad outline\n";
return false; return false;
} }

View File

@ -2,6 +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-2017 Cirilo Bernardo * Copyright (C) 2014-2017 Cirilo Bernardo
* Copyright (C) 2020 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
@ -102,7 +103,6 @@ bool IDF3::GetIDFString( const std::string& aLine, std::string& aIDFString,
if( idx == len ) if( idx == len )
{ {
ERROR_IDF << "unterminated quote mark in line:\n"; ERROR_IDF << "unterminated quote mark in line:\n";
std::cerr << "LINE: " << aLine << "\n";
aIndex = idx; aIndex = idx;
return false; return false;
} }

View File

@ -732,7 +732,6 @@ void IDF3_COMP_OUTLINE_DATA::writePlaceData( std::ostream& aBoardFile,
if( aPlacement == PS_INVALID ) if( aPlacement == PS_INVALID )
{ {
ERROR_IDF << "placement invalid (" << aRefDes << ":"; ERROR_IDF << "placement invalid (" << aRefDes << ":";
std::cerr << aPlacement << "); defaulting to PLACED\n";
aPlacement = PS_PLACED; aPlacement = PS_PLACED;
} }

View File

@ -406,7 +406,6 @@ int PANEL_KICAD2STEP::RunConverter()
catch( const Standard_Failure& e ) catch( const Standard_Failure& e )
{ {
wxString err = e.GetMessageString(); wxString err = e.GetMessageString();
//e.Print( std::cerr );
wxMessageBox( err, "Export Error" ); wxMessageBox( err, "Export Error" );
ReportMessage( wxString::Format( "\nExport Error: %s\n", err ) ); ReportMessage( wxString::Format( "\nExport Error: %s\n", err ) );