clean up a-pong
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 1de3c641ddd87603c2ebae09b58ab1996587089a..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;
@@ -88,8 +88,7 @@ TimeAxisView::setup_sizes()
 }
 
 TimeAxisView::TimeAxisView (ARDOUR::Session* sess, PublicEditor& ed, TimeAxisView* rent, Canvas& /*canvas*/)
-       : AxisView (sess)
-       , controls_table (5, 4)
+       : controls_table (5, 4)
        , controls_button_size_group (Gtk::SizeGroup::create (Gtk::SIZE_GROUP_BOTH))
        , _name_editing (false)
        , height (0)
@@ -294,6 +293,7 @@ TimeAxisView::hide ()
 * @param y y position.
 * @param nth index for this TimeAxisView, increased if this view has children.
 * @param parent parent component.
+*
 * @return height of this TimeAxisView.
 */
 guint32
@@ -738,20 +738,16 @@ 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::set_selected (bool yn)
 {
-#if 0
-       /* end any name edit in progress */
-       if (can_edit_name()) {
-               end_name_edit (string(), 0);
-       }
-#endif
-
-       if (yn == _selected) {
+       if (yn == selected()) {
                return;
        }
 
@@ -936,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)
 {
@@ -945,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;
                }
        }