back by popular demand: load mode icons, tweak shapewipe layout
[goodguy/cinelerra.git] / cinelerra-5.1 / guicast / bcfilebox.C
index 7fba2ec63dfa468d6569d9073cabbf0dace5cc0e..803f2fc465542afec39b9179c744f0de2e44cd08 100644 (file)
@@ -51,6 +51,7 @@ BC_FileBoxRecent::BC_FileBoxRecent(BC_FileBox *filebox, int x, int y)
                0, 0, 1, 0, 1)
 {
        this->filebox = filebox;
+       set_tooltip(_("Recent paths"));
 }
 
 int BC_FileBoxRecent::handle_event()
@@ -173,7 +174,7 @@ int BC_FileBoxListBox::evaluate_query(char *string)
 
 
 BC_FileBoxTextBox::BC_FileBoxTextBox(int x, int y, BC_FileBox *filebox)
- : BC_TextBox(x, y, filebox->get_w() - 20, 1,
+ : BC_TextBox(x, y, filebox->get_w() - x - 20, 1,
        filebox->want_directory ?  filebox->directory : filebox->filename)
 {
        this->filebox = filebox;
@@ -194,8 +195,8 @@ int BC_FileBoxTextBox::handle_event()
 }
 
 
-BC_FileBoxDirectoryText::BC_FileBoxDirectoryText(int x, int y, BC_FileBox *filebox)
- : BC_TextBox(x, y, filebox->get_w() - 40, 1, filebox->fs->get_current_dir())
+BC_FileBoxDirectoryText::BC_FileBoxDirectoryText(int x, int y, int w, BC_FileBox *filebox)
+ : BC_TextBox(x, y, w, 1, filebox->fs->get_current_dir())
 {
        this->filebox = filebox;
 }
@@ -545,6 +546,7 @@ BC_FileBox::BC_FileBox(int x, int y, const char *init_path,
        this->h_padding = h_padding;
        delete_thread = new BC_DeleteThread(this);
        rename_thread = 0;
+       y_margin = 0;
 }
 
 BC_FileBox::~BC_FileBox()
@@ -624,10 +626,12 @@ void BC_FileBox::create_objects()
        y += directory_title_margin + 3;
 
        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);
-       x += directory_title->get_w() + 8;
-       recent_popup->reposition_window(x, y, directory_title->get_w(), 200);
+       BC_Title *dir_title;
+       add_subwindow(dir_title = new BC_Title(x, y, _("Directory:")));
+       int x1 = x + dir_title->get_w() + 10, w1 = get_w()-x1 - recent_popup->get_w()-20;
+       add_subwindow(directory_title = new BC_FileBoxDirectoryText(x1, y, w1, this));
+       x1 += directory_title->get_w() + 8;
+       recent_popup->reposition_window(x1, y, directory_title->get_w(), 200);
 
        x = 10;
        y += directory_title->get_h() + 5;
@@ -665,7 +669,9 @@ void BC_FileBox::create_objects()
        listbox = 0;
        create_listbox(x, y, get_display_mode());
        y += listbox->get_h() + 10;
-       add_subwindow(textbox = new BC_FileBoxTextBox(x, y, this));
+       add_subwindow(file_title = new BC_Title(x, y, _("File:")));
+       x1 = x + file_title->get_w() + 10;
+       add_subwindow(textbox = new BC_FileBoxTextBox(x1, y, this));
        y += textbox->get_h() + 10;
 
        if(!want_directory) {
@@ -674,7 +680,9 @@ void BC_FileBox::create_objects()
                add_subwindow(filter_text = new BC_FileBoxFilterText(x1, y, this));
                add_subwindow(filter_popup =
                        new BC_FileBoxFilterMenu(x1 + filter_text->get_w(), y, this));
+               y += filter_text->get_h() + 10;
        }
+       y_margin = y;
 
 // listbox has to be active because refresh might be called from newfolder_thread
        listbox->activate();
@@ -684,6 +692,7 @@ void BC_FileBox::create_objects()
 
        refresh();
        show_window();
+       raise_window();
        unlock_window();
 }
 
@@ -741,10 +750,8 @@ int BC_FileBox::resize_event(int w, int h)
                w - (get_w() - filter_text->get_w()),
                1);
        directory_title->reposition_window(
-               directory_title->get_x(),
-               directory_title->get_y(),
-               get_w() - recent_popup->get_w() -  20,
-               1);
+               directory_title->get_x(), directory_title->get_y(),
+               get_w()-directory_title->get_x() - recent_popup->get_w()-20, 1);
        recent_popup->reposition_window(
                directory_title->get_x() + directory_title->get_w() + 8,
                directory_title->get_y(),
@@ -754,6 +761,8 @@ int BC_FileBox::resize_event(int w, int h)
                search_text->get_y(),
                get_w() - search_text->get_x() -  40,
                1);
+       file_title->reposition_window(file_title->get_x(),
+               h - (get_h() - file_title->get_y()));
        textbox->reposition_window(textbox->get_x(),
                h - (get_h() - textbox->get_y()),
                w - (get_w() - textbox->get_w()),
@@ -775,6 +784,9 @@ int BC_FileBox::resize_event(int w, int h)
        set_w(w);  set_h(h);
        get_resources()->filebox_w = get_w();
        get_resources()->filebox_h = get_h();
+       y_margin = filter_text ?
+               filter_text->get_y() + filter_text->get_h() + 10 :
+               textbox->get_y() + textbox->get_h() + 10 ;
        flush();
        return 1;
 }
@@ -1318,6 +1330,11 @@ void BC_FileBox::create_listbox(int x, int y, int mode)
                add_subwindow(listbox = new BC_FileBoxListBox(x, y, this));
 }
 
+int BC_FileBox::get_y_margin()
+{
+       return y_margin;
+}
+
 char* BC_FileBox::get_path(int selection)
 {
        if(selection == 0)