コード例 #1
0
void GUIManager::sideBarGUIEvent(ofxUIEventArgs &e) //---------------- Top bar
{
	string name = e.widget->getName();
    
	if (name == SIDE_AUTO_SAVE)
	{
		ofxUIToggle *toggle = (ofxUIToggle *)e.widget;
		isAutoSave = toggle->getValue();
	}
	else if (name == SIDE_SAVE)
	{
		saveSettings();
	}
	else if (name == SIDE_NEXT)
	{
		ofxUIButton *button = (ofxUIButton *)e.widget;
		if (button->getValue()) nextPage();
	}
	else if (name == SIDE_PREVIOUS)
	{
		ofxUIButton *button = (ofxUIButton *)e.widget;
		if (button->getValue()) previousPage();
	}
    else
    {
        for (int i = 0; i < (int)guiPages.size(); i++)
            if (name == guiPages[i]->getName()) currentUIID = i;
        
        showGUI(name);
    }
}
コード例 #2
0
void GUIManager::toggleVisible()
{
    isVisible = !isVisible;
    if (isVisible)
    {
        showGUI(guiPages[currentUIID]->getName());
    }
    else
    {
        for (int i = 0; i < (int)guiPages.size(); i++)
        {
            guiPages[i]->setVisible(false);
        }
		sideBarGui->setVisible(false);
    }
}
コード例 #3
0
//==============================================================================
VstPluginExternalEditor::VstPluginExternalEditor (BasePlugin* plugin_,
                                                  VstPluginWindow* window_)
  : PluginEditorComponent (plugin_),
#if defined(LINUX)
    eventProc (0),
#endif
    handle (0),
    window (window_),
    editorWidth (0),
    editorHeight (0),
    offsetX (0),
    offsetY (0)
#ifdef JUCE_MAC
	, vstGuiWindow(0)
