Exemplo n.º 1
0
void ChildAlias::mouseUp (const MouseEvent& e)
{ 
 ((CabbageMainPanel*)(getTarget()->getParentComponent()))->setMouseState("up");
   if (e.eventComponent == resizer)
   {
   }
   else
   {
      //add this to reset MainComponent to have keyboard focus so that keyboard shortcuts (eg. lock/unlock) still work / intercept the messages
      getTopLevelComponent()->getChildComponent(0)->grabKeyboardFocus(); 
   }
   if (userAdjusting) userStoppedChangingBounds ();
   userAdjusting = false;   
   
   int offX = getProperties().getWithDefault(var::identifier("plantX"), 0);
   int offY = getProperties().getWithDefault(var::identifier("plantY"), 0);
   //update dimensions
   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->currentBounds.setBounds(getPosition().getX()-offX,
																					 getPosition().getY()-offY,
																					 getWidth(),
																					 getHeight());

   applyToTarget("");

   ((CabbageMainPanel*)(getTarget()->getParentComponent()))->sendActionMessage("Message sent from CabbageMainPanel:Up");

   if(type.containsIgnoreCase("CabbageGroupbox")||
	   type.containsIgnoreCase("CabbageImage"))
	   toBack();
   else 
	   toFront(true);


}
Exemplo n.º 2
0
// ---------------------------------------------------------------------------
//  SchemaInfo:
// ---------------------------------------------------------------------------
DOMElement*
SchemaInfo::getTopLevelComponent(const unsigned short compCategory,
                                 const XMLCh* const compName,
                                 const XMLCh* const name,
                                 SchemaInfo** enclosingSchema) {

    SchemaInfo* currentInfo = this;
    DOMElement* child = getTopLevelComponent(compCategory, compName, name);

    if (child == 0) {

        unsigned int listSize = (fIncludeInfoList) ? fIncludeInfoList->size() : 0;

        for (unsigned int i=0; i < listSize; i++) {

            currentInfo = fIncludeInfoList->elementAt(i);

            if (currentInfo == this)
                continue;

            child = currentInfo->getTopLevelComponent(compCategory, compName, name);

            if (child != 0) {

                *enclosingSchema = currentInfo;
                break;
            }
        }
    }

    return child;
}
Exemplo n.º 3
0
 void setUsingOpenGLRenderer (bool shouldUseOpenGL)
 {
    #if JUCE_OPENGL
     if (shouldUseOpenGL && currentDemoId != showOpenGL)
         openGLContext.attachTo (*getTopLevelComponent());
     else
         openGLContext.detach();
    #endif
 }
