コード例 #1
0
ファイル: LightingWindow.cpp プロジェクト: florian-f/echomesh
void LightingWindow::setConfig(const LightConfig& config) {
  MessageManagerLock l;
  setTopLeftPosition(config.visualizer.topLeft.x, config.visualizer.topLeft.y);
  instrumentGrid_->setConfig(config);
  toFront(true);
  initialized_ = true;
}
コード例 #2
0
ファイル: juce_Toolbar.cpp プロジェクト: adscum/MoogLadders
    void positionNearBar()
    {
        const Rectangle<int> screenSize (toolbar->getParentMonitorArea());
        const int tbx = toolbar->getScreenX();
        const int tby = toolbar->getScreenY();
        const int gap = 8;

        int x, y;

        if (toolbar->isVertical())
        {
            y = tby;

            if (tbx > screenSize.getCentreX())
                x = tbx - getWidth() - gap;
            else
                x = tbx + toolbar->getWidth() + gap;
        }
        else
        {
            x = tbx + (toolbar->getWidth() - getWidth()) / 2;

            if (tby > screenSize.getCentreY())
                y = tby - getHeight() - gap;
            else
                y = tby + toolbar->getHeight() + gap;
        }

        setTopLeftPosition (x, y);
    }
コード例 #3
0
    void setNewScreenPos (const Point<int>& screenPos)
    {
        Point<int> newPos (screenPos - imageOffset);

        if (getParentComponent() != nullptr)
            newPos = getParentComponent()->getLocalPoint (nullptr, newPos);

        setTopLeftPosition (newPos);
    }
