Simplification, formatting, and spelling.

This commit is contained in:
Jeff Young 2022-10-03 17:53:13 +01:00
parent 15d52c91e4
commit 2422b9a7c8
2 changed files with 13 additions and 32 deletions

View File

@ -26,20 +26,15 @@
#include <ignore.h> #include <ignore.h>
#include <macros.h> #include <macros.h>
#include <trace_helpers.h> #include <trace_helpers.h>
#include <tool/tool_manager.h> #include <tool/tool_manager.h>
#include <tool/tools_holder.h>
#include <tool/tool_dispatcher.h> #include <tool/tool_dispatcher.h>
#include <tool/actions.h> #include <tool/actions.h>
#include <tool/action_manager.h> #include <tool/action_manager.h>
#include <tool/action_menu.h> #include <tool/action_menu.h>
#include <view/view.h> #include <view/view.h>
#include <view/wx_view_controls.h> #include <view/wx_view_controls.h>
#include <class_draw_panel_gal.h>
#include <eda_draw_frame.h> #include <eda_draw_frame.h>
#include <core/kicad_algo.h>
#include <core/arraydim.h>
#include <optional> #include <optional>
#include <wx/log.h> #include <wx/log.h>
#include <wx/stc/stc.h> #include <wx/stc/stc.h>
@ -279,21 +274,13 @@ bool isKeySpecialCode( int aKeyCode )
{ {
// These keys have predefined actions (like move thumbtrack cursor), // These keys have predefined actions (like move thumbtrack cursor),
// and we do not want these actions executed // and we do not want these actions executed
const enum wxKeyCode special_keys[] = const std::vector<enum wxKeyCode> special_keys =
{ {
WXK_PAGEUP, WXK_PAGEDOWN, WXK_PAGEUP, WXK_PAGEDOWN,
WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN
}; };
bool isInList = false; return alg::contains( special_keys, aKeyCode );
for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
{
if( special_keys[ii] == aKeyCode )
isInList = true;
}
return isInList;
} }
@ -302,20 +289,12 @@ bool isKeySpecialCode( int aKeyCode )
// that is not used alone in kicad // that is not used alone in kicad
static bool isKeyModifierOnly( int aKeyCode ) static bool isKeyModifierOnly( int aKeyCode )
{ {
const enum wxKeyCode special_keys[] = const std::vector<enum wxKeyCode> special_keys =
{ {
WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT,WXK_ALT WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT, WXK_ALT
}; };
bool isInList = false; return alg::contains( special_keys, aKeyCode );
for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ )
{
if( special_keys[ii] == aKeyCode )
isInList = true;
}
return isInList;
} }
@ -634,11 +613,13 @@ void TOOL_DISPATCHER::DispatchWxEvent( wxEvent& aEvent )
// Escape key presses are never skipped by the handler since they correspond to tool cancel // Escape key presses are never skipped by the handler since they correspond to tool cancel
// events, and if they aren't skipped then they are propagated to other frames (which we // events, and if they aren't skipped then they are propagated to other frames (which we
// don't want). // don't want).
if( (type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK) if( ( type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK )
&& !keyIsSpecial && !keyIsSpecial
&& !handled && !handled
&& !keyIsEscape ) && !keyIsEscape )
{
aEvent.Skip(); aEvent.Skip();
}
wxLogTrace( kicadTraceToolStack, "TOOL_DISPATCHER::DispatchWxEvent - Wx event skipped: %s", wxLogTrace( kicadTraceToolStack, "TOOL_DISPATCHER::DispatchWxEvent - Wx event skipped: %s",
( aEvent.GetSkipped() ? "true" : "false" ) ); ( aEvent.GetSkipped() ? "true" : "false" ) );

View File

@ -270,7 +270,7 @@ bool KIUI::IsInputControlFocused( wxWindow* aFocus )
wxSlider* sliderCtl = dynamic_cast<wxSlider*>( aFocus ); wxSlider* sliderCtl = dynamic_cast<wxSlider*>( aFocus );
// Data view control is annoying, the focus is on a "wxDataViewCtrlMainWindow" class that // Data view control is annoying, the focus is on a "wxDataViewCtrlMainWindow" class that
// is not formerly exported via the header. // is not formally exported via the header.
wxDataViewCtrl* dataViewCtrl = nullptr; wxDataViewCtrl* dataViewCtrl = nullptr;
wxWindow* parent = aFocus->GetParent(); wxWindow* parent = aFocus->GetParent();