summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Davis <paul@linuxaudiosystems.com>2010-06-02 15:54:51 +0000
committerPaul Davis <paul@linuxaudiosystems.com>2010-06-02 15:54:51 +0000
commitf9a47cff2b7f07b769fe674f395e413fc40501fe (patch)
tree303233544e36627ecf6dd3de7e5a53f6418e1416
parent519eaabe8b7995b986b05c050b814cd09cbd4859 (diff)
make marker labels and regionview name text (now drawn with pixbufs) be color-adjustable just like all other canvas items2.8.9
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7212 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour2_ui_default.conf1
-rw-r--r--gtk2_ardour/canvas_vars.h1
-rw-r--r--gtk2_ardour/marker.cc14
-rw-r--r--gtk2_ardour/marker.h2
-rw-r--r--gtk2_ardour/time_axis_view.cc2
-rw-r--r--gtk2_ardour/time_axis_view_item.cc18
-rw-r--r--gtk2_ardour/time_axis_view_item.h4
-rw-r--r--gtk2_ardour/utils.cc11
-rw-r--r--gtk2_ardour/utils.h1
9 files changed, 45 insertions, 9 deletions
diff --git a/gtk2_ardour/ardour2_ui_default.conf b/gtk2_ardour/ardour2_ui_default.conf
index 1cce3fb740..36a580cb66 100644
--- a/gtk2_ardour/ardour2_ui_default.conf
+++ b/gtk2_ardour/ardour2_ui_default.conf
@@ -75,6 +75,7 @@
<Option name="tempo bar" value="72727fff"/>
<Option name="TempoMarker" value="f2425bff"/>
<Option name="TimeAxisFrame" value="000000cb"/>
+ <Option name="time axis item name" value="000000ff"/>
<Option name="time-stretch-fill" value="e2b5b596"/>
<Option name="time-stretch-outline" value="63636396"/>
<Option name="TransportDragRect" value="969696c6"/>
diff --git a/gtk2_ardour/canvas_vars.h b/gtk2_ardour/canvas_vars.h
index b1ec2fc305..eb8a16b430 100644
--- a/gtk2_ardour/canvas_vars.h
+++ b/gtk2_ardour/canvas_vars.h
@@ -72,6 +72,7 @@ CANVAS_VARIABLE(canvasvar_Selection, "Selection")
CANVAS_VARIABLE(canvasvar_TempoBar, "tempo bar")
CANVAS_VARIABLE(canvasvar_TempoMarker, "TempoMarker")
CANVAS_VARIABLE(canvasvar_TimeAxisFrame, "TimeAxisFrame")
+CANVAS_VARIABLE(canvasvar_TimeAxisViewItemName, "time axis item name")
CANVAS_VARIABLE(canvasvar_TimeStretchFill, "time-stretch-fill")
CANVAS_VARIABLE(canvasvar_TimeStretchOutline, "time-stretch-outline")
CANVAS_VARIABLE(canvasvar_TransportDragRect, "TransportDragRect")
diff --git a/gtk2_ardour/marker.cc b/gtk2_ardour/marker.cc
index 22fc535722..ab895394ec 100644
--- a/gtk2_ardour/marker.cc
+++ b/gtk2_ardour/marker.cc
@@ -255,9 +255,10 @@ Marker::Marker (PublicEditor& ed, ArdourCanvas::Group& parent, guint32 rgba, con
name_pixbuf->property_x() = label_offset;
name_pixbuf->property_y() = (13 / 2) - (name_height / 2);
- set_name (annotation.c_str());
+ set_name (annotation);
editor.ZoomChanged.connect (mem_fun (*this, &Marker::reposition));
+ ColorsChanged.connect (mem_fun (*this, &Marker::color_handler));
mark->set_data ("marker", this);
@@ -343,11 +344,20 @@ Marker::the_item() const
}
void
+Marker::color_handler ()
+{
+ set_name (_annotation);
+}
+
+void
Marker::set_name (const string& new_name)
{
int name_width = pixel_width (new_name, *name_font) + 2;
- name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, name_font, name_width, name_height);
+ _annotation = new_name;
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, name_font,
+ ARDOUR_UI::config()->canvasvar_MarkerLabel.get(),
+ name_width, name_height);
if (_type == End || _type == LoopEnd || _type == PunchOut) {
name_pixbuf->property_x() = - (name_width);
diff --git a/gtk2_ardour/marker.h b/gtk2_ardour/marker.h
index 0f01f1d794..8d5674c7b0 100644
--- a/gtk2_ardour/marker.h
+++ b/gtk2_ardour/marker.h
@@ -96,8 +96,10 @@ class Marker : public PBD::Destructible
unsigned char shift; /* should be double, but its always small and integral */
Type _type;
int name_height;
+ std::string _annotation;
void reposition ();
+ void color_handler ();
};
class TempoMarker : public Marker
diff --git a/gtk2_ardour/time_axis_view.cc b/gtk2_ardour/time_axis_view.cc
index fcfc1d0772..0fed1ef843 100644
--- a/gtk2_ardour/time_axis_view.cc
+++ b/gtk2_ardour/time_axis_view.cc
@@ -164,8 +164,6 @@ TimeAxisView::TimeAxisView (ARDOUR::Session& sess, PublicEditor& ed, TimeAxisVie
controls_frame.set_name ("TimeAxisViewControlsBaseUnselected");
controls_vbox.set_name ("TimeAxisViewControlsBaseUnselected");
controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
-
- ColorsChanged.connect (mem_fun (*this, &TimeAxisView::color_handler));
}
TimeAxisView::~TimeAxisView()
diff --git a/gtk2_ardour/time_axis_view_item.cc b/gtk2_ardour/time_axis_view_item.cc
index ec0af7fb3b..d3f720c253 100644
--- a/gtk2_ardour/time_axis_view_item.cc
+++ b/gtk2_ardour/time_axis_view_item.cc
@@ -239,6 +239,8 @@ TimeAxisViewItem::init (const string& it_name, double spu, Gdk::Color& base_colo
set_duration (item_duration, this) ;
set_position (start, this) ;
+
+ ColorsChanged.connect (mem_fun (*this, &TimeAxisViewItem::color_handler));
}
/**
@@ -552,9 +554,19 @@ TimeAxisViewItem::set_name_text(const ustring& new_name)
return;
}
+ _name = new_name;
+
last_item_width = trackview.editor.frame_to_pixel(item_duration);
name_pixbuf_width = pixel_width (new_name, *NAME_FONT) + 2;
- name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, NAME_FONT, name_pixbuf_width, NAME_HEIGHT);
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(new_name, NAME_FONT,
+ ARDOUR_UI::config()->canvasvar_TimeAxisViewItemName.get(),
+ name_pixbuf_width, NAME_HEIGHT);
+}
+
+void
+TimeAxisViewItem::color_handler ()
+{
+ set_name_text (_name);
}
/**
@@ -919,7 +931,9 @@ TimeAxisViewItem::reset_name_width (double pix_width)
name_pixbuf->show();
}
- name_pixbuf->property_pixbuf() = pixbuf_from_ustring(item_name, NAME_FONT, pb_width, NAME_HEIGHT);
+ name_pixbuf->property_pixbuf() = pixbuf_from_ustring(item_name, NAME_FONT,
+ ARDOUR_UI::config()->canvasvar_TimeAxisViewItemName.get(),
+ pb_width, NAME_HEIGHT);
}
diff --git a/gtk2_ardour/time_axis_view_item.h b/gtk2_ardour/time_axis_view_item.h
index 9874be8cbb..167f1932c0 100644
--- a/gtk2_ardour/time_axis_view_item.h
+++ b/gtk2_ardour/time_axis_view_item.h
@@ -373,6 +373,8 @@ class TimeAxisViewItem : public Selectable
virtual void reset_width_dependent_items (double pixel_width);
void reset_name_width (double pixel_width);
+ void color_handler ();
+
/**
* Callback used to remove this item during the gtk idle loop
* This is used to avoid deleting the obejct while inside the remove_this_group
@@ -465,7 +467,7 @@ class TimeAxisViewItem : public Selectable
double _height;
Visibility visibility;
bool _recregion;
-
+ std::string _name;
}; /* class TimeAxisViewItem */
diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc
index ee84cfe1da..854b5f7862 100644
--- a/gtk2_ardour/utils.cc
+++ b/gtk2_ardour/utils.cc
@@ -887,14 +887,21 @@ convert_bgra_to_rgba (guint8 const* src,
}
Glib::RefPtr<Gdk::Pixbuf>
-pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, int clip_width, int clip_height)
+pixbuf_from_ustring(const ustring& name, Pango::FontDescription* font, uint32_t rgba, int clip_width, int clip_height)
{
Glib::RefPtr<Gdk::Pixbuf> buf = Gdk::Pixbuf::create(Gdk::COLORSPACE_RGB, true, 8, clip_width, clip_height);
cairo_surface_t* surface = cairo_image_surface_create(CAIRO_FORMAT_ARGB32, clip_width, clip_height);
cairo_t* cr = cairo_create (surface);
cairo_text_extents_t te;
- cairo_set_source_rgba (cr, 0.0, 0.0, 0.0, 1.0);
+ float fr, fg, fb, fa;
+
+ fr = ((rgba & 0xff000000) >> 24) / 255.0f;
+ fg = ((rgba & 0xff0000) >> 16) / 255.0f;
+ fb = ((rgba & 0xff00) >> 8) / 255.0f;
+ fa = (rgba & 0xff) / 255.0f;
+
+ cairo_set_source_rgba (cr, fr, fg, fb, fa);
cairo_select_font_face (cr, font->get_family().c_str(),
CAIRO_FONT_SLANT_NORMAL, CAIRO_FONT_WEIGHT_NORMAL);
cairo_set_font_size (cr, font->get_size() / Pango::SCALE);
diff --git a/gtk2_ardour/utils.h b/gtk2_ardour/utils.h
index faa2ac2b05..ac62f015ca 100644
--- a/gtk2_ardour/utils.h
+++ b/gtk2_ardour/utils.h
@@ -96,6 +96,7 @@ void convert_bgra_to_rgba (guint8 const* src,
int height);
Glib::RefPtr<Gdk::Pixbuf> pixbuf_from_ustring (const Glib::ustring& name,
Pango::FontDescription* font,
+ uint32_t rgba,
int clip_width,
int clip_height);