Merge branch 'master' of github.com:musescore/MuseScore

This commit is contained in:
ws 2013-06-24 10:27:25 +02:00
commit c086620594
17 changed files with 120 additions and 42 deletions

View file

@ -165,10 +165,6 @@ void Beam::remove(ChordRest* a)
void Beam::draw(QPainter* painter) const
{
if (staff()->isTabStaff()) {
if (staff()->staffType()->slashStyle())
return;
}
painter->setBrush(QBrush(curColor()));
painter->setPen(Qt::NoPen);
qreal lw2 = point(score()->styleS(ST_beamWidth)) * .5 * mag();

View file

@ -1074,9 +1074,9 @@ qreal Chord::centerX() const
void Chord::scanElements(void* data, void (*func)(void*, Element*), bool all)
{
if (_hook)
func(data, _hook);
if (_stem)
if (_hook && !measure()->slashStyle(staffIdx()))
func(data, _hook );
if (_stem && !measure()->slashStyle(staffIdx()))
func(data, _stem);
if (_stemSlash)
func(data, _stemSlash);
@ -1086,8 +1086,9 @@ void Chord::scanElements(void* data, void (*func)(void*, Element*), bool all)
func(data, _tremolo);
if (_glissando)
func(data, _glissando);
for (LedgerLine* ll = _ledgerLines; ll; ll = ll->next())
func(data, ll);
if(staff()->showLedgerLines())
for (LedgerLine* ll = _ledgerLines; ll; ll = ll->next())
func(data, ll);
int n = _notes.size();
for (int i = 0; i < n; ++i)
_notes.at(i)->scanElements(data, func, all);
@ -1598,7 +1599,7 @@ void Chord::layoutPitched()
score()->undoRemoveElement(_hook);
else {
_hook->layout();
if (up()) {
if (up() && stem()) {
// hook position is not set yet
qreal x = _hook->bbox().right() + stem()->hookPos().x();
rrr = qMax(rrr, x);

View file

@ -124,7 +124,8 @@ ChordRest::~ChordRest()
void ChordRest::scanElements(void* data, void (*func)(void*, Element*), bool all)
{
if (_beam && (_beam->elements().front() == this))
if (_beam && (_beam->elements().front() == this)
&& !measure()->slashStyle(staffIdx()))
_beam->scanElements(data, func, all);
foreach(Articulation* a, _articulations)
func(data, a);

View file

@ -706,7 +706,7 @@ bool Element::readProperties(XmlReader& e)
}
else if (tag == "tick") {
int val = e.readInt();
if (type() != SYMBOL && type() != TEMPO_TEXT && (type() != GLISSANDO || score()->mscVersion() > 114)) // hack for 1.2
if (val >= 0 && type() != SYMBOL && type() != TEMPO_TEXT && (type() != GLISSANDO || score()->mscVersion() > 114)) // hack for 1.2
e.setTick(score()->fileDivision(val));
}
else if (tag == "offset") { // ??obsolete -> used for volta

View file

@ -100,7 +100,7 @@ void KeySig::layout()
qreal _spatium = spatium();
setbbox(QRectF());
if (staff() && staff()->isTabStaff()) { // no key sigs on TAB staves
if (staff() && !staff()->genKeySig()) { // no key sigs on TAB staves
foreach(KeySym* ks, keySymbols)
delete ks;
keySymbols.clear();

View file

@ -2321,7 +2321,7 @@ bool Measure::visible(int staffIdx) const
bool Measure::slashStyle(int staffIdx) const
{
return score()->staff(staffIdx)->slashStyle() || staves[staffIdx]->_slashStyle;
return score()->staff(staffIdx)->slashStyle() || staves[staffIdx]->_slashStyle || score()->staff(staffIdx)->staffType()->slashStyle();
}
//---------------------------------------------------------

View file

@ -74,5 +74,13 @@ void NoteDot::read(XmlReader& e)
}
}
//---------------------------------------------------------
// mag
//---------------------------------------------------------
qreal NoteDot::mag() const
{
return parent()->mag() * score()->styleD(ST_dotMag);
}
}

View file

@ -32,7 +32,7 @@ class NoteDot : public Element {
virtual ElementType type() const { return NOTEDOT; }
int idx() const { return _idx; }
void setIdx(int val) { _idx = val; }
virtual qreal mag() const { return parent()->mag(); }
virtual qreal mag() const;
virtual void draw(QPainter*) const;
virtual void write(Xml& xml) const;

View file

@ -845,5 +845,33 @@ void Staff::setInitialClef(ClefType ct)
_initialClef = ClefTypeList(ct, ct);
}
bool Staff::genKeySig()
{
switch(_staffType->group()) {
case TAB_STAFF:
return false;
case PITCHED_STAFF:
return static_cast<StaffTypePitched*>(_staffType)->genKeysig();
case PERCUSSION_STAFF:
return static_cast<StaffTypePercussion*>(_staffType)->genKeysig();
default:
return true;
}
}
bool Staff::showLedgerLines()
{
switch(_staffType->group()) {
case TAB_STAFF:
return false;
case PITCHED_STAFF:
return static_cast<StaffTypePitched*>(_staffType)->showLedgerLines();
case PERCUSSION_STAFF:
return static_cast<StaffTypePercussion*>(_staffType)->showLedgerLines();
default:
return true;
}
}
}

View file

@ -190,6 +190,7 @@ class Staff : public QObject {
StaffType* staffType() const { return _staffType; }
void setStaffType(StaffType* st);
StaffGroup staffGroup() const { return _staffType->group(); }
bool isPitchedStaff() const { return staffGroup() == PITCHED_STAFF; }
bool isTabStaff() const { return staffGroup() == TAB_STAFF; }
bool isDrumStaff() const { return staffGroup() == PERCUSSION_STAFF; }
@ -205,6 +206,8 @@ class Staff : public QObject {
qreal userDist() const { return _userDist; }
void setUserDist(qreal val) { _userDist = val; }
void spatiumChanged(qreal /*oldValue*/, qreal /*newValue*/);
bool genKeySig();
bool showLedgerLines();
};
} // namespace Ms

View file

@ -96,6 +96,7 @@ StyleType styleTypes[] = {
StyleType("beamMinSlope", ST_DOUBLE),
StyleType("beamMaxSlope", ST_DOUBLE),
StyleType("maxBeamTicks", ST_INT),
StyleType("dotMag", ST_DOUBLE),
StyleType("dotNoteDistance", ST_SPATIUM),
StyleType("dotRestDistance", ST_SPATIUM),
StyleType("dotDotDistance", ST_SPATIUM),
@ -490,6 +491,7 @@ StyleData::StyleData()
StyleVal(ST_beamMaxSlope, qreal(0.2)),
StyleVal(ST_maxBeamTicks, MScore::division),
StyleVal(ST_dotMag, qreal(1.0)),
StyleVal(ST_dotNoteDistance, Spatium(0.35)),
StyleVal(ST_dotRestDistance, Spatium(0.25)),
StyleVal(ST_dotDotDistance, Spatium(0.5)),

View file

@ -216,6 +216,7 @@ enum StyleIdx {
ST_beamMaxSlope,
ST_maxBeamTicks,
ST_dotMag,
ST_dotNoteDistance,
ST_dotRestDistance,
ST_dotDotDistance,

View file

@ -272,6 +272,7 @@ void EditStyle::getValues()
lstyle.set(ST_accidentalNoteDistance, Spatium(accidentalNoteDistance->value()));
lstyle.set(ST_accidentalDistance, Spatium(accidentalDistance->value()));
lstyle.set(ST_dotMag, dotMag->value() * 0.01);
lstyle.set(ST_dotNoteDistance, Spatium(noteDotDistance->value()));
lstyle.set(ST_dotDotDistance, Spatium(dotDotDistance->value()));
lstyle.set(ST_stemWidth, Spatium(stemWidth->value()));
@ -506,6 +507,7 @@ void EditStyle::setValues()
accidentalNoteDistance->setValue(lstyle.valueS(ST_accidentalNoteDistance).val());
accidentalDistance->setValue(lstyle.valueS(ST_accidentalDistance).val());
dotMag->setValue(lstyle.value(ST_dotMag).toDouble() * 100.0);
noteDotDistance->setValue(lstyle.valueS(ST_dotNoteDistance).val());
dotDotDistance->setValue(lstyle.valueS(ST_dotDotDistance).val());
stemWidth->setValue(lstyle.valueS(ST_stemWidth).val());

View file

@ -7,7 +7,7 @@
<x>0</x>
<y>0</y>
<width>875</width>
<height>556</height>
<height>565</height>
</rect>
</property>
<property name="windowTitle">
@ -163,7 +163,7 @@
<item row="0" column="1">
<widget class="QStackedWidget" name="pageStack">
<property name="currentIndex">
<number>0</number>
<number>6</number>
</property>
<widget class="QWidget" name="Seite1">
<layout class="QVBoxLayout" name="verticalLayout_20">
@ -2407,14 +2407,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="1" column="0">
<item row="3" column="0">
<widget class="QLabel" name="label_43">
<property name="text">
<string>Accidental distance</string>
</property>
</widget>
</item>
<item row="1" column="1">
<item row="3" column="1">
<widget class="QDoubleSpinBox" name="accidentalDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2430,14 +2430,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="2" column="0">
<item row="5" column="0">
<widget class="QLabel" name="label_22">
<property name="text">
<string>Note dot distance</string>
</property>
</widget>
</item>
<item row="2" column="1">
<item row="5" column="1">
<widget class="QDoubleSpinBox" name="noteDotDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2453,14 +2453,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="3" column="0">
<item row="6" column="0">
<widget class="QLabel" name="label_23">
<property name="text">
<string>Dot dot distance</string>
</property>
</widget>
</item>
<item row="3" column="1">
<item row="6" column="1">
<widget class="QDoubleSpinBox" name="dotDotDistance">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2476,14 +2476,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="5" column="0">
<item row="8" column="0">
<widget class="QLabel" name="label_24">
<property name="text">
<string>Ledger line width</string>
</property>
</widget>
</item>
<item row="5" column="1">
<item row="8" column="1">
<widget class="QDoubleSpinBox" name="ledgerLineWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2499,14 +2499,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="6" column="0">
<item row="9" column="0">
<widget class="QLabel" name="label_34">
<property name="text">
<string>Ledger line length</string>
</property>
</widget>
</item>
<item row="6" column="1">
<item row="9" column="1">
<widget class="QDoubleSpinBox" name="ledgerLineLength">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2522,14 +2522,14 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="4" column="0">
<item row="7" column="0">
<widget class="QLabel" name="label_100">
<property name="text">
<string>Stem width</string>
</property>
</widget>
</item>
<item row="4" column="1">
<item row="7" column="1">
<widget class="QDoubleSpinBox" name="stemWidth">
<property name="sizePolicy">
<sizepolicy hsizetype="Preferred" vsizetype="Fixed">
@ -2545,6 +2545,32 @@ p, li { white-space: pre-wrap; }
</property>
</widget>
</item>
<item row="4" column="0">
<widget class="QLabel" name="label_101">
<property name="text">
<string>Dot size</string>
</property>
</widget>
</item>
<item row="4" column="1">
<widget class="QSpinBox" name="dotMag">
<property name="suffix">
<string>%</string>
</property>
<property name="minimum">
<number>50</number>
</property>
<property name="maximum">
<number>200</number>
</property>
<property name="singleStep">
<number>10</number>
</property>
<property name="value">
<number>100</number>
</property>
</widget>
</item>
</layout>
</item>
<item>

View file

@ -1451,8 +1451,13 @@ void OveToMScore::convertNotes(Measure* measure, int part, int staff, int track)
}
cr->setDuration(cr->durationType().fraction());
//TODO-S Segment* s = measure->getGraceSegment(tick, graceLevel);
//TODO-S Deal with grace notes
// Segment* s = measure->getGraceSegment(tick, graceLevel);
// s->add(cr);
if(graceLevel == 0) {
Segment* s = measure->getSegment(cr, tick);
s->add(cr);
}
}
for (j = 0; j < notes.size(); ++j) {

View file

@ -4833,9 +4833,12 @@ void MusicXml::xmlNote(Measure* measure, int staff, const QString& partId, Beam*
}
cr->setDots(dots);
cr->setDuration(cr->durationType().fraction());
// qDebug(" cr->tick()=%d ", cr->tick());
//TODO-S Segment* s = measure->getGraceSegment(loc_tick, gl);
// s->add(cr);
//qDebug(" cr->tick()=%d ", cr->tick());
//TODO-S deal with grace notes
if(gl == 0) {
Segment* s = measure->getSegment(cr, loc_tick);
s->add(cr);
}
}
cr->setStaffMove(move);

View file

@ -4130,6 +4130,7 @@ void MuseScore::cmd(QAction* a, const QString& cmd)
if (est->exec() && est->isModified()) {
Score* score = cs;
score->startCmd();
score->deselectAll();
QList<StaffType*> tl = est->getStaffTypes();
score->replaceStaffTypes(tl);
score->setLayoutAll(true);
@ -4676,18 +4677,19 @@ int main(int argc, char* av[])
QApplication::setStyle(st);
qApp->setStyleSheet(appStyleSheet());
QPalette p(QApplication::palette());
p.setColor(QPalette::Window, QColor(0x52, 0x52, 0x52));
p.setColor(QPalette::WindowText, Qt::white);
p.setColor(QPalette::Base, QColor(0x42, 0x42, 0x42));
p.setColor(QPalette::AlternateBase, QColor(0x62, 0x62, 0x62));
p.setColor(QPalette::Text, Qt::white);
p.setColor(QPalette::Button, QColor(0x52, 0x52, 0x52));
p.setColor(QPalette::ButtonText, Qt::white);
p.setColor(QPalette::BrightText, Qt::black);
QSettings s;
p.setColor(QPalette::Window, QColor(s.value("WindowColor", "#525252").toString()));
p.setColor(QPalette::WindowText, QColor(s.value("WindowTextColor", "#FFFFFF").toString()));
p.setColor(QPalette::Base, QColor(s.value("BaseColor", "#424242").toString()));
p.setColor(QPalette::AlternateBase, QColor(s.value("AlternateBaseColor", "#626262").toString()));
p.setColor(QPalette::Text, QColor(s.value("TextColor", "#FFFFFF").toString()));
p.setColor(QPalette::Button, QColor(s.value("ButtonColor", "#525252").toString()));
p.setColor(QPalette::ButtonText, QColor(s.value("ButtonTextColor", "#FFFFFF").toString()));
p.setColor(QPalette::BrightText, QColor(s.value("BrightTextColor", "#000000").toString()));
QApplication::setPalette(p);
QPalette palette = QToolTip::palette();
palette.setBrush(QPalette::ToolTipBase, QBrush(Qt::darkGray));
palette.setBrush(QPalette::ToolTipBase, QBrush(QColor(s.value("ToolTipBaseColor", "#808080").toString())));
QToolTip::setPalette(palette);
break;