#endif
{
    DBG ("VstPluginExternalEditor::VstPluginExternalEditor");
    
    setWantsKeyboardFocus (true);
    setVisible (true);

#if defined(LINUX)
    plugin->openEditor (window->getWindowHandle (), display);

    handle = getChildWindow ((Window) window->getWindowHandle ());
    if (handle)
        eventProc = (EventProcPtr) obtainPropertyFromXWindow (handle,
                                                              XInternAtom (display, "_XEventProc", false));

#elif defined(_WIN32)
    plugin->openEditor (window->getWindowHandle (), (void*) 0);

	handle = GetWindow ((HWND) window->getWindowHandle(), GW_CHILD);
#endif

    if (editorWidth <= 0 || editorHeight <= 0)
        plugin->getEditorSize (editorWidth, editorHeight);

    jassert (editorWidth > 0 && editorHeight > 0);
    setSize (editorWidth, editorHeight);

    offsetX = window->getBorderThickness().getLeft ();
    offsetY = window->getTitleBarHeight()
              + window->getMenuBarHeight()
              + window->getBorderThickness().getTop ();
    
    if (handle)
    {
#if defined(LINUX)
        XResizeWindow (display, handle, editorWidth, editorHeight);
        XMoveWindow (display, handle, offsetX, offsetY);
#elif defined (_WIN32)
		MoveWindow (handle, offsetX, offsetY, editorWidth, editorHeight, true); 
#endif
    }
    
#ifdef JUCE_MAC
    setGuiWindow(new MacVSTGUIPositionHelperWindow(plugin, window->getX() + offsetX, window->getY() + offsetY));
    showGUI(true);
#endif

	repaint ();

	startTimer (1000 / 10);
}
コード例 #4
0
void GUIManager::previousPage()
{
	--currentUIID;
	if (currentUIID < 0) currentUIID = guiPages.size() - 1;
    showGUI(guiPages[currentUIID]->getName());
}
コード例 #5
0
void GUIManager::nextPage()
{
	++currentUIID;
	if (currentUIID > guiPages.size() - 1) currentUIID = 0;
    showGUI(guiPages[currentUIID]->getName());
}
コード例 #6
0
void
RemotePluginServer::dispatchControlEvents()
{    
    RemotePluginOpcode opcode = RemotePluginNoOpcode;
    static float *parameterBuffer = 0;

    tryRead(m_controlRequestFd, &opcode, sizeof(RemotePluginOpcode));

    switch (opcode) {

    case RemotePluginGetVersion:
	writeFloat(m_controlResponseFd, getVersion());
	break;

    case RemotePluginGetName:
	writeString(m_controlResponseFd, getName());
	break;

    case RemotePluginGetMaker:
	writeString(m_controlResponseFd, getMaker());
	break;
    
    case RemotePluginTerminate:
	terminate();
	break;
    
    case RemotePluginGetInputCount:
	m_numInputs = getInputCount();
	writeInt(m_controlResponseFd, m_numInputs);
	break;

    case RemotePluginGetOutputCount:
	m_numOutputs = getOutputCount();
	writeInt(m_controlResponseFd, m_numOutputs);
	break;

    case RemotePluginGetParameterCount:
	writeInt(m_controlResponseFd, getParameterCount());
	break;
	
    case RemotePluginGetParameterName:
	writeString(m_controlResponseFd, getParameterName(readInt(m_controlRequestFd)));
	break;
    
    case RemotePluginGetParameter:
	writeFloat(m_controlResponseFd, getParameter(readInt(m_controlRequestFd)));
	break;
    
    case RemotePluginGetParameterDefault:
	writeFloat(m_controlResponseFd, getParameterDefault(readInt(m_controlRequestFd)));
	break;

    case RemotePluginGetParameters:
    {
	if (!parameterBuffer) {
	    parameterBuffer = new float[getParameterCount()];
	}
	int p0 = readInt(m_controlRequestFd);
	int pn = readInt(m_controlRequestFd);
	getParameters(p0, pn, parameterBuffer);
	tryWrite(m_controlResponseFd, parameterBuffer, (pn - p0 + 1) * sizeof(float));
	break;
    }

    case RemotePluginHasMIDIInput:
    {
	bool m = hasMIDIInput();
	tryWrite(m_controlResponseFd, &m, sizeof(bool));
	break;
    }
       
    case RemotePluginGetProgramCount:
	writeInt(m_controlResponseFd, getProgramCount());
	break;

    case RemotePluginGetProgramName:
	writeString(m_controlResponseFd, getProgramName(readInt(m_controlRequestFd)));
	break;

    case RemotePluginIsReady:
    {
	if (!m_shm) sizeShm();
	bool b(isReady());
	std::cerr << "isReady: returning " << b << std::endl;
	tryWrite(m_controlResponseFd, &b, sizeof(bool));
    }

    case RemotePluginSetDebugLevel:
    {
	RemotePluginDebugLevel newLevel = m_debugLevel;
	tryRead(m_controlRequestFd, &newLevel, sizeof(RemotePluginDebugLevel));
	setDebugLevel(newLevel);
	m_debugLevel = newLevel;
	break;
    }

    case RemotePluginWarn:
    {
	bool b = warn(readString(m_controlRequestFd));
	tryWrite(m_controlResponseFd, &b, sizeof(bool));
	break;
    }

    case RemotePluginShowGUI:
    {
	showGUI(readString(m_controlRequestFd));
	break;
    }

    case RemotePluginHideGUI:
    {
	hideGUI();
	break;
    }

    //Deryabin Andrew: vst chunks support
    case RemotePluginGetVSTChunk:
    {
        std::vector<char> chunk = getVSTChunk();
        writeRaw(m_controlResponseFd, chunk);
        break;
    }

    case RemotePluginSetVSTChunk:
    {
        std::vector<char> chunk = readRaw(m_controlRequestFd);
        setVSTChunk(chunk);
        break;
    }
    //Deryabin Andrew: vst chunks support: end code

    case RemotePluginNoOpcode:
	break;

    case RemotePluginReset:
	reset();
	break;

    default:
	std::cerr << "WARNING: RemotePluginServer::dispatchControlEvents: unexpected opcode "
		  << opcode << std::endl;
    }
}