changeset 217:69f83e36b8e5

* 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 1fa0d271fd2c
children e6b581c7c246
files icons/draw.png icons/erase.png icons/normalise-columns.png icons/normalise.png icons/select.png icons/show-peaks.png main/MainWindow.cpp main/MainWindow.h sonic-visualiser.qrc
diffstat 9 files changed, 30 insertions(+), 18 deletions(-) [+]
line wrap: on
line diff
Binary file icons/draw.png has changed
Binary file icons/erase.png has changed
Binary file icons/normalise-columns.png has changed
Binary file icons/normalise.png has changed
Binary file icons/select.png has changed
Binary file icons/show-peaks.png has changed
--- a/main/MainWindow.cpp	Thu Nov 22 14:13:20 2007 +0000
+++ b/main/MainWindow.cpp	Fri Nov 23 16:48:23 2007 +0000
@@ -1738,10 +1738,21 @@
     m_keyReference->registerShortcut(action);
     m_toolActions[ViewManager::DrawMode] = action;
 
+    action = toolbar->addAction(il.load("erase"),
+				tr("Erase"));
+    action->setCheckable(true);
+    action->setShortcut(tr("5"));
+    action->setStatusTip(tr("Erase items from layer"));
+    connect(action, SIGNAL(triggered()), this, SLOT(toolEraseSelected()));
+    connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
+    group->addAction(action);
+    m_keyReference->registerShortcut(action);
+    m_toolActions[ViewManager::EraseMode] = action;
+
     action = toolbar->addAction(il.load("measure"),
 				tr("Measure"));
     action->setCheckable(true);
-    action->setShortcut(tr("5"));
+    action->setShortcut(tr("6"));
     action->setStatusTip(tr("Make measurements in layer"));
     connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected()));
     connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool)));
@@ -1749,14 +1760,6 @@
     m_keyReference->registerShortcut(action);
     m_toolActions[ViewManager::MeasureMode] = action;
 
-//    action = toolbar->addAction(il.load("text"),
-//				tr("Text"));
-//    action->setCheckable(true);
-//    action->setShortcut(tr("5"));
-//    connect(action, SIGNAL(triggered()), this, SLOT(toolTextSelected()));
-//    group->addAction(action);
-//    m_toolActions[ViewManager::TextMode] = action;
-
     toolNavigateSelected();
 
     Pane::registerShortcuts(*m_keyReference);
@@ -1899,17 +1902,17 @@
 }
 
 void
+MainWindow::toolEraseSelected()
+{
+    m_viewManager->setToolMode(ViewManager::EraseMode);
+}
+
+void
 MainWindow::toolMeasureSelected()
 {
     m_viewManager->setToolMode(ViewManager::MeasureMode);
 }
 
-//void
-//MainWindow::toolTextSelected()
-//{
-//    m_viewManager->setToolMode(ViewManager::TextMode);
-//}
-
 void
 MainWindow::importAudio()
 {
@@ -2824,15 +2827,19 @@
 	if (emptyTypes.find(type) != emptyTypes.end()) {
 
 	    newLayer = m_document->createEmptyLayer(type);
-	    m_toolActions[ViewManager::DrawMode]->trigger();
+            if (newLayer) {
+                m_toolActions[ViewManager::DrawMode]->trigger();
+            }
 
 	} else {
 
 	    newLayer = m_document->createMainModelLayer(type);
 	}
 
-	m_document->addLayerToView(pane, newLayer);
-	m_paneStack->setCurrentLayer(pane, newLayer);
+        if (newLayer) {
+            m_document->addLayerToView(pane, newLayer);
+            m_paneStack->setCurrentLayer(pane, newLayer);
+        }
 
 	return;
     }
--- a/main/MainWindow.h	Thu Nov 22 14:13:20 2007 +0000
+++ b/main/MainWindow.h	Fri Nov 23 16:48:23 2007 +0000
@@ -99,6 +99,7 @@
     virtual void toolSelectSelected();
     virtual void toolEditSelected();
     virtual void toolDrawSelected();
+    virtual void toolEraseSelected();
     virtual void toolMeasureSelected();
 
     virtual void documentModified();
--- a/sonic-visualiser.qrc	Thu Nov 22 14:13:20 2007 +0000
+++ b/sonic-visualiser.qrc	Fri Nov 23 16:48:23 2007 +0000
@@ -28,6 +28,7 @@
     <file>icons/text.png</file>
     <file>icons/draw.png</file>
     <file>icons/draw-curve.png</file>
+    <file>icons/erase.png</file>
     <file>icons/measure.png</file>
     <file>icons/measure1cursor.xbm</file>
     <file>icons/measure1mask.xbm</file>
@@ -66,6 +67,9 @@
     <file>icons/help.png</file>
     <file>icons/emptypage.png</file>
     <file>icons/cross.png</file>
+    <file>icons/normalise.png</file>
+    <file>icons/normalise-columns.png</file>
+    <file>icons/show-peaks.png</file>
     <file>icons/sv-16x16.png</file>
     <file>icons/sv-22x22.png</file>
     <file>icons/sv-24x24.png</file>