ffmpeg filter memory leak, cursor hopper fix, added leaker.C, misc fixes
[goodguy/history.git] / cinelerra-5.1 / cinelerra / patchgui.C
index 51e47ba19699aac93be332b0de61190529fdc44e..3a20d44c32db3e1636475ff578c175e2ee176aab 100644 (file)
@@ -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);
                }
        }
@@ -237,29 +237,17 @@ void PatchGUI::toggle_behavior(int type,
                BC_Toggle *toggle,
                int *output)
 {
-       if(toggle->shift_down())
-       {
+       if(toggle->shift_down()) {
+               int sense = type != Tracks::MUTE ? 1 : 0;
                // all selected if nothing previously selected or
                // if this patch was previously the only one selected
-               switch( type ) {
-               case Tracks::MUTE: {  // negative logic for normally off
-                       int total_selected = mwindow->edl->tracks->total() -
-                               mwindow->edl->tracks->total_of(type);
-                       int current_output = *output;
-                       int selected = !total_selected || (total_selected == 1 &&
-                                !current_output ) ? 0 : 1;
-                       mwindow->edl->tracks->select_all(type, selected);
-                       if( selected ) *output = 0;
-                       break; }
-               default: {
-                       int total_selected = mwindow->edl->tracks->total_of(type);
-                       int current_output = *output;
-                       int selected = !total_selected || (total_selected == 1 &&
-                                current_output ) ? 1 : 0;
-                       mwindow->edl->tracks->select_all(type, selected);
-                       if( !selected ) *output = 1;
-                       break; }
-               }
+               int total_type = mwindow->edl->tracks->total_of(type);
+               int total_selected = sense ? total_type :
+                       mwindow->edl->tracks->total() - total_type;
+               int selected = !total_selected || (total_selected == 1 &&
+                        *output == sense ) ? sense : 1-sense;
+               mwindow->edl->tracks->select_all(type, selected);
+               if( selected != sense ) *output = sense;
 
                patchbay->drag_operation = type;
                patchbay->new_status = 1;
@@ -567,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,
@@ -621,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)
@@ -746,13 +713,13 @@ int NudgePatch::handle_event()
 
 void NudgePatch::set_value(int64_t value)
 {
-       mwindow->undo->update_undo_before(_("nudge"), this);
+       mwindow->undo->update_undo_before(_("nudge."), this);
        patch->track->nudge = value;
 
        if(patch->track->gang && patch->track->record)
                patch->patchbay->synchronize_nudge(patch->track->nudge, patch->track);
 
-       mwindow->undo->update_undo_after(_("nudge"), LOAD_PATCHES);
+       mwindow->undo->update_undo_after(_("nudge."), LOAD_PATCHES);
 
        mwindow->gui->unlock_window();
        if(patch->track->data_type == TRACK_VIDEO)