amend 5d0303b - fix editor summary leak
[ardour.git] / gtk2_ardour / time_axis_view_item.cc
index 1e1e66889f9f33b63ecaede38d2fa7ed8ea07f91..74651f67f6d1eddd8ad74b4f3539e35d4bde44aa 100644 (file)
@@ -28,7 +28,7 @@
 #include "gtkmm2ext/utils.h"
 #include "gtkmm2ext/gui_thread.h"
 
-#include "canvas/group.h"
+#include "canvas/container.h"
 #include "canvas/rectangle.h"
 #include "canvas/debug.h"
 #include "canvas/text.h"
@@ -56,6 +56,7 @@ using namespace Editing;
 using namespace Glib;
 using namespace PBD;
 using namespace ARDOUR;
+using namespace ARDOUR_UI_UTILS;
 using namespace Gtkmm2ext;
 
 Pango::FontDescription TimeAxisViewItem::NAME_FONT;
@@ -119,7 +120,7 @@ TimeAxisViewItem::set_constant_heights ()
  * @param automation true if this is an automation region view
  */
 TimeAxisViewItem::TimeAxisViewItem(
-       const string & it_name, ArdourCanvas::Group& parent, TimeAxisView& tv, double spu, uint32_t base_color,
+       const string & it_name, ArdourCanvas::Item& parent, TimeAxisView& tv, double spu, uint32_t base_color,
        framepos_t start, framecnt_t duration, bool recording, bool automation, Visibility vis
        )
        : trackview (tv)
@@ -149,7 +150,7 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
 {
        /* share the other's parent, but still create a new group */
 
-       ArdourCanvas::Group* parent = other.group->parent();
+       ArdourCanvas::Item* parent = other.group->parent();
        
        _selected = other._selected;
        
@@ -158,11 +159,11 @@ TimeAxisViewItem::TimeAxisViewItem (const TimeAxisViewItem& other)
 }
 
 void
-TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_color, 
+TimeAxisViewItem::init (ArdourCanvas::Item* parent, double fpp, uint32_t base_color, 
                        framepos_t start, framepos_t duration, Visibility vis, 
                        bool wide, bool high)
 {
-       group = new ArdourCanvas::Group (parent);
+       group = new ArdourCanvas::Container (parent);
        CANVAS_DEBUG_NAME (group, string_compose ("TAVI group for %1", get_item_name()));
        group->Event.connect (sigc::mem_fun (*this, &TimeAxisViewItem::canvas_group_event));
 
@@ -200,7 +201,7 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_c
                                                                         trackview.current_height() - 1.0));
 
                CANVAS_DEBUG_NAME (frame, string_compose ("frame for %1", get_item_name()));
-               
+
                if (Config->get_show_name_highlight()) {
                        frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
                } else {
@@ -254,6 +255,7 @@ TimeAxisViewItem::init (ArdourCanvas::Group* parent, double fpp, uint32_t base_c
                        name_text->set_position (ArdourCanvas::Duple (NAME_X_OFFSET, NAME_Y_OFFSET));
                }
                name_text->set_font_description (NAME_FONT);
+               name_text->set_ignore_events (true);
        } else {
                name_text = 0;
        }
@@ -540,6 +542,21 @@ TimeAxisViewItem::set_selected(bool yn)
        if (_selected != yn) {
                Selectable::set_selected (yn);
                set_frame_color ();
+               set_name_text_color ();
+
+               if (frame) {
+                       if (!Config->get_show_name_highlight() && yn) {
+                               frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM|ArdourCanvas::Rectangle::TOP));
+                               frame->set_y1 (_height - 1.0);
+                       } else {
+                               if (Config->get_show_name_highlight()) {
+                                       frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
+                               } else {
+                                       frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM));
+                               }
+                               frame->set_y1 (_height);
+                       }
+               }
        }
 }
 
@@ -590,7 +607,18 @@ TimeAxisViewItem::set_height (double height)
        }
 
        if (frame) {
-               frame->set_y1 (height);
+               if (!Config->get_show_name_highlight() && _selected) {
+                       frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM|ArdourCanvas::Rectangle::TOP));
+                       frame->set_y1 (_height - 1.0);
+               } else {
+                       if (Config->get_show_name_highlight()) {
+                               frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT));
+                       } else {
+                               frame->set_outline_what (ArdourCanvas::Rectangle::What (ArdourCanvas::Rectangle::LEFT|ArdourCanvas::Rectangle::RIGHT|ArdourCanvas::Rectangle::BOTTOM));
+                       }
+                       frame->set_y1 (_height);
+               }
+
                if (frame_handle_start) {
                        frame_handle_start->set_y1 (height);
                        frame_handle_end->set_y1 (height);
@@ -646,7 +674,7 @@ TimeAxisViewItem::get_canvas_frame()
        return frame;
 }
 
-ArdourCanvas::Group*
+ArdourCanvas::Item*
 TimeAxisViewItem::get_canvas_group()
 {
        return group;
@@ -696,7 +724,7 @@ TimeAxisViewItem::set_name_text_color ()
                f = get_fill_color ();
        }
 
-       name_text->set_color (contrasting_text_color (f));
+       name_text->set_color (ArdourCanvas::contrasting_text_color (f));
 }
 
 uint32_t