X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fcinelerra%2Fswindow.C;h=5764aeae49875e09f8ad924cb86a2fbc951cd72a;hb=60f8df69db9ddd8148bfc41a17bb0955b52a45e6;hp=a4315b50febf1e877dfb3bab7bf5fb46c257315b;hpb=bf87166cc5846f96c5be2621e329c1cbc21c1508;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/cinelerra/swindow.C b/cinelerra-5.1/cinelerra/swindow.C index a4315b50..5764aeae 100644 --- a/cinelerra-5.1/cinelerra/swindow.C +++ b/cinelerra-5.1/cinelerra/swindow.C @@ -76,27 +76,15 @@ SWindowLoadPath::SWindowLoadPath(SWindowGUI *gui, int x, int y, char *path) : BC_TextBox(x, y, 200, 1, path) { this->sw_gui = gui; - - file_entries = new ArrayList; - FileSystem fs; char string[BCTEXTLEN]; -// Load current directory - fs.update(getcwd(string, BCTEXTLEN)); - int total_files = fs.total_files(); - for(int i = 0; i < total_files; i++) { - const char *name = fs.get_entry(i)->get_name(); - file_entries->append(new BC_ListBoxItem(name)); - } } SWindowLoadPath::~SWindowLoadPath() { - file_entries->remove_all_objects(); - delete file_entries; } int SWindowLoadPath::handle_event() { - calculate_suggestions(file_entries); + calculate_suggestions(); strcpy(sw_gui->script_path, get_text()); return 1; } @@ -196,14 +184,14 @@ void SWindowGUI::create_objects() add_subwindow(script_title = new BC_Title(x1, y, _("Script Text:"))); y += script_title->get_h() + pad; int rows = (ok_y - y - BC_Title::calculate_h(this,_("Line Text:")) - - 4*pad) / text_rowsz - 3; + 4*pad) / text_rowsz - 4; int w1 = get_w() - x1 - pad; script_entry = new ScriptEntry(this, x1, y, w1, rows, blank_line); script_entry->create_objects(); y += script_entry->get_h() + pad; add_subwindow(line_title = new BC_Title(x1, y, _("Line Text:"))); y += line_title->get_h() + pad; - line_entry = new ScriptEntry(this, x1, y, w1, 3); + line_entry = new ScriptEntry(this, x1, y, w1, 4); line_entry->create_objects(); ok = new SWindowOK(this, ok_x, ok_y); add_subwindow(ok); @@ -333,12 +321,12 @@ int SWindowGUI::resize_event(int w, int h) script_title->reposition_window(x, y); y += script_title->get_h() + pad; w1 = w - x - pad; - int rows = (ok_y - y - line_title->get_h() - 4*pad) / text_rowsz - 3; + int rows = (ok_y - y - line_title->get_h() - 4*pad) / text_rowsz - 4; script_entry->reposition_window(x, y, w1, rows); y += script_entry->get_h() + 2*pad; line_title->reposition_window(x, y); y += line_title->get_h() + pad; - line_entry->reposition_window(x, y, w1, 3); + line_entry->reposition_window(x, y, w1, 4); return 0; } @@ -368,6 +356,7 @@ void SWindowGUI::set_script_pos(int64_t entry_no, int text_no) int SWindowGUI::load_selection(int pos, int row) { + if( pos < 0 || pos >= script.size() ) return 1; ScriptLines *texts = script[pos]; char *rp = texts->get_text_row(row); if( !rp || *rp == '=' || *rp == '*' || *rp=='\n' ) return 1; @@ -689,7 +678,7 @@ char *ScriptLines::get_text_row(int n) } ScriptScroll::ScriptScroll(SWindowGUI *gui, int x, int y, int w) - : BC_ScrollBar(x, y, SCROLL_HORIZ, w, 0, 0, 0) + : BC_ScrollBar(x, y, SCROLL_HORIZ + SCROLL_STRETCH, w, 0, 0, 0) { this->sw_gui = gui; } @@ -754,7 +743,7 @@ void ScriptEntry::set_text(char *text, int isz) int ScriptEntry::handle_event() { - if( sw_gui->get_button_down() && + if( ttext && sw_gui->get_button_down() && sw_gui->get_buttonpress() == 1 && sw_gui->get_triple_click() ) { int ibeam = get_ibeam_letter(), row = 0; @@ -806,6 +795,8 @@ void SWindowGUI::load_script() return; } load_script(fp); + script_text_no = -1; + load_selection(script_entry_no=0, 0); } void SWindowGUI::load_script(FILE *fp) @@ -823,11 +814,10 @@ void SWindowGUI::load_script(FILE *fp) script_entries->update(value); sprintf(value,"%jd",script_text_lines); script_texts->update(value); - int hw = 2*script_scroll->get_h(); + int hw = script_scroll->get_h(); script_scroll->update_length(script.size(), script_entry_no, hw, 0); script_position->update(script_entry_no); script_position->set_boundaries((int64_t)0, (int64_t)script.size()-1); - fclose(fp); } @@ -846,9 +836,11 @@ void SWindowGUI::save_spumux_data() for( Track *track=tracks->first; track; track=track->next ) { if( track->data_type != TRACK_SUBTITLE ) continue; if( !track->record ) continue; - char *cp = track_title; - for( char *bp=track->title; *bp; ++bp,++cp ) - *cp = !isalnum(*bp) ? '_' : *bp; + char *cp = track_title, *ep = cp+sizeof(track_title)-6; + for( const char *bp=track->title; cp