From 7b1d45d1fba849095aef1aef2e16090e7aee9c03 Mon Sep 17 00:00:00 2001 From: Michael Richters Date: Tue, 1 Mar 2022 10:06:52 -0600 Subject: [PATCH] Remove deprecated LED-ActiveModColor code Signed-off-by: Michael Richters --- docs/UPGRADING.md | 8 ++++ .../plugin/LED-ActiveModColor.cpp | 16 +++----- .../kaleidoscope/plugin/LED-ActiveModColor.h | 38 ++++--------------- 3 files changed, 21 insertions(+), 41 deletions(-) diff --git a/docs/UPGRADING.md b/docs/UPGRADING.md index da28bef9..d41f23be 100644 --- a/docs/UPGRADING.md +++ b/docs/UPGRADING.md @@ -1060,6 +1060,14 @@ Second, the `Layer.eventHandler()` function has been deprecated. There wasn't mu # Removed APIs +#### ActiveModColor public variables + +The following deprecated `ActiveModColorEffect` public variables were removed on **2022-03-03**. Please use the following methods instead: + + - For `ActiveModColor.highlight_color`, use `ActiveModColor.setHighlightColor(color)` + - For `ActiveModColor.oneshot_color`, use `ActiveModColor.setOneShotColor(color)` + - For `ActiveModColor.sticky_color`, use `ActiveModColor.setStickyColor(color)` + #### OneShot public variables The following deprecated `OneShot` public variables were removed on **2022-03-03**. Please use the following methods instead: diff --git a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp index ac1e55a8..f0891d70 100644 --- a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp +++ b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.cpp @@ -28,9 +28,9 @@ namespace plugin { KeyAddrBitfield ActiveModColorEffect::mod_key_bits_; bool ActiveModColorEffect::highlight_normal_modifiers_ = true; -cRGB ActiveModColorEffect::highlight_color = CRGB(160, 160, 160); -cRGB ActiveModColorEffect::oneshot_color = CRGB(160, 160, 0); -cRGB ActiveModColorEffect::sticky_color = CRGB(160, 0, 0); +cRGB ActiveModColorEffect::highlight_color_ = CRGB(160, 160, 160); +cRGB ActiveModColorEffect::oneshot_color_ = CRGB(160, 160, 0); +cRGB ActiveModColorEffect::sticky_color_ = CRGB(160, 0, 0); // ----------------------------------------------------------------------------- EventHandlerResult ActiveModColorEffect::onKeyEvent(KeyEvent &event) { @@ -81,20 +81,16 @@ EventHandlerResult ActiveModColorEffect::beforeSyncingLeds() { // This loop iterates through only the `key_addr`s that have their bits in the // `mod_key_bits_` bitfield set. for (KeyAddr key_addr : mod_key_bits_) { - -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" if (::OneShot.isTemporary(key_addr)) { // Temporary OneShot keys get one color: - ::LEDControl.setCrgbAt(key_addr, oneshot_color); + ::LEDControl.setCrgbAt(key_addr, oneshot_color_); } else if (::OneShot.isSticky(key_addr)) { // Sticky OneShot keys get another color: - ::LEDControl.setCrgbAt(key_addr, sticky_color); + ::LEDControl.setCrgbAt(key_addr, sticky_color_); } else if (highlight_normal_modifiers_) { // Normal modifiers get a third color: - ::LEDControl.setCrgbAt(key_addr, highlight_color); + ::LEDControl.setCrgbAt(key_addr, highlight_color_); } -#pragma GCC diagnostic pop } return EventHandlerResult::OK; diff --git a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.h b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.h index 3e5124b1..3f127869 100644 --- a/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.h +++ b/plugins/Kaleidoscope-LED-ActiveModColor/src/kaleidoscope/plugin/LED-ActiveModColor.h @@ -23,48 +23,20 @@ #define MAX_MODS_PER_LAYER 16 -// ============================================================================= -#define _DEPRECATED_MESSAGE_ACTIVEMODCOLOR_COLORS \ - "The `ActiveModColorEffect` public class variables have been deprecated. \n" \ - "Please use the following methods instead: \n" \ - " - for `highlight_color` => `setHighlightColor(color)` \n" \ - " - for `oneshot_color` => `setOneShotColor(color)` \n" \ - " - for `sticky_color` => `setStickyColor(color)` \n" \ - "These variables will be removed after 2021-08-01." - namespace kaleidoscope { namespace plugin { class ActiveModColorEffect : public kaleidoscope::Plugin { public: ActiveModColorEffect(void) {} - // When removing access to these variables, don't delete them. Instead, make - // them private, and add trailing underscores here and in - // LED-ActiveModColor.cpp. - DEPRECATED(ACTIVEMODCOLOR_COLORS) - static cRGB highlight_color; - DEPRECATED(ACTIVEMODCOLOR_COLORS) - static cRGB oneshot_color; - DEPRECATED(ACTIVEMODCOLOR_COLORS) - static cRGB sticky_color; - static void setHighlightColor(cRGB color) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - highlight_color = color; -#pragma GCC diagnostic pop + highlight_color_ = color; } static void setOneShotColor(cRGB color) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - oneshot_color = color; -#pragma GCC diagnostic pop + oneshot_color_ = color; } static void setOnestickyColor(cRGB color) { -#pragma GCC diagnostic push -#pragma GCC diagnostic ignored "-Wdeprecated-declarations" - sticky_color = color; -#pragma GCC diagnostic pop + sticky_color_ = color; } static void highlightNormalModifiers(bool value) { @@ -77,6 +49,10 @@ class ActiveModColorEffect : public kaleidoscope::Plugin { private: static bool highlight_normal_modifiers_; static KeyAddrBitfield mod_key_bits_; + + static cRGB highlight_color_; + static cRGB oneshot_color_; + static cRGB sticky_color_; }; } }