sams ladspa icons, add theme color to common icons
[goodguy/history.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index f7d690acfb89fcf5ba265824d449caf995e037df..763f62fe3fd85d27a5a9a4c18bafcc69690442f4 100644 (file)
@@ -29,6 +29,7 @@
 #include "bcsignals.h"
 #include "bchash.h"
 #include "cache.h"
+#include "cstrdup.h"
 #include "clip.h"
 #include "clippopup.h"
 #include "cursors.h"
@@ -297,31 +298,31 @@ void AssetPicon::create_objects()
                                else {
                                        gui->lock_window("AssetPicon::create_objects 2");
                                        icon = gui->video_icon;
-                                       icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
+                                       icon_vframe = gui->video_vframe;
                                }
                        }
                        else {
                                icon = gui->video_icon;
-                               icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
+                               icon_vframe = gui->video_vframe;
                        }
                }
                else
                if( asset->audio_data ) {
                        icon = gui->audio_icon;
-                       icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_SOUND];
+                       icon_vframe = gui->audio_vframe;
                }
 
        }
        else
        if( indexable && !indexable->is_asset ) {
                icon = gui->video_icon;
-               icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_FILM];
+               icon_vframe = gui->video_vframe;
        }
        else
        if( edl ) {
                set_text(strcpy(name, edl->local_session->clip_title));
                icon = gui->clip_icon;
-               icon_vframe = mwindow->theme->get_image("clip_icon");
+               icon_vframe = gui->clip_vframe;
        }
        else
        if( plugin ) {
@@ -373,9 +374,7 @@ void AssetPicon::create_objects()
                              mwindow->edl->session->frames_per_foot);
                set_text(name);
                icon = gui->label_icon;
