コード例 #1
0
ファイル: HoaMapComponent.cpp プロジェクト: CICM/HoaLibrary
void HoaMapComponent::mouseMove(const MouseEvent &event)
{
    Point<float> point;
    Point<float> mouse = event.getPosition().toFloat();
    mouse.applyTransform(AffineTransform::fromTargetPoints(0, 0, -1, 1, getWidth(), 0, 1, 1, getWidth(), getWidth(), 1, -1));
    
    m_source_selected   = -1;
    for (int i = 0; i < m_sources->getNumberOfSources(); i++)
    {
        if(m_sources->sourceGetExistence(i))
        {
            point.setXY(m_sources->sourceGetAbscissa(i) * m_sources->getZoom(), m_sources->sourceGetOrdinate(i) * m_sources->getZoom());
            if(mouse.getDistanceFrom(point) < m_sources_size * 0.002)
            {
                m_source_selected = i;
                setMouseCursor(MouseCursor::PointingHandCursor);
                repaint();
                return;
            }
        }
    }
    m_drag_mode = 0;
    repaint();
    setMouseCursor(MouseCursor::NormalCursor);
}
コード例 #2
0
ファイル: tool_pick.cpp プロジェクト: CCChaos/RyzomCore
// **********************************************
void CToolPick::updateAfterRender()
{
	//H_AUTO(R2_CToolPick_updateAfterRender)
	// See if the mouse is over a valid position
	_ValidPos = false;
	sint32 mouseX,  mouseY;
	getMousePos(mouseX,  mouseY);
	if (!isInScreen(mouseX,  mouseY))
	{
		getEditor().setFocusedInstance(NULL);
		setMouseCursor(_CursCannotPickPos);
		return;
	}
	_CandidateInstance = NULL;
	CInstance *instanceUnder = checkInstanceUnderMouse();
	bool ignoreInstanceUnder = false;
	if(instanceUnder && _IgnoreInstances.size()>0)
	{
		for(uint i=0; i<_IgnoreInstances.size(); i++)
		{
			if(instanceUnder->isKindOf(_IgnoreInstances[i]))
			{
				ignoreInstanceUnder = true;
				break;
			}
		}
	}
	if (!instanceUnder || ignoreInstanceUnder)
	{
		if (isMouseOnUI() && !isMouseOnContainer())
		{
			setMouseCursor(DEFAULT_CURSOR);
		}
		else
		{
			CTool::CWorldViewRay worldViewRay;
			computeWorldViewRay(mouseX,  mouseY,  worldViewRay);
			CVector inter;
			_ValidPos = (ValidPacsPos == computeLandscapeRayIntersection(worldViewRay,  _Intersection));
			setMouseCursor(_ValidPos ? _CursCanPickPos : _CursCannotPickPos);
			getEditor().setFocusedInstance(NULL);
		}
		return;
	}
	getEditor().setFocusedInstance(instanceUnder);
	if (canPick(*instanceUnder))
	{
		_CandidateInstance = instanceUnder;
		setMouseCursor(_CursCanPickInstance);
	}
	else
	{
		setMouseCursor(_CursCannotPickInstance);
	}
}
コード例 #3
0
//==============================================================================
void PianoGridNote::mouseMove (const MouseEvent& e)
{
    if (e.x >= getWidth() - 2)
    {
        setMouseCursor (MouseCursor (MouseCursor::LeftRightResizeCursor));
    }
    else
    {
        setMouseCursor (MouseCursor (MouseCursor::NormalCursor));
    }
}
コード例 #4
0
void stepQuickEdit::mouseMove (const MouseEvent &e)
{
	if (e.x > 4 && e.x < 124 && e.y > 2 && e.y < 16)
	{
		setMouseCursor (MouseCursor::DraggingHandCursor);
	}
	else
	{
		setMouseCursor (MouseCursor::NormalCursor);
	}
}
コード例 #5
0
ファイル: SidebarPanel.cpp プロジェクト: gsenna/cabbage
//--------------------------------------------------------------------
void SidebarPanel::mouseEnter(const MouseEvent& event)
{
    const int xPos = event.getPosition().getX();

    if(!event.mods.isLeftButtonDown() && xPos>getWidth()-10)
    {
        setMouseCursor (MouseCursor::LeftRightResizeCursor);
        canResize=true;
    }
    else
        setMouseCursor (MouseCursor::NormalCursor);
}
コード例 #6
0
ファイル: PluginEditor.cpp プロジェクト: dimibil/HoaLibrary
void HoaplugAudioProcessorEditor::mouseMove (const MouseEvent &event)
{
    Point<int> mouse = event.getPosition();
    Rectangle<int> clickable(70, 40, 20, 20);
    //Rectangle<int> clickable(0, 0, 20, 20);
    cicm_link_over = false;
    setMouseCursor(MouseCursor::NormalCursor);
    if (clickable.contains(mouse)) {
        cicm_link_over = true;
        setMouseCursor(MouseCursor::PointingHandCursor);
    }
    //repaint();
}
コード例 #7
0
ファイル: tool_create_entity.cpp プロジェクト: mixxit/solinia
//***************************************************************
void CToolCreateEntity::updateInvalidCursorOnUI()
{
	//H_AUTO(R2_CToolCreateEntity_updateInvalidCursorOnUI)
	// set the default cursor unless the mouse is on the palette
	const std::vector<CInterfaceGroup *> &groups = getUI().getGroupsUnderPointer();
	for(uint k = 0; k < groups.size(); ++k)
	{
		if (groups[k]->getId() == "ui:interface:r2ed_palette") // hardcoded for now ...
		{
			setMouseCursor(_CursValid);
			return;
		}
	}
	setMouseCursor(DEFAULT_CURSOR);
}
コード例 #8
0
void
WorldInputCmdProcessor::evaluateMouseEvents()
{
    iXY world_pos;
    iXY mouse_pos;

    MouseInterface::getMousePosition( &mouse_pos.x, &mouse_pos.y );
    WorldViewInterface::getViewWindow( &world_win );

    WorldViewInterface::clientXYtoWorldXY( world_win, mouse_pos, &world_pos );
    setMouseCursor(getCursorStatus(world_pos));

    if(selection_box_active) {
        box_release = world_pos;
        if(abs(box_release.x - box_press.x) > 3
                    && abs(box_release.y - box_press.y) > 3) {
            selectBoundBoxUnits();
        }
    }

    while( !MouseInterface::event_queue.empty() ) {
        MouseEvent event = MouseInterface::event_queue.front();
        MouseInterface::event_queue.pop_front();

        if( event.button == MouseInterface::left_button )
            evalLeftMButtonEvents(event);

        if( event.button == MouseInterface::right_button )
            evalRightMButtonEvents(event);
    }
}
コード例 #9
0
void GraphComponent::mouseUp (const MouseEvent& e)
{
    if (e.mods.isLeftButtonDown())
    {
        lassoComponent->endLasso ();
    }
    else if (e.mods.isMiddleButtonDown ())
    {
    }
    else if (e.mods.isRightButtonDown ())
    {
        // try to open internal plugins
        BasePlugin* newPlugin = PluginLoader::handlePopupMenu (false, 0, owner->getFilter());

        // now open plugin
        if (host && newPlugin)
        {
            host->openPlugin (newPlugin);
            host->addPlugin (newPlugin);

            newPlugin->setValue (PROP_GRAPHXPOS, e.x);
            newPlugin->setValue (PROP_GRAPHYPOS, e.y);

            createPluginNode (newPlugin);
        }
    }
    
    lassoComponent->endLasso ();
    setMouseCursor (MouseCursor::NormalCursor);
}
コード例 #10
0
void GraphComponent::mouseDrag (const MouseEvent& e)
{
    if (e.mods.isLeftButtonDown())
    {
        lassoComponent->toFront (false);
        lassoComponent->dragLasso (e);
    }
    else if (e.mods.isMiddleButtonDown ())
    {
        Viewport* parent = findParentComponentOfClass ((Viewport*) 0);
        if (parent)
        {
            int x = dragStartX - e.getDistanceFromDragStartX ();
            int y = dragStartY - e.getDistanceFromDragStartY ();

            Component* comp = parent->getViewedComponent ();
            if (comp)
            {
                x = jmax (0, jmin (comp->getWidth () - parent->getViewWidth (), x));
                y = jmax (0, jmin (comp->getHeight () - parent->getViewHeight (), y));
            }
            
            parent->setViewPosition (x, y);
            
            setMouseCursor (MouseCursor::DraggingHandCursor);
        }
    }
    else if (e.mods.isRightButtonDown ())
    {
    }
}
コード例 #11
0
EnvelopeComponent::EnvelopeComponent()
:	minNumHandles(0),
	maxNumHandles(0xffffff),
	domainMin(0.0),
	domainMax(1.0),
	valueMin(0.0),
	valueMax(1.0),
	valueGrid((valueMax-valueMin) / 10),
	domainGrid((domainMax-domainMin) / 16),
	gridDisplayMode(GridNone),
	gridQuantiseMode(GridNone),
	draggingHandle(0),
	curvePoints(64),
	releaseNode(-1),
	loopNode(-1),
	allowCurveEditing(true),
	allowNodeEditing(true)
{
	setMouseCursor(MouseCursor::NormalCursor);
	setBounds(0, 0, 200, 200); // non-zero size to start with
		
	colours[Node]				= 0xFF69B4FF;
	colours[ReleaseNode]		= 0xB469FFFF;
	colours[LoopNode]			= 0x69FFB4FF;
	colours[Line]				= 0xFFFFFFFF;
	colours[LoopLine]			= 0xB469FFFF;
	colours[Background]			= 0x555555FF;
	colours[GridLine]			= 0x888888FF;
	colours[LegendText]			= 0x000000FF;
	colours[LegendBackground]	= 0x696969FF;
}
コード例 #12
0
ファイル: HoaMap.cpp プロジェクト: dimibil/HoaLibrary
void HoaMap::mouseDrag (const MouseEvent &event)
{
    Point<float> mouse = event.getPosition().toFloat();
    Point<float> newPos;
    ModifierKeys modifierKey = event.mods;
    // conversion en cartesien :
    //mouse.applyTransform(AffineTransform::translation(m_padding, m_padding));
    mouse.applyTransform(AffineTransform::fromTargetPoints(0, 0, -1, 1,
                                                           getPadWidth(), 0, 1, 1,
                                                           getPadWidth(), getPadWidth(), 1, -1));
    
    newPos = mouse;
    
    if (m_sourcePointed >= 0 && m_sourcePointed < m_nbSources) {
        setMouseCursor(MouseCursor::DraggingHandCursor);
        m_sources_dragState[m_sourcePointed] = -1; // reset dragging state
        m_sources_ValueChanged[m_sourcePointed] = 1;
        if (modifierKey.isShiftDown()) { // constrain move to distance
            setPolarCoordinates(m_sourcePointed, Tools::radius(newPos.x, newPos.y), m_sources[m_sourcePointed].getAzimuth());
        }
        else if (modifierKey.isCtrlDown()) { // constrain move to angle
            setPolarCoordinates(m_sourcePointed, m_sources[m_sourcePointed].getRadius(), Tools::angle(newPos.x, newPos.y));
        }
        else {
            setCartesianCoordinates(m_sourcePointed, newPos.x, newPos.y, sendNotificationSync);
        }
    }
}
コード例 #13
0
 ItemDragAndDropOverlayComponent()
     : isDragging (false)
 {
     setAlwaysOnTop (true);
     setRepaintsOnMouseActivity (true);
     setMouseCursor (MouseCursor::DraggingHandCursor);
 }
