def _handle_clip_key_event(event): # Key bindings for MOVE MODES if editorstate.current_is_move_mode(): action = _get_shortcut_action(event) # Apr-2017 - SvdB - Add different speeds for different modifiers # Allow user to select what speed belongs to what modifier, knowing that a combo of mods # will MULTIPLY all speeds # Available: SHIFT_MASK LOCK_MASK CONTROL_MASK prefs = editorpersistance.prefs if action == 'prev_frame' or action == 'next_frame': if action == 'prev_frame': seek_amount = -1 else: seek_amount = 1 if (event.get_state() & Gdk.ModifierType.SHIFT_MASK): seek_amount = seek_amount * prefs.ffwd_rev_shift if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): seek_amount = seek_amount * prefs.ffwd_rev_ctrl if (event.get_state() & Gdk.ModifierType.LOCK_MASK): seek_amount = seek_amount * prefs.ffwd_rev_caps PLAYER().seek_delta(seek_amount) return True if action == 'next_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.up_arrow_seek_on_monitor_clip() return True if action == 'prev_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True if action == 'play_pause': if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() if action == 'mark_in': monitorevent.mark_in_pressed() return True if action == 'to_mark_in': monitorevent.to_mark_in_pressed() return True if action == 'mark_out': monitorevent.mark_out_pressed() return True if action == 'to_mark_out': monitorevent.to_mark_out_pressed() return True if action == 'clear_io_marks': monitorevent.marks_clear_pressed() return True
def _handle_tline_key_event(event): """ This is called when timeline widgets have focus and key is pressed. Returns True for handled key presses to stop those keyevents from going forward. """ tool_was_selected = workflow.tline_tool_keyboard_selected(event) if tool_was_selected == True: return True action = _get_shortcut_action(event) prefs = editorpersistance.prefs if action == 'mark_in': monitorevent.mark_in_pressed() return True if action == 'to_mark_in': monitorevent.to_mark_in_pressed() return True if action == 'zoom_out': updater.zoom_out() if action == 'zoom_in': updater.zoom_in() if action == 'mark_out': monitorevent.mark_out_pressed() return True if action == 'to_mark_out': monitorevent.to_mark_out_pressed() return True if action == 'clear_io_marks': monitorevent.marks_clear_pressed() return True if action == 'play_pause': if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True if action == 'switch_monitor': updater.switch_monitor_display() return True if action == 'add_marker': tlineaction.add_marker() return True if action == 'cut': tlineaction.cut_pressed() return True if action == 'cut_all': tlineaction.cut_all_pressed() return True if action == 'sequence_split': tlineaction.sequence_split_pressed() return True if action == 'log_range': medialog.log_range_clicked() return True if action == 'toggle_ripple': gui.editor_window.toggle_trim_ripple_mode() return True # Key bindings for keyboard trimming if editorstate.current_is_active_trim_mode() == True: if action == 'prev_frame': trimmodes.left_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True elif action == 'next_frame': trimmodes.right_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True elif action == 'enter_edit': trimmodes.enter_pressed() return True if editorstate.EDIT_MODE() == editorstate.OVERWRITE_MOVE: if action == 'nudge_back': movemodes.nudge_selection(-1) return True elif action == 'nudge_forward': movemodes.nudge_selection(1) return True elif action == 'nudge_back_10': movemodes.nudge_selection(-10) return True elif action == 'nudge_forward_10': movemodes.nudge_selection(10) return True if editorstate.EDIT_MODE() == editorstate.MULTI_TRIM: multitrimmode.enter_pressed() # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode( ) or editorstate.current_is_active_trim_mode() == False: if action == 'next_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_next_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.up_arrow_seek_on_monitor_clip() if action == 'prev_cut': if editorstate.timeline_visible(): tline_frame = PLAYER().tracktor_producer.frame() frame = current_sequence().find_prev_cut_frame(tline_frame) if frame != -1: PLAYER().seek_frame(frame) if editorpersistance.prefs.center_on_arrow_move == True: updater.center_tline_to_current_frame() return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # Apr-2017 - SvdB - Add different speeds for different modifiers # Allow user to select what speed belongs to what modifier, knowing that a combo of mods # will MULTIPLY all speeds # Available: SHIFT_MASK LOCK_MASK CONTROL_MASK if action == 'prev_frame' or action == 'next_frame': if action == 'prev_frame': seek_amount = -1 else: seek_amount = 1 if (event.get_state() & Gdk.ModifierType.SHIFT_MASK): seek_amount = seek_amount * prefs.ffwd_rev_shift if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): seek_amount = seek_amount * prefs.ffwd_rev_ctrl if (event.get_state() & Gdk.ModifierType.LOCK_MASK): seek_amount = seek_amount * prefs.ffwd_rev_caps PLAYER().seek_delta(seek_amount) return True if action == '3_point_overwrite': tlineaction.three_point_overwrite_pressed() return True if action == 'overwrite_range': tlineaction.range_overwrite_pressed() return True if action == 'insert': if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True if action == 'append': tlineaction.append_button_pressed() return True if action == 'append_from_bin': projectaction.append_selected_media_clips_into_timeline() return True if action == 'slower': monitorevent.j_pressed() return True if action == 'stop': monitorevent.k_pressed() return True if action == 'faster': monitorevent.l_pressed() return True if action == 'log_range': medialog.log_range_clicked() return True if action == 'resync': tlineaction.resync_button_pressed() return True if action == 'delete': if editorstate.EDIT_MODE() == editorstate.KF_TOOL: kftoolmode.delete_active_keyframe() else: # Clip selection and compositor selection are mutually exclusive, # so max one one these will actually delete something tlineaction.splice_out_button_pressed() compositormodes.delete_current_selection() if action == 'lift': tlineaction.lift_button_pressed() return True if action == 'to_start': if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True if action == 'to_end': if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True else: if action == 'to_start': if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.set_default_edit_tool() PLAYER().seek_frame(0) _move_to_beginning() return True if action == 'to_end': if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.set_default_edit_tool() PLAYER().seek_end() _move_to_end() return True return False