menu item says Fader and Pan, so the automation track should say the same for consistency
[ardour.git] / gtk2_ardour / marker_time_axis.cc
index 767bb458f3e7742e155b77e26977780b1f7807a0..f5c80be288c3c729dd34fe6fed291d28b73f18a7 100644 (file)
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #include <string>
 
 #include <pbd/error.h>
 
+#include <gtkmm/menu.h>
+
 #include <gtkmm2ext/utils.h>
 
 #include <ardour/session.h>
@@ -40,6 +41,7 @@
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 using namespace sigc;
 using namespace Gtk;
 
@@ -55,7 +57,7 @@ using namespace Gtk;
  * @param name the name/id of this time axis
  * @param tav the associated track view that this MarkerTimeAxis is marking up
  */
-MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas, std::string name, TimeAxisView* tav)
+MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas& canvas, const string & name, TimeAxisView* tav)
        : AxisView(sess),
          VisualTimeAxis(name, ed, sess, canvas)
 {
@@ -69,7 +71,6 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas&
        selection_group->hide();
 
        // intialize our data items
-       name_prompter = 0 ;
        marker_menu = 0 ;
 
        y_position = -1 ;
@@ -81,7 +82,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas&
        label_view() ;
                
        // set the initial height of this time axis
-       set_height(Small) ;
+       set_height(hSmall) ;
 }
 
 /**
@@ -90,27 +91,7 @@ MarkerTimeAxis::MarkerTimeAxis (PublicEditor& ed, ARDOUR::Session& sess, Canvas&
  */
 MarkerTimeAxis::~MarkerTimeAxis()
 {
-        GoingAway() ; /* EMIT_SIGNAL */
-
-       for (list<SelectionRect*>::iterator i = free_selection_rects.begin(); i != free_selection_rects.end(); ++i)
-       {
-               delete (*i)->rect;
-               delete (*i)->start_trim;
-               delete (*i)->end_trim;
-       }
-
-       for (list<SelectionRect*>::iterator i = used_selection_rects.begin(); i != used_selection_rects.end(); ++i)
-       {
-               delete (*i)->rect;
-               delete (*i)->start_trim;
-               delete (*i)->end_trim;
-       }
-       
-       if(selection_group)
-       {
-               delete selection_group;
-               selection_group = 0 ;
-       }
+       GoingAway() ; /* EMIT_SIGNAL */
 
        // destroy the view helper
        // this handles removing and destroying individual marker items
@@ -125,14 +106,10 @@ MarkerTimeAxis::~MarkerTimeAxis()
 //---------------------------------------------------------------------------------------//
 // ui methods & data
        
-/**
- * Sets the height of this TrackView to one of the defined TrackHeights
- *
- * @param h the TrackHeight value to set
- */    
 void
-MarkerTimeAxis::set_height (TrackHeight h)
+MarkerTimeAxis::set_height (uint32_t h)
 {
+       bool changed = (height == 0) || (h != height);
        VisualTimeAxis::set_height(h) ;
        
        // tell out view helper of the change too
@@ -141,8 +118,10 @@ MarkerTimeAxis::set_height (TrackHeight h)
                view->set_height((double) height) ;
        }
        
+       if (changed) {
        // tell those interested that we have had our height changed
         gui_changed("track_height",(void*)0) ; /* EMIT_SIGNAL */
+       }
 }
 
 /**
@@ -240,6 +219,7 @@ void
 MarkerTimeAxis::build_marker_menu()
 {
        using namespace Menu_Helpers;
+       using Gtk::Menu;
 
        marker_menu = manage(new Menu) ;
        marker_menu->set_name ("ArdourContextMenu");