Ejemplo n.º 1
0
pd::Patch ofxPd::openPatch(pd::Patch& patch) {
	
	ofLogVerbose("Pd") << "opening patch: "+patch.filename()+" path: "+patch.path();
	
	_LOCK();
	Patch p = PdBase::openPatch(patch);
	_UNLOCK();
	if(!p.isValid()) {
		ofLogError("Pd") << "opening patch \""+patch.filename()+"\" failed";
	}
	
	return p;
}
Ejemplo n.º 2
0
void GuiPatcher::setPatch(InstanceProcessor& processor, pd::Patch const& patch)
{
    m_comment.clear();
    m_parameters.clear();
    m_labels.clear();
    if(patch.isValid())
    {
        std::array<int, 2> size(patch.getSize());
        setSize(std::max(size[0], 120), std::max(size[1], 20));
        std::vector<pd::Gui> guis(patch.getGuis());
        for(size_t i = 0; i < guis.size(); ++i)
        {
            if(guis[i].getType() == pd::Gui::Type::Number)
            {
                m_parameters.add(new GuiNumbox(processor, guis[i]));
                addAndMakeVisible(m_parameters.getLast());
            }
            else if(guis[i].getType() == pd::Gui::Type::HorizontalRadio ||
                    guis[i].getType() == pd::Gui::Type::VerticalRadio)
            {
                m_parameters.add(new GuiRadio(processor, guis[i]));
                addAndMakeVisible(m_parameters.getLast());
            }
            else if(guis[i].getType() == pd::Gui::Type::HorizontalSlider ||
                    guis[i].getType() == pd::Gui::Type::VerticalSlider)
            {
                m_parameters.add(new GuiSlider(processor, guis[i]));
                addAndMakeVisible(m_parameters.getLast());
            }
            else if(guis[i].getType() == pd::Gui::Type::Toggle)
            {
                m_parameters.add(new GuiToggle(processor, guis[i]));
                addAndMakeVisible(m_parameters.getLast());
            }
            
            if(guis[i].isParameter())
            {
                m_labels.add(new GuiLabel(processor, guis[i]));
                addAndMakeVisible(m_labels.getLast());
            }
        }
        
        std::vector<pd::Object> cmts(patch.getComments());
        for(size_t i = 0; i < cmts.size(); ++i)
        {
            m_comment.add(new GuiComment(cmts[i]));
            addAndMakeVisible(m_comment.getLast());
        }
        repaint();
    }
}
Ejemplo n.º 3
0
Patch PdBase::openPatch(pd::Patch& patch) {
	return openPatch(patch.filename(), patch.path());
}