On Thursday 05 June 2003 08:08 pm, Levi Burton wrote:
> Hello,
>
> Here is a patch that will now paste segments copied from multiple tracks
> into tracks starting from the currently selected track. I guess to explain
> it better, say I copy segments from tracks 1, 2 and 3 - then select track 5
> and hit paste, the segments will paste to tracks 5, 6 and 7.
And here is the patch which should work correctly and also fixes a bug where
if the new track id < 0 does not create a new segment. Also, if a paste were
to go past the upper limit of tracks, it will probably crash (I'm not sure
where this upper limit is defined).
Sorry for all the fuss.
--
Levi Burton
http://www.puresimplicity.net/~ldb/
Index: editcommands.cpp
===================================================================
RCS file: /cvsroot/rosegarden/gui/editcommands.cpp,v
retrieving revision 1.52
diff -u -w -r1.52 editcommands.cpp
--- editcommands.cpp 5 May 2003 14:12:27 -0000 1.52
+++ editcommands.cpp 6 Jun 2003 08:57:03 -0000
@@ -231,6 +231,7 @@
// to that as they did before
timeT earliestStartTime = 0;
+ int trackOffset = 0;
for (Rosegarden::Clipboard::iterator i = m_clipboard->begin();
i != m_clipboard->end(); ++i) {
@@ -238,6 +239,7 @@
if (i == m_clipboard->begin() ||
(*i)->getStartTime() < earliestStartTime) {
earliestStartTime = (*i)->getStartTime();
+ trackOffset = (*i)->getTrack();
}
}
@@ -246,9 +248,16 @@
for (Rosegarden::Clipboard::iterator i = m_clipboard->begin();
i != m_clipboard->end(); ++i) {
+ int newTrackId = m_composition->getSelectedTrack()
+ + (*i)->getTrack()
+ - trackOffset;
+
+ // needs to check if greater than upper limit of tracks.
+ if (newTrackId < 0) continue;
+
Segment *segment = new Segment(**i);
segment->setStartTime(segment->getStartTime() + offset);
- segment->setTrack(m_composition->getSelectedTrack());
+ segment->setTrack(newTrackId);
m_composition->addSegment(segment);
m_addedSegments.push_back(segment);
}