LCOV - code coverage report
Current view: top level - src/engraving/dom - page.h Coverage Total Hit
Test: filtered_coverage.info Lines: 93.3 % 15 14
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              : #pragma once
      24              : 
      25              : #include <array>
      26              : #include <vector>
      27              : 
      28              : #include "bsp.h"
      29              : #include "engravingitem.h"
      30              : #include "mscore.h"
      31              : #include "text.h"
      32              : 
      33              : namespace mu::engraving {
      34              : class Factory;
      35              : class System;
      36              : class Text;
      37              : class Measure;
      38              : class RangeLock;
      39              : 
      40              : class Score;
      41              : class MeasureBase;
      42              : 
      43              : //---------------------------------------------------------
      44              : //   @@ Page
      45              : //   @P pagenumber int (read only)
      46              : //---------------------------------------------------------
      47              : 
      48              : class Page final : public EngravingItem
      49              : {
      50         6866 :     OBJECT_ALLOCATOR(engraving, Page)
      51         1429 :     DECLARE_CLASSOF(ElementType::PAGE)
      52              : 
      53              : public:
      54              :     ~Page() override;
      55              : 
      56            0 :     Page* clone() const override { return new Page(*this); }
      57              : 
      58              :     //! A page is owned by its score. This overload hides EngravingItem::setOwnershipParent,
      59              :     //! so that no other parent can be set by accident.
      60              :     void setOwnershipParent(Score* score);
      61              : 
      62              :     EngravingItem* layoutParent() const override;
      63              :     EngravingItem* accessibleParentItem() const override;
      64              : 
      65        14020 :     const std::vector<System*>& systems() const { return m_systems; }
      66        82101 :     std::vector<System*>& systems() { return m_systems; }
      67          514 :     System* system(size_t idx) { return m_systems[idx]; }
      68         1186 :     const System* system(size_t idx) const { return m_systems.at(idx); }
      69              : 
      70              :     MeasureBase* firstMeasureBase() const;
      71              :     MeasureBase* lastMeasureBase() const;
      72              : 
      73              :     void appendSystem(System* s);
      74              : 
      75        20700 :     page_idx_t pageNumber() const { return m_pageNumber; }
      76         4161 :     void setPageNumber(page_idx_t n) { m_pageNumber = n; }
      77              :     int getDisplayPageNumber() const;
      78              :     bool isOdd() const;
      79              :     double tm() const;              // margins in pixel
      80              :     double bm() const;
      81              :     double lm() const;
      82              :     double rm() const;
      83              : 
      84              :     void scanElements(std::function<void(EngravingItem*)> func) override;
      85              :     EngravingItemList accessibleChildren() const override;
      86              : 
      87              :     std::vector<EngravingItem*> items(const RectF& r);
      88              :     std::vector<EngravingItem*> items(const PointF& p);
      89         4135 :     void invalidateBspTree() { m_bspTreeValid = false; }
      90           33 :     PointF pagePos() const override { return PointF(); }       ///< position in page coordinates
      91              :     std::vector<EngravingItem*> elements() const;              ///< list of visible elements
      92              :     RectF tbbox() const;                             // tight bounding box, excluding white space
      93              :     Fraction endTick() const;
      94              :     Measure* firstMeasure() const;
      95              : 
      96        12877 :     Text* headerText(int index) const { return m_headerTexts.at(index); }
      97        29824 :     Text* footerText(int index) const { return m_footerTexts.at(index); }
      98          164 :     void setHeaderText(int index, Text* t) { m_headerTexts.at(index) = t; }
      99        10146 :     void setFooterText(int index, Text* t) { m_footerTexts.at(index) = t; }
     100              : 
     101              :     bool isLocked() const;
     102              :     const RangeLock* pageLock() const;
     103              : 
     104              : #ifndef ENGRAVING_NO_ACCESSIBILITY
     105              :     AccessibleItemPtr createAccessible() override;
     106              : #endif
     107              : 
     108              : private:
     109              :     friend class Factory;
     110              :     Page(Score* parent);
     111              : 
     112              :     void doRebuildBspTree();
     113              : 
     114              :     std::vector<System*> m_systems;
     115              :     page_idx_t m_pageNumber = 0;
     116              : 
     117              :     std::array<Text*, MAX_HEADERS> m_headerTexts {};
     118              :     std::array<Text*, MAX_FOOTERS> m_footerTexts {};
     119              : 
     120              :     BspTree bspTree;
     121              :     bool m_bspTreeValid = false;
     122              : };
     123              : }
        

Generated by: LCOV version 2.0-1