13
0

track mouse motion in the mapping bar

This does not yet snap to BBT positions
This commit is contained in:
Paul Davis 2023-02-26 13:46:51 -07:00
parent 5e01503a56
commit 868d606d16
3 changed files with 30 additions and 15 deletions

View File

@ -193,8 +193,10 @@ Editor::initialize_canvas ()
mapping_cursor->set_fill (false);
mapping_cursor->set_outline (true);
mapping_cursor->set_outline_color (0xff0000ff);
mapping_cursor->set_radius (timebar_height);
mapping_cursor->set_radius (timebar_height/2);
mapping_cursor->set_arc (360);
mapping_cursor->set_ignore_events (true);
mapping_cursor->set_center (ArdourCanvas::Duple (35., timebar_height/2.0)); // x is arbitrary at this time
mapping_cursor->hide ();
range_marker_bar = new ArdourCanvas::Rectangle (range_marker_group, ArdourCanvas::Rect (0.0, timebar_top, ArdourCanvas::COORD_MAX, timebar_btm));
@ -257,7 +259,7 @@ Editor::initialize_canvas ()
transport_punchout_line->hide();
tempo_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), tempo_bar, TempoBarItem, "tempo bar"));
mapping_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), tempo_bar, MappingBarItem, "mapping bar"));
mapping_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), mapping_bar, MappingBarItem, "mapping bar"));
meter_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), meter_bar, MeterBarItem, "meter bar"));
marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), marker_bar, MarkerBarItem, "marker bar"));
cd_marker_bar->Event.connect (sigc::bind (sigc::mem_fun (*this, &Editor::canvas_ruler_bar_event), cd_marker_bar, CdMarkerBarItem, "cd marker bar"));

View File

@ -1072,18 +1072,18 @@ Editor::canvas_ruler_bar_event (GdkEvent *event, ArdourCanvas::Item* item, ItemT
/* XXX consolidate with Editor::canvas_ruler_event ? */
switch (event->type) {
case GDK_ENTER_NOTIFY:
if (event->crossing.detail != GDK_NOTIFY_INFERIOR) {
item->set_fill_color (Gtkmm2ext::HSV(UIConfiguration::instance().color_mod (color_name, "marker bar")).lighter(0.20).color());
}
break;
case GDK_LEAVE_NOTIFY:
if (event->crossing.detail != GDK_NOTIFY_INFERIOR) {
item->set_fill_color (UIConfiguration::instance().color_mod (color_name, "marker bar"));
}
break;
default:
break;
case GDK_ENTER_NOTIFY:
if (event->crossing.detail != GDK_NOTIFY_INFERIOR) {
item->set_fill_color (Gtkmm2ext::HSV(UIConfiguration::instance().color_mod (color_name, "marker bar")).lighter(0.20).color());
}
break;
case GDK_LEAVE_NOTIFY:
if (event->crossing.detail != GDK_NOTIFY_INFERIOR) {
item->set_fill_color (UIConfiguration::instance().color_mod (color_name, "marker bar"));
}
break;
default:
break;
};
return typed_event (item, event, type);

View File

@ -1987,6 +1987,10 @@ Editor::enter_handler (ArdourCanvas::Item* item, GdkEvent* event, ItemType item_
choose_canvas_cursor_on_entry (item_type);
switch (item_type) {
case MappingBarItem:
mapping_cursor->show ();
break;
case ControlPointItem:
if (mouse_mode == MouseDraw || mouse_mode == MouseObject || mouse_mode == MouseContent) {
cp = static_cast<ControlPoint*>(item->get_data ("control_point"));
@ -2132,6 +2136,10 @@ Editor::leave_handler (ArdourCanvas::Item* item, GdkEvent*, ItemType item_type)
}
switch (item_type) {
case MappingBarItem:
mapping_cursor->hide ();
break;
case ControlPointItem:
_verbose_cursor->hide ();
break;
@ -2280,7 +2288,7 @@ Editor::scrub (samplepos_t sample, double current_x)
}
bool
Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from_autoscroll)
Editor::motion_handler (ArdourCanvas::Item* item, GdkEvent* event, bool from_autoscroll)
{
_last_motion_y = event->motion.y;
@ -2334,6 +2342,11 @@ Editor::motion_handler (ArdourCanvas::Item* /*item*/, GdkEvent* event, bool from
timepos_t t (where);
snap_to_with_modifier (t, event);
set_snapped_cursor_position (t);
if (item == mapping_bar) {
double const new_pos = sample_to_pixel_unrounded (where);
mapping_cursor->set_center (ArdourCanvas::Duple (new_pos, mapping_cursor->center().y));
}
}
if (!peaks_visible) {