Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge develop-tab into develop #3588

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from
Draft
6 changes: 5 additions & 1 deletion include/vrv/note.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
//----------------------------------------------------------------------------

#include "accid.h"
#include "altsyminterface.h"
#include "atts_analytical.h"
#include "atts_externalsymbols.h"
#include "atts_frettab.h"
Expand Down Expand Up @@ -45,6 +46,7 @@ class Verse;
*/
class Note : public LayerElement,
public StemmedDrawingInterface,
public AltSymInterface,
public DurationInterface,
public PitchInterface,
public PositionInterface,
Expand Down Expand Up @@ -80,6 +82,8 @@ class Note : public LayerElement,
* @name Getter to interfaces
*/
///@{
AltSymInterface *GetAltSymInterface() override { return vrv_cast<AltSymInterface *>(this); }
const AltSymInterface *GetAltSymInterface() const override { return vrv_cast<const AltSymInterface *>(this); }
DurationInterface *GetDurationInterface() override { return vrv_cast<DurationInterface *>(this); }
const DurationInterface *GetDurationInterface() const override { return vrv_cast<const DurationInterface *>(this); }
PitchInterface *GetPitchInterface() override { return vrv_cast<PitchInterface *>(this); }
Expand Down Expand Up @@ -162,7 +166,7 @@ class Note : public LayerElement,
* @name Return the smufl string to use for a note give the notation type
*/
///@{
std::u32string GetTabFretString(data_NOTATIONTYPE notationType) const;
std::u32string GetTabFretString(data_NOTATIONTYPE notationType, int &overline, int &strike, int &underline) const;
///@}

