-// Get the array index of the curve
- int update_gui = 0;
- if(popup->keyframe_autos)
- {
- if(popup->keyframe_autos->type == Autos::AUTOMATION_TYPE_PLUGIN)
- {
- mwindow->edl->session->auto_conf->plugins = 0;
- update_gui = 1;
- }
- else
- {
- Track *track = popup->keyframe_autos->track;
- if(track)
- {
- Automation *automation = track->automation;
- if(automation)
- {
- for(int i = 0; i < AUTOMATION_TOTAL; i++)
- {
- if(automation->autos[i] == popup->keyframe_autos)
- {
- mwindow->edl->session->auto_conf->autos[i] = 0;
- update_gui = 1;
- break;
- }
- }
- }
- }
- }
+ if( popup->keyframe_autos )
+ mwindow->set_auto_visibility(popup->keyframe_autos, 0);
+ 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);