Fix crash when deleting overlapped regions.
Use RegionSelection for MIDI regions as well, since the old dumb stub didn't do some things correctly. There's probably no reason to have a separate class for this at all, and some good ones for putting all regions in the same selection, so we should probably do that. For now they are still separate in the selection but use the same base class.
This commit is contained in:
parent
4ba4677b45
commit
589cc3162b
@ -1967,7 +1967,10 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
|
||||
MidiRegionSelection::iterator next;
|
||||
next = r;
|
||||
++next;
|
||||
(*r)->begin_resizing (at_front);
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
if (mrv) {
|
||||
mrv->begin_resizing (at_front);
|
||||
}
|
||||
r = next;
|
||||
}
|
||||
}
|
||||
@ -1979,7 +1982,10 @@ NoteResizeDrag::motion (GdkEvent* /*event*/, bool /*first_move*/)
|
||||
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
||||
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
||||
assert (nb);
|
||||
(*r)->update_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
if (mrv) {
|
||||
mrv->update_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1990,7 +1996,10 @@ NoteResizeDrag::finished (GdkEvent*, bool /*movement_occurred*/)
|
||||
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
||||
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
||||
assert (nb);
|
||||
(*r)->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
if (mrv) {
|
||||
mrv->commit_resizing (nb, at_front, _drags->current_pointer_x() - grab_x(), relative);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1999,7 +2008,10 @@ NoteResizeDrag::aborted (bool)
|
||||
{
|
||||
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
|
||||
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
||||
(*r)->abort_resizing ();
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||
if (mrv) {
|
||||
mrv->abort_resizing ();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -4000,10 +4000,12 @@ void
|
||||
Editor::cut_copy_midi (CutCopyOp op)
|
||||
{
|
||||
for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
|
||||
MidiRegionView* mrv = *i;
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
|
||||
if (mrv) {
|
||||
mrv->cut_copy_clear (op);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -17,29 +17,19 @@
|
||||
|
||||
*/
|
||||
|
||||
#include "gtkmm2ext/gui_thread.h"
|
||||
#include "midi_region_view.h"
|
||||
#include "midi_selection.h"
|
||||
#include "region_view.h"
|
||||
|
||||
MidiRegionSelection::MidiRegionSelection ()
|
||||
{
|
||||
RegionView::RegionViewGoingAway.connect (_death_connection, MISSING_INVALIDATOR, boost::bind (&MidiRegionSelection::remove_it, this, _1), gui_context());
|
||||
}
|
||||
: RegionSelection ()
|
||||
{}
|
||||
|
||||
/** Copy constructor.
|
||||
* @param other MidiRegionSelection to copy.
|
||||
*/
|
||||
MidiRegionSelection::MidiRegionSelection (MidiRegionSelection const & other)
|
||||
: std::list<MidiRegionView*> (other)
|
||||
{
|
||||
RegionView::RegionViewGoingAway.connect (_death_connection, MISSING_INVALIDATOR, boost::bind (&MidiRegionSelection::remove_it, this, _1), gui_context());
|
||||
}
|
||||
: RegionSelection (other)
|
||||
{}
|
||||
|
||||
|
||||
void
|
||||
MidiRegionSelection::remove_it (RegionView* rv)
|
||||
MidiRegionSelection&
|
||||
MidiRegionSelection::operator= (const MidiRegionSelection& other)
|
||||
{
|
||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
|
||||
remove (mrv);
|
||||
RegionSelection::operator=(other);
|
||||
return *this;
|
||||
}
|
||||
|
@ -20,22 +20,19 @@
|
||||
#ifndef __ardour_gtk_midi_selection_h__
|
||||
#define __ardour_gtk_midi_selection_h__
|
||||
|
||||
#include <list>
|
||||
#include "pbd/signals.h"
|
||||
#include "region_selection.h"
|
||||
|
||||
class MidiRegionView;
|
||||
class MidiCutBuffer;
|
||||
class RegionView;
|
||||
|
||||
class MidiRegionSelection : public std::list<MidiRegionView*>
|
||||
class MidiRegionSelection : public RegionSelection
|
||||
{
|
||||
public:
|
||||
MidiRegionSelection ();
|
||||
MidiRegionSelection (MidiRegionSelection const &);
|
||||
MidiRegionSelection (const MidiRegionSelection&);
|
||||
|
||||
private:
|
||||
void remove_it (RegionView *);
|
||||
PBD::ScopedConnection _death_connection;
|
||||
MidiRegionSelection& operator= (const MidiRegionSelection&);
|
||||
};
|
||||
|
||||
struct MidiNoteSelection : std::list<MidiCutBuffer*> {};
|
||||
|
@ -225,8 +225,10 @@ RegionView::~RegionView ()
|
||||
bool
|
||||
RegionView::canvas_group_event (GdkEvent* event)
|
||||
{
|
||||
if (!in_destructor) {
|
||||
return trackview.editor().canvas_region_view_event (event, group, this);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/)
|
||||
|
Loading…
Reference in New Issue
Block a user