add nested proxy path, rework perpetual session load/save strategy, build cleanups
authorGood Guy <[email protected]>
Mon, 13 Jan 2020 01:25:10 +0000 (18:25 -0700)
committerGood Guy <[email protected]>
Mon, 13 Jan 2020 01:25:10 +0000 (18:25 -0700)
14 files changed:
cinelerra-5.1/cinelerra/interfaceprefs.C
cinelerra-5.1/cinelerra/interfaceprefs.h
cinelerra-5.1/cinelerra/main.C
cinelerra-5.1/cinelerra/maskauto.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/mwindow.h
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/proxy.C
cinelerra-5.1/cinelerra/undostack.C
cinelerra-5.1/configure.ac
cinelerra-5.1/guicast/bctexture.C

index 9a861e68634f56a41eaa1738b4eae8f537f19208..593927e21e1ae1da974c9c2075b6dcb824081c7c 100644 (file)
@@ -62,7 +62,7 @@ InterfacePrefs::~InterfacePrefs()
 void InterfacePrefs::create_objects()
 {
        int xs4 = xS(4), xs5 = xS(5), xs10 = xS(10), xs30 = xS(30);
-       int ys5 = yS(5), ys10 = yS(10), ys20 = yS(20), ys30 = yS(30), ys35 = yS(35);
+       int ys5 = yS(5), ys10 = yS(10), ys30 = yS(30), ys35 = yS(35);
        BC_Resources *resources = BC_WindowBase::get_resources();
        int margin = mwindow->theme->widget_border;
        char string[BCTEXTLEN];
@@ -130,26 +130,35 @@ void InterfacePrefs::create_objects()
        AndroidRemote *android_remote = new AndroidRemote(pwindow, x2, y);
        add_subwindow(android_remote);
        y += android_remote->get_h() + ys10;
-       add_subwindow(title = new BC_Title(x2, y, _("Port:")));
-       int x3 = x2 + title->get_w() + margin;
+       int x3 = x2;
+       add_subwindow(title = new BC_Title(x3, y, _("Port:")));
+       x3 += title->get_w() + margin;
        AndroidPort *android_port = new AndroidPort(pwindow, x3, y);
        add_subwindow(android_port);
-       y += title->get_h() + ys10;
-       add_subwindow(title = new BC_Title(x2, y, _("PIN:")));
+       x3 += android_port->get_w() + 2*margin;
+       add_subwindow(title = new BC_Title(x3, y, _("PIN:")));
+       x3 += title->get_w() + margin;
        AndroidPIN *android_pin = new AndroidPIN(pwindow, x3, y);
        add_subwindow(android_pin);
-       y += title->get_h() + ys20;
+       y += android_port->get_h() + 3*margin;
 
        ShBtnPrefs *shbtn_prefs = new ShBtnPrefs(pwindow, this, x2, y);
        add_subwindow(shbtn_prefs);
-       y += shbtn_prefs->get_h() + ys20;
+       x3 = x2 + shbtn_prefs->get_w() + 2*margin;
+       add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x3, y));
+       y += reload_plugins->get_h() + 3*margin;
 
-       add_subwindow(reload_plugins = new PrefsReloadPlugins(pwindow, this, x2, y));
-       y += reload_plugins->get_h() + ys10;
+       add_subwindow(title = new BC_Title(x2, y, _("Nested Proxy Path:")));
+       y += title->get_h() + ys10;
+       PrefsNestedProxyPath *nested_proxy_path = new PrefsNestedProxyPath(pwindow, this,
+                       x2, y, get_w()-x2-xs30);
+       add_subwindow(nested_proxy_path);
+       y += xs30;
 
        add_subwindow(title = new BC_Title(x2, y, _("Default LV2_PATH:")));
        y += title->get_h() + ys10;
-       PrefsLV2PathText *lv2_path_text = new PrefsLV2PathText(pwindow, this, x2, y, get_w()-x2-xs30);
+       PrefsLV2PathText *lv2_path_text = new PrefsLV2PathText(pwindow, this,
+                       x2, y, get_w()-x2-xs30);
        add_subwindow(lv2_path_text);
        y += xs30;
 
