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 "../types/types.h"
26 :
27 : namespace muse::draw {
28 : class Painter;
29 : }
30 :
31 : namespace mu::engraving {
32 : class EngravingItem;
33 : class Page;
34 : class Score;
35 :
36 : class MuseScoreView
37 : {
38 : public:
39 0 : virtual ~MuseScoreView() = default;
40 :
41 0 : virtual double selectionProximity() const { return 0.0f; }
42 :
43 0 : virtual void layoutChanged() {}
44 : virtual void dataChanged(const RectF&) = 0;
45 : virtual void updateAll() = 0;
46 :
47 0 : virtual void moveCursor() {}
48 :
49 0 : virtual Score* score() const { return m_score; }
50 0 : virtual void setScore(Score* s) { m_score = s; }
51 0 : virtual void removeScore() {}
52 :
53 0 : virtual void changeEditElement(EngravingItem*) {}
54 : virtual void drawBackground(muse::draw::Painter*, const RectF&) const = 0;
55 0 : virtual void setDropTarget(EngravingItem*) {}
56 :
57 0 : virtual void textTab(bool /*back*/) {}
58 :
59 : const std::vector<EngravingItem*> elementsAt(const PointF&) const;
60 : EngravingItem* elementNear(const PointF& pos) const;
61 0 : virtual void adjustCanvasPosition(const EngravingItem*, int /*staffIdx*/ = -1) {}
62 :
63 : protected:
64 : Score* m_score = nullptr;
65 :
66 : private:
67 : Page* point2page(const PointF&) const;
68 : EngravingItem* elementAt(const PointF& p) const;
69 : const std::vector<EngravingItem*> elementsNear(const PointF& pos) const;
70 : };
71 : }
|