X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcfilebox.C;h=7d52d98c9e56250266cae06a4104132f17b3597e;hb=27d1d08d9125dc46f252073aaf1fead7518ee4c8;hp=8e5a1e547aa5969d68b26e7f8e1b4bc5a6238a30;hpb=8c99a62f8ed4014195a3b65095becec907690d72;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 8e5a1e54..7d52d98c 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -128,7 +128,7 @@ int BC_FileBoxListBox::sort_order_event() { get_resources()->filebox_sortcolumn = filebox->sort_column = get_sort_column(); get_resources()->filebox_sortorder = filebox->sort_order = get_sort_order(); - filebox->refresh(); + filebox->refresh(-1); return 1; } @@ -215,7 +215,7 @@ int BC_FileBoxDirectoryText::handle_event() while( *cp ) ++cp; if( cp > path && *--cp != '/' ) return 0; char *file_path = FileSystem::basepath(path); - char *dir_path = FileSystem::basepath(filebox->fs->get_current_dir()); + char *dir_path = FileSystem::basepath(filebox->directory); int ret = !strcmp(file_path, dir_path) ? 0 : 1; if( ret ) { strcpy(filebox->directory, file_path); @@ -497,7 +497,7 @@ BC_FileBox::BC_FileBox(int x, int y, const char *init_path, this->want_directory = want_directory; if(show_all_files) fs->set_show_all(); fs->complete_path(this->current_path); - fs->complete_path(this->submitted_path); + strcpy(this->submitted_path, this->current_path); fs->extract_dir(directory, this->current_path); fs->extract_name(filename, this->current_path); @@ -535,16 +535,12 @@ BC_FileBox::BC_FileBox(int x, int y, const char *init_path, // Test if current directory exists if(!fs->is_dir(directory)) { - sprintf(this->current_path, "~"); - fs->complete_path(this->current_path); - fs->set_current_dir(this->current_path); -// fs->update(this->current_path); - strcpy(directory, fs->get_current_dir()); + sprintf(directory, "~"); + fs->complete_path(directory); + strcpy(current_path,directory); filename[0] = 0; } - else - fs->set_current_dir(this->directory); - + fs->set_current_dir(directory); if(h_padding == -1) { @@ -580,22 +576,18 @@ void BC_FileBox::create_objects() int directory_title_margin = MAX(20, resources->filebox_text_images[0]->get_h()); -// Create recent dir list - create_history(); - // Directories aren't filtered in FileSystem so skip this if(!want_directory) { filter_list.append(new BC_ListBoxItem("*")); - filter_list.append(new BC_ListBoxItem("[*.ifo][*.vob]")); + filter_list.append(new BC_ListBoxItem("[*.mkv]")); + filter_list.append(new BC_ListBoxItem("[*.mp4]")); filter_list.append(new BC_ListBoxItem("[*.mp2][*.mp3][*.wav]")); filter_list.append(new BC_ListBoxItem("[*.avi][*.mpg][*.m2v][*.m1v][*.mov]")); - filter_list.append(new BC_ListBoxItem("heroine*")); filter_list.append(new BC_ListBoxItem("*.xml")); fs->set_filter(get_resources()->filebox_filter); } -// fs->update(directory); create_icons(); create_tables(); @@ -653,8 +645,16 @@ void BC_FileBox::create_objects() if( newest >= 0 ) { strcpy(directory, resources->filebox_history[newest].path); fs->change_dir(directory, 0); + strcpy(directory, fs->get_current_dir()); directory_title->update(fs->get_current_dir()); } + fs->set_sort_order(sort_order); + fs->set_sort_field(column_type[sort_column]); + fs->update(directory); + +// Create recent dir list + create_history(); + update_history(); listbox = 0; create_listbox(x, y, get_display_mode()); @@ -674,7 +674,7 @@ void BC_FileBox::create_objects() rename_thread = new BC_RenameThread(this); - + refresh(); show_window(); } @@ -807,8 +807,6 @@ int BC_FileBox::create_tables() fs->set_sort_order(sort_order); fs->set_sort_field(column_type[sort_column]); -// Directory is entered before this from a random source - fs->update(0); for(int i = 0; i < fs->total_files(); i++) { FileItem *file_item = fs->get_entry(i); @@ -913,20 +911,11 @@ BC_Pixmap* BC_FileBox::get_icon(char *path, int is_dir) const char* BC_FileBox::columntype_to_text(int type) { - switch(type) - { - case FILEBOX_NAME: - return FILEBOX_NAME_TEXT; - break; - case FILEBOX_SIZE: - return FILEBOX_SIZE_TEXT; - break; - case FILEBOX_DATE: - return FILEBOX_DATE_TEXT; - break; - case FILEBOX_EXTENSION: - return FILEBOX_EXTENSION_TEXT; - break; + switch(type) { + case FILEBOX_NAME: return FILEBOX_NAME_TEXT; + case FILEBOX_SIZE: return FILEBOX_SIZE_TEXT; + case FILEBOX_DATE: return FILEBOX_DATE_TEXT; + case FILEBOX_EXTENSION: return FILEBOX_EXTENSION_TEXT; } return ""; } @@ -940,13 +929,19 @@ int BC_FileBox::column_of_type(int type) -int BC_FileBox::refresh(int zscroll) +int BC_FileBox::refresh(int reset) { + fs->set_sort_order(sort_order); + fs->set_sort_field(column_type[sort_column]); + if( reset >= 0 ) + fs->update(0); + else + fs->update_sort(); create_tables(); listbox->set_master_column(column_of_type(FILEBOX_NAME), 0); listbox->update(list_column, column_titles, column_width, columns, - !zscroll ? listbox->get_xposition() : 0, - !zscroll ? listbox->get_yposition() : 0, + reset>0 ? 0 : listbox->get_xposition(), + reset>0 ? 0 : listbox->get_yposition(), -1, 1); return 0; } @@ -966,7 +961,6 @@ void BC_FileBox::move_column(int src, int dst) { if(src != dst) { - ArrayList *new_columns = new ArrayList[columns]; int *new_types = new int[columns];