add binfolder path relative filters, fix gbrp color model, vwdw timebar tweaks, title...
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index d7f6268b3cbc4a49ba7968c70fc33675dc65d60b..1ab6ea1affe3b65c6a63ad6a95a9ba8592a0cdd3 100644 (file)
@@ -153,6 +153,10 @@ VFrame *AssetVIcon::frame()
                if( !temp )
                        temp = new VFrame(0, -1, asset->width, asset->height, BC_RGB888, -1);
                while( seq_no >= images.size() ) {
+                       mwindow->video_cache->check_in(asset);
+                       Thread::yield();
+                       file = mwindow->video_cache->check_out(asset, mwindow->edl, 0);
+                       if( !file ) { usleep(1000);  continue; }
                        file->set_layer(0);
                        int64_t pos = images.size() / picon->gui->vicon_thread->refresh_rate * frame_rate;
                        file->set_video_position(pos,0);
@@ -1713,17 +1717,18 @@ EDL *AWindowGUI::collect_proxy(Indexable *indexable)
 }
 
 
-void AWindowGUI::collect_assets()
+void AWindowGUI::collect_assets(int proxy)
 {
        mwindow->session->drag_assets->remove_all();
        mwindow->session->drag_clips->remove_all();
        int i = 0;  AssetPicon *result;
        while( (result = (AssetPicon*)asset_list->get_selection(0, i++)) != 0 ) {
                Indexable *indexable = result->indexable;
-               if( indexable && indexable->is_asset &&
+               if( proxy && indexable && indexable->is_asset &&
                    indexable->awindow_folder == AW_PROXY_FOLDER ) {
                        EDL *drag_edl = collect_proxy(indexable);
                        if( drag_edl ) mwindow->session->drag_clips->append(drag_edl);
+                       continue;
                }
                if( indexable ) {
                        mwindow->session->drag_assets->append(indexable);
@@ -1751,10 +1756,13 @@ void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
                AssetPicon *picon = (AssetPicon*)src->values[i];
                picon->sort_key = -1;
                if( !visible && bin_folder ) {
-                       Indexable *idxbl = bin_folder->is_clips ? picon->edl : picon->indexable;
+                       Indexable *idxbl = bin_folder->is_clips ? (Indexable *)picon->edl :
+                           picon->indexable ? picon->indexable :
+                           picon->edl ? picon->edl->get_proxy_asset() : 0;
                        if( idxbl ) {
                                picon->sort_key = mwindow->edl->folders.matches_indexable(folder, idxbl);
-                               if( picon->sort_key >= 0 ) visible = 1;
+                               if( picon->sort_key < 0 ) continue;
+                               visible = 1;
                        }
                }
                if( !visible && picon->indexable && picon->indexable->awindow_folder == folder )
@@ -2080,7 +2088,7 @@ int AWindowFolders::drag_stop()
                        ArrayList<Indexable *> *drags = folder->is_clips ?
                                ((ArrayList<Indexable *> *)mwindow->session->drag_clips) :
                                ((ArrayList<Indexable *> *)mwindow->session->drag_assets);
-                       if( folder && drags && !folder->add_patterns(drags) )
+                       if( folder && drags && !folder->add_patterns(drags, shift_down()) )
                                flicker(1,30);
                        mwindow->session->current_operation = ::NO_OPERATION;
                        result = 1;
@@ -2226,17 +2234,17 @@ int AWindowAssets::selection_changed()
                        break;
                }
 
-               BC_ListBox::deactivate_selection();
+               deactivate_selection();
        }
-       else if( gui->vicon_drawing &&
-                get_button_down() && get_buttonpress() == 1 &&
-                (item = (AssetPicon*)get_selection(0, 0)) ) {
+       else if( gui->vicon_drawing && get_button_down() && get_buttonpress() == 1 &&
+                ( mwindow->edl->session->awindow_folder == AW_MEDIA_FOLDER ||
+                  mwindow->edl->session->awindow_folder >= AWINDOW_USER_FOLDERS ) &&
+                  (item = (AssetPicon*)get_selection(0, 0)) != 0 ) {
                VIcon *vicon = 0;
-               if( !gui->vicon_thread->viewing ) {
+               if( !gui->vicon_thread->vicon  ) {
                        vicon = item->vicon;
                }
                gui->vicon_thread->set_view_popup(vicon);
-
        }
        return 1;
 }
@@ -2255,7 +2263,7 @@ void AWindowAssets::draw_background()
 int AWindowAssets::drag_start_event()
 {
        int collect_pluginservers = 0;
-       int collect_assets = 0;
+       int collect_assets = 0, proxy = 0;
 
        if( BC_ListBox::drag_start_event() ) {
                switch( mwindow->edl->session->awindow_folder ) {
@@ -2278,6 +2286,8 @@ int AWindowAssets::drag_start_event()
                case AW_LABEL_FOLDER:
                        // do nothing!
                        break;
+               case AW_PROXY_FOLDER:
+                       proxy = 1; // fall thru
                case AW_MEDIA_FOLDER:
                default:
                        mwindow->session->current_operation = DRAG_ASSET;
@@ -2298,7 +2308,7 @@ int AWindowAssets::drag_start_event()
                }
 
                if( collect_assets ) {
-                       gui->collect_assets();
+                       gui->collect_assets(proxy);
                }
 
                return 1;
@@ -2403,8 +2413,9 @@ int AWindowAssets::column_resize_event()
 
 int AWindowAssets::focus_in_event()
 {
+       int ret = BC_ListBox::focus_in_event();
        gui->start_vicon_drawing();
-       return 0;
+       return ret;
 }
 
 int AWindowAssets::focus_out_event()
@@ -2413,6 +2424,19 @@ int AWindowAssets::focus_out_event()
        return BC_ListBox::focus_out_event();
 }
 
+int AWindowAssets::cursor_enter_event()
+{
+       int ret = BC_ListBox::cursor_enter_event();
+       gui->start_vicon_drawing();
+       return ret;
+}
+
+int AWindowAssets::cursor_leave_event()
+{
+       gui->stop_vicon_drawing();
+       return BC_ListBox::cursor_leave_event();
+}
+
 void AWindowAssets::update_vicon_area()
 {
        int x0 = 0, x1 = get_w();
@@ -2425,6 +2449,18 @@ void AWindowAssets::update_vicon_area()
        gui->vicon_thread->set_drawing_area(x0,y0, x1,y1);
 }
 
+int AWindowAssets::mouse_over_event(int no)
+{
+       if( gui->vicon_thread->viewing &&
+           no >= 0 && no < gui->displayed_assets[0].size() ) {
+               AssetPicon *picon = (AssetPicon *)gui->displayed_assets[0][no];
+               VIcon *vicon = picon->vicon;
+               picon->gui->vicon_thread->set_view_popup(vicon);
+       }
+       return 0;
+}
+
+
 AWindowSearchTextBox::AWindowSearchTextBox(AWindowSearchText *search_text, int x, int y, int w)
  : BC_TextBox(x, y, w, 1, "")
 {
@@ -2658,7 +2694,7 @@ AVIconDrawing::AVIconDrawing(AWindowGUI *agui, int x, int y, VFrame **images)
  : BC_Toggle(x, y, images, agui->vicon_drawing)
 {
        this->agui = agui;
-       set_tooltip(_("draw vicons"));
+       set_tooltip(_("Preview"));
 }
 
 void AVIconDrawing::calculate_geometry(AWindowGUI *agui, VFrame **images, int *ww, int *hh)