Reenable the correct sort column and type when redisplaying regions
[ardour.git] / gtk2_ardour / audio_time_axis.cc
index 533c5ffc35c8d9c768c91a49625d41b7f3baff6a..61c7b25cfc166680c0e3404b1a444e947b37009a 100644 (file)
@@ -1,21 +1,29 @@
 /*
-    Copyright (C) 2000-2006 Paul Davis
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-*/
+ * Copyright (C) 2005-2006 Nick Mainsbridge <mainsbridge@gmail.com>
+ * Copyright (C) 2005-2006 Sampo Savolainen <v2@iki.fi>
+ * Copyright (C) 2005-2006 Taybin Rutkin <taybin@taybin.com>
+ * Copyright (C) 2005-2007 Doug McLain <doug@nostar.net>
+ * Copyright (C) 2005-2017 Paul Davis <paul@linuxaudiosystems.com>
+ * Copyright (C) 2005 Karsten Wiese <fzuuzf@googlemail.com>
+ * Copyright (C) 2006-2015 David Robillard <d@drobilla.net>
+ * Copyright (C) 2007-2012 Carl Hetherington <carl@carlh.net>
+ * Copyright (C) 2013-2014 John Emmas <john@creativepost.co.uk>
+ * Copyright (C) 2014-2019 Robin Gareus <robin@gareus.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
 
 #include <cstdlib>
 #include <cmath>
 #include "pbd/stl_delete.h"
 #include "pbd/memento_command.h"
 
-#include <gtkmm2ext/gtk_ui.h>
-#include <gtkmm2ext/selector.h>
-#include <gtkmm2ext/bindable_button.h>
-#include <gtkmm2ext/utils.h>
+#include "gtkmm2ext/gtk_ui.h"
+#include "gtkmm2ext/utils.h"
+
+#include "widgets/ardour_button.h"
 
 #include "ardour/event_type_map.h"
 #include "ardour/pannable.h"
 #include "ardour/panner.h"
 #include "ardour/panner_shell.h"
 
-#include "ardour_button.h"
-#include "ardour_ui.h"
 #include "audio_time_axis.h"
 #include "automation_line.h"
 #include "enums.h"
 #include "automation_time_axis.h"
 #include "keyboard.h"
 #include "playlist_selector.h"
-#include "prompter.h"
 #include "public_editor.h"
 #include "audio_region_view.h"
 #include "audio_streamview.h"
+#include "ui_config.h"
 #include "utils.h"
 
-#include "i18n.h"
+#include "pbd/i18n.h"
 
 using namespace std;
 using namespace ARDOUR;
+using namespace ArdourWidgets;
 using namespace ARDOUR_UI_UTILS;
 using namespace PBD;
 using namespace Gtk;
 using namespace Editing;
 
 AudioTimeAxisView::AudioTimeAxisView (PublicEditor& ed, Session* sess, ArdourCanvas::Canvas& canvas)
-       : AxisView(sess)
+       : SessionHandlePtr (sess)
        , RouteTimeAxisView(ed, sess, canvas)
 {
+       UIConfiguration::instance().ParameterChanged.connect (sigc::mem_fun (*this, &AudioTimeAxisView::parameter_changed));
 }
 
 void
@@ -106,6 +114,10 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
                create_automation_child (GainAutomation, false);
        }
 
+       if (automation_child (TrimAutomation) == 0) {
+               create_automation_child (TrimAutomation, false);
+       }
+
        /* if set_state above didn't create a mute automation child, we need to make one */
        if (automation_child (MuteAutomation) == 0) {
                create_automation_child (MuteAutomation, false);
@@ -113,7 +125,7 @@ AudioTimeAxisView::set_route (boost::shared_ptr<Route> rt)
 
        if (_route->panner_shell()) {
                _route->panner_shell()->Changed.connect (*this, invalidator (*this),
-                                                         boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
+                                                        boost::bind (&AudioTimeAxisView::ensure_pan_views, this, false), gui_context());
        }
 
        /* map current state of the route */
@@ -180,14 +192,14 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
        AutomationTracks::iterator existing = _automation_tracks.find (param);
 
        if (existing != _automation_tracks.end()) {
-               
+
                /* automation track created because we had existing data for
                 * the processor, but visibility may need to be controlled
                 * since it will have been set visible by default.
                 */
 
                existing->second->set_marked_for_display (show);
-               
+
                if (!no_redraw) {
                        request_redraw ();
                }
@@ -199,9 +211,17 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
 
                create_gain_automation_child (param, show);
 
+       } else if (param.type() == BusSendLevel) {
+
+               create_trim_automation_child (param, show);
+
+       } else if (param.type() == TrimAutomation) {
+
+               create_trim_automation_child (param, show);
+
        } else if (param.type() == PanWidthAutomation ||
-                   param.type() == PanElevationAutomation ||
-                   param.type() == PanAzimuthAutomation) {
+                  param.type() == PanElevationAutomation ||
+                  param.type() == PanAzimuthAutomation) {
 
                ensure_pan_views (show);
 
@@ -212,7 +232,7 @@ AudioTimeAxisView::create_automation_child (const Evoral::Parameter& param, bool
        } else if (param.type() == MuteAutomation) {
 
                create_mute_automation_child (param, show);
-               
+
 
        } else {
                error << "AudioTimeAxisView: unknown automation child " << EventTypeMap::instance().to_symbol(param) << endmsg;
@@ -272,6 +292,14 @@ AudioTimeAxisView::route_active_changed ()
        update_control_names ();
 }
 
+void
+AudioTimeAxisView::parameter_changed (string const & p)
+{
+       if (p == "vertical-region-gap") {
+               _view->update_contents_height ();
+       }
+}
+
 
 /**
  *    Set up the names of the controls so that they are coloured
@@ -300,7 +328,7 @@ AudioTimeAxisView::update_control_names ()
                }
        }
 
-       if (get_selected()) {
+       if (selected()) {
                controls_ebox.set_name (controls_base_selected_name);
                time_axis_frame.set_name (controls_base_selected_name);
        } else {