diff base/PropertyContainer.cpp @ 387:7aa1de571880

* juggle some files around in order to free audioio, base, and system libraries from dependency on QtGui
author Chris Cannam
date Wed, 12 Mar 2008 17:42:56 +0000
parents 516819f2b97b
children 57857a57a03a
line wrap: on
line diff
--- a/base/PropertyContainer.cpp	Sat Mar 01 16:17:44 2008 +0000
+++ b/base/PropertyContainer.cpp	Wed Mar 12 17:42:56 2008 +0000
@@ -14,12 +14,8 @@
 */
 
 #include "PropertyContainer.h"
-#include "CommandHistory.h"
 #include "RangeMapper.h"
 #include "UnitDatabase.h"
-#include "ColourDatabase.h"
-
-#include <QColor>
 
 #include <iostream>
 
@@ -60,13 +56,6 @@
 QString
 PropertyContainer::getPropertyValueLabel(const PropertyName &name, int value) const
 {
-    if (getPropertyType(name) == ColourProperty) {
-        ColourDatabase *db = ColourDatabase::getInstance();
-        if (value >= 0 && size_t(value) < db->getColourCount()) {
-            return db->getColourName(value);
-        }
-    }
-
     return QString();
 }
 
@@ -82,14 +71,12 @@
     std::cerr << "WARNING: PropertyContainer[" << getPropertyContainerName().toStdString() << "]::setProperty(" << name.toStdString() << "): no implementation in subclass!" << std::endl;
 }
 
-void
-PropertyContainer::setPropertyWithCommand(const PropertyName &name, int value)
+Command *
+PropertyContainer::getSetPropertyCommand(const PropertyName &name, int value)
 {
     int currentValue = getPropertyRangeAndValue(name, 0, 0, 0);
-    if (value == currentValue) return;
-
-    CommandHistory::getInstance()->addCommand
-	(new SetPropertyCommand(this, name, value), true, true); // bundled
+    if (value == currentValue) return 0;
+    return new SetPropertyCommand(this, name, value);
 }
  
 void
@@ -107,19 +94,19 @@
     setProperty(name, value);
 }
  
-void
-PropertyContainer::setPropertyWithCommand(QString nameString, QString valueString)
+Command *
+PropertyContainer::getSetPropertyCommand(QString nameString, QString valueString)
 {
     PropertyName name;
     int value;
     if (!convertPropertyStrings(nameString, valueString, name, value)) {
-        std::cerr << "WARNING: PropertyContainer::setPropertyWithCommand(\""
+        std::cerr << "WARNING: PropertyContainer::getSetPropertyCommand(\""
                   << nameString.toStdString() << "\", \""
                   << valueString.toStdString()
                   << "\"): Name and value conversion failed" << std::endl;
-        return;
+        return 0;
     }
-    setPropertyWithCommand(name, value);
+    return getSetPropertyCommand(name, value);
 }
 
 bool
@@ -184,6 +171,7 @@
         break;
 
     case ValueProperty:
+    case ColourProperty:
     {
         int min, max;
         getPropertyRangeAndValue(name, &min, &max, 0);
@@ -196,12 +184,6 @@
         }
         break;
     }
-
-    case ColourProperty:
-        value = ColourDatabase::getInstance()->getColourIndex(valueString);
-        if (value >= 0) success = true;
-        else value = 0;
-        break;
         
     case UnitsProperty:
         value = UnitDatabase::getInstance()->getUnitId(valueString, false);