public static IFragment[] GetSelectedFragmentsInGuiOrder(this RowSelectionList selectedRows)
        {
            ICollection <IFragmentContainer> handledFragmentContrainers = new HashSet <IFragmentContainer>();
            var fragments = new List <IFragment>();

            foreach (Row row in selectedRows.GetRowsInGuiOrder())
            {
                var fragment = row.Item as IFragment;
                if (fragment == null)
                {
                    continue;
                }

                if (fragment.FragmentContainer != null)
                {
                    if (!handledFragmentContrainers.Contains(fragment.FragmentContainer))
                    {
                        handledFragmentContrainers.Add(fragment.FragmentContainer);

                        foreach (IFragment fragment1 in fragment.FragmentContainer)
                        {
                            fragments.Add(fragment1);
                        }
                    }
                }
                else
                {
                    fragments.Add(fragment);
                }
            }
            return(fragments.ToArray());
        }
        private static Row[] GetRowsInGuiOrder(this RowSelectionList rowSelectionList)
        {
            if (rowSelectionList == null || rowSelectionList.Count == 0)
            {
                return(new Row[0]);
            }

            return(rowSelectionList.GetRows().GetRowsInGuiOrder());
        }
        /// <summary>
        /// Gets a unique subset of the rows from <paramref name="rowSelectionList"/>, so that
        /// no row is a descendant of any other row.
        /// The rows are sorted in the order they appear in the tree.
        /// </summary>
        /// <param name="rowSelectionList">the rows</param>
        /// <returns>the unique rows in GUI order</returns>
        internal static Row[] GetUniqueRowsInGuiOrder(this RowSelectionList rowSelectionList)
        {
            if (rowSelectionList == null || rowSelectionList.Count == 0)
            {
                return new Row[] { }
            }
            ;

            return(rowSelectionList.GetRows().GetUniqueRowsInGuiOrder());
        }
 internal static bool ContainsInputFile(this RowSelectionList rowSelectionList)
 {
     foreach (Row row in rowSelectionList)
     {
         if (row.Item is IInputFile)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #5
0
 // Only rows != codec stream can be deleted.
 // If the selection consists of codec streams only,
 // do not enable the delete menu option.
 private static bool ContainsDataBlocksOrFiles(RowSelectionList rows)
 {
     foreach (Row row in rows)
     {
         if ((row != null) && ((row.Item is IInputFile) || (row.Item is IDataBlock)))
         {
             return(true);
         }
     }
     return(false);
 }
Пример #6
0
 private static bool AnySelectedIsFile(RowSelectionList selection)
 {
     foreach (Row row in selection)
     {
         if (row.Item is IInputFile)
         {
             return(true);
         }
     }
     return(false);
 }
Пример #7
0
 private static bool AllSelectedAreVideoBlocks(RowSelectionList selection)
 {
     foreach (Row row in selection)
     {
         if (!IsVideoBlock(row.Item))
         {
             return(false);
         }
     }
     return(true);
 }
        /// <summary>
        /// Returns whether any of the <paramref name="selectedRows"/> has
        /// an accompanying column.
        /// </summary>
        /// <param name="selectedRows">the selected rows</param>
        /// <returns><c>true</c> if any row has an accompanying column, <c>false</c> otherwise</returns>
        private bool HasAccompanyingColumn(RowSelectionList selectedRows)
        {
            if (!HasSelectedRows)
            {
                return(false);
            }

            foreach (Row row in selectedRows)
            {
                IResultAttribute resultAttribute = row.Item as IResultAttribute;
                if (resultAttribute != null && Result.Detectors.First().ColumnInHeader(Result.Name, resultAttribute.Name))
                {
                    return(true);
                }
            }
            return(false);
        }