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.

patch.hpp 1.2KB

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