Esempio n. 1
0
void ChildAlias::mouseDrag (const MouseEvent& e)
{
if (e.mods.isLeftButtonDown()){
   if (e.eventComponent == resizer)
   {
   }
   else
   {
      if (!e.mouseWasClicked ())
      {
		 constrainer->setMinimumOnscreenAmounts(getHeight(), getWidth(), getHeight(), getWidth());
         dragger.dragComponent (this,e, constrainer);
         applyToTarget ("");
		 if(type.containsIgnoreCase("juce::GroupComponent")||
					type.containsIgnoreCase("CabbageImage"))
			toBack();
      }
   }
   if(type.containsIgnoreCase("juce::GroupComponent")||
	   type.containsIgnoreCase("CabbageImage"))
	   toBack();
   else 
	   toFront(true);
}//end of left click check
}
//==============================================================================
void PianoGridNote::startResizing (const MouseEvent& e)
{
    isResizing = true;

    toFront (true);
    repaint ();
}
bool GUIWebPageOrganizer::OnEvent(Event*e)
{
	bool res=IGUIPanelElement::OnEvent(e);
	if(e->getType()==ET_Keyboard)
	{
		KeyboardEvent* evt=(KeyboardEvent*)e;

		if(evt->Char=='`')
		{
			_SwitchFullscreen();
		}
	}
	if(res)
	{
		for(int i=0;i<m_pages.size();++i)
		{
			if(GetCreator()->GetFocusElement()==m_pages[i])
			{
				m_activePage=i;
				toFront(m_pages[i]);


				break;
			}
		}
	}
	return res;
}
Esempio n. 4
0
TestClassPropertyIterator::TestClassPropertyIterator(const QHash<QScriptString, TestClass::CustomProperty*> &props,
                                     const QScriptValue &object)
    : QScriptClassPropertyIterator(object)
{
    m_props = props;
    toFront();
}
void TooltipWindow::displayTip (Point<int> screenPos, const String& tip)
{
    jassert (tip.isNotEmpty());

    if (! reentrant)
    {
        ScopedValueSetter<bool> setter (reentrant, true, false);

        if (tipShowing != tip)
        {
            tipShowing = tip;
            repaint();
        }

        if (Component* const parent = getParentComponent())
        {
            updatePosition (tip, parent->getLocalPoint (nullptr, screenPos),
                            parent->getLocalBounds());
        }
        else
        {
            updatePosition (tip, screenPos, Desktop::getInstance().getDisplays()
                                                .getDisplayContaining (screenPos).userArea);

            addToDesktop (ComponentPeer::windowHasDropShadow
                            | ComponentPeer::windowIsTemporary
                            | ComponentPeer::windowIgnoresKeyPresses);
        }

        toFront (false);
    }
}
Esempio n. 6
0
void SplashScreen::show (const String& title,
                         const int width,
                         const int height,
                         const int minimumTimeToDisplayFor,
                         const bool useDropShadow,
                         const bool removeOnMouseClick)
{
    setName (title);
    setAlwaysOnTop (true);
    setVisible (true);
    centreWithSize (width, height);

    addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0);
    toFront (false);

   #if JUCE_MODAL_LOOPS_PERMITTED
    MessageManager::getInstance()->runDispatchLoopUntil (300);
   #endif

    repaint();

    originalClickCounter = removeOnMouseClick
                                ? Desktop::getMouseButtonClickCounter()
                                : std::numeric_limits<int>::max();

    earliestTimeToDelete = Time::getCurrentTime() + RelativeTime::milliseconds (minimumTimeToDisplayFor);

    startTimer (50);
}
Esempio n. 7
0
void LightingWindow::setConfig(const LightConfig& config) {
  MessageManagerLock l;
  setTopLeftPosition(config.visualizer.topLeft.x, config.visualizer.topLeft.y);
  instrumentGrid_->setConfig(config);
  toFront(true);
  initialized_ = true;
}
Esempio n. 8
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);


}
void TopLevelWindow::recreateDesktopWindow()
{
    if (isOnDesktop())
    {
        Component::addToDesktop (getDesktopWindowStyleFlags());
        toFront (true);
    }
}
//==============================================================================
void PianoGridNote::startVelocity (const MouseEvent& e)
{
    isEditingVelocity = true;

    setMouseCursor (MouseCursor (MouseCursor::UpDownResizeCursor));

    toFront (true);
    repaint ();
}
Esempio n. 11
0
void TopLevelWindow::visibilityChanged()
{
    if (isShowing()
         && (getPeer()->getStyleFlags() & (ComponentPeer::windowIsTemporary
                                            | ComponentPeer::windowIgnoresKeyPresses)) == 0)
    {
        toFront (true);
    }
}
//==============================================================================
void MidiGridItem::startDragging (const MouseEvent& e)
{
    isDragging = true;

    dragger.startDraggingComponent (this, 0);

    toFront (true);
    repaint ();
}
void QScriptValueIteratorImpl::setObject(const QScriptValueImpl &obj)
{
    Q_ASSERT(obj.isObject());
    m_object = obj;
    if (m_classDataIterator) {
        delete m_classDataIterator;
        m_classDataIterator = 0;
    }
    toFront();
}
//==============================================================================
PianoGridNote::PianoGridNote (PianoGrid* owner_)
  : note (0),
    length (0.0f),
    velocity (1.0f),
    owner (owner_),
    isResizing (false),
    isEditingVelocity (false)
{
    setOpaque (false);
    toFront (false);
}
//==============================================================================
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);
}
int MNullBreakIterator::previous(int index)
{
    Q_D(MNullBreakIterator);
    int previous = index - 1;
    if (previous < 0) {
        previous = -1;
        toFront();
    }
    d->current = previous;
    return previous;
}
Esempio n. 17
0
void SplashScreen::makeVisible (int w, int h, bool useDropShadow)
{
    clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter();
    creationTime = Time::getCurrentTime();

    setAlwaysOnTop (true);
    setVisible (true);
    centreWithSize (w, h);
    addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0);
    toFront (false);
}
    BluetoothMidiSelectorOverlay()
    {
        setAlwaysOnTop (true);
        setVisible (true);
        addToDesktop (ComponentPeer::windowHasDropShadow);
        setBounds (0, 0, getParentWidth(), getParentHeight());
        toFront (true);

        addAndMakeVisible (bluetoothDevicesList);
        enterModalState (true, nullptr, true);
    }
