[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src commands/MoveClip.cpp commands/Mov...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src commands/MoveClip.cpp commands/Mov... |
Date: |
Thu, 14 Feb 2008 10:32:23 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 08/02/14 10:32:22
Modified files:
src/commands : MoveClip.cpp MoveClip.h
src/core : AudioClipGroup.cpp AudioClipGroup.h Sheet.cpp
Sheet.h
Log message:
* use track sort index to detect if the group should move tracks
up/down. Currently not working for Fold Sheet
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.cpp?cvsroot=traverso&r1=1.66&r2=1.67
http://cvs.savannah.gnu.org/viewcvs/traverso/src/commands/MoveClip.h?cvsroot=traverso&r1=1.29&r2=1.30
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClipGroup.cpp?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/AudioClipGroup.h?cvsroot=traverso&r1=1.3&r2=1.4
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Sheet.cpp?cvsroot=traverso&r1=1.6&r2=1.7
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Sheet.h?cvsroot=traverso&r1=1.2&r2=1.3
Patches:
Index: commands/MoveClip.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.cpp,v
retrieving revision 1.66
retrieving revision 1.67
diff -u -b -r1.66 -r1.67
--- commands/MoveClip.cpp 14 Feb 2008 08:41:51 -0000 1.66
+++ commands/MoveClip.cpp 14 Feb 2008 10:32:22 -0000 1.67
@@ -108,10 +108,14 @@
}
TimeRef currentLocation =
TimeRef(cpointer().on_first_input_event_scene_x() * d->sv->timeref_scalefactor);
+ m_origTrackIndex = -1;
foreach(Track* track, tracks) {
QList<AudioClip*> clips = track->get_cliplist();
foreach(AudioClip* clip, clips) {
+ if (m_origTrackIndex == -1) {
+ m_origTrackIndex = m_newTrackIndex =
track->get_sort_index();
+ }
if (clip->get_track_end_location() >
currentLocation) {
movingClips.append(clip);
}
@@ -125,6 +129,7 @@
Q_ASSERT(cv);
d->sv = cv->get_sheetview();
m_group.add_clip(cv->get_clip());
+ m_origTrackIndex = m_newTrackIndex =
cv->get_clip()->get_track()->get_sort_index();
}
d->zoom = 0;
@@ -151,7 +156,7 @@
QList<AudioClip*> newclips = m_group.copy_clips();
m_group.set_clips(newclips);
m_group.add_all_clips_to_tracks();
- m_group.move_to(m_trackStartLocation +
TimeRef(d->sv->timeref_scalefactor * 3));
+ m_group.move_to(m_origTrackIndex, m_trackStartLocation +
TimeRef(d->sv->timeref_scalefactor * 3));
}
m_group.set_snappable(false);
@@ -201,11 +206,11 @@
{
PENTER;
if (m_actionType == MOVE || m_actionType == FOLD_SHEET || m_actionType
== FOLD_TRACK) {
- m_group.move_to(m_trackStartLocation + m_posDiff);
+ m_group.move_to(m_newTrackIndex, m_trackStartLocation +
m_posDiff);
}
else if (m_actionType == COPY) {
m_group.add_all_clips_to_tracks();
- m_group.move_to(m_trackStartLocation + m_posDiff);
+ m_group.move_to(m_newTrackIndex, m_trackStartLocation +
m_posDiff);
}
else if (m_actionType == MOVE_TO_START) {
move_to_start(false);
@@ -225,7 +230,7 @@
if (m_actionType == COPY) {
m_group.remove_all_clips_from_tracks();
} else {
- m_group.move_to(m_trackStartLocation);
+ m_group.move_to(m_origTrackIndex, m_trackStartLocation);
}
return 1;
@@ -244,10 +249,9 @@
return 0;
}
- // Detect if we moved up/down tracks.
- // FIXME!
TrackView* trackView =
d->sv->get_trackview_under(cpointer().scene_pos());
if (trackView) {
+ m_newTrackIndex = trackView->get_track()->get_sort_index();
}
// Calculate the distance moved based on the current scene x pos and
the initial one.
@@ -276,7 +280,7 @@
m_posDiff = newTrackStartLocation - m_trackStartLocation;
// and used to move the group to it's new location.
- m_group.move_to(m_trackStartLocation + m_posDiff);
+ m_group.move_to(m_newTrackIndex, m_trackStartLocation + m_posDiff);
d->sv->update_shuttle_factor();
@@ -320,15 +324,15 @@
void MoveClip::move_to_start(bool autorepeat)
{
- Q_UNUSED(autorepeat)
+ Q_UNUSED(autorepeat);
TimeRef location; // location == 0
- m_group.move_to(location);
+ m_group.move_to(m_origTrackIndex, location);
}
void MoveClip::move_to_end(bool autorepeat)
{
- Q_UNUSED(autorepeat)
- m_group.move_to(m_sheet->get_last_location());
+ Q_UNUSED(autorepeat);
+ m_group.move_to(m_origTrackIndex, m_sheet->get_last_location());
}
void MoveClip::start_zoom(bool autorepeat)
@@ -344,8 +348,6 @@
delete d->zoom;
d->zoom = 0;
cpointer().get_viewport()->set_holdcursor(":/cursorHoldLrud");
- d->sceneXStartPos -= int((d->origPos -
cpointer().scene_pos()).x());
- d->origPos = cpointer().scene_pos();
d->sv->start_shuttle(true, true);
}
}
Index: commands/MoveClip.h
===================================================================
RCS file: /sources/traverso/traverso/src/commands/MoveClip.h,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -b -r1.29 -r1.30
--- commands/MoveClip.h 13 Feb 2008 23:02:17 -0000 1.29
+++ commands/MoveClip.h 14 Feb 2008 10:32:22 -0000 1.30
@@ -68,15 +68,15 @@
Sheet* m_sheet;
AudioClipGroup m_group;
- AudioClip* m_clip;
TimeRef m_trackStartLocation;
TimeRef m_posDiff;
ActionType m_actionType;
+ int m_origTrackIndex;
+ int m_newTrackIndex;
struct Data {
- int sceneXStartPos;
SheetView* sv;
- QPointF origPos;
+ int sceneXStartPos;
bool verticalOnly;
Zoom* zoom;
};
Index: core/AudioClipGroup.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClipGroup.cpp,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- core/AudioClipGroup.cpp 13 Feb 2008 23:02:17 -0000 1.3
+++ core/AudioClipGroup.cpp 14 Feb 2008 10:32:22 -0000 1.4
@@ -25,6 +25,7 @@
#include "Command.h"
#include "ProjectManager.h"
#include "ResourcesManager.h"
+#include "Sheet.h"
#include "Track.h"
#include "Debugger.h"
@@ -56,9 +57,19 @@
update_track_start_and_end_locations();
}
-void AudioClipGroup::move_to(TimeRef location)
+void AudioClipGroup::move_to(int trackIndex, TimeRef location)
{
foreach(AudioClip* clip, m_clips) {
+
+ if (clip->get_track()->get_sort_index() != trackIndex) {
+ Sheet* s = clip->get_sheet();
+ Track* track =
clip->get_sheet()->get_track_for_index(trackIndex);
+ if (track) {
+
Command::process_command(clip->get_track()->remove_clip(clip, false, true));
+ Command::process_command(track->add_clip(clip,
false, true));
+ }
+ }
+
TimeRef offset = clip->get_track_start_location() -
m_trackStartLocation;
clip->set_track_start_location(location + offset);
}
Index: core/AudioClipGroup.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/AudioClipGroup.h,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -b -r1.3 -r1.4
--- core/AudioClipGroup.h 13 Feb 2008 23:02:17 -0000 1.3
+++ core/AudioClipGroup.h 14 Feb 2008 10:32:22 -0000 1.4
@@ -34,7 +34,7 @@
void add_clip(AudioClip* clip);
void set_clips(QList<AudioClip*> clips);
- void move_to(TimeRef location);
+ void move_to(int trackIndex, TimeRef location);
void set_snappable(bool snap);
void set_as_moving(bool move);
Index: core/Sheet.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Sheet.cpp,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -b -r1.6 -r1.7
--- core/Sheet.cpp 12 Feb 2008 11:48:07 -0000 1.6
+++ core/Sheet.cpp 14 Feb 2008 10:32:22 -0000 1.7
@@ -1430,3 +1430,14 @@
}
return list;
}
+
+Track * Sheet::get_track_for_index(int index)
+{
+ apill_foreach(Track* track, Track, m_tracks) {
+ if (track->get_sort_index() == index) {
+ return track;
+ }
+ }
+
+ return 0;
+}
Index: core/Sheet.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Sheet.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -b -r1.2 -r1.3
--- core/Sheet.h 29 Jan 2008 09:11:56 -0000 1.2
+++ core/Sheet.h 14 Feb 2008 10:32:22 -0000 1.3
@@ -108,6 +108,7 @@
TimeLine* get_timeline() const {return m_timeline;}
Snappable* get_work_snap() {return workSnap;}
Track* get_track(qint64 id);
+ Track* get_track_for_index(int index);
// Set functions
void set_artists(const QString& pArtistis);