cut with active speed auto correction, add locale pref, mod prores dft profile to...
authorGood Guy <[email protected]>
Sun, 9 Aug 2020 23:51:03 +0000 (17:51 -0600)
committerGood Guy <[email protected]>
Sun, 9 Aug 2020 23:51:03 +0000 (17:51 -0600)
15 files changed:
cinelerra-5.1/cinelerra/appearanceprefs.C
cinelerra-5.1/cinelerra/appearanceprefs.h
cinelerra-5.1/cinelerra/appearanceprefs.inc
cinelerra-5.1/cinelerra/edits.C
cinelerra-5.1/cinelerra/loadfile.C
cinelerra-5.1/cinelerra/main.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/preferences.C
cinelerra-5.1/cinelerra/preferences.h
cinelerra-5.1/cinelerra/preferences.inc
cinelerra-5.1/cinelerra/preferencesthread.C
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/track.h
cinelerra-5.1/cinelerra/trackcanvas.C
cinelerra-5.1/ffmpeg/video/prores.pro

index fc2ff08901b8bd0a07276012f83f6e853526f81d..435f70ad1bf6df6a54397e854a0f4ca2ee2ef3fd 100644 (file)
@@ -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,
index e96aca1b4d6e7eec29b3974cbbbf8a5b97e01421..fed29a98a314fcd2217c3aedf55526f0c58e0af0 100644 (file)
@@ -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:
index 5515b3fdc0af71938a739ce351ca2bb673f993b0..20c79101a9cd1adf452d40a5a9ad4cc0d7f1f7dc 100644 (file)
@@ -60,5 +60,6 @@ class YuvColorRange;
 class YuvColorRangeItem;
 class PerpetualSession;
 class Composer_BG_Color;
+class LayoutLocale;
 
 #endif
index a64024ada45ad77505b3b53905e823a04608a9ed..cec86c847d449255a2441fcd0fa8070becc54697 100644 (file)
@@ -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;
index dce124911df4b2bb5b5505ac84350b12940f407d..4867bd34db5fe2bdd588662373f63a237c8a4470 100644 (file)
@@ -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;
 }
 
index 8a4815f9eb32d469189a6e30fd963ce67b34e826..0def64b724aab1bc01c416d0bafc0aad3a04b3a9 100644 (file)
@@ -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();
 
index c85212701d68bb1f5e98bb00977958b274c52515..a8851d54484201d969ff15f72d49a11b402753a5 100644 (file)
@@ -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"));
index 4e739e85d8d4feb854ca767195ee51d90c1a9e37..f783fbfc8998eb60c2b513e89b1f2838861f6f55 100644 (file)
@@ -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);
 
index fd2304692a7039f573b8013e5363809329cdcd0c..dc6589819dd54af5dd9837b6560a9495fd650dde 100644 (file)
@@ -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;
index 6eb2939977b4fb8916a78cd8e5cd883e8f2e19ae..f941c1b8cbcb10d8efa73b223ff773d564813417 100644 (file)
@@ -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
index 4c9561b04e9014bba5f4e3d5763dfddc119750e6..52de4f5526a2888d8e8dd2341c709916f2c40339 100644 (file)
@@ -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 ||
index 9e86481c8df919e4d01f441b2a60ce8ff292368f..1cf0f69dbcd6a51c14251977759d64ca3445a189 100644 (file)
@@ -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;
 }
 
index a23f664806cd95ca6f7f284335d847103b17081e..32c6a8ec689e41a2bd25a8c6e129d129eeffcf69 100644 (file)
@@ -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
index c0f8f995d3453504ef4fc830c5cf9d55c7189e8a..40d87c9cba68013db58a48cef0ea2f2b8b15c4f0 100644 (file)
@@ -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 )
index e8e589bb7d37f50b6570a3a4243927e39e15b527..507586e70de9565495f49bea3349095bfde5e46f 100644 (file)
@@ -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