Store the last used AudioMarkerInteractionObject in its own member variable to eliminate an ugly dynamic_cast
Originally committed to SVN as r6178.
This commit is contained in:
parent
88ba844850
commit
6953a69cf8
2 changed files with 8 additions and 6 deletions
|
@ -1027,10 +1027,6 @@ void AudioDisplay::OnPaint(wxPaintEvent&)
|
||||||
|
|
||||||
void AudioDisplay::SetDraggedObject(AudioDisplayInteractionObject *new_obj)
|
void AudioDisplay::SetDraggedObject(AudioDisplayInteractionObject *new_obj)
|
||||||
{
|
{
|
||||||
// Special case for audio markers being dragged: they use a temporary wrapper object
|
|
||||||
// which must be deleted when it is no longer used.
|
|
||||||
delete dynamic_cast<AudioMarkerInteractionObject*>(dragged_object);
|
|
||||||
|
|
||||||
dragged_object = new_obj;
|
dragged_object = new_obj;
|
||||||
|
|
||||||
if (dragged_object && !HasCapture())
|
if (dragged_object && !HasCapture())
|
||||||
|
@ -1162,7 +1158,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
|
||||||
if (marker)
|
if (marker)
|
||||||
{
|
{
|
||||||
RemoveTrackCursor();
|
RemoveTrackCursor();
|
||||||
SetDraggedObject(new AudioMarkerInteractionObject(marker, timing, this, controller, wxMOUSE_BTN_LEFT));
|
audio_marker.reset(new AudioMarkerInteractionObject(marker, timing, this, controller, wxMOUSE_BTN_LEFT));
|
||||||
|
SetDraggedObject(audio_marker.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1175,7 +1172,8 @@ void AudioDisplay::OnMouseEvent(wxMouseEvent& event)
|
||||||
if (marker)
|
if (marker)
|
||||||
{
|
{
|
||||||
RemoveTrackCursor();
|
RemoveTrackCursor();
|
||||||
SetDraggedObject(new AudioMarkerInteractionObject(marker, timing, this, controller, wxMOUSE_BTN_RIGHT));
|
audio_marker.reset(new AudioMarkerInteractionObject(marker, timing, this, controller, wxMOUSE_BTN_RIGHT));
|
||||||
|
SetDraggedObject(audio_marker.get());
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,6 +58,7 @@ class AudioProvider;
|
||||||
class AudioDisplayScrollbar;
|
class AudioDisplayScrollbar;
|
||||||
class AudioDisplayTimeline;
|
class AudioDisplayTimeline;
|
||||||
class AudioDisplaySelection;
|
class AudioDisplaySelection;
|
||||||
|
class AudioMarkerInteractionObject;
|
||||||
|
|
||||||
/// @class AudioDisplayInteractionObject
|
/// @class AudioDisplayInteractionObject
|
||||||
/// @brief Interface for objects on the audio display that can respond to mouse events
|
/// @brief Interface for objects on the audio display that can respond to mouse events
|
||||||
|
@ -122,6 +123,9 @@ class AudioDisplay: public wxWindow {
|
||||||
/// Timeline helper object
|
/// Timeline helper object
|
||||||
agi::scoped_ptr<AudioDisplayTimeline> timeline;
|
agi::scoped_ptr<AudioDisplayTimeline> timeline;
|
||||||
|
|
||||||
|
/// The interaction object for the last-dragged audio marker
|
||||||
|
agi::scoped_ptr<AudioMarkerInteractionObject> audio_marker;
|
||||||
|
|
||||||
|
|
||||||
/// Current object on display being dragged, if any
|
/// Current object on display being dragged, if any
|
||||||
AudioDisplayInteractionObject *dragged_object;
|
AudioDisplayInteractionObject *dragged_object;
|
||||||
|
|
Loading…
Reference in a new issue