Skip to content

Commit

Permalink
Refactor of the drawing staff lines decision steps
Browse files Browse the repository at this point in the history
* Change `staffDef->GetLinesVisible() == BOOLEAN_true` for GLT (pinging @paul-bayleaf and @musicog)
  • Loading branch information
lpugin committed Nov 26, 2024
1 parent 2da0dce commit 5d06ae6
Showing 1 changed file with 12 additions and 2 deletions.
14 changes: 12 additions & 2 deletions src/view_page.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1290,6 +1290,15 @@ void View::DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, M
assert(measure);
assert(system);

// If German lute tablature the default is @lines.visible="false", but setting @lines.visible="true"
// will draw the staff lines.
bool gltLines = (staff->IsTabLuteGerman() && staffDef->GetLinesVisible() == BOOLEAN_true);
// For anything other than German lute tablature the default is @lines.visible="true"
bool visibleLines = (staffDef->GetLinesVisible() != BOOLEAN_false);

// Nothing to do if both are false
if (!gltLines && !visibleLines) return;

int j, x1, x2, y1, y2;

x1 = measure->GetDrawingX();
Expand All @@ -1309,15 +1318,16 @@ void View::DrawStaffLines(DeviceContext *dc, Staff *staff, StaffDef *staffDef, M
// If German lute tablature the default is @lines.visible="false", but setting @lines.visible="true"
// will draw the staff lines.
// For anything other than German lute tablature the default is @lines.visible="true"
if (staff->IsTabLuteGerman() && staffDef->GetLinesVisible() != BOOLEAN_true) {
if (gltLines) {
// German tablature has no staff, just a single base line
// But internally we maintain the fiction of an invisible staff as a coordinate system
SegmentedLine line(x1, x2);
// Issue #3589 move base line slightly further down and reduce thickness
y1 -= (m_doc->GetDrawingDoubleUnit(staff->m_drawingStaffSize) * staff->m_drawingLines) * 11 / 10;
this->DrawHorizontalSegmentedLine(dc, y1, line, lineWidth / 2);
}
else if (staffDef->GetLinesVisible() != BOOLEAN_false) {
// Normal staff lines
else {
// draw staff lines
for (j = 0; j < staff->m_drawingLines; ++j) {
// Skewed lines - with Facs (neumes) only for now
Expand Down

0 comments on commit 5d06ae6

Please sign in to comment.