Remove the wxLog calls from math/util.h for now

This was leaking windows headers and partial wx headers to 1084 compilation units......
This also means math/util.h is leaking to 1084 compilation units which seems a bit high too.
This commit is contained in:
Marek Roszko 2021-06-01 01:17:57 -04:00
parent cfa2b57c68
commit cf2bb5692a
39 changed files with 180 additions and 65 deletions

View File

@ -31,6 +31,7 @@
#include <drawing_sheet/ds_painter.h>
#include <drawing_sheet/drawing_sheet_reader_lexer.h>
#include <wx/ffile.h>
#include <wx/log.h>
#include <wx/file.h>
#include <wx/mstream.h>

View File

@ -30,6 +30,7 @@
#include <trace_helpers.h>
#include <trigo.h>
#include <i18n_utility.h>
#include <wx/log.h>
#include <wx/fdrepdlg.h>

View File

@ -38,6 +38,7 @@
#include <cassert>
#include <memory>
#include <stdexcept>
#include <wx/log.h>
using namespace KIGFX;

View File

@ -24,6 +24,7 @@
#include <algorithm>
#include <kicad_string.h>
#include <wx/log.h>
#ifdef DEBUG
#include <cstdarg>

View File

@ -29,6 +29,7 @@
#include <kicad_string.h>
#include <richio.h>
#include <wx/log.h>
#include <functional>
#include <cstdio>

View File

@ -21,6 +21,7 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <wx/log.h>
#include <wx/stdpaths.h>
#include <config_params.h>

View File

@ -23,6 +23,7 @@
#include <settings/color_settings.h>
#include <settings/parameters.h>
#include <settings/settings_manager.h>
#include <wx/log.h>
#include "builtin_color_themes.h"

View File

@ -33,6 +33,7 @@
#include <wx/debug.h>
#include <wx/fileconf.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/wfstream.h>

View File

@ -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

View File

@ -23,7 +23,7 @@
#include <template_fieldnames.h>
#include <lib_symbol.h>
#include <symbol_lib_table.h>
#include <wx/log.h>
static const wxString DescriptionFormat =
"<b>__NAME__</b>"

View File

@ -27,6 +27,8 @@
#include <convert_to_biu.h>
#include <ki_exception.h>
#include <wx/log.h>
#include "plugins/altium/altium_parser.h"
#include "sch_plugins/altium/altium_parser_sch.h"

View File

@ -28,6 +28,7 @@
#include <wx/mstream.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/textfile.h>
#include <wx/tokenzr.h>

View File

@ -37,6 +37,7 @@
#include <boost/functional/hash.hpp>
#include <wx/filename.h>
#include <wx/log.h>
#include "erc_item.h"

View File

@ -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 );

View File

@ -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 <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* 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 <wx/intl.h>
#include <lib_logger.h>
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();
}
}

View File

@ -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 <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* 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 <wx/log.h>
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 */

View File

@ -38,6 +38,8 @@
#include <widgets/progress_reporter.h>
#include <list>
#include <locale_io.h>
#include <wx/log.h>
#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<void( int, int,
const wxString& )> aProgressCallback )
{
m_logger.Activate();
m_logger->Activate();
{
getAdapter()->Sync( aForceRefresh, aProgressCallback );
m_syncHash = symTable()->GetModifyHash();
}
m_logger.Deactivate();
m_logger->Deactivate();
}

View File

@ -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<wxString, LIB_BUFFER> 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<LIB_TREE_MODEL_ADAPTER> m_adapter;

View File

@ -114,7 +114,6 @@ public:
}
catch( ... )
{
wxLogTrace( traceSettings, "Unable to create application settings object" );
}
}

View File

@ -30,8 +30,6 @@
#include <cstdint>
#include <limits>
#include <typeinfo>
#include <wx/debug.h>
#include <wx/log.h>
/**
* Function Clamp
@ -45,7 +43,6 @@
*/
template <typename T> 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<ret_type>::max() < ret ||
std::numeric_limits<ret_type>::lowest() > ret )
{
wxLogDebug
( "Overflow KiROUND converting value %f to %s", double( v ), typeid(ret_type).name() );
return 0;
}

View File

@ -29,6 +29,8 @@
#include <geometry/geometry_utils.h>
#include <board_commit.h>
#include <wx/log.h>
#include <thread>
#include <mutex>
#include <algorithm>

