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

This commit is contained in:
ws 2014-01-23 19:56:59 +01:00
commit 41dabf1182
12 changed files with 5910 additions and 745 deletions

File diff suppressed because it is too large Load diff

View file

@ -1931,7 +1931,9 @@ void Measure::read(XmlReader& e, int staffIdx)
if (spanner) {
spanner->setTick2(e.tick());
// if (spanner->track2() == -1)
spanner->setTrack2(e.track());
// the absence of a track tag [?] means the
// track is the same as the beginning of the slur
spanner->setTrack2(spanner->track());
if (spanner->type() == OTTAVA) {
Ottava* o = static_cast<Ottava*>(spanner);
o->staff()->updateOttava(o);

View file

@ -351,7 +351,7 @@ int MidiFile::readLong()
int val = 0;
for (int i = 0; i < 4; ++i) {
fp->getChar(&c);
val <<= 8;
val <<= 8;
val += (c & 0xff);
}
return val;

View file

@ -108,7 +108,7 @@
<item>
<widget class="QLabel" name="label_2">
<property name="text">
<string>Number of Frets:</string>
<string>Number of frets:</string>
</property>
</widget>
</item>

View file

@ -577,6 +577,9 @@
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>
@ -609,6 +612,9 @@
<property name="decimals">
<number>1</number>
</property>
<property name="minimum">
<double>-100.000000000000000</double>
</property>
<property name="singleStep">
<double>0.500000000000000</double>
</property>

View file

@ -126,7 +126,7 @@ void MTrack::processMeta(int tick, const MidiEvent& mm)
break; // lyric and text are added in importmidi_lyrics.cpp
case META_TRACK_NAME:
{
std::string text = MidiCharset::fromUchar(data);
const std::string text = MidiCharset::fromUchar(data);
if (name.isEmpty())
name = MidiCharset::convertToCharset(text);
}
@ -543,8 +543,7 @@ std::multimap<int, MTrack> createMTrackList(ReducedFraction &lastTick,
else if (e.type() == ME_NOTE) {
++events;
const int pitch = e.pitch();
const auto len = ReducedFraction::fromTicks(
(e.len() * MScore::division + mf->division() / 2) / mf->division());
const auto len = toMuseScoreTicks(e.len(), track.division);
if (tick + len > lastTick)
lastTick = tick + len;

View file

@ -105,6 +105,15 @@ bool areOnTimeValuesDifferent(const std::multimap<ReducedFraction, MidiChord> &c
return true;
}
bool areSingleNoteChords(const std::multimap<ReducedFraction, MidiChord> &chords)
{
for (const auto &chordEvent: chords) {
if (chordEvent.second.notes.size() > 1)
return false;
}
return true;
}
#endif
@ -139,43 +148,48 @@ void collectChords(std::multimap<int, MTrack> &tracks)
ReducedFraction fudgeTime = threshTime / 4;
ReducedFraction threshExtTime = threshTime / 2;
ReducedFraction startTime(-1, 1); // invalid
ReducedFraction currentChordStart(-1, 1); // invalid
ReducedFraction curThreshTime(-1, 1);
// if intersection of note durations is less than min(minNoteDuration, threshTime)
// then this is not a chord
ReducedFraction tol(-1, 1); // invalid
ReducedFraction beg(-1, 1);
ReducedFraction end(-1, 1);
// chords here consist of a single note
// because notes are not united into chords yet
// if note onTime goes after max chord offTime
// then this is not a chord but arpeggio
ReducedFraction maxOffTime(-1, 1);
// chords here should consist of a single note
// because notes are not united into chords yet
Q_ASSERT_X(areSingleNoteChords(chords),
"MChord: collectChords", "Some chords have more than one note");
for (auto it = chords.begin(); it != chords.end(); ) {
const auto &note = it->second.notes[0];
// this should not be executed when it == chords.begin()
if (it->first <= startTime + curThreshTime) {
if (it->first > beg)
beg = it->first;
if (it->first + note.len < end)
end = it->first + note.len;
if (note.len < tol)
tol = note.len;
if (end - beg >= tol) {
// add current note to the previous chord
// short events with len < minAllowedDuration must be cleaned up
Q_ASSERT_X(note.len >= minAllowedDuration(),
"MChord: collectChords", "Note length is less than min allowed duration");
if (it->first <= currentChordStart + curThreshTime) {
// this branch should not be executed when it == chords.begin()
Q_ASSERT_X(it != chords.begin(),
"MChord: collectChords", "it == chords.begin()");
if (it->first < maxOffTime) {
// add current note to the previous chord
auto prev = std::prev(it);
prev->second.notes.push_back(note);
if (it->first >= startTime + curThreshTime - fudgeTime)
if (it->first >= currentChordStart + curThreshTime - fudgeTime
&& curThreshTime == threshTime) {
curThreshTime += threshExtTime;
}
if (it->first + note.len > maxOffTime)
maxOffTime = it->first + note.len;
it = chords.erase(it);
continue;
}
}
else {
startTime = it->first;
beg = startTime;
end = startTime + note.len;
tol = threshTime;
if (curThreshTime != threshTime)
curThreshTime = threshTime;
}
currentChordStart = it->first;
maxOffTime = currentChordStart + note.len;
if (curThreshTime != threshTime)
curThreshTime = threshTime;
++it;
}

View file

@ -1415,7 +1415,7 @@ std::vector<TupletData> convertToData(const std::vector<TupletInfo> &tuplets)
return tupletsData;
}
// check is the chord is already in tuplet in prev bar or division
// check is the chord already in tuplet in prev bar or division
// it's possible because we use (startDivTick - tol) as a start tick
template <typename Iter>

View file

@ -630,6 +630,7 @@ PreferenceDialog::PreferenceDialog(QWidget* parent)
connect(defaultStyleButton, SIGNAL(clicked()), SLOT(selectDefaultStyle()));
connect(partStyleButton, SIGNAL(clicked()), SLOT(selectPartStyle()));
connect(styleFileButton, SIGNAL(clicked()), SLOT(styleFileButtonClicked()));
connect(instrumentList1Button, SIGNAL(clicked()), SLOT(selectInstrumentList1()));
connect(instrumentList2Button, SIGNAL(clicked()), SLOT(selectInstrumentList2()));
connect(startWithButton, SIGNAL(clicked()), SLOT(selectStartWith()));
@ -1489,7 +1490,7 @@ void PreferenceDialog::resetAllValues()
void PreferenceDialog::styleFileButtonClicked()
{
QString fn = mscore->getStyleFilename(true);
QString fn = mscore->getStyleFilename(true, tr("Choose Default Style for Imports"));
if (fn.isEmpty())
return;
importStyleFile->setText(fn);

View file

@ -163,7 +163,7 @@ qDebug("capture key 0x%x modifiers 0x%x virt 0x%x scan 0x%x <%s><%s>\n",
void ShortcutCaptureDialog::clearClicked()
{
//nshrtLabel->setText(tr("Undefined"));
nshrtLabel->setText("");
key = 0;
}
}

View file

@ -11,7 +11,7 @@
</rect>
</property>
<property name="windowTitle">
<string>Enter shortcut sequence</string>
<string>Enter Shortcut Sequence</string>
</property>
<property name="modal">
<bool>true</bool>
@ -35,7 +35,7 @@
<item row="0" column="0" colspan="2">
<widget class="QLabel" name="descrLabel">
<property name="text">
<string>Press up to 4 keys to enter shortcut sequence!</string>
<string>Press up to four keys to enter shortcut sequence</string>
</property>
<property name="alignment">
<set>Qt::AlignCenter</set>

View file

@ -247,7 +247,7 @@
<string>Create a new staff type of current group.</string>
</property>
<property name="text">
<string>Create new standard type</string>
<string>Create New Standard Type</string>
</property>
</widget>
</item>
@ -359,7 +359,7 @@
<item row="0" column="1">
<widget class="QCheckBox" name="upsideDown">
<property name="text">
<string>Upside Down</string>
<string>Upside down</string>
</property>
</widget>
</item>
@ -999,7 +999,7 @@
<bool>true</bool>
</property>
<property name="text">
<string>Show Rests</string>
<string>Show rests</string>
</property>
</widget>
</item>
@ -1110,7 +1110,7 @@
<item>
<widget class="QPushButton" name="newTypeTablature">
<property name="text">
<string>Create new tablature type</string>
<string>Create New Tablature Type</string>
</property>
</widget>
</item>
@ -1225,7 +1225,7 @@
<item>
<widget class="QPushButton" name="newTypePercussion">
<property name="text">
<string>Create new percussion type</string>
<string>Create New Percussion type</string>
</property>
</widget>
</item>