changeset 387:f329416bf1a5

* Permit holding Shift while dragging an instant or other edited thing, to override the initial drag resistance (for #1928943 sticky time instants) * better handling of updates during progressive decode load * ready() signal from model (used by vect)
author Chris Cannam
date Mon, 19 May 2008 17:23:11 +0000
parents 590b899b7e45
children 881470f9ca48
files layer/TimeInstantLayer.cpp view/Pane.cpp view/View.cpp
diffstat 3 files changed, 39 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/layer/TimeInstantLayer.cpp	Fri May 16 13:27:07 2008 +0000
+++ b/layer/TimeInstantLayer.cpp	Mon May 19 17:23:11 2008 +0000
@@ -35,6 +35,8 @@
 #include <iostream>
 #include <cmath>
 
+#define DEBUG_TIME_INSTANT_LAYER 1
+
 TimeInstantLayer::TimeInstantLayer() :
     SingleColourLayer(),
     m_model(0),
@@ -57,7 +59,9 @@
 
     connectSignals(m_model);
 
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::setModel(" << model << ")" << std::endl;
+#endif
 
     emit modelReplaced();
 }
@@ -446,7 +450,9 @@
 void
 TimeInstantLayer::drawStart(View *v, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::drawStart(" << e->x() << ")" << std::endl;
+#endif
 
     if (!m_model) return;
 
@@ -467,7 +473,9 @@
 void
 TimeInstantLayer::drawDrag(View *v, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::drawDrag(" << e->x() << ")" << std::endl;
+#endif
 
     if (!m_model || !m_editing) return;
 
@@ -482,7 +490,9 @@
 void
 TimeInstantLayer::drawEnd(View *, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::drawEnd(" << e->x() << ")" << std::endl;
+#endif
     if (!m_model || !m_editing) return;
     QString newName = tr("Add Point at %1 s")
 	.arg(RealTime::frame2RealTime(m_editingPoint.frame,
@@ -541,7 +551,9 @@
 void
 TimeInstantLayer::editStart(View *v, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::editStart(" << e->x() << ")" << std::endl;
+#endif
 
     if (!m_model) return;
 
@@ -561,7 +573,9 @@
 void
 TimeInstantLayer::editDrag(View *v, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::editDrag(" << e->x() << ")" << std::endl;
+#endif
 
     if (!m_model || !m_editing) return;
 
@@ -582,7 +596,9 @@
 void
 TimeInstantLayer::editEnd(View *, QMouseEvent *e)
 {
+#ifdef DEBUG_TIME_INSTANT_LAYER
     std::cerr << "TimeInstantLayer::editEnd(" << e->x() << ")" << std::endl;
+#endif
     if (!m_model || !m_editing) return;
     if (m_editingCommand) {
 	QString newName = tr("Move Point to %1 s")
--- a/view/Pane.cpp	Fri May 16 13:27:07 2008 +0000
+++ b/view/Pane.cpp	Mon May 19 17:23:11 2008 +0000
@@ -1557,14 +1557,25 @@
 
         if (!m_editing) {
 
+            bool resist = true;
+
+            if ((e->modifiers() & Qt::ShiftModifier)) {
+                m_shiftPressed = true;
+                // ... but don't set it false if shift has been
+                // released -- we want the state when we started
+                // dragging to be used most of the time
+            }
+
+            if (m_shiftPressed) resist = false;
+
             DragMode newDragMode = updateDragMode
                 (m_dragMode,
                  m_clickPos,
                  e->pos(),
-                 true,  // can move horiz
-                 true,  // can move vert
-                 true,  // resist horiz
-                 true); // resist vert
+                 true,    // can move horiz
+                 true,    // can move vert
+                 resist,  // resist horiz
+                 resist); // resist vert
 
             if (newDragMode != UnresolvedDrag) {
 
--- a/view/View.cpp	Fri May 16 13:27:07 2008 +0000
+++ b/view/View.cpp	Mon May 19 17:23:11 2008 +0000
@@ -1385,20 +1385,25 @@
 	    int completion = i->first->getCompletion(this);
             QString text = i->first->getPropertyContainerName();
 
+            Model *model = i->first->getModel();
+            RangeSummarisableTimeValueModel *wfm = 
+                dynamic_cast<RangeSummarisableTimeValueModel *>(model);
+
             if (completion >= 100) {
 
                 //!!!
-                Model *model = i->first->getModel();
-                RangeSummarisableTimeValueModel *wfm = 
-                    dynamic_cast<RangeSummarisableTimeValueModel *>(model);
                 if (wfm ||
                     (wfm = dynamic_cast<RangeSummarisableTimeValueModel *>
                      (model->getSourceModel()))) {
                     completion = wfm->getAlignmentCompletion();
+                    std::cerr << "View::checkProgress: Alignment completion = " << completion << std::endl;
                     if (completion < 100) {
                         text = tr("Alignment");
                     }
                 }
+
+            } else if (wfm) {
+                update(); // ensure duration &c gets updated
             }
 
 	    if (completion >= 100) {