fixes for vicons checkin
authorGood Guy <good1.2guy@gmail.com>
Fri, 4 Dec 2015 03:09:42 +0000 (20:09 -0700)
committerGood Guy <good1.2guy@gmail.com>
Fri, 4 Dec 2015 03:09:42 +0000 (20:09 -0700)
cinelerra-5.0/cinelerra/awindowgui.C
cinelerra-5.0/guicast/vicon.C
cinelerra-5.0/guicast/vicon.h

index 5b8d9f77cc38617f247c3747313d539fb8d2802c..17354995790f0079117fdda473b920ae2176452c 100644 (file)
@@ -86,12 +86,11 @@ VFrame *AssetVIcon::frame()
                VFrame frame(asset->width, asset->height, BC_RGB888);
                file->set_layer(0);
                file->set_video_position(images.size(),0);
-               VFrame *vfrm0 = images[0];
-               int ww = vfrm0->get_w(), hh = vfrm0->get_h();
-               int cmdl = vfrm0->get_color_model();
+               int ww = picon->gui->vicon_thread->view_w;
+               int hh = picon->gui->vicon_thread->view_h;
                while( seq_no >= images.size() ) {
                        file->read_frame(&frame);
-                       add_image(&frame, ww, hh, cmdl);
+                       add_image(&frame, ww, hh, BC_RGB8);
                }
                mwindow->video_cache->check_in(asset);
        }
@@ -262,8 +261,6 @@ void AssetPicon::create_objects()
                                        int64_t vframes = asset->get_video_frames();
                                        if( length > vframes ) length = vframes;
                                        vicon = new AssetVIcon(this, pixmap_w, pixmap_h, framerate, length);
-                                       int ww = gui->vicon_thread->view_w, hh = gui->vicon_thread->view_h;
-                                       vicon->add_image(gui->temp_picon, ww, hh, BC_RGB8);
                                        gui->vicon_thread->add_vicon(vicon);
                                        if(debug) printf("AssetPicon::create_objects %d\n", __LINE__);
 
@@ -1524,9 +1521,14 @@ int AWindowAssets::selection_changed()
                BC_ListBox::deactivate_selection();
                return 1;
        }
-       else if(get_button_down() && get_buttonpress() == 1 && get_selection(0, 0)) {
-               AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
-               gui->vicon_thread->set_view_popup(picon->vicon);
+       else if( get_button_down() && get_buttonpress() == 1 && get_selection(0, 0) ) {
+               VIcon *vicon = 0;
+               if( !gui->vicon_thread->viewing ) {
+                       AssetPicon *picon = (AssetPicon*)get_selection(0, 0);
+                       vicon = picon->vicon;
+               }
+               gui->vicon_thread->set_view_popup(vicon);
+
        }
        return 0;
 }
index 05f56dfeae357da1d1db90c2deb5c7ef31457561..814ef2d4c605c30d3d401e30814ad66700c6b230 100644 (file)
@@ -68,7 +68,6 @@ VIconThread(BC_WindowBase *wdw, int vw, int vh)
 {
        this->wdw = wdw;
        this->view_win = 0;  this->vicon = 0;
-       this->cur_view = 0;  this->new_view = 0;
        this->view_w = vw;   this->view_h = vh;
        this->viewing = 0;   this->draw_flash = 0;
        draw_lock = new Condition(0, "VIconThread::draw_lock", 1);
@@ -95,7 +94,7 @@ VIconThread::
 void VIconThread::
 start_drawing()
 {
-       wdw->lock_window("VIconThread::stop_drawing");
+       wdw->lock_window("VIconThread::start_drawing");
         if( interrupted )
                draw_lock->unlock();
        wdw->unlock_window();
@@ -111,12 +110,17 @@ stop_drawing()
 
 int VIconThread::keypress_event(int key)
 {
-       if( !cur_view ) return 0;
        if( key != ESC ) return 0;
        set_view_popup(0);
        return 1;
 }
 
+int ViewPopup::button_press_event()
+{
+       vt->set_view_popup(0);
+       return 1;
+}
+
 bool VIconThread::
 visible(VIcon *vicon, int x, int y)
 {
@@ -138,11 +142,6 @@ int ViewPopup::keypress_event()
        int key = get_keypress();
        return vt->keypress_event(key);
 }
-int ViewPopup::button_press_event()
-{
-       return vt->keypress_event(ESC);
-}
-
 ViewPopup::ViewPopup(VIconThread *vt, VFrame *frame, int x, int y, int w, int h)
  : BC_Popup(vt->wdw, x, y, w, h, BLACK)
 {
@@ -205,19 +204,12 @@ void VIconThread::set_view_popup(VIcon *vicon)
 int VIconThread::
 update_view()
 {
-       if( viewing == vicon && cur_view == new_view ) return 0;
-       wdw->lock_window("VIconThread::update_view");;
-       if( viewing && !vicon ) new_view = 0;
-       if( !viewing && vicon ) new_view = 1;
-       if( cur_view != new_view && !new_view ) vicon = 0;
-       viewing = vicon;  cur_view = new_view;
        delete view_win;  view_win = 0;
-       if( cur_view ) {
+       if( (viewing=vicon) != 0 ) {
                VFrame *frame = viewing->frame();
                view_win = new_view_window(frame);
                view_win->show_window();
-        }
-       wdw->unlock_window();
+       }
        return 1;
 }
 
@@ -267,7 +259,7 @@ run()
                interrupted = 0;
                drawing_started();
                while( !interrupted ) {
-                       if( viewing != vicon || cur_view != new_view )
+                       if( viewing != vicon )
                                update_view();
                        VIcon *next = low_vicon();
                        if( !next ) break;
index fb315289a57aa44dbfb72b63263dae627b4fb8e0..b209af3a60f019284d049284695ddf8393d9349e 100644 (file)
@@ -59,7 +59,6 @@ public:
        ViewPopup *view_win;
        VIcon *viewing, *vicon;
        int view_w, view_h;
-       int cur_view, new_view;
        int img_dirty, win_dirty;
        int64_t draw_flash;