fixes for 98% of all the warnings/errors reported by OS X gcc on tiger
[ardour.git] / gtk2_ardour / route_time_axis.cc
index 1869e9542fdb94f1ca352d639934b0f8ff69758e..17c0874641731dc211770d2e5d216c08186f7a86 100644 (file)
@@ -141,7 +141,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 +195,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 +258,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 +913,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 +1299,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 +1467,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;
@@ -1533,51 +1526,48 @@ RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr<Playlist>
                return;
        }
 
-       boost::shared_ptr<AudioPlaylist> apl = boost::dynamic_pointer_cast<AudioPlaylist> (pl);
+       if (track()->playlist() == pl) {
+               // exit when use_playlist is called by the creation of the playlist menu
+               // or the playlist choice is unchanged
+               return;
+       }
 
-       if (apl) {
-               if (track()->playlist() == apl) {
-                        // exit when use_playlist is called by the creation of the playlist menu
-                        // or the playlist choice is unchanged
+       track()->use_playlist (pl);
+       
+       RouteGroup* rg = route_group();
+       
+       if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::edit.property_id)) {
+               std::string group_string = "." + rg->name() + ".";
+               
+               std::string take_name = pl->name();
+               std::string::size_type idx = take_name.find(group_string);
+               
+               if (idx == std::string::npos)
                        return;
-               }
-               track()->use_playlist (apl);
-
-               RouteGroup* rg = route_group();
-
-               if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::edit.property_id)) {
-                       std::string group_string = "." + rg->name() + ".";
-
-                       std::string take_name = apl->name();
-                       std::string::size_type idx = take_name.find(group_string);
-
-                       if (idx == std::string::npos)
-                               return;
-
-                       take_name = take_name.substr(idx + group_string.length()); // find the bit containing the take number / name
-
-                       boost::shared_ptr<RouteList> rl (rg->route_list());
-
-                       for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
-                               if ( (*i) == this->route()) {
-                                       continue;
-                               }
-
-                               std::string playlist_name = (*i)->name()+group_string+take_name;
-
-                               boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track>(*i);
-                               if (!track) {
-                                       continue;
-                               }
-
-                               boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
-                               if (!ipl) {
-                                       // No playlist for this track for this take yet, make it
-                                       track->use_new_playlist();
-                                       track->playlist()->set_name(playlist_name);
-                               } else {
-                                       track->use_playlist(ipl);
-                               }
+               
+               take_name = take_name.substr(idx + group_string.length()); // find the bit containing the take number / name
+               
+               boost::shared_ptr<RouteList> rl (rg->route_list());
+               
+               for (RouteList::const_iterator i = rl->begin(); i != rl->end(); ++i) {
+                       if ( (*i) == this->route()) {
+                               continue;
+                       }
+                       
+                       std::string playlist_name = (*i)->name()+group_string+take_name;
+                       
+                       boost::shared_ptr<Track> track = boost::dynamic_pointer_cast<Track>(*i);
+                       if (!track) {
+                               continue;
+                       }
+                       
+                       boost::shared_ptr<Playlist> ipl = session()->playlists->by_name(playlist_name);
+                       if (!ipl) {
+                               // No playlist for this track for this take yet, make it
+                               track->use_new_playlist();
+                               track->playlist()->set_name(playlist_name);
+                       } else {
+                               track->use_playlist(ipl);
                        }
                }
        }
@@ -1885,7 +1875,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);
@@ -2291,7 +2281,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;
@@ -2491,3 +2481,4 @@ RouteTimeAxisView::state_id() const
 {
        return string_compose ("rtav %1", _route->id().to_s());
 }
+