From 4b91e8a72deb0be3437ef0edd745646e525534d4 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Fri, 24 Mar 2017 11:48:43 -0600 Subject: [PATCH] assetedit/resize track fixes, dangling popup threads --- cinelerra-5.1/cinelerra/asset.C | 6 +++--- cinelerra-5.1/cinelerra/assetedit.C | 3 ++- cinelerra-5.1/cinelerra/awindowgui.C | 24 +++++++++++++++++++++ cinelerra-5.1/cinelerra/awindowgui.h | 1 + cinelerra-5.1/cinelerra/editpopup.C | 7 ++---- cinelerra-5.1/cinelerra/resizetrackthread.C | 6 ++++-- cinelerra-5.1/guicast/bcpopupmenu.C | 1 + cinelerra-5.1/guicast/vicon.h | 1 + 8 files changed, 38 insertions(+), 11 deletions(-) diff --git a/cinelerra-5.1/cinelerra/asset.C b/cinelerra-5.1/cinelerra/asset.C index d8db797b..5a17fde8 100644 --- a/cinelerra-5.1/cinelerra/asset.C +++ b/cinelerra-5.1/cinelerra/asset.C @@ -341,14 +341,14 @@ int Asset::equivalent(Asset &asset, int test_audio, int test_video, EDL *edl) delete [] cp; } } - if( strcmp(apath, tpath) ) result = 1; + if( strcmp(apath, tpath) ) result = 0; delete [] apath; delete [] tpath; delete [] out_path; } - if(result && format == FILE_FFMPEG) - result = !strcmp(fformat, asset.fformat); + if(result && format == FILE_FFMPEG && strcmp(fformat, asset.fformat) ) + result = 0; if(test_audio && result) { diff --git a/cinelerra-5.1/cinelerra/assetedit.C b/cinelerra-5.1/cinelerra/assetedit.C index 26759748..5b753657 100644 --- a/cinelerra-5.1/cinelerra/assetedit.C +++ b/cinelerra-5.1/cinelerra/assetedit.C @@ -128,7 +128,7 @@ void AssetEdit::handle_close_event(int result) if(indexable->is_asset) { asset = (Asset*)indexable; - if( changed_params->equivalent(*asset, 1, 1, mwindow->edl) ) + if( !changed_params->equivalent(*asset, 1, 1, mwindow->edl) ) changed = 1; } else { @@ -177,6 +177,7 @@ void AssetEdit::handle_close_event(int result) } mwindow->gui->unlock_window(); //printf("AssetEdit::handle_close_event %d\n", __LINE__); + mwindow->awindow->gui->update_picon(indexable); mwindow->awindow->gui->async_update_assets(); mwindow->restart_brender(); diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index 1dcacb94..a0ffb857 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -1143,6 +1143,30 @@ void AWindowGUI::update_asset_list() //printf("AWindowGUI::update_asset_list 7 %d\n", assets.total); } +void AWindowGUI::update_picon(Indexable *indexable) +{ +//printf("AWindowGUI::update_asset_list 1\n"); + VIcon *vicon = 0; + for(int i = 0; i < assets.total; i++) { + AssetPicon *picon = (AssetPicon*)assets.values[i]; + if( picon->indexable == indexable || + picon->edl == (EDL *)indexable ) { + char name[BCTEXTLEN]; + FileSystem fs; + fs.extract_name(name, indexable->path); + picon->set_text(name); + vicon = picon->vicon; + break; + } + } + if( vicon ) { + stop_vicon_drawing(); + vicon->clear_images(); + vicon->reset(indexable->get_frame_rate()); + start_vicon_drawing(); + } +} + void AWindowGUI::sort_assets() { //printf("AWindowGUI::sort_assets 1 %s\n", mwindow->edl->session->current_folder); diff --git a/cinelerra-5.1/cinelerra/awindowgui.h b/cinelerra-5.1/cinelerra/awindowgui.h index 8d9414e0..04fac704 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.h +++ b/cinelerra-5.1/cinelerra/awindowgui.h @@ -184,6 +184,7 @@ public: int load_defaults(BC_Hash *defaults); void start_vicon_drawing(); void stop_vicon_drawing(); + void update_picon(Indexable *indexable); MWindow *mwindow; AWindow *awindow; diff --git a/cinelerra-5.1/cinelerra/editpopup.C b/cinelerra-5.1/cinelerra/editpopup.C index 9dccdd06..4670dafd 100644 --- a/cinelerra-5.1/cinelerra/editpopup.C +++ b/cinelerra-5.1/cinelerra/editpopup.C @@ -35,11 +35,7 @@ #include EditPopup::EditPopup(MWindow *mwindow, MWindowGUI *gui) - : BC_PopupMenu(0, - 0, - 0, - "", - 0) + : BC_PopupMenu(0, 0, 0, "", 0) { this->mwindow = mwindow; this->gui = gui; @@ -58,6 +54,7 @@ void EditPopup::create_objects() add_item(new EditPopupAddTrack(mwindow, this)); // add_item(new EditPopupTitle(mwindow, this)); resize_option = 0; + matchsize_option = 0; } int EditPopup::update(Track *track, Edit *edit) diff --git a/cinelerra-5.1/cinelerra/resizetrackthread.C b/cinelerra-5.1/cinelerra/resizetrackthread.C index 4af7eb75..a9548455 100644 --- a/cinelerra-5.1/cinelerra/resizetrackthread.C +++ b/cinelerra-5.1/cinelerra/resizetrackthread.C @@ -299,7 +299,8 @@ void ResizeTrackThread::start_window(Track *track) void ResizeTrackThread::update() { - mwindow->resize_track(track, w, h); + if( mwindow->edl->tracks->track_exists(track) ) + mwindow->resize_track(track, w, h); } @@ -350,7 +351,8 @@ ResizeAssetButton::~ResizeAssetButton() int ResizeAssetButton::handle_event() { - resize_asset_thread = new ResizeAssetThread(fwindow); + if( !resize_asset_thread ) + resize_asset_thread = new ResizeAssetThread(fwindow); resize_asset_thread->start_window(fwindow->asset_edit->changed_params); return 1; } diff --git a/cinelerra-5.1/guicast/bcpopupmenu.C b/cinelerra-5.1/guicast/bcpopupmenu.C index 6a8c63e2..9d8e2c22 100644 --- a/cinelerra-5.1/guicast/bcpopupmenu.C +++ b/cinelerra-5.1/guicast/bcpopupmenu.C @@ -96,6 +96,7 @@ BC_PopupMenu::~BC_PopupMenu() { use_title = 0; deactivate(); + delete menu_popup; for(int i = 0; i < TOTAL_IMAGES; i++) { if(images[i]) delete images[i]; diff --git a/cinelerra-5.1/guicast/vicon.h b/cinelerra-5.1/guicast/vicon.h index 6ae0119e..6af17b2a 100644 --- a/cinelerra-5.1/guicast/vicon.h +++ b/cinelerra-5.1/guicast/vicon.h @@ -44,6 +44,7 @@ public: int64_t vframes() { return images.size(); } void reset() { seq_no = 0; cycle_start = 0; age = 0; } + void reset(double rate) { reset(); frame_rate = rate; } void clear_images() { images.remove_all_objects(); } virtual int64_t set_seq_no(int64_t no) { return seq_no = no; } -- 2.26.2