X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmainsession.C;h=7d582c46d59e65d7b32e2a0993067a69664834af;hp=86e5b36d3f92c4c579bbbb973347191f85a6dc2d;hb=1db0dacec8f9d7f5687e582bd282d9bf83bd58f0;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/mainsession.C b/cinelerra-5.1/cinelerra/mainsession.C index 86e5b36d..7d582c46 100644 --- a/cinelerra-5.1/cinelerra/mainsession.C +++ b/cinelerra-5.1/cinelerra/mainsession.C @@ -36,6 +36,7 @@ #include "mwindow.h" #include "mwindowgui.h" #include "plugin.h" +#include "transition.h" MainSession::MainSession(MWindow *mwindow) { @@ -51,23 +52,25 @@ MainSession::MainSession(MWindow *mwindow) current_operation = NO_OPERATION; drag_pluginservers = new ArrayList; drag_plugin = 0; + drag_transition = 0; drag_assets = new ArrayList; drag_auto_gang = new ArrayList; drag_clips = new ArrayList; drag_edits = new ArrayList; drag_edit = 0; + drag_group = 0; + drag_group_edit = 0; + drag_group_position = 0; + drag_group_first_track = 0; + group_number = 1; clip_number = 1; brender_end = 0; cwindow_controls = 1; trim_edits = 0; current_tip = -1; - drag_handle = 0; - cwindow_fullscreen = 0; - rwindow_fullscreen = 0; - vwindow_fullscreen = 0; - zwindow_fullscreen = 0; selected_zwindow = -1; actual_frame_rate = 0; + title_bar_alpha = 0; window_config = 0; a_x11_host[0] = 0; b_x11_host[0] = 0; @@ -105,6 +108,12 @@ MainSession::MainSession(MWindow *mwindow) use_vector = 0; use_hist_parade = 0; use_wave_parade = 0; + use_wave_gain = 5; + use_vect_gain = 5; + use_smooth = 0; + use_refresh = 0; + use_release = 0; + use_graticule = 0; afolders_w = 0; show_vwindow = show_awindow = show_cwindow = show_gwindow = show_lwindow = 0; plugindialog_w = plugindialog_h = 0; @@ -124,6 +133,8 @@ MainSession::~MainSession() delete drag_auto_gang; delete drag_clips; delete drag_edits; + if( drag_group ) + drag_group->remove_user(); } void MainSession::boundaries() @@ -198,9 +209,42 @@ void MainSession::default_window_positions(int window_config) int border_bottom = display_info.get_bottom_border(); int dual_head = screens > 1 ? 1 : 0; - int right_w = root_w; + int left_w = 0, left_h = 0, right_w = 0; + int xin_screens = display_info.get_xinerama_screens(); + if( xin_screens > 1 ) { + dual_head = 1; + int x, y, w, h; + for( int s=0; s 0 ) { + int min_x = INT_MAX; + for( int s=0; s= left_w && x < min_x ) { + min_x = x; + right_w = w; + screens = 2; + } + } + if( window_config == 1 ) { + root_x = min_x; + root_w = right_w; + } + else { + root_w = left_w; + root_h = left_h; + } + } + } // Wider than 16:9, narrower than dual head - if( screens < 2 && (float)root_w / root_h > 1.8) { + else if( screens < 2 && (float)root_w / root_h > 1.8 ) { dual_head = 1; switch( root_h ) { case 600: right_w = 800; break; @@ -208,16 +252,20 @@ void MainSession::default_window_positions(int window_config) case 1024: right_w = 1280; break; case 1200: right_w = 1600; break; case 1080: right_w = 1920; break; - default: right_w = root_w/2; break; - } - if( window_config == 1 ) { - root_x = root_w - right_w; - root_w = right_w; + default: + dual_head = 0; + break; } - else { - // use same aspect ratio to compute left height - root_w -= right_w; - root_h = (root_w*root_h) / right_w; + if( dual_head ) { + if( window_config == 1 ) { + root_x = root_w - right_w; + root_w = right_w; + } + else { + // use same aspect ratio to compute left height + root_w -= right_w; + root_h = (root_w*root_h) / right_w; + } } } @@ -239,10 +287,10 @@ void MainSession::default_window_positions(int window_config) BC_DisplayInfo b_display_info(b_x11_host); b_root_w = b_display_info.get_root_w(); b_root_h = b_display_info.get_root_h(); - cwindow_x = 50; - cwindow_y = 50; - cwindow_w = b_root_w-100; - cwindow_h = b_root_h-100; + cwindow_x = xS(50); + cwindow_y = yS(50); + cwindow_w = b_root_w-xS(100); + cwindow_h = b_root_h-yS(100); } ctool_x = cwindow_x + cwindow_w / 2; @@ -258,11 +306,11 @@ void MainSession::default_window_positions(int window_config) awindow_w = root_x + root_w - awindow_x - border_left - border_right; awindow_h = mwindow_h; - bwindow_w = 600; - bwindow_h = 360; + bwindow_w = xS(600); + bwindow_h = yS(360); - ewindow_w = 640; - ewindow_h = 240; + ewindow_w = xS(640); + ewindow_h = yS(240); channels_x = 0; channels_y = 0; @@ -270,25 +318,31 @@ void MainSession::default_window_positions(int window_config) picture_y = 0; scope_x = 0; scope_y = 0; - scope_w = 640; - scope_h = 320; + scope_w = xS(640); + scope_h = yS(320); histogram_x = 0; histogram_y = 0; - histogram_w = 320; - histogram_h = 480; + histogram_w = xS(320); + histogram_h = yS(480); record_scope = 0; use_hist = 1; use_wave = 1; use_vector = 1; use_hist_parade = 1; use_wave_parade = 1; + use_wave_gain = 5; + use_vect_gain = 5; + use_smooth = 1; + use_refresh = 0; + use_release = 0; + use_graticule = 0; if(mwindow->edl) lwindow_w = MeterPanel::get_meters_width(mwindow->theme, mwindow->edl->session->audio_channels, 1); else - lwindow_w = 100; + lwindow_w = xS(100); lwindow_y = 0; lwindow_x = root_w - lwindow_w; @@ -296,36 +350,36 @@ void MainSession::default_window_positions(int window_config) rwindow_x = root_x; rwindow_y = root_y; - rwindow_h = 500; - rwindow_w = 650; + rwindow_h = yS(500); + rwindow_w = xS(650); cswindow_x = root_x; cswindow_y = root_y; - cswindow_w = 1280; - cswindow_h = 600; + cswindow_w = xS(1280); + cswindow_h = yS(600); if( !dual_head || window_config != 2 ) { - rmonitor_x = rwindow_x + rwindow_w + 10; + rmonitor_x = rwindow_x + rwindow_w + xS(10); rmonitor_y = rwindow_y; rmonitor_w = root_x + root_w - rmonitor_x; rmonitor_h = rwindow_h; } else { - rmonitor_x = cswindow_x = 50; - rmonitor_y = cswindow_y = 50; - rmonitor_w = b_root_w-100; - rmonitor_h = b_root_h-100; + rmonitor_x = cswindow_x = xS(50); + rmonitor_y = cswindow_y = yS(50); + rmonitor_w = b_root_w-xS(100); + rmonitor_h = b_root_h-yS(100); if( cswindow_w < rmonitor_w ) cswindow_w = rmonitor_w; if( cswindow_h < rmonitor_h ) cswindow_h = rmonitor_h; } swindow_x = root_x; swindow_y = root_y; - swindow_w = 600; - swindow_h = 400; + swindow_w = xS(600); + swindow_h = yS(400); - batchrender_w = 750; - batchrender_h = 400; + batchrender_w = xS(750); + batchrender_h = yS(400); batchrender_x = root_w / 2 - batchrender_w / 2; batchrender_y = root_h / 2 - batchrender_h / 2; } @@ -333,8 +387,12 @@ void MainSession::default_window_positions(int window_config) int MainSession::load_defaults(BC_Hash *defaults) { // Setup main windows - strcpy(a_x11_host, defaults->get("A_X11_HOST", a_x11_host)); - strcpy(b_x11_host, defaults->get("B_X11_HOST", b_x11_host)); + char *a_host = defaults->get("A_X11_HOST", a_x11_host); + if( a_host != a_x11_host ) + strcpy(a_x11_host, defaults->get("A_X11_HOST", a_x11_host)); + char *b_host = defaults->get("B_X11_HOST", b_x11_host); + if( b_host != b_x11_host ) + strcpy(b_x11_host, defaults->get("B_X11_HOST", b_x11_host)); window_config = defaults->get("WINDOW_CONFIG", window_config); default_window_positions(window_config); @@ -392,11 +450,17 @@ int MainSession::load_defaults(BC_Hash *defaults) use_vector = defaults->get("USE_VECTOR", use_vector); use_hist_parade = defaults->get("USE_HIST_PARADE", use_hist_parade); use_wave_parade = defaults->get("USE_WAVE_PARADE", use_wave_parade); + use_wave_gain = defaults->get("USE_WAVE_GAIN", use_wave_gain); + use_vect_gain = defaults->get("USE_VECT_GAIN", use_vect_gain); + use_smooth = defaults->get("USE_SMOOTH", use_smooth); + use_refresh = defaults->get("USE_REFRESH", use_refresh); + use_release = defaults->get("USE_RELEASE", use_release); + use_graticule = defaults->get("USE_GRATICULE", use_graticule); //printf("MainSession::load_defaults 1\n"); // Other windows - afolders_w = defaults->get("ABINS_W", 200); + afolders_w = defaults->get("ABINS_W", xS(200)); bwindow_w = defaults->get("BWINDOW_W", bwindow_w); bwindow_h = defaults->get("BWINDOW_H", bwindow_h); @@ -434,22 +498,23 @@ int MainSession::load_defaults(BC_Hash *defaults) cwindow_controls = defaults->get("CWINDOW_CONTROLS", cwindow_controls); - plugindialog_w = defaults->get("PLUGINDIALOG_W", 510); - plugindialog_h = defaults->get("PLUGINDIALOG_H", 415); -// presetdialog_w = defaults->get("PRESETDIALOG_W", 510); -// presetdialog_h = defaults->get("PRESETDIALOG_H", 415); - keyframedialog_w = defaults->get("KEYFRAMEDIALOG_W", 320); - keyframedialog_h = defaults->get("KEYFRAMEDIALOG_H", 415); - keyframedialog_column1 = defaults->get("KEYFRAMEDIALOG_COLUMN1", 150); - keyframedialog_column2 = defaults->get("KEYFRAMEDIALOG_COLUMN2", 100); + plugindialog_w = defaults->get("PLUGINDIALOG_W", xS(510)); + plugindialog_h = defaults->get("PLUGINDIALOG_H", yS(415)); +// presetdialog_w = defaults->get("PRESETDIALOG_W", xS(510)); +// presetdialog_h = defaults->get("PRESETDIALOG_H", yS(415)); + keyframedialog_w = defaults->get("KEYFRAMEDIALOG_W", xS(320)); + keyframedialog_h = defaults->get("KEYFRAMEDIALOG_H", yS(415)); + keyframedialog_column1 = defaults->get("KEYFRAMEDIALOG_COLUMN1", xS(150)); + keyframedialog_column2 = defaults->get("KEYFRAMEDIALOG_COLUMN2", xS(100)); keyframedialog_all = defaults->get("KEYFRAMEDIALOG_ALL", 0); - menueffect_w = defaults->get("MENUEFFECT_W", 580); - menueffect_h = defaults->get("MENUEFFECT_H", 350); - transitiondialog_w = defaults->get("TRANSITIONDIALOG_W", 320); - transitiondialog_h = defaults->get("TRANSITIONDIALOG_H", 512); + menueffect_w = defaults->get("MENUEFFECT_W", xS(580)); + menueffect_h = defaults->get("MENUEFFECT_H", yS(350)); + transitiondialog_w = defaults->get("TRANSITIONDIALOG_W", xS(320)); + transitiondialog_h = defaults->get("TRANSITIONDIALOG_H", yS(512)); current_tip = defaults->get("CURRENT_TIP", current_tip); actual_frame_rate = defaults->get("ACTUAL_FRAME_RATE", (float)-1); + title_bar_alpha = defaults->get("TITLE_BAR_ALPHA", (float)1); boundaries(); return 0; @@ -516,6 +581,12 @@ int MainSession::save_defaults(BC_Hash *defaults) defaults->update("USE_VECTOR", use_vector); defaults->update("USE_HIST_PARADE", use_hist_parade); defaults->update("USE_WAVE_PARADE", use_wave_parade); + defaults->update("USE_WAVE_GAIN", use_wave_gain); + defaults->update("USE_VECT_GAIN", use_vect_gain); + defaults->update("USE_SMOOTH", use_smooth); + defaults->update("USE_REFRESH", use_refresh); + defaults->update("USE_RELEASE", use_release); + defaults->update("USE_GRATICULE", use_graticule); defaults->update("ABINS_W", afolders_w); @@ -569,6 +640,7 @@ int MainSession::save_defaults(BC_Hash *defaults) defaults->update("TRANSITIONDIALOG_H", transitiondialog_h); defaults->update("ACTUAL_FRAME_RATE", actual_frame_rate); + defaults->update("TITLE_BAR_ALPHA", title_bar_alpha); defaults->update("CURRENT_TIP", current_tip); @@ -587,6 +659,10 @@ Track *MainSession::drag_handle_track() case DRAG_PLUGINHANDLE2: track = drag_plugin->edits->track; break; + case DRAG_TRANSNHANDLE1: + case DRAG_TRANSNHANDLE2: + track = drag_transition->edits->track; + break; } return track; } @@ -603,3 +679,31 @@ void MainSession::update_clip_number() clip_number = clip_no+1; } +int MainSession::load_file(const char *path) +{ + int ret = 1; + FILE *fp = fopen(path,"r"); + if( fp ) { + BC_Hash defaults; + defaults.load_file(fp); + load_defaults(&defaults); + fclose(fp); + ret = 0; + } + return ret; +} + +int MainSession::save_file(const char *path) +{ + int ret = 1; + FILE *fp = fopen(path,"w"); + if( fp ) { + BC_Hash defaults; + save_defaults(&defaults); + defaults.save_file(fp); + fclose(fp); + ret = 0; + } + return ret; +} +