13 #ifndef __STAFFTYPE_H__ 14 #define __STAFFTYPE_H__ 29 #define STAFFTYPE_TAB_DEFAULTSTEMLEN_UP 3.0 30 #define STAFFTYPE_TAB_DEFAULTSTEMDIST_UP 1.0 31 #define STAFFTYPE_TAB_DEFAULTSTEMPOSY_UP -STAFFTYPE_TAB_DEFAULTSTEMDIST_UP 32 #define STAFFTYPE_TAB_DEFAULTSTEMLEN_DN 3.0 33 #define STAFFTYPE_TAB_DEFAULTSTEMDIST_DN 1.0 34 #define STAFFTYPE_TAB_DEFAULTSTEMPOSY_DN STAFFTYPE_TAB_DEFAULTSTEMDIST_DN 35 #define STAFFTYPE_TAB_DEFAULTSTEMLEN_THRU 3.5 36 #define STAFFTYPE_TAB_DEFAULTSTEMPOSX 0.75 37 #define STAFFTYPE_TAB_DEFAULTDOTDIST_X 0.75 42 #define STAFFTYPE_TAB_SHORTSTEMRATIO 0.5 44 #define STAFFTYPE_TAB_SLASH_WIDTH 1.2 45 #define STAFFTYPE_TAB_SLASH_SLANTY 0.8 46 #define STAFFTYPE_TAB_SLASH_THICK 0.4 47 #define STAFFTYPE_TAB_SLASH_DISPL 0.8 50 #define STAFFTYPE_TAB_SLASH_2TOTHEIGHT (STAFFTYPE_TAB_SLASH_THICK+STAFFTYPE_TAB_SLASH_DISPL+STAFFTYPE_TAB_SLASH_SLANTY) 52 #define STAFFTYPE_TAB_SLASH_2STARTY_UP ((STAFFTYPE_TAB_DEFAULTSTEMLEN_UP-STAFFTYPE_TAB_SLASH_2TOTHEIGHT)*0.5) 54 #define STAFFTYPE_TAB_SLASH_2STARTY_DN ((STAFFTYPE_TAB_DEFAULTSTEMLEN_UP+STAFFTYPE_TAB_SLASH_2TOTHEIGHT)*0.5) 56 #define STAFFTYPE_TAB_SLASH_4TOTHEIGHT (STAFFTYPE_TAB_SLASH_THICK+STAFFTYPE_TAB_SLASH_DISPL*3+STAFFTYPE_TAB_SLASH_SLANTY) 58 #define STAFFTYPE_TAB_SLASH_4STARTY_UP ((STAFFTYPE_TAB_DEFAULTSTEMLEN_UP-STAFFTYPE_TAB_SLASH_4TOTHEIGHT)*0.5) 60 #define STAFFTYPE_TAB_SLASH_4STARTY_DN ((STAFFTYPE_TAB_DEFAULTSTEMLEN_UP+STAFFTYPE_TAB_SLASH_4TOTHEIGHT)*0.5) 67 #define STAFFTYPE_TAB_BASSSLASH_YOFFSET 0.33 74 #define NUM_OF_BASSSTRINGS_WITH_LETTER 4 // the max number of bass strings frettable with letter notation (French) 75 #define NUM_OF_BASSSTRINGS_WITH_NUMBER 2 // the max number of bass strings frettable with number notation (Italian) 81 #define NUM_OF_DIGITFRETS 100 // the max fret number which can be rendered with numbers 82 #define NUM_OF_LETTERFRETS 17 // the max fret number which can be rendered with letters 83 #define NUM_OF_BASSSTRING_SLASHES 5 // the max number of slashes supported for French bass strings notation 88 static const qreal GRID_BEAM_DEF_WIDTH = 0.25;
89 static const qreal GRID_STEM_DEF_HEIGHT = 1.75;
90 static const qreal GRID_STEM_DEF_WIDTH = 0.125;
139 qreal gridBeamWidth = GRID_BEAM_DEF_WIDTH;
140 qreal gridStemHeight = GRID_STEM_DEF_HEIGHT;
141 qreal gridStemWidth = GRID_STEM_DEF_WIDTH;
167 static const int STAFF_GROUP_NAME_MAX_LENGTH = 32;
181 qreal _userMag { 1.0 };
183 bool _small {
false };
188 bool _showBarlines =
true;
189 bool _showLedgerLines =
true;
190 bool _stemless =
false;
192 bool _genClef =
true;
193 bool _genTimesig =
true;
194 bool _genKeysig =
true;
200 qreal _durationFontSize = 15.0;
201 qreal _durationFontUserY = 0.0;
203 qreal _fretFontSize = 10.0;
204 qreal _fretFontUserY = 0.0;
206 bool _genDurations =
false;
207 bool _linesThrough =
false;
210 bool _onLines =
true;
211 bool _showRests =
false;
212 bool _stemsDown =
true;
213 bool _stemsThrough =
true;
214 bool _upsideDown =
false;
215 bool _showTabFingering =
false;
216 bool _useNumbers =
true;
217 bool _showBackTied =
true;
222 mutable qreal _durationBoxH = 0.0;
223 qreal
mutable _durationBoxY = 0.0;
227 int _durationFontIdx = 0;
228 mutable qreal _durationYOffset = 0.0;
230 mutable qreal _durationGridYOffset = 0.0;
232 mutable bool _durationMetricsValid =
false;
233 mutable qreal _fretBoxH = 0.0;
234 mutable qreal _fretBoxY = 0.0;
238 int _fretFontIdx = 0;
239 mutable qreal _fretYOffset = 0.0;
242 mutable bool _fretMetricsValid =
false;
243 mutable qreal _refDPI = 0.0;
250 void setDurationMetrics()
const;
251 void setFretMetrics()
const;
253 static bool readConfigFile(
const QString& fileName);
259 StaffType(
StaffGroup sg,
const QString& xml,
const QString& name,
int lines,
int stpOff, qreal lineDist,
260 bool genClef,
bool showBarLines,
bool stemless,
bool genTimeSig,
261 bool genKeySig,
bool showLedgerLines);
263 StaffType(
StaffGroup sg,
const QString& xml,
const QString& name,
int lines,
int stpOff, qreal lineDist,
264 bool genClef,
bool showBarLines,
bool stemless,
bool genTimesig,
265 const QString& durFontName, qreal durFontSize, qreal durFontUserY, qreal genDur,
266 const QString& fretFontName, qreal fretFontSize, qreal fretFontUserY,
TablatureSymbolRepeat symRepeat,
268 bool stemsDown,
bool stemThrough,
bool upsideDown,
bool showTabFingering,
bool useNumbers,
bool showBackTied);
272 bool isSameStructure(
const StaffType&)
const;
275 const QString&
name()
const {
return _name; }
276 const QString&
xmlName()
const {
return _xmlName; }
277 void setName(
const QString& val) { _name = val; }
279 const char* groupName()
const;
283 int lines()
const {
return _lines; }
293 bool small()
const {
return _small; }
313 static const StaffType* presetFromXmlName(QString& xmlName);
322 QString fretString(
int fret,
int string,
bool ghost)
const;
326 int physStringToVisual(
int strg)
const;
327 int visualStringToPhys(
int line)
const;
328 qreal physStringToYOffset(
int strg)
const;
329 QString tabBassStringPrefix(
int strg,
bool* hasFret)
const;
330 void drawInputStringMarks(QPainter* p,
int string,
int voice, QRectF rect)
const;
331 int numOfTabLedgerLines(
int string)
const;
334 qreal durationBoxH()
const;
335 qreal durationBoxY()
const;
338 const QString
durationFontName()
const {
return _durationFonts[_durationFontIdx].displayName; }
341 qreal
durationFontYOffset()
const { setDurationMetrics();
return _durationYOffset + _durationFontUserY * SPATIUM20; }
343 qreal
fretBoxH()
const { setFretMetrics();
return _fretBoxH; }
344 qreal
fretBoxY()
const { setFretMetrics();
return _fretBoxY + _fretFontUserY * SPATIUM20; }
348 qreal
fretMaskY()
const {
return (_onLines ? -0.5 : -1.0) * _lineDistance.
val() * SPATIUM20; }
350 const QFont&
fretFont()
const {
return _fretFont; }
351 const QString
fretFontName()
const {
return _fretFonts[_fretFontIdx].displayName; }
354 qreal
fretFontYOffset()
const { setFretMetrics();
return _fretYOffset + _fretFontUserY * SPATIUM20; }
369 void setDurationFontName(
const QString&);
370 void setDurationFontSize(qreal);
372 void setFretFontName(
const QString&);
373 void setFretFontSize(qreal);
379 void setOnLines(
bool);
385 void setUseNumbers(
bool val) { _useNumbers = val; _fretMetricsValid =
false; }
389 QPointF chordStemPos(
const Chord*)
const;
390 qreal chordRestStemPosY(
const ChordRest*)
const;
392 QPointF chordStemPosBeam(
const Chord*)
const;
393 qreal chordStemLength(
const Chord*)
const;
398 static QList<QString> fontNames(
bool bDuration);
399 static bool fontData(
bool bDuration,
int nIdx, QString *pFamily, QString *pDisplayName, qreal * pSize, qreal *pYOff);
401 static void initStaffTypes();
402 static const std::vector<StaffType>&
presets() {
return _presets; }
433 virtual void draw(QPainter*)
const;
435 virtual void layout();
QString _name
Definition: stafftype.h:179
QString slashChar[NUM_OF_BASSSTRING_SLASHES]
Definition: stafftype.h:99
QFont _durationFont
Definition: stafftype.h:226
bool linesThrough() const
Definition: stafftype.h:356
bool genClef() const
Definition: stafftype.h:289
void setShowTabFingering(bool val)
Definition: stafftype.h:384
QChar xChar
Definition: stafftype.h:97
bool showTabFingering() const
Definition: stafftype.h:364
TablatureMinimStyle minimStyle() const
Definition: stafftype.h:357
#define NUM_OF_DIGITFRETS
Definition: stafftype.h:81
void setMinimStyle(TablatureMinimStyle val)
Definition: stafftype.h:377
void setUseNumbers(bool val)
Definition: stafftype.h:385
qreal fretMaskH() const
Definition: stafftype.h:347
DurationType
Definition: durationtype.h:30
bool stemless() const
Definition: stafftype.h:304
void setGenClef(bool val)
Definition: stafftype.h:288
static QList< TablatureFretFont > _fretFonts
Definition: stafftype.h:246
QChar displayLetter[NUM_OF_LETTERFRETS]
Definition: stafftype.h:101
Spatium lineDistance() const
Definition: stafftype.h:287
NoteHeadScheme
Definition: mscore.h:182
Base class of score layout elements.
Definition: element.h:158
Definition: stafftype.h:420
void setStepOffset(int v)
Definition: stafftype.h:284
TablatureMinimStyle
Definition: stafftype.h:121
qreal userMag() const
Definition: stafftype.h:292
bool _repeat
Definition: stafftype.h:426
StaffGroup
Definition: mscore.h:177
virtual ~StaffType()
Definition: stafftype.h:270
bool upsideDown() const
Definition: stafftype.h:363
QString displayName
Definition: stafftype.h:136
virtual bool isEditable() const
Definition: stafftype.h:434
bool isRepeat() const
Definition: stafftype.h:444
bool showBarlines() const
Definition: stafftype.h:291
void setXmlName(const QString &val)
Definition: stafftype.h:278
void setLinesThrough(bool val)
Definition: stafftype.h:376
void setShowLedgerLines(bool val)
Definition: stafftype.h:317
void setSmall(bool val)
Definition: stafftype.h:295
const QFont & durationFont() const
Definition: stafftype.h:337
bool showLedgerLines() const
Definition: stafftype.h:318
#define STAFFTYPE_TAB_DEFAULTSTEMPOSX
Definition: stafftype.h:36
bool useNumbers() const
Definition: stafftype.h:365
const StaffType * _tab
Definition: stafftype.h:424
const QFont & fretFont() const
Definition: stafftype.h:350
QChar ghostChar
Definition: stafftype.h:98
qreal defPitch
Definition: stafftype.h:137
void setUserMag(qreal val)
Definition: stafftype.h:294
constexpr qreal val() const
Definition: spatium.h:32
TablatureSymbolRepeat symRepeat() const
Definition: stafftype.h:358
bool isTabStaff() const
Definition: stafftype.h:395
bool genKeysig() const
Definition: stafftype.h:316
int lines() const
Definition: stafftype.h:283
bool onLines() const
Definition: stafftype.h:359
#define NUM_OF_LETTERFRETS
Definition: stafftype.h:82
Definition: stafftype.h:92
QString displayName
Definition: stafftype.h:94
const int STAFF_GROUP_MAX
Definition: mscore.h:180
void setName(const QString &val)
Definition: stafftype.h:277
virtual TabDurationSymbol * clone() const
Definition: stafftype.h:432
StaffTypes
Definition: stafftype.h:153
TabBeamGrid _beamGrid
Definition: stafftype.h:423
qreal defPitch
Definition: stafftype.h:95
int stepOffset() const
Definition: stafftype.h:285
qreal fretFontSize() const
Definition: stafftype.h:352
bool stemsDown() const
Definition: stafftype.h:361
qreal durationFontYOffset() const
Definition: stafftype.h:341
qreal durationGridYOffset() const
Definition: stafftype.h:342
const QString durationFontName() const
Definition: stafftype.h:338
QString family
Definition: stafftype.h:135
const QString & name() const
Definition: stafftype.h:275
int _beamLevel
Definition: stafftype.h:422
Definition: aeolus.cpp:26
TabVal
Definition: stafftype.h:106
bool isDrumStaff() const
Definition: stafftype.h:396
bool small() const
Definition: stafftype.h:293
qreal durationFontUserY() const
Definition: stafftype.h:340
void setUpsideDown(bool val)
Definition: stafftype.h:383
QString _text
Definition: stafftype.h:425
qreal fretMaskY() const
Definition: stafftype.h:348
Definition: stafftype.h:173
bool stemThrough() const
Definition: stafftype.h:362
TablatureSymbolRepeat
Definition: stafftype.h:127
void setSymbolRepeat(TablatureSymbolRepeat val)
Definition: stafftype.h:378
void setFretFontUserY(qreal val)
Definition: stafftype.h:374
QString displayDigit[NUM_OF_DIGITFRETS]
Definition: stafftype.h:100
virtual ElementType type() const
Definition: stafftype.h:436
StaffGroup group() const
Definition: stafftype.h:274
void setShowBackTied(bool val)
Definition: stafftype.h:386
Definition: xmlwriter.h:26
QString family
Definition: stafftype.h:93
static std::vector< StaffType > _presets
Definition: stafftype.h:248
void setLines(int val)
Definition: stafftype.h:282
Graphic representation of a chord.
Definition: chord.h:55
Definition: chordrest.h:48
qreal chordStemPosX(const Chord *) const
Definition: stafftype.h:391
bool genTimesig() const
Definition: stafftype.h:305
void setNoteHeadScheme(NoteHeadScheme s)
Definition: stafftype.h:319
const QString fretFontName() const
Definition: stafftype.h:351
bool genDurations() const
Definition: stafftype.h:355
qreal fretFontUserY() const
Definition: stafftype.h:353
QChar displayDot
Definition: stafftype.h:144
QString _xmlName
Definition: stafftype.h:178
void setLineDistance(const Spatium &val)
Definition: stafftype.h:286
qreal durationFontSize() const
Definition: stafftype.h:339
void setRepeat(bool val)
Definition: stafftype.h:445
qreal defYOffset
Definition: stafftype.h:96
static QList< TablatureDurationFont > _durationFonts
Definition: stafftype.h:247
void setGenDurations(bool val)
Definition: stafftype.h:375
void setStemless(bool val)
Definition: stafftype.h:303
Definition: stafftype.h:134
QString durationString(TDuration::DurationType type, int dots) const
Definition: stafftype.cpp:676
void setGenTimesig(bool val)
Definition: stafftype.h:306
QFont _fretFont
Definition: stafftype.h:237
void setStemsDown(bool val)
Definition: stafftype.h:381
bool showBackTied() const
Definition: stafftype.h:366
ElementType
Definition: types.h:34
void setDuration(TDuration::DurationType type, int dots, const StaffType *tab)
Definition: stafftype.h:440
const QString & xmlName() const
Definition: stafftype.h:276
qreal defYOffset
Definition: stafftype.h:138
TabBeamGrid
Definition: stafftype.h:413
TabBeamGrid beamGrid()
Definition: stafftype.h:438
qreal fretFontYOffset() const
Definition: stafftype.h:354
bool showRests() const
Definition: stafftype.h:360
qreal _beamLength
Definition: stafftype.h:421
NoteHeadScheme noteHeadScheme() const
Definition: stafftype.h:320
bool read(XmlReader &)
Definition: stafftype.cpp:1046
static const std::vector< StaffType > & presets()
Definition: stafftype.h:402
void setStemsThrough(bool val)
Definition: stafftype.h:382
qreal fretBoxY() const
Definition: stafftype.h:344
void setGenKeysig(bool val)
Definition: stafftype.h:315
#define NUM_OF_BASSSTRING_SLASHES
Definition: stafftype.h:83
qreal fretBoxH() const
Definition: stafftype.h:343
void setShowBarlines(bool val)
Definition: stafftype.h:290
Spatium yoffset() const
Definition: stafftype.h:296
void setDurationFontUserY(qreal val)
Definition: stafftype.h:371
void setYoffset(Spatium val)
Definition: stafftype.h:297
void setShowRests(bool val)
Definition: stafftype.h:380