Beispiel #1
0
void KoZoomTool::mouseMoveEvent(KoPointerEvent *event)
{
    updateCursor(event->modifiers() & Qt::ControlModifier);

    if (currentStrategy()) {
        currentStrategy()->handleMouseMove(event->point, event->modifiers());
    }
}
Beispiel #2
0
void SDLFontGL::setupColors(std::vector<SDL_Color> colors) {
	assert(!colors.empty());
	m_colors = colors;

	updateColors();
	// cursor does a manual color lookup
	updateCursor();
}
Beispiel #3
0
void KoZoomTool::keyReleaseEvent(QKeyEvent *event)
{
    event->ignore();

    updateCursor(event->modifiers() & Qt::ControlModifier);

    KoInteractionTool::keyReleaseEvent(event);
}
Beispiel #4
0
void CursorManager::cancelTarget() {
    if (target_) {
        target_->onCancel();
        target_.reset();

        updateCursor();
    }
}
Beispiel #5
0
void CursorManager::setTarget(boost::shared_ptr<targeting::Target> targ) {
    // should we cancel the previous target here? seems like a logical thing to do, but
    // if both the last and current target were induced by the server, runuo interprets the
    // cancelling of the old one wrong (= as cancelling the new one).
    // thus, do not cancel here - for now
    target_ = targ;
    updateCursor();
}
Beispiel #6
0
void AbstractSelection::mouseReleaseEvent(QMouseEvent *event, ImageArea &imageArea)
{
    int right = mTopLeftPoint.x() > mBottomRightPoint.x() ? mTopLeftPoint.x() : mBottomRightPoint.x();
    int bottom = mTopLeftPoint.y() > mBottomRightPoint.y() ? mTopLeftPoint.y() : mBottomRightPoint.y();
    int left = mTopLeftPoint.x() < mBottomRightPoint.x() ? mTopLeftPoint.x() : mBottomRightPoint.x();
    int top = mTopLeftPoint.y() < mBottomRightPoint.y() ? mTopLeftPoint.y() : mBottomRightPoint.y();
    mBottomRightPoint = QPoint(right, bottom);
    mTopLeftPoint = QPoint(left, top);
    if (mIsSelectionExists)
    {
        updateCursor(event, imageArea);
        if (mButton == Qt::RightButton && !mIsMouseMoved)
        {
            showMenu(imageArea);
            paint(imageArea);
            drawBorder(imageArea);
            mIsPaint = false;
            mIsSelectionMoving = mIsImageSelected = false;
        }
        else if (mIsSelectionMoving)
        {
            imageArea.setImage(mImageCopy);
            completeMoving(imageArea);
            paint(imageArea);
            drawBorder(imageArea);
            mIsPaint = false;
            mIsSelectionMoving = false;
        }
        else if (mIsSelectionResizing)
        {
            imageArea.setImage(mImageCopy);
            paint(imageArea);
            completeResizing(imageArea);
            paint(imageArea);
            drawBorder(imageArea);
            mIsPaint = false;
            mIsSelectionResizing = false;
        }
    }
    if (mIsPaint)
    {
        if (event->button() == Qt::LeftButton)
        {
            imageArea.setImage(mImageCopy);
            if (mTopLeftPoint != mBottomRightPoint)
            {
                imageArea.setImage(mImageCopy);
                paint(imageArea);
                completeSelection(imageArea);
                paint(imageArea);
                mIsSelectionExists = true;
            }
            drawBorder(imageArea);
            mIsPaint = false;
        }
    }
    mIsSelectionAdjusting = false;
}
Beispiel #7
0
void readCommand(){
	clearBuffer();
	int pos = 0, line=((typeOffset/2)/VGA_W); //%VGA_H;
	clearLine();
	updateCursor(typeOffset/2);
	key next;
	while(1){
		if(key_queue_is_empty()) continue;
		next = remove_key();
		/*printint(next.scancode);
		print(" ");
		continue;*/
		if(next.scancode==75 && pos>0){pos--;}			//left arrow
		if(next.scancode==77 && pos<bufferLength()-1){pos++;}	//right arrow
		if(next.scancode==72) {
			lookupHistory();
			pos=k_strlen(textBuffer);
		}//up arrow
		if(next.scancode==80) {
			lookdownHistory();
			pos=k_strlen(textBuffer);
		}//down arrow
		if(next.key=='\n') {
			if(typeOffset>(VGA_H-1)*VGA_W*2) {scroll();typeOffset-=2*VGA_W;}
			typeOffset=(typeOffset+VGA_W*2)-(typeOffset/2)%VGA_W*2;
			return;
		}else if(next.key=='\b') {if(pos==0) continue; else charFromBuffer(pos--);}
		else if(next.key=='\t') {
			int num = splitString(textBuffer, ' ');
			int i;
			for(i =0;i<num;i++){argv[i]=stringArray[i];}
			char *ac = autoComp(argv[i-1]);
			while(*ac!=0) {charToBuffer(*ac,pos++); ac++;}
		}else if(next.key!=0) {if(pos>(BUFFERSIZE)/2-4) continue; else charToBuffer(next.key, pos++);}

		if(line==VGA_H-1 && bufferLength()>=VGA_W){scroll();line--;}
		typeOffset = line*VGA_W*2;
		typePrompt();
		int save = typeOffset;
		print(textBuffer);
		clearLine();
		typeOffset = save+pos*2;
		updateCursor(typeOffset/2);
	}
}
Beispiel #8
0
void QWindowCompositor::setCursorSurface(QWaylandSurface *surface, int hotspotX, int hotspotY)
{
    if ((m_cursorSurface != surface) && surface)
        connect(surface, SIGNAL(damaged(QRect)), this, SLOT(updateCursor()));

    m_cursorSurface = surface;
    m_cursorHotspotX = hotspotX;
    m_cursorHotspotY = hotspotY;
}
Beispiel #9
0
bool QDragManager::drag( QDragObject * o, QDragObject::DragMode mode )
{
#ifdef DEBUG_QDND_SRC
    qDebug( "QDragManager::drag ( %p, %d )", o, mode );
#endif

    if ( object == o || !o || !o->parent() )
        return false;

    if ( object ) {
        cancel();
        qApp->removeEventFilter( this );
        beingCancelled = false;
    }

    object = o;
    drag_mode = mode;
    updatePixmap();
    willDrop = FALSE;

#ifndef QT_NO_ACCESSIBILITY
    QAccessible::updateAccessibility( this, 0, QAccessible::DragDropStart );
#endif

    DWORD dwEffect, dwOKEffect;

    QOleDataObject *obj = new QOleDataObject( o );
    QOleDropSource *qsrc = new QOleDropSource();
    src = o->target();
    dwOKEffect = translateToWinDragEffects ( mode );

    updateCursor();
#ifdef Q_OS_TEMP
    HRESULT r = 0;
    resultEffect = 0;
#else
    HRESULT r = DoDragDrop( obj, qsrc, dwOKEffect, &dwEffect );
#endif

#ifndef QT_NO_CURSOR
    QApplication::restoreOverrideCursor();
    restoreCursor = false;
#endif

    // clean up
    obj->releaseQt();
    obj->Release();        // Will delete obj if refcount becomes 0
    qsrc->Release();       // Will delete src if refcount becomes 0
    object = 0;

#ifndef QT_NO_ACCESSIBILITY

    QAccessible::updateAccessibility( this, 0, QAccessible::DragDropEnd );
#endif

    return true;
}
Beispiel #10
0
void QWidget::setCursor( const QCursor &cursor )
{
    createExtra();
    delete extra->curs;
    extra->curs = new QCursor(cursor);
    setWState( WState_OwnCursor );
    if ( isVisible() )
	updateCursor( paintableRegion() );
}
Beispiel #11
0
void NYView::guiSetup()
{
    if(marginLeft > 0 && !getLocalBooleanOption("number")) {
        marginLeft = 0;
    }

    refresh();
    updateCursor();
}
Beispiel #12
0
void ImageViewer::mouseReleaseEvent ( QMouseEvent * event )
{
    velocityTracker->handleMouseRelease(event);

    if(event->button() & Qt::LeftButton){
        leftMousePressed = false;
        updateCursor();
    }
}
Beispiel #13
0
Qt::DropAction QDragManager::drag(QDrag *o)
{
    if (object == o || !o || !o->source())
        return Qt::IgnoreAction;

    if (object) {
        cancel();
        qApp->removeEventFilter(this);
        beingCancelled = false;
    }

    object = drag_object = o;
    qt_qws_dnd_deco = new QShapedPixmapWidget();
    oldstate = Qt::NoModifier; // #### Should use state that caused the drag
//    drag_mode = mode;

    willDrop = false;
    updatePixmap();
    updateCursor();
    restoreCursor = true;
    object->d_func()->target = 0;
    qApp->installEventFilter(this);

    global_accepted_action = Qt::CopyAction;
#ifndef QT_NO_CURSOR
    qApp->setOverrideCursor(Qt::ArrowCursor);
    restoreCursor = true;
    updateCursor();
#endif

    qt_qws_dnd_dragging = true;

    eventLoop = new QEventLoop;
    (void) eventLoop->exec();
    delete eventLoop;
    eventLoop = 0;

    delete qt_qws_dnd_deco;
    qt_qws_dnd_deco = 0;
    qt_qws_dnd_dragging = false;


    return global_accepted_action;
}
Beispiel #14
0
void Console::draw(NVGcontext* ctx){
    Widget::draw(ctx);  

    //Screen *sc = dynamic_cast<Screen *>(this->window()->parent());

    // Draw rounded rectangel around text area ////////////////////
    NVGpaint paint = nvgBoxGradient(
        ctx, mPos.x() + 1, mPos.y() + 1,
        mSize.x()-2, mSize.y(), 3, 4, Color(0, 32), Color(0, 92));
    nvgBeginPath(ctx);
    nvgRoundedRect(ctx, mPos.x(), mPos.y(), mSize.x(), mSize.y(), 3);
    nvgFillPaint(ctx, paint);
    nvgFill(ctx);
    ///////////////////////////////////////////////////////////////
    


    nvgFontSize(ctx, 18.0f);
    nvgFontFace(ctx, "sans");
    nvgTextAlign(ctx, NVG_ALIGN_LEFT|NVG_ALIGN_TOP);
    float x, y, linew, lineh;
    nvgTextMetrics(ctx, nullptr, nullptr, &lineh);
    x = mPos.x();
    y = mPos.y();
    linew = mSize.x();
    
    mNumRows = mSize.y()/lineh ; // make sure that the size of console is updated
    //setSize(Vector2i(mSize.x(), nrows*lineh)); // this code does not work. It
    //changes size each frame. Move from draw into one time function.
    
    // init console output 
    if(mInit) {
        initBuffer(ctx, linew);
        mInit = false;
    }
    //typedef std::deque<std::string> Buffer_t;

    //temp solution: when buffer is not full. Move this to updateFunction.
    for(auto it = mBuffer.begin();it!=mBuffer.end();++it) {

        nvgBeginPath(ctx);
        nvgFillColor(ctx, nvgRGBA(255,255,255,16));
        nvgRect(ctx, x, y, linew, lineh);
        nvgFill(ctx);

        nvgFillColor(ctx, nvgRGBA(255,255,255,255));
        nvgText(ctx, x, y, it->c_str(), nullptr);
        
        y += lineh;
    }
   
    updateCursor(ctx, lineh);
    //update cursor and draw
    //mCaret.onClick(ctx, lineh, mMouseDownPos - mPos);
    mCaret.draw(ctx, lineh, mPos);
}
void ByteArrayColumnViewPrivate::blinkCursor()
{
    // skip the cursor drawing?
    if( mCursorPaused || mValueEditor->isInEditMode() )
        return;

    // switch the cursor state
    mBlinkCursorVisible = !mBlinkCursorVisible;
    updateCursor( *mActiveColumn );
}
Beispiel #16
0
void QWidget::unsetCursor()
{
    if ( extra ) {
	delete extra->curs;
	extra->curs = 0;
    }
    clearWState( WState_OwnCursor );
    if ( isVisible() )
	updateCursor( paintableRegion() );
}
void QCtkXipSGWidget::mousePressEvent(QMouseEvent *event)
{
  if(mInteractingField)
    mInteractingField->setValue(1);

  // store old pos for delta mode
  mOldPos = SbVec2s(event->pos().x(), event->pos().y());



  event->accept();

  // Pass the QT mouse button event to open inventor
  SbTime time;
  time.setToTimeOfDay();
  SoMouseButtonEvent e;
  e.setTime(time);

  switch (event->button())
  {
  default:
  case Qt::LeftButton:    e.setButton(SoMouseButtonEvent::BUTTON1); break;
  case Qt::MidButton:        e.setButton(SoMouseButtonEvent::BUTTON2); break;
  case Qt::RightButton:    e.setButton(SoMouseButtonEvent::BUTTON3); break;
  }
  if (event->modifiers() & Qt::ShiftModifier)
    e.setShiftDown(TRUE);
  if (event->modifiers() & Qt::ControlModifier)
    e.setCtrlDown(TRUE);
  e.setState(SoButtonEvent::DOWN);
  e.setPosition(SbVec2s(event->pos().x(), mHeight - event->pos().y()));

  if (mSceneManager->processEvent(&e))
  {
    //processDelayQueue();
    //repaint();
    updateCursor(true);
  }
  else
  {
    updateCursor(false);
  }
}
Beispiel #18
0
void ImageViewer::layoutImage()
{
    if(hasPicture()) {
        calcScaleRatio();
        calcTopLeft();
        calcShift();
    }

    updateCursor();
}
void ScriptEdit::TextEdit::keyPressEvent(QKeyEvent *e)
{
    updateCursor();

    switch(e->key())
    {
//    case Qt::Key_Space:
//        if(!(e->modifiers() & Qt::ControlModifier)) QTextEdit::keyPressEvent(e);
//        else Kernel::run(document()->toPlainText()); break;

    case Qt::Key_Tab: insert("    "); break;

    case Qt::Key_ParenLeft:
        if(!curChar().isLetterOrNumber()) { insert("()"); moveCursor(-1); }
        else QTextEdit::keyPressEvent(e); break;

    case Qt::Key_ParenRight:
        if(curChar() == ')') moveCursor(1);
        else QTextEdit::keyPressEvent(e); break;

    case Qt::Key_BraceLeft:
        insert("{}"); moveCursor(-1); break;

    case Qt::Key_BraceRight:
        if(curChar() == '}') moveCursor(1);
        else QTextEdit::keyPressEvent(e); break;

    case Qt::Key_Return:
    {
        QString text = document()->toPlainText(), space = "";
        int n = 0;

        for(int i = 0; i < pos(); i++) if(text.at(i) == '{') n++; else if(text.at(i) == '}') n--;
        space.fill(' ', 4*n);

        if(prevChar() == '{')
        {
            insert("\n" + space);
            if(curChar() == '}')
            {
                insert("\n" + space.left(space.length()-4));
                moveCursor(3-4*n);
            }
            break;
        }
        else if(curChar() == '}') { insert("\n" + space.left(space.length()-4)); break; }
        else { insert("\n" + space); break; }

        QTextEdit::keyPressEvent(e); break;
    }

    default: QTextEdit::keyPressEvent(e);
    }
}
Beispiel #20
0
void Cursor::setMouseSelectionType(CursorSelectionType selectionType)
{
	XOJ_CHECK_TYPE(Cursor);

	if (this->selectionType == selectionType)
	{
		return;
	}
	this->selectionType = selectionType;
	updateCursor();
}
Beispiel #21
0
void DisassemblyView::setCursorPosition(int x, int y)
{
  if (!SetCursor(x, y))
    return;

  _cursorTimer.start();
  _cursorBlink = false;
  updateCursor();

  emit cursorAddressUpdated(GetCursorAddress());
}
void CTimelineControl::_OnMouseMove( uiMouseEvent mouseEvent, int x, int y )
{
	if ( m_changeTimeAndValue )
	{
		if ( m_lbuttonDown )
		{
			if ( m_mouseActionState == k_mouseActionChangeTime )
			{
				// drag to change time
				updateChangeTime( x, y );
			}
			else if ( m_mouseActionState == k_mouseActionChangeValue )
			{
				// drag to change value
				updateChangeValue( x,y );
			}
			else
			{
				// drag
				m_currentTime = getTimeValue( x - OFFSET_X + m_crollX );
				checkSelectTime( x, y );
			}

			update();
		}			
	}

	if ( m_rbuttonDown )
	{
		int nWidth = getClientWidth();
		float timeWidth = m_lengthPixel*m_timeLength;
		int limitW = (int)timeWidth + OFFSET_X * 2;

		if ( nWidth < limitW )
		{
			int dx = x - m_x;			
			m_crollX -= dx;
			
			if ( m_crollX < 0 )
				m_crollX = 0;
			else if ( nWidth + m_crollX > limitW  )
			{
				m_crollX = limitW - nWidth;
			}
		}
		update();
	}

	m_x = x;
	m_y = y;

	// update cursor icon
	updateCursor( x, y);
}
void ChannelListWidget::setActive(bool active)
{
    if (m_active == active)
        return;
    m_active = active;
    if (active) {
        connect(m_yellowPage, SIGNAL(updateDone(YellowPage *, bool)),
                this, SLOT(done(YellowPage *, bool)));
        updateCursor();
        updateActions();
    } else {
Beispiel #24
0
void Mouse::update() {
	if (CursorMan.isVisible() && !_surface->getVisible()) {
		CursorMan.showMouse(false);
	} else if (!CursorMan.isVisible() && _surface->getVisible()) {
		CursorMan.showMouse(true);
	}
	updateCursor();
	_frameNum++;
	if (_frameNum >= 6)
		_frameNum = 0;
	_needRefresh = _frameNum % 2 == 0;
}
void KisVisualColorSelectorShape::setColor(KoColor c)
{
    //qDebug() << this  << "KisVisualColorSelectorShape::setColor";
    if (c.colorSpace() != m_d->colorSpace) {
        c.convertTo(m_d->colorSpace);
    }
    m_d->currentColor = c;
    updateCursor();

    m_d->imagesNeedUpdate = true;
    update();
}
 void updateHand(Hand * p)
 {
     if(hands.find(p->id) == hands.end())return;
     if(p->population != 1)
     {
         removeHand(p);
     }
     else
     {
         updateCursor(p);
     }
 }
Beispiel #27
0
Datei: te.c Projekt: thigley/THOS
static void setupte(int filenum){
	int newfile = filenum<0?1:0;
	int i;
	for(i=0;i<VGA_W*VGA_H;i++) file_buffer[i]= 0;

	clearScreen();
	if(filenum>=0){load(filenum);}
	typeOffset=0;
	updateCursor(typeOffset);
	

}
Beispiel #28
0
bool LineEdit::onKeyPressed(const sf::Event::KeyEvent &evt)
{
	Widget::onKeyPressed(evt);
	if(m_inputison)
	{
		switch(evt.code)
		{
			case sf::Keyboard::Return:
				if(m_func)
					m_func(getString());
				m_inputison = false;
				break;

			case sf::Keyboard::Left:
				if(m_positioncursor > 0)
					m_positioncursor--;
				break;

			case sf::Keyboard::Right:
				if(m_positioncursor < m_text.getString().getSize())
					m_positioncursor++;
				break;

			case sf::Keyboard::BackSpace:
				//erase character
				if(m_positioncursor > 0)
				{
					sf::String temp(m_text.getString());
					temp.erase(m_positioncursor - 1, 1);
					m_text.setString(temp);
					m_positioncursor--;
				}
				break;

			case sf::Keyboard::Delete:
				//erase character
				if(m_positioncursor < m_text.getString().getSize())
				{
					sf::String temp(m_text.getString());
					temp.erase(m_positioncursor, 1);
					m_text.setString(temp);
				}
				break;

			default:
				break;
		}

		updateCursor();
		return true;
	}
	return false;
}
	void PointerContextManager::removeContext(const std::string& _name)
	{
		for (VectorContext::iterator item = mContexts.begin(); item != mContexts.end(); ++item)
		{
			if (_name == (*item)->getResourceName())
			{
				mContexts.erase(item);
				break;
			}
		}

		updateCursor();
	}
Beispiel #30
0
void Canvas::onColorPicker(bool in)
{
    if(in){
        inPicker = true;
        QPixmap icon = QPixmap("iconset/color-picker.png");
        setCursor(QCursor(icon, 0, icon.height()));
    }else{
        inPicker = false;
        //        setCursor(Qt::CrossCursor);
        updateCursor(brush_->width());
        emit pickColorComplete();
    }
}