コード例 #4
0
void EnvelopeHandleComponent::recalculatePosition()
{
	bool oldDontUpdateTimeAndValue = dontUpdateTimeAndValue;
	dontUpdateTimeAndValue = true;
	setTopLeftPosition(getParentComponent()->convertDomainToPixels(time), 
					   getParentComponent()->convertValueToPixels(value));
	dontUpdateTimeAndValue = oldDontUpdateTimeAndValue;
	getParentComponent()->repaint();
}
コード例 #5
0
//==============================================================================
VstPluginWindow::VstPluginWindow (PluginEditorWindowHolder* owner_,
                                  BasePlugin* plugin_)
  : DialogWindow (String::empty, Colours::beige, true, false),
    plugin (0),
    owner (owner_),
    specialEditor (0),
    nativeEditor (0),
    externalEditor (0),
    content (0)
{
    DBG ("VstPluginWindow::VstPluginWindow");

    // add to desktop
    addToDesktop (getDesktopWindowStyleFlags());

    // setup window default values
    setTitleBarHeight (24);
    centreWithSize (400, 300);
    setWantsKeyboardFocus (true);
    setBackgroundColour (Config::getInstance ()->getColour (T("mainBackground")));

    // try to move the window to its old position
    int oldX = -1, oldY = -1, oldW = -1, oldH = -1, lastPage = 0;
    if (plugin_)
    {
        oldX = plugin_->getIntValue (PROP_WINDOWXPOS, -1);
        oldY = plugin_->getIntValue (PROP_WINDOWYPOS, -1);
        oldW = plugin_->getIntValue (PROP_WINDOWWSIZE, -1);
        oldH = plugin_->getIntValue (PROP_WINDOWHSIZE, -1);
        lastPage = plugin_->getIntValue (PROP_WINDOWPAGE, 0);
    }

    // try to move the window to its old position
    if (oldX >= 0 && oldY >= 0)
        setTopLeftPosition (oldX, oldY);

    // try to set the window to its old size
    if ((lastPage == 0 && ! externalEditor)
        || (lastPage == 1 && externalEditor))
    {
        if (oldW >= 0 && oldY >= 0)
            setSize (oldW, oldH);
    }

    // default plugin to open
    setPlugin (plugin_);
    
    // setMenuBar here, after setting the plugin, so the plugin's menu items are there immediately
    setMenuBar (this, getMenuBarHeight ());

    // restore window to front
    toFront (false);
    setVisible (true);
}
コード例 #6
0
void EnvelopeHandleComponent::updateTimeAndValue()
{
    if (shouldLockTime)
    {
        setTopLeftPosition(getParentComponent()->convertDomainToPixels(time),
                           getY());
    }
    else time = getParentComponent()->convertPixelsToDomain(getX());
    
    if (shouldLockValue)
    {
        setTopLeftPosition(getX(),
                           getParentComponent()->convertValueToPixels(value));
    }
    else value = getParentComponent()->convertPixelsToValue(getY());
	
#ifdef MYDEBUG
	printf("MyEnvelopeHandleComponent::updateTimeAndValue(%f, %f)\n", time, value);
#endif
}
コード例 #7
0
void EnvelopeHandleComponent::setTime(double timeToSet)
{
	bool oldDontUpdateTimeAndValue = dontUpdateTimeAndValue;
	dontUpdateTimeAndValue = true;
	
	time = constrainDomain(timeToSet);
	
	setTopLeftPosition(getParentComponent()->convertDomainToPixels(time), 
					   getY());
	
	dontUpdateTimeAndValue = oldDontUpdateTimeAndValue;
	
	getParentComponent()->repaint();
	((EnvelopeComponent*)getParentComponent())->sendChangeMessage();
}
コード例 #8
0
void EnvelopeHandleComponent::setValue(double valueToSet)
{
	bool oldDontUpdateTimeAndValue = dontUpdateTimeAndValue;
	dontUpdateTimeAndValue = true;
	
	value = constrainValue(valueToSet);
	
	setTopLeftPosition(getX(), 
					   getParentComponent()->convertValueToPixels(value));
	
	dontUpdateTimeAndValue = oldDontUpdateTimeAndValue;
	
	getParentComponent()->repaint();
	((EnvelopeComponent*)getParentComponent())->sendChangeMessage();
}
コード例 #9
0
ファイル: pMixPluginWindow.cpp プロジェクト: eriser/pMix2
PluginWindow::PluginWindow (Component* const pluginEditor, AudioProcessorGraph::Node* const o, WindowFormatType t)
: DocumentWindow (pluginEditor->getName(), Colours::lightblue, DocumentWindow::minimiseButton | DocumentWindow::closeButton),
owner (o),
type (t)
{
  setSize (400, 300);
  setUsingNativeTitleBar(true);
  setAlwaysOnTop(true);
  setContentOwned (pluginEditor, true);

  setTopLeftPosition (owner->properties.getWithDefault ("uiLastX", Random::getSystemRandom().nextInt (500)),
                      owner->properties.getWithDefault ("uiLastY", Random::getSystemRandom().nextInt (500)));
  setVisible (true);
  activePluginWindows.add (this);
}
コード例 #10
0
ファイル: UploadWindow.cpp プロジェクト: FigBug/komododrop
UploadWindow::UploadWindow()
{
	setSize(96, 96);
	setOpaque(true);
	addToDesktop(0);
	setAlwaysOnTop(true);

	juce::Rectangle<int> rc = Desktop::getInstance().getDisplays().getMainDisplay().userArea;

	Settings* settings = Settings::getInstance();
	if (settings->x == -1 || settings->y == -1 || !Desktop::getInstance().getDisplays().getTotalBounds(true).contains(settings->x, settings->y))
		setTopLeftPosition(rc.getRight() - 96 - 7, rc.getBottom() - 96 - 7);
	else
		setTopLeftPosition(settings->x, settings->y);

	setVisible(true);
	
#if defined (JUCE_WIN32) || defined (JUCE_LINUX)
	trayIcon = new TrayIcon(this);
#endif
#ifdef JUCE_MAC
	MenuBarModel::setMacMainMenu(this);
#endif
}
コード例 #11
0
MacVSTGUIPositionHelperWindow::MacVSTGUIPositionHelperWindow(BasePlugin* plugin_, int topleftX, int topleftY)
: 
    DocumentWindow (T(""), Colours::floralwhite, false),
    plugin(plugin_)
{
    setTitleBarHeight(0);

    setResizable (false, false); 

    int editorWidth;
    int editorHeight;
    plugin->getEditorSize (editorWidth, editorHeight);
    setSize(editorWidth, editorHeight);
    setTopLeftPosition(topleftX, topleftY);
    setVisible (true);
}
コード例 #12
0
ファイル: AttributeView.cpp プロジェクト: EQ4/KiwiJuce
    InspectorWindow::InspectorWindow(sAttributeViewer attrsViewer) :
    BaseWindow("Inspector", Colours::lightgrey, minimiseButton | closeButton, true),
	m_attr_viewer(attrsViewer)
    {
        setResizable(true, false);
        setResizeLimits(50, 50, 32000, 32000);
        setTopLeftPosition(0, 0);
        setSize(300, 440);
        setVisible(true);
		
		if (m_attr_viewer)
		{
			m_attr_viewer->setBounds(getLocalBounds());
			setContentNonOwned(m_attr_viewer.get(), true);
		}
    }
