From: Good Guy Date: Tue, 27 Feb 2018 15:19:13 +0000 (-0700) Subject: multi-line clip note fix X-Git-Url: http://git.cinelerra-gg.org/git/?p=goodguy%2Fhistory.git;a=commitdiff_plain;h=8de624882f93013542044d4ad39c3f6e2f77d752 multi-line clip note fix --- diff --git a/cinelerra-5.1/cinelerra/filexml.C b/cinelerra-5.1/cinelerra/filexml.C index aef297e4..9c99d3f8 100644 --- a/cinelerra-5.1/cinelerra/filexml.C +++ b/cinelerra-5.1/cinelerra/filexml.C @@ -489,7 +489,7 @@ int FileXML::skip_tag() return 1; } -int FileXML::read_data_until(const char *tag_end, char *out, int len) +int FileXML::read_data_until(const char *tag_end, char *out, int len, int skip) { long ipos = buffer->itell(); int opos = 0, pos = -1; @@ -518,15 +518,15 @@ int FileXML::read_data_until(const char *tag_end, char *out, int len) ++pos; } // if end tag is reached, pos is left on the < of the end tag - if( pos >= 0 && !tag_end[pos] ) + if( !skip && pos >= 0 && !tag_end[pos] && !skip ) buffer->iseek(ipos); return opos; } -int FileXML::read_text_until(const char *tag_end, char *out, int len) +int FileXML::read_text_until(const char *tag_end, char *out, int len, int skip) { char data[len+1]; - int opos = read_data_until(tag_end, data, len); + int opos = read_data_until(tag_end, data, len, skip); decode(out, data, opos); return 0; } diff --git a/cinelerra-5.1/cinelerra/filexml.h b/cinelerra-5.1/cinelerra/filexml.h index 270b763d..c6506f02 100644 --- a/cinelerra-5.1/cinelerra/filexml.h +++ b/cinelerra-5.1/cinelerra/filexml.h @@ -133,8 +133,8 @@ public: int append_data(const char *text, long len); char* read_text(); - int read_data_until(const char *tag_end, char *out, int len); - int read_text_until(const char *tag_end, char *out, int len); + int read_data_until(const char *tag_end, char *out, int len, int skip=0); + int read_text_until(const char *tag_end, char *out, int len, int skip=0); int read_tag(); int skip_tag(); int write_to_file(const char *filename); diff --git a/cinelerra-5.1/cinelerra/keyframe.C b/cinelerra-5.1/cinelerra/keyframe.C index 28ff8c6f..cd8c6a3e 100644 --- a/cinelerra-5.1/cinelerra/keyframe.C +++ b/cinelerra-5.1/cinelerra/keyframe.C @@ -54,7 +54,7 @@ void KeyFrame::load(FileXML *file) // position = file->tag.get_property((char*)"POSITION", position); //printf("KeyFrame::load 1\n"); - int len = file->read_data_until((char*)"/KEYFRAME", data, MESSAGESIZE-1); + int len = file->read_data_until((char*)"/KEYFRAME", data, MESSAGESIZE-1, 1); data[len] = 0; //printf("KeyFrame::load 2 data=\n%s\nend of data\n", data); } diff --git a/cinelerra-5.1/cinelerra/localsession.C b/cinelerra-5.1/cinelerra/localsession.C index 19f8d62a..eace821b 100644 --- a/cinelerra-5.1/cinelerra/localsession.C +++ b/cinelerra-5.1/cinelerra/localsession.C @@ -168,7 +168,6 @@ 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); @@ -213,6 +212,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 +251,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); @@ -320,6 +328,14 @@ 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") ) { + file->read_text_until("/CLIP_NOTES", + clip_notes, sizeof(clip_notes)-1, 1); + } + } } void LocalSession::boundaries() diff --git a/cinelerra-5.1/cinelerra/vwindow.C b/cinelerra-5.1/cinelerra/vwindow.C index d1ea6b03..2574499b 100644 --- a/cinelerra-5.1/cinelerra/vwindow.C +++ b/cinelerra-5.1/cinelerra/vwindow.C @@ -212,10 +212,10 @@ void VWindow::change_source(Indexable *indexable) if( playback_engine->is_playing_back ) stop_playback(1); - gui->lock_window("VWindow::change_source 2"); // if(asset && this->asset && // asset->id == this->asset->id && // asset == this->asset) return; + gui->lock_window("VWindow::change_source 2"); //printf("VWindow::change_source %d\n", __LINE__);