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;
  10. std::string warningLog;
  11. PatchManager();
  12. ~PatchManager();
  13. /** Resets the history and scroll position to prepare for a new patch. */
  14. void reset();
  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. 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