Line data Source code
1 : /*
2 : * SPDX-License-Identifier: GPL-3.0-only
3 : * MuseScore-Studio-CLA-applies
4 : *
5 : * MuseScore Studio
6 : * Music Composition & Notation
7 : *
8 : * Copyright (C) 2021 MuseScore Limited and others
9 : *
10 : * This program is free software: you can redistribute it and/or modify
11 : * it under the terms of the GNU General Public License version 3 as
12 : * published by the Free Software Foundation.
13 : *
14 : * This program is distributed in the hope that it will be useful,
15 : * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 : * GNU General Public License for more details.
18 : *
19 : * You should have received a copy of the GNU General Public License
20 : * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 : */
22 :
23 : #pragma once
24 :
25 : #include <vector>
26 :
27 : #include "types/bytearray.h"
28 : #include "types/ret.h"
29 :
30 : #include "inotationselectionrange.h"
31 :
32 : class QMimeData;
33 :
34 : namespace mu::engraving {
35 : class EngravingItem;
36 : class MeasureBase;
37 : class Note;
38 : class Page;
39 : class System;
40 : enum class SelState : char;
41 : }
42 :
43 : namespace mu::notation {
44 : using SelectionState = mu::engraving::SelState;
45 :
46 : enum class NoteFilter : unsigned char
47 : {
48 : All,
49 : WithTie,
50 : WithSlur
51 : };
52 :
53 : class INotationSelection
54 : {
55 : public:
56 12 : virtual ~INotationSelection() = default;
57 :
58 : virtual bool isNone() const = 0;
59 : virtual bool isSingle() const = 0;
60 : virtual bool isRange() const = 0;
61 : virtual SelectionState state() const = 0;
62 :
63 : virtual muse::Ret canCopy() const = 0;
64 : virtual muse::ByteArray mimeData() const = 0;
65 : virtual QMimeData* qMimeData() const = 0;
66 :
67 : virtual engraving::EngravingItem* element() const = 0;
68 : virtual const std::vector<engraving::EngravingItem*>& elements() const = 0;
69 :
70 : virtual std::vector<engraving::Note*> notes(NoteFilter filter = NoteFilter::All) const = 0;
71 :
72 : virtual muse::RectF canvasBoundingRect() const = 0;
73 :
74 : virtual INotationSelectionRangePtr range() const = 0;
75 :
76 : virtual engraving::EngravingItem* lastElementHit() const = 0;
77 :
78 : virtual mu::engraving::MeasureBase* startMeasureBase() const = 0;
79 : virtual mu::engraving::MeasureBase* endMeasureBase() const = 0;
80 : virtual std::vector<mu::engraving::MeasureBase*> measureBasesInSelection() const = 0;
81 : virtual std::vector<mu::engraving::System*> selectedSystems() const = 0;
82 : virtual std::vector<mu::engraving::Page*> pagesContainingSelection() const = 0;
83 :
84 : virtual bool elementsSelected(const mu::engraving::ElementTypeSet& types) const = 0;
85 : };
86 :
87 : using INotationSelectionPtr = std::shared_ptr<INotationSelection>;
88 : }
|