summaryrefslogtreecommitdiff
path: root/muse2
diff options
context:
space:
mode:
authorRobert Jonsson <spamatica@gmail.com>2011-03-10 22:06:49 +0000
committerRobert Jonsson <spamatica@gmail.com>2011-03-10 22:06:49 +0000
commit3b9d24733e59de44de13abaf77f1806779715075 (patch)
tree3b737106a5d0f1c216289782a35b7be7272b53f0 /muse2
parentcada6a202543d0f3f5ac02b4b52b9f17fda038bf (diff)
cursor mode
Diffstat (limited to 'muse2')
-rw-r--r--muse2/ChangeLog6
-rw-r--r--muse2/muse/arranger/pcanvas.cpp6
-rw-r--r--muse2/muse/icons.cpp3
-rw-r--r--muse2/muse/icons.h2
-rw-r--r--muse2/muse/midiedit/dcanvas.cpp206
-rw-r--r--muse2/muse/midiedit/dcanvas.h10
-rw-r--r--muse2/muse/midiedit/dlist.cpp36
-rw-r--r--muse2/muse/midiedit/dlist.h2
-rw-r--r--muse2/muse/midiedit/drumedit.cpp22
-rw-r--r--muse2/muse/shortcuts.cpp8
-rw-r--r--muse2/muse/shortcuts.h7
-rw-r--r--muse2/muse/widgets/tools.cpp22
-rw-r--r--muse2/muse/widgets/tools.h15
13 files changed, 245 insertions, 100 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index ac993d15..da73fa3b 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,9 @@
+10.03.2011:
+ - Added: Say hello to 'CURSOR MODE' in drum editor (rj)
+ the idea is to edit drums more like a mod tracker, doing all from the keyboard.
+ shortcuts defined for entering cursor mode (U) and V,B,N,M for entering notes.
+ TODO: Step parameter, auto scrolling, mouse integration and more
+ - color tweaks for wave tracks in arranger (rj)
07.03.2011:
- draw gradients in arranger (rj)
06.03.2011:
diff --git a/muse2/muse/arranger/pcanvas.cpp b/muse2/muse/arranger/pcanvas.cpp
index 6bd35cb8..a68f3bb5 100644
--- a/muse2/muse/arranger/pcanvas.cpp
+++ b/muse2/muse/arranger/pcanvas.cpp
@@ -1788,7 +1788,7 @@ void PartCanvas::drawWavePart(QPainter& p,
rms = (rms * (hh-2)) >> 9;
p.setPen(QColor(Qt::darkGray));
p.drawLine(i, y - peak - cc, i, y + peak);
- p.setPen(QColor(Qt::black));
+ p.setPen(QColor(Qt::darkGray).darker());
p.drawLine(i, y - rms - cc, i, y + rms);
}
}
@@ -1810,7 +1810,7 @@ void PartCanvas::drawWavePart(QPainter& p,
int rms = (sa[k].rms * (hm - 1)) >> 8;
p.setPen(QColor(Qt::darkGray));
p.drawLine(i, y - peak - cc, i, y + peak);
- p.setPen(QColor(Qt::black));
+ p.setPen(QColor(Qt::darkGray).darker());
p.drawLine(i, y - rms - cc, i, y + rms);
y += 2 * hm;
@@ -2966,7 +2966,7 @@ void PartCanvas::drawTopItem(QPainter& p, const QRect& rect)
for (iTrack it = tl->begin(); it != tl->end(); ++it) {
Track* track = *it;
if (track->recordFlag()) {
- int startPos = audio->getStartRecordPos().tick();
+ unsigned int startPos = audio->getStartRecordPos().tick();
if (song->punchin())
startPos=song->lpos();
if (song->punchout() && song->cpos() > song->rpos()) {
diff --git a/muse2/muse/icons.cpp b/muse2/muse/icons.cpp
index 198fcaf4..df2e9f72 100644
--- a/muse2/muse/icons.cpp
+++ b/muse2/muse/icons.cpp
@@ -78,6 +78,7 @@
#include "xpm/steprec.xpm"
#include "xpm/glue.xpm"
#include "xpm/draw.xpm"
+#include "xpm/cursor.xpm"
#include "xpm/quant.xpm"
#include "xpm/fileprint.xpm"
#include "xpm/filesave.xpm"
@@ -298,6 +299,7 @@ QPixmap* cutIcon;
QPixmap* steprecIcon;
QPixmap* glueIcon;
QPixmap* drawIcon;
+QPixmap* cursorIcon;
QPixmap* quantIcon;
QPixmap* printIcon;
QPixmap* printIconS;
@@ -500,6 +502,7 @@ void initIcons()
steprecIcon = new MPIXMAP(steprec_xpm, NULL);
glueIcon = new MPIXMAP(glue_xpm, NULL);
drawIcon = new MPIXMAP(draw_xpm, NULL);
+ cursorIcon = new MPIXMAP(cursor_xpm, NULL);
quantIcon = new MPIXMAP(quant_xpm, NULL);
saveIcon = new MPIXMAP(filesave_xpm, "document-save");
saveasIcon = new MPIXMAP(filesaveas_xpm, "document-save-as");
diff --git a/muse2/muse/icons.h b/muse2/muse/icons.h
index d45b1b5a..c93e4a58 100644
--- a/muse2/muse/icons.h
+++ b/muse2/muse/icons.h
@@ -49,6 +49,8 @@ extern QPixmap* cutIcon;
extern QPixmap* steprecIcon;
extern QPixmap* glueIcon;
extern QPixmap* drawIcon;
+extern QPixmap* cursorIcon;
+
extern QPixmap* quantIcon;
extern QPixmap* printIcon;
diff --git a/muse2/muse/midiedit/dcanvas.cpp b/muse2/muse/midiedit/dcanvas.cpp
index 713ac6cd..c17ea065 100644
--- a/muse2/muse/midiedit/dcanvas.cpp
+++ b/muse2/muse/midiedit/dcanvas.cpp
@@ -32,6 +32,8 @@
#include "midiport.h"
#include "audio.h"
#include "velocity.h"
+#include "shortcuts.h"
+#include "icons.h"
#define CARET 10
#define CARET2 5
@@ -84,6 +86,7 @@ DrumCanvas::DrumCanvas(MidiEditor* pr, QWidget* parent, int sx,
: EventCanvas(pr, parent, sx, sy, name)
{
setVirt(false);
+ cursorPos= QPoint(0,0);
songChanged(SC_TRACK_INSERTED);
}
@@ -376,16 +379,25 @@ CItem* DrumCanvas::newItem(const QPoint& p, int state)
else if (state == (Qt::ControlModifier | Qt::ShiftModifier))
velo = drumMap[instr].lv1;
int tick = editor->rasterVal(p.x());
- tick -= curPart->tick();
- Event e(Note);
- e.setTick(tick);
- e.setPitch(instr);
- e.setVelo(velo);
- e.setLenTick(drumMap[instr].len);
- return new DEvent(e, curPart);
+ return newItem(tick, instr, velo);
}
//---------------------------------------------------------
+// newItem
+//---------------------------------------------------------
+
+CItem* DrumCanvas::newItem(int tick, int instrument, int velocity)
+{
+ tick -= curPart->tick();
+ Event e(Note);
+ e.setTick(tick);
+ e.setPitch(instrument);
+ e.setVelo(velocity);
+ e.setLenTick(drumMap[instrument].len);
+ return new DEvent(e, curPart);
+}
+
+//---------------------------------------------------------
// resizeItem
//---------------------------------------------------------
@@ -590,8 +602,17 @@ void DrumCanvas::drawCanvas(QPainter& p, const QRect& rect)
//---------------------------------------------------------
// drawTopItem
//---------------------------------------------------------
-void DrumCanvas::drawTopItem(QPainter &, const QRect &)
+void DrumCanvas::drawTopItem(QPainter &p, const QRect &r)
{
+ // draw cursor
+ if (_tool == CursorTool) {
+ p.setPen(Qt::black);
+
+ int y = TH * cursorPos.y();
+
+ p.drawPixmap(mapx(cursorPos.x())-TH/2,y,TH,TH, *cursorIcon);
+ // need to figure out a coordinate system for the cursor, complicated stuff.
+ }
}
//---------------------------------------------------------
@@ -682,38 +703,38 @@ void DrumCanvas::cmd(int cmd)
break;
case CMD_SELECT_PREV_PART: // select previous part
{
- Part* pt = editor->curCanvasPart();
- Part* newpt = pt;
- PartList* pl = editor->parts();
- for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
- if(ip->second == pt)
- {
- if(ip == pl->begin())
- ip = pl->end();
- --ip;
- newpt = ip->second;
- break;
- }
- if(newpt != pt)
- editor->setCurCanvasPart(newpt);
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ if(ip == pl->begin())
+ ip = pl->end();
+ --ip;
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
}
break;
case CMD_SELECT_NEXT_PART: // select next part
{
- Part* pt = editor->curCanvasPart();
- Part* newpt = pt;
- PartList* pl = editor->parts();
- for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
- if(ip->second == pt)
- {
- ++ip;
- if(ip == pl->end())
- ip = pl->begin();
- newpt = ip->second;
- break;
- }
- if(newpt != pt)
- editor->setCurCanvasPart(newpt);
+ Part* pt = editor->curCanvasPart();
+ Part* newpt = pt;
+ PartList* pl = editor->parts();
+ for(iPart ip = pl->begin(); ip != pl->end(); ++ip)
+ if(ip->second == pt)
+ {
+ ++ip;
+ if(ip == pl->end())
+ ip = pl->begin();
+ newpt = ip->second;
+ break;
+ }
+ if(newpt != pt)
+ editor->setCurCanvasPart(newpt);
}
break;
case CMD_DEL:
@@ -755,27 +776,28 @@ void DrumCanvas::cmd(int cmd)
break;
case CMD_LEFT:
{
- int spos = pos[0];
- if(spos > 0)
- {
- spos -= 1; // Nudge by -1, then snap down with raster1.
- spos = AL::sigmap.raster1(spos, editor->rasterStep(pos[0]));
- }
- if(spos < 0)
- spos = 0;
- Pos p(spos,true);
- song->setPos(0, p, true, true, true);
+ int spos = pos[0];
+ if(spos > 0)
+ {
+ spos -= 1; // Nudge by -1, then snap down with raster1.
+ spos = AL::sigmap.raster1(spos, editor->rasterStep(pos[0]));
+ }
+ if(spos < 0)
+ spos = 0;
+ Pos p(spos,true);
+ song->setPos(0, p, true, true, true);
}
break;
case CMD_RIGHT:
{
- int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2.
- Pos p(spos,true);
- song->setPos(0, p, true, true, true);
+ int spos = AL::sigmap.raster2(pos[0] + 1, editor->rasterStep(pos[0])); // Nudge by +1, then snap up with raster2.
+ Pos p(spos,true);
+ song->setPos(0, p, true, true, true);
}
break;
case CMD_LEFT_NOSNAP:
{
+ printf("left no snap\n");
int spos = pos[0] - editor->rasterStep(pos[0]);
if (spos < 0)
spos = 0;
@@ -912,7 +934,6 @@ Q3TextDrag* DrumCanvas::getTextDrag(QWidget* parent)
void DrumCanvas::copy()
{
- //QDrag* drag = getTextDrag();
QMimeData* md = getTextDrag();
if (md)
@@ -1003,7 +1024,6 @@ void DrumCanvas::paste()
void DrumCanvas::startDrag(CItem* /* item*/, bool copymode)
{
QMimeData* md = getTextDrag();
- //QDrag* drag = getTextDrag();
if (md) {
// QApplication::clipboard()->setData(drag, QClipboard::Clipboard); // This line NOT enabled in muse-1
@@ -1029,7 +1049,6 @@ void DrumCanvas::startDrag(CItem* /* item*/, bool copymode)
void DrumCanvas::dragEnterEvent(QDragEnterEvent* event)
{
- ///event->accept(Q3TextDrag::canDecode(event));
event->acceptProposedAction(); // TODO CHECK Tim.
}
@@ -1039,8 +1058,6 @@ void DrumCanvas::dragEnterEvent(QDragEnterEvent* event)
void DrumCanvas::dragMoveEvent(QDragMoveEvent*)
{
- //printf("drag move %x\n", this);
- //event->acceptProposedAction();
}
//---------------------------------------------------------
@@ -1049,8 +1066,6 @@ void DrumCanvas::dragMoveEvent(QDragMoveEvent*)
void DrumCanvas::dragLeaveEvent(QDragLeaveEvent*)
{
- //printf("drag leave\n");
- //event->acceptProposedAction();
}
/*
@@ -1089,17 +1104,18 @@ void DrumCanvas::viewDropEvent(QDropEvent* event)
*/
//---------------------------------------------------------
-// keyPressed
+// keyPressed - called from DList
//---------------------------------------------------------
-void DrumCanvas::keyPressed(int index, bool)
+void DrumCanvas::keyPressed(int index, int velocity)
{
+ // called from DList - play event
int port = drumMap[index].port;
int channel = drumMap[index].channel;
int pitch = drumMap[index].anote;
// play note:
- MidiPlayEvent e(0, port, channel, 0x90, pitch, 127);
+ MidiPlayEvent e(0, port, channel, 0x90, pitch, velocity);
audio->msgPlayMidiEvent(&e);
}
@@ -1109,6 +1125,7 @@ void DrumCanvas::keyPressed(int index, bool)
void DrumCanvas::keyReleased(int index, bool)
{
+ // called from DList - silence playing event
int port = drumMap[index].port;
int channel = drumMap[index].channel;
int pitch = drumMap[index].anote;
@@ -1345,3 +1362,74 @@ void DrumCanvas::curPartChanged()
editor->setWindowTitle(getCaption());
}
+void DrumCanvas::keyPress(QKeyEvent* event)
+{
+ if (_tool == CursorTool) {
+ int key = event->key();
+ ///if (event->state() & Qt::ShiftButton)
+ if (((QInputEvent*)event)->modifiers() & Qt::ShiftModifier)
+ key += Qt::SHIFT;
+ ///if (event->state() & Qt::AltButton)
+ if (((QInputEvent*)event)->modifiers() & Qt::AltModifier)
+ key += Qt::ALT;
+ ///if (event->state() & Qt::ControlButton)
+ if (((QInputEvent*)event)->modifiers() & Qt::ControlModifier)
+ key+= Qt::CTRL;
+
+ int curpos = cursorPos.x();
+ // Select items by key (PianoRoll & DrumEditor)
+ if (key == shortcuts[SHRT_SEL_RIGHT].key) {
+ int newPos = AL::sigmap.raster2(curpos + 1, editor->rasterStep(curpos)); // Nudge by +1, then snap up with raster2.
+ cursorPos.setX(newPos);
+ update();
+ return;
+ }
+ else if (key == shortcuts[SHRT_SEL_LEFT].key) {
+ int newPos = AL::sigmap.raster1(curpos-1, editor->rasterStep(curpos));
+ cursorPos.setX(newPos);
+ if (cursorPos.x() < 0 )
+ cursorPos.setX(0);
+ update();
+ return;
+ }
+ else if (key == shortcuts[SHRT_ADDNOTE_1].key) {
+ newItem(newItem(cursorPos.x(), cursorPos.y(), drumMap[cursorPos.y()].lv1),false);
+ keyPressed(cursorPos.y(), drumMap[cursorPos.y()].lv1);
+ keyReleased(cursorPos.y(), false);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ADDNOTE_2].key) {
+ newItem(newItem(cursorPos.x(), cursorPos.y(), drumMap[cursorPos.y()].lv2),false);
+ keyPressed(cursorPos.y(), drumMap[cursorPos.y()].lv2);
+ keyReleased(cursorPos.y(), false);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ADDNOTE_3].key) {
+ newItem(newItem(cursorPos.x(), cursorPos.y(), drumMap[cursorPos.y()].lv3),false);
+ keyPressed(cursorPos.y(), drumMap[cursorPos.y()].lv3);
+ keyReleased(cursorPos.y(), false);
+ return;
+ }
+ else if (key == shortcuts[SHRT_ADDNOTE_4].key) {
+ newItem(newItem(cursorPos.x(), cursorPos.y(), drumMap[cursorPos.y()].lv4),false);
+ keyPressed(cursorPos.y(), drumMap[cursorPos.y()].lv4);
+ keyReleased(cursorPos.y(), false);
+ return;
+ }
+ }
+ EventCanvas::keyPress(event);
+}
+
+
+void DrumCanvas::setTool2(int)
+{
+ if (cursorPos.x() < curPart->tick())
+ cursorPos.setX(curPart->tick());
+ update();
+}
+void DrumCanvas::setCurDrumInstrument(int i)
+{
+ cursorPos.setY(i);
+ update();
+}
+
diff --git a/muse2/muse/midiedit/dcanvas.h b/muse2/muse/midiedit/dcanvas.h
index a5510b3c..d1b20b87 100644
--- a/muse2/muse/midiedit/dcanvas.h
+++ b/muse2/muse/midiedit/dcanvas.h
@@ -41,6 +41,9 @@ class PianoRoll;
class DrumCanvas : public EventCanvas {
+ // Cursor tool position
+ QPoint cursorPos;
+
Q_OBJECT
virtual void drawCanvas(QPainter&, const QRect&);
virtual void drawItem(QPainter&, const CItem*, const QRect&);
@@ -54,6 +57,7 @@ class DrumCanvas : public EventCanvas {
virtual void resizeItem(CItem*, bool);
virtual void newItem(CItem*, bool);
virtual bool deleteItem(CItem*);
+ CItem* newItem(int tick, int instrument, int velocity);
int y2pitch(int y) const;
int pitch2y(int pitch) const;
@@ -72,8 +76,10 @@ class DrumCanvas : public EventCanvas {
public slots:
void mapChanged(int, int);
- void keyPressed(int, bool);
+ void keyPressed(int, int);
void keyReleased(int, bool);
+ void setTool2(int);
+ void setCurDrumInstrument(int);
public:
enum {
@@ -86,6 +92,8 @@ class DrumCanvas : public EventCanvas {
const char* name = 0);
void cmd(int);
virtual void modifySelected(NoteInfo::ValType type, int delta);
+ virtual void keyPress(QKeyEvent* event);
+
};
#endif
diff --git a/muse2/muse/midiedit/dlist.cpp b/muse2/muse/midiedit/dlist.cpp
index ee8c8e50..3736d6aa 100644
--- a/muse2/muse/midiedit/dlist.cpp
+++ b/muse2/muse/midiedit/dlist.cpp
@@ -221,7 +221,7 @@ void DList::viewMousePressEvent(QMouseEvent* ev)
int y = ev->y();
int button = ev->button();
///bool shift = ev->state() & Qt::ShiftButton;
- bool shift = ev->modifiers() & Qt::ShiftModifier;
+ //bool shift = ev->modifiers() & Qt::ShiftModifier;
unsigned pitch = y / TH;
DrumMap* dm = &drumMap[pitch];
@@ -302,21 +302,24 @@ void DList::viewMousePressEvent(QMouseEvent* ev)
dm->len = val;
break;
case COL_ANOTE:
- val = dm->anote + incVal;
- if (val < 0)
- val = 0;
- else if (val > 127)
- val = 127;
- if(val != dm->anote)
- {
- audio->msgIdle(true);
- //audio->msgRemapPortDrumCtlEvents(pitch, val, -1, -1);
- song->remapPortDrumCtrlEvents(pitch, val, -1, -1);
- audio->msgIdle(false);
- dm->anote = val;
- song->update(SC_DRUMMAP);
+ {
+ val = dm->anote + incVal;
+ if (val < 0)
+ val = 0;
+ else if (val > 127)
+ val = 127;
+ if(val != dm->anote)
+ {
+ audio->msgIdle(true);
+ //audio->msgRemapPortDrumCtlEvents(pitch, val, -1, -1);
+ song->remapPortDrumCtrlEvents(pitch, val, -1, -1);
+ audio->msgIdle(false);
+ dm->anote = val;
+ song->update(SC_DRUMMAP);
+ }
+ int velocity = 127 * float(ev->x()) / width();
+ emit keyPressed(pitch, velocity);//(dm->anote, shift);
}
- emit keyPressed(pitch, shift);//(dm->anote, shift);
break;
case COL_CHANNEL:
val = dm->channel + incVal;
@@ -386,7 +389,7 @@ void DList::viewMousePressEvent(QMouseEvent* ev)
dm->lv4 = val;
break;
case COL_NAME:
- emit keyPressed(pitch, shift); //Mapping done on other side, send index
+ emit keyPressed(pitch, 100); //Mapping done on other side, send index
break;
#if 0
case COL_CHANNEL:
@@ -750,3 +753,4 @@ int DList::getSelectedInstrument()
return drumInmap[int(currentlySelected->enote)];
}
+
diff --git a/muse2/muse/midiedit/dlist.h b/muse2/muse/midiedit/dlist.h
index f0dda0d4..f57b7501 100644
--- a/muse2/muse/midiedit/dlist.h
+++ b/muse2/muse/midiedit/dlist.h
@@ -82,7 +82,7 @@ class DList : public View {
signals:
void channelChanged();
void mapChanged(int, int);
- void keyPressed(int, bool);
+ void keyPressed(int, int);
void keyReleased(int, bool);
void curDrumInstrumentChanged(int);
diff --git a/muse2/muse/midiedit/drumedit.cpp b/muse2/muse/midiedit/drumedit.cpp
index ae13734a..06e7bc34 100644
--- a/muse2/muse/midiedit/drumedit.cpp
+++ b/muse2/muse/midiedit/drumedit.cpp
@@ -67,7 +67,7 @@ int DrumEdit::_toInit = 0;
static const int xscale = -10;
static const int yscale = 1;
-static const int drumeditTools = PointerTool | PencilTool | RubberTool;
+static const int drumeditTools = PointerTool | PencilTool | RubberTool | CursorTool;
enum DrumColumn {
COL_MUTE = 0,
@@ -388,7 +388,7 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
// p3.3.44
setCurDrumInstrument(dlist->getSelectedInstrument());
- connect(dlist, SIGNAL(keyPressed(int, bool)), canvas, SLOT(keyPressed(int, bool)));
+ connect(dlist, SIGNAL(keyPressed(int, int)), canvas, SLOT(keyPressed(int, int)));
connect(dlist, SIGNAL(keyReleased(int, bool)), canvas, SLOT(keyReleased(int, bool)));
connect(dlist, SIGNAL(mapChanged(int, int)), canvas, SLOT(mapChanged(int, int)));
@@ -415,7 +415,8 @@ DrumEdit::DrumEdit(PartList* pl, QWidget* parent, const char* name, unsigned ini
connect(hscroll, SIGNAL(scrollChanged(int)), time, SLOT(setXPos(int)));
connect(hscroll, SIGNAL(scaleChanged(int)), time, SLOT(setXMag(int)));
- connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int)));
+ connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool(int))); // in Canvas
+ connect(tools2, SIGNAL(toolChanged(int)), canvas, SLOT(setTool2(int))); // in DrumCanvas
connect(canvas, SIGNAL(selectionChanged(int, Event&, Part*)), this,
SLOT(setSelection(int, Event&, Part*)));
@@ -921,6 +922,7 @@ CtrlEdit* DrumEdit::addCtrl()
connect(ctrlEdit, SIGNAL(yposChanged(int)), toolbar, SLOT(setInt(int)));
connect(tools2, SIGNAL(toolChanged(int)), ctrlEdit, SLOT(setTool(int)));
connect(dlist, SIGNAL(curDrumInstrumentChanged(int)), SLOT(setCurDrumInstrument(int)));
+ connect(dlist, SIGNAL(curDrumInstrumentChanged(int)), canvas, SLOT(setCurDrumInstrument(int)));
//printf("DrumEdit::addCtrl curDrumInstrument:%d\n", dlist->getSelectedInstrument());
@@ -1050,21 +1052,21 @@ void DrumEdit::keyPressEvent(QKeyEvent* event)
close();
return;
}
+ else if (key == Qt::Key_F2) {
+ dlist->lineEdit(dlist->getSelectedInstrument(),(int)DList::COL_NAME);
+ return;
+ }
else if (key == Qt::Key_Up) {
dlist->setCurDrumInstrument(dlist->getSelectedInstrument()-1);
dlist->redraw();
return;
}
- else if (key == Qt::Key_F2) {
- dlist->lineEdit(dlist->getSelectedInstrument(),(int)DList::COL_NAME);
- return;
- }
else if (key == Qt::Key_Down) {
dlist->setCurDrumInstrument(dlist->getSelectedInstrument()+1);
dlist->redraw();
return;
}
-
+
else if (key == shortcuts[SHRT_POS_INC].key) {
dc->cmd(DrumCanvas::CMD_RIGHT);
return;
@@ -1095,6 +1097,10 @@ void DrumEdit::keyPressEvent(QKeyEvent* event)
tools2->set(RubberTool);
return;
}
+ else if (key == shortcuts[SHRT_TOOL_CURSOR].key) {
+ tools2->set(CursorTool);
+ return;
+ }
else if (key == shortcuts[SHRT_ZOOM_IN].key) {
int mag = hscroll->mag();
int zoomlvl = ScrollScale::getQuickZoomLevel(mag);
diff --git a/muse2/muse/shortcuts.cpp b/muse2/muse/shortcuts.cpp
index 5aacf085..5e387c46 100644
--- a/muse2/muse/shortcuts.cpp
+++ b/muse2/muse/shortcuts.cpp
@@ -208,6 +208,14 @@ void initShortCuts()
defShrt(SHRT_TOOL_RUBBER, Qt::Key_R, "Tool: Eraser", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "eraser_tool");
// piano roll & drum editor
defShrt(SHRT_TOOL_LINEDRAW, Qt::Key_F, "Tool: Line Draw", ARRANG_SHRT + PROLL_SHRT + DEDIT_SHRT, "line_draw_tool");
+
+ // drum editor
+ defShrt(SHRT_TOOL_CURSOR, Qt::Key_U, "Tool: Cursor", DEDIT_SHRT, "cursor_tool");
+ defShrt(SHRT_ADDNOTE_1, Qt::Key_V, "Add note:: 1", DEDIT_SHRT, "add note velocity 1");
+ defShrt(SHRT_ADDNOTE_2, Qt::Key_B, "Add note:: 2", DEDIT_SHRT, "add note velocity 2");
+ defShrt(SHRT_ADDNOTE_3, Qt::Key_N, "Add note:: 3", DEDIT_SHRT, "add note velocity 3");
+ defShrt(SHRT_ADDNOTE_4, Qt::Key_M, "Add note:: 4", DEDIT_SHRT, "add note velocity 4");
+
// arranger
defShrt(SHRT_TOOL_SCISSORS, Qt::Key_S, "Tool: Scissor", ARRANG_SHRT, "scissor_tool");
defShrt(SHRT_TOOL_GLUE, Qt::Key_G, "Tool: Glue", ARRANG_SHRT, "glue_tool");
diff --git a/muse2/muse/shortcuts.h b/muse2/muse/shortcuts.h
index 7cd47bd5..340bf2fb 100644
--- a/muse2/muse/shortcuts.h
+++ b/muse2/muse/shortcuts.h
@@ -286,6 +286,13 @@ enum {
// pianoroll and drum editor
SHRT_TOOL_LINEDRAW,
+ // drum editor
+ SHRT_TOOL_CURSOR,
+ SHRT_ADDNOTE_1,
+ SHRT_ADDNOTE_2,
+ SHRT_ADDNOTE_3,
+ SHRT_ADDNOTE_4,
+
// arranger
SHRT_TOOL_SCISSORS,
SHRT_TOOL_GLUE,
diff --git a/muse2/muse/widgets/tools.cpp b/muse2/muse/widgets/tools.cpp
index 40b0a328..31f014ef 100644
--- a/muse2/muse/widgets/tools.cpp
+++ b/muse2/muse/widgets/tools.cpp
@@ -35,18 +35,20 @@ const char* infoDraw = QT_TRANSLATE_NOOP("@default", "select Drawing Tool");
const char* infoMute = QT_TRANSLATE_NOOP("@default", "select Muting Tool:\n"
"click on part to mute/unmute");
const char* infoAutomation = QT_TRANSLATE_NOOP("@default", "Manipulate automation");
+const char* infoCursor = QT_TRANSLATE_NOOP("@default", "Cursor tool");
ToolB toolList[] = {
- {&pointerIcon, QT_TRANSLATE_NOOP("@default", "pointer"), infoPointer },
- {&pencilIcon, QT_TRANSLATE_NOOP("@default", "pencil"), infoPencil },
- {&deleteIcon, QT_TRANSLATE_NOOP("@default", "eraser"), infoDel },
- {&cutIcon, QT_TRANSLATE_NOOP("@default", "cutter"), infoCut },
- {&note1Icon, QT_TRANSLATE_NOOP("@default", "score"), infoScore },
- {&glueIcon, QT_TRANSLATE_NOOP("@default", "glue"), infoGlue },
- {&quantIcon, QT_TRANSLATE_NOOP("@default", "quantize"), infoQuant },
- {&drawIcon, QT_TRANSLATE_NOOP("@default", "draw"), infoDraw },
- {&editmuteIcon, QT_TRANSLATE_NOOP("@default", "mute parts"), infoMute },
- {&drawIcon, QT_TRANSLATE_NOOP("@default", "edit automation"), infoAutomation},
+ {&pointerIcon, QT_TRANSLATE_NOOP("@default", "pointer"), infoPointer },
+ {&pencilIcon, QT_TRANSLATE_NOOP("@default", "pencil"), infoPencil },
+ {&deleteIcon, QT_TRANSLATE_NOOP("@default", "eraser"), infoDel },
+ {&cutIcon, QT_TRANSLATE_NOOP("@default", "cutter"), infoCut },
+ {&note1Icon, QT_TRANSLATE_NOOP("@default", "score"), infoScore },
+ {&glueIcon, QT_TRANSLATE_NOOP("@default", "glue"), infoGlue },
+ {&quantIcon, QT_TRANSLATE_NOOP("@default", "quantize"), infoQuant },
+ {&drawIcon, QT_TRANSLATE_NOOP("@default", "draw"), infoDraw },
+ {&editmuteIcon, QT_TRANSLATE_NOOP("@default", "mute parts"), infoMute },
+ {&drawIcon, QT_TRANSLATE_NOOP("@default", "edit automation"),infoAutomation},
+ {&cursorIcon, QT_TRANSLATE_NOOP("@default", "cursor"), infoCursor},
};
//---------------------------------------------------------
diff --git a/muse2/muse/widgets/tools.h b/muse2/muse/widgets/tools.h
index 43d1ebaf..be479a50 100644
--- a/muse2/muse/widgets/tools.h
+++ b/muse2/muse/widgets/tools.h
@@ -16,8 +16,19 @@ class QAction;
class QPixmap;
class QWidget;
-enum Tool { PointerTool=1, PencilTool=2, RubberTool=4, CutTool=8,
- ScoreTool=16, GlueTool=32, QuantTool=64, DrawTool=128, MuteTool=256, AutomationTool=512};
+enum Tool {
+ PointerTool=1,
+ PencilTool=2,
+ RubberTool=4,
+ CutTool=8,
+ ScoreTool=16,
+ GlueTool=32,
+ QuantTool=64,
+ DrawTool=128,
+ MuteTool=256,
+ AutomationTool=512,
+ CursorTool=1024
+};
const int arrangerTools = PointerTool | PencilTool | RubberTool | CutTool | GlueTool | MuteTool | AutomationTool;