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_SEGMENTSPLITTER_H
20 #define RG_SEGMENTSPLITTER_H
21 
22 #include "SegmentTool.h"
23 #include <QString>
24 #include "base/Event.h"
25 
26 
27 class QMouseEvent;
28 
29 
30 namespace Rosegarden
31 {
32 
33 class Segment;
34 class RosegardenDocument;
35 class CompositionView;
36 
37 
38 class SegmentSplitter : public SegmentTool
39 {
40     Q_OBJECT
41 
42     friend class SegmentToolBox;
43 
44 public:
45 
46     ~SegmentSplitter() override;
47 
48     void ready() override;
49 
50     void mousePressEvent(QMouseEvent *) override;
51     int mouseMoveEvent(QMouseEvent *) override;
52     void mouseReleaseEvent(QMouseEvent *) override;
53 
54     // don't do double clicks
55     virtual void contentsMouseDoubleClickEvent(QMouseEvent*);
56 
57     static QString ToolName();
58 
59 protected:
60     SegmentSplitter(CompositionView*, RosegardenDocument*);
61 
62     void drawSplitLine(QMouseEvent*);
63     void splitSegment(Segment *segment,
64                       timeT &splitTime);
65 
66     bool m_enableEditingDuringPlayback;
67 
68     // ??? unused
69     int m_prevX;
70     // ??? unused
71     int m_prevY;
72 };
73 
74 
75 }
76 
77 #endif
78