1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
5
A MIDI and audio sequencer and musical notation editor.
7
This program is Copyright 2000-2008
8
Guillaume Laurent <glaurent@telegraph-road.org>,
9
Chris Cannam <cannam@all-day-breakfast.com>,
10
Richard Bown <richard.bown@ferventsoftware.com>
12
The moral rights of Guillaume Laurent, Chris Cannam, and Richard
13
Bown to claim authorship of this work have been asserted.
15
Other copyrights also apply to some parts of this work. Please
16
see the AUTHORS file and individual file headers for details.
18
This program is free software; you can redistribute it and/or
19
modify it under the terms of the GNU General Public License as
20
published by the Free Software Foundation; either version 2 of the
21
License, or (at your option) any later version. See the file
22
COPYING included with this distribution for more information.
26
#include "SegmentSyncClefCommand.h"
28
#include "base/Selection.h"
29
#include "commands/notation/ClefInsertionCommand.h"
33
SegmentSyncClefCommand::SegmentSyncClefCommand(Segment &segment, const Clef& clef) :
34
KMacroCommand(i18n("Sync segment clef"))
36
processSegment(segment, clef);
40
SegmentSyncClefCommand::processSegment(Segment &segment, const Clef& clef)
42
KMacroCommand * macroCommand = this;
44
// TODO delete it somewhere.
45
EventSelection * wholeSegment = new EventSelection(segment, segment.getStartTime(), segment.getEndMarkerTime());
47
EventSelection::eventcontainer::iterator i;
49
for (i = wholeSegment->getSegmentEvents().begin();
50
i != wholeSegment->getSegmentEvents().end(); ++i) {
51
if ((*i)->isa(Rosegarden::Clef::EventType)) {
52
macroCommand->addCommand
53
(new ClefInsertionCommand
55
(*i)->getAbsoluteTime(),
63
SegmentSyncClefCommand::~SegmentSyncClefCommand()