def play_pressed(): if editorstate.current_is_active_trim_mode( ) and trimmodes.submode != trimmodes.NOTHING_ON: return if current_is_move_mode(): movemodes.play_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_play_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_play_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_play_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.KF_TOOL: movemodes.play_pressed() elif EDIT_MODE() == editorstate.MULTI_TRIM: movemodes.play_pressed() elif EDIT_MODE() == editorstate.CUT: movemodes.play_pressed()
def tline_cursor_leave(self, event): cursor = Gdk.Cursor.new(Gdk.CursorType.LEFT_PTR) gdk_window = self.window.get_window() gdk_window.set_cursor(cursor) if event.get_state() & Gdk.ModifierType.BUTTON1_MASK: if editorstate.current_is_move_mode(): tlineaction.mouse_dragged_out(event)
def prev_pressed(): if current_is_move_mode(): movemodes.prev_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_prev_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_prev_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_prev_pressed()
def stop_pressed(): if current_is_move_mode(): movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.KF_TOOL: movemodes.play_pressed()
def stop_pressed(): if current_is_move_mode(): movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.KF_TOOL: movemodes.stop_pressed()
def set_transition_render_edit_menu_items_sensitive(range_start, range_end): if not editorstate.current_is_move_mode(): return ui = gui.editor_window.uimanager render_transition = ui.get_widget('/MenuBar/EditMenu/AddTransition') render_fade = ui.get_widget('/MenuBar/EditMenu/AddFade') if range_start == -1: render_transition.set_sensitive(False) render_fade.set_sensitive(False) elif range_start == range_end: render_transition.set_sensitive(False) render_fade.set_sensitive(True) elif range_start == range_end - 1: render_transition.set_sensitive(True) render_fade.set_sensitive(False) else: render_transition.set_sensitive(False) render_fade.set_sensitive(False)
def stop_pressed(): if current_is_move_mode(): movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_stop_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_stop_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM_NO_EDIT: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.KF_TOOL: movemodes.stop_pressed() elif EDIT_MODE() == editorstate.MULTI_TRIM: movemodes.stop_pressed() updater.maybe_autocenter()
def play_pressed(): if editorstate.current_is_active_trim_mode() and trimmodes.submode != trimmodes.NOTHING_ON: return if current_is_move_mode(): movemodes.play_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_play_pressed() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_play_pressed() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM: trimmodes.slide_play_pressed() elif EDIT_MODE() == editorstate.SLIDE_TRIM_NO_EDIT: movemodes.play_pressed() elif EDIT_MODE() == editorstate.KF_TOOL: movemodes.play_pressed() elif EDIT_MODE() == editorstate.MULTI_TRIM: movemodes.play_pressed() elif EDIT_MODE() == editorstate.CUT: movemodes.play_pressed()
def key_down(widget, event): """ Global key press listener. """ # Handle ESCAPE if event.keyval == Gdk.KEY_Escape: if audiowaveform.waveform_thread != None: audiowaveform.waveform_thread.abort_rendering() return True else: if editorstate.current_is_move_mode() == False: editevent.set_default_edit_mode() return True # Compositor editors keyevents was_handled = _handle_geometry_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True was_handled = _handle_effects_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True # If timeline widgets are in focus timeline keyevents are available if _timeline_has_focus(): was_handled = _handle_tline_key_event(event) if was_handled: # Stop widget focus from travelling if arrow key pressed for next frame # by stopping signal gui.editor_window.window.emit_stop_by_name("key_press_event") return was_handled # Insert shortcut keys need more focus then timeline shortcuts. # these may already have been handled in timeline focus events was_handled = _handle_extended_tline_focus_events(event) if was_handled: # Stop event handling here return True # Pressing timeline button obivously leaves user expecting # to have focus in timeline if gui.sequence_editor_b.has_focus(): _handle_tline_key_event(event) # Stop event handling here return True # Clip button or posbar focus with clip displayed leaves playback keyshortcuts available if (gui.clip_editor_b.has_focus() or (gui.pos_bar.widget.is_focus() and (not timeline_visible()))): _handle_clip_key_event(event) # Stop event handling here return True # Handle non-timeline delete if event.keyval == Gdk.KEY_Delete: return _handle_delete() # Home if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True # Select all with CTRL + A in media panel if event.keyval == Gdk.KEY_a: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if gui.media_list_view.widget.has_focus() or gui.media_list_view.widget.get_focus_child() != None: gui.media_list_view.select_all() return True #debug if event.keyval == Gdk.KEY_F11: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): pass return True #debug if event.keyval == Gdk.KEY_F12: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): pass return True # Key event was not handled here. return False
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. """ # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == Gdk.KEY_Tab: updater.switch_monitor_display() return True # M if event.keyval == Gdk.KEY_m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == Gdk.KEY_1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_3: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == Gdk.KEY_x: tlineaction.cut_pressed() return True # G if event.keyval == Gdk.KEY_g: medialog.log_range_clicked() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode() or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == Gdk.KEY_Up: 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) return True else: monitorevent.up_arrow_seek_on_monitor_clip() # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: 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) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # T if event.keyval == Gdk.KEY_t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == Gdk.KEY_y: if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == Gdk.KEY_u: tlineaction.append_button_pressed() return True # J if event.keyval == Gdk.KEY_j: monitorevent.j_pressed() return True # K if event.keyval == Gdk.KEY_k: monitorevent.k_pressed() return True # L if event.keyval == Gdk.KEY_l: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # CTRL+C if event.keyval == Gdk.KEY_c: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.do_timeline_objects_copy() return True # CTRL+V if event.keyval == Gdk.KEY_v: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.do_timeline_objects_paste() return True # DELETE if event.keyval == Gdk.KEY_Delete: # 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() # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True else: # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) return True return False
def _handle_clip_key_event(event): # Key bindings for MOVE MODES if editorstate.current_is_move_mode(): # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # UP ARROW if event.keyval == Gdk.KEY_Up: 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) return True else: monitorevent.up_arrow_seek_on_monitor_clip() return True # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: 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) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True
def key_down(widget, event): """ Global key press listener. """ # Handle ESCAPE if event.keyval == gtk.keysyms.Escape: if audiowaveform.waveform_thread != None: audiowaveform.waveform_thread.abort_rendering() return True else: if editorstate.current_is_move_mode() == False: editevent.set_default_edit_mode() return True # If timeline widgets are in focus timeline keyevents are available if _timeline_has_focus(): was_handled = _handle_tline_key_event(event) if was_handled: # Stop widget focus from travelling if arrow key pressed for next frame # by stopping signal gui.editor_window.window.emit_stop_by_name("key_press_event") return was_handled # Insert shortcut keys need more focus then timeline shortcuts. # these may already have been handled in timeline focus events was_handled = _handle_extended_tline_focus_events(event) if was_handled: # Stop event handling here return True was_handled = _handle_geometry_editor_arrow_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True # Pressing timeline button obivously leaves user expecting # to have focus in timeline if gui.sequence_editor_b.has_focus(): _handle_tline_key_event(event) # Stop event handling here return True # Clip button or posbar focus with clip displayed leaves playback keyshortcuts available if (gui.clip_editor_b.has_focus() or (gui.pos_bar.widget.is_focus() and (not timeline_visible()))): _handle_clip_key_event(event) # Stop event handling here return True # Handle non-timeline delete if event.keyval == gtk.keysyms.Delete: return _handle_delete() # Home if event.keyval == gtk.keysyms.Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True # Select all with CTRL + A in media panel if event.keyval == gtk.keysyms.a: if (event.state & gtk.gdk.CONTROL_MASK): if gui.media_list_view.widget.has_focus( ) or gui.media_list_view.widget.get_focus_child() != None: gui.media_list_view.select_all() return True #debug if event.keyval == gtk.keysyms.F11: if (event.state & gtk.gdk.CONTROL_MASK): mltrefhold.print_objects() return True #debug if event.keyval == gtk.keysyms.F12: if (event.state & gtk.gdk.CONTROL_MASK): mltrefhold.print_and_clear() return True # Key event was not handled here. return False
def _handle_clip_key_event(event): # Key bindings for MOVE MODES if editorstate.current_is_move_mode(): # LEFT ARROW, prev frame if event.keyval == gtk.keysyms.Left: PLAYER().seek_delta(-1) return # RIGHT ARROW, next frame if event.keyval == gtk.keysyms.Right: PLAYER().seek_delta(1) return # UP ARROW if event.keyval == gtk.keysyms.Up: 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) return True else: monitorevent.up_arrow_seek_on_monitor_clip() return True # DOWN ARROW, prev cut if event.keyval == gtk.keysyms.Down: 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) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # SPACE if event.keyval == gtk.keysyms.space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() # I if event.keyval == gtk.keysyms.i: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == gtk.keysyms.I: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == gtk.keysyms.o: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == gtk.keysyms.O: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True
def tline_canvas_mouse_pressed(event, frame): """ Mouse event callback from timeline canvas widget """ global mouse_disabled if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() # Double click handled separately if event.type == Gdk.EventType._2BUTTON_PRESS: return # Handle and exit parent clip selecting if EDIT_MODE() == editorstate.SELECT_PARENT_CLIP: syncsplitevent.select_sync_parent_mouse_pressed(event, frame) mouse_disabled = True # Set INSERT_MODE set_default_edit_mode() return # Handle and exit tline sync clip selecting if EDIT_MODE() == editorstate.SELECT_TLINE_SYNC_CLIP: audiosync.select_sync_clip_mouse_pressed(event, frame) mouse_disabled = True # Set INSERT_MODE set_default_edit_mode() return # Hitting timeline in clip display mode displays timeline in # default mode. if not timeline_visible(): updater.display_sequence_in_monitor() if (event.button == 1): # Now that we have correct edit mode we'll reenter # this method to get e.g. a select action tline_canvas_mouse_pressed(event, frame) return if (event.button == 3): mouse_disabled == True # Right mouse + CTRL displays clip menu if we hit clip if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_frame(frame) # Right mouse on timeline seeks frame else: success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) return # If clip end drag mode is for some reason still active, exit to default edit mode if EDIT_MODE() == editorstate.CLIP_END_DRAG: editorstate.edit_mode = editorstate.INSERT_MOVE # This shouldn't happen unless for some reason mouse release didn't hit clipenddragmode listener. print "EDIT_MODE() == editorstate.CLIP_END_DRAG at mouse press!" # Check if match frame close is hit if editorstate.current_is_move_mode() and timeline_visible(): if tlinewidgets.match_frame_close_hit(event.x, event.y) == True: tlinewidgets.set_match_frame(-1, -1, True) updater.repaint_tline() return # Check if compositor is hit and if so handle compositor editing if editorstate.current_is_move_mode() and timeline_visible(): hit_compositor = tlinewidgets.compositor_hit( frame, event.y, current_sequence().compositors) if hit_compositor != None: movemodes.clear_selected_clips() if event.button == 1 or (event.button == 3 and event.get_state() & Gdk.ModifierType.CONTROL_MASK): compositormodes.set_compositor_mode(hit_compositor) mode_funcs = EDIT_MODE_FUNCS[editorstate.COMPOSITOR_EDIT] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) elif event.button == 3: mouse_disabled == True compositormodes.set_compositor_selected(hit_compositor) guicomponents.display_compositor_popup_menu( event, hit_compositor, compositor_menu_item_activated) elif event.button == 2: updater.zoom_project_length() return compositormodes.clear_compositor_selection() # Check if we should enter clip end drag mode. if (event.button == 3 and editorstate.current_is_move_mode() and timeline_visible() and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): clipenddragmode.maybe_init_for_mouse_press(event, frame) # Handle mouse button presses depending which button was pressed and # editor state. # RIGHT BUTTON: seek frame or display clip menu if not dragging clip end if (event.button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG): if ((not editorstate.current_is_active_trim_mode()) and timeline_visible()): if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) #else: # PLAYER().seek_frame(frame) else: # For trim modes set <X>_NO_EDIT edit mode and seek frame. and seek frame trimmodes.set_no_edit_trim_mode() PLAYER().seek_frame(frame) return # LEFT BUTTON + CTRL: Select new trimmed clip in one roll trim mode elif (event.button == 1 and (event.get_state() & Gdk.ModifierType.CONTROL_MASK) and EDIT_MODE() == editorstate.ONE_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: if editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return success = trimmodes.set_oneroll_mode(track, frame) if (not success ) and editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return gui.editor_window.set_cursor_to_mode() gui.editor_window.set_mode_selector_to_mode() if not editorpersistance.prefs.quick_enter_trims: mouse_disabled = True else: trimmodes.oneroll_trim_move(event.x, event.y, frame, None) # LEFT BUTTON + CTRL: Select new trimmed clip in two roll trim mode elif (event.button == 1 and (event.get_state() & Gdk.ModifierType.CONTROL_MASK) and EDIT_MODE() == editorstate.TWO_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: if editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return success = trimmodes.set_tworoll_mode(track, frame) if (not success ) and editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return if not editorpersistance.prefs.quick_enter_trims: mouse_disabled = True else: trimmodes.tworoll_trim_move(event.x, event.y, frame, None) elif event.button == 2: updater.zoom_project_length() # LEFT BUTTON: Handle left mouse button edits by passing event to current edit mode # handler func elif event.button == 1 or event.button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame)
def next_pressed(): if current_is_move_mode(): movemodes.next_pressed()
def tline_canvas_mouse_pressed(event, frame): """ Mouse event callback from timeline canvas widget """ editorstate.timeline_mouse_disabled = False # This is used to disable "move and "release" events when they would get bad data. if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() # Double click handled separately if event.type == Gdk.EventType._2BUTTON_PRESS: return # Handle and exit parent clip selecting if EDIT_MODE() == editorstate.SELECT_PARENT_CLIP: syncsplitevent.select_sync_parent_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Handle and exit tline sync clip selecting if EDIT_MODE() == editorstate.SELECT_TLINE_SYNC_CLIP: audiosync.select_sync_clip_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Hitting timeline in clip display mode displays timeline in # default mode. if not timeline_visible(): updater.display_sequence_in_monitor() if (event.button == 1): # Now that we have correct edit mode we'll reenter # this method to get e.g. a select action tline_canvas_mouse_pressed(event, frame) return if (event.button == 3): # Right mouse + CTRL displays clip menu if we hit clip if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_frame(frame) # Right mouse on timeline seeks frame else: success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) return # If clip end drag mode is for some reason still active, exit to default edit mode if EDIT_MODE() == editorstate.CLIP_END_DRAG: modesetting.set_default_edit_mode() # This shouldn't happen unless for some reason mouse release didn't hit clipenddragmode listener. print("EDIT_MODE() == editorstate.CLIP_END_DRAG at mouse press!") # Check if match frame close is hit if editorstate.current_is_move_mode() and timeline_visible(): if tlinewidgets.match_frame_close_hit(event.x, event.y) == True: tlinewidgets.set_match_frame(-1, -1, True) updater.repaint_tline() return # Check if compositor is hit and if so, handle compositor editing if editorstate.current_is_move_mode() and timeline_visible(): hit_compositor = tlinewidgets.compositor_hit(frame, event.x, event.y, current_sequence().compositors) if hit_compositor != None: if editorstate.get_compositing_mode() == appconsts.COMPOSITING_MODE_STANDARD_AUTO_FOLLOW: compositeeditor.set_compositor(hit_compositor) compositormodes.set_compositor_selected(hit_compositor) movemodes.clear_selected_clips() editorstate.timeline_mouse_disabled = True return elif editorstate.auto_follow_active() == False or hit_compositor.obey_autofollow == False: movemodes.clear_selected_clips() if event.button == 1 or (event.button == 3 and event.get_state() & Gdk.ModifierType.CONTROL_MASK): compositormodes.set_compositor_mode(hit_compositor) mode_funcs = EDIT_MODE_FUNCS[editorstate.COMPOSITOR_EDIT] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) return if event.button == 3: compositormodes.set_compositor_selected(hit_compositor) guicomponents.display_compositor_popup_menu(event, hit_compositor, compositor_menu_item_activated) return elif event.button == 2: updater.zoom_project_length() return compositormodes.clear_compositor_selection() # Check if we should enter clip end drag mode if (event.button == 3 and editorstate.current_is_move_mode() and timeline_visible() and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): # with CTRL right mouse clipenddragmode.maybe_init_for_mouse_press(event, frame) elif (timeline_visible() and (EDIT_MODE() == editorstate.INSERT_MOVE or EDIT_MODE() == editorstate.OVERWRITE_MOVE) and (tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_LEFT or tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_RIGHT)): # with pointer context clipenddragmode.maybe_init_for_mouse_press(event, frame) # Handle mouse button presses depending which button was pressed and # editor state. # RIGHT BUTTON: seek frame or display clip menu if not dragging clip end if (event.button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG and EDIT_MODE() != editorstate.KF_TOOL): if ((not editorstate.current_is_active_trim_mode()) and timeline_visible()): if not(event.get_state() & Gdk.ModifierType.CONTROL_MASK): success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) else: # For trim modes set <X>_NO_EDIT edit mode and seek frame. and seek frame trimmodes.set_no_edit_trim_mode() PLAYER().seek_frame(frame) return # LEFT BUTTON: Select new trimmed clip in active one roll trim mode with sensitive cursor. elif (event.button == 1 and EDIT_MODE() == editorstate.ONE_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: modesetting.set_default_edit_mode(True) return success = trimmodes.set_oneroll_mode(track, frame) if not success: modesetting.set_default_edit_mode(True) return if trimmodes.edit_data["to_side_being_edited"] == True: pointer_context = appconsts.POINTER_CONTEXT_TRIM_LEFT else: pointer_context = appconsts.POINTER_CONTEXT_TRIM_RIGHT gui.editor_window.set_tline_cursor_to_context(pointer_context) gui.editor_window.set_tool_selector_to_mode() if not editorpersistance.prefs.quick_enter_trims: editorstate.timeline_mouse_disabled = True else: trimmodes.oneroll_trim_move(event.x, event.y, frame, None) elif event.button == 2: updater.zoom_project_length() # LEFT BUTTON: Handle left mouse button edits by passing event to current edit mode # handler func elif event.button == 1 or event.button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame)
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
def prev_pressed(): if current_is_move_mode(): movemodes.prev_pressed()
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. """ # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == Gdk.KEY_Tab: updater.switch_monitor_display() return True # M if event.keyval == Gdk.KEY_m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == Gdk.KEY_1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_3: if editorstate.edit_mode != editorstate.ONE_ROLL_TRIM and editorstate.edit_mode != editorstate.ONE_ROLL_TRIM_NO_EDIT: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() else: gui.editor_window.toggle_trim_ripple_mode() return True if event.keyval == Gdk.KEY_4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == Gdk.KEY_7: gui.editor_window.handle_box_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == Gdk.KEY_x: tlineaction.cut_pressed() return True # G if event.keyval == Gdk.KEY_g: medialog.log_range_clicked() return True # R if event.keyval == Gdk.KEY_r: gui.editor_window.toggle_trim_ripple_mode() return True # Key bindings for keyboard trimming if editorstate.current_is_active_trim_mode() == True: # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: trimmodes.left_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: trimmodes.right_arrow_pressed( (event.get_state() & Gdk.ModifierType.CONTROL_MASK)) return True if event.keyval == Gdk.KEY_Return: trimmodes.enter_pressed() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode( ) or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == Gdk.KEY_Up: 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() # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: 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 # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # T if event.keyval == Gdk.KEY_t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == Gdk.KEY_y: if not (event.get_state() & Gdk.ModifierType.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == Gdk.KEY_u: tlineaction.append_button_pressed() return True # J if event.keyval == Gdk.KEY_j: monitorevent.j_pressed() return True # K if event.keyval == Gdk.KEY_k: monitorevent.k_pressed() return True # L if event.keyval == Gdk.KEY_l: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # S if event.keyval == Gdk.KEY_s: tlineaction.resync_button_pressed() return True # DELETE if event.keyval == Gdk.KEY_Delete: # 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() # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True # END if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True else: # HOME if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) _move_to_beginning() return True # END if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_end() _move_to_end() return True return False
def end_pressed(): if current_is_move_mode(): movemodes.end_pressed()
def tline_canvas_mouse_pressed(event, frame): """ Mouse event callback from timeline canvas widget """ editorstate.timeline_mouse_disabled = False # This is used to disable "move and "release" events when they would get bad data. if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() # Double click handled separately if event.type == Gdk.EventType._2BUTTON_PRESS: return # Handle and exit parent clip selecting if EDIT_MODE() == editorstate.SELECT_PARENT_CLIP: syncsplitevent.select_sync_parent_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Handle and exit tline sync clip selecting if EDIT_MODE() == editorstate.SELECT_TLINE_SYNC_CLIP: audiosync.select_sync_clip_mouse_pressed(event, frame) editorstate.timeline_mouse_disabled = True # Set INSERT_MODE modesetting.set_default_edit_mode() return # Hitting timeline in clip display mode displays timeline in # default mode. if not timeline_visible(): updater.display_sequence_in_monitor() if (event.button == 1): # Now that we have correct edit mode we'll reenter # this method to get e.g. a select action tline_canvas_mouse_pressed(event, frame) return if (event.button == 3): # Right mouse + CTRL displays clip menu if we hit clip if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_frame(frame) # Right mouse on timeline seeks frame else: success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) return # If clip end drag mode is for some reason still active, exit to default edit mode if EDIT_MODE() == editorstate.CLIP_END_DRAG: modesetting.set_default_edit_mode() # This shouldn't happen unless for some reason mouse release didn't hit clipenddragmode listener. print "EDIT_MODE() == editorstate.CLIP_END_DRAG at mouse press!" # Check if match frame close is hit if editorstate.current_is_move_mode() and timeline_visible(): if tlinewidgets.match_frame_close_hit(event.x, event.y) == True: tlinewidgets.set_match_frame(-1, -1, True) updater.repaint_tline() return # Check if compositor is hit and if so, handle compositor editing if editorstate.current_is_move_mode() and timeline_visible(): hit_compositor = tlinewidgets.compositor_hit(frame, event.y, current_sequence().compositors) if hit_compositor != None: if editorstate.auto_follow == False or hit_compositor.obey_autofollow == False: movemodes.clear_selected_clips() if event.button == 1 or (event.button == 3 and event.get_state() & Gdk.ModifierType.CONTROL_MASK): compositormodes.set_compositor_mode(hit_compositor) mode_funcs = EDIT_MODE_FUNCS[editorstate.COMPOSITOR_EDIT] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) return if event.button == 3: compositormodes.set_compositor_selected(hit_compositor) guicomponents.display_compositor_popup_menu(event, hit_compositor, compositor_menu_item_activated) return elif event.button == 2: updater.zoom_project_length() return compositormodes.clear_compositor_selection() # Check if we should enter clip end drag mode if (event.button == 3 and editorstate.current_is_move_mode() and timeline_visible() and (event.get_state() & Gdk.ModifierType.CONTROL_MASK)): # with CTRL right mouse clipenddragmode.maybe_init_for_mouse_press(event, frame) elif (timeline_visible() and (EDIT_MODE() == editorstate.INSERT_MOVE or EDIT_MODE() == editorstate.OVERWRITE_MOVE) and (tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_LEFT or tlinewidgets.pointer_context == appconsts.POINTER_CONTEXT_END_DRAG_RIGHT)): # with pointer context clipenddragmode.maybe_init_for_mouse_press(event, frame) # Handle mouse button presses depending which button was pressed and # editor state. # RIGHT BUTTON: seek frame or display clip menu if not dragging clip end if (event.button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG and EDIT_MODE() != editorstate.KF_TOOL): if ((not editorstate.current_is_active_trim_mode()) and timeline_visible()): if not(event.get_state() & Gdk.ModifierType.CONTROL_MASK): success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) else: # For trim modes set <X>_NO_EDIT edit mode and seek frame. and seek frame trimmodes.set_no_edit_trim_mode() PLAYER().seek_frame(frame) return # LEFT BUTTON: Select new trimmed clip in active one roll trim mode with sensitive cursor. elif (event.button == 1 and EDIT_MODE() == editorstate.ONE_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: modesetting.set_default_edit_mode(True) return success = trimmodes.set_oneroll_mode(track, frame) if not success: modesetting.set_default_edit_mode(True) return if trimmodes.edit_data["to_side_being_edited"] == True: pointer_context = appconsts.POINTER_CONTEXT_TRIM_LEFT else: pointer_context = appconsts.POINTER_CONTEXT_TRIM_RIGHT gui.editor_window.set_tline_cursor_to_context(pointer_context) gui.editor_window.set_tool_selector_to_mode() if not editorpersistance.prefs.quick_enter_trims: editorstate.timeline_mouse_disabled = True else: trimmodes.oneroll_trim_move(event.x, event.y, frame, None) elif event.button == 2: updater.zoom_project_length() # LEFT BUTTON: Handle left mouse button edits by passing event to current edit mode # handler func elif event.button == 1 or event.button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame)
def display_clip_in_monitor(clip_monitor_currently_active=False): """ Sets mltplayer producer to be video file clip and updates GUI. """ if MONITOR_MEDIA_FILE() == None: gui.editor_window.clip_editor_b.set_active(False) return global save_monitor_frame save_monitor_frame = True # Opening clip exits trim modes if not editorstate.current_is_move_mode(): set_clip_edit_mode_callback() gui.clip_editor_b.set_sensitive(True) editorstate._timeline_displayed = False # Save timeline pos if so directed. if clip_monitor_currently_active == False: global saved_timeline_pos saved_timeline_pos = PLAYER().current_frame() editorstate.tline_shadow_frame = saved_timeline_pos # If we're already displaying monitor clip we stop consumer # to supress timeline flashing between monitor clips if clip_monitor_currently_active == False: editorstate.PLAYER().consumer.stop() # Clear old clip current_sequence().clear_hidden_track() # Create and display clip on hidden track if MONITOR_MEDIA_FILE( ).type == appconsts.PATTERN_PRODUCER or MONITOR_MEDIA_FILE( ).type == appconsts.IMAGE_SEQUENCE: # pattern producer or image sequence clip_producer = current_sequence().display_monitor_clip( None, MONITOR_MEDIA_FILE()) else: # File producers clip_producer = current_sequence().display_monitor_clip( MONITOR_MEDIA_FILE().path) # Timeline flash does not happen if we start consumer after monitor clip is # already on sequence if clip_monitor_currently_active == False: editorstate.PLAYER().consumer.start() # IMAGE_SEQUENCE files always returns 15000 for get_length from mlt so we have to monkeypatch that method to get correct results if MONITOR_MEDIA_FILE().type == appconsts.IMAGE_SEQUENCE: clip_producer.get_length = lambda: MONITOR_MEDIA_FILE().length clip_producer.mark_in = MONITOR_MEDIA_FILE().mark_in clip_producer.mark_out = MONITOR_MEDIA_FILE().mark_out # Give IMAGE and PATTERN_PRODUCER media types default mark in and mark out if not already set. # This makes them reasonably short and trimmable in both directions. if clip_producer.media_type == appconsts.IMAGE or clip_producer.media_type == appconsts.PATTERN_PRODUCER: if clip_producer.mark_in == -1 and clip_producer.mark_out == -1: center_frame = clip_producer.get_length() / 2 default_length_half = 75 mark_in = center_frame - default_length_half mark_out = center_frame + default_length_half - 1 clip_producer.mark_in = mark_in clip_producer.mark_out = mark_out MONITOR_MEDIA_FILE().mark_in = mark_in MONITOR_MEDIA_FILE().mark_out = mark_out # Display frame, marks and pos gui.pos_bar.update_display_from_producer(clip_producer) display_monitor_clip_name() if MONITOR_MEDIA_FILE().type == appconsts.IMAGE or \ MONITOR_MEDIA_FILE().type == appconsts.PATTERN_PRODUCER: PLAYER().seek_frame(0) else: if editorpersistance.prefs.remember_monitor_clip_frame: PLAYER().seek_frame(MONITOR_MEDIA_FILE().current_frame) else: PLAYER().seek_frame(0) display_marks_tc() gui.pos_bar.widget.grab_focus() gui.media_list_view.widget.queue_draw() if editorpersistance.prefs.auto_play_in_clip_monitor == True: PLAYER().start_playback() repaint_tline()
def key_down(widget, event): """ Global key press listener. """ # Handle ESCAPE if event.keyval == Gdk.KEY_Escape: if audiowaveform.waveform_thread != None: audiowaveform.waveform_thread.abort_rendering() return True elif editorstate.current_is_move_mode() == False: modesetting.set_default_edit_mode() return True elif gui.big_tc.get_visible_child_name() == "BigTCEntry": gui.big_tc.set_visible_child_name("BigTCDisplay") return True # Compositor editors keyevents was_handled = _handle_geometry_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True was_handled = _handle_effects_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True # If timeline widgets are in focus timeline keyevents are available if _timeline_has_focus(): was_handled = _handle_tline_key_event(event) if was_handled: # Stop widget focus from travelling if arrow key pressed for next frame # by stopping signal gui.editor_window.window.emit_stop_by_name("key_press_event") return was_handled # Insert shortcut keys need more focus then timeline shortcuts. # these may already have been handled in timeline focus events was_handled = _handle_extended_monitor_focus_events(event) if was_handled: # Stop event handling here return True was_handled = _handle_configurable_global_events(event) if was_handled: return True # Pressing timeline button obivously leaves user expecting # to have focus in timeline if gui.monitor_switch.widget.has_focus() and timeline_visible(): _handle_tline_key_event(event) return True if gui.monitor_switch.widget.has_focus() and (not timeline_visible()): _handle_clip_key_event(event) return True if gui.pos_bar.widget.is_focus() and (not timeline_visible()): _handle_clip_key_event(event) return True # Handle non-timeline delete if event.keyval == Gdk.KEY_Delete: return _handle_delete() # Home if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True # End if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True # Select all with CTRL + A in media panel if event.keyval == Gdk.KEY_a: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if gui.media_list_view.widget.has_focus() or gui.media_list_view.widget.get_focus_child() != None: gui.media_list_view.select_all() return True if event.keyval == Gdk.KEY_F11: menuactions.toggle_fullscreen() return True #debug.test help if event.keyval == Gdk.KEY_F12: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): rotomask.show_rotomask() return True # Key event was not handled here. return False
def tline_canvas_mouse_pressed(event, frame): """ Mouse event callback from timeline canvas widget """ global mouse_disabled if PLAYER().looping(): return elif PLAYER().is_playing(): PLAYER().stop_playback() # Double click handled separately if event.type == gtk.gdk._2BUTTON_PRESS: return # Handle and exit parent clip selecting if EDIT_MODE() == editorstate.SELECT_PARENT_CLIP: syncsplitevent.select_sync_parent_mouse_pressed(event, frame) mouse_disabled = True # Set INSERT_MODE set_default_edit_mode() return # Hitting timeline in clip display mode displays timeline in # default mode. if not timeline_visible(): updater.display_sequence_in_monitor() if (event.button == 1): # Now that we have correct edit mode we'll reenter # this method to get e.g. a select action tline_canvas_mouse_pressed(event, frame) return if (event.button == 3): mouse_disabled == True # Right mouse + CTRL displays clip menu if we hit clip if (event.state & gtk.gdk.CONTROL_MASK): PLAYER().seek_frame(frame) # Right mouse on timeline seeks frame else: success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) return # Check if compositor is hit and if so handle compositor editing if editorstate.current_is_move_mode() and timeline_visible(): hit_compositor = tlinewidgets.compositor_hit(frame, event.y, current_sequence().compositors) if hit_compositor != None: movemodes.clear_selected_clips() if event.button == 1: compositormodes.set_compositor_mode(hit_compositor) mode_funcs = EDIT_MODE_FUNCS[editorstate.COMPOSITOR_EDIT] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) elif event.button == 3: mouse_disabled == True compositormodes.set_compositor_selected(hit_compositor) guicomponents.display_compositor_popup_menu(event, hit_compositor, compositor_menu_item_activated) elif event.button == 2: updater.zoom_project_length() return compositormodes.clear_compositor_selection() # Handle mouse button presses depending which button was pressed and # editor state. # RIGHT BUTTON: seek frame or display clip menu if (event.button == 3): if ((not editorstate.current_is_active_trim_mode()) and timeline_visible()): if not(event.state & gtk.gdk.CONTROL_MASK): success = display_clip_menu_pop_up(event.y, event, frame) if not success: PLAYER().seek_frame(frame) else: PLAYER().seek_frame(frame) else: # For trim modes set <X>_NO_EDIT edit mode and seek frame. and seek frame trimmodes.set_no_edit_trim_mode() PLAYER().seek_frame(frame) return # LEFT BUTTON + CTRL: Select new trimmed clip in one roll trim mode elif (event.button == 1 and (event.state & gtk.gdk.CONTROL_MASK) and EDIT_MODE() == editorstate.ONE_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: if editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return success = trimmodes.set_oneroll_mode(track, frame) if (not success) and editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return gui.editor_window.set_cursor_to_mode() gui.editor_window.set_mode_selector_to_mode() if not editorpersistance.prefs.quick_enter_trims: mouse_disabled = True else: trimmodes.oneroll_trim_move(event.x, event.y, frame, None) # LEFT BUTTON + CTRL: Select new trimmed clip in two roll trim mode elif (event.button == 1 and (event.state & gtk.gdk.CONTROL_MASK) and EDIT_MODE() == editorstate.TWO_ROLL_TRIM): track = tlinewidgets.get_track(event.y) if track == None: if editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return success = trimmodes.set_tworoll_mode(track, frame) if (not success) and editorpersistance.prefs.empty_click_exits_trims == True: set_default_edit_mode(True) return if not editorpersistance.prefs.quick_enter_trims: mouse_disabled = True else: trimmodes.tworoll_trim_move(event.x, event.y, frame, None) # LEFT BUTTON: Handle left mouse button edits by passing event to current edit mode # handler func elif event.button == 1: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] press_func = mode_funcs[TL_MOUSE_PRESS] press_func(event, frame) elif event.button == 2: updater.zoom_project_length()
def tline_cursor_leave(self, event): editorstate.cursor_on_tline = False self.set_cursor_to_mode() if event.state & gtk.gdk.BUTTON1_MASK: if editorstate.current_is_move_mode(): tlineaction.mouse_dragged_out(event)
def display_clip_in_monitor(clip_monitor_currently_active=False): """ Sets mltplayer producer to be video file clip and updates GUI. """ if MONITOR_MEDIA_FILE() == None: gui.editor_window.clip_editor_b.set_active(False) return global save_monitor_frame save_monitor_frame = True # Opening clip exits trim modes if not editorstate.current_is_move_mode(): set_clip_edit_mode_callback() gui.clip_editor_b.set_sensitive(True) editorstate._timeline_displayed = False # Save timeline pos if so directed. if clip_monitor_currently_active == False: global saved_timeline_pos saved_timeline_pos = PLAYER().current_frame() editorstate.tline_shadow_frame = saved_timeline_pos # If we're already displaying monitor clip we stop consumer # to supress timeline flashing between monitor clips if clip_monitor_currently_active == False: editorstate.PLAYER().consumer.stop() # Clear old clip current_sequence().clear_hidden_track() # Create and display clip on hidden track if MONITOR_MEDIA_FILE().type == appconsts.PATTERN_PRODUCER or MONITOR_MEDIA_FILE().type == appconsts.IMAGE_SEQUENCE: # pattern producer or image sequence clip_producer = current_sequence().display_monitor_clip(None, MONITOR_MEDIA_FILE()) else: # File producers clip_producer = current_sequence().display_monitor_clip(MONITOR_MEDIA_FILE().path) # Timeline flash does not happen if we start consumer after monitor clip is # already on sequence if clip_monitor_currently_active == False: editorstate.PLAYER().consumer.start() # IMAGE_SEQUENCE files always returns 15000 for get_length from mlt so we have to monkeypatch that method to get correct results if MONITOR_MEDIA_FILE().type == appconsts.IMAGE_SEQUENCE: clip_producer.get_length = lambda : MONITOR_MEDIA_FILE().length clip_producer.mark_in = MONITOR_MEDIA_FILE().mark_in clip_producer.mark_out = MONITOR_MEDIA_FILE().mark_out # Give IMAGE and PATTERN_PRODUCER media types default mark in and mark out if not already set. # This makes them reasonably short and trimmable in both directions. if clip_producer.media_type == appconsts.IMAGE or clip_producer.media_type == appconsts.PATTERN_PRODUCER: if clip_producer.mark_in == -1 and clip_producer.mark_out == -1: center_frame = clip_producer.get_length() / 2 default_length_half = 75 mark_in = center_frame - default_length_half mark_out = center_frame + default_length_half - 1 clip_producer.mark_in = mark_in clip_producer.mark_out = mark_out MONITOR_MEDIA_FILE().mark_in = mark_in MONITOR_MEDIA_FILE().mark_out = mark_out display_monitor_clip_name() # Display frame, marks and pos gui.pos_bar.update_display_from_producer(clip_producer) if MONITOR_MEDIA_FILE().type == appconsts.IMAGE or \ MONITOR_MEDIA_FILE().type == appconsts.PATTERN_PRODUCER: PLAYER().seek_frame(0) else: if editorpersistance.prefs.remember_monitor_clip_frame: PLAYER().seek_frame(MONITOR_MEDIA_FILE().current_frame) else: PLAYER().seek_frame(0) display_marks_tc() gui.pos_bar.widget.grab_focus() gui.media_list_view.widget.queue_draw() if editorpersistance.prefs.auto_play_in_clip_monitor == True: PLAYER().start_playback() repaint_tline()
def start_pressed(): if current_is_move_mode(): movemodes.start_pressed()
def next_pressed(): if current_is_move_mode(): movemodes.next_pressed() """ This is highly f*****g suspect, it does an edit immediately
def _handle_clip_key_event(event): # Key bindings for MOVE MODES if editorstate.current_is_move_mode(): # LEFT ARROW, prev frame if event.keyval == Gdk.KEY_Left: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(-10) else: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == Gdk.KEY_Right: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): PLAYER().seek_delta(10) else: PLAYER().seek_delta(1) return True # UP ARROW if event.keyval == Gdk.KEY_Up: 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 # DOWN ARROW, prev cut if event.keyval == Gdk.KEY_Down: 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 # SPACE if event.keyval == Gdk.KEY_space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() # I if event.keyval == Gdk.KEY_i: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == Gdk.KEY_I: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == Gdk.KEY_o: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == Gdk.KEY_O: if (event.get_state() & Gdk.ModifierType.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_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 == '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 == 'sequence_split': tlineaction.sequence_split_pressed() return True if action == 'log_range': medialog.log_range_clicked() return True """ THis may need rethinking 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 # 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 == '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 == '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': # 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 == '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
def key_down(widget, event): """ Global key press listener. """ # Handle ESCAPE if event.keyval == Gdk.KEY_Escape: if audiowaveform.waveform_thread != None: audiowaveform.waveform_thread.abort_rendering() return True elif editorstate.current_is_move_mode() == False: modesetting.set_default_edit_mode() return True elif gui.big_tc.get_visible_child_name() == "BigTCEntry": gui.big_tc.set_visible_child_name("BigTCDisplay") return True # Compositor editors keyevents was_handled = _handle_geometry_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True was_handled = _handle_effects_editor_keys(event) if was_handled: # Stop widget focus from travelling if arrow key pressed gui.editor_window.window.emit_stop_by_name("key_press_event") return True # If timeline widgets are in focus timeline keyevents are available if _timeline_has_focus(): was_handled = _handle_tline_key_event(event) if was_handled: # Stop widget focus from travelling if arrow key pressed for next frame # by stopping signal gui.editor_window.window.emit_stop_by_name("key_press_event") return was_handled # Insert shortcut keys need more focus then timeline shortcuts. # these may already have been handled in timeline focus events was_handled = _handle_extended_tline_focus_events(event) if was_handled: # Stop event handling here return True # Pressing timeline button obivously leaves user expecting # to have focus in timeline """ TODO: this needs something if gui.sequence_editor_b.has_focus(): _handle_tline_key_event(event) # Stop event handling here return True """ # Clip button or posbar focus with clip displayed leaves playback keyshortcuts available """ if (gui.clip_editor_b.has_focus() TODO: this needs something or (gui.pos_bar.widget.is_focus() and (not timeline_visible()))): _handle_clip_key_event(event) # Stop event handling here return True """ if gui.monitor_switch.widget.has_focus() and timeline_visible(): _handle_tline_key_event(event) return True if gui.monitor_switch.widget.has_focus() and (not timeline_visible()): _handle_clip_key_event(event) return True if gui.pos_bar.widget.is_focus() and (not timeline_visible()): _handle_clip_key_event(event) return True # Handle non-timeline delete if event.keyval == Gdk.KEY_Delete: return _handle_delete() # Home if event.keyval == Gdk.KEY_Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) _move_to_beginning() return True # End if event.keyval == Gdk.KEY_End: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_end() _move_to_end() return True # Select all with CTRL + A in media panel if event.keyval == Gdk.KEY_a: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): if gui.media_list_view.widget.has_focus() or gui.media_list_view.widget.get_focus_child() != None: gui.media_list_view.select_all() return True if event.keyval == Gdk.KEY_F11: menuactions.toggle_fullscreen() return True #debug if event.keyval == Gdk.KEY_F12: if (event.get_state() & Gdk.ModifierType.CONTROL_MASK): pass return True # Key event was not handled here. return False
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. """ # I if event.keyval == gtk.keysyms.i: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.mark_in_pressed() return True if event.keyval == gtk.keysyms.I: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_in_pressed() return True monitorevent.to_mark_in_pressed() return True # O if event.keyval == gtk.keysyms.o: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.mark_out_pressed() return True if event.keyval == gtk.keysyms.O: if (event.state & gtk.gdk.MOD1_MASK): monitorevent.to_mark_out_pressed() return True monitorevent.to_mark_out_pressed() return True # SPACE if event.keyval == gtk.keysyms.space: if PLAYER().is_playing(): monitorevent.stop_pressed() else: monitorevent.play_pressed() return True # TAB if event.keyval == gtk.keysyms.Tab: updater.switch_monitor_display() return True # M if event.keyval == gtk.keysyms.m: tlineaction.add_marker() return True # Number edit mode changes if event.keyval == gtk.keysyms._1: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._2: gui.editor_window.handle_over_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._3: gui.editor_window.handle_one_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._4: gui.editor_window.handle_two_roll_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._5: gui.editor_window.handle_slide_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True if event.keyval == gtk.keysyms._6: gui.editor_window.handle_multi_mode_button_press() gui.editor_window.set_mode_selector_to_mode() return True # X if event.keyval == gtk.keysyms.x: tlineaction.cut_pressed() return True # G if event.keyval == gtk.keysyms.g: medialog.log_range_clicked() return True # Key bindings for MOVE MODES and _NO_EDIT modes if editorstate.current_is_move_mode( ) or editorstate.current_is_active_trim_mode() == False: # UP ARROW, next cut if event.keyval == gtk.keysyms.Up: 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) return True else: monitorevent.up_arrow_seek_on_monitor_clip() # DOWN ARROW, prev cut if event.keyval == gtk.keysyms.Down: 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) return True else: monitorevent.down_arrow_seek_on_monitor_clip() return True # LEFT ARROW, prev frame if event.keyval == gtk.keysyms.Left: PLAYER().seek_delta(-1) return True # RIGHT ARROW, next frame if event.keyval == gtk.keysyms.Right: PLAYER().seek_delta(1) return True # T if event.keyval == gtk.keysyms.t: tlineaction.three_point_overwrite_pressed() return True # Y if event.keyval == gtk.keysyms.y: if not (event.state & gtk.gdk.CONTROL_MASK): tlineaction.insert_button_pressed() return True # U if event.keyval == gtk.keysyms.u: tlineaction.append_button_pressed() return True # J if event.keyval == gtk.keysyms.j: monitorevent.j_pressed() return True # K if event.keyval == gtk.keysyms.k: monitorevent.k_pressed() return True # L if event.keyval == gtk.keysyms.l: if (event.state & gtk.gdk.CONTROL_MASK): medialog.log_range_clicked() else: monitorevent.l_pressed() return True # CTRL+C if event.keyval == gtk.keysyms.c: if (event.state & gtk.gdk.CONTROL_MASK): tlineaction.do_timeline_objects_copy() return True # CTRL+V if event.keyval == gtk.keysyms.v: if (event.state & gtk.gdk.CONTROL_MASK): tlineaction.do_timeline_objects_paste() return True # DELETE if event.keyval == gtk.keysyms.Delete: # 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() # HOME if event.keyval == gtk.keysyms.Home: if PLAYER().is_playing(): monitorevent.stop_pressed() PLAYER().seek_frame(0) return True else: # HOME if event.keyval == gtk.keysyms.Home: if PLAYER().is_playing(): monitorevent.stop_pressed() gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode() PLAYER().seek_frame(0) return True return False