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.

120 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. void syncfs();
  46. #endif
  47. std::string homeDir();
  48. void switchDarkMode(bool darkMode);
  49. } // namespace rack
  50. // -----------------------------------------------------------------------------------------------------------
  51. namespace patchUtils {
  52. void loadDialog();
  53. void loadPathDialog(const std::string& path, bool asTemplate = false);
  54. void loadSelectionDialog();
  55. void loadTemplate(bool factory);
  56. void loadTemplateDialog(bool factory);
  57. void revertDialog();
  58. void saveDialog(const std::string& path);
  59. void saveAsDialog();
  60. void saveAsDialogUncompressed();
  61. void saveTemplateDialog();
  62. void appendSelectionContextMenu(rack::ui::Menu* menu);
  63. void openBrowser(const std::string& url);
  64. } // namespace patchUtils
  65. // -----------------------------------------------------------------------------------------------------------
  66. #if defined(HAVE_LIBLO) && defined(HEADLESS)
  67. # define CARDINAL_INIT_OSC_THREAD
  68. #endif
  69. typedef void* lo_server_thread;
  70. START_NAMESPACE_DISTRHO
  71. class CardinalBasePlugin;
  72. class CardinalBaseUI;
  73. struct CardinalPluginContext;
  74. struct Initializer
  75. {
  76. #ifdef CARDINAL_INIT_OSC_THREAD
  77. lo_server_thread oscServerThread = nullptr;
  78. CardinalBasePlugin* remotePluginInstance = nullptr;
  79. #endif
  80. std::string templatePath;
  81. std::string factoryTemplatePath;
  82. bool shouldSaveSettings = false;
  83. Initializer(const CardinalBasePlugin* plugin, const CardinalBaseUI* ui);
  84. ~Initializer();
  85. void loadSettings(bool isRealInstance);
  86. };
  87. #ifndef HEADLESS
  88. void handleHostParameterDrag(const CardinalPluginContext* pcontext, uint index, bool started);
  89. #endif
  90. END_NAMESPACE_DISTRHO
  91. // -----------------------------------------------------------------------------------------------------------