mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-01 00:19:27 +02:00
Fix Bug 163 - Aborting a track name change writes a name change to history.
The logic was flawed -- did updates and PushState even when user canceled or hit OK with a blank name.
This commit is contained in:
parent
62689e9e70
commit
afd7dec991
@ -6752,30 +6752,31 @@ void TrackPanel::OnChangeOctave(wxCommandEvent & event)
|
|||||||
void TrackPanel::OnSetName(wxCommandEvent &event)
|
void TrackPanel::OnSetName(wxCommandEvent &event)
|
||||||
{
|
{
|
||||||
Track *t = mPopupMenuTarget;
|
Track *t = mPopupMenuTarget;
|
||||||
|
if (t)
|
||||||
if (t) {
|
{
|
||||||
wxString defaultStr = t->GetName();
|
wxString oldName = t->GetName();
|
||||||
wxString newName = wxGetTextFromUser(_("Change track name to:"),
|
wxString newName =
|
||||||
_("Track Name"), defaultStr);
|
wxGetTextFromUser(_("Change track name to:"),
|
||||||
//if we have a linked channel this name should change as well (otherwise sort by name and time will crash)
|
_("Track Name"), oldName);
|
||||||
if (newName != wxT("")) {
|
if (newName != wxT("")) // wxGetTextFromUser returns empty string on Cancel.
|
||||||
|
{
|
||||||
t->SetName(newName);
|
t->SetName(newName);
|
||||||
if(t->GetLinked())
|
// if we have a linked channel this name should change as well
|
||||||
{
|
// (otherwise sort by name and time will crash).
|
||||||
|
if (t->GetLinked())
|
||||||
t->GetLink()->SetName(newName);
|
t->GetLink()->SetName(newName);
|
||||||
}
|
|
||||||
|
MixerBoard* pMixerBoard = this->GetMixerBoard();
|
||||||
|
if (pMixerBoard && (t->GetKind() == Track::Wave))
|
||||||
|
pMixerBoard->UpdateName((WaveTrack*)t);
|
||||||
|
|
||||||
|
MakeParentPushState(wxString::Format(_("Renamed '%s' to '%s'"),
|
||||||
|
oldName.c_str(),
|
||||||
|
newName.c_str()),
|
||||||
|
_("Name Change"));
|
||||||
|
|
||||||
|
Refresh(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
MixerBoard* pMixerBoard = this->GetMixerBoard();
|
|
||||||
if (pMixerBoard && (t->GetKind() == Track::Wave))
|
|
||||||
pMixerBoard->UpdateName((WaveTrack*)t);
|
|
||||||
|
|
||||||
MakeParentPushState(wxString::Format(_("Renamed '%s' to '%s'"),
|
|
||||||
defaultStr.c_str(),
|
|
||||||
newName.c_str()),
|
|
||||||
_("Name Change"));
|
|
||||||
|
|
||||||
Refresh(false);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user