summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
Diffstat (limited to 'muse2')
-rw-r--r--muse2/muse/helper.cpp7
-rw-r--r--muse2/muse/helper.h4
-rw-r--r--muse2/muse/midiedit/dcanvas.h2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp6
-rw-r--r--muse2/muse/midiedit/drumedit.h2
-rw-r--r--muse2/muse/midiedit/pianoroll.cpp7
-rw-r--r--muse2/muse/midiedit/pianoroll.h1
-rw-r--r--muse2/muse/midiedit/prcanvas.h2
-rw-r--r--muse2/muse/midiedit/scoreedit.cpp16
-rw-r--r--muse2/muse/midiedit/scoreedit.h3
10 files changed, 38 insertions, 12 deletions
diff --git a/muse2/muse/helper.cpp b/muse2/muse/helper.cpp
index 6aaacdb5..82c22c64 100644
--- a/muse2/muse/helper.cpp
+++ b/muse2/muse/helper.cpp
@@ -27,6 +27,7 @@
#include "app.h"
#include "icons.h"
#include "synth.h"
+#include "functions.h"
#ifdef DSSI_SUPPORT
#include "dssihost.h"
@@ -36,6 +37,7 @@
#include "vst.h"
#endif
+using std::set;
namespace MusEGlobal {
extern bool hIsB;
@@ -321,4 +323,9 @@ QActionGroup* populateAddTrack(QMenu* addTrack)
return grp;
}
+bool any_event_selected(const set<Part*>& parts, bool in_range)
+{
+ return !get_events(parts, in_range ? 3 : 1).empty();
+}
+
} // namespace MusEUtil
diff --git a/muse2/muse/helper.h b/muse2/muse/helper.h
index 94143756..e86a8949 100644
--- a/muse2/muse/helper.h
+++ b/muse2/muse/helper.h
@@ -23,6 +23,8 @@
#ifndef __HELPER_H__
#define __HELPER_H__
+#include <set>
+
class QActionGroup;
class QString;
class QMenu;
@@ -36,6 +38,8 @@ QString pitch2string(int v);
Part* partFromSerialNumber(int serial);
+bool any_event_selected(const std::set<Part*>&, bool in_range=false);
+
QMenu* populateAddSynth(QWidget* parent);
QActionGroup* populateAddTrack(QMenu* addTrack);
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h
index 110ecfb7..c25f71ca 100644
--- a/muse2/muse/midiedit/dcanvas.h
+++ b/muse2/muse/midiedit/dcanvas.h
@@ -106,7 +106,7 @@ class DrumCanvas : public EventCanvas {
public:
enum {
- CMD_CUT, CMD_COPY, CMD_PASTE, CMD_PASTE_DIALOG, CMD_SAVE, CMD_LOAD, CMD_RESET,
+ CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_SAVE, CMD_LOAD, CMD_RESET,
CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
CMD_DEL, CMD_FIXED_LEN, CMD_RIGHT, CMD_LEFT, CMD_RIGHT_NOSNAP, CMD_LEFT_NOSNAP, CMD_MODIFY_VELOCITY, CMD_CRESCENDO,
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index 182a2db3..a617f3ab 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -59,6 +59,7 @@
#include "audio.h"
#include "gconfig.h"
#include "functions.h"
+#include "helper.h"
#include "widgets/function_dialogs/quantize.h"
/*
@@ -197,6 +198,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
menuEdit->addSeparator();
cutAction = menuEdit->addAction(QIcon(*editcutIconSet), tr("Cut"));
copyAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy"));
+ copyRangeAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy events in range"));
pasteAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("Paste"));
pasteDialogAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("Paste (with Dialog)"));
menuEdit->addSeparator();
@@ -204,12 +206,14 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
connect(cutAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(copyAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
+ connect(copyRangeAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(pasteAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(pasteDialogAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
connect(deleteAction, SIGNAL(triggered()), signalMapper, SLOT(map()));
signalMapper->setMapping(cutAction, DrumCanvas::CMD_CUT);
signalMapper->setMapping(copyAction, DrumCanvas::CMD_COPY);
+ signalMapper->setMapping(copyRangeAction, DrumCanvas::CMD_COPY_RANGE);
signalMapper->setMapping(pasteAction, DrumCanvas::CMD_PASTE);
signalMapper->setMapping(pasteDialogAction, DrumCanvas::CMD_PASTE_DIALOG);
signalMapper->setMapping(deleteAction, DrumCanvas::CMD_DEL);
@@ -920,6 +924,7 @@ void DrumEdit::cmd(int cmd)
erase_notes(partlist_to_set(parts()), 1);
break;
case DrumCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break;
+ case DrumCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break;
case DrumCanvas::CMD_PASTE:
((DrumCanvas*)canvas)->cmd(DrumCanvas::CMD_SELECT_NONE);
paste_notes(3072);
@@ -1275,6 +1280,7 @@ void DrumEdit::initShortcuts()
cutAction->setShortcut(shortcuts[SHRT_CUT].key);
copyAction->setShortcut(shortcuts[SHRT_COPY].key);
+ copyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key);
pasteAction->setShortcut(shortcuts[SHRT_PASTE].key);
pasteDialogAction->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key);
deleteAction->setShortcut(shortcuts[SHRT_DELETE].key);
diff --git a/muse2/muse/midiedit/drumedit.h b/muse2/muse/midiedit/drumedit.h
index be9481c9..06f7e131 100644
--- a/muse2/muse/midiedit/drumedit.h
+++ b/muse2/muse/midiedit/drumedit.h
@@ -91,7 +91,7 @@ class DrumEdit : public MidiEditor {
static int _dlistWidthInit, _dcanvasWidthInit;
QAction *loadAction, *saveAction, *resetAction;
- QAction *cutAction, *copyAction, *pasteAction, *pasteDialogAction, *deleteAction;
+ QAction *cutAction, *copyAction, *copyRangeAction, *pasteAction, *pasteDialogAction, *deleteAction;
QAction *fixedAction, *veloAction, *crescAction, *quantizeAction;
QAction *sallAction, *snoneAction, *invAction, *inAction , *outAction;
QAction *prevAction, *nextAction;
diff --git a/muse2/muse/midiedit/pianoroll.cpp b/muse2/muse/midiedit/pianoroll.cpp
index 771bd3dd..1eff2504 100644
--- a/muse2/muse/midiedit/pianoroll.cpp
+++ b/muse2/muse/midiedit/pianoroll.cpp
@@ -60,6 +60,7 @@
#include "icons.h"
#include "audio.h"
#include "functions.h"
+#include "helper.h"
#include "cmd.h"
@@ -107,6 +108,10 @@ PianoRoll::PianoRoll(PartList* pl, QWidget* parent, const char* name, unsigned i
mapper->setMapping(editCopyAction, PianoCanvas::CMD_COPY);
connect(editCopyAction, SIGNAL(triggered()), mapper, SLOT(map()));
+ editCopyRangeAction = menuEdit->addAction(QIcon(*editcopyIconSet), tr("Copy events in range"));
+ mapper->setMapping(editCopyRangeAction, PianoCanvas::CMD_COPY_RANGE);
+ connect(editCopyRangeAction, SIGNAL(triggered()), mapper, SLOT(map()));
+
editPasteAction = menuEdit->addAction(QIcon(*editpasteIconSet), tr("&Paste"));
mapper->setMapping(editPasteAction, PianoCanvas::CMD_PASTE);
connect(editPasteAction, SIGNAL(triggered()), mapper, SLOT(map()));
@@ -634,6 +639,7 @@ void PianoRoll::cmd(int cmd)
erase_notes(partlist_to_set(parts()), 1);
break;
case PianoCanvas::CMD_COPY: copy_notes(partlist_to_set(parts()), 1); break;
+ case PianoCanvas::CMD_COPY_RANGE: copy_notes(partlist_to_set(parts()), MusEUtil::any_event_selected(partlist_to_set(parts())) ? 3 : 2); break;
case PianoCanvas::CMD_PASTE:
((PianoCanvas*)canvas)->cmd(PianoCanvas::CMD_SELECT_NONE);
paste_notes(3072);
@@ -1251,6 +1257,7 @@ void PianoRoll::initShortcuts()
{
editCutAction->setShortcut(shortcuts[SHRT_CUT].key);
editCopyAction->setShortcut(shortcuts[SHRT_COPY].key);
+ editCopyRangeAction->setShortcut(shortcuts[SHRT_COPY_RANGE].key);
editPasteAction->setShortcut(shortcuts[SHRT_PASTE].key);
editPasteDialogAction->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key);
editDelEventsAction->setShortcut(shortcuts[SHRT_DELETE].key);
diff --git a/muse2/muse/midiedit/pianoroll.h b/muse2/muse/midiedit/pianoroll.h
index 5a8d17bc..1a87d407 100644
--- a/muse2/muse/midiedit/pianoroll.h
+++ b/muse2/muse/midiedit/pianoroll.h
@@ -85,6 +85,7 @@ class PianoRoll : public MidiEditor {
QAction* editCutAction;
QAction* editCopyAction;
+ QAction* editCopyRangeAction;
QAction* editPasteAction;
QAction* editPasteDialogAction;
QAction* editDelEventsAction;
diff --git a/muse2/muse/midiedit/prcanvas.h b/muse2/muse/midiedit/prcanvas.h
index d45b5551..a44a9a4a 100644
--- a/muse2/muse/midiedit/prcanvas.h
+++ b/muse2/muse/midiedit/prcanvas.h
@@ -105,7 +105,7 @@ class PianoCanvas : public EventCanvas {
public:
enum {
- CMD_CUT, CMD_COPY, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL,
+ CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL,
CMD_QUANTIZE,
CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
CMD_SELECT_ILOOP, CMD_SELECT_OLOOP, CMD_SELECT_PREV_PART, CMD_SELECT_NEXT_PART,
diff --git a/muse2/muse/midiedit/scoreedit.cpp b/muse2/muse/midiedit/scoreedit.cpp
index 11632ef3..06e32c9c 100644
--- a/muse2/muse/midiedit/scoreedit.cpp
+++ b/muse2/muse/midiedit/scoreedit.cpp
@@ -366,6 +366,10 @@ ScoreEdit::ScoreEdit(QWidget* parent, const char* name, unsigned initPos)
menu_mapper->setMapping(copy_action, CMD_COPY);
connect(copy_action, SIGNAL(triggered()), menu_mapper, SLOT(map()));
+ copy_range_action = edit_menu->addAction(QIcon(*editcopyIconSet), tr("Copy events in range"));
+ menu_mapper->setMapping(copy_range_action, CMD_COPY_RANGE);
+ connect(copy_range_action, SIGNAL(triggered()), menu_mapper, SLOT(map()));
+
paste_action = edit_menu->addAction(QIcon(*editpasteIconSet), tr("&Paste"));
menu_mapper->setMapping(paste_action, CMD_PASTE);
connect(paste_action, SIGNAL(triggered()), menu_mapper, SLOT(map()));
@@ -504,6 +508,7 @@ void ScoreEdit::init_shortcuts()
{
cut_action->setShortcut(shortcuts[SHRT_CUT].key);
copy_action->setShortcut(shortcuts[SHRT_COPY].key);
+ copy_range_action->setShortcut(shortcuts[SHRT_COPY_RANGE].key);
paste_action->setShortcut(shortcuts[SHRT_PASTE].key);
paste_dialog_action->setShortcut(shortcuts[SHRT_PASTE_DIALOG].key);
del_action->setShortcut(shortcuts[SHRT_DELETE].key);
@@ -701,6 +706,7 @@ void ScoreEdit::menu_command(int cmd)
erase_notes(score_canvas->get_all_parts(), 1);
break;
case CMD_COPY: copy_notes(score_canvas->get_all_parts(), 1); break;
+ case CMD_COPY_RANGE: copy_notes(score_canvas->get_all_parts(), MusEUtil::any_event_selected(score_canvas->get_all_parts()) ? 3 : 2); break;
case CMD_PASTE:
menu_command(CMD_SELECT_NONE);
paste_notes(3072);
@@ -4529,16 +4535,11 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)
* because after A (and B) got resized, the B-resize is invalid!
* o when changing toolbarstate when sharing and immediately after that
* changing "share" status, the changed state isn't stored
+ * ? pasting in editors sometimes fails oO? ( ERROR: reading eventlist
+ * from clipboard failed. ignoring this one... ) [ not reproducible ]
*
* CURRENT TODO
- * o pasting in editors sometimes fails oO? ( ERROR: reading eventlist from clipboard failed. ignoring this one... )
- * o ctrl+shift+c for editors
* o TEST pasting in editors!
- * x sane default for raster
- * x use raster and amount in paste_notes!
- * x clone-bug
- * x pasting in editors: add dialogs
- * x when pasting and creating new parts, inform the editors about that!
*
* o ticks-to-quarter spinboxes
*
@@ -4547,7 +4548,6 @@ void ScoreCanvas::add_new_parts(const std::map< Part*, std::set<Part*> >& param)
* 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 sane defaults for toolbars
- * o paste in midi editors
* o implement borland-style maximize: free windows do not cover the main menu, even when maximized
* o smart range selection: if range markers have been used recently (that is, a dialog with
* "range" setting, or they've been modified), default to "in range" or "selected in range"
diff --git a/muse2/muse/midiedit/scoreedit.h b/muse2/muse/midiedit/scoreedit.h
index 9227389f..709a26ee 100644
--- a/muse2/muse/midiedit/scoreedit.h
+++ b/muse2/muse/midiedit/scoreedit.h
@@ -79,7 +79,7 @@ enum {CMD_COLOR_BLACK, CMD_COLOR_VELO, CMD_COLOR_PART,
CMD_QUANTIZE, CMD_VELOCITY, CMD_CRESCENDO, CMD_NOTELEN, CMD_TRANSPOSE,
CMD_ERASE, CMD_MOVE, CMD_FIXED_LEN, CMD_DELETE_OVERLAPS, CMD_LEGATO,
- CMD_CUT, CMD_COPY, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL,
+ CMD_CUT, CMD_COPY, CMD_COPY_RANGE, CMD_PASTE, CMD_PASTE_DIALOG, CMD_DEL,
CMD_SELECT_ALL, CMD_SELECT_NONE, CMD_SELECT_INVERT,
CMD_SELECT_ILOOP, CMD_SELECT_OLOOP};
@@ -133,6 +133,7 @@ class ScoreEdit : public TopWin
QAction* cut_action;
QAction* copy_action;
+ QAction* copy_range_action;
QAction* paste_action;
QAction* paste_dialog_action;
QAction* del_action;