1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-11-23 09:20:16 +01:00

Move writing and reading of common Track fields into functions...

... also now writing selected state of TimeTrack as for other tracks, fixing
an omission, with no harm to forward compatibility
This commit is contained in:
Paul Licameli
2018-11-20 14:37:19 -05:00
parent 2b2d13d5be
commit 98f322d685
7 changed files with 60 additions and 58 deletions

View File

@@ -2390,8 +2390,8 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
return true;
const wxString strValue = value;
if (!wxStrcmp(attr, wxT("name")) && XMLValueChecker::IsGoodString(strValue))
mName = strValue;
if (this->Track::HandleCommonXMLAttribute(attr, strValue))
;
else if (!wxStrcmp(attr, wxT("numlabels")) &&
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
{
@@ -2403,15 +2403,6 @@ bool LabelTrack::HandleXMLTag(const wxChar *tag, const wxChar **attrs)
mLabels.clear();
mLabels.reserve(nValue);
}
else if (!wxStrcmp(attr, wxT("height")) &&
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
SetHeight(nValue);
else if (!wxStrcmp(attr, wxT("minimized")) &&
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
SetMinimized(nValue != 0);
else if (!wxStrcmp(attr, wxT("isSelected")) &&
XMLValueChecker::IsGoodInt(strValue) && strValue.ToLong(&nValue))
this->SetSelected(nValue != 0);
}
return true;
@@ -2434,11 +2425,8 @@ void LabelTrack::WriteXML(XMLWriter &xmlFile) const
int len = mLabels.size();
xmlFile.StartTag(wxT("labeltrack"));
xmlFile.WriteAttr(wxT("name"), mName);
this->Track::WriteCommonXMLAttributes( xmlFile );
xmlFile.WriteAttr(wxT("numlabels"), len);
xmlFile.WriteAttr(wxT("height"), this->GetActualHeight());
xmlFile.WriteAttr(wxT("minimized"), this->GetMinimized());
xmlFile.WriteAttr(wxT("isSelected"), this->GetSelected());
for (auto &labelStruct: mLabels) {
xmlFile.StartTag(wxT("label"));