X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fplugindialog.C;h=439a6efb5d5feffb6d83f6b48bae9b94fd412dc7;hp=5c682797c6c77e59e5497bbc1abef9114c91eb86;hb=HEAD;hpb=22a5ea2ff7a04c02465dc9b2256f04c38433142e diff --git a/cinelerra-5.1/cinelerra/plugindialog.C b/cinelerra-5.1/cinelerra/plugindialog.C index 5c682797..439a6efb 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" @@ -52,10 +53,7 @@ PluginDialogThread::~PluginDialogThread() } void PluginDialogThread::start_window(Track *track, - Plugin *plugin, - const char *title, - int is_mainmenu, - int data_type) + Plugin *plugin, const char *title, int is_mainmenu, int data_type) { if(!BC_DialogThread::is_running()) { @@ -242,25 +240,8 @@ PluginDialog::~PluginDialog() void PluginDialog::create_objects() { // int use_default = 1; - char string[BCTEXTLEN]; mwindow->theme->get_plugindialog_sizes(); - lock_window("PluginDialog::create_objects"); - if(thread->plugin) - { - strcpy(string, thread->plugin->title); - //use_default = 0; - } - else - { -// no plugin - sprintf(string, _("None")); - } - - - - - // GET A LIST OF ALL THE PLUGINS AVAILABLE mwindow->search_plugindb(thread->data_type == TRACK_AUDIO, @@ -282,15 +263,12 @@ void PluginDialog::create_objects() Track *track = mwindow->edl->tracks->number(plugin_locations.values[i]->module); char *track_title = track->title; int number = plugin_locations.values[i]->plugin; - Plugin *plugin = track->get_current_plugin(mwindow->edl->local_session->get_selectionstart(1), - number, - PLAY_FORWARD, - 1, - 0); - char *plugin_title = plugin->title; + double start = mwindow->edl->local_session->get_selectionstart(1); + Plugin *plugin = track->get_current_plugin(start, number, PLAY_FORWARD, 1, 0); + if( !plugin ) continue; char string[BCTEXTLEN]; - - snprintf(string, sizeof(string), "%s: %s", track_title, _(plugin_title)); + const char *plugin_title = _(plugin->title); + snprintf(string, sizeof(string), "%s: %s", track_title, plugin_title); shared_data.append(new BC_ListBoxItem(string)); } for(int i = 0; i < module_locations.total; i++) @@ -329,12 +307,6 @@ void PluginDialog::create_objects() // mwindow->theme->plugindialog_newattach_y)); // - - - - - - add_subwindow(shared_title = new BC_Title(mwindow->theme->plugindialog_shared_x, mwindow->theme->plugindialog_shared_y - 20, _("Shared effects:"))); @@ -356,13 +328,6 @@ void PluginDialog::create_objects() // mwindow->theme->plugindialog_sharedattach_y)); // - - - - - - - add_subwindow(module_title = new BC_Title(mwindow->theme->plugindialog_module_x, mwindow->theme->plugindialog_module_y - 20, _("Shared tracks:"))); @@ -468,9 +433,9 @@ int PluginDialog::resize_event(int w, int h) if(single_standalone) - single_standalone->reposition_window(mwindow->theme->plugindialog_new_x, - mwindow->theme->plugindialog_new_y + - mwindow->theme->plugindialog_new_h + + single_standalone->reposition_window( + mwindow->theme->plugindialog_new_x + BC_OKButton::calculate_w() + 10, + mwindow->theme->plugindialog_new_y + mwindow->theme->plugindialog_new_h + get_text_height(MEDIUMFONT)); flush(); @@ -479,7 +444,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 +454,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 +464,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 +541,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; } @@ -752,9 +717,9 @@ void PluginDialog::load_plugin_list(int redraw) const char *text = search_text->get_text(); for( int i=0; ititle; - if( text && text[0] && !strstr(title, text) ) continue; - standalone_data.append(new BC_ListBoxItem(title)); + const char *title = _(plugindb.values[i]->title); + if( text && text[0] && !bstrcasestr(title, text) ) continue; + standalone_data.append(new PluginDialogListItem(title, i)); } if( redraw ) @@ -777,7 +742,7 @@ PluginDialogSingle::PluginDialogSingle(PluginDialog *dialog, int x, int y) : BC_CheckBox(x, y, dialog->thread->single_standalone, - _("Attach single standlone and share others")) + _("Attach single standalone and share others")) { this->dialog = dialog; }