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.

55 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. /** Loads a patch and nothing else.
  24. Returns whether the patch was loaded successfully.
  25. */
  26. bool load(std::string path);
  27. /** Loads the template patch. */
  28. void loadTemplate();
  29. void loadTemplateDialog();
  30. void loadAutosave();
  31. /** Loads a patch, sets the current path, and updates the recent patches. */
  32. void loadAction(std::string path);
  33. void loadDialog();
  34. void loadPathDialog(std::string path);
  35. /** Asks the user to reload the current patch. */
  36. void revertDialog();
  37. void pushRecentPath(std::string path);
  38. /** Disconnects all cables. */
  39. void disconnectDialog();
  40. json_t* toJson();
  41. void fromJson(json_t* rootJ);
  42. bool isLegacy(int level);
  43. void log(std::string msg);
  44. };
  45. } // namespace rack