add new clear-gray color theme
[ardour.git] / gtk2_ardour / route_time_axis.cc
index f291af5dc58f286e3c95c0ce781c427f57b92ff3..9bf84f8b13e0ce4ce80e05146bbbe54a20821cf9 100644 (file)
@@ -83,7 +83,7 @@
 
 #include "ardour/track.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace ARDOUR;
 using namespace ARDOUR_UI_UTILS;
@@ -95,8 +95,7 @@ using namespace std;
 using std::list;
 
 RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
-       : AxisView(sess)
-       , RouteUI(sess)
+       : RouteUI(sess)
        , TimeAxisView(sess,ed,(TimeAxisView*) 0, canvas)
        , _view (0)
        , parent_canvas (canvas)
@@ -129,6 +128,14 @@ RouteTimeAxisView::RouteTimeAxisView (PublicEditor& ed, Session* sess, ArdourCan
        parameter_changed ("editor-stereo-only-meters");
 }
 
+void
+RouteTimeAxisView::route_property_changed (const PBD::PropertyChange& what_changed)
+{
+       if (what_changed.contains (ARDOUR::Properties::name)) {
+               label_view ();
+       }
+}
+
 void
 RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 {
@@ -171,7 +178,7 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        playlist_button.set_name ("route button");
        automation_button.set_name ("route button");
 
-       route_group_button.signal_button_release_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false);
+       route_group_button.signal_button_release_event().connect (sigc::mem_fun(*this, &RouteTimeAxisView::route_group_click), false);
        playlist_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::playlist_click));
        automation_button.signal_clicked.connect (sigc::mem_fun(*this, &RouteTimeAxisView::automation_click));
 
@@ -292,7 +299,6 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
        _y_position = -1;
 
        _route->processors_changed.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::processors_changed, this, _1), gui_context());
-       _route->PropertyChanged.connect (*this, invalidator (*this), boost::bind (&RouteTimeAxisView::route_property_changed, this, _1), gui_context());
 
        if (is_track()) {
 
@@ -314,8 +320,8 @@ RouteTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 
        PropertyList* plist = new PropertyList();
 
-       plist->add (ARDOUR::Properties::mute, true);
-       plist->add (ARDOUR::Properties::solo, true);
+       plist->add (ARDOUR::Properties::group_mute, true);
+       plist->add (ARDOUR::Properties::group_solo, true);
 
        route_group_menu = new RouteGroupMenu (_session, plist);
 
@@ -342,6 +348,15 @@ RouteTimeAxisView::~RouteTimeAxisView ()
        CatchDeletion (this);
 }
 
+string
+RouteTimeAxisView::name() const
+{
+       if (_route) {
+               return _route->name();
+       }
+       return string();
+}
+
 void
 RouteTimeAxisView::post_construct ()
 {
@@ -430,10 +445,8 @@ RouteTimeAxisView::update_track_number_visibility ()
                if (tnw & 1) --tnw;
                number_label.set_size_request(tnw, -1);
                number_label.show ();
-               name_hbox.set_size_request(TimeAxisView::name_width_px - 2 - tnw, -1); // -2 = cellspacing
        } else {
                number_label.hide ();
-               name_hbox.set_size_request(TimeAxisView::name_width_px, -1);
        }
 }
 
@@ -451,14 +464,6 @@ RouteTimeAxisView::parameter_changed (string const & p)
        }
 }
 
-void
-RouteTimeAxisView::route_property_changed (const PropertyChange& what_changed)
-{
-       if (what_changed.contains (ARDOUR::Properties::name)) {
-               label_view ();
-       }
-}
-
 void
 RouteTimeAxisView::take_name_changed (void *src)
 {
@@ -470,7 +475,7 @@ RouteTimeAxisView::take_name_changed (void *src)
 void
 RouteTimeAxisView::playlist_click ()
 {
-       build_playlist_menu ();
+       build_playlist_menu ();
        conditionally_add_to_selection ();
        playlist_action_menu->popup (1, gtk_get_current_event_time());
 }
@@ -592,11 +597,6 @@ RouteTimeAxisView::build_display_menu ()
        }
        build_size_menu ();
        items.push_back (MenuElem (_("Height"), *_size_menu));
-
-       items.push_back (SeparatorElem());
-
-       items.push_back (MenuElem (_("Remote Control ID..."), sigc::mem_fun (*this, &RouteUI::open_remote_control_id_dialog)));
-       items.back().set_sensitive (_editor.get_selection().tracks.size() <= 1);
        items.push_back (SeparatorElem());
 
        // Hook for derived classes to add type specific stuff
@@ -1175,7 +1175,7 @@ RouteTimeAxisView::use_copy_playlist (bool prompt, vector<boost::shared_ptr<Play
 
        name = pl->name();
 
-       if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::select.property_id)) {
+       if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) {
                name = resolve_new_group_playlist_name(name, playlists_before_op);
        }
 
@@ -1230,7 +1230,7 @@ RouteTimeAxisView::use_new_playlist (bool prompt, vector<boost::shared_ptr<Playl
 
        name = pl->name();
 
-       if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::select.property_id)) {
+       if (route_group() && route_group()->is_active() && route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) {
                name = resolve_new_group_playlist_name(name,playlists_before_op);
        }
 
@@ -1410,12 +1410,6 @@ RouteTimeAxisView::route_group () const
        return _route->route_group();
 }
 