View File

@ -29,6 +29,8 @@
#include <macros.h>
#include <connectivity/connectivity_items.h>
#include <wx/log.h>
int CN_ITEM::AnchorCount() const
{
if( !m_valid )

View File

@ -28,6 +28,7 @@
#include <wx/config.h>
#include <base_units.h>
#include <widgets/ui_common.h>
#include <wx/log.h>
///! Update the schema version whenever a migration is required

View File

@ -22,6 +22,7 @@
#include <kicad_string.h>
#include <footprint.h>
#include <fp_lib_table.h>
#include <wx/log.h>
static const wxString DescriptionFormat =

View File

@ -23,6 +23,7 @@
*/
#include <wx/clipbrd.h>
#include <wx/log.h>
#include <build_version.h>
#include <board.h>

View File

@ -28,6 +28,7 @@
#include <track.h>
#include <zone.h>
#include <netinfo.h>
#include <wx/log.h>
// Constructor and destructor

View File

@ -28,6 +28,7 @@
#include <track.h>
#include <geometry/shape_segment.h>
#include <pcb_expr_evaluator.h>
#include <wx/log.h>
#include <connectivity/connectivity_data.h>
#include <connectivity/connectivity_algo.h>

View File

@ -27,6 +27,8 @@
#include <ki_exception.h>
#include <math/util.h>
#include <wx/log.h>
#include "altium_parser_pcb.h"
#include "plugins/altium/altium_parser.h"

View File

@ -44,6 +44,7 @@
#include <trigo.h>
#include <utf.h>
#include <wx/docview.h>
#include <wx/log.h>
#include <wx/mstream.h>
#include <wx/wfstream.h>
#include <wx/zstream.h>

View File

@ -55,6 +55,7 @@ Load() TODO's
#include <wx/string.h>
#include <wx/xml/xml.h>
#include <wx/filename.h>
#include <wx/log.h>
#include <wx/wfstream.h>
#include <convert_basic_shapes_to_polygon.h>

View File

@ -42,6 +42,7 @@
#include <wx_filename.h>
#include <wx/dir.h>
#include <wx/log.h>
#include <wx/filename.h>
#include <wx/wfstream.h>
#include <boost/ptr_container/ptr_map.hpp>

View File

@ -46,6 +46,7 @@
#include <track.h>
#include <wildcards_and_files_ext.h>
#include <wx/dir.h>
#include <wx/log.h>
#include <wx_filename.h>
#include <zone.h>
#include <zones.h>

View File

@ -54,6 +54,7 @@
#include <plugins/kicad/pcb_parser.h>
#include <convert_basic_shapes_to_polygon.h> // for RECT_CHAMFER_POSITIONS definition
#include <template_fieldnames.h>
#include <wx/log.h>
using namespace PCB_KEYS_T;

View File

@ -42,6 +42,8 @@
#include <drc/drc_rule.h>
#include <drc/drc_engine.h>
#include <wx/log.h>
#include <memory>
#include <advanced_config.h>

View File

@ -33,6 +33,8 @@
#include "pns_walkaround.h"
#include "pns_mouse_trail_tracer.h"
#include <wx/log.h>
namespace PNS {
LINE_PLACER::LINE_PLACER( ROUTER* aRouter ) :

View File

@ -23,6 +23,8 @@
#include "pns_item.h"
#include "pns_via.h"
#include <wx/log.h>
namespace PNS {
LOGGER::LOGGER( )

View File

@ -29,6 +29,8 @@
#include <geometry/seg.h>
#include <geometry/shape_line_chain.h>
#include <wx/log.h>
#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<SHAPE_LINE_CHAIN::INTERSECTION> intersectingPts;
int layer = aLine->Layer();
for( const OBSTACLE& obstacle : obstacleList )
{
if( aRestrictedSet && aRestrictedSet->find( obstacle.m_item ) == aRestrictedSet->end() )

View File

@ -25,6 +25,8 @@
#include <geometry/shape_compound.h>
#include <wx/log.h>
#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() )
{

View File

@ -28,6 +28,8 @@
#include <geometry/shape_simple.h>
#include <geometry/shape_compound.h>
#include <wx/log.h>
#include "pns_router.h"
#include "pns_solid.h"
#include "pns_utils.h"