@@ -422,7 +431,7 @@ int AndroidRemote::handle_event()
 }
 
 AndroidPIN::AndroidPIN(PreferencesWindow *pwindow, int x, int y)
- : BC_TextBox(x, y, xS(240), 1, pwindow->thread->preferences->android_pin)
+ : BC_TextBox(x, y, xS(180), 1, pwindow->thread->preferences->android_pin)
 {
        this->pwindow = pwindow;
 }
@@ -685,3 +694,21 @@ int PrefsLV2PathText::handle_event()
        return 1;
 }
 
+PrefsNestedProxyPath::PrefsNestedProxyPath(PreferencesWindow *pwindow,
+       InterfacePrefs *subwindow, int x, int y, int w)
+ : BC_TextBox(x, y, w, 1, pwindow->thread->preferences->nested_proxy_path)
+{
+       this->pwindow = pwindow;
+       this->subwindow = subwindow;
+}
+
+PrefsNestedProxyPath::~PrefsNestedProxyPath()
+{
+}
+
+int PrefsNestedProxyPath::handle_event()
+{
+       strcpy(pwindow->thread->preferences->nested_proxy_path, get_text());
+       return 1;
+}
+
index 7a890fb99304bf696ec9e3ff37c7a8df6cedc078..5813fe6508f1c5a206a0bbb7ce2e4776ba3b673a 100644 (file)
@@ -308,6 +308,18 @@ public:
        InterfacePrefs *subwindow;
 };
 
+class PrefsNestedProxyPath : public BC_TextBox
+{
+public:
+       PrefsNestedProxyPath(PreferencesWindow *pwindow,
+               InterfacePrefs *subwindow, int x, int y, int w);
+       ~PrefsNestedProxyPath();
+
+       int handle_event();
+       PreferencesWindow *pwindow;
+       InterfacePrefs *subwindow;
+};
+
 class PrefsReloadPlugins : public BC_GenericButton
 {
 public:
index 42207c557b05bad7ef99ee0fa27aa7c16079adf2..8a4815f9eb32d469189a6e30fd963ce67b34e826 100644 (file)
@@ -363,7 +363,7 @@ int main(int argc, char *argv[])
                                MWindow mwindow;
                                mwindow.create_objects(1, !filenames.total, config_path);
                                CommandLineThread *thread  = 0;
-                               if( mwindow.preferences->perpetual_session && load_perpetual )
+                               if( load_perpetual )
                                        mwindow.load_undo_data();
 //SET_TRACE
 // load the initial files on seperate tracks
@@ -399,8 +399,7 @@ int main(int argc, char *argv[])
                                        done = 1;
 
                                mwindow.save_defaults();
-                               if( mwindow.preferences->perpetual_session )
-                                       mwindow.save_undo_data();
+                               mwindow.save_undo_data();
 //PRINT_TRACE
                                filenames.remove_all_objects();
                                delete thread;
index 1d3e982197497d701fbb54020f99377f5db0e2e9..47fb3f4291a97e1845b90e3f2a5092b4d9e61e4b 100644 (file)
@@ -100,7 +100,7 @@ void SubMask::copy_from(SubMask& ptr, int do_name)
 {
        if( do_name ) {
                memset(name, 0, sizeof(name));
-               strncpy(name, ptr.name, sizeof(name-1));
+               strncpy(name, ptr.name, sizeof(name)-1);
        }
        fader = ptr.fader;
        feather = ptr.feather;
index cf9988903e223b44a15faf73eb77086f701cd79e..bd75cbbac482ef4196b6bce9407d31febefdb27c 100644 (file)
@@ -4124,6 +4124,7 @@ void MWindow::save_backup()
                sprintf(string2, _("Couldn't open %s for writing."), backup_path);
                gui->show_message(string2);
        }
+       save_undo_data();
 }
 
 void MWindow::load_backup()
@@ -4151,8 +4152,8 @@ void MWindow::load_backup()
 
 void MWindow::save_undo_data()
 {
-       undo_before();
-       undo_after(_("perpetual session"), LOAD_ALL);
+       if( stack.size() > 0 ) return;
+       if( !preferences->perpetual_session ) return;
        char perpetual_path[BCTEXTLEN];
        snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
                File::get_config_path(), PERPETUAL_FILE);
