Esempio n. 1
0
BlockModel::BlockModel (const String& format, const String& id)
    : NodeModel (Slugs::block)
{
    ValueTree v (node());
    v.setProperty (Slugs::id, id, nullptr);
    v.setProperty ("format", format, nullptr);
}
Esempio n. 2
0
void CtrlrMIDILibrary::addNewProgram (const String programName, const int number, ValueTree unitToAddTo)
{
	ValueTree program = createEmptyProgramTree();

	program.addChild (owner.getProgram(), -1, nullptr);

	program.setProperty (Ids::name, getDefaultProgramName(programName), nullptr);
	program.setProperty (Ids::description, String::empty, nullptr);
	program.setProperty (Ids::number, getCurrentProgramMIDINumber(number), nullptr);
	program.setProperty (Ids::uuid, Uuid().toString(), nullptr);

	if (unitToAddTo.isValid())
	{
		unitToAddTo.addChild (program, -1, 0);
	}
	else
	{
		if (isBank(getCurrentBank()))
		{
			getCurrentBank().addChild (program, -1, 0);
		}
		else
		{
			getRoot().addChild (program, -1, 0);
		}
	}

	listeners.call (&CtrlrMIDILibrary::Listener::programListChanged);
}
ValueTree RelativePointPath::CubicTo::createTree() const
{
    ValueTree v (DrawablePath::ValueTreeWrapper::Element::cubicToElement);
    v.setProperty (DrawablePath::ValueTreeWrapper::point1, controlPoints[0].toString(), nullptr);
    v.setProperty (DrawablePath::ValueTreeWrapper::point2, controlPoints[1].toString(), nullptr);
    v.setProperty (DrawablePath::ValueTreeWrapper::point3, controlPoints[2].toString(), nullptr);
    return v;
}
Esempio n. 4
0
    LayerItem KeyItem::addLayer (const LayerItem& layer)
    {
        int layerIndex = countLayers();
        ValueTree lnode = layer.node().createCopy();
        lnode.setProperty (Slugs::index, layerIndex, nullptr);
        lnode.setProperty (Slugs::note, getNote(), nullptr);
        LayerItem item (lnode);
        objectData.addChild (lnode, layerIndex, nullptr);

        return item;
    }
Esempio n. 5
0
    LayerItem KeyItem::addLayer (const File& file)
    {
        const int layerIndex  = countLayers();
        ValueTree layerNode (Tags::layer);

        layerNode.setProperty (Slugs::index, layerIndex, nullptr);
        layerNode.setProperty (Slugs::file, file.getFullPathName(), nullptr);
        layerNode.setProperty (Slugs::name, file.getFileNameWithoutExtension(), nullptr);
        layerNode.setProperty (Slugs::note, getNote(), nullptr);

        LayerItem layer (layerNode);
        objectData.addChild (layerNode, layerIndex, nullptr);

        return layer;
    }
