fix all warnings on Mac OSX. Hopefully without side effects on other platforms.

This commit is contained in:
lasconic 2015-05-05 18:28:39 +02:00
parent 0324d59821
commit 61eed11401
25 changed files with 95 additions and 60 deletions

View file

@ -142,7 +142,25 @@ QPointF Beam::canvasPos() const
// add
//---------------------------------------------------------
void Beam::add(ChordRest* a)
void Beam::add(Element* e) {
if (e && e->isChordRest())
addChordRest(static_cast<ChordRest*>(e));
}
//---------------------------------------------------------
// remove
//---------------------------------------------------------
void Beam::remove(Element* e) {
if (e && e->isChordRest())
removeChordRest(static_cast<ChordRest*>(e));
}
//---------------------------------------------------------
// addChordRest
//---------------------------------------------------------
void Beam::addChordRest(ChordRest* a)
{
a->setBeam(this);
if (!_elements.contains(a)) {
@ -166,10 +184,10 @@ void Beam::add(ChordRest* a)
}
//---------------------------------------------------------
// remove
// removeChordRest
//---------------------------------------------------------
void Beam::remove(ChordRest* a)
void Beam::removeChordRest(ChordRest* a)
{
if (!_elements.removeOne(a))
qDebug("Beam::remove(): cannot find ChordRest");

View file

@ -68,6 +68,8 @@ class Beam : public Element {
void computeStemLen(const QList<ChordRest*>& crl, qreal& py1, int beamLevels);
bool slopeZero(const QList<ChordRest*>& crl);
bool hasNoSlope();
void addChordRest(ChordRest* a);
void removeChordRest(ChordRest* a);
public:
enum class Mode : signed char {
@ -106,8 +108,8 @@ class Beam : public Element {
void clear() { _elements.clear(); }
bool isEmpty() const { return _elements.isEmpty(); }
void add(ChordRest* a);
void remove(ChordRest* a);
virtual void add(Element*) override;
virtual void remove(Element*) override;
virtual void move(qreal, qreal) override;
virtual void draw(QPainter*) const override;

View file

@ -112,7 +112,7 @@ class Chord : public ChordRest {
Chord &operator=(const Chord&) = delete;
virtual Chord* clone() const { return new Chord(*this, false); }
virtual Chord* linkedClone() { return new Chord(*this, true); }
virtual Element* linkedClone() { return new Chord(*this, true); }
virtual void undoUnlink() override;
virtual void setScore(Score* s);

View file

@ -1847,7 +1847,7 @@ Element* Element::nextElement()
}
case Element::Type::MEASURE: {
Measure* m = static_cast<Measure*>(p);
return m->nextElement(staffIdx());
return m->nextElementStaff(staffIdx());
}
case Element::Type::SYSTEM: {
System* sys = static_cast<System*>(p);
@ -1892,7 +1892,7 @@ Element* Element::prevElement()
}
case Element::Type::MEASURE: {
Measure* m = static_cast<Measure*>(p);
return m->prevElement(staffIdx());
return m->prevElementStaff(staffIdx());
}
case Element::Type::SYSTEM: {
System* sys = static_cast<System*>(p);

View file

@ -2187,7 +2187,7 @@ bool Score::layoutSystem(qreal& minWidth, qreal systemWidth, bool isFirstSystem,
xo = point(static_cast<Box*>(curMeasure)->boxWidth());
system->setInstrumentNames(longName);
system->layout(xo);
system->layoutSystem(xo);
qreal minMeasureWidth = point(styleS(StyleIdx::minMeasureWidth));
minWidth = system->leftMargin();
@ -2452,7 +2452,7 @@ bool Score::layoutSystem1(qreal& minWidth, bool isFirstSystem, bool longName)
xo = point(static_cast<Box*>(curMeasure)->boxWidth());
system->setInstrumentNames(longName);
system->layout(xo);
system->layoutSystem(xo);
qreal minMeasureWidth = point(styleS(StyleIdx::minMeasureWidth));
minWidth = system->leftMargin();
@ -3016,7 +3016,7 @@ QList<System*> Score::layoutSystemRow(qreal rowWidth, bool isFirstSystem, bool u
Measure* m = static_cast<Measure*>(mb);
qreal weight = m->ticks() * m->userStretch();
ww = m->minWidth2() + rest * weight;
m->layout(ww);
m->layoutWidth(ww);
}
else if (mb->type() == Element::Type::HBOX) {
mb->setPos(pos);
@ -3127,7 +3127,7 @@ void Score::layoutLinear()
xo += point(static_cast<Box*>(m)->boxWidth());
}
system->layout(xo);
system->layoutSystem(xo);
system->setPos(0.0, spatium() * 10.0);
curPage = 0;
Page* page = getEmptyPage();
@ -3187,7 +3187,7 @@ void Score::layoutLinear()
qreal minMeasureWidth = point(styleS(StyleIdx::minMeasureWidth));
if (w < minMeasureWidth)
w = minMeasureWidth;
m->layout(w);
m->layoutWidth(w);
isFirstMeasure = false;
}
else {

View file

@ -452,7 +452,7 @@ AccidentalVal Measure::findAccidental(Segment* s, int staffIdx, int line) const
/// Note: minWidth = width - stretch
//---------------------------------------------------------
void Measure::layout(qreal width)
void Measure::layoutWidth(qreal width)
{
int nstaves = _score->nstaves();
for (int staffIdx = 0; staffIdx < nstaves; ++staffIdx) {
@ -4154,7 +4154,7 @@ qreal Measure::userStretch() const
return (score()->layoutMode() == LayoutMode::FLOAT ? 1.0 : _userStretch);
}
Element* Measure::nextElement(int staff)
Element* Measure::nextElementStaff(int staff)
{
Segment* firstSeg = segments()->first();
if (firstSeg)
@ -4162,7 +4162,7 @@ Element* Measure::nextElement(int staff)
return score()->firstElement();
}
Element* Measure::prevElement(int staff)
Element* Measure::prevElementStaff(int staff)
{
Measure* prevM = prevMeasureMM();
if (prevM) {

View file

@ -168,6 +168,7 @@ class Measure : public MeasureBase {
void read(XmlReader&, int idx);
void read(XmlReader& d) { read(d, 0); }
virtual void write(Xml&) const override {}
void write(Xml&, int, bool writeSystemElements) const;
void writeBox(Xml&) const;
void readBox(XmlReader&);
@ -222,7 +223,7 @@ class Measure : public MeasureBase {
void setUserStretch(qreal v) { _userStretch = v; }
void layoutX(qreal stretch);
void layout(qreal width);
void layoutWidth(qreal width);
void layout2();
Chord* findChord(int tick, int track);
@ -322,8 +323,8 @@ class Measure : public MeasureBase {
Measure* mmRestFirst() const;
Measure* mmRestLast() const;
Element* nextElement(int staff);
Element* prevElement(int staff);
Element* nextElementStaff(int staff);
Element* prevElementStaff(int staff);
virtual QString accessibleInfo() override;
};

View file

@ -84,6 +84,7 @@ class MeasureBase : public Element {
Ms::Measure* prevMeasureMM() const;
virtual int ticks() const { return 0; }
virtual void write(Xml&) const override = 0;
virtual void write(Xml&, int, bool) const = 0;
virtual void layout();

View file

@ -527,7 +527,7 @@ static int penalty(int lof1, int lof2, int k)
}
static const int WINDOW = 9;
#if 1 // yet(?) unused
#if 0 // yet(?) unused
static const int WINDOW_SHIFT = 3;
static const int ASIZE = 1024; // 2 ** WINDOW
#endif

View file

@ -54,7 +54,7 @@ class Rest : public ChordRest {
Rest &operator=(const Rest&) = delete;
virtual Rest* clone() const override { return new Rest(*this, false); }
virtual Rest* linkedClone() const { return new Rest(*this, true); }
virtual Element* linkedClone() { return new Rest(*this, true); }
virtual Measure* measure() const override { return parent() ? (Measure*)(parent()->parent()) : 0; }
virtual qreal mag() const override;
virtual void draw(QPainter*) const override;

View file

@ -419,7 +419,7 @@ void SlurSegment::editDrag(const EditData& ed)
// writeProperties
//---------------------------------------------------------
void SlurSegment::write(Xml& xml, int no) const
void SlurSegment::writeSlur(Xml& xml, int no) const
{
if (ups(Grip::START).off.isNull()
&& ups(Grip::END).off.isNull()
@ -592,7 +592,7 @@ void Slur::computeBezier(SlurSegment* ss, QPointF p6o)
// p1, p2 are in System coordinates
//---------------------------------------------------------
void SlurSegment::layout(const QPointF& p1, const QPointF& p2)
void SlurSegment::layoutSegment(const QPointF& p1, const QPointF& p2)
{
ups(Grip::START).p = p1;
ups(Grip::END).p = p2;
@ -1030,7 +1030,7 @@ void SlurTie::writeProperties(Xml& xml) const
xml.tag("track2", track2());
int idx = 0;
foreach(const SpannerSegment* ss, spannerSegments())
((SlurSegment*)ss)->write(xml, idx++);
((SlurSegment*)ss)->writeSlur(xml, idx++);
if (_slurDirection != MScore::Direction::AUTO)
xml.tag("up", int(_slurDirection));
if (_lineType)
@ -1349,7 +1349,7 @@ void Slur::layout()
s = frontSegment();
}
s->setSpannerSegmentType(SpannerSegmentType::SINGLE);
s->layout(QPointF(0, 0), QPointF(_spatium * 6, 0));
s->layoutSegment(QPointF(0, 0), QPointF(_spatium * 6, 0));
setbbox(frontSegment()->bbox());
return;
}
@ -1453,13 +1453,13 @@ void Slur::layout()
// case 1: one segment
if (sPos.system1 == sPos.system2) {
segment->setSpannerSegmentType(SpannerSegmentType::SINGLE);
segment->layout(sPos.p1, sPos.p2);
segment->layoutSegment(sPos.p1, sPos.p2);
}
// case 2: start segment
else if (i == 0) {
segment->setSpannerSegmentType(SpannerSegmentType::BEGIN);
qreal x = system->bbox().width();
segment->layout(sPos.p1, QPointF(x, sPos.p1.y()));
segment->layoutSegment(sPos.p1, QPointF(x, sPos.p1.y()));
}
// case 3: middle segment
else if (i != 0 && system != sPos.system2) {
@ -1467,13 +1467,13 @@ void Slur::layout()
qreal x1 = firstNoteRestSegmentX(system);
qreal x2 = system->bbox().width();
qreal y = system->staff(staffIdx())->y();
segment->layout(QPointF(x1, y), QPointF(x2, y));
segment->layoutSegment(QPointF(x1, y), QPointF(x2, y));
}
// case 4: end segment
else {
segment->setSpannerSegmentType(SpannerSegmentType::END);
qreal x = firstNoteRestSegmentX(system);
segment->layout(QPointF(x, sPos.p2.y()), sPos.p2);
segment->layoutSegment(QPointF(x, sPos.p2.y()), sPos.p2);
}
if (system == sPos.system2)
break;

View file

@ -86,7 +86,7 @@ class SlurSegment : public SpannerSegment {
virtual int subtype() const { return static_cast<int>(spanner()->type()); }
virtual QString subtypeName() const { return name(spanner()->type()); }
void layout(const QPointF& p1, const QPointF& p2);
void layoutSegment(const QPointF& p1, const QPointF& p2);
virtual QPainterPath shape() const { return shapePath; }
virtual void draw(QPainter*) const;
@ -110,7 +110,7 @@ class SlurSegment : public SpannerSegment {
SlurTie* slurTie() const { return (SlurTie*)spanner(); }
void write(Xml& xml, int no) const;
void writeSlur(Xml& xml, int no) const;
void read(XmlReader&);
virtual void reset();
void setSlurOffset(Grip i, const QPointF& val) { _ups[int(i)].off = val; }

View file

@ -119,7 +119,7 @@ void System::removeStaff(int idx)
// width of this box.
//---------------------------------------------------------
void System::layout(qreal xo1)
void System::layoutSystem(qreal xo1)
{
if (isVbox()) // ignore vbox
return;

View file

@ -117,7 +117,7 @@ class System : public Element {
Page* page() const { return (Page*)parent(); }
virtual void layout(qreal xoffset);
virtual void layoutSystem(qreal xoffset);
void layout2(); ///< Called after Measure layout.
void clear(); ///< Clear measure list.

View file

@ -291,7 +291,9 @@ class Text : public Element {
virtual void write(Xml& xml) const override;
virtual void read(XmlReader&) override;
void writeProperties(Xml&, bool = true, bool = true) const;
virtual void writeProperties(Xml& xml) const { writeProperties(xml, true, true); }
void writeProperties(Xml& xml, bool writeText) const { writeProperties(xml, writeText, true); }
void writeProperties(Xml&, bool, bool) const;
bool readProperties(XmlReader&);
void spellCheckUnderline(bool) {}

View file

@ -368,7 +368,7 @@ void Tie::layout()
segment->setSystem(startNote()->chord()->segment()->measure()->system());
SlurPos sPos;
slurPos(&sPos);
segment->layout(sPos.p1, sPos.p2);
segment->layoutSegment(sPos.p1, sPos.p2);
return;
}
@ -421,20 +421,20 @@ void Tie::layout()
// case 1: one segment
if (sPos.system1 == sPos.system2) {
segment->layout(sPos.p1, sPos.p2);
segment->layoutSegment(sPos.p1, sPos.p2);
segment->setSpannerSegmentType(SpannerSegmentType::SINGLE);
}
// case 2: start segment
else if (i == 0) {
qreal x = system->bbox().width();
segment->layout(sPos.p1, QPointF(x, sPos.p1.y()));
segment->layoutSegment(sPos.p1, QPointF(x, sPos.p1.y()));
segment->setSpannerSegmentType(SpannerSegmentType::BEGIN);
}
// case 4: end segment
else {
qreal x = firstNoteRestSegmentX(system);
segment->layout(QPointF(x, sPos.p2.y()), sPos.p2);
segment->layoutSegment(QPointF(x, sPos.p2.y()), sPos.p2);
segment->setSpannerSegmentType(SpannerSegmentType::END);
}
++i;

View file

@ -492,7 +492,7 @@ static bool findChordRests(BasicDrawObj const* const o, Score* score, const int
qDebug("findChordRests o %p nNotes %d score %p track %d tick %d cr1 %p cr2 %p", o, o->nNotes, score, track, tick, cr1, cr2);
if (!(cr1 && cr2)) {
qDebug("first or second anchor for BasicDrawObj not found (tick %d type %d track %d first %p second %p)",
qDebug("first or second anchor for BasicDrawObj not found (tick %d type %hhu track %d first %p second %p)",
tick, o->type, track, cr1, cr2);
return false;
}
@ -791,7 +791,7 @@ static int readCapVoice(Score* score, CapVoice* cvoice, int staffIdx, int tick,
qDebug(" <Clef>");
CapClef* o = static_cast<CapClef*>(no);
ClefType nclef = o->clef();
qDebug("%d:%d <Clef> %s line %d oct %d clef %hhd", tick, staffIdx, o->name(), o->line, o->oct, o->clef());
qDebug("%d:%d <Clef> %s line %hhd oct %hhd clef %hhd", tick, staffIdx, o->name(), o->line, o->oct, o->clef());
if (nclef == ClefType::INVALID)
break;
// staff(staffIdx)->setClef(tick, nclef);
@ -1227,7 +1227,7 @@ void convertCapella(Score* score, Capella* cap, bool capxMode)
}
break;
default:
qDebug("page background object type %d", o->type);
qDebug("page background object type %hhu", o->type);
break;
}
}
@ -1686,7 +1686,7 @@ QList<BasicDrawObj*> Capella::readDrawObjectArray()
}
break;
default:
qFatal("readDrawObjectArray unsupported type %d", type);
qFatal("readDrawObjectArray unsupported type %hhu", type);
break;
}
}
@ -1760,7 +1760,7 @@ void BasicDurationalObj::read()
objects = cap->readDrawObjectArray();
}
Q_ASSERT(!(c & 0x80));
qDebug("DurationObj ndots %d nodur %d postgr %d bsm %d inv %d notbl %d t %d hsh %d cnt %d trp %d ispro %d",
qDebug("DurationObj ndots %d nodur %d postgr %d bsm %d inv %d notbl %d t %hhd hsh %d cnt %d trp %d ispro %d",
nDots, noDuration, postGrace, bSmall, invisible, notBlack, t, horizontalShift, count, tripartite, isProlonging
);
}
@ -2151,7 +2151,7 @@ void Capella::readStaveLayout(CapStaffLayout* sl, int idx)
sl->form = Form(clef & 7);
sl->line = ClefLine((clef >> 3) & 7);
sl->oct = Oct((clef >> 6));
qDebug(" clef %x form %d, line %d, oct %d", clef, sl->form, sl->line, sl->oct);
qDebug(" clef %x form %hhd, line %hhd, oct %hhd", clef, sl->form, sl->line, sl->oct);
// Schlagzeuginformation
unsigned char b = readByte();
@ -2264,7 +2264,7 @@ void CapClef::read()
form = Form(b & 7);
line = ClefLine((b >> 3) & 7);
oct = Oct(b >> 6);
qDebug("Clef::read form %d line %d oct %d", form, line, oct);
qDebug("Clef::read form %hhd line %hhd oct %hhd", form, line, oct);
}
//---------------------------------------------------------
@ -2298,7 +2298,7 @@ ClefType CapClef::clefType(Form form, ClefLine line, Oct oct)
default:
if (form == Form::FORM_NULL)
return ClefType::INVALID;
qDebug("unknown clef %d %d %d", form, line, oct);
qDebug("unknown clef %hhd %hhd %hhd", form, line, oct);
break;
}
return ClefType::INVALID;
@ -2365,7 +2365,7 @@ void CapExplicitBarline::read()
_barMode = b >> 4; // 0 = auto, 1 = nur Zeilen, 2 = durchgezogen
Q_ASSERT(_barMode <= 2);
qDebug(" Expl.Barline type %d mode %d", _type, _barMode);
qDebug(" Expl.Barline type %hhd mode %d", _type, _barMode);
}
//---------------------------------------------------------
@ -2530,7 +2530,7 @@ int BasicDurationalObj::ticks() const
case TIMESTEP::D256: len = MScore::division >> 6; break;
case TIMESTEP::D_BREVE: len = MScore::division * 8; break;
default:
qDebug("BasicDurationalObj::ticks: illegal duration value %d", t);
qDebug("BasicDurationalObj::ticks: illegal duration value %hhd", t);
break;
}
int slen = len;

View file

@ -139,7 +139,7 @@ void BasicDurationalObj::readCapx(XmlReader& e, unsigned int& fullm)
else
e.unknown();
}
qDebug("DurationObj ndots %d nodur %d postgr %d bsm %d inv %d notbl %d t %d hsh %d cnt %d trp %d ispro %d fullm %d",
qDebug("DurationObj ndots %d nodur %d postgr %d bsm %d inv %d notbl %d t %hhd hsh %d cnt %d trp %d ispro %d fullm %d",
nDots, noDuration, postGrace, bSmall, invisible, notBlack, t, horizontalShift, count, tripartite, isProlonging, fullm
);
}
@ -191,7 +191,7 @@ void CapClef::readCapx(XmlReader& e)
else if (clef == "treble") { form = Form::G; line = ClefLine::L2; oct = Oct::OCT_NULL; }
else if (clef == "bass") { form = Form::F; line = ClefLine::L4; oct = Oct::OCT_NULL; }
else { /* default */ form = Form::G; line = ClefLine::L2; oct = Oct::OCT_NULL; }
qDebug("Clef::read '%s' -> form %d line %d oct %d", qPrintable(clef), form, line, oct);
qDebug("Clef::read '%s' -> form %hhd line %hhd oct %hhd", qPrintable(clef), form, line, oct);
e.readNext();
}

View file

@ -52,19 +52,19 @@ static int pitch2y(int pitch)
//---------------------------------------------------------
DrumItem::DrumItem(Note* n)
: QGraphicsPolygonItem(), note(n)
: QGraphicsPolygonItem(), _note(n)
{
setFlags(flags() | QGraphicsItem::ItemIsSelectable);
int pitch = n->pitch();
int pitch = _note->pitch();
QPolygonF p;
double h2 = keyHeight/2;
p << QPointF(0, -h2) << QPointF(h2, 0.0) << QPointF(0.0, h2) << QPointF(-h2, 0.0);
setPolygon(p);
setBrush(QBrush());
setSelected(n->selected());
setData(0, QVariant::fromValue<void*>(n));
setSelected(_note->selected());
setData(0, QVariant::fromValue<void*>(_note));
setPos(n->chord()->tick() + 480, pitch2y(pitch) + keyHeight / 4);
setPos(_note->chord()->tick() + 480, pitch2y(pitch) + keyHeight / 4);
setFlag(QGraphicsItem::ItemIgnoresTransformations, true);
}

View file

@ -34,7 +34,7 @@ class Note;
//---------------------------------------------------------
class DrumItem : public QGraphicsPolygonItem {
Note* note;
Note* _note;
virtual void paint(QPainter* painter, const QStyleOptionGraphicsItem* option, QWidget* widget = 0);

View file

@ -579,7 +579,7 @@ static void createMeasures(Score* score, const QVector<Fraction>& ml, const QVec
static void determineMeasureStart(const QVector<Fraction>& ml, QVector<Fraction>& ms)
{
ms.resize(ml.size());
if (!ms.size() > 0)
if (!(ms.size() > 0))
return; // no parts read
// first measure starts at t = 0

View file

@ -2516,6 +2516,14 @@ int OctaveShift::getEndTick() const {
return endTick_;
}
void OctaveShift::setOctaveShiftPosition(OctaveShiftPosition position) {
octaveShiftPosition_ = position;
}
OctaveShiftPosition OctaveShift::getOctaveShiftPosition() const {
return octaveShiftPosition_;
}
///////////////////////////////////////////////////////////////////////////////
OctaveShiftEndPoint::OctaveShiftEndPoint() {
musicDataType_ = MusicDataType::OctaveShift_EndPoint;

View file

@ -1756,6 +1756,9 @@ public:
void setOctaveShiftType(OctaveShiftType type);
OctaveShiftType getOctaveShiftType() const;
void setOctaveShiftPosition(OctaveShiftPosition position);
OctaveShiftPosition getOctaveShiftPosition() const;
int getNoteShift() const;
void setEndTick(int tick);

View file

@ -20,7 +20,7 @@
class AgentList;
class Event;
struct Event;
class AgentParameters
{

View file

@ -900,7 +900,7 @@ PmError pm_macosxcm_init(void)
/* Register this device with PortMidi */
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
TRUE, (void*)endpoint, &pm_macosx_in_dictionary);
TRUE, (void*)(long)endpoint, &pm_macosx_in_dictionary);
}
/* Iterate over the MIDI output devices */
@ -916,7 +916,7 @@ PmError pm_macosxcm_init(void)
/* Register this device with PortMidi */
pm_add_device("CoreMIDI", cm_get_full_endpoint_name(endpoint),
FALSE, (void*)endpoint, &pm_macosx_out_dictionary);
FALSE, (void*)(long) endpoint, &pm_macosx_out_dictionary);
}
return pmNoError;