LCOV - code coverage report
Current view: top level - src/notationscene/qml/MuseScore/NotationScene - notationpaintview.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 31 0
Test Date: 2026-11-05 04:07:02

            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              : #include "notationpaintview.h"
      24              : 
      25              : #include "notation/inotationviewstate.h"
      26              : 
      27              : using namespace mu;
      28              : using namespace muse::draw;
      29              : using namespace mu::notation;
      30              : 
      31            0 : NotationPaintView::NotationPaintView(QQuickItem* parent)
      32            0 :     : AbstractNotationPaintView(parent)
      33              : {
      34            0 : }
      35              : 
      36            0 : void NotationPaintView::onLoadNotation(INotationPtr notation)
      37              : {
      38            0 :     m_isLocalMatrixUpdate = true;
      39            0 :     setMatrix(notation->viewState()->matrix());
      40            0 :     m_isLocalMatrixUpdate = false;
      41              : 
      42            0 :     notation->viewState()->matrixChanged().onReceive(this, [this](const Transform& matrix, NotationPaintView* sender) {
      43            0 :         if (sender != this) {
      44            0 :             m_isLocalMatrixUpdate = true;
      45            0 :             setMatrix(matrix);
      46            0 :             m_isLocalMatrixUpdate = false;
      47              :         }
      48            0 :     });
      49              : 
      50            0 :     AbstractNotationPaintView::onLoadNotation(notation);
      51            0 : }
      52              : 
      53            0 : void NotationPaintView::onUnloadNotation(INotationPtr notation)
      54              : {
      55            0 :     AbstractNotationPaintView::onUnloadNotation(notation);
      56              : 
      57            0 :     notation->viewState()->matrixChanged().disconnect(this);
      58            0 : }
      59              : 
      60            0 : void NotationPaintView::initZoomAndPosition()
      61              : {
      62            0 :     if (notation() && !notation()->viewState()->isMatrixInited()) {
      63            0 :         inputController()->initZoom();
      64            0 :         inputController()->initCanvasPos();
      65              :     }
      66            0 : }
      67              : 
      68            0 : void NotationPaintView::onMatrixChanged(const Transform& oldMatrix, const Transform& newMatrix, bool overrideZoomType)
      69              : {
      70            0 :     AbstractNotationPaintView::onMatrixChanged(oldMatrix, newMatrix, overrideZoomType);
      71              : 
      72            0 :     if (!m_isLocalMatrixUpdate && notation()) {
      73            0 :         notation()->viewState()->setMatrix(newMatrix, this);
      74              : 
      75            0 :         if (overrideZoomType) {
      76            0 :             notation()->viewState()->setZoomType(ZoomType::Percentage);
      77              :         }
      78              :     }
      79            0 : }
        

Generated by: LCOV version 2.0-1