Esempio n. 6
0
void MarkerList::ValueTreeWrapper::setMarker (const MarkerList::Marker& m, UndoManager* undoManager)
{
    ValueTree marker (state.getChildWithProperty (nameProperty, m.name));

    if (marker.isValid())
    {
        marker.setProperty (posProperty, m.position.toString(), undoManager);
    }
    else
    {
        marker = ValueTree (markerTag);
        marker.setProperty (nameProperty, m.name, nullptr);
        marker.setProperty (posProperty, m.position.toString(), nullptr);
        state.addChild (marker, -1, undoManager);
    }
}
Esempio n. 7
0
void EnabledModuleList::addModule (const File& moduleManifestFile, bool copyLocally)
{
    ModuleDescription info (moduleManifestFile);

    if (info.isValid())
    {
        const String moduleID (info.getID());

        if (! isModuleEnabled (moduleID))
        {
            ValueTree module (Ids::MODULES);
            module.setProperty (Ids::ID, moduleID, nullptr);

            state.addChild (module, -1, getUndoManager());
            sortAlphabetically();

            shouldShowAllModuleFilesInProject (moduleID) = true;
            shouldCopyModuleFilesLocally (moduleID) = copyLocally;

            RelativePath path (moduleManifestFile.getParentDirectory().getParentDirectory(),
                               project.getProjectFolder(), RelativePath::projectFolder);

            for (Project::ExporterIterator exporter (project); exporter.next();)
                exporter->getPathForModuleValue (moduleID) = path.toUnixStyle();
        }
    }
}
void UnityProjectBuilder::updateBuildDirectories()
{
    if (buildDir.isEmpty())
        return;
    
    ValueTree exportsTree (project.getChildWithName (Ids::exportFormats));
    
    if (! exportsTree.isValid())
        return;
    
    const int numExports = exportsTree.getNumChildren();
    
    for (int i = 0; i < numExports; ++i)
    {
        ValueTree exporter (exportsTree.getChild (i));
        
        if (exporter.hasProperty (Ids::targetFolderProp))
        {
            logOutput ("Updating exporter " + exporter.getType().toString());
            const String oldTarget (exporter.getProperty (Ids::targetFolderProp).toString());
            String newTarget (buildDir);
            
            if (oldTarget.containsChar ('/'))
                 newTarget << oldTarget.fromLastOccurrenceOf ("/", true, false);
                
            exporter.setProperty (Ids::targetFolderProp, newTarget, nullptr);
        }
    }
}
Esempio n. 9
0
void CtrlrMIDILibrary::valueTreePropertyChanged (ValueTree &treeWhosePropertyHasChanged, const Identifier &property)
{
	if (!treeWhosePropertyHasChanged.hasType(Ids::midiLibrary))
		return;

	if (property == Ids::midiLibraryBank)
	{
		setCurrentBank(Uuid(getProperty(property)));
	}
	else if (property == Ids::midiLibraryProgram)
	{
		setCurrentProgram (Uuid(getProperty(property)), InheritFromLibrary);
	}
	else if (property == Ids::midiLibrarySnapshot)
	{
		setCurrentSnapshot (Uuid(getProperty(property)), InheritFromLibrary);
	}
	else if ((property == Ids::lsb || property == Ids::msb) && treeWhosePropertyHasChanged.hasType (Ids::midiLibraryBank))
	{
		BigInteger bi;
		bi.setBitRangeAsInt (0, 7, (int)treeWhosePropertyHasChanged.getProperty(Ids::lsb));
		bi.setBitRangeAsInt (7, 7, (int)treeWhosePropertyHasChanged.getProperty(Ids::msb));
		treeWhosePropertyHasChanged.setProperty (Ids::value, (int)bi.getBitRangeAsInt (0, 14), nullptr);
	}
}
Esempio n. 10
0
void CtrlrMIDILibrary::snapshot()
{
    ValueTree snapshotTree = createEmptyProgramTree();

    snapshotTree.setProperty (Ids::time, Time::getCurrentTime().toMilliseconds(), nullptr);
    snapshotTree.setProperty (Ids::name, getDefaultSnapshotName(), nullptr);
    snapshotTree.setProperty (Ids::uuid, Uuid().toString(), nullptr);
	snapshotTree.addChild (owner.getProgram(), -1, nullptr);

	if (getSnapshots().isValid())
	{
		if (getSnapshots().isValid())
		{
			getSnapshots().addChild (snapshotTree, -1, nullptr);
		}
	}
}
Esempio n. 11
0
void BackendProcessor::getStateInformation(MemoryBlock &destData)
{
	MemoryOutputStream output(destData, false);

	ValueTree v = synthChain->exportAsValueTree();

	v.setProperty("ProjectRootFolder", GET_PROJECT_HANDLER(synthChain).getWorkDirectory().getFullPathName(), nullptr);

	if (auto root = dynamic_cast<BackendRootWindow*>(getActiveEditor()))
	{
		root->saveInterfaceData();
	}

	v.setProperty("InterfaceData", JSON::toString(editorInformation, true, DOUBLE_TO_STRING_DIGITS), nullptr);

	v.writeToStream(output);
}
Esempio n. 12
0
void CtrlrTabsComponent::addTab(const ValueTree tabToAdd)
{
	ValueTree tabTree = tabToAdd;

	const int tabId = ctrlrTabs->getNumTabs();

	if (!tabTree.hasProperty(Ids::uiTabsTabIndex))
		tabTree.setProperty (Ids::uiTabsTabIndex, tabId, 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabName))
		tabTree.setProperty (Ids::uiTabsTabName, "Tab "+String(tabId), 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabContentBackgroundColour))
		tabTree.setProperty (Ids::uiTabsTabContentBackgroundColour, Colours::yellow.toString(), 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabBackgroundColour))
		tabTree.setProperty (Ids::uiTabsTabBackgroundColour, Colours::lightgrey.toString(), 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabBackgroundImage))
		tabTree.setProperty (Ids::uiTabsTabBackgroundImage, COMBO_NONE_ITEM, 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabBackgroundImageLayout))
		tabTree.setProperty (Ids::uiTabsTabBackgroundImageLayout, 36, 0);

	if (!tabTree.hasProperty(Ids::uiTabsTabBackgroundImageAlpha))
		tabTree.setProperty (Ids::uiTabsTabBackgroundImageAlpha, 255, 0);

	ctrlrTabs->addTab (	tabTree.getProperty(Ids::uiTabsTabName).toString(),
						VAR2COLOUR(tabTree.getProperty(Ids::uiTabsTabBackgroundColour)),
						new CtrlrTabsContentComponent(tabTree, *this),
						true,
						tabTree.getProperty(Ids::uiTabsTabIndex));
}
void StoredSettings::AddRecentString(const Identifier& Type, const String& Str)
{
	ValueTree tree = GetProperty(Type);
	if(tree.getNumProperties() >= MAX_RECENT_STRINGS){		//If we have more strings in the history over the range, remove the oldest one from it.
		tree.removeProperty(tree.getPropertyName(0), nullptr);
	}

	tree.setProperty(Identifier(String(Str.hashCode64())), var(Str), nullptr);
}
Esempio n. 14
0
        void sendPingMessageToSlave()
        {
            ValueTree message ("MESSAGE");
            message.setProperty ("count", count++, nullptr);

            demo.logMessage ("Sending: " + valueTreeToString (message));

            sendMessageToSlave (valueTreeToMemoryBlock (message));
        }
