From 2ba7e9962ea989863e152373e96a09b00a0b4eb8 Mon Sep 17 00:00:00 2001 From: Good Guy Date: Tue, 20 Sep 2016 12:17:47 -0600 Subject: [PATCH] color coded keyframe curves, keyframe popups, cwin scrollbar fixes --- cinelerra-5.1/cinelerra/Makefile | 2 +- cinelerra-5.1/cinelerra/apatchgui.C | 108 ++++--- cinelerra-5.1/cinelerra/apatchgui.h | 38 ++- cinelerra-5.1/cinelerra/apatchgui.inc | 7 + cinelerra-5.1/cinelerra/autos.C | 18 +- cinelerra-5.1/cinelerra/autos.h | 14 - cinelerra-5.1/cinelerra/awindowgui.C | 14 +- cinelerra-5.1/cinelerra/canvas.C | 86 ++---- cinelerra-5.1/cinelerra/edl.C | 46 +-- cinelerra-5.1/cinelerra/edl.inc | 14 +- cinelerra-5.1/cinelerra/gwindowgui.C | 135 +++++---- cinelerra-5.1/cinelerra/gwindowgui.h | 5 + cinelerra-5.1/cinelerra/keyframepopup.C | 352 +++++++++++++++------- cinelerra-5.1/cinelerra/keyframepopup.h | 49 +++ cinelerra-5.1/cinelerra/keyframepopup.inc | 9 +- cinelerra-5.1/cinelerra/localsession.C | 8 +- cinelerra-5.1/cinelerra/mainmenu.C | 9 +- cinelerra-5.1/cinelerra/mwindow.C | 61 +++- cinelerra-5.1/cinelerra/mwindow.h | 7 + cinelerra-5.1/cinelerra/mwindowgui.C | 24 +- cinelerra-5.1/cinelerra/mwindowgui.h | 3 +- cinelerra-5.1/cinelerra/patchgui.C | 25 +- cinelerra-5.1/cinelerra/patchgui.h | 1 - cinelerra-5.1/cinelerra/trackcanvas.C | 27 +- cinelerra-5.1/cinelerra/trackcanvas.h | 3 +- cinelerra-5.1/cinelerra/vpatchgui.C | 130 +++++--- cinelerra-5.1/cinelerra/vpatchgui.h | 32 +- cinelerra-5.1/cinelerra/vpatchgui.inc | 9 +- 28 files changed, 752 insertions(+), 484 deletions(-) diff --git a/cinelerra-5.1/cinelerra/Makefile b/cinelerra-5.1/cinelerra/Makefile index c5c9ee7e..f2c3debd 100644 --- a/cinelerra-5.1/cinelerra/Makefile +++ b/cinelerra-5.1/cinelerra/Makefile @@ -409,7 +409,7 @@ $(OUTPUT): $(OBJS) $(DCRAW) $(FILEEXR) $(FILEFLAC) $(LIBRARIES) $(if $(findstring -ggdb,$(CFLAGS)),,strip $(OUTPUT)) ln -f -s ../bin/$(WANT_CIN) ci -$(CUTADS): $(CUTOBJS) $(CUTLIBS) +$(CUTADS): $(CUTOBJS) $(CUTLIBS) $(LIBRARIES) @echo g++ -o $@ $(CUTOBJS) @g++ $(CFLAGS) -pthread -o $@ $(CUTOBJS) $(CUTLIBS) $(LIBS) $(if $(findstring -g,$(CFLAGS)),objcopy --only-keep-debug $(CUTADS) $(CUTADS).debuginfo) diff --git a/cinelerra-5.1/cinelerra/apatchgui.C b/cinelerra-5.1/cinelerra/apatchgui.C index 64e851c9..8243fc25 100644 --- a/cinelerra-5.1/cinelerra/apatchgui.C +++ b/cinelerra-5.1/cinelerra/apatchgui.C @@ -20,7 +20,6 @@ */ #include "apatchgui.h" -#include "apatchgui.inc" #include "atrack.h" #include "autoconf.h" #include "automation.h" @@ -28,6 +27,9 @@ #include "edlsession.h" #include "floatauto.h" #include "floatautos.h" +#include "gwindowgui.h" +#include "intauto.h" +#include "intautos.h" #include "language.h" #include "localsession.h" #include "mainundo.h" @@ -223,14 +225,10 @@ void APatchGUI::synchronize_fade(float value_change) AFadePatch::AFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y, int w) - : BC_FSlider(x, - y, - 0, - w, - w, - mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE], - mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE], - get_keyframe(mwindow, patch)->get_value()) + : BC_FSlider(x, y, 0, w, w, + mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_AUDIO_FADE], + mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_AUDIO_FADE], + mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value()) { this->mwindow = mwindow; this->patch = patch; @@ -279,31 +277,53 @@ int AFadePatch::handle_event() return 1; } -FloatAuto* AFadePatch::get_keyframe(MWindow *mwindow, APatchGUI *patch) +AKeyFadePatch::AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y) + : BC_SubWindow(x,y, patch->patchbay->get_w(),20, + GWindowGUI::auto_colors[AUTOMATION_FADE]) { - Auto *current = 0; - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = patch->atrack->to_units(unit_position, 0); - - FloatAutos *ptr = (FloatAutos*)patch->atrack->automation->autos[AUTOMATION_FADE]; - return (FloatAuto*)ptr->get_prev_auto( - (long)unit_position, - PLAY_FORWARD, - current); + this->mwindow = mwindow; + this->patch = patch; +} + +void AKeyFadePatch::create_objects() +{ + akey_fade_value = new AKeyFadeValue(this); + add_subwindow(akey_fade_value); + akey_fade_value->activate(); + show_window(); +} + +AKeyFadeValue::AKeyFadeValue(AKeyFadePatch *akey_fade_patch) + : AFadePatch(akey_fade_patch->mwindow, akey_fade_patch->patch, + 0,0, akey_fade_patch->get_w()) +{ + this->akey_fade_patch = akey_fade_patch; +} + +int AKeyFadeValue::button_release_event() +{ + AFadePatch::button_release_event(); + return 0; +} + +int AKeyFadeValue::handle_event() +{ + APatchGUI *patch = akey_fade_patch->patch; + int ret = AFadePatch::handle_event(); + AFadePatch *fade = patch->fade; + if( fade ) + fade->update(get_value()); + return ret; } APanPatch::APanPatch(MWindow *mwindow, APatchGUI *patch, int x, int y) - : BC_Pan(x, - y, - PAN_RADIUS, - MAX_PAN, - mwindow->edl->session->audio_channels, - mwindow->edl->session->achannel_positions, - get_keyframe(mwindow, patch)->handle_x, - get_keyframe(mwindow, patch)->handle_y, - get_keyframe(mwindow, patch)->values) + : BC_Pan(x, y, PAN_RADIUS, MAX_PAN, + mwindow->edl->session->audio_channels, + mwindow->edl->session->achannel_positions, + mwindow->get_pan_auto(patch)->handle_x, + mwindow->get_pan_auto(patch)->handle_y, + mwindow->get_pan_auto(patch)->values) { this->mwindow = mwindow; this->patch = patch; @@ -336,21 +356,25 @@ int APanPatch::handle_event() return 1; } -PanAuto* APanPatch::get_keyframe(MWindow *mwindow, APatchGUI *patch) +AKeyPanPatch::AKeyPanPatch(MWindow *mwindow, APatchGUI *patch) + : APanPatch(mwindow, patch, -1,-1) { - Auto *current = 0; - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = patch->atrack->to_units(unit_position, 0); - - PanAutos *ptr = (PanAutos*)patch->atrack->automation->autos[AUTOMATION_PAN]; - return (PanAuto*)ptr->get_prev_auto( - (long)unit_position, - PLAY_FORWARD, - current); } +int AKeyPanPatch::button_release_event() +{ + APanPatch::button_release_event(); + return 0; +} +int AKeyPanPatch::handle_event() +{ + int ret = APanPatch::handle_event(); + APanPatch *pan = patch->pan; + if( pan ) + pan->update(get_stick_x(), get_stick_y()); + return ret; +} AMeterPatch::AMeterPatch(MWindow *mwindow, APatchGUI *patch, int x, int y) @@ -381,7 +405,3 @@ int AMeterPatch::button_press_event() return 0; } - - - - diff --git a/cinelerra-5.1/cinelerra/apatchgui.h b/cinelerra-5.1/cinelerra/apatchgui.h index abc7b259..b342fc6a 100644 --- a/cinelerra-5.1/cinelerra/apatchgui.h +++ b/cinelerra-5.1/cinelerra/apatchgui.h @@ -29,9 +29,6 @@ #include "panauto.inc" #include "patchgui.h" -class AFadePatch; -class APanPatch; -class AMeterPatch; class APatchGUI : public PatchGUI { @@ -55,22 +52,52 @@ class AFadePatch : public BC_FSlider public: AFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y, int w); static FloatAuto* get_keyframe(MWindow *mwindow, APatchGUI *patch); - int handle_event(); + virtual int handle_event(); float update_edl(); MWindow *mwindow; APatchGUI *patch; }; +class AKeyFadePatch : public BC_SubWindow +{ +public: + AKeyFadePatch(MWindow *mwindow, APatchGUI *patch, int x, int y); + void create_objects(); + + MWindow *mwindow; + APatchGUI *patch; + AKeyFadeValue *akey_fade_value; +}; + +class AKeyFadeValue : public AFadePatch +{ +public: + AKeyFadeValue(AKeyFadePatch *akey_fade_patch); + int button_release_event(); + int handle_event(); + + AKeyFadePatch *akey_fade_patch; +}; + + class APanPatch : public BC_Pan { public: APanPatch(MWindow *mwindow, APatchGUI *patch, int x, int y); static PanAuto* get_keyframe(MWindow *mwindow, APatchGUI *patch); - int handle_event(); + virtual int handle_event(); MWindow *mwindow; APatchGUI *patch; }; +class AKeyPanPatch : public APanPatch +{ +public: + AKeyPanPatch(MWindow *mwindow, APatchGUI *patch); + int button_release_event(); + int handle_event(); +}; + class AMeterPatch : public BC_Meter { public: @@ -80,5 +107,4 @@ public: APatchGUI *patch; }; - #endif diff --git a/cinelerra-5.1/cinelerra/apatchgui.inc b/cinelerra-5.1/cinelerra/apatchgui.inc index 9181ee7b..5f71e9b5 100644 --- a/cinelerra-5.1/cinelerra/apatchgui.inc +++ b/cinelerra-5.1/cinelerra/apatchgui.inc @@ -26,5 +26,12 @@ #define MAX_AUDIO_FADE 6 +class APatchGUI; +class AFadePatch; +class AKeyFadePatch; +class AKeyFadeValue; +class APanPatch; +class AKeyPanPatch; +class AMeterPatch; #endif diff --git a/cinelerra-5.1/cinelerra/autos.C b/cinelerra-5.1/cinelerra/autos.C index 36abbd7d..7ab31dd5 100644 --- a/cinelerra-5.1/cinelerra/autos.C +++ b/cinelerra-5.1/cinelerra/autos.C @@ -282,27 +282,17 @@ Auto* Autos::get_auto_at_position(double position) Auto* Autos::get_auto_for_editing(double position) { - if(position < 0) - { + if(position < 0) { position = edl->local_session->get_selectionstart(1); } Auto *result = 0; position = edl->align_to_frame(position, 0); - - - - //printf("Autos::get_auto_for_editing %p %p\n", first, default_auto); - if(edl->session->auto_keyframes) - { - result = insert_auto(track->to_units(position, 0)); - } - else - result = get_prev_auto(track->to_units(position, 0), - PLAY_FORWARD, - result); + result = edl->session->auto_keyframes ? + insert_auto(track->to_units(position, 0)) : + get_prev_auto(track->to_units(position, 0), PLAY_FORWARD, result); //printf("Autos::get_auto_for_editing %p %p %p\n", default_auto, first, result); return result; diff --git a/cinelerra-5.1/cinelerra/autos.h b/cinelerra-5.1/cinelerra/autos.h index 9bc648f4..5ce985af 100644 --- a/cinelerra-5.1/cinelerra/autos.h +++ b/cinelerra-5.1/cinelerra/autos.h @@ -191,20 +191,6 @@ public: // 0 if after all autos Auto* nearest_before(int64_t position); // return nearest auto before or 0 Auto* nearest_after(int64_t position); // return nearest auto after or 0 - - Auto *selected; - int skip_selected; // if selected was added - int64_t selected_position, selected_position_; // original position for moves - double selected_value, selected_value_; // original position for moves - float virtual_h; // height cursor moves to cover entire range when track height is less than this - int virtual_center; - int stack_number; - int stack_total; }; - - - - - #endif diff --git a/cinelerra-5.1/cinelerra/awindowgui.C b/cinelerra-5.1/cinelerra/awindowgui.C index ba047200..bee6da43 100644 --- a/cinelerra-5.1/cinelerra/awindowgui.C +++ b/cinelerra-5.1/cinelerra/awindowgui.C @@ -536,19 +536,19 @@ SET_TRACE SET_TRACE // Mandatory folders - folders.append(picon = new AssetPicon(mwindow, this, AEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(AEFFECT_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, VEFFECT_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(VEFFECT_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, ATRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(ATRANSITION_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, VTRANSITION_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(VTRANSITION_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, LABEL_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(LABEL_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, CLIP_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(CLIP_FOLDER))); picon->persistent = 1; - folders.append(picon = new AssetPicon(mwindow, this, MEDIA_FOLDER)); + folders.append(picon = new AssetPicon(mwindow, this, _(MEDIA_FOLDER))); picon->persistent = 1; create_label_folder(); diff --git a/cinelerra-5.1/cinelerra/canvas.C b/cinelerra-5.1/cinelerra/canvas.C index e749aa7a..b2bd838d 100644 --- a/cinelerra-5.1/cinelerra/canvas.C +++ b/cinelerra-5.1/cinelerra/canvas.C @@ -505,45 +505,23 @@ void Canvas::get_scrollbars(EDL *edl, } //printf("Canvas::get_scrollbars 1 %d %d\n", get_xscroll(), get_yscroll()); - if(use_scrollbars) - { + if( use_scrollbars ) { w_needed = edl->session->output_w; h_needed = edl->session->output_h; get_zooms(edl, 0, zoom_x, zoom_y, conformed_w, conformed_h); //printf("Canvas::get_scrollbars 2 %d %d\n", get_xscroll(), get_yscroll()); -// while(!done) -// { - w_visible = (int)(canvas_w / zoom_x); - h_visible = (int)(canvas_h / zoom_y); -// done = 1; - -// if(w_needed > w_visible) - if(1) - { - if(!need_xscroll) - { - need_xscroll = 1; - canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ); -// done = 0; - } - } - else - need_xscroll = 0; + w_visible = (int)(canvas_w / zoom_x); + h_visible = (int)(canvas_h / zoom_y); + if( w_needed > w_visible ) { + need_xscroll = 1; + canvas_h -= BC_ScrollBar::get_span(SCROLL_HORIZ); + } -// if(h_needed > h_visible) - if(1) - { - if(!need_yscroll) - { - need_yscroll = 1; - canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT); -// done = 0; - } - } - else - need_yscroll = 0; -// } + if( h_needed > h_visible ) { + need_yscroll = 1; + canvas_w -= BC_ScrollBar::get_span(SCROLL_VERT); + } //printf("Canvas::get_scrollbars %d %d %d %d %d %d\n", canvas_w, canvas_h, w_needed, h_needed, w_visible, h_visible); //printf("Canvas::get_scrollbars 3 %d %d\n", get_xscroll(), get_yscroll()); @@ -551,47 +529,41 @@ void Canvas::get_scrollbars(EDL *edl, h_visible = (int)(canvas_h / zoom_y); } - if(need_xscroll) - { - if(!xscroll) - { - subwindow->add_subwindow(xscroll = - new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h, - w_needed, get_xscroll(), w_visible, canvas_w)); + if( need_xscroll ) { + if( !xscroll ) { + xscroll = new CanvasXScroll(edl, this, canvas_x, canvas_y + canvas_h, + w_needed, get_xscroll(), w_visible, canvas_w); + subwindow->add_subwindow(xscroll); xscroll->show_window(0); } else xscroll->reposition_window(canvas_x, canvas_y + canvas_h, canvas_w); - if(xscroll->get_length() != w_needed || - xscroll->get_handlelength() != w_visible) + if( xscroll->get_length() != w_needed || + xscroll->get_handlelength() != w_visible ) xscroll->update_length(w_needed, get_xscroll(), w_visible, 0); } - else - { - if( xscroll ) { delete xscroll; xscroll = 0; } + else if( xscroll ) { + delete xscroll; xscroll = 0; } //printf("Canvas::get_scrollbars 4 %d %d\n", get_xscroll(), get_yscroll()); - if(need_yscroll) - { - if(!yscroll) - { - subwindow->add_subwindow(yscroll = - new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y, - h_needed, get_yscroll(), h_visible, canvas_h)); + if( need_yscroll ) { + if( !yscroll ) { + yscroll = new CanvasYScroll(edl, this, canvas_x + canvas_w, canvas_y, + h_needed, get_yscroll(), h_visible, canvas_h); + subwindow->add_subwindow(yscroll); yscroll->show_window(0); } else yscroll->reposition_window(canvas_x + canvas_w, canvas_y, canvas_h); - if(yscroll->get_length() != edl->session->output_h || - yscroll->get_handlelength() != h_visible) + if( yscroll->get_length() != edl->session->output_h || + yscroll->get_handlelength() != h_visible ) yscroll->update_length(h_needed, get_yscroll(), h_visible, 0); } - else - { - if( yscroll ) { delete yscroll; yscroll = 0; } + else if( yscroll ) { + delete yscroll; yscroll = 0; } //printf("Canvas::get_scrollbars 5 %d %d\n", get_xscroll(), get_yscroll()); } diff --git a/cinelerra-5.1/cinelerra/edl.C b/cinelerra-5.1/cinelerra/edl.C index e5047404..591db252 100644 --- a/cinelerra-5.1/cinelerra/edl.C +++ b/cinelerra-5.1/cinelerra/edl.C @@ -1286,48 +1286,12 @@ void EDL::get_shared_tracks(Track *track, // Convert position to frames if cursor alignment is enabled double EDL::align_to_frame(double position, int round) { -//printf("EDL::align_to_frame 1 %f\n", position); - if(session->cursor_on_frames) - { -// Seconds -> Frames - double temp = (double)position * session->frame_rate; -//printf("EDL::align_to_frame 2 %f\n", temp); - -// Assert some things - if(session->sample_rate == 0) - printf("EDL::align_to_frame: sample_rate == 0\n"); - - if(session->frame_rate == 0) - printf("EDL::align_to_frame: frame_rate == 0\n"); - -// Round frames -// Always round down negative numbers -// but round up only if requested - if(round) - { - temp = Units::round(temp); - } - else - { -// if(temp < 0) -// { -// temp -= 0.5; -// } -// else - temp = Units::to_int64(temp); - } -//printf("EDL::align_to_frame 3 %f\n", temp); - -// Frames -> Seconds - temp /= session->frame_rate; - -//printf("EDL::align_to_frame 5 %f\n", temp); - - return temp; + if( session->cursor_on_frames && session->frame_rate > 0 ) { + double frame_no = position * session->frame_rate; + int64_t frame_pos = frame_no + (round ? 0.5 : 1e-6); + double pos = frame_pos / session->frame_rate; + if( !EQUIV(pos, position) ) position = pos; } -//printf("EDL::align_to_frame 3 %d\n", position); - - return position; } diff --git a/cinelerra-5.1/cinelerra/edl.inc b/cinelerra-5.1/cinelerra/edl.inc index 96dff63c..96ab0e42 100644 --- a/cinelerra-5.1/cinelerra/edl.inc +++ b/cinelerra-5.1/cinelerra/edl.inc @@ -55,16 +55,16 @@ class EDL; // Mandatory folders -#define AEFFECT_FOLDER "Audio Effects" -#define VEFFECT_FOLDER "Video Effects" -#define ATRANSITION_FOLDER "Audio Transitions" -#define VTRANSITION_FOLDER "Video Transitions" +#define AEFFECT_FOLDER N_("Audio Effects") +#define VEFFECT_FOLDER N_("Video Effects") +#define ATRANSITION_FOLDER N_("Audio Transitions") +#define VTRANSITION_FOLDER N_("Video Transitions") -#define LABEL_FOLDER "Labels" +#define LABEL_FOLDER N_("Labels") // Default folders -#define CLIP_FOLDER "Clips" -#define MEDIA_FOLDER "Media" +#define CLIP_FOLDER N_("Clips") +#define MEDIA_FOLDER N_("Media") diff --git a/cinelerra-5.1/cinelerra/gwindowgui.C b/cinelerra-5.1/cinelerra/gwindowgui.C index 1e51d17c..4589fb1e 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.C +++ b/cinelerra-5.1/cinelerra/gwindowgui.C @@ -30,6 +30,7 @@ #include "mainsession.h" #include "mwindow.h" #include "mwindowgui.h" +#include "theme.h" #include "trackcanvas.h" @@ -38,13 +39,13 @@ GWindowGUI::GWindowGUI(MWindow *mwindow, int w, int h) : BC_Window(_(PROGRAM_NAME ": Overlays"), - mwindow->session->gwindow_x, mwindow->session->gwindow_y, + mwindow->session->gwindow_x, mwindow->session->gwindow_y, w, h, w, h, 0, 0, 1) { this->mwindow = mwindow; } -static const char *other_text[NON_AUTOMATION_TOTAL] = +const char *GWindowGUI::other_text[NON_AUTOMATION_TOTAL] = { "Assets", "Titles", @@ -52,7 +53,7 @@ static const char *other_text[NON_AUTOMATION_TOTAL] = "Plugin Autos" }; -static const char *auto_text[AUTOMATION_TOTAL] = +const char *GWindowGUI::auto_text[AUTOMATION_TOTAL] = { "Mute", "Camera X", @@ -68,18 +69,32 @@ static const char *auto_text[AUTOMATION_TOTAL] = "Speed" }; +int GWindowGUI::auto_colors[AUTOMATION_TOTAL] = +{ + PINK, + RED, + GREEN, + BLUE, + LTPINK, + LTGREEN, + LTBLUE, + LTPURPLE, + 0, + 0, + 0, + ORANGE, +}; + static toggleinfo toggle_order[] = { {0, NON_AUTOMATION_ASSETS}, {0, NON_AUTOMATION_TITLES}, {0, NON_AUTOMATION_TRANSITIONS}, + {0, NON_AUTOMATION_PLUGIN_AUTOS}, + {0, -1}, // bar {1, AUTOMATION_FADE}, {1, AUTOMATION_MUTE}, - {1, AUTOMATION_MODE}, - {1, AUTOMATION_PAN}, - {0, NON_AUTOMATION_PLUGIN_AUTOS}, - {1, AUTOMATION_MASK}, {1, AUTOMATION_SPEED}, {1, AUTOMATION_CAMERA_X}, {1, AUTOMATION_CAMERA_Y}, @@ -87,6 +102,9 @@ static toggleinfo toggle_order[] = {1, AUTOMATION_PROJECTOR_X}, {1, AUTOMATION_PROJECTOR_Y}, {1, AUTOMATION_PROJECTOR_Z}, + {1, AUTOMATION_MODE}, + {1, AUTOMATION_PAN}, + {1, AUTOMATION_MASK}, }; void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) @@ -96,15 +114,19 @@ void GWindowGUI::calculate_extents(BC_WindowBase *gui, int *w, int *h) *w = 10; *h = 10; - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + toggleinfo *tp = &toggle_order[i]; + int isauto = tp->isauto, ref = tp->ref; + if( ref < 0 ) { + *h += get_resources()->bar_data->get_h() + 5; + continue; + } BC_Toggle::calculate_extents(gui, BC_WindowBase::get_resources()->checkbox_images, 0, &temp1, ¤t_w, ¤t_h, &temp2, &temp3, &temp4, &temp5, &temp6, &temp7, - _(toggle_order[i].isauto ? - auto_text[toggle_order[i].ref] : - other_text[toggle_order[i].ref]), MEDIUMFONT); + _(isauto ? auto_text[ref] : other_text[ref]), + MEDIUMFONT); *w = MAX(current_w, *w); *h += current_h + 5; } @@ -120,14 +142,26 @@ void GWindowGUI::create_objects() int x = 10, y = 10; lock_window("GWindowGUI::create_objects 1"); - - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { - add_tool(toggles[i] = new GWindowToggle(mwindow, - this, - x, - y, - toggle_order[i])); + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + toggleinfo *tp = &toggle_order[i]; + int ref = tp->ref; + if( ref < 0 ) { + BC_Bar *bar = new BC_Bar(x,y,get_w()-x-10); + add_tool(bar); + toggles[i] = 0; + y += bar->get_h() + 5; + continue; + } + toggles[i] = new GWindowToggle(mwindow, this, x, y, *tp); + add_tool(toggles[i]); + VFrame *vframe = 0; + switch( ref ) { + case AUTOMATION_MODE: vframe = mwindow->theme->modekeyframe_data; break; + case AUTOMATION_PAN: vframe = mwindow->theme->pankeyframe_data; break; + case AUTOMATION_MASK: vframe = mwindow->theme->maskkeyframe_data; break; + } + if( vframe ) + draw_vframe(vframe, get_w()-vframe->get_w()-10, y); y += toggles[i]->get_h() + 5; } unlock_window(); @@ -144,9 +178,8 @@ void GWindowGUI::update_toggles(int use_lock) { if(use_lock) lock_window("GWindowGUI::update_toggles"); - for(int i = 0; i < NON_AUTOMATION_TOTAL + AUTOMATION_TOTAL; i++) - { - toggles[i]->update(); + for( int i=0; i<(int)(sizeof(toggle_order)/sizeof(toggle_order[0])); ++i ) { + if( toggles[i] ) toggles[i]->update(); } if(use_lock) unlock_window(); @@ -176,29 +209,28 @@ int GWindowGUI::close_event() int GWindowGUI::keypress_event() { - switch(get_keypress()) - { - case 'w': - case 'W': - if(ctrl_down()) - { - close_event(); - return 1; - } - break; + switch(get_keypress()) { + case 'w': + case 'W': + case '0': + if( ctrl_down() ) { + close_event(); + return 1; + } + break; } return 0; } - - - - GWindowToggle::GWindowToggle(MWindow *mwindow, GWindowGUI *gui, int x, int y, toggleinfo toggleinf) : BC_CheckBox(x, y, *get_main_value(mwindow, toggleinf), - _((toggleinf.isauto ? auto_text[toggleinf.ref] : other_text[toggleinf.ref]))) + _((toggleinf.isauto ? + GWindowGUI::auto_text[toggleinf.ref] : + GWindowGUI::other_text[toggleinf.ref])), + MEDIUMFONT, + !toggleinf.isauto ? -1 : GWindowGUI::auto_colors[toggleinf.ref]) { this->mwindow = mwindow; this->gui = gui; @@ -242,30 +274,23 @@ int GWindowToggle::handle_event() int* GWindowToggle::get_main_value(MWindow *mwindow, toggleinfo toggleinf) { - if(toggleinf.isauto) - { + if( toggleinf.isauto ) return &mwindow->edl->session->auto_conf->autos[toggleinf.ref]; - } - else - { - switch(toggleinf.ref) - { - case NON_AUTOMATION_ASSETS: - return &mwindow->edl->session->show_assets; - case NON_AUTOMATION_TITLES: - return &mwindow->edl->session->show_titles; - case NON_AUTOMATION_TRANSITIONS: - return &mwindow->edl->session->auto_conf->transitions; - case NON_AUTOMATION_PLUGIN_AUTOS: - return &mwindow->edl->session->auto_conf->plugins; - } + + switch(toggleinf.ref) { + case NON_AUTOMATION_ASSETS: return &mwindow->edl->session->show_assets; + case NON_AUTOMATION_TITLES: return &mwindow->edl->session->show_titles; + case NON_AUTOMATION_TRANSITIONS: return &mwindow->edl->session->auto_conf->transitions; + case NON_AUTOMATION_PLUGIN_AUTOS: return &mwindow->edl->session->auto_conf->plugins; } return 0; } void GWindowToggle::update() { - set_value(*get_main_value(mwindow, toggleinf)); + int *vp = get_main_value(mwindow, toggleinf); + if( !vp ) return; + set_value(*vp); } diff --git a/cinelerra-5.1/cinelerra/gwindowgui.h b/cinelerra-5.1/cinelerra/gwindowgui.h index 90357df1..86045eb9 100644 --- a/cinelerra-5.1/cinelerra/gwindowgui.h +++ b/cinelerra-5.1/cinelerra/gwindowgui.h @@ -33,6 +33,7 @@ enum { NONAUTOTOGGLES_TITLES, NONAUTOTOGGLES_TRANSITIONS, NONAUTOTOGGLES_PLUGIN_AUTOS, + NONAUTOTOGGLES_BAR, NONAUTOTOGGLES_COUNT }; @@ -54,6 +55,10 @@ public: void update_toggles(int use_lock); void update_mwindow(); + static const char *other_text[]; + static const char *auto_text[]; + static int auto_colors[]; + MWindow *mwindow; GWindowToggle *toggles[NONAUTOTOGGLES_COUNT + AUTOMATION_TOTAL]; }; diff --git a/cinelerra-5.1/cinelerra/keyframepopup.C b/cinelerra-5.1/cinelerra/keyframepopup.C index 053dd656..293e1852 100644 --- a/cinelerra-5.1/cinelerra/keyframepopup.C +++ b/cinelerra-5.1/cinelerra/keyframepopup.C @@ -20,6 +20,7 @@ */ #include "apatchgui.h" +#include "atrack.h" #include "autoconf.h" #include "autos.h" #include "bcwindowbase.h" @@ -29,8 +30,10 @@ #include "edl.h" #include "edlsession.h" #include "filexml.h" +#include "floatauto.h" #include "gwindow.h" #include "gwindowgui.h" +#include "intauto.h" #include "keyframe.h" #include "keyframepopup.h" #include "language.h" @@ -42,8 +45,9 @@ #include "mwindow.h" #include "patchbay.h" #include "patchgui.h" +#include "timelinepane.h" #include "track.h" -#include "vpatchgui.h" +#include "vtrack.h" KeyframePopup::KeyframePopup(MWindow *mwindow, MWindowGUI *gui) : BC_PopupMenu(0, 0, 0, "", 0) @@ -78,8 +82,8 @@ KeyframePopup::~KeyframePopup() void KeyframePopup::create_objects() { - add_item(key_hide = new KeyframePopupHide(mwindow, this)); add_item(key_show = new KeyframePopupShow(mwindow, this)); + add_item(key_hide = new KeyframePopupHide(mwindow, this)); add_item(key_delete = new KeyframePopupDelete(mwindow, this)); add_item(key_copy = new KeyframePopupCopy(mwindow, this)); @@ -93,6 +97,7 @@ void KeyframePopup::create_objects() int KeyframePopup::update(Plugin *plugin, KeyFrame *keyframe) { + key_show->set_text(_("Show Plugin Settings")); this->keyframe_plugin = plugin; this->keyframe_auto = keyframe; this->keyframe_autos = 0; @@ -103,6 +108,7 @@ int KeyframePopup::update(Plugin *plugin, KeyFrame *keyframe) int KeyframePopup::update(Automation *automation, Autos *autos, Auto *auto_keyframe) { + key_show->set_text(_(GWindowGUI::auto_text[autos->autoidx])); this->keyframe_plugin = 0; this->keyframe_automation = automation; this->keyframe_autos = autos; @@ -186,7 +192,7 @@ int KeyframePopupDelete::handle_event() mwindow->save_backup(); mwindow->gui->update(0, 1, // 1 for incremental drawing. 2 for full refresh - 0, 0, 0, 0, 0); + 0, 0, 0, 0, 0); mwindow->update_plugin_guis(); mwindow->restart_brender(); mwindow->sync_parameters(CHANGE_EDL); @@ -223,107 +229,120 @@ KeyframePopupShow::~KeyframePopupShow() { } +PatchGUI *KeyframePopupShow::get_patchgui(Track *track) +{ + PatchGUI *patchgui = 0; + TimelinePane **panes = mwindow->gui->pane; + for( int i=0; ipatchbay; + if( !patchbay ) continue; + for( int j=0; jpatches.total && !patchgui; ++j ) { + if( patchbay->patches.values[j]->track == track ) + patchgui = patchbay->patches.values[j]; + } + } + return patchgui; +} + int KeyframePopupShow::handle_event() { - if (popup->keyframe_plugin) - { + MWindowGUI *mgui = mwindow->gui; + CWindowGUI *cgui = mwindow->cwindow->gui; + int cx = mgui->get_relative_cursor_x()+15, cy = mgui->get_relative_cursor_y()-15; + delete mgui->keyvalue_popup; + mgui->keyvalue_popup = 0; + + if( popup->keyframe_plugin ) { mwindow->update_plugin_guis(); mwindow->show_plugin(popup->keyframe_plugin); } else if( popup->keyframe_automation ) { -/* - - mwindow->cwindow->gui->lock_window(); + cgui->lock_window(); int show_window = 1; - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->projector_autos || - popup->keyframe_autos == (Autos *)popup->keyframe_automation->pzoom_autos) - - { - mwindow->cwindow->gui->set_operation(CWINDOW_PROJECTOR); - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->camera_autos || - popup->keyframe_autos == (Autos *)popup->keyframe_automation->czoom_autos) - - { - mwindow->cwindow->gui->set_operation(CWINDOW_CAMERA); - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mode_autos) - - { - // no window to be shown - show_window = 0; - // first find the appropriate patchgui - PatchBay *patchbay = mwindow->gui->patchbay; - PatchGUI *patchgui = 0; - for (int i = 0; i < patchbay->patches.total; i++) - if (patchbay->patches.values[i]->track == popup->keyframe_automation->track) - patchgui = patchbay->patches.values[i]; - if (patchgui != 0) - { -// FIXME: repositioning of the listbox needs support in guicast -// int cursor_x = popup->get_relative_cursor_x(); -// int cursor_y = popup->get_relative_cursor_y(); -// vpatchgui->mode->reposition_window(cursor_x, cursor_y); - - -// Open the popup menu - VPatchGUI *vpatchgui = (VPatchGUI *)patchgui; - vpatchgui->mode->activate_menu(); - } - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mask_autos) - - { - mwindow->cwindow->gui->set_operation(CWINDOW_MASK); - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pan_autos) - - { - // no window to be shown + + switch( popup->keyframe_autos->autoidx ) { + case AUTOMATION_CAMERA_X: + case AUTOMATION_CAMERA_Y: + case AUTOMATION_CAMERA_Z: { + cgui->set_operation(CWINDOW_CAMERA); + break; } + + case AUTOMATION_PROJECTOR_X: + case AUTOMATION_PROJECTOR_Y: + case AUTOMATION_PROJECTOR_Z: { + cgui->set_operation(CWINDOW_PROJECTOR); + break; } + + case AUTOMATION_MASK: { + cgui->set_operation(CWINDOW_MASK); + break; } + + default: { show_window = 0; - // first find the appropriate patchgui - PatchBay *patchbay = mwindow->gui->patchbay; - PatchGUI *patchgui = 0; - for (int i = 0; i < patchbay->patches.total; i++) - if (patchbay->patches.values[i]->track == popup->keyframe_automation->track) - patchgui = patchbay->patches.values[i]; - if (patchgui != 0) - { -// Open the popup menu at current mouse position - APatchGUI *apatchgui = (APatchGUI *)patchgui; - int cursor_x = popup->get_relative_cursor_x(); - int cursor_y = popup->get_relative_cursor_y(); - apatchgui->pan->activate(cursor_x, cursor_y); + PatchGUI *patchgui = get_patchgui(popup->keyframe_automation->track); + if( !patchgui ) break; + + switch( popup->keyframe_autos->autoidx ) { + case AUTOMATION_MODE: { + VKeyModePatch *mode = new VKeyModePatch(mwindow, (VPatchGUI *)patchgui); + mgui->add_subwindow(mode); + mode->create_objects(); + mode->activate_menu(); + mgui->keyvalue_popup = mode; + break; } + + case AUTOMATION_PAN: { + AKeyPanPatch *pan = new AKeyPanPatch(mwindow, (APatchGUI *)patchgui); + mgui->add_subwindow(pan); + pan->create_objects(); + pan->activate(cx, cy); + mgui->keyvalue_popup = pan; + break; } + + case AUTOMATION_FADE: { + switch( patchgui->data_type ) { + case TRACK_AUDIO: { + AKeyFadePatch *fade = new AKeyFadePatch(mwindow, (APatchGUI *)patchgui, cx, cy); + mgui->add_subwindow(fade); + fade->create_objects(); + mgui->keyvalue_popup = fade; + break; } + case TRACK_VIDEO: { + VKeyFadePatch *fade = new VKeyFadePatch(mwindow, (VPatchGUI *)patchgui, cx, cy); + mgui->add_subwindow(fade); + fade->create_objects(); + mgui->keyvalue_popup = fade; + break; } + } + break; } + + case AUTOMATION_SPEED: { + KeySpeedPatch *speed = new KeySpeedPatch(mwindow, patchgui, cx, cy); + mgui->add_subwindow(speed); + speed->create_objects(); + mgui->keyvalue_popup = speed; + break; } + + case AUTOMATION_MUTE: { + KeyMutePatch *mute = new KeyMutePatch(mwindow, (APatchGUI *)patchgui, cx, cy); + mgui->add_subwindow(mute); + mute->create_objects(); + mgui->keyvalue_popup = mute; + break; } } - - - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->fade_autos) - - { - // no window to be shown, so do nothing - // IDEA: open window for fading - show_window = 0; - } else - if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mute_autos) - - { - // no window to be shown, so do nothing - // IDEA: directly switch - show_window = 0; - } else; - + break; } + } // ensure bringing to front - if (show_window) - { - ((CPanelToolWindow *)(mwindow->cwindow->gui->composite_panel->operation[CWINDOW_TOOL_WINDOW]))->set_shown(0); - ((CPanelToolWindow *)(mwindow->cwindow->gui->composite_panel->operation[CWINDOW_TOOL_WINDOW]))->set_shown(1); + if( show_window ) { + mwindow->show_cwindow(); + CPanelToolWindow *panel_tool_window = + (CPanelToolWindow *)cgui->composite_panel->operation[CWINDOW_TOOL_WINDOW]; + panel_tool_window->set_shown(0); + panel_tool_window->set_shown(1); } - mwindow->cwindow->gui->unlock_window(); - - -*/ + cgui->unlock_window(); } return 1; } @@ -348,7 +367,7 @@ int KeyframePopupCopy::handle_event() we want to copy just keyframe under cursor, NOT all keyframes at this frame - very hard to do, so this is good approximation for now... */ - + #if 0 if (popup->keyframe_automation) { @@ -366,17 +385,17 @@ int KeyframePopupCopy::handle_event() else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->camera_autos) autoconf.camera = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->czoom_autos) - autoconf.czoom = 1; + autoconf.czoom = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mode_autos) autoconf.mode = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mask_autos) autoconf.mask = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->pan_autos) - autoconf.pan = 1; + autoconf.pan = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->fade_autos) autoconf.fade = 1; else if (popup->keyframe_autos == (Autos *)popup->keyframe_automation->mute_autos) - autoconf.mute = 1; + autoconf.mute = 1; // now create a clipboard @@ -388,8 +407,8 @@ int KeyframePopupCopy::handle_event() file.append_newline(); file.append_newline(); -/* track->copy_automation(position, - position, +/* track->copy_automation(position, + position, &file, 0, 0); @@ -400,15 +419,12 @@ int KeyframePopupCopy::handle_event() file.append_tag(); file.append_newline(); - track->automation->copy(position, - position, + track->automation->copy(position, + position, &file, 0, 0, &autoconf); - - - file.tag.set_title("/TRACK"); file.append_tag(); file.append_newline(); @@ -416,8 +432,6 @@ int KeyframePopupCopy::handle_event() file.append_newline(); file.append_newline(); - - file.tag.set_title("/AUTO_CLIPBOARD"); file.append_tag(); file.append_newline(); @@ -521,7 +535,7 @@ KeyframeHidePopup::~KeyframeHidePopup() void KeyframeHidePopup::create_objects() { - add_item(new KeyframeHideItem(mwindow, this)); + add_item(new KeyframeHideItem(mwindow, this)); } int KeyframeHidePopup::update(Autos *autos) @@ -545,3 +559,129 @@ int KeyframeHideItem::handle_event() return 1; } + + +KeyMutePatch::KeyMutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y) + : BC_SubWindow(x, y, 100, 20, GWindowGUI::auto_colors[AUTOMATION_MUTE]) +{ + this->mwindow = mwindow; + this->patch = patch; +} + +void KeyMutePatch::create_objects() +{ + key_mute_checkbox = new KeyMuteValue(this); + add_subwindow(key_mute_checkbox); + key_mute_checkbox->activate(); + show_window(); +} + +KeyMuteValue::KeyMuteValue(KeyMutePatch *key_mute_patch) + : BC_CheckBox(0,0, key_mute_patch->mwindow-> + get_int_auto(key_mute_patch->patch, AUTOMATION_MUTE)->value, + _("Mute"), MEDIUMFONT, RED) +{ + this->key_mute_patch = key_mute_patch; +} + +int KeyMuteValue::button_release_event() +{ + BC_CheckBox::button_release_event(); + return 0; +} + +void KeyMuteValue::update_edl() +{ + MWindow *mwindow = key_mute_patch->mwindow; + PatchGUI *patch = key_mute_patch->patch; + double position = mwindow->edl->local_session->get_selectionstart(1); + Autos *mute_autos = patch->track->automation->autos[AUTOMATION_MUTE]; + int need_undo = !mute_autos->auto_exists_for_editing(position); + mwindow->undo->update_undo_before(_("mute"), need_undo ? 0 : this); + IntAuto *current = (IntAuto*)mute_autos->get_auto_for_editing(position); + current->value = this->get_value(); + mwindow->undo->update_undo_after(_("mute"), LOAD_AUTOMATION); +} + +int KeyMuteValue::handle_event() +{ + MWindow *mwindow = key_mute_patch->mwindow; + PatchGUI *patch = key_mute_patch->patch; + patch->change_source = 1; + update_edl(); + patch->change_source = 0; + mwindow->sync_parameters(CHANGE_PARAMS); + if(mwindow->edl->session->auto_conf->autos[AUTOMATION_MUTE]) { + mwindow->gui->update_patchbay(); + mwindow->gui->draw_overlays(1); + } + return 1; +} + +KeySpeedPatch::KeySpeedPatch(MWindow *mwindow, PatchGUI *patch, int x, int y) + : BC_SubWindow(x,y, 200,20, GWindowGUI::auto_colors[AUTOMATION_SPEED]) +{ + this->mwindow = mwindow; + this->patch = patch; +} + +void KeySpeedPatch::create_objects() +{ + key_speed_slider = new KeySpeedValue(this); + add_subwindow(key_speed_slider); + key_speed_slider->activate(); + show_window(); +} + +KeySpeedValue::KeySpeedValue(KeySpeedPatch *key_speed_patch) + : BC_FSlider(0,0, 0, key_speed_patch->get_w(), key_speed_patch->get_w(), + key_speed_patch->mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_SPEED], + key_speed_patch->mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_SPEED], + key_speed_patch->mwindow->get_float_auto(key_speed_patch->patch, AUTOMATION_SPEED)->get_value()) +{ + this->key_speed_patch = key_speed_patch; + set_precision(0.01); +} + +KeySpeedValue::~KeySpeedValue() +{ +} + +int KeySpeedValue::button_release_event() +{ + BC_FSlider::button_release_event(); + return 0; +} + +void KeySpeedValue::update_edl() +{ + MWindow *mwindow = key_speed_patch->mwindow; + PatchGUI *patch = key_speed_patch->patch; + double position = mwindow->edl->local_session->get_selectionstart(1); + Autos *speed_autos = patch->track->automation->autos[AUTOMATION_SPEED]; + int need_undo = !speed_autos->auto_exists_for_editing(position); + mwindow->undo->update_undo_before(_("speed"), need_undo ? 0 : this); + FloatAuto *current = (FloatAuto*)speed_autos->get_auto_for_editing(position); + current->set_value(get_value()); + mwindow->undo->update_undo_after(_("speed"), LOAD_AUTOMATION); +} + +int KeySpeedValue::handle_event() +{ + MWindow *mwindow = key_speed_patch->mwindow; + PatchGUI *patch = key_speed_patch->patch; + if( shift_down() ) { + update(1.0); + set_tooltip(get_caption()); + } + + patch->change_source = 1; + update_edl(); + patch->change_source = 0; + mwindow->sync_parameters(CHANGE_PARAMS); + if(mwindow->edl->session->auto_conf->autos[AUTOMATION_SPEED]) { + mwindow->gui->draw_overlays(1); + } + return 1; +} + diff --git a/cinelerra-5.1/cinelerra/keyframepopup.h b/cinelerra-5.1/cinelerra/keyframepopup.h index bcdd11dc..2b23f775 100644 --- a/cinelerra-5.1/cinelerra/keyframepopup.h +++ b/cinelerra-5.1/cinelerra/keyframepopup.h @@ -22,9 +22,11 @@ #ifndef KEYFRAMEPOPUP_H #define KEYFRAMEPOPUP_H +#include "apatchgui.h" #include "guicast.h" #include "mwindow.inc" #include "mwindowgui.inc" +#include "patchgui.inc" #include "plugin.inc" #include "plugindialog.inc" #include "keyframe.inc" @@ -97,6 +99,7 @@ class KeyframePopupShow : public BC_MenuItem public: KeyframePopupShow(MWindow *mwindow, KeyframePopup *popup); ~KeyframePopupShow(); + PatchGUI *get_patchgui(Track *track); int handle_event(); MWindow *mwindow; @@ -166,4 +169,50 @@ public: KeyframeHidePopup *popup; }; +class KeyMutePatch : public BC_SubWindow +{ +public: + KeyMutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y); + void create_objects(); + + MWindow *mwindow; + PatchGUI *patch; + KeyMuteValue *key_mute_checkbox; +}; + +class KeyMuteValue : public BC_CheckBox +{ +public: + KeyMuteValue(KeyMutePatch *key_mute_patch); + void update_edl(); + int button_release_event(); + int handle_event(); + + KeyMutePatch *key_mute_patch; +}; + +class KeySpeedPatch : public BC_SubWindow +{ +public: + KeySpeedPatch(MWindow *mwindow, PatchGUI *patch, int x, int y); + void create_objects(); + + MWindow *mwindow; + PatchGUI *patch; + KeySpeedValue *key_speed_slider; +}; + +class KeySpeedValue : public BC_FSlider +{ +public: + KeySpeedValue(KeySpeedPatch *key_speed_patch); + ~KeySpeedValue(); + + void update_edl(); + int handle_event(); + int button_release_event(); + + KeySpeedPatch *key_speed_patch; +}; + #endif diff --git a/cinelerra-5.1/cinelerra/keyframepopup.inc b/cinelerra-5.1/cinelerra/keyframepopup.inc index 3728f0c3..1dc401db 100644 --- a/cinelerra-5.1/cinelerra/keyframepopup.inc +++ b/cinelerra-5.1/cinelerra/keyframepopup.inc @@ -24,11 +24,16 @@ class KeyframePopup; class KeyframePopupDelete; +class KeyframePopupHide; class KeyframePopupShow; class KeyframePopupCopy; class KeyframePopupCurveMode; class KeyframePopupEdit; -class KeyframePopupHide; class KeyframeHidePopup; - +class KeyframeHideItem; +class KeyMutePatch; +class KeyMuteValue; +class KeySpeedPatch; +class KeySpeedValue; + #endif diff --git a/cinelerra-5.1/cinelerra/localsession.C b/cinelerra-5.1/cinelerra/localsession.C index c4d672c7..3775dee1 100644 --- a/cinelerra-5.1/cinelerra/localsession.C +++ b/cinelerra-5.1/cinelerra/localsession.C @@ -83,11 +83,11 @@ LocalSession::LocalSession(EDL *edl) automation_mins[AUTOGROUPTYPE_VIDEO_FADE] = 0; automation_maxs[AUTOGROUPTYPE_VIDEO_FADE] = 100; - automation_mins[AUTOGROUPTYPE_ZOOM] = 0.001; - automation_maxs[AUTOGROUPTYPE_ZOOM] = 4; + automation_mins[AUTOGROUPTYPE_ZOOM] = 0.005; + automation_maxs[AUTOGROUPTYPE_ZOOM] = 5.000; - automation_mins[AUTOGROUPTYPE_SPEED] = 0.05; - automation_maxs[AUTOGROUPTYPE_SPEED] = 3; + automation_mins[AUTOGROUPTYPE_SPEED] = 0.005; + automation_maxs[AUTOGROUPTYPE_SPEED] = 5.000; automation_mins[AUTOGROUPTYPE_X] = -100; automation_maxs[AUTOGROUPTYPE_X] = 100; diff --git a/cinelerra-5.1/cinelerra/mainmenu.C b/cinelerra-5.1/cinelerra/mainmenu.C index 27339053..5542b499 100644 --- a/cinelerra-5.1/cinelerra/mainmenu.C +++ b/cinelerra-5.1/cinelerra/mainmenu.C @@ -1417,14 +1417,19 @@ int ShowCWindow::handle_event() ShowGWindow::ShowGWindow(MWindow *mwindow) - : BC_MenuItem(_("Show Overlays")) + : BC_MenuItem(_("Show Overlays"), _("Ctrl-0"), '0') { this->mwindow = mwindow; + set_ctrl(1); set_checked(mwindow->session->show_gwindow); } int ShowGWindow::handle_event() { - mwindow->show_gwindow(); + if( !mwindow->session->show_gwindow ) + mwindow->show_gwindow(); + else + mwindow->hide_gwindow(); + set_checked(mwindow->session->show_gwindow); return 1; } diff --git a/cinelerra-5.1/cinelerra/mwindow.C b/cinelerra-5.1/cinelerra/mwindow.C index 7e44e509..156c9532 100644 --- a/cinelerra-5.1/cinelerra/mwindow.C +++ b/cinelerra-5.1/cinelerra/mwindow.C @@ -20,6 +20,7 @@ #include "asset.h" #include "assets.h" +#include "atrack.h" #include "audioalsa.h" #include "autos.h" #include "awindowgui.h" @@ -53,11 +54,13 @@ #include "file.h" #include "filesystem.h" #include "filexml.h" +#include "floatautos.h" #include "framecache.h" #include "gwindow.h" #include "gwindowgui.h" #include "keyframegui.h" #include "indexfile.h" +#include "intautos.h" #include "interlacemodes.h" #include "language.h" #include "levelwindowgui.h" @@ -77,6 +80,7 @@ #include "mwindow.h" #include "nestededls.h" #include "new.h" +#include "panautos.h" #include "patchbay.h" #include "playback3d.h" #include "playbackengine.h" @@ -107,6 +111,7 @@ #include "transition.h" #include "transportque.h" #include "vframe.h" +#include "vtrack.h" #include "versioninfo.h" #include "videodevice.inc" #include "videowindow.h" @@ -641,14 +646,14 @@ int MWindow::init_ladspa_index(MWindow *mwindow, Preferences *preferences, strcpy(plugin_path, path); delete [] path; printf("init ladspa index: %s\n", plugin_dir); FILE *fp = fopen(index_path,"w"); - if( !fp ) { + if( !fp ) { fprintf(stderr,_("MWindow::init_ladspa_index: " "can't create plugin index: %s\n"), index_path); return 1; } fprintf(fp, "%d\n", PLUGIN_FILE_VERSION); fprintf(fp, "%s\n", plugin_dir); - init_plugin_index(mwindow, preferences, fp, plugin_path); + init_plugin_index(mwindow, preferences, fp, plugin_path); fclose(fp); return 0; } @@ -1279,7 +1284,7 @@ int MWindow::put_commercial() void MWindow::stop_playback(int wait) { int locked = gui->get_window_lock(); - if( locked ) gui->unlock_window(); + if( locked ) gui->unlock_window(); cwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, @@ -1293,7 +1298,7 @@ void MWindow::stop_playback(int wait) vwindow->playback_engine->que->send_command(STOP, CHANGE_NONE, 0, 0); vwindow->playback_engine->interrupt_playback(wait); } - if( locked ) gui->lock_window("MWindow::stop_playback"); + if( locked ) gui->lock_window("MWindow::stop_playback"); } int MWindow::load_filenames(ArrayList *filenames, @@ -2159,6 +2164,14 @@ void MWindow::show_gwindow() gui->mainmenu->show_gwindow->set_checked(1); } +void MWindow::hide_gwindow() +{ + session->show_gwindow = 0; + + gwindow->gui->lock_window("MWindow::show_gwindow"); + gwindow->gui->hide_window(); + gwindow->gui->unlock_window(); +} void MWindow::show_lwindow() { @@ -3161,10 +3174,10 @@ void MWindow::dump_undo(FILE *fp) void MWindow::dump_exe(FILE *fp) { - char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; - sprintf(proc_path, "/proc/%d/exe", (int)getpid()); + char proc_path[BCTEXTLEN], exe_path[BCTEXTLEN]; + sprintf(proc_path, "/proc/%d/exe", (int)getpid()); - int ret = -1, n = 100; + int ret = -1, n = 100; for( int len; (len=readlink(proc_path, exe_path, sizeof(exe_path)))>0; --n ) { exe_path[len] = 0; strcpy(proc_path, exe_path); ret = 0; @@ -3476,6 +3489,8 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra EDLSession *session = edl->session; double old_framerate = session->frame_rate; double old_samplerate = session->sample_rate; + int old_auto_keyframes = session->auto_keyframes; + session->auto_keyframes = 0; int result = file->open_file(preferences, asset, 1, 0); if( !result && delete_tracks > 0 ) undo->update_undo_before(); @@ -3589,6 +3604,7 @@ int MWindow::select_asset(Asset *asset, int vstream, int astream, int delete_tra edl->resample(old_samplerate, session->sample_rate, TRACK_AUDIO); } delete file; + session->auto_keyframes = old_auto_keyframes; if( !result && delete_tracks > 0 ) { save_backup(); undo->update_undo_after(_("select asset"), LOAD_ALL); @@ -3617,3 +3633,34 @@ void MWindow::dump_plugindb(FILE *fp) plugindb->get(i)->dump(fp); } +FloatAuto* MWindow::get_float_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + FloatAutos *ptr = (FloatAutos*)patch->track->automation->autos[idx]; + return (FloatAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +IntAuto* MWindow::get_int_auto(PatchGUI *patch,int idx) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + IntAutos *ptr = (IntAutos*)patch->track->automation->autos[idx]; + return (IntAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + +PanAuto* MWindow::get_pan_auto(PatchGUI *patch) +{ + Auto *current = 0; + double unit_position = edl->local_session->get_selectionstart(1); + unit_position = patch->track->to_units(unit_position, 0); + + PanAutos *ptr = (PanAutos*)patch->track->automation->autos[AUTOMATION_PAN]; + return (PanAuto*)ptr->get_prev_auto( (long)unit_position, PLAY_FORWARD, current); +} + + diff --git a/cinelerra-5.1/cinelerra/mwindow.h b/cinelerra-5.1/cinelerra/mwindow.h index 7628632e..385f47f6 100644 --- a/cinelerra-5.1/cinelerra/mwindow.h +++ b/cinelerra-5.1/cinelerra/mwindow.h @@ -24,6 +24,7 @@ #include #include +#include "apatchgui.h" #include "arraylist.h" #include "asset.inc" #include "assets.inc" @@ -92,6 +93,7 @@ #include "transition.inc" #include "transportque.inc" #include "videowindow.inc" +#include "vpatchgui.h" #include "vwindow.inc" #include "wwindow.inc" #include "wavecache.inc" @@ -135,6 +137,7 @@ public: void show_lwindow(); void show_cwindow(); void show_gwindow(); + void hide_gwindow(); int tile_windows(int window_config); char *get_cwindow_display(); // void set_titles(int value); @@ -481,6 +484,10 @@ public: int paste_default_keyframe(); int clear_default_keyframe(); + FloatAuto* get_float_auto(PatchGUI *patch,int idx); + IntAuto* get_int_auto(PatchGUI *patch,int idx); + PanAuto* get_pan_auto(PatchGUI *patch); + int modify_edithandles(); int modify_pluginhandles(); void finish_modify_handles(); diff --git a/cinelerra-5.1/cinelerra/mwindowgui.C b/cinelerra-5.1/cinelerra/mwindowgui.C index 1a1c3bfe..74f3e1f3 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.C +++ b/cinelerra-5.1/cinelerra/mwindowgui.C @@ -120,6 +120,7 @@ MWindowGUI::MWindowGUI(MWindow *mwindow) plugin_menu = 0; keyframe_menu = 0; keyframe_hide = 0; + keyvalue_popup = 0; transition_menu = 0; remote_control = 0; cwindow_remote_handler = 0; @@ -134,6 +135,7 @@ MWindowGUI::~MWindowGUI() delete cwindow_remote_handler; delete record_remote_handler; delete remote_control; + delete keyvalue_popup; // delete samplescroll; // delete trackscroll; for(int i = 0; i < TOTAL_PANES; i++) @@ -1108,19 +1110,13 @@ void MWindowGUI::default_positions() } - - - - - - - - - - - - - +int MWindowGUI::button_release_event() +{ + if( keyvalue_popup ) { + delete keyvalue_popup; keyvalue_popup = 0; + } + return 0; +} int MWindowGUI::repeat_event(int64_t duration) @@ -1280,7 +1276,6 @@ int MWindowGUI::keypress_event() return result; } - int MWindowGUI::keyboard_listener(BC_WindowBase *wp) { return key_listener(wp->get_keypress()); @@ -2270,7 +2265,6 @@ int PaneButton::cursor_motion_event() int PaneButton::button_release_event() { mwindow->gui->stop_pane_drag(); - int result = BC_Button::button_release_event(); return result; } diff --git a/cinelerra-5.1/cinelerra/mwindowgui.h b/cinelerra-5.1/cinelerra/mwindowgui.h index 8432f0df..066ef452 100644 --- a/cinelerra-5.1/cinelerra/mwindowgui.h +++ b/cinelerra-5.1/cinelerra/mwindowgui.h @@ -130,6 +130,7 @@ public: int translation_event(); int resize_event(int w, int h); // handle a resize event + int button_release_event(); int keypress_event(); int keyboard_listener(BC_WindowBase *wp); int key_listener(int key); @@ -192,6 +193,7 @@ public: PluginPopup *plugin_menu; KeyframePopup *keyframe_menu; KeyframeHidePopup *keyframe_hide; + BC_SubWindow *keyvalue_popup; TransitionPopup *transition_menu; MainClock *mainclock; @@ -222,7 +224,6 @@ public: BC_DragWindow *drag_popup; - // PatchBay *patchbay; // MTimeBar *timebar; // SampleScroll *samplescroll; diff --git a/cinelerra-5.1/cinelerra/patchgui.C b/cinelerra-5.1/cinelerra/patchgui.C index 1e31919b..72211d1a 100644 --- a/cinelerra-5.1/cinelerra/patchgui.C +++ b/cinelerra-5.1/cinelerra/patchgui.C @@ -199,7 +199,7 @@ int PatchGUI::update(int x, int y) record->update(track->record); gang->update(track->gang); draw->update(track->draw); - mute->update(mute->get_keyframe(mwindow, this)->value); + mute->update(mwindow->get_int_auto(this, AUTOMATION_MUTE)->value); expand->update(track->expand_view); } } @@ -555,7 +555,7 @@ int DrawPatch::button_release_event() MutePatch::MutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y) : BC_Toggle(x, y, mwindow->theme->get_image_set("mutepatch_data"), - get_keyframe(mwindow, patch)->value, + mwindow->get_int_auto(patch, AUTOMATION_MUTE)->value, "", 0, 0, @@ -609,27 +609,6 @@ int MutePatch::button_release_event() return result; } -IntAuto* MutePatch::get_keyframe(MWindow *mwindow, PatchGUI *patch) -{ - Auto *current = 0; - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = patch->track->to_units(unit_position, 0); - return (IntAuto*)patch->track->automation->autos[AUTOMATION_MUTE]->get_prev_auto( - (int64_t)unit_position, - PLAY_FORWARD, - current); -} - - - - - - - - - - ExpandPatch::ExpandPatch(MWindow *mwindow, PatchGUI *patch, int x, int y) diff --git a/cinelerra-5.1/cinelerra/patchgui.h b/cinelerra-5.1/cinelerra/patchgui.h index c2c4132e..25d23e6d 100644 --- a/cinelerra-5.1/cinelerra/patchgui.h +++ b/cinelerra-5.1/cinelerra/patchgui.h @@ -153,7 +153,6 @@ public: MutePatch(MWindow *mwindow, PatchGUI *patch, int x, int y); int button_press_event(); int button_release_event(); - static IntAuto* get_keyframe(MWindow *mwindow, PatchGUI *patch); MWindow *mwindow; PatchGUI *patch; }; diff --git a/cinelerra-5.1/cinelerra/trackcanvas.C b/cinelerra-5.1/cinelerra/trackcanvas.C index 5d5b64fe..2e21511e 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.C +++ b/cinelerra-5.1/cinelerra/trackcanvas.C @@ -38,6 +38,7 @@ #include "edlsession.h" #include "floatauto.h" #include "floatautos.h" +#include "gwindowgui.h" #include "indexstate.h" #include "intauto.h" #include "intautos.h" @@ -1868,24 +1869,8 @@ void TrackCanvas::draw_brender_start() } } -static int auto_colors[AUTOMATION_TOTAL] = -{ - BLUE, - RED, - GREEN, - BLUE, - RED, - GREEN, - BLUE, - WHITE, - 0, - 0, - 0, - WHITE -}; - // The operations which correspond to each automation type -static int auto_operations[AUTOMATION_TOTAL] = +int TrackCanvas::auto_operations[AUTOMATION_TOTAL] = { DRAG_MUTE, DRAG_CAMERA_X, @@ -1990,8 +1975,8 @@ int TrackCanvas::do_keyframes(int cursor_x, auto_keyframe, grouptype); result = do_float_autos(track, autos, - cursor_x, cursor_y, draw, - buttonpress, 0, 0, auto_colors[i], + cursor_x, cursor_y, draw, buttonpress, + 0, 0, GWindowGUI::auto_colors[i], auto_keyframe, grouptype); break; } @@ -2002,8 +1987,8 @@ int TrackCanvas::do_keyframes(int cursor_x, buttonpress, 1, 1, MDGREY, auto_keyframe); result = do_int_autos(track, autos, - cursor_x, cursor_y, draw, - buttonpress, 0, 0, auto_colors[i], + cursor_x, cursor_y, draw, buttonpress, + 0, 0, GWindowGUI::auto_colors[i], auto_keyframe); break; } } diff --git a/cinelerra-5.1/cinelerra/trackcanvas.h b/cinelerra-5.1/cinelerra/trackcanvas.h index 69318d67..9f86d81d 100644 --- a/cinelerra-5.1/cinelerra/trackcanvas.h +++ b/cinelerra-5.1/cinelerra/trackcanvas.h @@ -399,8 +399,7 @@ public: ArrayList plugin_on_toggles; ArrayList plugin_show_toggles; - - + static int auto_operations[]; // event handlers void draw_paste_destination(); diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C index 57c862d3..94e194d5 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.C +++ b/cinelerra-5.1/cinelerra/vpatchgui.C @@ -25,6 +25,7 @@ #include "edlsession.h" #include "floatauto.h" #include "floatautos.h" +#include "gwindowgui.h" #include "intauto.h" #include "intautos.h" #include "language.h" @@ -103,16 +104,9 @@ int VPatchGUI::update(int x, int y) } else { - FloatAuto *previous = 0, *next = 0; - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = vtrack->to_units(unit_position, 0); - int value = (int)((FloatAutos*)vtrack->automation->autos[AUTOMATION_FADE])->get_value( - (int64_t)unit_position, PLAY_FORWARD, previous, next); - fade->update(fade->get_w(), value, + fade->update(fade->get_w(), mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value(), mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE], mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE]); -// fade->update((int)fade->get_keyframe(mwindow, this)->value); } } else @@ -137,7 +131,7 @@ int VPatchGUI::update(int x, int y) } else { - mode->update(mode->get_keyframe(mwindow, this)->value); + mode->update(mwindow->get_int_auto(this, AUTOMATION_MODE)->value); nudge->update(); } } @@ -179,14 +173,10 @@ void VPatchGUI::synchronize_fade(float value_change) VFadePatch::VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w) - : BC_ISlider(x, - y, - 0, - w, - w, - mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE], - mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE], - (int64_t)get_keyframe(mwindow, patch)->get_value()) + : BC_ISlider(x, y, 0, w, w, + mwindow->edl->local_session->automation_mins[AUTOGROUPTYPE_VIDEO_FADE], + mwindow->edl->local_session->automation_maxs[AUTOGROUPTYPE_VIDEO_FADE], + (int64_t)mwindow->get_float_auto(patch,AUTOMATION_FADE)->get_value()) { this->mwindow = mwindow; this->patch = patch; @@ -240,38 +230,70 @@ int VFadePatch::handle_event() return 1; } -FloatAuto* VFadePatch::get_keyframe(MWindow *mwindow, VPatchGUI *patch) + +VKeyFadePatch::VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) + : BC_SubWindow(x,y, patch->patchbay->get_w(),20, + GWindowGUI::auto_colors[AUTOMATION_FADE]) +{ + this->mwindow = mwindow; + this->patch = patch; +} + +void VKeyFadePatch::create_objects() +{ + vkey_fade_value = new VKeyFadeValue(this); + add_subwindow(vkey_fade_value); + vkey_fade_value->activate(); + show_window(); +} + +VKeyFadeValue::VKeyFadeValue(VKeyFadePatch *vkey_fade_patch) + : VFadePatch(vkey_fade_patch->mwindow, vkey_fade_patch->patch, + 0,0, vkey_fade_patch->get_w()) +{ + this->vkey_fade_patch = vkey_fade_patch; +} + +int VKeyFadeValue::button_release_event() +{ + VFadePatch::button_release_event(); + return 0; +} + +int VKeyFadeValue::handle_event() { - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = patch->vtrack->to_units(unit_position, 0); - Auto *current = 0; - - return (FloatAuto*)patch->vtrack->automation->autos[AUTOMATION_FADE]->get_prev_auto( - (int64_t)unit_position, - PLAY_FORWARD, - current); + VPatchGUI *patch = vkey_fade_patch->patch; + int ret = VFadePatch::handle_event(); + VFadePatch *fade = patch->fade; + if( fade ) + fade->update(get_value()); + return ret; } + VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) - : BC_PopupMenu(x, - y, - patch->patchbay->mode_icons[0]->get_w() + 20, - "", - 1, - mwindow->theme->get_image_set("mode_popup", 0), - 10) + : BC_PopupMenu(x, y, patch->patchbay->mode_icons[0]->get_w() + 20, + "", 1, mwindow->theme->get_image_set("mode_popup", 0), 10) { this->mwindow = mwindow; this->patch = patch; - this->mode = get_keyframe(mwindow, patch)->value; + this->mode = mwindow->get_int_auto(patch, AUTOMATION_MODE)->value; set_icon(patch->patchbay->mode_to_icon(this->mode)); set_tooltip(_("Overlay mode")); } +VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch) + : BC_PopupMenu(0, 0, 0, "", 0) +{ + this->mwindow = mwindow; + this->patch = patch; + this->mode = mwindow->get_int_auto(patch, AUTOMATION_MODE)->value; +} + + int VModePatch::handle_event() { // Set menu items @@ -308,20 +330,6 @@ int VModePatch::handle_event() return 1; } -IntAuto* VModePatch::get_keyframe(MWindow *mwindow, VPatchGUI *patch) -{ - Auto *current = 0; - double unit_position = mwindow->edl->local_session->get_selectionstart(1); - unit_position = mwindow->edl->align_to_frame(unit_position, 0); - unit_position = patch->vtrack->to_units(unit_position, 0); - - return (IntAuto*)patch->vtrack->automation->autos[AUTOMATION_MODE]->get_prev_auto( - (int64_t)unit_position, - PLAY_FORWARD, - current); -} - - void VModePatch::create_objects() { for( int mode=0; modehandle_event(); return 1; } + + +VKeyModePatch::VKeyModePatch(MWindow *mwindow, VPatchGUI *patch) + : VModePatch(mwindow, patch) +{ +} + +int VKeyModePatch::button_release_event() +{ + VModePatch::button_release_event(); + return 0; +} + +int VKeyModePatch::handle_event() +{ + int ret = VModePatch::handle_event(); + VModePatch *mode = patch->mode; + if( mode ) + mode->update(this->mode); + return ret; +} + + + diff --git a/cinelerra-5.1/cinelerra/vpatchgui.h b/cinelerra-5.1/cinelerra/vpatchgui.h index 4d791e89..e368c8ec 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.h +++ b/cinelerra-5.1/cinelerra/vpatchgui.h @@ -57,20 +57,40 @@ public: VFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y, int w); int handle_event(); float update_edl(); - static FloatAuto* get_keyframe(MWindow *mwindow, VPatchGUI *patch); MWindow *mwindow; VPatchGUI *patch; }; +class VKeyFadePatch : public BC_SubWindow +{ +public: + VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y); + void create_objects(); + + MWindow *mwindow; + VPatchGUI *patch; + VKeyFadeValue *vkey_fade_value; +}; + +class VKeyFadeValue : public VFadePatch +{ +public: + VKeyFadeValue(VKeyFadePatch *vkey_fade_patch); + int button_release_event(); + int handle_event(); + + VKeyFadePatch *vkey_fade_patch; +}; + class VModePatch : public BC_PopupMenu { public: VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y); + VModePatch(MWindow *mwindow, VPatchGUI *patch); int handle_event(); void create_objects(); // add initial items static const char* mode_to_text(int mode); - static IntAuto* get_keyframe(MWindow *mwindow, VPatchGUI *patch); void update(int mode); MWindow *mwindow; @@ -88,5 +108,13 @@ public: int mode; }; +class VKeyModePatch : public VModePatch +{ +public: + VKeyModePatch(MWindow *mwindow, VPatchGUI *patch); + int button_release_event(); + int handle_event(); +}; + #endif diff --git a/cinelerra-5.1/cinelerra/vpatchgui.inc b/cinelerra-5.1/cinelerra/vpatchgui.inc index 260bcf77..971efae2 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.inc +++ b/cinelerra-5.1/cinelerra/vpatchgui.inc @@ -22,11 +22,14 @@ #ifndef VPATCHGUI_INC #define VPATCHGUI_INC - - class VPatchGUI; +class VFadePatch; +class VKeyFadePatch; +class VKeyFadeValue; +class VModePatch; +class VModePatchItem; +class VKeyModePatch; #define MAX_VIDEO_FADE 100 - #endif -- 2.26.2