Merged changes from trunk 1699:1751 into 2.1-staging
[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 "editor.h"
24 #include "editing.h"
25 #include "audio_time_axis.h"
26 #include "region_view.h"
27 #include "selection.h"
28
29 using namespace ARDOUR;
30 using namespace PBD;
31
32 void
33 Editor::set_route_loop_selection ()
34 {
35         if (session == 0 || selection->time.empty()) {
36                 return;
37         }
38
39         nframes_t start = selection->time[clicked_selection].start;
40         nframes_t end = selection->time[clicked_selection].end;
41
42         Location* loc = transport_loop_location();
43
44         if (loc) {
45                 
46                 loc->set (start, end);
47
48                 // enable looping, reposition and start rolling
49                 session->request_play_loop (true);
50                 session->request_locate (loc->start(), true);
51         }
52
53 }
54
55 void
56 Editor::set_show_waveforms (bool yn)
57 {
58         AudioTimeAxisView* atv;
59
60         if (_show_waveforms != yn) {
61                 _show_waveforms = yn;
62                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
63                         if ((atv = dynamic_cast<AudioTimeAxisView*>(*i)) != 0) {
64                                 atv->set_show_waveforms (yn);
65                         }
66                 }
67         }
68 }
69
70 void
71 Editor::set_show_waveforms_recording (bool yn)
72 {
73         AudioTimeAxisView* atv;
74
75         if (_show_waveforms_recording != yn) {
76                 _show_waveforms_recording = yn;
77                 for (TrackViewList::iterator i = track_views.begin(); i != track_views.end(); ++i) {
78                         if ((atv = dynamic_cast<AudioTimeAxisView*>(*i)) != 0) {
79                                 atv->set_show_waveforms_recording (yn);
80                         }
81                 }
82         }
83 }