Exemplo n.º 1
0
        public void OnGUI(List <ColumnViewElement> elements, ColumnView.ObjectColumnFunction previewColumnFunction, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            ColumnView.InitStyles();
            this.m_ScrollPosition = GUILayout.BeginScrollView(this.m_ScrollPosition, new GUILayoutOption[0]);
            GUILayout.BeginHorizontal(new GUILayoutOption[0]);
            List <ColumnViewElement> list = elements;
            int    i = 0;
            object obj;

            do
            {
                if (this.m_ListViewStates.Count == i)
                {
                    this.m_ListViewStates.Add(new ListViewState());
                }
                if (this.m_CachedSelectedIndices.Count == i)
                {
                    this.m_CachedSelectedIndices.Add(-1);
                }
                ListViewState listViewState = this.m_ListViewStates[i];
                listViewState.totalRows = list.Count;
                if (i == 0)
                {
                    GUILayout.BeginVertical(new GUILayoutOption[]
                    {
                        GUILayout.MaxWidth(this.columnWidth)
                    });
                }
                int num = this.m_CachedSelectedIndices[i];
                num = this.DoListColumn(listViewState, list, i, num, (i != 0) ? null : selectedSearchItemFunction, selectedRegularItemFunction, getDataForDraggingFunction);
                if (Event.current.type == EventType.Layout && this.m_ColumnToFocusKeyboard == i)
                {
                    this.m_ColumnToFocusKeyboard = -1;
                    GUIUtility.keyboardControl   = listViewState.ID;
                    if (listViewState.row == -1 && list.Count != 0)
                    {
                        num = (listViewState.row = 0);
                    }
                }
                if (i == 0)
                {
                    if (this.isSearching)
                    {
                        KeyCode keyCode = ColumnView.StealImportantListviewKeys();
                        if (keyCode != KeyCode.None)
                        {
                            ListViewShared.SendKey(this.m_ListViewStates[0], keyCode);
                        }
                    }
                    this.m_SearchText = EditorGUILayout.ToolbarSearchField(this.m_SearchText, new GUILayoutOption[0]);
                    GUILayout.EndVertical();
                }
                if (num >= list.Count)
                {
                    num = -1;
                }
                if (Event.current.type == EventType.Layout && this.m_CachedSelectedIndices[i] != num && this.m_ListViewStates.Count > i + 1)
                {
                    int index = i + 1;
                    int count = this.m_ListViewStates.Count - (i + 1);
                    this.m_ListViewStates.RemoveRange(index, count);
                    this.m_CachedSelectedIndices.RemoveRange(index, count);
                }
                this.m_CachedSelectedIndices[i] = num;
                obj  = ((num <= -1) ? null : list[num].value);
                list = (obj as List <ColumnViewElement>);
                i++;
            }while (list != null);
            while (i < this.minimumNumberOfColumns)
            {
                this.DoDummyColumn();
                i++;
            }
            ColumnView.DoPreviewColumn(obj, previewColumnFunction);
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }
Exemplo n.º 2
0
 internal static Vector2 ListViewScrollToRow(ListViewShared.InternalListViewState ilvState, int row)
 {
     return(ListViewShared.ListViewScrollToRow(ilvState, ilvState.state.scrollPos, row));
 }
Exemplo n.º 3
0
 internal static int ListViewScrollToRow(ListViewShared.InternalListViewState ilvState, int currPosY, int row)
 {
     return((int)ListViewShared.ListViewScrollToRow(ilvState, new Vector2(0f, (float)currPosY), row).y);
 }
Exemplo n.º 4
0
 internal static bool HasMouseUp(ListViewShared.InternalListViewState ilvState, Rect r)
 {
     return(ListViewShared.HasMouseUp(ilvState, r, 0));
 }
