Tweak spacing.
[ardour.git] / gtk2_ardour / route_time_axis.cc
index 37775adb394c1d073f9fede7ba3ae6366d90b61b..736476e49b1208288e73276e192907449c06a778 100644 (file)
@@ -110,6 +110,7 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, Canvas& c
        , TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas)
        , _view (0)
        , parent_canvas (canvas)
+       , no_redraw (false)
        , button_table (3, 3)
        , route_group_button (_("g"))
        , playlist_button (_("p"))
@@ -141,7 +142,11 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        }
 
        if (!_route->is_hidden()) {
-               set_gui_property ("visible", "yes");
+               if (gui_property ("visible").empty()) {
+                       set_gui_property ("visible", true);
+               }
+       } else {
+               set_gui_property ("visible", false);
        }
 
        mute_changed (0);
@@ -191,7 +196,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 
                rec_enable_button->set_sensitive (_session->writable());
        }
-
+       
        controls_hbox.pack_start(gm.get_level_meter(), false, false);
        _route->meter_change.connect (*this, invalidator (*this), bind (&RouteTimeAxisView::meter_changed, this), gui_context());
        _route->input()->changed.connect (*this, invalidator (*this), ui_bind (&RouteTimeAxisView::io_changed, this, _1, _2), gui_context());
@@ -254,6 +259,8 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        gm.get_gain_slider().signal_scroll_event().connect(sigc::mem_fun(*this, &RouteTimeAxisView::controls_ebox_scroll), false);
        gm.get_gain_slider().set_name ("TrackGainFader");
 
+       gm.get_level_meter().signal_scroll_event().connect (sigc::mem_fun (*this, &RouteTimeAxisView::controls_ebox_scroll), false);
+
        show_name_entry ();
        hide_name_label ();
 }
@@ -907,12 +914,10 @@ RouteTimeAxisView::set_height (uint32_t h)
 }
 
 void
-RouteTimeAxisView::set_color (Gdk::Color const & c)
+RouteTimeAxisView::route_color_changed ()
 {
-       RouteUI::set_color (c);
-
        if (_view) {
-               _view->apply_color (_color, StreamView::RegionColor);
+               _view->apply_color (color(), StreamView::RegionColor);
        }
 }
 
@@ -1295,30 +1300,27 @@ RouteTimeAxisView::playlist () const
 void
 RouteTimeAxisView::name_entry_changed ()
 {
-       string x;
-
-       x = name_entry.get_text ();
+       string x = name_entry.get_text ();
 
        if (x == _route->name()) {
                return;
        }
 
-       strip_whitespace_edges(x);
+       strip_whitespace_edges (x);
 
        if (x.length() == 0) {
                name_entry.set_text (_route->name());
                return;
        }
 
-       if (!_session->route_name_unique (x)) {
-               ARDOUR_UI::instance()->popup_error (_("A track already exists with that name"));
-               name_entry.set_text (_route->name());
-       } else if (_session->route_name_internal (x)) {
+       if (_session->route_name_internal (x)) {
                ARDOUR_UI::instance()->popup_error (string_compose (_("You cannot create a track with that name as it is reserved for %1"),
-                                                                    PROGRAM_NAME));
-               name_entry.set_text (_route->name());
-       } else {
+                                                                   PROGRAM_NAME));
+               name_entry.grab_focus ();
+       } else if (RouteUI::verify_new_route_name (x)) {
                _route->set_name (x);
+       } else {
+               name_entry.grab_focus ();
        }
 }
 
@@ -1466,18 +1468,10 @@ RouteTimeAxisView::build_playlist_menu ()
        playlist_action_menu->set_name ("ArdourContextMenu");
        playlist_items.clear();
 
-        vector<boost::shared_ptr<Playlist> > playlists, playlists_tr;
-       boost::shared_ptr<Track> tr = track();
        RadioMenuItem::Group playlist_group;
+       boost::shared_ptr<Track> tr = track ();
 
-       _session->playlists->get (playlists);
-
-        /* find the playlists for this diskstream */
-        for (vector<boost::shared_ptr<Playlist> >::iterator i = playlists.begin(); i != playlists.end(); ++i) {
-                if (((*i)->get_orig_diskstream_id() == tr->diskstream_id()) || (tr->playlist()->id() == (*i)->id())) {
-                        playlists_tr.push_back(*i);
-                }
-        }
+        vector<boost::shared_ptr<Playlist> > playlists_tr = _session->playlists->playlists_for_track (tr);
 
         /* sort the playlists */
         PlaylistSorter cmp;
@@ -1882,7 +1876,7 @@ RouteTimeAxisView::add_processor_automation_curve (boost::shared_ptr<Processor>
 }
 
 void
-RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::ProcessorAutomationNode* pan, boost::shared_ptr<Processor> i)
+RouteTimeAxisView::processor_automation_track_hidden (RouteTimeAxisView::ProcessorAutomationNode* pan, boost::shared_ptr<Processor>)
 {
        if (!_hidden) {
                pan->menu_item->set_active (false);
@@ -2288,7 +2282,7 @@ RouteTimeAxisView::set_underlay_state()
 }
 
 void
-RouteTimeAxisView::add_underlay (StreamView* v, bool update_xml)
+RouteTimeAxisView::add_underlay (StreamView* v, bool /*update_xml*/)
 {
        if (!v) {
                return;
@@ -2356,8 +2350,16 @@ RouteTimeAxisView::set_button_names ()
        rec_enable_button_label.set_text (_("r"));
 
         if (_route && _route->solo_safe()) {
-                solo_button_label.set_text (X_("!"));
+               solo_button->remove ();
+               if (solo_safe_image == 0) {
+                       solo_safe_image = new Gtk::Image (::get_icon("solo-safe-enabled"));
+                       solo_safe_image->show ();
+               }
+               solo_button->add (*solo_safe_image);
         } else {
+               solo_button->remove ();
+               solo_button->add (solo_button_label);
+               solo_button_label.show ();
                 if (Config->get_solo_control_is_listen_control()) {
                         switch (Config->get_listen_position()) {
                         case AfterFaderListen:
@@ -2488,3 +2490,4 @@ RouteTimeAxisView::state_id() const
 {
        return string_compose ("rtav %1", _route->id().to_s());
 }
+