Add python3 to github action test deps
[zynaddsubfx-code.git] / src / Params / Presets.cpp
blobf38e036ff99cdc6f0ecb5ee838285f19a929a097
1 /*
2 ZynAddSubFX - a software synthesizer
4 Presets.cpp - Presets and Clipboard management
5 Copyright (C) 2002-2005 Nasca Octavian Paul
6 Author: Nasca Octavian Paul
8 This program is free software; you can redistribute it and/or
9 modify it under the terms of the GNU General Public License
10 as published by the Free Software Foundation; either version 2
11 of the License, or (at your option) any later version.
14 #include "Presets.h"
15 #include "../Misc/XMLwrapper.h"
16 #include "PresetsStore.h"
17 #include <string.h>
19 namespace zyn {
21 Presets::Presets()
23 type[0] = 0;
26 Presets::~Presets()
29 void Presets::setpresettype(const char *type)
31 strcpy(this->type, type);
34 void Presets::copy(PresetsStore &ps, const char *name)
36 XMLwrapper xml;
38 //used only for the clipboard
39 if(name == NULL)
40 xml.minimal = false;
42 char type[MAX_PRESETTYPE_SIZE];
43 strcpy(type, this->type);
44 //strcat(type, "n");
45 if(name == NULL)
46 if(strstr(type, "Plfo") != NULL)
47 strcpy(type, "Plfo");
49 xml.beginbranch(type);
50 add2XML(xml);
51 xml.endbranch();
53 if(name == NULL)
54 ps.copyclipboard(xml, type);
55 else
56 ps.copypreset(xml, type, name);
59 #if 0
60 void Presets::paste(PresetsStore &ps, int npreset)
62 char type[MAX_PRESETTYPE_SIZE];
63 strcpy(type, this->type);
64 //strcat(type, "n");
66 if(npreset == 0)
67 if(strstr(type, "Plfo") != NULL)
68 strcpy(type, "Plfo");
70 XMLwrapper xml;
71 if(npreset == 0) {
72 if(!checkclipboardtype(ps))
73 return;
74 if(!ps.pasteclipboard(xml))
75 return;
76 } else if(!ps.pastepreset(xml, npreset))
77 return;
79 if(xml.enterbranch(type) == 0)
80 return;
82 defaults();
83 getfromXML(&xml);
85 xml.exitbranch();
87 #endif
89 bool Presets::checkclipboardtype(PresetsStore &ps)
91 return ps.checkclipboardtype(type);
95 void Presets::deletepreset(PresetsStore &ps, int npreset)
97 ps.deletepreset(npreset);