diff layer/NoteLayer.cpp @ 1427:f792a5001d80 single-point

Update to use external set of commands
author Chris Cannam
date Fri, 15 Mar 2019 11:09:17 +0000
parents e1a08da75427
children c9fa16e41664
line wrap: on
line diff
--- a/layer/NoteLayer.cpp	Thu Mar 14 15:32:58 2019 +0000
+++ b/layer/NoteLayer.cpp	Fri Mar 15 11:09:17 2019 +0000
@@ -881,7 +881,7 @@
     m_originalPoint = m_editingPoint;
 
     if (m_editingCommand) finish(m_editingCommand);
-    m_editingCommand = new NoteModel::EditCommand(m_model, tr("Draw Point"));
+    m_editingCommand = new ChangeEventsCommand(m_model, tr("Draw Point"));
     m_editingCommand->add(m_editingPoint);
 
     m_editing = true;
@@ -959,7 +959,7 @@
     if (p.getFrame() != m_editingPoint.getFrame() ||
         p.getValue() != m_editingPoint.getValue()) return;
 
-    m_editingCommand = new NoteModel::EditCommand(m_model, tr("Erase Point"));
+    m_editingCommand = new ChangeEventsCommand(m_model, tr("Erase Point"));
 
     m_editingCommand->remove(m_editingPoint);
 
@@ -1010,7 +1010,7 @@
     double value = getValueForY(v, newy);
 
     if (!m_editingCommand) {
-        m_editingCommand = new NoteModel::EditCommand(m_model,
+        m_editingCommand = new ChangeEventsCommand(m_model,
                                                       tr("Drag Point"));
     }
 
@@ -1083,7 +1083,7 @@
             .withDuration(dialog->getFrameDuration())
             .withLabel(dialog->getText());
         
-        NoteModel::EditCommand *command = new NoteModel::EditCommand
+        ChangeEventsCommand *command = new ChangeEventsCommand
             (m_model, tr("Edit Point"));
         command->remove(note);
         command->add(newNote);
@@ -1102,8 +1102,8 @@
 {
     if (!m_model) return;
 
-    NoteModel::EditCommand *command =
-        new NoteModel::EditCommand(m_model, tr("Drag Selection"));
+    ChangeEventsCommand *command =
+        new ChangeEventsCommand(m_model, tr("Drag Selection"));
 
     EventVector points =
         m_model->getEventsStartingWithin(s.getStartFrame(), s.getDuration());
@@ -1123,8 +1123,8 @@
 {
     if (!m_model || !s.getDuration()) return;
 
-    NoteModel::EditCommand *command =
-        new NoteModel::EditCommand(m_model, tr("Resize Selection"));
+    ChangeEventsCommand *command =
+        new ChangeEventsCommand(m_model, tr("Resize Selection"));
 
     EventVector points =
         m_model->getEventsStartingWithin(s.getStartFrame(), s.getDuration());
@@ -1153,8 +1153,8 @@
 {
     if (!m_model) return;
 
-    NoteModel::EditCommand *command =
-        new NoteModel::EditCommand(m_model, tr("Delete Selected Points"));
+    ChangeEventsCommand *command =
+        new ChangeEventsCommand(m_model, tr("Delete Selected Points"));
 
     EventVector points =
         m_model->getEventsStartingWithin(s.getStartFrame(), s.getDuration());
@@ -1206,8 +1206,8 @@
         }
     }
 
-    NoteModel::EditCommand *command =
-        new NoteModel::EditCommand(m_model, tr("Paste"));
+    ChangeEventsCommand *command =
+        new ChangeEventsCommand(m_model, tr("Paste"));
 
     for (EventVector::const_iterator i = points.begin();
          i != points.end(); ++i) {
@@ -1277,7 +1277,7 @@
             m_pendingNoteOns.erase(i);
             Event note = p.withDuration(frame - p.getFrame());
             if (m_model) {
-                NoteModel::EditCommand *c = new NoteModel::EditCommand
+                ChangeEventsCommand *c = new ChangeEventsCommand
                     (m_model, tr("Record Note"));
                 c->add(note);
                 // execute and bundle: