mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-08 15:54:57 +01:00
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
5 changed files with 35 additions and 32 deletions
|
|
@ -1967,7 +1967,10 @@ NoteResizeDrag::start_grab (GdkEvent* event, Gdk::Cursor* /*ignored*/)
|
||||||
MidiRegionSelection::iterator next;
|
MidiRegionSelection::iterator next;
|
||||||
next = r;
|
next = r;
|
||||||
++next;
|
++next;
|
||||||
(*r)->begin_resizing (at_front);
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*r);
|
||||||
|
if (mrv) {
|
||||||
|
mrv->begin_resizing (at_front);
|
||||||
|
}
|
||||||
r = next;
|
r = next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -1979,7 +1982,10 @@ NoteResizeDrag::motion (GdkEvent* /*event*/, bool /*first_move*/)
|
||||||
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
||||||
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
||||||
assert (nb);
|
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) {
|
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
||||||
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
NoteBase* nb = reinterpret_cast<NoteBase*> (_item->get_data ("notebase"));
|
||||||
assert (nb);
|
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);
|
MidiRegionSelection& ms (_editor->get_selection().midi_regions);
|
||||||
for (MidiRegionSelection::iterator r = ms.begin(); r != ms.end(); ++r) {
|
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,8 +4000,10 @@ void
|
||||||
Editor::cut_copy_midi (CutCopyOp op)
|
Editor::cut_copy_midi (CutCopyOp op)
|
||||||
{
|
{
|
||||||
for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
|
for (MidiRegionSelection::iterator i = selection->midi_regions.begin(); i != selection->midi_regions.end(); ++i) {
|
||||||
MidiRegionView* mrv = *i;
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
|
||||||
mrv->cut_copy_clear (op);
|
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 "midi_selection.h"
|
||||||
#include "region_view.h"
|
|
||||||
|
|
||||||
MidiRegionSelection::MidiRegionSelection ()
|
MidiRegionSelection::MidiRegionSelection ()
|
||||||
{
|
: RegionSelection ()
|
||||||
RegionView::RegionViewGoingAway.connect (_death_connection, MISSING_INVALIDATOR, boost::bind (&MidiRegionSelection::remove_it, this, _1), gui_context());
|
{}
|
||||||
}
|
|
||||||
|
|
||||||
/** Copy constructor.
|
|
||||||
* @param other MidiRegionSelection to copy.
|
|
||||||
*/
|
|
||||||
MidiRegionSelection::MidiRegionSelection (MidiRegionSelection const & other)
|
MidiRegionSelection::MidiRegionSelection (MidiRegionSelection const & other)
|
||||||
: std::list<MidiRegionView*> (other)
|
: RegionSelection (other)
|
||||||
{
|
{}
|
||||||
RegionView::RegionViewGoingAway.connect (_death_connection, MISSING_INVALIDATOR, boost::bind (&MidiRegionSelection::remove_it, this, _1), gui_context());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
MidiRegionSelection&
|
||||||
void
|
MidiRegionSelection::operator= (const MidiRegionSelection& other)
|
||||||
MidiRegionSelection::remove_it (RegionView* rv)
|
|
||||||
{
|
{
|
||||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*> (rv);
|
RegionSelection::operator=(other);
|
||||||
remove (mrv);
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -20,22 +20,19 @@
|
||||||
#ifndef __ardour_gtk_midi_selection_h__
|
#ifndef __ardour_gtk_midi_selection_h__
|
||||||
#define __ardour_gtk_midi_selection_h__
|
#define __ardour_gtk_midi_selection_h__
|
||||||
|
|
||||||
#include <list>
|
#include "region_selection.h"
|
||||||
#include "pbd/signals.h"
|
|
||||||
|
|
||||||
class MidiRegionView;
|
class MidiRegionView;
|
||||||
class MidiCutBuffer;
|
class MidiCutBuffer;
|
||||||
class RegionView;
|
class RegionView;
|
||||||
|
|
||||||
class MidiRegionSelection : public std::list<MidiRegionView*>
|
class MidiRegionSelection : public RegionSelection
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
MidiRegionSelection ();
|
MidiRegionSelection ();
|
||||||
MidiRegionSelection (MidiRegionSelection const &);
|
MidiRegionSelection (const MidiRegionSelection&);
|
||||||
|
|
||||||
private:
|
MidiRegionSelection& operator= (const MidiRegionSelection&);
|
||||||
void remove_it (RegionView *);
|
|
||||||
PBD::ScopedConnection _death_connection;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
struct MidiNoteSelection : std::list<MidiCutBuffer*> {};
|
struct MidiNoteSelection : std::list<MidiCutBuffer*> {};
|
||||||
|
|
|
||||||
|
|
@ -225,7 +225,9 @@ RegionView::~RegionView ()
|
||||||
bool
|
bool
|
||||||
RegionView::canvas_group_event (GdkEvent* event)
|
RegionView::canvas_group_event (GdkEvent* event)
|
||||||
{
|
{
|
||||||
return trackview.editor().canvas_region_view_event (event, group, this);
|
if (!in_destructor) {
|
||||||
|
return trackview.editor().canvas_region_view_event (event, group, this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue