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.

116 lines
2.9KB

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