From: Good Guy Date: Mon, 25 Apr 2016 17:30:37 +0000 (-0600) Subject: menuattachtransition fixes X-Git-Url: http://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=d74af873b37515106009148abcc8686836aec72e;p=goodguy%2Fhistory.git menuattachtransition fixes --- diff --git a/cinelerra-5.1/cinelerra/menuattachtransition.C b/cinelerra-5.1/cinelerra/menuattachtransition.C index fa1e8965..57090f03 100644 --- a/cinelerra-5.1/cinelerra/menuattachtransition.C +++ b/cinelerra-5.1/cinelerra/menuattachtransition.C @@ -61,6 +61,7 @@ TransitionDialogThread::TransitionDialogThread(MWindow *mwindow, int data_type) { this->mwindow = mwindow; this->data_type = data_type; + this->number = -1; } TransitionDialogThread::~TransitionDialogThread() @@ -72,23 +73,21 @@ void TransitionDialogThread::start() { if(!transition_names.total) { + strcpy(transition_title, data_type == TRACK_AUDIO ? + mwindow->edl->session->default_atransition : + mwindow->edl->session->default_vtransition); + // Construct listbox names ArrayList plugindb; mwindow->search_plugindb(data_type == TRACK_AUDIO, - data_type == TRACK_VIDEO, - 0, - 1, - 0, - plugindb); - for(int i = 0; i < plugindb.total; i++) - transition_names.append(new BC_ListBoxItem(_(plugindb.values[i]->title))); + data_type == TRACK_VIDEO, 0, 1, 0, plugindb); + for(int i = 0; i < plugindb.total; i++) { + const char *title = _(plugindb.values[i]->title); + if( !strcmp(transition_title, title) ) number = i; + transition_names.append(new BC_ListBoxItem(title)); + } } - if(data_type == TRACK_AUDIO) - strcpy(transition_title, mwindow->edl->session->default_atransition); - else - strcpy(transition_title, mwindow->edl->session->default_vtransition); - mwindow->gui->unlock_window(); BC_DialogThread::start(); mwindow->gui->lock_window("TransitionDialogThread::start"); @@ -103,10 +102,7 @@ BC_Window* TransitionDialogThread::new_gui() mwindow->session->transitiondialog_w / 2; int y = mwindow->gui->get_abs_cursor_y(0) - mwindow->session->transitiondialog_h / 2; - TransitionDialog *window = new TransitionDialog(mwindow, - this, - x, - y); + TransitionDialog *window = new TransitionDialog(mwindow, this, x, y); window->create_objects(); mwindow->gui->unlock_window(); return window; @@ -123,19 +119,11 @@ void TransitionDialogThread::handle_close_event(int result) TransitionDialog::TransitionDialog(MWindow *mwindow, - TransitionDialogThread *thread, - int x, - int y) - : BC_Window(_("Attach Transition"), - x, - y, + TransitionDialogThread *thread, int x, int y) + : BC_Window(_("Attach Transition"), x, y, mwindow->session->transitiondialog_w, mwindow->session->transitiondialog_h, - 320, - 240, - 1, - 0, - 1) + 320, 240, 1, 0, 1) { this->mwindow = mwindow; this->thread = thread; @@ -155,10 +143,13 @@ void TransitionDialog::create_objects() y, get_w() - x - x, get_h() - y - BC_OKButton::calculate_h() - 10)); + if( thread->number >= 0 ) { + name_list->update_selection(&thread->transition_names, thread->number, 0); + name_list->draw_items(0); + } add_subwindow(new BC_OKButton(this)); add_subwindow(new BC_CancelButton(this)); show_window(); - flush(); unlock_window(); } @@ -181,11 +172,7 @@ int TransitionDialog::resize_event(int w, int h) TransitionDialogName::TransitionDialogName(TransitionDialogThread *thread, - ArrayList *standalone_data, - int x, - int y, - int w, - int h) + ArrayList *standalone_data, int x, int y, int w, int h) : BC_ListBox(x, y, w, @@ -204,9 +191,9 @@ int TransitionDialogName::handle_event() int TransitionDialogName::selection_changed() { - int number = get_selection_number(0, 0); + thread->number = get_selection_number(0, 0); strcpy(thread->transition_title, - thread->transition_names.values[number]->get_text()); + thread->transition_names.values[thread->number]->get_text()); return 1; } diff --git a/cinelerra-5.1/cinelerra/menuattachtransition.h b/cinelerra-5.1/cinelerra/menuattachtransition.h index 1e02fd51..00980cd3 100644 --- a/cinelerra-5.1/cinelerra/menuattachtransition.h +++ b/cinelerra-5.1/cinelerra/menuattachtransition.h @@ -60,6 +60,7 @@ public: char transition_title[BCTEXTLEN]; MWindow *mwindow; int data_type; + int number; ArrayList transition_names; }; diff --git a/cinelerra-5.1/plugins/shapewipe/shapewipe.C b/cinelerra-5.1/plugins/shapewipe/shapewipe.C index 1656e7f1..bb91c5ec 100644 --- a/cinelerra-5.1/plugins/shapewipe/shapewipe.C +++ b/cinelerra-5.1/plugins/shapewipe/shapewipe.C @@ -21,6 +21,7 @@ #include "bcdisplayinfo.h" #include "bchash.h" +#include "cstrdup.h" #include "edl.inc" #include "filesystem.h" #include "filexml.h" @@ -332,6 +333,8 @@ ShapeWipeMain::ShapeWipeMain(PluginServer *server) preserve_aspect = 0; last_preserve_aspect = 0; shapes_initialized = 0; + shape_paths.set_array_delete(); + shape_titles.set_array_delete(); } ShapeWipeMain::~ShapeWipeMain() @@ -399,8 +402,8 @@ void ShapeWipeMain::init_shapes() FileItem *file_item = fs.get_entry(i); if(!file_item->get_is_dir()) { - shape_paths.append(strdup(file_item->get_path())); - char *ptr = strdup(file_item->get_name()); + shape_paths.append(cstrdup(file_item->get_path())); + char *ptr = cstrdup(file_item->get_name()); char *ptr2 = strrchr(ptr, '.'); if(ptr2) *ptr2 = 0; shape_titles.append(ptr); @@ -610,26 +613,40 @@ void ShapeWipeMain::reset_pattern_image() type *in_row; \ type *out_row; \ \ - for(j = 0; j < h; j++) \ - { \ - in_row = (type*) in_rows[j]; \ - out_row = (type*)out_rows[j]; \ - pattern_row = pattern_image[j]; \ - \ - col_offset = 0; \ - for(k = 0; k < w; k++) \ - { \ - value = pattern_row[k]; \ - if ((direction == 0 && value >= threshold) || \ - (direction == 1 && value <= threshold)) \ - { \ + if( !direction ) { \ + for(j = 0; j < h; j++) { \ + in_row = (type*) in_rows[j]; \ + out_row = (type*)out_rows[j]; \ + pattern_row = pattern_image[j]; \ + \ + col_offset = 0; \ + for(k = 0; k < w; k++, col_offset += components ) { \ + value = pattern_row[k]; \ + if (value < threshold) continue; \ + out_row[col_offset] = in_row[col_offset]; \ + out_row[col_offset + 1] = in_row[col_offset + 1]; \ + out_row[col_offset + 2] = in_row[col_offset + 2]; \ + if(components == 4) \ + out_row[col_offset + 3] = in_row[col_offset + 3]; \ + } \ + } \ + } \ + else { \ + for(j = 0; j < h; j++) { \ + in_row = (type*) in_rows[j]; \ + out_row = (type*)out_rows[j]; \ + pattern_row = pattern_image[j]; \ + \ + col_offset = 0; \ + for(k = 0; k < w; k++, col_offset += components ) { \ + value = pattern_row[k]; \ + if (value > threshold) continue; \ out_row[col_offset] = in_row[col_offset]; \ out_row[col_offset + 1] = in_row[col_offset + 1]; \ out_row[col_offset + 2] = in_row[col_offset + 2]; \ if(components == 4) \ out_row[col_offset + 3] = in_row[col_offset + 3]; \ } \ - col_offset += components; \ } \ } \ }