public bool try_rotate_command_exceptions(MappingViewModel m, int step) // returns: handled { var command = m.Command; KnownCommands cur_id = (KnownCommands)m.Command.Id; int cur_modifier; switch (cur_id) { case KnownCommands.Mixer_FXUnit1On: cur_modifier = 1; break; case KnownCommands.Mixer_FXUnit2On: cur_modifier = 2; break; case KnownCommands.Mixer_FXUnit3On: cur_modifier = 3; break; case KnownCommands.Mixer_FXUnit4On: cur_modifier = 4; break; default: return(false); } int start_i = 1; int end_i = 4; int new_modifier = rotate_modifier_key_int(cur_modifier, step, start_i, end_i); string new_name = patch_command_name(command.Name, new_modifier); KnownCommands new_id; switch (new_modifier) { case 1: new_id = KnownCommands.Mixer_FXUnit1On; break; case 2: new_id = KnownCommands.Mixer_FXUnit2On; break; case 3: new_id = KnownCommands.Mixer_FXUnit3On; break; case 4: new_id = KnownCommands.Mixer_FXUnit4On; break; default: return(false); } ; // pestrela: this is a bit fragile, and should be improved m.Command.hack_modifier(new_id, new_name); m.hack_modifier(new_id); m.UpdateInteraction(); return(true); }
public void try_rotate_command(MappingViewModel m, int step, KnownCommands start_c, KnownCommands end_c) { var command = m.Command; KnownCommands cur_id = (KnownCommands)m.Command.Id; if (!is_range_id(cur_id, start_c, end_c)) { //return; } int cur_modifier = cur_id - start_c + 1; int start_i = 1; int end_i; switch (end_c) { case KnownCommands.FXUnit_Button3: case KnownCommands.FXUnit_Effect3Selector: case KnownCommands.FXUnit_Knob3: end_i = 3; break; case KnownCommands.Mixer_FXUnit4On: end_i = 4; break; case KnownCommands.Global_MidiControls_Buttons_MidiButton8: case KnownCommands.Global_MidiControls_Knobs_MidiFader8: case KnownCommands.Global_MidiControls_Knobs_MidiKnob8: case KnownCommands.Modifier_Modifier8: case KnownCommands.TrackDeck_Cue_Hotcue8Type: end_i = 8; break; case KnownCommands.RemixDeck_StepSequencer_EnableStep16: case KnownCommands.DeckCommon_FreezeMode_SliceTrigger16: // needs bugfix? //return; end_i = 16; break; default: MessageBoxHelper.ShowError(String.Format("Rotating command - unknown command: {0}", end_c)); return; } int distance_id = end_c - start_c + 1; if (distance_id != end_i) { MessageBoxHelper.ShowError(String.Format("Rotating command {0} has id_diff of {1}, but expected {2}", end_c, distance_id, end_i)); return; } if (!is_range_id(cur_id, start_c, end_c)) { return; } int new_modifier = rotate_modifier_key_int(cur_modifier, step, start_i, end_i); string new_name = patch_command_name(command.Name, new_modifier); KnownCommands new_id = start_c + new_modifier - 1; // pestrela: this is a bit fragile, and should be improved m.Command.hack_modifier(new_id, new_name); m.hack_modifier(new_id); // would this be the proper way? // var _rawMapping = m._mapping.RawMapping; // ACommand Command = Commands.All.GetCommandProxy(_rawMapping.TraktorControlId, _rawMapping.Type).Create(_rawMapping.Settings); m.UpdateInteraction(); }
public void try_rotate(MappingViewModel m, int step, KnownCommands start_c, KnownCommands end_c) { var command = m.Command; KnownCommands cur_id = (KnownCommands)m.Command.Id; if (!is_range_id(cur_id, start_c, end_c)) { return; } int cur_modifier = cur_id - start_c + 1; int start_i = 1; int end_i = 8; switch (end_c) { case KnownCommands.FXUnit_Button3: case KnownCommands.FXUnit_Effect3Selector: case KnownCommands.FXUnit_Knob3: end_i = 3; break; case KnownCommands.Global_MidiControls_Buttons_MidiButton8: case KnownCommands.Global_MidiControls_Knobs_MidiFader8: case KnownCommands.Global_MidiControls_Knobs_MidiKnob8: case KnownCommands.Modifier_Modifier8: case KnownCommands.TrackDeck_Cue_Hotcue8Type: end_i = 8; break; case KnownCommands.Mixer_FXUnit4On: end_i = 4; break; case KnownCommands.RemixDeck_StepSequencer_EnableStep16: // needs bugfix return; end_i = 16; break; } int new_modifier = rotate_modifier_key_int(cur_modifier, step, start_i, end_i); string new_name = patch_command_name(command.Name, new_modifier); KnownCommands new_id = start_c + new_modifier - 1; // pestrela: this is a bit fragile, and should be improved m.Command.hack_modifier(new_id, new_name); m.hack_modifier(new_id); // would this be the proper way? // var _rawMapping = m._mapping.RawMapping; // ACommand Command = Commands.All.GetCommandProxy(_rawMapping.TraktorControlId, _rawMapping.Type).Create(_rawMapping.Settings); m.UpdateInteraction(); }