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; |
6204 |
*/ |
*/ |
6205 |
void Group::MoveAll() { |
void Group::MoveAll() { |
6206 |
// get "that" other group first |
// get "that" other group first |
6207 |
|
size_t i = 0; |
6208 |
Group* pOtherGroup = NULL; |
Group* pOtherGroup = NULL; |
6209 |
for (pOtherGroup = pFile->GetFirstGroup(); pOtherGroup; pOtherGroup = pFile->GetNextGroup()) { |
for (pOtherGroup = pFile->GetGroup(i); pOtherGroup; |
6210 |
|
pOtherGroup = pFile->GetGroup(++i)) |
6211 |
|
{ |
6212 |
if (pOtherGroup != this) break; |
if (pOtherGroup != this) break; |
6213 |
} |
} |
6214 |
if (!pOtherGroup) throw Exception( |
if (!pOtherGroup) throw Exception( |
6289 |
|
|
6290 |
File::~File() { |
File::~File() { |
6291 |
if (pGroups) { |
if (pGroups) { |
6292 |
std::list<Group*>::iterator iter = pGroups->begin(); |
std::vector<Group*>::iterator iter = pGroups->begin(); |
6293 |
std::list<Group*>::iterator end = pGroups->end(); |
std::vector<Group*>::iterator end = pGroups->end(); |
6294 |
while (iter != end) { |
while (iter != end) { |
6295 |
delete *iter; |
delete *iter; |
6296 |
++iter; |
++iter; |
6940 |
return bRequiresSave; |
return bRequiresSave; |
6941 |
} |
} |
6942 |
|
|
6943 |
|
/** |
6944 |
|
* Returns a pointer to the first <i>Group</i> object of the file, |
6945 |
|
* <i>NULL</i> otherwise. |
6946 |
|
* |
6947 |
|
* @deprecated This method is not reentrant-safe, use GetGroup() instead. |
6948 |
|
*/ |
6949 |
Group* File::GetFirstGroup() { |
Group* File::GetFirstGroup() { |
6950 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
6951 |
// there must always be at least one group |
// there must always be at least one group |
6953 |
return *GroupsIterator; |
return *GroupsIterator; |
6954 |
} |
} |
6955 |
|
|
6956 |
|
/** |
6957 |
|
* Returns a pointer to the next <i>Group</i> object of the file, |
6958 |
|
* <i>NULL</i> otherwise. |
6959 |
|
* |
6960 |
|
* @deprecated This method is not reentrant-safe, use GetGroup() instead. |
6961 |
|
*/ |
6962 |
Group* File::GetNextGroup() { |
Group* File::GetNextGroup() { |
6963 |
if (!pGroups) return NULL; |
if (!pGroups) return NULL; |
6964 |
++GroupsIterator; |
++GroupsIterator; |
6973 |
*/ |
*/ |
6974 |
Group* File::GetGroup(size_t index) { |
Group* File::GetGroup(size_t index) { |
6975 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
6976 |
GroupsIterator = pGroups->begin(); |
if (index >= pGroups->size()) return NULL; |
6977 |
for (size_t i = 0; GroupsIterator != pGroups->end(); i++) { |
return (*pGroups)[index]; |
|
if (i == index) return *GroupsIterator; |
|
|
++GroupsIterator; |
|
|
} |
|
|
return NULL; |
|
6978 |
} |
} |
6979 |
|
|
6980 |
/** |
/** |
6989 |
*/ |
*/ |
6990 |
Group* File::GetGroup(String name) { |
Group* File::GetGroup(String name) { |
6991 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
6992 |
GroupsIterator = pGroups->begin(); |
size_t i = 0; |
6993 |
for (uint i = 0; GroupsIterator != pGroups->end(); ++GroupsIterator, ++i) |
for (Group* pGroup = GetGroup(i); pGroup; pGroup = GetGroup(++i)) |
6994 |
if ((*GroupsIterator)->Name == name) return *GroupsIterator; |
if (pGroup->Name == name) return pGroup; |
6995 |
return NULL; |
return NULL; |
6996 |
} |
} |
6997 |
|
|
7015 |
*/ |
*/ |
7016 |
void File::DeleteGroup(Group* pGroup) { |
void File::DeleteGroup(Group* pGroup) { |
7017 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
7018 |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
std::vector<Group*>::iterator iter = |
7019 |
|
find(pGroups->begin(), pGroups->end(), pGroup); |
7020 |
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"); |
7021 |
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!"); |
7022 |
// delete all members of this group |
// delete all members of this group |
7042 |
*/ |
*/ |
7043 |
void File::DeleteGroupOnly(Group* pGroup) { |
void File::DeleteGroupOnly(Group* pGroup) { |
7044 |
if (!pGroups) LoadGroups(); |
if (!pGroups) LoadGroups(); |
7045 |
std::list<Group*>::iterator iter = find(pGroups->begin(), pGroups->end(), pGroup); |
std::vector<Group*>::iterator iter = |
7046 |
|
find(pGroups->begin(), pGroups->end(), pGroup); |
7047 |
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"); |
7048 |
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!"); |
7049 |
// move all members of this group to another group |
// move all members of this group to another group |
7054 |
} |
} |
7055 |
|
|
7056 |
void File::LoadGroups() { |
void File::LoadGroups() { |
7057 |
if (!pGroups) pGroups = new std::list<Group*>; |
if (!pGroups) pGroups = new std::vector<Group*>; |
7058 |
// try to read defined groups from file |
// try to read defined groups from file |
7059 |
RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI); |
RIFF::List* lst3gri = pRIFF->GetSubList(LIST_TYPE_3GRI); |
7060 |
if (lst3gri) { |
if (lst3gri) { |
7253 |
} |
} |
7254 |
} |
} |
7255 |
|
|
7256 |
std::list<Group*>::iterator iter = pGroups->begin(); |
std::vector<Group*>::iterator iter = pGroups->begin(); |
7257 |
std::list<Group*>::iterator end = pGroups->end(); |
std::vector<Group*>::iterator end = pGroups->end(); |
7258 |
for (; iter != end; ++iter) { |
for (; iter != end; ++iter) { |
7259 |
(*iter)->UpdateChunks(pProgress); |
(*iter)->UpdateChunks(pProgress); |
7260 |
} |
} |