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.

82 lines
2.6KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2022 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 3 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the LICENSE file.
  16. */
  17. #pragma once
  18. #include "DistrhoUtils.hpp"
  19. namespace rack {
  20. namespace window {
  21. struct Window;
  22. }
  23. }
  24. START_NAMESPACE_DISTRHO
  25. // -----------------------------------------------------------------------------------------------------------
  26. // NOTE make sure to never change the order, parameters indexes are based on this
  27. enum WindowParameterList {
  28. kWindowParameterShowTooltips,
  29. kWindowParameterCableOpacity,
  30. kWindowParameterCableTension,
  31. kWindowParameterRackBrightness,
  32. kWindowParameterHaloBrightness,
  33. kWindowParameterKnobMode,
  34. kWindowParameterWheelKnobControl,
  35. kWindowParameterWheelSensitivity,
  36. kWindowParameterLockModulePositions,
  37. kWindowParameterUpdateRateLimit,
  38. kWindowParameterBrowserSort,
  39. kWindowParameterBrowserZoom,
  40. kWindowParameterInvertZoom,
  41. kWindowParameterSqueezeModulePositions,
  42. kWindowParameterCount,
  43. };
  44. struct WindowParameters {
  45. float cableOpacity = 0.5f;
  46. float cableTension = 0.75f;
  47. float rackBrightness = 1.0f;
  48. float haloBrightness = 0.25f;
  49. float knobScrollSensitivity = 0.001f;
  50. float browserZoom = -1.0f;
  51. int knobMode = 0;
  52. int browserSort = 3;
  53. bool tooltips = true;
  54. bool knobScroll = false;
  55. bool lockModules = false;
  56. bool squeezeModules = true;
  57. bool invertZoom = false;
  58. // cardinal specific
  59. int rateLimit = 0;
  60. };
  61. struct WindowParametersCallback {
  62. virtual ~WindowParametersCallback() {}
  63. virtual void WindowParametersChanged(WindowParameterList param, float value) = 0;
  64. };
  65. void WindowParametersSave(rack::window::Window* window);
  66. void WindowParametersRestore(rack::window::Window* window);
  67. void WindowParametersSetCallback(rack::window::Window* window, WindowParametersCallback* callback);
  68. void WindowParametersSetValues(rack::window::Window* window, const WindowParameters& params);
  69. // -----------------------------------------------------------------------------------------------------------
  70. END_NAMESPACE_DISTRHO