4801 |
|
|
4802 |
ScriptGroup::~ScriptGroup() { |
ScriptGroup::~ScriptGroup() { |
4803 |
if (pScripts) { |
if (pScripts) { |
4804 |
std::list<Script*>::iterator iter = pScripts->begin(); |
std::vector<Script*>::iterator iter = pScripts->begin(); |
4805 |
std::list<Script*>::iterator end = pScripts->end(); |
std::vector<Script*>::iterator end = pScripts->end(); |
4806 |
while (iter != end) { |
while (iter != end) { |
4807 |
delete *iter; |
delete *iter; |
4808 |
++iter; |
++iter; |
4840 |
// now store the name of this group as <LSNM> chunk as subchunk of the <RTIS> list chunk |
// now store the name of this group as <LSNM> chunk as subchunk of the <RTIS> list chunk |
4841 |
::SaveString(CHUNK_ID_LSNM, NULL, pList, Name, String("Unnamed Group"), true, 64); |
::SaveString(CHUNK_ID_LSNM, NULL, pList, Name, String("Unnamed Group"), true, 64); |
4842 |
|
|
4843 |
for (std::list<Script*>::iterator it = pScripts->begin(); |
for (std::vector<Script*>::iterator it = pScripts->begin(); |
4844 |
it != pScripts->end(); ++it) |
it != pScripts->end(); ++it) |
4845 |
{ |
{ |
4846 |
(*it)->UpdateChunks(pProgress); |
(*it)->UpdateChunks(pProgress); |
4857 |
*/ |
*/ |
4858 |
Script* ScriptGroup::GetScript(uint index) { |
Script* ScriptGroup::GetScript(uint index) { |
4859 |
if (!pScripts) LoadScripts(); |
if (!pScripts) LoadScripts(); |
4860 |
std::list<Script*>::iterator it = pScripts->begin(); |
if (index >= pScripts->size()) return NULL; |
4861 |
for (uint i = 0; it != pScripts->end(); ++i, ++it) |
return (*pScripts)[index]; |
|
if (i == index) return *it; |
|
|
return NULL; |
|
4862 |
} |
} |
4863 |
|
|
4864 |
/** @brief Add new instrument script. |
/** @brief Add new instrument script. |
4891 |
*/ |
*/ |
4892 |
void ScriptGroup::DeleteScript(Script* pScript) { |
void ScriptGroup::DeleteScript(Script* pScript) { |
4893 |
if (!pScripts) LoadScripts(); |
if (!pScripts) LoadScripts(); |
4894 |
std::list<Script*>::iterator iter = |
std::vector<Script*>::iterator iter = |
4895 |
find(pScripts->begin(), pScripts->end(), pScript); |
find(pScripts->begin(), pScripts->end(), pScript); |
4896 |
if (iter == pScripts->end()) |
if (iter == pScripts->end()) |
4897 |
throw gig::Exception("Could not delete script, could not find given script"); |
throw gig::Exception("Could not delete script, could not find given script"); |
4904 |
|
|
4905 |
void ScriptGroup::LoadScripts() { |
void ScriptGroup::LoadScripts() { |
4906 |
if (pScripts) return; |
if (pScripts) return; |
4907 |
pScripts = new std::list<Script*>; |
pScripts = new std::vector<Script*>; |
4908 |
if (!pList) return; |
if (!pList) return; |
4909 |
|
|
4910 |
size_t i = 0; |
size_t i = 0; |