LCOV - code coverage report
Current view: top level - src/engraving/dom - parenthesis.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 75.0 % 40 30
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) 2024 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 "parenthesis.h"
      24              : 
      25              : #include "segment.h"
      26              : #include "types/typesconv.h"
      27              : 
      28              : using namespace mu::engraving;
      29              : 
      30          506 : Parenthesis::Parenthesis(DummyParentOr<EngravingItem> parent)
      31          506 :     : EngravingItem(ElementType::PARENTHESIS, parent, ElementFlag::MOVABLE)
      32              : {
      33          506 : }
      34              : 
      35           22 : Parenthesis::Parenthesis(const Parenthesis& p)
      36           22 :     : EngravingItem(p)
      37              : {
      38           22 :     _direction = p._direction;
      39           22 : }
      40              : 
      41         3058 : PropertyValue Parenthesis::getProperty(Pid pid) const
      42              : {
      43         3058 :     switch (pid) {
      44          300 :     case Pid::HORIZONTAL_DIRECTION:
      45          300 :         return direction();
      46         2758 :     default:
      47         2758 :         return EngravingItem::getProperty(pid);
      48              :     }
      49              : }
      50              : 
      51           20 : bool Parenthesis::setProperty(Pid pid, const PropertyValue& v)
      52              : {
      53           20 :     switch (pid) {
      54           10 :     case Pid::HORIZONTAL_DIRECTION:
      55           10 :         setDirection(v.value<DirectionH>());
      56           10 :         break;
      57           10 :     default:
      58           10 :         return EngravingItem::setProperty(pid, v);
      59              :     }
      60              : 
      61           10 :     return true;
      62              : }
      63              : 
      64         3006 : PropertyValue Parenthesis::propertyDefault(Pid pid) const
      65              : {
      66         3006 :     switch (pid) {
      67          300 :     case Pid::HORIZONTAL_DIRECTION:
      68          300 :         return DirectionH::LEFT;
      69         2706 :     default:
      70         2706 :         return EngravingItem::propertyDefault(pid);
      71              :     }
      72              : }
      73              : 
      74            0 : String Parenthesis::accessibleInfo() const
      75              : {
      76            0 :     return String(u"%1: %2").arg(EngravingItem::accessibleInfo(), TConv::translatedUserName(direction()));
      77              : }
      78              : 
      79            0 : bool Parenthesis::followParentCurColor() const
      80              : {
      81            0 :     return m_followParentColor;
      82              : }
      83              : 
      84           64 : void Parenthesis::setFollowParentColor(bool val)
      85              : {
      86           64 :     m_followParentColor = val;
      87           64 : }
      88              : 
      89            0 : Color Parenthesis::curColor(const rendering::PaintOptions& opt) const
      90              : {
      91            0 :     if (m_followParentColor) {
      92            0 :         return layoutParent()->curColor(opt);
      93              :     }
      94              : 
      95            0 :     return EngravingItem::curColor(getProperty(Pid::VISIBLE).toBool(),
      96            0 :                                    getProperty(Pid::COLOR).value<Color>(),
      97            0 :                                    opt);
      98              : }
        

Generated by: LCOV version 2.0-1