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.

111 lines
2.7KB

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