public bool isGroupSelected(AMTakeData take, int group_id, ref int numTracks) { AMGroup grp = take.getGroup(group_id); for (int i = 0; i < grp.elements.Count; i++) { // select track if (grp.elements[i] > 0) { if (!contextSelectionTracks.Contains(grp.elements[i])) { return(false); } numTracks++; } else { if (isGroupSelected(take, grp.elements[i], ref numTracks) == false) { return(false); } } } return(true); }
/*public void contextSelectGroup(int group_id, bool deselect) { * AMGroup grp = getGroup(group_id); * for(int i=0;i<grp.elements.Count;i++) { * // select track * if(grp.elements[i] > 0) { * bool isSelected = contextSelectionTracks.Contains(grp.elements[i]); * if(deselect) { * if(isSelected) contextSelectionTracks.Remove(grp.elements[i]); * } else { * if(!isSelected) contextSelectionTracks.Add(grp.elements[i]); * } * } else { * contextSelectGroup(grp.elements[i],deselect); * } * } * }*/ public void contextSelectGroup(AMTakeData take, int group_id, bool isControlDown) { AMGroup grp = take.getGroup(group_id); int numTracks = 0; bool deselect = isControlDown && isGroupSelected(take, group_id, ref numTracks); for (int i = 0; i < grp.elements.Count; i++) { // select track if (grp.elements[i] > 0) { bool isSelected = contextSelectionTracks.Contains(grp.elements[i]); if (deselect) { if (isSelected) { contextSelectionTracks.Remove(grp.elements[i]); } } else { if (!isSelected) { contextSelectionTracks.Add(grp.elements[i]); } } } else { contextSelectGroup(take, grp.elements[i], deselect); } } }