use virtual bool canvas_group_event () in TimeAxisViewItems to get suitably delegatable/inherited event handling
This commit is contained in:
parent
b604dd2413
commit
7de31d5a41
@ -43,7 +43,7 @@
|
||||
#include "evoral/Control.hpp"
|
||||
#include "evoral/midi_util.h"
|
||||
|
||||
#include "canvas/pixbuf.h"
|
||||
#include "canvas/debug.h"
|
||||
|
||||
#include "automation_region_view.h"
|
||||
#include "automation_time_axis.h"
|
||||
@ -114,6 +114,7 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||
, pre_press_cursor (0)
|
||||
, _note_player (0)
|
||||
{
|
||||
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
|
||||
_note_group->raise_to_top();
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
|
||||
@ -150,7 +151,9 @@ MidiRegionView::MidiRegionView (ArdourCanvas::Group *parent, RouteTimeAxisView &
|
||||
, pre_press_cursor (0)
|
||||
, _note_player (0)
|
||||
{
|
||||
CANVAS_DEBUG_NAME (_note_group, string_compose ("note group for %1", get_item_name()));
|
||||
_note_group->raise_to_top();
|
||||
|
||||
PublicEditor::DropDownKeys.connect (sigc::mem_fun (*this, &MidiRegionView::drop_down_keys));
|
||||
|
||||
connect_to_diskstream ();
|
||||
@ -276,8 +279,6 @@ MidiRegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||
reset_width_dependent_items (_pixel_width);
|
||||
|
||||
group->raise_to_top();
|
||||
group->Event.connect (sigc::mem_fun (this, &MidiRegionView::canvas_event));
|
||||
|
||||
|
||||
midi_view()->midi_track()->PlaybackChannelModeChanged.connect (_channel_mode_changed_connection, invalidator (*this),
|
||||
boost::bind (&MidiRegionView::midi_channel_mode_changed, this),
|
||||
@ -319,7 +320,7 @@ MidiRegionView::connect_to_diskstream ()
|
||||
}
|
||||
|
||||
bool
|
||||
MidiRegionView::canvas_event(GdkEvent* ev)
|
||||
MidiRegionView::canvas_group_event(GdkEvent* ev)
|
||||
{
|
||||
bool r;
|
||||
|
||||
@ -385,7 +386,7 @@ MidiRegionView::canvas_event(GdkEvent* ev)
|
||||
break;
|
||||
}
|
||||
|
||||
return false;
|
||||
return trackview.editor().canvas_region_view_event (ev, group, this);
|
||||
}
|
||||
|
||||
void
|
||||
@ -626,7 +627,6 @@ MidiRegionView::motion (GdkEventMotion* ev)
|
||||
MouseMode m = editor.current_mouse_mode();
|
||||
|
||||
if (m == MouseDraw || (m == MouseObject && Keyboard::modifier_state_contains (ev->state, Keyboard::insert_note_modifier()))) {
|
||||
|
||||
editor.drags()->set (new NoteCreateDrag (dynamic_cast<Editor *> (&editor), group, this), (GdkEvent *) ev);
|
||||
_mouse_state = AddDragging;
|
||||
remove_ghost_note ();
|
||||
|
@ -349,7 +349,7 @@ private:
|
||||
|
||||
void clear_events (bool with_selection_signal = true);
|
||||
|
||||
bool canvas_event(GdkEvent* ev);
|
||||
bool canvas_group_event(GdkEvent* ev);
|
||||
bool note_canvas_event(GdkEvent* ev);
|
||||
|
||||
void midi_channel_mode_changed ();
|
||||
|
@ -199,7 +199,7 @@ NoteBase::set_selected(bool selected)
|
||||
}
|
||||
|
||||
_selected = selected;
|
||||
set_fill_color (base_color ());
|
||||
set_fill_color (base_color());
|
||||
|
||||
if (_selected) {
|
||||
set_outline_color(calculate_outline(ARDOUR_UI::config()->get_canvasvar_MidiNoteSelected()));
|
||||
|
@ -196,8 +196,6 @@ RegionView::init (Gdk::Color const & basic_color, bool wfd)
|
||||
|
||||
_region->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RegionView::region_changed, this, _1), gui_context());
|
||||
|
||||
group->Event.connect (sigc::bind (sigc::mem_fun (PublicEditor::instance(), &PublicEditor::canvas_region_view_event), group, this));
|
||||
|
||||
set_colors ();
|
||||
|
||||
ColorsChanged.connect (sigc::mem_fun (*this, &RegionView::color_handler));
|
||||
@ -222,6 +220,12 @@ RegionView::~RegionView ()
|
||||
delete editor;
|
||||
}
|
||||
|
||||
bool
|
||||
RegionView::canvas_group_event (GdkEvent* event)
|
||||
{
|
||||
return trackview.editor().canvas_region_view_event (event, group, this);
|
||||
}
|
||||
|
||||
void
|
||||
RegionView::set_silent_frames (const AudioIntervalResult& silences, double /*threshold*/)
|
||||
{
|
||||
|
@ -135,6 +135,8 @@ class RegionView : public TimeAxisViewItem
|
||||
bool recording,
|
||||
TimeAxisViewItem::Visibility);
|
||||
|
||||
bool canvas_group_event (GdkEvent*);
|
||||
|
||||
virtual void region_resized (const PBD::PropertyChange&);
|
||||
virtual void region_muted ();
|
||||
void region_locked ();
|
||||
|
@ -942,16 +942,18 @@ TimeAxisView::get_selection_rect (uint32_t id)
|
||||
|
||||
rect->rect = new ArdourCanvas::Rectangle (selection_group);
|
||||
CANVAS_DEBUG_NAME (rect->rect, "selection rect");
|
||||
rect->rect->set_outline_what (0);
|
||||
rect->rect->set_outline (false);
|
||||
rect->rect->set_fill_color (ARDOUR_UI::config()->get_canvasvar_SelectionRect());
|
||||
|
||||
rect->start_trim = new ArdourCanvas::Rectangle (selection_group);
|
||||
CANVAS_DEBUG_NAME (rect->rect, "selection rect start trim");
|
||||
rect->start_trim->set_outline_what (0);
|
||||
rect->start_trim->set_outline (false);
|
||||
rect->start_trim->set_fill (false);
|
||||
|
||||
rect->end_trim = new ArdourCanvas::Rectangle (selection_group);
|
||||
CANVAS_DEBUG_NAME (rect->rect, "selection rect end trim");
|
||||
rect->end_trim->set_outline_what (0);
|
||||
rect->end_trim->set_outline (false);
|
||||
rect->end_trim->set_fill (false);
|
||||
|
||||
free_selection_rects.push_front (rect);
|
||||
|
||||
|
@ -111,10 +111,7 @@ TimeAxisViewItem::TimeAxisViewItem(
|
||||
, _automation (automation)
|
||||
, _dragging (false)
|
||||
{
|
||||
group = new ArdourCanvas::Group (&parent);
|
||||
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", it_name));
|
||||
|
||||
init (it_name, spu, base_color, start, duration, vis, true, true);
|
||||
init (it_name, &parent, spu, base_color, start, duration, vis, true, true);
|
||||
}
|
||||
|
||||
TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
||||
@ -136,21 +133,22 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
|
||||
/* share the other's parent, but still create a new group */
|
||||
|
||||
ArdourCanvas::Group* parent = other.group->parent();
|
||||
|
||||
group = new ArdourCanvas::Group (parent);
|
||||
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
|
||||
|
||||
|
||||
_selected = other._selected;
|
||||
|
||||
init (other.item_name, other.samples_per_pixel, c, other.frame_position,
|
||||
|
||||
init (other.item_name, parent, other.samples_per_pixel, c, other.frame_position,
|
||||
other.item_duration, other.visibility, other.wide_enough_for_name, other.high_enough_for_name);
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::init (const string& it_name, double fpp, Gdk::Color const & base_color,
|
||||
TimeAxisViewItem::init (const string& it_name, ArdourCanvas::Group* parent, double fpp, Gdk::Color const & base_color,
|
||||
framepos_t start, framepos_t duration, Visibility vis,
|
||||
bool wide, bool high)
|
||||
{
|
||||
group = new ArdourCanvas::Group (parent);
|
||||
CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
|
||||
group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
|
||||
|
||||
item_name = it_name;
|
||||
samples_per_pixel = fpp;
|
||||
frame_position = start;
|
||||
@ -266,6 +264,12 @@ TimeAxisViewItem::~TimeAxisViewItem()
|
||||
delete group;
|
||||
}
|
||||
|
||||
bool
|
||||
TimeAxisViewItem::canvas_group_event (GdkEvent* ev)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
TimeAxisViewItem::hide_rect ()
|
||||
{
|
||||
|
@ -157,7 +157,9 @@ class TimeAxisViewItem : public Selectable, public PBD::ScopedConnectionList
|
||||
|
||||
TimeAxisViewItem (const TimeAxisViewItem&);
|
||||
|
||||
void init (const std::string&, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
|
||||
void init (const std::string&, ArdourCanvas::Group*, double, Gdk::Color const &, framepos_t, framepos_t, Visibility, bool, bool);
|
||||
|
||||
virtual bool canvas_group_event (GdkEvent*);
|
||||
|
||||
virtual void compute_colors (Gdk::Color const &);
|
||||
virtual void set_colors();
|
||||
|
Loading…
Reference in New Issue
Block a user