mask tool/gui rework, plugin_cuda CUDA_PATH fix, raise filebox/tool guis on open...
authorGood Guy <good1.2guy@gmail.com>
Wed, 26 Jun 2019 01:15:31 +0000 (19:15 -0600)
committerGood Guy <good1.2guy@gmail.com>
Wed, 26 Jun 2019 01:15:31 +0000 (19:15 -0600)
21 files changed:
cinelerra-5.1/cinelerra/cwindow.C
cinelerra-5.1/cinelerra/cwindow.h
cinelerra-5.1/cinelerra/cwindowgui.C
cinelerra-5.1/cinelerra/cwindowtool.C
cinelerra-5.1/cinelerra/cwindowtool.h
cinelerra-5.1/cinelerra/cwindowtool.inc
cinelerra-5.1/cinelerra/localsession.C
cinelerra-5.1/cinelerra/localsession.h
cinelerra-5.1/cinelerra/maskengine.C
cinelerra-5.1/cinelerra/mwindow.C
cinelerra-5.1/cinelerra/playabletracks.C
cinelerra-5.1/cinelerra/playback3d.C
cinelerra-5.1/cinelerra/playbackengine.C
cinelerra-5.1/cinelerra/track.C
cinelerra-5.1/cinelerra/track.h
cinelerra-5.1/cinelerra/tracks.C
cinelerra-5.1/cinelerra/tracks.h
cinelerra-5.1/guicast/bcfilebox.C
cinelerra-5.1/guicast/bctextbox.C
cinelerra-5.1/guicast/bctextbox.h
cinelerra-5.1/plugin_cuda

index 9fed729273ac69bb3a002661d02dfc68f5d69035..d60617582f2e29312972737450bc096416c0c875 100644 (file)
@@ -61,6 +61,7 @@ CWindow::CWindow(MWindow *mwindow)
        this->mwindow = mwindow;
        this->playback_engine = 0;
        this->playback_cursor = 0;
+       this->mask_track_id = -1;
        this->gui = 0;
 }
 
@@ -78,26 +79,14 @@ CWindow::~CWindow()
 
 void CWindow::create_objects()
 {
-       destination = mwindow->defaults->get("CWINDOW_DESTINATION", 0);
-
-
        gui = new CWindowGUI(mwindow, this);
-
        gui->create_objects();
-
-
        playback_engine = new CPlayback(mwindow, this, gui->canvas);
-
-
 // Start command loop
        playback_engine->create_objects();
-
        gui->transport->set_engine(playback_engine);
-
        playback_cursor = new CTracking(mwindow, this);
-
        playback_cursor->create_objects();
-
 }
 
 
@@ -132,21 +121,25 @@ void CWindow::hide_window()
 
 Track* CWindow::calculate_affected_track()
 {
-       Track* affected_track = 0;
-       for(Track *track = mwindow->edl->tracks->first;
-               track;
-               track = track->next)
-       {
-               if(track->data_type == TRACK_VIDEO &&
-                       track->record)
-               {
-                       affected_track = track;
-                       break;
-               }
+       Track *track = mwindow->edl->tracks->first;
+       for( ; track; track=track->next ) {
+               if( track->data_type != TRACK_VIDEO ) continue;
+               if( track->record ) break;
        }
-       return affected_track;
+       return track;
 }
 
+Track* CWindow::calculate_mask_track()
+{
+       Track *track = mwindow->edl->tracks->first;
+       for( ; track; track=track->next ) {
+               if( track->data_type != TRACK_VIDEO ) continue;
+               if( track->record && track->get_id() == mask_track_id ) break;
+       }
+       return track;
+}
+
+
 Auto* CWindow::calculate_affected_auto(Autos *autos,
                int create, int *created, int redraw)
 {
index e6a9b9448a572d9f57e3f5d5e72a13e7fd85bfca..2eaad4b3a0d2b59cceb3cfe5af42160584b74d0a 100644 (file)
@@ -49,6 +49,7 @@ public:
                int timebar = 0);
        void run();
        Track* calculate_affected_track();
+       Track* calculate_mask_track();
 // Get keyframe for editing in the CWindow.
 // create - if 0 forces automatic creation to be off
 //          if 1 uses automatic creation option to create
@@ -71,6 +72,7 @@ public:
        void refresh_frame(int change_type, EDL *edl, int dir=1);
 
        int destination;
+       int mask_track_id;
        MWindow *mwindow;
        CWindowGUI *gui;
 
index 1825191efc5638453ee7df57670aab37a204bf31..1439f72a69f0564c8aaaacb92603f4dc60eacf73 100644 (file)
@@ -78,14 +78,10 @@ static int total_zooms = sizeof(my_zoom_table) / sizeof(double);
 CWindowGUI::CWindowGUI(MWindow *mwindow, CWindow *cwindow)
  : BC_Window(_(PROGRAM_NAME ": Compositor"),
        mwindow->session->cwindow_x,
-    mwindow->session->cwindow_y,
-    mwindow->session->cwindow_w,
-    mwindow->session->cwindow_h,
-    100,
-    100,
-    1,
-    1,
-    1,
+       mwindow->session->cwindow_y,
+       mwindow->session->cwindow_w,
+       mwindow->session->cwindow_h,
+       100, 100, 1, 1, 1,
        BC_WindowBase::get_resources()->bg_color,
        mwindow->get_cwindow_display())
 {
@@ -212,12 +208,6 @@ void CWindowGUI::create_objects()
        if( !mwindow->edl->session->cwindow_scrollbars )
                zoom_panel->set_text(auto_zoom);
 
-//     destination = new CWindowDestination(mwindow,
-//             this,
-//             mwindow->theme->cdest_x,
-//             mwindow->theme->cdest_y);
-//     destination->create_objects();
-
 // Must create after meter panel
        tool_panel = new CWindowTool(mwindow, this);
        tool_panel->Thread::start();
@@ -1003,44 +993,12 @@ int CWindowSlider::decrease_value()
        lock_window("CWindowSlider::decrease_value");
        return 1;
 }
-
-
-// CWindowDestination::CWindowDestination(MWindow *mwindow, CWindowGUI *cwindow, int x, int y)
-//  : BC_PopupTextBox(cwindow,
-//     &cwindow->destinations,
-//     cwindow->destinations.values[cwindow->cwindow->destination]->get_text(),
-//     x,
-//     y,
-//     70,
-//     200)
-// {
-//     this->mwindow = mwindow;
-//     this->cwindow = cwindow;
-// }
-//
-// CWindowDestination::~CWindowDestination()
-// {
-// }
-//
-// int CWindowDestination::handle_event()
-// {
-//     return 1;
-// }
 #endif // USE_SLIDER
 
 
-
-
-
-
 CWindowTransport::CWindowTransport(MWindow *mwindow,
-       CWindowGUI *gui,
-       int x,
-       int y)
- : PlayTransport(mwindow,
-       gui,
-       x,
-       y)
+       CWindowGUI *gui, int x, int y)
+ : PlayTransport(mwindow, gui, x, y)
 {
        this->gui = gui;
 }
@@ -1480,7 +1438,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
 {
 // Retrieve points from top recordable track
 //printf("CWindowCanvas::do_mask 1\n");
-       Track *track = gui->cwindow->calculate_affected_track();
+       Track *track = gui->cwindow->calculate_mask_track();
 //printf("CWindowCanvas::do_mask 2\n");
 
        if(!track) return 0;
@@ -1816,7 +1774,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                        cvs_win->set_color(WHITE);
 #endif
                }
