always compute range for a redirect automation line, even if it will not be drawn...
[ardour.git] / gtk2_ardour / visual_time_axis.cc
index 24cafdbe67a0985b74bc3e660ab6d53c7ed11361..468b9671866c38f5c2f1b4e118d947d4bf854e84 100644 (file)
@@ -15,7 +15,6 @@
     along with this program; if not, write to the Free Software
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 
-    $Id$
 */
 
 #include <cstdlib>
@@ -85,24 +84,28 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se
        size_button.set_name("TrackSizeButton") ;
        visual_button.set_name("TrackVisualButton") ;
        hide_button.set_name("TrackRemoveButton") ;
-       hide_button.add(*(Gtk::manage(new Gtk::Image(get_xpm("small_x.xpm")))));
+       hide_button.add (*(manage (new Image (::get_icon("hide")))));
+       hide_button.show_all ();
+
        size_button.signal_button_release_event().connect (mem_fun (*this, &VisualTimeAxis::size_click)) ;
        visual_button.signal_clicked().connect (mem_fun (*this, &VisualTimeAxis::visual_click)) ;
        hide_button.signal_clicked().connect (mem_fun (*this, &VisualTimeAxis::hide_click)) ;
        ARDOUR_UI::instance()->tooltips().set_tip(size_button,_("Display Height")) ;
        ARDOUR_UI::instance()->tooltips().set_tip(visual_button, _("Visual options")) ;
        ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("Hide this track")) ;
-               
+
+if (0) {               
+               /* old school - when we used to put an extra row of buttons in place */
        controls_table.attach (hide_button, 0, 1, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
        controls_table.attach (visual_button, 1, 2, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
        controls_table.attach (size_button, 2, 3, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
-
+}
        /* remove focus from the buttons */
        size_button.unset_flags(Gtk::CAN_FOCUS) ;
        hide_button.unset_flags(Gtk::CAN_FOCUS) ;
        visual_button.unset_flags(Gtk::CAN_FOCUS) ;
        
-       set_height(Normal) ;
+       set_height (hNormal) ;
 }
 
 /**
@@ -145,39 +148,31 @@ VisualTimeAxis::name() const
 /**
  * Sets the height of this TrackView to one of the defined TrackHeghts
  *
- * @param h the TrackHeight value to set
+ * @param h 
  */
 void
-VisualTimeAxis::set_height(TrackHeight h)
+VisualTimeAxis::set_height(uint32_t h)
 {
-       TimeAxisView::set_height(h) ;
+       TimeAxisView::set_height(h);
        
-       switch (height)
-       {
-               case Largest:
-               case Large:
-               case Larger:
-               case Normal:
-               {
-                       hide_name_label ();
-                       show_name_entry ();
-                       other_button_hbox.show_all() ;
-                       break;
-               }
-               case Smaller:
-               {
-                       hide_name_label ();
-                       show_name_entry ();
-                       other_button_hbox.hide_all() ;
-                       break;
-               }
-               case Small:
-               {
-                       hide_name_entry ();
-                       show_name_label ();
-                       other_button_hbox.hide_all() ;
-               }
-               break;
+       if (h >= hNormal) {
+               hide_name_label ();
+               show_name_entry ();
+               visual_button.show();
+               size_button.show();
+               hide_button.show();
+       } else if (h >= hSmaller) {
+               hide_name_label ();
+               show_name_entry ();
+               visual_button.hide ();
+               size_button.hide ();
+               hide_button.hide();
+       } else if (h >= hSmall) {
+               hide_name_entry ();
+               show_name_label ();
+               visual_button.hide ();
+               size_button.hide ();
+               hide_button.hide ();
        }
 }
 
@@ -375,17 +370,17 @@ VisualTimeAxis::name_entry_changed()
                return;
        }
 
+       strip_whitespace_edges(x);
+
        if (x.length() == 0) {
                name_entry.set_text (time_axis_name);
                return;
        }
 
-       strip_whitespace_edges(x);
-
        if (!editor.get_named_time_axis(x)) {
                set_time_axis_name(x, this);
        } else {
-               ARDOUR_UI::instance()->popup_error (_("a track already exists with that name"));
+               ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
                name_entry.set_text(time_axis_name);
        }
 }