Audio plugin host https://kx.studio/carla
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.

101 lines
2.0KB

  1. /*
  2. ZynAddSubFX - a software synthesizer
  3. Presets.cpp - Presets and Clipboard management
  4. Copyright (C) 2002-2005 Nasca Octavian Paul
  5. Author: Nasca Octavian Paul
  6. This program is free software; you can redistribute it and/or
  7. modify it under the terms of the GNU General Public License
  8. as published by the Free Software Foundation; either version 2
  9. of the License, or (at your option) any later version.
  10. */
  11. #include "Presets.h"
  12. #include "../Misc/XMLwrapper.h"
  13. #include "PresetsStore.h"
  14. #include <string.h>
  15. namespace zyncarla {
  16. Presets::Presets()
  17. {
  18. type[0] = 0;
  19. }
  20. Presets::~Presets()
  21. {}
  22. void Presets::setpresettype(const char *type)
  23. {
  24. strcpy(this->type, type);
  25. }
  26. void Presets::copy(PresetsStore &ps, const char *name)
  27. {
  28. XMLwrapper xml;
  29. //used only for the clipboard
  30. if(name == NULL)
  31. xml.minimal = false;
  32. char type[MAX_PRESETTYPE_SIZE];
  33. strcpy(type, this->type);
  34. //strcat(type, "n");
  35. if(name == NULL)
  36. if(strstr(type, "Plfo") != NULL)
  37. strcpy(type, "Plfo");
  38. xml.beginbranch(type);
  39. add2XML(xml);
  40. xml.endbranch();
  41. if(name == NULL)
  42. ps.copyclipboard(xml, type);
  43. else
  44. ps.copypreset(xml, type, name);
  45. }
  46. #if 0
  47. void Presets::paste(PresetsStore &ps, int npreset)
  48. {
  49. char type[MAX_PRESETTYPE_SIZE];
  50. strcpy(type, this->type);
  51. //strcat(type, "n");
  52. if(npreset == 0)
  53. if(strstr(type, "Plfo") != NULL)
  54. strcpy(type, "Plfo");
  55. XMLwrapper xml;
  56. if(npreset == 0) {
  57. if(!checkclipboardtype(ps))
  58. return;
  59. if(!ps.pasteclipboard(xml))
  60. return;
  61. } else if(!ps.pastepreset(xml, npreset))
  62. return;
  63. if(xml.enterbranch(type) == 0)
  64. return;
  65. defaults();
  66. getfromXML(&xml);
  67. xml.exitbranch();
  68. }
  69. #endif
  70. bool Presets::checkclipboardtype(PresetsStore &ps)
  71. {
  72. return ps.checkclipboardtype(type);
  73. }
  74. void Presets::deletepreset(PresetsStore &ps, int npreset)
  75. {
  76. ps.deletepreset(npreset);
  77. }
  78. }