-               if( draw && mask_gui && mask_gui->center_mark && points.size() ) {
+               if( draw && mask_gui && draw_markers && points.size() ) {
                        float cx = 0, cy = 0;
                        int n = points.size();
                        for( int i=0; i<n; ++i ) {
@@ -1826,7 +1784,7 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                        cx /= n;  cy /= n;
                        output_to_canvas(mwindow->edl, 0, cx, cy);
                        float r = bmax(cvs_win->get_w(), cvs_win->get_h());
-                       float d = 0.003*r;
+                       float d = 0.007*r;
                        cvs_win->set_line_width((int)(0.002*r) + 1);
                        cvs_win->set_color(ORANGE);
                        cvs_win->draw_line(cx-d,cy, cx+d, cy);
@@ -1838,12 +1796,12 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
        }
 
        if(button_press && !result) {
-               gui->affected_track = gui->cwindow->calculate_affected_track();
+               gui->affected_track = gui->cwindow->calculate_mask_track();
 
 // Get keyframe outside the EDL to edit.  This must be rendered
 // instead of the EDL keyframes when it exists.  Then it must be
 // applied to the EDL keyframes on buttonrelease.
-               if(gui->affected_track) {
+               if( gui->affected_track ) {
 #ifdef USE_KEYFRAME_SPANNING
 // Make copy of current parameters in local keyframe
                        gui->mask_keyframe =
@@ -2130,12 +2088,21 @@ int CWindowCanvas::do_mask(int &redraw, int &rerender,
                                double scale = button_no == WHEEL_UP ? 1.02 : 0.98;
                                double theta = button_no == WHEEL_UP ? M_PI/360. : -M_PI/360.;
                                float st = sin(theta), ct = cos(theta);
-                               gui->x_origin = mask_cursor_x;
-                               gui->y_origin = mask_cursor_y;
+                               float cx = 0, cy = 0;
+                               int n = mask_points.size();
                                if( mask_gui && mask_gui->focused ) {
-                                       gui->x_origin = atof(mask_gui->focus_x->get_text());
-                                       gui->y_origin = atof(mask_gui->focus_y->get_text());
+                                       cx = atof(mask_gui->focus_x->get_text());
+                                       cy = atof(mask_gui->focus_y->get_text());
+                               }
+                               else if( n > 0 ) {
+                                       for( int i=0; i<n; ++i ) {
+                                               MaskPoint *point = mask_points.values[i];
+                                               cx += point->x;  cy += point->y;
+                                       }
+                                       cx /= n;  cy /= n;
                                }
+                               gui->x_origin = cx;
+                               gui->y_origin = cy;
                                for( int i=0; i<mask_points.size(); ++i ) {
                                        MaskPoint *point = mask_points.values[i];
                                        float px = point->x - gui->x_origin;
@@ -3016,7 +2983,7 @@ int CWindowCanvas::test_bezier(int button_press,
 
 // Get target keyframe
                        if( !gui->affected_x && !gui->affected_y && !gui->affected_z ) {
-                               if(!gui->affected_track) return 0;
+                               if( !gui->affected_track ) return 0;
                                FloatAutos *affected_x_autos, *affected_y_autos, *affected_z_autos;
                                FloatAutos** autos = (FloatAutos**) gui->affected_track->automation->autos;
                                if( mwindow->edl->session->cwindow_operation == CWINDOW_CAMERA ) {
@@ -3114,8 +3081,7 @@ int CWindowCanvas::test_bezier(int button_press,
                gui->affected_track = gui->cwindow->calculate_affected_track();
                gui->reset_affected();
 
-               if(gui->affected_track)
-               {
+               if( gui->affected_track ) {
                        if( do_camera )
                                mwindow->undo->update_undo_before(_("camera"), this);
                        else
@@ -3286,12 +3252,7 @@ int CWindowCanvas::cursor_motion_event()
                case CWINDOW_MASK_CONTROL_IN:
                case CWINDOW_MASK_CONTROL_OUT:
                case CWINDOW_MASK_TRANSLATE:
-
-                       result = do_mask(redraw,
-                               rerender,
-                               0,
-                               1,
-                               0);
+                       result = do_mask(redraw, rerender, 0, 1, 0);
                        break;
 
                case CWINDOW_EYEDROP:
@@ -3319,12 +3280,8 @@ int CWindowCanvas::cursor_motion_event()
                                result = do_ruler(0, 1, 0, 0);
                                break;
                        case CWINDOW_MASK:
-                               result = do_mask(redraw,
-                                       rerender,
-                                       0,
-                                       1,
-                                       0);
-                                       break;
+                               result = do_mask(redraw, rerender, 0, 1, 0);
+                               break;
                }
        }
 
@@ -3392,8 +3349,7 @@ int CWindowCanvas::button_press_event()
                                        break;
                                case MIDDLE_BUTTON: {  // && shift_down()
                                        result = do_mask_focus();
-                                       redraw = 1;
-                                       redraw_canvas = 1;
+                                       redraw = redraw_canvas = 1;
                                        break; }
                                case WHEEL_UP:
                                case WHEEL_DOWN:
index d3d0b4945e6ef936b5a405de96794f68a0eee5e8..c9a84c4f90269b3dcb2aa5cce6e03766b88c8cc4 100644 (file)
@@ -47,6 +47,7 @@
 #include "mwindowgui.h"
 #include "theme.h"
 #include "track.h"
+#include "tracks.h"
 #include "trackcanvas.h"
 #include "transportque.h"
 
@@ -180,6 +181,16 @@ void CWindowTool::hide_tool()
        }
 }
 
+void CWindowTool::raise_tool()
+{
+       if(tool_gui && mwindow->edl->session->tool_window)
+       {
+               tool_gui->lock_window("CWindowTool::show_tool");
+               tool_gui->raise_window();
+               tool_gui->unlock_window();
+       }
+}
+
 
 void CWindowTool::run()
 {
@@ -279,17 +290,13 @@ int CWindowToolGUI::close_event()
        flush();
        mwindow->edl->session->tool_window = 0;
        unlock_window();
-
-
-
        thread->gui->lock_window("CWindowToolGUI::close_event");
        thread->gui->composite_panel->set_operation(mwindow->edl->session->cwindow_operation);
        thread->gui->flush();
        thread->gui->unlock_window();
-
        lock_window("CWindowToolGUI::close_event");
        return 1;
-;}
+}
 
 int CWindowToolGUI::keypress_event()
 {
@@ -326,8 +333,21 @@ int CWindowToolGUI::translation_event()
 }
 
 
+void CWindowToolGUI::update_preview(int changed_edl)
+{
+       unlock_window();
+       draw_preview(changed_edl);
+       lock_window("CWindowToolGUI::update_preview");
+}
 
-
+void CWindowToolGUI::draw_preview(int changed_edl)
+{
+       CWindowGUI *cgui = mwindow->cwindow->gui;
+       cgui->lock_window("CWindowToolGUI::draw_preview");
+       int change_type = !changed_edl ? CHANGE_PARAMS : CHANGE_EDL;
+       cgui->sync_parameters(change_type, 0, 1);
+       cgui->unlock_window();
+}
 
 
 CWindowCoord::CWindowCoord(CWindowToolGUI *gui, int x, int y, float value, int log_increment = 0)
@@ -804,15 +824,6 @@ void CWindowCameraGUI::create_objects()
        unlock_window();
 }
 
-void CWindowCameraGUI::update_preview()
-{
-       CWindowGUI *cgui = mwindow->cwindow->gui;
-       cgui->lock_window("CWindowCameraGUI::update_preview");
-       cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
-       cgui->unlock_window();
-}
-
-
 void CWindowCameraGUI::handle_event()
 {
        FloatAuto *x_auto = 0;
@@ -1202,14 +1213,6 @@ void CWindowProjectorGUI::create_objects()
        unlock_window();
 }
 
-void CWindowProjectorGUI::update_preview()
-{
-       CWindowGUI *cgui = mwindow->cwindow->gui;
-       cgui->lock_window("CWindowProjectorGUI::update_preview");
-       cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
-       cgui->unlock_window();
-}
-
 void CWindowProjectorGUI::handle_event()
 {
        FloatAuto *x_auto = 0;
@@ -1482,18 +1485,99 @@ int CWindowProjectorBottom::handle_event()
 }
 
 
-CWindowMaskTrack::CWindowMaskTrack(MWindow *mwindow, CWindowMaskGUI *gui,
-               int x, int y, const char *text)
- : BC_Title(x, y, text, MEDIUMFONT, get_resources()->button_highlighted)
+CWindowMaskOnTrack::CWindowMaskOnTrack(MWindow *mwindow, CWindowMaskGUI *gui,
+               int x, int y, int w, const char *text)
+ : BC_PopupTextBox(gui, 0, text, x, y, w, 120)
 {
        this->mwindow = mwindow;
        this->gui = gui;
 }
 
-CWindowMaskTrack::~CWindowMaskTrack()
+CWindowMaskOnTrack::~CWindowMaskOnTrack()
+{
+}
+
+int CWindowMaskOnTrack::handle_event()
 {
+       int k = get_number();
+//printf("selected %d = %s\n", k, k<0 ? "()" : track_items[k]->get_text());
+       CWindowMaskItem *track_item = k >= 0 ? (CWindowMaskItem *)track_items[k] : 0;
+       Track *track = track_item ? mwindow->edl->tracks->get_track_by_id(track_item->id) : 0;
+       int track_id = track_item && track && track->record ? track_item->id : -1;
+       set_back_color(track_id >= 0 ?
+               gui->get_resources()->text_background :
+               gui->get_resources()->text_background_disarmed);
+       gui->mask_on_track->update(track_item ? track_item->get_text() : "");
+       mwindow->cwindow->mask_track_id = track_id;
+       mwindow->edl->local_session->solo_track_id = -1;
+       gui->mask_solo_track->update(0);
+       gui->update_preview(1);
+       return 1;
 }
 
+void CWindowMaskOnTrack::update_items()
+{
+       track_items.remove_all_objects();
+       for( Track *track=mwindow->edl->tracks->first; track; track=track->next ) {
+               if( track->data_type != TRACK_VIDEO ) continue;
+               int color = track->record ? -1 : RED;
+               track_items.append(new CWindowMaskItem(track->title, track->get_id(), color));
+       }
+       update_list(&track_items);
+}
+
+CWindowMaskTrackTumbler::CWindowMaskTrackTumbler(MWindow *mwindow, CWindowMaskGUI *gui,
+               int x, int y)
+ : BC_Tumbler(x, y)
+{
+       this->mwindow = mwindow;
+       this->gui = gui;
+}
+CWindowMaskTrackTumbler::~CWindowMaskTrackTumbler()
+{
+}
+
+int CWindowMaskTrackTumbler::handle_up_event()
+{
+       return do_event(1);
+}
+
+int CWindowMaskTrackTumbler::handle_down_event()
+{
+       return do_event(-1);
+}
+
+int CWindowMaskTrackTumbler::do_event(int dir)
+{
+       CWindowMaskItem *track_item = 0;
+       CWindowMaskItem **items = (CWindowMaskItem**)&gui->mask_on_track->track_items[0];
+       int n = gui->mask_on_track->track_items.size();
+       int id = mwindow->cwindow->mask_track_id;
+       if( n > 0 ) {   
+               int k = n;
+               while( --k >= 0 && items[k]->id != id );
+               if( k >= 0 ) {
+                       k += dir;
+                       bclamp(k, 0, n-1);
+                       track_item = items[k];
+               }
+               else
+                       track_item = items[0];
+       }
+       Track *track = track_item ? mwindow->edl->tracks->get_track_by_id(track_item->id) : 0;
+       int track_id = track_item && track && track->record ? track_item->id : -1;
+       gui->mask_on_track->set_back_color(track_id >= 0 ?
+               gui->get_resources()->text_background :
+               gui->get_resources()->text_background_disarmed);
+       gui->mask_on_track->update(track_item ? track_item->get_text() : "");
+       mwindow->cwindow->mask_track_id = track_item ? track_item->id : -1;
+       mwindow->edl->local_session->solo_track_id = -1;
+       gui->mask_solo_track->update(0);
+       gui->update_preview(1);
+       return 1;
+}
+
+
 CWindowMaskName::CWindowMaskName(MWindow *mwindow, CWindowMaskGUI *gui,
                int x, int y, const char *text)
  : BC_PopupTextBox(gui, 0, text, x, y, 100, 160)
@@ -1557,7 +1641,7 @@ void CWindowMaskName::update_items(MaskAuto *keyframe)
                }
                else
                        sprintf(text, "%d", i);
-               mask_items.append(new BC_ListBoxItem(text));
+               mask_items.append(new CWindowMaskItem(text));
        }
        update_list(&mask_items);
 }
@@ -1579,7 +1663,7 @@ CWindowMaskButton::~CWindowMaskButton()
 int CWindowMaskButton::handle_event()
 {
        mwindow->edl->session->cwindow_mask = no;
-       gui->name->update(gui->name->mask_items[no]->get_text());
+       gui->mask_name->update(gui->mask_name->mask_items[no]->get_text());
        gui->update();
        gui->update_preview();
        return 1;
@@ -1613,15 +1697,95 @@ int CWindowMaskThumbler::do_event(int dir)
        if( (k+=dir) >= SUBMASKS ) k = 0;
        else if( k < 0 ) k = SUBMASKS-1;
        mwindow->edl->session->cwindow_mask = k;
-       gui->name->update(gui->name->mask_items[k]->get_text());
+       gui->mask_name->update(gui->mask_name->mask_items[k]->get_text());
        gui->update();
        gui->update_preview();
        return 1;
 }
 
+CWindowMaskEnable::CWindowMaskEnable(MWindow *mwindow, CWindowMaskGUI *gui,
+                int x, int y, int no, int v)
+ : BC_CheckBox(x, y, v)
+{
+       this->mwindow = mwindow;
+       this->gui = gui;
+       this->no = no;
+}
+
+CWindowMaskEnable::~CWindowMaskEnable()
+{
+}
+
+int CWindowMaskEnable::handle_event()
+{
+       Track *track = mwindow->cwindow->calculate_mask_track();
+       if( track ) {
+               mwindow->undo->update_undo_before(_("mask enable"), this);
+               int bit = 1 << no;
+               if( get_value() )
+                       track->masks |= bit;
+               else
+                       track->masks &= ~bit;
+               gui->update();
+               gui->update_preview(1);
+               mwindow->undo->update_undo_after(_("mask enable"), LOAD_PATCHES);
+       }
+       return 1;
+}
+
+CWindowMaskUnclear::CWindowMaskUnclear(MWindow *mwindow,
+       CWindowMaskGUI *gui, int x, int y, int w)
+ : BC_GenericButton(x, y, w, _("Enable"))
+{
+       this->mwindow = mwindow;
+       this->gui = gui;
+       set_tooltip(_("Show mask"));
+}
+
+int CWindowMaskUnclear::handle_event()
+{
+       Track *track = mwindow->cwindow->calculate_mask_track();
+       if( track ) {
+               mwindow->undo->update_undo_before(_("mask enables"), this);
+               int m = (1<<SUBMASKS)-1;
+               if( track->masks == m )
+                       track->masks = 0;
+               else
+                       track->masks = m;
+               for( int i=0; i<SUBMASKS; ++i )
+                       gui->mask_enables[i]->update((track->masks>>i) & 1);
+               gui->update_preview(1);
+               mwindow->undo->update_undo_after(_("mask enables"), LOAD_PATCHES);
+       }
+       return 1;
+}
+
+CWindowMaskSoloTrack::CWindowMaskSoloTrack(MWindow *mwindow,
+       CWindowMaskGUI *gui, int x, int y, int v)
+ : BC_CheckBox(x, y, v, _("Solo"))
+{
+       this->mwindow = mwindow;
+       this->gui = gui;
+       set_tooltip(_("Solo video track"));
+}
+
+int CWindowMaskSoloTrack::handle_event()
+{
+       mwindow->edl->local_session->solo_track_id =
+               get_value() ? mwindow->cwindow->mask_track_id : -1;
+       gui->update_preview(1);
+       return 1;
+}
+
+int CWindowMaskSoloTrack::calculate_w(BC_WindowBase *gui)
+{
+       int w = 0, h = 0;
+       calculate_extents(gui, &w, &h, _("Solo"));
+       return w;
+}
 
 CWindowMaskDelMask::CWindowMaskDelMask(MWindow *mwindow,
-       CWindowToolGUI *gui, int x, int y)
+       CWindowMaskGUI *gui, int x, int y)
  : BC_GenericButton(x, y, _("Delete"))
 {
        this->mwindow = mwindow;
@@ -1639,7 +1803,7 @@ int CWindowMaskDelMask::handle_event()
        int total_points;
 
 // Get existing keyframe
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+       gui->get_keyframe(track, autos, keyframe, mask, point, 0);
 
        if( track ) {
                mwindow->undo->update_undo_before(_("mask delete"), 0);
@@ -1675,7 +1839,7 @@ int CWindowMaskDelMask::handle_event()
 }
 
 CWindowMaskDelPoint::CWindowMaskDelPoint(MWindow *mwindow,
-       CWindowToolGUI *gui, int x, int y)
+       CWindowMaskGUI *gui, int x, int y)
  : BC_GenericButton(x, y, _("Delete"))
 {
        this->mwindow = mwindow;
@@ -1693,7 +1857,7 @@ int CWindowMaskDelPoint::handle_event()
        int total_points;
 
 // Get existing keyframe
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+       gui->get_keyframe(track, autos, keyframe, mask, point, 0);
        if( track ) {
                mwindow->undo->update_undo_before(_("point delete"), 0);
 
@@ -1754,7 +1918,7 @@ int CWindowMaskDelPoint::keypress_event()
 
 
 CWindowMaskAffectedPoint::CWindowMaskAffectedPoint(MWindow *mwindow,
-       CWindowToolGUI *gui, int x, int y)
+       CWindowMaskGUI *gui, int x, int y)
  : BC_TumbleTextBox(gui,
                (int64_t)mwindow->cwindow->gui->affected_point,
                (int64_t)0, INT64_MAX, x, y, 100)
@@ -1771,7 +1935,7 @@ int CWindowMaskAffectedPoint::handle_event()
 {
        int total_points = 0;
        int affected_point = atol(get_text());
-       Track *track = mwindow->cwindow->calculate_affected_track();
+       Track *track = mwindow->cwindow->calculate_mask_track();
        if(track) {
                MaskAutos *autos = (MaskAutos*)track->automation->autos[AUTOMATION_MASK];
                MaskAuto *keyframe = (MaskAuto*)mwindow->cwindow->calculate_affected_auto(autos, 0);
@@ -1794,8 +1958,8 @@ int CWindowMaskAffectedPoint::handle_event()
 }
 
 
-CWindowMaskFocus::CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->focused, _("Focus"))
+CWindowMaskFocus::CWindowMaskFocus(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y)
+ : BC_CheckBox(x, y, gui->focused, _("Focus"))
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -1808,34 +1972,14 @@ CWindowMaskFocus::~CWindowMaskFocus()
 
 int CWindowMaskFocus::handle_event()
 {
-       ((CWindowMaskGUI*)gui)->focused = get_value();
-       gui->update();
-       gui->update_preview();
-       return 1;
-}
-
-CWindowMaskDrawCenter::CWindowMaskDrawCenter(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->center_mark, _("Center Mark"))
-{
-       this->mwindow = mwindow;
-       this->gui = gui;
-       set_tooltip(_("show center of mask points"));
-}
-
-CWindowMaskDrawCenter::~CWindowMaskDrawCenter()
-{
-}
-
-int CWindowMaskDrawCenter::handle_event()
-{
-       ((CWindowMaskGUI*)gui)->center_mark = get_value();
+       gui->focused = get_value();
        gui->update();
        gui->update_preview();
        return 1;
 }
 
-CWindowMaskDrawMarkers::CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->markers, _("Markers"))
+CWindowMaskDrawMarkers::CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y)
+ : BC_CheckBox(x, y, gui->markers, _("Markers"))
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -1848,14 +1992,14 @@ CWindowMaskDrawMarkers::~CWindowMaskDrawMarkers()
 
 int CWindowMaskDrawMarkers::handle_event()
 {
-       ((CWindowMaskGUI*)gui)->markers = get_value();
+       gui->markers = get_value();
        gui->update();
        gui->update_preview();
        return 1;
 }
 
-CWindowMaskDrawBoundary::CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
- : BC_CheckBox(x, y, ((CWindowMaskGUI*)gui)->boundary, _("Boundary"))
+CWindowMaskDrawBoundary::CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y)
+ : BC_CheckBox(x, y, gui->boundary, _("Boundary"))
 {
        this->mwindow = mwindow;
        this->gui = gui;
@@ -1868,14 +2012,14 @@ CWindowMaskDrawBoundary::~CWindowMaskDrawBoundary()
 
 int CWindowMaskDrawBoundary::handle_event()
 {
-       ((CWindowMaskGUI*)gui)->boundary = get_value();
+       gui->boundary = get_value();
        gui->update();
        gui->update_preview();
        return 1;
 }
 
 
-CWindowMaskFeather::CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
+CWindowMaskFeather::CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y)
  : BC_TumbleTextBox(gui, 0, -FEATHER_MAX, FEATHER_MAX, x, y, 64, 2)
 {
        this->mwindow = mwindow;
@@ -1887,8 +2031,7 @@ CWindowMaskFeather::~CWindowMaskFeather()
 
 int CWindowMaskFeather::update(float v)
 {
-       CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->feather_slider->update(v);
+       gui->feather_slider->update(v);
        return BC_TumbleTextBox::update(v);
 }
 
@@ -1908,10 +2051,10 @@ int CWindowMaskFeather::update_value(float v)
        mwindow->undo->update_undo_before(_("mask feather"), this);
 
 // Get existing keyframe
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
+       gui->get_keyframe(track, autos, keyframe,
                        mask, point, create_it);
        if( track ) {
-               int gang = ((CWindowMaskGUI*)gui)->gang_feather->get_value();
+               int gang = gui->gang_feather->get_value();
 #ifdef USE_KEYFRAME_SPANNING
                MaskAuto temp_keyframe(mwindow->edl, autos);
                temp_keyframe.copy_data(keyframe);
@@ -1939,13 +2082,12 @@ int CWindowMaskFeather::update_value(float v)
 int CWindowMaskFeather::handle_event()
 {
        float v = atof(get_text());
-       CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->feather_slider->update(v);
-       return mask_gui->feather->update_value(v);
+       gui->feather_slider->update(v);
+       return gui->feather->update_value(v);
 }
 
 CWindowMaskFeatherSlider::CWindowMaskFeatherSlider(MWindow *mwindow,
-               CWindowToolGUI *gui, int x, int y, int w, float v)
+               CWindowMaskGUI *gui, int x, int y, int w, float v)
  : BC_FSlider(x, y, 0, w, w, -FEATHER_MAX, FEATHER_MAX, v)
 {
        this->mwindow = mwindow;
@@ -1982,9 +2124,8 @@ int CWindowMaskFeatherSlider::handle_event()
        else
                last_v = v;
        timer->update();
-       CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->feather->BC_TumbleTextBox::update(v);
-       return mask_gui->feather->update_value(v);
+       gui->feather->BC_TumbleTextBox::update(v);
+       return gui->feather->update_value(v);
 }
 
 int CWindowMaskFeatherSlider::update(float v)
@@ -1992,7 +2133,7 @@ int CWindowMaskFeatherSlider::update(float v)
        return BC_FSlider::update(v);
 }
 
-CWindowMaskFade::CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui, int x, int y)
+CWindowMaskFade::CWindowMaskFade(MWindow *mwindow, CWindowMaskGUI *gui, int x, int y)
  : BC_TumbleTextBox(gui, 0, -100.f, 100.f, x, y, 64, 2)
 {
        this->mwindow = mwindow;
@@ -2004,8 +2145,7 @@ CWindowMaskFade::~CWindowMaskFade()
 
 int CWindowMaskFade::update(float v)
 {
-       CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->fade_slider->update(v);
+       gui->fade_slider->update(v);
        return BC_TumbleTextBox::update(v);
 }
 
@@ -2025,10 +2165,10 @@ int CWindowMaskFade::update_value(float v)
        mwindow->undo->update_undo_before(_("mask fade"), this);
 
 // Get existing keyframe
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe,
+       gui->get_keyframe(track, autos, keyframe,
                        mask, point, create_it);
        if( track ) {
-               int gang = ((CWindowMaskGUI*)gui)->gang_fader->get_value();
+               int gang = gui->gang_fader->get_value();
 #ifdef USE_KEYFRAME_SPANNING
                MaskAuto temp_keyframe(mwindow->edl, autos);
                temp_keyframe.copy_data(keyframe);
@@ -2056,12 +2196,11 @@ int CWindowMaskFade::update_value(float v)
 int CWindowMaskFade::handle_event()
 {
        float v = atof(get_text());
-       CWindowMaskGUI * mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->fade_slider->update(v);
-       return mask_gui->fade->update_value(v);
+       gui->fade_slider->update(v);
+       return gui->fade->update_value(v);
 }
 
-CWindowMaskFadeSlider::CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+CWindowMaskFadeSlider::CWindowMaskFadeSlider(MWindow *mwindow, CWindowMaskGUI *gui,
                int x, int y, int w)
  : BC_ISlider(x, y, 0, w, w, -200, 200, 0)
 {
@@ -2098,9 +2237,8 @@ int CWindowMaskFadeSlider::handle_event()
        else
                last_v = v;
        timer->update();
-       CWindowMaskGUI *mask_gui = (CWindowMaskGUI*)gui;
-       mask_gui->fade->BC_TumbleTextBox::update(v);
-       return mask_gui->fade->update_value(v);
+       gui->fade->BC_TumbleTextBox::update(v);
+       return gui->fade->update_value(v);
 }
 
 int CWindowMaskFadeSlider::update(int64_t v)
@@ -2109,7 +2247,7 @@ int CWindowMaskFadeSlider::update(int64_t v)
 }
 
 CWindowMaskGangFader::CWindowMaskGangFader(MWindow *mwindow,
-               CWindowToolGUI *gui, int x, int y)
+               CWindowMaskGUI *gui, int x, int y)
  : BC_Toggle(x, y, mwindow->theme->get_image_set("gangpatch_data"), 0)
 {
         this->mwindow = mwindow;
@@ -2126,7 +2264,7 @@ int CWindowMaskGangFader::handle_event()
        return 1;
 }
 
