diff view/Pane.cpp @ 335:2f83b6e3b8ca

* Add Erase tool and mode * Add icons for Normalize buttons in property boxes, and for Show Peaks * Add support for velocity in notes -- not yet reflected in display or editable in the note edit dialog, but they are imported from MIDI, played, and exported * Begin work on making pastes align pasted times (subtler than I thought)
author Chris Cannam
date Fri, 23 Nov 2007 16:48:23 +0000
parents e74b56f07c73
children 1d3b27e69bf0 0895517bb2d1
line wrap: on
line diff
--- a/view/Pane.cpp	Thu Nov 22 14:27:41 2007 +0000
+++ b/view/Pane.cpp	Fri Nov 23 16:48:23 2007 +0000
@@ -1294,6 +1294,13 @@
 	    layer->drawStart(this, e);
 	}
 
+    } else if (mode == ViewManager::EraseMode) {
+
+	Layer *layer = getSelectedLayer();
+	if (layer && layer->isLayerEditable()) {
+	    layer->eraseStart(this, e);
+	}
+
     } else if (mode == ViewManager::EditMode) {
 
 	if (!editSelectionStart(e)) {
@@ -1379,6 +1386,14 @@
 	    update();
 	}
 
+    } else if (mode == ViewManager::EraseMode) {
+
+	Layer *layer = getSelectedLayer();
+	if (layer && layer->isLayerEditable()) {
+	    layer->eraseEnd(this, e);
+	    update();
+	}
+
     } else if (mode == ViewManager::EditMode) {
 
 	if (!editSelectionEnd(e)) {
@@ -1485,6 +1500,13 @@
 	    layer->drawDrag(this, e);
 	}
 
+    } else if (mode == ViewManager::EraseMode) {
+
+	Layer *layer = getSelectedLayer();
+	if (layer && layer->isLayerEditable()) {
+	    layer->eraseDrag(this, e);
+	}
+
     } else if (mode == ViewManager::EditMode) {
 
 	if (!editSelectionDrag(e)) {
@@ -2189,6 +2211,10 @@
     case ViewManager::DrawMode:
 	setCursor(Qt::CrossCursor);
 	break;
+	
+    case ViewManager::EraseMode:
+	setCursor(Qt::CrossCursor);
+	break;
 
     case ViewManager::MeasureMode:
         if (m_measureCursor1) setCursor(*m_measureCursor1);
@@ -2328,6 +2354,13 @@
 	if (editable) {
             help = tr("Click to add a new item in the active layer");
         }
+
+    } else if (mode == ViewManager::EraseMode) {
+        
+        //!!! could call through to a layer function to find out exact meaning
+	if (editable) {
+            help = tr("Click to erase an item from the active layer");
+        }
         
     } else if (mode == ViewManager::EditMode) {