Skip to content

Commit

Permalink
StaffEditor: header stop abscissa can be modified/restored
Browse files Browse the repository at this point in the history
  • Loading branch information
hbitteur committed Jan 19, 2024
1 parent 0ea46eb commit 7588503
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 254 deletions.
254 changes: 0 additions & 254 deletions src/main/org/audiveris/omr/image/PixelBuffer.java

This file was deleted.

22 changes: 22 additions & 0 deletions src/main/org/audiveris/omr/sheet/ui/StaffEditor.java
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
import org.audiveris.omr.sheet.Staff;
import org.audiveris.omr.sheet.StaffLine;
import org.audiveris.omr.sheet.grid.LineInfo;
import org.audiveris.omr.sheet.header.StaffHeader;
import org.audiveris.omr.ui.view.RubberPanel;
import static org.audiveris.omr.util.HorizontalSide.LEFT;
import static org.audiveris.omr.util.HorizontalSide.RIGHT;
Expand Down Expand Up @@ -305,6 +306,16 @@ public void finalDoit ()
staffLine.setGlyph(glyph);
});

// Update header if so needed
final StaffHeader header = staff.getHeader();
if (header != null) {
if (header.stop == header.start) {
final int stop = staff.getAbscissa(LEFT);
staff.setHeaderStop(stop);
model.headerStop = stop;
}
}

system.updateCoordinates();
system.updateArea();

Expand Down Expand Up @@ -572,6 +583,10 @@ protected void applyModel (StaffModel model)
staff.setAbscissa(LEFT, (int) Math.rint(left));
staff.setAbscissa(RIGHT, (int) Math.rint(right));
staff.setArea(null);

if (model.headerStop != null) {
staff.getHeader().stop = model.headerStop;
}
}

/**
Expand Down Expand Up @@ -711,9 +726,16 @@ protected static abstract class StaffModel
/** Sections removed from hLag. */
public final Set<Section> hLagRemovals = new HashSet<>();

/** Header stop, if any. */
public Integer headerStop;

public StaffModel (Staff staff)
{
staff.getLines().forEach(l -> staffLineGlyphs.add(((StaffLine) l).getGlyph()));

if (staff.getHeader() != null) {
headerStop = staff.getHeader().stop;
}
}
}
}

0 comments on commit 7588503

Please sign in to comment.