// protected
void kpToolText::handleLeftKeyPress (QKeyEvent *e,
    const QList <QString> &textLines, int cursorRow, int cursorCol)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "\tleft pressed";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    if (!textLines.isEmpty ())
    {
        if ((e->modifiers () & Qt::ControlModifier) == 0)
        {
        #if DEBUG_KP_TOOL_TEXT
            qCDebug(kpLogTools) << "\tmove single char";
        #endif
    
            MoveCursorLeft (textLines, &cursorRow, &cursorCol);
            viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
        }
        else
        {
        #if DEBUG_KP_TOOL_TEXT
            qCDebug(kpLogTools) << "\tmove to start of word";
        #endif
    
            MoveCursorToWordStart (textLines, &cursorRow, &cursorCol);
            viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
        }
    }

    e->accept ();
}
Esempio n. 2
0
	void fillRect(const IntRect &rect,
	              const Vec4 &color)
	{
		bindFBO();

		glState.scissorTest.pushSet(true);
		glState.scissorBox.pushSet(normalizedRect(rect));
		glState.clearColor.pushSet(color);

		FBO::clear();

		glState.clearColor.pop();
		glState.scissorBox.pop();
		glState.scissorTest.pop();
	}
Esempio n. 3
0
// protected
void kpToolText::changeTextStyle (const QString &name,
                                  const kpTextStyle &newTextStyle,
                                  const kpTextStyle &oldTextStyle)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "kpToolText::changeTextStyle(" << name << ")";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    commandHistory ()->addCommand (
        new kpToolTextChangeStyleCommand (
            name,
            newTextStyle,
            oldTextStyle,
            environ ()->commandEnvironment ()));
}
// protected
void kpToolText::handleDownKeyPress (QKeyEvent *e,
    const QList <QString> &textLines, int cursorRow, int cursorCol)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "\tdown pressed";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    if (!textLines.isEmpty () && cursorRow < (int) textLines.size () - 1)
    {
        cursorRow++;
        cursorCol = qMin (cursorCol, (int) textLines [cursorRow].length ());
        viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
    }

    e->accept ();
}
// private
QVariant kpAbstractSelectionTool::operationMove (Operation op,
        const QVariant &data1, const QVariant &data2)
{
    (void) data1;
    (void) data2;


    switch (op)
    {
    case HaventBegunDrawUserMessage:
        return /*virtual*/haventBegunDrawUserMessageMove ();

    case SetCursor:
        setCursorMove ();
        break;

    case BeginDraw:
        beginDrawMove ();
        break;

    case Draw:
        drawMove (currentPoint (), normalizedRect ());
        break;

    case Cancel:
        cancelMove ();
        break;

    case EndDraw:
        endDrawMove ();
        break;

    default:
        Q_ASSERT (!"Unhandled operation");
        break;
    }

    return QVariant ();
}
// protected
void kpToolText::handleEndKeyPress (QKeyEvent *e,
    const QList <QString> &textLines, int cursorRow, int cursorCol)
{
#if DEBUG_KP_TOOL_TEXT
    qCDebug(kpLogTools) << "\tend pressed";
#endif

    if (hasBegunShape ())
        endShape (currentPoint (), normalizedRect ());

    if (!textLines.isEmpty ())
    {
        if (e->modifiers () & Qt::ControlModifier)
            cursorRow = textLines.size () - 1;
    
        cursorCol = textLines [cursorRow].length ();
    
        viewManager ()->setTextCursorPosition (cursorRow, cursorCol);
    }

    e->accept ();
}
Esempio n. 7
0
	void addTaintedArea(const IntRect &rect)
	{	
		IntRect norm = normalizedRect(rect);
		pixman_region_union_rect
		        (&tainted, &tainted, norm.x, norm.y, norm.w, norm.h);
	}