Make waveform show / scale / shape a global option in the prefs dialog to clean thing...
[ardour.git] / gtk2_ardour / editor_audiotrack.cc
1 /*
2     Copyright (C) 2000-2007 Paul Davis 
3
4     This program is free software; you can redistribute it and/or modify
5     it under the terms of the GNU General Public License as published by
6     the Free Software Foundation; either version 2 of the License, or
7     (at your option) any later version.
8
9     This program is distributed in the hope that it will be useful,
10     but WITHOUT ANY WARRANTY; without even the implied warranty of
11     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12     GNU General Public License for more details.
13
14     You should have received a copy of the GNU General Public License
15     along with this program; if not, write to the Free Software
16     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
17
18 */
19
20 #include "ardour/location.h"
21 #include "ardour/audio_diskstream.h"
22
23 #include "ardour_ui.h"
24 #include "editor.h"
25 #include "editing.h"
26 #include "audio_time_axis.h"
27 #include "route_time_axis.h"
28 #include "audio_region_view.h"
29 #include "selection.h"
30
31 #include "i18n.h"
32
33 using namespace ARDOUR;
34 using namespace PBD;
35
36 void
37 Editor::set_show_waveforms_recording (bool yn)
38 {
39         AudioTimeAxisView* atv;
40
41         if (_show_waveforms_recording != yn) {
42                 _show_waveforms_recording = yn;
43                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
44                         if ((atv = dynamic_cast<AudioTimeAxisView*>(*i)) != 0) {
45                                 atv->set_show_waveforms_recording (yn);
46                         }
47                 }
48         }
49 }
50
51 gint
52 Editor::start_updating ()
53 {
54         RouteTimeAxisView* rtv;
55
56         //cerr << "Editor::start_updating () called" << endl;//DEBUG
57         if (is_mapped() && session) {
58                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
59                         if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
60                                 rtv->reset_meter ();
61                         }
62                 }
63         }
64
65         if (!meters_running) {
66                 fast_screen_update_connection = ARDOUR_UI::SuperRapidScreenUpdate.connect (mem_fun(*this, &Editor::fast_update_strips));
67                 meters_running = true;
68         }
69     return 0;
70 }
71
72 gint
73 Editor::stop_updating ()
74 {
75         RouteTimeAxisView* rtv;
76         
77         meters_running = false;
78         fast_screen_update_connection.disconnect();
79         //cerr << "Editor::stop_updating () called" << endl;//DEBUG
80         if (is_mapped() && session) {
81                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
82                         if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
83                                 rtv->hide_meter ();
84                         }
85                 }
86         }
87
88     return 0;
89 }
90
91 void
92 Editor::toggle_meter_updating()
93 {
94         if (Config->get_show_track_meters()) {
95                 start_updating();
96         } else {
97                 stop_updating ();
98         }
99         track_canvas_allocate(track_canvas->get_allocation());
100 }
101
102 void
103 Editor::fast_update_strips ()
104 {
105         RouteTimeAxisView* rtv;
106
107         if (is_mapped() && session) {
108                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
109                         if ((rtv = dynamic_cast<RouteTimeAxisView*>(*i)) != 0) {
110                                 rtv->fast_update ();
111                         }
112                 }
113         }
114 }
115