-               icon_vframe = BC_WindowBase::get_resources()->type_to_icon[ICON_LABEL];
-               set_icon(icon);
-               set_icon_vframe(icon_vframe);
+               icon_vframe = gui->label_vframe;
        }
        if( !icon ) {
                icon = gui->file_icon;
@@ -436,6 +435,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
        labellist_menu = 0;
        folderlist_menu = 0;
        temp_picon = 0;
+       search_text = 0;
        allow_iconlisting = 1;
        remove_plugin = 0;
        vicon_thread = 0;
@@ -465,6 +465,7 @@ AWindowGUI::~AWindowGUI()
        delete cliplist_menu;
        delete labellist_menu;
        delete folderlist_menu;
+       delete search_text;
        delete temp_picon;
        delete remove_plugin;
 
@@ -614,9 +615,9 @@ void AWindowGUI::create_objects()
        mwindow->theme->get_awindow_sizes(this);
        load_defaults(mwindow->defaults);
 
-       int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y + 5;
+       int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y;
        int w1 = mwindow->theme->alist_w, h1 = mwindow->theme->alist_h;
-       search_text = new AWindowSearchText(mwindow, this, x1, y1);
+       search_text = new AWindowSearchText(mwindow, this, x1, y1+5);
        search_text->create_objects();
        int dy = search_text->get_h() + 10;
        y1 += dy;  h1 -= dy;
@@ -718,9 +719,9 @@ int AWindowGUI::translation_event()
 
 void AWindowGUI::reposition_objects()
 {
-       int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y + 5;
+       int x1 = mwindow->theme->alist_x, y1 = mwindow->theme->alist_y;
        int w1 = mwindow->theme->alist_w, h1 = mwindow->theme->alist_h;
-       search_text->reposition_window(x1, y1, w1);
+       search_text->reposition_window(x1, y1+5, w1);
        int dy = search_text->get_h() + 10;
        y1 += dy;  h1 -= dy;
        asset_list->reposition_window(x1, y1, w1, h1);
@@ -835,6 +836,7 @@ void AWindowRemovePlugin::handle_close_event(int result)
 {
        if( !result ) {
                printf(_("remove %s\n"), plugin->path);
+               awindow->gui->lock_window("AWindowRemovePlugin::handle_close_event");
                ArrayList<BC_ListBoxItem*> *folder =
                        plugin->audio ? plugin->transition ?
                                &awindow->gui->atransitions :
@@ -844,14 +846,14 @@ void AWindowRemovePlugin::handle_close_event(int result)
                                &awindow->gui->veffects :
                        0;
                if( folder ) remove_plugin(plugin, *folder);
+               MWindow *mwindow = awindow->mwindow;
+               awindow->gui->unlock_window();
                char plugin_path[BCTEXTLEN];
                strcpy(plugin_path, plugin->path);
-               MWindow *mwindow = awindow->mwindow;
                mwindow->plugindb->remove(plugin);
                remove(plugin_path);
                char index_path[BCTEXTLEN];
-               snprintf(index_path, sizeof(index_path), "%s/%s",
-                       mwindow->preferences->plugin_dir, PLUGIN_FILE);
+               mwindow->create_defaults_path(index_path, PLUGIN_FILE);
                remove(index_path);
                char picon_path[BCTEXTLEN];
                FileSystem fs;
@@ -943,7 +945,6 @@ void AWindowGUI::async_update_assets()
 
 void AWindowGUI::update_folder_list()
 {
-       stop_vicon_drawing();
        for( int i = 0; i < folders.total; i++ ) {
                AssetPicon *picon = (AssetPicon*)folders.values[i];
                picon->in_use = 0;
@@ -981,8 +982,6 @@ void AWindowGUI::update_folder_list()
                        folders.remove_number(i);
                }
        }
-
-       start_vicon_drawing();
 }
 
 void AWindowGUI::create_persistent_folder(ArrayList<BC_ListBoxItem*> *output,
@@ -1198,7 +1197,9 @@ void AWindowGUI::copy_picons(ArrayList<BC_ListBoxItem*> *dst,
                    (picon->indexable && picon->indexable->awindow_folder == folder) ||
                    (picon->edl && picon->edl->local_session->awindow_folder == folder) ) {
                        const char *text = search_text->get_text();
-                       if( text && text[0] && !strstr(picon->get_text(), text) ) continue;
+                       int hidden = text && text[0] && !bstrcasestr(picon->get_text(), text);
+                       if( picon->vicon ) picon->vicon->hidden = hidden;
+                       if( hidden ) continue;
                        BC_ListBoxItem *item2, *item1;
                        dst[0].append(item1 = picon);
                        if( picon->edl )
@@ -1279,10 +1280,14 @@ void AWindowGUI::filter_displayed_assets()
 
 void AWindowGUI::update_assets()
 {
+       stop_vicon_drawing();
        update_folder_list();
        update_asset_list();
        labellist.remove_all_objects();
        create_label_folder();
+
+       if( displayed_folder != mwindow->edl->session->awindow_folder )
+               search_text->clear();
        filter_displayed_assets();
 
        if( mwindow->edl->session->folderlist_format != folder_list->get_format() ) {
@@ -1307,6 +1312,7 @@ void AWindowGUI::update_assets()
        asset_list->center_selection();
 
        flush();
+       start_vicon_drawing();
        return;
 }
 
@@ -1744,11 +1750,13 @@ int AWindowAssets::drag_stop_event()
 
        lock_window("AWindowAssets::drag_stop_event");
 
-       if( result ) get_drag_popup()->set_animation(0);
+       if( result )
+               get_drag_popup()->set_animation(0);
 
        BC_ListBox::drag_stop_event();
-       mwindow->session->current_operation = ::NO_OPERATION; // since NO_OPERATION is also defined in listbox, we have to reach for global scope...
-       return 0;
+// since NO_OPERATION is also defined in listbox, we have to reach for global scope...
+       mwindow->session->current_operation = ::NO_OPERATION;
+       return 1;
 }
 
 int AWindowAssets::column_resize_event()
@@ -1828,6 +1836,11 @@ const char *AWindowSearchText::get_text()
        return text_box->get_text();
 }
 
+void AWindowSearchText::clear()
+{
+       text_box->update("");
+}
+
 AWindowNewFolder::AWindowNewFolder(MWindow *mwindow, AWindowGUI *gui, int x, int y)
  : BC_Button(x, y, mwindow->theme->newbin_data)
 {