X-Git-Url: https://git.cinelerra-gg.org/git/?a=blobdiff_plain;ds=sidebyside;f=cinelerra-5.1%2Fcinelerra%2Fvpatchgui.C;h=53ec27fb3af0d935b5d14f6d7b9df0ba56a0c63e;hb=HEAD;hp=774ac86bf33ca4c2cc41f1c2e8b49dc50cc27ee6;hpb=686bc04a488847170d80ec603f8c33962a7aa928;p=goodguy%2Fcinelerra.git diff --git a/cinelerra-5.1/cinelerra/vpatchgui.C b/cinelerra-5.1/cinelerra/vpatchgui.C index 774ac86b..53ec27fb 100644 --- a/cinelerra-5.1/cinelerra/vpatchgui.C +++ b/cinelerra-5.1/cinelerra/vpatchgui.C @@ -109,7 +109,7 @@ int VPatchGUI::update(int x, int y) else if( h >= y2 ) { int64_t v = mwindow->get_float_auto(this, AUTOMATION_FADE)->get_value(); patchbay->add_subwindow(fade = new VFadePatch(this, x1+x, y1+y, - patchbay->get_w() - 10, v)); + patchbay->get_w() - xS(10), v)); } y1 = y2; @@ -130,13 +130,13 @@ int VPatchGUI::update(int x, int y) } } else if( h >= y2 ) { - patchbay->add_subwindow(mix = new VMixPatch(mwindow, this, x1+x, y1+y+5)); + patchbay->add_subwindow(mix = new VMixPatch(mwindow, this, x1+x, y1+y+yS(5))); x1 += mix->get_w(); patchbay->add_subwindow(mode = new VModePatch(mwindow, this, x1+x, y1+y)); mode->create_objects(); x1 += mode->get_w(); patchbay->add_subwindow(nudge = new NudgePatch(mwindow, this, x1+x, y1+y, - patchbay->get_w() - x1-x - 10)); + patchbay->get_w() - x1-x - xS(10))); } y1 = y2; @@ -161,14 +161,12 @@ void VPatchGUI::update_faders(float v) double position = mwindow->edl->local_session->get_selectionstart(1); Autos *fade_autos = vtrack->automation->autos[AUTOMATION_FADE]; int need_undo = !fade_autos->auto_exists_for_editing(position); - mwindow->undo->update_undo_before(_("fade"), need_undo ? 0 : this); FloatAuto *current = (FloatAuto*)fade_autos->get_auto_for_editing(position); - float change = v - current->get_value(); - current->set_value(v); - - if( track->gang && track->record ) - patchbay->synchronize_faders(change, TRACK_AUDIO, track); + float change = v - current->get_value(edge); + current->bump_value(v, edge, span); + if( track->is_ganged() && track->is_armed() ) + patchbay->synchronize_faders(change, TRACK_VIDEO, track, edge, span); mwindow->undo->update_undo_after(_("fade"), LOAD_AUTOMATION); change_source = 0; @@ -189,33 +187,64 @@ int VFadePatch::handle_event() return 1; } -VKeyFadePatch::VKeyFadePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) - : BC_SubWindow(x,y, 200,20, GWindowGUI::auto_colors[AUTOMATION_FADE]) +VKeyFadePatch::VKeyFadePatch(MWindow *mwindow, VPatchGUI *gui, + int bump, int x, int y) + : BC_SubWindow(x,y, xS(200),yS(bump ? 50 : 24), + GWindowGUI::auto_colors[AUTOMATION_FADE]) { this->mwindow = mwindow; - this->patch = patch; + this->gui = gui; +} +VKeyFadePatch::~VKeyFadePatch() +{ } void VKeyFadePatch::create_objects() { - int x = 0, y = 0; - int64_t v = mwindow->get_float_auto(patch, AUTOMATION_FADE)->get_value(); - add_subwindow(vkey_fade_text = new VKeyFadeText(this, x, y, 64, v)); + int x = 0, x1 = x, y = 0, dy = 0; + FloatAuto *fade_auto = mwindow->get_float_auto(gui, AUTOMATION_FADE); + int64_t v = fade_auto->get_value(gui->edge); + add_subwindow(vkey_fade_text = new VKeyFadeText(this, x, y, xS(64), v)); x += vkey_fade_text->get_w(); + dy = bmax(dy, vkey_fade_text->get_h()); VFrame **lok_images = mwindow->theme->get_image_set("lok"); int w1 = get_w() - x - lok_images[0]->get_w(); add_subwindow(vkey_fade_slider = new VKeyFadeSlider(this, x, y, w1, v)); x += vkey_fade_slider->get_w(); + dy = bmax(dy, vkey_fade_slider->get_h()); add_subwindow(vkey_fade_ok = new VKeyFadeOK(this, x, y, lok_images)); + dy = bmax(dy, vkey_fade_ok->get_h()); + if( fade_auto->is_bump() ) { + y += dy; + set_color(get_resources()->get_bg_color()); + draw_box(0,y, get_w(),get_h()); + add_subwindow(auto_edge = new VKeyPatchAutoEdge(mwindow, this, x1, y)); + x1 += auto_edge->get_w() + xS(15); + add_subwindow(auto_span = new VKeyPatchAutoSpan(mwindow, this, x1, y)); + } + draw_3d_border(0,0, get_w(), get_h(), 0); activate(); show_window(); } +void VKeyFadePatch::set_edge(int edge) +{ + gui->edge = edge; + FloatAuto *fade_auto = mwindow->get_float_auto(gui, AUTOMATION_FADE); + int64_t v = fade_auto->get_value(edge); + update(v); +} + +void VKeyFadePatch::set_span(int span) +{ + gui->span = span; +} + void VKeyFadePatch::update(int64_t v) { vkey_fade_text->update(v); vkey_fade_slider->update(v); - patch->update_faders(v); + gui->update_faders(v); } VKeyFadeOK::VKeyFadeOK(VKeyFadePatch *vkey_fade_patch, int x, int y, VFrame **images) @@ -226,9 +255,8 @@ VKeyFadeOK::VKeyFadeOK(VKeyFadePatch *vkey_fade_patch, int x, int y, VFrame **im int VKeyFadeOK::handle_event() { - MWindowGUI *mgui = vkey_fade_patch->mwindow->gui; - delete mgui->keyvalue_popup; - mgui->keyvalue_popup = 0; + MWindow *mwindow = vkey_fade_patch->mwindow; + mwindow->gui->close_keyvalue_popup(); return 1; } @@ -248,7 +276,7 @@ int VKeyFadeText::handle_event() VKeyFadeSlider::VKeyFadeSlider(VKeyFadePatch *vkey_fade_patch, int x, int y, int w, int64_t v) - : VFadePatch(vkey_fade_patch->patch, x,y, w, v) + : VFadePatch(vkey_fade_patch->gui, x,y, w, v) { this->vkey_fade_patch = vkey_fade_patch; } @@ -262,7 +290,7 @@ int VKeyFadeSlider::handle_event() VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) - : BC_PopupMenu(x, y, patch->patchbay->mode_icons[0]->get_w() + 20, + : BC_PopupMenu(x, y, patch->patchbay->mode_icons[0]->get_w() + xS(20), "", 1, mwindow->theme->get_image_set("mode_popup", 0), 0) { this->mwindow = mwindow; @@ -270,6 +298,8 @@ VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) this->mode = mwindow->get_int_auto(patch, AUTOMATION_MODE)->value; set_icon(patch->patchbay->mode_to_icon(this->mode)); set_tooltip(_("Overlay mode")); +// *** CONTEXT_HELP *** + context_help_set_keyword("Overlays"); } VModePatch::VModePatch(MWindow *mwindow, VPatchGUI *patch) @@ -299,14 +329,10 @@ int VModePatch::handle_event() double position = mwindow->edl->local_session->get_selectionstart(1); Autos *mode_autos = patch->vtrack->automation->autos[AUTOMATION_MODE]; int need_undo = !mode_autos->auto_exists_for_editing(position); - mwindow->undo->update_undo_before(_("mode"), need_undo ? 0 : this); - current = (IntAuto*)mode_autos->get_auto_for_editing(position); current->value = mode; - mwindow->undo->update_undo_after(_("mode"), LOAD_AUTOMATION); - mwindow->sync_parameters(CHANGE_PARAMS); if( mwindow->edl->session->auto_conf->autos[AUTOMATION_MODE] ) { @@ -483,9 +509,43 @@ VMixPatch::VMixPatch(MWindow *mwindow, VPatchGUI *patch, int x, int y) : MixPatch(mwindow, patch, x, y) { set_tooltip(_("Mixer")); +// *** CONTEXT_HELP *** + context_help_set_keyword("Recover Mixer Windows"); } VMixPatch::~VMixPatch() { } +VKeyPatchAutoEdge::VKeyPatchAutoEdge(MWindow *mwindow, + VKeyFadePatch *patch, int x, int y) + : BC_Toggle(x, y, mwindow->theme->get_image_set("bump_edge"), + patch->gui->edge,_("Edge")) +{ + this->mwindow = mwindow; + this->patch = patch; + set_tooltip(_("Bump uses left edge")); +} + +int VKeyPatchAutoEdge::handle_event() +{ + patch->set_edge(get_value()); + return 1; +} + +VKeyPatchAutoSpan::VKeyPatchAutoSpan(MWindow *mwindow, + VKeyFadePatch *patch, int x, int y) + : BC_Toggle(x, y, mwindow->theme->get_image_set("bump_span"), + patch->gui->span,_("Span")) +{ + this->mwindow = mwindow; + this->patch = patch; + set_tooltip(_("Bump spans to next")); +} + +int VKeyPatchAutoSpan::handle_event() +{ + patch->set_span(get_value()); + return 1; +} +