summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gtk2_ardour/automation_time_axis.cc28
-rw-r--r--gtk2_ardour/processor_box.cc10
-rw-r--r--libs/gtkmm2ext/gtkmm2ext/pixfader.h10
-rw-r--r--libs/gtkmm2ext/pixfader.cc72
4 files changed, 81 insertions, 39 deletions
diff --git a/gtk2_ardour/automation_time_axis.cc b/gtk2_ardour/automation_time_axis.cc
index 262f495f84..498832da02 100644
--- a/gtk2_ardour/automation_time_axis.cc
+++ b/gtk2_ardour/automation_time_axis.cc
@@ -153,16 +153,9 @@ AutomationTimeAxisView::AutomationTimeAxisView (
set_height (preset_height (HeightNormal));
}
- /* rearrange the name display */
-
- controls_table.remove (name_hbox);
- controls_table.attach (name_hbox, 1, 6, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND, 3, 0);
-
- /* we never show these for automation tracks, so make
- life easier and remove them.
- */
-
- hide_name_entry();
+ /* for automation tracks, the label does not swap with an entry box. remove all that stuff */
+ if ( name_label.get_parent() )
+ name_hbox.remove(name_label);
name_label.set_text (_name);
name_label.set_alignment (Gtk::ALIGN_CENTER, Gtk::ALIGN_CENTER);
@@ -178,12 +171,13 @@ AutomationTimeAxisView::AutomationTimeAxisView (
/* add the buttons */
controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
- controls_table.attach (auto_button, 6, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+ controls_table.attach (name_label, 0, 6, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+ controls_table.attach (auto_button, 6, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
if (_controller) {
_controller.get()->set_size_request(-1, 24);
/* add bar controller */
- controls_table.attach (*_controller.get(), 0, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+ controls_table.attach (*_controller.get(), 1, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
/* note that this handler connects *before* the default handler */
_controller->event_widget().signal_scroll_event().connect (mem_fun (*this, &AutomationTimeAxisView::controls_ebox_scroll), false);
}
@@ -427,21 +421,15 @@ AutomationTimeAxisView::set_height (uint32_t h)
first_call_to_set_height = false;
if (h >= preset_height (HeightNormal)) {
- hide_name_entry ();
- show_name_label ();
- name_hbox.show_all ();
-
+ name_label.show();
auto_button.show();
hide_button.show_all();
} else if (h >= preset_height (HeightSmall)) {
controls_table.hide_all ();
hide_name_entry ();
- show_name_label ();
- name_hbox.show_all ();
-
+ name_label.hide();
auto_button.hide();
- hide_button.hide();
}
}
diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc
index 70e479363e..3a7f000668 100644
--- a/gtk2_ardour/processor_box.cc
+++ b/gtk2_ardour/processor_box.cc
@@ -432,9 +432,13 @@ ProcessorEntry::Control::Control (Glib::RefPtr<Gdk::Pixbuf> s, Glib::RefPtr<Gdk:
} else {
- box.pack_start (_label);
- _label.show ();
- _label.set_text (_name);
+ _slider.set_name ("PluginSlider");
+ _slider.set_size_request (-1, 20);
+ _slider.set_text (_name);
+
+// box.pack_start (_label);
+// _label.show ();
+// _label.set_text (_name);
box.pack_start (_slider);
_slider.show ();
diff --git a/libs/gtkmm2ext/gtkmm2ext/pixfader.h b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
index 068d740272..8ef740b8e7 100644
--- a/libs/gtkmm2ext/gtkmm2ext/pixfader.h
+++ b/libs/gtkmm2ext/gtkmm2ext/pixfader.h
@@ -40,7 +40,17 @@ class PixFader : public Gtk::DrawingArea
void set_default_value (float);
+ void set_text (const std::string&);
+
protected:
+ Glib::RefPtr<Pango::Layout> _layout;
+ std::string _text;
+ int _text_width;
+ int _text_height;
+ double text_r;
+ double text_g;
+ double text_b;
+
Gtk::Adjustment& adjustment;
void on_size_request (GtkRequisition*);
diff --git a/libs/gtkmm2ext/pixfader.cc b/libs/gtkmm2ext/pixfader.cc
index 11420159c4..931c5ebe45 100644
--- a/libs/gtkmm2ext/pixfader.cc
+++ b/libs/gtkmm2ext/pixfader.cc
@@ -143,7 +143,17 @@ PixFader::create_patterns ()
cairo_pattern_add_color_stop_rgba (shine_pattern, 0.5, 1,1,1,0.0);
cairo_pattern_add_color_stop_rgba (shine_pattern, 1, 1,1,1,0.0);
}
-
+
+ if ( !_text.empty()) {
+ _layout->get_pixel_size (_text_width, _text_height);
+ } else {
+ _text_width = 0;
+ _text_height = 0;
+ }
+ c = get_style()->get_text (get_state());
+ text_r = c.get_red_p ();
+ text_g = c.get_green_p ();
+ text_b = c.get_blue_p ();
}
bool
@@ -196,22 +206,34 @@ PixFader::on_expose_event (GdkEventExpose* ev)
// cairo_fill (cr);
}
- /* always draw the unity-position line */
-
- if (_orien == VERT) {
- context->set_line_width (1);
- context->set_source_rgb (0.0, 1.0, 0.0);
- context->move_to (1, unity_loc);
- context->line_to (girth, unity_loc);
- context->stroke ();
- } else {
- context->set_line_width (1);
- context->set_source_rgb (0.0, 1.0, 0.0);
- context->move_to (unity_loc, 1);
- context->line_to (unity_loc, girth);
- context->stroke ();
+ /* draw the unity-position line if it's not at either end*/
+ if (unity_loc > 0) {
+ if ( _orien == VERT && unity_loc < h ) {
+ context->set_line_width (1);
+ context->set_source_rgb (0.0, 1.0, 0.0);
+ context->move_to (1, unity_loc);
+ context->line_to (girth, unity_loc);
+ context->stroke ();
+ } else if ( unity_loc < w ){
+ context->set_line_width (1);
+ context->set_source_rgb (0.0, 1.0, 0.0);
+ context->move_to (unity_loc, 1);
+ context->line_to (unity_loc, girth);
+ context->stroke ();
+ }
}
+
+ if ( !_text.empty() ) {
+ cairo_new_path (cr);
+
+ /* center text */
+ cairo_move_to (cr, (get_width() - _text_width)/2.0, get_height()/2.0 - _text_height/2.0);
+
+ cairo_set_source_rgba (cr, text_r, text_g, text_b, 0.9);
+ pango_cairo_show_layout (cr, _layout->gobj());
+ }
+
// if (Config->get_widget_prelight()) { //pixfader does not have access to config
if (_hovering) {
Gtkmm2ext::rounded_rectangle (cr, 0, 0, get_width(), get_height(), 3);
@@ -243,7 +265,8 @@ PixFader::on_size_allocate (Gtk::Allocation& alloc)
}
update_unity_position ();
-
+ create_patterns();
+
queue_draw ();
}
@@ -499,3 +522,20 @@ PixFader::set_default_value (float d)
default_value = d;
update_unity_position ();
}
+
+void
+PixFader::set_text (const std::string& str)
+{
+ _text = str;
+
+ if (!_layout && !_text.empty()) {
+ _layout = Pango::Layout::create (get_pango_context());
+ }
+
+ if (_layout) {
+ _layout->set_text (str);
+ }
+
+ queue_resize ();
+}
+