reinstate context menu on stereo panner
[ardour.git] / gtk2_ardour / time_axis_view_item.cc
index fc0b4b24a1c406a7eb18788b516d89d705f565e1..495efd578cbbf493e2f1591cc7e7feb4b60bfd3c 100644 (file)
@@ -156,6 +156,7 @@ TimeAxisViewItem::init (
        last_item_width = 0;
        wide_enough_for_name = wide;
        high_enough_for_name = high;
+        rect_visible = true;
 
        if (duration == 0) {
                warning << "Time Axis Item Duration == 0" << endl;
@@ -234,6 +235,30 @@ TimeAxisViewItem::~TimeAxisViewItem()
        delete group;
 }
 
+void
+TimeAxisViewItem::hide_rect ()
+{
+        rect_visible = false;
+        set_frame_color ();
+
+        if (name_highlight) {
+                name_highlight->property_outline_what() = 0x0;
+                name_highlight->property_fill_color_rgba() = UINT_RGBA_CHANGE_A(fill_color,64);
+        }
+}
+
+void
+TimeAxisViewItem::show_rect ()
+{
+        rect_visible = true;
+        set_frame_color ();
+
+        if (name_highlight) {
+                name_highlight->property_outline_what() = 0x4;
+                name_highlight->property_fill_color_rgba() = fill_color;
+        }
+}
+
 
 /**
  * Set the position of this item on the timeline.
@@ -682,21 +707,30 @@ TimeAxisViewItem::set_colors()
 void
 TimeAxisViewItem::set_frame_color()
 {
+        uint32_t f = 0;
+
        if (!frame) {
                return;
        }
        
        if (_selected) {
+
+                f = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
+
                if (fill_opacity) {
-                       frame->property_fill_color_rgba() = UINT_RGBA_CHANGE_A (ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get(), fill_opacity);
-               } else {
-                       frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_SelectedFrameBase.get();
-               }
+                        f = UINT_RGBA_CHANGE_A (f, fill_opacity);
+               } 
+
+                if (!rect_visible) {
+                        f = UINT_RGBA_CHANGE_A (f, 0);
+                }
+
        } else {
+
                if (_recregion) {
-                       frame->property_fill_color_rgba() = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
+                       f = ARDOUR_UI::config()->canvasvar_RecordingRect.get();
                } else {
-                       uint32_t f = 0;
+                        
                        if (high_enough_for_name && !Config->get_color_regions_using_track_color()) {
                                f = ARDOUR_UI::config()->canvasvar_FrameBase.get();
                        } else {
@@ -707,9 +741,23 @@ TimeAxisViewItem::set_frame_color()
                                f = UINT_RGBA_CHANGE_A (f, fill_opacity);
                        }
 
-                       frame->property_fill_color_rgba() = f;
-               }
+                        if (!rect_visible) {
+                                f = UINT_RGBA_CHANGE_A (f, 0);
+                        }
+                }
        }
+
+        frame->property_fill_color_rgba() = f;
+
+        if (!_recregion) {
+                f = ARDOUR_UI::config()->canvasvar_TimeAxisFrame.get();
+                
+                if (!rect_visible) {
+                        f = UINT_RGBA_CHANGE_A (f, 64);
+                }
+                
+                frame->property_outline_color_rgba() = f;
+        }
 }
 
 /**