Example #1
0
void TypingCommand::doApply()
{
    if (endingSelection().isNone())
        return;
        
    if (m_commandType == DeleteKey)
        if (m_commands.isEmpty())
            m_openedByBackwardDelete = true;

    switch (m_commandType) {
        case DeleteSelection:
            deleteSelection(m_smartDelete);
            return;
        case DeleteKey:
            deleteKeyPressed(m_granularity);
            return;
        case ForwardDeleteKey:
            forwardDeleteKeyPressed(m_granularity);
            return;
        case InsertLineBreak:
            insertLineBreak();
            return;
        case InsertParagraphSeparator:
            insertParagraphSeparator();
            return;
        case InsertParagraphSeparatorInQuotedContent:
            insertParagraphSeparatorInQuotedContent();
            return;
        case InsertText:
            insertText(m_textToInsert, m_selectInsertedText);
            return;
    }

    ASSERT_NOT_REACHED();
}
Example #2
0
void SymbianPhone::handleKeyEventCode(int keyCode)
{
    switch(keyCode)
    {
    case LEFT_KEY:
        emit leftSoftKeyPressed();
        break;
    case RIGHT_KEY:
        emit rightSoftKeyPressed();
        break;
    case C_KEY:
        emit deleteKeyPressed();
        break;
    case GREEN_KEY:
        emit greenKeyPressed();
        break;
    case RED_KEY:
        emit redKeyPressed();
        break;
    case NUMBER_1:
        emit number1KeyPressed();
        break;
    case NUMBER_2:
        emit number2KeyPressed();
        break;
    case NUMBER_3:
        emit number3KeyPressed();
        break;
    case NUMBER_4:
        emit number4KeyPressed();
        break;
    case NUMBER_5:
        emit number5KeyPressed();
        break;
    case NUMBER_6:
        emit number6KeyPressed();
        break;
    case NUMBER_7:
        emit number7KeyPressed();
        break;
    case NUMBER_8:
        emit number8KeyPressed();
        break;
    case NUMBER_9:
        emit number9KeyPressed();
        break;
    case STAR:
        emit starKeyPressed();
        break;
    case SHARP:
        emit sharpKeyPressed();
        break;
    default:
        break;
    }
}
Example #3
0
void
TableView::keyPressEvent(QKeyEvent* e)
{
    if ( (e->key() == Qt::Key_Delete) || (e->key() == Qt::Key_Backspace) ) {
        Q_EMIT deleteKeyPressed();
        e->accept();
    }

    QTreeView::keyPressEvent(e);
}
void FileSearchPathListComponent::buttonClicked (Button* button)
{
    const int currentRow = listBox.getSelectedRow();

    if (button == &removeButton)
    {
        deleteKeyPressed (currentRow);
    }
    else if (button == &addButton)
    {
        File start (defaultBrowseTarget);

        if (start == File::nonexistent)
            start = path [0];

        if (start == File::nonexistent)
            start = File::getCurrentWorkingDirectory();

#if JUCE_MODAL_LOOPS_PERMITTED
        FileChooser chooser (TRANS("Add a folder..."), start, "*");

        if (chooser.browseForDirectory())
            path.add (chooser.getResult(), currentRow);
#else
        jassertfalse; // needs rewriting to deal with non-modal environments
#endif
    }
    else if (button == &changeButton)
    {
        returnKeyPressed (currentRow);
    }
    else if (button == &upButton)
    {
        if (currentRow > 0 && currentRow < path.getNumPaths())
        {
            const File f (path[currentRow]);
            path.remove (currentRow);
            path.add (f, currentRow - 1);
            listBox.selectRow (currentRow - 1);
        }
    }
    else if (button == &downButton)
    {
        if (currentRow >= 0 && currentRow < path.getNumPaths() - 1)
        {
            const File f (path[currentRow]);
            path.remove (currentRow);
            path.add (f, currentRow + 1);
            listBox.selectRow (currentRow + 1);
        }
    }

    changed();
}