-CWindowMaskBeforePlugins::CWindowMaskBeforePlugins(CWindowToolGUI *gui, int x, int y)
+CWindowMaskBeforePlugins::CWindowMaskBeforePlugins(CWindowMaskGUI *gui, int x, int y)
  : BC_CheckBox(x,
        y,
        1,
@@ -2142,7 +2280,7 @@ int CWindowMaskBeforePlugins::handle_event()
        MaskAuto *keyframe;
        SubMask *mask;
        MaskPoint *point;
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 1);
+       gui->get_keyframe(track, autos, keyframe, mask, point, 1);
 
        if (keyframe) {
                int v = get_value();
@@ -2160,7 +2298,7 @@ int CWindowMaskBeforePlugins::handle_event()
 }
 
 
-CWindowDisableOpenGLMasking::CWindowDisableOpenGLMasking(CWindowToolGUI *gui, int x, int y)
+CWindowDisableOpenGLMasking::CWindowDisableOpenGLMasking(CWindowMaskGUI *gui, int x, int y)
  : BC_CheckBox(x, y, 1, _("Disable OpenGL masking"))
 {
        this->gui = gui;
@@ -2173,7 +2311,7 @@ int CWindowDisableOpenGLMasking::handle_event()
        MaskAuto *keyframe;
        SubMask *mask;
        MaskPoint *point;
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 1);
+       gui->get_keyframe(track, autos, keyframe, mask, point, 1);
 
        if( keyframe ) {
                int v = get_value();
@@ -2219,7 +2357,7 @@ int CWindowMaskClrMask::handle_event()
        SubMask *mask;
 
 // Get existing keyframe
-       ((CWindowMaskGUI*)gui)->get_keyframe(track, autos, keyframe, mask, point, 0);
+       gui->get_keyframe(track, autos, keyframe, mask, point, 0);
 
        if( track ) {
                mwindow->undo->update_undo_before(_("del masks"), 0);
@@ -2233,7 +2371,7 @@ int CWindowMaskClrMask::handle_event()
 }
 
 CWindowMaskGangFeather::CWindowMaskGangFeather(MWindow *mwindow,
-               CWindowToolGUI *gui, int x, int y)
+               CWindowMaskGUI *gui, int x, int y)
  : BC_Toggle(x, y, mwindow->theme->get_image_set("gangpatch_data"), 0)
 {
         this->mwindow = mwindow;
@@ -2252,7 +2390,7 @@ int CWindowMaskGangFeather::handle_event()
 
 CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread)
  : CWindowToolGUI(mwindow, thread,
-       _(PROGRAM_NAME ": Mask"), 360, 620)
+       _(PROGRAM_NAME ": Mask"), 400, 660)
 {
        this->mwindow = mwindow;
        this->thread = thread;
@@ -2260,13 +2398,13 @@ CWindowMaskGUI::CWindowMaskGUI(MWindow *mwindow, CWindowTool *thread)
        fade = 0;
        feather = 0;
        focused = 0;
-       center_mark = 0;
        markers = 1;
        boundary = 1;
 }
 CWindowMaskGUI::~CWindowMaskGUI()
 {
        lock_window("CWindowMaskGUI::~CWindowMaskGUI");
+       done_event();
        delete active_point;
        delete fade;
        delete feather;
@@ -2276,34 +2414,45 @@ CWindowMaskGUI::~CWindowMaskGUI()
 void CWindowMaskGUI::create_objects()
 {
        int x = 10, y = 10, margin = mwindow->theme->widget_border;
-       int clr_x = get_w()-x - CWindowMaskClrMask::calculate_w(mwindow);
-       int del_x = clr_x-margin - CWindowMaskDelMask::calculate_w(this,_("Delete"));
-       //MaskAuto *keyframe = 0;
-       //Track *track = mwindow->cwindow->calculate_affected_track();
-       //if(track)
-       //      keyframe = (MaskAuto*)mwindow->cwindow->calculate_affected_auto(track->automation->autos[AUTOMATION_MASK], 0);
+       int clr_w = CWindowMaskClrMask::calculate_w(mwindow);
+       int clr_x = get_w()-x - clr_w;
+       int del_w = CWindowMaskDelMask::calculate_w(this,_("Delete"));
+       int del_x = clr_x-2*margin - del_w;
 
        lock_window("CWindowMaskGUI::create_objects");
        BC_TitleBar *title_bar;
        add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Masks on Track")));
        y += title_bar->get_h() + margin;
-       int x1 = x + 70;
-       add_subwindow(mask_track = new CWindowMaskTrack(mwindow, this, x1, y, ""));
-       y += mask_track->get_h() + margin;
+       BC_Title *title;
+       add_subwindow(title = new BC_Title(x,y, _("Track:")));
+       int x1 = x + 90;
+       Track *track = mwindow->cwindow->calculate_affected_track();
+       const char *text = track ? track->title : "";
+       mwindow->cwindow->mask_track_id = track ? track->get_id() : -1;
+       mask_on_track = new CWindowMaskOnTrack(mwindow, this, x1, y, 100, text);
+       mask_on_track->create_objects();
+       mask_on_track->set_tooltip(_("Video track"));
+       int x2 = x1 + mask_on_track->get_w();
+       add_subwindow(mask_track_tumbler = new CWindowMaskTrackTumbler(mwindow, this, x2, y));
+       mwindow->edl->local_session->solo_track_id = -1;
+       x2 = del_x + (del_w - CWindowMaskSoloTrack::calculate_w(this)) / 2;
+       add_subwindow(mask_solo_track = new CWindowMaskSoloTrack(mwindow, this, x2, y, 0));
+       y += mask_on_track->get_h() + margin;
        add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Masks")));
        y += title_bar->get_h() + margin;
-       BC_Title *title;
        add_subwindow(title = new BC_Title(x, y, _("Mask:")));
-       name = new CWindowMaskName(mwindow, this, x1, y, "");
-       name->create_objects();
+       mask_name = new CWindowMaskName(mwindow, this, x1, y, "");
+       mask_name->create_objects();
+       mask_name->set_tooltip(_("Mask name"));
        add_subwindow(clr_mask = new CWindowMaskClrMask(mwindow, this, clr_x, y));
        add_subwindow(del_mask = new CWindowMaskDelMask(mwindow, this, del_x, y));
-       y += name->get_h() + margin;
+       y += mask_name->get_h() + 2*margin;
 
+       add_subwindow(title = new BC_Title(x, y, _("Select:")));
        int bw = 0, bh = 0;
        BC_CheckBox::calculate_extents(this, &bw, &bh);
        int bdx = bw + margin;
-       int x2 = x;
+       x2 = x1;
        for( int i=0; i<SUBMASKS; x2+=bdx, ++i ) {
                int v = i == mwindow->edl->session->cwindow_mask ? 1 : 0;
                mask_buttons[i] = new CWindowMaskButton(mwindow, this, x2, y, i, v);
@@ -2312,14 +2461,21 @@ void CWindowMaskGUI::create_objects()
        x2 += margin;
        add_subwindow(mask_thumbler = new CWindowMaskThumbler(mwindow, this, x2, y));
        y += bh + margin;
-       x2 = x;
+       x2 = x1;
        for( int i=0; i<SUBMASKS; x2+=bdx, ++i ) {
                char text[BCSTRLEN];  sprintf(text, "%d", i);
                int tx = (bw - get_text_width(MEDIUMFONT, text)) / 2;
                mask_blabels[i] = new BC_Title(x2+tx, y, text);
                add_subwindow(mask_blabels[i]);
        }
-       y += mask_blabels[0]->get_h() + 2*margin;
+       y += mask_blabels[0]->get_h() + margin;
+       add_subwindow(unclr_mask = new CWindowMaskUnclear(mwindow, this, x, y, x1-x-2*margin));
+       x2 = x1;
+       for( int i=0; i<SUBMASKS; x2+=bdx, ++i ) {
+               mask_enables[i] = new CWindowMaskEnable(mwindow, this, x2, y, i, 1);
+               add_subwindow(mask_enables[i]);
+       }
+       y += mask_enables[0]->get_h() + 2*margin;
        add_subwindow(title_bar = new BC_TitleBar(x, y, get_w()-2*x, 20, 10, _("Fade & Feather")));
        y += title_bar->get_h() + margin;
 
@@ -2368,7 +2524,6 @@ void CWindowMaskGUI::create_objects()
        add_subwindow(title = new BC_Title(x, y, "Y:"));
        focus_y = new CWindowCoord(this, x1, y, (float)0.0);
        focus_y->create_objects();
-       add_subwindow(draw_center = new CWindowMaskDrawCenter(mwindow, this, del_x, y));
        y += focus_x->get_h() + 2*margin;
        BC_Bar *bar;
        add_subwindow(bar = new BC_Bar(x, y, get_w()-2*x));
@@ -2385,7 +2540,7 @@ void CWindowMaskGUI::create_objects()
                "Shift+LMB: move an end point\n"
                "Ctrl+LMB: move a control point\n"
                "Alt+LMB: to drag translate the mask\n"
-               "Shift+Key Delete to delete the mask\n"
+               "Shift+Key Delete to delete the point\n"
                "Wheel Up/Dn: rotate around pointer\n"
                "Shift+Wheel Up/Dn: scale around pointer\n"
                "Shift+MMB: Toggle focus center at pointer")));
