diff widgets/Pane.cpp @ 44:ad214997dddb

* Refactor Layer classes so as no longer to store a single View pointer; instead they need to be able to draw themselves on any View on demand. Layers with caches (e.g. spectrogram) will need to be further refactored so as to maintain a per-View cache * Begin refactoring MainWindow by pulling out the document stuff (set of layers, models etc) into a Document class. Not yet in use. This revision is fairly unstable.
author Chris Cannam
date Thu, 02 Mar 2006 16:58:49 +0000
parents 78515b1e29eb
children 97b0643bd799
line wrap: on
line diff
--- a/widgets/Pane.cpp	Wed Mar 01 18:13:01 2006 +0000
+++ b/widgets/Pane.cpp	Thu Mar 02 16:58:49 2006 +0000
@@ -39,7 +39,7 @@
 }
 
 bool
-Pane::shouldIlluminateLocalFeatures(const Layer *layer, QPoint &pos)
+Pane::shouldIlluminateLocalFeatures(const Layer *layer, QPoint &pos) const
 {
     QPoint discard;
     bool b0, b1;
@@ -57,7 +57,7 @@
 bool
 Pane::shouldIlluminateLocalSelection(QPoint &pos,
 				     bool &closeToLeft,
-				     bool &closeToRight)
+				     bool &closeToRight) const
 {
     if (m_identifyFeatures &&
 	m_manager &&
@@ -141,7 +141,7 @@
 	    waveformModel = (*vi)->getModel();
 	}
 
-	int sw = (*vi)->getVerticalScaleWidth(paint);
+	int sw = (*vi)->getVerticalScaleWidth(this, paint);
 
 	if (sw > 0 && r.left() < sw) {
 
@@ -155,7 +155,7 @@
 	    paint.drawRect(0, 0, sw, height());
 
 	    paint.setBrush(Qt::NoBrush);
-	    (*vi)->paintVerticalScale(paint, QRect(0, 0, sw, height()));
+	    (*vi)->paintVerticalScale(this, paint, QRect(0, 0, sw, height()));
 
 	    paint.restore();
 	}
@@ -163,7 +163,7 @@
 	if (m_identifyFeatures) {
 
 	    QPoint pos = m_identifyPoint;
-	    QString desc = (*vi)->getFeatureDescription(pos);
+	    QString desc = (*vi)->getFeatureDescription(this, pos);
 	    
 	    if (desc != "") {
 
@@ -364,7 +364,7 @@
 }
 
 Selection
-Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge)
+Pane::getSelectionAt(int x, bool &closeToLeftEdge, bool &closeToRightEdge) const
 {
     closeToLeftEdge = closeToRightEdge = false;
 
@@ -446,7 +446,8 @@
 	
 	    Layer *layer = getSelectedLayer();
 	    if (layer) {
-		layer->snapToFeatureFrame(snapFrame, resolution, Layer::SnapLeft);
+		layer->snapToFeatureFrame(this, snapFrame,
+					  resolution, Layer::SnapLeft);
 	    }
 	    
 	    if (snapFrame < 0) snapFrame = 0;
@@ -466,7 +467,7 @@
 
 	Layer *layer = getSelectedLayer();
 	if (layer && layer->isLayerEditable()) {
-	    layer->drawStart(e);
+	    layer->drawStart(this, e);
 	}
 
     } else if (mode == ViewManager::EditMode) {
@@ -474,7 +475,7 @@
 	if (!editSelectionStart(e)) {
 	    Layer *layer = getSelectedLayer();
 	    if (layer && layer->isLayerEditable()) {
-		layer->editStart(e);
+		layer->editStart(this, e);
 	    }
 	}
     }
@@ -557,7 +558,7 @@
 
 	Layer *layer = getSelectedLayer();
 	if (layer && layer->isLayerEditable()) {
-	    layer->drawEnd(e);
+	    layer->drawEnd(this, e);
 	    update();
 	}
 
@@ -566,7 +567,7 @@
 	if (!editSelectionEnd(e)) {
 	    Layer *layer = getSelectedLayer();
 	    if (layer && layer->isLayerEditable()) {
-		layer->editEnd(e);
+		layer->editEnd(this, e);
 		update();
 	    }
 	}
@@ -652,8 +653,10 @@
 	
 	Layer *layer = getSelectedLayer();
 	if (layer) {
-	    layer->snapToFeatureFrame(snapFrameLeft, resolution, Layer::SnapLeft);
-	    layer->snapToFeatureFrame(snapFrameRight, resolution, Layer::SnapRight);
+	    layer->snapToFeatureFrame(this, snapFrameLeft,
+				      resolution, Layer::SnapLeft);
+	    layer->snapToFeatureFrame(this, snapFrameRight,
+				      resolution, Layer::SnapRight);
 	}
 	
 //	std::cerr << "snap: frame = " << mouseFrame << ", start frame = " << m_selectionStartFrame << ", left = " << snapFrameLeft << ", right = " << snapFrameRight << std::endl;
@@ -706,7 +709,7 @@
 
 	Layer *layer = getSelectedLayer();
 	if (layer && layer->isLayerEditable()) {
-	    layer->drawDrag(e);
+	    layer->drawDrag(this, e);
 	}
 
     } else if (mode == ViewManager::EditMode) {
@@ -714,7 +717,7 @@
 	if (!editSelectionDrag(e)) {
 	    Layer *layer = getSelectedLayer();
 	    if (layer && layer->isLayerEditable()) {
-		layer->editDrag(e);
+		layer->editDrag(this, e);
 	    }
 	}
     }
@@ -737,7 +740,7 @@
 
 	Layer *layer = getSelectedLayer();
 	if (layer && layer->isLayerEditable()) {
-	    layer->editOpen(e);
+	    layer->editOpen(this, e);
 	}
     }
 }