Organize trace debugging code for ease of maintenance.
This commit is contained in:
parent
89bf02adb7
commit
81843c37a4
|
@ -298,6 +298,7 @@ set( COMMON_SRCS
|
|||
settings.cpp
|
||||
status_popup.cpp
|
||||
systemdirsappend.cpp
|
||||
trace_helpers.cpp
|
||||
trigo.cpp
|
||||
undo_redo_container.cpp
|
||||
utf8.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, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -36,6 +36,7 @@
|
|||
#include <class_drawpanel.h>
|
||||
#include <base_screen.h>
|
||||
#include <bitmaps.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include "../eeschema/dialogs/dialog_schematic_find.h"
|
||||
|
||||
|
@ -55,8 +56,6 @@ static const unsigned char dummy_png[] = {
|
|||
|
||||
static const BITMAP_OPAQUE dummy_xpm[1] = {{ dummy_png, sizeof( dummy_png ), "dummy_xpm" }};
|
||||
|
||||
const wxString traceFindReplace = "KICAD_TRACE_FIND_REPLACE";
|
||||
|
||||
|
||||
enum textbox {
|
||||
ID_TEXTBOX_LIST = 8010
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include <base_units.h>
|
||||
#include <math/box2.h>
|
||||
#include <lockfile.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <wx/fontdlg.h>
|
||||
#include <wx/snglinst.h>
|
||||
|
@ -243,7 +244,7 @@ EDA_DRAW_FRAME::~EDA_DRAW_FRAME()
|
|||
|
||||
void EDA_DRAW_FRAME::OnCharHook( wxKeyEvent& event )
|
||||
{
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dumpKeyEvent( event ) );
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_FRAME::OnCharHook %s", dump( event ) );
|
||||
// Key events can be filtered here.
|
||||
// Currently no filtering is made.
|
||||
event.Skip();
|
||||
|
|
|
@ -41,6 +41,7 @@
|
|||
#include <draw_frame.h>
|
||||
#include <view/view_controls.h>
|
||||
#include <gal/gal_display_options.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <kicad_device_context.h>
|
||||
|
||||
|
@ -65,22 +66,6 @@ static const int CURSOR_SIZE = 12; ///< Cursor size in pixels
|
|||
#define DEBUG_SHOW_CLIP_RECT 0 // Set to 1 to draw clipping rectangle.
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable draw panel coordinate debug tracing.
|
||||
*/
|
||||
static const wxString kicadTraceCoords = wxT( "KICAD_TRACE_COORDS" );
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable wxKeyEvent debug tracing.
|
||||
*/
|
||||
const wxString kicadTraceKeyEvent = "KICAD_KEY_EVENTS";
|
||||
|
||||
|
||||
// Events used by EDA_DRAW_PANEL
|
||||
BEGIN_EVENT_TABLE( EDA_DRAW_PANEL, wxScrolledWindow )
|
||||
EVT_LEAVE_WINDOW( EDA_DRAW_PANEL::OnMouseLeaving )
|
||||
|
@ -1395,29 +1380,9 @@ void EDA_DRAW_PANEL::OnMouseEvent( wxMouseEvent& event )
|
|||
}
|
||||
|
||||
|
||||
// @todo Move this to a debug helper file in common folder.
|
||||
wxString dumpKeyEvent( const wxKeyEvent& aEvent )
|
||||
{
|
||||
wxString dump = wxString::Format( "key code %d", aEvent.GetKeyCode() );
|
||||
|
||||
if( aEvent.GetUnicodeKey() )
|
||||
dump += wxString::Format(", unicode key %d", aEvent.GetUnicodeKey() );
|
||||
if( aEvent.HasModifiers() )
|
||||
dump += wxString::Format( ", mod %d", aEvent.GetModifiers() );
|
||||
if( aEvent.ShiftDown() )
|
||||
dump += ", shift";
|
||||
if( aEvent.ControlDown() )
|
||||
dump += ", ctrl";
|
||||
if( aEvent.AltDown() )
|
||||
dump += ", alt";
|
||||
|
||||
return dump;
|
||||
}
|
||||
|
||||
|
||||
void EDA_DRAW_PANEL::OnCharHook( wxKeyEvent& event )
|
||||
{
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dumpKeyEvent( event ) );
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnCharHook %s", dump( event ) );
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
@ -1427,7 +1392,7 @@ void EDA_DRAW_PANEL::OnKeyEvent( wxKeyEvent& event )
|
|||
int localkey;
|
||||
wxPoint pos;
|
||||
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dumpKeyEvent( event ) );
|
||||
wxLogTrace( kicadTraceKeyEvent, "EDA_DRAW_PANEL::OnKeyEvent %s", dump( event ) );
|
||||
|
||||
localkey = event.GetKeyCode();
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2017 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2013 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -40,6 +40,7 @@
|
|||
#include <eda_base_frame.h>
|
||||
#include <menus_helpers.h>
|
||||
#include <bitmaps.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <wx/display.h>
|
||||
#include <wx/utils.h>
|
||||
|
@ -50,8 +51,6 @@
|
|||
|
||||
#define URL_GET_INVOLVED "http://kicad-pcb.org/contribute/"
|
||||
|
||||
const wxChar traceAutoSave[] = wxT( "KICAD_TRACE_AUTOSAVE" );
|
||||
|
||||
///@{
|
||||
/// \ingroup config
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2013 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
* Last changez: 2017
|
||||
* Last changes: 2018
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU General Public License
|
||||
|
@ -24,6 +24,7 @@
|
|||
*/
|
||||
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tool/tool_dispatcher.h>
|
||||
|
@ -36,10 +37,6 @@
|
|||
|
||||
#include <core/optional.h>
|
||||
|
||||
extern wxString dumpKeyEvent( const wxKeyEvent& aEvent );
|
||||
|
||||
extern const wxString kicadTraceKeyEvent;
|
||||
|
||||
|
||||
///> Stores information about a mouse button state
|
||||
struct TOOL_DISPATCHER::BUTTON_STATE
|
||||
|
@ -381,7 +378,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
{
|
||||
wxLogTrace( kicadTraceKeyEvent,
|
||||
"TOOL_DISPATCHER::DispatchWxEvent wxEVT_CHAR_HOOK %s",
|
||||
dumpKeyEvent( *ke ) );
|
||||
dump( *ke ) );
|
||||
aEvent.Skip();
|
||||
return;
|
||||
}
|
||||
|
@ -392,7 +389,7 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
|
|||
{
|
||||
wxLogTrace( kicadTraceKeyEvent,
|
||||
"TOOL_DISPATCHER::DispatchWxEvent wxEVT_CHAR %s",
|
||||
dumpKeyEvent( *ke ) );
|
||||
dump( *ke ) );
|
||||
}
|
||||
|
||||
int mods = decodeModifiers( ke );
|
||||
|
|
|
@ -0,0 +1,270 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2018 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file trace_helpers.cpp
|
||||
* @brief wxLogTrace helper implementation.
|
||||
*/
|
||||
|
||||
#include <wx/defs.h>
|
||||
#include <wx/string.h>
|
||||
#include <wx/event.h>
|
||||
#include <wx/arrstr.h>
|
||||
|
||||
|
||||
const wxChar* traceFindReplace = wxT( "KICAD_FIND_REPLACE" );
|
||||
const wxChar* kicadTraceCoords = wxT( "KICAD_COORDS" );
|
||||
const wxChar* kicadTraceKeyEvent = wxT( "KICAD_KEY_EVENTS" );
|
||||
const wxChar* traceSchLibMem = wxT( "KICAD_SCH_LIB_MEM" );
|
||||
const wxChar* traceFindItem = wxT( "KICAD_FIND_ITEM" );
|
||||
const wxChar* traceSchLegacyPlugin = wxT( "KICAD_SCH_LEGACY_PLUGIN" );
|
||||
const wxChar* traceGedaPcbPlugin = wxT( "KICAD_GEDA_PLUGIN" );
|
||||
const wxChar* traceKicadPcbPlugin = wxT( "KICAD_PCB_PLUGIN" );
|
||||
const wxChar* tracePrinting = wxT( "KICAD_PRINT" );
|
||||
const wxChar* traceAutoSave = wxT( "KICAD_AUTOSAVE" );
|
||||
|
||||
|
||||
wxString dump( const wxArrayString& aArray )
|
||||
{
|
||||
wxString tmp;
|
||||
|
||||
for( unsigned i = 0; i < aArray.GetCount(); i++ )
|
||||
{
|
||||
if( aArray[i].IsEmpty() )
|
||||
tmp << wxT( "\"\" " );
|
||||
else
|
||||
tmp << aArray[i] << wxT( " " );
|
||||
}
|
||||
|
||||
return tmp;
|
||||
}
|
||||
|
||||
|
||||
// The following code was shamelessly copied from the wxWidgets keyboard sample
|
||||
// at https://github.com/wxWidgets/wxWidgets/blob/master/samples/keyboard/keyboard.cpp.
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
// Author: Vadim Zeitlin
|
||||
// Modified by: Marcin Wojdyr
|
||||
// Created: 07.04.02
|
||||
// Copyright: (c) 2002 Vadim Zeitlin
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
// helper function that returns textual description of wx virtual keycode
|
||||
const char* GetVirtualKeyCodeName(int keycode)
|
||||
{
|
||||
switch ( keycode )
|
||||
{
|
||||
#define WXK_(x) \
|
||||
case WXK_##x: return #x;
|
||||
|
||||
WXK_(BACK)
|
||||
WXK_(TAB)
|
||||
WXK_(RETURN)
|
||||
WXK_(ESCAPE)
|
||||
WXK_(SPACE)
|
||||
WXK_(DELETE)
|
||||
WXK_(START)
|
||||
WXK_(LBUTTON)
|
||||
WXK_(RBUTTON)
|
||||
WXK_(CANCEL)
|
||||
WXK_(MBUTTON)
|
||||
WXK_(CLEAR)
|
||||
WXK_(SHIFT)
|
||||
WXK_(ALT)
|
||||
WXK_(CONTROL)
|
||||
WXK_(MENU)
|
||||
WXK_(PAUSE)
|
||||
WXK_(CAPITAL)
|
||||
WXK_(END)
|
||||
WXK_(HOME)
|
||||
WXK_(LEFT)
|
||||
WXK_(UP)
|
||||
WXK_(RIGHT)
|
||||
WXK_(DOWN)
|
||||
WXK_(SELECT)
|
||||
WXK_(PRINT)
|
||||
WXK_(EXECUTE)
|
||||
WXK_(SNAPSHOT)
|
||||
WXK_(INSERT)
|
||||
WXK_(HELP)
|
||||
WXK_(NUMPAD0)
|
||||
WXK_(NUMPAD1)
|
||||
WXK_(NUMPAD2)
|
||||
WXK_(NUMPAD3)
|
||||
WXK_(NUMPAD4)
|
||||
WXK_(NUMPAD5)
|
||||
WXK_(NUMPAD6)
|
||||
WXK_(NUMPAD7)
|
||||
WXK_(NUMPAD8)
|
||||
WXK_(NUMPAD9)
|
||||
WXK_(MULTIPLY)
|
||||
WXK_(ADD)
|
||||
WXK_(SEPARATOR)
|
||||
WXK_(SUBTRACT)
|
||||
WXK_(DECIMAL)
|
||||
WXK_(DIVIDE)
|
||||
WXK_(F1)
|
||||
WXK_(F2)
|
||||
WXK_(F3)
|
||||
WXK_(F4)
|
||||
WXK_(F5)
|
||||
WXK_(F6)
|
||||
WXK_(F7)
|
||||
WXK_(F8)
|
||||
WXK_(F9)
|
||||
WXK_(F10)
|
||||
WXK_(F11)
|
||||
WXK_(F12)
|
||||
WXK_(F13)
|
||||
WXK_(F14)
|
||||
WXK_(F15)
|
||||
WXK_(F16)
|
||||
WXK_(F17)
|
||||
WXK_(F18)
|
||||
WXK_(F19)
|
||||
WXK_(F20)
|
||||
WXK_(F21)
|
||||
WXK_(F22)
|
||||
WXK_(F23)
|
||||
WXK_(F24)
|
||||
WXK_(NUMLOCK)
|
||||
WXK_(SCROLL)
|
||||
WXK_(PAGEUP)
|
||||
WXK_(PAGEDOWN)
|
||||
WXK_(NUMPAD_SPACE)
|
||||
WXK_(NUMPAD_TAB)
|
||||
WXK_(NUMPAD_ENTER)
|
||||
WXK_(NUMPAD_F1)
|
||||
WXK_(NUMPAD_F2)
|
||||
WXK_(NUMPAD_F3)
|
||||
WXK_(NUMPAD_F4)
|
||||
WXK_(NUMPAD_HOME)
|
||||
WXK_(NUMPAD_LEFT)
|
||||
WXK_(NUMPAD_UP)
|
||||
WXK_(NUMPAD_RIGHT)
|
||||
WXK_(NUMPAD_DOWN)
|
||||
WXK_(NUMPAD_PAGEUP)
|
||||
WXK_(NUMPAD_PAGEDOWN)
|
||||
WXK_(NUMPAD_END)
|
||||
WXK_(NUMPAD_BEGIN)
|
||||
WXK_(NUMPAD_INSERT)
|
||||
WXK_(NUMPAD_DELETE)
|
||||
WXK_(NUMPAD_EQUAL)
|
||||
WXK_(NUMPAD_MULTIPLY)
|
||||
WXK_(NUMPAD_ADD)
|
||||
WXK_(NUMPAD_SEPARATOR)
|
||||
WXK_(NUMPAD_SUBTRACT)
|
||||
WXK_(NUMPAD_DECIMAL)
|
||||
WXK_(NUMPAD_DIVIDE)
|
||||
|
||||
WXK_(WINDOWS_LEFT)
|
||||
WXK_(WINDOWS_RIGHT)
|
||||
#ifdef __WXOSX__
|
||||
WXK_(RAW_CONTROL)
|
||||
#endif
|
||||
#undef WXK_
|
||||
|
||||
default:
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// helper function that returns textual description of key in the event
|
||||
wxString GetKeyName( const wxKeyEvent &aEvent )
|
||||
{
|
||||
int keycode = aEvent.GetKeyCode();
|
||||
const char* virt = GetVirtualKeyCodeName( keycode );
|
||||
|
||||
if( virt )
|
||||
return virt;
|
||||
|
||||
if( keycode > 0 && keycode < 32 )
|
||||
return wxString::Format( "Ctrl-%c", (unsigned char)('A' + keycode - 1) );
|
||||
|
||||
if( keycode >= 32 && keycode < 128 )
|
||||
return wxString::Format( "'%c'", (unsigned char)keycode );
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
int uc = aEvent.GetUnicodeKey();
|
||||
|
||||
if( uc != WXK_NONE )
|
||||
return wxString::Format( "'%c'", uc );
|
||||
#endif
|
||||
|
||||
return "unknown";
|
||||
}
|
||||
|
||||
|
||||
wxString dump( const wxKeyEvent& aEvent )
|
||||
{
|
||||
wxString msg;
|
||||
wxString eventType = "unknown";
|
||||
|
||||
if( aEvent.GetEventType() == wxEVT_KEY_DOWN )
|
||||
eventType = "KeyDown";
|
||||
else if( aEvent.GetEventType() == wxEVT_KEY_UP )
|
||||
eventType = "KeyUp";
|
||||
else if( aEvent.GetEventType() == wxEVT_CHAR )
|
||||
eventType = "Char";
|
||||
else if( aEvent.GetEventType() == wxEVT_CHAR_HOOK )
|
||||
eventType = "Hook";
|
||||
|
||||
// event key_name KeyCode modifiers Unicode raw_code raw_flags pos
|
||||
msg.Printf( "%7s %15s %5d %c%c%c%c"
|
||||
#if wxUSE_UNICODE
|
||||
"%5d (U+%04x)"
|
||||
#else
|
||||
" none "
|
||||
#endif
|
||||
#ifdef wxHAS_RAW_KEY_CODES
|
||||
" %7lu 0x%08lx"
|
||||
#else
|
||||
" not-set not-set"
|
||||
#endif
|
||||
" (%5d,%5d)"
|
||||
"\n",
|
||||
eventType,
|
||||
GetKeyName( aEvent ),
|
||||
aEvent.GetKeyCode(),
|
||||
aEvent.ControlDown() ? 'C' : '-',
|
||||
aEvent.AltDown() ? 'A' : '-',
|
||||
aEvent.ShiftDown() ? 'S' : '-',
|
||||
aEvent.MetaDown() ? 'M' : '-'
|
||||
#if wxUSE_UNICODE
|
||||
, aEvent.GetUnicodeKey()
|
||||
, aEvent.GetUnicodeKey()
|
||||
#endif
|
||||
#ifdef wxHAS_RAW_KEY_CODES
|
||||
, (unsigned long) aEvent.GetRawKeyCode()
|
||||
, (unsigned long) aEvent.GetRawKeyFlags()
|
||||
#endif
|
||||
, aEvent.GetX()
|
||||
, aEvent.GetY()
|
||||
);
|
||||
|
||||
return msg;
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2004-2018 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
|
||||
|
@ -36,6 +36,7 @@
|
|||
#include <sch_screen.h>
|
||||
#include <richio.h>
|
||||
#include <kicad_string.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <template_fieldnames.h>
|
||||
|
@ -61,9 +62,6 @@ int LIB_PART::m_subpartIdSeparator = 0;
|
|||
int LIB_PART::m_subpartFirstId = 'A';
|
||||
|
||||
|
||||
const wxChar traceSchLibMem[] = wxT( "KICAD_TRACE_SCH_LIB_MEM" ); // public
|
||||
|
||||
|
||||
LIB_ALIAS::LIB_ALIAS( const wxString& aName, LIB_PART* aRootPart ):
|
||||
EDA_ITEM( LIB_ALIAS_T ),
|
||||
shared( aRootPart )
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2018 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
|
||||
|
@ -61,14 +61,6 @@ enum LIBRENTRYOPTIONS
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable schematic library memory deletion debug output.
|
||||
*/
|
||||
extern const wxChar traceSchLibMem[];
|
||||
|
||||
|
||||
/**
|
||||
* Part library alias object definition.
|
||||
*
|
||||
|
|
|
@ -36,6 +36,7 @@
|
|||
#include <pgm_base.h>
|
||||
#include <kiface_i.h>
|
||||
#include <richio.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <eeschema_id.h>
|
||||
#include <class_library.h>
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
*
|
||||
* Copyright (C) 2004 Jean-Pierre Charras, jaen-pierre.charras@gipsa-lab.inpg.com
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2018 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
|
||||
|
@ -41,6 +41,7 @@
|
|||
#include <gestfich.h>
|
||||
#include <sch_edit_frame.h>
|
||||
#include <base_units.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <class_library.h>
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2011-2016 Wayne Stambaugh <stambaughw@verizon.net>
|
||||
* Copyright (C) 2004-2016 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2018 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
|
||||
|
@ -27,6 +27,7 @@
|
|||
*/
|
||||
|
||||
#include <macros.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <sch_sheet_path.h>
|
||||
#include <transform.h>
|
||||
|
|
|
@ -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-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -30,6 +30,7 @@
|
|||
#include <common.h>
|
||||
#include <gr_basic.h>
|
||||
#include <base_struct.h>
|
||||
#include <trace_helpers.h>
|
||||
#include <sch_item_struct.h>
|
||||
#include <sch_screen.h>
|
||||
#include <class_drawpanel.h>
|
||||
|
@ -38,8 +39,6 @@
|
|||
#include <general.h>
|
||||
|
||||
|
||||
const wxString traceFindItem = wxT( "KICAD_TRACE_FIND_ITEM" );
|
||||
|
||||
/* Constructor and destructor for SCH_ITEM */
|
||||
/* They are not inline because this creates problems with gcc at linking time
|
||||
* in debug mode
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2016 CERN
|
||||
* Copyright (C) 2016-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 2016-2018 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
*
|
||||
* @author Wayne Stambaugh <stambaughw@gmail.com>
|
||||
*
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <richio.h>
|
||||
#include <core/typeinfo.h>
|
||||
#include <properties.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <sch_bitmap.h>
|
||||
|
@ -78,13 +79,6 @@ const char* delims = " \t\r\n";
|
|||
#define T_COLORA "rgba" // cannot be modifed (used by wxWidgets)
|
||||
#define T_WIDTH "width"
|
||||
|
||||
/**
|
||||
* @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 )
|
||||
{
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
* Copyright (C) 2013-2015 Jean-Pierre Charras, jp.charras at wanadoo.fr
|
||||
* Copyright (C) 2008-2015 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
|
||||
* Copyright (C) 2008 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2004-2017 KiCad Developers, see change_log.txt for contributors.
|
||||
* Copyright (C) 2004-2018 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
|
||||
|
@ -45,24 +45,6 @@ extern std::ostream& operator <<( std::ostream& out, const wxPoint& pt );
|
|||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @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 <a href="http://docs.wxwidgets.org/3.0/
|
||||
* group__group__funcmacro__log.html#ga947e317db477914c12b13c4534867ec9"> wxLogTrace </a>
|
||||
* documentation for more information.
|
||||
*/
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable find and replace debug tracing.
|
||||
*/
|
||||
extern const wxString traceFindReplace;
|
||||
|
||||
|
||||
/**
|
||||
* Enum FILL_T
|
||||
* is the set of fill types used in plotting or drawing enclosed areas.
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2013-2016 CERN
|
||||
* Copyright (C) 2013-2018 CERN
|
||||
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
|
||||
* @author Maciej Suminski <maciej.suminski@cern.ch>
|
||||
*
|
||||
|
|
|
@ -52,17 +52,6 @@ typedef void ( *MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
|||
typedef void ( *END_MOUSE_CAPTURE_CALLBACK )( EDA_DRAW_PANEL* aPanel, wxDC* aDC );
|
||||
|
||||
|
||||
/**
|
||||
* Debug helper for printing wxKeyEvent information.
|
||||
*
|
||||
* @param aEvent is the wxKeyEvent to generate the print string from.
|
||||
* @return the wxKeyEvent information.
|
||||
*/
|
||||
extern wxString dumpKeyEvent( const wxKeyEvent& aEvent );
|
||||
|
||||
extern const wxString kicadTraceKeyEvent;
|
||||
|
||||
|
||||
class EDA_DRAW_PANEL : public wxScrolledWindow
|
||||
{
|
||||
private:
|
||||
|
|
|
@ -95,14 +95,6 @@ enum id_librarytype {
|
|||
};
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable auto save feature debug tracing.
|
||||
*/
|
||||
extern const wxChar traceAutoSave[];
|
||||
|
||||
|
||||
/**
|
||||
* Class EDA_BASE_FRAME
|
||||
* is the base frame for deriving all KiCad main window classes. This class is not
|
||||
|
|
|
@ -0,0 +1,110 @@
|
|||
/*
|
||||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2018 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 2018 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
|
||||
* as published by the Free Software Foundation; either version 2
|
||||
* 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:
|
||||
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
|
||||
* or you may search the http://www.gnu.org website for the version 2 license,
|
||||
* or you may write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
|
||||
*/
|
||||
|
||||
/**
|
||||
* @file trace_helpers.h
|
||||
* @brief wxLogTrace helper definitions.
|
||||
*/
|
||||
|
||||
#ifndef _TRACE_HELPERS_H_
|
||||
#define _TRACE_HELPERS_H_
|
||||
|
||||
/**
|
||||
* @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 <a href="http://docs.wxwidgets.org/3.0/
|
||||
* group__group__funcmacro__log.html#ga947e317db477914c12b13c4534867ec9"> wxLogTrace </a>
|
||||
* documentation for more information.
|
||||
*/
|
||||
|
||||
///@{
|
||||
/// \ingroup trace_env_vars
|
||||
|
||||
/**
|
||||
* Flag to enable find and replace debug tracing.
|
||||
*/
|
||||
extern wxChar* traceFindReplace;
|
||||
|
||||
/**
|
||||
* Flag to enable draw panel coordinate debug tracing.
|
||||
*/
|
||||
extern wxChar* kicadTraceCoords;
|
||||
|
||||
|
||||
/**
|
||||
* Flag to enable wxKeyEvent debug tracing.
|
||||
*/
|
||||
extern wxChar* kicadTraceKeyEvent;
|
||||
|
||||
/**
|
||||
* Flag to enable auto save feature debug tracing.
|
||||
*/
|
||||
extern wxChar* traceAutoSave;
|
||||
|
||||
/**
|
||||
* Flag to enable schematic library memory deletion debug output.
|
||||
*/
|
||||
extern wxChar* traceSchLibMem;
|
||||
|
||||
/**
|
||||
* Flag to enable legacy schematic plugin debug output.
|
||||
*/
|
||||
extern wxChar* traceSchLegacyPlugin;
|
||||
|
||||
/**
|
||||
* Flag to enable GEDA PCB plugin debug output.
|
||||
*/
|
||||
extern wxChar* traceKicadPcbPlugin;
|
||||
|
||||
/**
|
||||
* Flag to enable GEDA PCB plugin debug output.
|
||||
*/
|
||||
extern wxChar* traceGedaPcbPlugin;
|
||||
|
||||
/**
|
||||
* Flag to enable print controller debug output.
|
||||
*/
|
||||
extern wxChar* tracePrinting;
|
||||
|
||||
///@}
|
||||
|
||||
/**
|
||||
* Debug helper for printing wxKeyEvent information.
|
||||
*
|
||||
* @param aEvent is the wxKeyEvent to generate the print string from.
|
||||
* @return the wxKeyEvent information.
|
||||
*/
|
||||
extern wxString dump( const wxKeyEvent& aEvent );
|
||||
|
||||
/**
|
||||
* Debug helper for printing wxArrayString contents.
|
||||
*
|
||||
* @param aArray is the string array to output.
|
||||
* @return the wxArrayString contents in a formatted string for debugging output.
|
||||
*/
|
||||
extern wxString dump( const wxArrayString& aArray );
|
||||
|
||||
#endif // _TRACE_HELPERS_H_
|
|
@ -44,6 +44,7 @@
|
|||
#include <ratsnest_data.h>
|
||||
#include <kiway.h>
|
||||
#include <kiway_player.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 Wayne Stambaugh <stambaughw@gmail.com>
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -33,6 +33,7 @@
|
|||
#include <trigo.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <filter_reader.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -47,29 +48,6 @@
|
|||
#include <boost/ptr_container/ptr_map.hpp>
|
||||
#include <memory.h>
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable GEDA PCB plugin debug output.
|
||||
*/
|
||||
static const wxString traceFootprintLibrary = wxT( "KICAD_TRACE_GEDA_PLUGIN" );
|
||||
|
||||
#ifdef DEBUG
|
||||
static void inline traceParams( wxArrayString& aParams )
|
||||
{
|
||||
wxString tmp;
|
||||
|
||||
for( unsigned i = 0; i < aParams.GetCount(); i++ )
|
||||
{
|
||||
if( aParams[i].IsEmpty() )
|
||||
tmp << wxT( "\"\" " );
|
||||
else
|
||||
tmp << aParams[i] << wxT( " " );
|
||||
}
|
||||
|
||||
wxLogTrace( traceFootprintLibrary, tmp );
|
||||
}
|
||||
#endif
|
||||
|
||||
static inline long parseInt( const wxString& aValue, double aScalar )
|
||||
{
|
||||
|
@ -119,14 +97,6 @@ static inline long parseInt( const wxString& aValue, double aScalar )
|
|||
}
|
||||
|
||||
|
||||
// Tracing for token parameter arrays.
|
||||
#ifdef DEBUG
|
||||
#define TRACE_PARAMS( arr ) traceParams( arr );
|
||||
#else
|
||||
#define TRACE_PARAMS( arr ) // Expands to nothing on non-debug builds.
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* Class GPCB_FPL_CACHE_ITEM
|
||||
* is helper class for creating a footprint library cache.
|
||||
|
@ -532,7 +502,7 @@ MODULE* GPCB_FPL_CACHE::parseMODULE( LINE_READER* aLineReader )
|
|||
conv_unit = NEW_GPCB_UNIT_CONV;
|
||||
}
|
||||
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "%s parameter count = %d." ),
|
||||
wxLogTrace( traceGedaPcbPlugin, wxT( "%s parameter count = %d." ),
|
||||
GetChars( parameters[0] ), paramCnt );
|
||||
|
||||
// Parse a line with format: ElementLine [X1 Y1 X2 Y2 Thickness]
|
||||
|
@ -805,7 +775,7 @@ void GPCB_FPL_CACHE::parseParameters( wxArrayString& aParameterList, LINE_READER
|
|||
// of a keyword definition.
|
||||
if( aParameterList.GetCount() == 1 )
|
||||
{
|
||||
TRACE_PARAMS( aParameterList );
|
||||
wxLogTrace( traceGedaPcbPlugin, dump( aParameterList ) );
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -821,7 +791,7 @@ void GPCB_FPL_CACHE::parseParameters( wxArrayString& aParameterList, LINE_READER
|
|||
|
||||
tmp.Append( key );
|
||||
aParameterList.Add( tmp );
|
||||
TRACE_PARAMS( aParameterList );
|
||||
wxLogTrace( traceGedaPcbPlugin, dump( aParameterList ) );
|
||||
return;
|
||||
|
||||
case '\n':
|
||||
|
@ -1092,7 +1062,7 @@ bool GPCB_PLUGIN::FootprintLibDelete( const wxString& aLibraryPath, const PROPER
|
|||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "Removing footprint library '%s'" ),
|
||||
wxLogTrace( traceGedaPcbPlugin, wxT( "Removing footprint library '%s'" ),
|
||||
aLibraryPath.GetData() );
|
||||
|
||||
// Some of the more elaborate wxRemoveFile() crap puts up its own wxLog dialog
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* This program source code file is part of KiCad, a free EDA CAD application.
|
||||
*
|
||||
* Copyright (C) 2012 CERN
|
||||
* Copyright (C) 1992-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -29,6 +29,7 @@
|
|||
#include <macros.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <base_units.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
|
@ -56,13 +57,6 @@ using namespace PCB_KEYS_T;
|
|||
#define FMT_IU BOARD_ITEM::FormatInternalUnits
|
||||
#define FMT_ANGLE BOARD_ITEM::FormatAngle
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable KiCad PCB plugin debug output.
|
||||
*/
|
||||
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 )
|
||||
|
@ -221,7 +215,7 @@ void FP_CACHE::Save( MODULE* aModule )
|
|||
// Allow file output stream to go out of scope to close the file stream before
|
||||
// renaming the file.
|
||||
{
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "Creating temporary library file %s" ),
|
||||
wxLogTrace( traceKicadPcbPlugin, wxT( "Creating temporary library file %s" ),
|
||||
GetChars( tempFileName ) );
|
||||
|
||||
FILE_OUTPUTFORMATTER formatter( tempFileName );
|
||||
|
@ -2104,7 +2098,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
|
|||
|
||||
if( it != mods.end() )
|
||||
{
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "Removing footprint library file '%s'." ),
|
||||
wxLogTrace( traceKicadPcbPlugin, wxT( "Removing footprint library file '%s'." ),
|
||||
fn.GetFullPath().GetData() );
|
||||
mods.erase( footprintName );
|
||||
wxRemoveFile( fn.GetFullPath() );
|
||||
|
@ -2122,7 +2116,7 @@ void PCB_IO::FootprintSave( const wxString& aLibraryPath, const MODULE* aFootpri
|
|||
if( module->GetLayer() != F_Cu )
|
||||
module->Flip( module->GetPosition() );
|
||||
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "Creating s-expression footprint file: %s." ),
|
||||
wxLogTrace( traceKicadPcbPlugin, wxT( "Creating s-expression footprint file: %s." ),
|
||||
fn.GetFullPath().GetData() );
|
||||
mods.insert( footprintName, new FP_CACHE_ITEM( module, fn ) );
|
||||
m_cache->Save( module );
|
||||
|
@ -2225,7 +2219,7 @@ bool PCB_IO::FootprintLibDelete( const wxString& aLibraryPath, const PROPERTIES*
|
|||
}
|
||||
}
|
||||
|
||||
wxLogTrace( traceFootprintLibrary, wxT( "Removing footprint library \"%s\"" ),
|
||||
wxLogTrace( traceKicadPcbPlugin, wxT( "Removing footprint library \"%s\"" ),
|
||||
aLibraryPath.GetData() );
|
||||
|
||||
// Some of the more elaborate wxRemoveFile() crap puts up its own wxLog dialog
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <msgpanel.h>
|
||||
#include <fp_lib_table.h>
|
||||
#include <bitmaps.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <pcbnew.h>
|
||||
#include <pcbnew_id.h>
|
||||
|
|
|
@ -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-2017 KiCad Developers, see AUTHORS.txt for contributors.
|
||||
* Copyright (C) 1992-2018 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
|
||||
|
@ -40,18 +40,11 @@
|
|||
#include <pcb_base_frame.h>
|
||||
#include <class_board.h>
|
||||
#include <pcbnew.h>
|
||||
#include <trace_helpers.h>
|
||||
|
||||
#include <printout_controler.h>
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
* Flag to enable PCB print controller debug output.
|
||||
*/
|
||||
static const wxString tracePrinting = wxT( "KICAD_TRACE_PCB_PRINT" );
|
||||
|
||||
|
||||
PRINT_PARAMETERS::PRINT_PARAMETERS()
|
||||
{
|
||||
m_PenDefaultSize = Millimeter2iu( 0.2 ); // A reasonable default value to draw items
|
||||
|
|
Loading…
Reference in New Issue