diff --git a/3d-viewer/3d_canvas/board_adapter.cpp b/3d-viewer/3d_canvas/board_adapter.cpp index 6497c984c2..59eda07bf1 100644 --- a/3d-viewer/3d_canvas/board_adapter.cpp +++ b/3d-viewer/3d_canvas/board_adapter.cpp @@ -433,26 +433,10 @@ void BOARD_ADAPTER::InitSettings( REPORTER* aStatusReporter, REPORTER* aWarningR else aWarningReporter->Report( wxEmptyString ); -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_stopCreateBoardPolyTime = GetRunningMicroSecs(); - unsigned stats_startCreateLayersTime = stats_stopCreateBoardPolyTime; -#endif - if( aStatusReporter ) aStatusReporter->Report( _( "Create layers" ) ); 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 } diff --git a/3d-viewer/3d_canvas/create_layer_items.cpp b/3d-viewer/3d_canvas/create_layer_items.cpp index 59712b3f8f..c1993f19fe 100644 --- a/3d-viewer/3d_canvas/create_layer_items.cpp +++ b/3d-viewer/3d_canvas/create_layer_items.cpp @@ -170,11 +170,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( 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 // ///////////////////////////////////////////////////////////////////////// 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 ) 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 // ///////////////////////////////////////////////////////////////////////// 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 // ///////////////////////////////////////////////////////////////////////// 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 // ///////////////////////////////////////////////////////////////////////// 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 // ///////////////////////////////////////////////////////////////////////// for( MODULE* module : m_board->Modules() ) @@ -509,11 +479,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( 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) // ///////////////////////////////////////////////////////////////////////// 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 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) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && ( 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 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) if( GetFlag( FL_RENDER_OPENGL_COPPER_THICKNESS ) && ( 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( 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 ) && ( 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 if( aStatusReporter ) @@ -820,11 +750,6 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) 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 // ///////////////////////////////////////////////////////////////////////// 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 - // This will make a union of all added contourns m_through_inner_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_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 // 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 ) aStatusReporter->Report( _( "Build Tech layers" ) ); @@ -1051,16 +964,8 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) } // End Build Tech layers -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_endTechLayersTime = GetRunningMicroSecs(); -#endif - - // Build BVH (Bounding volume hierarchy) for holes and vias -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_startHolesBVHTime = GetRunningMicroSecs(); -#endif if( aStatusReporter ) aStatusReporter->Report( _( "Build BVH for holes and vias" ) ); @@ -1081,24 +986,4 @@ void BOARD_ADAPTER::createLayers( REPORTER* aStatusReporter ) if( m_layers_container2D[F_Mask] ) 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 } diff --git a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp index 4264812214..1d02e2fd51 100644 --- a/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp +++ b/3d-viewer/3d_rendering/3d_render_ogl_legacy/c3d_render_createscene_ogl_legacy.cpp @@ -342,25 +342,13 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin COBJECT2D_STATS::Instance().ResetStats(); -#ifdef PRINT_STATISTICS_3D_VIEWER - printf("InitSettings...\n"); -#endif - unsigned stats_startReloadTime = GetRunningMicroSecs(); m_boardAdapter.InitSettings( aStatusReporter, aWarningReporter ); -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_endReloadTime = GetRunningMicroSecs(); -#endif - SFVEC3F camera_pos = m_boardAdapter.GetBoardCenter3DU(); m_camera.SetBoardLookAtPos( camera_pos ); -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_start_OpenGL_Load_Time = GetRunningMicroSecs(); -#endif - if( aStatusReporter ) aStatusReporter->Report( _( "Load OpenGL: board" ) ); @@ -615,35 +603,13 @@ void C3D_RENDER_OGL_LEGACY::reload( REPORTER* aStatusReporter, REPORTER* aWarnin layer_z_top ); }// for each layer on map -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_end_OpenGL_Load_Time = GetRunningMicroSecs(); -#endif - // Load 3D models // ///////////////////////////////////////////////////////////////////////// -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_start_models_Load_Time = GetRunningMicroSecs(); -#endif - if( aStatusReporter ) aStatusReporter->Report( _( "Loading 3D models" ) ); 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 ) { // Calculation time in seconds diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp index abb0eedb5f..080bcc5a01 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/accelerators/cbvh_pbrt.cpp @@ -305,35 +305,6 @@ CBVH_PBRT::CBVH_PBRT( const CGENERICCONTAINER &aObjectContainer, flattenBVHTree( root, &offset ); 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 } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp index c0dde6e722..beaaa2a196 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/c3d_render_createscene.cpp @@ -266,19 +266,10 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin COBJECT2D_STATS::Instance().ResetStats(); COBJECT3D_STATS::Instance().ResetStats(); -#ifdef PRINT_STATISTICS_3D_VIEWER - printf("InitSettings...\n"); -#endif - unsigned stats_startReloadTime = GetRunningMicroSecs(); 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(); m_camera.SetBoardLookAtPos( camera_pos ); @@ -290,10 +281,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin // Create and add the outline board // ///////////////////////////////////////////////////////////////////////// -#ifdef PRINT_STATISTICS_3D_VIEWER - printf("Create outline board...\n"); -#endif - delete m_outlineBoard2dObjects; 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) // ///////////////////////////////////////////////////////////////////////// -#ifdef PRINT_STATISTICS_3D_VIEWER - printf("Add layers maps...\n"); -#endif - for( MAP_CONTAINER_2D::const_iterator ii = m_boardAdapter.GetMapLayers().begin(); ii != m_boardAdapter.GetMapLayers().end(); ++ii ) @@ -983,11 +966,6 @@ void C3D_RENDER_RAYTRACING::reload( REPORTER* aStatusReporter, REPORTER* aWarnin // Create an accelerator // ///////////////////////////////////////////////////////////////////////// - -#ifdef PRINT_STATISTICS_3D_VIEWER - unsigned stats_startAcceleratorTime = GetRunningMicroSecs(); -#endif - if( 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 ); -#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 ) { // Calculation time in seconds diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp index 60f8cf1689..05cb90656f 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/ray.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2017 Mario Luzeiro - * 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 * modify it under the terms of the GNU General Public License @@ -32,6 +32,7 @@ #include "../../3d_fastmath.h" #include #include +#include #include @@ -88,7 +89,8 @@ void RAY::Init( const SFVEC3F& o, const SFVEC3F& d ) { m_Classification = RAY_CLASSIFICATION::MMM; } - else if( m_Dir.z > 0 ){ + else if( m_Dir.z > 0 ) + { m_Classification = RAY_CLASSIFICATION::MMP; } else//( m_Dir.z >= 0 ) @@ -397,6 +399,6 @@ bool RAYSEG2D::IntersectCircle( const SFVEC2F &aCenter, void RAY::debug() const { - printf("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 ); + 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 ); } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cobject2d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cobject2d.cpp index 403aad3bf6..bd3b7370cd 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cobject2d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cobject2d.cpp @@ -64,11 +64,9 @@ const std::map objectTypeNames void COBJECT2D_STATS::PrintStats() { - printf( "OBJ2D Statistics:\n" ); - for( auto& objectType : objectTypeNames ) { - printf( " %20s %u\n", objectType.second, + wxLogDebug( " %20s %u\n", objectType.second, m_counter[static_cast( objectType.first )] ); } } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp index 2ada77821e..f4e4b982cb 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes2D/cpolygon2d.cpp @@ -701,21 +701,6 @@ void Convert_path_polygon_to_polygon_blocks_and_dummy_blocks( blockY -= blockAdvance.y; 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 } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp index 946d2417dd..a00b1918a0 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cbbox.cpp @@ -395,6 +395,6 @@ void CBBOX::ApplyTransformationAA( glm::mat4 aTransformMatrix ) void CBBOX::debug() const { - printf( "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 ); + 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 ); } diff --git a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cobject.cpp b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cobject.cpp index d854b16c58..9d2827ced9 100644 --- a/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cobject.cpp +++ b/3d-viewer/3d_rendering/3d_render_raytracing/shapes3D/cobject.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015-2016 Mario Luzeiro - * 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 * modify it under the terms of the GNU General Public License @@ -63,11 +63,11 @@ const std::map objectTypeNames void COBJECT3D_STATS::PrintStats() { - printf( "OBJ3D Statistics:\n" ); + wxLogDebug( "OBJ3D Statistics:\n" ); for( auto& objectType : objectTypeNames ) { - printf( " %20s %u\n", objectType.second, + wxLogDebug( " %20s %u\n", objectType.second, m_counter[static_cast( objectType.first )] ); } } diff --git a/3d-viewer/common_ogl/cogl_att_list.cpp b/3d-viewer/common_ogl/cogl_att_list.cpp index 688c50f5e9..469268b250 100644 --- a/3d-viewer/common_ogl/cogl_att_list.cpp +++ b/3d-viewer/common_ogl/cogl_att_list.cpp @@ -119,7 +119,6 @@ const int *COGL_ATT_LIST::GetAttributesList( ANTIALIASING_MODE aAntiAliasingMode } else { - DBG( printf("GetAttributesList: AntiAliasing is not supported.\n") ); aAntiAliasingMode = ANTIALIASING_MODE::AA_NONE; } } diff --git a/Documentation/development/coding-style-policy.md b/Documentation/development/coding-style-policy.md index f742ced759..2657535578 100644 --- a/Documentation/development/coding-style-policy.md +++ b/Documentation/development/coding-style-policy.md @@ -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. -# 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: - contain a license statement @@ -537,7 +559,7 @@ Project \*.h source files should: 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 prevent compiler errors in the case where the header file is seen 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 \#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: KiCad is not at this point now, but this section is a goal of the project.) @@ -598,13 +620,13 @@ is exposed in the header file, merely by including that one header 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 code formatting options or no formatting is defined, follow the existing 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 configuration file for the code beautifier uncrustify. Uncrustify won't 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/ -# 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 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 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 @@ -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 [overloading]:http://www.cs.caltech.edu/courses/cs11/material/cpp/donnie/cpp-ops.html [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 diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 6c6eae2873..2ea2636c23 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -96,11 +96,6 @@ void EDA_ITEM::SetModified() 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 // this return EDA_RECT( wxPoint( 0, 0 ), wxSize( 0, 0 ) ); diff --git a/common/dialog_shim.cpp b/common/dialog_shim.cpp index 6d3fa00f32..9377a68a12 100644 --- a/common/dialog_shim.cpp +++ b/common/dialog_shim.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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 ) { // 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 ); } @@ -364,16 +357,12 @@ int DIALOG_SHIM::ShowQuasiModal() // Get the optimal parent 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, wxT( "Caller using ShowQuasiModal() twice on same window?" ) ); // quasi-modal: disable only my "optimal" parent m_qmodal_parent_disabler = new WDO_ENABLE_DISABLE( parent ); - // 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 // the windows so that the quasi-modal will be pushed in front of the disabled diff --git a/common/dsnlexer.cpp b/common/dsnlexer.cpp index 0a1f3d8e1e..8824af6916 100644 --- a/common/dsnlexer.cpp +++ b/common/dsnlexer.cpp @@ -3,7 +3,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007-2013 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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; - // printf("tok:\"%s\"\n", curText.c_str() ); return curTok; } diff --git a/common/eagle_parser.cpp b/common/eagle_parser.cpp index a5ac6f42d0..3672c2ca3f 100644 --- a/common/eagle_parser.cpp +++ b/common/eagle_parser.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * 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. * @author Alejandro García Montoro * @@ -598,7 +598,6 @@ wxSize ETEXT::ConvertSize() const } else { - wxLogDebug( "Invalid font name \"%s\"", fontName ); textsize = wxSize( size.ToSchUnits(), size.ToSchUnits() ); } } diff --git a/common/eda_base_frame.cpp b/common/eda_base_frame.cpp index eeede7a02b..be9b5185ff 100644 --- a/common/eda_base_frame.cpp +++ b/common/eda_base_frame.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2013 Wayne Stambaugh - * 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 * 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() ) ) { - // Nothing bad happens if this fails, at worst it uses a generic application is preventing shutdown message - wxLogDebug( wxT( "ShutdownBlockReasonCreate failed to set reason: %s" ), aReason ); + // Nothing bad happens if this fails, at worst it uses a generic application is + // preventing shutdown message } #endif } @@ -460,8 +460,6 @@ void EDA_BASE_FRAME::LoadWindowSettings( WINDOW_SETTINGS* aCfg ) wxDisplay display( index ); wxRect clientSize = display.GetClientArea(); - wxLogDebug( "Client size (%d, %d)", clientSize.width, clientSize.height ); - m_FramePos = wxDefaultPosition; // Ensure the window fits on the display, since the other one could have been larger diff --git a/common/gal/opengl/cached_container.cpp b/common/gal/opengl/cached_container.cpp index 6f47165245..98a583ce78 100644 --- a/common/gal/opengl/cached_container.cpp +++ b/common/gal/opengl/cached_container.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright 2013-2017 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * 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 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; #if CACHED_CONTAINER_TEST > 1 - wxLogDebug( wxT( "Finishing item 0x%08lx (size %d)" ), (long) m_item, itemSize ); test(); #endif } @@ -156,10 +153,6 @@ void CACHED_CONTAINER::Delete( VERTEX_ITEM* aItem ) 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 addFreeChunk( offset, size ); @@ -215,10 +208,6 @@ bool CACHED_CONTAINER::reallocate( unsigned int aSize ) 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 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 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 memcpy( &m_vertices[newChunkOffset], &m_vertices[m_chunkOffset], itemSize * VERTEX_SIZE ); @@ -363,10 +348,6 @@ void CACHED_CONTAINER::mergeFreeChunks() // Add the last one 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 test(); #endif @@ -385,42 +366,11 @@ void CACHED_CONTAINER::addFreeChunk( unsigned int aOffset, unsigned int aSize ) 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() { -#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__ */ } diff --git a/common/gal/opengl/cached_container_gpu.cpp b/common/gal/opengl/cached_container_gpu.cpp index bda99ba526..1f931777f3 100644 --- a/common/gal/opengl/cached_container_gpu.cpp +++ b/common/gal/opengl/cached_container_gpu.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright 2013-2017 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Maciej Suminski * * This program is free software; you can redistribute it and/or @@ -43,15 +45,15 @@ CACHED_CONTAINER_GPU::CACHED_CONTAINER_GPU( unsigned int aSize ) : m_useCopyBuffer = GLEW_ARB_copy_buffer; 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" ) ) { - wxLogDebug( "Disabling glCopyBuffer(), on %s GPU.\n", vendor ); m_useCopyBuffer = false; } - + glGenBuffers( 1, &m_glBufferHandle ); glBindBuffer( GL_ARRAY_BUFFER, m_glBufferHandle ); glBufferData( GL_ARRAY_BUFFER, m_currentSize * VERTEX_SIZE, NULL, GL_DYNAMIC_DRAW ); diff --git a/common/gal/opengl/shader.cpp b/common/gal/opengl/shader.cpp index cc09465945..3f7b191a80 100644 --- a/common/gal/opengl/shader.cpp +++ b/common/gal/opengl/shader.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2012 Torsten Hueter, torstenhtr 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 * @@ -185,8 +185,6 @@ void SHADER::programInfo( GLuint aProgram ) GLchar* glInfoLog = new GLchar[glInfoLogLength]; glGetProgramInfoLog( aProgram, glInfoLogLength, &writtenChars, glInfoLog ); - std::cerr << glInfoLog << std::endl; - delete[] glInfoLog; } } @@ -206,8 +204,6 @@ void SHADER::shaderInfo( GLuint aShader ) GLchar* glInfoLog = new GLchar[glInfoLogLength]; glGetShaderInfoLog( aShader, glInfoLogLength, &writtenChars, glInfoLog ); - std::cerr << glInfoLog << std::endl; - delete[] glInfoLog; } } diff --git a/common/gal/opengl/utils.cpp b/common/gal/opengl/utils.cpp index 2d2b519a14..29d1f6b9ec 100644 --- a/common/gal/opengl/utils.cpp +++ b/common/gal/opengl/utils.cpp @@ -26,6 +26,8 @@ #include #include +#include // wxLogDebug + int checkGlError( const std::string& aInfo, bool aThrow ) { @@ -127,13 +129,13 @@ static void GLAPIENTRY debugMsgCallback( GLenum aSource, GLenum aType, GLuint aI { switch( aSeverity ) { - case GL_DEBUG_SEVERITY_HIGH: printf( "OpenGL ERROR: " ); break; - case GL_DEBUG_SEVERITY_MEDIUM: printf( "OpenGL WARNING: " ); break; - case GL_DEBUG_SEVERITY_LOW: printf( "OpenGL INFO: " ); break; + case GL_DEBUG_SEVERITY_HIGH: wxLogDebug( "OpenGL ERROR: " ); break; + case GL_DEBUG_SEVERITY_MEDIUM: wxLogDebug( "OpenGL WARNING: " ); break; + case GL_DEBUG_SEVERITY_LOW: wxLogDebug( "OpenGL INFO: " ); break; case GL_DEBUG_SEVERITY_NOTIFICATION: return; } - printf( "%s\n", aMessage ); + wxLogDebug( "%s\n", aMessage ); } diff --git a/common/gestfich.cpp b/common/gestfich.cpp index e3f15299ba..b616947678 100644 --- a/common/gestfich.cpp +++ b/common/gestfich.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com * Copyright (C) 2008-2017 Wayne Stambaugh - * 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 * modify it under the terms of the GNU General Public License @@ -81,16 +81,6 @@ wxString EDA_FILE_SELECTOR( const wxString& aTitle, 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, dotted_Ext, aWildcard, aStyle, // open mode wxFD_OPEN, wxFD_SAVE .. diff --git a/common/kicad_curl/kicad_curl.cpp b/common/kicad_curl/kicad_curl.cpp index 2290cb7632..a1131d9837 100644 --- a/common/kicad_curl/kicad_curl.cpp +++ b/common/kicad_curl/kicad_curl.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Mark Roszko * Copyright (C) 2016 SoftPLC Corporation, Dick Hollenbeck - * 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 * modify it under the terms of the GNU General Public License @@ -165,8 +165,6 @@ void KICAD_CURL::Init() init_locks(); - //wxLogDebug( "Using %s", GetVersion() ); - s_initialized = true; } } diff --git a/common/lib_tree_model_adapter.cpp b/common/lib_tree_model_adapter.cpp index a4404a3521..8783fcba9a 100644 --- a/common/lib_tree_model_adapter.cpp +++ b/common/lib_tree_model_adapter.cpp @@ -116,10 +116,6 @@ void LIB_TREE_MODEL_ADAPTER::SaveColWidths() auto cfg = Kiface().KifaceSettings(); cfg->m_LibTree.column_width = m_widget->GetColumn( PART_COL )->GetWidth(); } - else - { - wxLogDebug( "Error saving column size, tree view doesn't exist" ); - } } diff --git a/common/lset.cpp b/common/lset.cpp index 8101222af6..706f682cf4 100644 --- a/common/lset.cpp +++ b/common/lset.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2014 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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 ); - // printf( "%s: id:%d PCB_LAYER_ID_COUNT:%d\n", __func__, id, PCB_LAYER_ID_COUNT ); - assert( unsigned( id ) < PCB_LAYER_ID_COUNT ); set( id ); diff --git a/common/project.cpp b/common/project.cpp index 7648f2b8be..a6829338bc 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -262,12 +262,6 @@ void PROJECT::SetElem( ELEM_T aIndex, _ELEM* aElem ) 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]; m_elems[aIndex] = aElem; } diff --git a/common/ptree.cpp b/common/ptree.cpp index b1619de092..5e6b47c4ac 100644 --- a/common/ptree.cpp +++ b/common/ptree.cpp @@ -3,7 +3,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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(); - //D(printf( "%s: '%s'\n", __func__, key );) - PTREE* list = &aTree->push_back( PTREE::value_type( key, PTREE() ) )->second; if( tok != DSN_RIGHT ) @@ -81,8 +79,6 @@ inline void scanAtom( PTREE* aTree, DSNLEXER* aLexer ) { const char* key = aLexer->CurText(); - //D(printf( "%s: '%s'\n", __func__, key );) - aTree->push_back( PTREE::value_type( key, PTREE() ) ); } diff --git a/common/tool/action_menu.cpp b/common/tool/action_menu.cpp index 8018bb0294..4e78d091bf 100644 --- a/common/tool/action_menu.cpp +++ b/common/tool/action_menu.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * @author Maciej Suminski * @@ -267,9 +267,8 @@ void ACTION_MENU::UpdateAll() { update(); } - catch( std::exception& e ) + catch( std::exception& ) { - wxLogDebug( wxString::Format( "ACTION_MENU update handler exception: %s", e.what() ) ); } if( m_tool ) @@ -560,9 +559,8 @@ void ACTION_MENU::runOnSubmenus( std::function aFunction ) m->runOnSubmenus( aFunction ); } ); } - catch( std::exception& e ) + catch( std::exception& ) { - wxLogDebug( wxString::Format( "ACTION_MENU runOnSubmenus exception: %s", e.what() ) ); } } diff --git a/common/tool/picker_tool.cpp b/common/tool/picker_tool.cpp index f6657e931f..069ea3fcfd 100644 --- a/common/tool/picker_tool.cpp +++ b/common/tool/picker_tool.cpp @@ -80,9 +80,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) { (*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 ); } - catch( std::exception& e ) + catch( std::exception& ) { - std::cerr << "PICKER_TOOL click handler error: " << e.what() << std::endl; finalize_state = EXCEPTION_CANCEL; break; } @@ -133,9 +131,8 @@ int PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) { (*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 ); } - catch( std::exception& e ) + catch( std::exception& ) { - std::cerr << "PICKER_TOOL finalize handler error: " << e.what() << std::endl; } } diff --git a/common/widgets/mathplot.cpp b/common/widgets/mathplot.cpp index 9b0825f273..96ab63b385 100644 --- a/common/widgets/mathplot.cpp +++ b/common/widgets/mathplot.cpp @@ -169,10 +169,6 @@ void mpInfoLayer::Plot( wxDC& dc, mpWindow& w ) 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 ) 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) ) { -#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 ) 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) ) { -#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 ) 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 > (tmpX + baseWidth) ) ? textX : (tmpX + baseWidth + mpLEGEND_MARGIN); 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 ) ); - // printf("minV %.10f maxV %.10f %.10f %.10f\n", minV, maxV, minVvis, maxVvis); - m_tickValues.clear(); m_tickLabels.clear(); @@ -884,9 +867,6 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w ) { double curr_step = fabs( maxVvis - minVvis ) / (double) i; double base = pow( 10, floor( log10( curr_step ) ) ); - - // printf("base %.3f\n", base); - double stepInt = floor( curr_step / base ) * base; double err = fabs( curr_step - stepInt ); @@ -895,15 +875,12 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w ) minErr = err; bestStep = stepInt; } - - // printf("curr_step %d %.3f %.3f best %.3f\n",i, curr_step, stepInt, bestStep); } double v = floor( minVvis / bestStep ) * bestStep; double zeroOffset = 100000000.0; - // printf("maxVVis %.3f\n", maxVvis); while( v < maxVvis ) { @@ -912,7 +889,6 @@ void mpScaleX::recalculateTicks( wxDC& dc, mpWindow& w ) if( fabs( v ) < zeroOffset ) zeroOffset = fabs( v ); - // printf("tick %.3f\n", v); v += bestStep; } @@ -967,7 +943,6 @@ int mpScaleBase::getLabelDecimalDigits( int maxDigits ) 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_maxLabelWidth = 0; @@ -1067,8 +1042,6 @@ void mpScaleY::getVisibleDataRange( mpWindow& w, double& minV, double& maxV ) double pymin = w.p2y( minYpx ); double pymax = w.p2y( maxYpx ); - // printf("PYmin %.3f PYmax %.3f\n", pymin, pymax); - minV = TransformFromPlot( pymax ); maxV = TransformFromPlot( pymin ); } @@ -1082,7 +1055,6 @@ void mpScaleY::computeSlaveTicks( mpWindow& w ) m_tickValues.clear(); m_tickLabels.clear(); - // printf("NTicks %d\n", m_masterScale->m_tickValues.size()); double p0 = m_masterScale->TransformToPlot( m_masterScale->m_tickValues[0] ); 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 ) { - // printf("this %p master %p\n", this, m_masterScale); - if( m_masterScale ) { computeSlaveTicks( w ); @@ -1140,15 +1110,11 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) double minV, maxV, minVvis, maxVvis; GetDataRange( minV, maxV ); getVisibleDataRange( w, minVvis, maxVvis ); - // printf("vdr %.10f %.10f\n", minVvis, maxVvis); m_absVisibleMaxV = std::max( std::abs( minVvis ), std::abs( maxVvis ) ); - - m_tickValues.clear(); m_tickLabels.clear(); - double minErr = 1000000000000.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 base = pow( 10, floor( log10( curr_step ) ) ); - - // printf("base %.3f\n", base); - double stepInt = floor( curr_step / base ) * base; double err = fabs( curr_step - stepInt ); @@ -1167,15 +1130,12 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) minErr = err; bestStep = stepInt; } - - // printf("curr_step %d %.3f %.3f best %.3f\n",i, curr_step, stepInt, bestStep); } double v = floor( minVvis / bestStep ) * bestStep; double zeroOffset = 100000000.0; - // printf("v %.3f maxVVis %.3f\n", v, maxVvis); const int iterLimit = 1000; int i = 0; @@ -1187,7 +1147,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) if( fabs( v ) < zeroOffset ) zeroOffset = fabs( v ); - // printf("tick %.3f %d\n", v, m_tickValues.size()); v += bestStep; i++; } @@ -1213,7 +1172,6 @@ void mpScaleY::recalculateTicks( wxDC& dc, mpWindow& w ) // end = n0 + // n0 = floor( (w.GetPosX() ) / step ) * step ; - // printf("zeroOffset:%.3f tickjs : %d\n", zeroOffset, m_tickValues.size()); updateTickLabels( dc, w ); // 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 endPx = m_drawOutsideMargins ? w.GetScrX() : w.GetScrX() - w.GetMarginRight(); - - // printf("getVisibleDataRange\n"); - double pxmin = w.p2x( startPx ); double pxmax = w.p2x( endPx ); @@ -1245,9 +1200,6 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w ) // double decades = log( maxV / minV ) / log(10); double minDecade = pow( 10, floor( log10( minV ) ) ); 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 d; @@ -1261,7 +1213,6 @@ void mpScaleXLog::recalculateTicks( wxDC& dc, mpWindow& w ) for( d = minDecade; d<=maxDecade; d *= 10.0 ) { - // printf("d %.1f\n",d ); m_tickLabels.emplace_back( 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 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 labelH = m_maxLabelHeight; // Control labels heigth to decide where to put axis name (below labels or on top of axis) // int maxExtent = tc.MaxLabelWidth(); - // printf("Ticks : %d\n",labelCount()); for( int n = 0; n < tickCount(); 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() ); -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage( wxT( "mpScaleX::Plot: n: %f -> p = %d" ), n, p ); -#endif - if( (p >= startPx) && (p <= endPx) ) { if( m_ticks ) // draw axis ticks @@ -1392,7 +1336,6 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w ) if( (m_flags == mpALIGN_BOTTOM) && !m_drawOutsideMargins ) { - // printf("d1"); m_pen.SetStyle( wxPENSTYLE_DOT ); dc.SetPen( m_pen ); 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 ) { - // printf("d2"); dc.DrawLine( p, orgy - 4, p, maxYpx ); } else { - // printf("d3"); 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, maxYpx, endPx, maxYpx ); - // printf("Labels : %d\n",labelCount()); - // Actually draw labels, taking care of not overlapping them, and distributing them regularly + // Actually draw labels, taking care of not overlapping them, and distributing them + // regularly for( int n = 0; n < labelCount(); n++ ) { double tp = getLabelPos( n ); @@ -1437,15 +1378,10 @@ void mpScaleXBase::Plot( wxDC& dc, mpWindow& w ) // double xlogmin = log10 ( m_minV ); // double xlogmax = log10 ( m_maxV ); - double px = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); + double px = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); 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) ) { // Write ticks labels in s string @@ -1527,7 +1463,6 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w ) m_offset = -m_minV; m_scale = 1.0 / ( m_maxV - m_minV ); - // printf("Plot Y-scale\n"); recalculateTicks( dc, w ); if( m_visible ) @@ -1582,14 +1517,11 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w ) s.Printf( fmt, n ); dc.GetTextExtent( s, &tx, &labelHeigth ); - // printf("Y-ticks: %d\n", tickCount()); for( n = 0; n < tickCount(); n++ ) { - // printf("Tick %d\n", n); - double tp = getTickPos( n ); - double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); + double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); const int p = (int) ( ( w.GetPosY() - py ) * w.GetScaleY() ); @@ -1623,14 +1555,11 @@ void mpScaleY::Plot( wxDC& dc, mpWindow& w ) } } - // printf("Y-ticks: %d\n", tickCount()); for( n = 0; n < labelCount(); n++ ) { - // printf("Tick %d\n", n); - double tp = getLabelPos( n ); - double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); + double py = TransformToPlot( tp ); // ( log10 ( tp ) - xlogmin) / (xlogmax - xlogmin); const int p = (int) ( ( w.GetPosY() - py ) * w.GetScaleY() ); if( !m_tickLabels[n].visible ) @@ -1906,14 +1835,6 @@ void mpWindow::OnMouseMove( wxMouseEvent& event ) if( updateRequired ) 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 { @@ -1980,20 +1901,9 @@ void mpWindow::OnMouseLeftDown( wxMouseEvent& event ) m_mouseLClick.x = event.GetX(); m_mouseLClick.y = event.GetY(); 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(); 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(); } @@ -2074,10 +1984,8 @@ void mpWindow::Fit( double xMin, double xMax, double yMin, double yMax, if( m_lockaspect ) { -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage( "mpWindow::Fit()(lock) m_scaleX=%f,m_scaleY=%f", m_scaleX, m_scaleY ); -#endif - // Keep the lowest "scale" to fit the whole range required by that axis (to actually "fit"!): + // 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; m_scaleX = 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_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!! // Otherwise, the DC dimensions will be those of the window instead of the printer device if( printSizeX==NULL || printSizeY==NULL ) @@ -2131,11 +2021,6 @@ void mpWindow::DoZoomInXCalc( const int staticXpixel ) // Adjust desired m_desiredXmin = m_posX; 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 m_desiredYmax = m_posY; 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 m_desiredXmin = m_posX; 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 m_desiredYmax = m_posY; 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_desiredYmin = m_posY - (m_scrY - m_marginTop - m_marginBottom) / m_scaleY; // m_desiredYmin = m_posY - m_scrY / m_scaleY; 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(); } @@ -2370,21 +2234,12 @@ void mpWindow::ZoomOut( const wxPoint& centerPoint, double zoomFactor ) m_desiredYmax = m_posY; 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, m_desiredXmin ) || !CheckYLimits( m_desiredYmax, m_desiredYmin ) ) { - // printf("call fit()\n"); 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(); } @@ -2431,10 +2286,6 @@ void mpWindow::ZoomRect( wxPoint p0, wxPoint p1 ) double zoom_y_min = p0yp1y ? 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 ); AdjustLimitedView(); } @@ -2496,9 +2347,6 @@ void mpWindow::OnSize( wxSizeEvent& WXUNUSED( event ) ) { // Try to fit again with the new window size: 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! -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage( "[mpWindow::OnPaint] vis.area: x %i y%i", m_scrX, m_scrY ); -#endif - // Selects direct or buffered draw: wxDC* trgDc; @@ -2654,9 +2498,6 @@ void mpWindow::OnPaint( wxPaintEvent& WXUNUSED( 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 (!m_enableScrollBars) { // 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 = 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(); //// event.Skip(); @@ -2727,9 +2563,6 @@ void mpWindow::SetMPScrollbars( bool status ) // 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 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) { // SetScrollbars(1, // 1, @@ -2785,12 +2618,6 @@ bool mpWindow::UpdateBBox() // 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; #endif } @@ -2840,9 +2667,6 @@ bool mpWindow::UpdateBBox() * * 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(); @@ -3153,16 +2977,9 @@ mpInfoLayer* mpWindow::IsInsideInfoLayer( wxPoint& point ) 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() ) { mpInfoLayer* tmpLyr = (mpInfoLayer*) (*li); -#ifdef MATHPLOT_DO_LOGGING - wxLogMessage( "mpWindow::IsInsideInfoLayer() layer = %p", (*li) ); -#endif // MATHPLOT_DO_LOGGING if( tmpLyr->Inside( point ) ) { @@ -3280,9 +3097,6 @@ void mpWindow::SetColourTheme( const wxColour& bgColour, * } * // Draw inside margins * 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; * } * @@ -3293,9 +3107,6 @@ void mpWindow::SetColourTheme( const wxColour& bgColour, * } * // Draw inside margins * 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; * } */ @@ -3311,7 +3122,6 @@ IMPLEMENT_DYNAMIC_CLASS( mpFXYVector, mpFXY ) mpFXYVector::mpFXYVector( const wxString& name, int flags ) : mpFXY( name, flags ) { m_index = 0; - // printf("FXYVector::FXYVector!\n"); m_minX = -1; m_maxX = 1; m_minY = -1; @@ -3409,17 +3219,12 @@ void mpFXYVector::SetData( const std::vector& xs, const std::vector0 ) { @@ -3447,9 +3252,6 @@ void mpFXYVector::SetData( const std::vector& xs, const std::vectorm_maxY ) m_maxY = *it; } - - // printf("minX %.10f maxX %.10f\n ", m_minX, m_maxX ); - // printf("minY %.10f maxY %.10f\n ", m_minY, m_maxY ); } else { @@ -3545,12 +3347,6 @@ bool mpPrintout::OnPrintPage( int page ) m_prnY -= (2 * 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: plotWindow->Fit( plotWindow->GetDesiredXmin(), @@ -3623,8 +3419,6 @@ void mpMovableObject::ShapeUpdated() // Just in case... 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 { @@ -3776,21 +3570,15 @@ void mpCovarianceEllipse::RecalculateShape() m_shape_xs.clear(); m_shape_ys.clear(); - // Preliminar checks: + // Preliminary checks: if( m_quantiles<0 ) - { - wxLogError( wxT( "[mpCovarianceEllipse] Error: quantiles must be non-negative" ) ); return; - } + return; if( m_cov_00<0 ) - { - wxLogError( wxT( "[mpCovarianceEllipse] Error: cov(0,0) must be non-negative" ) ); return; - } + return; if( m_cov_11<0 ) - { - wxLogError( wxT( "[mpCovarianceEllipse] Error: cov(1,1) must be non-negative" ) ); return; - } + return; m_shape_xs.resize( m_segments, 0 ); m_shape_ys.resize( m_segments, 0 ); @@ -3803,9 +3591,7 @@ void mpCovarianceEllipse::RecalculateShape() double D = b * b - 4 * c; if( D<0 ) - { - wxLogError( wxT( "[mpCovarianceEllipse] Error: cov is not positive definite" ) ); return; - } + return; double eigenVal0 = 0.5 * ( -b + sqrt( D ) ); double eigenVal1 = 0.5 * ( -b - sqrt( D ) ); @@ -3887,12 +3673,7 @@ void mpPolygon::setPoints( const std::vector& points_xs, const std::vector& points_ys, bool closedShape ) { - if( points_xs.size()!=points_ys.size() ) - { - wxLogError( wxT( - "[mpPolygon] Error: points_xs and points_ys must have the same number of elements" ) ); - } - else + if( points_xs.size()==points_ys.size() ) { m_shape_xs = points_xs; 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 ) { - if( !inBmp.Ok() ) - { - wxLogError( wxT( "[mpBitmapLayer] Assigned bitmap is not Ok()!" ) ); - } - else + if( inBmp.Ok() ) { m_bitmap = inBmp; // .GetSubBitmap( wxRect(0, 0, inBmp.GetWidth(), inBmp.GetHeight())); 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_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? if( d_width>0 && d_height>0 ) { @@ -4101,7 +3865,6 @@ void mpFXY::SetScale( mpScaleBase* scaleX, mpScaleBase* scaleY ) m_scaleX = scaleX; m_scaleY = scaleY; - // printf("SetScales : %p %p\n", scaleX, scaleY); UpdateScales(); } diff --git a/cvpcb/cvpcb_mainframe.cpp b/cvpcb/cvpcb_mainframe.cpp index 8504904f95..a039d9ccbe 100644 --- a/cvpcb/cvpcb_mainframe.cpp +++ b/cvpcb/cvpcb_mainframe.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * 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 * 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(); - //DBG(printf( "%s: %s\n", __func__, payload.c_str() );) - switch( mail.Command() ) { case MAIL_EESCHEMA_NETLIST: diff --git a/cvpcb/readwrite_dlgs.cpp b/cvpcb/readwrite_dlgs.cpp index fc7dc229e1..451f023ad1 100644 --- a/cvpcb/readwrite_dlgs.cpp +++ b/cvpcb/readwrite_dlgs.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras * Copyright (C) 2011-2016 Wayne Stambaugh - * 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 * 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 ) { 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; break; diff --git a/cvpcb/tools/cvpcb_association_tool.cpp b/cvpcb/tools/cvpcb_association_tool.cpp index b8319d19f8..a8e76177b7 100644 --- a/cvpcb/tools/cvpcb_association_tool.cpp +++ b/cvpcb/tools/cvpcb_association_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2019 Ian McInerney - * 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 * 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->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) - wxLogDebug( "Failed to copy data to clipboard" ); - + wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ); wxTheClipboard->Flush(); wxTheClipboard->Close(); } - else - wxLogDebug( "Failed to open the clipboard" ); return 0; } @@ -126,7 +122,6 @@ int CVPCB_ASSOCIATION_TOOL::CutAssoc( const TOOL_EVENT& aEvent ) { if( !wxTheClipboard->SetData( new wxTextDataObject( fpid.GetUniStringLibId() ) ) ) { - wxLogDebug( "Failed to cut data to clipboard" ); wxTheClipboard->Close(); return 0; } @@ -136,7 +131,6 @@ int CVPCB_ASSOCIATION_TOOL::CutAssoc( const TOOL_EVENT& aEvent ) } else { - wxLogDebug( "Failed to open the clipboard" ); return 0; } @@ -166,7 +160,6 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent ) } else { - wxLogDebug( "Failed to open the clipboard" ); return 0; } @@ -184,6 +177,7 @@ int CVPCB_ASSOCIATION_TOOL::PasteAssoc( const TOOL_EVENT& aEvent ) return 0; } + void CVPCB_ASSOCIATION_TOOL::Reset( RESET_REASON aReason ) { m_frame = getEditFrame(); diff --git a/eeschema/class_library.cpp b/eeschema/class_library.cpp index be967fb7e5..b9c99db2d9 100644 --- a/eeschema/class_library.cpp +++ b/eeschema/class_library.cpp @@ -596,11 +596,4 @@ void PART_LIBS::LoadAllLibraries( PROJECT* aProject, bool aShowProgress ) // of the HTML_MESSAGE_BOX. 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 } diff --git a/eeschema/cross-probing.cpp b/eeschema/cross-probing.cpp index 634ef2d931..bbf3821525 100644 --- a/eeschema/cross-probing.cpp +++ b/eeschema/cross-probing.cpp @@ -489,9 +489,8 @@ void SCH_EDIT_FRAME::KiwayMailIn( KIWAY_EXPRESS& mail ) SCH_EDITOR_CONTROL* controlTool = m_toolManager->GetTool(); 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; diff --git a/eeschema/dialogs/dialog_bom.cpp b/eeschema/dialogs/dialog_bom.cpp index 318232bbd2..f863275fb0 100644 --- a/eeschema/dialogs/dialog_bom.cpp +++ b/eeschema/dialogs/dialog_bom.cpp @@ -348,7 +348,6 @@ void DIALOG_BOM::installGeneratorsList() for( const auto& path : pluginPaths ) { - wxLogDebug( wxString::Format( "Searching directory %s for BOM generators", path ) ); wxDir dir( path ); if( !dir.IsOpened() ) @@ -362,7 +361,7 @@ void DIALOG_BOM::installGeneratorsList() { 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 ) ) { diff --git a/eeschema/dialogs/dialog_print_using_printer.cpp b/eeschema/dialogs/dialog_print_using_printer.cpp index 779569bca6..8b8ce244ae 100644 --- a/eeschema/dialogs/dialog_print_using_printer.cpp +++ b/eeschema/dialogs/dialog_print_using_printer.cpp @@ -2,7 +2,7 @@ * 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-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 * 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 ) ) 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; } @@ -446,9 +430,6 @@ void SCH_PRINTOUT::PrintPage( SCH_SCREEN* aScreen ) 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 // not be centered on X or Y axis. Give a draw offset to center the schematic page on the // paper draw area. diff --git a/eeschema/eeschema_config.cpp b/eeschema/eeschema_config.cpp index 8f36a83391..14249ed71c 100644 --- a/eeschema/eeschema_config.cpp +++ b/eeschema/eeschema_config.cpp @@ -74,10 +74,9 @@ void PARAM_CFG_FIELDNAMES::ReadParam( wxConfigBase* aConfig ) const { m_Pt_param->Parse( &lexer, false ); } - 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() ) ); ) } } } @@ -391,10 +390,8 @@ void SCH_BASE_FRAME::LoadSettings( APP_SETTINGS_BASE* aCfg ) { 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() ) ); ) } } } diff --git a/eeschema/lib_arc.cpp b/eeschema/lib_arc.cpp index 29d7259d15..4b0707a141 100644 --- a/eeschema/lib_arc.cpp +++ b/eeschema/lib_arc.cpp @@ -344,13 +344,7 @@ const EDA_RECT LIB_ARC::GetBoundingBox() const wxPoint normEnd = m_ArcEnd - m_Pos; 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; - } endPos = DefaultTransform.TransformCoordinate( m_ArcEnd ); startPos = DefaultTransform.TransformCoordinate( m_ArcStart ); diff --git a/eeschema/lib_pin.cpp b/eeschema/lib_pin.cpp index d5f5040a3e..3223d37019 100644 --- a/eeschema/lib_pin.cpp +++ b/eeschema/lib_pin.cpp @@ -1309,7 +1309,6 @@ void LIB_PIN::CalcEdit( const wxPoint& aPosition ) { if( IsMoving() ) { - DBG(printf("MOVEPIN\n");) MoveTo( aPosition ); } } diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp index f5cc2482a2..77b741a7a7 100644 --- a/eeschema/sch_edit_frame.cpp +++ b/eeschema/sch_edit_frame.cpp @@ -114,9 +114,8 @@ SEARCH_STACK* PROJECT::SchSearchS() { 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 ) diff --git a/eeschema/sch_sheet.cpp b/eeschema/sch_sheet.cpp index 0b3348203e..4fbabee2b1 100644 --- a/eeschema/sch_sheet.cpp +++ b/eeschema/sch_sheet.cpp @@ -301,9 +301,6 @@ void SCH_SHEET::RemovePin( SCH_SHEET_PIN* aSheetPin ) 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 ) { - wxLogDebug( wxT( "Sheet assignment operator." ) ); - wxCHECK_MSG( Type() == aItem.Type(), *this, wxT( "Cannot assign object type " ) + aItem.GetClass() + wxT( " to type " ) + GetClass() ); diff --git a/eeschema/tools/backanno.cpp b/eeschema/tools/backanno.cpp index c3807a5ab9..6702afb4eb 100644 --- a/eeschema/tools/backanno.cpp +++ b/eeschema/tools/backanno.cpp @@ -59,12 +59,6 @@ void SCH_EDITOR_CONTROL::BackAnnotateFootprints( const std::string& aChangedSetO { 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" ); wxString footprint; diff --git a/gerbview/am_param.cpp b/gerbview/am_param.cpp index a07ab9984b..7e83b20512 100644 --- a/gerbview/am_param.cpp +++ b/gerbview/am_param.cpp @@ -7,7 +7,7 @@ * * Copyright (C) 1992-2017 Jean-Pierre Charras * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck - * 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 * modify it under the terms of the GNU General Public License @@ -31,6 +31,9 @@ #include #include +#include + + extern int ReadInt( char*& text, bool aSkipSeparator = true ); extern double ReadDouble( char*& text, bool aSkipSeparator = true ); extern double Evaluate( AM_PARAM_EVAL_STACK& aExp ); @@ -116,7 +119,7 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const } 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 ) ); @@ -128,8 +131,10 @@ double AM_PARAM::GetValue( const D_CODE* aDcode ) const break; default: - wxLogDebug( "AM_PARAM::GetValue(): dcode %d prm %d/%d: unexpected type %d", - aDcode ? aDcode->m_Num_Dcode : -1, ii, m_paramStack.size(), item.GetType() ); + wxFAIL_MSG( wxString::Format( "AM_PARAM::GetValue(): dcode %d prm %d/%d: " + "unexpected type %d", + aDcode ? aDcode->m_Num_Dcode : -1, ii, + m_paramStack.size(), item.GetType() ) ); break; } } @@ -256,7 +261,7 @@ bool AM_PARAM::ReadParam( char*& aText ) break; default: - dvalue = ReadDouble( aText, false ); + dvalue = ReadDouble( aText, false ); PushOperator( PUSHVALUE, dvalue ); found = true; break; diff --git a/gerbview/am_primitive.cpp b/gerbview/am_primitive.cpp index 6d4c4588f2..77356dc25d 100644 --- a/gerbview/am_primitive.cpp +++ b/gerbview/am_primitive.cpp @@ -433,7 +433,6 @@ void AM_PRIMITIVE::DrawBasicShape( const GERBER_DRAW_ITEM* aParent, case AMP_UNKNOWN: default: - DBG( printf( "AM_PRIMITIVE::DrawBasicShape() err: unknown prim id %d\n",primitive_id) ); break; } } diff --git a/gerbview/gerbview_frame.cpp b/gerbview/gerbview_frame.cpp index 065d4833be..f4ea30ce51 100644 --- a/gerbview/gerbview_frame.cpp +++ b/gerbview/gerbview_frame.cpp @@ -260,7 +260,6 @@ bool GERBVIEW_FRAME::OpenProjectFiles( const std::vector& aFileSet, in if( !wxFileExists( path ) && wxDirExists( path ) ) { - wxLogDebug( wxT( "MRU path: %s." ), GetChars( path ) ); m_mruPath = path; return true; } @@ -455,7 +454,8 @@ void GERBVIEW_FRAME::SetElementVisibility( int aLayerID, bool aNewState ) break; default: - wxLogDebug( wxT( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d" ), aLayerID ); + wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetElementVisibility(): bad arg %d", + aLayerID ) ); } if( dcodes_changed ) @@ -759,7 +759,7 @@ bool GERBVIEW_FRAME::IsElementVisible( int aLayerID ) const case LAYER_GERBVIEW_BACKGROUND: return true; default: - wxLogDebug( wxT( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d" ), aLayerID ); + wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::IsElementVisible(): bad arg %d", aLayerID ) ); } return true; @@ -821,7 +821,8 @@ COLOR4D GERBVIEW_FRAME::GetVisibleElementColor( int aLayerID ) break; default: - wxLogDebug( wxT( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d" ), aLayerID ); + wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::GetVisibleElementColor(): bad arg %d", + aLayerID ) ); } return color; @@ -865,7 +866,8 @@ void GERBVIEW_FRAME::SetVisibleElementColor( int aLayerID, COLOR4D aColor ) break; default: - wxLogDebug( wxT( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d" ), aLayerID ); + wxFAIL_MSG( wxString::Format( "GERBVIEW_FRAME::SetVisibleElementColor(): bad arg %d", + aLayerID ) ); } } diff --git a/include/tool/examples/delegate_example.cpp b/include/tool/examples/delegate_example.cpp index 3d3c7829a3..a7d1c815f6 100644 --- a/include/tool/examples/delegate_example.cpp +++ b/include/tool/examples/delegate_example.cpp @@ -8,8 +8,6 @@ class MyClass public: 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(); } }; @@ -29,6 +27,5 @@ main() retval1 = ptr1( "apples" ); retval2 = ptr2( "cherries" ); - printf( "Object 1 returned %d, object 2 returned %d\n", retval1, retval2 ); return 0; } diff --git a/libs/kimath/src/geometry/shape_file_io.cpp b/libs/kimath/src/geometry/shape_file_io.cpp index a9e9a4af70..7c4f1796eb 100644 --- a/libs/kimath/src/geometry/shape_file_io.cpp +++ b/libs/kimath/src/geometry/shape_file_io.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2013 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * * 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); - printf("create shape %d\n", type); - switch(type) { case SHAPE::LINE_CHAIN: diff --git a/libs/kimath/src/md5_hash.cpp b/libs/kimath/src/md5_hash.cpp index 44b1ba2da1..db2f7c9f35 100644 --- a/libs/kimath/src/md5_hash.cpp +++ b/libs/kimath/src/md5_hash.cpp @@ -58,7 +58,6 @@ MD5_HASH& MD5_HASH::operator=( const MD5_HASH& aOther ) void MD5_HASH::Init() { - //printf("%p init\n", this); m_valid = false; md5_init(&m_ctx); } @@ -75,7 +74,6 @@ void MD5_HASH::Hash ( int value ) void MD5_HASH::Finalize() { - //printf("%p final\n", this); md5_final(&m_ctx, m_hash); m_valid = true; diff --git a/pcbnew/autorouter/ar_autoplacer.cpp b/pcbnew/autorouter/ar_autoplacer.cpp index 21522e32c6..e53d9e6eed 100644 --- a/pcbnew/autorouter/ar_autoplacer.cpp +++ b/pcbnew/autorouter/ar_autoplacer.cpp @@ -5,7 +5,7 @@ * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh * - * 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 * 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 ); testRectangle( fpBBox, side ); -//printf("test %p diag %d\n", aModule, diag);fflush(0); + if( diag != AR_FREE_CELL ) return diag; @@ -731,8 +731,6 @@ double AR_AUTOPLACER::computePlacementRatsnestCost( MODULE *aModule, const wxPoi if( !nearest ) 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); end = VECTOR2I( nearest->GetPosition() ); @@ -893,8 +891,6 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector aModules, memopos = m_curPosition; - //printf("set grid: %d\n", m_gridSize); - m_matrix.m_GridRouting = m_gridSize; //(int) m_frame->GetScreen()->GetGridSize().x; // Ensure Board.m_GridRouting has a reasonable value: @@ -984,8 +980,6 @@ AR_RESULT AR_AUTOPLACER::AutoplaceModules( std::vector aModules, // Try orientations 90, 180, 270 degrees from initial orientation rotAllowed = module->GetPlacementCost180(); - //printf("rotAllowed %d\n", rotAllowed); - if( rotAllowed != 0 ) { rotateModule( module, 1800.0, true ); @@ -1063,7 +1057,6 @@ end_of_tst: if( bestRotation != module->GetOrientation() ) { - //printf("best rotation %d\n", bestRotation ); rotateModule( module, bestRotation, false ); } diff --git a/pcbnew/autorouter/ar_matrix.cpp b/pcbnew/autorouter/ar_matrix.cpp index 4e3b4f1e85..7efcc17d2b 100644 --- a/pcbnew/autorouter/ar_matrix.cpp +++ b/pcbnew/autorouter/ar_matrix.cpp @@ -5,7 +5,7 @@ * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2011 Wayne Stambaugh * - * 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 * 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; - - //printf("segmQcq %d %d %d %d\n", ux0, uy0, ux1, uy1); - SetCellOperation( op_logic ); // 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 - - //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++ ) { int64_t cxr; @@ -797,8 +791,6 @@ void AR_MATRIX::TraceSegmentPcb( int ux1 = pt_segm->GetEnd().x - GetBrdCoordOrigin().x; 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 switch( pt_segm->GetShape() ) diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index 66025fc145..69621b990d 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KICAD, a free EDA CAD application. * * Copyright (C) 2016-2018 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Tomasz Wlostowski * * 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() { -#ifdef CONNECTIVITY_DEBUG - printf("Search start\n"); -#endif - #ifdef PROFILE PROF_COUNTER garbage_collection( "garbage-collection" ); #endif @@ -282,11 +280,6 @@ void CN_CONNECTIVITY_ALGO::searchConnections() #endif 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(); } ); -#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; } diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index e042cb096b..99c476a287 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -150,12 +150,12 @@ const VECTOR2I CN_ITEM::GetAnchor( int n ) const void CN_ITEM::Dump() { - printf(" valid: %d, connected: \n", !!Valid()); + wxLogDebug(" valid: %d, connected: \n", !!Valid()); for( auto i : m_connected ) { TRACK* t = static_cast( i->Parent() ); - printf( " - %p %d\n", t, t->Type() ); + wxLogDebug( " - %p %d\n", t, t->Type() ); } } @@ -449,8 +449,8 @@ void CN_CLUSTER::Dump() { wxLogTrace( "CN", " - item : %p bitem : %p type : %d inet %s\n", item, item->Parent(), item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() ); - printf( "- item : %p bitem : %p type : %d inet %s\n", item, item->Parent(), - item->Parent()->Type(), (const char*) item->Parent()->GetNetname().c_str() ); + 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->Dump(); } } diff --git a/pcbnew/eagle_plugin.cpp b/pcbnew/eagle_plugin.cpp index cebbc6c0fd..e09316282f 100644 --- a/pcbnew/eagle_plugin.cpp +++ b/pcbnew/eagle_plugin.cpp @@ -537,14 +537,6 @@ void EAGLE_PLUGIN::loadLayerDefs( wxXmlNode* aLayers ) } } -#if 0 && defined(DEBUG) - printf( "m_cu_map:\n" ); - for( unsigned i=0; iGetName() != "element" ) { - wxLogDebug( "expected: read <%s>. Skip it", element->GetName() ); // Get next item element = element->GetNext(); continue; @@ -1115,7 +1106,6 @@ void EAGLE_PLUGIN::loadElements( wxXmlNode* aElements ) { if( attribute->GetName() != "attribute" ) { - wxLogDebug( "expected: read <%s>. Skip it", attribute->GetName() ); attribute = attribute->GetNext(); continue; } @@ -2431,8 +2421,6 @@ void EAGLE_PLUGIN::loadSignals( wxXmlNode* aSignals ) const wxString& pad = netItem->GetAttribute( "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_xpath->pop(); @@ -2579,9 +2567,6 @@ void EAGLE_PLUGIN::centerBoard() int desired_x = ( w - bbbox.GetWidth() ) / 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() ) ); } } diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 7bf95e697e..cefd83bb4c 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2016 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2015 Wayne Stambaugh - * 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 * 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; default: - wxLogDebug( wxT( "PCB_EDIT_FRAME::Process_Special_Functions() unknown event id %d" ), id ); break; } } diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index f3dc5430bc..c21a94dee6 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -2,7 +2,7 @@ * 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) 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 * 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; default: - wxLogDebug( wxT( "PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event() error") ); break; } } diff --git a/pcbnew/exporters/export_vrml.cpp b/pcbnew/exporters/export_vrml.cpp index e738eee8ce..5734f8ddb8 100644 --- a/pcbnew/exporters/export_vrml.cpp +++ b/pcbnew/exporters/export_vrml.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2009-2013 Lorenzo Mercantonio * Copyright (C) 2014-2017 Cirilo Bernardo * 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 * 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 ) { - wxLogDebug( "Copying 3D model %s to %s.", - GetChars( srcFile.GetFullPath() ), - GetChars( dstFile.GetFullPath() ) ); - wxString fileExt = srcFile.GetExt(); 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 ) ) { -#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; } 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)" ) ); } @@ -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 ) || 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; } if( ( idxPlane.size() % 3 ) || ( idxSide.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)" ) ); } std::vector< SGPOINT > vlist; diff --git a/pcbnew/files.cpp b/pcbnew/files.cpp index a4ad14d085..cce22b19fc 100644 --- a/pcbnew/files.cpp +++ b/pcbnew/files.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2011 Wayne Stambaugh - * 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 * 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: - wxLogDebug( wxT( "File_io Internal Error" ) ); return false; } } diff --git a/pcbnew/footprint_editor_utils.cpp b/pcbnew/footprint_editor_utils.cpp index 8488ab15af..f47a2f645a 100644 --- a/pcbnew/footprint_editor_utils.cpp +++ b/pcbnew/footprint_editor_utils.cpp @@ -1,7 +1,7 @@ /* * 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 * 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; default: - wxLogDebug( wxT( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ) ); + wxFAIL_MSG( "FOOTPRINT_EDIT_FRAME::Process_Special_Functions error" ); break; } } @@ -345,8 +345,8 @@ void FOOTPRINT_EDIT_FRAME::editFootprintProperties( MODULE* aModule ) BASIC_FOOTPRINT_INFO footprintInfo( aModule ); wxDataViewItem treeItem = m_adapter->FindItem( oldFPID ); - if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported from file - // therefore not yet in tree. + if( treeItem.IsOk() ) // Can be not found in tree if the current footprint is imported + // from file therefore not yet in tree. { static_cast( treeItem.GetID() )->Update( &footprintInfo ); m_treePane->GetLibTree()->RefreshLibTree(); diff --git a/pcbnew/footprint_wizard_frame_functions.cpp b/pcbnew/footprint_wizard_frame_functions.cpp index 6e432dc940..7974b8b1e4 100644 --- a/pcbnew/footprint_wizard_frame_functions.cpp +++ b/pcbnew/footprint_wizard_frame_functions.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2012 Miguel Angel Ajo Pelayo, miguelangel@nbee.es * 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 * 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; default: - wxLogDebug( wxT( "FOOTPRINT_WIZARD_FRAME::Process_Special_Functions error: id = %d" ), - event.GetId() ); + wxFAIL_MSG( wxString::Format( + "FOOTPRINT_WIZARD_FRAME::Process_Special_Functions error: id = %d", + event.GetId() ) ); break; } } @@ -113,10 +114,6 @@ void FOOTPRINT_WIZARD_FRAME::ReloadFootprint() GetBoard()->Add( module, ADD_MODE::APPEND ); module->SetPosition( wxPoint( 0, 0 ) ); } - else - { - DBG(printf( "footprintWizard->GetFootprint() returns NULL\n" );) - } updateView(); GetCanvas()->Refresh(); diff --git a/pcbnew/github/github_getliblist.cpp b/pcbnew/github/github_getliblist.cpp index 25dcaf1749..0667d66ab2 100644 --- a/pcbnew/github/github_getliblist.cpp +++ b/pcbnew/github/github_getliblist.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2015 Jean-Pierre Charras jp.charras at wanadoo.fr * Copyright (C) 2013 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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; - wxLogDebug( wxT( "Attempting to download: " ) + aFullURLCommand ); - kcurl.SetURL( aFullURLCommand ); kcurl.SetUserAgent( "http://kicad-pcb.org" ); kcurl.SetHeader( "Accept", m_option_string ); diff --git a/pcbnew/github/github_plugin.cpp b/pcbnew/github/github_plugin.cpp index 1126da485c..041fdb90d3 100644 --- a/pcbnew/github/github_plugin.cpp +++ b/pcbnew/github/github_plugin.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2015 SoftPLC Corporation, Dick Hollenbeck - * 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 * modify it under the terms of the GNU General Public License @@ -142,7 +142,6 @@ void GITHUB_PLUGIN::FootprintEnumerate( wxArrayString& aFootprintNames, const wx { try { - //D(printf("%s: this:%p aLibPath:\"%s\"\n", __func__, this, TO_UTF8(aLibraryPath) );) cacheLib( aLibPath, aProperties ); typedef std::set MYSET; @@ -188,8 +187,6 @@ void GITHUB_PLUGIN::PrefetchLib( MODULE* GITHUB_PLUGIN::FootprintLoad( const wxString& aLibraryPath, 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 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. 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(); // 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 ) { // e.g. "https://github.com/liftoff-sr/pretty_footprints" - //D(printf("aRepoURL:%s\n", TO_UTF8( aRepoURL ) );) wxURI repo( aRepoURL ); @@ -565,8 +560,6 @@ void GITHUB_PLUGIN::remoteGetZip( const wxString& aRepoURL ) THROW_IO_ERROR( msg ); } - wxLogDebug( wxT( "Attempting to download: " ) + zip_url ); - KICAD_CURL_EASY kcurl; // this can THROW_IO_ERROR kcurl.SetURL( zip_url.c_str() ); diff --git a/pcbnew/layer_widget.cpp b/pcbnew/layer_widget.cpp index 34119f3858..9cf2130416 100644 --- a/pcbnew/layer_widget.cpp +++ b/pcbnew/layer_widget.cpp @@ -3,7 +3,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2010 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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 ) { 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 ) { 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: @@ -868,36 +866,29 @@ class MYFRAME : public wxFrame void OnLayerColorChange( int aLayer, COLOR4D aColor ) { - printf( "OnLayerColorChange( aLayer:%d, aColor:%d )\n", aLayer, aColor ); - /* a test trigger only if( aLayer == 2 ) { ClearLayerRows(); - printf(" GetLayerRowCount(): %d\n", GetLayerRowCount() ); } */ } bool OnLayerSelect( LAYER_NUM aLayer ) { - printf( "OnLayerSelect( aLayer:%d )\n", aLayer ); return true; } 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 ) { - printf( "OnRenderColorChange( aId:%d, aColor:%d )\n", aId, aColor ); } void OnRenderEnable( int aId, bool isEnabled ) { - printf( "OnRenderEnable( aId:%d, isEnabled:%d )\n", aId, isEnabled ); } }; diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 764b5396e3..bcff9f26dc 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -222,7 +222,6 @@ static inline char* ReadLine( LINE_READER* rdr, const char* caller ) char* ret = rdr->ReadLine(); const char* line = rdr->Line(); - printf( "%-6u %s: %s", rdr->LineNumber(), caller, line ); #if 0 // trap if( !strcmp( "loadSETUP", caller ) && !strcmp( "$EndSETUP\n", line ) ) @@ -611,7 +610,6 @@ void LEGACY_PLUGIN::loadGENERAL() LEG_MASK enabledLayers = hexParse( line + SZ( "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 ); // layer visibility equals layer usage, unless overridden later via "VisibleLayers" diff --git a/pcbnew/load_select_footprint.cpp b/pcbnew/load_select_footprint.cpp index 2ee55f8bcf..1086dd0901 100644 --- a/pcbnew/load_select_footprint.cpp +++ b/pcbnew/load_select_footprint.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2018 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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 ); } - 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 ) @@ -296,10 +293,8 @@ MODULE* PCB_BASE_FRAME::LoadFootprint( const LIB_ID& 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; @@ -317,10 +312,8 @@ MODULE* PCB_BASE_FRAME::loadFootprint( const LIB_ID& 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, diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index c1b8e59bd2..820ddaf0a2 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -1,7 +1,7 @@ /* * 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 * modify it under the terms of the GNU General Public License @@ -172,10 +172,10 @@ void NETINFO_LIST::Show() const NETNAMES_MAP::const_iterator it, itEnd; for( it = m_netNames.begin(), itEnd = m_netNames.end(); it != itEnd; ++it ) { - printf( "[%d]: netcode:%d netname:<%s>\n", - i++, - it->second->GetNet(), - TO_UTF8( it->second->GetNetname() ) ); + wxLogDebug( "[%d]: netcode:%d netname:<%s>\n", + i++, + it->second->GetNet(), + TO_UTF8( it->second->GetNetname() ) ); } } #endif diff --git a/pcbnew/netlist_reader/kicad_netlist_reader.cpp b/pcbnew/netlist_reader/kicad_netlist_reader.cpp index 0ebb0d7d70..a29a5f3c4f 100644 --- a/pcbnew/netlist_reader/kicad_netlist_reader.cpp +++ b/pcbnew/netlist_reader/kicad_netlist_reader.cpp @@ -168,8 +168,8 @@ void KICAD_NETLIST_PARSER::Parse() if( plevel != 0 ) { - wxLogDebug( wxT( "KICAD_NETLIST_PARSER::Parse(): bad parenthesis count (count = %d"), - plevel ); + wxFAIL_MSG( wxString::Format( "KICAD_NETLIST_PARSER::Parse(): bad parenthesis " + "count (count = %d", plevel ) ); } } diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 3930cab220..43a0d7ffcd 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -252,14 +252,11 @@ LIBEVAL::VALUE PCB_EXPR_VAR_REF::GetValue( LIBEVAL::CONTEXT* aCtx ) if( !m_isEnum ) { - //printf("item %p Get string '%s'\n", item, (const char*) it->second->Name().c_str() ); - str = item->Get( it->second ); } else { const wxAny& any = item->Get( it->second ); any.GetAs( &str ); - //printf("item %p get enum: '%s'\n", item , (const char*) str.c_str() ); } return LIBEVAL::VALUE( str ); @@ -310,7 +307,6 @@ std::unique_ptr PCB_EXPR_UCODE::CreateVarRef( const wxString& 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 ); if( prop->TypeHash() == TYPE_HASH( int ) ) diff --git a/pcbnew/pcb_parser.cpp b/pcbnew/pcb_parser.cpp index 55b74c5625..efcf8c5ef6 100644 --- a/pcbnew/pcb_parser.cpp +++ b/pcbnew/pcb_parser.cpp @@ -99,21 +99,6 @@ void PCB_PARSER::init() 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; default: // Skip everything but the board thickness. - //wxLogDebug( wxT( "Skipping general section token %s " ), GetChars( GetTokenString( token ) ) ); - while( ( token = NextTok() ) != T_RIGHT ) { if( !IsSymbol( token ) && token != T_NUMBER ) @@ -1467,15 +1450,6 @@ T PCB_PARSER::lookUpLayer( const M& aMap ) 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 ); return Rescue; } diff --git a/pcbnew/pcbnew_config.cpp b/pcbnew/pcbnew_config.cpp index ec01102bfa..796e482a3f 100644 --- a/pcbnew/pcbnew_config.cpp +++ b/pcbnew/pcbnew_config.cpp @@ -4,7 +4,7 @@ * Copyright (C) 2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2012 Wayne Stambaugh - * 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 * 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() { - wxLogDebug( wxT( "Loading project '%s' settings." ), GetChars( Prj().GetProjectFullName() ) ); - PROJECT_FILE& project = Prj().GetProjectFile(); PROJECT_LOCAL_SETTINGS& localSettings = Prj().GetLocalSettings(); diff --git a/pcbnew/router/pns_component_dragger.cpp b/pcbnew/router/pns_component_dragger.cpp index de555523b9..5aa3d21b45 100644 --- a/pcbnew/router/pns_component_dragger.cpp +++ b/pcbnew/router/pns_component_dragger.cpp @@ -69,9 +69,6 @@ bool COMPONENT_DRAGGER::Start( const VECTOR2I& aP, ITEM_SET& aPrimitives ) 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; 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; } diff --git a/pcbnew/router/pns_line.cpp b/pcbnew/router/pns_line.cpp index 926ce0645b..389986aa30 100644 --- a/pcbnew/router/pns_line.cpp +++ b/pcbnew/router/pns_line.cpp @@ -173,12 +173,6 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, 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++ ) { 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); if( so.Contains( a ) ) { - // printf("discard seg %d\n", i ); over = true; 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 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 { for( int j = 0; j < aObstacle.SegmentCount(); j++ ) @@ -222,17 +212,13 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, else 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; ip.our = a; ip.their = aObstacle.CSegment(j); ip.p = *p; ips.push_back(ip); - //printf("chb %d %d\n", p->x, p->y); } } } @@ -261,14 +247,14 @@ bool LINE::Walkaround( SHAPE_LINE_CHAIN aObstacle, SHAPE_LINE_CHAIN& aPre, const SEG& os = aObstacle.CSegment(j); auto p = os.Intersect(a); - if(p) + + if( p ) { SHAPE_LINE_CHAIN::INTERSECTION ip; ip.our = a; ip.their = aObstacle.CSegment(j); ip.p = *p; ips.push_back(ip); - // printf("gif %d %d\n", p->x, p->y); } } diff --git a/pcbnew/router/pns_optimizer.cpp b/pcbnew/router/pns_optimizer.cpp index dde5660528..b31994cfa5 100644 --- a/pcbnew/router/pns_optimizer.cpp +++ b/pcbnew/router/pns_optimizer.cpp @@ -1019,7 +1019,6 @@ bool OPTIMIZER::Optimize( LINE* aLine, int aEffortLevel, NODE* aWorld, const VEC { auto c = new PRESERVE_VERTEX_CONSTRAINT( aWorld, aV ); opt.AddConstraint( c ); - //printf("pres-v %d %d\n", aV.x, aV.y ); } if ( aEffortLevel & KEEP_TOPOLOGY ) @@ -1372,15 +1371,12 @@ bool tightenSegment( bool dir, NODE *aNode, const LINE& cur, int step = initial; int current = step; - //printf("step %d\n", step); SHAPE_LINE_CHAIN snew; while (step > 1) { LINE l ( cur ); - - //printf("current %d l %d\n", current, guide.Length() ); snew.Clear(); snew.Append( a.A ); snew.Append( a.B + (a.A - a.B).Resize( current ) ); diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 2fae50c730..5649764b2b 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * 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 * * This program is free software: you can redistribute it and/or modify it @@ -238,7 +238,7 @@ SHOVE::SHOVE_STATUS SHOVE::processHullSet( LINE& aCurrent, LINE& aObstacle, #ifdef DEBUG char str[128]; - sprintf(str,"att-%d-shoved", attempt); + sprintf( str, "att-%d-shoved", attempt ); Dbg()->AddLine( l.CLine(), 3, 20000, str ); #endif @@ -322,7 +322,7 @@ SHOVE::SHOVE_STATUS SHOVE::ProcessSingleLine( LINE& aCurrent, LINE& aObstacle, L #ifdef DEBUG char str[128]; - sprintf(str,"current-cl-%d", clearance ); + sprintf( str, "current-cl-%d", clearance ); Dbg()->AddLine( aCurrent.CLine(), 5, 20000, str ); #endif diff --git a/pcbnew/router/pns_walkaround.cpp b/pcbnew/router/pns_walkaround.cpp index 860166b1e7..4acd3c893d 100644 --- a/pcbnew/router/pns_walkaround.cpp +++ b/pcbnew/router/pns_walkaround.cpp @@ -2,7 +2,7 @@ * KiRouter - a push-and-(sometimes-)shove PCB router * * 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 * * This program is free software: you can redistribute it and/or modify it @@ -169,17 +169,17 @@ bool clipToLoopStart( SHAPE_LINE_CHAIN& l ) auto tail = l.Slice(pidx + 1, -1); int pidx2 = tail.Split( ip->p ); - + auto dbg = ROUTER::GetInstance()->GetInterface()->GetDebugDecorator(); dbg->AddPoint( ip->p, 5 ); - + l = lead; l.Append( tail.Slice( 0, pidx2 ) ); //l = l.Slice(0, pidx); return true; } - + } @@ -225,27 +225,19 @@ const WALKAROUND::RESULT WALKAROUND::Route( const LINE& aInitialPath ) if( s_ccw != STUCK ) 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(); if( clipToLoopStart( path_cw.Line() )) { - //printf("ClipCW\n"); - //Dbg()->AddLine( old, 1, 40000 ); s_cw = ALMOST_DONE; } if( clipToLoopStart( path_ccw.Line() )) { - //printf("ClipCCW\n"); s_ccw = ALMOST_DONE; } - + if( s_cw != IN_PROGRESS ) { result.lineCw = path_cw; diff --git a/pcbnew/specctra_import_export/specctra.cpp b/pcbnew/specctra_import_export/specctra.cpp index b890961a72..9e619dde5e 100644 --- a/pcbnew/specctra_import_export/specctra.cpp +++ b/pcbnew/specctra_import_export/specctra.cpp @@ -3,7 +3,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007-2011 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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 ) { - // printf( "PADSTACK::Compare( %p, %p)\n", lhs, rhs ); - if( !lhs->hash.size() ) lhs->hash = lhs->makeHash(); @@ -3596,8 +3594,6 @@ int IMAGE::Compare( IMAGE* lhs, IMAGE* rhs ) int result = lhs->hash.compare( rhs->hash ); - // printf("\"%s\" \"%s\" ret=%d\n", lhs->hash.c_str(), rhs->hash.c_str(), result ); - return result; } diff --git a/pcbnew/specctra_import_export/specctra_export.cpp b/pcbnew/specctra_import_export/specctra_export.cpp index 02b7f89e75..e9faab9215 100644 --- a/pcbnew/specctra_import_export/specctra_export.cpp +++ b/pcbnew/specctra_import_export/specctra_export.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2007-2015 SoftPLC Corporation, Dick Hollenbeck - * 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 * 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_ARC: default: - DBG( printf( "makeIMAGE(): unsupported shape %s\n", - TO_UTF8( BOARD_ITEM::ShowShape( graphic->GetShape() ) ) ); ) continue; } } diff --git a/pcbnew/tools/pcbnew_control.cpp b/pcbnew/tools/pcbnew_control.cpp index 9cbb3f48d8..b43aaad411 100644 --- a/pcbnew/tools/pcbnew_control.cpp +++ b/pcbnew/tools/pcbnew_control.cpp @@ -636,7 +636,6 @@ int PCBNEW_CONTROL::Paste( const TOOL_EVENT& aEvent ) if( editModules && ( !board() || !module() ) ) { - wxLogDebug( wxT( "Attempting to paste to empty module editor window\n") ); return 0; } diff --git a/pcbnew/tools/pcbnew_picker_tool.cpp b/pcbnew/tools/pcbnew_picker_tool.cpp index 9313899886..b59b23911f 100644 --- a/pcbnew/tools/pcbnew_picker_tool.cpp +++ b/pcbnew/tools/pcbnew_picker_tool.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * * 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)(); } - 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 ); } - catch( std::exception& e ) + catch( std::exception& ) { - std::cerr << "PCBNEW_PICKER_TOOL clickHandler error: " << e.what() << std::endl; finalize_state = EXCEPTION_CANCEL; break; } @@ -120,9 +118,8 @@ int PCBNEW_PICKER_TOOL::Main( const TOOL_EVENT& aEvent ) { (*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 ); } - catch( std::exception& e ) + catch( std::exception& ) { - std::cerr << "PCBNEW_PICKER_TOOL finalizeHandler error: " << e.what() << std::endl; } } diff --git a/pcbnew/undo_redo.cpp b/pcbnew/undo_redo.cpp index f6d08317a1..c4a5afaa50 100644 --- a/pcbnew/undo_redo.cpp +++ b/pcbnew/undo_redo.cpp @@ -5,7 +5,7 @@ * Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck * Copyright (C) 2016 CERN * @author Maciej Suminski - * 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 * 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: { - wxLogDebug( wxT( "SaveCopyInUndoList() error (unknown code %X)" ), command ); + wxFAIL_MSG( wxString::Format( "SaveCopyInUndoList() error (unknown code %X)", + command ) ); } break; @@ -569,8 +570,8 @@ void PCB_BASE_EDIT_FRAME::PutDataInPreviousState( PICKED_ITEMS_LIST* aList, bool break; default: - wxLogDebug( wxT( "PutDataInPreviousState() error (unknown code %X)" ), - aList->GetPickedItemStatus( ii ) ); + wxFAIL_MSG( wxString::Format( "PutDataInPreviousState() error (unknown code %X)", + aList->GetPickedItemStatus( ii ) ) ); break; } } diff --git a/qa/common_tools/tools/coroutines/coroutines.cpp b/qa/common_tools/tools/coroutines/coroutines.cpp index eafb97b4db..011f168f64 100644 --- a/qa/common_tools/tools/coroutines/coroutines.cpp +++ b/qa/common_tools/tools/coroutines/coroutines.cpp @@ -1,7 +1,7 @@ /* * 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 * modify it under the terms of the GNU General Public License @@ -53,12 +53,8 @@ public: 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++ ) { - printf( "%s: Yielding %d\n", __FUNCTION__, i ); m_cofunc->KiYield( i ); } @@ -68,16 +64,12 @@ public: void Run() { m_cofunc = std::make_unique( this, &CoroutineExample::CountTo ); - printf( "%s: Calling coroutine that will count from 1 to 5.\n", __FUNCTION__ ); m_cofunc->Call( m_count ); while( m_cofunc->Running() ) { - printf( "%s: Got value: %d\n", __FUNCTION__, m_cofunc->ReturnValue() ); m_cofunc->Resume(); } - - printf( "%s: Done!\n", __FUNCTION__ ); } std::unique_ptr m_cofunc; @@ -137,4 +129,4 @@ static bool registered = UTILITY_REGISTRY::Register( { "coroutine", "Test a simple coroutine", coroutine_main_func, -} ); \ No newline at end of file +} ); diff --git a/qa/drc_proto/drc_clearance_test_functions.cpp b/qa/drc_proto/drc_clearance_test_functions.cpp index 726f419869..591a8b3a5e 100644 --- a/qa/drc_proto/drc_clearance_test_functions.cpp +++ b/qa/drc_proto/drc_clearance_test_functions.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2004-2019 Jean-Pierre Charras, jp.charras at wanadoo.fr * 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 * 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; default: - wxLogDebug( wxT( "DRC::checkClearancePadToPad: unexpected pad shape %d" ), aPad->GetShape() ); break; } } diff --git a/qa/drc_proto/drc_engine.cpp b/qa/drc_proto/drc_engine.cpp index 0d3bfa236c..e318c7ac7d 100644 --- a/qa/drc_proto/drc_engine.cpp +++ b/qa/drc_proto/drc_engine.cpp @@ -43,24 +43,25 @@ void drcPrintDebugMessage( int level, wxString msg, const char *function, int li if( wxGetEnv( "DRC_DEBUG", &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_designSettings ( aSettings ), m_reporter( nullptr ), m_progressReporter( nullptr ) - { +{ + +} - } test::DRC_ENGINE::~DRC_ENGINE() { } + test::DRC_REPORT::~DRC_REPORT() { for( auto item : m_entries ) @@ -70,6 +71,7 @@ test::DRC_REPORT::~DRC_REPORT() } } + /*void test::DRC_ENGINE::AddMarker( MARKER_PCB* aMarker ) { if( m_designSettings->Ignore( aMarker->GetRCItem()->GetErrorCode() ) ) @@ -81,9 +83,10 @@ test::DRC_REPORT::~DRC_REPORT() m_markers.push_back( aMarker ); }*/ + bool test::DRC_ENGINE::LoadRules( wxFileName aPath ) { - + if( aPath.FileExists() ) { m_ruleConditions.clear(); @@ -237,7 +240,7 @@ const test::DRC_CONSTRAINT& test::DRC_ENGINE::EvalRulesForItems( test::DRC_CONST if( rcond->conditions.size() == 0 ) // uconditional { drc_dbg( 8, " -> rule '%s' matches (unconditional)\n", - rcond->constraint.GetParentRule()->GetName() + rcond->constraint.GetParentRule()->GetName() ); return rcond->constraint; } @@ -265,10 +268,10 @@ const test::DRC_CONSTRAINT& test::DRC_ENGINE::EvalRulesForItems( test::DRC_CONST void test::DRC_ENGINE::Report( std::shared_ptr aItem, ::MARKER_PCB *aMarker ) { m_drcReport->AddItem( aItem, aMarker ); - + if( m_reporter ) { - m_reporter->Report ( wxString::Format( "Test '%s': violation of rule '%s' : %s (code %d)", + m_reporter->Report ( wxString::Format( "Test '%s': violation of rule '%s' : %s (code %d)", aItem->GetViolatingTest()->GetName(), aItem->GetViolatingRule()->GetName(), aItem->GetErrorMessage(), @@ -301,14 +304,16 @@ void test::DRC_ENGINE::ReportProgress( double aProgress ) m_progressReporter->SetCurrentProgress( aProgress ); } + void test::DRC_ENGINE::ReportStage ( const wxString& aStageName, int index, int total ) { if( !m_progressReporter ) return; - m_progressReporter->BeginPhase( index ); // fixme: coalesce all stages/test providers + m_progressReporter->BeginPhase( index ); // fixme: coalesce all stages/test providers } + #if 0 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 + std::vector test::DRC_ENGINE::QueryConstraintsById( test::DRC_CONSTRAINT_TYPE_T constraintID ) { std::vector rv; diff --git a/qa/drc_proto/drc_proto_test.cpp b/qa/drc_proto/drc_proto_test.cpp index ade7ef0676..0d081b5023 100644 --- a/qa/drc_proto/drc_proto_test.cpp +++ b/qa/drc_proto/drc_proto_test.cpp @@ -53,11 +53,10 @@ int main( int argc, char *argv[] ) } catch( PARSE_ERROR& err ) { - printf("Can't load DRC rules: %s\n", (const char*) err.What().c_str() ); return -1; } drcEngine.RunTests(); return 0; -} \ No newline at end of file +} diff --git a/qa/eeschema/test_sch_symbol.cpp b/qa/eeschema/test_sch_symbol.cpp index 759e94e79f..ffbd399aec 100644 --- a/qa/eeschema/test_sch_symbol.cpp +++ b/qa/eeschema/test_sch_symbol.cpp @@ -66,18 +66,14 @@ BOOST_AUTO_TEST_CASE( Orientation ) { 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 ); 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.SetOrientation( CMP_ORIENT_180 ); 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.SetOrientation( CMP_ORIENT_270 ); t = m_symbol.GetTransform(); - wxLogDebug( "Angle 270: x1 = %d, y1 = %d, x2 = %d, y2 = %d", t.x1, t.y1, t.x2, t.y2 ); } diff --git a/qa/libeval_compiler/libeval_compiler_test.cpp b/qa/libeval_compiler/libeval_compiler_test.cpp index e0f74857aa..cac3407d74 100644 --- a/qa/libeval_compiler/libeval_compiler_test.cpp +++ b/qa/libeval_compiler/libeval_compiler_test.cpp @@ -27,11 +27,11 @@ bool testEvalExpr( const std::string expr, LIBEVAL::VALUE expectedResult, bool e { if ( expectError ) { - printf("result: OK (expected parse error)\n"); ok = true; return ok; - } else { - printf("result: FAIL: %s\n", compiler.GetErrorStatus().Format().c_str() ); + } + else + { ok = false; } } @@ -44,26 +44,6 @@ bool testEvalExpr( const std::string expr, LIBEVAL::VALUE expectedResult, bool e 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; } @@ -73,7 +53,7 @@ bool EvaluatePCBExpression( const std::string& aExpr, int& aResult ) PCB_EXPR_UCODE ucode; if( !compiler.Compile( aExpr, &ucode ) ) return false; - + auto result = ucode.Run(); return true; } @@ -83,7 +63,7 @@ int main( int argc, char *argv[] ) PROPERTY_MANAGER& propMgr = PROPERTY_MANAGER::Instance(); propMgr.Rebuild(); - + using VAL = LIBEVAL::VALUE; /* testEvalExpr( "10mm + 20 mm", VAL(30e6) ); @@ -91,7 +71,7 @@ int main( int argc, char *argv[] ) testEvalExpr( "3*7+8", VAL(3*7+8) ); testEvalExpr( "(3*7)+8", VAL(3*7+8) ); testEvalExpr( "10mm + 20)", VAL(0), true ); - */ + */ BOARD brd; @@ -99,27 +79,16 @@ int main( int argc, char *argv[] ) NETCLASSPTR netclass1( new NETCLASS("HV") ); 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 net2info = new NETINFO_ITEM( &brd, "net2", 2); - - + net1info->SetClass( netclass1 ); 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 trackB(&brd); - printf("net1 classname '%s'\n", (const char*) net1info->GetClassName().c_str() ); - trackA.SetNet( net1info ); trackB.SetNet( net2info ); @@ -128,9 +97,6 @@ int main( int argc, char *argv[] ) trackA.SetWidth( Mils2iu( 10 )); 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.type == 'Pad' && B.type == 'Pad' && (A.onLayer('F.Cu'))", VAL( 0.0 ), false, &trackA, &trackB ); return 0; diff --git a/qa/libs/kimath/geometry/test_shape_arc.cpp b/qa/libs/kimath/geometry/test_shape_arc.cpp index f107363ff3..1dbe2d7dbe 100644 --- a/qa/libs/kimath/geometry/test_shape_arc.cpp +++ b/qa/libs/kimath/geometry/test_shape_arc.cpp @@ -1,7 +1,7 @@ /* * 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 * 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 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( KI_TEST::IsBoxWithinTol, ( aArc.BBox() )( aProps.m_bbox )( pos_tol ) ); /// Collisions will be checked elsewhere. } + /** * Check an arcs geometry and other class functions */ @@ -145,6 +137,7 @@ BOOST_AUTO_TEST_CASE( NullCtor ) CheckArc( arc, null_props ); } + /** * 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; }; + struct ARC_CPA_CASE { /// The text context name @@ -172,6 +166,7 @@ struct ARC_CPA_CASE ARC_PROPERTIES m_properties; }; + static const std::vector arc_cases = { { "C(0,0) 114 + 360 degree", @@ -316,6 +311,7 @@ static const std::vector arc_cases = { }, }; + BOOST_AUTO_TEST_CASE( BasicCPAGeom ) { for( const auto& c : arc_cases ) @@ -361,6 +357,7 @@ bool ArePolylineEndPointsNearCircle( return GEOM_TEST::ArePointsNearCircle( points, aCentre, aRad, aTolEnds ); } + /** * Predicate for checking a polyline has all the segment mid points on * (near) a circle of given centre and radius diff --git a/qa/pcbnew/test_libeval_compiler.cpp b/qa/pcbnew/test_libeval_compiler.cpp index 948f26c850..604c487e0b 100644 --- a/qa/pcbnew/test_libeval_compiler.cpp +++ b/qa/pcbnew/test_libeval_compiler.cpp @@ -1,7 +1,7 @@ /* * 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 * 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 ); - printf( "Expr: '%s'\n", (const char*) expr.c_str() ); - bool error = !compiler.Compile( expr, &ucode, &preflightContext ); BOOST_CHECK_EQUAL( 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; } @@ -120,18 +116,10 @@ static bool testEvalExpr( const wxString& expr, LIBEVAL::VALUE expectedResult, if( expectedResult.GetType() == LIBEVAL::VT_NUMERIC ) { BOOST_CHECK_EQUAL( result.AsDouble(), expectedResult.AsDouble() ); - /*printf( "result: %s (got %.10f expected: %.10f)\n", - ok ? "OK" : "FAIL", - result.AsDouble(), - expectedResult.AsDouble() );*/ } else { BOOST_CHECK_EQUAL( result.AsString(), expectedResult.AsString() ); - /*printf( "result: %s (got '%ls' expected: '%ls')\n", - ok ? "OK" : "FAIL", - GetChars( result.AsString() ), - GetChars( expectedResult.AsString() ) );*/ } @@ -181,4 +169,4 @@ BOOST_AUTO_TEST_CASE( IntrospectedProperties ) } } -BOOST_AUTO_TEST_SUITE_END() \ No newline at end of file +BOOST_AUTO_TEST_SUITE_END() diff --git a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp index 9d65e023bb..7978c2d73a 100644 --- a/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp +++ b/qa/pcbnew_tools/tools/pcb_parser/pcb_parser_tool.cpp @@ -72,10 +72,8 @@ bool parse( std::istream& aStream, bool aVerbose ) duration = timer.SinceStart(); } - 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 ) @@ -166,4 +164,4 @@ int pcb_parser_main_func( int argc, char** argv ) static bool registered = UTILITY_REGISTRY::Register( - { "pcb_parser", "Parse a KiCad PCB file", pcb_parser_main_func } ); \ No newline at end of file + { "pcb_parser", "Parse a KiCad PCB file", pcb_parser_main_func } ); diff --git a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp index f91638797f..98e1ce9304 100644 --- a/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp +++ b/qa/pcbnew_tools/tools/polygon_generator/polygon_generator.cpp @@ -3,7 +3,7 @@ * * Copyright (C) 2017 CERN * @author Tomasz Wlostowski - * 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 * 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 ) { - 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; } @@ -82,8 +80,6 @@ int polygon_gererator_main( int argc, char* argv[] ) for( unsigned net = 0; net < brd->GetNetCount(); net++ ) { - printf( "net %d\n", net ); - for( auto track : brd->Tracks() ) process( track, net ); @@ -95,8 +91,6 @@ int polygon_gererator_main( int argc, char* argv[] ) for( auto zone : brd->Zones() ) process( zone, net ); - - printf( "endnet\n" ); } return KI_TEST::RET_CODES::OK; diff --git a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp index bde3cdc667..55fac96e81 100644 --- a/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp +++ b/qa/pcbnew_tools/tools/polygon_triangulation/polygon_triangulation.cpp @@ -2,6 +2,8 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 CERN + * Copyright (C) 2020 KiCad Developers, see AUTHORS.txt for contributors. + * * @author Alejandro García Montoro * * 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].next = &edgeList[ (i != lc.SegmentCount() - 1) ? i + 1 : 0 ]; - //printf("n %p\n", edgeList[i].next); } std::unordered_set queue; @@ -121,8 +122,6 @@ void unfracture( SHAPE_POLY_SET::POLYGON* aPoly, SHAPE_POLY_SET::POLYGON* aResul if( e1 > e2 ) std::swap(e1, e2); - // printf("e1 %d e2 %d\n", e1, e2 ) ; - int e1_prev = e1 - 1; if (e1_prev < 0) 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 ) queue.insert ( &edgeList[i] ); - //else - //printf("Skip %d\n", i); } auto edgeBuf = std::make_unique( lc.SegmentCount() ); @@ -164,8 +161,9 @@ aResult->clear(); auto e_first = (*queue.begin()); auto e = e_first; int cnt=0; - do { - // printf("e %p cnt %d IDX %d\n", e, cnt, e->index); + + do + { edgeBuf[cnt++] = e; e = e->next; } while( e != e_first ); @@ -175,13 +173,11 @@ aResult->clear(); for(int i = 0; i < cnt ;i++) { auto p = lc.CPoint(edgeBuf[i]->index); -// printf("append %d %d\n", p.x, p.y); outl.Append( p ); queue.erase( edgeBuf[i] ); } // 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.SetClosed(true); @@ -247,7 +243,6 @@ int polygon_triangulation_main( int argc, char *argv[] ) poly.CacheTriangulation(); (void) poly; - printf( "zone %zu/%d\n", ( areaId + 1 ), brd->GetAreaCount() ); #if 0 PROF_COUNTER unfrac("unfrac"); poly.Unfracture( SHAPE_POLY_SET::PM_FAST ); diff --git a/qa/pcbnew_utils/board_file_utils.cpp b/qa/pcbnew_utils/board_file_utils.cpp index 395bfa7084..95fc3386e7 100644 --- a/qa/pcbnew_utils/board_file_utils.cpp +++ b/qa/pcbnew_utils/board_file_utils.cpp @@ -69,10 +69,8 @@ std::unique_ptr ReadBoardItemFromStream( std::istream& aStream ) { 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; @@ -98,4 +96,4 @@ std::unique_ptr ReadBoardFromFileOrStream( return ReadItemFromStream( *in_stream ); } -} // namespace KI_TEST \ No newline at end of file +} // namespace KI_TEST diff --git a/qa/qa_utils/mocks.cpp b/qa/qa_utils/mocks.cpp index 2168c44bd7..f3b39dca88 100644 --- a/qa/qa_utils/mocks.cpp +++ b/qa/qa_utils/mocks.cpp @@ -1,7 +1,7 @@ /* * 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 * modify it under the terms of the GNU General Public License @@ -121,7 +121,6 @@ program; PGM_BASE& Pgm() { - printf("Pgm @ %p\n", &program ); return program; } diff --git a/qa/qa_utils/pcb_test_frame.cpp b/qa/qa_utils/pcb_test_frame.cpp index 24ce295d29..cf723fe394 100644 --- a/qa/qa_utils/pcb_test_frame.cpp +++ b/qa/qa_utils/pcb_test_frame.cpp @@ -1,7 +1,7 @@ /* * 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 * * 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" ), ioe.Problem() ); - printf( "%s\n", (const char*) msg.mb_str() ); return nullptr; } diff --git a/qa/qa_utils/utility_program.cpp b/qa/qa_utils/utility_program.cpp index 7fa89eac18..97a01f1301 100644 --- a/qa/qa_utils/utility_program.cpp +++ b/qa/qa_utils/utility_program.cpp @@ -103,7 +103,6 @@ int COMBINED_UTILITY::HandleCommandLine( int argc, char** argv ) const if( !func ) { - std::cerr << "Tool " << arg1 << " not found." << std::endl; return RET_CODES::UNKNOWN_TOOL; } diff --git a/utils/idftools/dxf2idf.cpp b/utils/idftools/dxf2idf.cpp index edec488474..1e55c05d27 100644 --- a/utils/idftools/dxf2idf.cpp +++ b/utils/idftools/dxf2idf.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * 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() ) { - std::cerr << "* DXF2IDF::WriteOutline(): no valid outline in file\n"; 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'; if( outline.IsCCW() ) @@ -160,7 +153,6 @@ bool DXF2IDF::WriteOutline( FILE* aFile, bool isInch ) { if( !outline.front()->IsCircle() ) { - std::cerr << "* DXF2IDF::WriteOutline(): bad outline\n"; return false; } diff --git a/utils/idftools/idf_helpers.cpp b/utils/idftools/idf_helpers.cpp index 20bd00e473..1968e23842 100644 --- a/utils/idftools/idf_helpers.cpp +++ b/utils/idftools/idf_helpers.cpp @@ -2,6 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * 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 * 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 ) { ERROR_IDF << "unterminated quote mark in line:\n"; - std::cerr << "LINE: " << aLine << "\n"; aIndex = idx; return false; } diff --git a/utils/idftools/idf_parser.cpp b/utils/idftools/idf_parser.cpp index 3eadb5a384..bd5c274b3c 100644 --- a/utils/idftools/idf_parser.cpp +++ b/utils/idftools/idf_parser.cpp @@ -732,7 +732,6 @@ void IDF3_COMP_OUTLINE_DATA::writePlaceData( std::ostream& aBoardFile, if( aPlacement == PS_INVALID ) { ERROR_IDF << "placement invalid (" << aRefDes << ":"; - std::cerr << aPlacement << "); defaulting to PLACED\n"; aPlacement = PS_PLACED; } diff --git a/utils/kicad2step/kicad2step.cpp b/utils/kicad2step/kicad2step.cpp index b7f8361cb0..ffc66a33e0 100644 --- a/utils/kicad2step/kicad2step.cpp +++ b/utils/kicad2step/kicad2step.cpp @@ -406,7 +406,6 @@ int PANEL_KICAD2STEP::RunConverter() catch( const Standard_Failure& e ) { wxString err = e.GetMessageString(); - //e.Print( std::cerr ); wxMessageBox( err, "Export Error" ); ReportMessage( wxString::Format( "\nExport Error: %s\n", err ) );