Exemplo n.º 5
0
        internal static bool MultiSelection(ListViewShared.InternalListViewState ilvState, int prevSelected, int currSelected, ref int initialSelected, ref bool[] selectedItems)
        {
            bool shift     = Event.current.shift;
            bool actionKey = EditorGUI.actionKey;
            bool result    = false;

            if ((shift || actionKey) && initialSelected == -1)
            {
                initialSelected = prevSelected;
            }
            if (shift)
            {
                int num  = Math.Min(initialSelected, currSelected);
                int num2 = Math.Max(initialSelected, currSelected);
                if (!actionKey)
                {
                    for (int i = 0; i < num; i++)
                    {
                        if (selectedItems[i])
                        {
                            result = true;
                        }
                        selectedItems[i] = false;
                    }
                    for (int j = num2 + 1; j < selectedItems.Length; j++)
                    {
                        if (selectedItems[j])
                        {
                            result = true;
                        }
                        selectedItems[j] = false;
                    }
                }
                if (num < 0)
                {
                    num = num2;
                }
                for (int k = num; k <= num2; k++)
                {
                    if (!selectedItems[k])
                    {
                        result = true;
                    }
                    selectedItems[k] = true;
                }
            }
            else if (actionKey)
            {
                selectedItems[currSelected] = !selectedItems[currSelected];
                initialSelected             = currSelected;
                result = true;
            }
            else
            {
                if (!selectedItems[currSelected])
                {
                    result = true;
                }
                for (int l = 0; l < selectedItems.Length; l++)
                {
                    if (selectedItems[l] && currSelected != l)
                    {
                        result = true;
                    }
                    selectedItems[l] = false;
                }
                initialSelected             = -1;
                selectedItems[currSelected] = true;
            }
            if (ilvState != null)
            {
                ilvState.state.scrollPos = ListViewShared.ListViewScrollToRow(ilvState, currSelected);
            }
            return(result);
        }
Exemplo n.º 6
0
 internal static void SendKey(ListViewState state, KeyCode keyCode)
 {
     ListViewShared.SendKey(state.ilvState, keyCode, 1);
 }
Exemplo n.º 7
0
        internal static bool SendKey(ListViewShared.InternalListViewState ilvState, KeyCode keyCode, int totalCols)
        {
            ListViewState state = ilvState.state;
            bool          result;

            switch (keyCode)
            {
            case KeyCode.UpArrow:
                if (state.row > 0)
                {
                    state.row--;
                }
                goto IL_14C;

            case KeyCode.DownArrow:
                if (state.row < state.totalRows - 1)
                {
                    state.row++;
                }
                goto IL_14C;

            case KeyCode.RightArrow:
                if (state.column < totalCols - 1)
                {
                    state.column++;
                }
                goto IL_14C;

            case KeyCode.LeftArrow:
                if (state.column > 0)
                {
                    state.column--;
                }
                goto IL_14C;

            case KeyCode.Home:
                state.row = 0;
                goto IL_14C;

            case KeyCode.End:
                state.row = state.totalRows - 1;
                goto IL_14C;

            case KeyCode.PageUp:
                if (!ListViewShared.DoLVPageUpDown(ilvState, ref state.row, ref state.scrollPos, true))
                {
                    Event.current.Use();
                    result = false;
                    return(result);
                }
                goto IL_14C;

            case KeyCode.PageDown:
                if (!ListViewShared.DoLVPageUpDown(ilvState, ref state.row, ref state.scrollPos, false))
                {
                    Event.current.Use();
                    result = false;
                    return(result);
                }
                goto IL_14C;
            }
            result = false;
            return(result);

IL_14C:
            state.scrollPos = ListViewShared.ListViewScrollToRow(ilvState, state.scrollPos, state.row);
            Event.current.Use();
            result = true;
            return(result);
        }
