예제 #1
0
파일: GuiApp.cpp 프로젝트: bketech/element
    void
    GuiApp::run()
    {
        commander().registerAllCommandsForTarget (JUCEApplication::getInstance());
        commander().registerAllCommandsForTarget (this);

        globals().session().open();
        sessionDoc = new SessionDocument (globals().session());

        content = new ContentComponent (*this);
        content->setSize (800, 600);
        mainWindow = new MainWindow (*this);
        mainWindow->setContentNonOwned (content.get(), true);

        PropertiesFile* pf = globals().settings().getUserSettings();
        mainWindow->restoreWindowStateFromString (pf->getValue ("mainWindowState"));

       #if JUCE_IOS || JUCE_ANDROID
        Desktop& d = Desktop::getInstance();
        d.setKioskModeComponent (mainWindow);
       #endif

        mainWindow->addToDesktop();
        mainWindow->setVisible (true);
        dispatch->startTimer (250);

        openWindow (ELEMENT_PLUGIN_MANAGER);

        File sess (pf->getValue ("lastSession"));
        if (sess.existsAsFile()) {
            sessionDoc->loadFrom (sess, true);
            mainWindow->setName (sessionDoc->getDocumentTitle());
        }
    }
예제 #2
0
//==============================================================================
MidiSlider::MidiSlider(MiosStudio *_miosStudio, int _num, String _functionName, int _functionArg, int _midiChannel, int initialValue, bool _vertical)
    : miosStudio(_miosStudio)
    , sliderNum(_num)
    , vertical(_vertical)
{
    addAndMakeVisible(slider = new MidiSliderComponent(T("Slider")));
    slider->setSliderStyle(vertical ? MidiSliderComponent::LinearVertical : MidiSliderComponent::LinearHorizontal);
    slider->addListener(this);

    // only used for horizontal sliders
    addAndMakeVisible(sliderFunction = new ComboBox(String::empty));
    sliderFunction->addListener(this);

    // restore settings
    PropertiesFile *propertiesFile = MiosStudioProperties::getInstance()->getCommonSettings(true);
    if( propertiesFile ) {
        _functionName = propertiesFile->getValue("slider" + String(sliderNum) + "FunctionName", _functionName);
        _functionArg = propertiesFile->getIntValue("slider" + String(sliderNum) + "FunctionArg", _functionArg);
        _midiChannel = propertiesFile->getIntValue("slider" + String(sliderNum) + "MidiChannel", _midiChannel);
        initialValue = propertiesFile->getIntValue("slider" + String(sliderNum) + "InitialValue", initialValue);
    }

    setFunction(_functionName, _functionArg, _midiChannel, initialValue);

    if( vertical )
        setSize(24, 18+80);
    else
        setSize(128, 24+18);
}
예제 #3
0
void ApplicationSettingsComponent::loadSettingsFromFile(){
  PropertiesFile* properties = ApplicationConfiguration::getApplicationProperties();
#if JUCE_MAC || JUCE_IOS
  DirectoryIterator it(File("/dev"), false, "tty.usbserial-*");
#elif JUCE_WINDOWS
  DirectoryIterator it(File("\\\\.\\"), false, "COM*");
#elif JUCE_LINUX
  DirectoryIterator it(File("/dev"), false, "ttyUSB*");
#endif
  int index = 1;
  serialPortComboBox->addItem("none", index);
  while(it.next())
    serialPortComboBox->addItem(it.getFile().getFullPathName(), ++index);
  serialPortComboBox->setText(properties->getValue("serialport"));
  serialSpeedComboBox->setText(properties->getValue("serialspeed"));
  presetDirectoryEditor->setText(properties->getValue("presetdirectory"));

  const StringArray& inputs = MidiInput::getDevices();
  midiInputComboBox->addItem("none", ++index);
  for(int i=0; i<inputs.size(); ++i)
    midiInputComboBox->addItem(inputs[i], ++index);
#if ! JUCE_WINDOWS
  midiInputComboBox->addItem("BlipZones", ++index);
#endif
  midiInputComboBox->setText(properties->getValue("midiinput"));

  const StringArray& outputs = MidiOutput::getDevices();
  midiOutputComboBox->addItem("none", ++index);
  for(int i=0; i<outputs.size(); ++i)
    midiOutputComboBox->addItem(outputs[i], ++index);
#if ! JUCE_WINDOWS
  midiOutputComboBox->addItem("BlipZones", ++index);
#endif
  midiOutputComboBox->setText(properties->getValue("midioutput"));

  oscHostEditor->setText(properties->getValue("oschost"));
  oscPortEditor->setText(properties->getValue("oscport"));

  std::cout << "loaded settings from file " << properties->getFile().getFullPathName() << std::endl;
}
FileSearchPath PluginListComponent::getLastSearchPath (PropertiesFile& properties, AudioPluginFormat& format)
{
    return FileSearchPath (properties.getValue ("lastPluginScanPath_" + format.getName(),
                                                format.getDefaultLocationsToSearch().toString()));
}