changeset 19:46d8f5add6f0

* Introduce potentially-separate read and write ring buffers, so we can swap in a new set when something changes -- thus allowing us to respond quickly when something changes during playback, without losing the long buffers * Some fixes for display & editing
author Chris Cannam
date Fri, 27 Jan 2006 18:04:07 +0000
parents 7c767d41bcee
children 1deb5f87a18c
files widgets/Pane.cpp widgets/PaneStack.cpp widgets/PaneStack.h widgets/PropertyStack.cpp widgets/PropertyStack.h
diffstat 5 files changed, 55 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/widgets/Pane.cpp	Thu Jan 26 18:01:38 2006 +0000
+++ b/widgets/Pane.cpp	Fri Jan 27 18:04:07 2006 +0000
@@ -227,12 +227,14 @@
     }
 
     if (m_clickedInRange && m_shiftPressed) {
-	//!!! be nice if this looked a bit more in keeping with the
-	//selection block
-	paint.setPen(Qt::blue);
-	paint.drawRect(m_clickPos.x(), m_clickPos.y(),
-		       m_mousePos.x() - m_clickPos.x(),
-		       m_mousePos.y() - m_clickPos.y());
+	if (m_manager && (m_manager->getToolMode() == ViewManager::NavigateMode)) {
+	    //!!! be nice if this looked a bit more in keeping with the
+	    //selection block
+	    paint.setPen(Qt::blue);
+	    paint.drawRect(m_clickPos.x(), m_clickPos.y(),
+			   m_mousePos.x() - m_clickPos.x(),
+			   m_mousePos.y() - m_clickPos.y());
+	}
     }
     
     paint.end();
@@ -578,6 +580,7 @@
 	Layer *layer = getSelectedLayer();
 	if (layer) {
 	    layer->drawDrag(e);
+	    update();
 	}
 
     } else if (mode == ViewManager::EditMode) {
@@ -585,6 +588,7 @@
 	Layer *layer = getSelectedLayer();
 	if (layer) {
 	    layer->editDrag(e);
+	    update();
 	}
     }
 }
@@ -680,7 +684,7 @@
 	break;
 	
     case ViewManager::EditMode:
-	setCursor(Qt::SizeAllCursor);
+	setCursor(Qt::UpArrowCursor);
 	break;
 	
     case ViewManager::DrawMode:
--- a/widgets/PaneStack.cpp	Thu Jan 26 18:01:38 2006 +0000
+++ b/widgets/PaneStack.cpp	Fri Jan 27 18:04:07 2006 +0000
@@ -157,6 +157,37 @@
     emit currentPaneChanged(m_currentPane);
 }
 
+void
+PaneStack::setCurrentLayer(Pane *pane, Layer *layer) // may be null
+{
+    setCurrentPane(pane);
+
+    if (m_currentPane) {
+
+	std::vector<Pane *>::iterator i = m_panes.begin();
+	std::vector<QWidget *>::iterator j = m_propertyStacks.begin();
+
+	while (i != m_panes.end()) {
+
+	    if (*i == pane) {
+		PropertyStack *stack = dynamic_cast<PropertyStack *>(*j);
+		if (stack) {
+		    if (stack->containsContainer(layer)) {
+			stack->setCurrentIndex(stack->getContainerIndex(layer));
+			emit currentLayerChanged(pane, layer);
+		    } else {
+			stack->setCurrentIndex(stack->getContainerIndex(pane));
+			emit currentLayerChanged(pane, 0);
+		    }
+		}
+		break;
+	    }
+	    ++i;
+	    ++j;
+	}
+    }
+}
+
 Pane *
 PaneStack::getCurrentPane() 
 {
--- a/widgets/PaneStack.h	Thu Jan 26 18:01:38 2006 +0000
+++ b/widgets/PaneStack.h	Fri Jan 27 18:04:07 2006 +0000
@@ -34,6 +34,7 @@
     int getPaneCount() const;
 
     void setCurrentPane(Pane *pane);
+    void setCurrentLayer(Pane *pane, Layer *layer);
     Pane *getCurrentPane();
 
 signals:
--- a/widgets/PropertyStack.cpp	Thu Jan 26 18:01:38 2006 +0000
+++ b/widgets/PropertyStack.cpp	Fri Jan 27 18:04:07 2006 +0000
@@ -95,6 +95,17 @@
     return false;
 }
 
+int
+PropertyStack::getContainerIndex(PropertyContainer *pc) const
+{
+    for (size_t i = 0; i < m_client->getPropertyContainerCount(); ++i) {
+	PropertyContainer *container = m_client->getPropertyContainer(i);
+	if (pc == container) return i;
+    }
+
+    return false;
+}
+
 void
 PropertyStack::propertyContainerAdded(PropertyContainer *)
 {
--- a/widgets/PropertyStack.h	Thu Jan 26 18:01:38 2006 +0000
+++ b/widgets/PropertyStack.h	Fri Jan 27 18:04:07 2006 +0000
@@ -27,6 +27,7 @@
     PropertyStack(QWidget *parent, View *client);
 
     bool containsContainer(PropertyContainer *container) const;
+    int getContainerIndex(PropertyContainer *container) const;
 
 signals:
     void propertyContainerSelected(PropertyContainer *container);