| 2354 | } |
| 2355 | |
| 2356 | bool CFamiTrackerView::EditInstrumentColumn(stChanNote &Note, int Key, bool &StepDown, bool &MoveRight, bool &MoveLeft) |
| 2357 | { |
| 2358 | edit_style_t EditStyle = FTEnv.GetSettings()->General.iEditStyle; |
| 2359 | const cursor_column_t Column = m_pPatternEditor->GetColumn(); // // // |
| 2360 | |
| 2361 | if (!m_bEditEnable) |
| 2362 | return false; |
| 2363 | |
| 2364 | if (CheckClearKey(Key)) { |
| 2365 | SetInstrument(Note.Instrument = MAX_INSTRUMENTS); // Indicate no instrument selected |
| 2366 | if (EditStyle != edit_style_t::MPT) |
| 2367 | StepDown = true; |
| 2368 | return true; |
| 2369 | } |
| 2370 | else if (CheckRepeatKey(Key)) { |
| 2371 | SetInstrument(Note.Instrument = m_LastNote.Instrument); |
| 2372 | if (EditStyle != edit_style_t::MPT) |
| 2373 | StepDown = true; |
| 2374 | return true; |
| 2375 | } |
| 2376 | else if (Key == 'H') { // // // 050B |
| 2377 | SetInstrument(Note.Instrument = HOLD_INSTRUMENT); |
| 2378 | if (EditStyle != edit_style_t::MPT) |
| 2379 | StepDown = true; |
| 2380 | return true; |
| 2381 | } |
| 2382 | |
| 2383 | int Value = ConvertKeyToHex(Key); |
| 2384 | unsigned char Mask, Shift; |
| 2385 | |
| 2386 | if (Value == -1 && FTEnv.GetSettings()->General.bHexKeypad) // // // |
| 2387 | Value = ConvertKeyExtra(Key); |
| 2388 | if (Value == -1) |
| 2389 | return false; |
| 2390 | |
| 2391 | if (Column == cursor_column_t::INSTRUMENT1) { |
| 2392 | Mask = 0x0F; |
| 2393 | Shift = 4; |
| 2394 | } |
| 2395 | else { |
| 2396 | Mask = 0xF0; |
| 2397 | Shift = 0; |
| 2398 | } |
| 2399 | |
| 2400 | if (Note.Instrument == MAX_INSTRUMENTS || Note.Instrument == HOLD_INSTRUMENT) // // // 050B |
| 2401 | Note.Instrument = 0; |
| 2402 | |
| 2403 | switch (EditStyle) { |
| 2404 | case edit_style_t::FT2: // FT2 |
| 2405 | Note.Instrument = (Note.Instrument & Mask) | (Value << Shift); |
| 2406 | StepDown = true; |
| 2407 | break; |
| 2408 | case edit_style_t::MPT: // MPT |
| 2409 | Note.Instrument = ((Note.Instrument & 0x0F) << 4) | Value & 0x0F; |
| 2410 | if (Note.Instrument >= MAX_INSTRUMENTS) // // // |
| 2411 | Note.Instrument &= 0x0F; |
| 2412 | break; |
| 2413 | case edit_style_t::IT: // IT |
nothing calls this directly
no test coverage detected