X-Git-Url: http://git.cinelerra-gg.org/git/?a=blobdiff_plain;f=cinelerra-5.1%2Fguicast%2Fbcfilebox.C;h=7ca7e4ab8962428b933dbcee3b05ba9f84d3f9c2;hb=564227981f9c1b021445fa0352b75c7670172912;hp=7d52d98c9e56250266cae06a4104132f17b3597e;hpb=27d1d08d9125dc46f252073aaf1fead7518ee4c8;p=goodguy%2Fhistory.git diff --git a/cinelerra-5.1/guicast/bcfilebox.C b/cinelerra-5.1/guicast/bcfilebox.C index 7d52d98c..7ca7e4ab 100644 --- a/cinelerra-5.1/guicast/bcfilebox.C +++ b/cinelerra-5.1/guicast/bcfilebox.C @@ -1,7 +1,7 @@ /* * CINELERRA - * Copyright (C) 1997-2011 Adam Williams + * Copyright (C) 1997-2017 Adam Williams * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -625,11 +625,9 @@ void BC_FileBox::create_objects() add_subwindow(recent_popup = new BC_FileBoxRecent(this, x, y)); add_subwindow(directory_title = new BC_FileBoxDirectoryText(x, y, this)); - directory_title->reposition_window(x, y, - get_w() - recent_popup->get_w() - 20, 1); - recent_popup->reposition_window( - x + directory_title->get_w(), y, - directory_title->get_w(), 200); + directory_title->reposition_window(x, y, get_w() - recent_popup->get_w() - 20, 1); + x += directory_title->get_w() + 8; + recent_popup->reposition_window(x, y, directory_title->get_w(), 200); x = 10; y += directory_title->get_h() + 5; @@ -685,9 +683,7 @@ int BC_FileBox::get_listbox_w() int BC_FileBox::get_listbox_h(int y) { - int result = get_h() - - y - - h_padding; + int result = get_h() - y - h_padding - 10; if(want_directory) result -= BC_WindowBase::get_resources()->dirbox_margin; else @@ -738,7 +734,7 @@ int BC_FileBox::resize_event(int w, int h) get_w() - recent_popup->get_w() - 20, 1); recent_popup->reposition_window( - directory_title->get_x() + directory_title->get_w(), + directory_title->get_x() + directory_title->get_w() + 8, directory_title->get_y(), directory_title->get_w() + recent_popup->get_w(), recent_popup->get_h()); @@ -885,25 +881,13 @@ int BC_FileBox::delete_tables() BC_Pixmap* BC_FileBox::get_icon(char *path, int is_dir) { - char *suffix = strrchr(path, '.'); + if( is_dir ) return icons[ICON_FOLDER]; int icon_type = ICON_UNKNOWN; - - if(is_dir) return icons[ICON_FOLDER]; - - if(suffix) - { - suffix++; - if(*suffix != 0) - { - for(int i = 0; i < TOTAL_SUFFIXES; i++) - { - if(!strcasecmp(suffix, BC_WindowBase::get_resources()->suffix_to_type[i].suffix)) - { - icon_type = BC_WindowBase::get_resources()->suffix_to_type[i].icon_type; - break; - } - } - } + char *suffix = strrchr(path, '.'); + if( suffix && *++suffix ) { + suffix_to_type_t *stp = &BC_WindowBase::get_resources()->suffix_to_type[0]; + while( stp->suffix && strcasecmp(stp->suffix, suffix) ) ++stp; + if( stp->icon_type ) icon_type = stp->icon_type; } return icons[icon_type]; @@ -1040,12 +1024,17 @@ int BC_FileBox::submit_dir(char *dir) int BC_FileBox::submit_file(const char *path, int use_this) { + char path1[BCTEXTLEN]; + strcpy(path1, path); + char *cp = strchr(path1,'\n'); + if( cp ) *cp = 0; + // Deactivate textbox to hide suggestions textbox->deactivate(); // If file wanted, take the current directory as the desired file. // If directory wanted, ignore it. - if(!path[0] && !want_directory) + if(!path1[0] && !want_directory) { // save complete path strcpy(this->current_path, directory); @@ -1059,9 +1048,9 @@ int BC_FileBox::submit_file(const char *path, int use_this) } // is a directory, change directories - if(fs->is_dir(path) && !use_this) + if(fs->is_dir(path1) && !use_this) { - fs->change_dir(path, 0); + fs->change_dir(path1, 0); refresh(1); directory_title->update(fs->get_current_dir()); strcpy(this->current_path, fs->get_current_dir()); @@ -1080,7 +1069,7 @@ int BC_FileBox::submit_file(const char *path, int use_this) // Is a file or desired directory. Quit the operation. { char path2[BCTEXTLEN]; - strcpy(path2, path); + strcpy(path2, path1); // save directory for defaults fs->extract_dir(directory, path2); @@ -1116,7 +1105,7 @@ void BC_FileBox::update_history() strcpy(path, directory); // enfore one trailing slash char *cp = path; - while( *cp ) ++cp; + while( *cp && *cp != '\n' ) ++cp; while( cp > path && *(cp-1) == '/' ) --cp; *cp++ = '/'; *cp = 0;