From ea0f83a2b769f440ac637ceee4fca5ea85340cdf Mon Sep 17 00:00:00 2001 From: Good Guy Date: Mon, 21 Mar 2016 15:13:00 -0600 Subject: [PATCH] merge: fixes to speed autos, draw float autos, edit params, render format tool --- cinelerra-5.1/cinelerra/automation.C | 1 + cinelerra-5.1/cinelerra/keyframepopup.C | 20 ++++++++++++--- cinelerra-5.1/cinelerra/keyframepopup.h | 1 + cinelerra-5.1/cinelerra/render.C | 13 +++++++--- cinelerra-5.1/cinelerra/render.h | 1 + cinelerra-5.1/cinelerra/trackcanvas.C | 34 +++++++++++-------------- 6 files changed, 43 insertions(+), 27 deletions(-) diff --git a/cinelerra-5.1/cinelerra/automation.C b/cinelerra-5.1/cinelerra/automation.C index b7c04bdf..fd2de322 100644 --- a/cinelerra-5.1/cinelerra/automation.C +++ b/cinelerra-5.1/cinelerra/automation.C @@ -76,6 +76,7 @@ int Automation::autogrouptype(int autoidx, Track *track) break; case AUTOMATION_CAMERA_Z: case AUTOMATION_PROJECTOR_Z: + case AUTOMATION_SPEED: autogrouptype = AUTOGROUPTYPE_ZOOM; break; case AUTOMATION_FADE: diff --git a/cinelerra-5.1/cinelerra/keyframepopup.C b/cinelerra-5.1/cinelerra/keyframepopup.C index 303f599e..d8528ae2 100644 --- a/cinelerra-5.1/cinelerra/keyframepopup.C +++ b/cinelerra-5.1/cinelerra/keyframepopup.C @@ -54,6 +54,7 @@ KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui) key_free = 0; key_mbar = 0; key_mode_displayed = false; + key_edit_displayed = false; } KeyframePopup::~KeyframePopup() @@ -65,6 +66,9 @@ KeyframePopup::~KeyframePopup() delete key_free_t; delete key_free; } + if( !key_edit_displayed ) { + delete key_edit; + } } void KeyframePopup::create_objects() @@ -72,8 +76,8 @@ void KeyframePopup::create_objects() add_item(key_show = new KeyframePopupShow(mwindow, this)); add_item(key_delete = new KeyframePopupDelete(mwindow, this)); add_item(key_copy = new KeyframePopupCopy(mwindow, this)); - add_item(key_edit = new KeyframePopupEdit(mwindow, this)); + key_edit = new KeyframePopupEdit(mwindow, this); key_mbar = new BC_MenuItem("-"); key_smooth = new KeyframePopupCurveMode(mwindow, this, FloatAuto::SMOOTH); key_linear = new KeyframePopupCurveMode(mwindow, this, FloatAuto::LINEAR); @@ -119,6 +123,15 @@ void KeyframePopup::handle_curve_mode(Autos *autos, Auto *auto_keyframe) // determines the type of automation node. if floatauto, adds // menu entries showing the curve mode of the node { + if( !key_edit_displayed && keyframe_plugin ) { + add_item(key_edit); + key_edit_displayed = true; + } + else if( key_edit_displayed && !keyframe_plugin ) { + remove_item(key_mbar); + key_edit_displayed = false; + } + if(!key_mode_displayed && autos && autos->get_type() == AUTOMATION_TYPE_FLOAT) { // append additional menu entries showing the curve_mode add_item(key_mbar); @@ -190,9 +203,8 @@ int KeyframePopupShow::handle_event() { mwindow->update_plugin_guis(); mwindow->show_plugin(popup->keyframe_plugin); - } else - if (popup->keyframe_automation) - { + } + else if( popup->keyframe_automation ) { /* mwindow->cwindow->gui->lock_window(); diff --git a/cinelerra-5.1/cinelerra/keyframepopup.h b/cinelerra-5.1/cinelerra/keyframepopup.h index d774686b..c512d0e0 100644 --- a/cinelerra-5.1/cinelerra/keyframepopup.h +++ b/cinelerra-5.1/cinelerra/keyframepopup.h @@ -68,6 +68,7 @@ private: KeyframePopupCurveMode *key_linear; KeyframePopupCurveMode *key_free_t; KeyframePopupCurveMode *key_free; + bool key_edit_displayed; bool key_mode_displayed; void handle_curve_mode(Autos *autos, Auto *auto_keyframe); diff --git a/cinelerra-5.1/cinelerra/render.C b/cinelerra-5.1/cinelerra/render.C index ded88a3f..a1160a64 100644 --- a/cinelerra-5.1/cinelerra/render.C +++ b/cinelerra-5.1/cinelerra/render.C @@ -350,6 +350,15 @@ BC_Window* Render::new_gui() return render_window; } +void Render::handle_done_event(int result) +{ + if(!result) { + // add to recentlist only on OK + render_window->format_tools->path_recent-> + add_item(File::formattostr(asset->format), asset->path); + } + render_window = 0; +} void Render::handle_close_event(int result) { @@ -357,9 +366,6 @@ void Render::handle_close_event(int result) const int debug = 0; if(!result) { - // add to recentlist only on OK - render_window->format_tools->path_recent-> - add_item(File::formattostr(asset->format), asset->path); // Check the asset format for errors. FormatCheck format_check(asset); format_error = format_check.check_format(); @@ -379,7 +385,6 @@ void Render::handle_close_event(int result) if(debug) printf("Render::handle_close_event %d\n", __LINE__); } //PRINT_TRACE - render_window = 0; } diff --git a/cinelerra-5.1/cinelerra/render.h b/cinelerra-5.1/cinelerra/render.h index 638aaabb..357af62f 100644 --- a/cinelerra-5.1/cinelerra/render.h +++ b/cinelerra-5.1/cinelerra/render.h @@ -118,6 +118,7 @@ public: void stop_operation(); BC_Window* new_gui(); + void handle_done_event(int result); void handle_close_event(int result); void start_render(); diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 3a5bdade..28f149f3 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -2842,7 +2842,6 @@ int TrackCanvas::do_float_autos(Track *track, Autos *autos, int cursor_x, int cu double view_start, unit_start; double view_end, unit_end, yscale; double zoom_sample, zoom_units; - double ax, ay, ax2, ay2, ax0, ay0; double in_x2, in_y2, out_x2, out_y2; double slope; //int skip = 0; @@ -2857,25 +2856,24 @@ int TrackCanvas::do_float_autos(Track *track, Autos *autos, int cursor_x, int cu // Get first auto before start Auto *current = 0, *previous = 0; - ax0 = ay0 = -1; for( current = autos->last; current && current->position >= unit_start; current = PREVIOUS ) ; - if( !current ) { - current = autos->first ? autos->first : autos->default_auto; - ax0 = 0; - } - if( current ) { + Auto *first_auto = current ? current : + autos->first ? autos->first : autos->default_auto; + + double ax = 0, ay = 0, ax2 = 0, ay2 = 0; + if( first_auto ) calculate_auto_position(&ax, &ay, 0, 0, 0, 0, - current, unit_start, zoom_units, yscale, autogrouptype); - if( ax0 < 0 ) current = NEXT; - } - else - ay0 = 0; + first_auto, unit_start, zoom_units, yscale, autogrouptype); - if( ax0 >= 0 ) ax = ax0; - if( ay0 >= 0 ) ay = ay0; + if( current ) + current = NEXT; + else { + current = autos->first; + ax = 0; + } do { //skip = 0; @@ -2891,17 +2889,15 @@ int TrackCanvas::do_float_autos(Track *track, Autos *autos, int cursor_x, int cu //skip = 1; } - slope = (ay2 - ay) / (ax2 - ax); + slope = ax2 > ax ? (ay2 - ay) / (ax2 - ax) : 0; - if(ax2 > get_w()) - { + if(ax2 > get_w()) { draw_auto = 0; ax2 = get_w(); ay2 = ay + slope * (get_w() - ax); } - if(ax < 0) - { + if(ax < 0) { ay = ay + slope * (0 - ax); ax = 0; } -- 2.26.2