LCOV - code coverage report
Current view: top level - src/engraving/editing - editstyle.h Coverage Total Hit
Test: filtered_coverage.info Lines: 81.8 % 11 9
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) 2025 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 "global/io/iodevice.h"
      26              : 
      27              : #include "transaction/undoablecommand.h"
      28              : 
      29              : #include "../dom/score.h"
      30              : 
      31              : namespace mu::engraving {
      32              : class Transaction;
      33              : 
      34              : class ChangeStyle : public UndoableCommand
      35              : {
      36            2 :     OBJECT_ALLOCATOR(engraving, ChangeStyle)
      37              : 
      38              :     Score* score = nullptr;
      39              :     MStyle style;
      40              :     bool overlap = false;
      41              : 
      42              :     void flip() override;
      43              :     void undo() override;
      44              : 
      45              : public:
      46              :     ChangeStyle(Score*, const MStyle&, const bool overlapOnly = false);
      47              : 
      48              :     StyleIdSet changedIds() const;
      49              : 
      50            1 :     UNDO_TYPE(CommandType::ChangeStyle)
      51            0 :     UNDO_NAME("ChangeStyle")
      52            3 :     UNDO_CHANGED_OBJECTS({ score })
      53              : };
      54              : 
      55              : class ChangeStyleValues : public UndoableCommand
      56              : {
      57          245 :     OBJECT_ALLOCATOR(engraving, ChangeStyleValues)
      58              : 
      59              : public:
      60          127 :     ChangeStyleValues(Score* s, std::unordered_map<Sid, PropertyValue> values)
      61          127 :         : m_score(s), m_values(std::move(values)) {}
      62              : 
      63           56 :     const std::unordered_map<Sid, PropertyValue>& values() const { return m_values; }
      64              : 
      65           56 :     UNDO_TYPE(CommandType::ChangeStyleValues)
      66            0 :     UNDO_NAME("ChangeStyleValues")
      67          168 :     UNDO_CHANGED_OBJECTS({ m_score })
      68              : 
      69              : private:
      70              :     void flip() override;
      71              : 
      72              :     Score* m_score = nullptr;
      73              :     std::unordered_map<Sid, PropertyValue> m_values;
      74              : };
      75              : 
      76              : class EditStyle
      77              : {
      78              : public:
      79              :     static bool loadStyle(Transaction& tx, Score* score, muse::io::IODevice& dev, bool ign = false, bool overlap = false);
      80              : };
      81              : }
        

Generated by: LCOV version 2.0-1