Skip to content

Commit

Permalink
Merge branch 'develop' into develop-pypi
Browse files Browse the repository at this point in the history
  • Loading branch information
lpugin committed Sep 10, 2024
2 parents 07f8151 + 243728d commit 8cfac8d
Show file tree
Hide file tree
Showing 31 changed files with 42,373 additions and 34,605 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Changelog

## [unreleased]
* Support (initial) for Volpiano input
* Support for neumatic notation oriscus and quilisma
* Support for neume layout without facsimile
* Support for numeral harmonics in MusicXML importer (@eNote-GmBH)

## [4.2.1] - 2024-05-07
* Fix GitHub actions (Python release only)
Expand All @@ -9,6 +13,7 @@
* Support for `fTrem@unitdur` (@eNote-GmbH)
* Upgrade to C++20
* Update of the Midifile library
* Improved logging
* Fix lyric position in MIDI output
* Fix string formatting output with some locale configurations (@ammatwain)

Expand Down
512 changes: 453 additions & 59 deletions include/hum/humlib.h

Large diffs are not rendered by default.

8 changes: 5 additions & 3 deletions include/vrv/barline.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#define __VRV_BARLINE_H__

#include "atts_shared.h"
#include "atts_visual.h"
#include "layerelement.h"

namespace vrv {
Expand All @@ -27,6 +28,7 @@ enum class BarLinePosition { None, Left, Right };
*/
class BarLine : public LayerElement,
public AttBarLineLog,
public AttBarLineVis,
public AttColor,
public AttNNumberLike,
public AttVisibility {
Expand Down Expand Up @@ -76,9 +78,9 @@ class BarLine : public LayerElement,
* @return First entry is true if the attribute was found, second entry contains the value
*/
///@{
std::pair<bool, double> GetLength(const StaffDef *staffDef) const;
std::pair<bool, data_BARMETHOD> GetMethod(const StaffDef *staffDef) const;
std::pair<bool, int> GetPlace(const StaffDef *staffDef) const;
std::pair<bool, double> GetLengthFromContext(const StaffDef *staffDef) const;
std::pair<bool, data_BARMETHOD> GetMethodFromContext(const StaffDef *staffDef) const;
std::pair<bool, int> GetPlaceFromContext(const StaffDef *staffDef) const;
///@}

//----------//
Expand Down
12 changes: 6 additions & 6 deletions include/vrv/divline.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ class DivLine : public LayerElement,
///@{
DivLine();
virtual ~DivLine();
virtual Object *Clone() const { return new DivLine(*this); }
virtual void Reset();
virtual std::string GetClassName() const { return "DivLine"; }
Object *Clone() const override { return new DivLine(*this); }
void Reset() override;
std::string GetClassName() const override { return "DivLine"; }
///@}

/** Override the method since alignment is required */
virtual bool HasToBeAligned() const { return true; }
bool HasToBeAligned() const override { return true; }

/**
* Use to set the alignment for the Measure BarLine members.
Expand Down Expand Up @@ -84,8 +84,8 @@ class DivLineAttr : public DivLine {
///@{
DivLineAttr();
virtual ~DivLineAttr();
virtual Object *Clone() const { return new DivLineAttr(*this); }
virtual std::string GetClassName() const { return "DivLineAttr"; }
Object *Clone() const override { return new DivLineAttr(*this); }
std::string GetClassName() const override { return "DivLineAttr"; }
///@}

// void SetLeft() { m_isLeft = true; }
Expand Down
8 changes: 4 additions & 4 deletions include/vrv/elementpart.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class TupletNum;
//----------------------------------------------------------------------------

/**
* This class models a group of dots as a layer element part and has not direct MEI equivlatent.
* This class models a group of dots as a layer element part and has no direct MEI equivalent.
*/
class Dots : public LayerElement, public AttAugmentDots {
public:
Expand Down Expand Up @@ -92,7 +92,7 @@ class Dots : public LayerElement, public AttAugmentDots {
//----------------------------------------------------------------------------

/**
* This class models a stem as a layer element part and has not direct MEI equivlatent.
* This class models a stem as a layer element part and has no direct MEI equivalent.
*/
class Flag : public LayerElement {
public:
Expand Down Expand Up @@ -144,7 +144,7 @@ class Flag : public LayerElement {
//----------------------------------------------------------------------------

/**
* This class models a bracket as a layer element part and has not direct MEI equivlatent.
* This class models a bracket as a layer element part and has no direct MEI equivalent.
* It is used to represent tuplet brackets.
*/
class TupletBracket : public LayerElement, public AttTupletVis {
Expand Down Expand Up @@ -243,7 +243,7 @@ class TupletBracket : public LayerElement, public AttTupletVis {
//----------------------------------------------------------------------------

/**
* This class models a tuplet num as a layer element part and has not direct MEI equivlatent.
* This class models a tuplet num as a layer element part and has no direct MEI equivalent.
* It is used to represent tuplet number
*/
class TupletNum : public LayerElement, public AttNumberPlacement, public AttTupletVis {
Expand Down
2 changes: 2 additions & 0 deletions include/vrv/iohumdrum.h
Original file line number Diff line number Diff line change
Expand Up @@ -900,6 +900,8 @@ class HumdrumInput : public vrv::Input {
bool checkIfReversedSpineOrder(std::vector<hum::HTp> &staffstarts);
bool hasOmdText(int startline, int endline);
void processMeiOptions(hum::HumdrumFile &infile);
std::string getInstrumentNumber(hum::HTp icode);
void insertTextWithNewlines(Label *label, const std::string &text);

// header related functions: ///////////////////////////////////////////
void createHeader();
Expand Down
2 changes: 1 addition & 1 deletion include/vrv/layerelement.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ class LayerElement : public Object,

/**
* Return true if the element has to be aligned horizontally
* It typically set to false for mRest, mRpt, etc.
* It is typically set to false for mRest, mRpt, etc.
*/
virtual bool HasToBeAligned() const { return false; }

Expand Down
10 changes: 5 additions & 5 deletions include/vrv/liquescent.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ class Liquescent : public LayerElement, public PitchInterface, public PositionIn
///@{
Liquescent();
virtual ~Liquescent();
virtual Object *Clone() const { return new Liquescent(*this); }
virtual void Reset();
virtual std::string GetClassName() const { return "Liquescent"; }
Object *Clone() const override { return new Liquescent(*this); }
void Reset() override;
std::string GetClassName() const override { return "Liquescent"; }
///@}

/**
* @name Getter to interfaces
*/
///@{
virtual PitchInterface *GetPitchInterface() { return dynamic_cast<PitchInterface *>(this); }
PitchInterface *GetPitchInterface() override { return dynamic_cast<PitchInterface *>(this); }
///@}

/** Override the method since alignment is required */
virtual bool HasToBeAligned() const { return true; }
bool HasToBeAligned() const override { return true; }

private:
//
Expand Down
10 changes: 5 additions & 5 deletions include/vrv/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -165,7 +165,7 @@ class Object : public BoundingBox {
const Resources *GetDocResources() const;

/**
* Reset the object, that is 1) removing all childs and 2) resetting all attributes.
* Reset the object, that is 1) removing all children and 2) resetting all attributes.
* The method is virtual, so _always_ call the parent in the method overriding it.
*/
virtual void Reset();
Expand Down Expand Up @@ -820,8 +820,8 @@ class Object : public BoundingBox {
class ObjectListInterface {
public:
// constructors and destructors
ObjectListInterface(){};
virtual ~ObjectListInterface(){};
ObjectListInterface() = default;
virtual ~ObjectListInterface() = default;
ObjectListInterface(const ObjectListInterface &listInterface); // copy constructor;
ObjectListInterface &operator=(const ObjectListInterface &listInterface); // copy assignment;

Expand Down Expand Up @@ -919,8 +919,8 @@ class ObjectListInterface {
class TextListInterface : public ObjectListInterface {
public:
// constructors and destructors
TextListInterface(){};
virtual ~TextListInterface(){};
TextListInterface() = default;
virtual ~TextListInterface() = default;

/**
* Returns a contatenated version of all the text children
Expand Down
10 changes: 5 additions & 5 deletions include/vrv/oriscus.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ class Oriscus : public LayerElement, public PitchInterface, public PositionInter
///@{
Oriscus();
virtual ~Oriscus();
virtual Object *Clone() const { return new Oriscus(*this); }
virtual void Reset();
virtual std::string GetClassName() const { return "Oriscus"; }
Object *Clone() const override { return new Oriscus(*this); }
void Reset() override;
std::string GetClassName() const override { return "Oriscus"; }
///@}

/**
* @name Getter to interfaces
*/
///@{
virtual PitchInterface *GetPitchInterface() { return dynamic_cast<PitchInterface *>(this); }
PitchInterface *GetPitchInterface() override { return dynamic_cast<PitchInterface *>(this); }
///@}

/** Override the method since alignment is required */
virtual bool HasToBeAligned() const { return true; }
bool HasToBeAligned() const override { return true; }

private:
//
Expand Down
10 changes: 5 additions & 5 deletions include/vrv/quilisma.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,20 +29,20 @@ class Quilisma : public LayerElement, public PitchInterface, public PositionInte
///@{
Quilisma();
virtual ~Quilisma();
virtual Object *Clone() const { return new Quilisma(*this); }
virtual void Reset();
virtual std::string GetClassName() const { return "Quilisma"; }
Object *Clone() const override { return new Quilisma(*this); }
void Reset() override;
std::string GetClassName() const override { return "Quilisma"; }
///@}

/**
* @name Getter to interfaces
*/
///@{
virtual PitchInterface *GetPitchInterface() { return dynamic_cast<PitchInterface *>(this); }
PitchInterface *GetPitchInterface() override { return dynamic_cast<PitchInterface *>(this); }
///@}

/** Override the method since alignment is required */
virtual bool HasToBeAligned() const { return true; }
bool HasToBeAligned() const override { return true; }

private:
//
Expand Down
7 changes: 1 addition & 6 deletions include/vrv/staff.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,8 @@ class LedgerLine {
public:
/**
* @name Constructors, destructors, reset methods
* Reset method reset all attribute classes
*/
///@{
LedgerLine();
virtual ~LedgerLine();
virtual void Reset();
///@}
LedgerLine() = default;

/**
* Add a dash to the ledger line object.
Expand Down
28 changes: 28 additions & 0 deletions include/vrv/toolkit.h
Original file line number Diff line number Diff line change
Expand Up @@ -770,6 +770,22 @@ class Toolkit {
*/
void ResetLogBuffer();

/**
* Start capturing std::cerr from an external codebase for redirection to vrv::logBuffer.
* Only one capture should be active at a given time. Finish by calling LogRedirectStop.
*/
void LogRedirectStart();

/**
* End capturing std::cerr from an external codebase for redirection to vrv::logBuffer.
*/
void LogRedirectStop();

/**
* Load a string data with or without resetting the log buffer
*/
bool LoadData(const std::string &data, bool resetLogBuffer);

private:
bool SetFont(const std::string &fontName);
bool IsUTF16(const std::string &filename);
Expand Down Expand Up @@ -805,6 +821,18 @@ class Toolkit {
*/
char *m_cString;

/**
* Temporary capture buffer for redirecting std::cerr to vrv::LogWarning.
* Used to coordinate between LogRedirectStart()/LogRedirectStop().
*/
std::stringstream m_cerrCaptured;

/**
* Temporary storage of the std::cerr read buffer during LogCapture. NULL when not in use.
* Used to coordinate between LogRedirectStart()/LogRedirectStop().
*/
std::streambuf *m_cerrOriginalBuf;

EditorToolkit *m_editorToolkit;

#ifndef NO_RUNTIME
Expand Down
2 changes: 1 addition & 1 deletion include/vrv/vrv.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ extern bool loggingToBuffer;
*/
extern struct timeval start;
void LogElapsedTimeStart();
void LogElapsedTimeEnd(const char *msg = "unspecified operation");
void LogElapsedTimeStop(const char *msg = "unspecified operation");

//----------------------------------------------------------------------------
// Notation type checks
Expand Down
14 changes: 9 additions & 5 deletions src/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,19 +33,22 @@ namespace vrv {

static const ClassRegistrar<BarLine> s_factory("barLine", BARLINE);

BarLine::BarLine() : LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttColor(), AttNNumberLike(), AttVisibility()
BarLine::BarLine()
: LayerElement(BARLINE, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility()
{
this->RegisterAttClass(ATT_BARLINELOG);
this->RegisterAttClass(ATT_BARLINEVIS);
this->RegisterAttClass(ATT_COLOR);
this->RegisterAttClass(ATT_VISIBILITY);

this->Reset();
}

BarLine::BarLine(ClassId classId)
: LayerElement(classId, "bline-"), AttBarLineLog(), AttColor(), AttNNumberLike(), AttVisibility()
: LayerElement(classId, "bline-"), AttBarLineLog(), AttBarLineVis(), AttColor(), AttNNumberLike(), AttVisibility()
{
this->RegisterAttClass(ATT_BARLINELOG);
this->RegisterAttClass(ATT_BARLINEVIS);
this->RegisterAttClass(ATT_COLOR);
this->RegisterAttClass(ATT_VISIBILITY);

Expand All @@ -59,6 +62,7 @@ void BarLine::Reset()
LayerElement::Reset();

this->ResetBarLineLog();
this->ResetBarLineVis();
this->ResetColor();
this->ResetVisibility();

Expand Down Expand Up @@ -91,7 +95,7 @@ bool BarLine::IsDrawnThrough(const StaffGrp *staffGrp) const
return false;
}

std::pair<bool, double> BarLine::GetLength(const StaffDef *staffDef) const
std::pair<bool, double> BarLine::GetLengthFromContext(const StaffDef *staffDef) const
{
// First check the parent measure
const Measure *measure = dynamic_cast<const Measure *>(this->GetParent());
Expand All @@ -116,7 +120,7 @@ std::pair<bool, double> BarLine::GetLength(const StaffDef *staffDef) const
return { false, 0.0 };
}

std::pair<bool, data_BARMETHOD> BarLine::GetMethod(const StaffDef *staffDef) const
std::pair<bool, data_BARMETHOD> BarLine::GetMethodFromContext(const StaffDef *staffDef) const
{
// First check the parent measure
const Measure *measure = dynamic_cast<const Measure *>(this->GetParent());
Expand All @@ -141,7 +145,7 @@ std::pair<bool, data_BARMETHOD> BarLine::GetMethod(const StaffDef *staffDef) con
return { false, BARMETHOD_NONE };
}

std::pair<bool, int> BarLine::GetPlace(const StaffDef *staffDef) const
std::pair<bool, int> BarLine::GetPlaceFromContext(const StaffDef *staffDef) const
{
// First check the parent measure
const Measure *measure = dynamic_cast<const Measure *>(this->GetParent());
Expand Down
21 changes: 12 additions & 9 deletions src/calcligatureorneumeposfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,16 +347,19 @@ FunctorCode CalcLigatureOrNeumePosFunctor::VisitNeume(Neume *neume)
}
}

// If the nc overlaps with the previous, move it back from a line width
if (overlapWithPrevious) {
xRel -= lineWidth;
}
// xRel remains unset with facsimile
if (!m_doc->HasFacsimile()) {
// If the nc overlaps with the previous, move it back from a line width
if (overlapWithPrevious) {
xRel -= lineWidth;
}

nc->SetDrawingXRel(xRel);
// The first glyph set the spacing - unless we are starting a ligature, in which case no spacing should be added
// between the two nc
if (!previousLig) {
xRel += m_doc->GetGlyphWidth(nc->m_drawingGlyphs.at(0).m_fontNo, staffSize, false);
nc->SetDrawingXRel(xRel);
// The first glyph set the spacing - unless we are starting a ligature, in which case no spacing should be
// added between the two nc
if (!previousLig) {
xRel += m_doc->GetGlyphWidth(nc->m_drawingGlyphs.at(0).m_fontNo, staffSize, false);
}
}

previousNc = nc;
Expand Down
Loading

0 comments on commit 8cfac8d

Please sign in to comment.