make autoscroll a bit easier to use, fix missing measure lines when moving the editor...
[ardour.git] / gtk2_ardour / visual_time_axis.cc
index f9408fae608d4201136e89cc80023af1e4878b04..e44ea4011e2d3fdcac138371f03e7198dd999cb0 100644 (file)
 #include "i18n.h"
 
 using namespace ARDOUR;
+using namespace PBD;
 using namespace sigc;
 using namespace Gtk;
-
-//XXX should really have a common home...
-static const gchar* small_x_xpm[] = {
-       "11 11 2 1",
-       "       c None",
-       ".      c #000000",
-       "           ",
-       "           ",
-       "  .     .  ",
-       "   .   .   ",
-       "    . .    ",
-       "     .     ",
-       "    . .    ",
-       "   .   .   ",
-       "  .     .  ",
-       "           ",
-       "           "};
-
        
 /**
  * Abstract Constructor for base visual time axis classes
@@ -102,8 +85,7 @@ VisualTimeAxis::VisualTimeAxis(const string & name, PublicEditor& ed, ARDOUR::Se
        size_button.set_name("TrackSizeButton") ;
        visual_button.set_name("TrackVisualButton") ;
        hide_button.set_name("TrackRemoveButton") ;
-       Glib::RefPtr<Gdk::Pixbuf> small_x_pixbuf = Gdk::Pixbuf::create_from_xpm_data(small_x_xpm);
-       hide_button.add(*(Gtk::manage(new Gtk::Image(small_x_pixbuf)))) ;
+       hide_button.add(*(Gtk::manage(new Gtk::Image(get_xpm("small_x.xpm")))));
        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)) ;
@@ -273,7 +255,7 @@ VisualTimeAxis::set_time_axis_color(Gdk::Color c)
 }
 
 void
-VisualTimeAxis::set_selected_regionviews (AudioRegionSelection& regions)
+VisualTimeAxis::set_selected_regionviews (RegionSelection& regions)
 {
        // Not handled by purely visual TimeAxis
 }
@@ -293,23 +275,17 @@ VisualTimeAxis::remove_this_time_axis(void* src)
 
        std::string prompt  = string_compose (_("Do you really want to remove track \"%1\" ?\n(cannot be undone)"), time_axis_name);
 
-       choices.push_back (_("Yes, remove it."));
        choices.push_back (_("No, do nothing."));
+       choices.push_back (_("Yes, remove it."));
 
        Gtkmm2ext::Choice prompter (prompt, choices);
 
-       prompter.chosen.connect(sigc::ptr_fun(Gtk::Main::quit));
-       prompter.show_all ();
-
-       Gtk::Main::run ();
-
-       if (prompter.get_choice() == 0)
-       {
+       if (prompter.run () == 1) {
                /*
-                  defer to idle loop, otherwise we'll delete this object
-                  while we're still inside this function ...
+                 defer to idle loop, otherwise we'll delete this object
+                 while we're still inside this function ...
                */
-         Glib::signal_idle().connect(bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src));
+               Glib::signal_idle().connect(bind(sigc::ptr_fun(&VisualTimeAxis::idle_remove_this_time_axis), this, src));
        }
 }
 
@@ -347,6 +323,8 @@ VisualTimeAxis::start_time_axis_rename()
        ArdourPrompter name_prompter;
 
        name_prompter.set_prompt (_("new name: ")) ;
+       name_prompter.add_button (_("Rename"), Gtk::RESPONSE_ACCEPT);
+       name_prompter.set_response_sensitive (Gtk::RESPONSE_ACCEPT, false);
        name_prompter.show_all() ;
 
        switch (name_prompter.run ()) {