Credit Andrew - fix vorbis audio which was scratchy and ensure aging plugin does...
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / mainsession.C
index e0a8a8265f57752e73b347788500a9f8b4a3b116..f4e4cc9b8e29cbabcc5da923abea54cfbe2145b3 100644 (file)
@@ -36,6 +36,7 @@
 #include "mwindow.h"
 #include "mwindowgui.h"
 #include "plugin.h"
+#include "transition.h"
 
 MainSession::MainSession(MWindow *mwindow)
 {
@@ -51,6 +52,7 @@ MainSession::MainSession(MWindow *mwindow)
        current_operation = NO_OPERATION;
        drag_pluginservers = new ArrayList<PluginServer*>;
        drag_plugin = 0;
+       drag_transition = 0;
        drag_assets = new ArrayList<Indexable*>;
        drag_auto_gang = new ArrayList<Auto*>;
        drag_clips = new ArrayList<EDL*>;
@@ -96,6 +98,7 @@ MainSession::MainSession(MWindow *mwindow)
        gwindow_x = gwindow_y = 0;
        cswindow_x = cswindow_y = cswindow_w = cswindow_h = 0;
        swindow_x = swindow_y = swindow_w = swindow_h = 0;
+       tile_mixers_x = tile_mixers_y = tile_mixers_w = tile_mixers_h = 0;
        ewindow_w = ewindow_h = 0;
        channels_x = channels_y = 0;
        picture_x = picture_y = 0;
@@ -106,6 +109,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;
@@ -215,17 +224,18 @@ void MainSession::default_window_positions(int window_config)
                        }
                }
                if( left_w > 0 ) {
+                       int min_x = INT_MAX;
                        for( int s=0; s<xin_screens; ++s ) {
                                if( display_info.xinerama_geometry(s, x, y, w, h) )
                                        continue;
-                               if( !y && x == left_w ) {
+                               if( !y && x >= left_w && x < min_x ) {
+                                       min_x = x;
                                        right_w = w;
                                        screens = 2;
-                                       break;
                                }
                        }
                        if( window_config == 1 ) {
-                               root_x = left_w;
+                               root_x = min_x;
                                root_w = right_w;
                        }
                        else {
@@ -243,16 +253,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;
+               default:
+                       dual_head = 0;
+                       break;
                }
-               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;
+               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;
+                       }
                }
        }
 
@@ -317,6 +331,12 @@ void MainSession::default_window_positions(int window_config)
        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,
@@ -359,6 +379,11 @@ void MainSession::default_window_positions(int window_config)
        swindow_w = xS(600);
        swindow_h = yS(400);
 
+       tile_mixers_x = 1 + mwindow_x;
+       tile_mixers_y = 1;
+       tile_mixers_w = cwindow_x - tile_mixers_x;
+       tile_mixers_h = mwindow_y - tile_mixers_y;
+
        batchrender_w = xS(750);
        batchrender_h = yS(400);
        batchrender_x = root_w / 2 - batchrender_w / 2;
@@ -368,8 +393,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);
 
@@ -427,6 +456,12 @@ 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");
 
@@ -456,6 +491,11 @@ int MainSession::load_defaults(BC_Hash *defaults)
        rmonitor_w = defaults->get("RMONITOR_W", rmonitor_w);
        rmonitor_h = defaults->get("RMONITOR_H", rmonitor_h);
 
+       tile_mixers_x = defaults->get("TILE_MIXERS_X", 0);
+       tile_mixers_y = defaults->get("TILE_MIXERS_Y", 0);
+       tile_mixers_w = defaults->get("TILE_MIXERS_W", 0);
+       tile_mixers_h = defaults->get("TILE_MIXERS_H", 0);
+
        batchrender_x = defaults->get("BATCHRENDER_X", batchrender_x);
        batchrender_y = defaults->get("BATCHRENDER_Y", batchrender_y);
        batchrender_w = defaults->get("BATCHRENDER_W", batchrender_w);
@@ -552,6 +592,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);
 
@@ -560,6 +606,11 @@ int MainSession::save_defaults(BC_Hash *defaults)
        defaults->update("RMONITOR_W", rmonitor_w);
        defaults->update("RMONITOR_H", rmonitor_h);
 
+       defaults->update("TILE_MIXERS_X", tile_mixers_x);
+       defaults->update("TILE_MIXERS_Y", tile_mixers_y);
+       defaults->update("TILE_MIXERS_W", tile_mixers_w);
+       defaults->update("TILE_MIXERS_H", tile_mixers_h);
+
        defaults->update("RWINDOW_X", rwindow_x);
        defaults->update("RWINDOW_Y", rwindow_y);
        defaults->update("RWINDOW_W", rwindow_w);
@@ -624,6 +675,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;
 }