void InterpolationSpacePreset::mouseDown (const MouseEvent& e)
{
  if (e.mods.isPopupMenu())
  {
    PopupMenu m;

    if (AudioProcessorGraph::Node::Ptr f = audioEngine.getDoc().getNodeForId (nodeID))
    {
      AudioProcessor* const processor = f->getProcessor();
      jassert (processor != nullptr);
      
      if(!InternalPluginFormat::isInternalFormat(processor->getName()))
      {
        m.addItem (1, TRANS("Delete Preset"));
        m.addItem (2, TRANS("Rename Preset"));
        m.addItem (3, TRANS("Update Preset"));
        m.addItem (4, TRANS("Randomize Preset"));
        m.addItem (5, TRANS("Set Colour"));
      }
    }
    
    const int r = m.show();
    
    if (r == 1)
    {
      audioEngine.getDoc().removePreset(nodeID, presetId);
    }
    else if (r == 2)
    {
      label->showEditor();
    }
    else if (r == 3)
    {
//      ColourSelector* colourSelector = new ColourSelector(ColourSelector::showSliders|ColourSelector::showColourAtTop|ColourSelector::showColourspace);
//      colourSelector->setName ("background");
//      colourSelector->setCurrentColour (audioEngine.getDoc().getNodeColour(nodeID));
//      colourSelector->addChangeListener (this);
//      colourSelector->setColour (ColourSelector::backgroundColourId, Colours::lightgrey);
//      colourSelector->setSize (300, 400);
//      
//      CallOutBox::launchAsynchronously (colourSelector, getScreenBounds(), nullptr);
    }
  }
  else
  {
    myDragger.startDraggingComponent (this, e);
    toFront (true);
    startBounds = getBounds();
    dragging = true;
    dynamic_cast<PMixInterpolationSpaceLayout*>(getParentComponent())->getLassoSelection().selectOnly(this);
  }
}
Esempio n. 20
0
void
ActivityWindow::_SetAlwaysOnTop(bool alwaysOnTop)
{
    SetFeel(alwaysOnTop ? B_FLOATING_ALL_WINDOW_FEEL : B_NORMAL_WINDOW_FEEL);
    fAlwaysOnTop->SetMarked(alwaysOnTop);
    if (fSettingsWindow.IsValid() && alwaysOnTop) {
        // Change the settings window feel to modal (via scripting)
        BMessage toFront(B_SET_PROPERTY);
        toFront.AddSpecifier("Feel");
        toFront.AddInt32("data", B_MODAL_ALL_WINDOW_FEEL);
        fSettingsWindow.SendMessage(&toFront);
    }
}
Esempio n. 21
0
void TooltipWindow::showFor (const String& tip)
{
    jassert (tip.isNotEmpty());
    if (tipShowing != tip)
        repaint();

    tipShowing = tip;

    Point<int> mousePos (Desktop::getMousePosition());
    Rectangle<int> parentArea;

    if (getParentComponent() != nullptr)
    {
        mousePos = getParentComponent()->getLocalPoint (nullptr, mousePos);
        parentArea = getParentComponent()->getLocalBounds();
    }
    else
    {
        parentArea = Desktop::getInstance().getMonitorAreaContaining (mousePos);
    }

    int w, h;
    getLookAndFeel().getTooltipSize (tip, w, h);

    int x = mousePos.x;
    if (x > parentArea.getCentreX())
        x -= (w + 12);
    else
        x += 24;

    int y = mousePos.y;
    if (y > parentArea.getCentreY())
        y -= (h + 6);
    else
        y += 6;

    x = jlimit (parentArea.getX(), parentArea.getRight() - w, x);
    y = jlimit (parentArea.getY(), parentArea.getBottom() - h, y);

    setBounds (x, y, w, h);
    setVisible (true);

    if (getParentComponent() == nullptr)
    {
        addToDesktop (ComponentPeer::windowHasDropShadow
                      | ComponentPeer::windowIsTemporary
                      | ComponentPeer::windowIgnoresKeyPresses);
    }

    toFront (false);
}
void ChildAlias::mouseDown (const MouseEvent& e)
{
    toFront (true);
    if (e.eventComponent == resizer)
    {
    }
    else
    {
        dragger.startDraggingComponent (this,0);
    }
    userAdjusting = true;
    startBounds = getBounds ();
    userStartedChangingBounds ();
}
//! returns the previous boundary from the given index value or -1 if none exists.
//! The current index is updated to the resulting value.
int MIcuBreakIterator::previous(int index)
{
    Q_D(MIcuBreakIterator);

    int result = d->icuIterator->preceding(index);

    if (result == BreakIterator::DONE) {
        result = -1;
        toFront();
    }

    d->current = result;
    return result;
}
Esempio n. 24
0
void TooltipWindow::displayTip (Point<int> screenPos, const String& tip)
{
    jassert (tip.isNotEmpty());

    if (! reentrant)
    {
        ScopedValueSetter<bool> setter (reentrant, true, false);

        if (tipShowing != tip)
        {
            tipShowing = tip;
            repaint();
        }

        if (auto* parent = getParentComponent())
        {
            updatePosition (tip, parent->getLocalPoint (nullptr, screenPos),
                            parent->getLocalBounds());
        }
        else
        {
            updatePosition (tip, screenPos, Desktop::getInstance().getDisplays()
                                                .getDisplayContaining (screenPos).userArea);

            addToDesktop (ComponentPeer::windowHasDropShadow
                            | ComponentPeer::windowIsTemporary
                            | ComponentPeer::windowIgnoresKeyPresses
                            | ComponentPeer::windowIgnoresMouseClicks);
        }

       #if JUCE_DEBUG
        activeTooltipWindows.addIfNotAlreadyThere (this);

        for (auto* w : activeTooltipWindows)
        {
            if (w != this && w->tipShowing == tipShowing)
            {
                // Looks like you have more than one TooltipWindow showing the same tip..
                // Be careful not to create more than one instance of this class!
                jassertfalse;
            }
        }
       #endif

        toFront (false);
    }
}
void HostFilterComponent::menuItemSelected (int menuItemID,
                                            int topLevelMenuIndex)
{
    Config* config = Config::getInstance();
    GraphComponent* graph = main->getGraph ();

    switch (topLevelMenuIndex)
    {
    case 0: // CommandCategories::file
        {
            // handle recent plugins selection
            int fileID = menuItemID - CommandIDs::recentPlugins;
            if (fileID >= 0 && fileID < config->recentPlugins.getNumFiles())
            {
                File fileToLoad = config->recentPlugins.getFile (fileID);

                if (graph)
                    graph->loadAndAppendPlugin (config->recentPlugins.getFile (fileID), 100, 100);

                break;
            }

            // handle recent session selection
            fileID = menuItemID - CommandIDs::recentSessions;
            if (fileID >= 0 && fileID < config->recentSessions.getNumFiles())
            {
                MemoryBlock fileData;
                File fileToLoad = config->recentSessions.getFile (fileID);

                if (fileToLoad.existsAsFile()
                    && fileToLoad.loadFileAsData (fileData))
                {
                    getFilter ()->setStateInformation (fileData.getData (), fileData.getSize());

                    Config::getInstance()->addRecentSession (fileToLoad);
                    Config::getInstance()->lastSessionFile = fileToLoad;
                }
            }
            break;
        }
    }

    toFront (true);
}
Esempio n. 26
0
void CanvasWidget::mousePressEvent(QMouseEvent *event) {

    pressedPoint.x = event->localPos().x();
    pressedPoint.y = event->localPos().y();

    selected = NULL;
    transformation = NONE;
    for(unsigned i = shapes.size(); i > 0; i--) {
        if(shapes[i - 1]->belongs(pressedPoint)) {
            //Нажали на фигуру
            toFront(i - 1); //переместилю фигуру вперед
            selected = shapes[shapes.size() - 1]; //Запоминаем последню выбранную фигуры
            if (selected != NULL && selectedShapes.size() == 1)
                emit shapeSelected(selected->getType());
            //Проверяем нажатие на контроллер масштабирования (левый верхний)
            if(selected->isTopLeft(pressedPoint, epsilon)) {
                topLeftResize = true;
            } else if(selected->isBottomRight(pressedPoint, epsilon)) {
                bottomRightResize = true;
            } else if(selected->isBottomLeft(pressedPoint, epsilon)) {
               bottomLeftResize = true;
            } else if(selected->isTopRight(pressedPoint, epsilon)) {
               topRightResize = true;
                // transformation = LEFT_RESIZE;
            }

            if (transformation == LEFT_RESIZE || transformation == RIGHT_RESIZE) //Оставляем только одну выделенную фигуру6 которую хотим масштабировать
                clearSelectedShapes();
            if (havingShapeInSelectedShapes(selected))
                transformation = MOVING;
             insertShapeInSelectedShapes(selected);

            if(selected->getType() == 2) {
                if(((QtParallelogram*)selected)->isControlPoint(pressedPoint, epsilon)) {
                    controlPointModify = true;
                }
            }

            pressedPoint -= selected->getCenter();
            break;
        }
    }
}
Esempio n. 27
0
void SplashScreen::makeVisible (int w, int h, bool useDropShadow, bool fullscreen)
{
    clickCountToDelete = Desktop::getInstance().getMouseButtonClickCounter();
    creationTime = Time::getCurrentTime();

    const Rectangle<int> screenSize = Desktop::getInstance().getDisplays().getMainDisplay().userArea;
    const int width  = (fullscreen ? screenSize.getWidth()   : w);
    const int height = (fullscreen ? screenSize.getHeight()  : h);

    setAlwaysOnTop (true);
    setVisible (true);
    centreWithSize (width, height);
    addToDesktop (useDropShadow ? ComponentPeer::windowHasDropShadow : 0);

    if (fullscreen)
        getPeer()->setFullScreen (true);

    toFront (false);
}
Esempio n. 28
0
LoadingWindow::LoadingWindow()
:               DocumentWindow (String::empty,
                                Colours::lightgrey,
                                0,
                                false)