コード例 #14
0
//==============================================================================
void CodeEditorComponent::mouseDown (const MouseEvent& e)
{
    newTransaction();
    dragType = notDragging;

    if (e.mods.isPopupMenu())
    {
        setMouseCursor (MouseCursor::NormalCursor);

        if (getHighlightedRegion().isEmpty())
        {
            CodeDocument::Position start, end;
            document.findTokenContaining (getPositionAt (e.x, e.y), start, end);

            if (start.getPosition() < end.getPosition())
                selectRegion (start, end);
        }

        PopupMenu m;
        m.setLookAndFeel (&getLookAndFeel());
        addPopupMenuItems (m, &e);

        m.showMenuAsync (PopupMenu::Options(),
                         ModalCallbackFunction::forComponent (codeEditorMenuCallback, this));
    }
    else
    {
        beginDragAutoRepeat (100);
        moveCaretTo (getPositionAt (e.x, e.y), e.mods.isShiftDown());
    }
}
コード例 #15
0
void QWidgetResizeHandler::doResize()
{
    if (!activeForResize)
        return;

    moveResizeMode = true;
    moveOffset = widget->mapFromGlobal(QCursor::pos());
    if (moveOffset.x() < widget->width()/2) {
        if (moveOffset.y() < widget->height()/2)
            mode = TopLeft;
        else
            mode = BottomLeft;
    } else {
        if (moveOffset.y() < widget->height()/2)
            mode = TopRight;
        else
            mode = BottomRight;
    }
    invertedMoveOffset = widget->rect().bottomRight() - moveOffset;
#ifndef QT_NO_CURSOR
    setMouseCursor(mode);
    widget->grabMouse(widget->cursor() );
#else
    widget->grabMouse();
#endif
    widget->grabKeyboard();
    resizeHorizontalDirectionFixed = false;
    resizeVerticalDirectionFixed = false;
}
コード例 #16
0
void DraggableWaveDisplay::mouseDown (const MouseEvent &e)
{
	mouseX.setBoth (e.x);
	isMouseDown = true;
	
	if (isDraggable)
	{
		if (mouseShouldTogglePlay)
		{
			if (filePlayer.getAudioTransportSource()->isPlaying())
			{
				shouldBePlaying = true;
				filePlayer.getAudioTransportSource()->stop();
			}
			else
            {
				shouldBePlaying = false;
            }
		}
        
		setMouseCursor (MouseCursor::DraggingHandCursor);
		
		startTimer (waveformMoved, 40);
	}
}
コード例 #17
0
void CodeEditorComponent::mouseUp (const MouseEvent&)
{
    newTransaction();
    beginDragAutoRepeat (0);
    dragType = notDragging;
    setMouseCursor (MouseCursor::IBeamCursor);
}
コード例 #18
0
void EnvelopeHandleComponent::mouseUp(const MouseEvent& e)
{
	(void)e;
    EnvelopeComponent *env = getParentComponent();

#ifdef MYDEBUG
	printf("MyEnvelopeHandleComponent::mouseUp\n");
#endif
	
	if(ignoreDrag == true)
	{
		ignoreDrag = false;
		goto exit;
	}
		
//	if(e.mods.isCtrlDown() == false)
//	{
		env->quantiseHandle(this);
//	}
	
	setMouseCursor(MouseCursor::CrosshairCursor);
	setMousePositionToThisHandle();
	
	offsetX = 0;
	offsetY = 0;
    
exit:
    getParentComponent()->sendEndDrag();
}
コード例 #19
0
ファイル: qwizard_win.cpp プロジェクト: 2gis/2gisqt5android
void QVistaHelper::mouseMoveEvent(QMouseEvent *event)
{
    if (wizard->windowState() & Qt::WindowMaximized) {
        event->ignore();
        return;
    }

    QRect rect = wizard->geometry();
    if (pressed) {
        switch (change) {
        case resizeTop:
            {
                const int dy = event->pos().y() - pressedPos.y();
                if ((dy > 0 && rect.height() > wizard->minimumHeight())
                    || (dy < 0 && rect.height() < wizard->maximumHeight()))
                    rect.setTop(rect.top() + dy);
            }
            break;
        case movePosition: {
            QPoint newPos = event->pos() - pressedPos;
            rect.moveLeft(rect.left() + newPos.x());
            rect.moveTop(rect.top() + newPos.y());
            break; }
        default:
            break;
        }
        wizard->setGeometry(rect);

    } else if (vistaState() == VistaAero) {
        setMouseCursor(event->pos());
    }
    event->ignore();
}
コード例 #20
0
ファイル: juce_HyperlinkButton.cpp プロジェクト: AGenews/GUI
HyperlinkButton::HyperlinkButton ()
   : Button (String::empty),
     font (14.0f, Font::underlined),
     resizeFont (true),
     justification (Justification::centred)
{
    setMouseCursor (MouseCursor::PointingHandCursor);
}
コード例 #21
0
void TimelineCursor::mouseUp(const MouseEvent &e)
{
    if(_showCursor)
    {
        setMouseCursor(MouseCursor::NormalCursor);
        startTimerIfCursorIsVisible();
    }
}
コード例 #22
0
ResizableCornerComponent::ResizableCornerComponent (Component* const componentToResize,
                                                    ComponentBoundsConstrainer* const constrainer_)
   : component (componentToResize),
     constrainer (constrainer_)
{
    setRepaintsOnMouseActivity (true);
    setMouseCursor (MouseCursor::BottomRightCornerResizeCursor);
}
コード例 #23
0
void PianoGridNote::endVelocity (const MouseEvent& e)
{
    isEditingVelocity = false;

    setMouseCursor (MouseCursor (MouseCursor::NormalCursor));

    repaint ();
}
コード例 #24
0
ファイル: rel.cpp プロジェクト: iPodLinux-Community/iScummVM
void loadRel(char *pRelName) {
	uint16 numEntry;
	uint16 i;
	byte *ptr;

	checkDataDisk(-1);

	for (i = 0; i < NUM_MAX_REL; i++) {
		if (relTable[i].data) {
			free(relTable[i].data);
			relTable[i].data = NULL;
			relTable[i].size = 0;
		}
	}

	ptr = readBundleFile(findFileInBundle(pRelName));

	setMouseCursor(MOUSE_CURSOR_DISK);

	numEntry = READ_BE_UINT16(ptr); ptr += 2;

	assert(numEntry <= NUM_MAX_REL);

	for (i = 0; i < numEntry; i++) {
		relTable[i].size = READ_BE_UINT16(ptr); ptr += 2;
		relTable[i].obj1Param1 = READ_BE_UINT16(ptr); ptr += 2;
		relTable[i].obj1Param2 = READ_BE_UINT16(ptr); ptr += 2;
		relTable[i].obj2Param = READ_BE_UINT16(ptr); ptr += 2;
	}

	for (i = 0; i < numEntry; i++) {
		if (relTable[i].size) {
			relTable[i].data = (byte *)malloc(relTable[i].size);

			assert(relTable[i].data);

			memcpy(relTable[i].data, ptr, relTable[i].size);
			ptr += relTable[i].size;
		}
	}

#ifdef DUMP_SCRIPTS

	{
		uint16 s;
		char buffer[256];

		for (s = 0; s < numEntry; s++) {
			if (relTable[s].size) {
				sprintf(buffer, "%s_%03d.txt", pRelName, s);

				decompileScript(relTable[s].data, NULL, relTable[s].size, s);
				dumpScript(buffer);
			}
		}
	}
#endif
}
コード例 #25
0
ファイル: synth_slider.cpp プロジェクト: cameronbroe/helm
void SynthSlider::mouseDown(const MouseEvent& e) {
  SynthGuiInterface* parent = findParentComponentOfClass<SynthGuiInterface>();

  if (e.mods.isPopupMenu()) {
    PopupMenu m;

    if (isDoubleClickReturnEnabled())
      m.addItem(kDefaultValue, "Set to Default Value");

    std::vector<mopo::ModulationConnection*> connections;
    if (parent) {
      m.addItem(kArmMidiLearn, "Learn MIDI Assignment");
      if (parent->isMidiMapped(getName().toStdString()))
        m.addItem(kClearMidiLearn, "Clear MIDI Assignment");

      connections = parent->getDestinationConnections(getName().toStdString());

      String disconnect("Disconnect from ");
      for (int i = 0; i < connections.size(); ++i)
        m.addItem(kModulationList + i, disconnect + connections[i]->source);

      if (connections.size() > 1)
        m.addItem(kClearModulations, "Disconnect all modulations");
    }

    int result = m.show();
    if (result == kArmMidiLearn) {
      parent->armMidiLearn(getName().toStdString(), getMinimum(), getMaximum());
    }
    else if (result == kClearMidiLearn) {
      parent->clearMidiLearn(getName().toStdString());
    }
    else if (result == kDefaultValue) {
      setValue(getDoubleClickReturnValue());
    }
    else if (result == kClearModulations) {
      for (mopo::ModulationConnection* connection : connections) {
        std::string source = connection->source;
        parent->disconnectModulation(connection);
      }
    }
    else if (result >= kModulationList) {
      int connection_index = result - kModulationList;
      std::string source = connections[connection_index]->source;
      parent->disconnectModulation(connections[connection_index]);
    }
  }
  else {
    Slider::mouseDown(e);

    if (parent)
      parent->beginChangeGesture(getName().toStdString());
    if (isRotary()) {
      click_position_ = e.getScreenPosition().toFloat();
      setMouseCursor(MouseCursor::NoCursor);
    }
  }
}
コード例 #26
0
//=================================================================================================
void SelectableComponent::mouseDrag (const MouseEvent& /*event*/)
{
    DragAndDropContainer* dc = findParentComponentOfClass<DragAndDropContainer>();

    if (dc != nullptr)  // 拖拽时产生的描述为父组件的名称
        dc->startDragging(parent->getName(), this, Image(Image::ARGB, 1, 1, true), true);

    setMouseCursor(MouseCursor::DraggingHandCursor);
}
コード例 #27
0
void EnveloppeAbstract::mouseUp (const MouseEvent &event)  {
    if (draggingPointIndex != -1) {
        Desktop::setMousePosition(Point<int>(getScreenX() + pointList[draggingPointIndex].get()->getPositionOnScreenX(),
                getScreenY() + pointList[draggingPointIndex].get()->getPositionOnScreenY()));
        draggingPointIndex = -1;
    }
    setMouseCursor(MouseCursor::NormalCursor);
    repaint();
}
コード例 #28
0
ファイル: HoaMap.cpp プロジェクト: dimibil/HoaLibrary
void HoaMap::mouseMove (const MouseEvent &event)
{
    Point<float> mouse = event.getPosition().toFloat();
    // coordonnées mouse en cartesien :
    mouse.applyTransform(AffineTransform::fromTargetPoints(0, 0, -1, 1,
                                                           getPadWidth(), 0, 1, 1,
                                                           getPadWidth(), getPadWidth(), 1, -1));
    setMouseCursor(MouseCursor::NormalCursor);
    m_sourceOver = -1;
    for (int i = 0; i < m_nbSources; i++) {
        if (mouse.getDistanceFrom(m_sources[i]) < m_sourceSize*0.5 && i <= m_nbSources) {
            m_sourceOver = i;
            setMouseCursor(MouseCursor::PointingHandCursor);
            break;
        }
    }
    repaint();
}
コード例 #29
0
//==============================================================================
void PianoGridNote::startVelocity (const MouseEvent& e)
{
    isEditingVelocity = true;

    setMouseCursor (MouseCursor (MouseCursor::UpDownResizeCursor));

    toFront (true);
    repaint ();
}
コード例 #30
0
void AudioTransportCursor::mouseUp (const MouseEvent& /*e*/)
{
    if (showTransportCursor)
    {
        setMouseCursor (MouseCursor::NormalCursor);

        startTimerIfNeeded();
    }
}