diff --git a/common/tool/tool_dispatcher.cpp b/common/tool/tool_dispatcher.cpp index afb24ae6e2..863867a6d0 100644 --- a/common/tool/tool_dispatcher.cpp +++ b/common/tool/tool_dispatcher.cpp @@ -26,20 +26,15 @@ #include #include #include - #include -#include #include #include #include #include #include #include - -#include #include - -#include +#include #include #include #include @@ -279,21 +274,13 @@ bool isKeySpecialCode( int aKeyCode ) { // These keys have predefined actions (like move thumbtrack cursor), // and we do not want these actions executed - const enum wxKeyCode special_keys[] = + const std::vector special_keys = { WXK_PAGEUP, WXK_PAGEDOWN, WXK_NUMPAD_PAGEUP, WXK_NUMPAD_PAGEDOWN }; - bool isInList = false; - - for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ ) - { - if( special_keys[ii] == aKeyCode ) - isInList = true; - } - - return isInList; + return alg::contains( special_keys, aKeyCode ); } @@ -302,20 +289,12 @@ bool isKeySpecialCode( int aKeyCode ) // that is not used alone in kicad static bool isKeyModifierOnly( int aKeyCode ) { - const enum wxKeyCode special_keys[] = + const std::vector special_keys = { - WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT,WXK_ALT + WXK_CONTROL, WXK_RAW_CONTROL, WXK_SHIFT, WXK_ALT }; - bool isInList = false; - - for( unsigned ii = 0; ii < arrayDim( special_keys ) && !isInList; ii++ ) - { - if( special_keys[ii] == aKeyCode ) - isInList = true; - } - - return isInList; + return alg::contains( special_keys, aKeyCode ); } @@ -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 // events, and if they aren't skipped then they are propagated to other frames (which we // don't want). - if( (type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK) - && !keyIsSpecial - && !handled - && !keyIsEscape ) + if( ( type == wxEVT_CHAR || type == wxEVT_CHAR_HOOK ) + && !keyIsSpecial + && !handled + && !keyIsEscape ) + { aEvent.Skip(); + } wxLogTrace( kicadTraceToolStack, "TOOL_DISPATCHER::DispatchWxEvent - Wx event skipped: %s", ( aEvent.GetSkipped() ? "true" : "false" ) ); diff --git a/common/widgets/ui_common.cpp b/common/widgets/ui_common.cpp index 8fa1d284a8..b456ad7c63 100644 --- a/common/widgets/ui_common.cpp +++ b/common/widgets/ui_common.cpp @@ -270,7 +270,7 @@ bool KIUI::IsInputControlFocused( wxWindow* aFocus ) wxSlider* sliderCtl = dynamic_cast( aFocus ); // 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; wxWindow* parent = aFocus->GetParent();