def get_snapped_x(x, track, edit_data): if snapping_on == False: return x frame = _get_frame_for_x_func(x) # Do snaps for relevant edit modes. if EDIT_MODE() == editorstate.OVERWRITE_MOVE: if editorstate.overwrite_mode_box == True: return x return _overwrite_move_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.CLIP_END_DRAG: return _object_end_drag_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.COMPOSITOR_EDIT: track = current_sequence().tracks[ compositormodes.compositor.transition.b_track - 1] if compositormodes.sub_mode == compositormodes.TRIM_EDIT: return _object_end_drag_snap(x, track, frame, edit_data) elif compositormodes.sub_mode == compositormodes.MOVE_EDIT: return _compositor_move_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM or EDIT_MODE( ) == editorstate.TWO_ROLL_TRIM: return _trimming_snap(x, track, frame, edit_data) # Many edit modes do not have snapping even if snapping is on return x
def tline_canvas_mouse_released(x, y, frame, button, state): """ Mouse event callback from timeline canvas widget """ gui.editor_window.set_cursor_to_mode() # we need this for box move at least, probably trims too if editorstate.timeline_mouse_disabled == True: gui.editor_window.set_cursor_to_mode() # we only need this update when mode change (to active trim mode) disables mouse, so we'll only do this then tlinewidgets.trim_mode_in_non_active_state = False # we only need this update when mode change (to active trim mode) disables mouse, so we'll only do this then gui.tline_canvas.widget.queue_draw() editorstate.timeline_mouse_disabled = False return if not timeline_visible(): return if PLAYER().looping(): PLAYER().stop_loop_playback(trimmodes.trim_looping_stopped) return # Handle timeline position setting with right mouse button if button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG and EDIT_MODE() != editorstate.COMPOSITOR_EDIT and EDIT_MODE() != editorstate.KF_TOOL: if not timeline_visible(): return PLAYER().seek_frame(frame) # Handle mouse button edits elif button == 1 or button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] release_func = mode_funcs[TL_MOUSE_RELEASE] release_func(x, y, frame, state)
def stop_looping(): # Stop trim mode looping using trimmodes.py methods for it # Called when entering move modes. if PLAYER().looping(): if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: trimmodes.oneroll_stop_pressed() if EDIT_MODE() == editorstate.TWO_ROLL_TRIM: trimmodes.tworoll_stop_pressed()
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 cut_pressed(): if not timeline_visible(): updater.display_sequence_in_monitor() if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: editevent.oneroll_trim_no_edit_init() return if EDIT_MODE() == editorstate.TWO_ROLL_TRIM: editevent.tworoll_trim_no_edit_init() return tline_frame = PLAYER().current_frame() movemodes.clear_selected_clips() # Iterate tracks and do cut on all active that have non-blanck # clips and frame is not on previous edits for i in range(1, len(current_sequence().tracks)): track = get_track(i) if track.active == False: continue if editevent.track_lock_check_and_user_info( track, cut_pressed, "cut"): # so the other tracks get cut... continue # Get index and clip index = track.get_clip_index_at(int(tline_frame)) try: clip = track.clips[index] # don't cut blanck clip if clip.is_blanck_clip: continue except Exception: continue # Frame after last clip in track # Get cut frame in clip frames clip_start_in_tline = track.clip_start(index) clip_frame = tline_frame - clip_start_in_tline + clip.clip_in # Dont edit if frame on cut. if clip_frame == clip.clip_in: continue # Do edit data = { "track": track, "index": index, "clip": clip, "clip_cut_frame": clip_frame } action = edit.cut_action(data) action.do_edit() updater.repaint_tline()
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 enter_pressed(): global submode if submode != KEYB_EDIT_ON: return if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: _one_roll_enter_edit() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: _tworoll_enter_edit() elif EDIT_MODE() == editorstate.SLIDE_TRIM: _slide_enter_edit() submode = NOTHING_ON
def tline_canvas_mouse_released(x, y, frame, button, state): """ Mouse event callback from timeline canvas widget """ gui.editor_window.set_cursor_to_mode() global mouse_disabled if mouse_disabled == True: gui.editor_window.set_cursor_to_mode() # we only need this update when mode change (to active trim mode) disables mouse, so we'll only do this then tlinewidgets.trim_mode_in_non_active_state = False # we only need this update when mode change (to active trim mode) disables mouse, so we'll only do this then gui.tline_canvas.widget.queue_draw() mouse_disabled = False return if not timeline_visible(): return if PLAYER().looping(): PLAYER().stop_loop_playback(trimmodes.trim_looping_stopped) return # Handle timeline position setting with right mouse button if button == 3: #if not editorstate.current_is_move_mode(): # return if not timeline_visible(): return PLAYER().seek_frame(frame) # Handle left mouse button edits elif button == 1: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] release_func = mode_funcs[TL_MOUSE_RELEASE] release_func(x, y, frame, state)
def right_arrow_pressed(ctrl_pressed): global submode if submode == MOUSE_EDIT_ON: return submode = KEYB_EDIT_ON delta = 1 if ctrl_pressed: delta = 10 if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: _one_roll_trim_right(delta) elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: _tworoll_trim_right(delta) elif EDIT_MODE() == editorstate.SLIDE_TRIM: _slide_trim_right(delta)
def set_clip_monitor_edit_mode(): """ Going to clip monitor exits active trimodes into non active trimmodes. """ if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: oneroll_trim_no_edit_init() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: pass elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: tworoll_trim_no_edit_init() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: pass else: gui.editor_window.set_default_edit_tool() gui.editor_window.set_tool_selector_to_mode()
def set_clip_monitor_edit_mode(): """ Going to clip monitor exits active trimodes into non active trimmodes. """ if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: oneroll_trim_no_edit_init() elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM_NO_EDIT: pass elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM: tworoll_trim_no_edit_init() elif EDIT_MODE() == editorstate.TWO_ROLL_TRIM_NO_EDIT: pass else: gui.editor_window.handle_insert_move_mode_button_press() gui.editor_window.set_mode_selector_to_mode()
def get_snapped_x(x, track, edit_data): if snapping_on == False: return x frame = _get_frame_for_x_func(x) # Do snaps for relevant edit modes. if EDIT_MODE() == editorstate.OVERWRITE_MOVE: if editorstate.overwrite_mode_box == True: return x return _overwrite_move_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.CLIP_END_DRAG: return _object_end_drag_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.COMPOSITOR_EDIT: track = current_sequence().tracks[compositormodes.compositor.transition.b_track - 1] if compositormodes.sub_mode == compositormodes.TRIM_EDIT: if compositormodes.edit_data["trim_is_clip_in"] == False: # This has different out frame semantics then clips, +1 makes the same function work in this case. frame = frame + 1 return _object_end_drag_snap(x, track, frame, edit_data) elif compositormodes.sub_mode == compositormodes.MOVE_EDIT: return _compositor_move_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.ONE_ROLL_TRIM or EDIT_MODE() == editorstate.TWO_ROLL_TRIM: return _trimming_snap(x, track, frame, edit_data) elif EDIT_MODE() == editorstate.MULTI_MOVE: return _spacer_move_snap(x, track, frame, edit_data) # Many edit modes do not have snapping even if snapping is on return x
def tline_canvas_mouse_moved(x, y, frame, button, state): """ Mouse event callback from timeline canvas widget """ # Refuse mouse events for some editor states. if PLAYER().looping(): return if editorstate.timeline_mouse_disabled == True: return if not timeline_visible(): return # Handle timeline position setting with right mouse button if button == 3 and EDIT_MODE() != editorstate.CLIP_END_DRAG and EDIT_MODE() != editorstate.COMPOSITOR_EDIT and EDIT_MODE() != editorstate.KF_TOOL: if not timeline_visible(): return PLAYER().seek_frame(frame) # Handle mouse button edits elif button == 1 or button == 3: mode_funcs = EDIT_MODE_FUNCS[EDIT_MODE()] move_func = mode_funcs[TL_MOUSE_MOVE] move_func(x, y, frame, state)
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()
def tline_media_drop(media_file, x, y, use_marks=False): track = tlinewidgets.get_track(y) if track == None: return if track.id < 1 or track.id >= (len(current_sequence().tracks) - 1): return if dialogutils.track_lock_check_and_user_info(track): #modesetting.set_default_edit_mode() # TODO: Info return modesetting.stop_looping() if EDIT_MODE() == editorstate.KF_TOOL: kftoolmode.exit_tool() frame = tlinewidgets.get_frame(x) # Create new clip. if media_file.type != appconsts.PATTERN_PRODUCER: if media_file.container_data == None: # Standard clips new_clip = current_sequence().create_file_producer_clip(media_file.path, media_file.name, False, media_file.ttl) else: # Container clips new_clip = current_sequence().create_file_producer_clip(media_file.path, media_file.name, False, media_file.ttl) new_clip.container_data = media_file.container_data else: new_clip = current_sequence().create_pattern_producer(media_file) # Set clip in and out if use_marks == False: new_clip.mark_in = 0 new_clip.mark_out = new_clip.get_length() - 1 # - 1 because out is mark_out inclusive if media_file.type == appconsts.IMAGE_SEQUENCE: new_clip.mark_out = media_file.length else: if new_clip.media_type == appconsts.IMAGE or new_clip.media_type == appconsts.PATTERN_PRODUCER: # 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. # NOTE: WE SHOULD BE DOING THIS AT CREATION TIME, WE'RE DOING THE SAME THING IN updater.display_clip_in_monitor() ? # ...but then we would need to patch persistance.py...maybe keep this even if not too smart. # TODO: Make default length user settable or use graphics value if (hasattr(new_clip, 'mark_in') == False) or (new_clip.mark_in == -1 and new_clip.mark_out == -1): center_frame = new_clip.get_length() // 2 default_length_half = 75 mark_in = center_frame - default_length_half mark_out = center_frame + default_length_half - 1 new_clip.mark_in = mark_in new_clip.mark_out = mark_out else: # All the rest new_clip.mark_in = media_file.mark_in new_clip.mark_out = media_file.mark_out if new_clip.mark_in == -1: new_clip.mark_in = 0 if new_clip.mark_out == -1: new_clip.mark_out = new_clip.get_length() - 1 # - 1 because out is mark_out inclusive if media_file.type == appconsts.IMAGE_SEQUENCE: new_clip.mark_out = media_file.length # Graphics files get added with their default lengths f_name, ext = os.path.splitext(media_file.name) if utils.file_extension_is_graphics_file(ext) and media_file.type != appconsts.IMAGE_SEQUENCE: # image sequences are graphics files but have own length in_fr, out_fr, l = editorpersistance.get_graphics_default_in_out_length() new_clip.mark_in = in_fr new_clip.mark_out = out_fr # Non-insert DND actions if editorpersistance.prefs.dnd_action == appconsts.DND_OVERWRITE_NON_V1: if track.id != current_sequence().first_video_track().id: drop_done = _attempt_dnd_overwrite(track, new_clip, frame) if drop_done == True: return elif editorpersistance.prefs.dnd_action == appconsts.DND_ALWAYS_OVERWRITE: drop_done = _attempt_dnd_overwrite(track, new_clip, frame) if drop_done == True: return do_clip_insert(track, new_clip, frame)
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 tline_media_drop(media_file, x, y, use_marks=False): track = tlinewidgets.get_track(y) if track == None: return if track.id < 1 or track.id >= (len(current_sequence().tracks) - 1): return if dialogutils.track_lock_check_and_user_info(track): #modesetting.set_default_edit_mode() # TODO: Info return modesetting.stop_looping() if EDIT_MODE() == editorstate.KF_TOOL: kftoolmode.exit_tool() frame = tlinewidgets.get_frame(x) # Create new clip. if media_file.type != appconsts.PATTERN_PRODUCER: if media_file.container_data == None: # Standard clips new_clip = current_sequence().create_file_producer_clip(media_file.path, media_file.name, False, media_file.ttl) else: # Container clips, create new container_data object and generate uuid for clip so it gets it own folder in.$XML_DATA/.../container_clips new_clip = current_sequence().create_file_producer_clip(media_file.path, media_file.name, False, media_file.ttl) new_clip.container_data = copy.deepcopy(media_file.container_data) new_clip.container_data.generate_clip_id() else: new_clip = current_sequence().create_pattern_producer(media_file) # Set clip in and out if use_marks == False: new_clip.mark_in = 0 new_clip.mark_out = new_clip.get_length() - 1 # - 1 because out is mark_out inclusive if media_file.type == appconsts.IMAGE_SEQUENCE: new_clip.mark_out = media_file.length else: # Media types that do not have length determined by content. if new_clip.media_type == appconsts.IMAGE or new_clip.media_type == appconsts.PATTERN_PRODUCER: # If no marks use default length. # This is different from media that has length determined by content. if (hasattr(media_file, 'mark_in') == False) or (media_file.mark_in == -1 and media_file.mark_out == -1): in_fr, out_fr, l = editorpersistance.get_graphics_default_in_out_length() new_clip.mark_in = in_fr new_clip.mark_out = out_fr else: new_clip.mark_in = media_file.mark_in new_clip.mark_out = media_file.mark_out # Replace single missing mark in 3-point edit style. if new_clip.mark_in == -1: new_clip.mark_in = 0 if new_clip.mark_out == -1: new_clip.mark_out = 14999 else: # All the rest new_clip.mark_in = media_file.mark_in new_clip.mark_out = media_file.mark_out # Replace single missing mark in 3-point edit style. if new_clip.mark_in == -1: new_clip.mark_in = 0 if new_clip.mark_out == -1: new_clip.mark_out = new_clip.get_length() - 1 # - 1 because out is mark_out inclusive if media_file.type == appconsts.IMAGE_SEQUENCE: new_clip.mark_out = media_file.length # Non-insert DND actions if editorpersistance.prefs.dnd_action == appconsts.DND_OVERWRITE_NON_V1: if track.id != current_sequence().first_video_track().id: drop_done = _attempt_dnd_overwrite(track, new_clip, frame) if drop_done == True: return elif editorpersistance.prefs.dnd_action == appconsts.DND_ALWAYS_OVERWRITE: drop_done = _attempt_dnd_overwrite(track, new_clip, frame) if drop_done == True: return do_clip_insert(track, new_clip, frame)
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 set_post_undo_redo_edit_mode(): if EDIT_MODE() == editorstate.ONE_ROLL_TRIM: oneroll_trim_no_edit_init() if EDIT_MODE() == editorstate.TWO_ROLL_TRIM: tworoll_trim_no_edit_init()