/** * Load the state of the color map widget from a project file. * @param lines :: string representing the current state of the color map * widget. */ void ColorMapWidget::loadFromProject(const std::string &lines) { API::TSVSerialiser tsv(lines); int scaleType; double min, max, power; tsv.selectLine("ScaleType"); tsv >> scaleType; tsv.selectLine("Power"); tsv >> power; tsv.selectLine("MinValue"); tsv >> min; tsv.selectLine("MaxValue"); tsv >> max; setScaleType(scaleType); setNthPower(power); setMinValue(min); setMaxValue(max); }
void AutomatableModel::loadSettings( const QDomElement& element, const QString& name ) { // read scale type and overwrite default scale type if( element.hasAttribute("scale_type") ) // wrong in most cases { if( element.attribute("scale_type") == "log" ) setScaleType( Logarithmic ); } else { setScaleType( Linear ); } // compat code QDomNode node = element.namedItem( AutomationPattern::classNodeName() ); if( node.isElement() ) { node = node.namedItem( name ); if( node.isElement() ) { AutomationPattern * p = AutomationPattern::globalAutomationPattern( this ); p->loadSettings( node.toElement() ); setValue( p->valueAt( 0 ) ); // in older projects we sometimes have odd automations // with just one value in - eliminate if necessary if( !p->hasAutomation() ) { delete p; } return; } // logscales were not existing at this point of time // so they can be ignored } QDomNode connectionNode = element.namedItem( "connection" ); // reads controller connection if( connectionNode.isElement() ) { QDomNode thisConnection = connectionNode.toElement().namedItem( name ); if( thisConnection.isElement() ) { setControllerConnection( new ControllerConnection( (Controller*)NULL ) ); m_controllerConnection->loadSettings( thisConnection.toElement() ); //m_controllerConnection->setTargetName( displayName() ); } } // models can be stored as elements (port00) or attributes (port10): // <ladspacontrols port10="4.41"> // <port00 value="4.41" id="4249278"/> // </ladspacontrols> // element => there is automation data node = element.namedItem( name ); if( node.isElement() ) { changeID( node.toElement().attribute( "id" ).toInt() ); setValue( node.toElement().attribute( "value" ).toFloat() ); } else if( element.hasAttribute( name ) ) // attribute => read the element's value from the attribute list { setInitValue( element.attribute( name ).toFloat() ); } else { reset(); } }
void InstrumentWidgetRenderTab::scaleTypeChanged(int type) { setScaleType((GraphOptions::ScaleType)type); }