Exemplo n.º 4
0
bool Component::needsOwnerDraw()
{
	wxColor bg = getTopLevelComponent()->getPeer()->GetBackgroundColour();

	int r = bg.Red(), g = bg.Green(), b = bg.Blue();

	// FOR NOW:: the need for owner-draw is triggered by detecting
	//           white background of the heavy-weight component

	return r == 255 && g == 255 && b == 255;
}
Exemplo n.º 5
0
void TextBuffer::updateWindowTitle()
{
  String title;
  if (file==File::nonexistent)
    {
      title=T("Untitled");
      title << T(" (") << TextIDs::toString(textid) << T(")");
    }
  else
    title = file.getFileName();
  getTopLevelComponent()->setName(title);
}
Exemplo n.º 6
0
void OpenGLComponent::updateContextPosition()
{
    needToUpdateViewport = true;

    if (getWidth() > 0 && getHeight() > 0)
    {
        Component* const topComp = getTopLevelComponent();

        if (topComp->getPeer() != nullptr)
            updateEmbeddedPosition (topComp->getLocalArea (this, getLocalBounds()));
    }
}
void DirectShowComponent::updateContextPosition()
{
    needToUpdateViewport = true;

    if (getWidth() > 0 && getHeight() > 0)
    {
        Component* const topComp = getTopLevelComponent();

        if (topComp->getPeer() != nullptr)
            context->updateWindowPosition (topComp->getLocalArea (this, getLocalBounds()));
    }
}
Exemplo n.º 8
0
void OpenGLComponent::updateContextPosition()
{
  if (this->isVisible() && getWidth()>0 && getHeight()>0)
  {
    Component* const topComp = getTopLevelComponent();
    if (topComp->getPeer()!=nullptr)
    {
      const ScopedLock sl(contextLock);
      if (context.nativeContext!=nullptr)
        context.nativeContext->updateWindowPosition(topComp->getLocalArea(this,getLocalBounds()));
    }
  }
}
bool ActiveXControlComponent::createControl (const void* controlIID)
{
    deleteControl();
    ComponentPeer* const peer = getPeer();

    // the component must have already been added to a real window when you call this!
    jassert (dynamic_cast <Win32ComponentPeer*> (peer) != nullptr);

    if (dynamic_cast <Win32ComponentPeer*> (peer) != nullptr)
    {
        const Point<int> pos (getTopLevelComponent()->getLocalPoint (this, Point<int>()));
        HWND hwnd = (HWND) peer->getNativeHandle();

        ScopedPointer<Pimpl> newControl (new Pimpl (hwnd, *this));

        HRESULT hr;
        if ((hr = OleCreate (*(const IID*) controlIID, IID_IOleObject, 1 /*OLERENDER_DRAW*/, 0,
                             newControl->clientSite, newControl->storage,
                             (void**) &(newControl->control))) == S_OK)
        {
            newControl->control->SetHostNames (L"Juce", 0);

            if (OleSetContainedObject (newControl->control, TRUE) == S_OK)
            {
                RECT rect;
                rect.left = pos.getX();
                rect.top = pos.getY();
                rect.right = pos.getX() + getWidth();
                rect.bottom = pos.getY() + getHeight();

                if (newControl->control->DoVerb (OLEIVERB_SHOW, 0, newControl->clientSite, 0, hwnd, &rect) == S_OK)
                {
                    control = newControl;
                    setControlBounds (Rectangle<int> (pos.getX(), pos.getY(), getWidth(), getHeight()));

                    control->controlHWND = ActiveXHelpers::getHWND (this);

                    if (control->controlHWND != 0)
                    {
                        originalWndProc = (void*) (pointer_sized_int) GetWindowLongPtr ((HWND) control->controlHWND, GWLP_WNDPROC);
                        SetWindowLongPtr ((HWND) control->controlHWND, GWLP_WNDPROC, (LONG_PTR) Pimpl::activeXHookWndProc);
                    }

                    return true;
                }
            }
        }
    }

    return false;
}
Exemplo n.º 10
0
    void buttonClicked (Button* b)
    {
        if (b == &createButton)
        {
            createProject();
        }
        else
        {
            MainWindow* mw = dynamic_cast<MainWindow*> (getTopLevelComponent());
            jassert (mw != nullptr);

            JucerApplication::getApp()->closeWindow (mw);
        }
    }
