From: Good Guy Date: Thu, 14 Feb 2019 19:47:07 +0000 (-0700) Subject: shuttlerc, boobytraps, vwindow hang, lock cleanup X-Git-Tag: 2019-08~105 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=17c1843cd537108ae6e852546a39f15ac5e33e40;p=goodguy%2Fcinelerra.git shuttlerc, boobytraps, vwindow hang, lock cleanup --- diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 2597f52e..a36c4191 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -399,7 +399,7 @@ int AssetViewPopup::button_press_event() vedl->set_outpoint(end); vedl->local_session->set_selectionstart(start); vedl->local_session->set_selectionend(end); - vwindow->update_position(CHANGE_NONE, 0, 1, 0); + vwindow->update_position(); return 1; } else { diff --git a/cinelerra-5.1/cinelerra/channeledit.C b/cinelerra-5.1/cinelerra/channeledit.C index 9a81984e..db680c17 100644 --- a/cinelerra-5.1/cinelerra/channeledit.C +++ b/cinelerra-5.1/cinelerra/channeledit.C @@ -703,7 +703,6 @@ void ConfirmScanThread::handle_done_event(int result) gui->channel_picker->save_scan_defaults(&gui->thread->scan_params); if(!result) { - get_gui()->hide_window(); gui->lock_window("ConfirmScanThread::handle_done_event"); gui->scan(); gui->unlock_window(); diff --git a/cinelerra-5.1/cinelerra/cwindowgui.C b/cinelerra-5.1/cinelerra/cwindowgui.C index e88b9a3f..a8472145 100644 --- a/cinelerra-5.1/cinelerra/cwindowgui.C +++ b/cinelerra-5.1/cinelerra/cwindowgui.C @@ -841,6 +841,7 @@ CWindowEditing::CWindowEditing(MWindow *mwindow, CWindow *cwindow) #define panel_btn(fn, args, s) \ panel_fn(panel_##fn, args, mwindow->gui->mbuttons->edit_panel->panel_##s) + double CWindowEditing::get_position() { relock_cm("get_position"); @@ -852,18 +853,19 @@ double CWindowEditing::get_position() void CWindowEditing::set_position(double position) { relock_cm("set_position"); - set_position(position); + mwindow->gui->mbuttons->edit_panel->set_position(position); relock_mc("set_position"); } void CWindowEditing::set_click_to_play(int v) { - relock_cm("set_click_to_play"); + relock_cm("set_position"); mwindow->edl->session->cwindow_click2play = v; + relock_mc("set_position"); 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)) diff --git a/cinelerra-5.1/cinelerra/keyframegui.C b/cinelerra-5.1/cinelerra/keyframegui.C index a8f99a73..49c90229 100644 --- a/cinelerra-5.1/cinelerra/keyframegui.C +++ b/cinelerra-5.1/cinelerra/keyframegui.C @@ -218,13 +218,13 @@ void KeyFrameThread::handle_close_event(int result) void KeyFrameThread::close_window() { - lock_window("KeyFrameThread::close_window"); + lock_dialog("KeyFrameThread::close_window"); if( get_gui() ) { get_gui()->lock_window("KeyFrameThread::close_window"); get_gui()->set_done(1); get_gui()->unlock_window(); } - unlock_window(); + unlock_dialog(); } @@ -261,7 +261,7 @@ void KeyFrameThread::update_gui(int update_value_text) update_values(); mwindow->gui->unlock_window(); - lock_window("KeyFrameThread::update_gui"); + lock_dialog("KeyFrameThread::update_gui"); KeyFrameWindow *window = (KeyFrameWindow*)get_gui(); if( window ) { window->lock_window("KeyFrameThread::update_gui"); @@ -280,7 +280,7 @@ void KeyFrameThread::update_gui(int update_value_text) } window->unlock_window(); } - unlock_window(); + unlock_dialog(); } #endif } diff --git a/cinelerra-5.1/cinelerra/mainerror.C b/cinelerra-5.1/cinelerra/mainerror.C index 61ffa7c4..4fdc592f 100644 --- a/cinelerra-5.1/cinelerra/mainerror.C +++ b/cinelerra-5.1/cinelerra/mainerror.C @@ -168,7 +168,7 @@ void MainError::append_error(const char *string) void MainError::show_error_local(const char *string) { // assume user won't get to closing the GUI here - lock_window("MainError::show_error_local"); + lock_dialog("MainError::show_error_local"); if( get_gui() ) { MainErrorGUI *gui = (MainErrorGUI*)get_gui(); gui->lock_window("MainError::show_error_local"); @@ -186,7 +186,7 @@ void MainError::show_error_local(const char *string) append_error(string); start(); } - unlock_window(); + unlock_dialog(); } diff --git a/cinelerra-5.1/cinelerra/manualgoto.C b/cinelerra-5.1/cinelerra/manualgoto.C index 966def18..8aa5cabd 100644 --- a/cinelerra-5.1/cinelerra/manualgoto.C +++ b/cinelerra-5.1/cinelerra/manualgoto.C @@ -64,7 +64,9 @@ void ManualGoto::handle_done_event(int result) case '-': new_position = current_position - new_position; break; default: break; } + panel->subwindow->lock_window("ManualGoto::handle_done_event"); panel->set_position(new_position); + panel->subwindow->unlock_window(); } @@ -81,7 +83,7 @@ ManualGotoWindow::~ManualGotoWindow() void ManualGotoWindow::reset_data(double position) { - lock_window(); + lock_window("ManualGotoWindow::reset_data"); update_position(position); signtitle->update("="); unlock_window(); diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 6c4707dd..58b659c4 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -174,10 +174,10 @@ int PreferencesThread::update_framerate() { if(thread_running) { - lock_gui("PreferencesThread::update_framerate"); + lock_dialog("PreferencesThread::update_framerate"); PreferencesWindow *window = (PreferencesWindow*)get_gui(); if(window) window->update_framerate(); - unlock_gui(); + unlock_dialog(); } return 0; } @@ -187,10 +187,10 @@ void PreferencesThread::update_rates() { if(thread_running) { - lock_gui("PreferencesThread::update_framerate"); + lock_dialog("PreferencesThread::update_framerate"); PreferencesWindow *window = (PreferencesWindow*)get_gui(); if(window) window->update_rates(); - unlock_gui(); + unlock_dialog(); } } diff --git a/cinelerra-5.1/cinelerra/vtimebar.C b/cinelerra-5.1/cinelerra/vtimebar.C index 6e79b89e..80447e88 100644 --- a/cinelerra-5.1/cinelerra/vtimebar.C +++ b/cinelerra-5.1/cinelerra/vtimebar.C @@ -92,10 +92,7 @@ void VTimeBar::select_label(double position) } // Que the CWindow - gui->vwindow->update_position(CHANGE_NONE, - 0, - 1, - 0); + gui->vwindow->update_position(); update(1); } } diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index df7bef70..0b75fc0c 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -188,7 +188,7 @@ void VWindow::change_source(int edl_number) this->edl = mwindow->edl->get_vwindow_edl(edl_number); this->edl->Garbage::add_user(); gui->change_source(get_edl(), get_edl()->local_session->clip_title); - update_position(CHANGE_ALL, 1, 1, 1); + update_position(CHANGE_ALL); } else { @@ -230,8 +230,7 @@ void VWindow::change_source(Indexable *indexable) // Update GUI gui->change_source(this->edl, title); - update_position(CHANGE_ALL, 1, 1, 1); - + update_position(CHANGE_ALL); gui->unlock_window(); } @@ -265,7 +264,7 @@ void VWindow::change_source(EDL *edl) // Update GUI gui->change_source(edl, edl->local_session->clip_title); - update_position(CHANGE_ALL, 1, 1, 1); + update_position(CHANGE_ALL); } else gui->change_source(edl, _("Viewer")); @@ -275,28 +274,20 @@ void VWindow::change_source(EDL *edl) void VWindow::goto_start() { - if(get_edl()) - { + if( get_edl() ) { get_edl()->local_session->set_selectionstart(0); get_edl()->local_session->set_selectionend(0); - update_position(CHANGE_NONE, - 0, - 1, - 0); + update_position(); } } void VWindow::goto_end() { - if(get_edl()) - { + if( get_edl() ) { double position = get_edl()->tracks->total_length(); get_edl()->local_session->set_selectionstart(position); get_edl()->local_session->set_selectionend(position); - update_position(CHANGE_NONE, - 0, - 1, - 0); + update_position(); } } @@ -307,23 +298,16 @@ void VWindow::update(int do_timebar) gui->edit_panel->update(); } -void VWindow::update_position(int change_type, - int use_slider, - int update_slider, - int lock_window) +void VWindow::update_position(int change_type) { EDL *edl = get_edl(); - if(edl) - { -//printf("VWindow::update_position %d\n", __LINE__); -//edl->dump(); + if(edl) { + gui->unlock_window(); playback_engine->refresh_frame(change_type, edl); - + gui->lock_window("VWindow::update_position"); double position = edl->local_session->get_selectionstart(1); - if(lock_window) gui->lock_window("VWindow::update_position"); gui->clock->update(position); gui->timebar->update(1); - if(lock_window) gui->unlock_window(); } } @@ -332,23 +316,23 @@ void VWindow::stop_playback(int wait) playback_engine->stop_playback(wait); } +void VWindow::interrupt_playback(int wait) +{ + gui->unlock_window(); + playback_engine->interrupt_playback(wait); + gui->lock_window("VWindow::interrupt_playback"); +} + int VWindow::update_position(double position) { EDL *edl = get_edl(); - if(edl) - { - gui->unlock_window(); - - playback_engine->interrupt_playback(1); - + if(edl) { + interrupt_playback(1); position = mwindow->edl->align_to_frame(position, 0); position = MAX(0, position); - edl->local_session->set_selectionstart(position); edl->local_session->set_selectionend(position); - - gui->lock_window("VWindow::update_position 1"); - update_position(CHANGE_NONE, 0, 1, 0); + update_position(); } return 1; @@ -357,8 +341,7 @@ int VWindow::update_position(double position) void VWindow::set_inpoint() { EDL *edl = get_edl(); - if(edl) - { + if(edl) { edl->set_inpoint(edl->local_session->get_selectionstart(1)); gui->timebar->update(1); } diff --git a/cinelerra-5.1/cinelerra/vwindow.h b/cinelerra-5.1/cinelerra/vwindow.h index d2a789a4..5d13e672 100644 --- a/cinelerra-5.1/cinelerra/vwindow.h +++ b/cinelerra-5.1/cinelerra/vwindow.h @@ -62,10 +62,7 @@ public: Indexable* get_source(); void update(int do_timebar); - void update_position(int change_type = CHANGE_NONE, - int use_slider = 1, - int update_slider = 0, - int lock_window = 0); + void update_position(int change_type = CHANGE_NONE); int update_position(double position); void set_inpoint(); void set_outpoint(); @@ -77,6 +74,7 @@ public: void goto_start(); void goto_end(); void stop_playback(int wait); + void interrupt_playback(int wait); VTracking *playback_cursor; diff --git a/cinelerra-5.1/cinelerra/vwindowgui.C b/cinelerra-5.1/cinelerra/vwindowgui.C index 52ef387e..814161b6 100644 --- a/cinelerra-5.1/cinelerra/vwindowgui.C +++ b/cinelerra-5.1/cinelerra/vwindowgui.C @@ -590,7 +590,7 @@ void VWindowEditing::set_position(double 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); + vwindow->update_position(); } } @@ -620,9 +620,7 @@ void VWindowEditing::panel_toggle_label() 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"); + vwindow->interrupt_playback(1); EDL *edl = vwindow->get_edl(); Label *current = edl->labels->next_label( @@ -631,16 +629,14 @@ void VWindowEditing::panel_next_label(int cut) 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->update_position(); 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"); + vwindow->interrupt_playback(1); EDL *edl = vwindow->get_edl(); Label *current = edl->labels->prev_label( @@ -648,7 +644,7 @@ void VWindowEditing::panel_prev_label(int cut) 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->update_position(); vwindow->gui->timebar->update(1); } @@ -818,9 +814,7 @@ void VWindowCanvas::zoom_resize_window(float percentage) void VWindowCanvas::close_source() { - gui->unlock_window(); - gui->vwindow->playback_engine->interrupt_playback(1); - gui->lock_window("VWindowCanvas::close_source"); + gui->vwindow->interrupt_playback(1); gui->vwindow->delete_source(1, 1); } diff --git a/cinelerra-5.1/guicast/bcdialog.C b/cinelerra-5.1/guicast/bcdialog.C index ef834919..64960351 100644 --- a/cinelerra-5.1/guicast/bcdialog.C +++ b/cinelerra-5.1/guicast/bcdialog.C @@ -51,12 +51,12 @@ BC_DialogThread::~BC_DialogThread() delete window_lock; } -void BC_DialogThread::lock_window(const char *location) +void BC_DialogThread::lock_dialog(const char *location) { window_lock->lock(location); } -void BC_DialogThread::unlock_window() +void BC_DialogThread::unlock_dialog() { window_lock->unlock(); } @@ -107,17 +107,6 @@ void BC_DialogThread::run() handle_close_event(result); } -void BC_DialogThread::lock_gui(const char *location) -{ - window_lock->lock(location); -} - -void BC_DialogThread::unlock_gui() -{ - window_lock->unlock(); -} - - BC_Window* BC_DialogThread::new_gui() { printf("BC_DialogThread::new_gui called\n"); @@ -139,14 +128,14 @@ void BC_DialogThread::handle_close_event(int result) void BC_DialogThread::close_window() { - lock_window("BC_DialogThread::close_window"); + lock_dialog("BC_DialogThread::close_window"); if(gui) { gui->lock_window("BC_DialogThread::close_window"); gui->set_done(1); gui->unlock_window(); } - unlock_window(); + unlock_dialog(); join(); } diff --git a/cinelerra-5.1/guicast/bcdialog.h b/cinelerra-5.1/guicast/bcdialog.h index bbdef7c7..1318a996 100644 --- a/cinelerra-5.1/guicast/bcdialog.h +++ b/cinelerra-5.1/guicast/bcdialog.h @@ -63,8 +63,8 @@ public: BC_Window* get_gui(); // Called by user to access the gui pointer - void lock_window(const char *location); - void unlock_window(); + void lock_dialog(const char *location); + void unlock_dialog(); // Called by user to close the GUI from outside the thread void close_window(); diff --git a/cinelerra-5.1/guicast/mutex.C b/cinelerra-5.1/guicast/mutex.C index 36dbfb92..9acbfc9f 100644 --- a/cinelerra-5.1/guicast/mutex.C +++ b/cinelerra-5.1/guicast/mutex.C @@ -91,6 +91,7 @@ int Mutex::unlock() { if( count <= 0 ) { printf("Mutex::unlock not locked: %s\n", title); + booby(); return 0; } // Remove from recursive status diff --git a/cinelerra-5.1/shuttlerc b/cinelerra-5.1/shuttlerc index 1f5758f9..2bb7bfd1 100644 --- a/cinelerra-5.1/shuttlerc +++ b/cinelerra-5.1/shuttlerc @@ -1,7 +1,7 @@ # uncomment to enable diagnostics #DEBUG -# uncommet to use direct usb +# uncomment to use direct usb #USB_DIRECT # redefine default, use @@ -21,17 +21,15 @@ # Most useful functions have to be on K5-K9 because Xpress only has 5 keys K5 XK_Home # Beginning - K6 XK_KP_3 # Play, or if playing Stop + K6 XK_KP_6 # Reverse, or if playing Stop K7 XK_KP_0 # Stop - K8 XK_KP_6 # Reverse, or if playing Stop + K8 XK_KP_3 # Play, or if playing Stop K9 XK_End # End -# K10 "[" # Switch if K14 not working -# K11 "]" # Switch if K15 not working - K10 Alt-XK_Left - K11 Alt-XK_Right - K12 XK_Home # Beginning - K13 XK_End # End + K10 Alt-XK_Left # Go to previous edit + K11 Alt-XK_Right # Go to next edit + K12 Ctrl-XK_Left # Go to previous label + K13 Ctrl-XK_Right # Go to next label K14 "[" # Toggle in K15 "]" # Toggle out @@ -63,18 +61,18 @@ # Most useful functions have to be on K5-K9 because Xpress only has 5 keys K5 XK_Home # Beginning - K6 XK_KP_3 # Play, or if playing Stop + K6 XK_KP_6 # Reverse, or if playing Stop K7 "f" # Go in or out of Fullscreen mode - K8 XK_KP_6 # Reverse, of if playing Stop + K8 XK_KP_3 # Play, of if playing Stop K9 XK_End # End - K10 "[" # Temporary until K14 Pro fixed - K11 "]" # Temporary until K15 Pro fixed - K12 XK_Home # Beginning - K13 XK_End # End + K10 Alt-XK_Left # Go to previous edit + K11 Alt-XK_Right # Go to next edit + K12 Ctrl-XK_Left # Go to previous label + K13 Ctrl-XK_Right # Go to next label K14 "[" # Toggle in K15 "]" # Toggle out - + K1 "i" # Clip K2 "x" # Cut K3 "c" # Copy @@ -103,18 +101,18 @@ # Most useful functions have to be on K6-K9 because Xpress only has 5 keys K5 XK_Home # Beginning - K6 XK_KP_3 # Play, or if playing Stop + K6 XK_KP_6 # Reverse, or if playing Stop K7 "f" # Go in or out of Fullscreen mode - K8 XK_KP_6 # Reverse, or if playing Stop + K8 XK_KP_3 # Play, or if playing Stop K9 XK_End # End - K10 "[" # Temporary until K14 Pro fixed - K11 "]" # Temporary until K15 Pro fixed - K12 XK_Home # Beginning - K13 XK_End # End + K10 "[" # Toggle in if no K14 + K11 "]" # Toggle in if no K15 + K12 Alt-XK_Left # Go to previous edit + K13 Alt-XK_Right # Go to next edit K14 "[" # Toggle in K15 "]" # Toggle out - + K1 "i" # Clip K2 "v" # Splice K3 "c" # Copy