summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Jung <flo@windfisch.org>2011-08-31 20:15:13 +0000
committerFlorian Jung <flo@windfisch.org>2011-08-31 20:15:13 +0000
commite64c6677de790368781f7d9f1ba1c98bcfc521d2 (patch)
tree6b4d788a846b021e13ee4875d43c4604965943ab
parente6b32e0c06254a99b09133b39e4f7c06bd9ec6ed (diff)
structure operations operate on selected tracks, not on non-muted tracks
fixed infinite recursion bug in global operations
-rw-r--r--muse2/muse/arranger/arrangerview.cpp6
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp1
-rw-r--r--muse2/muse/structure.cpp33
-rw-r--r--muse2/muse/structure.h2
4 files changed, 32 insertions, 10 deletions
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp
index db1fdf2d..4e844f35 100644
--- a/muse2/muse/arranger/arrangerview.cpp
+++ b/muse2/muse/arranger/arrangerview.cpp
@@ -960,6 +960,6 @@ void ArrangerView::updateVisibleTracksButtons()
visTracks->updateVisibleTracksButtons();
}
-void ArrangerView::globalCut() { globalCut(); }
-void ArrangerView::globalInsert() { globalInsert(); }
-void ArrangerView::globalSplit() { globalSplit(); }
+void ArrangerView::globalCut() { ::globalCut(); }
+void ArrangerView::globalInsert() { ::globalInsert(); }
+void ArrangerView::globalSplit() { ::globalSplit(); }
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index f4087ad2..d3bd26a7 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4451,7 +4451,6 @@ void staff_t::update_part_indices()
* CURRENT TODO
* M o remove that ugly "bool initalizing" stuff. it's probably unneeded (watch out for the FINDMICH message)
* M o shortcuts for "pencil" in score editor etc.
- * o structure ops only operate on muted tracks. really!
* o mirror most menus to an additional right-click context menu to avoid the long mouse pointer
* journey to the menu bar. try to find a way which does not involve duplicate code!
* o implement borland-style maximize: free windows do not cover the main menu, even when maximized
diff --git a/muse2/muse/structure.cpp b/muse2/muse/structure.cpp
index 53180ddd..1fb1668d 100644
--- a/muse2/muse/structure.cpp
+++ b/muse2/muse/structure.cpp
@@ -126,10 +126,17 @@ void globalCut()
Undo operations;
TrackList* tracks = song->tracks();
+ bool at_least_one_selected=false;
+
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it)
+ if ( (*it)->selected() ) {
+ at_least_one_selected=true;
+ break;
+ }
for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
- if (track == 0 || track->mute())
+ if (track == 0 || (at_least_one_selected && !track->selected()))
continue;
PartList* pl = track->parts();
for (iPart p = pl->begin(); p != pl->end(); ++p) {
@@ -221,22 +228,30 @@ void globalCut()
void globalInsert()
{
- Undo operations=movePartsTotheRight(song->lpos(), song->rpos()-song->lpos());
+ Undo operations=movePartsTotheRight(song->lpos(), song->rpos()-song->lpos(), true);
song->applyOperationGroup(operations);
}
-Undo movePartsTotheRight(unsigned int startTicks, int moveTicks)
+Undo movePartsTotheRight(unsigned int startTicks, int moveTicks, bool only_selected)
{
if (moveTicks<=0)
return Undo();
Undo operations;
TrackList* tracks = song->tracks();
+ bool at_least_one_selected=false;
+
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it)
+ if ( (*it)->selected() ) {
+ at_least_one_selected=true;
+ break;
+ }
+
for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
MidiTrack* track = dynamic_cast<MidiTrack*>(*it);
- if (track == 0 || track->mute())
+ if (track == 0 || (only_selected && at_least_one_selected && !track->selected()))
continue;
PartList* pl = track->parts();
for (riPart p = pl->rbegin(); p != pl->rend(); ++p) {
@@ -285,10 +300,18 @@ void globalSplit()
int pos = song->cpos();
Undo operations;
TrackList* tracks = song->tracks();
+ bool at_least_one_selected=false;
+
+ for (iTrack it = tracks->begin(); it != tracks->end(); ++it)
+ if ( (*it)->selected() ) {
+ at_least_one_selected=true;
+ break;
+ }
+
for (iTrack it = tracks->begin(); it != tracks->end(); ++it) {
Track* track = *it;
- if (track == 0 || track->mute())
+ if (track == 0 || (at_least_one_selected && !track->selected()))
continue;
PartList* pl = track->parts();
diff --git a/muse2/muse/structure.h b/muse2/muse/structure.h
index 955978dc..d1de1192 100644
--- a/muse2/muse/structure.h
+++ b/muse2/muse/structure.h
@@ -10,7 +10,7 @@
#include "undo.h"
-Undo movePartsTotheRight(unsigned int startTick, int moveTick);
+Undo movePartsTotheRight(unsigned int startTick, int moveTick, bool only_selected=false);
void adjustGlobalLists(Undo& operations, int startPos, int diff);
void globalCut();
void globalInsert();