Exemplo n.º 8
0
 public bool MoveNext()
 {
     if (this.xPos > -1)
     {
         if (ListViewShared.HasMouseDown(this.ilvState, this.rect))
         {
             this.ilvState.state.selectionChanged = true;
             this.ilvState.state.row       = this.yPos;
             this.ilvState.state.column    = this.xPos;
             this.ilvState.state.scrollPos = ListViewShared.ListViewScrollToRow(this.ilvState, this.yPos);
             if ((this.ilvState.wantsReordering || this.ilvState.wantsToStartCustomDrag) && GUIUtility.hotControl == this.ilvState.state.ID)
             {
                 DragAndDropDelay dragAndDropDelay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), this.ilvState.state.ID);
                 dragAndDropDelay.mouseDownPosition = Event.current.mousePosition;
                 this.ilvState.dragItem             = this.yPos;
                 ListViewShared.dragControlID       = this.ilvState.state.ID;
             }
         }
         if (!ListViewShared.isDragging && (this.ilvState.wantsReordering || this.ilvState.wantsToStartCustomDrag) && GUIUtility.hotControl == this.ilvState.state.ID && Event.current.type == EventType.MouseDrag && GUIClip.visibleRect.Contains(Event.current.mousePosition))
         {
             DragAndDropDelay dragAndDropDelay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), this.ilvState.state.ID);
             if (dragAndDropDelay2.CanStartDrag())
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new UnityEngine.Object[0];
                 DragAndDrop.paths            = null;
                 if (this.ilvState.wantsReordering)
                 {
                     this.ilvState.state.dropHereRect = new Rect(this.ilvState.rect.x, 0f, this.ilvState.rect.width, (float)(this.ilvState.state.rowHeight * 2));
                     DragAndDrop.StartDrag(this.dragTitle);
                 }
                 else if (this.ilvState.wantsToStartCustomDrag)
                 {
                     DragAndDrop.SetGenericData("CustomDragID", this.ilvState.state.ID);
                     DragAndDrop.StartDrag(this.dragTitle);
                 }
                 ListViewShared.isDragging = true;
             }
             Event.current.Use();
         }
     }
     this.xPos++;
     if (this.xPos > this.xTo)
     {
         this.xPos = 0;
         this.yPos++;
         this.rect.x     = this.firstRect.x;
         this.rect.width = (float)this.colWidths[0];
         if (this.yPos > this.yTo)
         {
             this.quiting = true;
         }
         else
         {
             this.rect.y = this.rect.y + this.rect.height;
         }
     }
     else
     {
         if (this.xPos >= 1)
         {
             this.rect.x = this.rect.x + (float)this.colWidths[this.xPos - 1];
         }
         this.rect.width = (float)this.colWidths[this.xPos];
     }
     this.element.row      = this.yPos;
     this.element.column   = this.xPos;
     this.element.position = this.rect;
     if (this.element.row >= this.ilvState.state.totalRows)
     {
         this.quiting = true;
     }
     if (this.isLayouted && Event.current.type == EventType.Layout)
     {
         if (this.yFrom + 1 == this.yPos)
         {
             this.quiting = true;
         }
     }
     if (this.isLayouted && this.yPos != this.yFrom)
     {
         GUILayout.EndHorizontal();
     }
     if (this.quiting)
     {
         if (this.ilvState.state.drawDropHere && Event.current.GetTypeForControl(this.ilvState.state.ID) == EventType.Repaint)
         {
             GUIStyle gUIStyle = ListViewShared.Constants.insertion;
             gUIStyle.Draw(gUIStyle.margin.Remove(this.ilvState.state.dropHereRect), false, false, false, false);
         }
         if (ListViewShared.ListViewKeyboard(this.ilvState, this.colWidths.Length))
         {
             this.ilvState.state.selectionChanged = true;
         }
         if (Event.current.GetTypeForControl(this.ilvState.state.ID) == EventType.MouseUp)
         {
             GUIUtility.hotControl = 0;
         }
         if (this.ilvState.wantsReordering && GUIUtility.hotControl == this.ilvState.state.ID)
         {
             ListViewState state = this.ilvState.state;
             EventType     type  = Event.current.type;
             if (type != EventType.DragUpdated)
             {
                 if (type != EventType.DragPerform)
                 {
                     if (type == EventType.DragExited)
                     {
                         this.ilvState.wantsReordering    = false;
                         this.ilvState.state.drawDropHere = false;
                         GUIUtility.hotControl            = 0;
                     }
                 }
                 else
                 {
                     if (GUIClip.visibleRect.Contains(Event.current.mousePosition))
                     {
                         this.ilvState.state.draggedFrom = this.ilvState.dragItem;
                         this.ilvState.state.draggedTo   = Mathf.RoundToInt(Event.current.mousePosition.y / (float)state.rowHeight);
                         if (this.ilvState.state.draggedTo > this.ilvState.state.totalRows)
                         {
                             this.ilvState.state.draggedTo = this.ilvState.state.totalRows;
                         }
                         if (this.ilvState.state.draggedTo > this.ilvState.state.draggedFrom)
                         {
                             this.ilvState.state.row = this.ilvState.state.draggedTo - 1;
                         }
                         else
                         {
                             this.ilvState.state.row = this.ilvState.state.draggedTo;
                         }
                         this.ilvState.state.selectionChanged = true;
                         DragAndDrop.AcceptDrag();
                         Event.current.Use();
                         this.ilvState.wantsReordering    = false;
                         this.ilvState.state.drawDropHere = false;
                     }
                     GUIUtility.hotControl = 0;
                 }
             }
             else
             {
                 DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Move);
                 Event.current.Use();
                 if (DragAndDrop.visualMode != DragAndDropVisualMode.None)
                 {
                     state.dropHereRect.y = (float)((Mathf.RoundToInt(Event.current.mousePosition.y / (float)state.rowHeight) - 1) * state.rowHeight);
                     if (state.dropHereRect.y >= (float)(state.rowHeight * state.totalRows))
                     {
                         state.dropHereRect.y = (float)(state.rowHeight * (state.totalRows - 1));
                     }
                     state.drawDropHere = true;
                 }
             }
         }
         else if (this.ilvState.wantsExternalFiles)
         {
             EventType type2 = Event.current.type;
             if (type2 != EventType.DragUpdated)
             {
                 if (type2 != EventType.DragPerform)
                 {
                     if (type2 == EventType.DragExited)
                     {
                         this.ilvState.wantsExternalFiles = false;
                         this.ilvState.state.drawDropHere = false;
                         GUIUtility.hotControl            = 0;
                     }
                 }
                 else
                 {
                     if (GUIClip.visibleRect.Contains(Event.current.mousePosition))
                     {
                         this.ilvState.state.fileNames = DragAndDrop.paths;
                         DragAndDrop.AcceptDrag();
                         Event.current.Use();
                         this.ilvState.wantsExternalFiles = false;
                         this.ilvState.state.drawDropHere = false;
                         this.ilvState.state.draggedTo    = Mathf.RoundToInt(Event.current.mousePosition.y / (float)this.ilvState.state.rowHeight);
                         if (this.ilvState.state.draggedTo > this.ilvState.state.totalRows)
                         {
                             this.ilvState.state.draggedTo = this.ilvState.state.totalRows;
                         }
                         this.ilvState.state.row = this.ilvState.state.draggedTo;
                     }
                     GUIUtility.hotControl = 0;
                 }
             }
             else if (GUIClip.visibleRect.Contains(Event.current.mousePosition) && DragAndDrop.paths != null && DragAndDrop.paths.Length != 0)
             {
                 DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Copy);
                 Event.current.Use();
                 if (DragAndDrop.visualMode != DragAndDropVisualMode.None)
                 {
                     this.ilvState.state.dropHereRect = new Rect(this.ilvState.rect.x, (float)((Mathf.RoundToInt(Event.current.mousePosition.y / (float)this.ilvState.state.rowHeight) - 1) * this.ilvState.state.rowHeight), this.ilvState.rect.width, (float)this.ilvState.state.rowHeight);
                     if (this.ilvState.state.dropHereRect.y >= (float)(this.ilvState.state.rowHeight * this.ilvState.state.totalRows))
                     {
                         this.ilvState.state.dropHereRect.y = (float)(this.ilvState.state.rowHeight * (this.ilvState.state.totalRows - 1));
                     }
                     this.ilvState.state.drawDropHere = true;
                 }
             }
         }
         else if (this.ilvState.wantsToAcceptCustomDrag && ListViewShared.dragControlID != this.ilvState.state.ID)
         {
             EventType type3 = Event.current.type;
             if (type3 != EventType.DragUpdated)
             {
                 if (type3 != EventType.DragPerform)
                 {
                     if (type3 == EventType.DragExited)
                     {
                         GUIUtility.hotControl = 0;
                     }
                 }
                 else
                 {
                     object genericData = DragAndDrop.GetGenericData("CustomDragID");
                     if (GUIClip.visibleRect.Contains(Event.current.mousePosition) && genericData != null)
                     {
                         this.ilvState.state.customDraggedFromID = (int)genericData;
                         DragAndDrop.AcceptDrag();
                         Event.current.Use();
                     }
                     GUIUtility.hotControl = 0;
                 }
             }
             else
             {
                 object genericData2 = DragAndDrop.GetGenericData("CustomDragID");
                 if (GUIClip.visibleRect.Contains(Event.current.mousePosition) && genericData2 != null)
                 {
                     DragAndDrop.visualMode = ((!this.ilvState.rect.Contains(Event.current.mousePosition)) ? DragAndDropVisualMode.None : DragAndDropVisualMode.Move);
                     Event.current.Use();
                 }
             }
         }
         if (this.ilvState.beganHorizontal)
         {
             EditorGUILayout.EndScrollView();
             GUILayout.EndHorizontal();
             this.ilvState.beganHorizontal = false;
         }
         if (this.isLayouted)
         {
             GUILayoutUtility.EndLayoutGroup();
             EditorGUILayout.EndScrollView();
         }
         this.ilvState.wantsReordering    = false;
         this.ilvState.wantsExternalFiles = false;
     }
     else if (this.isLayouted)
     {
         if (this.yPos != this.yFrom)
         {
             this.ilvStateL.group.ResetCursor();
             this.ilvStateL.group.AddY();
         }
         else
         {
             this.ilvStateL.group.AddY((float)(this.ilvState.invisibleRows * this.ilvState.state.rowHeight));
         }
     }
     if (this.isLayouted)
     {
         if (!this.quiting)
         {
             GUILayout.BeginHorizontal(GUIStyle.none, new GUILayoutOption[0]);
         }
         else
         {
             GUILayout.EndHorizontal();
         }
     }
     return(!this.quiting);
 }
