remove whitespace at eol
[goodguy/history.git] / cinelerra-5.1 / cinelerra / edlsession.C
index 50ba297e4ac697875b22971235405bf440bde932..ddce17f1b45dbd9c18a1b09ee0edcf928d6d58b5 100644 (file)
 #include "asset.h"
 #include "assets.h"
 #include "autoconf.h"
+#include "awindowgui.h"
 #include "bccmodels.h"
 #include "bchash.h"
+#include "clip.h"
 #include "edl.h"
 #include "edlsession.h"
 #include "filexml.h"
@@ -45,21 +47,21 @@ EDLSession::EDLSession(EDL *edl)
        for(int i = 0; i < ASSET_COLUMNS; i++)
                asset_columns[i] = 100;
        auto_conf = new AutoConf;
+       awindow_folder = AW_MEDIA_FOLDER;
        aspect_w = 4;  aspect_h = 3;
        audio_channels = 2;
        audio_tracks = 2;
        autos_follow_edits = 1; // this is needed for predictability
        auto_keyframes = 0;
-       brender_start = 0.0;
+       brender_start = brender_end = 0.0;
        clipboard_length = 0; // unused
        color_model = BC_RGBA8888;
-       interlace_mode = BC_ILACE_MODE_UNDETECTED;
+       interlace_mode = ILACE_MODE_UNDETECTED;
        crop_x1 = 0; crop_x2 = 320;
        crop_y1 = 0; crop_y2 = 240;
        eyedrop_radius = 0;
        ruler_x1 = ruler_y1 = 0.0;
        ruler_x2 = ruler_y2 = 0.0;
-       strcpy(current_folder, "");
        cursor_on_frames = 1;
        typeless_keyframes = 0;
        cwindow_dest = 0;
