From cb764d73c5ad0e4f25f02a15351a12cf8b69b1f7 Mon Sep 17 00:00:00 2001 From: Wayne Stambaugh Date: Thu, 21 Sep 2017 08:58:08 -0400 Subject: [PATCH] Minor trace logging improvements. Make all trace environment variable strings upper case and prefix with KICAD_TRACE_ for consistency. Add Doxygen group for the trace environment variable strings. --- common/base_struct.cpp | 2 +- common/basicframe.cpp | 4 ++-- common/draw_panel.cpp | 29 ++++++++++++++--------------- eeschema/class_libentry.cpp | 4 ++-- eeschema/class_libentry.h | 8 ++++++-- eeschema/sch_item_struct.cpp | 4 ++-- eeschema/sch_item_struct.h | 9 +++++++-- eeschema/sch_legacy_plugin.cpp | 7 ++++++- include/base_struct.h | 18 ++++++++++++++++-- include/wxstruct.h | 8 ++++++-- pcbnew/gpcb_plugin.cpp | 9 +++++---- pcbnew/kicad_plugin.cpp | 8 +++++--- pcbnew/printout_controler.cpp | 9 +++++---- 13 files changed, 77 insertions(+), 42 deletions(-) diff --git a/common/base_struct.cpp b/common/base_struct.cpp index 3af93a83d3..0a64871d6f 100644 --- a/common/base_struct.cpp +++ b/common/base_struct.cpp @@ -55,7 +55,7 @@ static const unsigned char dummy_png[] = { static const BITMAP_OPAQUE dummy_xpm[1] = {{ dummy_png, sizeof( dummy_png ), "dummy_xpm" }}; -const wxString traceFindReplace( wxT( "KicadFindReplace" ) ); +const wxString traceFindReplace = "KICAD_TRACE_FIND_REPLACE"; enum textbox { diff --git a/common/basicframe.cpp b/common/basicframe.cpp index 46d45c496e..83aabc3162 100644 --- a/common/basicframe.cpp +++ b/common/basicframe.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2013-2015 Wayne Stambaugh + * Copyright (C) 2013 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -50,7 +50,7 @@ #define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/" -const wxChar traceAutoSave[] = wxT( "KicadAutoSave" ); +const wxChar traceAutoSave[] = wxT( "KICAD_TRACE_AUTOSAVE" ); ///@{ /// \ingroup config diff --git a/common/draw_panel.cpp b/common/draw_panel.cpp index d5445e2bde..baf5e984f0 100644 --- a/common/draw_panel.cpp +++ b/common/draw_panel.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@gipsa-lab.inpg.fr - * Copyright (C) 2007-2011 Wayne Stambaugh + * Copyright (C) 2007 Wayne Stambaugh * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -65,12 +65,11 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels /** - * Trace mask used to enable or disable the trace output of coordinates during drawing - * functions. The coordinate dumping can be turned on by setting the WXTRACE environment - * variable to "kicad_dump_coords". See the wxWidgets documentation on wxLogTrace for - * more information. + * @ingroup trace_env_vars + * + * Flag to enable draw panel coordinate debug tracing. */ -#define KICAD_TRACE_COORDS wxT( "kicad_dump_coords" ) +static const wxString kicadTraceCoords = wxT( "KICAD_TRACE_COORDS" ); // Events used by EDA_DRAW_PANEL @@ -314,7 +313,7 @@ void EDA_DRAW_PANEL::RefreshDrawingRect( const EDA_RECT& aRect, bool aEraseBackg rect.width = dc.LogicalToDeviceXRel( rect.width ); rect.height = dc.LogicalToDeviceYRel( rect.height ); - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Refresh area: drawing (%d, %d, %d, %d), device (%d, %d, %d, %d)" ), aRect.GetX(), aRect.GetY(), aRect.GetWidth(), aRect.GetHeight(), rect.x, rect.y, rect.width, rect.height ); @@ -371,7 +370,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition ) GetScrollPixelsPerUnit( &xPpu, &yPpu ); CalcUnscrolledPosition( screenPos.x, screenPos.y, &drawingPos.x, &drawingPos.y ); - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "MoveCursor() initial screen position(%d, %d) " ) \ wxT( "rectangle(%d, %d, %d, %d) view(%d, %d)" ), screenPos.x, screenPos.y, clientRect.x, clientRect.y, @@ -389,7 +388,7 @@ void EDA_DRAW_PANEL::MoveCursor( const wxPoint& aPosition ) Scroll( x, y ); CalcScrolledPosition( drawingPos.x, drawingPos.y, &screenPos.x, &screenPos.y ); - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "MoveCursor() scrolled screen position(%d, %d) view(%d, %d)" ), screenPos.x, screenPos.y, x, y ); } @@ -488,7 +487,7 @@ void EDA_DRAW_PANEL::OnScroll( wxScrollWinEvent& event ) return; } - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Setting scroll bars ppuX=%d, ppuY=%d, unitsX=%d, unitsY=%d, posX=%d, posY=%d" ), ppux, ppuy, unitsX, unitsY, x, y ); @@ -544,7 +543,7 @@ void EDA_DRAW_PANEL::SetClipBox( wxDC& aDC, const wxRect* aRect ) m_ClipBox.SetSize( wxSize( aDC.DeviceToLogicalXRel( clipBox.width ), aDC.DeviceToLogicalYRel( clipBox.height ) ) ); - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Device clip box=(%d, %d, %d, %d), Logical clip box=(%d, %d, %d, %d)" ), clipBox.x, clipBox.y, clipBox.width, clipBox.height, m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetWidth(), m_ClipBox.GetHeight() ); @@ -638,7 +637,7 @@ void EDA_DRAW_PANEL::ReDraw( wxDC* DC, bool erasebg ) // Verfies that the clipping is working correctly. If these two sets of numbers are // not the same or really close. The clipping algorithms are broken. - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Clip box: (%d, %d, %d, %d), Draw extents (%d, %d, %d, %d)" ), m_ClipBox.GetX(), m_ClipBox.GetY(), m_ClipBox.GetRight(), m_ClipBox.GetBottom(), DC->MinX(), DC->MinY(), DC->MaxX(), DC->MaxY() ); @@ -958,7 +957,7 @@ void EDA_DRAW_PANEL::OnMouseWheel( wxMouseEvent& event ) if( event.GetWheelRotation() == 0 || !GetParent()->IsEnabled() || !rect.Contains( event.GetPosition() ) ) { - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "OnMouseWheel() position(%d, %d) rectangle(%d, %d, %d, %d)" ), event.GetPosition().x, event.GetPosition().y, rect.x, rect.y, rect.width, rect.height ); @@ -1422,7 +1421,7 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event ) unitsX /= ppux; unitsY /= ppuy; - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Scroll center position before pan: (%d, %d)" ), tmpX, tmpY ); switch( event.GetId() ) @@ -1483,7 +1482,7 @@ void EDA_DRAW_PANEL::OnPan( wxCommandEvent& event ) center.y += KiROUND( (double) ( y - tmpY ) / scale ); GetParent()->SetScrollCenterPosition( center ); - wxLogTrace( KICAD_TRACE_COORDS, + wxLogTrace( kicadTraceCoords, wxT( "Scroll center position after pan: (%d, %d)" ), center.x, center.y ); } diff --git a/eeschema/class_libentry.cpp b/eeschema/class_libentry.cpp index bc5a056cc1..cfe3d99ee8 100644 --- a/eeschema/class_libentry.cpp +++ b/eeschema/class_libentry.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2017 Wayne Stambaugh + * Copyright (C) 2008 Wayne Stambaugh * Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -60,7 +60,7 @@ int LIB_PART::m_subpartIdSeparator = 0; int LIB_PART::m_subpartFirstId = 'A'; -const wxChar traceSchLibMem[] = wxT( "KISCHLIBMEM" ); // public +const wxChar traceSchLibMem[] = wxT( "KICAD_TRACE_SCH_LIB_MEM" ); // public LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ): diff --git a/eeschema/class_libentry.h b/eeschema/class_libentry.h index ef25dd4cca..5decec9c5b 100644 --- a/eeschema/class_libentry.h +++ b/eeschema/class_libentry.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr - * Copyright (C) 2008-2017 Wayne Stambaugh + * Copyright (C) 2008 Wayne Stambaugh * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -61,7 +61,11 @@ enum LIBRENTRYOPTIONS }; -/// WXTRACE value to enable schematic library memory deletion debug output. +/** + * @ingroup trace_env_vars + * + * Flag to enable schematic library memory deletion debug output. + */ extern const wxChar traceSchLibMem[]; diff --git a/eeschema/sch_item_struct.cpp b/eeschema/sch_item_struct.cpp index 047d5c8699..6e4f98c8da 100644 --- a/eeschema/sch_item_struct.cpp +++ b/eeschema/sch_item_struct.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2006 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com - * Copyright (C) 1992-2015 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -38,7 +38,7 @@ #include -const wxString traceFindItem( wxT( "KicadFindItem" ) ); +const wxString traceFindItem = wxT( "KICAD_TRACE_FIND_ITEM" ); bool sort_schematic_items( const SCH_ITEM* aItem1, const SCH_ITEM* aItem2 ) diff --git a/eeschema/sch_item_struct.h b/eeschema/sch_item_struct.h index 2bd92abdfc..112b39c422 100644 --- a/eeschema/sch_item_struct.h +++ b/eeschema/sch_item_struct.h @@ -55,8 +55,13 @@ typedef std::vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; #define FMT_ANGLE SCH_ITEM::FormatAngle -/// Flag to enable find item tracing using the WXTRACE environment variable. This -/// flag generates a lot of debug output. +/** + * @ingroup trace_env_vars + * + * Flag to enable finding schematic item debug output. + * + * @warning This generates a log of debug output. + */ extern const wxString traceFindItem; diff --git a/eeschema/sch_legacy_plugin.cpp b/eeschema/sch_legacy_plugin.cpp index c184d89df5..5b316587ea 100644 --- a/eeschema/sch_legacy_plugin.cpp +++ b/eeschema/sch_legacy_plugin.cpp @@ -72,7 +72,12 @@ const char* delims = " \t\r\n"; -const wxChar traceSchLegacyPlugin[] = wxT( "KI_SCH_LEGACY_PLUGIN" ); +/** + * @ingroup trace_env_vars + * + * Flag to enable legacy schematic plugin debug output. + */ +const wxChar traceSchLegacyPlugin[] = wxT( "KICAD_TRACE_SCH_LEGACY_PLUGIN" ); static bool is_eol( char c ) diff --git a/include/base_struct.h b/include/base_struct.h index b6753aefa1..206ef4f9f8 100644 --- a/include/base_struct.h +++ b/include/base_struct.h @@ -3,7 +3,7 @@ * * Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr * Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck - * Copyright (C) 2008-2017 Wayne Stambaugh + * Copyright (C) 2008 Wayne Stambaugh * Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -45,7 +45,21 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt ); #endif -/// Flag to enable find and replace tracing using the WXTRACE environment variable. +/** + * @defgroup trace_env_vars Trace Environment Variables + * + * wxWidgets provides trace control of debug messages using the WXTRACE environment variable. + * This section defines the strings passed to WXTRACE to for debug output control of various + * sections of the KiCad code. See the wxWidgets wxLogTrace + * documentation for more information. + */ + +/** + * @ingroup trace_env_vars + * + * Flag to enable find and replace debug tracing. + */ extern const wxString traceFindReplace; diff --git a/include/wxstruct.h b/include/wxstruct.h index ea00298994..88a96be109 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009-2015 Jean-Pierre Charras, jp.charras wanadoo.fr - * Copyright (C) 2011-2017 Wayne Stambaugh + * Copyright (C) 2011 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -95,7 +95,11 @@ enum id_librarytype { }; -/// Custom trace mask to enable and disable auto save tracing. +/** + * @ingroup trace_env_vars + * + * Flag to enable auto save feature debug tracing. + */ extern const wxChar traceAutoSave[]; diff --git a/pcbnew/gpcb_plugin.cpp b/pcbnew/gpcb_plugin.cpp index 9c621e07f7..2c123bf59a 100644 --- a/pcbnew/gpcb_plugin.cpp +++ b/pcbnew/gpcb_plugin.cpp @@ -1,7 +1,7 @@ /* * This program source code file is part of KiCad, a free EDA CAD application. * - * Copyright (C) 2012-2017 Wayne Stambaugh + * Copyright (C) 2012 Wayne Stambaugh * Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors. * * This program is free software; you can redistribute it and/or @@ -48,10 +48,11 @@ #include /** - * Definition for enabling and disabling footprint library trace output. See the - * wxWidgets documentation on using the WXTRACE environment variable. + * @ingroup trace_env_vars + * + * Flag to enable GEDA PCB plugin debug output. */ -static const wxString traceFootprintLibrary( wxT( "GedaPcbFootprintLib" ) ); +static const wxString traceFootprintLibrary = wxT( "KICAD_TRACE_GEDA_PLUGIN" ); #ifdef DEBUG static void inline traceParams( wxArrayString& aParams ) diff --git a/pcbnew/kicad_plugin.cpp b/pcbnew/kicad_plugin.cpp index 20a98664db..b633eb5cfe 100644 --- a/pcbnew/kicad_plugin.cpp +++ b/pcbnew/kicad_plugin.cpp @@ -56,10 +56,12 @@ using namespace PCB_KEYS_T; #define FMTIU BOARD_ITEM::FormatInternalUnits /** - * Definition for enabling and disabling footprint library trace output. See the - * wxWidgets documentation on using the WXTRACE environment variable. + * @ingroup trace_env_vars + * + * Flag to enable KiCad PCB plugin debug output. */ -static const wxString traceFootprintLibrary( wxT( "KicadFootprintLib" ) ); +static const wxString traceFootprintLibrary = wxT( "KICAD_TRACE_FP_PLUGIN" ); + ///> Removes empty nets (i.e. with node count equal zero) from net classes void filterNetClass( const BOARD& aBoard, NETCLASS& aNetClass ) diff --git a/pcbnew/printout_controler.cpp b/pcbnew/printout_controler.cpp index 5825aebad7..416a2bf016 100644 --- a/pcbnew/printout_controler.cpp +++ b/pcbnew/printout_controler.cpp @@ -2,7 +2,7 @@ * This program source code file is part of KiCad, a free EDA CAD application. * * Copyright (C) 2009 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr - * Copyright (C) 1992-2016 KiCad Developers, see AUTHORS.txt for contributors. + * Copyright (C) 1992-2017 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 @@ -45,10 +45,11 @@ /** - * Definition for enabling and disabling print controller trace output. See the - * wxWidgets documentation on using the WXTRACE environment variable. + * @ingroup trace_env_vars + * + * Flag to enable PCB print controller debug output. */ -static const wxString tracePrinting( wxT( "KicadPrinting" ) ); +static const wxString tracePrinting = wxT( "KICAD_TRACE_PCB_PRINT" ); PRINT_PARAMETERS::PRINT_PARAMETERS()