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. /** Enables certain compatibility behavior based on the value */
  9. int legacy = 0;
  10. std::string warningLog;
  11. PatchManager();
  12. ~PatchManager();
  13. void launch(std::string pathArg);
  14. /** Clears the patch. */
  15. void clear();
  16. /** Saves the patch and nothing else. */
  17. void save(std::string path);
  18. void saveDialog();
  19. void saveAsDialog();
  20. void saveTemplateDialog();
  21. void saveAutosave();
  22. void cleanAutosave();
  23. /** Loads a patch and nothing else.
  24. Returns whether the patch was loaded successfully.
  25. */
  26. void load(std::string path);
  27. /** Loads the template patch. */
  28. void loadTemplate();
  29. void loadTemplateDialog();
  30. bool hasAutosave();
  31. void loadAutosave();
  32. /** Loads a patch, sets the current path, and updates the recent patches. */
  33. void loadAction(std::string path);
  34. void loadDialog();
  35. void loadPathDialog(std::string path);
  36. /** Asks the user to reload the current patch. */
  37. void revertDialog();
  38. void pushRecentPath(std::string path);
  39. /** Disconnects all cables. */
  40. void disconnectDialog();
  41. json_t* toJson();
  42. void fromJson(json_t* rootJ);
  43. bool isLegacy(int level);
  44. void log(std::string msg);
  45. };
  46. } // namespace rack