609 |
uint16_t iSampleGroup = 0; // 0 refers to default sample group |
uint16_t iSampleGroup = 0; // 0 refers to default sample group |
610 |
File* pFile = static_cast<File*>(pParent); |
File* pFile = static_cast<File*>(pParent); |
611 |
if (pFile->pGroups) { |
if (pFile->pGroups) { |
612 |
std::list<Group*>::iterator iter = pFile->pGroups->begin(); |
std::vector<Group*>::iterator iter = pFile->pGroups->begin(); |
613 |
std::list<Group*>::iterator end = pFile->pGroups->end(); |
std::vector<Group*>::iterator end = pFile->pGroups->end(); |
614 |
for (int i = 0; iter != end; i++, iter++) { |
for (int i = 0; iter != end; i++, iter++) { |
615 |
if (*iter == pGroup) { |
if (*iter == pGroup) { |
616 |
iSampleGroup = i; |
iSampleGroup = i; |
6286 |
|
|
6287 |
File::~File() { |
File::~File() { |
6288 |
if (pGroups) { |
if (pGroups) { |
6289 |
std::list<Group*>::iterator iter = pGroups->begin(); |
std::vector<Group*>::iterator iter = pGroups->begin(); |
6290 |
std::list<Group*>::iterator end = pGroups->end(); |
std::vector<Group*>::iterator end = pGroups->end(); |
6291 |
while (iter != end) { |
while (iter != end) { |
6292 |
delete *iter; |
delete *iter; |
6293 |
++iter; |
++iter; |
6937 |
return bRequiresSave; |
return bRequiresSave; |
6938 |
} |
} |
6939 |
|
|
6940 |
|
/** |
6941 |
|
* Returns a pointer to the first <i>Group</i> object of the file, |
6942 |
|
* <i>NULL</i> otherwise. |
6943 |
|
* |
6944 |
|
* @deprecated This method is not reentrant-safe, use GetGroup() instead. |
6945 |
|
*/ |
6946 |
Group* File::GetFirstGroup() { |
Group* File::GetFirstGroup() { |
6947 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
6948 |
// there must always be at least one group |
// there must always be at least one group |
6950 |
return *GroupsIterator; |
return *GroupsIterator; |
6951 |
} |
} |
6952 |
|
|
6953 |
|
/** |
6954 |
|
* Returns a pointer to the next <i>Group</i> object of the file, |
6955 |
|
* <i>NULL</i> otherwise. |
6956 |
|
* |
6957 |
|
* @deprecated This method is not reentrant-safe, use GetGroup() instead. |
6958 |
|
*/ |
6959 |
Group* File::GetNextGroup() { |
Group* File::GetNextGroup() { |
6960 |
if (!pGroups) return NULL; |
if (!pGroups) return NULL; |
6961 |
++GroupsIterator; |
++GroupsIterator; |
6970 |
*/ |
*/ |
6971 |
Group* File::GetGroup(size_t index) { |
Group* File::GetGroup(size_t index) { |
6972 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
6973 |
GroupsIterator = pGroups->begin(); |
if (index >= pGroups->size()) return NULL; |
6974 |
for (size_t i = 0; GroupsIterator != pGroups->end(); i++) { |
return (*pGroups)[index]; |
|
if (i == index) return *GroupsIterator; |
|
|
++GroupsIterator; |
|
|
} |
|
|
return NULL; |
|
6975 |
} |
} |
6976 |
|
|
6977 |
/** |
/** |
7012 |
*/ |
*/ |
7013 |
void File::DeleteGroup(Group* pGroup) { |
void File::DeleteGroup(Group* pGroup) { |
7014 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
7015 |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
std::vector<Group*>::iterator iter = |
7016 |
|
find(pGroups->begin(), pGroups->end(), pGroup); |
7017 |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
7018 |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
7019 |
// delete all members of this group |
// delete all members of this group |
7039 |
*/ |
*/ |
7040 |
void File::DeleteGroupOnly(Group* pGroup) { |
void File::DeleteGroupOnly(Group* pGroup) { |
7041 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
7042 |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
std::vector<Group*>::iterator iter = |
7043 |
|
find(pGroups->begin(), pGroups->end(), pGroup); |
7044 |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
if (iter == pGroups->end()) throw gig::Exception("Could not delete group, could not find given group"); |
7045 |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
if (pGroups->size() == 1) throw gig::Exception("Cannot delete group, there must be at least one default group!"); |
7046 |
// move all members of this group to another group |
// move all members of this group to another group |
7051 |
} |
} |
7052 |
|
|
7053 |
void File::LoadGroups() { |
void File::LoadGroups() { |
7054 |
if (!pGroups) pGroups = new std::list<Group*>; |
if (!pGroups) pGroups = new std::vector<Group*>; |
7055 |
// try to read defined groups from file |
// try to read defined groups from file |
7056 |
RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI); |
RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI); |
7057 |
if (lst3gri) { |
if (lst3gri) { |
7250 |
} |
} |
7251 |
} |
} |
7252 |
|
|
7253 |
std::list<Group*>::iterator iter = pGroups->begin(); |
std::vector<Group*>::iterator iter = pGroups->begin(); |
7254 |
std::list<Group*>::iterator end = pGroups->end(); |
std::vector<Group*>::iterator end = pGroups->end(); |
7255 |
for (; iter != end; ++iter) { |
for (; iter != end; ++iter) { |
7256 |
(*iter)->UpdateChunks(pProgress); |
(*iter)->UpdateChunks(pProgress); |
7257 |
} |
} |