示例#1
0
        static void UpdateReportListViewItemCellGUI(
            Rect rect,
            string wkPath,
            UpdateReportLineListViewItem item,
            ErrorsListColumn column,
            float rowHeight,
            bool isSelected,
            bool isFocused,
            int totalLinesCount,
            Action onCheckedReportLineChanged,
            HashSet <UpdateReportLineListViewItem> checkedLines)
        {
            string label = WorkspacePath.GetWorkspaceRelativePath(
                wkPath,
                item.ReportLine.ItemPath);

            bool wasChecked = checkedLines.Contains(item);
            bool isChecked  = DrawTreeViewItem.ForCheckableItemCell(
                rect,
                rowHeight,
                0,
                null,
                null,
                label,
                isSelected,
                isFocused,
                false,
                wasChecked);

            if (wasChecked != isChecked)
            {
                UpdateCheckedState(checkedLines, item, isChecked);
                onCheckedReportLineChanged();
            }
        }
示例#2
0
        static void ErrorListViewItemCellGUI(
            Rect rect,
            float rowHeight,
            WorkspaceInfo wkInfo,
            HashSet <ErrorMessage> checkedErrors,
            ErrorListViewItem item,
            Action onCheckedErrorChanged,
            UpdateReportListColumn column,
            bool isSelected,
            bool isFocused)
        {
            ErrorMessage errorMessage = item.ErrorMessage;

            string label = GetColumnText(
                wkInfo, errorMessage,
                UpdateReportListHeaderState.GetColumnName(column));

            bool wasChecked = checkedErrors.Contains(errorMessage);

            bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
                rect, rowHeight, 0, null, null, label,
                isSelected, isFocused, false, wasChecked);

            if (wasChecked != isChecked)
            {
                UpdateCheckState(
                    checkedErrors, errorMessage, isChecked);

                onCheckedErrorChanged();
            }
        }
示例#3
0
        static void IncomingChangeTreeViewItemCellGUI(
            string wkPath,
            Rect rect,
            float rowHeight,
            UnityIncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView treeView,
            ChangeTreeViewItem item,
            Action onCheckedNodeChanged,
            IncomingChangesTreeColumn column,
            bool isSelected,
            bool isFocused,
            bool isCurrentConflict,
            bool isSolvedConflict)
        {
            IncomingChangeInfo incomingChange = item.ChangeInfo;

            string label = incomingChange.GetColumnText(
                IncomingChangesTreeHeaderState.GetColumnName(column));

            if (column == IncomingChangesTreeColumn.Path)
            {
                if (incomingChangesTree.HasMeta(item.ChangeInfo))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                Texture icon = GetIcon(wkPath, incomingChange);
                GetChangesOverlayIcon.Data overlayIconData =
                    GetChangesOverlayIcon.ForGluonIncomingChange(
                        incomingChange, isSolvedConflict);

                bool wasChecked = incomingChange.IsChecked();

                bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
                    rect, rowHeight, item.depth,
                    icon, overlayIconData, label,
                    isSelected, isFocused, isCurrentConflict,
                    wasChecked);

                incomingChange.UpdateCheckedState(isChecked);

                if (wasChecked != isChecked)
                {
                    UpdateCheckStateForSelection(treeView, item);
                    onCheckedNodeChanged();
                }

                return;
            }

            if (column == IncomingChangesTreeColumn.Size)
            {
                DrawTreeViewItem.ForSecondaryLabelRightAligned(
                    rect, label, isSelected, isFocused, isCurrentConflict);
                return;
            }

            DrawTreeViewItem.ForSecondaryLabel(
                rect, label, isSelected, isFocused, isCurrentConflict);
        }
