X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmain.C;h=8a4815f9eb32d469189a6e30fd963ce67b34e826;hp=6f4ee2e122cbaea6d1b3c83745bb2d4721a3ecc4;hb=9b18af02dc4ccbf052ef9d70180a3d16c0f9848b;hpb=94fc059e6ed3f77f20531338cbb03bdb3b4d9eab diff --git a/cinelerra-5.1/cinelerra/main.C b/cinelerra-5.1/cinelerra/main.C index 6f4ee2e1..8a4815f9 100644 --- a/cinelerra-5.1/cinelerra/main.C +++ b/cinelerra-5.1/cinelerra/main.C @@ -46,7 +46,24 @@ #include #ifdef LEAKER -#define STRC(v) printf("==new %p from %p sz %jd\n", v, __builtin_return_address(0), n) +#if 0 // track allocators +#include +#define BT_BUF_SIZE 100 +static void leaker() +{ + void *buffer[BT_BUF_SIZE]; + int nptrs = backtrace(buffer, BT_BUF_SIZE); + char **trace = backtrace_symbols(buffer, nptrs); + if( !trace ) return; + for( int i=0; igui->lock_window("main"); //PRINT_TRACE - mwindow->load_filenames(filenames, LOADMODE_REPLACE); + mwindow->load_filenames(filenames, + LOADMODE_REPLACE, LOADMODE_EDL_CLIP); //PRINT_TRACE if( filenames->size() == 1 ) mwindow->gui->mainmenu->add_load(filenames->get(0)); @@ -104,11 +122,31 @@ 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 srand(time(0)); ArrayList filenames; + filenames.set_array_delete(); FileSystem fs; time_t st; time(&st); @@ -241,7 +279,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 || @@ -322,7 +363,7 @@ int main(int argc, char *argv[]) MWindow mwindow; mwindow.create_objects(1, !filenames.total, config_path); CommandLineThread *thread = 0; - if( mwindow.preferences->perpetual_session && load_perpetual ) + if( load_perpetual ) mwindow.load_undo_data(); //SET_TRACE // load the initial files on seperate tracks @@ -358,8 +399,7 @@ int main(int argc, char *argv[]) done = 1; mwindow.save_defaults(); - if( mwindow.preferences->perpetual_session ) - mwindow.save_undo_data(); + mwindow.save_undo_data(); //PRINT_TRACE filenames.remove_all_objects(); delete thread; @@ -384,6 +424,7 @@ DISABLE_BUFFER filenames.remove_all_objects(); Units::finit(); + BC_WindowBase::finit_resources(); time_t et; time(&et); long dt = et - st;