+
+
+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;
+ key_speed_patch->mwindow->speed_before();
+ set_precision(0.01);
+}
+
+KeySpeedValue::~KeySpeedValue()
+{
+}
+
+int KeySpeedValue::button_release_event()
+{
+ BC_FSlider::button_release_event();
+ key_speed_patch->mwindow->speed_after(1);
+ key_speed_patch->mwindow->resync_guis();
+ 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+LOAD_EDITS);
+}
+
+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;
+}
+