-string
-RouteTimeAxisView::name() const
-{
-       return _route->name();
-}
-
 boost::shared_ptr<Playlist>
 RouteTimeAxisView::playlist () const
 {
@@ -1428,33 +1422,30 @@ RouteTimeAxisView::playlist () const
        }
 }
 
-void
-RouteTimeAxisView::name_entry_changed ()
+bool
+RouteTimeAxisView::name_entry_changed (string const& str)
 {
-       TimeAxisView::name_entry_changed ();
-
-       string x = name_entry->get_text ();
-
-       if (x == _route->name()) {
-               return;
+       if (str == _route->name()) {
+               return true;
        }
 
+       string x = str;
+       
        strip_whitespace_edges (x);
 
-       if (x.length() == 0) {
-               name_entry->set_text (_route->name());
-               return;
+       if (x.empty()) {
+               return false;
        }
 
        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->grab_focus ();
+               ARDOUR_UI::instance()->popup_error (string_compose (_("The name \"%1\" is reserved for %2"), x, PROGRAM_NAME));
+               return false;
        } else if (RouteUI::verify_new_route_name (x)) {
                _route->set_name (x);
-       } else {
-               name_entry->grab_focus ();
+               return true;
        }
+
+       return false;
 }
 
 boost::shared_ptr<Region>
@@ -1594,7 +1585,7 @@ RouteTimeAxisView::cut_copy_clear (Selection& selection, CutCopyOp op)
 }
 
 bool
-RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx)
+RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteContext& ctx, const int32_t sub_num)
 {
        if (!is_track()) {
                return false;
@@ -1628,7 +1619,7 @@ RouteTimeAxisView::paste (framepos_t pos, const Selection& selection, PasteConte
                framecnt_t amount = extent.second - extent.first;
                pl->ripple(pos, amount * ctx.times, boost::shared_ptr<Region>());
        }
-       pl->paste (*p, pos, ctx.times);
+       pl->paste (*p, pos, ctx.times, sub_num);
 
        vector<Command*> cmds;
        pl->rdiff (cmds);
@@ -1688,7 +1679,7 @@ RouteTimeAxisView::build_playlist_menu ()
        playlist_items.push_back (MenuElem (_("Rename..."), sigc::mem_fun(*this, &RouteTimeAxisView::rename_current_playlist)));
        playlist_items.push_back (SeparatorElem());
 
-       if (!route_group() || !route_group()->is_active() || !route_group()->enabled_property (ARDOUR::Properties::select.property_id)) {
+       if (!route_group() || !route_group()->is_active() || !route_group()->enabled_property (ARDOUR::Properties::group_select.property_id)) {
                playlist_items.push_back (MenuElem (_("New..."), sigc::bind(sigc::mem_fun(_editor, &PublicEditor::new_playlists), this)));
                playlist_items.push_back (MenuElem (_("New Copy..."), sigc::bind(sigc::mem_fun(_editor, &PublicEditor::copy_playlists), this)));
 
@@ -1732,7 +1723,7 @@ RouteTimeAxisView::use_playlist (RadioMenuItem *item, boost::weak_ptr<Playlist>
 
        RouteGroup* rg = route_group();
 
-       if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::select.property_id)) {
+       if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::group_select.property_id)) {
                std::string group_string = "." + rg->name() + ".";
 
                std::string take_name = pl->name();
@@ -1778,7 +1769,7 @@ void
 RouteTimeAxisView::update_playlist_tip ()
 {
        RouteGroup* rg = route_group ();
-       if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::select.property_id)) {
+       if (rg && rg->is_active() && rg->enabled_property (ARDOUR::Properties::group_select.property_id)) {
                string group_string = "." + rg->name() + ".";
 
                string take_name = track()->playlist()->name();
@@ -2085,7 +2076,7 @@ RouteTimeAxisView::show_existing_automation (bool apply_to_selection)
 
                for (list<ProcessorAutomationInfo*>::iterator i = processor_automation.begin(); i != processor_automation.end(); ++i) {
                        for (vector<ProcessorAutomationNode*>::iterator ii = (*i)->lines.begin(); ii != (*i)->lines.end(); ++ii) {
-                               if ((*ii)->view != 0 && (*i)->processor->control((*ii)->what)->list()->size() > 0) {
+                               if ((*i)->processor->control((*ii)->what)->list()->size() > 0) {
                                        (*ii)->menu_item->set_active (true);
                                }
                        }
@@ -2929,3 +2920,22 @@ RouteTimeAxisView::remove_child (boost::shared_ptr<TimeAxisView> c)
                }
        }
 }
+
+Gdk::Color
+RouteTimeAxisView::color () const
+{
+       return route_color ();
+}
+
+bool
+RouteTimeAxisView::marked_for_display () const
+{
+       return !_route->presentation_info().hidden();
+}
+
+bool
+RouteTimeAxisView::set_marked_for_display (bool yn)
+{
+       return RouteUI::mark_hidden (!yn);
+}
+