make marker labels and regionview name text (now drawn with pixbufs) be color-adjusta... 2.8.9
authorPaul Davis <paul@linuxaudiosystems.com>
Wed, 2 Jun 2010 15:54:51 +0000 (15:54 +0000)
committerPaul Davis <paul@linuxaudiosystems.com>
Wed, 2 Jun 2010 15:54:51 +0000 (15:54 +0000)
git-svn-id: svn://localhost/ardour2/branches/2.0-ongoing@7212 d708f5d6-7413-0410-9779-e7cbd77b26cf

gtk2_ardour/ardour2_ui_default.conf
gtk2_ardour/canvas_vars.h
gtk2_ardour/marker.cc
gtk2_ardour/marker.h
gtk2_ardour/time_axis_view.cc
gtk2_ardour/time_axis_view_item.cc
gtk2_ardour/time_axis_view_item.h
gtk2_ardour/utils.cc
gtk2_ardour/utils.h

index 1cce3fb740abc0007330fba968aa460b30d44012..36a580cb66717966ddea52a2706453b500fccab9 100644 (file)
@@ -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"/>
index b1ec2fc305113cfe9e7b9fc9fe8b9f6fe60a0321..eb8a16b43006f18492c922cfe5116696f568e94d 100644 (file)
@@ -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")
index 22fc535722d51a17282927729bf2f91077201591..ab895394ec8ce8765b53e5b68097bc0a1b8b75e9 100644 (file)
@@ -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);
 
@@ -342,12 +343,21 @@ Marker::the_item() const
        return *mark;
 }
 
+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);
index 0f01f1d7944ad8caa47e0c4d6818e5775fe00cbd..8d5674c7b0e802eda38d1389e5d2c88247f42500 100644 (file)
@@ -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
index fcfc1d07722aff76518a4da47017a72738103cb3..0fed1ef8432aa6ad0d99c6c2f66f269b620b78c5 100644 (file)
@@ -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()
index ec0af7fb3b27f8a4f1fad3581e16b5dd90bb296e..d3f720c2537ddf693429443fb0ccc47920b3d5b6 100644 (file)
@@ -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);
 }
 
 
index 9874be8cbbd1a66b93472b3bdf17c33a8b685d8d..167f1932c06a31a8886728790b534412edcd5b97 100644 (file)
@@ -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 */
 
index ee84cfe1da9393eebe04aaea795eae0656d7266b..854b5f7862675e4a440e7db51ef5f2322d1b2818 100644 (file)
@@ -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);
index faa2ac2b0579a240344b0a96e114cd7aef9f5ca5..ac62f015ca648714305d3b052c6ae83324e40465 100644 (file)
@@ -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);