Skip to content

Commit

Permalink
actualization engraving accssesibility
Browse files Browse the repository at this point in the history
  • Loading branch information
igorkorsukov authored and vpereverzev committed Aug 24, 2021
1 parent 054d676 commit 68c72ef
Show file tree
Hide file tree
Showing 14 changed files with 41 additions and 47 deletions.
3 changes: 1 addition & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,7 @@ option(BUILD_AUTOBOT_MODULE "Build autobot module" OFF)
option(BUILD_MULTIINSTANCES_MODULE "Build multiinstances module" ON)
set(YOUTUBE_API_KEY "" CACHE STRING "YouTube API key")

option(USE_SCORE_ACCESSIBLE_TREE "Use score accessible tree" OFF)

option(ENGRAVING_BUILD_ACCESSIBLE_TREE "Build score accessible tree" 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
2 changes: 1 addition & 1 deletion build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
#cmakedefine BUILD_MULTIINSTANCES_MODULE
#cmakedefine BUILD_VST

#cmakedefine USE_SCORE_ACCESSIBLE_TREE
#cmakedefine ENGRAVING_BUILD_ACCESSIBLE_TREE
#cmakedefine ENGRAVING_COMPAT_WRITESTYLE_302
#cmakedefine ENGRAVING_COMPAT_WRITEEXCERPTS_302

Expand Down
2 changes: 1 addition & 1 deletion sandbox/engraving/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@
#define BUILD_MULTIINSTANCES_MODULE
#define BUILD_VST

/* #undef USE_SCORE_ACCESSIBLE_TREE */
/* #undef ENGRAVING_BUILD_ACCESSIBLE_TREE */

/* #undef SPARKLE_ENABLED */
/* #undef OPENGL */
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/accessibility/accessibleelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#include "accessiblescore.h"
#include "log.h"

using namespace mu::score;
using namespace mu::engraving;
using namespace mu::accessibility;

AccessibleElement::AccessibleElement(Ms::Element* e)
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/accessibility/accessibleelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_SCORE_ACCESSIBLEELEMENT_H
#define MU_SCORE_ACCESSIBLEELEMENT_H
#ifndef MU_ENGRAVING_ACCESSIBLEELEMENT_H
#define MU_ENGRAVING_ACCESSIBLEELEMENT_H

#include "accessibility/iaccessible.h"
#include "async/asyncable.h"
Expand All @@ -29,7 +29,7 @@

//! NOTE At the moment this is just a concept, not a production-ready system, a lot of work yet.

namespace mu::score {
namespace mu::engraving {
class AccessibleScore;
class AccessibleElement : public accessibility::IAccessible, public async::Asyncable
{
Expand Down Expand Up @@ -69,4 +69,4 @@ class AccessibleElement : public accessibility::IAccessible, public async::Async
};
}

#endif // MU_SCORE_ACCESSIBLEELEMENT_H
#endif // MU_ENGRAVING_ACCESSIBLEELEMENT_H
2 changes: 1 addition & 1 deletion src/engraving/accessibility/accessiblenote.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "log.h"

using namespace mu::score;
using namespace mu::engraving;
using namespace mu::accessibility;

AccessibleNote::AccessibleNote(Ms::Element* n)
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/accessibility/accessiblenote.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_SCORE_ACCESSIBLENOTE_H
#define MU_SCORE_ACCESSIBLENOTE_H
#ifndef MU_ENGRAVING_ACCESSIBLENOTE_H
#define MU_ENGRAVING_ACCESSIBLENOTE_H

#include "accessibleelement.h"
#include "libmscore/note.h"

//! NOTE Just for example
namespace mu::score {
namespace mu::engraving {
class AccessibleNote : public AccessibleElement
{
public:
Expand All @@ -37,4 +37,4 @@ class AccessibleNote : public AccessibleElement
};
}

#endif // MU_SCORE_ACCESSIBLENOTE_H
#endif // MU_ENGRAVING_ACCESSIBLENOTE_H
2 changes: 1 addition & 1 deletion src/engraving/accessibility/accessiblescore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "log.h"

using namespace mu::score;
using namespace mu::engraving;
using namespace mu::accessibility;

AccessibleScore::AccessibleScore(Ms::Score* score)
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/accessibility/accessiblescore.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_SCORE_ACCESSIBLESCORE_H
#define MU_SCORE_ACCESSIBLESCORE_H
#ifndef MU_ENGRAVING_ACCESSIBLESCORE_H
#define MU_ENGRAVING_ACCESSIBLESCORE_H

#include "modularity/ioc.h"
#include "accessibility/iaccessible.h"
Expand All @@ -29,7 +29,7 @@
#include "accessibleelement.h"
#include "libmscore/masterscore.h"

namespace mu::score {
namespace mu::engraving {
class AccessibleScore : public accessibility::IAccessible
{
INJECT(score, accessibility::IAccessibilityController, accessibilityController)
Expand Down Expand Up @@ -70,4 +70,4 @@ class AccessibleScore : public accessibility::IAccessible
};
}

#endif // MU_SCORE_ACCESSIBLESCORE_H
#endif // MU_ENGRAVING_ACCESSIBLESCORE_H
16 changes: 8 additions & 8 deletions src/engraving/libmscore/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@

#include "config.h"

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
#include "accessibility/accessibleelement.h"
#endif

Expand Down Expand Up @@ -211,7 +211,7 @@ QString Element::subtypeName() const
// Element
//---------------------------------------------------------

Element::Element(Score* s, ElementFlags f, mu::score::AccessibleElement* access)
Element::Element(Score* s, ElementFlags f, mu::engraving::AccessibleElement* access)
: ScoreElement(s)
{
_flags = f;
Expand All @@ -223,10 +223,10 @@ Element::Element(Score* s, ElementFlags f, mu::score::AccessibleElement* access)
_offsetChanged = OffsetChange::NONE;
_minDistance = Spatium(0.0);

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
m_accessible = access;
if (!m_accessible) {
m_accessible = new mu::score::AccessibleElement();
m_accessible = new mu::engraving::AccessibleElement();
}
m_accessible->setElement(this);
#else
Expand All @@ -252,7 +252,7 @@ Element::Element(const Element& e)
_minDistance = e._minDistance;
itemDiscovered = false;

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
m_accessible = e.m_accessible->clone(this);
#endif
}
Expand All @@ -263,7 +263,7 @@ Element::Element(const Element& e)

Element::~Element()
{
#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
delete m_accessible;
#endif
Score::onElementDestruction(this);
Expand Down Expand Up @@ -2003,7 +2003,7 @@ Element* Element::prevSegmentElement()
return score()->firstElement();
}

mu::score::AccessibleElement* Element::accessible() const
mu::engraving::AccessibleElement* Element::accessible() const
{
return m_accessible;
}
Expand Down Expand Up @@ -2689,7 +2689,7 @@ bool Element::selected() const
void Element::setSelected(bool f)
{
setFlag(ElementFlag::SELECTED, f);
#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
if (f) {
m_accessible->focused();
}
Expand Down
10 changes: 4 additions & 6 deletions src/engraving/libmscore/element.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,9 @@
#include "modularity/ioc.h"
#include "iengravingconfiguration.h"

namespace mu {
namespace score {
namespace mu::engraving {
class AccessibleElement;
}
}

namespace Ms {
#ifdef Q_OS_MAC
Expand Down Expand Up @@ -201,7 +199,7 @@ class Element : public ScoreElement
///< valid after call to layout()
uint _tag; ///< tag bitmask

mu::score::AccessibleElement* m_accessible = nullptr;
mu::engraving::AccessibleElement* m_accessible = nullptr;

public:
enum class EditBehavior {
Expand All @@ -214,7 +212,7 @@ class Element : public ScoreElement
mu::draw::Color _color; ///< element color attribute

public:
Element(Score* = 0, ElementFlags = ElementFlag::NOTHING, mu::score::AccessibleElement* access = nullptr);
Element(Score* = 0, ElementFlags = ElementFlag::NOTHING, mu::engraving::AccessibleElement* access = nullptr);
Element(const Element&);
virtual ~Element();

Expand Down Expand Up @@ -554,7 +552,7 @@ class Element : public ScoreElement
virtual Element* nextSegmentElement(); //< Used for navigation
virtual Element* prevSegmentElement(); //< next-element and prev-element command

mu::score::AccessibleElement* accessible() const;
mu::engraving::AccessibleElement* accessible() const;
virtual QString accessibleInfo() const; //< used to populate the status bar
virtual QString screenReaderInfo() const //< by default returns accessibleInfo, but can be overridden
{
Expand Down
6 changes: 3 additions & 3 deletions src/engraving/libmscore/note.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@
#include "log.h"
#include "config.h"

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
#include "accessibility/accessiblenote.h"
#endif

Expand Down Expand Up @@ -688,8 +688,8 @@ NoteHead::Group NoteHead::headGroup() const

Note::Note(Score* s)
: Element(s, ElementFlag::MOVABLE
#ifdef USE_SCORE_ACCESSIBLE_TREE
, new mu::score::AccessibleNote())
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
, new mu::engraving::AccessibleNote())
#else
)
#endif
Expand Down
10 changes: 5 additions & 5 deletions src/engraving/libmscore/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@

#include "config.h"

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
#include "accessibility/accessiblescore.h"
#endif

Expand Down Expand Up @@ -327,8 +327,8 @@ Score::Score()
// accInfo = tr("No selection"); // ??
accInfo = "No selection";

#ifdef USE_SCORE_ACCESSIBLE_TREE
m_accessible = new mu::score::AccessibleScore(this);
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
m_accessible = new mu::engraving::AccessibleScore(this);
#endif
}

Expand Down Expand Up @@ -415,7 +415,7 @@ Score::~Score()

imageStore.clearUnused();

#ifdef USE_SCORE_ACCESSIBLE_TREE
#ifdef ENGRAVING_BUILD_ACCESSIBLE_TREE
delete m_accessible;
#endif
}
Expand Down Expand Up @@ -5152,7 +5152,7 @@ void Score::connectTies(bool silent)
}
}

mu::score::AccessibleScore* Score::accessible() const
mu::engraving::AccessibleScore* Score::accessible() const
{
return m_accessible;
}
Expand Down
9 changes: 3 additions & 6 deletions src/engraving/libmscore/score.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace mu::engraving {
class EngravingProject;
class LayoutContext;
class LayoutMeasure;
class AccessibleScore;
}

namespace mu::engraving::compat {
Expand All @@ -66,10 +67,6 @@ class WriteScoreHook;
class Read302;
}

namespace mu::score {
class AccessibleScore;
}

namespace Ms {
namespace Avs {
class AvsOmr;
Expand Down Expand Up @@ -510,7 +507,7 @@ class Score : public QObject, public ScoreElement
QString accInfo; ///< information about selected element(s) for use by screen-readers
QString accMessage; ///< temporary status message for use by screen-readers

mu::score::AccessibleScore* m_accessible = nullptr;
mu::engraving::AccessibleScore* m_accessible = nullptr;

mu::engraving::Layout m_layout;
mu::engraving::LayoutOptions m_layoutOptions;
Expand Down Expand Up @@ -1243,7 +1240,7 @@ class Score : public QObject, public ScoreElement
Measure* firstTrailingMeasure(ChordRest** cr = nullptr);
ChordRest* cmdTopStaff(ChordRest* cr = nullptr);

mu::score::AccessibleScore* accessible() const;
mu::engraving::AccessibleScore* accessible() const;
void setAccessibleInfo(QString s) { accInfo = s.remove(":").remove(";"); }
QString accessibleInfo() const { return accInfo; }

Expand Down

0 comments on commit 68c72ef

Please sign in to comment.