MCPcopy Create free account
hub / github.com/HertzDevil/0CC-FamiTracker / HandleKeyboardInput

Method HandleKeyboardInput

Source/FamiTrackerView.cpp:2581–2691  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

2579}
2580
2581void CFamiTrackerView::HandleKeyboardInput(unsigned char nChar) // // //
2582{
2583 if (FTEnv.GetAccelerator()->IsKeyUsed(nChar)) return; // // //
2584
2585 edit_style_t EditStyle = FTEnv.GetSettings()->General.iEditStyle; // // //
2586 int Index = 0;
2587
2588 int Frame = GetSelectedFrame();
2589 int Row = GetSelectedRow();
2590 cursor_column_t Column = m_pPatternEditor->GetColumn();
2591
2592 bool bStepDown = false;
2593 bool bMoveRight = false;
2594 bool bMoveLeft = false;
2595
2596 // Watch for repeating keys
2597 if (PreventRepeat(nChar, m_bEditEnable))
2598 return;
2599
2600 // Get the note data
2601 stChanNote Note = GetSongView()->GetPatternOnFrame(GetSelectedChannel(), Frame).GetNoteOn(Row); // // //
2602
2603 // Make all effect columns look the same, save an index instead
2604 switch (Column) {
2605 case cursor_column_t::EFF1_NUM: Column = cursor_column_t::EFF1_NUM; Index = 0; break;
2606 case cursor_column_t::EFF2_NUM: Column = cursor_column_t::EFF1_NUM; Index = 1; break;
2607 case cursor_column_t::EFF3_NUM: Column = cursor_column_t::EFF1_NUM; Index = 2; break;
2608 case cursor_column_t::EFF4_NUM: Column = cursor_column_t::EFF1_NUM; Index = 3; break;
2609 case cursor_column_t::EFF1_PARAM1: Column = cursor_column_t::EFF1_PARAM1; Index = 0; break;
2610 case cursor_column_t::EFF2_PARAM1: Column = cursor_column_t::EFF1_PARAM1; Index = 1; break;
2611 case cursor_column_t::EFF3_PARAM1: Column = cursor_column_t::EFF1_PARAM1; Index = 2; break;
2612 case cursor_column_t::EFF4_PARAM1: Column = cursor_column_t::EFF1_PARAM1; Index = 3; break;
2613 case cursor_column_t::EFF1_PARAM2: Column = cursor_column_t::EFF1_PARAM2; Index = 0; break;
2614 case cursor_column_t::EFF2_PARAM2: Column = cursor_column_t::EFF1_PARAM2; Index = 1; break;
2615 case cursor_column_t::EFF3_PARAM2: Column = cursor_column_t::EFF1_PARAM2; Index = 2; break;
2616 case cursor_column_t::EFF4_PARAM2: Column = cursor_column_t::EFF1_PARAM2; Index = 3; break;
2617 }
2618
2619 if (Column != cursor_column_t::NOTE && !m_bEditEnable) // // //
2620 HandleKeyboardNote(nChar, true);
2621 switch (Column) {
2622 // Note & octave column
2623 case cursor_column_t::NOTE:
2624 if (CheckRepeatKey(nChar)) {
2625 Note.Note = m_LastNote.Note; // // //
2626 Note.Octave = m_LastNote.Octave;
2627 }
2628 else if (CheckEchoKey(nChar)) { // // //
2629 m_LastNote.Note = Note.Note = note_t::echo;
2630 m_LastNote.Octave = Note.Octave = static_cast<CMainFrame*>(GetParentFrame())->GetSelectedOctave(); // // //
2631 if (Note.Octave > ECHO_BUFFER_LENGTH - 1)
2632 Note.Octave = ECHO_BUFFER_LENGTH - 1;
2633 if (!m_bMaskInstrument)
2634 Note.Instrument = GetInstrument();
2635 }
2636 else if (CheckClearKey(nChar)) {
2637 // Remove note
2638 m_LastNote.Note = Note.Note = note_t::none; // // //

Callers

nothing calls this directly

Calls 8

IsKeyUsedMethod · 0.80
GetSelectedOctaveMethod · 0.80
MoveLeftMethod · 0.80
MoveRightMethod · 0.80
GetAcceleratorMethod · 0.45
GetSettingsMethod · 0.45
GetColumnMethod · 0.45
SaveRedoStateMethod · 0.45

Tested by

no test coverage detected