void CodeEditorComponent::scrollToKeepLinesOnScreen (Range<int> rangeToShow)
{
    if (rangeToShow.getStart() < firstLineOnScreen)
        scrollBy (rangeToShow.getStart() - firstLineOnScreen);
    else if (rangeToShow.getEnd() >= firstLineOnScreen + linesOnScreen)
        scrollBy (rangeToShow.getEnd() - (firstLineOnScreen + linesOnScreen - 1));
}
Ejemplo n.º 2
0
void ScrollWidget::wheelEvent(QGraphicsSceneWheelEvent *event)
{
    if (event->delta() < 0) {
        scrollBy (0, -10);
    } else {
        scrollBy (0, 10);
    }
    event->accept();
}
void CodeEditorComponent::scrollToKeepCaretOnScreen()
{
    if (caretPos.getLineNumber() < firstLineOnScreen)
        scrollBy (caretPos.getLineNumber() - firstLineOnScreen);
    else if (caretPos.getLineNumber() >= firstLineOnScreen + linesOnScreen)
        scrollBy (caretPos.getLineNumber() - (firstLineOnScreen + linesOnScreen - 1));

    const int column = indexToColumn (caretPos.getLineNumber(), caretPos.getIndexInLine());
    if (column >= xOffset + columnsOnScreen - 1)
        scrollToColumn (column + 1 - columnsOnScreen);
    else if (column < xOffset)
        scrollToColumn (column);
}
Ejemplo n.º 4
0
void TerminalBuffer::insertLf(void) {
    if (m_cursorY == m_scrollBottom) {
        scrollBy(1);
    } else {
        m_cursorY++;
    }
}
bool CodeEditorComponent::pageUp (const bool selecting)
{
    newTransaction();
    scrollBy (-linesOnScreen);
    moveLineDelta (-linesOnScreen, selecting);
    return true;
}
bool CodeEditorComponent::pageDown (const bool selecting)
{
    newTransaction();
    scrollBy (jlimit (0, linesOnScreen, 1 + document.getNumLines() - firstLineOnScreen - linesOnScreen));
    moveLineDelta (linesOnScreen, selecting);
    return true;
}
void CodeEditorComponent::pageDown (const bool selecting)
{
    newTransaction();

    scrollBy (jlimit (0, linesOnScreen, 1 + document.getNumLines() - firstLineOnScreen - linesOnScreen));
    moveCaretTo (caretPos.movedByLines (linesOnScreen), selecting);
}
Ejemplo n.º 8
0
bool QScrollView::qt_invoke( int _id, QUObject* _o )
{
    switch ( _id - staticMetaObject()->slotOffset() ) {
    case 0: resizeContents((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 1: scrollBy((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 2: setContentsPos((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 3: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 4: ensureVisible((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(int)static_QUType_int.get(_o+3),(int)static_QUType_int.get(_o+4)); break;
    case 5: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2)); break;
    case 6: center((int)static_QUType_int.get(_o+1),(int)static_QUType_int.get(_o+2),(float)(*((float*)static_QUType_ptr.get(_o+3))),(float)(*((float*)static_QUType_ptr.get(_o+4)))); break;
    case 7: updateScrollBars(); break;
    case 8: setEnabled((bool)static_QUType_bool.get(_o+1)); break;
    case 9: hslide((int)static_QUType_int.get(_o+1)); break;
    case 10: vslide((int)static_QUType_int.get(_o+1)); break;
    case 11: hbarIsPressed(); break;
    case 12: hbarIsReleased(); break;
    case 13: vbarIsPressed(); break;
    case 14: vbarIsReleased(); break;
    case 15: doDragAutoScroll(); break;
    case 16: startDragAutoScroll(); break;
    case 17: stopDragAutoScroll(); break;
    default:
	return QFrame::qt_invoke( _id, _o );
    }
    return TRUE;
}
void CodeEditorComponent::pageUp (const bool selecting)
{
    newTransaction();

    scrollBy (-linesOnScreen);
    moveCaretTo (caretPos.movedByLines (-linesOnScreen), selecting);
}
void CodeEditorComponent::scrollDown()
{
    newTransaction();
    scrollBy (-1);

    if (caretPos.getLineNumber() >= firstLineOnScreen + linesOnScreen)
        moveCaretTo (caretPos.movedByLines (-1), false);
}
bool CodeEditorComponent::scrollDown()
{
    newTransaction();
    scrollBy (-1);

    if (caretPos.getLineNumber() >= firstLineOnScreen + linesOnScreen)
        moveLineDelta (-1, false);

    return true;
}
bool CodeEditorComponent::scrollUp()
{
    newTransaction();
    scrollBy (1);

    if (caretPos.getLineNumber() < firstLineOnScreen)
        moveLineDelta (1, false);

    return true;
}
Ejemplo n.º 13
0
void PageView::contentsMouseMoveEvent( QMouseEvent* e )
{
  QPoint newPos = e->globalPos();

  if (e->state() == LeftButton && moveTool)
  {
    QPoint delta = dragGrabPos - newPos;
    scrollBy(delta.x(), delta.y());
  }
  dragGrabPos = newPos;
}
Ejemplo n.º 14
0
void CVBEditor::canvasResized(const QRect & oldSize, const QRect & newSize) {
	updateWorldMatrix();

	return;

	kdDebug() << k_funcinfo << endl;

	QPoint delta = oldSize.topLeft() - newSize.topLeft();
	delta *= p_itemView->zoomLevel();
	scrollBy(delta.x(), delta.y());
}
Ejemplo n.º 15
0
void ScrollView::wheelEvent(PlatformWheelEvent& e)
{
    // Determine how much we want to scroll.  If we can move at all, we will accept the event.
    IntSize maxScrollDelta = maximumScroll();
    if ((e.deltaX() < 0 && maxScrollDelta.width() > 0) ||
        (e.deltaX() > 0 && scrollOffset().width() > 0) ||
        (e.deltaY() < 0 && maxScrollDelta.height() > 0) ||
        (e.deltaY() > 0 && scrollOffset().height() > 0)) {
        e.accept();
        scrollBy(-e.deltaX() * LINE_STEP, -e.deltaY() * LINE_STEP);
    }
}
Ejemplo n.º 16
0
void TerminalBuffer::insertCharacter(uint8_t c) {
    assert((m_cursorX >= 0) && (m_cursorX < m_width));
    assert((m_cursorY >= 0) && (m_cursorY < m_height));

    TerminalLine* line = m_lines[m_cursorY];
    line->m_text[m_cursorX] = c;
    line->m_attr[m_cursorX] = m_attrib;
    line->m_dirtyWidth = std::max(line->m_dirtyWidth, m_cursorX + 1);

    if (++m_cursorX == m_width) {
        if (m_cursorY == m_scrollBottom) {
            scrollBy(1);
        } else {
            m_cursorY++;
        }

        m_cursorX = 0;
    }
}
Ejemplo n.º 17
0
void QTodoList::subWheelEvent(QWheelEvent* event)
{
	scrollBy(0,-event->delta());
}
Ejemplo n.º 18
0
void CardView::contentsWheelEvent( QWheelEvent *e )
{
  scrollBy( 2 * e->delta() / -3, 0 );
}
Ejemplo n.º 19
0
void ScrollView::setContentsPos(int newX, int newY)
{
    int dx = newX - contentsX();
    int dy = newY - contentsY();
    scrollBy(dx, dy);
}