@@ -172,7 +174,7 @@ void EDLSession::equivalent_output(EDLSession *session, double *result)
 {
        if(session->output_w != output_w ||
                session->output_h != output_h ||
-               session->frame_rate != frame_rate ||
+               !EQUIV(session->frame_rate, frame_rate) ||
                session->color_model != color_model ||
                session->interpolation_type != interpolation_type ||
                session->interpolate_raw != interpolate_raw ||
@@ -223,12 +225,13 @@ int EDLSession::load_defaults(BC_Hash *defaults)
        auto_conf->load_defaults(defaults);
        autos_follow_edits = defaults->get("AUTOS_FOLLOW_EDITS", 1);
        brender_start = defaults->get("BRENDER_START", brender_start);
+       brender_end = defaults->get("BRENDER_END", brender_end);
        BC_CModels::to_text(string, BC_RGBA8888);
        color_model = BC_CModels::from_text(defaults->get("COLOR_MODEL", string));
        eyedrop_radius = defaults->get("EYEDROP_RADIUS", 0);
        ilacemode_to_xmltext(string, interlace_mode);
        const char *ilace_mode = defaults->get("INTERLACE_MODE",string);
-       interlace_mode = ilacemode_from_xmltext(ilace_mode, BC_ILACE_MODE_NOTINTERLACED);
+       interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED);
        crop_x1 = defaults->get("CROP_X1", 0);
        crop_x2 = defaults->get("CROP_X2", 320);
        crop_y1 = defaults->get("CROP_Y1", 0);
@@ -237,8 +240,7 @@ int EDLSession::load_defaults(BC_Hash *defaults)
        ruler_x2 = defaults->get("RULER_X2", 0.0);
        ruler_y1 = defaults->get("RULER_Y1", 0.0);
        ruler_y2 = defaults->get("RULER_Y2", 0.0);
-       sprintf(current_folder, MEDIA_FOLDER);
-       defaults->get("CURRENT_FOLDER", current_folder);
+       awindow_folder = defaults->get("AWINDOW_FOLDER", awindow_folder);
        cursor_on_frames = defaults->get("CURSOR_ON_FRAMES", 1);
        typeless_keyframes = defaults->get("TYPELESS_KEYFRAMES", 0);
        cwindow_dest = defaults->get("CWINDOW_DEST", 0);
@@ -249,9 +251,9 @@ int EDLSession::load_defaults(BC_Hash *defaults)
        cwindow_xscroll = defaults->get("CWINDOW_XSCROLL", 0);
        cwindow_yscroll = defaults->get("CWINDOW_YSCROLL", 0);
        cwindow_zoom = defaults->get("CWINDOW_ZOOM", (float)1);
-       sprintf(default_atransition, "Crossfade");
+       sprintf(default_atransition, _("Crossfade"));
        defaults->get("DEFAULT_ATRANSITION", default_atransition);
-       sprintf(default_vtransition, "Dissolve");
+       sprintf(default_vtransition, _("Dissolve"));
        defaults->get("DEFAULT_VTRANSITION", default_vtransition);
        default_transition_length = defaults->get("DEFAULT_TRANSITION_LENGTH", (double)1);
        edit_handle_mode[0] = defaults->get("EDIT_HANDLE_MODE0", MOVE_ALL_EDITS);
@@ -335,14 +337,13 @@ int EDLSession::load_defaults(BC_Hash *defaults)
        video_write_length = defaults->get("VIDEO_WRITE_LENGTH", 30);
        view_follows_playback = defaults->get("VIEW_FOLLOWS_PLAYBACK", 1);
        vwindow_meter = defaults->get("VWINDOW_METER", 0);
-
+       vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
 
        decode_subtitles = defaults->get("DECODE_SUBTITLES", decode_subtitles);
        subtitle_number = defaults->get("SUBTITLE_NUMBER", subtitle_number);
        label_cells = defaults->get("LABEL_CELLS", label_cells);
        program_no = defaults->get("PROGRAM_NO", program_no);
 
-       vwindow_zoom = defaults->get("VWINDOW_ZOOM", (float)1);
        boundaries();
 
        return 0;
@@ -372,6 +373,7 @@ int EDLSession::save_defaults(BC_Hash *defaults)
        defaults->update("ATRACKS", audio_tracks);
        defaults->update("AUTOS_FOLLOW_EDITS", autos_follow_edits);
        defaults->update("BRENDER_START", brender_start);
+       defaults->update("BRENDER_END", brender_end);
        BC_CModels::to_text(string, color_model);
        defaults->update("COLOR_MODEL", string);
        ilacemode_to_xmltext(string, interlace_mode);
@@ -385,7 +387,7 @@ int EDLSession::save_defaults(BC_Hash *defaults)
        defaults->update("RULER_X2", ruler_x2);
        defaults->update("RULER_Y1", ruler_y1);
        defaults->update("RULER_Y2", ruler_y2);
-       defaults->update("CURRENT_FOLDER", current_folder);
+       defaults->update("AWINDOW_FOLDER", awindow_folder);
        defaults->update("CURSOR_ON_FRAMES", cursor_on_frames);
        defaults->update("TYPELESS_KEYFRAMES", typeless_keyframes);
        defaults->update("CWINDOW_DEST", cwindow_dest);
@@ -516,8 +518,10 @@ void EDLSession::boundaries()
        Workarounds::clamp(ruler_y1, 0.0, output_h);
        Workarounds::clamp(ruler_y2, 0.0, output_h);
        if(brender_start < 0) brender_start = 0.0;
+       if(brender_end < 0) brender_end = 0.0;
 
        Workarounds::clamp(subtitle_number, 0, 31);
+       Workarounds::clamp(awindow_folder, 0, AWINDOW_FOLDERS - 1);
 
 // Correct framerates
        frame_rate = Units::fix_framerate(frame_rate);
@@ -535,7 +539,7 @@ int EDLSession::load_video_config(FileXML *file, int append_mode, uint32_t load_
        BC_CModels::to_text(string, color_model);
        color_model = BC_CModels::from_text(file->tag.get_property("COLORMODEL", string));
        const char *ilace_mode = file->tag.get_property("INTERLACE_MODE");
-       interlace_mode = ilacemode_from_xmltext(ilace_mode, BC_ILACE_MODE_NOTINTERLACED);
+       interlace_mode = ilacemode_from_xmltext(ilace_mode, ILACE_MODE_NOTINTERLACED);
        video_channels = file->tag.get_property("CHANNELS", video_channels);
        for(int i = 0; i < video_channels; i++)
        {
@@ -594,6 +598,7 @@ int EDLSession::load_xml(FileXML *file,
                auto_keyframes = file->tag.get_property("AUTO_KEYFRAMES", auto_keyframes);
                autos_follow_edits = file->tag.get_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
                brender_start = file->tag.get_property("BRENDER_START", brender_start);
+               brender_end = file->tag.get_property("BRENDER_END", brender_end);
                eyedrop_radius = file->tag.get_property("EYEDROP_RADIUS", eyedrop_radius);
                crop_x1 = file->tag.get_property("CROP_X1", crop_x1);
                crop_y1 = file->tag.get_property("CROP_Y1", crop_y1);
@@ -603,7 +608,13 @@ int EDLSession::load_xml(FileXML *file,
                ruler_y1 = file->tag.get_property("RULER_Y1", ruler_y1);
                ruler_x2 = file->tag.get_property("RULER_X2", ruler_x2);
                ruler_y2 = file->tag.get_property("RULER_Y2", ruler_y2);
-               file->tag.get_property("CURRENT_FOLDER", current_folder);
+               string[0] = 0;
+               file->tag.get_property("CURRENT_FOLDER", string);
+               if( string[0] ) {
+                       awindow_folder = AWindowGUI::folder_number(string);
+                       if( awindow_folder < 0 ) awindow_folder = AW_MEDIA_FOLDER;
+               }
+               file->tag.get_property("AWINDOW_FOLDER", awindow_folder);
                cursor_on_frames = file->tag.get_property("CURSOR_ON_FRAMES", cursor_on_frames);
                typeless_keyframes = file->tag.get_property("TYPELESS_KEYFRAMES", typeless_keyframes);
                cwindow_dest = file->tag.get_property("CWINDOW_DEST", cwindow_dest);
@@ -640,6 +651,7 @@ int EDLSession::load_xml(FileXML *file,
                subtitle_number = file->tag.get_property("SUBTITLE_NUMBER", subtitle_number);
                label_cells = file->tag.get_property("LABEL_CELLS", label_cells);
                program_no = file->tag.get_property("PROGRAM_NO", program_no);
+
                boundaries();
        }
 
@@ -660,6 +672,7 @@ int EDLSession::save_xml(FileXML *file)
        file->tag.set_property("AUTO_KEYFRAMES", auto_keyframes);
        file->tag.set_property("AUTOS_FOLLOW_EDITS", autos_follow_edits);
        file->tag.set_property("BRENDER_START", brender_start);
+       file->tag.set_property("BRENDER_END", brender_end);
        file->tag.set_property("EYEDROP_RADIUS", eyedrop_radius);
        file->tag.set_property("CROP_X1", crop_x1);
        file->tag.set_property("CROP_Y1", crop_y1);
@@ -669,7 +682,7 @@ int EDLSession::save_xml(FileXML *file)
        file->tag.set_property("RULER_Y1", ruler_y1);
        file->tag.set_property("RULER_X2", ruler_x2);
        file->tag.set_property("RULER_Y2", ruler_y2);
-       file->tag.set_property("CURRENT_FOLDER", current_folder);
+       file->tag.set_property("AWINDOW_FOLDER", awindow_folder);
        file->tag.set_property("CURSOR_ON_FRAMES", cursor_on_frames);
        file->tag.set_property("TYPELESS_KEYFRAMES", typeless_keyframes);
        file->tag.set_property("CWINDOW_DEST", cwindow_dest);
@@ -789,6 +802,7 @@ int EDLSession::copy(EDLSession *session)
        audio_tracks = session->audio_tracks;
        autos_follow_edits = session->autos_follow_edits;
        brender_start = session->brender_start;
+       brender_end = session->brender_end;
        color_model = session->color_model;
        interlace_mode = session->interlace_mode;
        eyedrop_radius = session->eyedrop_radius;
@@ -800,7 +814,7 @@ int EDLSession::copy(EDLSession *session)
        ruler_y1 = session->ruler_y1;
        ruler_x2 = session->ruler_x2;
        ruler_y2 = session->ruler_y2;
-       strcpy(current_folder, session->current_folder);
+       awindow_folder = session->awindow_folder;
        cursor_on_frames = session->cursor_on_frames;
        typeless_keyframes = session->typeless_keyframes;
        cwindow_dest = session->cwindow_dest;