summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--muse2/ChangeLog2
-rw-r--r--muse2/muse/liste/listedit.cpp128
-rw-r--r--muse2/muse/liste/listedit.h2
3 files changed, 83 insertions, 49 deletions
diff --git a/muse2/ChangeLog b/muse2/ChangeLog
index 1d80c192..e3c783f1 100644
--- a/muse2/ChangeLog
+++ b/muse2/ChangeLog
@@ -1,3 +1,5 @@
+04.07.2012:
+ - added inc/dec tick for events in the list editor (rj)
03.07.2012:
- Fixed new drum parts disappear as sson as they're drawn. (Tim)
30.06.2012:
diff --git a/muse2/muse/liste/listedit.cpp b/muse2/muse/liste/listedit.cpp
index cdc34b45..0f6fd137 100644
--- a/muse2/muse/liste/listedit.cpp
+++ b/muse2/muse/liste/listedit.cpp
@@ -517,6 +517,12 @@ ListEdit::ListEdit(MusECore::PartList* pl)
editSignalMapper->setMapping(deleteAction, CMD_DELETE);
deleteAction->setShortcut(Qt::Key_Delete);
menuEdit->addSeparator();
+ QAction *incAction = menuEdit->addAction(tr("Increase Tick"));
+ connect(incAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ editSignalMapper->setMapping(incAction, CMD_INC);
+ QAction *decAction = menuEdit->addAction(tr("Decrease Tick"));
+ connect(decAction, SIGNAL(triggered()), editSignalMapper, SLOT(map()));
+ editSignalMapper->setMapping(decAction, CMD_DEC);
menuEdit->addActions(insertItems->actions());
@@ -918,61 +924,87 @@ void ListEdit::doubleClicked(QTreeWidgetItem* item)
//---------------------------------------------------------
void ListEdit::cmd(int cmd)
+{
+ bool found = false;
+ for (int row = 0; row < liste->topLevelItemCount(); ++row)
+ {
+ QTreeWidgetItem* i = liste->topLevelItem(row);
+ EventListItem *item = (EventListItem *) i;
+ if (i->isSelected() || item->event.selected())
{
- switch(cmd) {
- case CMD_DELETE:
- bool found = false;
- for (int row = 0; row < liste->topLevelItemCount(); ++row)
- {
+ found = true;
+ break;
+ }
+ }
+
+ switch(cmd) {
+ case CMD_DELETE:
+ {
+ if(!found)
+ break;
+
+ MusECore::Undo operations;
+
+ EventListItem *deletedEvent=NULL;
+ for (int row = 0; row < liste->topLevelItemCount(); ++row) {
QTreeWidgetItem* i = liste->topLevelItem(row);
EventListItem *item = (EventListItem *) i;
- if (i->isSelected() || item->event.selected())
- {
- found = true;
+ if (i->isSelected() || item->event.selected()) {
+ deletedEvent=item;
+ // Port controller values and clone parts.
+ operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent,item->event, item->part, true, true));
+ }
+ }
+
+ unsigned int nextTick=0;
+ // find biggest tick
+ for (int row = 0; row < liste->topLevelItemCount(); ++row) {
+ QTreeWidgetItem* i = liste->topLevelItem(row);
+ EventListItem *item = (EventListItem *) i;
+ if (item->event.tick() > nextTick && item != deletedEvent)
+ nextTick=item->event.tick();
+ }
+ // check if there's a tick that is "just" bigger than the deleted
+ for (int row = 0; row < liste->topLevelItemCount(); ++row) {
+ QTreeWidgetItem* i = liste->topLevelItem(row);
+ EventListItem *item = (EventListItem *) i;
+ if (item->event.tick() >= deletedEvent->event.tick() &&
+ item->event.tick() < nextTick &&
+ item != deletedEvent ) {
+ nextTick=item->event.tick();
+ }
+ }
+ selectedTick=nextTick;
+
+ MusEGlobal::song->applyOperationGroup(operations);
+ }
+ break;
+ case CMD_INC:
+ case CMD_DEC:
+ {
+ if(!found)
+ break;
+
+ MusECore::Undo operations;
+
+ for (int row = 0; row < liste->topLevelItemCount(); ++row) {
+ QTreeWidgetItem* i = liste->topLevelItem(row);
+ EventListItem *item = (EventListItem *) i;
+
+ if (i->isSelected() || item->event.selected()) {
+ MusECore::Event new_event=item->event.clone();
+ new_event.setTick( new_event.tick() + ( cmd==CMD_INC?1:-1) );
+ operations.push_back(MusECore::UndoOp(MusECore::UndoOp::ModifyEvent,new_event, item->event, item->part, false, false));
+ selectedTick=new_event.tick();
break;
+ }
}
- }
- if(!found)
- break;
-
- MusECore::Undo operations;
-
- EventListItem *deletedEvent=NULL;
- for (int row = 0; row < liste->topLevelItemCount(); ++row) {
- QTreeWidgetItem* i = liste->topLevelItem(row);
- EventListItem *item = (EventListItem *) i;
- if (i->isSelected() || item->event.selected()) {
- deletedEvent=item;
- // Port controller values and clone parts.
- operations.push_back(MusECore::UndoOp(MusECore::UndoOp::DeleteEvent,item->event, item->part, true, true));
- }
- }
-
- unsigned int nextTick=0;
- // find biggest tick
- for (int row = 0; row < liste->topLevelItemCount(); ++row) {
- QTreeWidgetItem* i = liste->topLevelItem(row);
- EventListItem *item = (EventListItem *) i;
- if (item->event.tick() > nextTick && item != deletedEvent)
- nextTick=item->event.tick();
- }
- // check if there's a tick that is "just" bigger than the deleted
- for (int row = 0; row < liste->topLevelItemCount(); ++row) {
- QTreeWidgetItem* i = liste->topLevelItem(row);
- EventListItem *item = (EventListItem *) i;
- if (item->event.tick() >= deletedEvent->event.tick() &&
- item->event.tick() < nextTick &&
- item != deletedEvent ) {
- nextTick=item->event.tick();
- }
- }
- selectedTick=nextTick;
+ MusEGlobal::song->applyOperationGroup(operations);
- MusEGlobal::song->applyOperationGroup(operations);
- break;
- }
- }
+ }
+ }
+}
//---------------------------------------------------------
// configChanged
diff --git a/muse2/muse/liste/listedit.h b/muse2/muse/liste/listedit.h
index 1dddb9a6..d9cdac96 100644
--- a/muse2/muse/liste/listedit.h
+++ b/muse2/muse/liste/listedit.h
@@ -61,7 +61,7 @@ class ListEdit : public MidiEditor {
int selectedTick;
int curPartId;
- enum { CMD_DELETE };
+ enum { CMD_DELETE, CMD_INC, CMD_DEC };
virtual void closeEvent(QCloseEvent*);