1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-22 07:10:06 +02:00

Heavyweight version of SelectedRegion stored in ViewInfo emits events

This commit is contained in:
Paul Licameli 2018-02-16 18:07:59 -05:00
parent 43af7b3265
commit 33f3d4b82d
16 changed files with 240 additions and 38 deletions

@ -21,6 +21,7 @@ class wxTextFile;
class AudacityProject; class AudacityProject;
class DirManager; class DirManager;
class NotifyingSelectedRegion;
class TimeWarper; class TimeWarper;
struct LabelTrackHit; struct LabelTrackHit;

@ -58,7 +58,7 @@ bool ProjectSelectionManager::SnapSelection()
auto snapTo = settings.GetSnapTo(); auto snapTo = settings.GetSnapTo();
if (snapTo != SNAP_OFF) { if (snapTo != SNAP_OFF) {
auto &viewInfo = ViewInfo::Get( project ); auto &viewInfo = ViewInfo::Get( project );
SelectedRegion &selectedRegion = viewInfo.selectedRegion; auto &selectedRegion = viewInfo.selectedRegion;
NumericConverter nc(NumericConverter::TIME, NumericConverter nc(NumericConverter::TIME,
settings.GetSelectionFormat(), 0, settings.GetRate()); settings.GetSelectionFormat(), 0, settings.GetRate());
const bool nearest = (snapTo == SNAP_NEAREST); const bool nearest = (snapTo == SNAP_NEAREST);

@ -128,7 +128,7 @@ public:
bool findNotesQuantizeOld; bool findNotesQuantizeOld;
#endif #endif
SelectedRegion *pSelectedRegion{}; const SelectedRegion *pSelectedRegion{};
ZoomInfo *pZoomInfo{}; ZoomInfo *pZoomInfo{};
bool drawEnvelope{ false }; bool drawEnvelope{ false };

@ -851,7 +851,8 @@ void TrackPanel::DrawTracks(wxDC * dc)
const wxRect clip = GetRect(); const wxRect clip = GetRect();
mTrackArtist->pSelectedRegion = &mViewInfo->selectedRegion; const SelectedRegion &sr = mViewInfo->selectedRegion;
mTrackArtist->pSelectedRegion = &sr;
mTrackArtist->pZoomInfo = mViewInfo; mTrackArtist->pZoomInfo = mViewInfo;
TrackPanelDrawingContext context { TrackPanelDrawingContext context {
*dc, Target(), mLastMouseState, mTrackArtist.get() *dc, Target(), mLastMouseState, mTrackArtist.get()

@ -21,6 +21,119 @@ Paul Licameli
#include "prefs/TracksBehaviorsPrefs.h" #include "prefs/TracksBehaviorsPrefs.h"
#include "xml/XMLWriter.h" #include "xml/XMLWriter.h"
wxDEFINE_EVENT( EVT_SELECTED_REGION_CHANGE, SelectedRegionEvent );
SelectedRegionEvent::SelectedRegionEvent(
wxEventType commandType, NotifyingSelectedRegion *pReg )
: wxEvent{ 0, commandType }
, pRegion{ pReg }
{}
wxEvent *SelectedRegionEvent::Clone() const
{
return safenew SelectedRegionEvent{ *this };
}
NotifyingSelectedRegion& NotifyingSelectedRegion::operator =
( const SelectedRegion &other )
{
if ( mRegion != other ) {
mRegion = other;
Notify();
}
return *this;
}
bool NotifyingSelectedRegion::setTimes(double t0, double t1)
{
bool result = false;
if ( mRegion.t0() != t0 || mRegion.t1() != t1 ) {
result = mRegion.setTimes( t0, t1 );
Notify();
}
return result;
}
bool NotifyingSelectedRegion::setT0(double t, bool maySwap)
{
bool result = false;
if ( mRegion.t0() != t ) {
result = mRegion.setT0( t, maySwap );
Notify();
}
return result;
}
bool NotifyingSelectedRegion::setT1(double t, bool maySwap)
{
bool result = false;
if ( mRegion.t1() != t ) {
result = mRegion.setT1( t, maySwap );
Notify();
}
return result;
}
void NotifyingSelectedRegion::collapseToT0()
{
if ( mRegion.t0() != mRegion.t1() ) {
mRegion.collapseToT0();
Notify();
}
}
void NotifyingSelectedRegion::collapseToT1()
{
if ( mRegion.t0() != mRegion.t1() ) {
mRegion.collapseToT1();
Notify();
}
}
void NotifyingSelectedRegion::move(double delta)
{
if (delta != 0) {
mRegion.move( delta );
Notify();
}
}
bool NotifyingSelectedRegion::setFrequencies(double f0, double f1)
{
bool result = false;
if ( mRegion.f0() != f0 || mRegion.f1() != f1 ) {
result = mRegion.setFrequencies( f0, f1 );
Notify();
}
return result;
}
bool NotifyingSelectedRegion::setF0(double f, bool maySwap)
{
bool result = false;
if ( mRegion.f0() != f ) {
result = mRegion.setF0( f, maySwap );
Notify();
}
return result;
}
bool NotifyingSelectedRegion::setF1(double f, bool maySwap)
{
bool result = false;
if ( mRegion.f1() != f ) {
result = mRegion.setF1( f, maySwap );
Notify();
}
return result;
}
void NotifyingSelectedRegion::Notify()
{
SelectedRegionEvent evt{ EVT_SELECTED_REGION_CHANGE, this };
ProcessEvent( evt );
}
static const AudacityProject::AttachedObjects::RegisteredFactory key{ static const AudacityProject::AttachedObjects::RegisteredFactory key{
[]( AudacityProject &project ) { []( AudacityProject &project ) {
auto result = auto result =

@ -14,11 +14,92 @@
#include <utility> #include <utility>
#include <vector> #include <vector>
#include <wx/event.h> // inherit wxEvtHandler #include <wx/event.h> // inherit wxEvtHandler
#include <wx/weakref.h> // member variable
#include "SelectedRegion.h" #include "SelectedRegion.h"
#include "MemoryX.h" #include "MemoryX.h"
#include "ZoomInfo.h" // to inherit #include "ZoomInfo.h" // to inherit
class NotifyingSelectedRegion;
struct SelectedRegionEvent : public wxEvent
{
SelectedRegionEvent( wxEventType commandType,
NotifyingSelectedRegion *pRegion );
wxEvent *Clone() const override;
wxWeakRef< NotifyingSelectedRegion > pRegion;
};
// To do: distinguish time changes from frequency changes perhaps?
wxDECLARE_EXPORTED_EVENT( AUDACITY_DLL_API,
EVT_SELECTED_REGION_CHANGE, SelectedRegionEvent );
// This heavyweight wrapper of the SelectedRegion structure emits events
// on mutating operations, that other classes can listen for.
class NotifyingSelectedRegion : public wxEvtHandler
{
public:
// Expose SelectedRegion's const accessors
double t0 () const { return mRegion.t0(); }
double t1 () const { return mRegion.t1(); }
double f0 () const { return mRegion.f0(); }
double f1 () const { return mRegion.f1(); }
double fc () const { return mRegion.fc(); }
bool isPoint() const { return mRegion.isPoint(); }
double duration() const { return mRegion.duration(); }
// Writing and reading of persistent fields -- the read is mutating but
// does not emit events
void WriteXMLAttributes
(XMLWriter &xmlFile,
const wxChar *legacyT0Name, const wxChar *legacyT1Name) const
{ mRegion.WriteXMLAttributes(xmlFile, legacyT0Name, legacyT1Name); }
bool HandleXMLAttribute
(const wxChar *attr, const wxChar *value,
const wxChar *legacyT0Name, const wxChar *legacyT1Name)
{ return mRegion.HandleXMLAttribute(
attr, value, legacyT0Name, legacyT1Name ); }
// const-only access allows assignment from this into a SelectedRegion
// or otherwise passing it into a function taking const SelectedRegion&
operator const SelectedRegion & () const { return mRegion; }
// These are the event-emitting operations
NotifyingSelectedRegion& operator = ( const SelectedRegion &other );
// Returns true iff the bounds got swapped
bool setTimes(double t0, double t1);
// Returns true iff the bounds got swapped
bool setT0(double t, bool maySwap = true);
// Returns true iff the bounds got swapped
bool setT1(double t, bool maySwap = true);
void collapseToT0();
void collapseToT1();
void move(double delta);
// Returns true iff the bounds got swapped
bool setFrequencies(double f0, double f1);
// Returns true iff the bounds got swapped
bool setF0(double f, bool maySwap = true);
// Returns true iff the bounds got swapped
bool setF1(double f, bool maySwap = true);
private:
void Notify();
SelectedRegion mRegion;
};
// See big pictorial comment in TrackPanel.cpp for explanation of these numbers // See big pictorial comment in TrackPanel.cpp for explanation of these numbers
enum : int { enum : int {
// constants related to y coordinates in the track panel // constants related to y coordinates in the track panel
@ -117,7 +198,7 @@ public:
// Current selection // Current selection
SelectedRegion selectedRegion; NotifyingSelectedRegion selectedRegion;
PlayRegion playRegion; PlayRegion playRegion;
// Scroll info // Scroll info

@ -1171,14 +1171,14 @@ bool Effect::DoEffect(wxWindow *parent,
double projectRate, double projectRate,
TrackList *list, TrackList *list,
TrackFactory *factory, TrackFactory *factory,
SelectedRegion *selectedRegion, NotifyingSelectedRegion &selectedRegion,
bool shouldPrompt /* = true */) bool shouldPrompt /* = true */)
{ {
wxASSERT(selectedRegion->duration() >= 0.0); wxASSERT(selectedRegion.duration() >= 0.0);
mOutputTracks.reset(); mOutputTracks.reset();
mpSelectedRegion = selectedRegion; mpSelectedRegion = &selectedRegion;
mFactory = factory; mFactory = factory;
mProjectRate = projectRate; mProjectRate = projectRate;
mTracks = list; mTracks = list;
@ -1218,8 +1218,8 @@ bool Effect::DoEffect(wxWindow *parent,
newTrack->SetSelected(true); newTrack->SetSelected(true);
} }
mT0 = selectedRegion->t0(); mT0 = selectedRegion.t0();
mT1 = selectedRegion->t1(); mT1 = selectedRegion.t1();
if (mT1 > mT0) if (mT1 > mT0)
{ {
// there is a selection: let's fit in there... // there is a selection: let's fit in there...
@ -1237,8 +1237,8 @@ bool Effect::DoEffect(wxWindow *parent,
: NumericConverter::DefaultSelectionFormat(); : NumericConverter::DefaultSelectionFormat();
#ifdef EXPERIMENTAL_SPECTRAL_EDITING #ifdef EXPERIMENTAL_SPECTRAL_EDITING
mF0 = selectedRegion->f0(); mF0 = selectedRegion.f0();
mF1 = selectedRegion->f1(); mF1 = selectedRegion.f1();
wxArrayString Names; wxArrayString Names;
if( mF0 != SelectedRegion::UndefinedFrequency ) if( mF0 != SelectedRegion::UndefinedFrequency )
Names.push_back(wxT("control-f0")); Names.push_back(wxT("control-f0"));
@ -1280,7 +1280,7 @@ bool Effect::DoEffect(wxWindow *parent,
if (returnVal && (mT1 >= mT0 )) if (returnVal && (mT1 >= mT0 ))
{ {
selectedRegion->setTimes(mT0, mT1); selectedRegion.setTimes(mT0, mT1);
} }
success = returnVal; success = returnVal;
@ -1289,10 +1289,11 @@ bool Effect::DoEffect(wxWindow *parent,
bool Effect::Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt) bool Effect::Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt)
{ {
SelectedRegion region{ mT0, mT1 }; NotifyingSelectedRegion region;
region.setTimes( mT0, mT1 );
return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory, return delegate.DoEffect( parent, mProjectRate, mTracks, mFactory,
&region, shouldPrompt ); region, shouldPrompt );
} }
// All legacy effects should have this overridden // All legacy effects should have this overridden

@ -43,6 +43,7 @@ class AudacityCommand;
class AudacityProject; class AudacityProject;
class LabelTrack; class LabelTrack;
class NotifyingSelectedRegion;
class ProgressDialog; class ProgressDialog;
class SelectedRegion; class SelectedRegion;
class EffectUIHost; class EffectUIHost;
@ -257,7 +258,7 @@ class AUDACITY_DLL_API Effect /* not final */ : public wxEvtHandler,
// have the "selected" flag set to true, which is consistent with // have the "selected" flag set to true, which is consistent with
// Audacity's standard UI. // Audacity's standard UI.
/* not virtual */ bool DoEffect(wxWindow *parent, double projectRate, TrackList *list, /* not virtual */ bool DoEffect(wxWindow *parent, double projectRate, TrackList *list,
TrackFactory *factory, SelectedRegion *selectedRegion, TrackFactory *factory, NotifyingSelectedRegion &selectedRegion,
bool shouldPrompt = true); bool shouldPrompt = true);
bool Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt); bool Delegate( Effect &delegate, wxWindow *parent, bool shouldPrompt);
@ -459,7 +460,7 @@ protected:
double mProjectRate; // Sample rate of the project - NEW tracks should double mProjectRate; // Sample rate of the project - NEW tracks should
// be created with this rate... // be created with this rate...
double mSampleRate; double mSampleRate;
SelectedRegion *mpSelectedRegion{}; wxWeakRef<NotifyingSelectedRegion> mpSelectedRegion{};
TrackFactory *mFactory; TrackFactory *mFactory;
const TrackList *inputTracks() const { return mTracks; } const TrackList *inputTracks() const { return mTracks; }
std::shared_ptr<TrackList> mOutputTracks; // used only if CopyInputTracks() is called. std::shared_ptr<TrackList> mOutputTracks; // used only if CopyInputTracks() is called.

@ -166,7 +166,7 @@ void EffectManager::UnregisterEffect(const PluginID & ID)
EffectManager & em = EffectManager::Get(); EffectManager & em = EffectManager::Get();
success = em.DoEffect(ID, &window, rate, success = em.DoEffect(ID, &window, rate,
&tracks, &trackFactory, &selectedRegion, &tracks, &trackFactory, selectedRegion,
(flags & EffectManager::kConfigured) == 0); (flags & EffectManager::kConfigured) == 0);
if (!success) if (!success)
@ -239,7 +239,7 @@ bool EffectManager::DoEffect(const PluginID & ID,
double projectRate, double projectRate,
TrackList *list, TrackList *list,
TrackFactory *factory, TrackFactory *factory,
SelectedRegion *selectedRegion, NotifyingSelectedRegion &selectedRegion,
bool shouldPrompt /* = true */) bool shouldPrompt /* = true */)
{ {

@ -41,6 +41,8 @@ class EffectRack;
class AudacityCommand; class AudacityCommand;
class NotifyingSelectedRegion;
class AUDACITY_DLL_API EffectManager class AUDACITY_DLL_API EffectManager
{ {
public: public:
@ -88,7 +90,7 @@ public:
double projectRate, double projectRate,
TrackList *list, TrackList *list,
TrackFactory *factory, TrackFactory *factory,
SelectedRegion *selectedRegion, NotifyingSelectedRegion &selectedRegion,
bool shouldPrompt = true); bool shouldPrompt = true);
wxString GetEffectFamilyName(const PluginID & ID); wxString GetEffectFamilyName(const PluginID & ID);

@ -124,7 +124,7 @@ LabelGlyphHandle::~LabelGlyphHandle()
void LabelGlyphHandle::HandleGlyphClick void LabelGlyphHandle::HandleGlyphClick
(LabelTrackHit &hit, const wxMouseEvent & evt, (LabelTrackHit &hit, const wxMouseEvent & evt,
const wxRect & r, const ZoomInfo &zoomInfo, const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *WXUNUSED(newSel)) NotifyingSelectedRegion &WXUNUSED(newSel))
{ {
if (evt.ButtonDown()) if (evt.ButtonDown())
{ {
@ -188,7 +188,7 @@ UIHandle::Result LabelGlyphHandle::Click
auto &viewInfo = ViewInfo::Get( *pProject ); auto &viewInfo = ViewInfo::Get( *pProject );
HandleGlyphClick( HandleGlyphClick(
*mpHit, event, mRect, viewInfo, &viewInfo.selectedRegion); *mpHit, event, mRect, viewInfo, viewInfo.selectedRegion);
if (! mpHit->mIsAdjustingLabel ) if (! mpHit->mIsAdjustingLabel )
{ {
@ -278,7 +278,7 @@ bool LabelGlyphHandle::HandleGlyphDragRelease
(AudacityProject &project, (AudacityProject &project,
LabelTrackHit &hit, const wxMouseEvent & evt, LabelTrackHit &hit, const wxMouseEvent & evt,
wxRect & r, const ZoomInfo &zoomInfo, wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel) NotifyingSelectedRegion &newSel)
{ {
const auto pTrack = mpLT; const auto pTrack = mpLT;
const auto &mLabels = pTrack->GetLabels(); const auto &mLabels = pTrack->GetLabels();
@ -340,7 +340,7 @@ bool LabelGlyphHandle::HandleGlyphDragRelease
auto selIndex = view.GetSelectedIndex( project ); auto selIndex = view.GetSelectedIndex( project );
//Set the selection region to be equal to //Set the selection region to be equal to
//the NEW size of the label. //the NEW size of the label.
*newSel = mLabels[ selIndex ].selectedRegion; newSel = mLabels[ selIndex ].selectedRegion;
} }
pTrack->SortLabels(); pTrack->SortLabels();
} }
@ -356,7 +356,7 @@ UIHandle::Result LabelGlyphHandle::Drag
const wxMouseEvent &event = evt.event; const wxMouseEvent &event = evt.event;
auto &viewInfo = ViewInfo::Get( *pProject ); auto &viewInfo = ViewInfo::Get( *pProject );
HandleGlyphDragRelease( HandleGlyphDragRelease(
*pProject, *mpHit, event, mRect, viewInfo, &viewInfo.selectedRegion); *pProject, *mpHit, event, mRect, viewInfo, viewInfo.selectedRegion);
// Refresh all so that the change of selection is redrawn in all tracks // Refresh all so that the change of selection is redrawn in all tracks
return result | RefreshCode::RefreshAll | RefreshCode::DrawOverlays; return result | RefreshCode::RefreshAll | RefreshCode::DrawOverlays;
@ -377,7 +377,7 @@ UIHandle::Result LabelGlyphHandle::Release
const wxMouseEvent &event = evt.event; const wxMouseEvent &event = evt.event;
auto &viewInfo = ViewInfo::Get( *pProject ); auto &viewInfo = ViewInfo::Get( *pProject );
if (HandleGlyphDragRelease( if (HandleGlyphDragRelease(
*pProject, *mpHit, event, mRect, viewInfo, &viewInfo.selectedRegion)) { *pProject, *mpHit, event, mRect, viewInfo, viewInfo.selectedRegion)) {
ProjectHistory::Get( *pProject ).PushState(_("Modified Label"), ProjectHistory::Get( *pProject ).PushState(_("Modified Label"),
_("Label Edit"), _("Label Edit"),
UndoPush::CONSOLIDATE); UndoPush::CONSOLIDATE);

@ -16,7 +16,7 @@ Paul Licameli split from TrackPanel.cpp
class wxMouseState; class wxMouseState;
class LabelTrack; class LabelTrack;
class LabelTrackEvent; class LabelTrackEvent;
class SelectedRegion; class NotifyingSelectedRegion;
class ZoomInfo; class ZoomInfo;
/// mEdge: /// mEdge:
@ -92,12 +92,12 @@ private:
void HandleGlyphClick void HandleGlyphClick
(LabelTrackHit &hit, (LabelTrackHit &hit,
const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo, const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel); NotifyingSelectedRegion &newSel);
bool HandleGlyphDragRelease bool HandleGlyphDragRelease
(AudacityProject &project, (AudacityProject &project,
LabelTrackHit &hit, LabelTrackHit &hit,
const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo, const wxMouseEvent & evt, wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel); NotifyingSelectedRegion &newSel);
void MayAdjustLabel void MayAdjustLabel
( LabelTrackHit &hit, ( LabelTrackHit &hit,

@ -78,7 +78,7 @@ void LabelTextHandle::HandleTextClick(AudacityProject &
, ,
const wxMouseEvent & evt, const wxMouseEvent & evt,
const wxRect & r, const ZoomInfo &zoomInfo, const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel) NotifyingSelectedRegion &newSel)
{ {
auto pTrack = mpLT.lock(); auto pTrack = mpLT.lock();
if (!pTrack) if (!pTrack)
@ -94,7 +94,7 @@ void LabelTextHandle::HandleTextClick(AudacityProject &
if ( selIndex != -1 ) { if ( selIndex != -1 ) {
const auto &mLabels = pTrack->GetLabels(); const auto &mLabels = pTrack->GetLabels();
const auto &labelStruct = mLabels[ selIndex ]; const auto &labelStruct = mLabels[ selIndex ];
*newSel = labelStruct.selectedRegion; newSel = labelStruct.selectedRegion;
if (evt.LeftDown()) { if (evt.LeftDown()) {
// Find the NEW drag end // Find the NEW drag end
@ -135,7 +135,7 @@ void LabelTextHandle::HandleTextClick(AudacityProject &
if (!LabelTrackView::OverTextBox(&labelStruct, evt.m_x, evt.m_y)) if (!LabelTrackView::OverTextBox(&labelStruct, evt.m_x, evt.m_y))
view.SetSelectedIndex( -1 ); view.SetSelectedIndex( -1 );
double t = zoomInfo.PositionToTime(evt.m_x, r.x); double t = zoomInfo.PositionToTime(evt.m_x, r.x);
*newSel = SelectedRegion(t, t); newSel = SelectedRegion(t, t);
} }
#endif #endif
} }
@ -143,7 +143,7 @@ void LabelTextHandle::HandleTextClick(AudacityProject &
if (evt.MiddleDown()) { if (evt.MiddleDown()) {
// Paste text, making a NEW label if none is selected. // Paste text, making a NEW label if none is selected.
wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->UsePrimarySelection(true);
view.PasteSelectedText(project, newSel->t0(), newSel->t1()); view.PasteSelectedText(project, newSel.t0(), newSel.t1());
wxTheClipboard->UsePrimarySelection(false); wxTheClipboard->UsePrimarySelection(false);
} }
#endif #endif
@ -169,7 +169,7 @@ UIHandle::Result LabelTextHandle::Click
mSelectedRegion = viewInfo.selectedRegion; mSelectedRegion = viewInfo.selectedRegion;
HandleTextClick( *pProject, HandleTextClick( *pProject,
event, evt.rect, viewInfo, &viewInfo.selectedRegion ); event, evt.rect, viewInfo, viewInfo.selectedRegion );
{ {
// IF the user clicked a label, THEN select all other tracks by Label // IF the user clicked a label, THEN select all other tracks by Label

@ -16,6 +16,7 @@ Paul Licameli split from TrackPanel.cpp
class wxMouseState; class wxMouseState;
class LabelTrack; class LabelTrack;
class NotifyingSelectedRegion;
class SelectionStateChanger; class SelectionStateChanger;
class ZoomInfo; class ZoomInfo;
@ -59,7 +60,7 @@ private:
void HandleTextClick void HandleTextClick
(AudacityProject &project, (AudacityProject &project,
const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo, const wxMouseEvent & evt, const wxRect & r, const ZoomInfo &zoomInfo,
SelectedRegion *newSel); NotifyingSelectedRegion &newSel);
void HandleTextDragRelease( void HandleTextDragRelease(
AudacityProject &project, const wxMouseEvent & evt); AudacityProject &project, const wxMouseEvent & evt);

@ -1336,7 +1336,7 @@ unsigned LabelTrackView::Char(
/// KeyEvent is called for every keypress when over the label track. /// KeyEvent is called for every keypress when over the label track.
bool LabelTrackView::DoKeyDown( bool LabelTrackView::DoKeyDown(
AudacityProject &project, SelectedRegion &newSel, wxKeyEvent & event) AudacityProject &project, NotifyingSelectedRegion &newSel, wxKeyEvent & event)
{ {
// Only track true changes to the label // Only track true changes to the label
bool updated = false; bool updated = false;
@ -1564,7 +1564,7 @@ bool LabelTrackView::DoKeyDown(
/// OnChar is called for incoming characters -- that's any keypress not handled /// OnChar is called for incoming characters -- that's any keypress not handled
/// by OnKeyDown. /// by OnKeyDown.
bool LabelTrackView::DoChar( bool LabelTrackView::DoChar(
AudacityProject &project, SelectedRegion &WXUNUSED(newSel), AudacityProject &project, NotifyingSelectedRegion &WXUNUSED(newSel),
wxKeyEvent & event) wxKeyEvent & event)
{ {
// Check for modifiers and only allow shift. // Check for modifiers and only allow shift.

@ -20,6 +20,7 @@ class LabelStruct;
class LabelTrack; class LabelTrack;
struct LabelTrackEvent; struct LabelTrackEvent;
struct LabelTrackHit; struct LabelTrackHit;
class NotifyingSelectedRegion;
class SelectedRegion; class SelectedRegion;
struct TrackPanelDrawingContext; struct TrackPanelDrawingContext;
class ZoomInfo; class ZoomInfo;
@ -54,9 +55,9 @@ public:
bool DoCaptureKey( AudacityProject &project, wxKeyEvent &event ); bool DoCaptureKey( AudacityProject &project, wxKeyEvent &event );
bool DoKeyDown( bool DoKeyDown(
AudacityProject &project, SelectedRegion &sel, wxKeyEvent & event); AudacityProject &project, NotifyingSelectedRegion &sel, wxKeyEvent & event);
bool DoChar( bool DoChar(
AudacityProject &project, SelectedRegion &sel, wxKeyEvent & event); AudacityProject &project, NotifyingSelectedRegion &sel, wxKeyEvent & event);
//This returns the index of the label we just added. //This returns the index of the label we just added.
int AddLabel(const SelectedRegion &region, int AddLabel(const SelectedRegion &region,