version update, chg shortcut for del last trk, ogg fixes/tweaks
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mwindow.C
index 78bc2bec395e56c3147ad3758565025fee45fa90..c959af278e7dd832f0a173c6ba3b8df2fe8b2a50 100644 (file)
 #include "wavecache.h"
 #include "wintv.h"
 #include "wwindow.h"
+#include "x10tv.h"
 #include "zoombar.h"
 #include "zwindow.h"
 #include "zwindowgui.h"
@@ -244,6 +245,7 @@ MWindow::MWindow()
        beeper = 0;
        shuttle = 0;
        wintv = 0;
+       x10tv = 0;
        mixers_align = 0;
 }
 
@@ -266,9 +268,14 @@ MWindow::~MWindow()
        delete beeper;
        delete create_bd;       create_bd = 0;
        delete create_dvd;      create_dvd = 0;
+#ifdef HAVE_SHUTTLE
        delete shuttle;         shuttle = 0;
+#endif
 #ifdef HAVE_WINTV
        delete wintv;           wintv = 0;
+#endif
+#ifdef HAVE_X10TV
+       delete x10tv;           x10tv = 0;
 #endif
        delete batch_render;    batch_render = 0;
        delete convert_render;  convert_render = 0;
@@ -670,6 +677,7 @@ int MWindow::init_plugins(MWindow *mwindow, Preferences *preferences)
 
 int MWindow::init_ladspa_plugins(MWindow *mwindow, Preferences *preferences)
 {
+#ifdef HAVE_LADSPA
        char *path = getenv("LADSPA_PATH");
        char ladspa_path[BCTEXTLEN];
        if( !path ) {
@@ -714,6 +722,7 @@ int MWindow::init_ladspa_plugins(MWindow *mwindow, Preferences *preferences)
                }
                fclose(fp);
        }
+#endif
        return 1;
 }
 
@@ -737,7 +746,7 @@ void MWindow::scan_plugin_index(MWindow *mwindow, Preferences *preferences, FILE
        char plugin_path[BCTEXTLEN];
        sprintf(plugin_path, "%s/%s", plug_dir, plug_path);
        FileSystem fs;
-       fs.set_filter( "[*.plugin][*.so]" );
+       fs.set_filter( "[*.plugin][*.so][*.dll]" );
        int result = fs.update(plugin_path);
        if( result || !fs.dir_list.total ) return;
        int vis_id = idx++;
@@ -1608,6 +1617,14 @@ void MWindow::init_wintv()
                wintv->start();
 #endif
 }
+void MWindow::init_x10tv()
+{
+#ifdef HAVE_X10TV
+       x10tv = X10TV::probe(this);
+       if( x10tv )
+               x10tv->start();
+#endif
+}
 
 
 void MWindow::init_brender()
@@ -2126,14 +2143,12 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__);
                        session->group_number += groups;
                        switch( edl_mode ) {
                        case LOADMODE_EDL_CLIP: {
-                               sprintf(new_edl->local_session->clip_title, _("Clip %d"),
-                                       session->clip_number++);
-                               char string[BCSTRLEN];
-                               time_t t;  time(&t);
-                               ctime_r(&t, string);
-                               snprintf(new_edl->local_session->clip_notes,
-                                       sizeof(new_edl->local_session->clip_notes),
-                                       +("%sFrom: %s"), string, filename);
+                               strcpy(new_edl->local_session->clip_title,
+                                       filenames->get(i));
+                                       struct stat st;
+                               time_t t = !stat(filenames->get(i),&st) ?
+                                               st.st_mtime : time(&t);
+                               ctime_r(&t, new_edl->local_session->clip_notes);
                                switch( load_mode ) {
                                case LOADMODE_REPLACE:
                                case LOADMODE_REPLACE_CONCATENATE:
@@ -2683,7 +2698,10 @@ void MWindow::create_objects(int want_gui,
        strcat(string, "/" FONT_SEARCHPATH);
        BC_Resources::init_fontconfig(string);
        if(debug) PRINT_TRACE
-       init_wintv();
+// use if plugged
+       init_x10tv();
+       if( !x10tv )
+               init_wintv();
 
 // Default project created here
        init_edl();
@@ -4108,6 +4126,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()
@@ -4135,8 +4154,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);
@@ -4148,15 +4167,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)
 {
@@ -4260,7 +4291,10 @@ void MWindow::save_project(const char *dir, int save_mode, int overwrite, int re
        char progress_title[BCTEXTLEN];
        sprintf(progress_title, _("Saving to %s:\n"), dir);
        int total_assets = save_edl->assets->total();
+       gui->lock_window("MWindow::save_project");
        MainProgressBar *progress = mainprogress->start_progress(progress_title, total_assets);
+       gui->unlock_window();
+
        int ret = 0;
        Asset *current = save_edl->assets->first;
        for( int i=0; !ret && current; ++i, current=NEXT ) {