fixes for vicons checkin
[goodguy/history.git] / cinelerra-5.0 / cinelerra / preferences.C
index dda8cc23873dc3ea00465da148b8cddc5840592c..670f1abd9592597043b23e99a1226e200cd26f27 100644 (file)
@@ -33,6 +33,7 @@
 #include "indexfile.h"
 #include "mutex.h"
 #include "preferences.h"
+#include "shbtnprefs.h"
 #include "theme.h"
 #include "videoconfig.h"
 #include "videodevice.inc"
@@ -50,8 +51,6 @@
 
 
 
-extern void get_exe_path(char *result);
-
 
 
 
@@ -71,12 +70,12 @@ Preferences::Preferences()
        sprintf(index_directory, BCASTDIR);
        if(strlen(index_directory))
                fs.complete_path(index_directory);
-       cache_size = 0xa00000;
-       index_size = 0x300000;
+       cache_size = 0x1000000;
+       index_size = 0x400000;
        index_count = 100;
        use_thumbnails = 1;
-       trap_sigsegv = 0;
-       trap_sigintr = 0;
+       trap_sigsegv = 1;
+       trap_sigintr = 1;
        theme[0] = 0;
        use_renderfarm = 0;
        force_uniprocessor = 0;
@@ -88,8 +87,8 @@ Preferences::Preferences()
        renderfarm_job_count = 20;
        processors = calculate_processors(0);
        real_processors = calculate_processors(1);
-       file_forking = 1;
        ffmpeg_early_probe = 0;
+       ffmpeg_marker_indecies = 1;
        warn_indecies = 1;
 
 // Default brender asset
@@ -125,6 +124,8 @@ Preferences::Preferences()
 Preferences::~Preferences()
 {
        brender_asset->Garbage::remove_user();
+       shbtn_prefs.remove_all_objects();
+       renderfarm_nodes.remove_all_objects();
        delete preferences_lock;
 }
 
@@ -180,14 +181,17 @@ void Preferences::copy_from(Preferences *that)
        android_remote = that->android_remote;
        android_port = that->android_port;
        strcpy(android_pin, that->android_pin);
+       this->shbtn_prefs.remove_all_objects();
+       for( int i=0; i<that->shbtn_prefs.size(); ++i )
+               this->shbtn_prefs.append(new ShBtnPref(*that->shbtn_prefs[i]));
        cache_size = that->cache_size;
        force_uniprocessor = that->force_uniprocessor;
        trap_sigsegv = that->trap_sigsegv;
        trap_sigintr = that->trap_sigintr;
        processors = that->processors;
        real_processors = that->real_processors;
-       file_forking = that->file_forking;
        ffmpeg_early_probe = that->ffmpeg_early_probe;
+       ffmpeg_marker_indecies = that->ffmpeg_marker_indecies;
        warn_indecies = that->warn_indecies;
        renderfarm_nodes.remove_all_objects();
        renderfarm_ports.remove_all();
@@ -337,10 +341,10 @@ int Preferences::load_defaults(BC_Hash *defaults)
 
 
 
-       force_uniprocessor = defaults->get("FORCE_UNIPROCESSOR", 0);
-       file_forking = defaults->get("FILE_FORKING", 1);
-       ffmpeg_early_probe = defaults->get("FFMPEG_EARLY_PROBE", 0);
-       warn_indecies = defaults->get("WARN_INDECIES", 1);
+       force_uniprocessor = defaults->get("FORCE_UNIPROCESSOR", force_uniprocessor);
+       ffmpeg_early_probe = defaults->get("FFMPEG_EARLY_PROBE", ffmpeg_early_probe);
+       ffmpeg_marker_indecies = defaults->get("FFMPEG_MARKER_INDECIES", ffmpeg_marker_indecies);
+       warn_indecies = defaults->get("WARN_INDECIES", warn_indecies);
        use_brender = defaults->get("USE_BRENDER", use_brender);
        brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment);
        cache_size = defaults->get("CACHE_SIZE", cache_size);
@@ -381,6 +385,24 @@ int Preferences::load_defaults(BC_Hash *defaults)
                }
        }
 
+       shbtn_prefs.remove_all_objects();
+       int shbtns_total = defaults->get("SHBTNS_TOTAL", -1);
+       if( shbtns_total < 0 ) {
+               shbtn_prefs.append(new ShBtnPref("manual", "firefox file:///$CINELERRA_PATH/manual.pdf", 0));
+               shbtn_prefs.append(new ShBtnPref("online help", "firefox http://cinelerra.org/help.php/", 0));
+               shbtns_total = 0;
+       }
+       for( int i=0; i<shbtns_total; ++i ) {
+               char name[BCTEXTLEN], commands[BCTEXTLEN];
+               sprintf(string, "SHBTN%d_NAME", i);
+               defaults->get(string, name);
+               sprintf(string, "SHBTN%d_COMMANDS", i);
+               defaults->get(string, commands);
+               sprintf(string, "SHBTN%d_WARN", i);
+               int warn = defaults->get(string, 0);
+               shbtn_prefs.append(new ShBtnPref(name, commands, warn));
+       }
+
 // Redo with the proper value of force_uniprocessor
        processors = calculate_processors(0);
        boundaries();
@@ -418,8 +440,8 @@ int Preferences::save_defaults(BC_Hash *defaults)
        }
 
        defaults->update("FORCE_UNIPROCESSOR", force_uniprocessor);
-       defaults->update("FILE_FORKING", file_forking);
        defaults->update("FFMPEG_EARLY_PROBE", ffmpeg_early_probe);
+       defaults->update("FFMPEG_MARKER_INDECIES", ffmpeg_marker_indecies);
        defaults->update("WARN_INDECIES", warn_indecies);
        brender_asset->save_defaults(defaults, 
                "BRENDER_",
@@ -451,6 +473,16 @@ int Preferences::save_defaults(BC_Hash *defaults)
                sprintf(string, "RENDERFARM_RATE%d", i);
                defaults->update(string, renderfarm_rate.values[i]);
        }
+       defaults->update("SHBTNS_TOTAL", shbtn_prefs.size());
+       for( int i=0; i<shbtn_prefs.size(); ++i ) {
+               ShBtnPref *pref = shbtn_prefs[i];
+               sprintf(string, "SHBTN%d_NAME", i);
+               defaults->update(string, pref->name);
+               sprintf(string, "SHBTN%d_COMMANDS", i);
+               defaults->update(string, pref->commands);
+               sprintf(string, "SHBTN%d_WARN", i);
+               defaults->update(string, pref->warn);
+       }
        return 0;
 }