Exemplo n.º 11
0
void MainComponent::updateRenderingEngine (int renderingEngineIndex)
{
    if (renderingEngineIndex == (renderingEngines.size() - 1))
    {
        openGLContext.attachTo (*getTopLevelComponent());
    }
    else
    {
        openGLContext.detach();
        peer->setCurrentRenderingEngine (renderingEngineIndex);
    }

    currentRenderingEngineIdx = renderingEngineIndex;
}
Exemplo n.º 12
0
void CtrlrEditor::setRenderingEngine (int index)
{
   #if JUCE_OPENGL
    if (getRenderingEngines()[index] == openGLRendererName)
    {
        openGLContext.attachTo (*getTopLevelComponent());
        return;
    }

    openGLContext.detach();
   #endif

    if (ComponentPeer* peer = getPeer())
        peer->setCurrentRenderingEngine (index);
}
Exemplo n.º 13
0
void Button::parentHierarchyChanged()
{
    auto* newKeySource = shortcuts.isEmpty() ? nullptr : getTopLevelComponent();

    if (newKeySource != keySource.get())
    {
        if (keySource != nullptr)
            keySource->removeKeyListener (callbackHelper.get());

        keySource = newKeySource;

        if (keySource != nullptr)
            keySource->addKeyListener (callbackHelper.get());
    }
}
Exemplo n.º 14
0
void Button::parentHierarchyChanged()
{
    Component* const newKeySource = (shortcuts.size() == 0) ? nullptr : getTopLevelComponent();

    if (newKeySource != keySource.get())
    {
        if (keySource != nullptr)
            keySource->removeKeyListener (callbackHelper);

        keySource = newKeySource;

        if (keySource != nullptr)
            keySource->addKeyListener (callbackHelper);
    }
}
Exemplo n.º 15
0
void Button::parentHierarchyChanged()
{
    Component* const newKeySource = (shortcuts.size() == 0) ? 0 : getTopLevelComponent();

    if (newKeySource != keySource.get())
    {
        if (keySource != 0)
            keySource->removeKeyListener (this);

        keySource = newKeySource;

        if (keySource != 0)
            keySource->addKeyListener (this);
    }
}
Exemplo n.º 16
0
void MainContentComponent::loadChaser()
{
	//open a load dialog
	File chaserLocation = FileLess::getAppFolder( FileLess::Chaser );
	FileChooser fc( "Pick a Chaser file...", chaserLocation, "*.xml", true );

	if ( fc.browseForFileToOpen() )
	{
		File f = fc.getResult();
		if ( creator->createChaserFromChaserFile( f, true ) )
		{
			getTopLevelComponent()->setName( f.getFileNameWithoutExtension() );
			xmlManager->setSaveFile( f );
		}
	}
}
Exemplo n.º 17
0
void ComponentOverlay::mouseUp (const MouseEvent& e)
{

    if (e.eventComponent != resizer)
    {
        //add this to reset MainComponent to have keyboard focus so that keyboard shortcuts (eg. lock/unlock) still work / intercept the messages
        getTopLevelComponent()->getChildComponent (0)->grabKeyboardFocus();
    }

    if (userAdjusting) userStoppedChangingBounds ();

    userAdjusting = false;

    layoutEditor->getLassoSelection().addToSelectionOnMouseUp (this, e.mods, true, mouseDownSelectStatus);
    layoutEditor->updateSelectedComponentBounds();
    updateBoundsDataForTarget();
}
Exemplo n.º 18
0
void TextBuffer::focusGained(Component::FocusChangeType cause)
{
  // When an editor window is selected is becomes the "focus" editor
  // and it only loses this focus when another editor window is
  // selected, i.e. the editing focus is maintained even when the
  // window itself is not the active window
  TopLevelWindow* w=NULL;
  // clear any other editing window of the focus
  for (int i=0; i<TopLevelWindow::getNumTopLevelWindows(); i++)
    {
      w=TopLevelWindow::getTopLevelWindow(i);
      if (w->getComponentPropertyBool(T("FocusEditor"), false))
	w->setComponentProperty(T("FocusEditor"), false);
    }
  // select this one
  getTopLevelComponent()->setComponentProperty(T("FocusEditor"), true);
}
Exemplo n.º 19
0
void MainComponent::setRenderingEngine (int index)
{
//  showMessageBubble (getRenderingEngines()[index]);
  
#if JUCE_OPENGL
  if (getRenderingEngines()[index] == openGLRendererName)
  {
    openGLContext.attachTo (*getTopLevelComponent());
    return;
  }
  
  openGLContext.detach();
#endif
  
  if (ComponentPeer* peer = getPeer())
    peer->setCurrentRenderingEngine (index);
}
Exemplo n.º 20
0
//==============================================================================
MainContent::MainContent ()
{
    addAndMakeVisible (background = new Background());
    background->setName ("background");

    addAndMakeVisible (controls = new Controls (this));
    controls->setName ("controls");

    addAndMakeVisible (chat = new Chat (this));
    chat->setName ("chat");

    addAndMakeVisible (preview = new Preview());
    preview->setName ("preview");

    addAndMakeVisible (presets = new Presets (this));
    presets->setName ("presets");

    addAndMakeVisible (config = new Config (this));
    config->setName ("config");

    addAndMakeVisible (statusbar = new Statusbar());
    statusbar->setName ("statusbar");


    //[UserPreSize]
    //[/UserPreSize]

    setSize (758, 762);


    //[Constructor] You can add your own custom stuff here..

  setSize(GUI::WINDOW_W , GUI::WINDOW_H) ;

  this->mainWindow = static_cast<DocumentWindow*>(getTopLevelComponent()) ;
#ifdef TRAY_ICON
  this->trayIcon = new AvCasterTrayIconComponent(this->mainWindow) ;
#endif // TRAY_ICON

  this->background->toFront(true) ;
  this->statusbar ->setAlwaysOnTop(true) ;
  this->statusbar ->setStatusL(GUI::INIT_STATUS_TEXT) ;

    //[/Constructor]
}
Exemplo n.º 21
0
void MainContentComponent::timerCallback()
{
	stopTimer();

	//if we can't load the existing chaser, create a new one
	if ( !creator->createChaserFromChaserFile( false ) ) //no need to give feedback on first startup
		creator->createChaserFromAssFile( FileHelper::getAssFileAutomagically( true ), false );

	//set the name
	getTopLevelComponent()->setName( FileLess::getLastUsedFileName( FileLess::Chaser ).getFileNameWithoutExtension() );

#ifdef DEBUG

#endif // DEBUG

	//resize to update preview window
	resized();
}
Exemplo n.º 22
0
 void buttonClicked (Button* button)
 {
   if (button == m_btnOK)
   {
     getTopLevelComponent ()->exitModalState (0);
   }
   else if (button == m_btnReset)
   {
   }
   else if (button == m_btnLoad)
   {
   }
   else if (button == m_btnSave)
   {
   }
   else if (button == m_btnNew)
   {
   }
 }
