KiCad PCB EDA Suite
trace_helpers.cpp File Reference

wxLogTrace helper implementation. More...

#include <trace_helpers.h>

Go to the source code of this file.

Macros

#define WXK_(x)   case WXK_##x: return #x;
 

Functions

wxString dump (const wxArrayString &aArray)
 Debug helper for printing wxArrayString contents. More...
 
const char * GetVirtualKeyCodeName (int keycode)
 
wxString GetKeyName (const wxKeyEvent &aEvent)
 
wxString dump (const wxKeyEvent &aEvent)
 Debug helper for printing wxKeyEvent information. More...
 

Variables

const wxChar *const traceFindReplace = wxT( "KICAD_FIND_REPLACE" )
 Flag to enable find and replace debug tracing. More...
 
const wxChar *const kicadTraceCoords = wxT( "KICAD_COORDS" )
 Flag to enable draw panel coordinate debug tracing. More...
 
const wxChar *const kicadTraceKeyEvent = wxT( "KICAD_KEY_EVENTS" )
 Flag to enable wxKeyEvent debug tracing. More...
 
const wxChar *const kicadTraceToolStack = wxT( "KICAD_TOOL_STACK" )
 Flag to enable tracing of the tool handling stack. More...
 
const wxChar *const kicadTraceCoroutineStack = wxT( "KICAD_COROUTINE_STACK" )
 Flag to enable tracing of the coroutine call stack. More...
 
const wxChar *const traceSchLibMem = wxT( "KICAD_SCH_LIB_MEM" )
 Flag to enable schematic library memory deletion debug output. More...
 
const wxChar *const traceFindItem = wxT( "KICAD_FIND_ITEM" )
 Flag to enable find debug tracing. More...
 
const wxChar *const traceSchLegacyPlugin = wxT( "KICAD_SCH_LEGACY_PLUGIN" )
 Flag to enable legacy schematic plugin debug output. More...
 
const wxChar *const traceGedaPcbPlugin = wxT( "KICAD_GEDA_PLUGIN" )
 Flag to enable GEDA PCB plugin debug output. More...
 
const wxChar *const traceKicadPcbPlugin = wxT( "KICAD_PCB_PLUGIN" )
 Flag to enable GEDA PCB plugin debug output. More...
 
const wxChar *const tracePrinting = wxT( "KICAD_PRINT" )
 Flag to enable print controller debug output. More...
 
const wxChar *const traceAutoSave = wxT( "KICAD_AUTOSAVE" )
 Flag to enable auto save feature debug tracing. More...
 
const wxChar *const tracePathsAndFiles = wxT( "KICAD_PATHS_AND_FILES" )
 Flag to enable path and file name debug output. More...
 
const wxChar *const traceLocale = wxT( "KICAD_LOCALE" )
 Flag to enable locale debug output. More...
 
const wxChar *const traceScreen = wxT( "KICAD_SCREEN" )
 Flag to enable debug output of BASE_SCREEN and it's derivatives. More...
 
const wxChar *const traceZoomScroll = wxT( "KICAD_ZOOM_SCROLL" )
 Flag to enable debug output of zoom-scrolling calculations in KIGFX::ZOOM_CONTROLLER and derivatives. More...
 
const wxChar *const traceSymbolResolver = wxT( "KICAD_SYM_RESOLVE" )
 Flag to enable debug output of symbol library resolver results. More...
 
const wxChar *const traceDisplayLocation = wxT( "KICAD_DISPLAY_LOCATION" )
 Flag to enable debug output of display positioning logic. More...
 
const wxChar *const traceSchSheetPaths = wxT( "KICAD_SCH_SHEET_PATHS" )
 Flag to enable debug output of schematic symbol sheet path manipulation code. More...
 
const wxChar *const traceEnvVars = wxT( "KICAD_ENV_VARS" )
 Flag to enable debug output of environment variable operations. More...
 
const wxChar *const traceGalProfile = wxT( "KICAD_GAL_PROFILE" )
 Flag to enable debug output of GAL performance profiling. More...
 

Detailed Description

wxLogTrace helper implementation.

Definition in file trace_helpers.cpp.

Macro Definition Documentation

◆ WXK_

#define WXK_ (   x)    case WXK_##x: return #x;

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 56 of file trace_helpers.cpp.

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

Referenced by TOOL_DISPATCHER::DispatchWxEvent(), LIBEVAL::COMPILER::generateUCode(), TOOL_DISPATCHER::GetToolEvent(), FOOTPRINTS_LISTBOX::OnChar(), LIBRARY_LISTBOX::OnChar(), COMPONENTS_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 230 of file trace_helpers.cpp.

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

References GetKeyName().

◆ GetKeyName()

wxString GetKeyName ( const wxKeyEvent &  aEvent)

Definition at line 205 of file trace_helpers.cpp.