{
    loadingComponent = new LoadingComponent();
    
    addToDesktop(getDesktopWindowStyleFlags());
    setTitleBarHeight(0); 
    
    //set loading component to own the content of the loading window
    setContentOwned(loadingComponent, false); 
    
    centreWithSize (500, 200);
    toFront(true);
    
    setVisible (true);
}
Esempio n. 29
0
    void mouseDown (const MouseEvent& e)
    {
        originalPos = localPointToGlobal (Point<int>());

        toFront (true);

        if (e.mods.isPopupMenu())
        {
            PopupMenu m;
            m.addItem (1, "Delete this filter");
            m.addItem (2, "Disconnect all pins");
            m.addSeparator();
            m.addItem (3, "Show plugin UI");
            m.addItem (4, "Show all parameters");

            const int r = m.show();

            if (r == 1)
            {
                graph.removeFilter (filterID);
                return;
            }
            else if (r == 2)
            {
                graph.disconnectFilter (filterID);
            }
            else if (r == 3 || r == 4)
            {
                AudioProcessorGraph::Node::Ptr f (graph.getNodeForId (filterID));

                if (f != nullptr)
                {
                    PluginWindow* const w = PluginWindow::getWindowFor (f, r == 4);

                    if (w != nullptr)
                        w->toFront (true);
                }
            }
        }
    }
