def mouse_press(event, frame):
    track = current_sequence().tracks[compositor.transition.b_track - 1]

    global edit_data, sub_mode
    
    compositor_y = tlinewidgets._get_track_y(track.id) - tlinewidgets.COMPOSITOR_HEIGHT_OFF
    
    if abs(event.x - tlinewidgets._get_frame_x(compositor.clip_in)) < TRIM_HANDLE_WIDTH:
        edit_data = {"clip_in":compositor.clip_in,
                     "clip_out":compositor.clip_out,
                     "trim_is_clip_in":True,
                     "compositor_y":  compositor_y,
                     "compositor": compositor}
        tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_trim)
        sub_mode = TRIM_EDIT
    elif abs(event.x - tlinewidgets._get_frame_x(compositor.clip_out + 1)) < TRIM_HANDLE_WIDTH:
        edit_data = {"clip_in":compositor.clip_in,
                     "clip_out":compositor.clip_out,
                     "trim_is_clip_in":False,
                     "compositor_y": compositor_y,
                     "compositor": compositor}
        tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_trim)
        sub_mode = TRIM_EDIT
    else:
        edit_data = {"press_frame":frame,
                     "current_frame":frame,
                     "clip_in":compositor.clip_in,
                     "clip_length":(compositor.clip_out - compositor.clip_in + 1),
                     "compositor_y": compositor_y,
                     "compositor": compositor}
        tlinewidgets.set_edit_mode(edit_data, tlinewidgets.draw_compositor_move_overlay)
        sub_mode = MOVE_EDIT
    updater.repaint_tline()
Exemple #2
0
def overwrite_move_move(x, y, frame, state):
    """
    User moves mouse when in overwrite move mode.
    """
    if editorstate.overwrite_mode_box == True:
        boxmove.mouse_move(x, y, frame)
        return
        
    global edit_data, drag_disabled    
    if drag_disabled:
        return 
    if edit_data == None:
        return
    
    _move_mode_move(frame, x, y)

    # Calculate overwrite area if moving
    if edit_data["move_on"] == True:
        # get in point
        over_in = edit_data["attempt_insert_frame"]
        
        # Check and do magnet
        cut_x = tlinewidgets._get_frame_x(edit_data["insert_frame"])
        clip_head_x = tlinewidgets._get_frame_x(edit_data["attempt_insert_frame"])
        if abs(clip_head_x - cut_x) < MAGNETIC_AREA_IN_PIX:
            over_in = edit_data["insert_frame"]

        over_out = over_in + edit_data["moving_length"] 

        edit_data["over_in"] = over_in
        edit_data["over_out"] = over_out

    updater.repaint_tline()
Exemple #3
0
def overwrite_move_move(x, y, frame, state):
    """
    User moves mouse when in overwrite move mode.
    """
    global edit_data, drag_disabled    
    if drag_disabled:
        return 
    if edit_data == None:
        return

    _move_mode_move(frame, x, y)

    # Calculate overwrite area if moving
    if edit_data["move_on"] == True:
        # get in point
        over_in = edit_data["attempt_insert_frame"]
        
        # Check and do magnet
        cut_x = tlinewidgets._get_frame_x(edit_data["insert_frame"])
        clip_head_x = tlinewidgets._get_frame_x(edit_data["attempt_insert_frame"])
        if abs(clip_head_x - cut_x) < MAGNETIC_AREA_IN_PIX:
            over_in = edit_data["insert_frame"]

        over_out = over_in + edit_data["moving_length"] 

        edit_data["over_in"] = over_in
        edit_data["over_out"] = over_out

    updater.repaint_tline()
Exemple #4
0
def _tline_overlay(cr, pos):
    if _clip_is_being_edited() == False:
        return
        
    track = edit_data["track"]
    ty = tlinewidgets._get_track_y(track.id)
    cx_start = tlinewidgets._get_frame_x(track.clip_start(edit_data["clip_index"]))
    clip = track.clips[edit_data["clip_index"]]
    cx_end = tlinewidgets._get_frame_x(track.clip_start(edit_data["clip_index"]) + clip.clip_out - clip.clip_in + 1)  # +1 because out inclusive
    height = EDIT_AREA_HEIGHT
    cy_start = ty - height/2
    
    # Draw bg
    cr.set_source_rgba(*OVERLAY_BG)
    cr.rectangle(cx_start, cy_start, cx_end - cx_start, height)
    cr.fill()

    # Top row
    cr.set_source_surface(HAMBURGER_ICON, cx_start, cy_start)
    cr.paint()
    cr.set_source_surface(CLOSE_ICON, cx_start +  (cx_end - cx_start) - 14, cy_start + 2)
    cr.paint()

    try:
        ep = edit_data["editable_property"]
        _draw_edit_area_borders(cr, cx_start, cy_start, cx_end - cx_start, height)
    except:
        _draw_edit_area_borders(cr, cx_start, cy_start, cx_end - cx_start, height)
Exemple #5
0
def get_pointer_context(compositor, x):   
    if abs(x - tlinewidgets._get_frame_x(compositor.clip_in)) < TRIM_HANDLE_WIDTH:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_END_DRAG_LEFT
    elif abs(x - tlinewidgets._get_frame_x(compositor.clip_out + 1)) < TRIM_HANDLE_WIDTH:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_END_DRAG_RIGHT
    else:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_MOVE
