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.

88 lines
2.2KB

  1. #include "common.hpp"
  2. namespace rack_plugin_CastleRocktronics {
  3. struct ShadedKnob : virtual Knob, FramebufferWidget {
  4. float minAngle = -2.35619f;
  5. float maxAngle = 2.35619f;
  6. TransformWidget* markerTransformWidget;
  7. SVGWidget* markerSVGWidget;
  8. SVGWidget* highlightWidget;
  9. TransformWidget* knobTransformWidget;
  10. SVGWidget* knobSVGWidget;
  11. CircularShadow* shadowWidget;
  12. float shadowBlur = 2.0f;
  13. Vec shadowOffset = Vec(-2, 2);
  14. ShadedKnob();
  15. void setMarker(std::shared_ptr<SVG> svg);
  16. void setHighlight(std::shared_ptr<SVG> svg);
  17. void setKnob(std::shared_ptr<SVG> svg);
  18. void step() override;
  19. void onChange(EventChange& e) override;
  20. };
  21. struct TenHex : SVGPort {
  22. TenHex() {
  23. background->svg = SVG::load(
  24. assetPlugin(plugin, "res/components/ports/10mmHex_black.svg"));
  25. background->wrap();
  26. box.size = background->box.size;
  27. }
  28. };
  29. struct SevenHalfHex : SVGPort {
  30. SevenHalfHex() {
  31. background->svg =
  32. SVG::load(assetPlugin(plugin, "res/components/ports/7_5mm_hex.svg"));
  33. background->wrap();
  34. box.size = background->box.size;
  35. }
  36. };
  37. struct SevenHalfKnurled : SVGPort {
  38. SevenHalfKnurled() {
  39. background->svg =
  40. SVG::load(assetPlugin(plugin, "res/components/ports/knurled-jack.svg"));
  41. background->wrap();
  42. box.size = background->box.size;
  43. }
  44. };
  45. struct CastleTrimpot : ShadedKnob {
  46. CastleTrimpot() {
  47. shadowBlur = 1.0f;
  48. shadowOffset = Vec(-1, 1);
  49. setKnob(SVG::load(assetPlugin(plugin, "res/components/trimpot/shaft.svg")));
  50. setHighlight(
  51. SVG::load(assetPlugin(plugin, "res/components/trimpot/highlight.svg")));
  52. setMarker(
  53. SVG::load(assetPlugin(plugin, "res/components/trimpot/marker.svg")));
  54. }
  55. };
  56. struct DelvinToggleTwo : SVGSwitch, ToggleSwitch {
  57. DelvinToggleTwo() {
  58. addFrame(SVG::load(
  59. assetPlugin(plugin, "res/components/switches/delvin/2pos_0.svg")));
  60. addFrame(SVG::load(
  61. assetPlugin(plugin, "res/components/switches/delvin/2pos_1.svg")));
  62. }
  63. };
  64. struct MThreeScrew : SVGScrew {
  65. MThreeScrew() {
  66. sw->setSVG(
  67. SVG::load(assetPlugin(plugin, "res/components/screws/screw.svg")));
  68. box.size = sw->box.size;
  69. }
  70. };
  71. } // namespace rack_plugin_CastleRocktronics