changeset 45:f4ee3c11eba9

toggle button for boundary constraints and note recalculation
author gyorgyf
date Thu, 20 Jun 2013 10:58:40 +0100
parents 66ba56e708c0
children 0909a7bda224
files .hgsubstate src/Analyser.cpp src/Analyser.h src/MainWindow.cpp src/MainWindow.h
diffstat 5 files changed, 44 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/.hgsubstate	Wed Jun 19 23:21:04 2013 +0100
+++ b/.hgsubstate	Thu Jun 20 10:58:40 2013 +0100
@@ -1,3 +1,3 @@
 cba1e2a3d14bdaa7ca167d8c1ff9727359a560d3 svapp
 e2b535b35b5f19eee55dd95242101147cc105eb0 svcore
-ac26de7b727a5539a50fc69433be24d632f5cef3 svgui
+050404ae7799c4c4b92a08d60024f36f8273450f svgui
--- a/src/Analyser.cpp	Wed Jun 19 23:21:04 2013 +0100
+++ b/src/Analyser.cpp	Thu Jun 20 10:58:40 2013 +0100
@@ -38,6 +38,7 @@
 
 Analyser::~Analyser()
 {
+    if (m_flexiNoteLayer) delete m_flexiNoteLayer;
 }
 
 void
@@ -48,11 +49,11 @@
     m_fileModel = model;
     m_pane = pane;
 
-    TransformId f0 = "vamp:yintony:yintony:notepitchtrack";
-    TransformId notes = "vamp:yintony:yintony:notes";
+    // TransformId f0 = "vamp:yintony:yintony:notepitchtrack";
+    // TransformId notes = "vamp:yintony:yintony:notes";
 
-    // TransformId f0 = "vamp:cepstral-pitchtracker:cepstral-pitchtracker:f0";
-    // TransformId notes = "vamp:cepstral-pitchtracker:cepstral-pitchtracker:notes";
+    TransformId f0 = "vamp:cepstral-pitchtracker:cepstral-pitchtracker:f0";
+    TransformId notes = "vamp:cepstral-pitchtracker:cepstral-pitchtracker:notes";
 
     // We don't want a waveform in the main pane. We must have a
     // main-model layer of some sort, but the layers created by
@@ -84,6 +85,7 @@
     if (layer) {
 	FlexiNoteLayer *nl = qobject_cast<FlexiNoteLayer *>(layer);
 	if (nl) {
+	    m_flexiNoteLayer = nl;
 	    nl->setBaseColour(ColourDatabase::getInstance()->
 			      getColourIndex(QString("Bright Blue")));
             nl->setVerticalScale(FlexiNoteLayer::AutoAlignScale);
@@ -164,3 +166,9 @@
     return layer;
 }
 
+void
+Analyser::setIntelligentActions(bool on) 
+{
+    std::cerr << "toggle setIntelligentActions " << on << std::endl;
+    m_flexiNoteLayer->setIntelligentActions(on);
+}
--- a/src/Analyser.h	Wed Jun 19 23:21:04 2013 +0100
+++ b/src/Analyser.h	Thu Jun 20 10:58:40 2013 +0100
@@ -20,7 +20,7 @@
 
 #include "transform/Transform.h"
 #include "layer/LayerFactory.h" // GF: added so we can access the FlexiNotes enum value.
-
+#include "layer/FlexiNoteLayer.h"
 
 class WaveFileModel;
 class Pane;
@@ -39,11 +39,14 @@
 
     void newFileLoaded(Document *newDocument, WaveFileModel *model,
 		       PaneStack *paneStack, Pane *pane);
+		       
+    void setIntelligentActions(bool);
 
 protected:
     Document *m_document;
     WaveFileModel *m_fileModel;
     Pane *m_pane;
+    FlexiNoteLayer *m_flexiNoteLayer;
 
     Layer *addLayerFor(TransformId);
     Layer *addLayerForNotes(TransformId);
--- a/src/MainWindow.cpp	Wed Jun 19 23:21:04 2013 +0100
+++ b/src/MainWindow.cpp	Thu Jun 20 10:58:40 2013 +0100
@@ -84,8 +84,9 @@
     MainWindowBase(withAudioOutput, withOSCSupport, false),
     m_overview(0),
     m_mainMenusCreated(false),
+    m_intelligentActionOn(true), //GF: !!! temporary
     m_playbackMenu(0),
-    m_recentFilesMenu(0),
+    m_recentFilesMenu(0), 
     m_rightButtonMenu(0),
     m_rightButtonPlaybackMenu(0),
     m_deleteSelectedAction(0),
@@ -594,6 +595,12 @@
     connect(m_editSelectAction, SIGNAL(triggered()), this, SLOT(selectNoteEditMode())); 
     // connect(this, SIGNAL(canPlay(bool)), test, SLOT(setEnabled(bool)));
     menu->addAction(m_editSelectAction);
+    
+    m_toggleIntelligenceAction = toolbar->addAction(il.load("notes"), tr("EditMode"));
+    // m_toggleIntelligenceAction->setShortcut(tr("Home"));
+    m_toggleIntelligenceAction->setStatusTip(tr("Toggle note edit boundary constraints and automation"));
+    m_toggleIntelligenceAction->setEnabled(true);
+    connect(m_toggleIntelligenceAction, SIGNAL(triggered()), this, SLOT(toggleNoteEditIntelligence()));
 
     Pane::registerShortcuts(*m_keyReference);
 }
@@ -609,7 +616,21 @@
         std::cerr << "NoteEdit mode selected" << std::endl;
         m_viewManager->setToolMode(ViewManager::NoteEditMode);
         m_editSelectAction->setIcon(il.load("navigate"));
-        m_editSelectAction->setStatusTip(tr("Navigate"));
+    }
+}
+
+void
+MainWindow::toggleNoteEditIntelligence()
+{
+    IconLoader il;
+    if (m_intelligentActionOn == true) {
+        m_toggleIntelligenceAction->setIcon(il.load("values"));
+        m_intelligentActionOn = false;
+        m_analyser->setIntelligentActions(false);
+    } else {
+        m_toggleIntelligenceAction->setIcon(il.load("notes"));
+        m_intelligentActionOn = true;
+        m_analyser->setIntelligentActions(true);
     }
 }
 
--- a/src/MainWindow.h	Wed Jun 19 23:21:04 2013 +0100
+++ b/src/MainWindow.h	Thu Jun 20 10:58:40 2013 +0100
@@ -100,6 +100,7 @@
 
    // GF: function for switching to NoteEditMode (perhaps temporary, as we may want this to be triggered in some other way...)
    virtual void selectNoteEditMode();
+   virtual void toggleNoteEditIntelligence();
 
 
 protected:
@@ -122,6 +123,9 @@
     QAction       *m_ffwdAction;
     QAction       *m_rwdAction;
     QAction       *m_editSelectAction;
+    QAction       *m_toggleIntelligenceAction;
+    bool           m_intelligentActionOn; // GF: !!! temporary
+    
 
     KeyReference  *m_keyReference;