Exemplo n.º 9
0
        internal static bool ListViewKeyboard(ListViewShared.InternalListViewState ilvState, int totalCols)
        {
            int totalRows = ilvState.state.totalRows;

            return(Event.current.type == EventType.KeyDown && totalRows != 0 && GUIUtility.keyboardControl == ilvState.state.ID && Event.current.GetTypeForControl(ilvState.state.ID) == EventType.KeyDown && ListViewShared.SendKey(ilvState, Event.current.keyCode, totalCols));
        }
Exemplo n.º 10
0
 public static bool HasMouseUp(Rect r)
 {
     return(ListViewShared.HasMouseUp(ListViewGUILayout.lvState.ilvState, r, 0));
 }
Exemplo n.º 11
0
 public static bool HasMouseDown(Rect r, int button)
 {
     return(ListViewShared.HasMouseDown(ListViewGUILayout.lvState.ilvState, r, button));
 }
Exemplo n.º 12
0
 public static bool MultiSelection(int prevSelected, int currSelected, ref int initialSelected, ref bool[] selectedItems)
 {
     return(ListViewShared.MultiSelection(ListViewGUILayout.lvState.ilvState, prevSelected, currSelected, ref initialSelected, ref selectedItems));
 }
Exemplo n.º 13
0
        public void OnGUI(List <ColumnViewElement> elements, ColumnView.ObjectColumnFunction previewColumnFunction, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            ColumnView.InitStyles();
            this.m_ScrollPosition = GUILayout.BeginScrollView(this.m_ScrollPosition);
            GUILayout.BeginHorizontal();
            List <ColumnViewElement> columnViewElements = elements;
            int    columnIndex = 0;
            object selectedObject;

            do
            {
                if (this.m_ListViewStates.Count == columnIndex)
                {
                    this.m_ListViewStates.Add(new ListViewState());
                }
                if (this.m_CachedSelectedIndices.Count == columnIndex)
                {
                    this.m_CachedSelectedIndices.Add(-1);
                }
                ListViewState listViewState = this.m_ListViewStates[columnIndex];
                listViewState.totalRows = columnViewElements.Count;
                if (columnIndex == 0)
                {
                    GUILayout.BeginVertical(GUILayout.MaxWidth(this.columnWidth));
                }
                int cachedSelectedIndex = this.m_CachedSelectedIndices[columnIndex];
                int index1 = this.DoListColumn(listViewState, columnViewElements, columnIndex, cachedSelectedIndex, columnIndex != 0 ? (ColumnView.ObjectColumnFunction)null : selectedSearchItemFunction, selectedRegularItemFunction, getDataForDraggingFunction);
                if (Event.current.type == EventType.Layout && this.m_ColumnToFocusKeyboard == columnIndex)
                {
                    this.m_ColumnToFocusKeyboard = -1;
                    GUIUtility.keyboardControl   = listViewState.ID;
                    if (listViewState.row == -1 && columnViewElements.Count != 0)
                    {
                        index1 = listViewState.row = 0;
                    }
                }
                if (columnIndex == 0)
                {
                    if (this.isSearching)
                    {
                        KeyCode keyCode = ColumnView.StealImportantListviewKeys();
                        if (keyCode != KeyCode.None)
                        {
                            ListViewShared.SendKey(this.m_ListViewStates[0], keyCode);
                        }
                    }
                    this.m_SearchText = EditorGUILayout.ToolbarSearchField(this.m_SearchText);
                    GUILayout.EndVertical();
                }
                if (index1 >= columnViewElements.Count)
                {
                    index1 = -1;
                }
                if (Event.current.type == EventType.Layout && this.m_CachedSelectedIndices[columnIndex] != index1 && this.m_ListViewStates.Count > columnIndex + 1)
                {
                    int index2 = columnIndex + 1;
                    int count  = this.m_ListViewStates.Count - (columnIndex + 1);
                    this.m_ListViewStates.RemoveRange(index2, count);
                    this.m_CachedSelectedIndices.RemoveRange(index2, count);
                }
                this.m_CachedSelectedIndices[columnIndex] = index1;
                selectedObject     = index1 <= -1 ? (object)null : columnViewElements[index1].value;
                columnViewElements = selectedObject as List <ColumnViewElement>;
                ++columnIndex;
            }while (columnViewElements != null);
            for (; columnIndex < this.minimumNumberOfColumns; ++columnIndex)
            {
                this.DoDummyColumn();
            }
            ColumnView.DoPreviewColumn(selectedObject, previewColumnFunction);
            GUILayout.EndHorizontal();
            GUILayout.EndScrollView();
        }
