LCOV - code coverage report
Current view: top level - src/engraving/dom - mmrestrange.cpp Coverage Total Hit
Test: filtered_coverage.info Lines: 0.0 % 35 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 "mmrestrange.h"
      24              : 
      25              : #include "style/style.h"
      26              : 
      27              : #include "measure.h"
      28              : 
      29              : #include "log.h"
      30              : 
      31              : using namespace mu;
      32              : using namespace mu::engraving;
      33              : 
      34              : namespace mu::engraving {
      35              : //---------------------------------------------------------
      36              : //   mmRestRangeStyle
      37              : //---------------------------------------------------------
      38              : 
      39              : static const ElementStyle mmRestRangeStyle {
      40              :     { Sid::mmRestRangeBracketType, Pid::MMREST_RANGE_BRACKET_TYPE },
      41              :     { Sid::mmRestRangeVPlacement,  Pid::PLACEMENT },
      42              :     { Sid::mmRestRangeHPlacement,  Pid::HPLACEMENT },
      43              :     { Sid::mmRestRangeMinDistance, Pid::MIN_DISTANCE },
      44              :     { Sid::mmRestRangeTextStyle, Pid::TEXT_STYLE }
      45              : };
      46              : 
      47            0 : MMRestRange::MMRestRange(DummyParentOr<Measure> parent)
      48            0 :     : MeasureNumberBase(ElementType::MMREST_RANGE, parent, TextStyleType::MMREST_RANGE)
      49              : {
      50            0 :     initElementStyle(&mmRestRangeStyle);
      51            0 : }
      52              : 
      53              : //---------------------------------------------------------
      54              : //   MMRestRange
      55              : ///   Copy constructor
      56              : //---------------------------------------------------------
      57              : 
      58            0 : MMRestRange::MMRestRange(const MMRestRange& other)
      59            0 :     : MeasureNumberBase(other)
      60              : {
      61            0 :     initElementStyle(&mmRestRangeStyle);
      62            0 : }
      63              : 
      64            0 : PropertyValue MMRestRange::getProperty(Pid id) const
      65              : {
      66            0 :     switch (id) {
      67            0 :     case Pid::MMREST_RANGE_BRACKET_TYPE:
      68            0 :         return int(bracketType());
      69            0 :     default:
      70            0 :         return MeasureNumberBase::getProperty(id);
      71              :     }
      72              : }
      73              : 
      74            0 : bool MMRestRange::setProperty(Pid id, const PropertyValue& val)
      75              : {
      76            0 :     switch (id) {
      77            0 :     case Pid::MMREST_RANGE_BRACKET_TYPE:
      78            0 :         setBracketType(MMRestRangeBracketType(val.toInt()));
      79            0 :         mutldata()->layoutInvalid = true;
      80            0 :         triggerLayout();
      81            0 :         return true;
      82            0 :     default:
      83            0 :         return MeasureNumberBase::setProperty(id, val);
      84              :     }
      85              : }
      86              : 
      87              : //---------------------------------------------------------
      88              : //   setXmlText
      89              : ///   This is reimplemented from TextBase::setXmlText to take care of the brackets
      90              : //---------------------------------------------------------
      91              : 
      92            0 : void MMRestRange::setXmlText(const String& s)
      93              : {
      94            0 :     switch (bracketType()) {
      95            0 :     case MMRestRangeBracketType::BRACKETS:
      96            0 :         TextBase::setXmlText(u"[" + s + u"]");
      97            0 :         break;
      98            0 :     case MMRestRangeBracketType::PARENTHESES:
      99            0 :         TextBase::setXmlText(u"(" + s + u")");
     100            0 :         break;
     101            0 :     case MMRestRangeBracketType::NONE:
     102              :     default:
     103            0 :         TextBase::setXmlText(s);
     104            0 :         break;
     105              :     }
     106            0 : }
     107              : } // namespace MS
        

Generated by: LCOV version 2.0-1