/[svn]/libgig/trunk/src/gig.cpp
ViewVC logotype

Diff of /libgig/trunk/src/gig.cpp

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 3946 by schoenebeck, Fri Jun 18 15:51:32 2021 UTC revision 3948 by schoenebeck, Sat Jun 19 08:09:58 2021 UTC
# Line 4801  namespace { Line 4801  namespace {
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;
# Line 4840  namespace { Line 4840  namespace {
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);
# Line 4857  namespace { Line 4857  namespace {
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.
# Line 4893  namespace { Line 4891  namespace {
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");
# Line 4906  namespace { Line 4904  namespace {
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;

Legend:
Removed from v.3946  
changed lines
  Added in v.3948

  ViewVC Help
Powered by ViewVC