~ubuntu-branches/ubuntu/karmic/rosegarden/karmic

« back to all changes in this revision

Viewing changes to src/commands/segment/SegmentSyncClefCommand.cpp

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-02 00:33:44 UTC
  • mfrom: (1.1.7 upstream) (6.1.1 lenny)
  • Revision ID: james.westby@ubuntu.com-20080502003344-67vbfhgqx2yl0ksi
Tags: 1:1.7.0-1ubuntu1
* Merge from Debian unstable. (LP: #225849) Remaining Ubuntu changes:
  - Add usr/share/doc/kde/HTML to rosegarden-data, to provide online
    help documentation.
  - Change fftw3-dev to libfftw3-dev.
  - Update maintainer field as per spec.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */
 
2
 
 
3
/*
 
4
    Rosegarden
 
5
    A MIDI and audio sequencer and musical notation editor.
 
6
 
 
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>
 
11
 
 
12
    The moral rights of Guillaume Laurent, Chris Cannam, and Richard
 
13
    Bown to claim authorship of this work have been asserted.
 
14
 
 
15
    Other copyrights also apply to some parts of this work.  Please
 
16
    see the AUTHORS file and individual file headers for details.
 
17
 
 
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.
 
23
*/
 
24
 
 
25
 
 
26
#include "SegmentSyncClefCommand.h"
 
27
 
 
28
#include "base/Selection.h"
 
29
#include "commands/notation/ClefInsertionCommand.h"
 
30
 
 
31
namespace Rosegarden
 
32
{
 
33
SegmentSyncClefCommand::SegmentSyncClefCommand(Segment &segment, const Clef& clef) :
 
34
        KMacroCommand(i18n("Sync segment clef"))
 
35
{
 
36
    processSegment(segment, clef);
 
37
}
 
38
 
 
39
void 
 
40
SegmentSyncClefCommand::processSegment(Segment &segment, const Clef& clef)
 
41
{
 
42
    KMacroCommand * macroCommand = this;
 
43
 
 
44
    // TODO delete it somewhere.
 
45
    EventSelection * wholeSegment = new EventSelection(segment, segment.getStartTime(), segment.getEndMarkerTime());
 
46
 
 
47
    EventSelection::eventcontainer::iterator i;
 
48
 
 
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
 
54
                     (segment,
 
55
                       (*i)->getAbsoluteTime(),
 
56
                       clef, false, false));
 
57
        }
 
58
    }
 
59
        
 
60
}
 
61
 
 
62
 
 
63
SegmentSyncClefCommand::~SegmentSyncClefCommand()
 
64
{}
 
65
 
 
66
 
 
67
}