Skip to content

Commit

Permalink
added ENGRAVING_PAINT_DEBUGGER_ENABLED cmake option
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov committed Sep 6, 2021
1 parent 0268999 commit 8b7313a
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 8 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ option(BUILD_DIAGNOSTICS "Build diagnostic code" ON)
set(YOUTUBE_API_KEY "" CACHE STRING "YouTube API key")

option(ENGRAVING_BUILD_ACCESSIBLE_TREE "Build score accessible tree" OFF)
option(ENGRAVING_PAINT_DEBUGGER_ENABLED "Enable diagnostic engraving paint debugger" OFF)
# Temporary flags for MU3 compatibility to make testing easier.
option(ENGRAVING_COMPAT_WRITESTYLE_302 "Write style to score xml file" ON)
option(ENGRAVING_COMPAT_WRITEEXCERPTS_302 "Write excerpts to score xml file" ON)
Expand Down
1 change: 1 addition & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
#cmakedefine BUILD_DIAGNOSTICS

#cmakedefine ENGRAVING_BUILD_ACCESSIBLE_TREE
#cmakedefine ENGRAVING_PAINT_DEBUGGER_ENABLED
#cmakedefine ENGRAVING_COMPAT_WRITESTYLE_302
#cmakedefine ENGRAVING_COMPAT_WRITEEXCERPTS_302

Expand Down
7 changes: 5 additions & 2 deletions src/engraving/libmscore/engravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,7 @@ EngravingItem::EngravingItem(const EngravingItem& e)
itemDiscovered = false;

#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
//! TODO Please don't remove (igor.korsukov@gmail.com)
//m_accessible = e.m_accessible->clone(this);
#endif
}
Expand All @@ -184,14 +185,16 @@ void EngravingItem::init()
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
m_accessible = createAccessible();
m_accessible->setElement(this);
#else
UNUSED(access);
#endif
}

mu::engraving::AccessibleElement* EngravingItem::createAccessible() const
{
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
return new mu::engraving::AccessibleElement();
#else
return nullptr;
#endif
}

//---------------------------------------------------------
Expand Down
9 changes: 3 additions & 6 deletions src/engraving/paint/paint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,6 @@

#include "log.h"

#define PAINT_DEBUGGER_ENABLED

using namespace mu::engraving;
using namespace mu::accessibility;
using namespace Ms;
Expand Down Expand Up @@ -123,7 +121,9 @@ void Paint::paintPage(mu::draw::Painter& painter, Ms::Page* page, const RectF& r
QList<EngravingItem*> elements = page->items(rect);
paintElements(painter, elements);

#ifdef ENGRAVING_PAINT_DEBUGGER_ENABLED
paintPageDiagnostic(painter, page);
#endif

painter.translate(-pagePosition);
painter.setClipping(false);
Expand Down Expand Up @@ -154,15 +154,12 @@ void Paint::paintChildren(mu::draw::Painter& painter, const std::list<const Ms::
if (el->treeParent() == parent) {
const Ms::EngravingItem* item = Ms::toEngravingItem(el);

#ifdef PAINT_DEBUGGER_ENABLED
initDebugger(painter, item);
#endif

paintElement(painter, item);

#ifdef PAINT_DEBUGGER_ENABLED
deinitDebugger(painter);
#endif

if (elementsProvider()->isSelected(item)) {
static mu::draw::Pen borderPen(DEBUG_ELTREE_SELECTED_COLOR, 4);

Expand Down

0 comments on commit 8b7313a

Please sign in to comment.