X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fplugindialog.C;h=9fec465d3a1e1c6752a4b5b369ffc6e83df43bda;hb=4ed99d3ff21fc5809ff2a2927f6d99413f80a168;hp=172eaf91acb13b75e777a39d73baf7bdc3a732f9;hpb=58d99c74e65066486dbebf7e1cb3087e7de1c92b;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/plugindialog.C b/cinelerra-5.1/cinelerra/plugindialog.C index 172eaf91..9fec465d 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.C +++ b/cinelerra-5.1/cinelerra/plugindialog.C @@ -20,6 +20,7 @@ */ #include "condition.h" +#include "cstrdup.h" #include "edl.h" #include "edlsession.h" #include "language.h" @@ -277,8 +278,6 @@ void PluginDialog::create_objects() thread->data_type); // Construct listbox items - for(int i = 0; i < plugindb.total; i++) - standalone_data.append(new BC_ListBoxItem(_(plugindb.values[i]->title))); for(int i = 0; i < plugin_locations.total; i++) { Track *track = mwindow->edl->tracks->number(plugin_locations.values[i]->module); @@ -309,12 +308,15 @@ void PluginDialog::create_objects() add_subwindow(standalone_title = new BC_Title(mwindow->theme->plugindialog_new_x, mwindow->theme->plugindialog_new_y - 20, _("Plugins:"))); + int x1 = mwindow->theme->plugindialog_new_x, y1 = mwindow->theme->plugindialog_new_y; + int w1 = mwindow->theme->plugindialog_new_w, h1 = mwindow->theme->plugindialog_new_h; + add_subwindow(search_text = new PluginDialogSearchText(this, x1, y1, w1)); + int dy = search_text->get_h() + 10; + y1 += dy; h1 -= dy; + load_plugin_list(0); + add_subwindow(standalone_list = new PluginDialogNew(this, - &standalone_data, - mwindow->theme->plugindialog_new_x, - mwindow->theme->plugindialog_new_y, - mwindow->theme->plugindialog_new_w, - mwindow->theme->plugindialog_new_h)); + &standalone_data, x1, y1, w1, h1)); // // if(thread->plugin) // add_subwindow(standalone_change = new PluginDialogChangeNew(mwindow, @@ -421,10 +423,13 @@ int PluginDialog::resize_event(int w, int h) standalone_title->reposition_window(mwindow->theme->plugindialog_new_x, mwindow->theme->plugindialog_new_y - 20); - standalone_list->reposition_window(mwindow->theme->plugindialog_new_x, - mwindow->theme->plugindialog_new_y, - mwindow->theme->plugindialog_new_w, - mwindow->theme->plugindialog_new_h); + int x1 = mwindow->theme->plugindialog_new_x, y1 = mwindow->theme->plugindialog_new_y; + int w1 = mwindow->theme->plugindialog_new_w, h1 = mwindow->theme->plugindialog_new_h; + search_text->reposition_window(x1, y1, w1); + int dy = search_text->get_h() + 10; + y1 += dy; h1 -= dy; + standalone_list->reposition_window(x1, y1, w1, h1); + // if(standalone_attach) // standalone_attach->reposition_window(mwindow->theme->plugindialog_newattach_x, // mwindow->theme->plugindialog_newattach_y); @@ -432,10 +437,6 @@ int PluginDialog::resize_event(int w, int h) // standalone_change->reposition_window(mwindow->theme->plugindialog_newattach_x, // mwindow->theme->plugindialog_newattach_y); - - - - shared_title->reposition_window(mwindow->theme->plugindialog_shared_x, mwindow->theme->plugindialog_shared_y - 20); shared_list->reposition_window(mwindow->theme->plugindialog_shared_x, @@ -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 @@ -559,19 +560,12 @@ void PluginDialog::save_settings() PluginDialogNew::PluginDialogNew(PluginDialog *dialog, ArrayList *standalone_data, - int x, - int y, - int w, - int h) - : BC_ListBox(x, - y, - w, - h, - LISTBOX_TEXT, - standalone_data) + int x, int y, int w, int h) + : BC_ListBox(x, y, w, h, LISTBOX_TEXT, standalone_data) { this->dialog = dialog; } + PluginDialogNew::~PluginDialogNew() { } int PluginDialogNew::handle_event() { @@ -583,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,6 +747,32 @@ int PluginDialogModules::selection_changed() return 1; } +void PluginDialog::load_plugin_list(int redraw) +{ + standalone_data.remove_all_objects(); + const char *text = search_text->get_text(); + + for( int i=0; ititle; + if( text && text[0] && !bstrcasestr(title, text) ) continue; + standalone_data.append(new PluginDialogListItem(title, i)); + } + + if( redraw ) + standalone_list->draw_items(1); +} + +PluginDialogSearchText::PluginDialogSearchText(PluginDialog *dialog, int x, int y, int w) + : BC_TextBox(x, y, w, 1, "") +{ + this->dialog = dialog; +} + +int PluginDialogSearchText::handle_event() +{ + dialog->load_plugin_list(1); + return 1; +} PluginDialogSingle::PluginDialogSingle(PluginDialog *dialog, int x, int y) : BC_CheckBox(x,