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.

107 lines
2.3KB

  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 modify
  7. it under the terms of version 2 of the GNU General Public License
  8. as published by the Free Software Foundation.
  9. This program is distributed in the hope that it will be useful,
  10. but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. GNU General Public License (version 2 or later) for more details.
  13. You should have received a copy of the GNU General Public License (version 2)
  14. along with this program; if not, write to the Free Software Foundation,
  15. Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  16. */
  17. #include "Presets.h"
  18. #include "../Misc/XMLwrapper.h"
  19. #include "PresetsStore.h"
  20. #include <string.h>
  21. Presets::Presets()
  22. {
  23. type[0] = 0;
  24. }
  25. Presets::~Presets()
  26. {}
  27. void Presets::setpresettype(const char *type)
  28. {
  29. strcpy(this->type, type);
  30. }
  31. void Presets::copy(PresetsStore &ps, const char *name)
  32. {
  33. XMLwrapper xml;
  34. //used only for the clipboard
  35. if(name == NULL)
  36. xml.minimal = false;
  37. char type[MAX_PRESETTYPE_SIZE];
  38. strcpy(type, this->type);
  39. //strcat(type, "n");
  40. if(name == NULL)
  41. if(strstr(type, "Plfo") != NULL)
  42. strcpy(type, "Plfo");
  43. xml.beginbranch(type);
  44. add2XML(&xml);
  45. xml.endbranch();
  46. if(name == NULL)
  47. ps.copyclipboard(xml, type);
  48. else
  49. ps.copypreset(xml, type, name);
  50. }
  51. #if 0
  52. void Presets::paste(PresetsStore &ps, int npreset)
  53. {
  54. char type[MAX_PRESETTYPE_SIZE];
  55. strcpy(type, this->type);
  56. //strcat(type, "n");
  57. if(npreset == 0)
  58. if(strstr(type, "Plfo") != NULL)
  59. strcpy(type, "Plfo");
  60. XMLwrapper xml;
  61. if(npreset == 0) {
  62. if(!checkclipboardtype(ps))
  63. return;
  64. if(!ps.pasteclipboard(xml))
  65. return;
  66. } else if(!ps.pastepreset(xml, npreset))
  67. return;
  68. if(xml.enterbranch(type) == 0)
  69. return;
  70. defaults();
  71. getfromXML(&xml);
  72. xml.exitbranch();
  73. }
  74. #endif
  75. bool Presets::checkclipboardtype(PresetsStore &ps)
  76. {
  77. return ps.checkclipboardtype(type);
  78. }
  79. void Presets::deletepreset(PresetsStore &ps, int npreset)
  80. {
  81. ps.deletepreset(npreset);
  82. }