comparison main/MainWindow.cpp @ 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
comparison
equal deleted inserted replaced
216:1fa0d271fd2c 217:69f83e36b8e5
1736 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool))); 1736 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
1737 group->addAction(action); 1737 group->addAction(action);
1738 m_keyReference->registerShortcut(action); 1738 m_keyReference->registerShortcut(action);
1739 m_toolActions[ViewManager::DrawMode] = action; 1739 m_toolActions[ViewManager::DrawMode] = action;
1740 1740
1741 action = toolbar->addAction(il.load("erase"),
1742 tr("Erase"));
1743 action->setCheckable(true);
1744 action->setShortcut(tr("5"));
1745 action->setStatusTip(tr("Erase items from layer"));
1746 connect(action, SIGNAL(triggered()), this, SLOT(toolEraseSelected()));
1747 connect(this, SIGNAL(canEditLayer(bool)), action, SLOT(setEnabled(bool)));
1748 group->addAction(action);
1749 m_keyReference->registerShortcut(action);
1750 m_toolActions[ViewManager::EraseMode] = action;
1751
1741 action = toolbar->addAction(il.load("measure"), 1752 action = toolbar->addAction(il.load("measure"),
1742 tr("Measure")); 1753 tr("Measure"));
1743 action->setCheckable(true); 1754 action->setCheckable(true);
1744 action->setShortcut(tr("5")); 1755 action->setShortcut(tr("6"));
1745 action->setStatusTip(tr("Make measurements in layer")); 1756 action->setStatusTip(tr("Make measurements in layer"));
1746 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected())); 1757 connect(action, SIGNAL(triggered()), this, SLOT(toolMeasureSelected()));
1747 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool))); 1758 connect(this, SIGNAL(canMeasureLayer(bool)), action, SLOT(setEnabled(bool)));
1748 group->addAction(action); 1759 group->addAction(action);
1749 m_keyReference->registerShortcut(action); 1760 m_keyReference->registerShortcut(action);
1750 m_toolActions[ViewManager::MeasureMode] = action; 1761 m_toolActions[ViewManager::MeasureMode] = action;
1751
1752 // action = toolbar->addAction(il.load("text"),
1753 // tr("Text"));
1754 // action->setCheckable(true);
1755 // action->setShortcut(tr("5"));
1756 // connect(action, SIGNAL(triggered()), this, SLOT(toolTextSelected()));
1757 // group->addAction(action);
1758 // m_toolActions[ViewManager::TextMode] = action;
1759 1762
1760 toolNavigateSelected(); 1763 toolNavigateSelected();
1761 1764
1762 Pane::registerShortcuts(*m_keyReference); 1765 Pane::registerShortcuts(*m_keyReference);
1763 } 1766 }
1897 { 1900 {
1898 m_viewManager->setToolMode(ViewManager::DrawMode); 1901 m_viewManager->setToolMode(ViewManager::DrawMode);
1899 } 1902 }
1900 1903
1901 void 1904 void
1905 MainWindow::toolEraseSelected()
1906 {
1907 m_viewManager->setToolMode(ViewManager::EraseMode);
1908 }
1909
1910 void
1902 MainWindow::toolMeasureSelected() 1911 MainWindow::toolMeasureSelected()
1903 { 1912 {
1904 m_viewManager->setToolMode(ViewManager::MeasureMode); 1913 m_viewManager->setToolMode(ViewManager::MeasureMode);
1905 } 1914 }
1906
1907 //void
1908 //MainWindow::toolTextSelected()
1909 //{
1910 // m_viewManager->setToolMode(ViewManager::TextMode);
1911 //}
1912 1915
1913 void 1916 void
1914 MainWindow::importAudio() 1917 MainWindow::importAudio()
1915 { 1918 {
1916 QString path = getOpenFileName(FileFinder::AudioFile); 1919 QString path = getOpenFileName(FileFinder::AudioFile);
2822 Layer *newLayer; 2825 Layer *newLayer;
2823 2826
2824 if (emptyTypes.find(type) != emptyTypes.end()) { 2827 if (emptyTypes.find(type) != emptyTypes.end()) {
2825 2828
2826 newLayer = m_document->createEmptyLayer(type); 2829 newLayer = m_document->createEmptyLayer(type);
2827 m_toolActions[ViewManager::DrawMode]->trigger(); 2830 if (newLayer) {
2831 m_toolActions[ViewManager::DrawMode]->trigger();
2832 }
2828 2833
2829 } else { 2834 } else {
2830 2835
2831 newLayer = m_document->createMainModelLayer(type); 2836 newLayer = m_document->createMainModelLayer(type);
2832 } 2837 }
2833 2838
2834 m_document->addLayerToView(pane, newLayer); 2839 if (newLayer) {
2835 m_paneStack->setCurrentLayer(pane, newLayer); 2840 m_document->addLayerToView(pane, newLayer);
2841 m_paneStack->setCurrentLayer(pane, newLayer);
2842 }
2836 2843
2837 return; 2844 return;
2838 } 2845 }
2839 2846
2840 TransformId transform = i->second; 2847 TransformId transform = i->second;