repair default keyframe load, tweak init default histogram threshold
[goodguy/history.git] / cinelerra-5.1 / cinelerra / localsession.C
index 19f8d62a6329683ab04da7be7b05a429c228092b..9556dce3d6ebd693e6b3d5dde01230e6d552d179 100644 (file)
@@ -60,7 +60,6 @@ LocalSession::LocalSession(EDL *edl)
 
        selectionstart = selectionend = 0;
        in_point = out_point = -1;
-       awindow_folder = AW_CLIP_FOLDER;
        sprintf(clip_title, _("Program"));
        strcpy(clip_notes, _("Hello world"));
        strcpy(clip_icon, "");
@@ -69,7 +68,7 @@ LocalSession::LocalSession(EDL *edl)
        loop_start = loop_end = 0;
        playback_start = -1;
        playback_end = 0;
-       preview_start = preview_end = 0;
+       preview_start = 0;  preview_end = -1;
        zoom_sample = DEFAULT_ZOOM_TIME;
        zoom_y = 0;
        zoom_track = 0;
@@ -119,7 +118,6 @@ void LocalSession::copy_from(LocalSession *that)
        strcpy(clip_title, that->clip_title);
        strcpy(clip_notes, that->clip_notes);
        strcpy(clip_icon, that->clip_icon);
-       awindow_folder = that->awindow_folder;
        in_point = that->in_point;
        loop_playback = that->loop_playback;
        loop_start = that->loop_start;
@@ -168,9 +166,7 @@ void LocalSession::save_xml(FileXML *file, double start)
        file->tag.set_property("SELECTION_START", selectionstart - start);
        file->tag.set_property("SELECTION_END", selectionend - start);
        file->tag.set_property("CLIP_TITLE", clip_title);
-       file->tag.set_property("CLIP_NOTES", clip_notes);
        file->tag.set_property("CLIP_ICON", clip_icon);
-       file->tag.set_property("AWINDOW_FOLDER", awindow_folder);
        file->tag.set_property("X_PANE", x_pane);
        file->tag.set_property("Y_PANE", y_pane);
 
@@ -190,10 +186,9 @@ void LocalSession::save_xml(FileXML *file, double start)
        file->tag.set_property("ZOOM_TRACK", zoom_track);
 
        double preview_start = this->preview_start - start;
-       if(preview_start < 0) preview_start = 0;
+       if( preview_start < 0 ) preview_start = 0;
        double preview_end = this->preview_end - start;
-       if(preview_end < 0) preview_end = 0;
-
+       if( preview_end < preview_start ) preview_end = -1;
        file->tag.set_property("PREVIEW_START", preview_start);
        file->tag.set_property("PREVIEW_END", preview_end);
        file->tag.set_property("FLOATAUTO_TYPE", floatauto_type);
@@ -213,6 +208,14 @@ void LocalSession::save_xml(FileXML *file, double start)
                }
        }
        file->append_tag();
+       file->append_newline();
+
+//this used to be a property, now used as tag member
+//     file->tag.set_property("CLIP_NOTES", clip_notes);
+       file->tag.set_title("CLIP_NOTES");   file->append_tag();
+       file->append_text(clip_notes);
+       file->tag.set_title("/CLIP_NOTES");  file->append_tag();
+       file->append_newline();
 
        file->tag.set_title("/LOCALSESSION");
        file->append_tag();
@@ -244,6 +247,7 @@ void LocalSession::load_xml(FileXML *file, unsigned long load_flags)
 //             clipboard_length = 0;
 // Overwritten by MWindow::load_filenames
                file->tag.get_property("CLIP_TITLE", clip_title);
+               clip_notes[0] = 0;
                file->tag.get_property("CLIP_NOTES", clip_notes);
                clip_icon[0] = 0;
                file->tag.get_property("CLIP_ICON", clip_icon);
@@ -258,12 +262,6 @@ void LocalSession::load_xml(FileXML *file, unsigned long load_flags)
                                        year, mon, mday, hour, min, sec);
                        }
                }
-               const char *folder = file->tag.get_property("FOLDER");
-               if( folder ) {
-                       awindow_folder = AWindowGUI::folder_number(folder);
-                       if( awindow_folder < 0 ) awindow_folder = AW_MEDIA_FOLDER;
-               }
-               awindow_folder = file->tag.get_property("AWINDOW_FOLDER", awindow_folder);
                loop_playback = file->tag.get_property("LOOP_PLAYBACK", 0);
                loop_start = file->tag.get_property("LOOP_START", (double)0);
                loop_end = file->tag.get_property("LOOP_END", (double)0);
@@ -320,6 +318,16 @@ void LocalSession::load_xml(FileXML *file, unsigned long load_flags)
                in_point = file->tag.get_property("IN_POINT", (double)-1);
                out_point = file->tag.get_property("OUT_POINT", (double)-1);
        }
+
+       while( !file->read_tag() ) {
+               if( file->tag.title_is("/LOCALSESSION") ) break;
+               if( file->tag.title_is("CLIP_NOTES") ) {
+                       XMLBuffer notes;
+                       file->read_text_until("/CLIP_NOTES", &notes, 1);
+                       memset(clip_notes, 0, sizeof(clip_notes));
+                       strncpy(clip_notes, notes.cstr(), sizeof(clip_notes)-1);
+               }
+       }
 }
 
 void LocalSession::boundaries()
@@ -491,12 +499,3 @@ int LocalSession::outpoint_valid()
        return out_point >= 0;
 }
 
-void LocalSession::set_clip_path(Indexable *indexable)
-{
-       char string[BCTEXTLEN];
-       FileSystem fs;
-       fs.extract_name(string, indexable->path);
-       strcpy(clip_title, string);
-}
-
-