Exemple #6
0
def get_pointer_context(compositor, x):
    if abs(x -
           tlinewidgets._get_frame_x(compositor.clip_in)) < TRIM_HANDLE_WIDTH:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_END_DRAG_LEFT
    elif abs(x - tlinewidgets._get_frame_x(compositor.clip_out +
                                           1)) < TRIM_HANDLE_WIDTH:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_END_DRAG_RIGHT
    else:
        return appconsts.POINTER_CONTEXT_COMPOSITOR_MOVE
Exemple #7
0
def _tline_overlay(cr):
    if _clip_is_being_edited() == False:
        return

    track = edit_data["track"]
    ty = tlinewidgets._get_track_y(track.id)
    cx_start = tlinewidgets._get_frame_x(edit_data["clip_start_in_timeline"])
    clip = track.clips[edit_data["clip_index"]]
    cx_end = tlinewidgets._get_frame_x(
        track.clip_start(edit_data["clip_index"]) + clip.clip_out -
        clip.clip_in + 1)  # +1 because out inclusive
    height = EDIT_AREA_HEIGHT
    cy_start = ty - height / 2

    _kf_editor.set_allocation(cx_start, cy_start, cx_end - cx_start, height)
    _kf_editor.draw(cr)
Exemple #8
0
def _tline_overlay(cr, pos):
    if _clip_is_being_edited() == False:
        return

    track = edit_data["track"]
    ty = tlinewidgets._get_track_y(track.id)
    cx_start = tlinewidgets._get_frame_x(
        track.clip_start(edit_data["clip_index"]))
    clip = track.clips[edit_data["clip_index"]]
    cx_end = tlinewidgets._get_frame_x(
        track.clip_start(edit_data["clip_index"]) + clip.clip_out -
        clip.clip_in + 1)  # +1 because out inclusive

    height = EDIT_AREA_HEIGHT

    cr.set_source_rgba(*OVERLAY_BG)
    cr.rectangle(cx_start, ty - height / 2, cx_end - cx_start, height)
    cr.fill()
Exemple #9
0
def split_audio_from_clips_list(clips, track):
    item_id = "not actually used"
    for clip in clips:
        # We're using the existing function to do thid need x for clip frame to use it
        index = track.clips.index(clip)
        frame = track.clip_start(index)
        x = tlinewidgets._get_frame_x(frame)

        popup_data = (clip, track, item_id, x)
        _do_split_audio_edit(popup_data)
Exemple #10
0
def split_audio_from_clips_list(clips, track):
    item_id = "not actually used"
    for clip in clips:
        # We're using the existing function to do thid need x for clip frame to use it
        index = track.clips.index(clip)
        frame = track.clip_start(index)
        x = tlinewidgets._get_frame_x(frame)

        popup_data = (clip, track, item_id, x)
        _do_split_audio_edit(popup_data)
Exemple #11
0
def _tline_overlay(cr):
    if _clip_is_being_edited() == False:
        return
        
    track = edit_data["track"]
    cx_start = tlinewidgets._get_frame_x(edit_data["clip_start_in_timeline"])
    clip = track.clips[edit_data["clip_index"]]
    cx_end = tlinewidgets._get_frame_x(track.clip_start(edit_data["clip_index"]) + clip.clip_out - clip.clip_in + 1)  # +1 because out inclusive
    
    # Get y position for clip's track
    ty_bottom = tlinewidgets._get_track_y(1) + current_sequence().tracks[1].height
    ty_top = tlinewidgets._get_track_y(len(current_sequence().tracks) - 2) - 6 # -6 is hand correction, no idea why the math isn't getting correct pos top most track
    ty_top_bottom_edge = ty_top + EDIT_AREA_HEIGHT
    off_step = float(ty_bottom - ty_top_bottom_edge) / float(len(current_sequence().tracks) - 2)
    ty_off = off_step * float(track.id - 1)
    ty = ty_bottom - ty_off
    cy_start = ty - EDIT_AREA_HEIGHT

    # Set draw params and draw
    _kf_editor.set_allocation(cx_start, cy_start, cx_end - cx_start, EDIT_AREA_HEIGHT)
    _kf_editor.source_track_center = tlinewidgets._get_track_y(track.id) + current_sequence().tracks[track.id].height / 2.0
    _kf_editor.draw(cr)
Exemple #12
0
def _tline_overlay(cr):
    if _clip_is_being_edited() == False:
        return
        
    track = edit_data["track"]
    cx_start = tlinewidgets._get_frame_x(edit_data["clip_start_in_timeline"])
    clip = track.clips[edit_data["clip_index"]]
    cx_end = tlinewidgets._get_frame_x(track.clip_start(edit_data["clip_index"]) + clip.clip_out - clip.clip_in + 1)  # +1 because out inclusive
    
    # Get y position for clip's track
    ty_bottom = tlinewidgets._get_track_y(1) + current_sequence().tracks[1].height
    ty_top = tlinewidgets._get_track_y(len(current_sequence().tracks) - 2) - 6 # -6 is hand correction, no idea why the math isn't getting correct pos top most track
    ty_top_bottom_edge = ty_top + EDIT_AREA_HEIGHT
    off_step = float(ty_bottom - ty_top_bottom_edge) / float(len(current_sequence().tracks) - 2)
    ty_off = off_step * float(track.id - 1)
    ty = ty_bottom - ty_off
    cy_start = ty - EDIT_AREA_HEIGHT

    # Set draw params and draw
    _kf_editor.set_allocation(cx_start, cy_start, cx_end - cx_start, EDIT_AREA_HEIGHT)
    _kf_editor.source_track_center = tlinewidgets._get_track_y(track.id) + current_sequence().tracks[track.id].height / 2.0
    _kf_editor.draw(cr)