summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/CMakeLists.txt1
-rw-r--r--muse2/muse/arranger/arrangerview.cpp7
-rw-r--r--muse2/muse/arranger/arrangerview.h2
-rw-r--r--muse2/muse/arranger/pcanvas.cpp35
-rw-r--r--muse2/muse/arranger/pcanvas.h1
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp1
-rw-r--r--muse2/muse/structure.cpp57
-rw-r--r--muse2/muse/structure.h21
8 files changed, 59 insertions, 66 deletions
diff --git a/muse2/muse/CMakeLists.txt b/muse2/muse/CMakeLists.txt
index cea95083..ec370781 100644
--- a/muse2/muse/CMakeLists.txt
+++ b/muse2/muse/CMakeLists.txt
@@ -60,6 +60,7 @@ QT4_WRAP_CPP ( muse_moc_headers
midieditor.h
miditransform.h
plugin.h
+ structure.h
song.h
transport.h
value.h
diff --git a/muse2/muse/arranger/arrangerview.cpp b/muse2/muse/arranger/arrangerview.cpp
index fd8165cf..d776198e 100644
--- a/muse2/muse/arranger/arrangerview.cpp
+++ b/muse2/muse/arranger/arrangerview.cpp
@@ -37,6 +37,7 @@
#include "arrangerview.h"
#include "visibletracks.h"
+#include "structure.h"
#include <iostream>
@@ -961,3 +962,9 @@ void ArrangerView::updateVisibleTracksButtons()
{
visTracks->updateVisibleTracksButtons();
}
+
+void ArrangerView::globalCut() { globalCut(); }
+void ArrangerView::globalInsert() { globalInsert(); }
+void ArrangerView::globalSplit() { globalSplit(); }
+void ArrangerView::copyRange() { copyRange(); }
+void ArrangerView::cutEvents() { cutEvents(); }
diff --git a/muse2/muse/arranger/arrangerview.h b/muse2/muse/arranger/arrangerview.h
index 752c2728..52e3273d 100644
--- a/muse2/muse/arranger/arrangerview.h
+++ b/muse2/muse/arranger/arrangerview.h
@@ -58,8 +58,6 @@ class ArrangerView : public TopWin
virtual void closeEvent(QCloseEvent*);
- void adjustGlobalLists(Undo& operations, int startPos, int diff);
-
QGridLayout* mainGrid;
QWidget* mainw;
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 572492d6..19e53f2e 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -27,6 +27,7 @@
#include "widgets/tools.h"
#include "arranger.h"
#include "arrangerview.h"
+#include "structure.h"
#include "pcanvas.h"
#include "midieditor.h"
#include "globals.h"
@@ -2879,40 +2880,6 @@ void PartCanvas::paste(bool clone, bool toTrack, bool doInsert)
}
//---------------------------------------------------------
-// movePartsToTheRight
-//---------------------------------------------------------
-Undo PartCanvas::movePartsTotheRight(unsigned int startTicks, int length)
-{
- Undo operations;
-
- // all parts that start after the pasted parts will be moved the entire length of the pasted parts
- for (iCItem i = items.begin(); i != items.end(); ++i) {
- if (!i->second->isSelected()) {
- Part* part = i->second->part();
- if (part->tick() >= startTicks) {
- Part *newPart = part->clone();
- newPart->setTick(newPart->tick()+length);
-
- operations.push_back(UndoOp(UndoOp::ModifyPart,part,newPart,false,false));
- }
- }
- }
- // perhaps ask if markers should be moved?
- MarkerList *markerlist = song->marker();
- for(iMarker i = markerlist->begin(); i != markerlist->end(); ++i)
- {
- Marker* m = &i->second;
- if (m->tick() >= startTicks) {
- Marker *oldMarker = new Marker();
- *oldMarker = *m;
- m->setTick(m->tick()+length);
- operations.push_back(UndoOp(UndoOp::ModifyMarker,oldMarker, m));
- }
- }
-
- return operations;
-}
-//---------------------------------------------------------
// startDrag
//---------------------------------------------------------
diff --git a/muse2/muse/arranger/pcanvas.h b/muse2/muse/arranger/pcanvas.h
index 71a0129c..eaa51190 100644
--- a/muse2/muse/arranger/pcanvas.h
+++ b/muse2/muse/arranger/pcanvas.h
@@ -109,7 +109,6 @@ class PartCanvas : public Canvas {
void copy(PartList*);
void paste(bool clone = false, bool toTrack = true, bool doInsert=false);
Undo pasteAt(const QString&, Track*, unsigned int, bool clone = false, bool toTrack = true, int* finalPosPtr = NULL);
- Undo movePartsTotheRight(unsigned int startTick, int length);
//Part* readClone(Xml&, Track*, bool toTrack = true);
void drawWavePart(QPainter&, const QRect&, WavePart*, const QRect&);
//void drawMidiPart(QPainter&, const QRect& rect, EventList* events, MidiTrack*mt, const QRect& r, int pTick, int from, int to);
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index eee92a9b..da920a43 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -4451,6 +4451,7 @@ 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 87f37c1c..9cdf68aa 100644
--- a/muse2/muse/structure.cpp
+++ b/muse2/muse/structure.cpp
@@ -16,7 +16,8 @@
#include "keyevent.h"
#include "audio.h"
#include "marker/marker.h"
-#include "arrangerview.h"
+#include "structure.h"
+#include "globals.h"
//---------------------------------------------------------
// adjustGlobalLists
@@ -25,7 +26,7 @@
// 'diff' number of ticks.
//---------------------------------------------------------
-void ArrangerView::adjustGlobalLists(Undo& operations, int startPos, int diff)
+void adjustGlobalLists(Undo& operations, int startPos, int diff)
{
const TempoList* t = &tempomap;
const AL::SigList* s = &AL::sigmap;
@@ -116,7 +117,7 @@ void ArrangerView::adjustGlobalLists(Undo& operations, int startPos, int diff)
// - cut master track
//---------------------------------------------------------
-void ArrangerView::globalCut()
+void globalCut()
{
int lpos = song->lpos();
int rpos = song->rpos();
@@ -218,12 +219,17 @@ void ArrangerView::globalCut()
// - insert in master track
//---------------------------------------------------------
-void ArrangerView::globalInsert()
+void globalInsert()
{
- unsigned lpos = song->lpos();
- unsigned rpos = song->rpos();
- if (lpos >= rpos)
- return;
+ Undo operations=movePartsTotheRight(song->lpos(), song->rpos()-song->lpos());
+ song->applyOperationGroup(operations);
+ }
+
+
+Undo movePartsTotheRight(unsigned int startTicks, int moveTicks)
+ {
+ if (moveTicks<=0)
+ return Undo();
Undo operations;
TrackList* tracks = song->tracks();
@@ -237,36 +243,35 @@ void ArrangerView::globalInsert()
Part* part = p->second;
unsigned t = part->tick();
int l = part->lenTick();
- if (t + l <= lpos)
+ if (t + l <= startTicks)
continue;
- if (lpos >= t && lpos < (t+l)) {
+ if (startTicks >= t && startTicks < (t+l)) {
MidiPart* nPart = new MidiPart(*(MidiPart*)part);
- nPart->setLenTick(l + (rpos-lpos));
+ nPart->setLenTick(l + moveTicks);
EventList* el = nPart->events();
for (riEvent i = el->rbegin(); i!=el->rend(); ++i)
{
- if (i->first < lpos-t)
+ if (i->first < startTicks-t)
break;
Event event = i->second;
Event nEvent = i->second.clone();
- nEvent.setTick(nEvent.tick() + (rpos-lpos));
+ nEvent.setTick(nEvent.tick() + moveTicks);
operations.push_back(UndoOp(UndoOp::ModifyEvent, nEvent, event, nPart, false, false));
}
operations.push_back(UndoOp(UndoOp::ModifyPart, part, nPart, true, true));
}
- else if (t > lpos) {
+ else if (t > startTicks) {
MidiPart* nPart = new MidiPart(*(MidiPart*)part);
- nPart->setTick(t + (rpos -lpos));
+ nPart->setTick(t + moveTicks);
operations.push_back(UndoOp(UndoOp::ModifyPart, part, nPart, true, false));
}
}
}
- int diff = rpos - lpos;
- adjustGlobalLists(operations, lpos, diff);
+ adjustGlobalLists(operations, startTicks, moveTicks);
- song->applyOperationGroup(operations);
+ return operations;
}
@@ -275,7 +280,7 @@ void ArrangerView::globalInsert()
// - split all parts at the song position pointer
//---------------------------------------------------------
-void ArrangerView::globalSplit()
+void globalSplit()
{
int pos = song->cpos();
Undo operations;
@@ -317,12 +322,9 @@ void ArrangerView::globalSplit()
// copied events
//---------------------------------------------------------
-void ArrangerView::copyRange()
+void copyRange()
{
- QMessageBox::critical(this,
- tr("ArrangerView: Copy Range"),
- tr("not implemented")
- );
+ QMessageBox::critical(muse, "Copy Range", "not implemented");
}
//---------------------------------------------------------
@@ -332,10 +334,7 @@ void ArrangerView::copyRange()
// - process only marked parts
//---------------------------------------------------------
-void ArrangerView::cutEvents()
+void cutEvents()
{
- QMessageBox::critical(this,
- tr("ArrangerView: Cut Events"),
- tr("not implemented")
- );
+ QMessageBox::critical(muse, "Cut Events", "not implemented");
}
diff --git a/muse2/muse/structure.h b/muse2/muse/structure.h
new file mode 100644
index 00000000..25cbb94e
--- /dev/null
+++ b/muse2/muse/structure.h
@@ -0,0 +1,21 @@
+//=========================================================
+// MusE
+// Linux Music Editor
+// structure.h
+// (C) Copyright 2011 Florian Jung (flo93@users.sourceforge.net)
+//=========================================================
+
+#ifndef __STRUCTURE_H__
+#define __STRUCTURE_H__
+
+#include "undo.h"
+
+Undo movePartsTotheRight(unsigned int startTick, int moveTick);
+void adjustGlobalLists(Undo& operations, int startPos, int diff);
+void globalCut();
+void globalInsert();
+void globalSplit();
+void copyRange();
+void cutEvents();
+
+#endif