1
//=========================================================
4
// $Id: trackdrummapupdater.cpp,v 1.59.2.52 2011/12/27 20:25:58 flo93 Exp $
6
// (C) Copyright 2011 Florian Jung (florian.a.jung (at) web.de)
8
// This program is free software; you can redistribute it and/or
9
// modify it under the terms of the GNU General Public License
10
// as published by the Free Software Foundation; version 2 of
11
// the License, or (at your option) any later version.
13
// This program is distributed in the hope that it will be useful,
14
// but WITHOUT ANY WARRANTY; without even the implied warranty of
15
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
// GNU General Public License for more details.
18
// You should have received a copy of the GNU General Public License
19
// along with this program; if not, write to the Free Software
20
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22
//=========================================================
24
#include "trackdrummapupdater.h"
30
using MusEGlobal::song;
32
TrackDrummapUpdater::TrackDrummapUpdater()
34
connect(song,SIGNAL(songChanged(MusECore::SongChangedFlags_t)), this, SLOT(songChanged(MusECore::SongChangedFlags_t)));
37
void TrackDrummapUpdater::songChanged(MusECore::SongChangedFlags_t flags)
39
if (flags & (SC_TRACK_INSERTED | SC_TRACK_REMOVED | SC_TRACK_MODIFIED |
40
SC_PART_INSERTED | SC_PART_REMOVED | SC_PART_MODIFIED |
41
SC_EVENT_INSERTED | SC_EVENT_REMOVED | SC_EVENT_MODIFIED ) )
44
for (iTrack t=song->tracks()->begin(); t!=song->tracks()->end(); t++)
46
MidiTrack* track=dynamic_cast<MidiTrack*>(*t);
47
if (track && track->auto_update_drummap())
53
// allow recursion. there will be no more recursion, because this
54
// is only executed when something other than SC_DRUMMAP happens
55
song->update(SC_DRUMMAP, true);
61
} //namespace MusECore