Exemplo n.º 1
0
/*-----------------------------------------------------------------*/
void __fastcall CrFeld::Set (bool _set, TShiftState _shift)
{
    switch (feld) {
        case GEWEBE:
            if (!frm->OptionsLockGewebe->Checked)
                frm->SetGewebe (fb.kbd.i, fb.kbd.j, true, frm->currentrange);
            else
                MessageBeep (MB_OK);
            break;

        case AUFKNUEPFUNG:
            frm->SetAufknuepfung (fb.kbd.i, fb.kbd.j, true, frm->currentrange);
            break;

        case TRITTFOLGE:
            frm->SetTrittfolge (fb.kbd.i, fb.kbd.j, true, frm->currentrange);
            break;
    }

    if (frm->toptobottom && feld==AUFKNUEPFUNG) {
        if (cursordirection&CD_UP) MoveCursorUp (1, false);
        else if (cursordirection&CD_DOWN) MoveCursorDown (1, false);
    } else {
        if (cursordirection&CD_UP) MoveCursorUp (1, false);
        else if (cursordirection&CD_DOWN) MoveCursorDown (1, false);
    }
    if (frm->righttoleft && feld==GEWEBE) {
        if (cursordirection&CD_LEFT) MoveCursorRight (1, false);
        else if (cursordirection&CD_RIGHT) MoveCursorLeft (1, false);
    } else {
        if (cursordirection&CD_LEFT) MoveCursorLeft (1, false);
        else if (cursordirection&CD_RIGHT) MoveCursorRight (1, false);
    }
}
Exemplo n.º 2
0
/*-----------------------------------------------------------------*/
void __fastcall CrFeld::Toggle (TShiftState _shift)
{
    //xxx Kann ich in FieldBase eine virtuelle
    //xxx SetField-Funktion einbauen, sodass ich
    //xxx hier diese aufrufen könnte, statt jeweils
    //xxx den switch zu machen?!
    switch (feld) {
        case BLATTEINZUG: {
            frm->SetBlatteinzug (fb.kbd.i);
            MoveCursorRight (1, false); //xxx siehe unten
            return;
        }
        case KETTFARBEN:
            // Mit Shift oder Control wird die Farbe selektiert!
            if (_shift.Contains (ssShift) || _shift.Contains (ssCtrl)) {
                Data->color = frm->kettfarben.feld.Get (fb.kbd.i+frm->scroll_x2);
                if (FarbPalette->Visible) FarbPalette->Invalidate();
                frm->Statusbar->Invalidate();
            } else {
                frm->SetKettfarben (fb.kbd.i);
                MoveCursorRight (1, false); //xxx siehe unten
            }
            return;
        case EINZUG: frm->SetEinzug (fb.kbd.i, fb.kbd.j); break;
        case GEWEBE:
            if (!frm->OptionsLockGewebe->Checked)
                frm->SetGewebe (fb.kbd.i, fb.kbd.j, false, 1);
            else
                MessageBeep (MB_OK);
            break;
        case AUFKNUEPFUNG: frm->SetAufknuepfung (fb.kbd.i, fb.kbd.j, false, 1); break;
        case TRITTFOLGE: frm->SetTrittfolge (fb.kbd.i, fb.kbd.j, false, 1); break;
        case SCHUSSFARBEN:
            // Mit Shift oder Control wird die Farbe selektiert!
            if (_shift.Contains (ssShift) || _shift.Contains (ssCtrl)) {
                Data->color = frm->schussfarben.feld.Get (frm->scroll_y2+fb.kbd.j);
                if (FarbPalette->Visible) FarbPalette->Invalidate();
                frm->Statusbar->Invalidate();
            } else {
                frm->SetSchussfarben (fb.kbd.j);
            }
            break;
    }

    if (frm->toptobottom && (feld==EINZUG || feld==AUFKNUEPFUNG)) {
        if (cursordirection&CD_UP) MoveCursorUp (1, false);
        else if (cursordirection&CD_DOWN) MoveCursorDown (1, false);
    } else {
        if (cursordirection&CD_UP) MoveCursorUp (1, false);
        else if (cursordirection&CD_DOWN) MoveCursorDown (1, false);
    }
    if (frm->righttoleft && (feld==EINZUG || feld==GEWEBE || feld==BLATTEINZUG || feld==KETTFARBEN)) {
        if (cursordirection&CD_LEFT) MoveCursorLeft (1, false);
        else if (cursordirection&CD_RIGHT) MoveCursorRight (1, false);
    } else {
        if (cursordirection&CD_LEFT) MoveCursorLeft (1, false);
        else if (cursordirection&CD_RIGHT) MoveCursorRight (1, false);
    }
}
Exemplo n.º 3
0
void DrawsWidget::SetKeyboardAction(ActionKeyboardType action)
{
	if (m_action == action)
		return;

	wxLogInfo(_T("DEBUG: Keyboard action %d requested"), action);

	switch (action) {
	case NONE:
		if (m_action >= CURSOR_LEFT_KB) {
			m_action = NONE;
			m_keyboard_timer->Stop();
		}
		break;
	case CURSOR_LEFT_KB:
		m_action = action;
		m_keyboard_timer->Start(FULL_SCREEN_SPEED / 3,
					wxTIMER_ONE_SHOT);
		MoveCursorLeft();
		break;
	case CURSOR_RIGHT_KB:
		m_action = action;
		m_keyboard_timer->Start(FULL_SCREEN_SPEED / 3,
					wxTIMER_ONE_SHOT);
		MoveCursorRight();
		break;
	case CURSOR_LONG_LEFT_KB:
		m_action = action;
		m_keyboard_timer->Start(FULL_SCREEN_SPEED / 3,
					wxTIMER_ONE_SHOT);
		MoveCursorLeft(TimeIndex::PeriodMult[m_draws_controller->GetPeriod()]);
		break;
	case CURSOR_LONG_RIGHT_KB:
		m_action = action;
		m_keyboard_timer->Start(FULL_SCREEN_SPEED / 3,
					wxTIMER_ONE_SHOT);
		MoveCursorRight(TimeIndex::PeriodMult[m_draws_controller->GetPeriod()]);
		break;
	case CURSOR_HOME_KB:
		m_action = action;
		MoveCursorBegin();
		break;
	case CURSOR_END_KB:
		m_action = action;
		MoveCursorEnd();
		break;
	case SCREEN_LEFT_KB:
		m_action = action;
		MoveScreenLeft();
		break;
	case SCREEN_RIGHT_KB:
		m_action = action;
		MoveScreenRight();
		break;
	default:
		break;
	}
}
// 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 ();
}
Exemplo n.º 5
0
// moves cursor left one space
// calls DeleteCurrentChar()
void CMyEditBox::DeletePreviusChar()
{
	if( _cursorLocation <= 0 )
		return; // no deletions necessary

	MoveCursorLeft();
	DeleteCurrentChar();
}	
Exemplo n.º 6
0
void DrawsWidget::OnKeyboardTimerEvent(wxTimerEvent & event)
{
	switch (m_action) {
	case CURSOR_LEFT:
	case CURSOR_LEFT_KB:
		MoveCursorLeft();
		break;
	case CURSOR_RIGHT:
	case CURSOR_RIGHT_KB:
		MoveCursorRight();
		break;
	default:
		break;
	}

	m_keyboard_timer->Start(CursorMovementSpeed[m_draws_controller->GetPeriod()], wxTIMER_ONE_SHOT);
}
Exemplo n.º 7
0
void
KnobTextEntryWindow::OnAction(int id) noexcept
{
  switch (id) {
  case DOWN:
    IncrementLetter();
    break;

  case UP:
    DecrementLetter();
    break;

  case LEFT:
    MoveCursorLeft();
    break;

  case RIGHT:
    MoveCursorRight();
    break;
  }
}
Exemplo n.º 8
0
//this function translates a passed in scan code to ascii (or maybe unicode?) character values that will be used to get the correct bitmaps for printing characters to the screen
extern uint8_t translateKeypress(uint8_t translate)
{
    uint8_t temp = 0;
    int i = 0;
    if(translate == 0x58) // caps lock
    {
        temp = 0x03;
    }
    else if(translate == 0x12) // left shift
    {
        ShiftPressed = 1;
        temp = 0;
    }
    else if(translate == 0x59) // right shift
    {
        ShiftPressed = 0;
        temp = 0;
    }
    else
    {
	switch(translate)
	{
		//start special key: enter
		case 0x5A: // enter
			temp = 0x01;
			break;
                //start special key: backspace
                case 0x66: // backspace
                    temp = 0x04;
                    break;
		//start special keys: page up and page down
		case 0x7D: // page up
		switch(ShiftPressed)
			{
			case 0:
				for(i = 0; i < 8; i++)
				{
					ShiftScreenUp();
				}
				temp = 0;
				break;
			case 1:
				ShiftScreenUp();
				temp = 0;
				break;
			}
			break;
		case 0x7A: // page down
		switch(ShiftPressed)
			{
			case 0:
				for(i = 0; i < 8; i++)
				{
					ShiftScreenDown();
				}
				temp = 0;
				break;
			case 1:
				ShiftScreenDown();
				temp = 0;
				break;
			}
			break;
		//start special keys: arrow keys
		case 0x6B: // left arrow
			switch(ShiftPressed)
			{
			case 0:
				MoveCursorLeft(); // left arrow
				BlinkCursor();
				temp = 0;
				break;
			case 1:
				ShiftScreenLeft();
				//MoveCursorLeft(); 
				//BlinkCursor();
				temp = 0;
				break;
			}
			break;
		case 0x74: // right arrow
			switch(ShiftPressed)
			{
			case 0:		
				//ShiftScreenRight();
				MoveCursorRight(); // right arrow
				BlinkCursor();
				//temp = 1; // quick way to make the right arrow print nothing but not get skipped over when incrementing
				temp = 0;
				break;
			case 1:
				ShiftScreenRight();
				//MoveCursorRight(); 
				//BlinkCursor();
				temp = 0;
				break;
			}
			break;
		case 0x75: // up arrow
			switch(ShiftPressed)
			{
			case 0:
				MoveCursorUp(); 
				BlinkCursor();
				temp = 0;
				break;
			case 1:
				for(i = 0; i < 8; i++)
				{
					ShiftScreenUp();
				}
				temp = 0;
				break;
			}
			break;
		case 0x72: // down arrow
			switch(ShiftPressed)
			{
			case 0:
				MoveCursorDown(); // down arrow
				BlinkCursor();
				temp = 0;
				break;
			case 1:			
				for(i = 0; i < 8; i++)
				{
					ShiftScreenDown();
				}
				temp = 0;
				break;
			}
			break;
		//start keyboard line: esc F1F2F3F4F5F6F7F8F9F10F11F12
		case 0x76: // esc
                    temp = 0x02; // temp number for commands will be in range 0x01 - 0x19
			break;
		case 0x05: // F1
			temp = 0;
                        //press_F1();
			break;
		case 0x06: // F2
			temp = 0;
			shiftTextLeft();
			break;
		//start keyboard line: `1234567890-=
		case 0x0E: //`
			switch(ShiftPressed)
			{
			case 0:		
				temp = 0x60; //`
				break;
			case 1:
				temp = 0x7E; //~
				break;
			}
			break;
		case 0x16: //1
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x31; //1
				break;
			case 1:
				temp = 0x21; //!
				break;
			}
			break;
		case 0x1E: //2
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x32; //2
				break;
			case 1:
				temp = 0x40; //@
				break;
			}
			break;
		case 0x26: //3
			switch(ShiftPressed)
			{
			case 0:		
				temp = 0x33; //3
				break;
			case 1:
				temp = 0x23; //#
				break;
			}
			break;
		case 0x25: //4
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x34; //4
				break;
			case 1:
				temp = 0x24; //$
				break;
			}
			break;
		case 0x2E: //5
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x35; //5
				break;
			case 1:
				temp = 0x25; //%
				break;
			}
			break;
		case 0x36: //6
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x36; //6
				break;
			case 1:
				temp = 0x5E; //^
				break;
			}
			break;
		case 0x3D: //7
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x37; //7
				break;
			case 1:
				temp = 0x26; //&
				break;
			}
			break;
		case 0x3E: //8
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x38; //8
				break;
			case 1:
				temp = 0x2A; //*
				break;
			}
			break;
		case 0x46: //9
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x39; //9
				break;
			case 1:
				temp = 0x28; //(
				break;
			}
			break;
		case 0x45: //0
			switch(ShiftPressed)	
			{
			case 0:
				temp = 0x30; //0
				break;
			case 1:
				temp = 0x29; //)
				break;
			}
			break;
		case 0x4E: //-
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x2D; //-
				break;
			case 1:
				temp = 0x5F; //_
				break;
			}
			break;
        case 0x55: //=
	   		switch(ShiftPressed)
			{
			case 0:
				temp = 0x3D; //=
				break;
			case 1:
				temp = 0x2B; //+
				break;
			}
			break;
		//start keyboard line: qwertyuiop[] and '\'
		case 0x15: //q
			switch(ShiftPressed)
			{
			case 0:
				temp = 0x71; //q
				break;
			case 1:
				temp = 0x51; //Q
				break;
			}
			break;
		case 0x1D: //w
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x77; //w
				break;
			case 1:
				temp = 0x57; //W
				break;
			}
			break;
		case 0x24: //e
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x65; //e
				break;
			case 1:
				temp = 0x45; //E
                break;
			}
			break;
		case 0x2D: //r
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x72; //r
				break;
			case 1:
				temp = 0x52; //R
				break;
			}
			break;
		case 0x2C: //t
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x74; //t
				break;
			case 1:
				temp = 0x54; //T
				break;
			}
			break;
		case 0x35: //y
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x79; //y
				break;
			case 1:
				temp = 0x59; //Y
				break;
			}
			break;
		case 0x3C: //u
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x75; //u
				break;
			case 1:
				temp = 0x55; //U
				break;
			}
			break;
		case 0x43: //i
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x69; //i
				break;
			case 1:
				temp = 0x49; //I
				break;
			}
			break;
		case 0x44: //o
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6F; //o
				break;
			case 1:
				temp = 0x4F; //O
				break;
			}
			break;
		case 0x4D: //p
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x70; //p
				break;
			case 1:
				temp = 0x50; //P
				break;
			}
			break;
		case 0x54: //[
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x5B; //[
				break;
			case 1:
				temp = 0x7B; //{
				break;
			}
			break;
		case 0x5B: //]
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x5D;  //]
				break;
			case 1:
				temp = 0x7D;  //}
				break;
			}
			break;
		case 0x5D: //"\"
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x5C; //"\"
				break;
			case 1:
				temp = 0x7C; //|
				break;
			}
			break;
		//start keyboard line: asdfghjkl;'
		case 0x1C: //a
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x61; //a
				break;
			case 1:
				temp = 0x41; //A
				break;
			}
			break;
		case 0x1B: //s
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x73; //s
				break;
			case 1:
				temp = 0x53; //S
				break;
			}
			break;
		case 0x23: //d
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x64; //d
				break;
			case 1:
				temp = 0x44; //D
				break;
			}
			break;
		case 0x2B: //f
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x66; //f
				break;
			case 1:
				temp = 0x46; //F
				break;
			}
			break;
		case 0x34: //g
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x67; //g
				break;
			case 1:
				temp = 0x47; //G
				break;
			}
			break;
		case 0x33: //h
			switch(ShiftPressed)
			{		
			case 0:
				temp = 0x68; //h
				break;
			case 1:
				temp = 0x48; //H
				break;
			}
			break;
		case 0x3B: //j
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6A; //j
				break;
			case 1:
				temp = 0x4A; //J
				break;
			}
			break;
		case 0x42: //k
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6B; //k
				break;
			case 1:
				temp = 0x4B; //K
				break;
			}
			break;
		case 0x4B: //l
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6C; //l
				break;
			case 1:
				temp = 0x4C; //L
				break;
			}
			break;
		case 0x4C:      //NOTE: this is actually a : not a ; but there is no bitmap for ;
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x3A; //;
				break;
			case 1:
				temp = 0x3A; //:
				break;
			}
			break;
		case 0x52: //'
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x27; //'
				break;
			case 1:
				temp = 0x22; //"
				break;
			}
			break;
		//start keyboard line: zxcvbnm,./
		case 0x1A: //z
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x7A; //z
				break;
			case 1:
				temp = 0x5A; //Z
				break;
			}
			break;
		case 0x22: //x
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x78; //x
				break;
			case 1:
				temp = 0x58; //X
				break;
			}
			break;
		case 0x21: //c
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x63; //c
				break;
			case 1:
				temp = 0x43; //C
				break;
			}
			break;
		case 0x2A: //v
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x76; //v
				break;
			case 1:
				temp = 0x56; //V
				break;
			}
			break;
		case 0x32: //b
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x62; //b
				break;
			case 1:
				temp = 0x42; //B
				break;
			}
			break;
		case 0x31: //n
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6E; //n
				break;
			case 1:
				temp = 0x4E; //N
				break;
			}
			break;
		case 0x3A: //m
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x6D; //m
				break;
			case 1:
				temp = 0x4D; //M
				break;
			}
			break;
		case 0x41: //,
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x2C; //,
				break;
			case 1:
				temp = 0x3C; //<
				break;
			}
			break;
		case 0x49: //.
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x2E; //.
				break;
			case 1:
				temp = 0x3E; //>
				break;
			}
			break;
		case 0x4A: // "/"
		switch(ShiftPressed)
			{		
			case 0:
				temp = 0x2F; // "/"
				break;
			case 1:
				temp = 0x3F; //?
				break;
			}
			break;
		case 0x29: // space
			temp = 0x20;
			break;
		default:
			temp = 0x21;
            }
        }
    return temp;
}
Exemplo n.º 9
0
/////////////////////////////////////////////////////////////////////
//  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);
}