@@ -2393,36 +2548,46 @@ void CWindowMaskGUI::create_objects()
        unlock_window();
 }
 
+int CWindowMaskGUI::close_event()
+{
+       done_event();
+       return CWindowToolGUI::close_event();
+}
+
+void CWindowMaskGUI::done_event()
+{
+       int &solo_track_id = mwindow->edl->local_session->solo_track_id;
+       if( solo_track_id >= 0 ) {
+               solo_track_id = -1;
+               update_preview();
+       }
+}
+
 void CWindowMaskGUI::get_keyframe(Track* &track,
-       MaskAutos* &autos,
-       MaskAuto* &keyframe,
-       SubMask* &mask,
-       MaskPoint* &point,
-       int create_it)
+               MaskAutos* &autos, MaskAuto* &keyframe,
+               SubMask* &mask, MaskPoint* &point, int create_it)
 {
        autos = 0;
        keyframe = 0;
 
-       track = mwindow->cwindow->calculate_affected_track();
-       if(track)
-       {
+       track = mwindow->cwindow->calculate_mask_track();
+       if( !track )
+               track = mwindow->cwindow->calculate_affected_track();
+               
+       if(track) {
                autos = (MaskAutos*)track->automation->autos[AUTOMATION_MASK];
                keyframe = (MaskAuto*)mwindow->cwindow->calculate_affected_auto(
                        autos,
                        create_it);
        }
 
-       if(keyframe)
-               mask = keyframe->get_submask(mwindow->edl->session->cwindow_mask);
-       else
-               mask = 0;
+       mask = !keyframe ? 0 :
+               keyframe->get_submask(mwindow->edl->session->cwindow_mask);
 
        point = 0;
-       if(keyframe)
-       {
-               if(mwindow->cwindow->gui->affected_point < mask->points.total &&
-                       mwindow->cwindow->gui->affected_point >= 0)
-               {
+       if( keyframe ) {
+               if( mwindow->cwindow->gui->affected_point < mask->points.total &&
+                       mwindow->cwindow->gui->affected_point >= 0 ) {
                        point = mask->points.values[mwindow->cwindow->gui->affected_point];
                }
        }
@@ -2437,15 +2602,20 @@ void CWindowMaskGUI::update()
        MaskPoint *point;
 //printf("CWindowMaskGUI::update 1\n");
        get_keyframe(track, autos, keyframe, mask, point, 0);
-
-       mask_track->update(!track ? "" : track->title);
-       name->update_items(keyframe);
+       mask_on_track->set_back_color(!track || track->record ?
+               get_resources()->text_background :
+               get_resources()->text_background_disarmed);
+       mask_on_track->update_items();
+       mask_on_track->update(!track ? "" : track->title);
+       mask_name->update_items(keyframe);
        const char *text = "";
        int sz = !keyframe ? 0 : keyframe->masks.size();
        int k = mwindow->edl->session->cwindow_mask;
        if( k >= 0 && k < sz )
                text = keyframe->masks[k]->name;
-       name->update(text);
+       else
+               k = mwindow->edl->session->cwindow_mask = 0;
+       mask_name->update(text);
        update_buttons(keyframe, k);
        if( point ) {
                x->update(point->x);
@@ -2456,6 +2626,9 @@ void CWindowMaskGUI::update()
                int64_t position_i = track->to_units(position, 0);
                feather->update(autos->get_feather(position_i, k, PLAY_FORWARD));
                fade->update(autos->get_fader(position_i, k, PLAY_FORWARD));
+               int show_mask = track->masks;
+               for( int i=0; i<SUBMASKS; ++i )
+                       mask_enables[i]->update((show_mask>>i) & 1);
        }
        if( keyframe ) {
                apply_before_plugins->update(keyframe->apply_before_plugins);
@@ -2506,16 +2679,6 @@ void CWindowMaskGUI::handle_event()
        mwindow->undo->update_undo_after(_("mask point"), LOAD_AUTOMATION);
 }
 
-void CWindowMaskGUI::update_preview()
-{
-       unlock_window();
-       CWindowGUI *cgui = mwindow->cwindow->gui;
-       cgui->lock_window("CWindowMaskGUI::update_preview");
-       cgui->sync_parameters(CHANGE_PARAMS, 0, 1);
-       cgui->unlock_window();
-       lock_window("CWindowMaskGUI::update_preview");
-}
-
 void CWindowMaskGUI::set_focused(int v, float cx, float cy)
 {
        focus_x->update(cx);
index dcdfa1601f7a43e8c74ccf6581655e6ee3d481d5..b8b431c9f4430a84b11c090b0fd7868791f37da3 100644 (file)
@@ -46,6 +46,7 @@ public:
 // Called when window is visible
        void show_tool();
        void hide_tool();
+       void raise_tool();
 
        void run();
        void update_show_window();
@@ -79,9 +80,10 @@ public:
 // Update text boxes from keyframe here
        virtual void update() {};
 // Update EDL and preview only
-       virtual void update_preview() {};
+       void update_preview(int changed_edl=0);
+       void draw_preview(int changed_edl);
        int current_operation;
-       int close_event();
+       virtual int close_event();
        int keypress_event();
        int translation_event();
 
@@ -128,14 +130,13 @@ public:
        CWindowCoord *x1, *y1, *width, *height;
 };
 
-class CWindowMaskTrack : public BC_Title
+class CWindowMaskItem : public BC_ListBoxItem
 {
 public:
-       CWindowMaskTrack(MWindow *mwindow, CWindowMaskGUI *gui,
-                       int x, int y, const char *text);
-       ~CWindowMaskTrack();
-       MWindow *mwindow;
-       CWindowMaskGUI *gui;
+       CWindowMaskItem(const char *text, int id=-1, int color=-1)
+        : BC_ListBoxItem(text, color), id(id) {}
+       ~CWindowMaskItem() {}
+       int id;
 };
 
 class CWindowMaskItems : public ArrayList<BC_ListBoxItem*>
@@ -145,6 +146,35 @@ public:
        ~CWindowMaskItems() { remove_all_objects(); }
 };
 
+class CWindowMaskOnTrack : public BC_PopupTextBox
+{
+public:
+       CWindowMaskOnTrack(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y, int w, const char *text);
+       ~CWindowMaskOnTrack();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+       CWindowMaskItems track_items;
+
+       int handle_event();
+       void update_items();
+};
+
+class CWindowMaskTrackTumbler : public BC_Tumbler
+{
+public:
+       CWindowMaskTrackTumbler(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y);
+       ~CWindowMaskTrackTumbler();
+       int handle_up_event();
+       int handle_down_event();
+       int do_event(int dir);
+
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+};
+
+
 class CWindowMaskName : public BC_PopupTextBox
 {
 public:
@@ -159,14 +189,35 @@ public:
        void update_items(MaskAuto *keyframe);
 };
 
+class CWindowMaskUnclear : public BC_GenericButton
+{
+public:
+       CWindowMaskUnclear(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y, int w);
+       int handle_event();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+};
+
+class CWindowMaskSoloTrack : public BC_CheckBox
+{
+public:
+       CWindowMaskSoloTrack(MWindow *mwindow, CWindowMaskGUI *gui,
+                       int x, int y, int v);
+       static int calculate_w(BC_WindowBase *gui);
+       int handle_event();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+};
+
 class CWindowMaskDelMask : public BC_GenericButton
 {
 public:
-       CWindowMaskDelMask(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskDelMask(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskClrMask : public BC_Button
@@ -208,30 +259,43 @@ public:
        CWindowMaskGUI *gui;
 };
 
+class CWindowMaskEnable : public BC_CheckBox
+{
+public:
+       CWindowMaskEnable(MWindow *mwindow, CWindowMaskGUI *gui,
+                        int x, int y, int no, int v);
+       ~CWindowMaskEnable();
+
+       int handle_event();
+       MWindow *mwindow;
+       CWindowMaskGUI *gui;
+       int no;
+};
+
 class CWindowMaskFade : public BC_TumbleTextBox
 {
 public:
-       CWindowMaskFade(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskFade(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskFade();
        int update(float v);
        int update_value(float v);
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskFadeSlider : public BC_ISlider
 {
 public:
-       CWindowMaskFadeSlider(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskFadeSlider(MWindow *mwindow, CWindowMaskGUI *gui,
                int x, int y, int w);
        ~CWindowMaskFadeSlider();
        int handle_event();
        int update(int64_t v);
        char *get_caption() { return 0; }
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
        int stick;
        float last_v;
        Timer *timer;
@@ -240,104 +304,93 @@ public:
 class CWindowMaskGangFader : public BC_Toggle
 {
 public:
-       CWindowMaskGangFader(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskGangFader(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskGangFader();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskAffectedPoint : public BC_TumbleTextBox
 {
 public:
-       CWindowMaskAffectedPoint(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskAffectedPoint(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskAffectedPoint();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskFocus : public BC_CheckBox
 {
 public:
-       CWindowMaskFocus(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskFocus(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskFocus();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
-};
-
-class CWindowMaskDrawCenter : public BC_CheckBox
-{
-public:
-       CWindowMaskDrawCenter(MWindow *mwindow, CWindowToolGUI *gui,
-                       int x, int y);
-       ~CWindowMaskDrawCenter();
-       int handle_event();
-       MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskDrawMarkers : public BC_CheckBox
 {
 public:
-       CWindowMaskDrawMarkers(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskDrawMarkers(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskDrawMarkers();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskDrawBoundary : public BC_CheckBox
 {
 public:
-       CWindowMaskDrawBoundary(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskDrawBoundary(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskDrawBoundary();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskDelPoint : public BC_GenericButton
 {
 public:
-       CWindowMaskDelPoint(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskDelPoint(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        int handle_event();
        int keypress_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskFeather : public BC_TumbleTextBox
 {
 public:
-       CWindowMaskFeather(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskFeather(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskFeather();
        int update(float v);
        int update_value(float v);
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskFeatherSlider : public BC_FSlider
 {
 public:
-       CWindowMaskFeatherSlider(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskFeatherSlider(MWindow *mwindow, CWindowMaskGUI *gui,
                int x, int y, int w, float v);
        ~CWindowMaskFeatherSlider();
        int handle_event();
        int update(float v);
        char *get_caption() { return 0; }
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
        int stick;
        float last_v;
        Timer *timer;
@@ -346,30 +399,30 @@ public:
 class CWindowMaskGangFeather : public BC_Toggle
 {
 public:
-       CWindowMaskGangFeather(MWindow *mwindow, CWindowToolGUI *gui,
+       CWindowMaskGangFeather(MWindow *mwindow, CWindowMaskGUI *gui,
                        int x, int y);
        ~CWindowMaskGangFeather();
        int handle_event();
        MWindow *mwindow;
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskBeforePlugins : public BC_CheckBox
 {
 public:
-       CWindowMaskBeforePlugins(CWindowToolGUI *gui,
+       CWindowMaskBeforePlugins(CWindowMaskGUI *gui,
                        int x, int y);
        int handle_event();
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowDisableOpenGLMasking : public BC_CheckBox
 {
 public:
-       CWindowDisableOpenGLMasking(CWindowToolGUI *gui,
+       CWindowDisableOpenGLMasking(CWindowMaskGUI *gui,
                        int x, int y);
        int handle_event();
-       CWindowToolGUI *gui;
+       CWindowMaskGUI *gui;
 };
 
 class CWindowMaskGUI : public CWindowToolGUI
@@ -379,19 +432,24 @@ public:
        ~CWindowMaskGUI();
        void create_objects();
        void update();
+       int close_event();
+       void done_event();
        void set_focused(int v, float cx, float cy);
        void update_buttons(MaskAuto *keyframe, int k);
        void handle_event();
        void get_keyframe(Track* &track, MaskAutos* &autos, MaskAuto* &keyframe,
                SubMask* &mask, MaskPoint* &point, int create_it);
-       void update_preview();
 
-       CWindowMaskTrack *mask_track;
-       CWindowMaskName *name;
+       CWindowMaskOnTrack *mask_on_track;
+       CWindowMaskTrackTumbler *mask_track_tumbler;
+       CWindowMaskName *mask_name;
        CWindowMaskButton *mask_buttons[SUBMASKS];
        CWindowMaskThumbler *mask_thumbler;
        BC_Title *mask_blabels[SUBMASKS];
+       CWindowMaskEnable *mask_enables[SUBMASKS];
+       CWindowMaskSoloTrack *mask_solo_track;
        CWindowMaskDelMask *del_mask;
+       CWindowMaskUnclear *unclr_mask;
        CWindowMaskClrMask *clr_mask;
        CWindowMaskFade *fade;
        CWindowMaskFadeSlider *fade_slider;
@@ -401,8 +459,6 @@ public:
        CWindowCoord *x, *y;
        CWindowMaskFocus *focus;
        int focused;
-       CWindowMaskDrawCenter *draw_center;
-       int center_mark;
        CWindowMaskDrawMarkers *draw_markers;
        int markers;
        CWindowMaskDrawBoundary *draw_boundary;
@@ -457,7 +513,6 @@ public:
        ~CWindowCameraGUI();
        void create_objects();
        void update();
-       void update_preview();
 
 // Update the keyframe from text boxes
        void handle_event();
@@ -535,7 +590,6 @@ public:
        ~CWindowProjectorGUI();
        void create_objects();
        void update();
-       void update_preview();
        void handle_event();
 //     BezierAuto* get_keyframe();
        CWindowCoord *x, *y, *z;
index 9d8118d35c427b8e4839246b38877ca820bbba4b..35bcf4e9247ad8828687274595172ea25047522d 100644 (file)
 
 class CWindowTool;
 class CWindowToolGUI;
-class CWindowCurveToggle;
 class CWindowCoord;
 class CWindowCropOK;
 class CWindowCropGUI;
-class CWindowMaskTrack;
+class CWindowMaskItem;
 class CWindowMaskItems;
+class CWindowMaskOnTrack;
+class CWindowMaskTrackTumbler;
 class CWindowMaskName;
+class CWindowMaskUnclear;
+class CWindowMaskSoloTrack;
 class CWindowMaskDelMask;
 class CWindowMaskClrMask;
 class CWindowMaskButton;
 class CWindowMaskThumbler;
+class CWindowMaskEnable;
 class CWindowMaskFade;
 class CWindowMaskFadeSlider;
 class CWindowMaskGangFader;
 class CWindowMaskAffectedPoint;
 class CWindowMaskFocus;
-class CWindowMaskDrawCenter;
 class CWindowMaskDrawMarkers;
 class CWindowMaskDrawBoundary;
 class CWindowMaskDelPoint;
@@ -68,4 +71,5 @@ class CWindowProjectorMiddle;
 class CWindowProjectorBottom;
 class CWindowRulerGUI;
 
+class CWindowCurveToggle;
 #endif
index 6f430e2c561adee9f631b3df24c291636671ae85..50837a135044536a7949a27a6fa6693880cdba46 100644 (file)
@@ -109,6 +109,7 @@ LocalSession::LocalSession(EDL *edl)
        red = green = blue = 0;
        red_max = green_max = blue_max = 0;
        use_max = 0;
+       solo_track_id = -1;
 }
 
 LocalSession::~LocalSession()
@@ -148,6 +149,7 @@ void LocalSession::copy_from(LocalSession *that)
        green_max = that->green_max;
        blue_max = that->blue_max;
        use_max = that->use_max;
+       solo_track_id = that->solo_track_id;
 
        for (int i = 0; i < AUTOGROUPTYPE_COUNT; i++) {
                automation_mins[i] = that->automation_mins[i];
@@ -238,6 +240,8 @@ void LocalSession::synchronize_params(LocalSession *that)
        red_max = that->red_max;
        green_max = that->green_max;
        blue_max = that->blue_max;
+       if( solo_track_id < 0 || that->solo_track_id < 0 )
+               solo_track_id = that->solo_track_id;
 }
 
 
index ea0a2d6b78c1e624aab2ff6fa54e37e19a28f17c..d2b289458fbcba0880f61312b71c57605ff181dc 100644 (file)
@@ -112,6 +112,8 @@ public:
        float red, green, blue;
        float red_max, green_max, blue_max;
        int use_max;
+// mask solo track, or -1
+       int solo_track_id;
 private:
 // The reason why selection ranges and inpoints have to be separate:
 // The selection position has to change to set new in points.
index 589b7938a875b9dc27a1aba95ee193d91dfa5456..bb930def75947e13a81208c28ef429b65c0632fa 100644 (file)
@@ -26,6 +26,7 @@
 #include "maskautos.h"
 #include "maskengine.h"
 #include "mutex.h"
+#include "track.h"
 #include "transportque.inc"
 #include "vframe.h"
 
@@ -444,6 +445,7 @@ SET_TRACE
                feathers.remove_all();
                fade[0] = 0;
 
+               int show_mask = keyframe_set->track->masks;
                for( int i=0; i<total_submasks; ++i ) {
                        float fader = keyframe_set->get_fader(start_position_project, i, PLAY_FORWARD);
                        float v = fader / 100;
@@ -459,7 +461,9 @@ SET_TRACE
                        MaskPointSet *new_points = new MaskPointSet();
                        keyframe_set->get_points(new_points, i, start_position_project, PLAY_FORWARD);
                        point_sets.append(new_points);
-                       draw_edge(*edges.append(new MaskEdge()), *new_points);
+                       MaskEdge *edge = edges.append(new MaskEdge());
+                       if( !((show_mask>>i) & 1) ) continue;
+                       draw_edge(*edge, *new_points);
                }
 // draw mask
                if( !mask ) mask = new VFrame(mask_w, mask_h, mask_model, 0);
index 09747382f32777e885377167b721780ed43d1ae3..d752b91ab2aa18adb5d364ab7d2cf2d0e0e490da 100644 (file)
@@ -2718,7 +2718,9 @@ void MWindow::create_objects(int want_gui,
        gui->show_window();
        gui->raise_window();
        gui->unlock_window();
-
+       cwindow->gui->lock_window("MWindow::create_objects 1");
+       cwindow->gui->tool_panel->raise_tool();
+       cwindow->gui->unlock_window();
        if(debug) PRINT_TRACE
 
        if(preferences->use_tipwindow)
@@ -3673,6 +3675,7 @@ void MWindow::update_project(int load_mode)
        if(debug) PRINT_TRACE
        cwindow->gui->lock_window("MWindow::update_project 2");
        cwindow->gui->timebar->update(0);
+       cwindow->gui->tool_panel->raise_tool();
        cwindow->gui->unlock_window();
 
        if(debug) PRINT_TRACE
index 80e655248476ec2b320e1935005ef17959884c8a..6285f3504dd7cfe0f407dc9bc6ae60372d03db14 100644 (file)
@@ -22,6 +22,7 @@
 #include "automation.h"
 #include "edl.h"
 #include "edlsession.h"
+#include "localsession.h"
 #include "mwindow.h"
 #include "patchbay.h"
 #include "playabletracks.h"
@@ -79,21 +80,32 @@ int PlayableTracks::is_playable(Track *current_track,
        if(current_track->data_type != data_type) result = 0;
 
 // Track is off screen and not bounced to other modules
-       if(result)
-       {
-               if(!current_track->plugin_used(position, direction) &&
-                       !current_track->is_playable(position, direction))
+       if( result &&
+               !current_track->plugin_used(position, direction) &&
+               !current_track->is_playable(position, direction) )
                        result = 0;
-       }
-
 // Test play patch
-       if(!current_track->play)
-       {
-               result = 0;
+       if( result &&
+               !current_track->play )
+                       result = 0;
+       if( result ) {
+               EDL *edl = current_track->edl;
+               int solo_track_id = edl->local_session->solo_track_id;
+               if( solo_track_id >= 0 ) {
+                       int visible = 0;
+                       int current_id = current_track->get_id();
+                       Track *track = edl->tracks->first;
+                       while( track ) {
+                               int id = track->get_id();
+                               if( id == solo_track_id ) { visible = 1;  break; }
+                               if( id == current_id ) { visible = 0; break; }
+                               track = track->next;
+                       }
+                       if( !track ) visible = 1;
+                       result = visible;
+               }
        }
-
-       if(result)
-       {
+       if( result ) {
 // Test for playable edit
                if(!current_track->playable_edit(position, direction))
                {
index 1c7ddc75701e8fbcbebc5779aebe4e32e3bc6028..e9b087fb16636af0075899302e9ace701f002720 100644 (file)
@@ -38,6 +38,7 @@
 #include "pluginclient.h"
 #include "pluginvclient.h"
 #include "edlsession.h"
+#include "track.h"
 #include "transportque.inc"
 #include "vframe.h"
 
@@ -1294,9 +1295,11 @@ void Playback3D::do_mask_sync(Playback3DCommand *command)
                glClearColor(bg, bg, bg, bg);
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 
+               int show_mask = command->keyframe_set->track->masks;
                for(int k = 0; k < total_submasks; k++) {
                        MaskPointSet &points = point_set[k];
                        MaskEdge &edge = *edges.append(new MaskEdge());
+                       if( !((show_mask>>k) & 1) ) continue;
                        int first_point = 0;
 // Need to tabulate every vertex in persistent memory because
 // gluTessVertex doesn't copy them.
index b59e609b189c4e28f63b6078033953f344f8dc0d..228f3890b2def426bf3d37f808c81fbeeaabb6ad 100644 (file)
@@ -539,9 +539,9 @@ int PlaybackEngine::transport_command(int command, int change_type, EDL *new_edl
 // Just change the EDL if the change requires it because renderengine
 // structures won't point to the new EDL otherwise and because copying the
 // EDL for every cursor movement is slow.
-               if( change_type & CHANGE_EDL )
+               if( change_type == CHANGE_EDL || change_type == CHANGE_ALL )
                        next_command->get_edl()->copy_all(new_edl);
-               else if( change_type & CHANGE_PARAMS )
+               else if( change_type == CHANGE_PARAMS )
                        next_command->get_edl()->synchronize_params(new_edl);
                next_command->set_playback_range(new_edl, use_inout,
                                preferences->forward_render_displacement);
index b5382c3383406354a7b6a55d81c8c8928cdc6dac..2413c4f7dc6fa0aa45520866624e5fec71bc6928 100644 (file)
@@ -33,6 +33,7 @@
 #include "keyframe.h"
 #include "labels.h"
 #include "localsession.h"
+#include "maskauto.h"
 #include "module.h"
 #include "patch.h"
 #include "patchbay.h"
@@ -67,6 +68,7 @@ Track::Track(EDL *edl, Tracks *tracks) : ListItem<Track>()
        track_h = edl->session->output_h;
        id = EDL::next_id();
        mixer_id = -1;
+       masks = (1<<SUBMASKS)-1;
 }
 
 Track::~Track()
@@ -92,6 +94,7 @@ int Track::copy_settings(Track *track)
        this->play = track->play;
        this->track_w = track->track_w;
        this->track_h = track->track_h;
+       this->masks = track->masks;
        strcpy(this->title, track->title);
        return 0;
 }
@@ -334,6 +337,7 @@ int Track::load(FileXML *file, int track_offset, uint32_t load_flags)
        expand_view = file->tag.get_property("EXPAND", expand_view);
        track_w = file->tag.get_property("TRACK_W", track_w);
        track_h = file->tag.get_property("TRACK_H", track_h);
+       masks = file->tag.get_property("MASKS", masks);
 
        load_header(file, load_flags);
 
@@ -852,8 +856,8 @@ void Track::synchronize_params(Track *track)
 
 int Track::dump(FILE *fp)
 {
-       fprintf(fp,"   Data type %d, draw %d, gang %d, play %d, record %d, nudge %jd\n",
-               data_type, draw, gang, play, record, nudge);
+       fprintf(fp,"   Data type %d, draw %d, gang %d, play %d, record %d, nudge %jd, masks 0x%04x\n",
+               data_type, draw, gang, play, record, nudge, masks);
        fprintf(fp,"   Title %s\n", title);
        fprintf(fp,"   Edits:\n");
        for(Edit* current = edits->first; current; current = NEXT)
@@ -1056,6 +1060,7 @@ int Track::copy(int copy_flags, double start, double end,
        file->tag.set_property("EXPAND", expand_view);
        file->tag.set_property("TRACK_W", track_w);
        file->tag.set_property("TRACK_H", track_h);
+       file->tag.set_property("MASKS", masks);
        save_header(file);
        file->append_tag();
        file->append_newline();
index 669b2db769cb9136b6df9cf62aa364c1d84de160..513c046b47631e73d9430b7f14f65e64cfc48932 100644 (file)
@@ -179,6 +179,8 @@ public:
        char title[BCTEXTLEN];
        int play;
        int record;
+// mask enable bit flags
+       int masks;
 // Nudge in track units.  Positive shifts track earlier in time.  This way
 // the position variables only need to add the nudge.
        int64_t nudge;
index 4873fac020d351c396da0fb0914c2d8be64ae38c..7feb1f99cfc1febeec05653ee8843c244ec52f1f 100644 (file)
@@ -170,6 +170,8 @@ void Tracks::copy_from(Tracks *tracks)
        Track *new_track = 0;
 
        delete_all_tracks();
+       int solo_track_id = tracks->edl->local_session->solo_track_id;
+
        for(Track *current = tracks->first; current; current = NEXT)
        {
                switch(current->data_type)
@@ -187,6 +189,9 @@ void Tracks::copy_from(Tracks *tracks)
                        continue;
                }
                new_track->copy_from(current);
+
+               if( current->get_id() == solo_track_id )
+                       edl->local_session->solo_track_id = new_track->get_id();
        }
 }
 
@@ -625,6 +630,12 @@ Track* Tracks::number(int number)
        return current;
 }
 
+Track* Tracks::get_track_by_id(int id)
+{
+       Track *track = edl->tracks->first;
+       while( track && track->get_id() != id ) track = track->next;
+       return track;
+}
 
 int Tracks::total_playable_vtracks()
 {
index da867148de5f10e0c69d48f6dbf7c142c3c05c78..0aff6a37365930a5865cb54ac9463b0876a65490 100644 (file)
@@ -104,7 +104,8 @@ public:
        void select_all(int type,
                int value);
        void translate_projector(float offset_x, float offset_y);
-               int total_of(int type);
+       int total_of(int type);
+       Track* get_track_by_id(int id);
 // add a track
        Track* add_audio_track(int above, Track *dst_track);
        Track* add_video_track(int above, Track *dst_track);
index 3ff3010119e17a1a3217def57405a319c45f23f0..f24a39e0b3ee96389b9e4f8d3972229aa050a6b7 100644 (file)
@@ -689,6 +689,7 @@ void BC_FileBox::create_objects()
 
        refresh();
        show_window();
+       raise_window();
        unlock_window();
 }
 
index 078134c011f6a0c8b595c762a83bf0e8783dd840..3dfb6cd5f29c42435261b4bb9766d18ff1fb32bb 100644 (file)
@@ -2561,55 +2561,26 @@ void BC_PopupTextBox::update_list(ArrayList<BC_ListBoxItem*> *data)
        listbox->update(data, 0, 0, 1);
 }
 
-
-const char* BC_PopupTextBox::get_text()
-{
-       return textbox->get_text();
-}
-
-const wchar_t* BC_PopupTextBox::get_wtext()
-{
-       return textbox->get_wtext();
-}
-
-int BC_PopupTextBox::get_number()
-{
-       return listbox->get_selection_number(0, 0);
-}
-
-int BC_PopupTextBox::get_x()
-{
-       return x;
-}
-
-int BC_PopupTextBox::get_y()
-{
-       return y;
-}
-
-int BC_PopupTextBox::get_w()
-{
-       return textbox->get_w() + listbox->get_w();
-}
-
-int BC_PopupTextBox::get_h()
-{
-       return textbox->get_h();
-}
-
-int BC_PopupTextBox::get_show_query()
+int BC_PopupTextBox::handle_event()
 {
-       return listbox->get_show_query();
+       return 1;
 }
 
-void BC_PopupTextBox::set_show_query(int v)
-{
-       listbox->set_show_query(v);
-}
+const char *BC_PopupTextBox::get_text() { return textbox->get_text(); }
+const wchar_t *BC_PopupTextBox::get_wtext() { return textbox->get_wtext(); }
+int BC_PopupTextBox::get_number() { return listbox->get_selection_number(0, 0); }
+int BC_PopupTextBox::get_x() { return x; }
+int BC_PopupTextBox::get_y() { return y; }
+int BC_PopupTextBox::get_w() { return textbox->get_w() + listbox->get_w(); }
+int BC_PopupTextBox::get_h() { return textbox->get_h(); }
+int BC_PopupTextBox::get_show_query() { return listbox->get_show_query(); }
+void BC_PopupTextBox::set_show_query(int v) { listbox->set_show_query(v); }
+int BC_PopupTextBox::get_back_color() { return textbox->get_back_color(); }
+void BC_PopupTextBox::set_back_color(int v) { textbox->set_back_color(v); }
 
-int BC_PopupTextBox::handle_event()
+void BC_PopupTextBox::set_tooltip(const char *text)
 {
-       return 1;
+       listbox->set_tooltip(text);
 }
 
 void BC_PopupTextBox::reposition_window(int x, int y)
@@ -2626,12 +2597,6 @@ void BC_PopupTextBox::reposition_window(int x, int y)
 //     if(flush) parent_window->flush();
 }
 
-void BC_PopupTextBox::set_tooltip(const char *text)
-{
-       listbox->set_tooltip(text);
-}
-
-
 
 BC_TumbleTextBoxText::BC_TumbleTextBoxText(BC_TumbleTextBox *popup,
        int64_t default_value, int x, int y)
index d58605775b6d58090128c87cb65d1f264c36f48e..954aa9a501054640756a3ad74da060af50bb1e8f 100644 (file)
@@ -349,8 +349,9 @@ public:
        virtual ~BC_PopupTextBox();
        int create_objects();
        virtual int handle_event();
-       const char* get_text();
-       const wchar_t* get_wtext();
+
+       const char *get_text();
+       const wchar_t *get_wtext();
        int get_number();
        int get_x();
        int get_y();
@@ -358,6 +359,9 @@ public:
        int get_h();
        int get_show_query();
        void set_show_query(int v);
+       int get_back_color();
+       void set_back_color(int v);
+
        void set_tooltip(const char *text);
 
        void update(const char *text);
index 10ee7faf0a69ea810913829a1ab183528b9e625d..f649113eae11607a1bb3f0f472a5ef8ab580bcf6 100644 (file)
@@ -1,11 +1,11 @@
 #cuda compile
 
-CUDA_PATH ?= /usr/local/cuda-10.1
+CUDA_PATH ?= /usr/local/cuda
 TARGET_SIZE := 64 # 32
 HOST_COMPILER ?= g++
 NVCC := $(CUDA_PATH)/bin/nvcc -ccbin $(HOST_COMPILER)
 NVCCFLAGS := -m${TARGET_SIZE} -Xcompiler -fPIC -Xcompiler -fno-omit-frame-pointer -g
-LDFLAGS = -lcuda -L /usr/local/cuda/targets/x86_64-linux/lib -lcudart
+LDFLAGS = -lcuda -L $(CUDA_PATH)/targets/x86_64-linux/lib -lcudart
 
 SMS ?= 30 35 37 50 52 60 61 70 75
 $(foreach sm,$(SMS),$(eval GENCODE_FLAGS += -gencode arch=compute_$(sm),code=sm_$(sm)))
@@ -15,14 +15,14 @@ GENCODE_FLAGS += -gencode arch=compute_$(HIGHEST_SM),code=compute_$(HIGHEST_SM)
 # samples source access BEWARE!
 # contains includes which conflict: search /usr/include first
 CFLAGS += -I/usr/include -I/usr/local/cuda/samples
-CFLAGS += -I/usr/local/cuda/samples/common/inc
-CFLAGS += -I/usr/local/cuda/targets/x86_64-linux/include
+CFLAGS += -I$(CUDA_PATH)/samples/common/inc
+CFLAGS += -I$(CUDA_PATH)/targets/x86_64-linux/include
 CFLAGS += -Wno-unused-function
 
 INCLUDES += -I$(TOPDIR)/cinelerra -I$(TOPDIR)/guicast
-INCLUDES += -I/usr/local/cuda/samples
-INCLUDES += -I/usr/local/cuda/samples/common/inc
-INCLUDES += -I/usr/local/cuda/targets/x86_64-linux/include
+INCLUDES += -I$(CUDA_PATH)/samples
+INCLUDES += -I$(CUDA_PATH)/samples/common/inc
+INCLUDES += -I$(CUDA_PATH)/targets/x86_64-linux/include
 
 CUFLAGS := $(INCLUDES) $(NVCCFLAGS) $(GENCODE_FLAGS)
 $(shell mkdir -p $(OBJDIR))