@@ -4164,15 +4165,27 @@ void MWindow::save_undo_data()
 
 void MWindow::load_undo_data()
 {
+       if( stack.size() > 0 ) return;
+       if( !preferences->perpetual_session ) return;
        char perpetual_path[BCTEXTLEN];
        snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
                File::get_config_path(), PERPETUAL_FILE);
        FILE *fp = fopen(perpetual_path,"r");
        if( !fp ) return;
        undo->load(fp);
+       undo_before();
+       undo_after(_("perpetual load"), LOAD_ALL);
        fclose(fp);
 }
 
+void MWindow::remove_undo_data()
+{
+       if( stack.size() > 0 ) return;
+       char perpetual_path[BCTEXTLEN];
+       snprintf(perpetual_path, sizeof(perpetual_path), "%s/%s",
+               File::get_config_path(), PERPETUAL_FILE);
+       ::remove(perpetual_path);
+}
 
 int MWindow::copy_target(const char *path, const char *target)
 {
index afbf356471ead585b07cc91929f5391c918d7792..c35d62babae47154ac10316a372e39d464792cf6 100644 (file)
@@ -549,6 +549,7 @@ public:
        void redo_entry(BC_WindowBase *calling_window_gui);
        void save_undo_data();
        void load_undo_data();
+       void remove_undo_data();
        int copy_target(const char *path, const char *target);
        int link_target(const char *real_path, const char *link_path, int relative);
        void save_project(const char *dir, int save_mode, int overwrite, int reload);
index 30a99ca3fb46f704f690a14041b8b00924263efd..ba69bd48cb2245bc461976b84764440e7e4605fb 100644 (file)
@@ -65,6 +65,7 @@ Preferences::Preferences()
        keyframe_reticle = HAIRLINE_DRAGGING;
        perpetual_session = 0;
        strcpy(lv2_path, DEFAULT_LV2_PATH);
+       strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH);
        autostart_lv2ui = 0;
        trap_sigsegv = 1;
        trap_sigintr = 1;
@@ -206,6 +207,7 @@ void Preferences::copy_from(Preferences *that)
        force_uniprocessor = that->force_uniprocessor;
        strcpy(lv2_path, that->lv2_path);
        autostart_lv2ui = that->autostart_lv2ui;
+       strcpy(nested_proxy_path, that->nested_proxy_path);
        trap_sigsegv = that->trap_sigsegv;
        trap_sigintr = that->trap_sigintr;
        processors = that->processors;
@@ -330,6 +332,8 @@ int Preferences::load_defaults(BC_Hash *defaults)
        strcpy(lv2_path, DEFAULT_LV2_PATH);
        defaults->get("LV2_PATH", lv2_path);
        autostart_lv2ui = defaults->get("AUTOSTART_LV2UI", autostart_lv2ui);
+       strcpy(nested_proxy_path, DEFAULT_NESTED_PROXY_PATH);
+       defaults->get("NESTED_PROXY_PATH", nested_proxy_path);
        trap_sigsegv = defaults->get("TRAP_SIGSEGV", trap_sigsegv);
        trap_sigintr = defaults->get("TRAP_SIGINTR", trap_sigintr);
 
@@ -482,6 +486,7 @@ int Preferences::save_defaults(BC_Hash *defaults)
        defaults->update("PERPETUAL_SESSION", perpetual_session);
        defaults->update("LV2_PATH", lv2_path);
        defaults->update("AUTOSTART_LV2UI", autostart_lv2ui);
+       defaults->update("NESTED_PROXY_PATH", nested_proxy_path);
        defaults->update("TRAP_SIGSEGV", trap_sigsegv);
        defaults->update("TRAP_SIGINTR", trap_sigintr);
        defaults->update("AWINDOW_PICON_H", awindow_picon_h);
