From: Good Guy Date: Sun, 9 Aug 2020 23:51:03 +0000 (-0600) Subject: cut with active speed auto correction, add locale pref, mod prores dft profile to... X-Git-Tag: 2020-08~6 X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=a6fa7638ac79011ab3188e1f4120680c641cca52;p=goodguy%2Fcinelerra.git cut with active speed auto correction, add locale pref, mod prores dft profile to hq, change loadmode default to replace, tweak click operation defaults --- diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.C b/cinelerra-5.1/cinelerra/appearanceprefs.C index fc2ff089..435f70ad 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.C +++ b/cinelerra-5.1/cinelerra/appearanceprefs.C @@ -94,7 +94,12 @@ void AppearancePrefs::create_objects() add_subwindow(new BC_Title(x, y, _("Plugin Icons:"))); add_subwindow(plugin_icons = new ViewPluginIcons(x1, y, pwindow)); plugin_icons->create_objects(); - y += plugin_icons->get_h() + ys15; + y += plugin_icons->get_h() + ys10; + add_subwindow(new BC_Title(x, y, _("Locale:"))); + LayoutLocale *layout_locale; + add_subwindow(layout_locale = new LayoutLocale(x1, y, pwindow)); + layout_locale->create_objects(); + y += layout_locale->get_h() + ys15; x1 = get_w()/2; int x2 = x1 + xS(160), y2 = y; @@ -462,6 +467,42 @@ int ViewPluginIconItem::handle_event() return 1; } +LayoutLocale::LayoutLocale(int x, int y, PreferencesWindow *pwindow) + : BC_PopupMenu(x, y, xS(200), pwindow->thread->preferences->locale, 1) +{ + this->pwindow = pwindow; +} +LayoutLocale::~LayoutLocale() +{ +} + +const char *LayoutLocale::locale_list[] = { LOCALE_LIST, 0 }; + +void LayoutLocale::create_objects() +{ + for( const char *tp, **lp=locale_list; (tp=*lp)!=0; ++lp ) + add_item(new LayoutLocaleItem(this, tp)); +} + +int LayoutLocale::handle_event() +{ + return 1; +} + +LayoutLocaleItem::LayoutLocaleItem(LayoutLocale *popup, const char *text) + : BC_MenuItem(text) +{ + this->popup = popup; +} + +int LayoutLocaleItem::handle_event() +{ + popup->set_text(get_text()); + strcpy(popup->pwindow->thread->preferences->locale, get_text()); + popup->handle_event(); + return 1; +} + ViewLayoutScale::ViewLayoutScale(PreferencesWindow *pwindow, AppearancePrefs *aprefs, int x, int y) : BC_TumbleTextBox(aprefs, diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.h b/cinelerra-5.1/cinelerra/appearanceprefs.h index e96aca1b..fed29a98 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.h +++ b/cinelerra-5.1/cinelerra/appearanceprefs.h @@ -181,6 +181,27 @@ public: ViewPluginIcons *popup; }; +class LayoutLocale : public BC_PopupMenu +{ + static const char *locale_list[]; +public: + LayoutLocale(int x, int y, PreferencesWindow *pwindow); + ~LayoutLocale(); + + void create_objects(); + int handle_event(); + + PreferencesWindow *pwindow; +}; + +class LayoutLocaleItem : public BC_MenuItem +{ +public: + LayoutLocaleItem(LayoutLocale *popup, const char *text); + int handle_event(); + LayoutLocale *popup; +}; + class ViewLayoutScale : public BC_TumbleTextBox { public: diff --git a/cinelerra-5.1/cinelerra/appearanceprefs.inc b/cinelerra-5.1/cinelerra/appearanceprefs.inc index 5515b3fd..20c79101 100644 --- a/cinelerra-5.1/cinelerra/appearanceprefs.inc +++ b/cinelerra-5.1/cinelerra/appearanceprefs.inc @@ -60,5 +60,6 @@ class YuvColorRange; class YuvColorRangeItem; class PerpetualSession; class Composer_BG_Color; +class LayoutLocale; #endif diff --git a/cinelerra-5.1/cinelerra/edits.C b/cinelerra-5.1/cinelerra/edits.C index a64024ad..cec86c84 100644 --- a/cinelerra-5.1/cinelerra/edits.C +++ b/cinelerra-5.1/cinelerra/edits.C @@ -255,7 +255,9 @@ Edit* Edits::split_edit(int64_t position) new_edit->hard_left = edit->hard_right = 0; } new_edit->startproject = position; - new_edit->startsource += edit->length; + int64_t edit_start = edit->startproject; + int64_t edit_end = edit_start + edit->length; + new_edit->startsource += track->speed_length(edit_start, edit_end); // Decide what to do with the transition if(edit->length && edit->transition) { @@ -629,7 +631,7 @@ void Edits::clear(int64_t start, int64_t end) //printf("Edits::clear 3.5 %d %d %d %d\n", edit1->startproject, edit1->length, edit2->startproject, edit2->length); edit1->length = start - edit1->startproject; edit2->length -= end - edit2->startproject; - edit2->startsource += end - edit2->startproject; + edit2->startsource += track->speed_length(edit2->startproject, end); edit2->startproject += end - edit2->startproject; // delete @@ -649,7 +651,7 @@ void Edits::clear(int64_t start, int64_t end) current_edit = split_edit(start); if( current_edit ) { current_edit->length -= end - start; - current_edit->startsource += end - start; + current_edit->startsource += track->speed_length(start, end); // shift while( (current_edit=current_edit->next) != 0 ) { current_edit->startproject -= end - start; diff --git a/cinelerra-5.1/cinelerra/loadfile.C b/cinelerra-5.1/cinelerra/loadfile.C index dce12491..4867bd34 100644 --- a/cinelerra-5.1/cinelerra/loadfile.C +++ b/cinelerra-5.1/cinelerra/loadfile.C @@ -80,7 +80,7 @@ LoadFileThread::LoadFileThread(MWindow *mwindow, Load *load) this->mwindow = mwindow; this->load = load; this->window = 0; - load_mode = LOADMODE_REPLACE; + load_mode = LOADMODE_RESOURCESONLY; edl_mode = LOADMODE_EDL_CLIP; } diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 8a4815f9..0def64b7 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -22,6 +22,7 @@ #include "arraylist.h" #include "batchrender.h" #include "bcsignals.h" +#include "cstrdup.h" #include "edl.h" #include "file.h" #include "filexml.h" @@ -167,7 +168,8 @@ int main(int argc, char *argv[]) batch_path[0] = 0; deamon_path[0] = 0; Units::init(); - + const char *lang = getenv("LANGUAGE"); + if( lang ) lang = cstrdup(lang); File::init_cin_path(); const char *locale_path = File::get_locale_path(); const char *cin = File::get_cin(); @@ -397,7 +399,6 @@ int main(int argc, char *argv[]) } if( restart <= 0 ) done = 1; - mwindow.save_defaults(); mwindow.save_undo_data(); //PRINT_TRACE @@ -406,6 +407,10 @@ int main(int argc, char *argv[]) } if( restart < 0 ) { + if( lang ) // reset to cmdline state + setenv("LANGUAGE", lang, 1); + else + unsetenv("LANGUAGE"); char exe_path[BCTEXTLEN]; int len = readlink("/proc/self/exe", exe_path, sizeof(exe_path)-1); if( len < 0 ) break; @@ -423,6 +428,7 @@ DISABLE_BUFFER } filenames.remove_all_objects(); + delete [] lang; Units::finit(); BC_WindowBase::finit_resources(); diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index c8521270..a8851d54 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -506,6 +506,13 @@ void MWindow::init_defaults(BC_Hash* &defaults, char *config_path) void MWindow::check_language() { + char pref_locale[BCSTRLEN]; + strcpy(pref_locale, DEFAULT_LOCALE); + defaults->get("LOCALE",pref_locale); +// set LANGUAGE if pref locale != sys + if( strcmp(pref_locale, DEFAULT_LOCALE) ) + setenv("LANGUAGE", pref_locale, 1); + char curr_lang[BCTEXTLEN]; curr_lang[0] = 0; const char *env_lang = getenv("LANGUAGE"); if( !env_lang ) env_lang = getenv("LC_ALL"); @@ -2673,12 +2680,12 @@ void MWindow::create_objects(int want_gui, init_3d(); if(debug) PRINT_TRACE - show_splash(); if(debug) PRINT_TRACE default_standard = default_std(); init_defaults(defaults, config_path); check_language(); + show_splash(); init_preferences(); if(splash_window) splash_window->update_status(_("Initializing Plugins")); diff --git a/cinelerra-5.1/cinelerra/preferences.C b/cinelerra-5.1/cinelerra/preferences.C index 4e739e85..f783fbfc 100644 --- a/cinelerra-5.1/cinelerra/preferences.C +++ b/cinelerra-5.1/cinelerra/preferences.C @@ -74,6 +74,7 @@ Preferences::Preferences() vicon_size = 50; vicon_color_mode = VICON_COLOR_MODE_LOW; theme[0] = 0; + strcpy(locale, DEFAULT_LOCALE); plugin_icons[0] = 0; strcpy(snapshot_path, DEFAULT_SNAPSHOT_PATH); use_renderfarm = 0; @@ -96,7 +97,7 @@ Preferences::Preferences() bd_warn_root = 1; popupmenu_btnup = 1; grab_input_focus = 1; - textbox_focus_policy = 0; + textbox_focus_policy = CLICK_ACTIVATE | CLICK_DEACTIVATE; auto_rotate = 1; forward_render_displacement = 0; dvd_yuv420p_interlace = 0; @@ -104,7 +105,7 @@ Preferences::Preferences() yuv_color_space = BC_COLORS_BT601; yuv_color_range = BC_COLORS_JPEG; autocolor_assets = 0; - ctrl_toggle = 0; + ctrl_toggle = 1; rectify_audio = 0; // Default brender asset @@ -189,6 +190,7 @@ void Preferences::copy_from(Preferences *that) vicon_size = that->vicon_size; vicon_color_mode = that->vicon_color_mode; strcpy(theme, that->theme); + strcpy(locale, that->locale); strcpy(plugin_icons, that->plugin_icons); strcpy(snapshot_path, that->snapshot_path); @@ -344,8 +346,10 @@ int Preferences::load_defaults(BC_Hash *defaults) vicon_size = defaults->get("VICON_SIZE",vicon_size); vicon_color_mode = defaults->get("VICON_COLOR_MODE",vicon_color_mode); strcpy(theme, _(DEFAULT_THEME)); + strcpy(locale, DEFAULT_LOCALE); strcpy(plugin_icons, DEFAULT_PICON); defaults->get("THEME", theme); + defaults->get("LOCALE", locale); defaults->get("PLUGIN_ICONS", plugin_icons); strcpy(snapshot_path, DEFAULT_SNAPSHOT_PATH); defaults->get("SNAPSHOT_PATH", snapshot_path); @@ -497,6 +501,7 @@ int Preferences::save_defaults(BC_Hash *defaults) defaults->update("VICON_SIZE",vicon_size); defaults->update("VICON_COLOR_MODE",vicon_color_mode); defaults->update("THEME", theme); + defaults->update("LOCALE", locale); defaults->update("PLUGIN_ICONS", plugin_icons); defaults->update("SNAPSHOT_PATH", snapshot_path); diff --git a/cinelerra-5.1/cinelerra/preferences.h b/cinelerra-5.1/cinelerra/preferences.h index fd230469..dc658981 100644 --- a/cinelerra-5.1/cinelerra/preferences.h +++ b/cinelerra-5.1/cinelerra/preferences.h @@ -97,9 +97,10 @@ public: int vicon_size, vicon_color_mode; float layout_scale; // Title of theme - char theme[BCTEXTLEN]; + char theme[BCSTRLEN]; + char locale[BCSTRLEN]; // plugin icon set - char plugin_icons[BCTEXTLEN]; + char plugin_icons[BCSTRLEN]; // snapshot directory path char snapshot_path[BCTEXTLEN]; double render_preroll; diff --git a/cinelerra-5.1/cinelerra/preferences.inc b/cinelerra-5.1/cinelerra/preferences.inc index 6eb29399..f941c1b8 100644 --- a/cinelerra-5.1/cinelerra/preferences.inc +++ b/cinelerra-5.1/cinelerra/preferences.inc @@ -30,6 +30,8 @@ #define LAYOUT_FILE "layout%d_rc" #define LAYOUT_NAME_LEN 8 #define LAYOUTS_MAX 4 +#define DEFAULT_LOCALE "sys" +#define LOCALE_LIST DEFAULT_LOCALE, "en", "fr", "de", "ru", "es", "it", "nb" #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2" #define DEFAULT_NESTED_PROXY_PATH NESTED_DIR #define DEFAULT_SNAPSHOT_PATH SNAP_DIR diff --git a/cinelerra-5.1/cinelerra/preferencesthread.C b/cinelerra-5.1/cinelerra/preferencesthread.C index 4c9561b0..52de4f55 100644 --- a/cinelerra-5.1/cinelerra/preferencesthread.C +++ b/cinelerra-5.1/cinelerra/preferencesthread.C @@ -237,6 +237,7 @@ int PreferencesThread::apply_settings() if( window ) window->lock_window("PreferencesThread::apply_settings 5"); if( strcmp(preferences->theme, mwindow->preferences->theme) || + strcmp(preferences->locale, mwindow->preferences->locale) || strcmp(preferences->plugin_icons, mwindow->preferences->plugin_icons) || preferences->awindow_picon_h != mwindow->preferences->awindow_picon_h || preferences->layout_scale != mwindow->preferences->layout_scale || diff --git a/cinelerra-5.1/cinelerra/track.C b/cinelerra-5.1/cinelerra/track.C index 9e86481c..1cf0f69d 100644 --- a/cinelerra-5.1/cinelerra/track.C +++ b/cinelerra-5.1/cinelerra/track.C @@ -271,6 +271,13 @@ int Track::has_speed() return 0; } +int64_t Track::speed_length(int64_t start, int64_t end) +{ + if( !has_speed() ) return end - start; + FloatAutos *speeds = (FloatAutos *) automation->autos[AUTOMATION_SPEED]; + return speeds->automation_integral(start, end-start, PLAY_FORWARD); +} + int Track::show_assets() { return expand_view || edl->session->show_assets ? 1 : 0; @@ -1055,6 +1062,8 @@ int Track::clear(int64_t start, int64_t end, int edit_edits, int edit_labels, int edit_plugins, int edit_autos, Edits *trim_edits) { + if( edit_edits ) + edits->clear(start, end); //printf("Track::clear 1 %d %d %d\n", edit_edits, edit_labels, edit_plugins); if( edit_autos ) automation->clear(start, end, 0, 1); @@ -1065,8 +1074,6 @@ int Track::clear(int64_t start, int64_t end, plugin_set.values[i]->clear(start, end, edit_keyframes); } } - if( edit_edits ) - edits->clear(start, end); return 0; } diff --git a/cinelerra-5.1/cinelerra/track.h b/cinelerra-5.1/cinelerra/track.h index a23f6648..32c6a8ec 100644 --- a/cinelerra-5.1/cinelerra/track.h +++ b/cinelerra-5.1/cinelerra/track.h @@ -91,6 +91,8 @@ public: // Speed curve in use int has_speed(); +// length when speed is applied + int64_t speed_length(int64_t start, int64_t end); // Get length of track in seconds double get_length(); // Get dimensions of source for convenience functions diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index c0f8f995..40d87c9c 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -1981,7 +1981,10 @@ void TrackCanvas::draw_drag_handle() idxbl->get_audio_samples() : edit->track->data_type == TRACK_VIDEO ? idxbl->get_video_frames() : -1; - if( edit->startsource + edit->length >= source_len ) + int64_t speed_start = edit->startproject; + int64_t speed_end = speed_start + edit->length; + int64_t speed_length = track->speed_length(speed_start, speed_end); + if( edit->startsource + speed_length >= source_len ) can_drag = 0; } else if( !edit->startsource ) diff --git a/cinelerra-5.1/ffmpeg/video/prores.pro b/cinelerra-5.1/ffmpeg/video/prores.pro index e8e589bb..507586e7 100644 --- a/cinelerra-5.1/ffmpeg/video/prores.pro +++ b/cinelerra-5.1/ffmpeg/video/prores.pro @@ -1,6 +1,6 @@ mov prores # ProRes, encoder prores_aw. Container Apple QuickTime movie (.mov). -profile=2 +profile=3 # The possible video profile values for the ProRes codec are: # 5 = 4444xq # 4 = 4444