void StoredSettings::Apply(void) { if(tree_root.getNumProperties() == 0){ //We'll set various settings at the first start-up. //初回起動時にプロパティーを設定する tree_root.setProperty(Identifiers::RecentFiles, var(list.toString()), nullptr); tree_root.setProperty(Identifiers::Languages, var("en"), nullptr); tree_root.addChild(ValueTree(Identifiers::RecentSearches), -1, nullptr); tree_root.addChild(ValueTree(Identifiers::RecentReplaces), -1, nullptr); } list.restoreFromString(tree_root.getProperty(Identifiers::RecentFiles)); list.removeNonExistentFiles(); const String LANG_NAME = tree_root.getProperty(Identifiers::Languages); if(LANG_NAME != String("en")){ File lang_file = File::getSpecialLocation(File::currentApplicationFile).getParentDirectory().getChildFile(String("languages/") + LANG_NAME + String(".txt")); LocalisedStrings::setCurrentMappings(new LocalisedStrings(lang_file)); if(LANG_NAME == String("ja")){ // UI表示フォントを日本語表示可能なものに変更する LookAndFeel::getDefaultLookAndFeel().setDefaultSansSerifTypefaceName(L"メイリオ"); } } Desktop::getInstance().getComponent(0)->repaint(); }
ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index) { ProjectExporter* exp = nullptr; switch (index) { case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (false)), false); break; case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (true)), true); break; case 2: exp = new MSVCProjectExporterVC2005 (project, ValueTree (MSVCProjectExporterVC2005::getValueTreeTypeName())); break; case 3: exp = new MSVCProjectExporterVC2008 (project, ValueTree (MSVCProjectExporterVC2008::getValueTreeTypeName())); break; case 4: exp = new MSVCProjectExporterVC2010 (project, ValueTree (MSVCProjectExporterVC2010::getValueTreeTypeName())); break; case 5: exp = new MSVCProjectExporterVC2012 (project, ValueTree (MSVCProjectExporterVC2012::getValueTreeTypeName())); break; case 6: exp = new MSVCProjectExporterVC2013 (project, ValueTree (MSVCProjectExporterVC2013::getValueTreeTypeName())); break; case 7: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break; case 8: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break; case 9: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter::getValueTreeTypeName())); break; default: jassertfalse; return 0; } File juceFolder (ModuleList::getLocalModulesFolder (&project)); File target (exp->getTargetFolder()); if (FileHelpers::shouldPathsBeRelative (juceFolder.getFullPathName(), project.getFile().getFullPathName())) exp->getJuceFolderValue() = FileHelpers::getRelativePathFrom (juceFolder, project.getFile().getParentDirectory()); else exp->getJuceFolderValue() = juceFolder.getFullPathName(); exp->createDefaultConfigs(); return exp; }
ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index) { ProjectExporter* exp = nullptr; switch (index) { case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (false)), false); break; case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter ::getValueTreeTypeName (true)), true); break; case 2: exp = new MSVCProjectExporterVC2005 (project, ValueTree (MSVCProjectExporterVC2005::getValueTreeTypeName())); break; case 3: exp = new MSVCProjectExporterVC2008 (project, ValueTree (MSVCProjectExporterVC2008::getValueTreeTypeName())); break; case 4: exp = new MSVCProjectExporterVC2010 (project, ValueTree (MSVCProjectExporterVC2010::getValueTreeTypeName())); break; case 5: exp = new MSVCProjectExporterVC2012 (project, ValueTree (MSVCProjectExporterVC2012::getValueTreeTypeName())); break; case 6: exp = new MSVCProjectExporterVC2013 (project, ValueTree (MSVCProjectExporterVC2013::getValueTreeTypeName())); break; case 7: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter ::getValueTreeTypeName())); break; case 8: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter ::getValueTreeTypeName())); break; case 9: exp = new CodeBlocksProjectExporter (project, ValueTree (CodeBlocksProjectExporter::getValueTreeTypeName())); break; default: jassertfalse; return 0; } exp->createDefaultConfigs(); exp->createDefaultModulePaths(); return exp; }
ValueTree getOrCreateChildWithName (const Identifier& typeToMatch, UndoManager* undoManager) { for (auto* s : children) if (s->type == typeToMatch) return ValueTree (*s); auto newObject = new SharedObject (typeToMatch); addChild (newObject, -1, undoManager); return ValueTree (*newObject); }
ValueTree getChildWithName (const Identifier& typeToMatch) const { for (int i = 0; i < children.size(); ++i) { SharedObject* const s = children.getObjectPointerUnchecked (i); if (s->type == typeToMatch) return ValueTree (s); } return ValueTree(); }
ValueTree ValueTree::SharedObject::getOrCreateChildWithName (const Identifier& typeToMatch, UndoManager* undoManager) { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) return ValueTree (static_cast <SharedObject*> (children.getUnchecked(i))); SharedObject* const newObject = new SharedObject (typeToMatch); addChild (newObject, -1, undoManager); return ValueTree (newObject); }
ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const { for (int i = 0; i < children.size(); ++i) { SharedObject* const s = children.getObjectPointerUnchecked (i); if (s->properties[propertyName] == propertyValue) return ValueTree (s); } return ValueTree(); }
ProjectExporter* ProjectExporter::createNewExporter (Project& project, const int index) { ProjectExporter* exp = nullptr; switch (index) { case 0: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter::getValueTreeTypeName (false)), false); break; case 1: exp = new XCodeProjectExporter (project, ValueTree (XCodeProjectExporter::getValueTreeTypeName (true)), true); break; case 2: exp = new MSVCProjectExporterVC6 (project, ValueTree (MSVCProjectExporterVC6::getValueTreeTypeName())); break; case 3: exp = new MSVCProjectExporterVC2005 (project, ValueTree (MSVCProjectExporterVC2005::getValueTreeTypeName())); break; case 4: exp = new MSVCProjectExporterVC2008 (project, ValueTree (MSVCProjectExporterVC2008::getValueTreeTypeName())); break; case 5: exp = new MSVCProjectExporterVC2010 (project, ValueTree (MSVCProjectExporterVC2010::getValueTreeTypeName())); break; case 6: exp = new MakefileProjectExporter (project, ValueTree (MakefileProjectExporter::getValueTreeTypeName())); break; case 7: exp = new AndroidProjectExporter (project, ValueTree (AndroidProjectExporter::getValueTreeTypeName())); break; default: jassertfalse; return 0; } File juceFolder (StoredSettings::getInstance()->getLastKnownJuceFolder()); File target (exp->getTargetFolder()); if (FileHelpers::shouldPathsBeRelative (juceFolder.getFullPathName(), project.getFile().getFullPathName())) exp->getJuceFolder() = juceFolder.getRelativePathFrom (project.getFile().getParentDirectory()); else exp->getJuceFolder() = juceFolder.getFullPathName(); exp->createLibraryModules(); return exp; }
ValueTree getOrCreateChildWithName (const Identifier& typeToMatch, UndoManager* undoManager) { for (int i = 0; i < children.size(); ++i) { SharedObject* const s = children.getObjectPointerUnchecked (i); if (s->type == typeToMatch) return ValueTree (s); } SharedObject* const newObject = new SharedObject (typeToMatch); addChild (newObject, -1, undoManager); return ValueTree (newObject); }
void BenderClientOptions::setDefaultOptions() { benderPropertiesTree = ValueTree("bender-properties"); benderPropertiesTree.setProperty ("destinationAddress", "localhost", nullptr); benderPropertiesTree.setProperty ("destinationPort", "9666", nullptr); benderPropertiesTree.setProperty ("localDataPort", "9667", nullptr); }
void RemoteChannels::buttonClicked(Button* a_button) { if (a_button == this->expandButton) toggleExpandChannels() ; else if (a_button == this->ignoreButton) this->subscriptions.addChild(ValueTree(this->configStore.getType()) , -1 , nullptr) ; }
//============================================================================== void ITunesLibrary::setLibraryTree (ValueTree& newTreeToUse) { if (! newTreeToUse.isValid()) newTreeToUse = ValueTree (MusicColumns::libraryIdentifier); libraryTree = newTreeToUse; }
void OnlineUnlockStatus::load() { MemoryBlock mb; mb.fromBase64Encoding (getState()); if (mb.getSize() > 0) status = ValueTree::readFromGZIPData (mb.getData(), mb.getSize()); else status = ValueTree (stateTagName); StringArray localMachineNums (getLocalMachineIDs()); if (machineNumberAllowed (StringArray ("1234"), localMachineNums)) status.removeProperty (unlockedProp, nullptr); KeyFileUtils::KeyFileData data; data = KeyFileUtils::getDataFromKeyFile (KeyFileUtils::getXmlFromKeyFile (status[keyfileDataProp], getPublicKey())); if (data.keyFileExpires) { if (! doesProductIDMatch (data.appID)) status.removeProperty (expiryTimeProp, nullptr); if (! machineNumberAllowed (data.machineNumbers, localMachineNums)) status.removeProperty (expiryTimeProp, nullptr); } else { if (! doesProductIDMatch (data.appID)) status.removeProperty (unlockedProp, nullptr); if (! machineNumberAllowed (data.machineNumbers, localMachineNums)) status.removeProperty (unlockedProp, nullptr); } }
Project::Item Project::createNewGroup() { Item item (*this, ValueTree (Tags::group)); item.initialiseNodeValues(); item.getName() = "New Group"; return item; }
//============================================================================== ZenAutoTrimAudioProcessor::ZenAutoTrimAudioProcessor() { // #TODO: bitwig parameter text showing normalized instead of in db undoManager = new UndoManager(); params = new ZenAudioProcessorValueTreeState(*this, undoManager); gainParam = params->createAndAddDecibelParameter(gainParamID, "Gain", -96.0f, 18.0f, 0.0f); targetGainParam = params->createAndAddDecibelParameter(targetGainParamID, "TargetGain", -96.0f, 18.0f, -18.0f); autoGainEnableParam = params->createAndAddBoolParameter(autoGainEnableParamID, "AutoGain", false); bypassParam = params->createAndAddBoolParameter(bypassParamID, "Bypass", false); targetTypeParam = params->createAndAddIntParameter(targetTypeParamID, "Target Type", 0, CalibrationTarget::targetCount, CalibrationTarget::Peak); rmsWindowTimeParam = params->createAndAddIntParameter(rmsWindowTimeParamID, "RMS Window Time", 10, 5000, CalibrationTimeInMS::time300ms); params->state = ValueTree("ZenAutoTrim"); #ifdef JUCE_DEBUG //// #TODO: Change this to use Juce SharedResourcePointer - https://forum.juce.com/t/juce-singleton-implementation-confusion/17847/6 //debugWindow = ZenDebugEditor::getInstance(); //debugWindow->setSize(650, 400); ////Open in bottom right corner //debugWindow->setTopLeftPosition(1900 - debugWindow->getWidth(), 1040 - debugWindow->getHeight()); //// #TODO: add JUCE REF COUNTED OBJECT to zen GUI #ifdef JUCE_MSVC //Visual Studio mem leak diagnostics settings _CrtSetDbgFlag(0); //Turn off VS memory dump output //_crtBreakAlloc = 5389; //Break on this memory allocation number (When Debug) #endif #endif }
ValueTree getChildWithName (const Identifier& typeToMatch) const { for (auto* s : children) if (s->type == typeToMatch) return ValueTree (s); return {}; }
Project::Item Project::Item::createGroup (Project& project, const String& name, const String& uid) { Item group (project, ValueTree (Tags::group)); group.setID (uid); group.initialiseMissingProperties(); group.getNameValue() = name; return group; }
ValueTree getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const { for (auto* s : children) if (s->properties[propertyName] == propertyValue) return ValueTree (s); return {}; }
Project::Item Project::Item::createGroup (Project& project, const String& name, const String& uid, bool isModuleCode) { Item group (project, ValueTree (Ids::GROUP), isModuleCode); group.setID (uid); group.initialiseMissingProperties(); group.getNameValue() = name; return group; }
ValueTree ValueTree::SharedObject::getChildWithName (const Identifier& typeToMatch) const { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->type == typeToMatch) return ValueTree (static_cast <SharedObject*> (children.getUnchecked(i))); return ValueTree::invalid; }
ValueTree ValueTree::SharedObject::getChildWithProperty (const Identifier& propertyName, const var& propertyValue) const { for (int i = 0; i < children.size(); ++i) if (children.getUnchecked(i)->getProperty (propertyName) == propertyValue) return ValueTree (static_cast <SharedObject*> (children.getUnchecked(i))); return ValueTree::invalid; }
void CtrlrPanelLayerList::addLayer() { if (owner.getEditor()) { owner.getEditor()->getCanvas()->addLayer(ValueTree()); } layerList->updateContent(); }
ValueTree ValueTree::getSibling (const int delta) const { if (object == 0 || object->parent == 0) return invalid; const int index = object->parent->indexOf (*this) + delta; return ValueTree (static_cast <SharedObject*> (object->parent->children [index])); }
//============================================================================== void BeatboxVoxAudioProcessor::setupParameters() { processorState.createAndAddParameter(paramOSDNoiseRatio, "OSD Noise Ratio", String(), NormalisableRange<float>(0.01f, 1.0f, 0.01f), 0.5f, nullptr, nullptr); processorState.addParameterListener(paramOSDNoiseRatio, this); processorState.createAndAddParameter(paramOSDMeanCoeff, "OSD Mean Coefficient", String(), NormalisableRange<float>(0.01f, 2.0f, 0.01f), 0.8f, nullptr, nullptr); processorState.addParameterListener(paramOSDMeanCoeff, this); processorState.createAndAddParameter(paramOSDMedianCoeff, "OSD Median Coefficient", String(), NormalisableRange<float>(0.01f, 2.0f, 0.01f), 0.8f, nullptr, nullptr); processorState.addParameterListener(paramOSDMedianCoeff, this); processorState.createAndAddParameter(paramOSDMsBetweenOnsets, "OSD Ms Between Onsets", String("ms"), NormalisableRange<float>(0.0f, 200.0f, 5.0f), 70.0f, nullptr, nullptr); processorState.addParameterListener(paramOSDMsBetweenOnsets, this); processorState.state = ValueTree(Identifier("BeatboxVox")); auto onsetDetectMeanCallback = [this] (float newMeanCoeff) { this->classifier.setOSDMeanCoeff(newMeanCoeff); }; auto onsetDetectMedianCallback = [this] (float newMedianCoeff) { this->classifier.setOSDMedianCoeff(newMedianCoeff); }; auto onsetDetectNoiseCallback = [this] (float newNoiseRatio) { this->classifier.setOSDNoiseRatio(newNoiseRatio); }; auto onsetDetectMsBetweenCallback = [this] (float newMsBetweenOnsets) { this->classifier.setOSDMsBetweenOnsets(static_cast<int>(newMsBetweenOnsets)); }; paramCallbacks.insert(std::make_pair(paramOSDMeanCoeff, onsetDetectMeanCallback)); paramCallbacks.insert(std::make_pair(paramOSDMedianCoeff, onsetDetectMedianCallback)); paramCallbacks.insert(std::make_pair(paramOSDNoiseRatio, onsetDetectNoiseCallback)); paramCallbacks.insert(std::make_pair(paramOSDMsBetweenOnsets, onsetDetectMsBetweenCallback)); }
AssetTree::Item AssetTree::Item::createGroup (AssetTree& tree, const String& name, const String& uid) { Item group (tree, ValueTree (Slugs::group)); group.setId (uid); group.setMissingProperties(); group.getNameValue() = name; return group; }
Project::Item Project::createNewItem (const File& file) { Item item (*this, ValueTree (Tags::file)); item.initialiseNodeValues(); item.getName() = file.getFileName(); item.getShouldCompileValue() = file.hasFileExtension ("cpp;mm;c;m;cc;cxx"); item.getShouldAddToResourceValue() = shouldBeAddedToBinaryResourcesByDefault (file); return item; }
//============================================================================== ValueTree Project::getJuceConfigNode() { ValueTree configNode = projectRoot.getChildWithName (Tags::configGroup); if (! configNode.isValid()) { configNode = ValueTree (Tags::configGroup); projectRoot.addChild (configNode, -1, 0); } return configNode; }
//============================================================================== ValueTree Project::getExporters() { ValueTree exporters (projectRoot.getChildWithName (Tags::exporters)); if (! exporters.isValid()) { projectRoot.addChild (ValueTree (Tags::exporters), 0, getUndoManagerFor (projectRoot)); exporters = getExporters(); } return exporters; }
ValueTree ZenAudioProcessorValueTreeState::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; }
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); }