add layout_scale preference, scaling cleanup, rework init bc_resources, init tip_info...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / main.C
index 6833425d0b7d1d30aafc08c945f3e25fbb3475d1..6e0b6d5e7422a3027b107139ef71e8dd52bf692c 100644 (file)
@@ -121,6 +121,25 @@ public:
 
 long cin_timezone;
 
+static float get_layout_scale()
+{
+       char config_path[BCTEXTLEN];
+       sprintf(config_path,"%s/%s", File::get_config_path(), CONFIG_FILE);
+       FILE *fp = fopen(config_path,"r");
+       if( !fp ) return 0;
+       float scale = 0;
+       char line[BCTEXTLEN];
+       line[BCTEXTLEN-1] = 0;
+       while( fgets(line, BCTEXTLEN-1, fp) ) {
+               if( !strncmp(line, "LAYOUT_SCALE ",12+1) ) {
+                       scale = atof(line+12);
+                       break;
+               }
+       }
+       fclose(fp);
+       return scale;
+}
+
 int main(int argc, char *argv[])
 {
 // handle command line arguments first
@@ -258,7 +277,10 @@ int main(int argc, char *argv[])
                }
        }
 
-
+       float scale = operation == DO_GUI ?
+               get_layout_scale() : 1;
+       // runs XInitThreads
+       BC_WindowBase::init_resources(scale);
 
        if( operation == DO_GUI ||
            operation == DO_DEAMON || operation == DO_DEAMON_FG ||
@@ -401,6 +423,7 @@ DISABLE_BUFFER
 
        filenames.remove_all_objects();
        Units::finit();
+       BC_WindowBase::finit_resources();
 
        time_t et; time(&et);
        long dt = et - st;