Skip to content

Commit

Permalink
Init adjustyrelfortranscriptionfunction
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Apr 3, 2024
1 parent 6066bb2 commit e73ba54
Show file tree
Hide file tree
Showing 6 changed files with 97 additions and 1 deletion.
1 change: 1 addition & 0 deletions bindings/iOS/all.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#import <VerovioFramework/adjustxposfunctor.h>
#import <VerovioFramework/adjustxrelfortranscriptionfunctor.h>
#import <VerovioFramework/adjustyposfunctor.h>
#import <VerovioFramework/adjustyrelfortranscriptionfunctor.h>
#import <VerovioFramework/alignfunctor.h>
#import <VerovioFramework/altsyminterface.h>
#import <VerovioFramework/anchoredtext.h>
Expand Down
56 changes: 56 additions & 0 deletions include/vrv/adjustyrelfortranscriptionfunctor.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: adjustyrelfortranscriptionfunctor.h
// Author: Yinan Zhou
// Created: 2024
// Copyright (c) Authors and others. All rights reserved.
/////////////////////////////////////////////////////////////////////////////

#ifndef __VRV_ADJUSTYRELFORTRANSCRIPTIONFUNCTOR_H__
#define __VRV_ADJUSTYRELFORTRANSCRIPTIONFUNCTOR_H__

#include "functor.h"

namespace vrv {

//----------------------------------------------------------------------------
// AdjustYRelForTranscriptionFunctor
//----------------------------------------------------------------------------

/**
* This class adjusts the YRel positions taking into account the bounding boxes.
*/
class AdjustYRelForTranscriptionFunctor : public Functor {
public:
/**
* @name Constructors, destructors
*/
///@{
AdjustYRelForTranscriptionFunctor();
virtual ~AdjustYRelForTranscriptionFunctor() = default;
///@}

/*
* Abstract base implementation
*/
bool ImplementsEndInterface() const override { return false; }

/*
* Functor interface
*/
///@{
FunctorCode VisitLayerElement(LayerElement *layerElement) override;
///@}

protected:
//
private:
//
public:
//
private:
//
};

} // namespace vrv

#endif // __VRV_ADJUSTYRELFORTRANSCRIPTIONFUNCTOR_H__
1 change: 0 additions & 1 deletion src/adjustxrelfortranscriptionfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ FunctorCode AdjustXRelForTranscriptionFunctor::VisitLayerElement(LayerElement *l
if (!layerElement->HasSelfBB()) return FUNCTOR_CONTINUE;

layerElement->SetDrawingXRel(-layerElement->GetSelfX1());
layerElement->SetDrawingYRel(-layerElement->GetSelfY1());

return FUNCTOR_CONTINUE;
}
Expand Down
35 changes: 35 additions & 0 deletions src/adjustyrelfortranscriptionfunctor.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
/////////////////////////////////////////////////////////////////////////////
// Name: adjustyrelfortranscriptionfunctor.cpp
// Author: Yinan Zhou
// Created: 2024
// Copyright (c) Authors and others. All rights reserved.
/////////////////////////////////////////////////////////////////////////////

#include "adjustyrelfortranscriptionfunctor.h"

//----------------------------------------------------------------------------

//----------------------------------------------------------------------------

namespace vrv {

//----------------------------------------------------------------------------
// AdjustYRelForTranscriptionFunctor
//----------------------------------------------------------------------------

AdjustYRelForTranscriptionFunctor::AdjustYRelForTranscriptionFunctor() : Functor() {}

FunctorCode AdjustYRelForTranscriptionFunctor::VisitLayerElement(LayerElement *layerElement)
{
if (layerElement->m_drawingFacsY == VRV_UNSET) return FUNCTOR_CONTINUE;

if (layerElement->IsScoreDefElement()) return FUNCTOR_SIBLINGS;

if (!layerElement->HasSelfBB()) return FUNCTOR_CONTINUE;

layerElement->SetDrawingYRel(-layerElement->GetSelfY1());

return FUNCTOR_CONTINUE;
}

} // namespace vrv
1 change: 1 addition & 0 deletions src/layerelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,7 @@ void LayerElement::Reset()
this->ResetLabelled();
this->ResetTyped();

m_drawingFacsY = VRV_UNSET;
m_drawingFacsX = VRV_UNSET;
m_drawingYRel = 0;
m_drawingXRel = 0;
Expand Down
4 changes: 4 additions & 0 deletions src/page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#include "adjustxposfunctor.h"
#include "adjustxrelfortranscriptionfunctor.h"
#include "adjustyposfunctor.h"
#include "adjustyrelfortranscriptionfunctor.h"
#include "alignfunctor.h"
#include "bboxdevicecontext.h"
#include "cachehorizontallayoutfunctor.h"
Expand Down Expand Up @@ -271,6 +272,9 @@ void Page::LayOutTranscription(bool force)
AdjustXRelForTranscriptionFunctor adjustXRelForTranscription;
this->Process(adjustXRelForTranscription);

AdjustYRelForTranscriptionFunctor adjustYRelForTranscription;
this->Process(adjustYRelForTranscription);

CalcLedgerLinesFunctor calcLedgerLines(doc);
this->Process(calcLedgerLines);

Expand Down

0 comments on commit e73ba54

Please sign in to comment.