diff widgets/PropertyBox.cpp @ 197:6b023411087b

* Work on harmonising colour and scale ranges between types of layer * Add normalize options to colour 3d plot layer
author Chris Cannam
date Thu, 01 Feb 2007 14:31:28 +0000
parents 57c2350a8c40
children 6969f21da18a
line wrap: on
line diff
--- a/widgets/PropertyBox.cpp	Wed Jan 31 12:13:47 2007 +0000
+++ b/widgets/PropertyBox.cpp	Thu Feb 01 14:31:28 2007 +0000
@@ -248,7 +248,8 @@
 }
 
 void
-PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name)
+PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name,
+                                  bool rangeChanged)
 {
     PropertyContainer::PropertyType type = m_container->getPropertyType(name);
     int row = m_layout->rowCount();
@@ -339,6 +340,14 @@
 	if (have) {
 	    dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
 	    assert(dial);
+            if (rangeChanged) {
+                dial->blockSignals(true);
+                dial->setMinimum(min);
+                dial->setMaximum(max);
+                dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
+                dial->blockSignals(false);
+            }
+                
 	} else {
 #ifdef DEBUG_PROPERTY_BOX 
 	    std::cerr << "PropertyBox: creating new dial" << std::endl;
@@ -401,7 +410,11 @@
 	    cb = new NotifyingComboBox();
 	    cb->setObjectName(name);
             cb->setDuplicatesEnabled(false);
+        }
 
+        if (!have || rangeChanged) {
+            cb->blockSignals(true);
+            cb->clear();
             if (type == PropertyContainer::ValueProperty) {
                 for (int i = min; i <= max; ++i) {
                     cb->addItem(m_container->getPropertyValueLabel(name, i));
@@ -414,7 +427,10 @@
                 }
                 cb->setEditable(true);
             }
+            cb->blockSignals(false);
+        }
 
+        if (!have) {
 	    connect(cb, SIGNAL(activated(int)),
 		    this, SLOT(propertyControllerChanged(int)));
             connect(cb, SIGNAL(mouseEntered()),
@@ -484,6 +500,19 @@
 }
 
 void
+PropertyBox::propertyContainerPropertyRangeChanged(PropertyContainer *pc)
+{
+    blockSignals(true);
+
+    PropertyContainer::PropertyList properties = m_container->getProperties();
+    for (size_t i = 0; i < properties.size(); ++i) {
+	updatePropertyEditor(properties[i], true);
+    }
+
+    blockSignals(false);
+}    
+
+void
 PropertyBox::unitDatabaseChanged()
 {
     blockSignals(true);