1 2 /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ 3 4 /* 5 Rosegarden 6 A MIDI and audio sequencer and musical notation editor. 7 Copyright 2000-2021 the Rosegarden development team. 8 9 Other copyrights also apply to some parts of this work. Please 10 see the AUTHORS file and individual file headers for details. 11 12 This program is free software; you can redistribute it and/or 13 modify it under the terms of the GNU General Public License as 14 published by the Free Software Foundation; either version 2 of the 15 License, or (at your option) any later version. See the file 16 COPYING included with this distribution for more information. 17 */ 18 19 #ifndef RG_NOTEINSERTIONCOMMAND_H 20 #define RG_NOTEINSERTIONCOMMAND_H 21 22 #include "base/NotationTypes.h" 23 #include "document/BasicCommand.h" 24 #include "base/Event.h" 25 #include "gui/editors/notation/NoteStyle.h" 26 27 #include <QCoreApplication> 28 29 namespace Rosegarden 30 { 31 32 class Segment; 33 class Event; 34 35 36 class NoteInsertionCommand : public BasicCommand 37 { 38 Q_DECLARE_TR_FUNCTIONS(Rosegarden::NoteInsertionCommand) 39 40 public: 41 enum AutoBeamMode { 42 AutoBeamOff, 43 AutoBeamOn 44 }; 45 46 enum AutoTieBarlinesMode { 47 AutoTieBarlinesOff, 48 AutoTieBarlinesOn 49 }; 50 51 enum MatrixMode { 52 MatrixModeOff, 53 MatrixModeOn 54 }; 55 56 enum GraceMode { 57 GraceModeOff, 58 GraceModeOn, 59 GraceAndTripletModesOn 60 }; 61 62 NoteInsertionCommand(Segment &segment, 63 timeT time, 64 timeT endTime, 65 Note note, 66 int pitch, 67 Accidental accidental, 68 AutoBeamMode autoBeam, 69 MatrixMode matrixType, 70 GraceMode grace, 71 float targetSubordering, 72 NoteStyleName noteStyle); 73 NoteInsertionCommand(Segment &segment, 74 timeT time, 75 timeT endTime, 76 Note note, 77 int pitch, 78 Accidental accidental, 79 AutoBeamMode autoBeam, 80 AutoTieBarlinesMode autoTieBarlines, 81 MatrixMode matrixType, 82 GraceMode grace, 83 float targetSubordering, 84 NoteStyleName noteStyle, 85 int velocity = 0); // Zero for rest inserter 86 ~NoteInsertionCommand() override; 87 88 EventSelection *getSubsequentSelection() override; getLastInsertedEvent()89 Event *getLastInsertedEvent() { return m_lastInsertedEvent; } 90 91 protected: 92 void modifySegment() override; 93 94 timeT getModificationStartTime(Segment &, timeT); 95 96 timeT m_insertionTime; 97 Note m_note; 98 int m_pitch; 99 Accidental m_accidental; 100 bool m_autoBeam; 101 bool m_autoTieBarlines; 102 bool m_matrixType; 103 GraceMode m_grace; 104 float m_targetSubordering; 105 NoteStyleName m_noteStyle; 106 int m_velocity; 107 108 Event *m_lastInsertedEvent; 109 }; 110 111 112 } 113 114 #endif 115