Separate Ardour UI widgets into dedicated library
[ardour.git] / gtk2_ardour / time_axis_view.cc
index 6c9eb1d4eb598cffb65ffaf4ee7c2c763b26c9a4..403ab88eb67cfea559cc30b01594ed71ba54f12e 100644 (file)
@@ -39,6 +39,8 @@
 #include "canvas/utils.h"
 #include "canvas/colors.h"
 
+#include "widgets/tooltips.h"
+
 #include "ardour/profile.h"
 
 #include "ardour_dialog.h"
@@ -55,7 +57,6 @@
 #include "streamview.h"
 #include "editor_drag.h"
 #include "editor.h"
-#include "tooltips.h"
 #include "ui_config.h"
 
 #include "pbd/i18n.h"
@@ -64,10 +65,10 @@ using namespace std;
 using namespace Gtk;
 using namespace Gdk;
 using namespace ARDOUR;
-using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Editing;
 using namespace ArdourCanvas;
+using namespace ArdourWidgets;
 using Gtkmm2ext::Keyboard;
 
 #define TOP_LEVEL_WIDGET controls_ebox
@@ -590,9 +591,7 @@ TimeAxisView::set_height (uint32_t h, TrackHeightMode m)
        TOP_LEVEL_WIDGET.property_height_request () = h;
        height = h;
 
-       char buf[32];
-       snprintf (buf, sizeof (buf), "%u", height);
-       set_gui_property ("height", buf);
+       set_gui_property ("height", height);
 
        for (list<GhostRegion*>::iterator i = ghosts.begin(); i != ghosts.end(); ++i) {
                (*i)->set_height ();
@@ -631,12 +630,12 @@ TimeAxisView::begin_name_edit ()
         */
 
        int x, y;
-        int wx, wy;
+       int wx, wy;
 
-        name_label.translate_coordinates (*toplevel, 0, 0, x, y);
-        toplevel->get_window()->get_origin (wx, wy);
+       name_label.translate_coordinates (*toplevel, 0, 0, x, y);
+       toplevel->get_window()->get_origin (wx, wy);
 
-        fte->move (wx + x, wy + y);
+       fte->move (wx + x, wy + y);
        fte->present ();
 }
 
@@ -744,7 +743,7 @@ TimeAxisView::popup_display_menu (guint32 when)
        build_display_menu ();
 
        if (!display_menu->items().empty()) {
-               display_menu->popup (3, when);
+               display_menu->popup (1, when);
        }
 }
 
@@ -771,19 +770,9 @@ TimeAxisView::set_selected (bool yn)
                time_axis_vbox.set_name (controls_base_unselected_name);
 
                hide_selection ();
-
-               /* children will be set for the yn=true case. but when deselecting
-                  the editor only has a list of top-level trackviews, so we
-                  have to do this here.
-               */
-
-               for (Children::iterator i = children.begin(); i != children.end(); ++i) {
-                       (*i)->set_selected (false);
-               }
        }
 
        time_axis_frame.show();
-
 }
 
 void
@@ -1029,15 +1018,31 @@ TimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> child)
  *  @param result Filled in with selectable things.
  */
 void
-TimeAxisView::get_selectables (framepos_t /*start*/, framepos_t /*end*/, double /*top*/, double /*bot*/, list<Selectable*>& /*result*/, bool /*within*/)
+TimeAxisView::get_selectables (framepos_t start, framepos_t end, double top, double bot, list<Selectable*>& results, bool within)
 {
-       return;
+       for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               if (!(*i)->hidden()) {
+                       (*i)->get_selectables (start, end, top, bot, results, within);
+               }
+       }
 }
 
 void
-TimeAxisView::get_inverted_selectables (Selection& /*sel*/, list<Selectable*>& /*result*/)
+TimeAxisView::set_selected_points (PointSelection& points)
 {
-       return;
+       for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               (*i)->set_selected_points (points);
+       }
+}
+
+void
+TimeAxisView::get_inverted_selectables (Selection& sel, list<Selectable*>& results)
+{
+       for (Children::iterator i = children.begin(); i != children.end(); ++i) {
+               if (!(*i)->hidden()) {
+                       (*i)->get_inverted_selectables (sel, results);
+               }
+       }
 }
 
 void
@@ -1307,10 +1312,9 @@ TimeAxisView::reset_visual_state ()
 {
        /* this method is not required to trigger a global redraw */
 
-       string str = gui_property ("height");
-
-       if (!str.empty()) {
-               set_height (atoi (str));
+       uint32_t height;
+       if (get_gui_property ("height", height)) {
+               set_height (height);
        } else {
                set_height (preset_height (HeightNormal));
        }