本文整理汇总了C++中FretDiagram类的典型用法代码示例。如果您正苦于以下问题:C++ FretDiagram类的具体用法?C++ FretDiagram怎么用?C++ FretDiagram使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了FretDiagram类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: tag
void Box::read(const QDomElement& de)
{
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
bool keepMargins = false; // whether original margins have to be kept when reading old file
for (QDomElement e = de.firstChildElement(); !e.isNull(); e = e.nextSiblingElement()) {
const QString& tag(e.tagName());
const QString& text(e.text());
if (tag == "height")
_boxHeight = Spatium(text.toDouble());
else if (tag == "width")
_boxWidth = Spatium(text.toDouble());
else if (tag == "topGap")
_topGap = text.toDouble();
else if (tag == "bottomGap")
_bottomGap = text.toDouble();
else if (tag == "leftMargin")
_leftMargin = text.toDouble();
else if (tag == "rightMargin")
_rightMargin = text.toDouble();
else if (tag == "topMargin")
_topMargin = text.toDouble();
else if (tag == "bottomMargin")
_bottomMargin = text.toDouble();
else if (tag == "Text") {
Text* t;
if (type() == TBOX) {
t = static_cast<TBox*>(this)->getText();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
add(t);
if (score()->mscVersion() <= 114)
t->setLayoutToParentWidth(true);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
// look ahead for image type
QString path;
QDomElement ee = e.firstChildElement("path");
if (!ee.isNull())
path = ee.text();
Image* image = 0;
QString s(path.toLower());
if (s.endsWith(".svg"))
image = new SvgImage(score());
else
if (s.endsWith(".jpg")
|| s.endsWith(".png")
|| s.endsWith(".gif")
|| s.endsWith(".xpm")
) {
image = new RasterImage(score());
}
else {
qDebug("unknown image format <%s>\n", path.toLatin1().data());
}
if (image) {
image->setTrack(score()->curTrack);
image->read(e);
add(image);
}
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else
domError(e);
}
// with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
// for backward compatibility set them to 0 in all other cases
if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins) {
//.........这里部分代码省略.........
示例2: add
void FBox::add(Element* e)
{
e->setParent(this);
if (e->type() == FRET_DIAGRAM) {
FretDiagram* fd = static_cast<FretDiagram*>(e);
fd->setFlag(ELEMENT_MOVABLE, false);
}
else {
qDebug("FBox::add: element not allowed\n");
return;
}
_el.append(e);
}
示例3: FretDiagram
void MuseScore::setBasicPalette()
{
mscore->getPaletteBox();
paletteBox->clear();
paletteBox->addPalette(newGraceNotePalette());
paletteBox->addPalette(newClefsPalette());
paletteBox->addPalette(newKeySigPalette());
paletteBox->addPalette(newTimePalette());
paletteBox->addPalette(newBarLinePalette());
paletteBox->addPalette(newLinesPalette());
paletteBox->addPalette(newArpeggioPalette());
paletteBox->addPalette(newBreathPalette());
paletteBox->addPalette(newBracketsPalette());
paletteBox->addPalette(newArticulationsPalette());
paletteBox->addPalette(newAccidentalsPalette(true));
paletteBox->addPalette(newDynamicsPalette());
paletteBox->addPalette(newFingeringPalette());
paletteBox->addPalette(newNoteHeadsPalette());
paletteBox->addPalette(newTremoloPalette());
paletteBox->addPalette(newRepeatsPalette());
paletteBox->addPalette(newTempoPalette());
paletteBox->addPalette(newTextPalette());
paletteBox->addPalette(newBreaksPalette());
// paletteBox->addPalette(newBagpipeEmbellishmentPalette());
paletteBox->addPalette(newBeamPalette());
paletteBox->addPalette(newFramePalette());
//-----------------------------------
// Symbols
//-----------------------------------
Palette* sp = new Palette;
sp->setName(QT_TRANSLATE_NOOP("Palette", "Symbols"));
sp->setGrid(42, 45);
sp->setDrawGrid(true);
FretDiagram* fret = new FretDiagram(gscore);
fret->setDot(5, 1);
fret->setDot(2, 2);
fret->setDot(1, 3);
fret->setMarker(0, 'X');
fret->setMarker(3, 'O');
fret->setMarker(4, 'O');
sp->append(fret, tr("Fretboard Diagram"));
paletteBox->addPalette(sp);
}
示例4: StaffState
void MuseScore::setAdvancedPalette()
{
mscore->getPaletteBox();
paletteBox->clear();
paletteBox->addPalette(newGraceNotePalette());
paletteBox->addPalette(newClefsPalette());
paletteBox->addPalette(newKeySigPalette());
paletteBox->addPalette(newTimePalette());
paletteBox->addPalette(newBarLinePalette());
paletteBox->addPalette(newLinesPalette());
paletteBox->addPalette(newArpeggioPalette());
paletteBox->addPalette(newBreathPalette());
paletteBox->addPalette(newBracketsPalette());
paletteBox->addPalette(newArticulationsPalette());
paletteBox->addPalette(newAccidentalsPalette());
paletteBox->addPalette(newDynamicsPalette());
paletteBox->addPalette(newFingeringPalette());
paletteBox->addPalette(newNoteHeadsPalette());
paletteBox->addPalette(newTremoloPalette());
paletteBox->addPalette(newRepeatsPalette());
paletteBox->addPalette(newTempoPalette());
paletteBox->addPalette(newTextPalette());
paletteBox->addPalette(newBreaksPalette());
paletteBox->addPalette(newBagpipeEmbellishmentPalette());
//-----------------------------------
// staff state changes
//-----------------------------------
#if 0
sp = new Palette;
sp->setName(QT_TRANSLATE_NOOP("Palette", "Staff Changes"));
sp->setMag(.7);
sp->setGrid(42, 36);
sp->setDrawGrid(true);
StaffState* st = new StaffState(gscore);
st->setSubtype(StaffStateType::VISIBLE);
sp->append(st, tr("set visible"));
st = new StaffState(gscore);
st->setSubtype(StaffStateType::INVISIBLE);
sp->append(st, tr("set invisible"));
st = new StaffState(gscore);
st->setSubtype(StaffStateType::TYPE);
sp->append(st, tr("change staff type"));
st = new StaffState(gscore);
st->setSubtype(StaffStateType::INSTRUMENT);
sp->append(st, tr("change instrument"));
paletteBox->addPalette(sp);
#endif
paletteBox->addPalette(newBeamPalette());
paletteBox->addPalette(newFramePalette());
//-----------------------------------
// Symbols
//-----------------------------------
Palette* sp = new Palette;
sp->setName(QT_TRANSLATE_NOOP("Palette", "Symbols"));
sp->setGrid(42, 45);
sp->setDrawGrid(true);
/* sp->append(SymId(accDiscantSym));
sp->append(SymId(accDotSym));
sp->append(SymId(accFreebaseSym));
sp->append(SymId(accStdbaseSym));
sp->append(SymId(accBayanbaseSym));
sp->append(SymId(accOldEESym));
sp->append(SymId(accpushSym));
sp->append(SymId(accpullSym));
*/
FretDiagram* fret = new FretDiagram(gscore);
fret->setDot(5, 1);
fret->setDot(2, 2);
fret->setDot(1, 3);
fret->setMarker(0, 'X');
fret->setMarker(3, 'O');
fret->setMarker(4, 'O');
sp->append(fret, tr("Fretboard Diagram"));
paletteBox->addPalette(sp);
}
示例5: FretDiagram
FretDiagram* FretDiagram::fromString(Score* score, const QString &s)
{
FretDiagram* fd = new FretDiagram(score);
fd->setStrings(s.size());
fd->setFrets(4);
int offset = 0;
int barreString = -1;
for (int i = 0; i < s.size(); i++) {
QChar c = s.at(i);
if (c == 'X' or c == 'O')
fd->setMarker(i, c.unicode());
else if (c == '-' && barreString == -1) {
fd->setBarre(1);
barreString = i;
}
else {
int fret = c.digitValue();
if (fret != -1) {
fd->setDot(i, fret);
if (fret - 3 > 0 && offset < fret - 3)
offset = fret - 3;
}
}
}
if (offset > 0) {
fd->setOffset(offset);
for (int i = 0; i < fd->strings(); i++)
if (fd->dot(i))
fd->setDot(i, fd->dot(i) - offset);
}
if (barreString >= 0)
fd->setDot(barreString, 1);
return fd;
}
示例6: StaffState
void MuseScore::populatePalette()
{
paletteBox->addPalette(newGraceNotePalette());
paletteBox->addPalette(newClefsPalette());
paletteBox->addPalette(newKeySigPalette());
paletteBox->addPalette(newTimePalette());
paletteBox->addPalette(newBarLinePalette());
paletteBox->addPalette(newLinesPalette());
paletteBox->addPalette(newArpeggioPalette());
paletteBox->addPalette(newBreathPalette());
paletteBox->addPalette(newBracketsPalette());
paletteBox->addPalette(newArticulationsPalette());
paletteBox->addPalette(newAccidentalsPalette());
paletteBox->addPalette(newDynamicsPalette());
paletteBox->addPalette(newFingeringPalette());
paletteBox->addPalette(newNoteHeadsPalette());
paletteBox->addPalette(newTremoloPalette());
paletteBox->addPalette(newFallDoitPalette());
paletteBox->addPalette(newRepeatsPalette());
paletteBox->addPalette(newTextPalette());
paletteBox->addPalette(newBreaksPalette());
//-----------------------------------
// staff state changes
//-----------------------------------
#if 0
sp = new Palette;
sp->setName(tr("Staff Changes"));
sp->setMag(.7);
sp->setGrid(42, 36);
sp->setDrawGrid(true);
StaffState* st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_VISIBLE);
sp->append(st, tr("set visible"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_INVISIBLE);
sp->append(st, tr("set invisible"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_TYPE);
sp->append(st, tr("change staff type"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_INSTRUMENT);
sp->append(st, tr("change instrument"));
paletteBox->addPalette(sp);
#endif
paletteBox->addPalette(newBeamPalette());
paletteBox->addPalette(newFramePalette());
//-----------------------------------
// Symbols
//-----------------------------------
Palette* sp = new Palette;
sp->setName(tr("Symbols"));
sp->setGrid(42, 45);
sp->setDrawGrid(true);
sp->append(accDiscantSym);
sp->append(accDotSym);
sp->append(accFreebaseSym);
sp->append(accStdbaseSym);
sp->append(accBayanbaseSym);
sp->append(accOldEESym);
sp->append(accpushSym);
sp->append(accpullSym);
FretDiagram* fret = new FretDiagram(gscore);
fret->setDot(5, 1);
fret->setDot(2, 2);
fret->setDot(1, 3);
fret->setMarker(0, 'X');
fret->setMarker(3, 'O');
fret->setMarker(4, 'O');
sp->append(fret, tr("Fret Diagram"));
paletteBox->addPalette(sp);
}
示例7: while
void Box::read(XmlReader& e)
{
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
bool keepMargins = false; // whether original margins have to be kept when reading old file
while (e.readNextStartElement()) {
const QStringRef& tag(e.name());
if (tag == "height")
_boxHeight = Spatium(e.readDouble());
else if (tag == "width")
_boxWidth = Spatium(e.readDouble());
else if (tag == "topGap")
_topGap = e.readDouble();
else if (tag == "bottomGap")
_bottomGap = e.readDouble();
else if (tag == "leftMargin")
_leftMargin = e.readDouble();
else if (tag == "rightMargin")
_rightMargin = e.readDouble();
else if (tag == "topMargin")
_topMargin = e.readDouble();
else if (tag == "bottomMargin")
_bottomMargin = e.readDouble();
else if (tag == "Text") {
Text* t;
if (type() == TBOX) {
t = static_cast<TBox*>(this)->getText();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
add(t);
if (score()->mscVersion() <= 114)
t->setLayoutToParentWidth(true);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
Image* image = new Image(score());
image->setTrack(e.track());
image->read(e);
add(image);
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
keepMargins = true; // in old file, box nesting used outer box margins
}
else if (Element::readProperties(e))
;
else
e.unknown();
}
// with .msc versions prior to 1.17, box margins were only used when nesting another box inside this box:
// for backward compatibility set them to 0 in all other cases
if (score()->mscVersion() < 117 && (type() == HBOX || type() == VBOX) && !keepMargins) {
_leftMargin = _rightMargin = _topMargin = _bottomMargin = 0.0;
}
}
示例8: tag
bool Box::readProperties(XmlReader& e)
{
const QStringRef& tag(e.name());
if (tag == "height")
_boxHeight = Spatium(e.readDouble());
else if (tag == "width")
_boxWidth = Spatium(e.readDouble());
else if (tag == "topGap") {
_topGap = e.readDouble();
if (score()->mscVersion() >= 203)
_topGap *= score()->spatium();
}
else if (tag == "bottomGap") {
_bottomGap = e.readDouble();
if (score()->mscVersion() >= 203)
_bottomGap *= score()->spatium();
}
else if (tag == "leftMargin")
_leftMargin = e.readDouble();
else if (tag == "rightMargin")
_rightMargin = e.readDouble();
else if (tag == "topMargin")
_topMargin = e.readDouble();
else if (tag == "bottomMargin")
_bottomMargin = e.readDouble();
else if (tag == "Text") {
Text* t;
if (type() == Element::Type::TBOX) {
t = static_cast<TBox*>(this)->text();
t->read(e);
}
else {
t = new Text(score());
t->read(e);
if (t->isEmpty()) {
qDebug("read empty text");
}
else
add(t);
}
}
else if (tag == "Symbol") {
Symbol* s = new Symbol(score());
s->read(e);
add(s);
}
else if (tag == "Image") {
if (MScore::noImages)
e.skipCurrentElement();
else {
Image* image = new Image(score());
image->setTrack(e.track());
image->read(e);
add(image);
}
}
else if (tag == "FretDiagram") {
FretDiagram* f = new FretDiagram(score());
f->read(e);
add(f);
}
else if (tag == "LayoutBreak") {
LayoutBreak* lb = new LayoutBreak(score());
lb->read(e);
add(lb);
}
else if (tag == "HBox") {
HBox* hb = new HBox(score());
hb->read(e);
add(hb);
}
else if (tag == "VBox") {
VBox* vb = new VBox(score());
vb->read(e);
add(vb);
}
else if (Element::readProperties(e))
;
else
return false;
return true;
}
示例9: populateIconPalette
//.........这里部分代码省略.........
lb = new LayoutBreak(gscore);
lb->setSubtype(LAYOUT_BREAK_SECTION);
sp->append(lb, tr("Section break"));
Spacer* spacer = new Spacer(gscore);
spacer->setGap(3 * _spatium);
spacer->setSubtype(SPACER_DOWN);
sp->append(spacer, tr("Staff spacer down"));
spacer = new Spacer(gscore);
spacer->setGap(3 * _spatium);
spacer->setSubtype(SPACER_UP);
sp->append(spacer, tr("Staff spacer up"));
paletteBox->addPalette(sp);
//-----------------------------------
// staff state changes
//-----------------------------------
#if 0
sp = new Palette;
sp->setName(tr("Staff Changes"));
sp->setMag(.7);
sp->setGrid(42, 36);
sp->setDrawGrid(true);
StaffState* st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_VISIBLE);
sp->append(st, tr("set visible"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_INVISIBLE);
sp->append(st, tr("set invisible"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_TYPE);
sp->append(st, tr("change staff type"));
st = new StaffState(gscore);
st->setSubtype(STAFF_STATE_INSTRUMENT);
sp->append(st, tr("change instrument"));
paletteBox->addPalette(sp);
#endif
//-----------------------------------
// beam properties
//-----------------------------------
sp = new Palette;
sp->setName(tr("Beam Properties"));
sp->setGrid(27, 40);
sp->setDrawGrid(true);
static const IconAction bpa[] = {
{ ICON_SBEAM, "beam-start" },
{ ICON_MBEAM, "beam-mid" },
{ ICON_NBEAM, "no-beam" },
{ ICON_BEAM32, "beam32" },
{ ICON_BEAM64, "beam64" },
{ ICON_AUTOBEAM, "auto-beam" },
{ ICON_FBEAM1, "fbeam1" },
{ ICON_FBEAM2, "fbeam2" },
{ -1, ""}
};
populateIconPalette(sp, bpa);
paletteBox->addPalette(sp);
//-----------------------------------
// Symbols
//-----------------------------------
sp = new Palette;
sp->setName(tr("Symbols"));
sp->setGrid(42, 45);
sp->setDrawGrid(true);
sp->append(accDiscantSym);
sp->append(accDotSym);
sp->append(accFreebaseSym);
sp->append(accStdbaseSym);
sp->append(accBayanbaseSym);
sp->append(accOldEESym);
sp->append(accpushSym);
sp->append(accpullSym);
FretDiagram* fret = new FretDiagram(gscore);
fret->setDot(5, 1);
fret->setDot(2, 2);
fret->setDot(1, 3);
fret->setMarker(0, 'X');
fret->setMarker(3, 'O');
fret->setMarker(4, 'O');
sp->append(fret, tr("Fret Diagram"));
paletteBox->addPalette(sp);
}