wide char tweaks, Features5 update, subtitle triple clk segv
[goodguy/history.git] / cinelerra-5.1 / cinelerra / plugindialog.C
index 5c682797c6c77e59e5497bbc1abef9114c91eb86..9fec465d3a1e1c6752a4b5b369ffc6e83df43bda 100644 (file)
@@ -20,6 +20,7 @@
  */
 
 #include "condition.h"
+#include "cstrdup.h"
 #include "edl.h"
 #include "edlsession.h"
 #include "language.h"
@@ -479,7 +480,7 @@ int PluginDialog::resize_event(int w, int h)
 
 int PluginDialog::attach_new(int number)
 {
-       if(number > -1 && number < standalone_data.total)
+       if(number >= 0 && number < plugindb.size())
        {
                strcpy(thread->plugin_title, plugindb.values[number]->title);
                thread->plugin_type = PLUGIN_STANDALONE;         // type is plugin
@@ -489,7 +490,7 @@ int PluginDialog::attach_new(int number)
 
 int PluginDialog::attach_shared(int number)
 {
-       if(number > -1 && number < shared_data.total)
+       if(number >= 0 && number < plugin_locations.size())
        {
                thread->plugin_type = PLUGIN_SHAREDPLUGIN;         // type is shared plugin
                thread->shared_location = *(plugin_locations.values[number]); // copy location
@@ -499,7 +500,7 @@ int PluginDialog::attach_shared(int number)
 
 int PluginDialog::attach_module(int number)
 {
-       if(number > -1 && number < module_data.total)
+       if(number >= 0 && number < module_locations.size())
        {
 //             title->update(module_data.values[number]->get_text());
                thread->plugin_type = PLUGIN_SHAREDMODULE;         // type is module
@@ -576,14 +577,14 @@ int PluginDialogNew::handle_event()
 }
 int PluginDialogNew::selection_changed()
 {
-       dialog->selected_available = get_selection_number(0, 0);
-
-
+       int no = get_selection_number(0, 0);
+       dialog->selected_available = no >= 0 && no < dialog->standalone_data.size() ?
+               ((PluginDialogListItem *)dialog->standalone_data[no])->item_no : -1;
        dialog->shared_list->set_all_selected(&dialog->shared_data, 0);
        dialog->shared_list->draw_items(1);
+       dialog->selected_shared = -1;
        dialog->module_list->set_all_selected(&dialog->module_data, 0);
        dialog->module_list->draw_items(1);
-       dialog->selected_shared = -1;
        dialog->selected_modules = -1;
        return 1;
 }
@@ -753,8 +754,8 @@ void PluginDialog::load_plugin_list(int redraw)
 
        for( int i=0; i<plugindb.total; ++i ) {
                const char *title = plugindb.values[i]->title;
-               if( text && text[0] && !strstr(title, text) ) continue;
-               standalone_data.append(new BC_ListBoxItem(title));
+               if( text && text[0] && !bstrcasestr(title, text) ) continue;
+               standalone_data.append(new PluginDialogListItem(title, i));
        }
 
        if( redraw )