コード例 #13
0
ファイル: juce_Label.cpp プロジェクト: Emisense/S3Test
void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wasResized*/)
{
    if (leftOfOwnerComp)
    {
        setSize (jmin (getFont().getStringWidth (textValue.toString()) + 8, component.getX()),
                 component.getHeight());

        setTopRightPosition (component.getX(), component.getY());
    }
    else
    {
        setSize (component.getWidth(),
                 8 + roundToInt (getFont().getHeight()));

        setTopLeftPosition (component.getX(), component.getY() - getHeight());
    }
}
コード例 #14
0
PluginWindow::PluginWindow (Component* const pluginEditor,
                            AudioProcessorGraph::Node* const o,
                            WindowFormatType t)
    : DocumentWindow (pluginEditor->getName(), Colours::lightblue,
                      DocumentWindow::minimiseButton | DocumentWindow::closeButton),
      owner (o),
      type (t)
{
    setSize (400, 300);

    setContentOwned (pluginEditor, true);

    setTopLeftPosition (0, 0);
    setVisible (true);

    activePluginWindows.add (this);
}
コード例 #15
0
ファイル: GraphEditorPanel.cpp プロジェクト: furio/pyplasm
PluginWindow::PluginWindow (Component* const uiComp,
                            AudioProcessorGraph::Node* owner_,
                            const bool isGeneric_)
    : DocumentWindow (uiComp->getName(), Colours::lightblue,
                      DocumentWindow::minimiseButton | DocumentWindow::closeButton),
      owner (owner_),
      isGeneric (isGeneric_)
{
    setSize (400, 300);

    setContentOwned (uiComp, true);

    setTopLeftPosition (owner->properties.getWithDefault ("uiLastX", Random::getSystemRandom().nextInt (500)),
                        owner->properties.getWithDefault ("uiLastY", Random::getSystemRandom().nextInt (500)));
    setVisible (true);

    activePluginWindows.add (this);
}
コード例 #16
0
//==================================================================================================================
bool ComponentOverlay::keyPressed (const KeyPress& key, Component* originatingComponent)
{
    bool multipleSelection = false;
    const int gridSize =  2;

    for (ComponentOverlay* child : layoutEditor->getLassoSelection())
    {
        if (key == KeyPress::leftKey || key == KeyPress::rightKey)
            child->setTopLeftPosition (child->getPosition().getX() + (key == KeyPress::leftKey ? -gridSize : gridSize), child->getPosition().getY());

        else if (key == KeyPress::upKey || key == KeyPress::downKey)
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() + (key == KeyPress::upKey ? -gridSize : gridSize));

        else if (key == KeyPress (KeyPress::leftKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX() - gridSize * 4, child->getPosition().getY());

        else if (key == KeyPress (KeyPress::rightKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX() + gridSize * 4, child->getPosition().getY());

        else if (key == KeyPress (KeyPress::upKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() - gridSize * 4);

        else if (key == KeyPress (KeyPress::downKey, ModifierKeys::shiftModifier, 0))
            child->setTopLeftPosition (child->getPosition().getX(), child->getPosition().getY() + gridSize * 4);


        child->applyToTarget();
        multipleSelection = true;
        layoutEditor->updateSelectedComponentBounds();
    }

    if (multipleSelection == false)
    {
        setTopLeftPosition (getPosition().getX() - gridSize, getPosition().getY());
        applyToTarget();
    }

    updateBoundsDataForTarget();
    layoutEditor->updateCodeEditor();

    return false;
}
コード例 #17
0
ファイル: MainHostWindow.cpp プロジェクト: AmirooR/JUCE
    PluginListWindow (MainHostWindow& owner_, AudioPluginFormatManager& formatManager)
        : DocumentWindow ("Available Plugins", Colours::white,
                          DocumentWindow::minimiseButton | DocumentWindow::closeButton),
          owner (owner_)
    {
        const File deadMansPedalFile (getAppProperties().getUserSettings()
                                        ->getFile().getSiblingFile ("RecentlyCrashedPluginsList"));

        setContentOwned (new PluginListComponent (formatManager,
                                                  owner.knownPluginList,
                                                  deadMansPedalFile,
                                                  getAppProperties().getUserSettings()), true);

        setResizable (true, false);
        setResizeLimits (300, 400, 800, 1500);
        setTopLeftPosition (60, 60);

        restoreWindowStateFromString (getAppProperties().getUserSettings()->getValue ("listWindowPos"));
        setVisible (true);
    }
コード例 #18
0
ファイル: juce_Label.cpp プロジェクト: 0x4d52/JUCE
void Label::componentMovedOrResized (Component& component, bool /*wasMoved*/, bool /*wasResized*/)
{
    const Font f (getLookAndFeel().getLabelFont (*this));

    if (leftOfOwnerComp)
    {
        setSize (jmin (roundToInt (f.getStringWidthFloat (textValue.toString()) + 0.5f) + getBorderSize().getLeftAndRight(),
                       component.getX()),
                 component.getHeight());

        setTopRightPosition (component.getX(), component.getY());
    }
    else
    {
        setSize (component.getWidth(),
                 getBorderSize().getTopAndBottom() + 6 + roundToInt (f.getHeight() + 0.5f));

        setTopLeftPosition (component.getX(), component.getY() - getHeight());
    }
}
コード例 #19
0
    PluginListWindow (KnownPluginList& knownPluginList)
        : DocumentWindow ("Available Plugins", Colours::white,
                          DocumentWindow::minimiseButton | DocumentWindow::closeButton)
    {
        currentPluginListWindow = this;

        const File deadMansPedalFile (ApplicationProperties::getInstance()->getUserSettings()
                                        ->getFile().getSiblingFile ("RecentlyCrashedPluginsList"));

        setContentComponent (new PluginListComponent (knownPluginList,
                                                      deadMansPedalFile,
                                                      ApplicationProperties::getInstance()->getUserSettings()), true, true);

        setResizable (true, false);
        setResizeLimits (300, 400, 800, 1500);
        setTopLeftPosition (60, 60);

        restoreWindowStateFromString (ApplicationProperties::getInstance()->getUserSettings()->getValue ("listWindowPos"));
        setVisible (true);
    }
コード例 #20
0
PluginWindow::PluginWindow (Component* const pluginEditor,
                            AudioProcessorGraph::Node* const o,
                            WindowFormatType t)
    : DocumentWindow (pluginEditor->getName(), Colours::black,
                      DocumentWindow::minimiseButton | DocumentWindow::closeButton),
    owner (o),
    type (t),
    editor(pluginEditor),
    basicLookAndFeel(new CabbageLookAndFeelBasic())
{
    setSize (400, 300);
    this->setTitleBarHeight(18);
    //setLookAndFeel(basicLookAndFeel);
    setContentOwned (pluginEditor, true);

    setTopLeftPosition (owner->properties.getWithDefault ("uiLastX", Random::getSystemRandom().nextInt (500)),
                        owner->properties.getWithDefault ("uiLastY", Random::getSystemRandom().nextInt (500)));
    setVisible (true);
    setAlwaysOnTop(true);
    activePluginWindows.add (this);
    startTimer(100);
}
コード例 #21
0
ファイル: GraphEditorPanel.cpp プロジェクト: Neknail/JUCE
PluginWindow::PluginWindow (Component* const pluginEditor,
                            AudioProcessorGraph::Node* const o,
                            WindowFormatType t)
    : DocumentWindow (pluginEditor->getName(),
                      LookAndFeel::getDefaultLookAndFeel().findColour (ResizableWindow::backgroundColourId),
                      DocumentWindow::minimiseButton | DocumentWindow::closeButton),
      owner (o),
      type (t)
{
    setSize (400, 300);

    setContentOwned (pluginEditor, true);

    setTopLeftPosition (owner->properties.getWithDefault (getLastXProp (type), Random::getSystemRandom().nextInt (500)),
                        owner->properties.getWithDefault (getLastYProp (type), Random::getSystemRandom().nextInt (500)));

    owner->properties.set (getOpenProp (type), true);

    setVisible (true);

    activePluginWindows.add (this);
}
コード例 #22
0
void PianoGridNote::continueDragging (const MouseEvent& e)
{
    int originalX = getX();
    int originalY = getY();

    dragger.dragComponent (this, e);

    int newNote = -1;
    float newBeat = -1;
    if (owner->getRowsColsByMousePosition (getX(), getY(), newNote, newBeat, e.mods.isAltDown()))
    {
        if (newNote != note || newBeat != beat)
        {
            owner->moveNote (this, newNote, newBeat);
        }

        setBounds (owner->getNoteRect (this));
    }
    else
    {
        setTopLeftPosition (originalX, originalY);
    }
}
コード例 #23
0
void AutomationEvent::continueDragging (const MouseEvent& e)
{
    int originalX = getX();
    int originalY = getY();

    dragger.dragComponent (this, e);

    double newValue = -1;
    double newBeat = -1;
    if (owner->getRowsColsByMousePosition (getX(), getY(), newValue, newBeat, e.mods.isAltDown()))
    {
        if (newValue != value || newBeat != beat)
        {
            owner->moveEvent (this, newBeat, newValue);
        }

        setBounds (owner->getNoteRect (this));
    }
    else
    {
        setTopLeftPosition (originalX, originalY);
    }
}
コード例 #24
0
void EnvelopeHandleComponent::setTimeAndValue(double timeToSet, double valueToSet, double quantise)
{
	bool oldDontUpdateTimeAndValue = dontUpdateTimeAndValue;
	dontUpdateTimeAndValue = true;

#ifdef MYDEBUG
	printf("MyEnvelopeHandleComponent::setTimeAndValue original (%f, %f)\n", timeToSet, valueToSet);
#endif
	
	if(quantise > 0.0) {
		int steps;

		steps		= valueToSet / quantise;
		valueToSet	= steps * quantise;
		steps		= timeToSet  / quantise;
		timeToSet	= steps * quantise;
		
#ifdef MYDEBUG
		printf("MyEnvelopeHandleComponent::setTimeAndValue quantised (%f, %f)\n", timeToSet, valueToSet);
#endif
	}
	
//	valueToSet = getParentComponent()->quantiseValue(valueToSet);
//	timeToSet = getParentComponent()->quantiseDomain(timeToSet);
	
	value = constrainValue(valueToSet);
	time = constrainDomain(timeToSet);
	
	setTopLeftPosition(getParentComponent()->convertDomainToPixels(time), 
					   getParentComponent()->convertValueToPixels(value));
	
	dontUpdateTimeAndValue = oldDontUpdateTimeAndValue;
	
	getParentComponent()->repaint();
	getParentComponent()->sendChangeMessage();
}
コード例 #25
0
    void updateLocation (const bool canDoExternalDrag, const Point<int>& screenPos)
    {
        // (note: use a local copy of this in case a callback runs a modal loop and deletes
        // this object before it returns)
        DragAndDropTarget::SourceDetails details (sourceDetails);

        Point<int> newPos (screenPos + imageOffset);

        if (getParentComponent() != nullptr)
            newPos = getParentComponent()->getLocalPoint (nullptr, newPos);

        //if (newX != getX() || newY != getY())
        {
            setTopLeftPosition (newPos.getX(), newPos.getY());

            Point<int> relPos;
            DragAndDropTarget* const newTarget = findTarget (screenPos, relPos);
            Component* newTargetComp = dynamic_cast <Component*> (newTarget);

            drawImage = (newTarget == nullptr) || newTarget->shouldDrawDragImageWhenOver();

            if (newTargetComp != currentlyOverComp)
            {
                DragAndDropTarget* const lastTarget = getCurrentlyOver();

                if (lastTarget != nullptr && details.sourceComponent != nullptr
                      && lastTarget->isInterestedInDragSource (details))
                    lastTarget->itemDragExit (details);

                currentlyOverComp = newTargetComp;

                if (newTarget != nullptr)
                {
                    details.localPosition = relPos;

                    if (newTarget->isInterestedInDragSource (details))
                        newTarget->itemDragEnter (details);
                }
            }

            {
                DragAndDropTarget* const target = getCurrentlyOver();
                if (target != nullptr)
                {
                    details.localPosition = relPos;

                    if (target->isInterestedInDragSource (details))
                        target->itemDragMove (details);
                }
            }

            if (getCurrentlyOver() == nullptr && canDoExternalDrag && ! hasCheckedForExternalDrag)
            {
                if (Desktop::getInstance().findComponentAt (screenPos) == nullptr)
                {
                    hasCheckedForExternalDrag = true;
                    StringArray files;
                    bool canMoveFiles = false;

                    if (owner->shouldDropFilesWhenDraggedExternally (details, files, canMoveFiles)
                         && files.size() > 0)
                    {
                        WeakReference<Component> thisWeakRef (this);
                        setVisible (false);

                        if (ModifierKeys::getCurrentModifiersRealtime().isAnyMouseButtonDown())
                            DragAndDropContainer::performExternalDragDropOfFiles (files, canMoveFiles);

                        delete thisWeakRef.get();
                        return;
                    }
                }
            }
        }
    }