$(OBJDIR)/trackcanvas.o \
$(OBJDIR)/tracking.o \
$(OBJDIR)/track.o \
+ $(OBJDIR)/trackpopup.o \
$(OBJDIR)/trackscroll.o \
$(OBJDIR)/tracksedit.o \
$(OBJDIR)/tracks.o \
MWindow *mwindow = picon->mwindow;
EDL *edl = mwindow->edl;
dragging = 0;
- if( y < bar_h ) {
+ if( y < get_h()/2 ) {
Indexable *idxbl =
picon->indexable ? picon->indexable :
picon->edl ? picon->edl : 0;
vwindow->update_position(CHANGE_NONE, 0, 1, 0);
return 1;
}
- if( y >= get_h()-bar_h ) {
+ else {
dragging = 1;
if( !ctrl_down() && !shift_down() )
return cursor_motion_event();
{
if( !is_event_win() ) return 0;
AssetVIconThread *avt = (AssetVIconThread *)vt;
- if( !avt->vicon || draw_mode != ASSET_VIEW_MEDIA_MAP ) return 0;
+ if( !avt->vicon ||
+ ( draw_mode != ASSET_VIEW_FULL &&
+ draw_mode != ASSET_VIEW_MEDIA_MAP ) ) return 0;
if( !get_button_down() || get_buttonpress() != LEFT_BUTTON ||
ctrl_down() || alt_down() || shift_down() )
return 0;
user_title[0] = 0;
nested_edl = 0;
is_plugin = 0;
+ is_selected = 0;
hard_left = 0;
hard_right = 0;
}
int id;
// User defined title for timeline
char user_title[BCTEXTLEN];
- int is_plugin;
+ int is_plugin, is_selected;
// edge cannot be optimized
int hard_left, hard_right;
int EditSplice::keypress_event()
{
if( alt_down() ) return 0;
- if( get_keypress() == 'v' ||
+ if( (get_keypress() == 'v' && !ctrl_down()) ||
(panel->is_vwindow() && get_keypress() == 'V') ) {
handle_event();
return 1;
int EditCopy::keypress_event()
{
if( alt_down() ) return 0;
- if( get_keypress() == 'c' ||
+ if( (get_keypress() == 'c' && !ctrl_down()) ||
(panel->is_vwindow() && get_keypress() == 'C') ) {
return handle_event();
}
int EditPaste::keypress_event()
{
- if( get_keypress() == 'v' )
+ if( get_keypress() == 'v' && !ctrl_down() )
return handle_event();
return 0;
}
void EditPopup::create_objects()
{
- add_item(new EditAttachEffect(mwindow, this));
- add_item(new EditMoveTrackUp(mwindow, this));
- add_item(new EditMoveTrackDown(mwindow, this));
- add_item(new EditPopupDeleteTrack(mwindow, this));
- add_item(new EditPopupAddTrack(mwindow, this));
+ add_item(new EditPopupClear(mwindow, this));
+ add_item(new EditPopupDelete(mwindow, this));
+ add_item(new EditPopupCopy(mwindow, this));
+ add_item(new EditPopupCut(mwindow, this));
+ add_item(new EditPopupCopyCut(mwindow, this));
+ add_item(new EditPopupPaste(mwindow, this));
add_item(new EditPopupFindAsset(mwindow, this));
add_item(new EditPopupTitle(mwindow, this));
add_item(new EditPopupShow(mwindow, this));
- resize_option = 0;
- matchsize_option = 0;
}
-int EditPopup::update(Track *track, Edit *edit)
+int EditPopup::update(Edit *edit)
{
this->edit = edit;
- this->track = track;
-
- if(track->data_type == TRACK_VIDEO && !resize_option)
- {
- add_item(resize_option = new EditPopupResize(mwindow, this));
- add_item(matchsize_option = new EditPopupMatchSize(mwindow, this));
- }
- else
- if(track->data_type == TRACK_AUDIO && resize_option)
- {
- del_item(resize_option); resize_option = 0;
- del_item(matchsize_option); matchsize_option = 0;
- }
return 0;
}
-EditAttachEffect::EditAttachEffect(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Attach effect..."))
+EditPopupClear::EditPopupClear(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Clear"),_("Ctrl-m"),'m')
{
this->mwindow = mwindow;
this->popup = popup;
- dialog_thread = new PluginDialogThread(mwindow);
-}
-
-EditAttachEffect::~EditAttachEffect()
-{
- delete dialog_thread;
+ set_ctrl(1);
}
-int EditAttachEffect::handle_event()
+int EditPopupClear::handle_event()
{
- dialog_thread->start_window(popup->track,
- 0, _(PROGRAM_NAME ": Attach Effect"),
- 0, popup->track->data_type);
+ mwindow->delete_edits(0);
return 1;
}
-
-EditMoveTrackUp::EditMoveTrackUp(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Move up"))
+EditPopupDelete::EditPopupDelete(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Delete"),_("Ctrl-DEL"),DELETE)
{
this->mwindow = mwindow;
this->popup = popup;
+ set_ctrl(1);
}
-EditMoveTrackUp::~EditMoveTrackUp()
-{
-}
-int EditMoveTrackUp::handle_event()
-{
- mwindow->move_track_up(popup->track);
- return 1;
-}
-
-
-EditMoveTrackDown::EditMoveTrackDown(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Move down"))
-{
- this->mwindow = mwindow;
- this->popup = popup;
-}
-EditMoveTrackDown::~EditMoveTrackDown()
-{
-}
-int EditMoveTrackDown::handle_event()
+int EditPopupDelete::handle_event()
{
- mwindow->move_track_down(popup->track);
+ mwindow->delete_edits(1);
return 1;
}
-
-EditPopupResize::EditPopupResize(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Resize track..."))
+EditPopupCopy::EditPopupCopy(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Copy"),_("Ctrl-c"),'c')
{
this->mwindow = mwindow;
this->popup = popup;
- dialog_thread = new ResizeTrackThread(mwindow);
-}
-EditPopupResize::~EditPopupResize()
-{
- delete dialog_thread;
+ set_ctrl(1);
}
-int EditPopupResize::handle_event()
+int EditPopupCopy::handle_event()
{
- dialog_thread->start_window(popup->track);
+ mwindow->selected_to_clipboard();
return 1;
}
-
-EditPopupMatchSize::EditPopupMatchSize(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Match output size"))
+EditPopupCut::EditPopupCut(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Cut"),_("Ctrl-x"),'x')
{
this->mwindow = mwindow;
this->popup = popup;
-}
-EditPopupMatchSize::~EditPopupMatchSize()
-{
+ set_ctrl(1);
}
-int EditPopupMatchSize::handle_event()
+int EditPopupCut::handle_event()
{
- mwindow->match_output_size(popup->track);
+ mwindow->cut_selected_edits(1);
return 1;
}
-
-EditPopupDeleteTrack::EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Delete track"))
+EditPopupCopyCut::EditPopupCopyCut(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Copy cut"),_("Ctrl-z"),'z')
{
this->mwindow = mwindow;
this->popup = popup;
+ set_ctrl(1);
}
-int EditPopupDeleteTrack::handle_event()
+
+int EditPopupCopyCut::handle_event()
{
- mwindow->delete_track(popup->track);
+ mwindow->cut_selected_edits(0);
return 1;
}
-
-EditPopupAddTrack::EditPopupAddTrack(MWindow *mwindow, EditPopup *popup)
- : BC_MenuItem(_("Add track"))
+EditPopupPaste::EditPopupPaste(MWindow *mwindow, EditPopup *popup)
+ : BC_MenuItem(_("Paste"),_("Ctrl-v"),'v')
{
this->mwindow = mwindow;
this->popup = popup;
+ set_ctrl(1);
}
-int EditPopupAddTrack::handle_event()
+int EditPopupPaste::handle_event()
{
- switch( popup->track->data_type ) {
- case TRACK_AUDIO:
- mwindow->add_audio_track_entry(1, popup->track);
- break;
- case TRACK_VIDEO:
- mwindow->add_video_track_entry(popup->track);
- break;
- case TRACK_SUBTITLE:
- mwindow->add_subttl_track_entry(popup->track);
- break;
- }
+ mwindow->paste();
return 1;
}
int x = 10, y = 10;
BC_Title *title;
char text[BCTEXTLEN];
- Track *track = popup->track;
Edit *edit = popup->edit;
+ Track *track = edit->track;
sprintf(text, _("Track %d:"), mwindow->edl->tracks->number_of(track)+1);
add_subwindow(title = new BC_Title(x, y, text));
int x1 = x + title->get_w() + 10;
#define EDITPOPUP_H
#include "guicast.h"
+#include "edit.inc"
+#include "editpopup.inc"
#include "mwindow.inc"
#include "mwindowgui.inc"
-#include "edit.inc"
#include "plugindialog.inc"
#include "resizetrackthread.inc"
-class EditPopup;
-class EditPopupMatchSize;
-class EditPopupResize;
-class EditPopupDeleteTrack;
-class EditPopupAddTrack;
-class EditPopupFindAsset;
-class EditAttachEffect;
-class EditMoveTrackUp;
-class EditMoveTrackDown;
-class EditPopupTitle;
-class EditTitleDialogThread;
-class EditPopupTitleText;
-class EditPopupTitleWindow;
-class EditPopupShow;
-class EditShowDialogThread;
-class EditPopupShowText;
-class EditPopupShowWindow;
-
class EditPopup : public BC_PopupMenu
{
public:
~EditPopup();
void create_objects();
- int update(Track *track, Edit *edit);
+ int update(Edit *edit);
MWindow *mwindow;
MWindowGUI *gui;
-// Acquired through the update command as the edit currently being operated on
Edit *edit;
- Track *track;
- EditPopupResize *resize_option;
- EditPopupMatchSize *matchsize_option;
};
-class EditPopupMatchSize : public BC_MenuItem
-{
-public:
- EditPopupMatchSize(MWindow *mwindow, EditPopup *popup);
- ~EditPopupMatchSize();
- int handle_event();
- MWindow *mwindow;
- EditPopup *popup;
-};
-class EditPopupResize : public BC_MenuItem
+class EditPopupClear : public BC_MenuItem
{
public:
- EditPopupResize(MWindow *mwindow, EditPopup *popup);
- ~EditPopupResize();
+ EditPopupClear(MWindow *mwindow, EditPopup *popup);
int handle_event();
+
MWindow *mwindow;
EditPopup *popup;
- ResizeTrackThread *dialog_thread;
};
-class EditPopupDeleteTrack : public BC_MenuItem
+class EditPopupDelete : public BC_MenuItem
{
public:
- EditPopupDeleteTrack(MWindow *mwindow, EditPopup *popup);
+ EditPopupDelete(MWindow *mwindow, EditPopup *popup);
int handle_event();
+
MWindow *mwindow;
EditPopup *popup;
};
-class EditPopupAddTrack : public BC_MenuItem
+class EditPopupCopy : public BC_MenuItem
{
public:
- EditPopupAddTrack(MWindow *mwindow, EditPopup *popup);
+ EditPopupCopy(MWindow *mwindow, EditPopup *popup);
int handle_event();
+
MWindow *mwindow;
EditPopup *popup;
};
-class EditPopupFindAsset : public BC_MenuItem
+class EditPopupCut : public BC_MenuItem
{
public:
- EditPopupFindAsset(MWindow *mwindow, EditPopup *popup);
+ EditPopupCut(MWindow *mwindow, EditPopup *popup);
int handle_event();
+
MWindow *mwindow;
EditPopup *popup;
};
-
-class EditAttachEffect : public BC_MenuItem
+class EditPopupCopyCut : public BC_MenuItem
{
public:
- EditAttachEffect(MWindow *mwindow, EditPopup *popup);
- ~EditAttachEffect();
-
+ EditPopupCopyCut(MWindow *mwindow, EditPopup *popup);
int handle_event();
MWindow *mwindow;
EditPopup *popup;
- PluginDialogThread *dialog_thread;
};
-class EditMoveTrackUp : public BC_MenuItem
+class EditPopupPaste : public BC_MenuItem
{
public:
- EditMoveTrackUp(MWindow *mwindow, EditPopup *popup);
- ~EditMoveTrackUp();
-
+ EditPopupPaste(MWindow *mwindow, EditPopup *popup);
int handle_event();
MWindow *mwindow;
EditPopup *popup;
};
-class EditMoveTrackDown : public BC_MenuItem
+class EditPopupFindAsset : public BC_MenuItem
{
public:
- EditMoveTrackDown(MWindow *mwindow, EditPopup *popup);
- ~EditMoveTrackDown();
-
+ EditPopupFindAsset(MWindow *mwindow, EditPopup *popup);
int handle_event();
-
MWindow *mwindow;
EditPopup *popup;
};
-
class EditPopupTitle : public BC_MenuItem
{
public:
*
*/
-#ifndef EDITPOPUP_INC
-#define EDITPOPUP_INC
+#ifndef __EDITPOPUP_INC__
+#define __EDITPOPUP_INC__
class EditPopup;
+class EditClear;
+class EditDelete;
+class EditCopy;
+class EditCut;
+class EditCopyCut;
+class EditPaste;
+class EditPopupFindAsset;
+class EditPopupTitle;
+class EditTitleDialogThread;
+class EditPopupTitleText;
+class EditPopupTitleWindow;
+class EditPopupShow;
+class EditShowDialogThread;
+class EditPopupShowText;
+class EditPopupShowWindow;
#endif
void update_vwindow();
// Fit selected time to horizontal display range
void fit_selection();
+ void selected_to_clipboard();
// Fit selected autos to the vertical display range
void fit_autos(int doall);
void change_currentautorange(int autogrouptype, int increment, int changemax);
int plugin_type);
void match_output_size(Track *track);
+ void delete_edit(Edit *edit, const char *msg, int collapse=0);
+ void delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse=0);
+ void delete_edits(int collapse=0);
+ void cut_selected_edits(int collapse=0);
// Move edit to new position
void move_edits(ArrayList<Edit*> *edits,
Track *track,
}
+void MWindow::selected_to_clipboard()
+{
+ EDL *new_edl = new EDL();
+ new_edl->create_objects();
+ new_edl->copy_session(edl);
+ const char *text = _("new_edl edit");
+ new_edl->set_path(text);
+ strcpy(new_edl->local_session->clip_title, text);
+ strcpy(new_edl->local_session->clip_notes, text);
+ new_edl->session->video_tracks = 0;
+ new_edl->session->audio_tracks = 0;
+ for( Track *track=edl->tracks->first; track; track=track->next ) {
+ int64_t startproject = 0;
+ Track *new_track = 0;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( !edit->is_selected ) continue;
+ if( !new_track ) {
+ switch( track->data_type ) {
+ case TRACK_VIDEO:
+ ++new_edl->session->video_tracks;
+ new_track = new_edl->tracks->add_video_track(0, 0);
+ break;
+ case TRACK_AUDIO:
+ ++new_edl->session->audio_tracks;
+ new_track = new_edl->tracks->add_audio_track(0, 0);
+ break;
+ case TRACK_SUBTITLE:
+ new_track = new_edl->tracks->add_subttl_track(0, 0);
+ break;
+ }
+ }
+ if( new_track ) {
+ Edit *clip_edit = new Edit(new_edl, new_track);
+ clip_edit->copy_from(edit);
+ clip_edit->startproject = startproject;
+ startproject += clip_edit->length;
+ new_track->edits->append(clip_edit);
+ }
+ }
+ }
+ double length = new_edl->tracks->total_length();
+ FileXML file;
+ new_edl->copy(0, length, 0, &file, "", 1);
+ const char *file_string = file.string();
+ long file_length = strlen(file_string);
+ gui->to_clipboard(file_string, file_length, BC_PRIMARY_SELECTION);
+ gui->to_clipboard(file_string, file_length, SECONDARY_SELECTION);
+ new_edl->remove_user();
+}
+
+void MWindow::delete_edit(Edit *edit, const char *msg, int collapse)
+{
+ ArrayList<Edit*> edits;
+ edits.append(edit);
+ delete_edits(&edits, msg, collapse);
+}
+
+void MWindow::delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse)
+{
+ if( !edits->size() ) return;
+ undo->update_undo_before();
+ for( Track *track=edl->tracks->first; track; track=track->next ) {
+ for( Edit *next=track->edits->first; next; ) {
+ Edit *edit = next; next = edit->next;
+ if( !edit->is_selected ) continue;
+ int64_t len = edit->length;
+ delete edit;
+ if( !collapse ) continue;
+ for( edit=next; edit; edit=edit->next )
+ edit->startproject -= len;
+ }
+ }
+ edl->optimize();
+ save_backup();
+ undo->update_undo_after(msg, LOAD_EDITS);
+
+ restart_brender();
+ cwindow->refresh_frame(CHANGE_EDL);
+ update_plugin_guis();
+ gui->update(1, NORMAL_DRAW, 1, 0, 0, 0, 0);
+}
+
+void MWindow::delete_edits(int collapse)
+{
+ ArrayList<Edit*> edits;
+ edl->tracks->get_selected_edits(&edits);
+ delete_edits(&edits,_("del edit"), collapse);
+}
+
+void MWindow::cut_selected_edits(int collapse)
+{
+ selected_to_clipboard();
+ ArrayList<Edit*> edits;
+ edl->tracks->get_selected_edits(&edits);
+ delete_edits(&edits, _("cut edit"), collapse);
+}
+
+
void MWindow::move_edits(ArrayList<Edit*> *edits,
Track *track,
double position,
#include "swindow.h"
#include "theme.h"
#include "trackcanvas.h"
+#include "trackpopup.h"
#include "trackscroll.h"
#include "tracks.h"
#include "transitionpopup.h"
statusbar = 0;
zoombar = 0;
mainclock = 0;
+ track_menu = 0;
edit_menu = 0;
plugin_menu = 0;
keyframe_menu = 0;
// cursor->create_objects();
+ if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
+ add_subwindow(track_menu = new TrackPopup(mwindow, this));
+ track_menu->create_objects();
if(debug) printf("MWindowGUI::create_objects %d\n", __LINE__);
add_subwindow(edit_menu = new EditPopup(mwindow, this));
edit_menu->create_objects();
result = 1;
break;
+ case 'c':
+ if( !ctrl_down() || alt_down() ) break;
+ mwindow->selected_to_clipboard();
+ break;
+ case 'v':
+ if( !ctrl_down() || alt_down() ) break;
+ mwindow->paste();
+ break;
+ case 'z':
+ case 'x':
+ if( !ctrl_down() || alt_down() ) break;
+ mwindow->cut_selected_edits(get_keypress()=='x' ? 1 : 0);
+ break;
+ case 'm':
+ case DELETE:
+ if( !ctrl_down() || alt_down() ) break;
+ mwindow->delete_edits(get_keypress()==DELETE ? 1 : 0);
+ break;
+
case '1': case '2': case '3': case '4':
case '5': case '6': case '7': case '8':
if( !alt_down() || shift_down() ) break;
#include "timelinepane.inc"
#include "track.inc"
#include "trackcanvas.inc"
+#include "trackpopup.inc"
#include "trackscroll.inc"
#include "transitionpopup.inc"
#include "zoombar.inc"
DbWindow *db_window;
SWindow *swindow;
// Popup menus
+ TrackPopup *track_menu;
EditPopup *edit_menu;
PluginPopup *plugin_menu;
KeyframePopup *keyframe_menu;
#include "theme.h"
#include "trackcanvas.h"
#include "tracking.h"
+#include "trackpopup.h"
#include "tracks.h"
#include "transition.h"
#include "transitionhandles.h"
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();
+ }
}
}
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) {
+ if( button_press && 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();
- result = 1;
+ if( get_buttonpress() == RIGHT_BUTTON ) {
+ gui->track_menu->update(track);
+ gui->track_menu->activate_menu();
+ result = 1;
+ }
+ else if( get_buttonpress() == MIDDLE_BUTTON ) {
+ gui->edit_menu->update(track->edits->editof(position, PLAY_FORWARD, 0));
+ gui->edit_menu->activate_menu();
+ result = 1;
+ }
}
}
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,
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include "asset.h"
+#include "assets.h"
+#include "awindow.h"
+#include "awindowgui.h"
+#include "edl.h"
+#include "edlsession.h"
+#include "file.h"
+#include "keys.h"
+#include "language.h"
+#include "localsession.h"
+#include "mainerror.h"
+#include "mainsession.h"
+#include "mwindow.h"
+#include "mwindowgui.h"
+#include "plugindialog.h"
+#include "resizetrackthread.h"
+#include "track.h"
+#include "tracks.h"
+#include "trackpopup.h"
+#include "trackcanvas.h"
+
+#include <string.h>
+
+TrackPopup::TrackPopup(MWindow *mwindow, MWindowGUI *gui)
+ : BC_PopupMenu(0, 0, 0, "", 0)
+{
+ this->mwindow = mwindow;
+ this->gui = gui;
+}
+
+TrackPopup::~TrackPopup()
+{
+}
+
+void TrackPopup::create_objects()
+{
+ add_item(new TrackAttachEffect(mwindow, this));
+ add_item(new TrackMoveUp(mwindow, this));
+ add_item(new TrackMoveDown(mwindow, this));
+ add_item(new TrackPopupDeleteTrack(mwindow, this));
+ add_item(new TrackPopupAddTrack(mwindow, this));
+ resize_option = 0;
+ matchsize_option = 0;
+}
+
+int TrackPopup::update(Track *track)
+{
+ this->track = track;
+
+ if(track->data_type == TRACK_VIDEO && !resize_option)
+ {
+ add_item(resize_option = new TrackPopupResize(mwindow, this));
+ add_item(matchsize_option = new TrackPopupMatchSize(mwindow, this));
+ }
+ else
+ if(track->data_type == TRACK_AUDIO && resize_option)
+ {
+ del_item(resize_option); resize_option = 0;
+ del_item(matchsize_option); matchsize_option = 0;
+ }
+ return 0;
+}
+
+
+TrackAttachEffect::TrackAttachEffect(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Attach effect..."))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+ dialog_thread = new PluginDialogThread(mwindow);
+}
+
+TrackAttachEffect::~TrackAttachEffect()
+{
+ delete dialog_thread;
+}
+
+int TrackAttachEffect::handle_event()
+{
+ dialog_thread->start_window(popup->track,
+ 0, _(PROGRAM_NAME ": Attach Effect"),
+ 0, popup->track->data_type);
+ return 1;
+}
+
+
+TrackMoveUp::TrackMoveUp(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Move up"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+TrackMoveUp::~TrackMoveUp()
+{
+}
+int TrackMoveUp::handle_event()
+{
+ mwindow->move_track_up(popup->track);
+ return 1;
+}
+
+
+
+TrackMoveDown::TrackMoveDown(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Move down"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+TrackMoveDown::~TrackMoveDown()
+{
+}
+int TrackMoveDown::handle_event()
+{
+ mwindow->move_track_down(popup->track);
+ return 1;
+}
+
+
+TrackPopupResize::TrackPopupResize(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Resize track..."))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+ dialog_thread = new ResizeTrackThread(mwindow);
+}
+TrackPopupResize::~TrackPopupResize()
+{
+ delete dialog_thread;
+}
+
+int TrackPopupResize::handle_event()
+{
+ dialog_thread->start_window(popup->track);
+ return 1;
+}
+
+
+TrackPopupMatchSize::TrackPopupMatchSize(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Match output size"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+TrackPopupMatchSize::~TrackPopupMatchSize()
+{
+}
+
+int TrackPopupMatchSize::handle_event()
+{
+ mwindow->match_output_size(popup->track);
+ return 1;
+}
+
+
+TrackPopupDeleteTrack::TrackPopupDeleteTrack(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Delete track"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+int TrackPopupDeleteTrack::handle_event()
+{
+ mwindow->delete_track(popup->track);
+ return 1;
+}
+
+
+TrackPopupAddTrack::TrackPopupAddTrack(MWindow *mwindow, TrackPopup *popup)
+ : BC_MenuItem(_("Add track"))
+{
+ this->mwindow = mwindow;
+ this->popup = popup;
+}
+
+int TrackPopupAddTrack::handle_event()
+{
+ switch( popup->track->data_type ) {
+ case TRACK_AUDIO:
+ mwindow->add_audio_track_entry(1, popup->track);
+ break;
+ case TRACK_VIDEO:
+ mwindow->add_video_track_entry(popup->track);
+ break;
+ case TRACK_SUBTITLE:
+ mwindow->add_subttl_track_entry(popup->track);
+ break;
+ }
+ return 1;
+}
+
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __TRACKPOPUP_H__
+#define __TRACKPOPUP_H__
+
+#include "guicast.h"
+#include "mwindow.inc"
+#include "mwindowgui.inc"
+#include "plugindialog.inc"
+#include "resizetrackthread.inc"
+#include "track.inc"
+#include "trackpopup.inc"
+
+
+class TrackPopup : public BC_PopupMenu
+{
+public:
+ TrackPopup(MWindow *mwindow, MWindowGUI *gui);
+ ~TrackPopup();
+
+ void create_objects();
+ int update(Track *track);
+
+ MWindow *mwindow;
+ MWindowGUI *gui;
+ Track *track;
+ TrackPopupResize *resize_option;
+ TrackPopupMatchSize *matchsize_option;
+};
+
+class TrackPopupMatchSize : public BC_MenuItem
+{
+public:
+ TrackPopupMatchSize(MWindow *mwindow, TrackPopup *popup);
+ ~TrackPopupMatchSize();
+ int handle_event();
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+class TrackPopupResize : public BC_MenuItem
+{
+public:
+ TrackPopupResize(MWindow *mwindow, TrackPopup *popup);
+ ~TrackPopupResize();
+ int handle_event();
+ MWindow *mwindow;
+ TrackPopup *popup;
+ ResizeTrackThread *dialog_thread;
+};
+
+class TrackPopupDeleteTrack : public BC_MenuItem
+{
+public:
+ TrackPopupDeleteTrack(MWindow *mwindow, TrackPopup *popup);
+ int handle_event();
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+class TrackPopupAddTrack : public BC_MenuItem
+{
+public:
+ TrackPopupAddTrack(MWindow *mwindow, TrackPopup *popup);
+ int handle_event();
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+class TrackPopupFindAsset : public BC_MenuItem
+{
+public:
+ TrackPopupFindAsset(MWindow *mwindow, TrackPopup *popup);
+ int handle_event();
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+
+class TrackAttachEffect : public BC_MenuItem
+{
+public:
+ TrackAttachEffect(MWindow *mwindow, TrackPopup *popup);
+ ~TrackAttachEffect();
+
+ int handle_event();
+
+ MWindow *mwindow;
+ TrackPopup *popup;
+ PluginDialogThread *dialog_thread;
+};
+
+class TrackMoveUp : public BC_MenuItem
+{
+public:
+ TrackMoveUp(MWindow *mwindow, TrackPopup *popup);
+ ~TrackMoveUp();
+
+ int handle_event();
+
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+class TrackMoveDown : public BC_MenuItem
+{
+public:
+ TrackMoveDown(MWindow *mwindow, TrackPopup *popup);
+ ~TrackMoveDown();
+
+ int handle_event();
+
+ MWindow *mwindow;
+ TrackPopup *popup;
+};
+
+
+#endif
--- /dev/null
+
+/*
+ * CINELERRA
+ * Copyright (C) 2008 Adam Williams <broadcast at earthling dot net>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __TRACKPOPUP_INC__
+#define __TRACKPOPUP_INC__
+
+class TrackPopup;
+class TrackPopupMatchSize;
+class TrackPopupResize;
+class TrackPopupDeleteTrack;
+class TrackPopupAddTrack;
+class TrackPopupFindAsset;
+class TrackAttachEffect;
+class TrackMoveTrackUp;
+class TrackMoveTrackDown;
+
+#endif
}
-
-
-void Tracks::get_affected_edits(ArrayList<Edit*> *drag_edits, double position, Track *start_track)
+void Tracks::clear_selected_edits()
{
- drag_edits->remove_all();
+ for( Track *track=first; track; track=track->next ) {
+ for( Edit *edit=track->edits->first; edit; edit=edit->next )
+ edit->is_selected = 0;
+ }
+}
- for(Track *track = start_track;
- track;
- track = track->next)
- {
-//printf("Tracks::get_affected_edits 1 %p %d %d\n", track, track->data_type, track->record);
- if(track->record)
- {
- for(Edit *edit = track->edits->first; edit; edit = edit->next)
- {
- double startproject = track->from_units(edit->startproject);
-//printf("Tracks::get_affected_edits 1 %d\n", edl->equivalent(startproject, position));
- if(edl->equivalent(startproject, position))
- {
- drag_edits->append(edit);
- break;
- }
+void Tracks::select_affected_edits(double position, Track *start_track)
+{
+ for( Track *track=start_track; track; track=track->next ) {
+ if( !track->record ) continue;
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ double startproject = track->from_units(edit->startproject);
+ if( edl->equivalent(startproject, position) ) {
+ edit->is_selected = 1;
+ break;
}
}
}
+}
+void Tracks::get_selected_edits(ArrayList<Edit*> *drag_edits)
+{
+ drag_edits->remove_all();
+ for( Track *track=first; track; track=track->next ) {
+ for( Edit *edit=track->edits->first; edit; edit=edit->next ) {
+ if( !edit->is_selected ) continue;
+ drag_edits->append(edit);
+ }
+ }
}
void Tracks::get_automation_extents(float *min,
int64_t position);
// Construct a list of all the recordable edits which start on position
- void get_affected_edits(ArrayList<Edit*> *drag_edits,
- double position,
- Track *start_track);
+ void clear_selected_edits();
+ void select_affected_edits(double position, Track *start_track);
+ void get_selected_edits(ArrayList<Edit*> *drag_edits);
void get_automation_extents(float *min,
float *max,