fix awdw solo vicon crash, fix nested clip for binfolders, open edit edl
[goodguy/cinelerra.git] / cinelerra-5.1 / cinelerra / awindowgui.C
index 03c8f22132266cb337352178e5910869503436cb..7f7300a8a0797c5d2ec90527a8189b14ccd895fc 100644 (file)
@@ -109,18 +109,23 @@ AssetVIcon::AssetVIcon(AssetPicon *picon, int w, int h, double framerate, int64_
        this->picon = picon;
        this->length = length;
        temp = 0;
+       broken = 0;
 }
 
 AssetVIcon::~AssetVIcon()
 {
+       if( picon->gui->vicon_thread->solo == this )
+               picon->gui->vicon_thread->solo = 0;
        picon->gui->vicon_thread->del_vicon(this);
        delete temp;
 }
 
 VFrame *AssetVIcon::frame()
 {
+       if( broken ) return 0;
        AssetVIconThread *avt = picon->gui->vicon_thread;
-       Asset *asset = (Asset *)picon->indexable;
+       Indexable *idxbl = picon->indexable;
+       Asset *asset = idxbl && idxbl->is_asset ? (Asset *)idxbl : 0;
        if( !asset ) return vframes()>0 ? (VFrame*)*images[0] : 0;
        if( !asset->video_data && audio_data && audio_size && length > 0 ) {
                if( !temp ) temp = new VFrame(0, -1, w, h, BC_RGB888, -1);
@@ -160,7 +165,10 @@ VFrame *AssetVIcon::frame()
        if( seq_no >= images.size() ) {
                MWindow *mwindow = picon->mwindow;
                File *file = mwindow->video_cache->check_out(asset, mwindow->edl, 1);
-               if( !file ) return 0;
+               if( !file ) {
+                       broken = 1;
+                       return 0;
+               }
                if( temp && (temp->get_w() != asset->width || temp->get_h() != asset->height) ) {
                        delete temp;  temp = 0;
                }
@@ -917,16 +925,25 @@ void AssetPicon::create_objects()
        int is_clip = 0;
 
        if( this->indexable ) {
-               fs.extract_name(name, indexable->path);
-               set_text(name);
-               if( this->indexable->is_asset )
+               char *cp = name;
+               if( this->indexable->is_asset ) {
                        asset = (Asset *)indexable;
-               else
+                       if( asset->format == FILE_REF ) {
+                               cp += sprintf(cp, "ref:");
+                               set_color(get_color() ^ 0x5599CC);
+                       }
+               }
+               else {
                        edl = (EDL *)indexable;
+                       cp += sprintf(cp, "edl:");
+//                     set_color(get_color() ^ 0xCC9955);
+               }
+               fs.extract_name(cp, indexable->path);
+               set_text(name);
        }
        else if( this->edl ) {
                edl = this->edl;
-               set_text(strcpy(name, edl->local_session->clip_title));
+               strcpy(name, edl->local_session->clip_title);
                set_text(name);
                is_clip = 1;
        }
@@ -1304,6 +1321,7 @@ AWindowGUI::AWindowGUI(MWindow *mwindow, AWindow *awindow)
        vicon_audio = 0;
        vicon_drawing = AVICON_FULL_PLAY;
        play_off = 0;
+       tip_info = 0;
        displayed_folder = AW_NO_FOLDER;
        new_folder_thread = 0;
        modify_folder_thread = 0;
@@ -1898,7 +1916,7 @@ int AWindowGUI::keypress_event()
                        return 1;
                }
                unlock_window();
-               mwindow->remove_assets_from_project(1, 1,
+               mwindow->remove_assets_from_project(1, 1, 1,
                        mwindow->session->drag_assets,
                        mwindow->session->drag_clips);
                lock_window("AWindowGUI::keypress_event 2");
@@ -2637,12 +2655,18 @@ int AWindowFolders::load_expanders()
        char expanders_path[BCTEXTLEN];
        mwindow->create_defaults_path(expanders_path, EXPANDERS_FILE);
        FILE *fp = fopen(expanders_path, "r");
+       if( !fp ) {
+               snprintf(expanders_path, sizeof(expanders_path), "%s/%s",
+                       File::get_cindat_path(), EXPANDERS_FILE);
+               char *cp = strrchr(expanders_path,'.');
+               if( cp ) strcpy(cp+1, mwindow->cin_lang);
+               fp = fopen(expanders_path, "r");
+       }
        if( !fp ) {
                snprintf(expanders_path, sizeof(expanders_path), "%s/%s",
                        File::get_cindat_path(), EXPANDERS_FILE);
                fp = fopen(expanders_path, "r");
        }
-
        if( !fp ) return 1;
        const char tab = '\t';
        char line[BCTEXTLEN];   line[0] = 0;