mirror of
https://github.com/Ardour/ardour.git
synced 2025-12-06 06:44:57 +01:00
Prelight group-tab bars (backport from LiveTrax)
This commit is contained in:
parent
bdd6eec95c
commit
e6bdf31483
2 changed files with 41 additions and 1 deletions
|
|
@ -54,8 +54,9 @@ GroupTabs::GroupTabs ()
|
|||
, _dragging_new_tab (0)
|
||||
, _extent (-1)
|
||||
, _offset (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));
|
||||
}
|
||||
|
||||
|
|
@ -84,6 +85,34 @@ 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 (offset () != 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);
|
||||
}
|
||||
|
||||
void
|
||||
GroupTabs::set_extent (double extent)
|
||||
{
|
||||
|
|
@ -306,6 +335,12 @@ 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 && UIConfiguration::instance ().get_widget_prelight ()) {
|
||||
cairo_set_source_rgba (cr, 1, 1, 1, 0.12);
|
||||
cairo_rectangle (cr, 0, 0, get_width(), get_height());
|
||||
cairo_fill (cr);
|
||||
}
|
||||
}
|
||||
|
||||
/** Convert a click position to a tab.
|
||||
|
|
|
|||
|
|
@ -141,6 +141,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 *);
|
||||
|
|
@ -173,6 +176,8 @@ private:
|
|||
double _extent;
|
||||
double _offset;
|
||||
|
||||
bool _hovering;
|
||||
|
||||
/** colors that have been used for new route group tabs */
|
||||
static std::list<Gdk::Color> _used_colors;
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue