LCOV - code coverage report
Current view: top level - src/engraving/editing - editexcerpt.h Coverage Total Hit
Test: filtered_coverage.info Lines: 15.8 % 19 3
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 "transaction/undoablecommand.h"
      26              : 
      27              : #include "../dom/excerpt.h"
      28              : #include "../dom/masterscore.h"
      29              : #include "../dom/part.h"
      30              : 
      31              : namespace mu::engraving {
      32              : class AddExcerpt : public UndoableCommand
      33              : {
      34            2 :     OBJECT_ALLOCATOR(engraving, AddExcerpt)
      35              : 
      36              :     Excerpt* excerpt = nullptr;
      37              :     bool deleteExcerpt = false;
      38              : 
      39              : public:
      40              :     AddExcerpt(Excerpt* ex);
      41              :     ~AddExcerpt() override;
      42              : 
      43              :     void undo() override;
      44              :     void redo() override;
      45              : 
      46              :     std::vector<EngravingObject*> objectItems() const override;
      47              : 
      48            2 :     UNDO_TYPE(CommandType::AddExcerpt)
      49            0 :     UNDO_NAME("AddExcerpt")
      50              : };
      51              : 
      52              : class RemoveExcerpt : public UndoableCommand
      53              : {
      54            2 :     OBJECT_ALLOCATOR(engraving, RemoveExcerpt)
      55              : 
      56              :     Excerpt* excerpt = nullptr;
      57              :     size_t index = muse::nidx;
      58              :     bool deleteExcerpt = false;
      59              : 
      60              : public:
      61              :     RemoveExcerpt(Excerpt* ex);
      62              :     ~RemoveExcerpt() override;
      63              : 
      64              :     void undo() override;
      65              :     void redo() override;
      66              : 
      67              :     std::vector<EngravingObject*> objectItems() const override;
      68              : 
      69            0 :     UNDO_TYPE(CommandType::RemoveExcerpt)
      70            0 :     UNDO_NAME("RemoveExcerpt")
      71              : };
      72              : 
      73              : class SwapExcerpt : public UndoableCommand
      74              : {
      75            0 :     OBJECT_ALLOCATOR(engraving, SwapExcerpt)
      76              : 
      77              :     MasterScore* score = nullptr;
      78              :     int pos1 = 0;
      79              :     int pos2 = 0;
      80              : 
      81              :     void flip() override;
      82              : 
      83              : public:
      84              :     SwapExcerpt(MasterScore* s, int p1, int p2)
      85              :         : score(s), pos1(p1), pos2(p2) {}
      86              : 
      87            0 :     UNDO_TYPE(CommandType::SwapExcerpt)
      88            0 :     UNDO_NAME("SwapExcerpt")
      89            0 :     UNDO_CHANGED_OBJECTS({ score })
      90              : };
      91              : 
      92              : class ChangeExcerptTitle : public UndoableCommand
      93              : {
      94            0 :     OBJECT_ALLOCATOR(engraving, ChangeExcerptTitle)
      95              : 
      96              :     Excerpt* excerpt = nullptr;
      97              :     String title;
      98              : 
      99              :     void flip() override;
     100              : 
     101              : public:
     102            0 :     ChangeExcerptTitle(Excerpt* x, const String& t)
     103            0 :         : excerpt(x), title(t) {}
     104              : 
     105            0 :     UNDO_TYPE(CommandType::ChangeExcerptTitle)
     106            0 :     UNDO_NAME("ChangeExcerptTitle")
     107              : };
     108              : 
     109              : class AddPartToExcerpt : public UndoableCommand
     110              : {
     111            0 :     OBJECT_ALLOCATOR(engraving, AddPartToExcerpt)
     112              : 
     113              :     Excerpt* m_excerpt = nullptr;
     114              :     Part* m_part = nullptr;
     115              :     size_t m_targetPartIdx = 0;
     116              : 
     117              : public:
     118              :     AddPartToExcerpt(Excerpt* e, Part* p, size_t targetPartIdx);
     119              :     void undo() override;
     120              :     void redo() override;
     121              :     void cleanup(bool wasDone) override;
     122              : 
     123            0 :     UNDO_TYPE(CommandType::AddPartToExcerpt)
     124            0 :     UNDO_NAME("AddPartToExcerpt")
     125            0 :     UNDO_CHANGED_OBJECTS({ m_part })
     126              : };
     127              : }
        

Generated by: LCOV version 2.0-1