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.
15 #include "../Misc/XMLwrapper.h"
16 #include "PresetsStore.h"
29 void Presets::setpresettype(const char *type
)
31 strcpy(this->type
, type
);
34 void Presets::copy(PresetsStore
&ps
, const char *name
)
38 //used only for the clipboard
42 char type
[MAX_PRESETTYPE_SIZE
];
43 strcpy(type
, this->type
);
46 if(strstr(type
, "Plfo") != NULL
)
49 xml
.beginbranch(type
);
54 ps
.copyclipboard(xml
, type
);
56 ps
.copypreset(xml
, type
, name
);
60 void Presets::paste(PresetsStore
&ps
, int npreset
)
62 char type
[MAX_PRESETTYPE_SIZE
];
63 strcpy(type
, this->type
);
67 if(strstr(type
, "Plfo") != NULL
)
72 if(!checkclipboardtype(ps
))
74 if(!ps
.pasteclipboard(xml
))
76 } else if(!ps
.pastepreset(xml
, npreset
))
79 if(xml
.enterbranch(type
) == 0)
89 bool Presets::checkclipboardtype(PresetsStore
&ps
)
91 return ps
.checkclipboardtype(type
);
95 void Presets::deletepreset(PresetsStore
&ps
, int npreset
)
97 ps
.deletepreset(npreset
);