From b5c58822be78c8820692c916e296a2230bb2b9e2 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 3 Oct 2017 15:08:30 -0600 Subject: [PATCH] alt transport keys, snap editing, grab focus, inv hilight clr, subtitle fix --- cinelerra-5.1/cinelerra/appearanceprefs.C | 37 ++++++++++ cinelerra-5.1/cinelerra/appearanceprefs.h | 15 ++++ cinelerra-5.1/cinelerra/editpanel.C | 40 ++++++++--- cinelerra-5.1/cinelerra/edl.C | 48 +++++++++++++ cinelerra-5.1/cinelerra/edl.h | 3 + cinelerra-5.1/cinelerra/maincursor.C | 3 +- cinelerra-5.1/cinelerra/mwindow.C | 1 + cinelerra-5.1/cinelerra/mwindow.h | 6 ++ cinelerra-5.1/cinelerra/mwindowedit.C | 48 ++++++++++++- cinelerra-5.1/cinelerra/mwindowmove.C | 78 +++------------------ cinelerra-5.1/cinelerra/playtransport.C | 35 +++++++-- cinelerra-5.1/cinelerra/preferences.C | 8 +++ cinelerra-5.1/cinelerra/preferences.h | 4 ++ cinelerra-5.1/cinelerra/preferencesthread.C | 1 + cinelerra-5.1/cinelerra/proxy.C | 2 +- cinelerra-5.1/cinelerra/swindow.C | 1 + cinelerra-5.1/cinelerra/trackcanvas.C | 22 +++++- cinelerra-5.1/guicast/bcresources.C | 3 +- cinelerra-5.1/guicast/bcresources.h | 3 +- cinelerra-5.1/guicast/bcwindowbase.C | 10 +++ cinelerra-5.1/guicast/bcwindowbase.h | 2 + cinelerra-5.1/po/de.po | 6 +- 22 files changed, 280 insertions(+), 96 deletions(-) diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index a865db1e..46badb85 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -139,6 +139,13 @@ void AppearancePrefs::create_objects() add_subwindow(seconds = new TimeFormatSeconds(pwindow, this, pwindow->thread->edl->session->time_format == TIME_SECONDS, x, y)); + x = x0; + y += 35; + add_subwindow(title = new BC_Title(x, y, _("Highlighting Inversion color:"))); + x += title->get_w() + margin; + char hex_color[BCSTRLEN]; + sprintf(hex_color, "%06x", preferences->highlight_inverse); + add_subwindow(new HighlightInverseColor(pwindow, x, y, hex_color)); y += 35; UseTipWindow *tip_win = new UseTipWindow(pwindow, x1, y1); @@ -156,6 +163,9 @@ void AppearancePrefs::create_objects() PopupMenuBtnup *pop_win = new PopupMenuBtnup(pwindow, x1, y1); add_subwindow(pop_win); y1 += pop_win->get_h() + 5; + GrabFocusPolicy *grab_input_focus = new GrabFocusPolicy(pwindow, x1, y1); + add_subwindow(grab_input_focus); + y1 += grab_input_focus->get_h() + 5; ActivateFocusPolicy *focus_activate = new ActivateFocusPolicy(pwindow, x1, y1); add_subwindow(focus_activate); y1 += focus_activate->get_h() + 5; @@ -439,6 +449,19 @@ int PopupMenuBtnup::handle_event() return 1; } +GrabFocusPolicy::GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y) + : BC_CheckBox(x, y, (pwindow->thread->preferences->grab_input_focus) != 0, + _("Set Input Focus when window entered")) +{ + this->pwindow = pwindow; +} + +int GrabFocusPolicy::handle_event() +{ + pwindow->thread->preferences->grab_input_focus = get_value(); + return 1; +} + ActivateFocusPolicy::ActivateFocusPolicy(PreferencesWindow *pwindow, int x, int y) : BC_CheckBox(x, y, (pwindow->thread->preferences->textbox_focus_policy & CLICK_ACTIVATE) != 0, _("Click to activate text focus")) @@ -484,3 +507,17 @@ int ForwardRenderDisplacement::handle_event() return 1; } +HighlightInverseColor::HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex) + : BC_TextBox(x, y, 80, 1, hex) +{ + this->pwindow = pwindow; +} + +int HighlightInverseColor::handle_event() +{ + int inverse_color = strtoul(get_text(),0,16); + inverse_color &= 0xffffff; + pwindow->thread->preferences->highlight_inverse = inverse_color; + return 1; +} + diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.h b/cinelerra-5.1/cinelerra/appearanceprefs.h index 9e0e05ae..7fbeeb92 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.h +++ b/cinelerra-5.1/cinelerra/appearanceprefs.h @@ -211,6 +211,14 @@ public: PreferencesWindow *pwindow; }; +class GrabFocusPolicy : public BC_CheckBox +{ +public: + GrabFocusPolicy(PreferencesWindow *pwindow, int x, int y); + int handle_event(); + PreferencesWindow *pwindow; +}; + class ActivateFocusPolicy : public BC_CheckBox { public: @@ -235,5 +243,12 @@ public: PreferencesWindow *pwindow; }; +class HighlightInverseColor : public BC_TextBox +{ +public: + HighlightInverseColor(PreferencesWindow *pwindow, int x, int y, const char *hex); + int handle_event(); + PreferencesWindow *pwindow; +}; #endif diff --git a/cinelerra-5.1/cinelerra/editpanel.C b/cinelerra-5.1/cinelerra/editpanel.C index 8de70d83..df2e7b1c 100644 --- a/cinelerra-5.1/cinelerra/editpanel.C +++ b/cinelerra-5.1/cinelerra/editpanel.C @@ -339,6 +339,8 @@ void EditPanel::toggle_label() void EditPanel::prev_label() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->ctrl_down(); + int have_mwindow_lock = mwindow->gui->get_window_lock(); int have_subwindow_lock = subwindow->get_top_level() == mwindow->gui->get_top_level() ? @@ -355,7 +357,10 @@ void EditPanel::prev_label() mwindow->gui->lock_window("EditPanel::prev_label 2"); - mwindow->prev_label(shift_down); + if( snap ) + mwindow->snap_left_label(); + else + mwindow->prev_label(shift_down); if(!have_mwindow_lock) mwindow->gui->unlock_window(); @@ -364,6 +369,8 @@ void EditPanel::prev_label() void EditPanel::next_label() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->ctrl_down(); + int have_mwindow_lock = mwindow->gui->get_window_lock(); int have_subwindow_lock = subwindow->get_top_level() == mwindow->gui->get_top_level() ? @@ -380,7 +387,10 @@ void EditPanel::next_label() mwindow->gui->lock_window("EditPanel::next_label 2"); - mwindow->next_label(shift_down); + if( snap ) + mwindow->snap_right_label(); + else + mwindow->next_label(shift_down); if(!have_mwindow_lock) mwindow->gui->unlock_window(); @@ -391,6 +401,8 @@ void EditPanel::next_label() void EditPanel::prev_edit() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->ctrl_down(); + int have_mwindow_lock = mwindow->gui->get_window_lock(); int have_subwindow_lock = subwindow->get_top_level() == mwindow->gui->get_top_level() ? @@ -407,7 +419,10 @@ void EditPanel::prev_edit() 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) mwindow->gui->unlock_window(); @@ -416,6 +431,8 @@ void EditPanel::prev_edit() void EditPanel::next_edit() { int shift_down = subwindow->shift_down(); + int snap = subwindow->ctrl_down() && subwindow->ctrl_down(); + int have_mwindow_lock = mwindow->gui->get_window_lock(); int have_subwindow_lock = subwindow->get_top_level() == mwindow->gui->get_top_level() ? @@ -432,7 +449,10 @@ void EditPanel::next_edit() 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) mwindow->gui->unlock_window(); @@ -705,7 +725,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; } @@ -732,7 +752,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; } @@ -761,7 +781,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; } @@ -788,7 +808,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; } @@ -874,7 +894,7 @@ int EditToClip::handle_event() int EditToClip::keypress_event() { - if(get_keypress() == 'i') + if(get_keypress() == 'i' && !alt_down()) { handle_event(); return 1; @@ -1186,7 +1206,7 @@ EditLabelbutton::~EditLabelbutton() } int EditLabelbutton::keypress_event() { - if(get_keypress() == 'l') + if(get_keypress() == 'l' && !alt_down()) return handle_event(); return 0; } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index 5d9ff496..134aa8c9 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -1549,3 +1549,51 @@ void EDL::append_vwindow_edl(EDL *edl, int increase_counter) } +double EDL::next_edit(double position) +{ + Units::fix_double(&position); + double new_position = INFINITY; + + double max_rate = get_frame_rate(); + int sample_rate = get_sample_rate(); + if( sample_rate > max_rate ) max_rate = sample_rate; + double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; + +// Test for edit handles after position + for( Track *track=tracks->first; track; track=track->next ) { + if( !track->record ) continue; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + double edit_end = track->from_units(edit->startproject + edit->length); + Units::fix_double(&edit_end); + if( fabs(edit_end-position) < min_movement ) continue; + if( edit_end > position && edit_end < new_position ) + new_position = edit_end; + } + } + return new_position; +} + +double EDL::prev_edit(double position) +{ + Units::fix_double(&position); + double new_position = -1; + + double max_rate = get_frame_rate(); + int sample_rate = get_sample_rate(); + if( sample_rate > max_rate ) max_rate = sample_rate; + double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; + +// Test for edit handles before cursor position + for( Track *track=tracks->first; track; track=track->next ) { + if( !track->record ) continue; + for( Edit *edit=track->edits->first; edit; edit=edit->next ) { + double edit_end = track->from_units(edit->startproject); + Units::fix_double(&edit_end); + if( fabs(edit_end-position) < min_movement ) continue; + if( edit_end < position && edit_end > new_position ) + new_position = edit_end; + } + } + return new_position; +} + diff --git a/cinelerra-5.1/cinelerra/edl.h b/cinelerra-5.1/cinelerra/edl.h index 0000e3f7..3b1d2253 100644 --- a/cinelerra-5.1/cinelerra/edl.h +++ b/cinelerra-5.1/cinelerra/edl.h @@ -132,6 +132,9 @@ public: // Add assets from the src to the destination void update_assets(EDL *src); void optimize(); +// return next/prev edit starting from position + double next_edit(double position); + double prev_edit(double position); // Debug int dump(FILE *fp=stdout); static int next_id(); diff --git a/cinelerra-5.1/cinelerra/maincursor.C b/cinelerra-5.1/cinelerra/maincursor.C index 974cf52c..4c3c5590 100644 --- a/cinelerra-5.1/cinelerra/maincursor.C +++ b/cinelerra-5.1/cinelerra/maincursor.C @@ -26,6 +26,7 @@ #include "maincursor.h" #include "mwindow.h" #include "mwindowgui.h" +#include "preferences.h" #include "timelinepane.h" #include "trackcanvas.h" @@ -132,7 +133,7 @@ void MainCursor::draw(int do_plugintoggles) //printf("MainCursor::draw 2\n"); } - pane->canvas->set_color(WHITE); + pane->canvas->set_color(mwindow->preferences->highlight_inverse); pane->canvas->set_inverse(); pane->canvas->draw_box(pixel1, 0, pixel2 - pixel1 + 1, pane->canvas->get_h()); pane->canvas->set_opaque(); diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 633af24a..1aa06bac 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -896,6 +896,7 @@ void MWindow::init_preferences() } BC_WindowBase::get_resources()->popupmenu_btnup = preferences->popupmenu_btnup; BC_WindowBase::get_resources()->textbox_focus_policy = preferences->textbox_focus_policy; + BC_WindowBase::get_resources()->grab_input_focus = preferences->grab_input_focus; } void MWindow::clean_indexes() diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 2ada7db3..e700e71f 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -323,6 +323,12 @@ public: void copy(); int copy(double start, double end); void cut(); + void cut(double start, double end, double new_position=-1); +// snap off edit from current position to handle/label + void snap_left_edit(); + void snap_right_edit(); + void snap_left_label(); + void snap_right_label(); // Calculate aspect ratio from pixel counts static int create_aspect_ratio(float &w, float &h, int width, int height); diff --git a/cinelerra-5.1/cinelerra/mwindowedit.C b/cinelerra-5.1/cinelerra/mwindowedit.C index 9d1a9dfc..36b8269b 100644 --- a/cinelerra-5.1/cinelerra/mwindowedit.C +++ b/cinelerra-5.1/cinelerra/mwindowedit.C @@ -512,11 +512,14 @@ void MWindow::crop_video() void MWindow::cut() { - undo->update_undo_before(); - double start = edl->local_session->get_selectionstart(); double end = edl->local_session->get_selectionend(); + cut(start, end); +} +void MWindow::cut(double start, double end, double new_position) +{ + undo->update_undo_before(); copy(start, end); edl->clear(start, end, edl->session->labels_follow_edits, @@ -527,7 +530,10 @@ void MWindow::cut() edl->optimize(); save_backup(); undo->update_undo_after(_("cut"), LOAD_EDITS | LOAD_TIMEBAR); - + if( new_position >= 0 ) { + edl->local_session->set_selectionstart(new_position); + edl->local_session->set_selectionend(new_position); + } restart_brender(); update_plugin_guis(); gui->update(1, 2, 1, 1, 1, 1, 0); @@ -536,6 +542,42 @@ void MWindow::cut() send_command(CURRENT_FRAME, CHANGE_EDL, edl, 1); } +void MWindow::snap_left_edit() +{ + double start_pos = edl->local_session->get_selectionstart(); + double position = edl->prev_edit(start_pos); + if( position < start_pos ) + cut(position, start_pos, position); +} + +void MWindow::snap_right_edit() +{ + double end_pos = edl->local_session->get_selectionend(); + double position = edl->next_edit(end_pos); + if( end_pos < position ) + cut(end_pos, position, end_pos); +} + +void MWindow::snap_left_label() +{ + double start_pos = edl->local_session->get_selectionstart(); + Label *left_label = edl->labels->prev_label(start_pos); + if( !left_label ) return; + double position = left_label->position; + if( position < start_pos ) + cut(position, start_pos, position); +} + +void MWindow::snap_right_label() +{ + double end_pos = edl->local_session->get_selectionend(); + Label *right_label = edl->labels->next_label(end_pos); + if( !right_label ) return; + double position = right_label->position; + if( end_pos < position ) + cut(end_pos, position, end_pos); +} + int MWindow::cut_automation() { undo->update_undo_before(); diff --git a/cinelerra-5.1/cinelerra/mwindowmove.C b/cinelerra-5.1/cinelerra/mwindowmove.C index 08a623f8..47bc2f1a 100644 --- a/cinelerra-5.1/cinelerra/mwindowmove.C +++ b/cinelerra-5.1/cinelerra/mwindowmove.C @@ -595,13 +595,10 @@ int MWindow::next_label(int shift_down) TimelinePane *pane = gui->get_focused_pane(); if(edl->local_session->get_selectionend(1) >= (double)edl->local_session->view_start[pane->number] * - edl->local_session->zoom_sample / - edl->session->sample_rate + + edl->local_session->zoom_sample / edl->session->sample_rate + pane->canvas->time_visible() || edl->local_session->get_selectionend(1) < (double)edl->local_session->view_start[pane->number] * - edl->local_session->zoom_sample / - edl->session->sample_rate) - { + edl->local_session->zoom_sample / edl->session->sample_rate) { samplemovement((int64_t)(edl->local_session->get_selectionend(1) * edl->session->sample_rate / edl->local_session->zoom_sample - @@ -650,14 +647,10 @@ int MWindow::prev_label(int shift_down) update_plugin_guis(); TimelinePane *pane = gui->get_focused_pane(); if(edl->local_session->get_selectionstart(1) >= edl->local_session->view_start[pane->number] * - edl->local_session->zoom_sample / - edl->session->sample_rate + - pane->canvas->time_visible() - || + edl->local_session->zoom_sample / edl->session->sample_rate + + pane->canvas->time_visible() || edl->local_session->get_selectionstart(1) < edl->local_session->view_start[pane->number] * - edl->local_session->zoom_sample / - edl->session->sample_rate) - { + edl->local_session->zoom_sample / edl->session->sample_rate ) { samplemovement((int64_t)(edl->local_session->get_selectionstart(1) * edl->session->sample_rate / edl->local_session->zoom_sample - @@ -686,40 +679,11 @@ int MWindow::prev_label(int shift_down) } - - - - int MWindow::next_edit_handle(int shift_down) { double position = edl->local_session->get_selectionend(1); - Units::fix_double(&position); - double new_position = INFINITY; - - double max_rate = edl->get_frame_rate(); - int sample_rate = edl->get_sample_rate(); - if( sample_rate > max_rate ) max_rate = sample_rate; - double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; - -// Test for edit handles after cursor position - for (Track *track = edl->tracks->first; track; track = track->next) - { - if (track->record) - { - for (Edit *edit = track->edits->first; edit; edit = edit->next) - { - double edit_end = track->from_units(edit->startproject + edit->length); - Units::fix_double(&edit_end); - if( fabs(edit_end-position) < min_movement ) continue; - if (edit_end > position && edit_end < new_position) - new_position = edit_end; - } - } - } - - if(new_position != INFINITY) - { - + double new_position = edl->next_edit(position); + if(new_position != INFINITY) { edl->local_session->set_selectionend(new_position); //printf("MWindow::next_edit_handle %d\n", shift_down); if(!shift_down) @@ -766,33 +730,9 @@ int MWindow::next_edit_handle(int shift_down) int MWindow::prev_edit_handle(int shift_down) { double position = edl->local_session->get_selectionstart(1); - double new_position = -1; - Units::fix_double(&position); - - double max_rate = edl->get_frame_rate(); - int sample_rate = edl->get_sample_rate(); - if( sample_rate > max_rate ) max_rate = sample_rate; - double min_movement = max_rate > 0 ? 1. / max_rate : 1e-6; - -// Test for edit handles before cursor position - for (Track *track = edl->tracks->first; track; track = track->next) - { - if (track->record) - { - for (Edit *edit = track->edits->first; edit; edit = edit->next) - { - double edit_end = track->from_units(edit->startproject); - Units::fix_double(&edit_end); - if( fabs(edit_end-position) < min_movement ) continue; - if (edit_end < position && edit_end > new_position) - new_position = edit_end; - } - } - } - - if(new_position != -1) - { + double new_position = edl->prev_edit(position); + if(new_position != -1) { edl->local_session->set_selectionstart(new_position); //printf("MWindow::next_edit_handle %d\n", shift_down); if(!shift_down) diff --git a/cinelerra-5.1/cinelerra/playtransport.C b/cinelerra-5.1/cinelerra/playtransport.C index 7ffb8532..6fc55d63 100644 --- a/cinelerra-5.1/cinelerra/playtransport.C +++ b/cinelerra-5.1/cinelerra/playtransport.C @@ -193,12 +193,13 @@ int PlayTransport::keypress_event() int toggle_audio = subwindow->shift_down() ? 1 : 0; int use_inout = subwindow->ctrl_down() ? 1 : 0; + int alt_key = subwindow->alt_down() ? 1 : 0; int command = -1, prev_command = engine->command->command; using_inout = use_inout; subwindow->unlock_window(); + result = 0; switch( key ) { - case 'k': case KPINS: command = STOP; break; case KPPLUS: command = FAST_REWIND; break; case KP6: command = NORMAL_REWIND; break; @@ -221,12 +222,38 @@ int PlayTransport::keypress_event() break; } break; - default: - result = 0; + case 'u': case 'U': + if( alt_key ) command = SINGLE_FRAME_REWIND; + break; + case 'i': case 'I': + if( alt_key ) command = SLOW_REWIND; + break; + case 'o': case 'O': + if( alt_key ) command = NORMAL_REWIND; + break; + case 'p': case 'P': + if( alt_key ) command = FAST_REWIND; + break; + case 'j': case 'J': + if( alt_key ) command = SINGLE_FRAME_FWD; + break; + case 'k': case 'K': + if( alt_key ) command = SLOW_FWD; + break; + case 'l': case 'L': + if( alt_key ) command = NORMAL_FWD; + break; + case ':': case ';': + if( alt_key ) command = FAST_FWD; + break; + case 'm': case 'M': + if( alt_key ) command = STOP; break; } - if( command >= 0 ) + if( command >= 0 ) { handle_transport(command, 0, use_inout, 1, toggle_audio); + result = 1; + } subwindow->lock_window("PlayTransport::keypress_event 5"); return result; diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 5fb48ad6..ee7c5d18 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -84,9 +84,11 @@ Preferences::Preferences() warn_version = 1; bd_warn_root = 1; popupmenu_btnup = 1; + grab_input_focus = 1; textbox_focus_policy = 0; forward_render_displacement = 0; dvd_yuv420p_interlace = 0; + highlight_inverse = 0xffffff; // Default brender asset brender_asset = new Asset; @@ -199,9 +201,11 @@ void Preferences::copy_from(Preferences *that) warn_version = that->warn_version; bd_warn_root = that->bd_warn_root; popupmenu_btnup = that->popupmenu_btnup; + grab_input_focus = that->grab_input_focus; textbox_focus_policy = that->textbox_focus_policy; forward_render_displacement = that->forward_render_displacement; dvd_yuv420p_interlace = that->dvd_yuv420p_interlace; + highlight_inverse = that->highlight_inverse; renderfarm_nodes.remove_all_objects(); renderfarm_ports.remove_all(); renderfarm_enabled.remove_all(); @@ -353,9 +357,11 @@ int Preferences::load_defaults(BC_Hash *defaults) warn_version = defaults->get("WARN_VERSION", warn_version); bd_warn_root = defaults->get("BD_WARN_ROOT", bd_warn_root); popupmenu_btnup = defaults->get("POPUPMENU_BTNUP", popupmenu_btnup); + grab_input_focus = defaults->get("GRAB_FOCUS", grab_input_focus); textbox_focus_policy = defaults->get("TEXTBOX_FOCUS_POLICY", textbox_focus_policy); forward_render_displacement = defaults->get("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement); dvd_yuv420p_interlace = defaults->get("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace); + highlight_inverse = defaults->get("HIGHLIGHT_INVERSE", highlight_inverse); use_brender = defaults->get("USE_BRENDER", use_brender); brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment); cache_size = defaults->get("CACHE_SIZE", cache_size); @@ -483,9 +489,11 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("WARN_VERSION", warn_version); defaults->update("BD_WARN_ROOT", bd_warn_root); defaults->update("POPUPMENU_BTNUP", popupmenu_btnup); + defaults->update("GRAB_FOCUS", grab_input_focus); defaults->update("TEXTBOX_FOCUS_POLICY", textbox_focus_policy); defaults->update("FORWARD_RENDER_DISPLACEMENT", forward_render_displacement); defaults->update("DVD_YUV420P_INTERLACE", dvd_yuv420p_interlace); + defaults->update("HIGHLIGHT_INVERSE", highlight_inverse); brender_asset->save_defaults(defaults, "BRENDER_", 1, 1, 1, 0, 0); defaults->update("USE_BRENDER", use_brender); defaults->update("BRENDER_FRAGMENT", brender_fragment); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index 779363a3..ac0784b5 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -110,6 +110,8 @@ public: int warn_indexes; int warn_version; int bd_warn_root; +// grab input focus on enter notify + int grab_input_focus; // popup menus activate on button release int popupmenu_btnup; // textbox focus policy: click, leave @@ -118,6 +120,8 @@ public: int forward_render_displacement; // use dvd yuv420p interlace format int dvd_yuv420p_interlace; +// highlight inversion color + int highlight_inverse; // Default positions for channels int channel_positions[MAXCHANNELS * MAXCHANNELS]; diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index b7c46fd5..dbda188f 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -223,6 +223,7 @@ int PreferencesThread::apply_settings() BC_Signals::set_catch_segv(mwindow->preferences->trap_sigsegv); BC_Signals::set_catch_intr(mwindow->preferences->trap_sigintr); BC_WindowBase::get_resources()->popupmenu_btnup = mwindow->preferences->popupmenu_btnup; + BC_WindowBase::get_resources()->grab_input_focus = mwindow->preferences->grab_input_focus; BC_WindowBase::get_resources()->textbox_focus_policy = mwindow->preferences->textbox_focus_policy; if( mwindow->preferences->trap_sigsegv || mwindow->preferences->trap_sigintr ) { BC_Trace::enable_locks(); diff --git a/cinelerra-5.1/cinelerra/proxy.C b/cinelerra-5.1/cinelerra/proxy.C index d8ef2420..faafc800 100644 --- a/cinelerra-5.1/cinelerra/proxy.C +++ b/cinelerra-5.1/cinelerra/proxy.C @@ -51,7 +51,7 @@ #define MAX_SCALE 16 ProxyMenuItem::ProxyMenuItem(MWindow *mwindow) - : BC_MenuItem(_("Proxy settings..."), _("Alt-P"), 'p') + : BC_MenuItem(_("Proxy settings..."), _("Alt-r"), 'r') { this->mwindow = mwindow; set_alt(); diff --git a/cinelerra-5.1/cinelerra/swindow.C b/cinelerra-5.1/cinelerra/swindow.C index 1d33f4b1..fd173764 100644 --- a/cinelerra-5.1/cinelerra/swindow.C +++ b/cinelerra-5.1/cinelerra/swindow.C @@ -356,6 +356,7 @@ void SWindowGUI::set_script_pos(int64_t entry_no, int text_no) int SWindowGUI::load_selection(int pos, int row) { + if( pos < 0 || pos >= script.size() ) return 1; ScriptLines *texts = script[pos]; char *rp = texts->get_text_row(row); if( !rp || *rp == '=' || *rp == '*' || *rp=='\n' ) return 1; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index e79654d4..a0ba9f27 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -1277,7 +1277,7 @@ void TrackCanvas::draw_highlight_rectangle(int x, int y, int w, int h) h = MIN(h, get_h() + 20); if(w > 0 && h > 0) { - set_color(WHITE); + set_color(mwindow->preferences->highlight_inverse); set_inverse(); //draw_rectangle(x, y, w, h); draw_rectangle(x + 1, y + 1, w - 2, h - 2); @@ -1339,7 +1339,7 @@ void TrackCanvas::draw_highlight_insertion(int x, int y, int w, int h) } w = MIN(w, get_w() + 20); h = MIN(h, get_h() + 20); - set_color(WHITE); + set_color(mwindow->preferences->highlight_inverse); set_inverse(); draw_rectangle(x, y, w, h); draw_rectangle(x + 1, y + 1, w - 2, h - 2); @@ -4658,6 +4658,7 @@ int TrackCanvas::button_press_event() int result = 0; int cursor_x, cursor_y; int new_cursor; + double start_position = mwindow->edl->local_session->get_selectionstart(1); cursor_x = get_cursor_x(); cursor_y = get_cursor_y(); @@ -4814,6 +4815,23 @@ int TrackCanvas::button_press_event() gui->flash_canvas(1); } } +// if snapping to selection point + if( gui->ctrl_down() && gui->alt_down() ) { + switch( mwindow->session->current_operation ) { + case DRAG_EDITHANDLE1: + mwindow->session->drag_position = start_position; + mwindow->session->current_operation = NO_OPERATION; + drag_scroll = 0; + end_edithandle_selection(); + break; + case DRAG_PLUGINHANDLE1: + mwindow->session->drag_position = start_position; + mwindow->session->current_operation = NO_OPERATION; + drag_scroll = 0; + end_pluginhandle_selection(); + break; + } + } return result; } diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index b51843b1..e3769675 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -642,8 +642,7 @@ new_vframes(20,default_medium_7segment, menu_item_text = BLACK; menu_highlighted_fontcolor = BLACK; progress_text = BLACK; - - + grab_input_focus = 1; text_default = BLACK; highlight_inverse = WHITE ^ BLUE; diff --git a/cinelerra-5.1/guicast/bcresources.h b/cinelerra-5.1/guicast/bcresources.h index 978425ae..1f2037bd 100644 --- a/cinelerra-5.1/guicast/bcresources.h +++ b/cinelerra-5.1/guicast/bcresources.h @@ -139,7 +139,8 @@ public: // color for progress text int progress_text; - +// set focus on enter + int grab_input_focus; int menu_highlighted_fontcolor; diff --git a/cinelerra-5.1/guicast/bcwindowbase.C b/cinelerra-5.1/guicast/bcwindowbase.C index 5909aced..ec750768 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.C +++ b/cinelerra-5.1/guicast/bcwindowbase.C @@ -296,6 +296,7 @@ int BC_WindowBase::initialize() active_menubar = 0; active_popup_menu = 0; active_subwindow = 0; + cursor_entered = 0; pixmap = 0; bg_pixmap = 0; _7segment_pixmaps = 0; @@ -1325,11 +1326,20 @@ locking_message = event->xclient.message_type; break; case LeaveNotify: + if( cursor_entered && event->xcrossing.window == win ) { + cursor_entered = 0; + } event_win = event->xany.window; dispatch_cursor_leave(); break; case EnterNotify: + if( !cursor_entered && event->xcrossing.window == win ) { + if( !event->xcrossing.focus && get_resources()->grab_input_focus ) { + XSetInputFocus(display, win, RevertToParent, CurrentTime); + } + cursor_entered = 1; + } event_win = event->xany.window; cursor_x = event->xcrossing.x; cursor_y = event->xcrossing.y; diff --git a/cinelerra-5.1/guicast/bcwindowbase.h b/cinelerra-5.1/guicast/bcwindowbase.h index 3029e16e..263fa657 100644 --- a/cinelerra-5.1/guicast/bcwindowbase.h +++ b/cinelerra-5.1/guicast/bcwindowbase.h @@ -674,6 +674,8 @@ private: int video_on; // Event handler completion int done, done_set, window_running; +// Enter/Leave notify state + int cursor_entered; // Return value of event handler int return_value; // Motion event compression diff --git a/cinelerra-5.1/po/de.po b/cinelerra-5.1/po/de.po index 26c6e964..c882d223 100644 --- a/cinelerra-5.1/po/de.po +++ b/cinelerra-5.1/po/de.po @@ -10453,12 +10453,12 @@ msgstr "proxy" msgid "Cinelerra: Proxy settings" msgstr "Cinelerra: Proxy-Einstellungen" msgid "Use scaler (FFMPEG only)" -msgstr "Verwenden scaler (Nur FFMPEG)" +msgstr "Scaler verwenden (Nur FFMPEG)" msgid "Original size" msgstr "Urspr. größe" msgid "New media dimensions: " -msgstr "Neue medien abmessungen: " +msgstr "Neue Medienabmessungen. " msgid "Auto proxy/scale media loads" -msgstr "Automatisch proxy/scalieren medien laden" +msgstr "Automatisch neu geladene Medien skalieren" msgid "Creating proxy files..." msgstr "Dateien proxy erstelle..." -- 2.26.2