You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
1020B

  1. #pragma once
  2. #include <app/common.hpp>
  3. #include <app/PortWidget.hpp>
  4. #include <widget/FramebufferWidget.hpp>
  5. #include <widget/SvgWidget.hpp>
  6. #include <app/CircularShadow.hpp>
  7. #include <settings.hpp>
  8. namespace rack {
  9. namespace app {
  10. struct SvgPort : PortWidget {
  11. widget::FramebufferWidget* fb;
  12. CircularShadow* shadow;
  13. widget::SvgWidget* sw;
  14. SvgPort();
  15. void setSvg(std::shared_ptr<window::Svg> svg);
  16. DEPRECATED void setSVG(std::shared_ptr<window::Svg> svg) {
  17. setSvg(svg);
  18. }
  19. };
  20. DEPRECATED typedef SvgPort SVGPort;
  21. struct ThemedSvgPort : SvgPort {
  22. std::shared_ptr<window::Svg> lightSvg;
  23. std::shared_ptr<window::Svg> darkSvg;
  24. void setSvg(std::shared_ptr<window::Svg> lightSvg, std::shared_ptr<window::Svg> darkSvg) {
  25. this->lightSvg = lightSvg;
  26. this->darkSvg = darkSvg;
  27. SvgPort::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg);
  28. }
  29. void step() override {
  30. SvgPort::setSvg(settings::preferDarkPanels ? darkSvg : lightSvg);
  31. SvgPort::step();
  32. }
  33. };
  34. } // namespace app
  35. } // namespace rack