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.

65 lines
1.5KB

  1. #pragma once
  2. #include <jansson.h>
  3. #include <common.hpp>
  4. namespace rack {
  5. namespace patch {
  6. struct Manager {
  7. struct Internal;
  8. Internal* internal;
  9. /** The currently loaded patch file path */
  10. std::string path;
  11. /** Path to autosave dir */
  12. std::string autosavePath;
  13. /** Path to user template patch */
  14. std::string templatePath;
  15. /** Path to factory template patch */
  16. std::string factoryTemplatePath;
  17. /** Append to this while loading/saving a patch to display messages to the user after success. */
  18. std::string warningLog;
  19. Manager();
  20. ~Manager();
  21. void launch(std::string pathArg);
  22. /** Clears the patch. */
  23. void clear();
  24. /** Saves the patch and nothing else. */
  25. void save(std::string path);
  26. void saveDialog();
  27. void saveAsDialog();
  28. void saveTemplateDialog();
  29. void saveAutosave();
  30. void cleanAutosave();
  31. /** Loads a patch and nothing else.
  32. Returns whether the patch was loaded successfully.
  33. */
  34. void load(std::string path);
  35. /** Loads the template patch. */
  36. void loadTemplate();
  37. void loadTemplateDialog();
  38. bool hasAutosave();
  39. void loadAutosave();
  40. /** Loads a patch, sets the current path, and updates the recent patches. */
  41. void loadAction(std::string path);
  42. void loadDialog();
  43. void loadPathDialog(std::string path);
  44. /** Asks the user to reload the current patch. */
  45. void revertDialog();
  46. void pushRecentPath(std::string path);
  47. /** Disconnects all cables. */
  48. void disconnectDialog();
  49. json_t* toJson();
  50. void fromJson(json_t* rootJ);
  51. void log(std::string msg);
  52. };
  53. } // namespace patch
  54. } // namespace rack