206 {
207  int keycode = aEvent.GetKeyCode();
208  const char* virt = GetVirtualKeyCodeName( keycode );
209 
210  if( virt )
211  return virt;
212 
213  if( keycode > 0 && keycode < 32 )
214  return wxString::Format( "Ctrl-%c", (unsigned char)('A' + keycode - 1) );
215 
216  if( keycode >= 32 && keycode < 128 )
217  return wxString::Format( "'%c'", (unsigned char)keycode );
218 
219 #if wxUSE_UNICODE
220  int uc = aEvent.GetUnicodeKey();
221 
222  if( uc != WXK_NONE )
223  return wxString::Format( "'%c'", uc );
224 #endif
225 
226  return "unknown";
227 }
const char * GetVirtualKeyCodeName(int keycode)
void Format(OUTPUTFORMATTER *out, int aNestLevel, int aCtl, const CPTREE &aTree)
Output a PTREE into s-expression format via an OUTPUTFORMATTER derivative.
Definition: ptree.cpp:200

References Format(), and GetVirtualKeyCodeName().

Referenced by dump().

◆ GetVirtualKeyCodeName()

const char* GetVirtualKeyCodeName ( int  keycode)

Definition at line 84 of file trace_helpers.cpp.

85 {
86  switch ( keycode )
87  {
88 #define WXK_(x) \
89  case WXK_##x: return #x;
90 
91  WXK_(BACK)
92  WXK_(TAB)
93  WXK_(RETURN)
94  WXK_(ESCAPE)
95  WXK_(SPACE)
96  WXK_(DELETE)
97  WXK_(START)
98  WXK_(LBUTTON)
99  WXK_(RBUTTON)
100  WXK_(CANCEL)
101  WXK_(MBUTTON)
102  WXK_(CLEAR)
103  WXK_(SHIFT)
104  WXK_(ALT)
105  WXK_(CONTROL)
106  WXK_(MENU)
107  WXK_(PAUSE)
108  WXK_(CAPITAL)
109  WXK_(END)
110  WXK_(HOME)
111  WXK_(LEFT)
112  WXK_(UP)
113  WXK_(RIGHT)
114  WXK_(DOWN)
115  WXK_(SELECT)
116  WXK_(PRINT)
117  WXK_(EXECUTE)
118  WXK_(SNAPSHOT)
119  WXK_(INSERT)
120  WXK_(HELP)
121  WXK_(NUMPAD0)
122  WXK_(NUMPAD1)
123  WXK_(NUMPAD2)
124  WXK_(NUMPAD3)
125  WXK_(NUMPAD4)
126  WXK_(NUMPAD5)
127  WXK_(NUMPAD6)
128  WXK_(NUMPAD7)
129  WXK_(NUMPAD8)
130  WXK_(NUMPAD9)
131  WXK_(MULTIPLY)
132  WXK_(ADD)
133  WXK_(SEPARATOR)
134  WXK_(SUBTRACT)
135  WXK_(DECIMAL)
136  WXK_(DIVIDE)
137  WXK_(F1)
138  WXK_(F2)
139  WXK_(F3)
140  WXK_(F4)
141  WXK_(F5)
142  WXK_(F6)
143  WXK_(F7)
144  WXK_(F8)
145  WXK_(F9)
146  WXK_(F10)
147  WXK_(F11)
148  WXK_(F12)
149  WXK_(F13)
150  WXK_(F14)
151  WXK_(F15)
152  WXK_(F16)
153  WXK_(F17)
154  WXK_(F18)
155  WXK_(F19)
156  WXK_(F20)
157  WXK_(F21)
158  WXK_(F22)
159  WXK_(F23)
160  WXK_(F24)
161  WXK_(NUMLOCK)
162  WXK_(SCROLL)
163  WXK_(PAGEUP)
164  WXK_(PAGEDOWN)
165  WXK_(NUMPAD_SPACE)
166  WXK_(NUMPAD_TAB)
167  WXK_(NUMPAD_ENTER)
168  WXK_(NUMPAD_F1)
169  WXK_(NUMPAD_F2)
170  WXK_(NUMPAD_F3)
171  WXK_(NUMPAD_F4)
172  WXK_(NUMPAD_HOME)
173  WXK_(NUMPAD_LEFT)
174  WXK_(NUMPAD_UP)
175  WXK_(NUMPAD_RIGHT)
176  WXK_(NUMPAD_DOWN)
177  WXK_(NUMPAD_PAGEUP)
178  WXK_(NUMPAD_PAGEDOWN)
179  WXK_(NUMPAD_END)
180  WXK_(NUMPAD_BEGIN)
181  WXK_(NUMPAD_INSERT)
182  WXK_(NUMPAD_DELETE)
183  WXK_(NUMPAD_EQUAL)
184  WXK_(NUMPAD_MULTIPLY)
185  WXK_(NUMPAD_ADD)
186  WXK_(NUMPAD_SEPARATOR)
187  WXK_(NUMPAD_SUBTRACT)
188  WXK_(NUMPAD_DECIMAL)
189  WXK_(NUMPAD_DIVIDE)
190 
191  WXK_(WINDOWS_LEFT)
192  WXK_(WINDOWS_RIGHT)
193 #ifdef __WXOSX__
194  WXK_(RAW_CONTROL)
195 #endif
196 #undef WXK_
197 
198  default:
199  return NULL;
200  }
201 }
#define WXK_(x)
#define NULL
static VECTOR2D CLEAR
Definition: am_param.h:150

References ADD, CLEAR, INSERT, LEFT, NULL, RIGHT, SELECT, SUBTRACT, and WXK_.

Referenced by GetKeyName().