#include "bcsignals.h"
#include "bctimer.h"
#include "clip.h"
-#include "colors.h"
+#include "bccolors.h"
#include "cplayback.h"
#include "cursors.h"
#include "cwindowgui.h"
#include "keyframepopup.h"
#include "keyframes.h"
#include "keys.h"
+#include "labels.h"
#include "localsession.h"
#include "mainclock.h"
#include "maincursor.h"
render_timer = new Timer;
hourglass_enabled = 0;
timebar_position = -1;
+ snapped = 0;
}
TrackCanvas::~TrackCanvas()
h = MIN(h, get_h() + 20);
if(w > 0 && h > 0)
{
- set_color(WHITE);
+ set_color(mwindow->preferences->highlight_inverse);
set_inverse();
//draw_rectangle(x, y, w, h);
draw_rectangle(x + 1, y + 1, w - 2, h - 2);
}
w = MIN(w, get_w() + 20);
h = MIN(h, get_h() + 20);
- set_color(WHITE);
+ set_color(mwindow->preferences->highlight_inverse);
set_inverse();
draw_rectangle(x, y, w, h);
draw_rectangle(x + 1, y + 1, w - 2, h - 2);
mwindow->edl->local_session->zoom_sample -
mwindow->edl->local_session->view_start[pane->number]);
//printf("TrackCanvas::draw_drag_handle 2 %d %jd\n", pane->number, pixel1);
- set_color(GREEN);
+ set_color(!snapped ? GREEN : (snapped=0, YELLOW));
set_inverse();
//printf("TrackCanvas::draw_drag_handle 3\n");
draw_line(pixel1, 0, pixel1, get_h());
void TrackCanvas::draw_brender_range()
{
- if(mwindow->preferences->use_brender)
+ if( !mwindow->preferences->use_brender || !mwindow->brender_active ) return;
+ if( mwindow->edl->session->brender_start >= mwindow->edl->session->brender_end ) return;
+ if( mwindow->edl->session->brender_end > 0 )
{
int64_t x1 = Units::round(mwindow->edl->session->brender_start *
mwindow->edl->session->sample_rate /
void TrackCanvas::update_drag_handle()
{
double new_position;
+ int cursor_x = get_cursor_x();
new_position =
- (double)(get_cursor_x() +
+ (double)(cursor_x +
mwindow->edl->local_session->view_start[pane->number]) *
mwindow->edl->local_session->zoom_sample /
mwindow->edl->session->sample_rate;
+
new_position =
mwindow->edl->align_to_frame(new_position, 0);
+ if( ctrl_down() && alt_down() ) {
+#define snapper(v) do { \
+ double pos = (v); \
+ if( pos < 0 ) break; \
+ double dist = fabs(new_position - pos); \
+ if( dist >= snap_min ) break; \
+ snap_position = pos; snap_min = dist; \
+} while(0)
+ double snap_position = new_position;
+ double snap_min = DBL_MAX;
+ if( mwindow->edl->local_session->inpoint_valid() )
+ snapper(mwindow->edl->local_session->get_inpoint());
+ if( mwindow->edl->local_session->outpoint_valid() )
+ snapper(mwindow->edl->local_session->get_outpoint());
+ snapper(mwindow->edl->prev_edit(new_position));
+ snapper(mwindow->edl->next_edit(new_position));
+ Label *prev_label = mwindow->edl->labels->prev_label(new_position);
+ if( prev_label ) snapper(prev_label->position);
+ Label *next_label = mwindow->edl->labels->next_label(new_position);
+ if( next_label ) snapper(next_label->position);
+ int snap_x = snap_position * mwindow->edl->session->sample_rate /
+ mwindow->edl->local_session->zoom_sample -
+ mwindow->edl->local_session->view_start[pane->number];
+ if( abs(snap_x - cursor_x) < HANDLE_W ) {
+ snapped = 1;
+ new_position = snap_position;
+ }
+#undef snapper
+ }
if(new_position != mwindow->session->drag_position)
{
int64_t track_x, track_y, track_w, track_h;
track_dimensions(track, track_x, track_y, track_w, track_h);
- if(button_press && get_buttonpress() == 3 &&
+ if(button_press && get_buttonpress() == RIGHT_BUTTON &&
cursor_y >= track_y && cursor_y < track_y + track_h) {
gui->edit_menu->update(track, 0);
gui->edit_menu->activate_menu();
mwindow->edl->local_session->zoom_sample /
mwindow->edl->session->sample_rate;
+ int cx, cy;
+ get_abs_cursor(cx, cy);
+ cx -= mwindow->theme->get_image("clip_icon")->get_w() / 2,
+ cy -= mwindow->theme->get_image("clip_icon")->get_h() / 2;
gui->drag_popup = new BC_DragWindow(gui,
- mwindow->theme->get_image("clip_icon") /*,
- get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
- get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
+ mwindow->theme->get_image("clip_icon"), cx, cy);
result = 1;
}
frame = mwindow->theme->get_image("veffect_icon");
}
}
-
- gui->drag_popup = new BC_DragWindow(gui, frame /*,
- get_abs_cursor_x(0) - frame->get_w() / 2,
- get_abs_cursor_y(0) - frame->get_h() / 2 */);
+ int cx, cy;
+ get_abs_cursor(cx, cy);
+ cx -= frame->get_w() / 2;
+ cy -= frame->get_h() / 2;
+ gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
break; }
case PLUGIN_SHAREDPLUGIN:
- case PLUGIN_SHAREDMODULE:
- gui->drag_popup = new BC_DragWindow(gui,
- mwindow->theme->get_image("clip_icon") /*,
- get_abs_cursor_x(0) - mwindow->theme->get_image("clip_icon")->get_w() / 2,
- get_abs_cursor_y(0) - mwindow->theme->get_image("clip_icon")->get_h() / 2 */);
- break;
+ case PLUGIN_SHAREDMODULE: {
+ VFrame *frame = mwindow->theme->get_image("clip_icon");
+ int cx, cy;
+ get_abs_cursor(cx, cy);
+ cx -= frame->get_w() / 2;
+ cy -= frame->get_h() / 2;
+ gui->drag_popup = new BC_DragWindow(gui, frame, cx, cy);
+ break; }
}
result = 1;
gui->flash_canvas(1);
}
}
+
return result;
}