Prelight Audio Clock

This commit is contained in:
Robin Gareus
2024-12-18 15:28:42 +01:00
parent f7d2c0b33e
commit d34213d7f3
2 changed files with 37 additions and 0 deletions

View File

@@ -101,6 +101,7 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
, drag_field (Field (0))
, xscale (1.0)
, yscale (1.0)
, _hovering (false)
{
if (editable) {
set_can_focus ();
@@ -328,6 +329,16 @@ AudioClock::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t*
}
}
}
if (UIConfigurationBase::instance().get_widget_prelight() && (_hovering || editing)) {
if (corner_radius) {
Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), corner_radius);
} else {
cairo_rectangle (cr, 0, 0, get_width(), get_height());
}
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.12);
cairo_fill (cr);
}
}
void
@@ -1752,6 +1763,28 @@ AudioClock::on_button_release_event (GdkEventButton *ev)
return false;
}
bool
AudioClock::on_enter_notify_event (GdkEventCrossing* ev)
{
if (UIConfigurationBase::instance().get_widget_prelight() && editable && !_off) {
_hovering = true;
CairoWidget::set_dirty ();
}
return CairoWidget::on_enter_notify_event (ev);
}
bool
AudioClock::on_leave_notify_event (GdkEventCrossing* ev)
{
_hovering = false;
if (UIConfigurationBase::instance().get_widget_prelight()) {
CairoWidget::set_dirty ();
}
return CairoWidget::on_leave_notify_event (ev);
}
bool
AudioClock::on_focus_out_event (GdkEventFocus* ev)
{

View File

@@ -201,6 +201,8 @@ private:
void on_size_request (Gtk::Requisition* req);
bool on_motion_notify_event (GdkEventMotion *ev);
bool on_focus_out_event (GdkEventFocus*);
bool on_enter_notify_event (GdkEventCrossing*);
bool on_leave_notify_event (GdkEventCrossing*);
void set_slave_info ();
void set_timecode (Temporal::timepos_t const &);
@@ -256,6 +258,8 @@ private:
double xscale;
double yscale;
bool _hovering;
PBD::ScopedConnection tempo_map_connection;
};