diff --git a/common/drawing_sheet/drawing_sheet_reader.cpp b/common/drawing_sheet/drawing_sheet_reader.cpp index 42c6f82a69..5791948733 100644 --- a/common/drawing_sheet/drawing_sheet_reader.cpp +++ b/common/drawing_sheet/drawing_sheet_reader.cpp @@ -31,6 +31,7 @@ #include #include #include +#include #include #include diff --git a/common/eda_item.cpp b/common/eda_item.cpp index fcfdc0e368..77a1eb5bc2 100644 --- a/common/eda_item.cpp +++ b/common/eda_item.cpp @@ -30,6 +30,7 @@ #include #include #include +#include #include diff --git a/common/gal/opengl/opengl_compositor.cpp b/common/gal/opengl/opengl_compositor.cpp index 19dcfc6956..e7016f51cd 100644 --- a/common/gal/opengl/opengl_compositor.cpp +++ b/common/gal/opengl/opengl_compositor.cpp @@ -38,6 +38,7 @@ #include #include #include +#include using namespace KIGFX; diff --git a/common/libeval_compiler/libeval_compiler.cpp b/common/libeval_compiler/libeval_compiler.cpp index 025ae3078b..f7abea35b9 100644 --- a/common/libeval_compiler/libeval_compiler.cpp +++ b/common/libeval_compiler/libeval_compiler.cpp @@ -24,6 +24,7 @@ #include #include +#include #ifdef DEBUG #include diff --git a/common/plugins/eagle/eagle_parser.cpp b/common/plugins/eagle/eagle_parser.cpp index 41c3c5cda4..aa158cf151 100644 --- a/common/plugins/eagle/eagle_parser.cpp +++ b/common/plugins/eagle/eagle_parser.cpp @@ -29,6 +29,7 @@ #include #include +#include #include #include diff --git a/common/project.cpp b/common/project.cpp index a5f530f637..0aaaf5e27c 100644 --- a/common/project.cpp +++ b/common/project.cpp @@ -21,6 +21,7 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ +#include #include #include diff --git a/common/settings/color_settings.cpp b/common/settings/color_settings.cpp index 1d609773ff..597c48163f 100644 --- a/common/settings/color_settings.cpp +++ b/common/settings/color_settings.cpp @@ -23,6 +23,7 @@ #include #include #include +#include #include "builtin_color_themes.h" diff --git a/common/settings/json_settings.cpp b/common/settings/json_settings.cpp index 435915fcc7..3ecc3385f9 100644 --- a/common/settings/json_settings.cpp +++ b/common/settings/json_settings.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include diff --git a/eeschema/CMakeLists.txt b/eeschema/CMakeLists.txt index 1bcfddc402..4783acd81a 100644 --- a/eeschema/CMakeLists.txt +++ b/eeschema/CMakeLists.txt @@ -138,6 +138,7 @@ set( EESCHEMA_WIDGETS set ( EESCHEMA_LIBEDIT_SRCS + symbol_editor/lib_logger.cpp symbol_editor/symbol_editor.cpp symbol_editor/symbol_editor_plotter.cpp symbol_editor/symbol_editor_settings.cpp diff --git a/eeschema/generate_alias_info.cpp b/eeschema/generate_alias_info.cpp index ec296951c5..ae1d0f22ac 100644 --- a/eeschema/generate_alias_info.cpp +++ b/eeschema/generate_alias_info.cpp @@ -23,7 +23,7 @@ #include #include #include - +#include static const wxString DescriptionFormat = "__NAME__" diff --git a/eeschema/sch_plugins/altium/altium_parser_sch.cpp b/eeschema/sch_plugins/altium/altium_parser_sch.cpp index 585cee9fde..6ac950cd90 100644 --- a/eeschema/sch_plugins/altium/altium_parser_sch.cpp +++ b/eeschema/sch_plugins/altium/altium_parser_sch.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "plugins/altium/altium_parser.h" #include "sch_plugins/altium/altium_parser_sch.h" diff --git a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp index e192df3f8d..9cdfc71f88 100644 --- a/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp +++ b/eeschema/sch_plugins/legacy/sch_legacy_plugin.cpp @@ -28,6 +28,7 @@ #include #include +#include #include #include diff --git a/eeschema/sch_sheet_path.cpp b/eeschema/sch_sheet_path.cpp index 5913167b39..f85616274c 100644 --- a/eeschema/sch_sheet_path.cpp +++ b/eeschema/sch_sheet_path.cpp @@ -37,6 +37,7 @@ #include #include +#include #include "erc_item.h" diff --git a/eeschema/sch_text.h b/eeschema/sch_text.h index 26fa200826..df8b8a5a09 100644 --- a/eeschema/sch_text.h +++ b/eeschema/sch_text.h @@ -81,7 +81,7 @@ public: case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::RIGHT; break; case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::BOTTOM; break; case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::LEFT; break; - default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break; + default: break; } return LABEL_SPIN_STYLE( newSpin ); @@ -97,7 +97,7 @@ public: case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::RIGHT; break; case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::UP; break; case LABEL_SPIN_STYLE::UP: newSpin = LABEL_SPIN_STYLE::LEFT; break; - default: wxLogWarning( "RotateCCW encountered unknown current spin style" ); break; + default: break; } return LABEL_SPIN_STYLE( newSpin ); @@ -116,7 +116,7 @@ public: case LABEL_SPIN_STYLE::BOTTOM: newSpin = LABEL_SPIN_STYLE::UP; break; case LABEL_SPIN_STYLE::LEFT: break; case LABEL_SPIN_STYLE::RIGHT: break; - default: wxLogWarning( "MirrorVertically encountered unknown current spin style" ); break; + default: break; } return LABEL_SPIN_STYLE( newSpin ); @@ -135,7 +135,7 @@ public: case LABEL_SPIN_STYLE::RIGHT: newSpin = LABEL_SPIN_STYLE::LEFT; break; case LABEL_SPIN_STYLE::UP: break; case LABEL_SPIN_STYLE::BOTTOM: break; - default: wxLogWarning( "MirrorHorizontally encountered unknown current spin style" ); break; + default: break; } return LABEL_SPIN_STYLE( newSpin ); diff --git a/eeschema/symbol_editor/lib_logger.cpp b/eeschema/symbol_editor/lib_logger.cpp new file mode 100644 index 0000000000..778ce1eb3a --- /dev/null +++ b/eeschema/symbol_editor/lib_logger.cpp @@ -0,0 +1,68 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017 CERN + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. + * @author Maciej Suminski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 3 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * https://www.gnu.org/licenses/gpl-3.0.html + * or you may search the http://www.gnu.org website for the version 3 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#include +#include + +LIB_LOGGER::LIB_LOGGER() : m_previousLogger( nullptr ), m_activated( false ) +{ +} + +LIB_LOGGER::~LIB_LOGGER() +{ + Deactivate(); +} + +void LIB_LOGGER::Activate() +{ + if( !m_activated ) + { + m_previousLogger = wxLog::GetActiveTarget(); + wxLog::SetActiveTarget( this ); + m_activated = true; + } +} + +void LIB_LOGGER::Deactivate() +{ + if( m_activated ) + { + Flush(); + m_activated = false; + wxLog::SetActiveTarget( m_previousLogger ); + } +} + + +void LIB_LOGGER::Flush() +{ + if( m_bHasMessages ) + { + wxLogMessage( _( "Not all symbol libraries could be loaded. Use the Manage Symbol\n" + "Libraries dialog to adjust paths and add or remove libraries." ) ); + wxLogGui::Flush(); + } +} \ No newline at end of file diff --git a/eeschema/symbol_editor/lib_logger.h b/eeschema/symbol_editor/lib_logger.h new file mode 100644 index 0000000000..3313317602 --- /dev/null +++ b/eeschema/symbol_editor/lib_logger.h @@ -0,0 +1,50 @@ +/* + * This program source code file is part of KiCad, a free EDA CAD application. + * + * Copyright (C) 2017 CERN + * Copyright (C) 2019-2021 KiCad Developers, see AUTHORS.txt for contributors. + * @author Maciej Suminski + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 3 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, you may find one here: + * https://www.gnu.org/licenses/gpl-3.0.html + * or you may search the http://www.gnu.org website for the version 3 license, + * or you may write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + + +#ifndef LIB_LOGGER_H +#define LIB_LOGGER_H + +#include + +class LIB_LOGGER : public wxLogGui +{ +public: + LIB_LOGGER(); + + ~LIB_LOGGER() override; + + void Activate(); + + void Deactivate(); + + void Flush() override; + +private: + wxLog* m_previousLogger; + bool m_activated; +}; + +#endif /* LIB_LOGGER_H */ \ No newline at end of file diff --git a/eeschema/symbol_editor/symbol_library_manager.cpp b/eeschema/symbol_editor/symbol_library_manager.cpp index 2153d90061..346d806f08 100644 --- a/eeschema/symbol_editor/symbol_library_manager.cpp +++ b/eeschema/symbol_editor/symbol_library_manager.cpp @@ -38,6 +38,8 @@ #include #include #include +#include +#include "lib_logger.h" SYMBOL_LIBRARY_MANAGER::SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ) : @@ -46,6 +48,13 @@ SYMBOL_LIBRARY_MANAGER::SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ) : { m_adapter = SYMBOL_TREE_SYNCHRONIZING_ADAPTER::Create( &m_frame, this ); m_adapter->ShowUnits( false ); + m_logger = new LIB_LOGGER(); +} + + +SYMBOL_LIBRARY_MANAGER::~SYMBOL_LIBRARY_MANAGER() +{ + delete m_logger; } @@ -53,12 +62,12 @@ void SYMBOL_LIBRARY_MANAGER::Sync( const wxString& aForceRefresh, std::function aProgressCallback ) { - m_logger.Activate(); + m_logger->Activate(); { getAdapter()->Sync( aForceRefresh, aProgressCallback ); m_syncHash = symTable()->GetModifyHash(); } - m_logger.Deactivate(); + m_logger->Deactivate(); } diff --git a/eeschema/symbol_editor/symbol_library_manager.h b/eeschema/symbol_editor/symbol_library_manager.h index d54e070251..cbeebfb3d4 100644 --- a/eeschema/symbol_editor/symbol_library_manager.h +++ b/eeschema/symbol_editor/symbol_library_manager.h @@ -44,55 +44,7 @@ class SCH_PLUGIN; class SYMBOL_EDIT_FRAME; class SYMBOL_LIB_TABLE; class SYMBOL_LIB_TABLE_ROW; - - -class LIB_LOGGER : public wxLogGui -{ -public: - LIB_LOGGER() : - m_previousLogger( nullptr ), - m_activated( false ) - { } - - ~LIB_LOGGER() override - { - Deactivate(); - } - - void Activate() - { - if( !m_activated ) - { - m_previousLogger = wxLog::GetActiveTarget(); - wxLog::SetActiveTarget( this ); - m_activated = true; - } - } - - void Deactivate() - { - if( m_activated ) - { - Flush(); - m_activated = false; - wxLog::SetActiveTarget( m_previousLogger ); - } - } - - void Flush() override - { - if( m_bHasMessages ) - { - wxLogMessage( _( "Not all symbol libraries could be loaded. Use the Manage Symbol\n" - "Libraries dialog to adjust paths and add or remove libraries." ) ); - wxLogGui::Flush(); - } - } - -private: - wxLog* m_previousLogger; - bool m_activated; -}; +class LIB_LOGGER; /** @@ -102,6 +54,7 @@ class SYMBOL_LIBRARY_MANAGER { public: SYMBOL_LIBRARY_MANAGER( SYMBOL_EDIT_FRAME& aFrame ); + ~SYMBOL_LIBRARY_MANAGER(); /** * Updates the #SYMBOL_LIBRARY_MANAGER data to synchronize with Symbol Library Table. @@ -469,7 +422,7 @@ private: std::map m_libs; SYMBOL_EDIT_FRAME& m_frame; ///< Parent frame - LIB_LOGGER m_logger; + LIB_LOGGER* m_logger; int m_syncHash; ///< Symbol lib table hash value from last synchronization wxObjectDataPtr m_adapter; diff --git a/include/settings/settings_manager.h b/include/settings/settings_manager.h index f7d0f0dc06..7b47899f53 100644 --- a/include/settings/settings_manager.h +++ b/include/settings/settings_manager.h @@ -114,7 +114,6 @@ public: } catch( ... ) { - wxLogTrace( traceSettings, "Unable to create application settings object" ); } } diff --git a/libs/kimath/include/math/util.h b/libs/kimath/include/math/util.h index 08a00a0793..c7329a1faf 100644 --- a/libs/kimath/include/math/util.h +++ b/libs/kimath/include/math/util.h @@ -30,8 +30,6 @@ #include #include #include -#include -#include /** * Function Clamp @@ -45,7 +43,6 @@ */ template inline const T& Clamp( const T& lower, const T& value, const T& upper ) { - wxASSERT( lower <= upper ); if( value < lower ) return lower; else if( upper < value ) @@ -73,8 +70,6 @@ constexpr ret_type KiROUND( fp_type v ) if( std::numeric_limits::max() < ret || std::numeric_limits::lowest() > ret ) { - wxLogDebug - ( "Overflow KiROUND converting value %f to %s", double( v ), typeid(ret_type).name() ); return 0; } diff --git a/pcbnew/connectivity/connectivity_algo.cpp b/pcbnew/connectivity/connectivity_algo.cpp index 7bb325717a..3bf15db00e 100644 --- a/pcbnew/connectivity/connectivity_algo.cpp +++ b/pcbnew/connectivity/connectivity_algo.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include #include #include diff --git a/pcbnew/connectivity/connectivity_items.cpp b/pcbnew/connectivity/connectivity_items.cpp index 0ef8d8e95c..00e1b749b8 100644 --- a/pcbnew/connectivity/connectivity_items.cpp +++ b/pcbnew/connectivity/connectivity_items.cpp @@ -29,6 +29,8 @@ #include #include +#include + int CN_ITEM::AnchorCount() const { if( !m_valid ) diff --git a/pcbnew/footprint_editor_settings.cpp b/pcbnew/footprint_editor_settings.cpp index 8fcbff722c..ef096299ba 100644 --- a/pcbnew/footprint_editor_settings.cpp +++ b/pcbnew/footprint_editor_settings.cpp @@ -28,6 +28,7 @@ #include #include #include +#include ///! Update the schema version whenever a migration is required diff --git a/pcbnew/generate_footprint_info.cpp b/pcbnew/generate_footprint_info.cpp index bc1cadf4f7..50adf1c181 100644 --- a/pcbnew/generate_footprint_info.cpp +++ b/pcbnew/generate_footprint_info.cpp @@ -22,6 +22,7 @@ #include #include #include +#include static const wxString DescriptionFormat = diff --git a/pcbnew/kicad_clipboard.cpp b/pcbnew/kicad_clipboard.cpp index 75441ca8a9..282c98c928 100644 --- a/pcbnew/kicad_clipboard.cpp +++ b/pcbnew/kicad_clipboard.cpp @@ -23,6 +23,7 @@ */ #include +#include #include #include diff --git a/pcbnew/netinfo_list.cpp b/pcbnew/netinfo_list.cpp index fdb6c33e6f..18d2e0b850 100644 --- a/pcbnew/netinfo_list.cpp +++ b/pcbnew/netinfo_list.cpp @@ -28,6 +28,7 @@ #include #include #include +#include // Constructor and destructor diff --git a/pcbnew/pcb_expr_evaluator.cpp b/pcbnew/pcb_expr_evaluator.cpp index 451f320a43..f17aad041a 100644 --- a/pcbnew/pcb_expr_evaluator.cpp +++ b/pcbnew/pcb_expr_evaluator.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include diff --git a/pcbnew/plugins/altium/altium_parser_pcb.cpp b/pcbnew/plugins/altium/altium_parser_pcb.cpp index aaf8067faf..e073a17e2a 100644 --- a/pcbnew/plugins/altium/altium_parser_pcb.cpp +++ b/pcbnew/plugins/altium/altium_parser_pcb.cpp @@ -27,6 +27,8 @@ #include #include +#include + #include "altium_parser_pcb.h" #include "plugins/altium/altium_parser.h" diff --git a/pcbnew/plugins/altium/altium_pcb.cpp b/pcbnew/plugins/altium/altium_pcb.cpp index 307442fb00..13169d1e12 100644 --- a/pcbnew/plugins/altium/altium_pcb.cpp +++ b/pcbnew/plugins/altium/altium_pcb.cpp @@ -44,6 +44,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/plugins/eagle/eagle_plugin.cpp b/pcbnew/plugins/eagle/eagle_plugin.cpp index 3522356ab6..ed7dc3a1d6 100644 --- a/pcbnew/plugins/eagle/eagle_plugin.cpp +++ b/pcbnew/plugins/eagle/eagle_plugin.cpp @@ -55,6 +55,7 @@ Load() TODO's #include #include #include +#include #include #include diff --git a/pcbnew/plugins/geda/gpcb_plugin.cpp b/pcbnew/plugins/geda/gpcb_plugin.cpp index 611fca73da..e64a997216 100644 --- a/pcbnew/plugins/geda/gpcb_plugin.cpp +++ b/pcbnew/plugins/geda/gpcb_plugin.cpp @@ -42,6 +42,7 @@ #include #include +#include #include #include #include diff --git a/pcbnew/plugins/kicad/kicad_plugin.cpp b/pcbnew/plugins/kicad/kicad_plugin.cpp index 900d3b5e04..015762be79 100644 --- a/pcbnew/plugins/kicad/kicad_plugin.cpp +++ b/pcbnew/plugins/kicad/kicad_plugin.cpp @@ -46,6 +46,7 @@ #include #include #include +#include #include #include #include diff --git a/pcbnew/plugins/kicad/pcb_parser.cpp b/pcbnew/plugins/kicad/pcb_parser.cpp index e819539bd2..bc0d58c1d1 100644 --- a/pcbnew/plugins/kicad/pcb_parser.cpp +++ b/pcbnew/plugins/kicad/pcb_parser.cpp @@ -54,6 +54,7 @@ #include #include // for RECT_CHAMFER_POSITIONS definition #include +#include using namespace PCB_KEYS_T; diff --git a/pcbnew/router/pns_kicad_iface.cpp b/pcbnew/router/pns_kicad_iface.cpp index 85ba0708c3..4c41035f22 100644 --- a/pcbnew/router/pns_kicad_iface.cpp +++ b/pcbnew/router/pns_kicad_iface.cpp @@ -42,6 +42,8 @@ #include #include +#include + #include #include diff --git a/pcbnew/router/pns_line_placer.cpp b/pcbnew/router/pns_line_placer.cpp index 4b5d5d5a6d..f54ca9d9a7 100644 --- a/pcbnew/router/pns_line_placer.cpp +++ b/pcbnew/router/pns_line_placer.cpp @@ -33,6 +33,8 @@ #include "pns_walkaround.h" #include "pns_mouse_trail_tracer.h" +#include + namespace PNS { LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) : diff --git a/pcbnew/router/pns_logger.cpp b/pcbnew/router/pns_logger.cpp index 8adff2740c..b341ac55fe 100644 --- a/pcbnew/router/pns_logger.cpp +++ b/pcbnew/router/pns_logger.cpp @@ -23,6 +23,8 @@ #include "pns_item.h" #include "pns_via.h" +#include + namespace PNS { LOGGER::LOGGER( ) diff --git a/pcbnew/router/pns_node.cpp b/pcbnew/router/pns_node.cpp index d6e42ea986..0268bcbb4a 100644 --- a/pcbnew/router/pns_node.cpp +++ b/pcbnew/router/pns_node.cpp @@ -29,6 +29,8 @@ #include #include +#include + #include "pns_arc.h" #include "pns_item.h" #include "pns_line.h" @@ -320,7 +322,7 @@ NODE::OPT_OBSTACLE NODE::NearestObstacle( const LINE* aLine, int aKindMask, std::vector intersectingPts; int layer = aLine->Layer(); - + for( const OBSTACLE& obstacle : obstacleList ) { if( aRestrictedSet && aRestrictedSet->find( obstacle.m_item ) == aRestrictedSet->end() ) diff --git a/pcbnew/router/pns_shove.cpp b/pcbnew/router/pns_shove.cpp index 7866b02efc..88d079eb19 100644 --- a/pcbnew/router/pns_shove.cpp +++ b/pcbnew/router/pns_shove.cpp @@ -25,6 +25,8 @@ #include +#include + #include "pns_arc.h" #include "pns_line.h" #include "pns_node.h" @@ -962,7 +964,7 @@ SHOVE::SHOVE_STATUS SHOVE::onCollidingVia( ITEM* aCurrent, VIA* aObstacleVia ) #endif lineCollision = aObstacleVia->Shape()->Collide( currentLine->Shape(), clearance + currentLine->Width() / 2, &mtvLine ); - + // Check the via if present. Via takes priority. if( currentLine->EndsWithVia() ) { diff --git a/pcbnew/router/pns_solid.cpp b/pcbnew/router/pns_solid.cpp index 827e2ab25e..def1fd3f77 100644 --- a/pcbnew/router/pns_solid.cpp +++ b/pcbnew/router/pns_solid.cpp @@ -28,6 +28,8 @@ #include #include +#include + #include "pns_router.h" #include "pns_solid.h" #include "pns_utils.h"