From 686bc04a488847170d80ec603f8c33962a7aa928 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 12 Apr 2019 18:45:28 -0600 Subject: [PATCH 1/1] drag edit contraints relaxed for ripples, cwdw gui/tool deadlock fix, vpatchgui fader realtime updates, fps/codec added to asset comments in awdw, histogram plot toggle tweak, titler booby, titler backslash, plugin_dialog apply clears selection --- cinelerra-5.1/cinelerra/apatchgui.C | 4 +-- cinelerra-5.1/cinelerra/awindowgui.C | 21 +++++++++++++--- cinelerra-5.1/cinelerra/awindowgui.h | 3 +++ cinelerra-5.1/cinelerra/colorpicker.C | 2 +- cinelerra-5.1/cinelerra/cwindowtool.C | 2 ++ cinelerra-5.1/cinelerra/edit.C | 16 ++++++------ cinelerra-5.1/cinelerra/plugindialog.C | 21 ++++++++++++++-- cinelerra-5.1/cinelerra/plugindialog.h | 1 + cinelerra-5.1/cinelerra/vpatchgui.C | 7 +++++- cinelerra-5.1/guicast/bcresources.C | 28 +-------------------- cinelerra-5.1/plugins/histogram/histogram.C | 4 +-- cinelerra-5.1/plugins/titler/titler.C | 3 ++- cinelerra-5.1/plugins/titler/titlerwindow.C | 2 ++ 13 files changed, 67 insertions(+), 47 deletions(-) diff --git a/cinelerra-5.1/cinelerra/apatchgui.C b/cinelerra-5.1/cinelerra/apatchgui.C index f46e4ab7..8743268d 100644 --- a/cinelerra-5.1/cinelerra/apatchgui.C +++ b/cinelerra-5.1/cinelerra/apatchgui.C @@ -104,9 +104,9 @@ int APatchGUI::update(int x, int y) FloatAuto *previous = 0, *next = 0; double unit_position = mwindow->edl->local_session->get_selectionstart(1); unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = atrack->to_units(unit_position, 0); + int64_t unit_pos = atrack->to_units(unit_position, 0); FloatAutos *ptr = (FloatAutos*)atrack->automation->autos[AUTOMATION_FADE]; - float value = ptr->get_value((long)unit_position, PLAY_FORWARD, previous, next); + float value = ptr->get_value(unit_pos, PLAY_FORWARD, previous, next); fade->update(fade->get_w(), value, mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE], mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE]); diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 8b1fda8c..0caedce4 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -870,6 +870,9 @@ void AssetPicon::reset() vicon_frame = 0; in_use = 1; comments_time = 0; + comments_rate = -1; + comments_ffmt = ' '; + comments_type = ""; id = 0; persistent = 0; } @@ -1060,6 +1063,10 @@ void AssetPicon::create_objects() } struct stat st; comments_time = !stat(asset->path, &st) ? st.st_mtime : 0; + comments_rate = asset->get_frame_rate(); + comments_ffmt = asset->format == FILE_FFMPEG ? '=' : '-'; + comments_type = asset->format == FILE_FFMPEG ? + asset->vcodec : File::formattostr(asset->format); } else if( indexable && !indexable->is_asset ) { @@ -2083,9 +2090,13 @@ void AWindowGUI::update_asset_list() continue; } if( picon->indexable && picon->indexable->is_asset ) { + Asset *asset = (Asset *)picon->indexable; struct stat st; - picon->comments_time = !stat(picon->indexable->path, &st) ? - st.st_mtime : 0; + picon->comments_time = !stat(asset->path, &st) ? st.st_mtime : 0; + picon->comments_rate = asset->get_frame_rate(); + picon->comments_ffmt = asset->format == FILE_FFMPEG ? '=' : '-'; + picon->comments_type = asset->format == FILE_FFMPEG ? + asset->vcodec : File::formattostr(asset->format); } } } @@ -2271,9 +2282,11 @@ void AWindowGUI::copy_picons(AssetPicon *picon, ArrayList *src) else if( picon->comments_time ) { char date_time[BCSTRLEN]; struct tm stm; localtime_r(&picon->comments_time, &stm); - sprintf(date_time,"%04d.%02d.%02d %02d:%02d:%02d", + sprintf(date_time,"%04d.%02d.%02d %02d:%02d:%02d @%0.2f %c%s", stm.tm_year+1900, stm.tm_mon+1, stm.tm_mday, - stm.tm_hour, stm.tm_min, stm.tm_sec); + stm.tm_hour, stm.tm_min, stm.tm_sec, + picon->comments_rate, picon->comments_ffmt, + picon->comments_type); dst[1].append(item2 = new BC_ListBoxItem(date_time)); } else diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index fc920070..a378c798 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -131,6 +131,9 @@ public: int in_use; int persistent; time_t comments_time; + int comments_ffmt; + double comments_rate; + const char *comments_type; double sort_key; PluginServer *plugin; Label *label; diff --git a/cinelerra-5.1/cinelerra/colorpicker.C b/cinelerra-5.1/cinelerra/colorpicker.C index f40a95f8..f3637466 100644 --- a/cinelerra-5.1/cinelerra/colorpicker.C +++ b/cinelerra-5.1/cinelerra/colorpicker.C @@ -96,7 +96,7 @@ void ColorPicker::update_gui(int output, int alpha) { ColorWindow *gui = (ColorWindow *)get_gui(); if( !gui ) return; - gui->lock_window(); + gui->lock_window("ColorPicker::update_gui"); this->output = output; this->alpha = alpha; gui->change_values(); diff --git a/cinelerra-5.1/cinelerra/cwindowtool.C b/cinelerra-5.1/cinelerra/cwindowtool.C index e0e27e4d..efa4cdb1 100644 --- a/cinelerra-5.1/cinelerra/cwindowtool.C +++ b/cinelerra-5.1/cinelerra/cwindowtool.C @@ -2193,10 +2193,12 @@ void CWindowMaskGUI::handle_event() void CWindowMaskGUI::update_preview() { + unlock_window(); CWindowGUI *cgui = mwindow->cwindow->gui; cgui->lock_window("CWindowMaskGUI::update_preview"); cgui->sync_parameters(CHANGE_PARAMS, 0, 1); cgui->unlock_window(); + lock_window("CWindowMaskGUI::update_preview"); } diff --git a/cinelerra-5.1/cinelerra/edit.C b/cinelerra-5.1/cinelerra/edit.C index bd82f451..e9e9f1b4 100644 --- a/cinelerra-5.1/cinelerra/edit.C +++ b/cinelerra-5.1/cinelerra/edit.C @@ -443,6 +443,7 @@ int Edit::shift_start(int edit_mode, int64_t newposition, int64_t oldposition, int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits) { int64_t cut_length = newposition - oldposition; + int rest_moved = edit_mode == MOVE_RIPPLE || edit_mode == MOVE_EDGE ? 1 : 0; if( cut_length > length ) cut_length = length; else if( cut_length < -length ) @@ -450,11 +451,11 @@ int Edit::shift_start(int edit_mode, int64_t newposition, int64_t oldposition, int64_t start = startproject, end = start + length; Edit *prev = this->previous, *next = this->next; - int edits_moved = 0, rest_moved = 0; + int edits_moved = 0; switch( edit_mode ) { case MOVE_RIPPLE: - edits_moved = rest_moved = 1; + edits_moved = 1; startsource += cut_length; cut_length = -cut_length; length += cut_length; @@ -488,7 +489,7 @@ int Edit::shift_start(int edit_mode, int64_t newposition, int64_t oldposition, } break; case MOVE_EDGE: - edits_moved = rest_moved = 1; + edits_moved = 1; startsource -= cut_length; length += cut_length; for( Edit *edit=next; edit; edit=edit->next ) @@ -504,18 +505,19 @@ int Edit::shift_end(int edit_mode, int64_t newposition, int64_t oldposition, int edit_labels, int edit_autos, int edit_plugins, Edits *trim_edits) { int64_t cut_length = newposition - oldposition; - if( cut_length > length ) - cut_length = length; + int rest_moved = edit_mode == MOVE_RIPPLE || edit_mode == MOVE_EDGE ? 1 : 0; + if( cut_length > length ) { + if( !rest_moved ) cut_length = length; + } else if( cut_length < -length ) cut_length = -length; int64_t start = startproject, end = start + length; Edit *prev = this->previous, *next = this->next; - int edits_moved = 0, rest_moved = 0; + int edits_moved = 0; switch( edit_mode ) { case MOVE_RIPPLE: case MOVE_EDGE: - rest_moved = 1; length += cut_length; for( Edit *edit=next; edit; edit=edit->next ) edit->startproject += cut_length; diff --git a/cinelerra-5.1/cinelerra/plugindialog.C b/cinelerra-5.1/cinelerra/plugindialog.C index d9e73d39..006cf40e 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.C +++ b/cinelerra-5.1/cinelerra/plugindialog.C @@ -44,7 +44,8 @@ PluginDialogThread::PluginDialogThread(MWindow *mwindow) : BC_DialogThread() { this->mwindow = mwindow; - plugin = 0; + this->plugin = 0; + this->plugin_type = PLUGIN_NONE; } PluginDialogThread::~PluginDialogThread() @@ -94,7 +95,7 @@ BC_Window* PluginDialogThread::new_gui() mwindow->session->plugindialog_w / 2; int y = mwindow->gui->get_abs_cursor_y(0) - mwindow->session->plugindialog_h / 2; - plugin_type = 0; + plugin_type = PLUGIN_NONE; PluginDialog *window = new PluginDialog(mwindow, this, window_title, @@ -412,6 +413,21 @@ void PluginDialog::save_settings() } +void PluginDialog::clear_selection() +{ + standalone_list->set_all_selected(&standalone_data, 0); + standalone_list->draw_items(1); + shared_list->set_all_selected(&shared_data, 0); + shared_list->draw_items(1); + module_list->set_all_selected(&module_data, 0); + module_list->draw_items(1); + selected_available = -1; + selected_shared = -1; + selected_modules = -1; + thread->plugin = 0; + thread->plugin_type = PLUGIN_NONE; +} + void PluginDialog::apply() { if( selected_available >= 0 ) { @@ -473,6 +489,7 @@ PluginDialogApply::PluginDialogApply(PluginDialog *dialog, int x, int y) int PluginDialogApply::handle_event() { dialog->apply(); + dialog->clear_selection(); return 1; } diff --git a/cinelerra-5.1/cinelerra/plugindialog.h b/cinelerra-5.1/cinelerra/plugindialog.h index 0559d9e7..3511c76e 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.h +++ b/cinelerra-5.1/cinelerra/plugindialog.h @@ -102,6 +102,7 @@ public: void save_settings(); int resize_event(int w, int h); void load_plugin_list(int redraw); + void clear_selection(); void apply(); BC_Title *standalone_title; diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C index f5c572d8..774ac86b 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.C +++ b/cinelerra-5.1/cinelerra/vpatchgui.C @@ -96,7 +96,12 @@ int VPatchGUI::update(int x, int y) delete fade; fade = 0; } else { - fade->update(fade->get_w(), mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value(), + FloatAuto *previous = 0, *next = 0; + double unit_position = mwindow->edl->local_session->get_selectionstart(1); + int64_t unit_pos = vtrack->to_units(unit_position, 0); + FloatAutos *ptr = (FloatAutos*)track->automation->autos[AUTOMATION_FADE]; + float value = ptr->get_value(unit_pos, PLAY_FORWARD, previous, next); + fade->update(fade->get_w(), value, mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE], mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE]); } diff --git a/cinelerra-5.1/guicast/bcresources.C b/cinelerra-5.1/guicast/bcresources.C index 43a713e7..d44c435a 100644 --- a/cinelerra-5.1/guicast/bcresources.C +++ b/cinelerra-5.1/guicast/bcresources.C @@ -1774,33 +1774,7 @@ int utf8conv:: wnext() { int v = 0, n = 0, ch = next(); - if( ch == '\\' ) { - switch( (ch=next()) ) { - case 'n': return '\n'; - case 't': return '\t'; - case 'r': return '\r'; - case 'b': return '\b'; - case 'f': return '\f'; - case 'v': return '\v'; - case 'a': return '\a'; - case '0': case '1': case '2': case '3': - case '4': case '5': case '6': case '7': - v = ch - '0'; - for( int i=3; --i>0; v=v*8+ch, next() ) - if( (ch=cur()-'0') < 0 || ch >= 8 ) break; - return v; - case 'x': n = 2; break; - case 'u': n = 4; break; - case 'U': n = 8; break; - default: return ch; - } - for( int i=n; --i>=0; v=v*16+ch, next() ) { - if( (ch=cur()-'0')>=0 && ch<10 ) continue; - if( (ch-='A'-'0'-10)>=10 && ch<16 ) continue; - if( (ch-='a'-'A')<10 || ch>=16 ) break; - } - } - else if( ch >= 0x80 ) { + if( ch >= 0x80 ) { static const unsigned char byts[] = { 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 4, 5, }; diff --git a/cinelerra-5.1/plugins/histogram/histogram.C b/cinelerra-5.1/plugins/histogram/histogram.C index 1d242001..523c863f 100644 --- a/cinelerra-5.1/plugins/histogram/histogram.C +++ b/cinelerra-5.1/plugins/histogram/histogram.C @@ -458,8 +458,8 @@ int HistogramMain::process_buffer(VFrame *frame, if( cpus > smps ) cpus = smps; engine = new HistogramEngine(this, cpus, cpus); } -// Always plot to set the curves if automatic - if(config.plot || config.automatic) send_render_gui(frame); +// if to plot histogram + if(config.plot) send_render_gui(frame); // Generate tables here. The same table is used by many packages to render // each horizontal stripe. Need to cover the entire output range in each diff --git a/cinelerra-5.1/plugins/titler/titler.C b/cinelerra-5.1/plugins/titler/titler.C index 79b90a7a..4bd0b69b 100644 --- a/cinelerra-5.1/plugins/titler/titler.C +++ b/cinelerra-5.1/plugins/titler/titler.C @@ -1339,7 +1339,8 @@ int TitleParser::wget(wchar_t &wch) int ich; while( (ich=wnext()) >= 0 ) { if( ich == '\\' ) { - if( (ich=wnext()) == '\n' ) continue; + if( (ich=wnext()) < 0 ) break; + if( !ich || ich == '\n' ) continue; wch = ich; return 0; } diff --git a/cinelerra-5.1/plugins/titler/titlerwindow.C b/cinelerra-5.1/plugins/titler/titlerwindow.C index a0c78826..c556968a 100644 --- a/cinelerra-5.1/plugins/titler/titlerwindow.C +++ b/cinelerra-5.1/plugins/titler/titlerwindow.C @@ -780,7 +780,9 @@ void TitleColorButton::handle_done_event(int result) { if( result ) { handle_new_color(orig_color, orig_alpha); + window->lock_window("TitleColorButton::handle_done_event"); update_gui(orig_color); + window->unlock_window(); } } -- 2.26.2