X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Feditpanel.C;h=379291413d0eb57561d359bb398aa7e68c4fca97;hp=e823421025aefb2aa2550521ea5d7d4dc7b5cd7b;hb=576087eacf577a0fa5d3008d37c4d5b597f0990a;hpb=30bdb85eb33a8ee7ba675038a86c6be59c43d7bd diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index e8234210..37929141 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -329,6 +329,13 @@ SET_TRACE SET_TRACE } +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() @@ -339,50 +346,36 @@ void EditPanel::toggle_label() void EditPanel::prev_label() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->alt_down(); int have_mwindow_lock = mwindow->gui->get_window_lock(); - int have_subwindow_lock = - subwindow->get_top_level() == mwindow->gui->get_top_level() ? - 0 : subwindow->get_window_lock(); - if(have_mwindow_lock) - mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->unlock_window(); - - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); + if( have_mwindow_lock ) mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->lock_window("EditPanel::prev_label 1"); + stop_transport("EditPanel::prev_label 1"); mwindow->gui->lock_window("EditPanel::prev_label 2"); - - mwindow->prev_label(shift_down); - - if(!have_mwindow_lock) + if( snap ) + mwindow->snap_left_label(); + else + mwindow->prev_label(shift_down); + if( !have_mwindow_lock ) mwindow->gui->unlock_window(); } void EditPanel::next_label() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->alt_down(); int have_mwindow_lock = mwindow->gui->get_window_lock(); - int have_subwindow_lock = - subwindow->get_top_level() == mwindow->gui->get_top_level() ? - 0 : subwindow->get_window_lock(); - if(have_mwindow_lock) - mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->unlock_window(); - - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); + if( have_mwindow_lock ) mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->lock_window("EditPanel::next_label 1"); + stop_transport("EditPanel::next_label 1"); mwindow->gui->lock_window("EditPanel::next_label 2"); - - mwindow->next_label(shift_down); - - if(!have_mwindow_lock) + if( snap ) + mwindow->snap_right_label(); + else + mwindow->next_label(shift_down); + if( !have_mwindow_lock ) mwindow->gui->unlock_window(); } @@ -391,50 +384,40 @@ void EditPanel::next_label() void EditPanel::prev_edit() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->alt_down(); int have_mwindow_lock = mwindow->gui->get_window_lock(); - int have_subwindow_lock = - subwindow->get_top_level() == mwindow->gui->get_top_level() ? - 0 : subwindow->get_window_lock(); - if(have_mwindow_lock) - mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->unlock_window(); - - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); + if( have_mwindow_lock ) mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->lock_window("EditPanel::prev_edit 1"); + stop_transport("EditPanel::prev_edit 1"); mwindow->gui->lock_window("EditPanel::prev_edit 2"); - mwindow->prev_edit_handle(shift_down); + if( snap ) + mwindow->snap_left_edit(); + else + mwindow->prev_edit_handle(shift_down); - if(!have_mwindow_lock) + if( !have_mwindow_lock ) mwindow->gui->unlock_window(); } void EditPanel::next_edit() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->alt_down(); int have_mwindow_lock = mwindow->gui->get_window_lock(); - int have_subwindow_lock = - subwindow->get_top_level() == mwindow->gui->get_top_level() ? - 0 : subwindow->get_window_lock(); - if(have_mwindow_lock) - mwindow->gui->unlock_window(); - if(have_subwindow_lock) - subwindow->unlock_window(); + if( have_mwindow_lock ) mwindow->gui->unlock_window(); - mwindow->gui->mbuttons->transport->handle_transport(STOP, 1, 0, 0); - - if(have_subwindow_lock) - subwindow->lock_window("EditPanel::next_edit 1"); + stop_transport("EditPanel::next_edit 1"); mwindow->gui->lock_window("EditPanel::next_edit 2"); - mwindow->next_edit_handle(shift_down); + if( snap ) + mwindow->snap_right_edit(); + else + mwindow->next_edit_handle(shift_down); - if(!have_mwindow_lock) + if( !have_mwindow_lock ) mwindow->gui->unlock_window(); } @@ -442,9 +425,7 @@ void EditPanel::next_edit() double EditPanel::get_position() { EDL *edl = mwindow->edl; - return !edl ? 0 : - edl->local_session->get_selectionstart(1) + - edl->session->get_frame_offset() / edl->session->frame_rate; + return !edl ? 0 : edl->local_session->get_selectionstart(1); } void EditPanel::set_position(double position) @@ -452,7 +433,6 @@ void EditPanel::set_position(double position) EDL *edl = mwindow->edl; if( !edl ) return; if( position != get_position() ) { - position -= edl->session->get_frame_offset() / edl->session->frame_rate; if( position < 0 ) position = 0; edl->local_session->set_selectionstart(position); edl->local_session->set_selectionend(position); @@ -629,21 +609,9 @@ void EditPanel::set_outpoint() mwindow->set_outpoint(1); } -void EditPanel::clear_inpoint() +void EditPanel::unset_inoutpoint() { - mwindow->delete_inpoint(); -} - -void EditPanel::clear_outpoint() -{ - mwindow->delete_outpoint(); -} - -void EditPanel::to_clip() -{ - subwindow->unlock_window(); - mwindow->to_clip(); - subwindow->lock_window("EditPanel::to_clip"); + mwindow->unset_inoutpoint(1); } @@ -652,7 +620,7 @@ EditInPoint::EditInPoint(MWindow *mwindow, EditPanel *panel, int x, int y) { this->mwindow = mwindow; this->panel = panel; - set_tooltip(_("In point ( [ )")); + set_tooltip(_("In point ( [ or < )")); } EditInPoint::~EditInPoint() { @@ -664,9 +632,14 @@ int EditInPoint::handle_event() } int EditInPoint::keypress_event() { - if(get_keypress() == '[') + int key = get_keypress(); + if( key == '[' || key == '<' ) { + panel->set_inpoint(); + return 1; + } + if(ctrl_down() && get_keypress() == 't') { - panel->set_inpoint(); + panel->unset_inoutpoint(); return 1; } return 0; @@ -677,7 +650,7 @@ EditOutPoint::EditOutPoint(MWindow *mwindow, EditPanel *panel, int x, int y) { this->mwindow = mwindow; this->panel = panel; - set_tooltip(_("Out point ( ] )")); + set_tooltip(_("Out point ( ] or > )")); } EditOutPoint::~EditOutPoint() { @@ -689,11 +662,16 @@ int EditOutPoint::handle_event() } int EditOutPoint::keypress_event() { - if(get_keypress() == ']') - { + int key = get_keypress(); + if( key == ']' || key == '>' ) { panel->set_outpoint(); return 1; } + if(ctrl_down() && get_keypress() == 't') + { + panel->unset_inoutpoint(); + return 1; + } return 0; } @@ -715,7 +693,7 @@ EditNextLabel::~EditNextLabel() } int EditNextLabel::keypress_event() { - if(get_keypress() == RIGHT && ctrl_down()) + if( ctrl_down() && get_keypress() == (!alt_down() ? RIGHT : '>') ) return handle_event(); return 0; } @@ -742,7 +720,7 @@ EditPrevLabel::~EditPrevLabel() } int EditPrevLabel::keypress_event() { - if(get_keypress() == LEFT && ctrl_down()) + if( ctrl_down() && get_keypress() == (!alt_down() ? LEFT : '<') ) return handle_event(); return 0; } @@ -771,7 +749,7 @@ EditNextEdit::~EditNextEdit() } int EditNextEdit::keypress_event() { - if(get_keypress() == RIGHT && alt_down()) + if( alt_down() && get_keypress() == (!ctrl_down() ? RIGHT : '.') ) return handle_event(); return 0; } @@ -798,7 +776,7 @@ EditPrevEdit::~EditPrevEdit() } int EditPrevEdit::keypress_event() { - if(get_keypress() == LEFT && alt_down()) + if( alt_down() && get_keypress() == (!ctrl_down() ? LEFT : ',') ) return handle_event(); return 0; } @@ -884,7 +862,7 @@ int EditToClip::handle_event() int EditToClip::keypress_event() { - if(get_keypress() == 'i') + if(get_keypress() == 'i' && !alt_down()) { handle_event(); return 1; @@ -1196,7 +1174,7 @@ EditLabelbutton::~EditLabelbutton() } int EditLabelbutton::keypress_event() { - if(get_keypress() == 'l') + if(get_keypress() == 'l' && !alt_down()) return handle_event(); return 0; }