Indicate clock delta mode using Δ
This commit is contained in:
@@ -117,6 +117,7 @@ protected:
|
||||
|
||||
bool on_button_press_event (GdkEventButton *ev);
|
||||
bool on_button_release_event(GdkEventButton *ev);
|
||||
void on_size_request (Gtk::Requisition* req);
|
||||
|
||||
ArdourWidgets::ArdourButton _left_btn;
|
||||
ArdourWidgets::ArdourButton _right_btn;
|
||||
@@ -198,7 +199,6 @@ private:
|
||||
bool on_key_release_event (GdkEventKey *);
|
||||
bool on_scroll_event (GdkEventScroll *ev);
|
||||
void on_style_changed (const Glib::RefPtr<Gtk::Style>&);
|
||||
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*);
|
||||
|
||||
@@ -26,6 +26,8 @@
|
||||
#include "ardour/session.h"
|
||||
#include "ardour/tempo.h"
|
||||
|
||||
#include "gtkmm2ext/colors.h"
|
||||
|
||||
#include "actions.h"
|
||||
#include "main_clock.h"
|
||||
#include "public_editor.h"
|
||||
@@ -46,12 +48,18 @@ MainClock::MainClock (
|
||||
, _disposition(d)
|
||||
, _suspend_delta_mode_signal (false)
|
||||
, _widget_name(widget_name)
|
||||
, _delta_mode (NoDelta)
|
||||
, _layout_width (0)
|
||||
, _layout_height (0)
|
||||
{
|
||||
ValueChanged.connect (sigc::mem_fun(*this, &MainClock::clock_value_changed));
|
||||
|
||||
UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &MainClock::parameter_changed));
|
||||
std::function<void (std::string)> pc (std::bind (&MainClock::parameter_changed, this, _1));
|
||||
UIConfiguration::instance().map_parameters (pc);
|
||||
|
||||
_layout = Pango::Layout::create (get_pango_context());
|
||||
_layout->set_text ("\u0394");
|
||||
}
|
||||
|
||||
void
|
||||
@@ -170,6 +178,46 @@ MainClock::set_display_delta_mode (ClockDeltaMode m)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
MainClock::on_size_request (Gtk::Requisition* req)
|
||||
{
|
||||
AudioClock::on_size_request (req);
|
||||
|
||||
Glib::RefPtr<Pango::Layout> tmp;
|
||||
Glib::RefPtr<Gtk::Style> style = get_style ();
|
||||
Pango::FontDescription font;
|
||||
|
||||
if (!get_realized()) {
|
||||
font = ARDOUR_UI_UTILS::get_font_for_style (get_name());
|
||||
} else {
|
||||
font = style->get_font();
|
||||
}
|
||||
|
||||
_layout->set_font_description (font);
|
||||
|
||||
_layout->get_pixel_size (_layout_width, _layout_height);
|
||||
|
||||
req->width += _layout_width * 1.5;
|
||||
req->height = std::max (req->height, _layout_height);
|
||||
}
|
||||
|
||||
void
|
||||
MainClock::render (Cairo::RefPtr<Cairo::Context> const& ctx, cairo_rectangle_t* rect)
|
||||
{
|
||||
AudioClock::render (ctx, rect);
|
||||
|
||||
if (!_delta_mode) {
|
||||
return;
|
||||
}
|
||||
|
||||
cairo_t* cr = ctx->cobj();
|
||||
|
||||
uint32_t text_color = UIConfiguration::instance().color (string_compose ("%1: text", get_name()));
|
||||
Gtkmm2ext::set_source_rgba (ctx, text_color);
|
||||
cairo_move_to (cr, get_width() - _layout_width * 1.5 , (get_height() - _layout_height) / 2.0);
|
||||
pango_cairo_show_layout (cr, _layout->gobj());
|
||||
}
|
||||
|
||||
void
|
||||
MainClock::edit_current_tempo ()
|
||||
{
|
||||
|
||||
@@ -48,6 +48,8 @@ public:
|
||||
void parameter_changed (std::string p);
|
||||
|
||||
protected:
|
||||
void render (Cairo::RefPtr<Cairo::Context> const&, cairo_rectangle_t*);
|
||||
void on_size_request (Gtk::Requisition* req);
|
||||
ClockDisposition _disposition;
|
||||
|
||||
private:
|
||||
@@ -59,7 +61,11 @@ private:
|
||||
void insert_new_meter ();
|
||||
bool _suspend_delta_mode_signal;
|
||||
std::string _widget_name;
|
||||
ARDOUR::ClockDeltaMode _delta_mode;
|
||||
|
||||
ARDOUR::ClockDeltaMode _delta_mode;
|
||||
Glib::RefPtr<Pango::Layout> _layout;
|
||||
int _layout_width;
|
||||
int _layout_height;
|
||||
};
|
||||
|
||||
/** TransportClock is a clock widget that reflects the state of the canonical MainClocks in ARDOUR_UI (either Primary or Secondary)
|
||||
|
||||
Reference in New Issue
Block a user