titler rework, some code cleanup and fixes
[goodguy/history.git] / cinelerra-5.1 / cinelerra / formattools.C
index 28f4b556461f7a1337a9272df7c7f497dcaa7637..4f6580d4fa21628ed578a7059e2f343ebf932462 100644 (file)
@@ -68,7 +68,6 @@ FormatTools::FormatTools(MWindow *mwindow,
        channels_title = 0;
        channels_button = 0;
        multiple_files = 0;
-       file_entries = 0;
        w = window->get_w();
 
        recording = 0;
@@ -104,12 +103,6 @@ SET_TRACE
        if(vparams_thread) delete vparams_thread;
 SET_TRACE
        if(channels_tumbler) delete channels_tumbler;
-SET_TRACE
-       if(file_entries)
-       {
-               file_entries->remove_all_objects();
-               delete file_entries;
-       }
 }
 
 void FormatTools::create_objects(int &init_x,
@@ -141,19 +134,6 @@ void FormatTools::create_objects(int &init_x,
        this->prompt_video_compression = prompt_video_compression;
        this->strategy = strategy;
 
-
-       file_entries = new ArrayList<BC_ListBoxItem*>;
-       FileSystem fs;
-       char string[BCTEXTLEN];
-// Load current directory
-       fs.update(getcwd(string, BCTEXTLEN));
-       for(int i = 0; i < fs.total_files(); i++)
-       {
-               file_entries->append(
-                       new BC_ListBoxItem(
-                               fs.get_entry(i)->get_name()));
-       }
-
 //printf("FormatTools::create_objects 1\n");
 
 // Modify strategy depending on render farm
@@ -179,21 +159,20 @@ void FormatTools::create_objects(int &init_x,
 
        if(!recording)
        {
-               window->add_subwindow(path_textbox = new FormatPathText(x, y, this));
-               x += path_textbox->get_w() + 5;
+               int px = x;
+               window->add_subwindow(path_textbox = new FormatPathText(px, y, this));
+               px += path_textbox->get_w() + 5;
                path_recent = new BC_RecentList("PATH", mwindow->defaults,
-                                       path_textbox, 10, x, y, 300, 100);
+                                       path_textbox, 10, px, y, 300, 100);
                window->add_subwindow(path_recent);
                path_recent->load_items(File::formattostr(asset->format));
-               x += path_recent->get_w() + 8;
+               px += path_recent->get_w();
                window->add_subwindow(path_button = new BrowseButton(
-                       mwindow, window, path_textbox, x, y, asset->path,
+                       mwindow->theme, window, path_textbox, px, y, asset->path,
                        _("Output to file"), _("Select a file to write to:"), 0));
 
 // Set w for user.
                w = MAX(w, 305);
-//             w = x + path_button->get_w() + 5;
-               x -= path_textbox->get_w() + 5;
                y += path_textbox->get_h() + 10;
        }
        else
@@ -205,14 +184,14 @@ void FormatTools::create_objects(int &init_x,
        x = init_x;
        window->add_subwindow(format_title = new BC_Title(x, y, _("File Format:")));
        x += 90;
-       window->add_subwindow(format_text = new BC_TextBox(x, y, 180, 1,
+       window->add_subwindow(format_text = new BC_TextBox(x, y, 160, 1,
                File::formattostr(asset->format)));
        x += format_text->get_w();
 //printf("FormatTools::create_objects %d %p\n", __LINE__, window);
        window->add_subwindow(format_button = new FormatFormat(x, y, this));
        format_button->create_objects();
        x += format_button->get_w() + 5;
-       window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 50, 1, asset->fformat));
+       window->add_subwindow(ffmpeg_type = new FFMpegType(x, y, 64, 1, asset->fformat));
        FFMPEG::set_asset_format(asset, asset->fformat);
        x += ffmpeg_type->get_w();
        window->add_subwindow(format_ffmpeg = new FormatFFMPEG(x, y, this));
@@ -320,8 +299,6 @@ void FormatTools::update_driver(int driver)
 
                case CAPTURE_IEC61883:
                case CAPTURE_FIREWIRE:
-               case CAPTURE_LML:
-               case CAPTURE_BUZ:
                case VIDEO4LINUX2JPEG:
                case CAPTURE_JPEG_WEBCAM:
                        asset->format = FILE_FFMPEG;
@@ -333,8 +310,6 @@ void FormatTools::update_driver(int driver)
                                locked_compressor = (char*)CODEC_TAG_DVSD;
                                break;
 
-                       case CAPTURE_BUZ:
-                       case CAPTURE_LML:
                        case VIDEO4LINUX2JPEG:
                                locked_compressor = (char*)CODEC_TAG_MJPEG;
                                break;
@@ -507,7 +482,8 @@ void FormatTools::close_format_windows()
 
 int FormatTools::get_w()
 {
-       return w;
+       return asset->format != FILE_FFMPEG ? w :
+               format_ffmpeg->get_x() + format_ffmpeg->get_w();
 }
 
 void FormatTools::set_w(int w)
@@ -522,11 +498,13 @@ void FormatTools::reposition_window(int &init_x, int &init_y)
 
        if(path_textbox)
        {
-               path_textbox->reposition_window(x, y);
-               x += path_textbox->get_w() + 5;
-               path_button->reposition_window(x, y);
-               x -= path_textbox->get_w() + 5;
-               y += 35;
+               int px = x;
+               path_textbox->reposition_window(px, y);
+               px += path_textbox->get_w() + 5;
+               path_recent->reposition_window(px, y);
+               px += path_recent->get_w() + 8;
+               path_button->reposition_window(px, y);
+               y += path_textbox->get_h() + 10;
        }
 
        format_title->reposition_window(x, y);
@@ -547,7 +525,7 @@ void FormatTools::reposition_window(int &init_x, int &init_y)
                if(prompt_audio) audio_switch->reposition_window(x, y);
 
                x = init_x;
-               y += aparams_button->get_h() + 20;
+               y += aparams_button->get_h() + 10;
                if(prompt_audio_channels)
                {
                        channels_title->reposition_window(x, y);
@@ -688,9 +666,8 @@ FormatAThread::FormatAThread(FormatTools *format)
 
 FormatAThread::~FormatAThread()
 {
+       delete file;  file = 0;
        join();
-       delete file;
-       file = 0;
 }
 
 void FormatAThread::start()
@@ -719,9 +696,8 @@ FormatVThread::FormatVThread(FormatTools *format)
 
 FormatVThread::~FormatVThread()
 {
+       delete file;  file = 0;
        join();
-       delete file;
-       file = 0;
 }
 
 void FormatVThread::start()
@@ -753,11 +729,7 @@ FormatPathText::~FormatPathText()
 }
 int FormatPathText::handle_event()
 {
-// Suggestions
-       calculate_suggestions(format->file_entries);
-
-
-
+       calculate_suggestions();
        strcpy(format->asset->path, get_text());
        format->handle_event();
        return 1;