automated build stuff continues
[ardour2.git] / gtk2_ardour / clock_group.cc
blob5a03064e8552b9b27118136489752415634eec6c
1 /*
2 Copyright (C) 2011 Paul Davis
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.
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.
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.
20 #include "clock_group.h"
22 ClockGroup::ClockGroup ()
23 : ignore_changes (false)
24 , _clock_mode (AudioClock::Frames)
28 ClockGroup::~ClockGroup()
32 void
33 ClockGroup::add (AudioClock& clock)
35 if (clocks.insert (&clock).second) {
36 clock.mode_changed.connect (sigc::bind (sigc::mem_fun (*this, &ClockGroup::one_clock_changed), &clock));
37 clock.set_mode (_clock_mode);
41 void
42 ClockGroup::remove (AudioClock& clock)
44 clocks.erase (&clock);
47 void
48 ClockGroup::one_clock_changed (AudioClock* clock)
50 if (!ignore_changes) {
51 set_clock_mode (clock->mode());
55 void
56 ClockGroup::set_clock_mode (AudioClock::Mode mode)
58 _clock_mode = mode;
60 ignore_changes = true;
61 for (std::set<AudioClock*>::iterator c = clocks.begin(); c != clocks.end(); ++c) {
62 (*c)->set_mode (mode);
64 ignore_changes = false;