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.

56 lines
1.3KB

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