Exemplo n.º 23
0
void MainAppWindow::setRenderingEngine (int index)
{
    showMessageBubble (getRenderingEngines()[index]);

   #if JUCE_OPENGL
    if (getRenderingEngines()[index] == openGLRendererName
          && contentComponent != nullptr
          && ! contentComponent->isShowingOpenGLDemo())
    {
        openGLContext.attachTo (*getTopLevelComponent());
        return;
    }

    openGLContext.detach();
   #endif

    if (ComponentPeer* peer = getPeer())
        peer->setCurrentRenderingEngine (index);
}
Exemplo n.º 24
0
bool MainContentComponent::saveChaserAs()
{

	//open a save dialog
	File chaserLocation = FileLess::getAppFolder( FileLess::Chaser );
	FileChooser fc( "Save chaser as...", chaserLocation, "*.xml", true );
	if ( fc.browseForFileToSave( true ) )
	{
		File f = fc.getResult();
		xmlManager->setSaveFile( f );

		sliceManager->writeToXml();
		chaseManager->writeToXml();

		getTopLevelComponent()->setName( f.getFileNameWithoutExtension() );
		return true;
	}

	return false;
}
Exemplo n.º 25
0
void D3D11Demo::paint (Graphics&)
{
    if (renderThreadExists())
        return;

    renderThreadStart ([this] (Thread* thread)
    {
        {
            ErrorReporter r (this);
            if (!d3d11.startup (getTopLevelComponent()->getWindowHandle()))
                return;
        }

        {
            ErrorReporter r (this);
            if (!demoStartup())
                return;
        }

        timeInit();

        while (!thread->threadShouldExit())
        {
            ErrorReporter r (this);
            timeUpdate();
            demoUpdate();
            Thread::yield();
        }

        {
            ErrorReporter r (this);
            demoShutdown();
        }

        {
            ErrorReporter r (this);
            d3d11.shutdown();
        }
    });
}
Exemplo n.º 26
0
    bool perform (const InvocationInfo& info) override
    {
        MainAppWindow* mainWindow = MainAppWindow::getMainAppWindow();

        if (mainWindow == nullptr)
            return true;

        switch (info.commandID)
        {
            case MainAppWindow::showPreviousDemo:   moveDemoPages (-1); break;
            case MainAppWindow::showNextDemo:       moveDemoPages ( 1); break;

            case MainAppWindow::welcome:
            case MainAppWindow::componentsAnimation:
            case MainAppWindow::componentsDialogBoxes:
            case MainAppWindow::componentsKeyMappings:
            case MainAppWindow::componentsMDI:
            case MainAppWindow::componentsPropertyEditors:
            case MainAppWindow::componentsTransforms:
            case MainAppWindow::componentsWebBrowsers:
            case MainAppWindow::componentsWidgets:
                demoList.selectRow (info.commandID - MainAppWindow::welcome);
                break;

            case MainAppWindow::renderingEngineOne:
            case MainAppWindow::renderingEngineTwo:
            case MainAppWindow::renderingEngineThree:
                mainWindow->setRenderingEngine (info.commandID - MainAppWindow::renderingEngineOne);
                break;

            case MainAppWindow::useLookAndFeelV1:  LookAndFeel::setDefaultLookAndFeel (&lookAndFeelV1); break;
            case MainAppWindow::useLookAndFeelV2:  LookAndFeel::setDefaultLookAndFeel (&lookAndFeelV2); break;
            case MainAppWindow::useLookAndFeelV3:  LookAndFeel::setDefaultLookAndFeel (&lookAndFeelV3); break;

            case MainAppWindow::toggleRepaintDebugging:
                juceDemoRepaintDebuggingActive = ! juceDemoRepaintDebuggingActive;
                mainWindow->repaint();
                break;

            case MainAppWindow::useNativeTitleBar:
                mainWindow->setUsingNativeTitleBar (! mainWindow->isUsingNativeTitleBar());
                break;

           #if ! JUCE_LINUX
            case MainAppWindow::goToKioskMode:
                {
                    Desktop& desktop = Desktop::getInstance();

                    if (desktop.getKioskModeComponent() == nullptr)
                        desktop.setKioskModeComponent (getTopLevelComponent());
                    else
                        desktop.setKioskModeComponent (nullptr);

                    break;
                }
           #endif

            default:
                return false;
        }

        return true;
    }
