vicon drag tweaks, proxy drag fix, vicon mouseover, binfolder around sort fix, draw_r...
[goodguy/history.git] / cinelerra-5.1 / guicast / vicon.C
index 1f80bc470c40799c84067557e1938ba769ff4591..f9978b26ebf0e917b1d7f6852a26b72dbf670c6d 100644 (file)
@@ -43,6 +43,8 @@ add_image(VFrame *frm, int ww, int hh, int vcmdl)
 void VIcon::
 draw_vframe(VIconThread *vt, BC_WindowBase *wdw, int x, int y)
 {
+       VFrame *vfrm = frame();
+       if( !vfrm ) return;
        int sx0 = 0, sx1 = sx0 + vt->view_w;
        int sy0 = 0, sy1 = sy0 + vt->view_h;
        int dx0 = x, dx1 = dx0 + vw;
@@ -54,7 +56,7 @@ draw_vframe(VIconThread *vt, BC_WindowBase *wdw, int x, int y)
        int sw = sx1 - sx0, sh = sy1 - sy0;
        int dw = dx1 - dx0, dh = dy1 - dy0;
        if( dw > 0 && dh > 0 && sw > 0 && sh > 0 )
-               wdw->draw_vframe(frame(), dx0,dy0, dw,dh, sx0,sy0, sw,sh);
+               wdw->draw_vframe(vfrm, dx0,dy0, dw,dh, sx0,sy0, sw,sh);
 }
 
 void VIconThread::
@@ -103,6 +105,7 @@ VIconThread(BC_WindowBase *wdw, int vw, int vh)
        this->refresh_rate = VICON_RATE;
        done = 0;
        interrupted = -1;
+       stop_age = 0;
 }
 
 VIconThread::
@@ -128,6 +131,8 @@ start_drawing()
                wdw->set_active_subwindow(view_win);
         if( interrupted < 0 )
                draw_lock->unlock();
+       timer->update();
+       timer->subtract(-stop_age);
        interrupted = 0;
        wdw->unlock_window();
 }
@@ -139,6 +144,7 @@ stop_drawing()
        set_view_popup(0);
        if( !interrupted )
                interrupted = 1;
+       stop_age = timer->get_difference();
        wdw->unlock_window();
 }
 
@@ -149,12 +155,6 @@ int VIconThread::keypress_event(int key)
        return 1;
 }
 
-int ViewPopup::button_press_event()
-{
-       vt->set_view_popup(0);
-       return 1;
-}
-
 bool VIconThread::
 visible(VIcon *vicon, int x, int y)
 {
@@ -171,6 +171,7 @@ int ViewPopup::keypress_event()
        int key = get_keypress();
        return vt->keypress_event(key);
 }
+
 ViewPopup::ViewPopup(VIconThread *vt, VFrame *frame, int x, int y, int w, int h)
  : BC_Popup(vt->wdw, x, y, w, h, BLACK)
 {
@@ -184,6 +185,7 @@ ViewPopup::~ViewPopup()
 
 void ViewPopup::draw_vframe(VFrame *frame)
 {
+       if( !frame ) return;
        BC_WindowBase::draw_vframe(frame, 0,0, get_w(),get_h());
 }
 
@@ -232,14 +234,13 @@ int VIconThread::del_vicon(VIcon *&vicon)
 
 void VIconThread::set_view_popup(VIcon *vicon)
 {
-       if( !vicon && this->vicon )
-               this->vicon->stop_audio();
        this->vicon = vicon;
 }
 
 int VIconThread::
 update_view()
 {
+       if( viewing ) viewing->stop_audio();
        delete view_win;  view_win = 0;
        if( (viewing=vicon) != 0 ) {
                VFrame *frame = viewing->frame();
@@ -287,6 +288,14 @@ draw(VIcon *vicon)
        return 1;
 }
 
+void VIconThread::hide_vicons(int v)
+{
+       for( int i=0; i<t_heap.size(); ++i ) {
+               t_heap[i]->hidden = v;
+               t_heap[i]->age = 0;
+       }
+}
+
 void VIconThread::
 run()
 {