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) 2022 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 <memory>
26 :
27 : #include "async/channel.h"
28 : #include "io/path.h"
29 : #include "types/retval.h"
30 :
31 : #include "types/viewmode.h"
32 : #include "types/zoomtype.h"
33 :
34 : namespace muse::draw {
35 : class Transform;
36 : }
37 :
38 : namespace mu::engraving {
39 : class MscReader;
40 : class MscWriter;
41 : }
42 :
43 : namespace mu::notation {
44 : class NotationPaintView;
45 : class INotationViewState
46 : {
47 : public:
48 0 : virtual ~INotationViewState() = default;
49 :
50 : virtual muse::Ret read(const engraving::MscReader& reader, const muse::io::path_t& pathPrefix = "") = 0;
51 : virtual muse::Ret write(engraving::MscWriter& writer, const muse::io::path_t& pathPrefix = "") = 0;
52 :
53 : virtual bool isMatrixInited() const = 0;
54 : virtual void setMatrixInited(bool inited) = 0;
55 :
56 : virtual const muse::draw::Transform& matrix() const = 0;
57 : virtual muse::async::Channel<muse::draw::Transform /*newMatrix*/, NotationPaintView* /*sender*/> matrixChanged() const = 0;
58 : virtual void setMatrix(const muse::draw::Transform& matrix, NotationPaintView* sender) = 0;
59 :
60 : virtual muse::ValCh<int> zoomPercentage() const = 0;
61 :
62 : virtual muse::ValCh<ZoomType> zoomType() const = 0;
63 : virtual void setZoomType(ZoomType type) = 0;
64 :
65 : virtual ViewMode viewMode() const = 0;
66 : virtual void setViewMode(const ViewMode& mode) = 0;
67 :
68 : // Style dialog
69 : virtual int styleDialogLastPageIndex() const = 0;
70 : virtual void setStyleDialogLastPageIndex(int value) = 0;
71 : virtual int styleDialogLastSubPageIndex() const = 0;
72 : virtual void setStyleDialogLastSubPageIndex(int value) = 0;
73 :
74 : virtual muse::async::Notification stateChanged() const = 0;
75 :
76 : virtual void makeDefault() = 0;
77 : };
78 :
79 : using INotationViewStatePtr = std::shared_ptr<INotationViewState>;
80 : }
|