Exemplo n.º 27
0
    // this is the ApplicationCommandTarget method that is used to actually perform one of our commands..
    bool perform (const InvocationInfo& info)
    {
        switch (info.commandID)
        {
        case showRendering:
            showDemo (createRenderingDemo());
            currentDemoId = showRendering;
            break;

        case showFontsAndText:
            showDemo (createFontsAndTextDemo());
            currentDemoId = showFontsAndText;
            break;

        case showWidgets:
            showDemo (createWidgetsDemo());
            currentDemoId = showWidgets;
            break;

        case showThreading:
            showDemo (createThreadingDemo());
            currentDemoId = showThreading;
            break;

        case showTreeView:
            showDemo (createTreeViewDemo());
            currentDemoId = showTreeView;
            break;

        case showTable:
            showDemo (createTableDemo());
            currentDemoId = showTable;
            break;

        case showAudio:
            showDemo (createAudioDemo());
            currentDemoId = showAudio;
            break;

        case showDragAndDrop:
            showDemo (createDragAndDropDemo());
            currentDemoId = showDragAndDrop;
            break;

        case showOpenGL:
           #if JUCE_OPENGL
            setUsingOpenGLRenderer (false);
            showDemo (createOpenGLDemo());
            currentDemoId = showOpenGL;
           #endif
            break;

        case showQuicktime:
           #if JUCE_QUICKTIME && ! JUCE_LINUX
            setUsingOpenGLRenderer (false);
            showDemo (createQuickTimeDemo());
            currentDemoId = showQuicktime;
           #endif
            break;

        case showDirectShow:
           #if JUCE_DIRECTSHOW
            setUsingOpenGLRenderer (false);
            showDemo (createDirectShowDemo());
            currentDemoId = showDirectShow;
           #endif
            break;

        case showCamera:
           #if JUCE_USE_CAMERA
            setUsingOpenGLRenderer (false);
            showDemo (createCameraDemo());
            currentDemoId = showCamera;
           #endif
            break;

        case showWebBrowser:
           #if JUCE_WEB_BROWSER
            setUsingOpenGLRenderer (false);
            showDemo (createWebBrowserDemo());
            currentDemoId = showWebBrowser;
           #endif
            break;

        case showCodeEditor:
            showDemo (createCodeEditorDemo());
            currentDemoId = showCodeEditor;
            break;

        case showInterprocessComms:
            showDemo (createInterprocessCommsDemo());
            currentDemoId = showInterprocessComms;
            break;

        case setDefaultLookAndFeel:
            LookAndFeel::setDefaultLookAndFeel (nullptr);
            break;

        case setOldSchoolLookAndFeel:
            LookAndFeel::setDefaultLookAndFeel (&oldLookAndFeel);
            break;

        case useNativeTitleBar:
            mainWindow.setUsingNativeTitleBar (! mainWindow.isUsingNativeTitleBar());
            break;

       #if JUCE_MAC
        case useNativeMenus:
            if (MenuBarModel::getMacMainMenu() != 0)
            {
                MenuBarModel::setMacMainMenu (0);
                mainWindow.setMenuBar ((ContentComp*) mainWindow.getContentComponent());
            }
            else
            {
                MenuBarModel::setMacMainMenu ((ContentComp*) mainWindow.getContentComponent());
                mainWindow.setMenuBar (0);
            }

            break;
       #endif

       #if ! JUCE_LINUX
        case goToKioskMode:
            {
                Desktop& desktop = Desktop::getInstance();

                if (desktop.getKioskModeComponent() == nullptr)
                    desktop.setKioskModeComponent (getTopLevelComponent());
                else
                    desktop.setKioskModeComponent (nullptr);

                break;
            }
       #endif

        default:
            return false;
        };

        return true;
    }
