mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 14:54:56 +01:00
fix some region-view level selection issues
This commit is contained in:
parent
182a24751b
commit
3700f191cd
5 changed files with 53 additions and 12 deletions
|
|
@ -749,3 +749,37 @@ MidiRegionView::drag_group () const
|
||||||
{
|
{
|
||||||
return get_canvas_group ();
|
return get_canvas_group ();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::select_self (bool add)
|
||||||
|
{
|
||||||
|
if (add) {
|
||||||
|
_editing_context.get_selection().add (this);
|
||||||
|
} else {
|
||||||
|
_editing_context.get_selection().set (this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::unselect_self ()
|
||||||
|
{
|
||||||
|
_editing_context.get_selection().remove (this);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::begin_drag_edit (std::string const & why)
|
||||||
|
{
|
||||||
|
if (!_selected) {
|
||||||
|
/* unclear why gcc can't understand which version of
|
||||||
|
select_self() to use here, but so be it.
|
||||||
|
*/
|
||||||
|
MidiView::select_self ();
|
||||||
|
}
|
||||||
|
// start_note_diff_command (why);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
MidiRegionView::select_self_uniquely ()
|
||||||
|
{
|
||||||
|
_editing_context.set_selected_midi_region_view (*this);
|
||||||
|
}
|
||||||
|
|
|
||||||
|
|
@ -126,6 +126,10 @@ public:
|
||||||
void redisplay (bool);
|
void redisplay (bool);
|
||||||
|
|
||||||
ArdourCanvas::Item* drag_group() const;
|
ArdourCanvas::Item* drag_group() const;
|
||||||
|
void select_self (bool add);
|
||||||
|
void unselect_self ();
|
||||||
|
void select_self_uniquely ();
|
||||||
|
void begin_drag_edit (std::string const & why);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void reset_width_dependent_items (double pixel_width);
|
void reset_width_dependent_items (double pixel_width);
|
||||||
|
|
|
||||||
|
|
@ -113,9 +113,9 @@ MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
||||||
: _midi_track (mt)
|
: _midi_track (mt)
|
||||||
, _editing_context (ec)
|
, _editing_context (ec)
|
||||||
, _midi_context (bg)
|
, _midi_context (bg)
|
||||||
, _active_notes(0)
|
, _active_notes (0)
|
||||||
, _note_group (new ArdourCanvas::Container (&parent))
|
, _note_group (new ArdourCanvas::Container (&parent))
|
||||||
, _note_diff_command (0)
|
, _note_diff_command (nullptr)
|
||||||
, _ghost_note(0)
|
, _ghost_note(0)
|
||||||
, _step_edit_cursor (0)
|
, _step_edit_cursor (0)
|
||||||
, _step_edit_cursor_width (1, 0)
|
, _step_edit_cursor_width (1, 0)
|
||||||
|
|
@ -123,7 +123,7 @@ MidiView::MidiView (std::shared_ptr<MidiTrack> mt,
|
||||||
, _mouse_state(None)
|
, _mouse_state(None)
|
||||||
, _pressed_button(0)
|
, _pressed_button(0)
|
||||||
, _optimization_iterator (_events.end())
|
, _optimization_iterator (_events.end())
|
||||||
, _list_editor (0)
|
, _list_editor (nullptr)
|
||||||
, _no_sound_notes (false)
|
, _no_sound_notes (false)
|
||||||
, _last_display_zoom (0)
|
, _last_display_zoom (0)
|
||||||
, _last_event_x (0)
|
, _last_event_x (0)
|
||||||
|
|
@ -2066,7 +2066,7 @@ void
|
||||||
MidiView::clear_note_selection ()
|
MidiView::clear_note_selection ()
|
||||||
{
|
{
|
||||||
clear_selection_internal ();
|
clear_selection_internal ();
|
||||||
// XXXX _editing_context.get_selection().remove (this);
|
unselect_self ();
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -2403,7 +2403,7 @@ MidiView::remove_from_selection (NoteBase* ev)
|
||||||
ghost_sync_selection (ev);
|
ghost_sync_selection (ev);
|
||||||
|
|
||||||
if (_selection.empty()) {
|
if (_selection.empty()) {
|
||||||
// XXXX _editing_context.get_selection().remove (this);
|
unselect_self ();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -2428,7 +2428,7 @@ MidiView::add_to_selection (NoteBase* ev)
|
||||||
* only apply to notes anyway, not regions.
|
* only apply to notes anyway, not regions.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// XXX _editing_context.set_selected_midi_region_view (*this);
|
select_self_uniquely ();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (_selection.insert (ev).second == true) {
|
if (_selection.insert (ev).second == true) {
|
||||||
|
|
@ -3173,8 +3173,6 @@ MidiView::change_note_length (NoteBase* event, Temporal::Beats t)
|
||||||
void
|
void
|
||||||
MidiView::begin_drag_edit (std::string const & why)
|
MidiView::begin_drag_edit (std::string const & why)
|
||||||
{
|
{
|
||||||
// XXXX _editing_context.get_selection().set (this, true);
|
|
||||||
start_note_diff_command (why);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|
@ -4079,7 +4077,7 @@ MidiView::maybe_select_by_position (GdkEventButton* ev, double /*x*/, double y)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (add_mrv_selection) {
|
if (add_mrv_selection) {
|
||||||
// XXXXX _editing_context.get_selection().add (this);
|
select_self (true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -173,7 +173,7 @@ class MidiView : public virtual sigc::trackable
|
||||||
void end_write();
|
void end_write();
|
||||||
void extend_active_notes();
|
void extend_active_notes();
|
||||||
|
|
||||||
void begin_drag_edit (std::string const & why);
|
virtual void begin_drag_edit (std::string const & why);
|
||||||
void end_drag_edit ();
|
void end_drag_edit ();
|
||||||
|
|
||||||
void display_model(std::shared_ptr<ARDOUR::MidiModel> model);
|
void display_model(std::shared_ptr<ARDOUR::MidiModel> model);
|
||||||
|
|
@ -332,6 +332,11 @@ class MidiView : public virtual sigc::trackable
|
||||||
EditingContext& editing_context() const { return _editing_context; }
|
EditingContext& editing_context() const { return _editing_context; }
|
||||||
MidiViewBackground& midi_context() const { return _midi_context; }
|
MidiViewBackground& midi_context() const { return _midi_context; }
|
||||||
|
|
||||||
|
virtual void select_self (bool add) {}
|
||||||
|
virtual void unselect_self () {}
|
||||||
|
void select_self () { select_self (false); }
|
||||||
|
virtual void select_self_uniquely () {}
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
void init ();
|
void init ();
|
||||||
virtual void region_resized (const PBD::PropertyChange&);
|
virtual void region_resized (const PBD::PropertyChange&);
|
||||||
|
|
|
||||||
|
|
@ -1622,8 +1622,8 @@ Selection::midi_regions ()
|
||||||
{
|
{
|
||||||
MidiRegionSelection ms;
|
MidiRegionSelection ms;
|
||||||
|
|
||||||
for (RegionSelection::iterator i = regions.begin(); i != regions.end(); ++i) {
|
for (auto & r : regions) {
|
||||||
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(*i);
|
MidiRegionView* mrv = dynamic_cast<MidiRegionView*>(r);
|
||||||
if (mrv) {
|
if (mrv) {
|
||||||
ms.add (mrv);
|
ms.add (mrv);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue