summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/ardour_button.cc52
-rw-r--r--gtk2_ardour/audio_clock.cc98
-rw-r--r--gtk2_ardour/audio_clock.h6
-rw-r--r--gtk2_ardour/cairo_widget.cc57
-rw-r--r--gtk2_ardour/cairo_widget.h13
-rw-r--r--gtk2_ardour/editor_group_tabs.cc10
-rw-r--r--gtk2_ardour/editor_group_tabs.h2
-rw-r--r--gtk2_ardour/editor_summary.cc22
-rw-r--r--gtk2_ardour/group_tabs.cc2
-rw-r--r--gtk2_ardour/led.cc4
-rw-r--r--gtk2_ardour/mixer_group_tabs.cc10
-rw-r--r--gtk2_ardour/mixer_group_tabs.h2
-rw-r--r--gtk2_ardour/time_info_box.cc8
13 files changed, 155 insertions, 131 deletions
diff --git a/gtk2_ardour/ardour_button.cc b/gtk2_ardour/ardour_button.cc
index 3f9c31b4a5..ca0a1c38c0 100644
--- a/gtk2_ardour/ardour_button.cc
+++ b/gtk2_ardour/ardour_button.cc
@@ -129,30 +129,20 @@ void
ArdourButton::render (cairo_t* cr)
{
if (!_fixed_diameter) {
- _diameter = std::min (_width, _height);
+ _diameter = std::min (get_width(), get_height());
}
- /* background fill. use parent window style, so that we fit in nicely.
- */
-
- Color c = get_parent_bg ();
-
- cairo_rectangle (cr, 0, 0, _width, _height);
- cairo_stroke_preserve (cr);
- cairo_set_source_rgb (cr, c.get_red_p(), c.get_green_p(), c.get_blue_p());
- cairo_fill (cr);
-
if (_elements & Edge) {
- Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), _corner_radius);
cairo_set_source (cr, edge_pattern);
cairo_fill (cr);
}
if (_elements & Body) {
if (_elements & Edge) {
- Gtkmm2ext::rounded_rectangle (cr, 1, 1, _width-2, _height-2, _corner_radius - 1.0);
+ Gtkmm2ext::rounded_rectangle (cr, 1, 1, get_width()-2, get_height()-2, _corner_radius - 1.0);
} else {
- Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius - 1.0);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), _corner_radius - 1.0);
}
cairo_set_source (cr, fill_pattern);
cairo_fill (cr);
@@ -161,8 +151,8 @@ ArdourButton::render (cairo_t* cr)
if (_pixbuf) {
double x,y;
- x = (_width - _pixbuf->get_width())/2.0;
- y = (_height - _pixbuf->get_height())/2.0;
+ x = (get_width() - _pixbuf->get_width())/2.0;
+ y = (get_height() - _pixbuf->get_height())/2.0;
cairo_rectangle (cr, x, y, _pixbuf->get_width(), _pixbuf->get_height());
gdk_cairo_set_source_pixbuf (cr, _pixbuf->gobj(), x, y);
@@ -173,7 +163,7 @@ ArdourButton::render (cairo_t* cr)
int text_margin;
- if (_width < 75) {
+ if (get_width() < 75) {
text_margin = 3;
} else {
text_margin = 10;
@@ -185,13 +175,13 @@ ArdourButton::render (cairo_t* cr)
if (_elements & Indicator) {
if (_led_left) {
- cairo_move_to (cr, text_margin + _diameter + 4, _height/2.0 - _text_height/2.0);
+ cairo_move_to (cr, text_margin + _diameter + 4, get_height()/2.0 - _text_height/2.0);
} else {
- cairo_move_to (cr, text_margin, _height/2.0 - _text_height/2.0);
+ cairo_move_to (cr, text_margin, get_height()/2.0 - _text_height/2.0);
}
} else {
/* center text */
- cairo_move_to (cr, (_width - _text_width)/2.0, _height/2.0 - _text_height/2.0);
+ cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0);
}
pango_cairo_show_layout (cr, _layout->gobj());
@@ -205,12 +195,12 @@ ArdourButton::render (cairo_t* cr)
if (_elements & Text) {
if (_led_left) {
- cairo_translate (cr, text_margin + (_diameter/2.0), _height/2.0);
+ cairo_translate (cr, text_margin + (_diameter/2.0), get_height()/2.0);
} else {
- cairo_translate (cr, _width - ((_diameter/2.0) + 4.0), _height/2.0);
+ cairo_translate (cr, get_width() - ((_diameter/2.0) + 4.0), get_height()/2.0);
}
} else {
- cairo_translate (cr, _width/2.0, _height/2.0);
+ cairo_translate (cr, get_width()/2.0, get_height()/2.0);
}
//inset
@@ -242,7 +232,7 @@ ArdourButton::render (cairo_t* cr)
/* a partially transparent gray layer to indicate insensitivity */
if ((visual_state() & Gtkmm2ext::Insensitive)) {
- Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), _corner_radius);
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.5);
cairo_fill (cr);
}
@@ -251,7 +241,7 @@ ArdourButton::render (cairo_t* cr)
if (ARDOUR::Config->get_widget_prelight()) {
if (_hovering) {
- Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, _height, _corner_radius);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), _corner_radius);
cairo_set_source_rgba (cr, 0.905, 0.917, 0.925, 0.2);
cairo_fill (cr);
}
@@ -339,7 +329,7 @@ ArdourButton::set_colors ()
if (_elements & Edge) {
- edge_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _height);
+ edge_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
if (visual_state() & Gtkmm2ext::Selected) {
start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border start selected", get_name()));
end_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: border end selected", get_name()));
@@ -362,7 +352,7 @@ ArdourButton::set_colors ()
}
if (_elements & Body) {
- fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, _height);
+ fill_pattern = cairo_pattern_create_linear (0.0, 0.0, 0.0, get_height());
if (active_state() == Gtkmm2ext::Mid) {
start_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: fill start mid", get_name()));
@@ -590,7 +580,7 @@ ArdourButton::setup_led_rect ()
{
int text_margin;
- if (_width < 75) {
+ if (get_width() < 75) {
text_margin = 3;
} else {
text_margin = 10;
@@ -603,14 +593,14 @@ ArdourButton::setup_led_rect ()
if (_led_left) {
_led_rect->x = text_margin;
} else {
- _led_rect->x = _width - text_margin - _diameter/2.0;
+ _led_rect->x = get_width() - text_margin - _diameter/2.0;
}
} else {
/* centered */
- _led_rect->x = _width/2.0 - _diameter/2.0;
+ _led_rect->x = get_width()/2.0 - _diameter/2.0;
}
- _led_rect->y = _height/2.0 - _diameter/2.0;
+ _led_rect->y = get_height()/2.0 - _diameter/2.0;
_led_rect->width = _diameter;
_led_rect->height = _diameter;
diff --git a/gtk2_ardour/audio_clock.cc b/gtk2_ardour/audio_clock.cc
index 6b2f621ab0..a7e7bbf418 100644
--- a/gtk2_ardour/audio_clock.cc
+++ b/gtk2_ardour/audio_clock.cc
@@ -53,6 +53,7 @@ sigc::signal<void> AudioClock::ModeChanged;
vector<AudioClock*> AudioClock::clocks;
const double AudioClock::info_font_scale_factor = 0.6;
const double AudioClock::separator_height = 2.0;
+const double AudioClock::x_leading_padding = 6.0;
AudioClock::AudioClock (const string& clock_name, bool transient, const string& widget_name,
bool allow_edit, bool follows_playhead, bool duration, bool with_info)
@@ -62,10 +63,8 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
, editable (allow_edit)
, _follows_playhead (follows_playhead)
, _off (false)
- , _need_bg (true)
, ops_menu (0)
, editing_attr (0)
- , background_attr (0)
, foreground_attr (0)
, mode_based_info_ratio (1.0)
, editing (false)
@@ -100,7 +99,6 @@ AudioClock::AudioClock (const string& clock_name, bool transient, const string&
AudioClock::~AudioClock ()
{
- delete background_attr;
delete foreground_attr;
delete editing_attr;
}
@@ -180,13 +178,12 @@ AudioClock::set_colors ()
editing_color = ARDOUR_UI::config()->color_by_name (string_compose ("%1: edited text", get_name()));
}
+ /* store for bg in ::render() */
+
UINT_TO_RGBA (bg_color, &r, &g, &b, &a);
r = lrint ((r/256.0) * 65535.0);
g = lrint ((g/256.0) * 65535.0);
b = lrint ((b/256.0) * 65535.0);
- background_attr = new Pango::AttrColor (Pango::Attribute::create_attr_background (r, g, b));
-
- /* store for bg in ::render() */
bg_r = r/256.0;
bg_g = g/256.0;
bg_b = b/256.0;
@@ -204,13 +201,8 @@ AudioClock::set_colors ()
b = lrint ((b/256.0) * 65535.0);
editing_attr = new Pango::AttrColor (Pango::Attribute::create_attr_foreground (r, g, b));
- normal_attributes.change (*background_attr);
normal_attributes.change (*foreground_attr);
-
- info_attributes.change (*background_attr);
info_attributes.change (*foreground_attr);
-
- editing_attributes.change (*background_attr);
editing_attributes.change (*foreground_attr);
editing_attributes.change (*editing_attr);
@@ -231,68 +223,55 @@ AudioClock::set_colors ()
void
AudioClock::render (cairo_t* cr)
{
+ /* main layout: rounded rect, plus the text */
+
if (_need_bg) {
- /* paint entire area the color of the parent window bg
-
- XXX try to optimize this so that we just paint the corners and
- other areas that may be exposed by rounded corners.
- */
-
- Gdk::Color bg (get_parent_bg());
- cairo_rectangle (cr, 0, 0, _width, _height);
- cairo_stroke_preserve (cr);
- cairo_set_source_rgb (cr, bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
+ cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
+ Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), upper_height, 9);
cairo_fill (cr);
}
- /* main layout: rounded rect, plus the text */
-
- cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
- Gtkmm2ext::rounded_rectangle (cr, 0, 0, _width, upper_height, 9);
-
- cairo_move_to (cr, 6, (upper_height - layout_height) / 2.0);
+ cairo_move_to (cr, x_leading_padding, (upper_height - layout_height) / 2.0);
pango_cairo_show_layout (cr, _layout->gobj());
if (_left_layout) {
- double h = _height - upper_height - separator_height;
+ double h = get_height() - upper_height - separator_height;
+
+ if (_need_bg) {
+ cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
+ }
if (mode_based_info_ratio != 1.0) {
- double left_rect_width = round (((_width - separator_height) * mode_based_info_ratio) + 0.5);
+ double left_rect_width = round (((get_width() - separator_height) * mode_based_info_ratio) + 0.5);
- cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
- Gtkmm2ext::rounded_rectangle (cr, 0, upper_height + separator_height, left_rect_width, h, 9);
-
- cairo_move_to (cr, 6, upper_height + separator_height + ((h - info_height)/2.0));
+ if (_need_bg) {
+ Gtkmm2ext::rounded_rectangle (cr, 0, upper_height + separator_height, left_rect_width, h, 9);
+ cairo_fill (cr);
+ }
+
+ cairo_move_to (cr, x_leading_padding, upper_height + separator_height + ((h - info_height)/2.0));
pango_cairo_show_layout (cr, _left_layout->gobj());
- Gtkmm2ext::rounded_rectangle (cr, left_rect_width + separator_height, upper_height + separator_height,
- _width - separator_height - left_rect_width, h, 9);
-
- cairo_move_to (cr, 6 + left_rect_width + separator_height, upper_height + separator_height + ((h - info_height)/2.0));
+ if (_need_bg) {
+ Gtkmm2ext::rounded_rectangle (cr, left_rect_width + separator_height, upper_height + separator_height,
+ get_width() - separator_height - left_rect_width, h, 9);
+ cairo_fill (cr);
+ }
+
+ cairo_move_to (cr, x_leading_padding + left_rect_width + separator_height, upper_height + separator_height + ((h - info_height)/2.0));
pango_cairo_show_layout (cr, _right_layout->gobj());
} else {
/* no info to display, or just one */
- cairo_set_source_rgba (cr, bg_r, bg_g, bg_b, bg_a);
- Gtkmm2ext::rounded_rectangle (cr, 0, upper_height + separator_height, _width, h, 9);
+ if (_need_bg) {
+ Gtkmm2ext::rounded_rectangle (cr, 0, upper_height + separator_height, get_width(), h, 9);
+ cairo_fill (cr);
+ }
}
}
-
- if (editing) {
- Pango::Rectangle cursor = _layout->get_cursor_strong_pos (edit_string.length() - input_string.length() - 1);
- cerr << "index at " << edit_string.length() - input_string.length() - 1
- << " cursor at " << cursor.get_x()/PANGO_SCALE << ", " << cursor.get_y()/PANGO_SCALE
- << " " << cursor.get_width()/PANGO_SCALE
- << " .. " << cursor.get_height()/PANGO_SCALE
- << endl;
- cairo_set_source_rgba (cr, 0.9, 0.1, 0.1, 0.3);
- cairo_rectangle (cr, 6 + cursor.get_x()/PANGO_SCALE, cursor.get_y()/PANGO_SCALE,
- 10, cursor.get_height()/PANGO_SCALE);
- cairo_fill (cr);
- }
}
void
@@ -301,9 +280,9 @@ AudioClock::on_size_allocate (Gtk::Allocation& alloc)
CairoWidget::on_size_allocate (alloc);
if (_left_layout) {
- upper_height = (_height/2.0) - 1.0;
+ upper_height = (get_height()/2.0) - 1.0;
} else {
- upper_height = _height;
+ upper_height = get_height();
}
}
@@ -356,6 +335,10 @@ AudioClock::on_size_request (Gtk::Requisition* req)
tmp->get_pixel_size (w, info_height);
+ /* silly extra padding that seems necessary to correct the info
+ * that pango just gave us. I have no idea why.
+ */
+
info_height += 4;
req->height += info_height;
@@ -369,7 +352,6 @@ AudioClock::show_edit_status (int length)
editing_attr->set_start_index (edit_string.length() - length);
editing_attr->set_end_index (edit_string.length());
- editing_attributes.change (*background_attr);
editing_attributes.change (*foreground_attr);
editing_attributes.change (*editing_attr);
@@ -452,6 +434,7 @@ AudioClock::end_edit (bool modify)
}
} else {
+
editing = false;
_layout->set_attributes (normal_attributes);
_layout->set_text (pre_edit_string);
@@ -1701,9 +1684,4 @@ AudioClock::focus ()
start_edit ();
}
-void
-AudioClock::set_draw_background (bool yn)
-{
- _need_bg = yn;
-}
diff --git a/gtk2_ardour/audio_clock.h b/gtk2_ardour/audio_clock.h
index 3f3c5dc846..03c5e802d2 100644
--- a/gtk2_ardour/audio_clock.h
+++ b/gtk2_ardour/audio_clock.h
@@ -67,7 +67,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
void set_mode (Mode);
void set_bbt_reference (framepos_t);
void set_is_duration (bool);
- void set_draw_background (bool yn);
std::string name() const { return _name; }
@@ -94,7 +93,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
/** true if this clock follows the playhead, meaning that certain operations are redundant */
bool _follows_playhead;
bool _off;
- bool _need_bg;
Gtk::Menu *ops_menu;
@@ -103,7 +101,6 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
Glib::RefPtr<Pango::Layout> _right_layout;
Pango::AttrColor* editing_attr;
- Pango::AttrColor* background_attr;
Pango::AttrColor* foreground_attr;
Pango::AttrList normal_attributes;
@@ -117,6 +114,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
double mode_based_info_ratio;
static const double info_font_scale_factor;
static const double separator_height;
+ static const double x_leading_padding;
enum Field {
Timecode_Hours,
@@ -140,7 +138,7 @@ class AudioClock : public CairoWidget, public ARDOUR::SessionHandlePtr
std::string pre_edit_string;
std::string input_string;
std::string::size_type insert_max;
-
+
framepos_t bbt_reference_time;
framepos_t last_when;
bool last_pdelta;
diff --git a/gtk2_ardour/cairo_widget.cc b/gtk2_ardour/cairo_widget.cc
index 3bd5ab9fca..6abc758035 100644
--- a/gtk2_ardour/cairo_widget.cc
+++ b/gtk2_ardour/cairo_widget.cc
@@ -20,11 +20,12 @@
#include "cairo_widget.h"
#include "gui_thread.h"
+static const char* has_cairo_widget_background_info = "has_cairo_widget_background_info";
+
CairoWidget::CairoWidget ()
- : _width (1)
- , _height (1)
- , _active_state (Gtkmm2ext::ActiveState (0))
+ : _active_state (Gtkmm2ext::ActiveState (0))
, _visual_state (Gtkmm2ext::VisualState (0))
+ , _need_bg (true)
{
}
@@ -39,7 +40,18 @@ CairoWidget::on_expose_event (GdkEventExpose *ev)
cairo_t* cr = gdk_cairo_create (get_window ()->gobj());
cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
cairo_clip (cr);
+
+ /* paint expose area the color of the parent window bg
+ */
+
+ Gdk::Color bg (get_parent_bg());
+
+ cairo_rectangle (cr, ev->area.x, ev->area.y, ev->area.width, ev->area.height);
+ cairo_set_source_rgb (cr, bg.get_red_p(), bg.get_green_p(), bg.get_blue_p());
+ cairo_fill (cr);
+
render (cr);
+
cairo_destroy (cr);
return true;
@@ -64,9 +76,6 @@ CairoWidget::on_size_allocate (Gtk::Allocation& alloc)
{
Gtk::EventBox::on_size_allocate (alloc);
- _width = alloc.get_width ();
- _height = alloc.get_height ();
-
set_dirty ();
}
@@ -77,8 +86,19 @@ CairoWidget::get_parent_bg ()
parent = get_parent ();
- while (parent && !parent->get_has_window()) {
- parent = parent->get_parent();
+ while (parent) {
+ void* p = g_object_get_data (G_OBJECT(parent->gobj()), has_cairo_widget_background_info);
+
+ if (p) {
+ Glib::RefPtr<Gtk::Style> style = parent->get_style();
+ return style->get_bg (get_state());
+ }
+
+ if (!parent->get_has_window()) {
+ parent = parent->get_parent();
+ } else {
+ break;
+ }
}
if (parent && parent->get_has_window()) {
@@ -135,3 +155,24 @@ CairoWidget::on_state_changed (Gtk::StateType)
queue_draw ();
}
+
+void
+CairoWidget::set_draw_background (bool yn)
+{
+ _need_bg = yn;
+}
+
+void
+CairoWidget::provide_background_for_cairo_widget (Gtk::Widget& w, const Gdk::Color& bg)
+{
+ /* set up @w to be able to provide bg information to
+ any CairoWidgets that are packed inside it.
+ */
+
+ w.modify_bg (Gtk::STATE_NORMAL, bg);
+ w.modify_bg (Gtk::STATE_INSENSITIVE, bg);
+ w.modify_bg (Gtk::STATE_ACTIVE, bg);
+ w.modify_bg (Gtk::STATE_SELECTED, bg);
+
+ g_object_set_data (G_OBJECT(w.gobj()), has_cairo_widget_background_info, (void*) 0xfeedface);
+}
diff --git a/gtk2_ardour/cairo_widget.h b/gtk2_ardour/cairo_widget.h
index dc50762b16..b34b305157 100644
--- a/gtk2_ardour/cairo_widget.h
+++ b/gtk2_ardour/cairo_widget.h
@@ -53,8 +53,18 @@ public:
void set_active (bool);
bool get_active () { return active_state() != Gtkmm2ext::ActiveState (0); }
+ /* widgets can be told to only draw their "foreground, and thus leave
+ in place whatever background is drawn by their parent. the default
+ is that the widget will fill its event window with the background
+ color of the parent container.
+ */
+
+ void set_draw_background (bool yn);
+
sigc::signal<void> StateChanged;
+ static void provide_background_for_cairo_widget (Gtk::Widget& w, const Gdk::Color& bg);
+
protected:
/** Render the widget to the given Cairo context */
virtual void render (cairo_t *) = 0;
@@ -63,10 +73,9 @@ protected:
void on_state_changed (Gtk::StateType);
Gdk::Color get_parent_bg ();
- int _width; ///< pixmap width
- int _height; ///< pixmap height
Gtkmm2ext::ActiveState _active_state;
Gtkmm2ext::VisualState _visual_state;
+ bool _need_bg;
private:
GdkPixmap* _pixmap; ///< our pixmap
diff --git a/gtk2_ardour/editor_group_tabs.cc b/gtk2_ardour/editor_group_tabs.cc
index 9b21432fef..ba94b16dd4 100644
--- a/gtk2_ardour/editor_group_tabs.cc
+++ b/gtk2_ardour/editor_group_tabs.cc
@@ -80,7 +80,7 @@ EditorGroupTabs::compute_tabs () const
void
EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
{
- double const arc_radius = _width;
+ double const arc_radius = get_width();
if (tab.group && tab.group->is_active()) {
cairo_set_source_rgba (cr, tab.color.get_red_p (), tab.color.get_green_p (), tab.color.get_blue_p (), 1);
@@ -89,9 +89,9 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
}
cairo_move_to (cr, 0, tab.from + arc_radius);
- cairo_arc (cr, _width, tab.from + arc_radius, arc_radius, M_PI, 3 * M_PI / 2);
- cairo_line_to (cr, _width, tab.to);
- cairo_arc (cr, _width, tab.to - arc_radius, arc_radius, M_PI / 2, M_PI);
+ cairo_arc (cr, get_width(), tab.from + arc_radius, arc_radius, M_PI, 3 * M_PI / 2);
+ cairo_line_to (cr, get_width(), tab.to);
+ cairo_arc (cr, get_width(), tab.to - arc_radius, arc_radius, M_PI / 2, M_PI);
cairo_line_to (cr, 0, tab.from + arc_radius);
cairo_fill (cr);
@@ -102,7 +102,7 @@ EditorGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_move_to (cr, _width - ext.height / 2, tab.from + (f.second + tab.to - tab.from) / 2);
+ cairo_move_to (cr, get_width() - ext.height / 2, tab.from + (f.second + tab.to - tab.from) / 2);
cairo_save (cr);
cairo_rotate (cr, - M_PI / 2);
cairo_show_text (cr, f.first.c_str());
diff --git a/gtk2_ardour/editor_group_tabs.h b/gtk2_ardour/editor_group_tabs.h
index 6d2b541747..e2ed6055aa 100644
--- a/gtk2_ardour/editor_group_tabs.h
+++ b/gtk2_ardour/editor_group_tabs.h
@@ -33,7 +33,7 @@ private:
double primary_coordinate (double, double) const;
ARDOUR::RouteList routes_for_tab (Tab const *) const;
double extent () const {
- return _height;
+ return get_height();
}
void add_menu_items (Gtk::Menu *, ARDOUR::RouteGroup *);
PBD::PropertyList default_properties () const;
diff --git a/gtk2_ardour/editor_summary.cc b/gtk2_ardour/editor_summary.cc
index dfbeccabfc..a4a6a9d73e 100644
--- a/gtk2_ardour/editor_summary.cc
+++ b/gtk2_ardour/editor_summary.cc
@@ -122,7 +122,7 @@ EditorSummary::on_expose_event (GdkEventExpose* event)
double const p = (_editor->playhead_cursor->current_frame - _start) * _x_scale;
cairo_move_to (cr, p, 0);
- cairo_line_to (cr, p, _height);
+ cairo_line_to (cr, p, get_height());
cairo_stroke (cr);
_last_playhead = p;
@@ -140,7 +140,7 @@ EditorSummary::render (cairo_t* cr)
/* background */
cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0, 0, _width, _height);
+ cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
if (_session == 0) {
@@ -165,12 +165,12 @@ EditorSummary::render (cairo_t* cr)
if (N == 0) {
_track_height = 16;
} else {
- _track_height = (double) _height / N;
+ _track_height = (double) get_height() / N;
}
/* calculate x scale */
if (_end != _start) {
- _x_scale = static_cast<double> (_width) / (_end - _start);
+ _x_scale = static_cast<double> (get_width()) / (_end - _start);
} else {
_x_scale = 1;
}
@@ -187,7 +187,7 @@ EditorSummary::render (cairo_t* cr)
cairo_set_source_rgb (cr, 0.2, 0.2, 0.2);
cairo_set_line_width (cr, _track_height - 2);
cairo_move_to (cr, 0, y + _track_height / 2);
- cairo_line_to (cr, _width, y + _track_height / 2);
+ cairo_line_to (cr, get_width(), y + _track_height / 2);
cairo_stroke (cr);
StreamView* s = (*i)->view ();
@@ -212,12 +212,12 @@ EditorSummary::render (cairo_t* cr)
double const p = (_session->current_start_frame() - _start) * _x_scale;
cairo_move_to (cr, p, 0);
- cairo_line_to (cr, p, _height);
+ cairo_line_to (cr, p, get_height());
cairo_stroke (cr);
double const q = (_session->current_end_frame() - _start) * _x_scale;
cairo_move_to (cr, q, 0);
- cairo_line_to (cr, q, _height);
+ cairo_line_to (cr, q, get_height());
cairo_stroke (cr);
}
@@ -278,16 +278,16 @@ EditorSummary::centre_on_click (GdkEventButton* ev)
double ex = ev->x - w / 2;
if (ex < 0) {
ex = 0;
- } else if ((ex + w) > _width) {
- ex = _width - w;
+ } else if ((ex + w) > get_width()) {
+ ex = get_width() - w;
}
double const h = yr.second - yr.first;
double ey = ev->y - h / 2;
if (ey < 0) {
ey = 0;
- } else if ((ey + h) > _height) {
- ey = _height - h;
+ } else if ((ey + h) > get_height()) {
+ ey = get_height() - h;
}
set_editor (ex, ey);
diff --git a/gtk2_ardour/group_tabs.cc b/gtk2_ardour/group_tabs.cc
index 94caf59936..c1b6e5142d 100644
--- a/gtk2_ardour/group_tabs.cc
+++ b/gtk2_ardour/group_tabs.cc
@@ -244,7 +244,7 @@ GroupTabs::render (cairo_t* cr)
/* background */
cairo_set_source_rgb (cr, 0, 0, 0);
- cairo_rectangle (cr, 0, 0, _width, _height);
+ cairo_rectangle (cr, 0, 0, get_width(), get_height());
cairo_fill (cr);
/* tabs */
diff --git a/gtk2_ardour/led.cc b/gtk2_ardour/led.cc
index fe8cf419bb..474ffe508b 100644
--- a/gtk2_ardour/led.cc
+++ b/gtk2_ardour/led.cc
@@ -45,7 +45,7 @@ void
LED::render (cairo_t* cr)
{
if (!_fixed_diameter) {
- _diameter = std::min (_width, _height);
+ _diameter = std::min (get_width(), get_height());
}
//background
@@ -75,7 +75,7 @@ LED::render (cairo_t* cr)
cairo_fill(cr);
#endif
- cairo_translate(cr, _width/2, _height/2);
+ cairo_translate(cr, get_width()/2, get_height()/2);
//inset
cairo_pattern_t *pat = cairo_pattern_create_linear (0.0, 0.0, 0.0, _diameter);
diff --git a/gtk2_ardour/mixer_group_tabs.cc b/gtk2_ardour/mixer_group_tabs.cc
index fa01579f78..2d33b54af3 100644
--- a/gtk2_ardour/mixer_group_tabs.cc
+++ b/gtk2_ardour/mixer_group_tabs.cc
@@ -89,7 +89,7 @@ MixerGroupTabs::compute_tabs () const
void
MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
{
- double const arc_radius = _height;
+ double const arc_radius = get_height();
if (tab.group && tab.group->is_active()) {
cairo_set_source_rgba (cr, tab.color.get_red_p (), tab.color.get_green_p (), tab.color.get_blue_p (), 1);
@@ -97,10 +97,10 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
cairo_set_source_rgba (cr, 1, 1, 1, 0.2);
}
- cairo_arc (cr, tab.from + arc_radius, _height, arc_radius, M_PI, 3 * M_PI / 2);
+ cairo_arc (cr, tab.from + arc_radius, get_height(), arc_radius, M_PI, 3 * M_PI / 2);
cairo_line_to (cr, tab.to - arc_radius, 0);
- cairo_arc (cr, tab.to - arc_radius, _height, arc_radius, 3 * M_PI / 2, 2 * M_PI);
- cairo_line_to (cr, tab.from, _height);
+ cairo_arc (cr, tab.to - arc_radius, get_height(), arc_radius, 3 * M_PI / 2, 2 * M_PI);
+ cairo_line_to (cr, tab.from, get_height());
cairo_fill (cr);
if (tab.group) {
@@ -110,7 +110,7 @@ MixerGroupTabs::draw_tab (cairo_t* cr, Tab const & tab) const
cairo_text_extents (cr, tab.group->name().c_str(), &ext);
cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_move_to (cr, tab.from + (tab.to - tab.from - f.second) / 2, _height - ext.height / 2);
+ cairo_move_to (cr, tab.from + (tab.to - tab.from - f.second) / 2, get_height() - ext.height / 2);
cairo_save (cr);
cairo_show_text (cr, f.first.c_str());
cairo_restore (cr);
diff --git a/gtk2_ardour/mixer_group_tabs.h b/gtk2_ardour/mixer_group_tabs.h
index 8a2e06bc45..d8dd062280 100644
--- a/gtk2_ardour/mixer_group_tabs.h
+++ b/gtk2_ardour/mixer_group_tabs.h
@@ -32,7 +32,7 @@ private:
double primary_coordinate (double, double) const;
ARDOUR::RouteList routes_for_tab (Tab const *) const;
double extent () const {
- return _width;
+ return get_width();
}
PBD::PropertyList default_properties () const;
diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc
index cde7e97e51..3befc890ae 100644
--- a/gtk2_ardour/time_info_box.cc
+++ b/gtk2_ardour/time_info_box.cc
@@ -143,6 +143,14 @@ TimeInfoBox::TimeInfoBox ()
Editor::instance().get_selection().RegionsChanged.connect (sigc::mem_fun (*this, &TimeInfoBox::selection_changed));
Editor::instance().MouseModeChanged.connect (editor_connections, invalidator(*this), ui_bind (&TimeInfoBox::track_mouse_mode, this), gui_context());
+
+ Gdk::Color bg;
+
+ bg.set_red (lrint (0.149 * 65535));
+ bg.set_green (lrint (0.149 * 65535));
+ bg.set_blue (lrint (0.149 * 65535));
+
+ CairoWidget::provide_background_for_cairo_widget (*this, bg);
}
TimeInfoBox::~TimeInfoBox ()