comparison 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
comparison
equal deleted inserted replaced
196:22c99c8aa1e0 197:6b023411087b
246 layout->insertStretch(-1, 10); 246 layout->insertStretch(-1, 10);
247 } 247 }
248 } 248 }
249 249
250 void 250 void
251 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name) 251 PropertyBox::updatePropertyEditor(PropertyContainer::PropertyName name,
252 bool rangeChanged)
252 { 253 {
253 PropertyContainer::PropertyType type = m_container->getPropertyType(name); 254 PropertyContainer::PropertyType type = m_container->getPropertyType(name);
254 int row = m_layout->rowCount(); 255 int row = m_layout->rowCount();
255 256
256 int min = 0, max = 0, value = 0; 257 int min = 0, max = 0, value = 0;
337 AudioDial *dial; 338 AudioDial *dial;
338 339
339 if (have) { 340 if (have) {
340 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]); 341 dial = dynamic_cast<AudioDial *>(m_propertyControllers[name]);
341 assert(dial); 342 assert(dial);
343 if (rangeChanged) {
344 dial->blockSignals(true);
345 dial->setMinimum(min);
346 dial->setMaximum(max);
347 dial->setRangeMapper(m_container->getNewPropertyRangeMapper(name));
348 dial->blockSignals(false);
349 }
350
342 } else { 351 } else {
343 #ifdef DEBUG_PROPERTY_BOX 352 #ifdef DEBUG_PROPERTY_BOX
344 std::cerr << "PropertyBox: creating new dial" << std::endl; 353 std::cerr << "PropertyBox: creating new dial" << std::endl;
345 #endif 354 #endif
346 dial = new AudioDial(); 355 dial = new AudioDial();
399 #endif 408 #endif
400 409
401 cb = new NotifyingComboBox(); 410 cb = new NotifyingComboBox();
402 cb->setObjectName(name); 411 cb->setObjectName(name);
403 cb->setDuplicatesEnabled(false); 412 cb->setDuplicatesEnabled(false);
404 413 }
414
415 if (!have || rangeChanged) {
416 cb->blockSignals(true);
417 cb->clear();
405 if (type == PropertyContainer::ValueProperty) { 418 if (type == PropertyContainer::ValueProperty) {
406 for (int i = min; i <= max; ++i) { 419 for (int i = min; i <= max; ++i) {
407 cb->addItem(m_container->getPropertyValueLabel(name, i)); 420 cb->addItem(m_container->getPropertyValueLabel(name, i));
408 } 421 }
409 cb->setEditable(false); 422 cb->setEditable(false);
412 for (int i = 0; i < units.size(); ++i) { 425 for (int i = 0; i < units.size(); ++i) {
413 cb->addItem(units[i]); 426 cb->addItem(units[i]);
414 } 427 }
415 cb->setEditable(true); 428 cb->setEditable(true);
416 } 429 }
417 430 cb->blockSignals(false);
431 }
432
433 if (!have) {
418 connect(cb, SIGNAL(activated(int)), 434 connect(cb, SIGNAL(activated(int)),
419 this, SLOT(propertyControllerChanged(int))); 435 this, SLOT(propertyControllerChanged(int)));
420 connect(cb, SIGNAL(mouseEntered()), 436 connect(cb, SIGNAL(mouseEntered()),
421 this, SLOT(mouseEnteredWidget())); 437 this, SLOT(mouseEnteredWidget()));
422 connect(cb, SIGNAL(mouseLeft()), 438 connect(cb, SIGNAL(mouseLeft()),
482 498
483 blockSignals(false); 499 blockSignals(false);
484 } 500 }
485 501
486 void 502 void
503 PropertyBox::propertyContainerPropertyRangeChanged(PropertyContainer *pc)
504 {
505 blockSignals(true);
506
507 PropertyContainer::PropertyList properties = m_container->getProperties();
508 for (size_t i = 0; i < properties.size(); ++i) {
509 updatePropertyEditor(properties[i], true);
510 }
511
512 blockSignals(false);
513 }
514
515 void
487 PropertyBox::unitDatabaseChanged() 516 PropertyBox::unitDatabaseChanged()
488 { 517 {
489 blockSignals(true); 518 blockSignals(true);
490 519
491 PropertyContainer::PropertyList properties = m_container->getProperties(); 520 PropertyContainer::PropertyList properties = m_container->getProperties();