Skip to content

Commit

Permalink
Fix draw accid & divLine
Browse files Browse the repository at this point in the history
  • Loading branch information
yinanazhou committed Jan 14, 2024
1 parent c90f470 commit efcdd40
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 17 deletions.
2 changes: 1 addition & 1 deletion src/facsimilefunctor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ SyncFromFacsimileFunctor::SyncFromFacsimileFunctor(Doc *doc) : Functor()

FunctorCode SyncFromFacsimileFunctor::VisitLayerElement(LayerElement *layerElement)
{
if (!layerElement->Is({ CLEF, CUSTOS, NC, NOTE, REST, SYL })) return FUNCTOR_CONTINUE;
if (!layerElement->Is({ ACCID, CLEF, CUSTOS, DIVLINE, NC, NOTE, REST, SYL })) return FUNCTOR_CONTINUE;

Zone *zone = layerElement->GetZone();
assert(zone);
Expand Down
17 changes: 4 additions & 13 deletions src/view_element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -299,20 +299,11 @@ void View::DrawAccid(DeviceContext *dc, LayerElement *element, Layer *layer, Sta
y = (accid->GetPlace() == STAFFREL_below) ? y - extend.m_ascent - unit : y + extend.m_descent + unit;
}

if (notationType == NOTATIONTYPE_neume) {
int rotationOffset = 0;
if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) {
double deg = staff->GetDrawingRotate();
int xDiff = x - staff->GetDrawingX();
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
}
else if (staff->HasDrawingRotation()) {
rotationOffset = staff->GetDrawingRotationOffsetFor(x);
}
if (accid->HasFacs() && m_doc->IsFacs()) {
y = ToLogicalY(y);
else if (notationType == NOTATIONTYPE_neume) {
if (m_doc->IsTranscription() && staff->HasDrawingRotation()) {
int rotationOffset = staff->GetDrawingRotationOffsetFor(x);
y -= rotationOffset;
}
y -= rotationOffset;
}

this->DrawSmuflString(
Expand Down
6 changes: 3 additions & 3 deletions src/view_neume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -380,9 +380,9 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
}

int x, y;
if (m_doc->IsFacs() && (divLine->HasFacs())) {
if (m_doc->IsTranscription() && (divLine->HasFacs())) {
x = divLine->GetDrawingX();
y = ToLogicalY(staff->GetDrawingY());
y = staff->GetDrawingY();
}
else {
x = element->GetDrawingX();
Expand All @@ -393,7 +393,7 @@ void View::DrawDivLine(DeviceContext *dc, LayerElement *element, Layer *layer, S
y -= (m_doc->GetDrawingUnit(staff->m_drawingStaffSize)) * 3;

int rotationOffset = 0;
if (m_doc->IsFacs() && (staff->GetDrawingRotate() != 0)) {
if (m_doc->IsTranscription() && (staff->GetDrawingRotate() != 0)) {
double deg = staff->GetDrawingRotate();
int xDiff = x - staff->GetDrawingX();
rotationOffset = int(xDiff * tan(deg * M_PI / 180.0));
Expand Down

0 comments on commit efcdd40

Please sign in to comment.