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.

119 lines
3.0KB

  1. /*
  2. * DISTRHO Cardinal Plugin
  3. * Copyright (C) 2021-2023 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. #include <string>
  20. extern const std::string CARDINAL_VERSION;
  21. // -----------------------------------------------------------------------------------------------------------
  22. namespace rack {
  23. namespace ui {
  24. struct Menu;
  25. }
  26. namespace window {
  27. void generateScreenshot();
  28. }
  29. bool isMini();
  30. bool isStandalone();
  31. #ifdef ARCH_WIN
  32. enum SpecialPath {
  33. kSpecialPathUserProfile,
  34. kSpecialPathCommonProgramFiles,
  35. kSpecialPathProgramFiles,
  36. kSpecialPathAppData,
  37. kSpecialPathMyDocuments,
  38. };
  39. std::string getSpecialPath(SpecialPath type);
  40. #endif
  41. #ifdef DISTRHO_OS_WASM
  42. extern char* patchFromURL;
  43. extern char* patchRemoteURL;
  44. extern char* patchStorageSlug;
  45. #endif
  46. std::string homeDir();
  47. void switchDarkMode(bool darkMode);
  48. } // namespace rack
  49. // -----------------------------------------------------------------------------------------------------------
  50. namespace patchUtils {
  51. void loadDialog();
  52. void loadPathDialog(const std::string& path, bool asTemplate = false);
  53. void loadSelectionDialog();
  54. void loadTemplate(bool factory);
  55. void loadTemplateDialog(bool factory);
  56. void revertDialog();
  57. void saveDialog(const std::string& path);
  58. void saveAsDialog();
  59. void saveAsDialogUncompressed();
  60. void saveTemplateDialog();
  61. void appendSelectionContextMenu(rack::ui::Menu* menu);
  62. void openBrowser(const std::string& url);
  63. } // namespace patchUtils
  64. // -----------------------------------------------------------------------------------------------------------
  65. #if defined(HAVE_LIBLO) && defined(HEADLESS)
  66. # define CARDINAL_INIT_OSC_THREAD
  67. #endif
  68. typedef void* lo_server_thread;
  69. START_NAMESPACE_DISTRHO
  70. class CardinalBasePlugin;
  71. class CardinalBaseUI;
  72. struct CardinalPluginContext;
  73. struct Initializer
  74. {
  75. #ifdef CARDINAL_INIT_OSC_THREAD
  76. lo_server_thread oscServerThread = nullptr;
  77. CardinalBasePlugin* remotePluginInstance = nullptr;
  78. #endif
  79. std::string templatePath;
  80. std::string factoryTemplatePath;
  81. bool shouldSaveSettings = false;
  82. Initializer(const CardinalBasePlugin* plugin, const CardinalBaseUI* ui);
  83. ~Initializer();
  84. void loadSettings(bool isRealInstance);
  85. };
  86. #ifndef HEADLESS
  87. void handleHostParameterDrag(const CardinalPluginContext* pcontext, uint index, bool started);
  88. #endif
  89. END_NAMESPACE_DISTRHO
  90. // -----------------------------------------------------------------------------------------------------------