Exemplo n.º 28
0
void CabbageTableManager::mouseDown (const MouseEvent& e)
{
    if(e.mods.isPopupMenu())
    {
        PopupMenu pop, subMenu1, subMenu2;
        pop.setLookAndFeel(&getTopLevelComponent()->getLookAndFeel());
        subMenu1.setLookAndFeel(&getTopLevelComponent()->getLookAndFeel());
        subMenu2.setLookAndFeel(&getTopLevelComponent()->getLookAndFeel());

        subMenu1.addItem(101, "1 segment");
        subMenu1.addItem(102, "2 segments");
        subMenu1.addItem(104, "4 segments");
        subMenu1.addItem(108, "8 segments");
        subMenu1.addItem(112, "12 segments");
        subMenu1.addItem(116, "16 segments");
        subMenu1.addItem(120, "20 segments");
        subMenu1.addItem(124, "24 segments");
        subMenu1.addItem(128, "28 segments");
        subMenu1.addItem(132, "32 segments");



        for(int i=0; i<tables.size(); i++)
            subMenu2.addColouredItem(200+i, "fTable:"+String(tables[i]->tableNumber), tables[i]->currColour);

        if(!readOnly)
        {
            pop.addSubMenu(TRANS("Edit..."), subMenu1);
            pop.addSubMenu(TRANS("Table to front..."), subMenu2);
            pop.addItem(300, "Replace existing table");
            pop.addItem(301, "Add table to score");
        }


        int choice;
#if !defined(AndroidBuild)
		choice = pop.show();
#endif
        if((choice>=100) && (choice<200))
        {
            for(int i=0; i<tables.size(); i++)
            {
                if(tables[i]->isCurrentlyOnTop)
                {
                    //Logger::writeToLog("currentOnTop:"+String(tables[i]->tableNumber));
                    tables[i]->createHandlesFromTable(choice-100);
                    tables[i]->drawOriginalTableData = false;
                }
            }
        }
        else if(choice>=200 && choice<300)
        {
            this->tableToTop(choice-200);
        }
        else if(choice==300)
        {
            for(int i=0; i<tables.size(); i++)
            {
                if(tables[i]->isCurrentlyOnTop)
                {
                    tables[i]->changeMessage = "overwriteFunctionTable";
                    tables[i]->sendChangeMessage();
                }
            }
        }
        else if(choice==301)
        {
            for(int i=0; i<tables.size(); i++)
            {
                if(tables[i]->isCurrentlyOnTop)
                {
                    tables[i]->changeMessage = "writeNewFunctionTable";
                    tables[i]->sendChangeMessage();
                }
            }
        }
    }
    //if left button is pressed..
    else
    {
        for(int i=0; i<tables.size(); i++)
        {
            if(tables[i]->editMode)
                if(tables[i]->toggleMaxMin)
                {
                    if(tables[i]->getBounds().contains(Point<int>(e.getMouseDownX(), e.getMouseDownY())))
                    {
                        tables[i]->toggleMinMaxAmp(e.getMouseDownX());
                        tables[i]->changeMessage = "updateFunctionTable";
                        tables[i]->sendChangeMessage();
                    }
                }

                else if(tables[i]->isCurrentlyOnTop)
                {
                    tables[i]->toggleMinMaxAmp(e.getMouseDownX());
                    tables[i]->changeMessage = "updateFunctionTable";
                    tables[i]->sendChangeMessage();
                }
        }

    }

}
Exemplo n.º 29
0
SoundboardAudioProcessorEditor::SoundboardAudioProcessorEditor(SoundboardAudioProcessor &p)
        : AudioProcessorEditor(&p), processor(p), mPauseState(true), mTimerState(true)
{
#if JUCE_WINDOWS
#if JUCE_OPENGL
    openGLContext.attachTo (*getTopLevelComponent());
#endif
#endif
    addAndMakeVisible(topBar = new Bar());
    
    addAndMakeVisible(gainSlider = new Slider());
    gainSlider->setRange(0, 100, 1);
    gainSlider->setValue(gainSlider->proportionOfLengthToValue(processor.getGain()), dontSendNotification);
    gainSlider->setTextBoxStyle(Slider::TextEntryBoxPosition::NoTextBox, true, 0, 0);
    gainSlider->setSliderStyle(Slider::SliderStyle::LinearHorizontal);
    gainSlider->addListener(this);
    gainBubble = new BubbleMessageComponent();
    gainBubble->addToDesktop(0);
    gainBubble->setAllowedPlacement(BubbleMessageComponent::BubblePlacement::below);

    addAndMakeVisible(loadDirectoryButton = new TextButton());
    loadDirectoryButton->setButtonText(FontAwesome_Folder_Open_O);
    loadDirectoryButton->setLookAndFeel(awesomeLookAndFeel);
    loadDirectoryButton->setConnectedEdges(TextButton::ConnectedOnLeft | TextButton::ConnectedOnRight);
    loadDirectoryButton->addListener(this);

    addAndMakeVisible(listButton = new TextButton());
    listButton->setLookAndFeel(awesomeLookAndFeel);
    listButton->setButtonText(FontAwesome_List);
    listButton->addListener(this);
    listButton->setConnectedEdges(TextButton::ConnectedOnRight);

    addAndMakeVisible(gridButton = new TextButton());
    gridButton->setLookAndFeel(awesomeLookAndFeel);
    gridButton->setButtonText(FontAwesome_Th);
    gridButton->addListener(this);
    gridButton->setConnectedEdges(TextButton::ConnectedOnLeft);

    addAndMakeVisible(settingsButton = new TextButton());
    settingsButton->setLookAndFeel(awesomeLookAndFeel);
    settingsButton->setButtonText(FontAwesome_Cog);
    settingsButton->addListener(this);
    settingsButton->setConnectedEdges(TextButton::ConnectedOnLeft);

    addAndMakeVisible(duckButton = new TextButton());
    duckButton->setLookAndFeel(awesomeLookAndFeel);
    duckButton->setButtonText(FontAwesome_Comment_O);
    duckButton->addListener(this);
    
    addAndMakeVisible(lockButton = new TextButton());
    lockButton->setLookAndFeel(awesomeLookAndFeel);
    if (processor.getLocked()) {
        lockButton->setButtonText(FontAwesome_Lock);
    } else {
        lockButton->setButtonText(FontAwesome_Unlock);
    }
    lockButton->addListener(this);
    lockButton->setConnectedEdges(TextButton::ConnectedOnRight);
    
    addAndMakeVisible(table = new SoundboardTableComponent(p));
    listButton->setEnabled(false);

    addAndMakeVisible(grid = new SoundboardGridComponent(p));
    grid->setVisible(false);
    grid->toBack();

    if (processor.wrapperType != AudioProcessor::wrapperType_Standalone)
    {
        addAndMakeVisible(resizableCornerComponent = new ResizableCornerComponent(this, &resizeLimits));
        resizeLimits.setSizeLimits(380, 320, 1024, 768);
    }

    refresh();

    // Make sure that before the constructor has finished, you've set the
    // editor's size to whatever you need it to be.
    setSize(processor.getWindowWidth(), processor.getWindowHeight());

    startTimer(TimerIdRefresh, static_cast<int>(1000 * 0.5));
    
    // listen to gain changes
    processor.getOscManager()->addOscParameterListener(this, "/ultraschall/soundboard/gain$");
    processor.getOscManager()->addOscParameterListener(this, "/ultraschall/soundboard/duck/gain$");
    processor.getOscManager()->addOscParameterListener(this, "/ultraschall/soundboard/duck/enabled$");
}
Exemplo n.º 30
0
void MainContentComponent::menuItemSelected( int menuItemID, int topLevelMenuIndex )
{
	if ( topLevelMenuIndex == 0 )
	{
		switch ( menuItemID )
		{
		case 1:
		{
			//new chaser
			File defaultChaser = FileLess::getNewFile( FileLess::Chaser );
			xmlManager->setSaveFile( defaultChaser );
			creator->createChaserFromAssFile( FileHelper::getAssFileAutomagically( true ), true );
			getTopLevelComponent()->setName( defaultChaser.getFileNameWithoutExtension() );
		}
		break;
		case 2:
			//load existing chaser
			loadChaser();
			break;
		case 3:
			//save the chaser under a new name
			saveChaserAs();
			break;
		case 4:
		{
			PixelMapCreator c;
			c.saveAsPng( sliceManager->getAssFile().getFileNameWithoutExtension(), sliceManager->getSlices(), sliceManager->getResolution() );
			break;
		}
		case 0:
		default:
			return;
		}
	}

	else if ( topLevelMenuIndex == 1 )
	{
		switch ( menuItemID )
		{
		case 1:
			copyStep();
			break;
		case 2:
			pasteStep();
			break;
		case 3:
		{
			//clear the step
			Step empty;
			chaseManager->setCurrentStep( empty );
			previewWindow->setActiveSlices();
			break;
		}
		case 4:
			//invert step
			previewWindow->invertActiveSlices();
			break;
		case 0:
		default:
			return;
		}
	}
}