Preserve stacked / overlaid state of tracks in the session file.
[ardour.git] / gtk2_ardour / automation_time_axis.cc
index f594901a287d19e6579a72968dceda0e3f2b3ee2..806359e2ab36f2e7b05935accc919f8d2f054060 100644 (file)
 
 #include <utility>
 #include <gtkmm2ext/barcontroller.h>
-#include <pbd/memento_command.h>
-#include <ardour/automation_control.h>
-#include <ardour/event_type_map.h>
-#include <ardour/route.h>
+#include "pbd/memento_command.h"
+#include "ardour/automation_control.h"
+#include "ardour/event_type_map.h"
+#include "ardour/route.h"
 
 #include "ardour_ui.h"
 #include "automation_time_axis.h"
@@ -40,6 +40,7 @@
 
 #include "i18n.h"
 
+using namespace std;
 using namespace ARDOUR;
 using namespace PBD;
 using namespace Gtk;
@@ -69,7 +70,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
          _base_rect (0),
          _view (show_regions ? new AutomationStreamView(*this) : NULL),
          _name (nom),
-         clear_button (_("clear")),
          auto_button (X_("")) /* force addition of a label */
 {
        if (!have_name_font) {
@@ -100,25 +100,23 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
        
        _base_rect->set_data ("trackview", this);
 
-       _base_rect->signal_event().connect (bind (mem_fun (_editor, &PublicEditor::canvas_automation_track_event),
-                                                _base_rect, this));
+       _base_rect->signal_event().connect (bind (
+                       mem_fun (_editor, &PublicEditor::canvas_automation_track_event),
+                       _base_rect, this));
 
-       _base_rect->lower_to_bottom();
+       // _base_rect->lower_to_bottom();
 
        hide_button.add (*(manage (new Gtk::Image (::get_icon("hide")))));
 
        auto_button.set_name ("TrackVisualButton");
-       clear_button.set_name ("TrackVisualButton");
        hide_button.set_name ("TrackRemoveButton");
 
        auto_button.unset_flags (Gtk::CAN_FOCUS);
-       clear_button.unset_flags (Gtk::CAN_FOCUS);
        hide_button.unset_flags (Gtk::CAN_FOCUS);
 
        controls_table.set_no_show_all();
 
        ARDOUR_UI::instance()->tooltips().set_tip(auto_button, _("automation state"));
-       ARDOUR_UI::instance()->tooltips().set_tip(clear_button, _("clear track"));
        ARDOUR_UI::instance()->tooltips().set_tip(hide_button, _("hide track"));
 
        /* rearrange the name display */
@@ -179,14 +177,12 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
        controls_table.attach (hide_button, 0, 1, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
 
        controls_table.attach (auto_button, 5, 8, 0, 1, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
-       controls_table.attach (clear_button, 5, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
        
        /* add bar controller */
-       controls_table.attach (*_controller.get(), 0, 8, 2, 3, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
+       controls_table.attach (*_controller.get(), 0, 8, 1, 2, Gtk::FILL|Gtk::EXPAND, Gtk::FILL|Gtk::EXPAND);
 
        controls_table.show_all ();
 
-       clear_button.signal_clicked().connect (mem_fun(*this, &AutomationTimeAxisView::clear_clicked));
        hide_button.signal_clicked().connect (mem_fun(*this, &AutomationTimeAxisView::hide_clicked));
        auto_button.signal_clicked().connect (mem_fun(*this, &AutomationTimeAxisView::auto_clicked));
 
@@ -194,8 +190,6 @@ AutomationTimeAxisView::AutomationTimeAxisView (Session& s, boost::shared_ptr<Ro
        controls_base_unselected_name = X_("AutomationTrackControlsBase");
        controls_ebox.set_name (controls_base_unselected_name);
 
-       controls_frame.set_shadow_type (Gtk::SHADOW_ETCHED_OUT);
-
        XMLNode* xml_node = get_parent_with_state()->get_automation_child_xml_node (
                        _control->parameter());
 
@@ -259,15 +253,20 @@ void
 AutomationTimeAxisView::set_automation_state (AutoState state)
 {
        if (!ignore_state_request) {
+               _automatable->set_parameter_automation_state (_control->parameter(), state);
+#if 0
                if (_route == _automatable) { // This is a time axis for route (not region) automation
                        _route->set_parameter_automation_state (_control->parameter(), state);
                }
 
                if (_control->list())
                        _control->alist()->set_automation_state(state);
+#endif
        }
-       if (_view)
+
+       if (_view) {
                _view->set_automation_state (state);
+       }
 }
 
 void
@@ -425,7 +424,6 @@ AutomationTimeAxisView::set_height (uint32_t h)
                        name_hbox.show_all ();
                        
                        auto_button.show();
-                       clear_button.show();
                        hide_button.show_all();
 
                } else if (h >= hSmall) {
@@ -443,7 +441,6 @@ AutomationTimeAxisView::set_height (uint32_t h)
                        name_hbox.show_all ();
                        
                        auto_button.hide();
-                       clear_button.hide();
                        hide_button.hide();
                }
        } else if (h >= hNormal){
@@ -567,7 +564,7 @@ AutomationTimeAxisView::build_display_menu ()
 }
 
 void
-AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* item, GdkEvent* event, nframes_t when, double y)
+AutomationTimeAxisView::add_automation_event (ArdourCanvas::Item* /*item*/, GdkEvent* /*event*/, nframes_t when, double y)
 {
        if (!_line)
                return;
@@ -740,7 +737,7 @@ AutomationTimeAxisView::paste_one (AutomationLine& line, nframes_t pos, float ti
        AutomationSelection::iterator p;
        boost::shared_ptr<AutomationList> alist(line.the_list());
        
-       for (p = selection.lines.begin(); p != selection.lines.end() && nth; ++p, --nth);
+       for (p = selection.lines.begin(); p != selection.lines.end() && nth; ++p, --nth) {}
 
        if (p == selection.lines.end()) {
                return false;