From: Good Guy Date: Wed, 24 Aug 2016 15:59:13 +0000 (-0600) Subject: mod mute toggle behavior for consistency X-Git-Url: https://git.cinelerra-gg.org/git/?a=commitdiff_plain;h=394f84fcbfbb6fc97758f09cfcf5319da036b8cd;p=goodguy%2Fhistory.git mod mute toggle behavior for consistency --- diff --git a/cinelerra-5.1/cinelerra/patchgui.C b/cinelerra-5.1/cinelerra/patchgui.C index e61ec0a4..51e47ba1 100644 --- a/cinelerra-5.1/cinelerra/patchgui.C +++ b/cinelerra-5.1/cinelerra/patchgui.C @@ -239,39 +239,27 @@ void PatchGUI::toggle_behavior(int type, { if(toggle->shift_down()) { - int total_selected = mwindow->edl->tracks->total_of(type); - -// nothing previously selected - if(total_selected == 0) - { - mwindow->edl->tracks->select_all(type, - 1); - } - else - if(total_selected == 1) - { -// this patch was previously the only one on - if(*output) - { - mwindow->edl->tracks->select_all(type, - 1); - } -// another patch was previously the only one on - else - { - mwindow->edl->tracks->select_all(type, - 0); - *output = 1; - } - } - else - if(total_selected > 1) - { - mwindow->edl->tracks->select_all(type, - 0); - *output = 1; + // 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; } } - toggle->set_value(*output); patchbay->drag_operation = type; patchbay->new_status = 1;