index 3b46f5f9a79cfcbbae0feb38510843005209ec7f..f20a791be9ef9efcd9eeeb7a8164c70be6711f85 100644 (file)
@@ -189,6 +189,7 @@ public:
        char plugin_dir[BCTEXTLEN];
        char lv2_path[BCTEXTLEN];
        int autostart_lv2ui;
+       char nested_proxy_path[BCTEXTLEN];
 
 // Required when updating renderfarm rates
        Mutex *preferences_lock;
index 0d6e53302be21286c58bc59d233de38e57165ac1..5cf159031261c1fe9c1903da72d1a7a331dcdcb1 100644 (file)
@@ -31,6 +31,7 @@
 #define LAYOUT_NAME_LEN 8
 #define LAYOUTS_MAX 4
 #define DEFAULT_LV2_PATH CINDAT_DIR "/lv2"
+#define DEFAULT_NESTED_PROXY_PATH NESTED_DIR
 #define FFMPEG_EARLY_TIP _("Currently: Try FFMpeg first\n   Click to: Try FFMpeg last")
 #define FFMPEG_LATE_TIP  _("Currently: Try FFMpeg last\n   Click to: Try FFMpeg first")
 
index e4f050be1d2ff4b7919ca8106e5a0eeb0a32e9f1..4c9561b04e9014bba5f4e3d5763dfddc119750e6 100644 (file)
@@ -251,6 +251,9 @@ int PreferencesThread::apply_settings()
                mwindow->restart_status = -1;
        }
 
+       if( mwindow->preferences->perpetual_session && !preferences->perpetual_session )
+               mwindow->remove_undo_data();
+
        mwindow->edl->copy_session(edl, 1);
        mwindow->update_preferences(preferences);
 
index 3165ad0ec8c3ced9724e486bb69e2ff6f1854d86..edeb394ac0fe4d61595045117dfd8b4cb5500289 100644 (file)
@@ -195,7 +195,16 @@ void ProxyRender::to_proxy_path(char *new_path, Indexable *indexable, int scale)
 {
 // path is already a proxy
        if( strstr(indexable->path, ".proxy") ) return;
-       strcpy(new_path, indexable->path);
+       if( !indexable->is_asset ) {
+               char *ifn = indexable->path, *cp = strrchr(ifn, '/');
+               if( cp ) ifn = cp+1;
+               char proxy_path[BCTEXTLEN];
+               File::getenv_path(proxy_path,
+                       mwindow->preferences->nested_proxy_path);
+               sprintf(new_path, "%s/%s", proxy_path, ifn);
+       }
+       else
+               strcpy(new_path, indexable->path);
        char prxy[BCSTRLEN];
        int n = sprintf(prxy, ".proxy%d", scale);
 // insert proxy, path.sfx => path.proxy#-sfx.ext
@@ -265,8 +274,18 @@ Asset *ProxyRender::add_original(Indexable *idxbl, int new_scale)
        if( strstr(idxbl->path,".proxy") ) return 0;
        char new_path[BCTEXTLEN];
        to_proxy_path(new_path, idxbl, new_scale);
-// don't proxy if not readable
+// don't proxy if not readable, or proxy_path not writable
        if( idxbl->is_asset && access(idxbl->path, R_OK) ) return 0;
+       int ret = access(new_path, W_OK);
+       if( ret ) {
+               int fd = ::open(new_path,O_WRONLY);
+               if( fd < 0 ) fd = open(new_path,O_WRONLY+O_CREAT,0666);
+               if( fd >= 0 ) { close(fd);  ret = 0; }
+       }
+       if( ret ) {
+               eprintf(_("bad proxy path: %s\n"), new_path);
+               return 0;
+       }
 // add to orig_idxbls & orig_proxies if it isn't already there.
        int got_it = 0;
        for( int i = 0; !got_it && i<orig_proxies.size(); ++i )
index 23f33bc193148fadc237dc9ed85d8e8133429778..e0de195c01bf3f63f206691a50a82a3358666ec4 100644 (file)
@@ -59,7 +59,7 @@ UndoStackItem *UndoStack::get_current_redo()
 UndoStackItem* UndoStack::push()
 {
 // delete oldest 2 undos if necessary
-       if( total() > UNDOLEVELS ) {
+       while( total() > UNDOLEVELS ) {
                UndoStackItem *item = first, *key = item;
 #ifdef UNDO_INCREMENTAL
                for( int i=2; --i>=0; item=item->next );
index 5067c68181fd0d1f0d71ae4523b73d5ff89bb2c0..92688079b26211e85a0b103da1b53f9ad6e97bf7 100644 (file)
@@ -48,6 +48,7 @@ CHECK_WITH([cindat],[cinelerra share path],[CINDAT_DIR],[auto])
 CHECK_WITH([plugin-dir],[plugin install dir],[PLUGIN_DIR],[auto])
 CHECK_WITH([ladspa-dir],[ladspa install dir],[LADSPA_DIR],[auto])
 CHECK_WITH([config-dir],[.bcast config dir],[CONFIG_DIR],[$$HOME/.bcast5])
+CHECK_WITH([nested-dir],[nested proxy dir],[NESTED_DIR],[$$HOME/Videos])
 CHECK_WITH([browser],[cin_browser path],[CIN_BROWSER],[firefox])
 CHECK_WITH([git-ffmpeg],[git ffmpeg using url],[GIT_FFMPEG],[no])
 CHECK_WITH([noelision],[use noelision/libpthread],[NOELISION],[auto])
@@ -748,8 +749,9 @@ EXROStream() : Imf::OStream("mypath") {} };
 ]])], [HAVE_OPENEXR=yes], [HAVE_OPENEXR=no])
  RESULT="$HAVE_OPENEXR"
  if test "x$RESULT" = "xyes"; then
