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

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

Referenced by 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 229 of file trace_helpers.cpp.

230 {
231  wxString msg;
232  wxString eventType = "unknown";
233 
234  if( aEvent.GetEventType() == wxEVT_KEY_DOWN )
235  eventType = "KeyDown";
236  else if( aEvent.GetEventType() == wxEVT_KEY_UP )
237  eventType = "KeyUp";
238  else if( aEvent.GetEventType() == wxEVT_CHAR )
239  eventType = "Char";
240  else if( aEvent.GetEventType() == wxEVT_CHAR_HOOK )
241  eventType = "Hook";
242 
243  // event key_name KeyCode modifiers Unicode raw_code raw_flags pos
244  msg.Printf( "%7s %15s %5d %c%c%c%c"
245 #if wxUSE_UNICODE
246  "%5d (U+%04x)"
247 #else
248  " none "
249 #endif
250 #ifdef wxHAS_RAW_KEY_CODES
251  " %7lu 0x%08lx"
252 #else
253  " not-set not-set"
254 #endif
255  " (%5d,%5d)"
256  "\n",
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 204 of file trace_helpers.cpp.

205 {
206  int keycode = aEvent.GetKeyCode();
207  const char* virt = GetVirtualKeyCodeName( keycode );
208 
209  if( virt )
210  return virt;
211 
212  if( keycode > 0 && keycode < 32 )
213  return wxString::Format( "Ctrl-%c", (unsigned char)('A' + keycode - 1) );
214 
215  if( keycode >= 32 && keycode < 128 )
216  return wxString::Format( "'%c'", (unsigned char)keycode );
217 
218 #if wxUSE_UNICODE
219  int uc = aEvent.GetUnicodeKey();
220 
221  if( uc != WXK_NONE )
222  return wxString::Format( "'%c'", uc );
223 #endif
224 
225  return "unknown";
226 }
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 83 of file trace_helpers.cpp.

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