From 11cb8b5d68e435343776ca6b8591fe822b5694c2 Mon Sep 17 00:00:00 2001 From: Lukas W Date: Fri, 12 Dec 2014 10:51:15 +0100 Subject: [PATCH] Automation Editor tension fix --- include/AutomationEditor.h | 3 +++ src/core/AutomationPattern.cpp | 5 ----- src/gui/editors/AutomationEditor.cpp | 24 +++++++++++++++++++----- 3 files changed, 22 insertions(+), 10 deletions(-) diff --git a/include/AutomationEditor.h b/include/AutomationEditor.h index 94798bedd..2aebe45f5 100644 --- a/include/AutomationEditor.h +++ b/include/AutomationEditor.h @@ -266,6 +266,9 @@ public: QSize sizeHint() const; +public slots: + void clearCurrentPattern(); + signals: void currentPatternChanged(); diff --git a/src/core/AutomationPattern.cpp b/src/core/AutomationPattern.cpp index 76b185d42..a1c01720a 100644 --- a/src/core/AutomationPattern.cpp +++ b/src/core/AutomationPattern.cpp @@ -79,11 +79,6 @@ AutomationPattern::AutomationPattern( const AutomationPattern & _pat_to_copy ) : AutomationPattern::~AutomationPattern() { - if( Engine::automationEditor() && - Engine::automationEditor()->currentPattern() == this ) - { - Engine::automationEditor()->setCurrentPattern( NULL ); - } } diff --git a/src/gui/editors/AutomationEditor.cpp b/src/gui/editors/AutomationEditor.cpp index ed5a5bb46..e7693f5ee 100644 --- a/src/gui/editors/AutomationEditor.cpp +++ b/src/gui/editors/AutomationEditor.cpp @@ -584,7 +584,6 @@ void AutomationEditor::mouseReleaseEvent(QMouseEvent * mouseEvent ) -#include void AutomationEditor::mouseMoveEvent(QMouseEvent * mouseEvent ) { QMutexLocker m( &m_patternMutex ); @@ -1999,8 +1998,6 @@ AutomationEditorWindow::AutomationEditorWindow() : QAction* eraseAction = editModeGroup->addAction(embed::getIconPixmap("edit_erase"), tr("Erase mode (Shift+E)")); eraseAction->setShortcut(Qt::SHIFT | Qt::Key_E); - drawAction->setChecked(true); - // TODO: m_selectButton and m_moveButton are broken. // m_selectButton = new QAction(embed::getIconPixmap("edit_select"), tr("Select mode (Shift+S)"), editModeGroup); // m_moveButton = new QAction(embed::getIconPixmap("edit_move"), tr("Move selection mode (Shift+M)"), editModeGroup); @@ -2039,12 +2036,19 @@ AutomationEditorWindow::AutomationEditorWindow() : m_cubicHermiteAction = progression_type_group->addAction( embed::getIconPixmap("progression_cubic_hermite"), tr( "Cubic Hermite progression")); - m_discreteAction->setChecked( true ); - connect(progression_type_group, SIGNAL(triggered(int)), m_editor, SLOT(setProgressionType(int))); // setup tension-stuff m_tensionKnob = new Knob( knobSmall_17, this, "Tension" ); + m_tensionKnob->setModel(m_editor->m_tensionModel); + ToolTip::add(m_tensionKnob, tr("Tension value for spline")); + m_tensionKnob->setWhatsThis( + tr("A higher tension value may make a smoother curve " + "but overshoot some values. A low tension " + "value will cause the slope of the curve to " + "level off at each control point.")); + + connect(m_cubicHermiteAction, SIGNAL(toggled(bool)), m_tensionKnob, SLOT(setEnabled(bool))); m_discreteAction->setWhatsThis( tr( "Click here to choose discrete progressions for this " @@ -2173,6 +2177,9 @@ AutomationEditorWindow::AutomationEditorWindow() : m_toolBar->addWidget( quantize_lbl ); m_toolBar->addWidget( m_quantizeComboBox ); + drawAction->setChecked(true); + m_discreteAction->setChecked(true); + // Setup our actual window setFocusPolicy( Qt::StrongFocus ); setFocus(); @@ -2205,6 +2212,8 @@ void AutomationEditorWindow::setCurrentPattern(AutomationPattern* pattern) break; } + connect(pattern, SIGNAL(destroyed()), this, SLOT(clearCurrentPattern())); + emit currentPatternChanged(); } @@ -2225,6 +2234,11 @@ QSize AutomationEditorWindow::sizeHint() const return {INITIAL_WIDTH, INITIAL_HEIGHT}; } +void AutomationEditorWindow::clearCurrentPattern() +{ + setCurrentPattern(nullptr); +} + void AutomationEditorWindow::play() { m_editor->play();