Reenable the correct sort column and type when redisplaying regions
[ardour.git] / gtk2_ardour / editor_audiotrack.cc
1 /*
2  * Copyright (C) 2006-2012 David Robillard <d@drobilla.net>
3  * Copyright (C) 2007-2016 Paul Davis <paul@linuxaudiosystems.com>
4  * Copyright (C) 2009-2010 Carl Hetherington <carl@carlh.net>
5  *
6  * This program is free software; you can redistribute it and/or modify
7  * it under the terms of the GNU General Public License as published by
8  * the Free Software Foundation; either version 2 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14  * GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License along
17  * with this program; if not, write to the Free Software Foundation, Inc.,
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19  */
20
21 #include "ardour/rc_configuration.h"
22
23 #include "canvas/canvas.h"
24
25 #include "editor.h"
26 #include "editing.h"
27 #include "audio_time_axis.h"
28 #include "route_time_axis.h"
29 #include "audio_region_view.h"
30 #include "selection.h"
31 #include "ui_config.h"
32
33 #include "pbd/i18n.h"
34
35 using namespace ARDOUR;
36 using namespace PBD;
37
38 void
39 Editor::start_updating_meters ()
40 {
41         RouteTimeAxisView* rtv;
42
43         if (contents().is_mapped() && _session) {
44                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
45                         if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
46                                 rtv->reset_meter ();
47                         }
48                 }
49         }
50
51         meters_running = true;
52 }
53
54 void
55 Editor::stop_updating_meters ()
56 {
57         RouteTimeAxisView* rtv;
58
59         meters_running = false;
60
61         if (contents().is_mapped() && _session) {
62                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
63                         if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
64                                 rtv->hide_meter ();
65                         }
66                 }
67         }
68 }
69
70 void
71 Editor::toggle_meter_updating()
72 {
73         DisplaySuspender ds;
74         if (UIConfiguration::instance().get_show_track_meters()) {
75                 start_updating_meters ();
76         } else {
77                 stop_updating_meters ();
78         }
79
80         track_canvas_viewport_allocate (_track_canvas->get_allocation());
81 }
82