Exemplo n.º 14
0
        public void DoDeletedItemsGUI(ASHistoryWindow parentWin, Rect theRect, GUIStyle s, float offset, float endOffset, bool focused)
        {
            Event     current = Event.current;
            Texture2D image   = EditorGUIUtility.FindTexture(EditorResourcesUtility.folderIconName);

            offset += 3f;
            Rect position = new Rect(this.m_Indent, offset, theRect.width - this.m_Indent, ASHistoryFileView.m_RowHeight);

            if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
            {
                GUIUtility.keyboardControl = this.m_FileViewControlID;
                this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                this.ScrollToDeletedItem(-1);
                parentWin.DoLocalSelectionChange();
            }
            position.width -= position.x;
            position.x      = 0f;
            GUIContent gUIContent = new GUIContent("Deleted Assets");

            gUIContent.image = image;
            int left = (int)this.m_BaseIndent;

            s.padding.left = left;
            if (current.type == EventType.Repaint)
            {
                s.Draw(position, gUIContent, false, false, this.SelType == ASHistoryFileView.SelectionType.DeletedItemsRoot, focused);
            }
            Rect position2 = new Rect(this.m_BaseIndent - this.m_FoldoutSize, offset, this.m_FoldoutSize, ASHistoryFileView.m_RowHeight);

            if (!this.m_DeletedItemsInitialized || this.m_DelPVstate.lv.totalRows != 0)
            {
                this.DeletedItemsToggle = GUI.Toggle(position2, this.DeletedItemsToggle, GUIContent.none, ASHistoryFileView.ms_Styles.foldout);
            }
            offset += ASHistoryFileView.m_RowHeight;
            if (!this.DeletedItemsToggle)
            {
                return;
            }
            int row  = this.m_DelPVstate.lv.row;
            int num  = 0;
            int num2 = -1;
            int num3 = -1;
            int num4 = 0;

            while (offset <= endOffset && num4 < this.m_DelPVstate.lv.totalRows)
            {
                if (offset + ASHistoryFileView.m_RowHeight >= 0f)
                {
                    if (num2 == -1)
                    {
                        this.m_DelPVstate.IndexToFolderAndFile(num4, ref num2, ref num3);
                    }
                    position = new Rect(0f, offset, (float)Screen.width, ASHistoryFileView.m_RowHeight);
                    ParentViewFolder parentViewFolder = this.m_DelPVstate.folders[num2];
                    if (current.type == EventType.MouseDown && position.Contains(current.mousePosition))
                    {
                        if (current.button != 1 || this.SelType != ASHistoryFileView.SelectionType.DeletedItems || !this.m_DelPVstate.selectedItems[num])
                        {
                            GUIUtility.keyboardControl = this.m_FileViewControlID;
                            this.SelType             = ASHistoryFileView.SelectionType.DeletedItems;
                            this.m_DelPVstate.lv.row = num;
                            ListViewShared.MultiSelection(null, row, this.m_DelPVstate.lv.row, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                            this.ScrollToDeletedItem(num);
                            parentWin.DoLocalSelectionChange();
                        }
                        if (current.button == 1 && this.SelType == ASHistoryFileView.SelectionType.DeletedItems)
                        {
                            GUIUtility.hotControl = 0;
                            Rect position3 = new Rect(current.mousePosition.x, current.mousePosition.y, 1f, 1f);
                            EditorUtility.DisplayCustomMenu(position3, this.dropDownMenuItems, -1, new EditorUtility.SelectMenuItemFunction(this.ContextMenuClick), null);
                        }
                        Event.current.Use();
                    }
                    if (num3 != -1)
                    {
                        gUIContent.text  = parentViewFolder.files[num3].name;
                        gUIContent.image = InternalEditorUtility.GetIconForFile(parentViewFolder.files[num3].name);
                        left             = (int)(this.m_BaseIndent + this.m_Indent * 2f);
                    }
                    else
                    {
                        gUIContent.text  = parentViewFolder.name;
                        gUIContent.image = image;
                        left             = (int)(this.m_BaseIndent + this.m_Indent);
                    }
                    s.padding.left = left;
                    if (Event.current.type == EventType.Repaint)
                    {
                        s.Draw(position, gUIContent, false, false, this.m_DelPVstate.selectedItems[num], focused);
                    }
                    this.m_DelPVstate.NextFileFolder(ref num2, ref num3);
                    num++;
                }
                num4++;
                offset += ASHistoryFileView.m_RowHeight;
            }
        }
Exemplo n.º 15
0
        private void DeletedItemsKeyboard(ASHistoryWindow parentWin)
        {
            int row = this.m_DelPVstate.lv.row;
            int num = row;

            if (!this.DeletedItemsToggle)
            {
                return;
            }
            switch (Event.current.keyCode)
            {
            case KeyCode.UpArrow:
                if (num > 0)
                {
                    num--;
                }
                else
                {
                    this.SelType = ASHistoryFileView.SelectionType.DeletedItemsRoot;
                    this.ScrollToDeletedItem(-1);
                    parentWin.DoLocalSelectionChange();
                }
                goto IL_1AE;

            case KeyCode.DownArrow:
                if (num < this.m_DelPVstate.lv.totalRows - 1)
                {
                    num++;
                }
                goto IL_1AE;

            case KeyCode.Home:
                num = 0;
                goto IL_1AE;

            case KeyCode.End:
                num = this.m_DelPVstate.lv.totalRows - 1;
                goto IL_1AE;

            case KeyCode.PageUp:
                if (ASHistoryFileView.OSX)
                {
                    this.m_ScrollPosition.y = this.m_ScrollPosition.y - this.m_ScreenRect.height;
                    if (this.m_ScrollPosition.y < 0f)
                    {
                        this.m_ScrollPosition.y = 0f;
                    }
                }
                else
                {
                    num -= (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
                    if (num < 0)
                    {
                        num = 0;
                    }
                }
                goto IL_1AE;

            case KeyCode.PageDown:
                if (ASHistoryFileView.OSX)
                {
                    this.m_ScrollPosition.y = this.m_ScrollPosition.y + this.m_ScreenRect.height;
                }
                else
                {
                    num += (int)(this.m_ScreenRect.height / ASHistoryFileView.m_RowHeight);
                    if (num > this.m_DelPVstate.lv.totalRows - 1)
                    {
                        num = this.m_DelPVstate.lv.totalRows - 1;
                    }
                }
                goto IL_1AE;
            }
            return;

IL_1AE:
            Event.current.Use();
            if (num != row)
            {
                this.m_DelPVstate.lv.row = num;
                ListViewShared.MultiSelection(null, row, num, ref this.m_DelPVstate.initialSelectedItem, ref this.m_DelPVstate.selectedItems);
                this.ScrollToDeletedItem(num);
                parentWin.DoLocalSelectionChange();
            }
        }
Exemplo n.º 16
0
 public static bool HasMouseUp(Rect r)
 {
     return(ListViewShared.HasMouseUp(ilvState, r, 0));
 }