13
0

(backport) minimal changes to make group bar more discoverable

* highlight on mouseover
* set cursor to indicate drag motion
This commit is contained in:
Ben Loftis 2024-05-28 17:31:35 -05:00
parent 3940795fdf
commit c032826631
3 changed files with 43 additions and 3 deletions

View File

@ -52,8 +52,9 @@ GroupTabs::GroupTabs ()
: _menu (0)
, _dragging (0)
, _dragging_new_tab (0)
, _hovering (false)
{
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK);
add_events (Gdk::BUTTON_PRESS_MASK|Gdk::BUTTON_RELEASE_MASK|Gdk::POINTER_MOTION_MASK|Gdk::ENTER_NOTIFY_MASK|Gdk::LEAVE_NOTIFY_MASK);
UIConfiguration::instance().ColorsChanged.connect (sigc::mem_fun (*this, &GroupTabs::queue_draw));
}
@ -82,6 +83,33 @@ GroupTabs::set_session (Session* s)
}
}
bool
GroupTabs::on_enter_notify_event (GdkEventCrossing* ev)
{
_hovering = true;
if (UIConfiguration::instance ().get_widget_prelight ()) {
queue_draw ();
}
get_window()->set_cursor (Gdk::Cursor( primary_coordinate(1,0) ? Gdk::SB_H_DOUBLE_ARROW : Gdk::SB_V_DOUBLE_ARROW));
return CairoWidget::on_enter_notify_event (ev);
}
bool
GroupTabs::on_leave_notify_event (GdkEventCrossing* ev)
{
_hovering = false;
if (UIConfiguration::instance ().get_widget_prelight ()) {
queue_draw ();
}
get_window()->set_cursor ();
return CairoWidget::on_leave_notify_event (ev);
}
/** Handle a size request.
* @param req GTK requisition
@ -283,6 +311,13 @@ GroupTabs::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*)
for (list<Tab>::const_iterator i = _tabs.begin(); i != _tabs.end(); ++i) {
draw_tab (cr, *i);
}
if (_hovering) {
cairo_set_source_rgba (cr, 1, 1, 1, 0.15);
cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
}
}
/** Convert a click position to a tab.

View File

@ -133,6 +133,9 @@ private:
bool on_motion_notify_event (GdkEventMotion *);
bool on_button_release_event (GdkEventButton *);
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
Tab * click_to_tab (double, std::list<Tab>::iterator *, std::list<Tab>::iterator *);
void route_group_property_changed (ARDOUR::RouteGroup *);
@ -163,6 +166,8 @@ private:
double _drag_max; ///< maximum position for drag
double _drag_first; ///< first mouse pointer position during drag
bool _hovering;
/** colors that have been used for new route group tabs */
static std::list<Gdk::Color> _used_colors;
};

View File

@ -177,8 +177,8 @@
<ColorAlias name="image track" alias="neutral:foreground2"/>
<ColorAlias name="inactive crossfade" alias="theme:contrast"/>
<ColorAlias name="inactive fade handle" alias="neutral:foreground2"/>
<ColorAlias name="group tab base" alias="neutral:background2"/>
<ColorAlias name="inactive group tab" alias="widget:bg"/>
<ColorAlias name="group tab base" alias="theme:bg"/>
<ColorAlias name="inactive group tab" alias="neutral:midground"/>
<ColorAlias name="invert button: fill" alias="widget:bg"/>
<ColorAlias name="invert button: fill active" alias="alert:blue"/>
<ColorAlias name="invert button: led active" alias="alert:green"/>