Esempio n. 15
0
int ksp1_db_query (void* arg, int count, char** values,  char** fields)
{
    ValueTree* tree = (ValueTree*) arg;
    ValueTree row ("row");

    for (int i = 0; i < count; ++i) {
        row.setProperty (fields[i], values[i], nullptr);
    }
    tree->addChild (row, -1, nullptr);
    return SQLITE_OK;
}
void CtrlrPanelComponentProperties::copyProperties(ValueTree &sourceTree, ValueTree &destinationTree)
{
	for (int i=0; i<sourceTree.getNumProperties(); i++)
	{
		if (!destinationTree.hasProperty (sourceTree.getPropertyName(i)))
		{
			if (sourceTree.getPropertyName(i) != Ids::vstIndex)
				destinationTree.setProperty (sourceTree.getPropertyName(i), sourceTree.getPropertyAsValue(sourceTree.getPropertyName(i), 0), 0);
		}
	}
}
Esempio n. 17
0
void DrawableShape::RelativeFillType::writeTo (ValueTree& v, ComponentBuilder::ImageProvider* imageProvider, UndoManager* undoManager) const
{
    if (fill.isColour())
    {
        v.setProperty (FillAndStrokeState::type, "solid", undoManager);
        v.setProperty (FillAndStrokeState::colour, String::toHexString ((int) fill.colour.getARGB()), undoManager);
    }
    else if (fill.isGradient())
    {
        v.setProperty (FillAndStrokeState::type, "gradient", undoManager);
        v.setProperty (FillAndStrokeState::gradientPoint1, gradientPoint1.toString(), undoManager);
        v.setProperty (FillAndStrokeState::gradientPoint2, gradientPoint2.toString(), undoManager);
        v.setProperty (FillAndStrokeState::gradientPoint3, gradientPoint3.toString(), undoManager);

        const ColourGradient& cg = *fill.gradient;
        v.setProperty (FillAndStrokeState::radial, cg.isRadial, undoManager);

        String s;
        for (int i = 0; i < cg.getNumColours(); ++i)
            s << ' ' << cg.getColourPosition (i)
              << ' ' << String::toHexString ((int) cg.getColour(i).getARGB());

        v.setProperty (FillAndStrokeState::colours, s.trimStart(), undoManager);
    }
    else if (fill.isTiledImage())
    {
        v.setProperty (FillAndStrokeState::type, "image", undoManager);

        if (imageProvider != nullptr)
            v.setProperty (FillAndStrokeState::imageId, imageProvider->getIdentifierForImage (fill.image), undoManager);

        if (fill.getOpacity() < 1.0f)
            v.setProperty (FillAndStrokeState::imageOpacity, fill.getOpacity(), undoManager);
        else
            v.removeProperty (FillAndStrokeState::imageOpacity, undoManager);
    }
    else
    {
        jassertfalse;
    }
}
Esempio n. 18
0
ValueTree GainMatcherVoiceStartModulator::exportAsValueTree() const
{
	ValueTree v = VoiceStartModulator::exportAsValueTree();

	saveAttribute(UseTable, "UseTable");

	v.setProperty("ConnectedId", getConnectedCollectorId(), nullptr);

	if (useTable) saveTable(table, "TableData");

	return v;
}
Esempio n. 19
0
void SeaboardVisualiser::seaboardDidGetPitchBend(const juce::MidiMessage & message)
{
	int channel = message.getChannel();
	float pitchBend = (message.getPitchWheelValue() - 8192) / 8192.f; //Normalise the pitch bend value between -1 and 1.
	String childName = kChannelNo + String(channel);
	
	ValueTree noteTree = theSeaboardData.getChildWithName(childName);
	if (noteTree.isValid())
	{
		noteTree.setProperty(kPitchBend, pitchBend, 0);
	}
}
Esempio n. 20
0
void SeaboardVisualiser::seaboardDidGetAftertouch(const juce::MidiMessage & message)
{
	int channel = message.getChannel();
	float aftertouch = message.getAfterTouchValue() / 127.f; //Normalise the aftertouch value between 0 and 1.
	String childName = kChannelNo + String(channel);
	
	ValueTree noteTree = theSeaboardData.getChildWithName(childName);
	if (noteTree.isValid())
	{
		noteTree.setProperty(kAftertouch, aftertouch, 0);
	}
}
Esempio n. 21
0
//==============================================================================
void AnalysisModel::setBufferSize(ValueTree analyserTree,int bufferSize)
{
    if (bufferSize >= currentHostFrameSize)
    {
        analyserTree.setProperty(Ids::BufferSize, bufferSize, nullptr);
        
    }
    else
    {
        int currentBufferSize = analyserTree[Ids::BufferSize];
        
        if (currentBufferSize != currentHostFrameSize)
        {
            analyserTree.setProperty(Ids::BufferSize, currentHostFrameSize, nullptr);
        }
        else
        {
            analyserTree.sendPropertyChangeMessage(Ids::BufferSize);
        }
    }
}
void StoredSettings::RestoreProperty(const Identifier& CategoryName, const Identifier& PropertyName, Value& Val)
{
	ValueTree tree = (CategoryName == Identifiers::Category1) ? tree_root : tree_root.getOrCreateChildWithName(CategoryName, nullptr);
	if(!tree.hasProperty(PropertyName)){
		//If there isn't one then set a new one.
		//プロパティーが存在しなければ、設定する
		tree.setProperty(PropertyName, Val, nullptr);
	}else{
		//If the property already exists then just return it.
		//存在していれば、そのプロパティーを参照する
		Val.referTo(tree.getPropertyAsValue(PropertyName, nullptr));
	}
}
ValueTree AudioProcessorValueTreeState::getOrCreateChildValueTree (const String& paramID)
{
    ValueTree v (state.getChildWithProperty (idPropertyID, paramID));

    if (! v.isValid())
    {
        v = ValueTree (valueType);
        v.setProperty (idPropertyID, paramID, undoManager);
        state.addChild (v, -1, undoManager);
    }

    return v;
}
Esempio n. 24
0
ValueTree ValueTree::fromXml (const XmlElement& xml)
{
    ValueTree v (xml.getTagName());

    const int numAtts = xml.getNumAttributes(); // xxx inefficient - should write an att iterator..

    for (int i = 0; i < numAtts; ++i)
        v.setProperty (xml.getAttributeName (i), var (xml.getAttributeValue (i)), 0);

    forEachXmlChildElement (xml, e)
    {
        v.addChild (fromXml (*e), -1, 0);
    }
void UnityProjectBuilder::parseFile (ValueTree file, const File& sourceDir)
{
    const String path (file.getProperty (Ids::fileProp).toString());
    const File sourceFile (projectFile.getSiblingFile (path));
    const bool compile = bool (file.getProperty (Ids::compileProp));
    
    if (compile && isValidSourceFile (sourceFile))
    {
        file.setProperty (Ids::compileProp, false, nullptr);
        filesToAdd.add (sourceFile.getRelativePathFrom (sourceDir));
        logOutput ("Adding file \"" + path + "\"...");
    }
}
Esempio n. 26
0
Value AppearanceSettings::getColourValue (const String& colourName)
{
    ValueTree c (settings.getChildWithProperty (Ids::name, colourName));

    if (! c.isValid())
    {
        c = ValueTree ("COLOUR");
        c.setProperty (Ids::name, colourName, nullptr);
        settings.addChild (c, -1, nullptr);
    }

    return c.getPropertyAsValue (Ids::colour, nullptr);
}
Esempio n. 27
0
//------------------------------------------------------------------------------
// values: link-type, parameters, identifier, startVertex, endVertex
ValueTree MDLParser::getLinkTree(const String& line, RegularExpression& re)
{
    StringArray values;
    re.fullMatchValues(line, values, 5);

    ValueTree linkTree = ObjectFactory::getLinkTreeFromStringId(values[0]);

    if (!linkTree.isValid())
    {
        throw std::runtime_error("Could not parse link-like object");
    }

    StringArray paramsArray = MDLHelper::getParamsFromString(values[1]);

    linkTree.addChild(ObjectFactory::createParamsTree(paramsArray),
                      -1, nullptr);

    linkTree.setProperty(Ids::identifier, values[2].trim(), nullptr);
    linkTree.setProperty(Ids::startVertex, values[3].trim(), nullptr);
    linkTree.setProperty(Ids::endVertex, values[4].trim(), nullptr);

    return linkTree;
}
ValueTree ScannerManagerComponent::getForDocument()
{
    ValueTree data ("SCANNERS");
    
    for (unsigned i = 0; i < cues.size(); i++)
    {
        ValueTree cue ("CUE");
        cue.setProperty ("x", cues[i]->getPosition(), nullptr);
        
        data.addChild (cue, i, nullptr);
    }
    
    return data;
}
Esempio n. 29
0
void CtrlrLuaMethodEditor::renameGroup(ValueTree parentGroup)
{
	AlertWindow w ("Rename group", "", AlertWindow::QuestionIcon, this);
	w.addTextEditor("name", parentGroup.getProperty (Ids::name).toString());
	w.addButton ("OK", 1, KeyPress(KeyPress::returnKey));
	w.addButton ("Cancel", 0, KeyPress(KeyPress::escapeKey));

	if (w.runModalLoop())
	{
		parentGroup.setProperty (Ids::name, w.getTextEditorContents("name"), nullptr);
		updateRootItem();
	}

	saveSettings(); // save settings
}
Esempio n. 30
0
void Project::addModule (const String& moduleID, bool shouldCopyFilesLocally)
{
    if (! isModuleEnabled (moduleID))
    {
        ValueTree module (Tags::module);
        module.setProperty (Ids::ID, moduleID, nullptr);

        ValueTree modules (getModulesNode());
        modules.addChild (module, -1, getUndoManagerFor (modules));

        shouldShowAllModuleFilesInProject (moduleID) = true;
    }

    if (shouldCopyFilesLocally)
        shouldCopyModuleFilesLocally (moduleID) = true;
}