void VstPluginWindow::menuItemSelected (int menuItemID,
                                        int topLevelMenuIndex)
{
    if ((menuItemID & PluginMenuCommandIDMask) == PluginMenuCommandIDMask)
        specialEditor->menuItemSelected(combinedMenuNames[topLevelMenuIndex], (menuItemID & ~PluginMenuCommandIDMask));

    else if (topLevelMenuIndex == combinedMenuNames.indexOf(CommandCategories::presets))
    {
		switch (menuItemID)
		{
		case 1:
			loadPreset ();
			break;
		case 2:
			savePreset ();
			break;
		default:
			if (menuItemID >= 100 && menuItemID < (100 + plugin->getNumPrograms ()))
			{
				plugin->setCurrentProgram (menuItemID - 100);
				updateParameters ();
			}
		}
	}
    else if (topLevelMenuIndex == combinedMenuNames.indexOf(CommandCategories::options))
	{
		if (menuItemID == 1)
		{
			bool keysVisible = plugin->getBoolValue (PROP_WINDOWVISIBLEMIDIKEY, true);

			if (content)
				content->activateMidiKeyboard (! keysVisible);

			plugin->setValue (PROP_WINDOWVISIBLEMIDIKEY, ! keysVisible);
		}
	}

    toFront (false);
}