#include "theme.h"
#include "trackcanvas.h"
#include "tracking.h"
+#include "trackpopup.h"
#include "tracks.h"
#include "transition.h"
#include "transitionhandles.h"
return gui->drag_motion();
}
-int TrackCanvas::drag_motion(Track **over_track,
- Edit **over_edit,
- PluginSet **over_pluginset,
- Plugin **over_plugin)
+int TrackCanvas::drag_motion(
+ Track **over_track, Edit **over_edit,
+ PluginSet **over_pluginset, Plugin **over_plugin)
{
int cursor_x = get_relative_cursor_x();
int cursor_y = get_relative_cursor_y();
+ if( get_cursor_over_window() ) {
+ drag_cursor_motion(cursor_x, cursor_y,
+ over_track, over_edit, over_pluginset, over_plugin);
+ }
+ if( over_track && !*over_track )
+ *over_track = pane->over_patchbay();
+ return 0;
+}
- if( get_cursor_over_window() &&
- cursor_x >= 0 && cursor_y >= 0 &&
- cursor_x < get_w() && cursor_y < get_h() )
+int TrackCanvas::drag_cursor_motion(int cursor_x, int cursor_y,
+ Track **over_track, Edit **over_edit,
+ PluginSet **over_pluginset, Plugin **over_plugin)
+{
+ if( cursor_x >= 0 && cursor_y >= 0 &&
+ cursor_x < get_w() && cursor_y < get_h() )
{
//printf("TrackCanvas::drag_motion %d %d\n", __LINE__, pane->number);
// Find the edit and track the cursor is over
}
}
- if( !*over_track )
- *over_track = pane->over_patchbay();
-
return 0;
}
from_units(drop_edit_position(&insertion,
mwindow->session->drag_edit,
mwindow->session->drag_edit->length));
+ current_vedit++;
}
}
if( paste_position >= 0 ) {
position = paste_position;
- current_vedit++;
+ current_vtrack++;
//draw_box = 1;
}
else
}
-
- if(draw_box)
- {
+ if( draw_box )
draw_highlight_rectangle(x, y, w, h);
+
+ for( Track *track=mwindow->edl->tracks->first; track; track=track->next ) {
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( !edit->is_selected ) continue;
+ edit_dimensions(edit, x, y, w, h);
+ if( !MWindowGUI::visible(x, x + w, 0, get_w()) ) continue;
+ if( !MWindowGUI::visible(y, y + h, 0, get_h()) ) continue;
+ set_color(GREEN | BLUE);
+ set_inverse();
+ draw_rectangle(x, y, w, h);
+ set_color(RED);
+ draw_rectangle(x-1, y-1, w+2, h+2);
+ set_opaque();
+ }
}
}
}
break;
+ case DROP_TARGETING:
+ new_cursor = GRABBED_CURSOR;
+ break;
+
default:
if(is_event_win() && cursor_inside()) {
// Update clocks
// Trap in drag stop
break;
+ case DROP_TARGETING: {
+ int cursor_x = get_cursor_x(), cursor_y = get_cursor_y();
+ Track *track=0; Edit *edit=0; PluginSet *pluginset=0; Plugin *plugin=0;
+ drag_cursor_motion(cursor_x, cursor_y,
+ &track, &edit, &pluginset, &plugin);
+ double position =
+ mwindow->edl->get_cursor_position(cursor_x, pane->number);
+ gui->edit_menu->activate_menu(track, edit, pluginset, plugin, position);
+ mwindow->session->current_operation = NO_OPERATION;
+ result = 1;
+ break; }
default:
if(mwindow->session->current_operation) {
{
int result = 0;
- for(Track *track = mwindow->edl->tracks->first;
- track && !result;
- track = track->next) {
- 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() == RIGHT_BUTTON &&
- cursor_y >= track_y && cursor_y < track_y + track_h) {
- double pos = mwindow->edl->get_cursor_position(cursor_x, pane->number);
- int64_t position = track->to_units(pos, 0);
- gui->edit_menu->update(track, track->edits->editof(position, PLAY_FORWARD, 0));
- gui->edit_menu->activate_menu();
+ Track *track=0; Edit *edit=0; PluginSet *pluginset=0; Plugin *plugin=0;
+ drag_cursor_motion(cursor_x, cursor_y,
+ &track, &edit, &pluginset, &plugin);
+
+ if( button_press && track ) {
+ switch( get_buttonpress() ) {
+ case RIGHT_BUTTON: {
+ double position =
+ mwindow->edl->get_cursor_position(cursor_x, pane->number);
+ gui->track_menu->activate_menu(track, edit, pluginset, plugin, position);
+ mwindow->session->current_operation = NO_OPERATION;
+ result = 1;
+ break; }
+ case MIDDLE_BUTTON:
+ set_cursor(GRABBED_CURSOR, 0, 1);
+ mwindow->session->current_operation = DROP_TARGETING;
result = 1;
+ break;
}
}
cursor_y >= edit_y && cursor_y < edit_y + edit_h) {
// Select duration of edit
if(button_press) {
- if(get_double_click() && !drag_start) {
+ if( !drag_start && get_double_click() ) {
mwindow->edl->local_session->set_selectionstart(edit->track->from_units(edit->startproject));
mwindow->edl->local_session->set_selectionend(edit->track->from_units(edit->startproject) +
edit->track->from_units(edit->length));
mwindow->edl->local_session->set_selectionend(
mwindow->edl->align_to_frame(mwindow->edl->local_session->get_selectionend(1), 1));
}
+ result = 1;
+ }
+ if( ctrl_down() && get_buttonpress() == 1 &&
+ mwindow->edl->session->editing_mode == EDITING_ARROW ) {
+ edit->is_selected = !edit->is_selected ? 1 : 0;
+ result = 1;
+ }
+ if( result ) {
redraw = 1;
rerender = 1;
update_cursor = -1;
- result = 1;
}
}
- else if(drag_start && track->record) {
- if(mwindow->edl->session->editing_mode == EDITING_ARROW) {
+ else if( drag_start && track->record ) {
+ if( mwindow->edl->session->editing_mode == EDITING_ARROW ) {
// Need to create drag window
mwindow->session->current_operation = DRAG_EDIT;
mwindow->session->drag_edit = edit;
-//printf("TrackCanvas::do_edits 2\n");
-
-// Drag only one edit if ctrl is initially down
- if(ctrl_down()) {
- mwindow->session->drag_edits->remove_all();
- mwindow->session->drag_edits->append(edit);
- }
- else {
// Construct list of all affected edits
- mwindow->edl->tracks->get_affected_edits(
- mwindow->session->drag_edits,
+ mwindow->edl->tracks->clear_selected_edits();
+ if( ctrl_down() )
+ edit->is_selected = 1;
+ else
+ mwindow->edl->tracks->select_affected_edits(
edit->track->from_units(edit->startproject),
edit->track);
- }
+ mwindow->edl->tracks->get_selected_edits(mwindow->session->drag_edits);
mwindow->session->drag_origin_x = cursor_x;
mwindow->session->drag_origin_y = cursor_y;
// Where the drag started, so we know relative position inside the edit later
update_cursor) ) break;
if( do_edits(cursor_x, cursor_y, 1, 0,
- update_cursor, rerender, new_cursor,
+ update_overlay, rerender, new_cursor,
update_cursor) ) break;
if( do_plugins(cursor_x, cursor_y, 0, 1,