示例#4
0
        static void ChangeTreeViewItemCellGUI(
            Rect rect,
            float rowHeight,
            PendingChangesTreeView treeView,
            UnityPendingChangesTree pendingChangesTree,
            ChangeTreeViewItem item,
            PendingChangesTreeColumn column,
            bool isSelected,
            bool isFocused)
        {
            PendingChangeInfo changeInfo = item.ChangeInfo;

            string label = changeInfo.GetColumnText(
                PendingChangesTreeHeaderState.GetColumnName(column));

            if (column == PendingChangesTreeColumn.Item)
            {
                if (pendingChangesTree.HasMeta(changeInfo.ChangeInfo))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                Texture             icon            = GetIcon(changeInfo);
                GetOverlayIcon.Data overlayIconData =
                    GetOverlayIcon.ForChange(changeInfo.ChangeInfo);

                bool wasChecked = changeInfo.IsChecked();

                bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
                    rect, rowHeight, item.depth,
                    icon, overlayIconData, label,
                    isSelected, isFocused, false,
                    wasChecked);

                changeInfo.UpdateCheckedState(isChecked);

                if (wasChecked != isChecked)
                {
                    UpdateCheckStateForSelection(treeView, item);
                }

                return;
            }

            if (column == PendingChangesTreeColumn.Size)
            {
                DefaultGUI.LabelRightAligned(rect, label, isSelected, isFocused);
                return;
            }

            DefaultGUI.Label(rect, label, isSelected, isFocused);
        }
        static void ChangeTreeViewItemCellGUI(
            bool isGluonMode,
            IAssetStatusCache assetStatusCache,
            Rect rect,
            float rowHeight,
            PendingChangesTreeView treeView,
            UnityPendingChangesTree pendingChangesTree,
            ChangeTreeViewItem item,
            PendingChangesTreeColumn column,
            bool isSelected,
            bool isFocused)
        {
            PendingChangeInfo changeInfo = item.ChangeInfo;

            string label = changeInfo.GetColumnText(
                PendingChangesTreeHeaderState.GetColumnName(column));

            DefaultStyles.label.fontSize = UnityConstants.PENDING_CHANGES_FONT_SIZE;

            if (column == PendingChangesTreeColumn.Item)
            {
                if (pendingChangesTree.HasMeta(changeInfo.ChangeInfo))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                Texture icon = GetIcon(changeInfo);

                bool isConflicted = IsConflicted(
                    isGluonMode, assetStatusCache,
                    changeInfo.ChangeInfo.GetFullPath());

                GetChangesOverlayIcon.Data overlayIconData =
                    GetChangesOverlayIcon.ForPendingChange(
                        changeInfo.ChangeInfo, isConflicted);

                bool wasChecked = changeInfo.IsChecked();

                bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
                    rect, rowHeight, item.depth,
                    icon, overlayIconData, label,
                    isSelected, isFocused, false,
                    wasChecked);

                changeInfo.UpdateCheckedState(isChecked);

                if (wasChecked != isChecked)
                {
                    UpdateCheckStateForSelection(treeView, item);
                    treeView.SelectionChanged();
                }

                return;
            }

            if (column == PendingChangesTreeColumn.Size)
            {
                DrawTreeViewItem.ForSecondaryLabelRightAligned(
                    rect, label, isSelected, isFocused, false);
                return;
            }

            DrawTreeViewItem.ForSecondaryLabel(
                rect, label, isSelected, isFocused, false);
        }
        static void IncomingChangeTreeViewItemCellGUI(
            string wkPath,
            Rect rect,
            float rowHeight,
            UnityIncomingChangesTree incomingChangesTree,
            IncomingChangesTreeView treeView,
            ChangeTreeViewItem item,
            Action onCheckedNodeChanged,
            IncomingChangesTreeColumn column,
            bool isSelected,
            bool isFocused,
            bool isCurrentConflict,
            bool isSolvedConflict)
        {
            IncomingChangeInfo incomingChange = item.ChangeInfo;

            string label = incomingChange.GetColumnText(
                IncomingChangesTreeHeaderState.GetColumnName(column));

            if (column == IncomingChangesTreeColumn.Path)
            {
                if (incomingChangesTree.HasMeta(item.ChangeInfo))
                {
                    label = string.Concat(label, UnityConstants.TREEVIEW_META_LABEL);
                }

                Texture icon        = GetIcon(wkPath, incomingChange);
                Texture overlayIcon =
                    GetChangesOverlayIcon.ForGluonIncomingChange(
                        incomingChange, isSolvedConflict);

                bool wasChecked = incomingChange.IsChecked();

                bool isChecked = DrawTreeViewItem.ForCheckableItemCell(
                    rect, rowHeight, item.depth,
                    icon, overlayIcon, label,
                    isSelected, isFocused, isCurrentConflict,
                    wasChecked);

                incomingChange.UpdateCheckedState(isChecked);

                if (wasChecked != isChecked)
                {
                    UpdateCheckStateForSelection(treeView, item);
                    onCheckedNodeChanged();
                }

                return;
            }

            if (column == IncomingChangesTreeColumn.Size)
            {
                // If there is a meta file, add the meta file to the file size so that it is consistent
                // with the Incoming Changes overview
                if (incomingChangesTree.HasMeta(item.ChangeInfo))
                {
                    IncomingChangeInfo metaFileInfo = incomingChangesTree.GetMetaChange(incomingChange);
                    long metaFileSize = metaFileInfo.GetSize();
                    long fileSize     = incomingChange.GetSize();

                    label = SizeConverter.ConvertToSizeString(fileSize + metaFileSize);
                }

                DrawTreeViewItem.ForSecondaryLabelRightAligned(
                    rect, label, isSelected, isFocused, isCurrentConflict);
                return;
            }

            DrawTreeViewItem.ForSecondaryLabel(
                rect, label, isSelected, isFocused, isCurrentConflict);
        }