-   SHARED_openexr="$LIBS"
-   CFG_CFLAGS+=" -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
+  SHARED_openexr="$LIBS"
+  SHARED_LIBS+=" $LIBS"
+  CFG_CFLAGS+=" -I/usr/include/OpenEXR -I/usr/local/include/OpenEXR"
  fi
  LIBS="$saved_LIBS"
  CXXFLAGS="$saved_CXXFLAGS"
@@ -966,6 +968,7 @@ echo "  using: exec-name = $WANT_CIN"
 echo "  using: with-cinlib = $WANT_CINLIB_DIR"
 echo "  using: with-cindat = $WANT_CINDAT_DIR"
 echo "  using: with-config-dir = $WANT_CONFIG_DIR"
+echo "  using: with-nested-dir = $WANT_NESTED_DIR"
 echo "  using: with-browser = $WANT_CIN_BROWSER"
 echo "  using: with-plugin-dir = $WANT_PLUGIN_DIR"
 echo "  using: with-ladspa-dir = $WANT_LADSPA_DIR"
@@ -1049,6 +1052,7 @@ echo "CFLAGS += '-DCIN=\"\$(WANT_CIN)\"'"
 echo "CFLAGS += '-DCINLIB_DIR=\"$WANT_CINLIB_DIR\"'"
 echo "CFLAGS += '-DCINDAT_DIR=\"$WANT_CINDAT_DIR\"'"
 echo "CFLAGS += '-DCONFIG_DIR=\"$WANT_CONFIG_DIR\"'"
+echo "CFLAGS += '-DNESTED_DIR=\"$WANT_NESTED_DIR\"'"
 echo "CFLAGS += '-DPLUGIN_DIR=\"$WANT_PLUGIN_DIR\"'"
 echo "CFLAGS += '-DLOCALE_DIR=\"$WANT_LOCALE_DIR\"'"
 echo "CFLAGS += '-DLADSPA_DIR=\"$WANT_LADSPA_DIR\"'"
index 52787e1a527fb45e546c1b98213fac8a149d47ce..e3eda5fa407fe4de9e5d8c2d26742fad9cb95872 100644 (file)
@@ -249,7 +249,7 @@ void BC_Texture::write_tex(const char *fn, int id)
        uint8_t *img = new uint8_t[w*h*3];
        glGetTexImage(GL_TEXTURE_2D, 0, GL_RGB, GL_UNSIGNED_BYTE, img);
        write_ppm(img, w, h, "%s", fn);
-       delete img;
+       delete [] img;
        glActiveTexture(prev_id);
 #endif
 }