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.

86 lines
2.6KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021 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. #ifdef HEADLESS
  18. # error wrong include
  19. #endif
  20. #pragma once
  21. #include "DistrhoUtils.hpp"
  22. namespace rack {
  23. namespace window {
  24. struct Window;
  25. }
  26. }
  27. START_NAMESPACE_DISTRHO
  28. // -----------------------------------------------------------------------------------------------------------
  29. // NOTE make sure to never change the order, parameters indexes are based on this
  30. enum WindowParameterList {
  31. kWindowParameterShowTooltips,
  32. kWindowParameterCableOpacity,
  33. kWindowParameterCableTension,
  34. kWindowParameterRackBrightness,
  35. kWindowParameterHaloBrightness,
  36. kWindowParameterKnobMode,
  37. kWindowParameterWheelKnobControl,
  38. kWindowParameterWheelSensitivity,
  39. kWindowParameterLockModulePositions,
  40. kWindowParameterUpdateRateLimit,
  41. kWindowParameterBrowserSort,
  42. kWindowParameterBrowserZoom,
  43. kWindowParameterInvertZoom,
  44. kWindowParameterSqueezeModulePositions,
  45. kWindowParameterCount,
  46. };
  47. struct WindowParameters {
  48. float cableOpacity = 0.5f;
  49. float cableTension = 0.75f;
  50. float rackBrightness = 1.0f;
  51. float haloBrightness = 0.25f;
  52. float knobScrollSensitivity = 0.001f;
  53. float browserZoom = -1.0f;
  54. int knobMode = 0;
  55. int browserSort = 3;
  56. bool tooltips = true;
  57. bool knobScroll = false;
  58. bool lockModules = false;
  59. bool squeezeModules = true;
  60. bool invertZoom = false;
  61. // cardinal specific
  62. int rateLimit = 0;
  63. };
  64. struct WindowParametersCallback {
  65. virtual ~WindowParametersCallback() {}
  66. virtual void WindowParametersChanged(WindowParameterList param, float value) = 0;
  67. };
  68. void WindowParametersSave(rack::window::Window* window);
  69. void WindowParametersRestore(rack::window::Window* window);
  70. void WindowParametersSetCallback(rack::window::Window* window, WindowParametersCallback* callback);
  71. void WindowParametersSetValues(rack::window::Window* window, const WindowParameters& params);
  72. // -----------------------------------------------------------------------------------------------------------
  73. END_NAMESPACE_DISTRHO