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     Copyright 2000-2021 the Rosegarden development team.
7 
8     Other copyrights also apply to some parts of this work.  Please
9     see the AUTHORS file and individual file headers for details.
10 
11     This program is free software; you can redistribute it and/or
12     modify it under the terms of the GNU General Public License as
13     published by the Free Software Foundation; either version 2 of the
14     License, or (at your option) any later version.  See the file
15     COPYING included with this distribution for more information.
16 */
17 
18 #ifndef RG_SETTRIGGERCOMMAND_H
19 #define RG_SETTRIGGERCOMMAND_H
20 
21 #include "base/TriggerSegment.h"
22 #include "document/BasicSelectionCommand.h"
23 #include <string>
24 #include <QString>
25 #include <QCoreApplication>
26 
27 
28 
29 
30 namespace Rosegarden
31 {
32 
33 class EventSelection;
34 
35 
36 class SetTriggerCommand : public BasicSelectionCommand
37 {
Q_DECLARE_TR_FUNCTIONS(Rosegarden::SetTriggerCommand)38     Q_DECLARE_TR_FUNCTIONS(Rosegarden::SetTriggerCommand)
39 
40 public:
41     SetTriggerCommand(EventSelection &selection,
42                       TriggerSegmentId triggerSegmentId,
43                       bool notesOnly,
44                       bool retune,
45                       std::string timeAdjust,
46                       Mark mark,
47                       QString name = nullptr) :
48         BasicSelectionCommand(!name.isEmpty() ? name : getGlobalName(), selection, true),
49         m_selection(&selection),
50         m_triggerSegmentId(triggerSegmentId),
51         m_notesOnly(notesOnly),
52         m_retune(retune),
53         m_timeAdjust(timeAdjust),
54         m_mark(mark)
55     { }
56 
getGlobalName()57     static QString getGlobalName() {
58         return tr("Tri&gger Segment");
59     }
60 
61 protected:
62     void modifySegment() override;
63 
64 private:
65     EventSelection *m_selection;// only used on 1st execute (cf bruteForceRedo)
66     TriggerSegmentId m_triggerSegmentId;
67     bool m_notesOnly;
68     bool m_retune;
69     std::string m_timeAdjust;
70     Mark m_mark;
71 };
72 
73 
74 
75 }
76 
77 #endif
78