X-Git-Url: https://git.cinelerra-gg.org/git/?p=goodguy%2Fcinelerra.git;a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fmwindow.C;h=6e8547d6359f231493c37e64b74b162d6396179a;hp=c1cd79f6119ff4e027a804bc7d828b2ae72d9d80;hb=e23393f4ff9f772ac8f47926cf490dc87a630ed4;hpb=7fd85fb66168f6b518c5f2d73e04036e87faa0e1 diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index c1cd79f6..6e8547d6 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -120,6 +120,7 @@ #include "vframe.h" #include "vtrack.h" #include "versioninfo.h" +#include "vicon.h" #include "videodevice.inc" #include "videowindow.h" #include "vplayback.h" @@ -1388,7 +1389,7 @@ void MWindow::create_mixers() save_backup(); undo->update_undo_after(_("create mixers"), LOAD_ALL); restart_brender(); - gui->update(1, 2, 1, 1, 1, 1, 0); + gui->update(1, FORCE_REDRAW, 1, 1, 1, 1, 0); sync_parameters(CHANGE_ALL); } @@ -2007,6 +2008,7 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); break; } if( strcmp(cin_version, CINELERRA_VERSION) && + strcmp(cin_version, "Unify") && strcmp(cin_version, "5.1") ) { char string[BCTEXTLEN]; snprintf(string, sizeof(string), @@ -2019,6 +2021,8 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); EDL *nested_edl = new EDL; nested_edl->create_objects(); nested_edl->load_xml(&xml_file, LOAD_ALL); + int groups = nested_edl->regroup(session->group_number); + session->group_number += groups; //printf("MWindow::load_filenames %p %s\n", nested_edl, nested_edl->project_path); new_edl->create_nested(nested_edl); new_edl->set_path(filenames->get(i)); @@ -2027,6 +2031,8 @@ if(debug) printf("MWindow::load_filenames %d\n", __LINE__); else { // Load EDL for pasting new_edl->load_xml(&xml_file, LOAD_ALL); + int groups = new_edl->regroup(session->group_number); + session->group_number += groups; if(debug) printf("MWindow::load_filenames %d\n", __LINE__); test_plugins(new_edl, filenames->get(i)); if(debug) printf("MWindow::load_filenames %d\n", __LINE__); @@ -2856,6 +2862,74 @@ void MWindow::show_lwindow() gui->mainmenu->show_lwindow->set_checked(1); } +void MWindow::restore_windows() +{ + if( !session->show_vwindow ) { + for( int i=0, n=vwindows.size(); iis_running() ) continue; + vwindow->gui->lock_window("MWindow::restore_windows"); + vwindow->gui->close(1); + vwindow->gui->unlock_window(); + } + } + else + show_vwindow(); + + if( !session->show_awindow && !awindow->gui->is_hidden() ) { + awindow->gui->lock_window("MWindow::restore_windows"); + awindow->gui->close_event(); + awindow->gui->unlock_window(); + } + else if( session->show_awindow && awindow->gui->is_hidden() ) + show_awindow(); + + if( !session->show_cwindow && !cwindow->gui->is_hidden() ) { + cwindow->gui->lock_window("MWindow::restore_windows"); + cwindow->hide_window(); + cwindow->gui->unlock_window(); + } + else if( session->show_cwindow && cwindow->gui->is_hidden() ) + cwindow->show_window(); + + if( !session->show_gwindow && !gwindow->gui->is_hidden() ) { + gwindow->gui->lock_window("MWindow::restore_windows"); + gwindow->gui->close_event(); + gwindow->gui->unlock_window(); + } + else if( session->show_gwindow && gwindow->gui->is_hidden() ) + show_gwindow(); + + if( !session->show_lwindow && !lwindow->gui->is_hidden() ) { + lwindow->gui->lock_window("MWindow::restore_windows"); + lwindow->gui->close_event(); + lwindow->gui->unlock_window(); + } + else if( session->show_lwindow && lwindow->gui->is_hidden() ) + show_lwindow(); + + gui->focus(); +} + +void MWindow::save_layout(int no) +{ + char layout_path[BCTEXTLEN]; + snprintf(layout_path, sizeof(layout_path), "%s/" LAYOUT_FILE, + File::get_config_path(), no); + session->save_file(layout_path); +} + +void MWindow::load_layout(int no) +{ + char layout_path[BCTEXTLEN]; + snprintf(layout_path, sizeof(layout_path), "%s/" LAYOUT_FILE, + File::get_config_path(), no); + session->load_file(layout_path); + restore_windows(); + gui->default_positions(); + save_defaults(); +} + int MWindow::tile_windows(int window_config) { int need_reload = 0; @@ -2909,7 +2983,7 @@ void MWindow::set_auto_visibility(Autos *autos, int value) else return; - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->mainmenu->update_toggles(1); gui->unlock_window(); gwindow->gui->update_toggles(1); @@ -3150,7 +3224,7 @@ void MWindow::hide_plugin(Plugin *plugin, int lock) plugin->show = 0; // Update the toggle gui->lock_window("MWindow::hide_plugin"); - gui->update(0, 1, 0, 0, 0, 0, 0); + gui->update(0, NORMAL_DRAW, 0, 0, 0, 0, 0); gui->unlock_window(); if(lock) plugin_gui_lock->lock("MWindow::hide_plugin"); @@ -3222,6 +3296,69 @@ void MWindow::hide_keyframe_gui(Plugin *plugin) keyframe_gui_lock->unlock(); } +int MWindow::get_hash_color(Edit *edit) +{ + Indexable *idxbl = edit->asset ? + (Indexable*)edit->asset : (Indexable*)edit->nested_edl; + if( !idxbl ) return 0; + char path[BCTEXTLEN]; + if( !edit->asset || edit->track->data_type != TRACK_VIDEO || + edl->session->proxy_scale == 1 || + ProxyRender::from_proxy_path(path, idxbl, edl->session->proxy_scale) ) + strcpy(path, idxbl->path); + char *cp = strrchr(path, '/'); + cp = !cp ? path : cp+1; + uint8_t *bp = (uint8_t*)cp; + int v = 0; + while( *bp ) v += *bp++; + return get_hash_color(v); +} + +int MWindow::get_hash_color(int v) +{ + int hash = 0x303030; + if( v & 0x01 ) hash ^= 0x000040; + if( v & 0x02 ) hash ^= 0x004000; + if( v & 0x04 ) hash ^= 0x400000; + if( v & 0x08 ) hash ^= 0x080000; + if( v & 0x10 ) hash ^= 0x000800; + if( v & 0x20 ) hash ^= 0x000008; + if( v & 0x40 ) hash ^= 0x404040; + if( v & 0x80 ) hash ^= 0x080808; + return hash; +} + +int MWindow::get_group_color(int v) +{ + int color = 0x606060; + if( v & 0x01 ) color ^= 0x000080; + if( v & 0x02 ) color ^= 0x008000; + if( v & 0x04 ) color ^= 0x800000; + if( v & 0x08 ) color ^= 0x100000; + if( v & 0x10 ) color ^= 0x001000; + if( v & 0x20 ) color ^= 0x000010; + if( v & 0x40 ) color ^= 0x080808; + if( v & 0x80 ) color ^= 0x909090; + return color; +} + +int MWindow::get_title_color(Edit *edit) +{ + unsigned color = edit->color & 0xffffff; + unsigned alpha = (~edit->color>>24) & 0xff; + if( !color ) { + if( edit->group_id ) + color = get_group_color(edit->group_id); + else if( preferences->autocolor_assets ) + color = get_hash_color(edit); + else + return 0; + } + if( !alpha ) + alpha = session->title_bar_alpha*255; + return color | (~alpha<<24); +} + void MWindow::update_keyframe_guis() { // Send new configuration to keyframe GUI's @@ -3481,7 +3618,7 @@ void MWindow::update_project(int load_mode) gui->load_panes(); } - gui->update(1, 1, 1, 1, 1, 1, 1); + gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 1); if(debug) PRINT_TRACE gui->unlock_window(); init_brender(); @@ -3941,6 +4078,8 @@ void MWindow::remove_asset_from_caches(Asset *asset) void MWindow::remove_assets_from_project(int push_undo, int redraw, ArrayList *drag_assets, ArrayList *drag_clips) { + awindow->gui->close_view_popup(); + for(int i = 0; i < drag_assets->total; i++) { Indexable *indexable = drag_assets->get(i); if(indexable->is_asset) remove_asset_from_caches((Asset*)indexable); @@ -3986,7 +4125,7 @@ void MWindow::remove_assets_from_project(int push_undo, int redraw, restart_brender(); gui->lock_window("MWindow::remove_assets_from_project 3"); - gui->update(1, 1, 1, 1, 0, 1, 0); + gui->update(1, NORMAL_DRAW, 1, 1, 0, 1, 0); gui->unlock_window(); // Removes from playback here @@ -3998,16 +4137,16 @@ void MWindow::remove_assets_from_project(int push_undo, int redraw, void MWindow::remove_assets_from_disk() { + remove_assets_from_project(1, + 1, + session->drag_assets, + session->drag_clips); + // Remove from disk for(int i = 0; i < session->drag_assets->total; i++) { remove(session->drag_assets->get(i)->path); } - - remove_assets_from_project(1, - 1, - session->drag_assets, - session->drag_clips); } void MWindow::dump_plugins(FILE *fp) @@ -4312,7 +4451,7 @@ void MWindow::resync_guis() // Update GUIs restart_brender(); gui->lock_window("MWindow::resync_guis"); - gui->update(1, 1, 1, 1, 1, 1, 0); + gui->update(1, NORMAL_DRAW, 1, 1, 1, 1, 0); gui->unlock_window(); cwindow->gui->lock_window("MWindow::resync_guis");