LCOV - code coverage report
Current view: top level - src/engraving/editing - editstaffbrackets.h Coverage Total Hit
Test: filtered_coverage.info Lines: 80.0 % 10 8
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/staff.h"
      28              : 
      29              : namespace mu::engraving {
      30              : class Score;
      31              : class Transaction;
      32              : 
      33              : class EditStaffBrackets
      34              : {
      35              : public:
      36              :     static void undoAddBracket(Score* score, Staff* staff, size_t level, BracketType type, size_t span);
      37              :     static void undoRemoveBracket(Score* score, Bracket* bracket);
      38              : 
      39              :     static void fillBrackets(Score* score, staff_idx_t staffIdx, size_t idx);
      40              :     static void cleanBrackets(Score* score, staff_idx_t staffIdx);
      41              : 
      42              :     static void adjustBracketsDel(Score* score, size_t sidx, size_t eidx);
      43              :     static void adjustBracketsIns(Score* score, size_t sidx, size_t eidx);
      44              : 
      45              :     static void setBracketType(Score* score, staff_idx_t staffIdx, size_t idx, BracketType val);
      46              :     static void setBracketSpan(Score* score, staff_idx_t staffIdx, size_t idx, size_t val);
      47              :     static void setBracketVisible(Score* score, staff_idx_t staffIdx, size_t idx, bool v);
      48              :     static void changeBracketColumn(Score* score, staff_idx_t staffIdx, size_t oldColumn, size_t newColumn);
      49              :     static void addBracket(Score* score, staff_idx_t staffIdx, BracketItem*);
      50              :     static void insertBracket(Score* score, staff_idx_t staffIdx, BracketItem* b);
      51              : };
      52              : 
      53              : class RemoveBracket : public UndoableCommand
      54              : {
      55           77 :     OBJECT_ALLOCATOR(engraving, RemoveBracket)
      56              : 
      57              :     Staff* staff = nullptr;
      58              :     size_t level = 0;
      59              :     BracketType bracketType = BracketType::NORMAL;
      60              :     size_t span = 0;
      61              : 
      62              :     void undo() override;
      63              :     void redo() override;
      64              : 
      65              : public:
      66           42 :     RemoveBracket(Staff* s, size_t l, BracketType t, size_t sp)
      67           42 :         : staff(s), level(l), bracketType(t), span(sp) {}
      68              : 
      69           71 :     UNDO_TYPE(CommandType::RemoveBracket)
      70            0 :     UNDO_NAME("RemoveBracket")
      71              : };
      72              : 
      73              : class AddBracket : public UndoableCommand
      74              : {
      75          124 :     OBJECT_ALLOCATOR(engraving, AddBracket)
      76              : 
      77              :     Staff* staff = nullptr;
      78              :     size_t level = 0;
      79              :     BracketType bracketType = BracketType::NORMAL;
      80              :     size_t span = 0;
      81              : 
      82              :     void undo() override;
      83              :     void redo() override;
      84              : 
      85              : public:
      86           66 :     AddBracket(Staff* s, size_t l, BracketType t, size_t sp)
      87           66 :         : staff(s), level(l), bracketType(t), span(sp) {}
      88              : 
      89          109 :     UNDO_TYPE(CommandType::AddBracket)
      90            0 :     UNDO_NAME("AddBracket")
      91              : };
      92              : }
        

Generated by: LCOV version 2.0-1