コード例 #1
0
/*****************************************************************************
 * FUNCTION: ProcessEscapeSequence
 *
 * RETURNS: None
 *
 * PARAMS:  pEscapeSequence -- escape sequence string to be processed.
 *
 * NOTES:   Processes an escape sequence received by the state machine
 *
 *****************************************************************************/
static void ProcessEscapeSequence(INT8 *pEscapeSequence)
{

   /* if a Left Arrow Key */
   if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) leftArrowEscapeSequence) == 0)
   {
      CursorLeft();
   }
   /* else if Right Arrow Key */
   else if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) rightArrowEscapeSequence) == 0)
   {
      CursorRight();
   }
#if (kWFNumHistoryEntries > 0)
   /* else if Up Arrow Key */
   else if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) upArrowEscapeSequence) == 0)
   {

      DisplayHistoryEntry(kWFPrevHistory);
   }
   /* else if Down Arrow Key */
   else if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) downArrowEscapeSequence) == 0)
   {
      DisplayHistoryEntry(kWFNextHistory);
   }
#endif
   /* else if Home Key */
   else if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) homeKeyEscapeSequence) == 0)
   {
      CursorHome();
   }
   /* else if End Key */
   else if (strcmppgm2ram( (const char *) pEscapeSequence, (ROM FAR char*) endKeyEscapeSequence) == 0)
   {
      CursorEnd();
   }
}
コード例 #2
0
ファイル: freqctrl.cpp プロジェクト: amontefusco/qthid
/////////////////////////////////////////////////////////////////////
//  Keyboard Event overrides
/////////////////////////////////////////////////////////////////////
void CFreqCtrl::keyPressEvent( QKeyEvent * event )
{   //call base class if dont over ride key
bool fSkipMsg = FALSE;
qint64 tmp;
//qDebug() <<event->key();
    switch(event->key())
    {
        case Qt::Key_0:
        case Qt::Key_1:
        case Qt::Key_2:
        case Qt::Key_3:
        case Qt::Key_4:
        case Qt::Key_5:
        case Qt::Key_6:
        case Qt::Key_7:
        case Qt::Key_8:
        case Qt::Key_9:
            if( m_ActiveEditDigit>=0)
            {
                if( m_DigitInfo[m_ActiveEditDigit].editmode)
                {
                    tmp = (m_freq/m_DigitInfo[m_ActiveEditDigit].weight)%10;
                    m_freq -= tmp*m_DigitInfo[m_ActiveEditDigit].weight;
                    m_freq = m_freq+(event->key()-'0')*m_DigitInfo[m_ActiveEditDigit].weight;
                    SetFrequency(m_freq);
                }
            }
            MoveCursorRight();
            fSkipMsg = TRUE;
            break;
        case Qt::Key_Left:
            if( m_ActiveEditDigit != -1 )
            {
                MoveCursorLeft();
                fSkipMsg = TRUE;
            }
            break;
        case Qt::Key_Up:
            if(m_ActiveEditDigit != -1 )
            {
                IncFreq();
                fSkipMsg = TRUE;
            }
            break;
        case Qt::Key_Down:
            if(m_ActiveEditDigit != -1)
            {
                DecFreq();
                fSkipMsg = TRUE;
            }
            break;
        case Qt::Key_Right:
            if(m_ActiveEditDigit != -1 )
            {
                MoveCursorRight();
                fSkipMsg = TRUE;
            }
            break;
        case Qt::Key_Home:
            CursorHome();
            fSkipMsg = TRUE;
            break;
        case Qt::Key_End:
            CursorEnd();
            fSkipMsg = TRUE;
            break;
        default:
            break;
    }
    if(!fSkipMsg)
        QFrame::keyPressEvent(event);
}