Some commits (cf5765018e4b742bbf490cf9fd57757bfb921f83 "removed ModifyPart/changePart. Replaced with ModifyPartLength etc.", and 013294f58a6433671da3b34775de5a3a7ea91464 "some const-correctness. Part interface overhaul.") removed code used by modifyPart(), preventing a successful build when python is enabled.
This patch brings back just the deleted code needed to compile pyapi.cpp and adds a cast. Signed-off-by: Michele Ballabio <[email protected]> --- I actually don't use pyapi, I just noticed it didn't compile anymore. muse2/muse/part.cpp | 20 ++++++++++++++++++++ muse2/muse/part.h | 1 + muse2/muse/remote/pyapi.cpp | 2 +- muse2/muse/song.h | 1 + 4 files changed, 23 insertions(+), 1 deletion(-) diff --git a/muse2/muse/part.cpp b/muse2/muse/part.cpp index 161da35..2f77eec 100644 --- a/muse2/muse/part.cpp +++ b/muse2/muse/part.cpp @@ -1007,6 +1007,26 @@ void Part::splitPart(int tickpos, Part*& p1, Part*& p2) const } } +//--------------------------------------------------------- +// changePart +//--------------------------------------------------------- + +void Song::changePart(Part* oPart, Part* nPart) + { + nPart->setSn(oPart->sn()); + + Track* oTrack = oPart->track(); + Track* nTrack = nPart->track(); + + oTrack->parts()->remove(oPart); + nTrack->parts()->add(nPart); + + // Added by T356. + // adjust song len: + unsigned epos = nPart->tick() + nPart->lenTick(); + if (epos > len()) + _len = epos; + } //--------------------------------------------------------- // dump diff --git a/muse2/muse/part.h b/muse2/muse/part.h index e44abc8..25c129a 100644 --- a/muse2/muse/part.h +++ b/muse2/muse/part.h @@ -91,6 +91,7 @@ class Part : public PosLen { virtual Part* createNewClone() const; // this does NOT chain clones yet. Chain is updated only when the part is really added! virtual void splitPart(int tickpos, Part*& p1, Part*& p2) const; + void setSn(int n) { _sn = n; } int clonemaster_sn() const { return _clonemaster_sn; } int sn() const { return _sn; } int newSn() { return snGen++; } diff --git a/muse2/muse/remote/pyapi.cpp b/muse2/muse/remote/pyapi.cpp index fa3c1cd..8b9b2c8 100644 --- a/muse2/muse/remote/pyapi.cpp +++ b/muse2/muse/remote/pyapi.cpp @@ -405,7 +405,7 @@ PyObject* modifyPart(PyObject*, PyObject* part) npart->setSn(opart->sn()); for (ciEvent e = opart->events().begin(); e != opart->events().end(); e++) { - Event& event = e->second; + Event& event = (Event &)(e->second); if (event.type() == Note || event.type() == Controller) continue; diff --git a/muse2/muse/song.h b/muse2/muse/song.h index 9c864dc..1c8e623 100644 --- a/muse2/muse/song.h +++ b/muse2/muse/song.h @@ -315,6 +315,7 @@ class Song : public QObject { void addPart(Part* part); void removePart(Part* part); + void changePart(Part*, Part*); PartList* getSelectedMidiParts() const; // FIXME TODO move functionality into function.cpp -- 2.0.0 ------------------------------------------------------------------------------ New Year. New Location. New Benefits. New Data Center in Ashburn, VA. GigeNET is offering a free month of service with a new server in Ashburn. Choose from 2 high performing configs, both with 100TB of bandwidth. Higher redundancy.Lower latency.Increased capacity.Completely compliant. http://p.sf.net/sfu/gigenet _______________________________________________ Lmuse-developer mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/lmuse-developer
