X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fplugindialog.C;h=8063982bfe8ffa652b11cf624af470f050b76e17;hb=166867a58d74619aa11aeb562a994cc364d62231;hp=006cf40e2ce1dc82e845ce68c48871e73b179447;hpb=686bc04a488847170d80ec603f8c33962a7aa928;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/plugindialog.C b/cinelerra-5.1/cinelerra/plugindialog.C index 006cf40e..8063982b 100644 --- a/cinelerra-5.1/cinelerra/plugindialog.C +++ b/cinelerra-5.1/cinelerra/plugindialog.C @@ -44,7 +44,7 @@ PluginDialogThread::PluginDialogThread(MWindow *mwindow) : BC_DialogThread() { this->mwindow = mwindow; - this->plugin = 0; + this->plugin_id = -1; this->plugin_type = PLUGIN_NONE; } @@ -62,7 +62,6 @@ void PluginDialogThread::start_window(Track *track, // mwindow->gui->lock_window("PluginDialogThread::start_window"); this->track = track; this->data_type = data_type; - this->plugin = plugin; this->is_mainmenu = is_mainmenu; single_standalone = mwindow->edl->session->single_standalone; @@ -71,6 +70,7 @@ void PluginDialogThread::start_window(Track *track, plugin->calculate_title(plugin_title, 0); this->shared_location = plugin->shared_location; this->plugin_type = plugin->plugin_type; + this->plugin_id = plugin->orig_id; } else { @@ -78,6 +78,7 @@ void PluginDialogThread::start_window(Track *track, this->shared_location.plugin = -1; this->shared_location.module = -1; this->plugin_type = PLUGIN_NONE; + this->plugin_id = -1; } strcpy(this->window_title, title); @@ -128,16 +129,10 @@ PluginDialog::PluginDialog(MWindow *mwindow, const char *window_title, int x, int y) - : BC_Window(window_title, - x, - y, + : BC_Window(window_title, x, y, mwindow->session->plugindialog_w, mwindow->session->plugindialog_h, - 510, - 415, - 1, - 0, - 1) + xS(510), yS(415), 1, 0, 1) { this->mwindow = mwindow; this->thread = thread; @@ -165,6 +160,8 @@ PluginDialog::~PluginDialog() void PluginDialog::create_objects() { + int xs10 = xS(10); + int ys10 = yS(10), ys20 = yS(20); // int use_default = 1; mwindow->theme->get_plugindialog_sizes(); lock_window("PluginDialog::create_objects"); @@ -204,18 +201,14 @@ void PluginDialog::create_objects() module_data.append(new BC_ListBoxItem(track->title)); } - - - - // Create widgets add_subwindow(standalone_title = new BC_Title(mwindow->theme->plugindialog_new_x, - mwindow->theme->plugindialog_new_y - 20, + mwindow->theme->plugindialog_new_y - ys20, _("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; + int dy = search_text->get_h() + ys10; y1 += dy; h1 -= dy; load_plugin_list(0); @@ -235,7 +228,7 @@ void PluginDialog::create_objects() // add_subwindow(shared_title = new BC_Title(mwindow->theme->plugindialog_shared_x, - mwindow->theme->plugindialog_shared_y - 20, + mwindow->theme->plugindialog_shared_y - ys20, _("Shared effects:"))); add_subwindow(shared_list = new PluginDialogShared(this, &shared_data, @@ -256,7 +249,7 @@ void PluginDialog::create_objects() // add_subwindow(module_title = new BC_Title(mwindow->theme->plugindialog_module_x, - mwindow->theme->plugindialog_module_y - 20, + mwindow->theme->plugindialog_module_y - ys20, _("Shared tracks:"))); add_subwindow(module_list = new PluginDialogModules(this, &module_data, @@ -286,13 +279,10 @@ void PluginDialog::create_objects() if(thread->is_mainmenu) add_subwindow(single_standalone = new PluginDialogSingle(this, - mwindow->theme->plugindialog_new_x + BC_OKButton::calculate_w() + 10, - mwindow->theme->plugindialog_new_y + - mwindow->theme->plugindialog_new_h + + mwindow->theme->plugindialog_new_x + BC_OKButton::calculate_w() + xs10, + mwindow->theme->plugindialog_new_y + mwindow->theme->plugindialog_new_h + get_text_height(MEDIUMFONT))); - - add_subwindow(ok_btn = new BC_OKButton(this)); add_subwindow(can_btn = new BC_CancelButton(this)); int aw = PluginDialogApply::calculate_w(this, _("Apply")); @@ -310,17 +300,17 @@ void PluginDialog::create_objects() int PluginDialog::resize_event(int w, int h) { + int ys10 = yS(10), ys20 = yS(20); mwindow->session->plugindialog_w = w; mwindow->session->plugindialog_h = h; mwindow->theme->get_plugindialog_sizes(); - standalone_title->reposition_window(mwindow->theme->plugindialog_new_x, - mwindow->theme->plugindialog_new_y - 20); + mwindow->theme->plugindialog_new_y - ys20); 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; + int dy = search_text->get_h() + ys10; y1 += dy; h1 -= dy; standalone_list->reposition_window(x1, y1, w1, h1); @@ -332,7 +322,7 @@ int PluginDialog::resize_event(int w, int h) // mwindow->theme->plugindialog_newattach_y); shared_title->reposition_window(mwindow->theme->plugindialog_shared_x, - mwindow->theme->plugindialog_shared_y - 20); + mwindow->theme->plugindialog_shared_y - ys20); shared_list->reposition_window(mwindow->theme->plugindialog_shared_x, mwindow->theme->plugindialog_shared_y, mwindow->theme->plugindialog_shared_w, @@ -349,7 +339,7 @@ int PluginDialog::resize_event(int w, int h) module_title->reposition_window(mwindow->theme->plugindialog_module_x, - mwindow->theme->plugindialog_module_y - 20); + mwindow->theme->plugindialog_module_y - ys20); module_list->reposition_window(mwindow->theme->plugindialog_module_x, mwindow->theme->plugindialog_module_y, mwindow->theme->plugindialog_module_w, @@ -364,7 +354,7 @@ int PluginDialog::resize_event(int w, int h) if(single_standalone) single_standalone->reposition_window( - mwindow->theme->plugindialog_new_x + BC_OKButton::calculate_w() + 10, + mwindow->theme->plugindialog_new_x + BC_OKButton::calculate_w() + ys10, mwindow->theme->plugindialog_new_y + mwindow->theme->plugindialog_new_h + get_text_height(MEDIUMFONT)); @@ -424,7 +414,7 @@ void PluginDialog::clear_selection() selected_available = -1; selected_shared = -1; selected_modules = -1; - thread->plugin = 0; + thread->plugin_id = -1; thread->plugin_type = PLUGIN_NONE; } @@ -445,8 +435,10 @@ void PluginDialog::apply() void PluginDialogThread::apply() { - if( mwindow->edl ) - mwindow->edl->session->single_standalone = single_standalone; + Plugin *plugin = 0; + EDL *edl = mwindow->edl; + if( edl ) + edl->session->single_standalone = single_standalone; if(plugin_type) { mwindow->gui->lock_window("PluginDialogThread::run 3"); mwindow->undo->update_undo_before(); @@ -454,19 +446,20 @@ void PluginDialogThread::apply() mwindow->insert_effect(plugin_title, &shared_location, data_type, plugin_type, single_standalone); } - else { - if( plugin ) { - if( mwindow->edl->tracks->plugin_exists(plugin) ) { - plugin->change_plugin(plugin_title, - &shared_location, plugin_type); - } - } - else { - if( mwindow->edl->tracks->track_exists(track) ) { - mwindow->insert_effect(plugin_title, &shared_location, - track, 0, 0, 0, plugin_type); - } + else if( (plugin=edl->tracks->plugin_exists(plugin_id)) != 0 ) { + plugin->change_plugin(plugin_title, + &shared_location, plugin_type); + } + else if( edl->tracks->track_exists(track) ) { + double start = edl->local_session->get_selectionstart(1); + double end = edl->local_session->get_selectionend(1); + if( start >= end ) { + start = 0; + end = track->get_length(); } + double length = end - start; + mwindow->insert_effect(plugin_title, &shared_location, + track, 0, start, length, plugin_type); } mwindow->save_backup(); @@ -477,7 +470,7 @@ void PluginDialogThread::apply() mwindow->gui->update(1, NORMAL_DRAW, 0, 0, 1, 0, 0); mwindow->gui->unlock_window(); } - plugin = 0; + plugin_id = -1; } PluginDialogApply::PluginDialogApply(PluginDialog *dialog, int x, int y) @@ -500,7 +493,7 @@ int PluginDialogApply::handle_event() // // PluginDialogTextBox::PluginDialogTextBox(PluginDialog *dialog, char *text, int x, int y) -// : BC_TextBox(x, y, 200, 1, text) +// : BC_TextBox(x, y, xS(200), 1, text) // { // this->dialog = dialog; // } @@ -527,16 +520,6 @@ int PluginDialogApply::handle_event() - - - - - - - - - - PluginDialogNew::PluginDialogNew(PluginDialog *dialog, ArrayList *standalone_data, int x, int y, int w, int h) @@ -599,26 +582,10 @@ int PluginDialogNew::selection_changed() // } - - - - - - - - PluginDialogShared::PluginDialogShared(PluginDialog *dialog, ArrayList *shared_data, - int x, - int y, - int w, - int h) - : BC_ListBox(x, - y, - w, - h, - LISTBOX_TEXT, - shared_data) + int x, int y, int w, int h) + : BC_ListBox(x, y, w, h, LISTBOX_TEXT, shared_data) { this->dialog = dialog; } @@ -690,16 +657,8 @@ int PluginDialogShared::selection_changed() PluginDialogModules::PluginDialogModules(PluginDialog *dialog, ArrayList *module_data, - int x, - int y, - int w, - int h) - : BC_ListBox(x, - y, - w, - h, - LISTBOX_TEXT, - module_data) + int x, int y, int w, int h) + : BC_ListBox(x, y, w, h, LISTBOX_TEXT, module_data) { this->dialog = dialog; } @@ -754,9 +713,7 @@ int PluginDialogSearchText::handle_event() } PluginDialogSingle::PluginDialogSingle(PluginDialog *dialog, int x, int y) - : BC_CheckBox(x, - y, - dialog->thread->single_standalone, + : BC_CheckBox(x, y, dialog->thread->single_standalone, _("Attach single standalone and share others")) { this->dialog = dialog; @@ -802,15 +759,3 @@ int PluginDialogSingle::handle_event() // } // - - - - - - - - - - - -