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_ERASECOMMAND_H
20 #define RG_ERASECOMMAND_H
21 
22 #include "document/BasicSelectionCommand.h"
23 #include "base/Event.h"
24 
25 #include <QCoreApplication>
26 #include <QString>
27 
28 
29 namespace Rosegarden
30 {
31 
32 
33 class EventSelection;
34 
35 
36 /// Erase a selection from within a segment
37 class EraseCommand : public BasicSelectionCommand
38 {
39     Q_DECLARE_TR_FUNCTIONS(Rosegarden::EraseCommand)
40 
41 public:
42     EraseCommand(EventSelection &selection);
43     ~EraseCommand() override;
44 
getGlobalName()45     static QString getGlobalName() { return tr("&Erase"); }
46 
47     // Return whether any deletions that affect later in the segment
48     // were done, meaning key or clef deletions.
49     static bool eraseInSegment(EventSelection *selection);
50 
51     timeT getRelayoutEndTime() override;
52 
53 protected:
54     void modifySegment() override;
55 
56 private:
57     /**
58      * Only used on first execute (cf BasicSelectionCommand::bruteForceRedo).
59      *
60      * QSharedPointer would be nice.
61      */
62     EventSelection *m_selection;
63 
64     timeT m_relayoutEndTime;
65 };
66 
67 
68 }
69 
70 #endif
71