KiCad PCB EDA Suite
trace_helpers.h File Reference

wxLogTrace helper definitions. More...

#include <wx/arrstr.h>
#include <wx/event.h>
#include <wx/string.h>
#include <stdarg.h>
#include <map>

Go to the source code of this file.

Classes

class  TRACE_MANAGER
 

Macros

#define KI_TRACE(aWhat, ...)
 

Functions

wxString dump (const wxKeyEvent &aEvent)
 Debug helper for printing wxKeyEvent information. More...
 
wxString dump (const wxArrayString &aArray)
 Debug helper for printing wxArrayString contents. More...
 

Variables

const wxChar *const traceFindItem
 Flag to enable find debug tracing. More...
 
const wxChar *const traceFindReplace
 Flag to enable find and replace debug tracing. More...
 
const wxChar *const kicadTraceCoords
 Flag to enable draw panel coordinate debug tracing. More...
 
const wxChar *const kicadTraceKeyEvent
 Flag to enable wxKeyEvent debug tracing. More...
 
const wxChar *const kicadTraceToolStack
 Flag to enable tracing of the tool handling stack. More...
 
const wxChar *const kicadTraceCoroutineStack
 Flag to enable tracing of the coroutine call stack. More...
 
const wxChar *const traceAutoSave
 Flag to enable auto save feature debug tracing. More...
 
const wxChar *const traceSchLibMem
 Flag to enable schematic library memory deletion debug output. More...
 
const wxChar *const traceSchPlugin
 Flag to enable legacy schematic plugin debug output. More...
 
const wxChar *const traceSchLegacyPlugin
 Flag to enable legacy schematic plugin debug output. More...
 
const wxChar *const traceKicadPcbPlugin
 Flag to enable GEDA PCB plugin debug output. More...
 
const wxChar *const traceGedaPcbPlugin
 Flag to enable GEDA PCB plugin debug output. More...
 
const wxChar *const tracePrinting
 Flag to enable print controller debug output. More...
 
const wxChar *const tracePathsAndFiles
 Flag to enable path and file name debug output. More...
 
const wxChar *const traceLocale
 Flag to enable locale debug output. More...
 
const wxChar *const traceFonts
 Flag to enable locale debug output. More...
 
const wxChar *const traceScreen
 Flag to enable debug output of BASE_SCREEN and it's derivatives. More...
 
const wxChar *const traceDisplayLocation
 Flag to enable debug output of display positioning logic. More...
 
const wxChar *const traceZoomScroll
 Flag to enable debug output of zoom-scrolling calculations in KIGFX::ZOOM_CONTROLLER and derivatives. More...
 
const wxChar *const traceSymbolResolver
 Flag to enable debug output of symbol library resolver results. More...
 
const wxChar *const traceSchSheetPaths
 Flag to enable debug output of schematic symbol sheet path manipulation code. More...
 
const wxChar *const traceEnvVars
 Flag to enable debug output of environment variable operations. More...
 
const wxChar *const traceGalProfile
 Flag to enable debug output of GAL performance profiling. More...
 
const wxChar *const traceKiCad2Step
 Flag to enable KiCad2Step debug tracing. More...
 

Detailed Description

wxLogTrace helper definitions.

Definition in file trace_helpers.h.

Macro Definition Documentation

◆ KI_TRACE

#define KI_TRACE (   aWhat,
  ... 
)
Value:
if( TRACE_MANAGER::Instance().IsTraceEnabled( aWhat ) ) \
{ \
TRACE_MANAGER::Instance().Trace( aWhat, __VA_ARGS__ ); \
} \
else \
{ \
}
static TRACE_MANAGER & Instance()

Definition at line 283 of file trace_helpers.h.

Function Documentation

◆ dump() [1/2]

wxString dump ( const wxArrayString &  aArray)

Debug helper for printing wxArrayString contents.

Parameters
aArrayis the string array to output.
Returns
the wxArrayString contents in a formatted string for debugging output.

Definition at line 60 of file trace_helpers.cpp.

61{
62 wxString tmp;
63
64 for( unsigned i = 0; i < aArray.GetCount(); i++ )
65 {
66 if( aArray[i].IsEmpty() )
67 tmp << wxT( "\"\" " );
68 else
69 tmp << aArray[i] << wxT( " " );
70 }
71
72 return tmp;
73}

Referenced by TOOL_DISPATCHER::DispatchWxEvent(), LIBEVAL::COMPILER::generateUCode(), TOOL_DISPATCHER::GetToolEvent(), FOOTPRINTS_LISTBOX::OnChar(), LIBRARY_LISTBOX::OnChar(), SYMBOLS_LISTBOX::OnChar(), EDA_BASE_FRAME::OnCharHook(), and GPCB_FPL_CACHE::parseParameters().

◆ dump() [2/2]

wxString dump ( const wxKeyEvent &  aEvent)

Debug helper for printing wxKeyEvent information.

Parameters
aEventis the wxKeyEvent to generate the print string from.
Returns
the wxKeyEvent information.

Definition at line 234 of file trace_helpers.cpp.

235{
236 wxString msg;
237 wxString eventType = wxS( "unknown" );
238
239 if( aEvent.GetEventType() == wxEVT_KEY_DOWN )
240 eventType = wxS( "KeyDown" );
241 else if( aEvent.GetEventType() == wxEVT_KEY_UP )
242 eventType = wxS( "KeyUp" );
243 else if( aEvent.GetEventType() == wxEVT_CHAR )
244 eventType = wxS( "Char" );
245 else if( aEvent.GetEventType() == wxEVT_CHAR_HOOK )
246 eventType = wxS( "Hook" );
247
248 // event key_name KeyCode modifiers Unicode raw_code raw_flags pos
249 msg.Printf( "%7s %15s %5d %c%c%c%c"
250#if wxUSE_UNICODE
251 "%5d (U+%04x)"
252#else
253 " none "
254#endif
255#ifdef wxHAS_RAW_KEY_CODES
256 " %7lu 0x%08lx"
257#else
258 " not-set not-set"
259#endif
260 " (%5d,%5d)",
261 eventType,
262 GetKeyName( aEvent ),
263 aEvent.GetKeyCode(),
264 aEvent.ControlDown() ? 'C' : '-',
265 aEvent.AltDown() ? 'A' : '-',
266 aEvent.ShiftDown() ? 'S' : '-',
267 aEvent.MetaDown() ? 'M' : '-'
268#if wxUSE_UNICODE
269 , aEvent.GetUnicodeKey()
270 , aEvent.GetUnicodeKey()
271#endif
272#ifdef wxHAS_RAW_KEY_CODES
273 , (unsigned long) aEvent.GetRawKeyCode()
274 , (unsigned long) aEvent.GetRawKeyFlags()
275#endif
276 , aEvent.GetX()
277 , aEvent.GetY()
278 );
279
280 return msg;
281}
wxString GetKeyName(const wxKeyEvent &aEvent)

References GetKeyName().