- 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;
- }
- toggle->set_value(*output);
+ 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
+ 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;