add bluray support, add dialog close fixes, scale fix
[goodguy/history.git] / cinelerra-5.0 / cinelerra / preferences.C
index afdcb50ed26a0c9f746cb2809a341b531d7e9455..0a8d33748ab8607d05a0726ee1516adb52cffe85 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);
-
 
 
 
@@ -90,6 +89,7 @@ Preferences::Preferences()
        real_processors = calculate_processors(1);
        file_forking = 1;
        ffmpeg_early_probe = 0;
+       warn_indecies = 1;
 
 // Default brender asset
        brender_asset = new Asset;
@@ -179,6 +179,9 @@ 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;
@@ -187,6 +190,7 @@ void Preferences::copy_from(Preferences *that)
        real_processors = that->real_processors;
        file_forking = that->file_forking;
        ffmpeg_early_probe = that->ffmpeg_early_probe;
+       warn_indecies = that->warn_indecies;
        renderfarm_nodes.remove_all_objects();
        renderfarm_ports.remove_all();
        renderfarm_enabled.remove_all();
@@ -338,6 +342,7 @@ 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);
        use_brender = defaults->get("USE_BRENDER", use_brender);
        brender_fragment = defaults->get("BRENDER_FRAGMENT", brender_fragment);
        cache_size = defaults->get("CACHE_SIZE", cache_size);
@@ -378,6 +383,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();
@@ -417,6 +440,7 @@ 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("WARN_INDECIES", warn_indecies);
        brender_asset->save_defaults(defaults, 
                "BRENDER_",
                1,
@@ -447,6 +471,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;
 }