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