/**
Expand Down
3 changes: 3 additions & 0 deletions include/vrv/rest.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
#ifndef __VRV_REST_H__
#define __VRV_REST_H__

#include "altsyminterface.h"
#include "atts_externalsymbols.h"
#include "atts_mensural.h"
#include "durationinterface.h"
Expand All @@ -34,6 +35,7 @@ enum RestNotePlace { RNP_UNSET = -1, RNP_noteInSpace, RNP_noteOnLine };
* This class models the MEI <rest> element.
*/
class Rest : public LayerElement,
public AltSymInterface,
public DurationInterface,
public PositionInterface,
public AttColor,
Expand Down Expand Up @@ -69,6 +71,7 @@ class Rest : public LayerElement,
* @name Getter to interfaces
*/
///@{
AltSymInterface *GetAltSymInterface() override { return vrv_cast<AltSymInterface *>(this); }
PositionInterface *GetPositionInterface() override { return vrv_cast<PositionInterface *>(this); }
const PositionInterface *GetPositionInterface() const override { return vrv_cast<const PositionInterface *>(this); }
DurationInterface *GetDurationInterface() override { return vrv_cast<DurationInterface *>(this); }
Expand Down
3 changes: 2 additions & 1 deletion include/vrv/staffdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,8 @@ class StaffDef : public ScoreDefElement,
public AttStaffDefLog,
public AttStaffDefVis,
public AttTimeBase,
public AttTransposition {
public AttTransposition,
public AttVerticalAlign {
public:
/**
* @name Constructors, destructors, and other standard methods
Expand Down
3 changes: 2 additions & 1 deletion include/vrv/tabdursym.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ namespace vrv {
/**
* This class models the MEI <tabDurSym> element.
*/
class TabDurSym : public LayerElement, public StemmedDrawingInterface, public AttNNumberLike {
class TabDurSym : public LayerElement, public StemmedDrawingInterface, public AttNNumberLike, public AttStaffLoc {
public:
/**
* @name Constructors, destructors, and other standard methods
Expand All @@ -30,6 +30,7 @@ class TabDurSym : public LayerElement, public StemmedDrawingInterface, public At
///@{
TabDurSym();
virtual ~TabDurSym();
Object *Clone() const override { return new TabDurSym(*this); }
void Reset() override;
std::string GetClassName() const override { return "TabDurSym"; }
///@}
Expand Down
1 change: 1 addition & 0 deletions include/vrv/tabgrp.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class TabGrp : public LayerElement, public ObjectListInterface, public DurationI
///@{
TabGrp();
virtual ~TabGrp();
Object *Clone() const override { return new TabGrp(*this); }
void Reset() override;
std::string GetClassName() const override { return "TabGrp"; }
///@}
Expand Down
17 changes: 15 additions & 2 deletions include/vrv/tuning.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,22 @@ class Tuning : public Object, public AttCourseLog {
bool IsSupportedChild(Object *object) override;

/**
* Return the line for a the tuning and a given course and a notation type
* Return the line for a note according to tablature type.
* Guitar, french and italian tablature: the line is based on the course.
* German tablature: the line is based on the note's index in the note list
* or by explicit @loc.
*
* @param[in] course
* @param[in] notationType
* @param[in] lines
* @param[in] listSize
* @param[in] index - 0 based from the bottom of the chord
* @param[in] loc - German tablature: note@loc if specified, 0 at the bottom
* @param[in] topAlign - German tablature: true => align at the top, false => align at the bottom
* @return position in staff half lines
*/
int CalcPitchPos(int course, data_NOTATIONTYPE notationType, int lines) const;
int CalcPitchPos(
int course, data_NOTATIONTYPE notationType, int lines, int listSize, int index, int loc, bool topAlign) const;

/**
* Calculate the MIDI note number for course/fret
Expand Down
2 changes: 1 addition & 1 deletion include/vrv/view.h
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ class View {
void DrawMeterSigGrp(DeviceContext *dc, Layer *layer, Staff *staff);
void DrawMNum(DeviceContext *dc, MNum *mnum, Measure *measure, System *system, int yOffset);
void DrawStaff(DeviceContext *dc, Staff *staff, Measure *measure, System *system);
void DrawStaffLines(DeviceContext *dc, Staff *staff, Measure *measure, System *system);
void DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, Measure *measure, System *system);
void DrawLayer(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure);
void DrawLayerList(DeviceContext *dc, Layer *layer, Staff *staff, Measure *measure, const ClassId classId);
void DrawLayerDefLabels(
Expand Down
1 change: 1 addition & 0 deletions include/vrv/vrvdef.h
Original file line number Diff line number Diff line change
Expand Up @@ -695,6 +695,7 @@ enum MeasureType { MEASURED = 0, UNMEASURED, NEUMELINE };
//----------------------------------------------------------------------------

#define TABLATURE_STAFF_RATIO 1.75
#define GERMAN_TAB_STAFF_RATIO 2.2

#define SUPER_SCRIPT_FACTOR 0.58
#define SUPER_SCRIPT_POSITION -0.20 // lowered down from the midline
Expand Down
4 changes: 2 additions & 2 deletions src/beam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -603,8 +603,8 @@ void BeamSegment::CalcBeamInit(
beamInterface->m_beamWidthBlack /= 2;
beamInterface->m_beamWidthWhite /= 2;

// Adjust it further for tab.lute.french and tab.lute.italian
if (staff->IsTabLuteFrench() || staff->IsTabLuteItalian()) {
// Adjust it further for tab.lute.french, tab.lute.german and tab.lute.italian
if (staff->IsTabLuteFrench() || staff->IsTabLuteGerman() || staff->IsTabLuteItalian()) {
beamInterface->m_beamWidthBlack = beamInterface->m_beamWidthBlack * 2 / 5;
beamInterface->m_beamWidthWhite = beamInterface->m_beamWidthWhite * 3 / 5;
}
Expand Down
9 changes: 6 additions & 3 deletions src/calcalignmentpitchposfunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include "rest.h"
#include "score.h"
#include "staff.h"
#include "tabgrp.h"
#include "tuning.h"

//----------------------------------------------------------------------------
Expand Down Expand Up @@ -105,8 +106,10 @@ FunctorCode CalcAlignmentPitchPosFunctor::VisitLayerElement(LayerElement *layerE
TabGrp *tabGrp = note->IsTabGrpNote();
if (tabGrp) {
assert(staffY->m_drawingTuning);
loc = staffY->m_drawingTuning->CalcPitchPos(
note->GetTabCourse(), staffY->m_drawingNotationType, staffY->m_drawingLines);
assert(staffY->m_drawingStaffDef);
loc = staffY->m_drawingTuning->CalcPitchPos(note->GetTabCourse(), staffY->m_drawingNotationType,
staffY->m_drawingLines, tabGrp->GetListSize(), tabGrp->GetListIndex(note), note->GetLoc(),
staffY->m_drawingStaffDef->GetValign() != VERTICALALIGNMENT_bottom);
}
else if ((note->HasPname() && (note->HasOct() || note->HasOctDefault())) || note->HasLoc()) {
loc = PitchInterface::CalcLoc(note, layerY, layerElementY);
Expand Down Expand Up @@ -307,7 +310,7 @@ FunctorCode CalcAlignmentPitchPosFunctor::VisitLayerElement(LayerElement *layerE
else if (layerElement->Is(TABDURSYM)) {
int yRel = 0;
if (staffY->IsTabWithStemsOutside()) {
double spacingRatio = (staffY->IsTabLuteFrench()) ? 2.0 : 1.0;
double spacingRatio = (staffY->IsTabLuteFrench() || staffY->IsTabLuteGerman()) ? 2.0 : 1.0;
yRel += m_doc->GetDrawingUnit(staffY->m_drawingStaffSize) * spacingRatio;
}
layerElement->SetDrawingYRel(yRel);
Expand Down
14 changes: 14 additions & 0 deletions src/iomei.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1838,6 +1838,7 @@ void MEIOutput::WriteStaffDef(pugi::xml_node currentNode, StaffDef *staffDef)
staffDef->WriteStaffDefVis(currentNode);
staffDef->WriteTimeBase(currentNode);
staffDef->WriteTransposition(currentNode);
staffDef->WriteVerticalAlign(currentNode);
}

void MEIOutput::WriteInstrDef(pugi::xml_node currentNode, InstrDef *instrDef)
Expand Down Expand Up @@ -2754,6 +2755,7 @@ void MEIOutput::WriteNote(pugi::xml_node currentNode, Note *note)
assert(note);

this->WriteLayerElement(currentNode, note);
this->WriteAltSymInterface(currentNode, note);
this->WriteDurationInterface(currentNode, note);
this->WritePitchInterface(currentNode, note);
this->WritePositionInterface(currentNode, note);
Expand Down Expand Up @@ -2812,6 +2814,7 @@ void MEIOutput::WriteRest(pugi::xml_node currentNode, Rest *rest)
assert(rest);

this->WriteLayerElement(currentNode, rest);
this->WriteAltSymInterface(currentNode, rest);
this->WriteDurationInterface(currentNode, rest);
this->WritePositionInterface(currentNode, rest);
rest->WriteColor(currentNode);
Expand Down Expand Up @@ -2845,6 +2848,7 @@ void MEIOutput::WriteTabDurSym(pugi::xml_node currentNode, TabDurSym *tabDurSym)

this->WriteLayerElement(currentNode, tabDurSym);
tabDurSym->WriteNNumberLike(currentNode);
tabDurSym->WriteStaffLoc(currentNode);
}

void MEIOutput::WriteTabGrp(pugi::xml_node currentNode, TabGrp *tabGrp)
Expand Down Expand Up @@ -3831,6 +3835,9 @@ bool MEIInput::IsAllowed(std::string element, Object *filterParent)
if (element == "note") {
return true;
}
if (element == "rest") {
return true;
}
else {
return false;
}
Expand Down Expand Up @@ -5196,6 +5203,7 @@ bool MEIInput::ReadStaffDef(Object *parent, pugi::xml_node staffDef)
vrvStaffDef->ReadStaffDefVis(staffDef);
vrvStaffDef->ReadTimeBase(staffDef);
vrvStaffDef->ReadTransposition(staffDef);
vrvStaffDef->ReadVerticalAlign(staffDef);

if (!vrvStaffDef->HasN()) {
LogWarning("No @n on <staffDef> might yield unpredictable results");
Expand Down Expand Up @@ -6940,6 +6948,7 @@ bool MEIInput::ReadNote(Object *parent, pugi::xml_node note)
}
}

this->ReadAltSymInterface(note, vrvNote);
this->ReadDurationInterface(note, vrvNote);
this->ReadPitchInterface(note, vrvNote);
this->ReadPositionInterface(note, vrvNote);
Expand Down Expand Up @@ -6994,6 +7003,7 @@ bool MEIInput::ReadRest(Object *parent, pugi::xml_node rest)
}
}

this->ReadAltSymInterface(rest, vrvRest);
this->ReadDurationInterface(rest, vrvRest);
this->ReadPositionInterface(rest, vrvRest);
vrvRest->ReadColor(rest);
Expand Down Expand Up @@ -7123,6 +7133,7 @@ bool MEIInput::ReadTabDurSym(Object *parent, pugi::xml_node tabRhyhtm)
this->ReadLayerElement(tabRhyhtm, vrvTabDurSym);

vrvTabDurSym->ReadNNumberLike(tabRhyhtm);
vrvTabDurSym->ReadStaffLoc(tabRhyhtm);

parent->AddChild(vrvTabDurSym);
this->ReadUnsupportedAttr(tabRhyhtm, vrvTabDurSym);
Expand Down Expand Up @@ -7260,6 +7271,9 @@ bool MEIInput::ReadSymbolDefChildren(Object *parent, pugi::xml_node parentNode,
else if (elementName == "svg") {
success = this->ReadSvg(parent, xmlElement);
}
else if (elementName == "symbol") {
success = this->ReadSymbol(parent, xmlElement);
}
// xml comment
else if (elementName == "") {
success = this->ReadXMLComment(parent, xmlElement);
Expand Down
Loading
Loading