Fixing sample file dialog initialization and other things - Alex
[terminatorX.git] / src / tX_global.c
index d5ae85ddc25441f05e880d9386c29011c9e0a604..1434f2784e24d964d511e1a0fef8e80a6a7021b8 100644 (file)
@@ -43,6 +43,7 @@
 #define TX_XML_RC_VERSION "1.0"
 
 tx_global globals;
+int _store_compress_xml=0;
 
 void get_rc_name(char *buffer)
 {
@@ -72,7 +73,7 @@ void set_global_defaults() {
        strcpy(globals.xinput_device, "");
        globals.xinput_enable=0;
        
-       globals.update_idle=18;
+       globals.update_idle=14;
        globals.update_delay=1;
        
        strcpy(globals.oss_device, "/dev/dsp");
@@ -81,11 +82,11 @@ void set_global_defaults() {
        globals.oss_samplerate=44100;
 
        strcpy(globals.alsa_device, "00-00: Default");  
-       globals.alsa_buffer_time=10000;
-       globals.alsa_period_time=5000;
+       globals.alsa_buffer_time=80000;
+       globals.alsa_period_time=20000;
        globals.alsa_samplerate=44100;
        
-       globals.sense_cycles=12;
+       globals.sense_cycles=80;
        
        globals.mouse_speed=0.8;
        
@@ -124,12 +125,19 @@ void set_global_defaults() {
 #endif 
 #endif         
        globals.use_stdout_cmdline=0;
-       globals.current_path = NULL;
+       strcpy(globals.current_path, "");
        globals.pitch=1.0;
        globals.volume=1.0;
        
        strcpy(globals.lrdf_path, "/usr/share/ladspa/rdf:/usr/local/share/ladspa/rdf");
-       globals.fullscreen_enabled=1;
+       globals.fullscreen_enabled=0;
+       globals.confirm_events=0;
+       globals.compress_set_files=0;
+       
+       globals.vtt_inertia=10.0;
+       
+       globals.alsa_free_hwstats=1;
+       globals.filename_length=20;
 }
 
 int load_globals_xml() {
@@ -181,7 +189,8 @@ int load_globals_xml() {
                        restore_int("alsa_buffer_time", globals.alsa_buffer_time);
                        restore_int("alsa_period_time", globals.alsa_period_time);
                        restore_int("alsa_samplerate", globals.alsa_samplerate);
-
+                       restore_int("alsa_free_hwstats", globals.alsa_free_hwstats);
+                       
                        restore_string("xinput_device", globals.xinput_device);
                        restore_int("xinput_enable", globals.xinput_enable);
                        restore_int("update_idle", globals.update_idle);
@@ -190,6 +199,7 @@ int load_globals_xml() {
                        restore_float("mouse_speed", globals.mouse_speed);
                        restore_int("width", globals.width);
                        restore_int("height", globals.height);
+                       restore_int("filename_length", globals.filename_length);
                        restore_int("tooltips", globals.tooltips);
                        restore_int("use_stdout", globals.use_stdout);
                        restore_int("show_nag", globals.show_nag);
@@ -203,8 +213,12 @@ int load_globals_xml() {
                        restore_string("record_filename", globals.record_filename);
                        restore_string("file_editor", globals.file_editor);
                        restore_string("lrdf_path", globals.lrdf_path);
+                       restore_string("last_path", globals.current_path);
                        
+                       restore_int("compress_set_files", globals.compress_set_files);
                        restore_int("fullscreen_enabled", globals.fullscreen_enabled);
+                       restore_int("confirm_events", globals.confirm_events);
+                       restore_float("vtt_inertia", globals.vtt_inertia);
 
                        if (!elementFound) {
                                fprintf(stderr, "tX: Unhandled XML element: \"%s\"\n", cur->name);
@@ -225,8 +239,10 @@ void store_globals() {
        char rc_name[PATH_MAX]="";
        char device_type[16];
        char indent[]="\t";
-       FILE *rc;
+       FILE *rc=NULL;
+       gzFile rz=NULL;
        char tmp_xml_buffer[4096];
+       _store_compress_xml=0;
        
        get_rc_name(rc_name);
 
@@ -263,6 +279,7 @@ void store_globals() {
                store_int("alsa_buffer_time", globals.alsa_buffer_time);
                store_int("alsa_period_time", globals.alsa_period_time);
                store_int("alsa_samplerate", globals.alsa_samplerate);          
+               store_int("alsa_free_hwstats", globals.alsa_free_hwstats);
                
                store_string("xinput_device", globals.xinput_device);
                store_int("xinput_enable", globals.xinput_enable);
@@ -272,6 +289,7 @@ void store_globals() {
                store_float("mouse_speed", globals.mouse_speed);
                store_int("width", globals.width);
                store_int("height", globals.height);
+               store_int("filename_length", globals.filename_length);
                store_int("tooltips", globals.tooltips);
                store_int("use_stdout", globals.use_stdout);
                // globals.use_stdout_from_conf_file=0; What the heck is this?
@@ -286,8 +304,13 @@ void store_globals() {
                store_string("record_filename", globals.record_filename);
                store_string("file_editor", globals.file_editor);
                store_string("lrdf_path", globals.lrdf_path);
+               store_int("compress_set_files", globals.compress_set_files);
                store_int("fullscreen_enabled", globals.fullscreen_enabled);
-               
+               store_int("confirm_events", globals.confirm_events);
+               store_float("vtt_inertia", globals.vtt_inertia);
+
+               store_string("last_path", globals.current_path);
+
                fprintf(rc,"</terminatorXrc>\n");
        }
 }
@@ -310,6 +333,9 @@ void load_globals() {
 char *encode_xml(char *dest, const char *src) {
        int i, t, max;
        char tmp[4096];
+       int outlen=4096;
+       int inlen;
+       int res;
        
        tmp[0]=0;
        t=0;
@@ -327,16 +353,13 @@ char *encode_xml(char *dest, const char *src) {
        }
        tmp[t]=0;
 
-       int outlen=4096;
-       int inlen=t;
-       
-       int res=isolat1ToUTF8((unsigned char *) dest, &outlen, (unsigned char *) tmp, &inlen);
+       inlen=t;
+       res=isolat1ToUTF8((unsigned char *) dest, &outlen, (unsigned char *) tmp, &inlen);
        dest[outlen]=0;
        if (res<0) {
                tX_error("failed to encode string (%s) to UTF-8.", src);
        }
        
-       //tX_debug("encode_xml: from \"%s\" to \"%s\".", src, dest); 
        return dest;
 }
 
@@ -353,4 +376,3 @@ char *decode_xml(char *dest, const char *src) {
        
        return dest;
 }
-