1, // use_keyframe
0, // use_splice
0, // use_overwrite
- 1, // use_lift
- 1, // use_extract
1, // use_copy
1, // use_paste
1, // use_undo
this->cwindow = cwindow;
}
-#define CWrapper(fn) void CWindowEditing::fn() { \
- mwindow->gui->lock_window("CWrapper::" #fn); \
- EditPanel::fn(); \
- mwindow->gui->unlock_window(); \
-}
+#define relock_cm(s) \
+ cwindow->gui->unlock_window(); \
+ mwindow->gui->lock_window("CWindowEditing::" s)
+#define relock_mc(s) \
+ mwindow->gui->unlock_window(); \
+ cwindow->gui->lock_window("CWindowEditing::" s)
+#define panel_fn(fn, args, s) \
+ CWindowEditing::fn args { relock_cm(#fn); s; relock_mc(#fn); }
-CWrapper(copy_selection)
-CWrapper(splice_selection)
-CWrapper(overwrite_selection)
-CWrapper(set_inpoint)
-CWrapper(set_outpoint)
-CWrapper(unset_inoutpoint)
-CWrapper(toggle_label)
+// transmit lock to mwindow, and run mbutton->edit_panel->s
+#define panel_btn(fn, args, s) \
+ panel_fn(panel_##fn, args, mwindow->gui->mbuttons->edit_panel->panel_##s)
-#define CWrapper_cut(fn) void CWindowEditing::fn(int cut) { \
- mwindow->gui->lock_window("CWrapper::" #fn); \
- EditPanel::fn(cut); \
- mwindow->gui->unlock_window(); \
+double CWindowEditing::get_position()
+{
+ relock_cm("get_position");
+ double ret = mwindow->edl->local_session->get_selectionstart(1);
+ relock_mc("get_position");
+ return ret;
+}
+
+void CWindowEditing::set_position(double position)
+{
+ relock_cm("set_position");
+ set_position(position);
+ relock_mc("set_position");
}
-CWrapper_cut(prev_label)
-CWrapper_cut(next_label)
-CWrapper_cut(prev_edit)
-CWrapper_cut(next_edit)
-void CWindowEditing::to_clip()
+void CWindowEditing::set_click_to_play(int v)
{
- mwindow->to_clip(mwindow->edl, _("composer window: "), 0);
+ relock_cm("set_click_to_play");
+ mwindow->edl->session->cwindow_click2play = v;
+ click2play->update(v);
+ relock_mc("set_click_to_play");
}
+void panel_btn(stop_transport,(), stop_transport())
+void panel_btn(toggle_label,(), toggle_label())
+void panel_btn(next_label,(int cut), next_label(cut))
+void panel_btn(prev_label,(int cut), prev_label(cut))
+void panel_btn(next_edit,(int cut), next_edit(cut))
+void panel_btn(prev_edit,(int cut), prev_edit(cut))
+void panel_fn(panel_copy_selection,(), mwindow->copy())
+void CWindowEditing::panel_overwrite_selection() {} // not used
+void CWindowEditing::panel_splice_selection() {} // not used
+void panel_btn(set_inpoint,(), set_inpoint())
+void panel_btn(set_outpoint,(), set_outpoint())
+void panel_btn(unset_inoutpoint,(), unset_inoutpoint())
+void panel_fn(panel_to_clip,(), mwindow->to_clip(mwindow->edl, _("main window: "), 0))
+void panel_btn(cut,(), cut())
+void panel_btn(paste,(), paste())
+void panel_btn(fit_selection,(), fit_selection())
+void panel_btn(fit_autos,(int all), fit_autos(all))
+void panel_btn(set_editing_mode,(int mode), set_editing_mode(mode))
+void panel_btn(set_auto_keyframes,(int v), set_auto_keyframes(v))
+void panel_btn(set_labels_follow_edits,(int v), set_labels_follow_edits(v))
+
CWindowMeters::CWindowMeters(MWindow *mwindow,
- CWindowGUI *gui,
- int x,
- int y,
- int h)
- : MeterPanel(mwindow,
- gui,
- x,
- y,
- -1,
- h,
+ CWindowGUI *gui, int x, int y, int h)
+ : MeterPanel(mwindow, gui, x, y, -1, h,
mwindow->edl->session->audio_channels,
mwindow->edl->session->cwindow_meter,
- 0,
- 0)
+ 0, 0)
{
this->mwindow = mwindow;
this->gui = gui;
CWindowEditing(MWindow *mwindow, CWindow *cwindow);
virtual ~CWindowEditing() {}
- void copy_selection();
- void splice_selection();
- void overwrite_selection();
- void set_inpoint();
- void set_outpoint();
- void unset_inoutpoint();
- void to_clip();
- void toggle_label();
- void prev_label(int cut);
- void next_label(int cut);
- void prev_edit(int cut);
- void next_edit(int cut);
+ double get_position();
+ void set_position(double position);
+ void set_click_to_play(int v);
+
+ void panel_stop_transport();
+ void panel_toggle_label();
+ void panel_next_label(int cut);
+ void panel_prev_label(int cut);
+ void panel_prev_edit(int cut);
+ void panel_next_edit(int cut);
+ void panel_copy_selection();
+ void panel_overwrite_selection();
+ void panel_splice_selection();
+ void panel_set_inpoint();
+ void panel_set_outpoint();
+ void panel_unset_inoutpoint();
+ void panel_to_clip();
+ void panel_cut();
+ void panel_paste();
+ void panel_fit_selection();
+ void panel_fit_autos(int all);
+ void panel_set_editing_mode(int mode);
+ void panel_set_auto_keyframes(int v);
+ void panel_set_labels_follow_edits(int v);
MWindow *mwindow;
CWindow *cwindow;
int use_keyframe,
int use_splice, // Extra buttons
int use_overwrite,
- int use_lift,
- int use_extract,
int use_copy,
int use_paste,
int use_undo,
this->use_keyframe = use_keyframe;
this->use_splice = use_splice;
this->use_overwrite = use_overwrite;
- this->use_lift = 0;
- this->use_extract = 0;
this->use_copy = use_copy;
this->use_paste = use_paste;
this->use_undo = use_undo;
this->outpoint = 0;
this->splice = 0;
this->overwrite = 0;
- this->lift = 0;
- this->extract = 0;
this->clip = 0;
this->cut = 0;
this->commercial = 0;
}
if( use_locklabels ) {
- locklabels = new LockLabelsButton(mwindow, x1, y1);
+ locklabels = new LockLabelsButton(mwindow, this, x1, y1);
subwindow->add_subwindow(locklabels);
x1 += locklabels->get_w();
}
x1 += overwrite->get_w();
}
- if( use_lift ) {
- lift = new EditLift(mwindow, this, x1, y1);
- subwindow->add_subwindow(lift);
- x1 += lift->get_w();
- }
-
- if( use_extract ) {
- extract = new EditExtract(mwindow, this, x1, y1);
- subwindow->add_subwindow(extract);
- x1 += extract->get_w();
- }
-
if( use_toclip ) {
clip = new EditToClip(mwindow, this, x1, y1);
subwindow->add_subwindow(clip);
}
}
-void EditPanel::stop_transport(const char *lock_msg)
-{
- int have_subwindow_lock = subwindow->get_window_lock();
- if( have_subwindow_lock ) subwindow->unlock_window();
- mwindow->stop_transport();
- if( have_subwindow_lock ) subwindow->lock_window(lock_msg);
-}
-
-
-void EditPanel::toggle_label()
-{
- mwindow->toggle_label(is_mwindow());
-}
-
-void EditPanel::prev_label(int cut)
-{
- int shift_down = subwindow->shift_down();
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( have_mwindow_lock ) mwindow->gui->unlock_window();
-
- stop_transport("EditPanel::prev_label 1");
-
- mwindow->gui->lock_window("EditPanel::prev_label 2");
- if( cut )
- mwindow->cut_left_label();
- else
- mwindow->prev_label(shift_down);
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
-}
-
-void EditPanel::next_label(int cut)
-{
- int shift_down = subwindow->shift_down();
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( have_mwindow_lock ) mwindow->gui->unlock_window();
-
- stop_transport("EditPanel::next_label 1");
-
- mwindow->gui->lock_window("EditPanel::next_label 2");
- if( cut )
- mwindow->cut_right_label();
- else
- mwindow->next_label(shift_down);
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
-}
-
-
-
-void EditPanel::prev_edit(int cut)
-{
- int shift_down = subwindow->shift_down();
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( have_mwindow_lock ) mwindow->gui->unlock_window();
-
- stop_transport("EditPanel::prev_edit 1");
-
- mwindow->gui->lock_window("EditPanel::prev_edit 2");
-
- if( cut )
- mwindow->cut_left_edit();
- else
- mwindow->prev_edit_handle(shift_down);
-
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
-}
-
-void EditPanel::next_edit(int cut)
-{
- int shift_down = subwindow->shift_down();
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( have_mwindow_lock ) mwindow->gui->unlock_window();
-
- stop_transport("EditPanel::next_edit 1");
-
- mwindow->gui->lock_window("EditPanel::next_edit 2");
-
- if( cut )
- mwindow->cut_right_edit();
- else
- mwindow->next_edit_handle(shift_down);
-
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
-}
-
-
-double EditPanel::get_position()
-{
- EDL *edl = mwindow->edl;
- return !edl ? 0 : edl->local_session->get_selectionstart(1);
-}
-
-void EditPanel::set_position(double position)
-{
- EDL *edl = mwindow->edl;
- if( !edl ) return;
- if( position != get_position() ) {
- if( position < 0 ) position = 0;
- edl->local_session->set_selectionstart(position);
- edl->local_session->set_selectionend(position);
- mwindow->gui->lock_window();
- mwindow->find_cursor();
- mwindow->gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 0);
- mwindow->gui->unlock_window();
- mwindow->cwindow->update(1, 0, 0, 0, 0);
- }
-}
-
void EditPanel::reposition_buttons(int x, int y)
{
this->x = x;
overwrite->reposition_window(x1, y1);
x1 += overwrite->get_w();
}
- if( use_lift ) {
- lift->reposition_window(x1, y1);
- x1 += lift->get_w();
- }
- if( use_extract ) {
- extract->reposition_window(x1, y1);
- x1 += extract->get_w();
- }
if( use_toclip ) {
clip->reposition_window(x1, y1);
x1 += clip->get_w();
}
}
-
-
void EditPanel::create_objects()
{
create_buttons();
return x1 - x;
}
-
-void EditPanel::copy_selection()
-{
- mwindow->copy();
-}
-
-void EditPanel::splice_selection()
-{
-}
-
-void EditPanel::overwrite_selection()
-{
-}
-
-void EditPanel::set_inpoint()
-{
- mwindow->set_inpoint(1);
-}
-
-void EditPanel::set_outpoint()
-{
- mwindow->set_outpoint(1);
-}
-
-void EditPanel::unset_inoutpoint()
-{
- mwindow->unset_inoutpoint(1);
-}
-
-
-EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("inbutton"))
+// toggle_label
+EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("labelbutton"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("In point ( [ or < )"));
-}
-EditInPoint::~EditInPoint()
-{
-}
-int EditInPoint::handle_event()
-{
- panel->set_inpoint();
- return 1;
-}
-int EditInPoint::keypress_event()
-{
- int key = get_keypress();
- if( ctrl_down() ) {
- if( key == 't' ) {
- panel->unset_inoutpoint();
- return 1;
- }
- }
- else if( !alt_down() ) {
- if( key == '[' || key == '<' ) {
- panel->set_inpoint();
- return 1;
- }
- }
- return 0;
+ set_tooltip(_("Toggle label at current position ( l )"));
}
-EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("outbutton"))
+EditLabelbutton::~EditLabelbutton()
{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Out point ( ] or > )"));
}
-EditOutPoint::~EditOutPoint()
+int EditLabelbutton::keypress_event()
{
+ if( get_keypress() == 'l' && !alt_down() )
+ return handle_event();
+ return 0;
}
-int EditOutPoint::handle_event()
+int EditLabelbutton::handle_event()
{
- panel->set_outpoint();
+ panel->panel_toggle_label();
return 1;
}
-int EditOutPoint::keypress_event()
-{
- int key = get_keypress();
- if( ctrl_down() ) {
- if( key == 't' ) {
- panel->unset_inoutpoint();
- return 1;
- }
- }
- else if( !alt_down() ) {
- if( key == ']' || key == '>' ) {
- panel->set_outpoint();
- return 1;
- }
- }
- return 0;
-}
-
+//next_label
EditNextLabel::EditNextLabel(MWindow *mwindow,
EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->get_image_set("nextlabel"))
if( ctrl_down() ) {
int key = get_keypress();
if( (key == RIGHT || key == '.') && !alt_down() ) {
- panel->next_label(0);
+ panel->panel_next_label(0);
return 1;
}
if( key == '>' && alt_down() ) {
- panel->next_label(1);
+ panel->panel_next_label(1);
return 1;
}
}
int EditNextLabel::handle_event()
{
int cut = ctrl_down() && alt_down();
- panel->next_label(cut);
+ panel->panel_next_label(cut);
return 1;
}
+//prev_label
EditPrevLabel::EditPrevLabel(MWindow *mwindow,
EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->get_image_set("prevlabel"))
if( ctrl_down() ) {
int key = get_keypress();
if( (key == LEFT || key == ',') && !alt_down() ) {
- panel->prev_label(0);
+ panel->panel_prev_label(0);
return 1;
}
if( key == '<' && alt_down() ) {
- panel->prev_label(1);
+ panel->panel_prev_label(1);
return 1;
}
}
int EditPrevLabel::handle_event()
{
int cut = ctrl_down() && alt_down();
- panel->prev_label(cut);
+ panel->panel_prev_label(cut);
return 1;
}
-
-
-EditNextEdit::EditNextEdit(MWindow *mwindow,
+//prev_edit
+EditPrevEdit::EditPrevEdit(MWindow *mwindow,
EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("nextedit"))
+ : BC_Button(x, y, mwindow->theme->get_image_set("prevedit"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Next edit ( alt -> )"));
+ set_tooltip(_("Previous edit (alt <- )"));
}
-EditNextEdit::~EditNextEdit()
+EditPrevEdit::~EditPrevEdit()
{
}
-int EditNextEdit::keypress_event()
+int EditPrevEdit::keypress_event()
{
if( alt_down() ) {
int key = get_keypress();
- if( (key == RIGHT || key == '.') && !ctrl_down() ) {
- panel->next_edit(0);
+ if( (key == LEFT || key == ',') && !ctrl_down() ) {
+ panel->panel_prev_edit(0);
return 1;
}
- if( key == '.' && ctrl_down() ) {
- panel->next_edit(1);
+ if( key == ',' && ctrl_down() ) {
+ panel->panel_prev_edit(1);
return 1;
}
}
return 0;
}
-int EditNextEdit::handle_event()
+int EditPrevEdit::handle_event()
{
int cut = ctrl_down() && alt_down();
- panel->next_edit(cut);
+ panel->panel_prev_edit(cut);
return 1;
}
-EditPrevEdit::EditPrevEdit(MWindow *mwindow,
+//next_edit
+EditNextEdit::EditNextEdit(MWindow *mwindow,
EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("prevedit"))
+ : BC_Button(x, y, mwindow->theme->get_image_set("nextedit"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Previous edit (alt <- )"));
+ set_tooltip(_("Next edit ( alt -> )"));
}
-EditPrevEdit::~EditPrevEdit()
+EditNextEdit::~EditNextEdit()
{
}
-int EditPrevEdit::keypress_event()
+int EditNextEdit::keypress_event()
{
if( alt_down() ) {
int key = get_keypress();
- if( (key == LEFT || key == ',') && !ctrl_down() ) {
- panel->prev_edit(0);
+ if( (key == RIGHT || key == '.') && !ctrl_down() ) {
+ panel->panel_next_edit(0);
return 1;
}
- if( key == ',' && ctrl_down() ) {
- panel->prev_edit(1);
+ if( key == '.' && ctrl_down() ) {
+ panel->panel_next_edit(1);
return 1;
}
}
return 0;
}
-int EditPrevEdit::handle_event()
+int EditNextEdit::handle_event()
{
int cut = ctrl_down() && alt_down();
- panel->prev_edit(cut);
+ panel->panel_next_edit(cut);
return 1;
}
-
-
-EditLift::EditLift(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->lift_data)
+//copy_selection
+EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("copy"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Lift"));
+ set_tooltip(_("Copy ( c )"));
+}
+EditCopy::~EditCopy()
+{
}
-EditLift::~EditLift()
+
+int EditCopy::keypress_event()
{
+ if( alt_down() ) return 0;
+ if( (get_keypress() == 'c' && !ctrl_down()) ||
+ (panel->is_vwindow() && get_keypress() == 'C') ) {
+ return handle_event();
+ }
+ return 0;
}
-int EditLift::handle_event()
+int EditCopy::handle_event()
{
+ panel->panel_copy_selection();
return 1;
}
+//overwrite_selection
EditOverwrite::EditOverwrite(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->overwrite_data)
{
}
int EditOverwrite::handle_event()
{
- panel->overwrite_selection();
+ panel->panel_overwrite_selection();
return 1;
}
int EditOverwrite::keypress_event()
return 0;
}
-EditExtract::EditExtract(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->extract_data)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Extract"));
-}
-EditExtract::~EditExtract()
-{
-}
-int EditExtract::handle_event()
-{
-// mwindow->extract_selection();
- return 1;
-}
-
-EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("toclip"))
+//set_inpoint
+//unset_inoutpoint
+EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("inbutton"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("To clip ( i )"));
+ set_tooltip(_("In point ( [ or < )"));
}
-EditToClip::~EditToClip()
+EditInPoint::~EditInPoint()
{
}
-int EditToClip::handle_event()
+int EditInPoint::handle_event()
{
- panel->to_clip();
+ panel->panel_set_inpoint();
return 1;
}
-
-int EditToClip::keypress_event()
+int EditInPoint::keypress_event()
{
- if( alt_down() ) return 0;
- if( get_keypress() == 'i' ||
- (panel->is_vwindow() && get_keypress() == 'I') ) {
- handle_event();
- return 1;
+ int key = get_keypress();
+ if( ctrl_down() ) {
+ if( key == 't' ) {
+ panel->panel_unset_inoutpoint();
+ return 1;
+ }
+ }
+ else if( !alt_down() ) {
+ if( key == '[' || key == '<' ) {
+ panel->panel_set_inpoint();
+ return 1;
+ }
}
return 0;
}
-EditManualGoto::EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("goto"))
+//set_outpoint
+//unset_inoutpoint
+EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("outbutton"))
{
this->mwindow = mwindow;
this->panel = panel;
- mangoto = new ManualGoto(mwindow, panel);
- set_tooltip(_("Manual goto ( g )"));
+ set_tooltip(_("Out point ( ] or > )"));
}
-EditManualGoto::~EditManualGoto()
+EditOutPoint::~EditOutPoint()
{
- delete mangoto;
}
-int EditManualGoto::handle_event()
+int EditOutPoint::handle_event()
{
- mangoto->start();
+ panel->panel_set_outpoint();
return 1;
}
-
-int EditManualGoto::keypress_event()
+int EditOutPoint::keypress_event()
{
- if( get_keypress() == 'g' ) {
- handle_event();
- return 1;
+ int key = get_keypress();
+ if( ctrl_down() ) {
+ if( key == 't' ) {
+ panel->panel_unset_inoutpoint();
+ return 1;
+ }
+ }
+ else if( !alt_down() ) {
+ if( key == ']' || key == '>' ) {
+ panel->panel_set_outpoint();
+ return 1;
+ }
}
return 0;
}
-
+//splice_selection
EditSplice::EditSplice(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->splice_data)
{
}
int EditSplice::handle_event()
{
- panel->splice_selection();
+ panel->panel_splice_selection();
return 1;
}
int EditSplice::keypress_event()
return 0;
}
-EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("cut"))
+//to_clip
+EditToClip::EditToClip(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("toclip"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Split | Cut ( x )"));
-}
-EditCut::~EditCut()
-{
+ set_tooltip(_("To clip ( i )"));
}
-int EditCut::keypress_event()
+EditToClip::~EditToClip()
{
- if( ctrl_down() || shift_down() || alt_down() )
- return 0;
- if( get_keypress() == 'x' )
- return handle_event();
- return 0;
}
-
-int EditCut::handle_event()
+int EditToClip::handle_event()
{
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( !have_mwindow_lock )
- mwindow->gui->lock_window("EditCut::handle_event");
-
- mwindow->cut();
-
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
+ panel->panel_to_clip();
return 1;
}
-EditClick2Play::EditClick2Play(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Toggle(x, y, mwindow->theme->get_image_set("playpatch_data"),
- !panel->is_vwindow() ?
- mwindow->edl->session->cwindow_click2play :
- mwindow->edl->session->vwindow_click2play)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Click to play (p)"));
-}
-int EditClick2Play::handle_event()
-{
- int value = get_value();
- if( panel->is_vwindow() ) {
- mwindow->edl->session->vwindow_click2play = value;
- mwindow->update_vwindow();
- }
- else
- mwindow->edl->session->cwindow_click2play = value;
- return 1;
-}
-int EditClick2Play::keypress_event()
+int EditToClip::keypress_event()
{
- int key = get_keypress();
- if( key == 'p' && !ctrl_down() && !shift_down() && !alt_down() ) {
- int value = get_value() ? 0 : 1;
- update(value);
- if( panel->is_vwindow() ) {
- mwindow->edl->session->vwindow_click2play = value;
- mwindow->update_vwindow();
- }
- else
- mwindow->edl->session->cwindow_click2play = value;
+ if( alt_down() ) return 0;
+ if( get_keypress() == 'i' ||
+ (panel->is_vwindow() && get_keypress() == 'I') ) {
+ handle_event();
return 1;
}
return 0;
}
-
-EditCommercial::EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("commercial"))
+//cut
+EditCut::EditCut(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("cut"))
{
this->mwindow = mwindow;
this->panel = panel;
- set_tooltip(_("Commercial ( shift A )"));
+ set_tooltip(_("Split | Cut ( x )"));
}
-EditCommercial::~EditCommercial()
+EditCut::~EditCut()
{
}
-int EditCommercial::keypress_event()
+int EditCut::keypress_event()
{
- if( ctrl_down() || !shift_down() || alt_down() )
+ if( ctrl_down() || shift_down() || alt_down() )
return 0;
- if( get_keypress() == 'A' )
- return handle_event();
- return 0;
-}
-
-int EditCommercial::handle_event()
-{
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( have_mwindow_lock )
- mwindow->gui->unlock_window();
- mwindow->commit_commercial();
- if( !mwindow->put_commercial() ) {
- mwindow->gui->lock_window("EditCommercial::handle_event 1");
- mwindow->cut();
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
- mwindow->activate_commercial();
- return 1;
- }
- mwindow->undo_commercial();
- if( have_mwindow_lock )
- mwindow->gui->lock_window("EditCommercial::handle_event 2");
- return 1;
-}
-
-EditCopy::EditCopy(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("copy"))
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Copy ( c )"));
-}
-EditCopy::~EditCopy()
-{
-}
-
-int EditCopy::keypress_event()
-{
- if( alt_down() ) return 0;
- if( (get_keypress() == 'c' && !ctrl_down()) ||
- (panel->is_vwindow() && get_keypress() == 'C') ) {
+ if( get_keypress() == 'x' )
return handle_event();
- }
return 0;
}
-int EditCopy::handle_event()
-{
- panel->copy_selection();
- return 1;
-}
-
-EditAppend::EditAppend(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->append_data)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Append to end of track"));
-}
-EditAppend::~EditAppend()
-{
-}
-
-
-int EditAppend::handle_event()
-{
- return 1;
-}
-
-EditInsert::EditInsert(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->insert_data)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Insert before beginning of track"));
-}
-EditInsert::~EditInsert()
-{
-}
-
-
-int EditInsert::handle_event()
+int EditCut::handle_event()
{
-
+ panel->panel_cut();
return 1;
}
-
+//paste
EditPaste::EditPaste(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->get_image_set("paste"))
{
}
int EditPaste::handle_event()
{
- int have_mwindow_lock = mwindow->gui->get_window_lock();
- if( !have_mwindow_lock )
- mwindow->gui->lock_window("EditPaste::handle_event");
-
- mwindow->paste();
-
- if( !have_mwindow_lock )
- mwindow->gui->unlock_window();
- return 1;
-}
-
-
-
-EditTransition::EditTransition(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->transition_data)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Set transition"));
-}
-EditTransition::~EditTransition()
-{
-}
-int EditTransition::handle_event()
-{
- return 1;
-}
-
-EditPresentation::EditPresentation(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->presentation_data)
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Set presentation up to current position"));
-}
-EditPresentation::~EditPresentation()
-{
-}
-int EditPresentation::handle_event()
-{
+ panel->panel_paste();
return 1;
}
-EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("undo"))
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Undo ( z )"));
-}
-EditUndo::~EditUndo()
-{
-}
-int EditUndo::keypress_event()
-{
- if( ctrl_down() || shift_down() || alt_down() )
- return 0;
- if( get_keypress() == 'z' )
- return handle_event();
- return 0;
-}
-int EditUndo::handle_event()
-{
- mwindow->undo_entry(panel->subwindow);
- return 1;
-}
-
-EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("redo"))
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Redo ( shift Z )"));
-}
-EditRedo::~EditRedo()
-{
-}
-int EditRedo::keypress_event()
-{
- if( ctrl_down() || !shift_down() || alt_down() )
- return 0;
- if( get_keypress() == 'Z' )
- return handle_event();
- return 0;
-}
-int EditRedo::handle_event()
-{
- mwindow->redo_entry(panel->subwindow);
- return 1;
-};
-
-
-
-
-
-EditLabelbutton::EditLabelbutton(MWindow *mwindow, EditPanel *panel, int x, int y)
- : BC_Button(x, y, mwindow->theme->get_image_set("labelbutton"))
-{
- this->mwindow = mwindow;
- this->panel = panel;
- set_tooltip(_("Toggle label at current position ( l )"));
-}
-
-EditLabelbutton::~EditLabelbutton()
-{
-}
-int EditLabelbutton::keypress_event()
-{
- if( get_keypress() == 'l' && !alt_down() )
- return handle_event();
- return 0;
-}
-int EditLabelbutton::handle_event()
-{
- panel->toggle_label();
- return 1;
-}
-
-
-
-
-
-
-
+//fit_selection
EditFit::EditFit(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->get_image_set("fit"))
{
}
int EditFit::handle_event()
{
- mwindow->fit_selection();
+ panel->panel_fit_selection();
return 1;
}
-
-
-
-
-
-
-
-
+//fit_autos
EditFitAutos::EditFitAutos(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Button(x, y, mwindow->theme->get_image_set("fitautos"))
{
}
int EditFitAutos::keypress_event()
{
- if( !ctrl_down() && alt_down() && get_keypress() == 'f' ) {
- mwindow->fit_autos(1);
- return 1;
- }
- if( ctrl_down() && alt_down() && get_keypress() == 'f' ) {
- mwindow->fit_autos(0);
+ if( get_keypress() == 'f' && alt_down() ) {
+ panel->panel_fit_autos(!ctrl_down() ? 1 : 0);
return 1;
}
return 0;
}
int EditFitAutos::handle_event()
{
- mwindow->fit_autos(1);
+ panel->panel_fit_autos(1);
return 1;
}
-
-
-
-
-
-
-
-
-
-
-
-
+//set_editing_mode
ArrowButton::ArrowButton(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Toggle(x, y,
mwindow->theme->get_image_set("arrow"),
{
update(1);
panel->ibeam->update(0);
- mwindow->set_editing_mode(EDITING_ARROW,
- !panel->is_mwindow(), panel->is_mwindow());
+ panel->panel_set_editing_mode(EDITING_ARROW);
// Nothing after this
return 1;
}
-
IBeamButton::IBeamButton(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Toggle(x, y,
mwindow->theme->get_image_set("ibeam"),
{
update(1);
panel->arrow->update(0);
- mwindow->set_editing_mode(EDITING_IBEAM,
- !panel->is_mwindow(), panel->is_mwindow());
+ panel->panel_set_editing_mode(EDITING_IBEAM);
// Nothing after this
return 1;
}
+//set_auto_keyframes
KeyFrameButton::KeyFrameButton(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Toggle(x, y,
mwindow->theme->get_image_set("autokeyframe"),
int KeyFrameButton::handle_event()
{
- mwindow->set_auto_keyframes(get_value(),
- !panel->is_mwindow(), panel->is_mwindow());
+ panel->panel_set_auto_keyframes(get_value());
return 1;
}
if( key == 'j' && !ctrl_down() && !shift_down() && !alt_down() ) {
int value = get_value() ? 0 : 1;
update(value);
- mwindow->set_auto_keyframes(value,
- !panel->is_mwindow(), panel->is_mwindow());
+ panel->panel_set_auto_keyframes(value);
return 1;
}
return 0;
}
-LockLabelsButton::LockLabelsButton(MWindow *mwindow, int x, int y)
+//set_labels_follow_edits
+LockLabelsButton::LockLabelsButton(MWindow *mwindow, EditPanel *panel, int x, int y)
: BC_Toggle(x, y,
mwindow->theme->get_image_set("locklabels"),
mwindow->edl->session->labels_follow_edits,
"", 0, 0, 0)
{
this->mwindow = mwindow;
+ this->panel = panel;
set_tooltip(_("Lock labels from moving with edits"));
}
int LockLabelsButton::handle_event()
{
- mwindow->set_labels_follow_edits(get_value());
+ panel->panel_set_labels_follow_edits(get_value());
+ return 1;
+}
+
+
+
+EditManualGoto::EditManualGoto(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("goto"))
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ mangoto = new ManualGoto(mwindow, panel);
+ set_tooltip(_("Manual goto ( g )"));
+}
+EditManualGoto::~EditManualGoto()
+{
+ delete mangoto;
+}
+int EditManualGoto::handle_event()
+{
+ mangoto->start();
+ return 1;
+}
+
+int EditManualGoto::keypress_event()
+{
+ if( get_keypress() == 'g' ) {
+ handle_event();
+ return 1;
+ }
+ return 0;
+}
+
+
+EditClick2Play::EditClick2Play(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Toggle(x, y, mwindow->theme->get_image_set("playpatch_data"),
+ !panel->is_vwindow() ?
+ mwindow->edl->session->cwindow_click2play :
+ mwindow->edl->session->vwindow_click2play)
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("Click to play (p)"));
+}
+int EditClick2Play::handle_event()
+{
+ int value = get_value();
+ panel->set_click_to_play(value);
+ return 1;
+}
+int EditClick2Play::keypress_event()
+{
+ int key = get_keypress();
+ if( key == 'p' && !ctrl_down() && !shift_down() && !alt_down() ) {
+ int value = get_value() ? 0 : 1;
+ update(value);
+ panel->set_click_to_play(value);
+ return 1;
+ }
+ return 0;
+}
+
+
+EditCommercial::EditCommercial(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("commercial"))
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("Commercial ( shift A )"));
+}
+EditCommercial::~EditCommercial()
+{
+}
+int EditCommercial::keypress_event()
+{
+ if( ctrl_down() || !shift_down() || alt_down() )
+ return 0;
+ if( get_keypress() == 'A' )
+ return handle_event();
+ return 0;
+}
+
+int EditCommercial::handle_event()
+{
+ int have_mwindow_lock = mwindow->gui->get_window_lock();
+ if( have_mwindow_lock )
+ mwindow->gui->unlock_window();
+ mwindow->commit_commercial();
+ if( !mwindow->put_commercial() ) {
+ mwindow->gui->lock_window("EditCommercial::handle_event 1");
+ mwindow->cut();
+ if( !have_mwindow_lock )
+ mwindow->gui->unlock_window();
+ mwindow->activate_commercial();
+ return 1;
+ }
+ mwindow->undo_commercial();
+ if( have_mwindow_lock )
+ mwindow->gui->lock_window("EditCommercial::handle_event 2");
+ return 1;
+}
+
+
+EditUndo::EditUndo(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("undo"))
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("Undo ( z )"));
+}
+EditUndo::~EditUndo()
+{
+}
+int EditUndo::keypress_event()
+{
+ if( ctrl_down() || shift_down() || alt_down() )
+ return 0;
+ if( get_keypress() == 'z' )
+ return handle_event();
+ return 0;
+}
+int EditUndo::handle_event()
+{
+ mwindow->undo_entry(panel->subwindow);
+ return 1;
+}
+
+EditRedo::EditRedo(MWindow *mwindow, EditPanel *panel, int x, int y)
+ : BC_Button(x, y, mwindow->theme->get_image_set("redo"))
+{
+ this->mwindow = mwindow;
+ this->panel = panel;
+ set_tooltip(_("Redo ( shift Z )"));
+}
+EditRedo::~EditRedo()
+{
+}
+int EditRedo::keypress_event()
+{
+ if( ctrl_down() || !shift_down() || alt_down() )
+ return 0;
+ if( get_keypress() == 'Z' )
+ return handle_event();
+ return 0;
+}
+int EditRedo::handle_event()
+{
+ mwindow->redo_entry(panel->subwindow);
return 1;
}
EditPanel *panel;
};
-class EditLift : public BC_Button
-{
-public:
- EditLift(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditLift();
- int handle_event();
- MWindow *mwindow;
- EditPanel *panel;
-};
-
-class EditExtract : public BC_Button
-{
-public:
- EditExtract(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditExtract();
- int handle_event();
- MWindow *mwindow;
- EditPanel *panel;
-};
-
class EditToClip : public BC_Button
{
public:
EditPanel *panel;
};
-class EditAppend : public BC_Button
-{
-public:
- EditAppend(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditAppend();
-
- int handle_event();
-
- MWindow *mwindow;
- EditPanel *panel;
-};
-
-class EditInsert : public BC_Button
-{
-public:
- EditInsert(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditInsert();
-
- int handle_event();
-
- MWindow *mwindow;
- EditPanel *panel;
-};
-
class EditPaste : public BC_Button
{
public:
EditPanel *panel;
};
-class EditTransition : public BC_Button
-{
-public:
- EditTransition(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditTransition();
- int handle_event();
- MWindow *mwindow;
- EditPanel *panel;
-};
-
-class EditPresentation : public BC_Button
-{
-public:
- EditPresentation(MWindow *mwindow, EditPanel *panel, int x, int y);
- ~EditPresentation();
- int handle_event();
- MWindow *mwindow;
- EditPanel *panel;
-};
-
class EditUndo : public BC_Button
{
public:
class LockLabelsButton : public BC_Toggle
{
public:
- LockLabelsButton(MWindow *mwindow, int x, int y);
+ LockLabelsButton(MWindow *mwindow, EditPanel *panel, int x, int y);
int handle_event();
MWindow *mwindow;
+ EditPanel *panel;
};
int use_keyframe,
int use_splice, // Extra buttons
int use_overwrite,
- int use_lift,
- int use_extract,
int use_copy, // Use copy when in EDITING_ARROW
int use_paste,
int use_undo,
void reposition_buttons(int x, int y);
void create_objects();
int get_w();
- virtual void copy_selection();
- virtual void splice_selection();
- virtual void overwrite_selection();
- virtual void set_inpoint();
- virtual void set_outpoint();
- virtual void unset_inoutpoint();
- virtual void to_clip() = 0;
- virtual void toggle_label();
- virtual void prev_label(int cut);
- virtual void next_label(int cut);
- virtual void prev_edit(int cut);
- virtual void next_edit(int cut);
- virtual double get_position();
- virtual void set_position(double position);
+
+ virtual double get_position() = 0;
+ virtual void set_position(double position) = 0;
+ virtual void set_click_to_play(int v) = 0;
+
+ virtual void panel_stop_transport() = 0;
+ virtual void panel_toggle_label() = 0;
+ virtual void panel_next_label(int cut) = 0;
+ virtual void panel_prev_label(int cut) = 0;
+ virtual void panel_prev_edit(int cut) = 0;
+ virtual void panel_next_edit(int cut) = 0;
+ virtual void panel_copy_selection() = 0;
+ virtual void panel_overwrite_selection() = 0;
+ virtual void panel_splice_selection() = 0;
+ virtual void panel_set_inpoint() = 0;
+ virtual void panel_set_outpoint() = 0;
+ virtual void panel_unset_inoutpoint() = 0;
+ virtual void panel_to_clip() = 0;
+ virtual void panel_cut() = 0;
+ virtual void panel_paste() = 0;
+ virtual void panel_fit_selection() = 0;
+ virtual void panel_fit_autos(int all) = 0;
+ virtual void panel_set_editing_mode(int mode) = 0;
+ virtual void panel_set_auto_keyframes(int v) = 0;
+ virtual void panel_set_labels_follow_edits(int v) = 0;
MWindow *mwindow;
BC_WindowBase *subwindow;
int use_keyframe;
int use_splice;
int use_overwrite;
- int use_lift;
- int use_extract;
int use_paste;
int use_undo;
int use_fit;
// EditDelOutPoint *deloutpoint;
EditSplice *splice;
EditOverwrite *overwrite;
- EditLift *lift;
- EditExtract *extract;
EditToClip *clip;
EditCut *cut;
EditCommercial *commercial;
#define CWINDOW_ID 1
#define VWINDOW_ID 2
+class EditPanel;
class EditInPoint;
class EditOutPoint;
class EditDelInPoint;
class EditDelOutPoint;
class EditSplice;
class EditOverwrite;
-class EditLift;
-class EditExtract;
class EditToClip;
class EditManualGoto;
class EditCut;
class EditCommercial;
class EditClick2Play;
class EditCopy;
-class EditAppend;
-class EditInsert;
class EditPaste;
-class EditTransition;
-class EditPresentation;
class EditUndo;
class EditRedo;
class EditLabelbutton;
class IBeamButton;
class KeyFrameButton;
class LockLabelsButton;
-class EditPanel;
#endif
1, // use_keyframe
0, // use_splice
0, // use_overwrite
- 1, // use_lift
- 1, // use_extract
1, // use_copy
1, // use_paste
1, // use_undo
this->mbuttons = mbuttons;
}
-void MainEditing::to_clip()
+double MainEditing::get_position()
+{
+ return mwindow->get_position();
+}
+
+void MainEditing::set_position(double position)
+{
+ mwindow->set_position(position);
+}
+
+void MainEditing::set_click_to_play(int v)
+{
+// not used
+}
+
+void MainEditing::panel_stop_transport()
+{
+ mwindow->gui->stop_transport("MainEditing::stop_transport");
+}
+
+void MainEditing::panel_toggle_label()
+{
+ mwindow->toggle_label();
+}
+
+void MainEditing::panel_next_label(int cut)
+{
+ int shift_down = mwindow->gui->shift_down();
+ panel_stop_transport();
+ if( cut )
+ mwindow->cut_right_label();
+ else
+ mwindow->next_label(shift_down);
+}
+
+void MainEditing::panel_prev_label(int cut)
+{
+ int shift_down = mwindow->gui->shift_down();
+ panel_stop_transport();
+ if( cut )
+ mwindow->cut_left_label();
+ else
+ mwindow->prev_label(shift_down);
+}
+
+void MainEditing::panel_prev_edit(int cut)
+{
+ int shift_down = subwindow->shift_down();
+ panel_stop_transport();
+ if( cut )
+ mwindow->cut_left_edit();
+ else
+ mwindow->prev_edit_handle(shift_down);
+}
+
+void MainEditing::panel_next_edit(int cut)
+{
+ int shift_down = subwindow->shift_down();
+ panel_stop_transport();
+ if( cut )
+ mwindow->cut_right_edit();
+ else
+ mwindow->next_edit_handle(shift_down);
+}
+
+void MainEditing::panel_copy_selection()
+{
+ mwindow->copy();
+}
+
+void MainEditing::panel_overwrite_selection() {} // not used
+void MainEditing::panel_splice_selection() {} // not used
+
+void MainEditing::panel_set_inpoint()
+{
+ mwindow->set_inpoint();
+}
+
+void MainEditing::panel_set_outpoint()
+{
+ mwindow->set_outpoint();
+}
+
+void MainEditing::panel_unset_inoutpoint()
+{
+ mwindow->unset_inoutpoint();
+}
+
+void MainEditing::panel_to_clip()
{
MWindowGUI *gui = mwindow->gui;
gui->unlock_window();
}
+void MainEditing::panel_cut()
+{
+ mwindow->cut();
+}
+
+void MainEditing::panel_paste()
+{
+ mwindow->paste();
+}
+
+void MainEditing::panel_fit_selection()
+{
+ mwindow->fit_selection();
+}
+
+void MainEditing::panel_fit_autos(int all)
+{
+ mwindow->fit_autos(all);
+}
+
+void MainEditing::panel_set_editing_mode(int mode)
+{
+ mwindow->set_editing_mode(mode);
+}
+
+void MainEditing::panel_set_auto_keyframes(int v)
+{
+ mwindow->set_auto_keyframes(v);
+}
+
+void MainEditing::panel_set_labels_follow_edits(int v)
+{
+ mwindow->set_labels_follow_edits(v);
+}
+
public:
MainEditing(MWindow *mwindow, MButtons *mbuttons, int x, int y);
virtual ~MainEditing() {}
- void to_clip();
+
+ double get_position();
+ void set_position(double position);
+ void set_click_to_play(int v);
+
+ void panel_stop_transport();
+ void panel_toggle_label();
+ void panel_next_label(int cut);
+ void panel_prev_label(int cut);
+ void panel_prev_edit(int cut);
+ void panel_next_edit(int cut);
+ void panel_copy_selection();
+ void panel_overwrite_selection();
+ void panel_splice_selection();
+ void panel_set_inpoint();
+ void panel_set_outpoint();
+ void panel_unset_inoutpoint();
+ void panel_to_clip();
+ void panel_cut();
+ void panel_paste();
+ void panel_fit_selection();
+ void panel_fit_autos(int all);
+ void panel_set_editing_mode(int mode);
+ void panel_set_auto_keyframes(int v);
+ void panel_set_labels_follow_edits(int v);
MWindow *mwindow;
MButtons *mbuttons;
playback_3d = 0;
splash_window = 0;
undo = 0;
+ undo_command = COMMAND_NONE;
defaults = 0;
assets = 0;
//commercials = 0;
{
if( !session->drag_assets->size() &&
!session->drag_clips->size() ) return;
- undo->update_undo_before();
+ undo_before();
select_zwindow(0);
ArrayList<ZWindow *>new_mixers;
refresh_mixers();
save_backup();
- undo->update_undo_after(_("create mixers"), LOAD_ALL);
+ undo_after(_("create mixers"), LOAD_ALL);
restart_brender();
gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
sync_parameters(CHANGE_ALL);
gui->stop_transport(gui->get_window_lock() ? "MWindow::stop_transport" : 0);
}
+void MWindow::undo_before(const char *description, void *creator)
+{
+ if( cwindow->playback_engine->is_playing_back ) {
+ undo_command = cwindow->playback_engine->command->command;
+ cwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0);
+ gui->unlock_window();
+ cwindow->playback_engine->interrupt_playback(1);
+ gui->lock_window(description);
+ }
+ undo->update_undo_before(description, creator);
+}
+
+void MWindow::undo_after(const char *description, uint32_t load_flags, int changes_made)
+{
+ if( undo_command != COMMAND_NONE ) {
+ cwindow->playback_engine->que->send_command(undo_command, CHANGE_NONE, edl, 1, 0);
+ undo_command = COMMAND_NONE;
+ }
+
+ undo->update_undo_after(description, load_flags, changes_made);
+}
+
void MWindow::beep(double freq, double secs, double gain)
{
if( !proxy_beep ) proxy_beep = new ProxyBeep(this);
gui->lock_window("MWindow::load_filenames 0");
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
- undo->update_undo_before();
+ undo_before();
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
// need to update undo before project, since mwindow is unlocked & a new load
// can begin here. Should really prevent loading until we're done.
if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
- undo->update_undo_after(_("load"), LOAD_ALL);
+ undo_after(_("load"), LOAD_ALL);
for(int i = 0; i < new_edls.size(); i++)
{
edl->Garbage::add_user();
save_backup();
- undo->update_undo_before(_("proxy"), this);
+ undo_before(_("proxy"), this);
ProxyRender proxy_render(this, asset);
// revert project to original size from current size
edl->set_proxy(new_scale, new_use_scaler,
&proxy_render.orig_idxbls, &proxy_render.orig_proxies);
- undo->update_undo_after(_("proxy"), LOAD_ALL);
+ undo_after(_("proxy"), LOAD_ALL);
edl->Garbage::remove_user();
restart_brender();
screens = value;
}
-void MWindow::set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow)
+void MWindow::set_auto_keyframes(int value)
{
- if(lock_mwindow) gui->lock_window("MWindow::set_auto_keyframes");
edl->session->auto_keyframes = value;
gui->mbuttons->edit_panel->keyframe->update(value);
gui->flush();
- if(lock_mwindow) gui->unlock_window();
-
- if(lock_cwindow) cwindow->gui->lock_window("MWindow::set_auto_keyframes");
+ cwindow->gui->lock_window("MWindow::set_auto_keyframes");
cwindow->gui->edit_panel->keyframe->update(value);
cwindow->gui->flush();
- if(lock_cwindow) cwindow->gui->unlock_window();
+ cwindow->gui->unlock_window();
}
void MWindow::set_auto_visibility(Autos *autos, int value)
gui->unlock_window();
}
-int MWindow::set_editing_mode(int new_editing_mode, int lock_mwindow, int lock_cwindow)
+int MWindow::set_editing_mode(int new_editing_mode)
{
- if(lock_mwindow) gui->lock_window("MWindow::set_editing_mode");
edl->session->editing_mode = new_editing_mode;
gui->mbuttons->edit_panel->editing_mode = edl->session->editing_mode;
gui->mbuttons->edit_panel->update();
gui->set_editing_mode(1);
- if(lock_mwindow) gui->unlock_window();
-
- if(lock_cwindow) cwindow->gui->lock_window("MWindow::set_editing_mode");
+ cwindow->gui->lock_window("MWindow::set_editing_mode");
cwindow->gui->edit_panel->update();
cwindow->gui->edit_panel->editing_mode = edl->session->editing_mode;
- if(lock_cwindow) cwindow->gui->unlock_window();
+ cwindow->gui->unlock_window();
return 0;
}
{
int mode = edl->session->editing_mode;
if( mode == EDITING_ARROW )
- set_editing_mode(EDITING_IBEAM, 0, 1);
+ set_editing_mode(EDITING_IBEAM);
else
- set_editing_mode(EDITING_ARROW, 0, 1);
+ set_editing_mode(EDITING_ARROW);
}
void MWindow::toggle_camera_xyz()
void MWindow::set_labels_follow_edits(int value)
{
- gui->lock_window("MWindow::set_labels_follow_edits");
edl->session->labels_follow_edits = value;
gui->mbuttons->edit_panel->locklabels->update(value);
gui->mainmenu->labels_follow_edits->set_checked(value);
gui->flush();
- gui->unlock_window();
}
void MWindow::sync_parameters(int change_type)
void MWindow::save_undo_data()
{
- undo->update_undo_before();
- undo->update_undo_after(_("perpetual session"), LOAD_ALL);
+ undo_before();
+ undo_after(_("perpetual session"), LOAD_ALL);
char perpetual_path[BCTEXTLEN];
snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
File::get_config_path(), PERPETUAL_FILE);
}
//printf("MWindow::rebuild_indices 1 %s\n", indexable->path);
- if(push_undo) undo->update_undo_before();
+ if(push_undo) undo_before();
if(drag_assets) edl->remove_from_project(drag_assets);
if(drag_clips) edl->remove_from_project(drag_clips);
if(redraw) save_backup();
- if(push_undo) undo->update_undo_after(_("remove assets"), LOAD_ALL);
+ if(push_undo) undo_after(_("remove assets"), LOAD_ALL);
if(redraw) {
restart_brender();
session->auto_keyframes = 0;
int result = file->open_file(preferences, asset, 1, 0);
if( !result && delete_tracks > 0 )
- undo->update_undo_before();
+ undo_before();
int video_layers = asset->get_video_layers();
if( !result && asset->video_data && vstream < video_layers ) {
// try to get asset up to date, may fail
session->auto_keyframes = old_auto_keyframes;
if( !result && delete_tracks > 0 ) {
save_backup();
- undo->update_undo_after(_("select asset"), LOAD_ALL);
+ undo_after(_("select asset"), LOAD_ALL);
}
resync_guis();
return result;
#define FONT_SEARCHPATH "fonts"
-// All entry points for commands except for window locking should be here.
-// This allows scriptability.
class MWindow : public Thread
{
int edit_labels, int edit_autos, int edit_plugins);
void selected_edits_to_clipboard(int packed);
// Fit selected autos to the vertical display range
- void fit_autos(int doall);
+ void fit_autos(int all);
void change_currentautorange(int autogrouptype, int increment, int changemax);
void expand_autos(int changeall, int domin, int domax);
void shrink_autos(int changeall, int domin, int domax);
void dump_plugindb(FILE *fp);
void stop_playback(int wait);
void stop_transport();
+ void undo_before(const char *description = "", void *creator = 0);
+ void undo_after(const char *description, uint32_t load_flags, int changes_made = 1);
void queue_mixers(EDL *edl, int command, int wait_tracking,
int use_inout, int update_refresh, int toggle_audio, int loop_play);
int find_selection(double position, int scroll_display = 0);
void toggle_camera_xyz();
void toggle_projector_xyz();
+ double get_position();
+ void set_position(double position);
// seek to labels
// shift_down must be passed by the caller because different windows call
void set_automation_mode(int mode);
void set_keyframe_type(int mode);
- void set_auto_keyframes(int value, int lock_mwindow, int lock_cwindow);
+ void set_auto_keyframes(int value);
void set_auto_visibility(Autos *autos, int value);
void set_labels_follow_edits(int value);
// Update the editing mode
- int set_editing_mode(int new_editing_mode, int lock_mwindow, int lock_cwindow);
+ int set_editing_mode(int new_editing_mode);
void toggle_editing_mode();
- void set_inpoint(int is_mwindow);
- void set_outpoint(int is_mwindow);
- void unset_inoutpoint(int is_mwindow);
+ void set_inpoint();
+ void set_outpoint();
+ void unset_inoutpoint();
void toggle_loop_playback();
void trim_selection();
// Synchronize EDL settings with all playback engines depending on current
void sync_parameters(int change_type = CHANGE_PARAMS);
void save_clip(EDL *new_edl, const char *txt);
void to_clip(EDL *edl, const char *txt, int all);
- int toggle_label(int is_mwindow);
+ int toggle_label();
void undo_entry(BC_WindowBase *calling_window_gui);
void redo_entry(BC_WindowBase *calling_window_gui);
void save_undo_data();
// Main undo stack
MainUndo *undo;
+ int undo_command;
+
BC_Hash *defaults;
Assets *assets;
// CICaches for drawing timeline only
void MWindow::add_audio_track_entry(int above, Track *dst)
{
- undo->update_undo_before();
+ undo_before();
add_audio_track(above, dst);
save_backup();
- undo->update_undo_after(_("add track"), LOAD_ALL);
+ undo_after(_("add track"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
void MWindow::add_video_track_entry(Track *dst)
{
- undo->update_undo_before();
+ undo_before();
add_video_track(1, dst);
- undo->update_undo_after(_("add track"), LOAD_ALL);
+ undo_after(_("add track"), LOAD_ALL);
restart_brender();
void MWindow::add_subttl_track_entry(Track *dst)
{
- undo->update_undo_before();
+ undo_before();
add_subttl_track(1, dst);
- undo->update_undo_after(_("add track"), LOAD_ALL);
+ undo_after(_("add track"), LOAD_ALL);
restart_brender();
{
int w, h;
- undo->update_undo_before();
+ undo_before();
// Get w and h
w = indexable->get_w();
save_backup();
- undo->update_undo_after(_("asset to all"), LOAD_ALL);
+ undo_after(_("asset to all"), LOAD_ALL);
restart_brender();
gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
sync_parameters(CHANGE_ALL);
if( indexable->have_video() ) {
int w, h;
- undo->update_undo_before();
+ undo_before();
// Get w and h
w = indexable->get_w();
save_backup();
- undo->update_undo_after(_("asset to size"), LOAD_ALL);
+ undo_after(_("asset to size"), LOAD_ALL);
restart_brender();
sync_parameters(CHANGE_ALL);
}
session->drag_assets->get(0)->have_video() ) {
double new_framerate = session->drag_assets->get(0)->get_frame_rate();
double old_framerate = edl->session->frame_rate;
- undo->update_undo_before();
+ undo_before();
edl->session->frame_rate = new_framerate;
edl->resample(old_framerate, new_framerate, TRACK_VIDEO);
save_backup();
- undo->update_undo_after(_("asset to rate"), LOAD_ALL);
+ undo_after(_("asset to rate"), LOAD_ALL);
restart_brender();
gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
sync_parameters(CHANGE_ALL);
void MWindow::clear_entry()
{
- undo->update_undo_before();
+ undo_before();
clear(1);
edl->optimize();
save_backup();
- undo->update_undo_after(_("clear"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("clear"), LOAD_EDITS | LOAD_TIMEBAR);
restart_brender();
update_plugin_guis();
void MWindow::set_automation_mode(int mode)
{
- undo->update_undo_before();
+ undo_before();
speed_before();
edl->tracks->set_automation_mode(
edl->local_session->get_selectionstart(),
save_backup();
char string[BCSTRLEN];
sprintf(string,"set %s", FloatAuto::curve_name(mode));
- undo->update_undo_after(string,
+ undo_after(string,
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
void MWindow::clear_automation()
{
- undo->update_undo_before();
+ undo_before();
speed_before();
edl->tracks->clear_automation(edl->local_session->get_selectionstart(),
edl->local_session->get_selectionend());
int changed_edl = speed_after(1);
save_backup();
- undo->update_undo_after(_("clear keyframes"),
+ undo_after(_("clear keyframes"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
int MWindow::clear_default_keyframe()
{
- undo->update_undo_before();
+ undo_before();
speed_before();
edl->tracks->clear_default_keyframe();
int changed_edl = speed_after(1);
save_backup();
- undo->update_undo_after(_("clear default keyframe"),
+ undo_after(_("clear default keyframe"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
void MWindow::clear_labels()
{
- undo->update_undo_before();
+ undo_before();
clear_labels(edl->local_session->get_selectionstart(),
edl->local_session->get_selectionend());
- undo->update_undo_after(_("clear labels"), LOAD_TIMEBAR);
+ undo_after(_("clear labels"), LOAD_TIMEBAR);
gui->update_timebar(1);
cwindow->update(0, 0, 0, 0, 1);
void MWindow::concatenate_tracks()
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->concatenate_tracks(edl->session->plugins_follow_edits,
edl->session->autos_follow_edits);
save_backup();
- undo->update_undo_after(_("concatenate tracks"), LOAD_EDITS);
+ undo_after(_("concatenate tracks"), LOAD_EDITS);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
void MWindow::crop_video()
{
- undo->update_undo_before();
+ undo_before();
// Clamp EDL crop region
if( edl->session->crop_x1 > edl->session->crop_x2 ) {
edl->session->crop_x1 ^= edl->session->crop_x2;
edl->session->output_h);
}
- undo->update_undo_after(_("crop"), LOAD_ALL);
+ undo_after(_("crop"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_ALL);
void MWindow::blade(double position)
{
- undo->update_undo_before();
+ undo_before();
edl->blade(position);
edl->optimize();
save_backup();
- undo->update_undo_after(_("blade"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("blade"), LOAD_EDITS | LOAD_TIMEBAR);
restart_brender();
update_plugin_guis();
gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
void MWindow::cut(double start, double end, double new_position)
{
- undo->update_undo_before();
+ undo_before();
copy(start, end);
edl->clear(start, end,
edl->session->labels_follow_edits,
edl->optimize();
save_backup();
- undo->update_undo_after(_("split | cut"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("split | cut"), LOAD_EDITS | LOAD_TIMEBAR);
if( new_position >= 0 ) {
edl->local_session->set_selectionstart(new_position);
edl->local_session->set_selectionend(new_position);
int MWindow::cut_automation()
{
- undo->update_undo_before();
+ undo_before();
speed_before();
copy_automation();
edl->tracks->clear_automation(edl->local_session->get_selectionstart(),
edl->local_session->get_selectionend());
int changed_edl = speed_after(1);
save_backup();
- undo->update_undo_after(_("cut keyframes"),
+ undo_after(_("cut keyframes"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
int MWindow::cut_default_keyframe()
{
- undo->update_undo_before();
+ undo_before();
speed_before();
copy_default_keyframe();
edl->tracks->clear_default_keyframe();
int changed_edl = speed_after(1);
save_backup();
- undo->update_undo_after(_("cut default keyframe"),
+ undo_after(_("cut default keyframe"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
void MWindow::delete_tracks()
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->delete_tracks();
- undo->update_undo_after(_("delete tracks"), LOAD_ALL);
+ undo_after(_("delete tracks"), LOAD_ALL);
save_backup();
restart_brender();
void MWindow::delete_track(Track *track)
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->delete_track(track);
- undo->update_undo_after(_("delete track"), LOAD_ALL);
+ undo_after(_("delete track"), LOAD_ALL);
restart_brender();
update_plugin_states();
Track *dest_track = session->track_highlighted;
if( !dest_track ) return;
- undo->update_undo_before();
+ undo_before();
for( int i=0; i<session->drag_pluginservers->total; ++i ) {
PluginServer *plugin = session->drag_pluginservers->values[i];
}
save_backup();
- undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
+ undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
restart_brender();
sync_parameters(CHANGE_EDL);
// GUI updated in TrackCanvas, after current_operations are reset
{
if( !dest_track ) return;
- undo->update_undo_before();
+ undo_before();
double start = 0;
double length = dest_track->get_length();
}
save_backup();
- undo->update_undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
+ undo_after(_("insert effect"), LOAD_EDITS | LOAD_PATCHES);
restart_brender();
sync_parameters(CHANGE_EDL);
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
int MWindow::modify_edithandles()
{
- undo->update_undo_before();
+ undo_before();
int handle_mode = edl->session->edit_handle_mode[session->drag_button];
edl->modify_edithandles(session->drag_start,
session->drag_position, session->drag_handle, handle_mode,
int MWindow::modify_pluginhandles()
{
- undo->update_undo_before();
+ undo_before();
edl->modify_pluginhandles(session->drag_start,
session->drag_position,
edl->local_session->set_selectionstart(position);
edl->local_session->set_selectionend(position);
}
- undo->update_undo_after(_("drag handle"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("drag handle"), LOAD_EDITS | LOAD_TIMEBAR);
save_backup();
restart_brender();
void MWindow::match_output_size(Track *track)
{
- undo->update_undo_before();
+ undo_before();
track->track_w = edl->session->output_w;
track->track_h = edl->session->output_h;
save_backup();
- undo->update_undo_after(_("match output size"), LOAD_ALL);
+ undo_after(_("match output size"), LOAD_ALL);
restart_brender();
sync_parameters(CHANGE_EDL);
void MWindow::delete_edits(ArrayList<Edit*> *edits, const char *msg, int collapse)
{
if( !edits->size() ) return;
- undo->update_undo_before();
+ undo_before();
if( edl->session->labels_follow_edits )
edl->delete_edit_labels(edits, collapse);
edl->delete_edits(edits, collapse);
edl->optimize();
save_backup();
- undo->update_undo_after(msg, LOAD_EDITS);
+ undo_after(msg, LOAD_EDITS);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
void MWindow::move_edits(ArrayList<Edit*> *edits,
Track *track, double position, int mode)
{
- undo->update_undo_before();
+ undo_before();
// lockout timebar labels update
// labels can be deleted with tooltip repeater running
cwindow->gui->lock_window("Tracks::move_edits");
cwindow->gui->unlock_window();
save_backup();
- undo->update_undo_after(_("move edit"), LOAD_ALL);
+ undo_after(_("move edit"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
EDL *clip = new EDL();
clip->create_objects();
if( !clip->load_xml(&file, LOAD_ALL) ) {
- undo->update_undo_before();
+ undo_before();
paste_edits(clip, first_track, position, overwrite,
edit_edits, edit_labels, edit_autos, edit_plugins);
save_backup();
- undo->update_undo_after(_("paste clip"), LOAD_ALL);
+ undo_after(_("paste clip"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
void MWindow::move_group(EDL *group, Track *first_track, double position, int overwrite)
{
- undo->update_undo_before();
+ undo_before();
// lockout timebar labels update
// labels can be deleted with tooltip repeater running
cwindow->gui->lock_window("Tracks::move_group");
// edl->tracks->clear_selected_edits();
save_backup();
- undo->update_undo_after(_("move group"), LOAD_ALL);
+ undo_after(_("move group"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
void MWindow::move_effect(Plugin *plugin, Track *track, int64_t position)
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_effect(plugin, track, position);
save_backup();
- undo->update_undo_after(_("paste effect"), LOAD_ALL);
+ undo_after(_("paste effect"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
void MWindow::move_effect(Plugin *plugin, PluginSet *plugin_set, int64_t position)
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_effect(plugin, plugin_set, position);
save_backup();
- undo->update_undo_after(_("move effect"), LOAD_ALL);
+ undo_after(_("move effect"), LOAD_ALL);
restart_brender();
cwindow->refresh_frame(CHANGE_EDL);
void MWindow::move_plugins_up(PluginSet *plugin_set)
{
- undo->update_undo_before();
+ undo_before();
plugin_set->track->move_plugins_up(plugin_set);
save_backup();
- undo->update_undo_after(_("move effect up"), LOAD_ALL);
+ undo_after(_("move effect up"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
sync_parameters(CHANGE_EDL);
void MWindow::move_plugins_down(PluginSet *plugin_set)
{
- undo->update_undo_before();
+ undo_before();
plugin_set->track->move_plugins_down(plugin_set);
save_backup();
- undo->update_undo_after(_("move effect down"), LOAD_ALL);
+ undo_after(_("move effect down"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 0, 0, 0);
sync_parameters(CHANGE_EDL);
void MWindow::move_track_down(Track *track)
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_track_down(track);
save_backup();
- undo->update_undo_after(_("move track down"), LOAD_ALL);
+ undo_after(_("move track down"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
void MWindow::move_tracks_down()
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_tracks_down();
save_backup();
- undo->update_undo_after(_("move tracks down"), LOAD_ALL);
+ undo_after(_("move tracks down"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
void MWindow::move_track_up(Track *track)
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_track_up(track);
save_backup();
- undo->update_undo_after(_("move track up"), LOAD_ALL);
+ undo_after(_("move track up"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
sync_parameters(CHANGE_EDL);
void MWindow::move_tracks_up()
{
- undo->update_undo_before();
+ undo_before();
edl->tracks->move_tracks_up();
save_backup();
- undo->update_undo_after(_("move tracks up"), LOAD_ALL);
+ undo_after(_("move tracks up"), LOAD_ALL);
restart_brender();
gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0);
sync_parameters(CHANGE_EDL);
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
if( start != end ) {
- undo->update_undo_before();
+ undo_before();
edl->clear(start, end, 0,
edl->session->plugins_follow_edits,
edl->session->autos_follow_edits);
edl->session->autos_follow_edits);
save_backup();
- undo->update_undo_after(_("mute"), LOAD_EDITS);
+ undo_after(_("mute"), LOAD_EDITS);
restart_brender();
update_plugin_guis();
double dst_start = edl->local_session->get_selectionstart();
double dst_len = edl->local_session->get_selectionend() - dst_start;
- undo->update_undo_before();
+ undo_before();
if( !EQUIV(dst_len, 0) && (dst_len < overwrite_len) ) {
// in/out points or selection present and shorter than overwrite range
// shorten the copy range
edl->local_session->set_selectionend(dst_start + overwrite_len);
save_backup();
- undo->update_undo_after(_("overwrite"), LOAD_EDITS);
+ undo_after(_("overwrite"), LOAD_EDITS);
restart_brender();
update_plugin_guis();
if( len ) {
char *string = new char[len];
- undo->update_undo_before();
+ undo_before();
gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
FileXML file;
file.read_from_string(string);
save_backup();
- undo->update_undo_after(_("paste"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("paste"), LOAD_EDITS | LOAD_TIMEBAR);
restart_brender();
update_plugin_guis();
gui->update(1, FORCE_REDRAW, 1, 1, 0, 1, 0);
int MWindow::paste_assets(double position, Track *dest_track, int overwrite)
{
int result = 0;
- undo->update_undo_before();
+ undo_before();
if( session->drag_assets->total ) {
load_assets(session->drag_assets,
save_backup();
- undo->update_undo_after(_("paste assets"), LOAD_EDITS);
+ undo_after(_("paste assets"), LOAD_EDITS);
restart_brender();
gui->update(1, FORCE_REDRAW, 1, 0, 0, 1, 0);
sync_parameters(CHANGE_EDL);
int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
if( len ) {
- undo->update_undo_before();
+ undo_before();
speed_before();
char *string = new char[len];
gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
edl->session->typeless_keyframes);
int changed_edl = speed_after(1);
save_backup();
- undo->update_undo_after(_("paste keyframes"),
+ undo_after(_("paste keyframes"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
update_gui(changed_edl);
int64_t len = gui->clipboard_len(BC_PRIMARY_SELECTION);
if( len ) {
- undo->update_undo_before();
+ undo_before();
speed_before();
char *string = new char[len];
gui->from_clipboard(string, len, BC_PRIMARY_SELECTION);
edl->session->typeless_keyframes);
// edl->tracks->paste_default_keyframe(&file);
int changed_edl = speed_after(1);
- undo->update_undo_after(_("paste default keyframe"),
+ undo_after(_("paste default keyframe"),
!changed_edl ? LOAD_AUTOMATION :
LOAD_AUTOMATION + LOAD_EDITS + LOAD_TIMEBAR);
save_backup();
if( edl->session->frame_rate > 0 )
end += 1./edl->session->frame_rate;
}
- undo->update_undo_before(_("silence"), this);
+ undo_before(_("silence"), this);
edl->paste_silence(start, end,
edl->session->labels_follow_edits,
edl->session->plugins_follow_edits,
edl->session->autos_follow_edits);
edl->optimize();
save_backup();
- undo->update_undo_after(_("silence"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("silence"), LOAD_EDITS | LOAD_TIMEBAR);
update_plugin_guis();
restart_brender();
void MWindow::detach_transition(Transition *transition)
{
- undo->update_undo_before();
+ undo_before();
hide_plugin(transition, 1);
int is_video = (transition->edit->track->data_type == TRACK_VIDEO);
transition->edit->detach_transition();
save_backup();
- undo->update_undo_after(_("detach transition"), LOAD_ALL);
+ undo_after(_("detach transition"), LOAD_ALL);
if( is_video ) restart_brender();
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
{
gui->lock_window("MWindow::detach_transitions 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->clear_transitions(start, end);
save_backup();
- undo->update_undo_after(_("detach transitions"), LOAD_EDITS);
+ undo_after(_("detach transitions"), LOAD_EDITS);
sync_parameters(CHANGE_EDL);
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
// Only the first transition gets dropped.
PluginServer *server = session->drag_pluginservers->values[0];
- undo->update_undo_before();
+ undo_before();
edl->tracks->paste_transition(server, session->edit_highlighted);
save_backup();
- undo->update_undo_after(_("transition"), LOAD_EDITS);
+ undo_after(_("transition"), LOAD_EDITS);
if( server->video ) restart_brender();
sync_parameters(CHANGE_ALL);
{
gui->lock_window("MWindow::detach_transitions 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->paste_transitions(start, end, track_type, title);
save_backup();
- undo->update_undo_after(_("attach transitions"), LOAD_EDITS);
+ undo_after(_("attach transitions"), LOAD_EDITS);
sync_parameters(CHANGE_EDL);
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
void MWindow::paste_transition_cwindow(Track *dest_track)
{
PluginServer *server = session->drag_pluginservers->values[0];
- undo->update_undo_before();
+ undo_before();
edl->tracks->paste_video_transition(server, 1);
save_backup();
- undo->update_undo_after(_("transition"), LOAD_EDITS);
+ undo_after(_("transition"), LOAD_EDITS);
restart_brender();
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
sync_parameters(CHANGE_ALL);
return;
}
- undo->update_undo_before();
+ undo_before();
edl->tracks->paste_audio_transition(server);
save_backup();
- undo->update_undo_after(_("transition"), LOAD_EDITS);
+ undo_after(_("transition"), LOAD_EDITS);
sync_parameters(CHANGE_EDL);
gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0);
return;
}
- undo->update_undo_before();
+ undo_before();
edl->tracks->paste_video_transition(server);
save_backup();
- undo->update_undo_after(_("transition"), LOAD_EDITS);
+ undo_after(_("transition"), LOAD_EDITS);
sync_parameters(CHANGE_EDL);
restart_brender();
{
gui->lock_window("MWindow::shuffle_edits 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->shuffle_edits(start, end);
save_backup();
- undo->update_undo_after(_("shuffle edits"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("shuffle edits"), LOAD_EDITS | LOAD_TIMEBAR);
sync_parameters(CHANGE_EDL);
restart_brender();
{
gui->lock_window("MWindow::reverse_edits 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->reverse_edits(start, end);
save_backup();
- undo->update_undo_after(_("reverse edits"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("reverse edits"), LOAD_EDITS | LOAD_TIMEBAR);
sync_parameters(CHANGE_EDL);
restart_brender();
{
gui->lock_window("MWindow::align_edits 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->align_edits(start, end);
save_backup();
- undo->update_undo_after(_("align edits"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("align edits"), LOAD_EDITS | LOAD_TIMEBAR);
sync_parameters(CHANGE_EDL);
restart_brender();
{
gui->lock_window("MWindow::set_edit_length 1");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->set_edit_length(start, end, length);
save_backup();
- undo->update_undo_after(_("edit length"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("edit length"), LOAD_EDITS | LOAD_TIMEBAR);
sync_parameters(CHANGE_EDL);
restart_brender();
{
gui->lock_window("MWindow::set_transition_length 1");
- undo->update_undo_before();
+ undo_before();
//double start = edl->local_session->get_selectionstart();
//double end = edl->local_session->get_selectionend();
edl->tracks->set_transition_length(transition, length);
save_backup();
- undo->update_undo_after(_("transition length"), LOAD_EDITS);
+ undo_after(_("transition length"), LOAD_EDITS);
edl->session->default_transition_length = length;
sync_parameters(CHANGE_PARAMS);
{
gui->lock_window("MWindow::set_transition_length 2");
- undo->update_undo_before();
+ undo_before();
double start = edl->local_session->get_selectionstart();
double end = edl->local_session->get_selectionend();
edl->tracks->set_transition_length(start, end, length);
save_backup();
- undo->update_undo_after(_("transition length"), LOAD_EDITS);
+ undo_after(_("transition length"), LOAD_EDITS);
edl->session->default_transition_length = length;
sync_parameters(CHANGE_PARAMS);
void MWindow::resize_track(Track *track, int w, int h)
{
- undo->update_undo_before();
+ undo_before();
// We have to move all maskpoints so they do not move in relation to image areas
((MaskAutos*)track->automation->autos[AUTOMATION_MASK])->translate_masks(
(w - track->track_w) / 2,
(h - track->track_h) / 2);
track->track_w = w;
track->track_h = h;
- undo->update_undo_after(_("resize track"), LOAD_ALL);
+ undo_after(_("resize track"), LOAD_ALL);
save_backup();
restart_brender();
}
-void MWindow::set_inpoint(int is_mwindow)
+void MWindow::set_inpoint()
{
- undo->update_undo_before();
+ undo_before();
edl->set_inpoint(edl->local_session->get_selectionstart(1));
save_backup();
- undo->update_undo_after(_("in point"), LOAD_TIMEBAR);
-
- if( !is_mwindow ) {
- gui->lock_window("MWindow::set_inpoint 1");
- }
+ undo_after(_("in point"), LOAD_TIMEBAR);
gui->update_timebar(1);
- if( !is_mwindow ) {
- gui->unlock_window();
- }
- if( is_mwindow ) {
- cwindow->gui->lock_window("MWindow::set_inpoint 2");
- }
+ cwindow->gui->lock_window("MWindow::set_inpoint 2");
cwindow->gui->timebar->update(1);
- if( is_mwindow ) {
- cwindow->gui->unlock_window();
- }
+ cwindow->gui->unlock_window();
}
-void MWindow::set_outpoint(int is_mwindow)
+void MWindow::set_outpoint()
{
- undo->update_undo_before();
+ undo_before();
edl->set_outpoint(edl->local_session->get_selectionend(1));
save_backup();
- undo->update_undo_after(_("out point"), LOAD_TIMEBAR);
+ undo_after(_("out point"), LOAD_TIMEBAR);
- if( !is_mwindow ) {
- gui->lock_window("MWindow::set_outpoint 1");
- }
gui->update_timebar(1);
- if( !is_mwindow ) {
- gui->unlock_window();
- }
-
- if( is_mwindow ) {
- cwindow->gui->lock_window("MWindow::set_outpoint 2");
- }
+ cwindow->gui->lock_window("MWindow::set_outpoint 2");
cwindow->gui->timebar->update(1);
- if( is_mwindow ) {
- cwindow->gui->unlock_window();
- }
+ cwindow->gui->unlock_window();
}
-void MWindow::unset_inoutpoint(int is_mwindow)
+void MWindow::unset_inoutpoint()
{
- undo->update_undo_before();
+ undo_before();
edl->unset_inoutpoint();
save_backup();
- undo->update_undo_after(_("clear in/out"), LOAD_TIMEBAR);
+ undo_after(_("clear in/out"), LOAD_TIMEBAR);
- if( !is_mwindow ) {
- gui->lock_window("MWindow::unset_inoutpoint 1");
- }
gui->update_timebar(1);
- if( !is_mwindow ) {
- gui->unlock_window();
- }
-
- if( is_mwindow ) {
- cwindow->gui->lock_window("MWindow::unset_inoutpoint 2");
- }
+ cwindow->gui->lock_window("MWindow::unset_inoutpoint 2");
cwindow->gui->timebar->update(1);
- if( is_mwindow ) {
- cwindow->gui->unlock_window();
- }
+ cwindow->gui->unlock_window();
}
void MWindow::splice(EDL *source, int all)
FileXML file;
LocalSession *src = source->local_session;
- undo->update_undo_before();
+ undo_before();
double source_start = all ? 0 :
src->inpoint_valid() ? src->get_inpoint() :
src->outpoint_valid() ? 0 : src->get_selectionstart();
edl->local_session->set_selectionend(start + source_end - source_start);
save_backup();
- undo->update_undo_after(_("splice"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("splice"), LOAD_EDITS | LOAD_TIMEBAR);
update_plugin_guis();
restart_brender();
gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0);
gui->unlock_window();
}
-int MWindow::toggle_label(int is_mwindow)
+int MWindow::toggle_label()
{
double position1, position2;
- undo->update_undo_before();
-
- if( cwindow->playback_engine->is_playing_back ) {
- position1 = position2 =
- cwindow->playback_engine->get_tracking_position();
- }
- else {
- position1 = edl->local_session->get_selectionstart(1);
- position2 = edl->local_session->get_selectionend(1);
- }
+ undo_before();
+ position1 = edl->local_session->get_selectionstart(1);
+ position2 = edl->local_session->get_selectionend(1);
position1 = edl->align_to_frame(position1, 0);
position2 = edl->align_to_frame(position2, 0);
-//printf("MWindow::toggle_label 1\n");
-
edl->labels->toggle_label(position1, position2);
save_backup();
- if( !is_mwindow ) {
- gui->lock_window("MWindow::toggle_label 1");
- }
gui->update_timebar(0);
gui->activate_timeline();
gui->flush();
- if( !is_mwindow ) {
- gui->unlock_window();
- }
- if( is_mwindow ) {
- cwindow->gui->lock_window("MWindow::toggle_label 2");
- }
+ cwindow->gui->lock_window("MWindow::toggle_label 2");
cwindow->gui->timebar->update(1);
- if( is_mwindow ) {
- cwindow->gui->unlock_window();
- }
-
+ cwindow->gui->unlock_window();
awindow->gui->async_update_assets();
- undo->update_undo_after(_("label"), LOAD_TIMEBAR);
+ undo_after(_("label"), LOAD_TIMEBAR);
return 0;
}
void MWindow::trim_selection()
{
- undo->update_undo_before();
+ undo_before();
edl->trim_selection(edl->local_session->get_selectionstart(),
edl->session->autos_follow_edits);
save_backup();
- undo->update_undo_after(_("trim selection"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("trim selection"), LOAD_EDITS | LOAD_TIMEBAR);
update_plugin_guis();
gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0);
cwindow->update(1, 0, 0, 0, 1);
void MWindow::new_folder(const char *new_folder, int is_clips)
{
- undo->update_undo_before();
+ undo_before();
if( edl->new_folder(new_folder, is_clips) ) {
MainError::show_error(_("create new folder failed"));
}
- undo->update_undo_after(_("new folder"), LOAD_ALL);
+ undo_after(_("new folder"), LOAD_ALL);
awindow->gui->async_update_assets();
}
void MWindow::delete_folder(char *folder)
{
- undo->update_undo_before();
+ undo_before();
if( edl->delete_folder(folder) < 0 ) {
MainError::show_error(_("delete folder failed"));
}
- undo->update_undo_after(_("del folder"), LOAD_ALL);
+ undo_after(_("del folder"), LOAD_ALL);
awindow->gui->async_update_assets();
}
void MWindow::map_audio(int pattern)
{
- undo->update_undo_before();
+ undo_before();
remap_audio(pattern);
- undo->update_undo_after(
+ undo_after(
pattern == MWindow::AUDIO_1_TO_1 ? _("map 1:1") : _("map 5.1:2"),
LOAD_AUTOMATION);
sync_parameters(CHANGE_PARAMS);
void MWindow::cut_commercials()
{
#ifdef HAVE_COMMERCIAL
- undo->update_undo_before();
+ undo_before();
commercials->scan_media();
edl->optimize();
save_backup();
- undo->update_undo_after(_("cut ads"), LOAD_EDITS | LOAD_TIMEBAR);
+ undo_after(_("cut ads"), LOAD_EDITS | LOAD_TIMEBAR);
restart_brender();
update_plugin_guis();
}
-void MWindow::fit_autos(int doall)
+void MWindow::fit_autos(int all)
{
float min = 0, max = 0;
double start, end;
int forstart = edl->local_session->zoombar_showautotype;
int forend = edl->local_session->zoombar_showautotype + 1;
- if (doall) {
+ if( all ) {
forstart = 0;
forend = AUTOGROUPTYPE_COUNT;
}
return 0;
}
+double MWindow::get_position()
+{
+ return edl->local_session->get_selectionstart(1);
+}
+
+void MWindow::set_position(double position)
+{
+ if( position != get_position() ) {
+ if( position < 0 ) position = 0;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ gui->lock_window();
+ find_cursor();
+ gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 0);
+ gui->unlock_window();
+ cwindow->update(1, 0, 0, 0, 0);
+ }
+}
+
int MWindow::expand_y()
{
{
EDL *edl = get_edl();
if( edl ) {
- gui->stop_transport("VTimeBar::select_label");
-
+ gui->stop_transport();
position = mwindow->edl->align_to_frame(position, 1);
if(shift_down())
return result;
}
-void VWindowGUI::stop_transport(const char *lock_msg)
-{
- if( !transport->is_stopped() ) {
- if( lock_msg ) unlock_window();
- transport->handle_transport(STOP, 1, 0, 0);
- if( lock_msg ) lock_window(lock_msg);
- }
-}
-
int VWindowGUI::button_press_event()
{
if( vwindow->get_edl() != 0 && canvas->get_canvas() &&
return 0;
}
+void VWindowGUI::stop_transport()
+{
+ if( !transport->is_stopped() ) {
+ unlock_window();
+ transport->handle_transport(STOP, 1, 0, 0);
+ lock_window("VWindowGUI::panel_stop_transport");
+ }
+}
void VWindowGUI::update_meters()
{
0, // use_keyframe
1, // use_splice
1, // use_overwrite
- 0, // use_lift
- 0, // use_extract
1, // use_copy
0, // use_paste
0, // use_undo
{
}
-void VWindowEditing::copy_selection()
+#define relock_vm(s) \
+ vwindow->gui->unlock_window(); \
+ mwindow->gui->lock_window("VWindowEditing::" s)
+#define relock_mv(s) \
+ mwindow->gui->unlock_window(); \
+ vwindow->gui->lock_window("VWindowEditing::" s)
+
+double VWindowEditing::get_position()
{
- vwindow->copy(subwindow->shift_down());
+ EDL *edl = vwindow->get_edl();
+ double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
+ return position;
}
-void VWindowEditing::splice_selection()
+void VWindowEditing::set_position(double position)
{
- if(vwindow->get_edl())
- {
- mwindow->gui->lock_window("VWindowEditing::splice_selection");
- mwindow->splice(vwindow->get_edl(), subwindow->shift_down());
- mwindow->gui->unlock_window();
+ EDL *edl = vwindow->get_edl();
+ if( !edl ) return;
+ if( get_position() != position ) {
+ if( position < 0 ) position = 0;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position(CHANGE_NONE, 0, 1);
}
}
-void VWindowEditing::overwrite_selection()
+void VWindowEditing::set_click_to_play(int v)
{
- if(vwindow->get_edl())
- {
- mwindow->gui->lock_window("VWindowEditing::overwrite_selection");
- mwindow->overwrite(vwindow->get_edl(), subwindow->shift_down());
- mwindow->gui->unlock_window();
- }
+ click2play->update(v);
+ relock_vm("set_click_to_play");
+ mwindow->edl->session->vwindow_click2play = v;
+ mwindow->update_vwindow();
+ relock_mv("set_click_to_play");
}
-void VWindowEditing::toggle_label()
+void VWindowEditing::panel_stop_transport()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- edl->labels->toggle_label(edl->local_session->get_selectionstart(1),
- edl->local_session->get_selectionend(1));
- vwindow->gui->timebar->update(1);
- }
+ vwindow->gui->stop_transport();
}
-void VWindowEditing::prev_label(int cut)
+void VWindowEditing::panel_toggle_label()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::prev_label");
+ if( !vwindow->get_edl() ) return;
+ EDL *edl = vwindow->get_edl();
+ edl->labels->toggle_label(edl->local_session->get_selectionstart(1),
+ edl->local_session->get_selectionend(1));
+ vwindow->gui->timebar->update(1);
+}
- Label *current = edl->labels->prev_label(
- edl->local_session->get_selectionstart(1));
+void VWindowEditing::panel_next_label(int cut)
+{
+ if( !vwindow->get_edl() ) return;
+ vwindow->gui->unlock_window();
+ vwindow->playback_engine->interrupt_playback(1);
+ vwindow->gui->lock_window("VWindowEditing::next_label");
+ EDL *edl = vwindow->get_edl();
+ Label *current = edl->labels->next_label(
+ edl->local_session->get_selectionstart(1));
+ double position = current ? current->position :
+ edl->tracks->total_length();
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position(CHANGE_NONE, 0, 1, 0);
+ vwindow->gui->timebar->update(1);
+}
- if(!current)
- {
- edl->local_session->set_selectionstart(0);
- edl->local_session->set_selectionend(0);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- else
- {
- edl->local_session->set_selectionstart(current->position);
- edl->local_session->set_selectionend(current->position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- }
+void VWindowEditing::panel_prev_label(int cut)
+{
+ if( !vwindow->get_edl() ) return;
+ vwindow->gui->unlock_window();
+ vwindow->playback_engine->interrupt_playback(1);
+ vwindow->gui->lock_window("VWindowEditing::prev_label");
+
+ EDL *edl = vwindow->get_edl();
+ Label *current = edl->labels->prev_label(
+ edl->local_session->get_selectionstart(1));
+ double position = !current ? 0 : current->position;
+ edl->local_session->set_selectionstart(position);
+ edl->local_session->set_selectionend(position);
+ vwindow->update_position(CHANGE_NONE, 0, 1, 0);
+ vwindow->gui->timebar->update(1);
}
-void VWindowEditing::next_label(int cut)
+void VWindowEditing::panel_prev_edit(int cut) {} // not used
+void VWindowEditing::panel_next_edit(int cut) {} // not used
+
+void VWindowEditing::panel_copy_selection()
{
- if(vwindow->get_edl())
- {
- EDL *edl = vwindow->get_edl();
- Label *current = edl->labels->next_label(
- edl->local_session->get_selectionstart(1));
- if(!current)
- {
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::next_label 1");
-
- double position = edl->tracks->total_length();
- edl->local_session->set_selectionstart(position);
- edl->local_session->set_selectionend(position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- else
- {
- vwindow->gui->unlock_window();
- vwindow->playback_engine->interrupt_playback(1);
- vwindow->gui->lock_window("VWindowEditing::next_label 2");
-
- edl->local_session->set_selectionstart(current->position);
- edl->local_session->set_selectionend(current->position);
- vwindow->update_position(CHANGE_NONE, 0, 1, 0);
- vwindow->gui->timebar->update(1);
- }
- }
+ vwindow->copy(vwindow->gui->shift_down());
}
-double VWindowEditing::get_position()
+void VWindowEditing::panel_overwrite_selection()
{
- EDL *edl = vwindow->get_edl();
- double position = !edl ? 0 : edl->local_session->get_selectionstart(1);
- return position;
+ if( !vwindow->get_edl() ) return;
+ relock_vm("overwrite_selection");
+ mwindow->overwrite(vwindow->get_edl(), vwindow->gui->shift_down());
+ relock_mv("overwrite_selection");
}
-void VWindowEditing::set_position(double position)
+void VWindowEditing::panel_splice_selection()
{
- EDL *edl = vwindow->get_edl();
- if( !edl ) return;
- if( get_position() != position ) {
- if( position < 0 ) position = 0;
- edl->local_session->set_selectionstart(position);
- edl->local_session->set_selectionend(position);
- vwindow->update_position(CHANGE_NONE, 0, 1);
- }
+ if( !vwindow->get_edl() ) return;
+ relock_vm("splice_selection");
+ mwindow->splice(vwindow->get_edl(), vwindow->gui->shift_down());
+ relock_mv("splice_selection");
}
-void VWindowEditing::set_inpoint()
+void VWindowEditing::panel_set_inpoint()
{
vwindow->set_inpoint();
}
-void VWindowEditing::set_outpoint()
+void VWindowEditing::panel_set_outpoint()
{
vwindow->set_outpoint();
}
-void VWindowEditing::unset_inoutpoint()
+void VWindowEditing::panel_unset_inoutpoint()
{
vwindow->unset_inoutpoint();
}
-
-void VWindowEditing::to_clip()
+void VWindowEditing::panel_to_clip()
{
EDL *edl = vwindow->get_edl();
if( !edl ) return;
mwindow->to_clip(edl, _("viewer window: "), subwindow->shift_down());
}
+// not used
+void VWindowEditing::panel_cut() {}
+void VWindowEditing::panel_paste() {}
+void VWindowEditing::panel_fit_selection() {}
+void VWindowEditing::panel_fit_autos(int all) {}
+void VWindowEditing::panel_set_editing_mode(int mode) {}
+void VWindowEditing::panel_set_auto_keyframes(int v) {}
+void VWindowEditing::panel_set_labels_follow_edits(int v) {}
+
+
VWindowSource::VWindowSource(MWindow *mwindow, VWindowGUI *vwindow, int x, int y)
: BC_PopupTextBox(vwindow,
&vwindow->sources,
int resize_event(int w, int h);
int translation_event();
int close_event();
- void stop_transport(const char *lock_msg);
+ void stop_transport();
int keypress_event();
int button_press_event();
int cursor_leave_event();
VWindowEditing(MWindow *mwindow, VWindow *vwindow);
virtual ~VWindowEditing();
- void copy_selection();
- void splice_selection();
- void overwrite_selection();
- void set_inpoint();
- void set_outpoint();
- void unset_inoutpoint();
- void to_clip();
- void toggle_label();
- void prev_label(int cut);
- void next_label(int cut);
double get_position();
void set_position(double position);
+ void set_click_to_play(int v);
+
+ void panel_stop_transport();
+ void panel_toggle_label();
+ void panel_next_label(int cut);
+ void panel_prev_label(int cut);
+ void panel_prev_edit(int cut);
+ void panel_next_edit(int cut);
+ void panel_copy_selection();
+ void panel_overwrite_selection();
+ void panel_splice_selection();
+ void panel_set_inpoint();
+ void panel_set_outpoint();
+ void panel_unset_inoutpoint();
+ void panel_to_clip();
+ void panel_cut();
+ void panel_paste();
+ void panel_fit_selection();
+ void panel_fit_autos(int all);
+ void panel_set_editing_mode(int mode);
+ void panel_set_auto_keyframes(int v);
+ void panel_set_labels_follow_edits(int v);
MWindow *mwindow;
VWindow *vwindow;
}
}
+void trace_info::set_owner() { owner = pthread_self(); }
+void trace_info::unset_owner() { owner = 0; }
+
void BC_Trace::dump_locks(FILE *fp)
{
// Dump lock table
fprintf(fp,"signal_entry: lock table size=%d\n", lock_table.size);
for( trace_item *tp=lock_table.first; tp!=0; tp=tp->next ) {
lock_item *p=(lock_item*)tp;
- fprintf(fp," %p %s %s %p%s\n", p->info, p->title,
- p->loc, (void*)p->tid, p->is_owner ? " *" : "");
+ fprintf(fp," %p %s, %s %p%s",
+ p->info, p->title, p->loc,
+ (void*)p->tid, p->is_owner ? " *" : "");
+ if( p->info->owner && p->info->owner != p->tid )
+ fprintf(fp," %p", (void*)p->info->owner);
+ fprintf(fp,"\n");
}
int64_t lock_total = lock_table.total();
int64_t free_total = lock_free.total();
class trace_info {
public:
void *trace;
- trace_info() { trace = 0; }
+ unsigned long owner;
+ trace_info() { trace = 0; owner = 0; }
~trace_info() {}
+ void set_owner();
+ void unset_owner();
};
#ifdef NO_GUICAST
pthread_mutex_init(&mutex, 0);
pthread_cond_init(&cond, NULL);
UNSET_ALL_LOCKS(this);
+ unset_owner();
value = init_value;
trace = 0;
}
value = 0;
else
value--;
+ if( !value )
+ set_owner();
pthread_mutex_unlock(&mutex);
}
value = 1;
else
value++;
+ unset_owner();
pthread_cond_signal(&cond);
pthread_mutex_unlock(&mutex);
}
else
--value;
}
+ if( !value )
+ set_owner();
pthread_mutex_unlock(&mutex);
return result;
}
Mutex::Mutex(const char *title, int recursive)
{
this->title = title;
- this->trace = 0;
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
SET_LOCK(this, title, location);
if(pthread_mutex_lock(&mutex)) perror("Mutex::lock");
-
+ set_owner();
// Update recursive status for the first lock
UNSET_LOCK(this);
+ unset_owner();
int ret = pthread_mutex_unlock(&mutex);
if( ret ) fprintf(stderr, "Mutex::unlock: %s\n",strerror(ret));
if( count ) return EBUSY;
int ret = pthread_mutex_trylock(&mutex);
if( ret ) return ret;
+ set_owner();
// Update recursive status for the first lock
if(recursive) {
pthread_mutexattr_init(&attr);
pthread_mutex_init(&mutex, &attr);
UNSET_ALL_LOCKS(this)
+ unset_owner();
trace = 0;
count = 0;
thread_id = 0;
https://github.com/webmproject/libvpx/releases/tag/v1.7.0
https://github.com/swh/ladspa/releases/tag/v0.4.17, plugin.org.uk
https://archive.mozilla.org/pub/opus/opus-1.3.tar.gz
+https://github.com/webmproject/libwebp = libwebp-1.0.2
+https://github.com/mozilla/aom = libaom-v1.0.0