wintv remote control + kernel patch, add codec fileref, amp up OpenEDL, add loadmode...
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcfilebox.C
index 54e6bbf5de5c6d65c88cf43a37b3e9b4c76573a4..cbb5168e7c3c90a1f0e0b494a23f1ba2e9dc0c67 100644 (file)
@@ -90,14 +90,8 @@ int BC_FileBoxListBox::selection_changed()
                filebox->column_of_type(FILEBOX_NAME), 0);
 
        if(item) {
-               char path[BCTEXTLEN];
-               strcpy(path, item->get_text());
-               filebox->textbox->update(path);
-               filebox->fs->extract_dir(filebox->directory, path);
-               filebox->fs->extract_name(filebox->filename, path);
-               filebox->fs->complete_path(path);
-               strcpy(filebox->current_path, path);
-               strcpy(filebox->submitted_path, path);
+               filebox->textbox->update(item->get_text());
+               filebox->update_paths(item->get_text());
        }
        return 1;
 }
@@ -172,11 +166,11 @@ BC_FileBoxTextBox::~BC_FileBoxTextBox()
 
 int BC_FileBoxTextBox::handle_event()
 {
-       int result = 0;
-       if(get_keypress() != RETURN)
-       {
+       int key = get_keypress(), result = 1;
+       if( !key || key == RETURN ) // not a text update
+               filebox->update_paths(filebox->textbox->get_text());
+       else
                result = calculate_suggestions(&filebox->list_column[0]);
-       }
        return result;
 }
 
@@ -1017,6 +1011,17 @@ int BC_FileBox::update_filter(const char *filter)
 }
 
 
+void BC_FileBox::update_paths(const char *text)
+{
+       char path[BCTEXTLEN];
+       strncpy(path, text, sizeof(path)-1);
+       fs->extract_dir(directory, path);
+       fs->extract_name(filename, path);
+       fs->complete_path(path);
+       strcpy(current_path, path);
+       strcpy(submitted_path, path);
+}
+
 void BC_FileBox::move_column(int src, int dst)
 {
        if(src != dst)
@@ -1325,24 +1330,19 @@ int BC_FileBox::get_y_margin()
 char* BC_FileBox::get_path(int selection)
 {
        if(selection == 0)
-       {
                return get_submitted_path();
-       }
-       else
-       {
-               BC_ListBoxItem *item = listbox->get_selection(
-                       column_of_type(FILEBOX_NAME), selection - 1);
-               if(item)
-               {
-                       fs->join_names(string, directory, item->get_text());
-                       return string;
-               }
+       BC_ListBoxItem *item = listbox->get_selection(
+               column_of_type(FILEBOX_NAME), selection - 1);
+       if( item ) {
+               fs->join_names(string, directory, item->get_text());
+               return string;
        }
        return 0;
 }
 
 char* BC_FileBox::get_submitted_path()
 {
+       update_paths(textbox->get_text());
        return submitted_path;
 }