2007-12-23 12:45:17 +00:00
|
|
|
//
|
|
|
|
// File: VLLayout.h - Dimensions for lead sheet layout
|
|
|
|
//
|
|
|
|
// Author(s):
|
|
|
|
//
|
|
|
|
// (MN) Matthias Neeracher
|
|
|
|
//
|
|
|
|
// Copyright © 2007 Matthias Neeracher
|
|
|
|
//
|
|
|
|
|
|
|
|
#include <VLModel.h>
|
|
|
|
#include <vector>
|
|
|
|
|
|
|
|
class VLSystemLayout {
|
|
|
|
public:
|
2007-12-23 23:07:27 +00:00
|
|
|
VLSystemLayout(const VLProperties & prop, float width, int maxMeas);
|
2007-12-23 12:45:17 +00:00
|
|
|
|
|
|
|
float ClefKeyWidth() const { return fClefKeyWidth; }
|
|
|
|
float MeasureWidth() const { return fMeasureWidth; }
|
|
|
|
float MeasurePosition(int m) const { return fClefKeyWidth+m*fMeasureWidth; }
|
|
|
|
float SystemWidth() const { return MeasurePosition(fNumMeasures); }
|
|
|
|
int Divisions() const { return fDivisions; }
|
|
|
|
int NumGroups() const { return fNumGroups; }
|
|
|
|
int DivPerGroup() const { return fDivPerGroup; }
|
|
|
|
int NumMeasures() const { return fNumMeasures; }
|
|
|
|
private:
|
|
|
|
float fClefKeyWidth;
|
|
|
|
float fMeasureWidth;
|
|
|
|
int fDivisions;
|
|
|
|
int fNumGroups;
|
|
|
|
int fDivPerGroup;
|
|
|
|
int fNumMeasures;
|
|
|
|
};
|
|
|
|
|
|
|
|
class VLLayout : public std::vector<VLSystemLayout> {
|
|
|
|
public:
|
|
|
|
VLLayout(const VLSong & song, float width);
|
|
|
|
|
|
|
|
int FirstMeasure(int system) const;
|
|
|
|
int SystemForMeasure(int measure) const;
|
|
|
|
int NumSystems() const { return size(); }
|
|
|
|
float MeasurePosition(int measure) const;
|
|
|
|
float NotePosition(int measure, VLFraction at) const;
|
|
|
|
};
|
|
|
|
|
2007-12-25 16:49:45 +00:00
|
|
|
class VLFontHandler {
|
|
|
|
public:
|
2008-05-29 18:54:30 +00:00
|
|
|
virtual void Draw(float x, float y,
|
|
|
|
const char * utf8Text, bool highlight) = 0;
|
2007-12-25 16:49:45 +00:00
|
|
|
virtual float Width(const char * utf8Text) = 0;
|
|
|
|
virtual ~VLFontHandler();
|
|
|
|
};
|
|
|
|
|
|
|
|
struct VLLayoutSyll : public VLSyllable {
|
|
|
|
float fX;
|
2008-05-29 18:54:30 +00:00
|
|
|
bool fHighlight;
|
2007-12-25 16:49:45 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
class VLTextLayout {
|
|
|
|
public:
|
|
|
|
VLTextLayout(VLFontHandler * regular, VLFontHandler * narrow);
|
|
|
|
|
2008-05-29 18:54:30 +00:00
|
|
|
void AddSyllable(const VLSyllable & syll, float x, bool highlight);
|
2007-12-25 16:49:45 +00:00
|
|
|
void DrawLine(float y);
|
|
|
|
private:
|
|
|
|
VLFontHandler * fRegularFont;
|
|
|
|
VLFontHandler * fNarrowFont;
|
|
|
|
std::vector<VLLayoutSyll> fSyllables;
|
|
|
|
};
|
|
|
|
|
2007-12-23 12:45:17 +00:00
|
|
|
// Local Variables:
|
|
|
|
// mode:C++
|
|
|
|
// End:
|