add missing include
[ardour.git] / gtk2_ardour / time_axis_view.cc
index de8c17f4566898a0ca91eda9458efccc075b134e..bdddaa0c5ae5a2c5cec1bc4aaa1326ed259267e9 100644 (file)
@@ -58,7 +58,7 @@
 #include "tooltips.h"
 #include "ui_config.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace Gtk;
@@ -738,13 +738,22 @@ TimeAxisView::popup_display_menu (guint32 when)
        conditionally_add_to_selection ();
 
        build_display_menu ();
-       display_menu->popup (1, when);
+
+       if (!display_menu->items().empty()) {
+               display_menu->popup (1, when);
+       }
 }
 
 void
-TimeAxisView::show_selected ()
+TimeAxisView::set_selected (bool yn)
 {
-       if (selected()) {
+       if (yn == selected()) {
+               return;
+       }
+
+       Selectable::set_selected (yn);
+
+       if (_selected) {
                time_axis_frame.set_shadow_type (Gtk::SHADOW_IN);
                time_axis_frame.set_name ("MixerStripSelectedFrame");
                controls_ebox.set_name (controls_base_selected_name);
@@ -770,6 +779,7 @@ TimeAxisView::show_selected ()
        }
 
        time_axis_frame.show();
+
 }
 
 void
@@ -922,6 +932,8 @@ TimeAxisView::order_selection_trims (ArdourCanvas::Item *item, bool put_start_on
        }
 }
 
+// retuned rect is pushed back into the used_selection_rects list
+// in TimeAxisView::show_selection() which is the only caller.
 SelectionRect *
 TimeAxisView::get_selection_rect (uint32_t id)
 {
@@ -931,7 +943,9 @@ TimeAxisView::get_selection_rect (uint32_t id)
 
        for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i) {
                if ((*i)->id == id) {
-                       return (*i);
+                       SelectionRect* ret = (*i);
+                       used_selection_rects.erase (i);
+                       return ret;
                }
        }