Skip to content

Commit

Permalink
Revert "Merge branch 'develop-facsimile-neume-line' into develop-facs…
Browse files Browse the repository at this point in the history
…imile-neume-line"

This reverts commit f16f670, reversing
changes made to 2823f7b.
  • Loading branch information
lpugin committed May 16, 2024
1 parent f16f670 commit 1ea5a52
Show file tree
Hide file tree
Showing 38 changed files with 657 additions and 448 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ jobs:
compiler: g++
version: "10"

- os: ubuntu-22.04
- os: ubuntu-20.04
compiler: g++
version: "11"

Expand Down
4 changes: 2 additions & 2 deletions Verovio.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -5172,7 +5172,7 @@
"$(inherited)",
NO_HUMDRUM_SUPPORT,
);
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = "";
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "";
};
Expand All @@ -5184,7 +5184,7 @@
CODE_SIGN_IDENTITY = "-";
DEAD_CODE_STRIPPING = YES;
GCC_PREPROCESSOR_DEFINITIONS = NO_HUMDRUM_SUPPORT;
MACOSX_DEPLOYMENT_TARGET = 10.15;
MACOSX_DEPLOYMENT_TARGET = "";
PRODUCT_NAME = "$(TARGET_NAME)";
USER_HEADER_SEARCH_PATHS = "";
};
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__
7 changes: 7 additions & 0 deletions include/vrv/devicecontext.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ class DeviceContext {
m_baseWidth = 0;
m_baseHeight = 0;
m_pushBack = false;
m_viewBoxFactor = (double)DEFINITION_FACTOR;
}
DeviceContext(ClassId classId)
{
Expand All @@ -89,6 +90,7 @@ class DeviceContext {
m_baseWidth = 0;
m_baseHeight = 0;
m_pushBack = false;
m_viewBoxFactor = (double)DEFINITION_FACTOR;
}
virtual ~DeviceContext(){};
ClassId GetClassId() const { return m_classId; }
Expand Down Expand Up @@ -124,12 +126,14 @@ class DeviceContext {
m_baseWidth = width;
m_baseHeight = height;
}
void SetViewBoxFactor(double ppuFactor);
int GetWidth() const { return m_width; }
int GetHeight() const { return m_height; }
int GetContentHeight() const { return m_contentHeight; }
double GetUserScaleX() { return m_userScaleX; }
double GetUserScaleY() { return m_userScaleY; }
std::pair<int, int> GetBaseSize() const { return std::make_pair(m_baseWidth, m_baseHeight); }
double GetViewBoxFactor() const { return m_viewBoxFactor; }
///@}

/**
Expand Down Expand Up @@ -365,6 +369,9 @@ class DeviceContext {
/** stores the scale as requested by the used */
double m_userScaleX;
double m_userScaleY;

/** stores the viewbox factor taking into account the DEFINTION_FACTOR and the PPU */
double m_viewBoxFactor;
};

} // namespace vrv
Expand Down
14 changes: 14 additions & 0 deletions include/vrv/doc.h
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,14 @@ class Doc : public Object {
bool IsMensuralMusicOnly() const { return m_isMensuralMusicOnly; }
///@}

/**
* @name Setter for and getter for neume-line flag
*/
///@{
void SetNeumeLines(bool isNeumeLines) { m_isNeumeLines = isNeumeLines; }
bool IsNeumeLines() const { return m_isNeumeLines; }
///@}

/**
* @name Setter and getter for facsimile
*/
Expand Down Expand Up @@ -660,6 +668,12 @@ class Doc : public Object {
*/
bool m_isMensuralMusicOnly;

/**
* A flag to indicate that the document contains neume lines.
* This is a special document type where neume lines are encoded with <section type="neon-neume-line">
*/
bool m_isNeumeLines;

/** Page width (MEI scoredef@page.width) - currently not saved */
int m_pageWidth;
/** Page height (MEI scoredef@page.height) - currently not saved */
Expand Down
25 changes: 22 additions & 3 deletions include/vrv/editortoolkit_neume.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#include "doc.h"
#include "editortoolkit.h"
#include "measure.h"
#include "view.h"
#include "vrv.h"
#include "zone.h"
Expand Down Expand Up @@ -50,6 +51,8 @@ class EditorToolkitNeume : public EditorToolkit {
bool Set(std::string elementId, std::string attrType, std::string attrValue);
bool SetText(std::string elementId, const std::string &text);
bool SetClef(std::string elementId, std::string shape);
bool SetLiquescent(std::string elementId, std::string shape);
bool SortStaves();
bool Split(std::string elementId, int x);
bool SplitNeume(std::string elementId, std::string ncId);
bool Remove(std::string elementId);
Expand Down Expand Up @@ -80,6 +83,7 @@ class EditorToolkitNeume : public EditorToolkit {
bool ParseSetAction(jsonxx::Object param, std::string *elementId, std::string *attrType, std::string *attrValue);
bool ParseSetTextAction(jsonxx::Object param, std::string *elementId, std::string *text);
bool ParseSetClefAction(jsonxx::Object param, std::string *elementId, std::string *shape);
bool ParseSetLiquescentAction(jsonxx::Object param, std::string *elementId, std::string *shape);
bool ParseSplitAction(jsonxx::Object param, std::string *elementId, int *x);
bool ParseSplitNeumeAction(jsonxx::Object param, std::string *elementId, std::string *ncId);
bool ParseRemoveAction(jsonxx::Object param, std::string *elementId);
Expand Down Expand Up @@ -178,11 +182,26 @@ struct ClosestNeume {
struct StaffSort {
// Sort staves left-to-right and top-to-bottom
// Sort by y if there is no intersection, by x if there is x intersection is smaller than half length of staff line

// Update 2024-04:
// Used only in neume lines,
// System->(Measure->Staff)
// Need to sort Measure to sort staff
bool operator()(Object *a, Object *b)
{
if (!a->GetFacsimileInterface() || !b->GetFacsimileInterface()) return true;
Zone *zoneA = a->GetFacsimileInterface()->GetZone();
Zone *zoneB = b->GetFacsimileInterface()->GetZone();
if (!a->Is(SYSTEM) || !b->Is(SYSTEM)) return false;
if (!a->FindDescendantByType(MEASURE) || !b->FindDescendantByType(MEASURE)) return false;
Measure *measureA = dynamic_cast<Measure *>(a->FindDescendantByType(MEASURE));
Measure *measureB = dynamic_cast<Measure *>(b->FindDescendantByType(MEASURE));
if (!measureA->IsNeumeLine() || !measureB->IsNeumeLine()) return true;
Object *staffA = a->FindDescendantByType(STAFF);
Object *staffB = b->FindDescendantByType(STAFF);
assert(staffA);
assert(staffB);
Zone *zoneA = staffA->GetFacsimileInterface()->GetZone();
Zone *zoneB = staffB->GetFacsimileInterface()->GetZone();
assert(zoneA);
assert(zoneB);

int aLowest, bLowest, aHighest, bHighest;

Expand Down
6 changes: 5 additions & 1 deletion include/vrv/facsimilefunctor.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class SyncFromFacsimileFunctor : public Functor {
/*
* Abstract base implementation
*/
bool ImplementsEndInterface() const override { return false; }
bool ImplementsEndInterface() const override { return true; }

/*
* Functor interface
Expand All @@ -51,6 +51,7 @@ class SyncFromFacsimileFunctor : public Functor {
FunctorCode VisitLayerElement(LayerElement *layerElement) override;
FunctorCode VisitMeasure(Measure *measure) override;
FunctorCode VisitPage(Page *page) override;
FunctorCode VisitPageEnd(Page *page) override;
FunctorCode VisitPb(Pb *pb) override;
FunctorCode VisitSb(Sb *sb) override;
FunctorCode VisitStaff(Staff *staff) override;
Expand All @@ -71,6 +72,9 @@ class SyncFromFacsimileFunctor : public Functor {
//
Page *m_currentPage;
System *m_currentSystem;
Measure *m_currentNeumeLine;
/** map to store the zone corresponding to a staff */
std::map<Staff *, Zone *> m_staffZones;
};

//----------------------------------------------------------------------------
Expand Down
7 changes: 7 additions & 0 deletions include/vrv/facsimileinterface.h
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,13 @@ class FacsimileInterface : public Interface, public AttFacsimile {
Zone *GetZone() { return m_zone; }
const Zone *GetZone() const { return m_zone; }
///@}
///

/** Get the surface */
///@{
Surface *GetSurface() { return m_surface; }
const Surface *GetSurface() const { return m_surface; }
///@}

//-----------------//
// Pseudo functors //
Expand Down
1 change: 1 addition & 0 deletions include/vrv/layerelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class LayerElement : public Object,
public:
/** Absolute position X. This is used for facsimile (transcription) encoding */
int m_drawingFacsX;
int m_drawingFacsY; // This is used only for accid, syl
/**
* This stores a pointer to the cross-staff (if any) and the appropriate layer
* See PrepareCrossStaffFunctor
Expand Down
14 changes: 10 additions & 4 deletions include/vrv/measure.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Measure : public Object,
* Reset method resets all attribute classes
*/
///@{
Measure(bool measuredMusic = true, int logMeasureNb = -1);
Measure(MeasureType measuredMusic = MEASURED, int logMeasureNb = -1);
virtual ~Measure();
Object *Clone() const override { return new Measure(*this); };
void Reset() override;
Expand All @@ -79,7 +79,12 @@ class Measure : public Object,
/**
* Return true if measured music (otherwise we have fake measures)
*/
bool IsMeasuredMusic() const { return m_measuredMusic; }
bool IsMeasuredMusic() const { return (m_measureType == MEASURED); }

/**
* Return true if the measure represents a neume (section) line
*/
bool IsNeumeLine() const { return (m_measureType == NEUMELINE); }

/**
* Get and set the measure index
Expand Down Expand Up @@ -404,9 +409,10 @@ class Measure : public Object,

private:
/**
* Indicates measured music (otherwise we have fake measures)
* Indicate measured music (CMN), unmeasured (fake measures for mensural or neumes) or neume lines
* Neume line measure are created from <section type="neon-neume-line">
*/
bool m_measuredMusic;
MeasureType m_measureType;

/**
* The unique measure index
Expand Down
17 changes: 17 additions & 0 deletions include/vrv/staff.h
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,17 @@ class Staff : public Object,
}
///@}

/**
* @name Getters and setters for the rotation.
* Used only with facsimile rendering.
*/
///@{
void SetDrawingRotation(double drawingRotation) { m_drawingRotation = drawingRotation; }
double GetDrawingRotation() const { return m_drawingRotation; }
bool HasDrawingRotation() const { return (m_drawingRotation != 0.0); }
int GetDrawingRotationOffsetFor(int x);
///@}

/**
* Delete all the legder line arrays.
*/
Expand Down Expand Up @@ -290,6 +301,12 @@ class Staff : public Object,
ArrayOfLedgerLines m_ledgerLinesAboveCue;
ArrayOfLedgerLines m_ledgerLinesBelowCue;
///@}

/**
* The drawing rotation.
* Used only with facsimile rendering
*/
double m_drawingRotation;
};

} // namespace vrv
Expand Down
1 change: 1 addition & 0 deletions include/vrv/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,7 @@ class View {
///@{
void DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
void DrawSyllable(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
void DrawLiquescent(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
void DrawNc(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
void DrawNeume(DeviceContext *dc, LayerElement *element, Layer *layer, Staff *staff, Measure *measure);
///@}
Expand Down
8 changes: 8 additions & 0 deletions include/vrv/vrvdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -661,6 +661,14 @@ enum SmuflTextFont { SMUFL_NONE = 0, SMUFL_FONT_SELECTED, SMUFL_FONT_FALLBACK };

enum GraphicID { PRIMARY = 0, SPANNING, SYMBOLREF };

//----------------------------------------------------------------------------
// Measure type
//----------------------------------------------------------------------------

enum MeasureType { MEASURED = 0, UNMEASURED, NEUMELINE };

#define NEUME_LINE_TYPE "neon-neume-line"

//----------------------------------------------------------------------------
// Legacy Wolfgang defines
//----------------------------------------------------------------------------
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
4 changes: 4 additions & 0 deletions src/calcdotsfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,10 @@ FunctorCode CalcDotsFunctor::VisitChord(Chord *chord)

FunctorCode CalcDotsFunctor::VisitNote(Note *note)
{
// We currently have no dots object with mensural notes
if (note->IsMensuralDur()) {
return FUNCTOR_SIBLINGS;
}
if (!note->IsVisible()) {
return FUNCTOR_SIBLINGS;
}
Expand Down
Loading

0 comments on commit 1ea5a52

Please sign in to comment.