lenmus / lomse

A C++ library for rendering, editing and playing back music scores.
MIT License
117 stars 28 forks source link

Baseline of each staff #384

Closed cecilios closed 3 months ago

cecilios commented 1 year ago

The last question I find in discussion #377 is about how to get the baseline (or some other anchor point) of each staff in the system.

Opening this issue as a remainder to answer this question.

cecilios commented 1 year ago

A simple way to get this information is by asking GmoBoxSystem for the staff shapes, and then requesting the staff bounding box (or its origin):

GmoBoxSystem* pSystem = ...
GmoShapeStaff* pStaff = pSystem->get_staff_shape(int iInstr, int iStaff);
UPoint origin = pStaff->get_origin()

As always, origin is relative to GmoBoxPage origin. But as FreeFlowView has only one page with origin at (0, 0), the returned staff origin can be used as absolute coordinates for FreeFlowView.

cecilios commented 1 year ago

@npiegdon Did the answer solved your needs? Can I close this issue?

npiegdon commented 1 year ago

Yes, this should be perfect, thanks! (And I am hoping to have a chance to confirm that, starting in just a couple weeks.)

cecilios commented 1 year ago

No problem. I'll keep it open until you can test and confirm.

cecilios commented 3 months ago

I am closing this issue due to lack of any feedback. So I assume the issue is solved