public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
		{
			ListViewGUILayout.lvState = state;
			GUILayout.BeginHorizontal(style, options);
			state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
			ListViewGUILayout.BeginLayoutedListview(state, GUIStyle.none, new GUILayoutOption[0]);
			state.draggedFrom = -1;
			state.draggedTo = -1;
			state.fileNames = null;
			if ((lvOptions & ListViewOptions.wantsReordering) != (ListViewOptions)0)
			{
				state.ilvState.wantsReordering = true;
			}
			if ((lvOptions & ListViewOptions.wantsExternalFiles) != (ListViewOptions)0)
			{
				state.ilvState.wantsExternalFiles = true;
			}
			if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != (ListViewOptions)0)
			{
				state.ilvState.wantsToStartCustomDrag = true;
			}
			if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != (ListViewOptions)0)
			{
				state.ilvState.wantsToAcceptCustomDrag = true;
			}
			return ListViewGUILayout.DoListView(state, null, dragTitle);
		}
Пример #2
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && element.position.Contains(Event.current.mousePosition) && Event.current.button == 0)
     {
         DragAndDropDelay dragAndDropDelay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         dragAndDropDelay.mouseDownPosition = Event.current.mousePosition;
     }
     if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDrag && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay dragAndDropDelay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (dragAndDropDelay2.CanStartDrag())
         {
             object obj = (getDataForDraggingFunction != null) ? getDataForDraggingFunction(columnViewElements[listView.row].value) : null;
             if (obj == null)
             {
                 return;
             }
             DragAndDrop.PrepareStartDrag();
             DragAndDrop.objectReferences = new UnityEngine.Object[0];
             DragAndDrop.paths            = null;
             DragAndDrop.SetGenericData("CustomDragData", obj);
             DragAndDrop.StartDrag(columnViewElements[listView.row].name);
             Event.current.Use();
         }
     }
 }
Пример #3
0
        private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown &&
                element.position.Contains(Event.current.mousePosition) &&
                Event.current.button == 0)
            {
                var delay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
                delay.mouseDownPosition = Event.current.mousePosition;
            }

            if (GUIUtility.hotControl == listView.ID &&
                Event.current.type == EventType.MouseDrag &&
                GUIClip.visibleRect.Contains(Event.current.mousePosition))
            {
                var delay = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);

                if (delay.CanStartDrag())
                {
                    var data = getDataForDraggingFunction == null ? null :
                               getDataForDraggingFunction(columnViewElements[listView.row].value);

                    if (data == null)
                    {
                        return;
                    }

                    DragAndDrop.PrepareStartDrag();
                    DragAndDrop.SetGenericData("CustomDragData", data);
                    DragAndDrop.StartDrag(columnViewElements[listView.row].name);

                    Event.current.Use();
                }
            }
        }
Пример #4
0
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, int[] colWidths, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
     GUILayout.BeginHorizontal(style, new GUILayoutOption[0]);
     state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
     ListViewGUI.ilvState.beganHorizontal = true;
     state.draggedFrom = -1;
     state.draggedTo   = -1;
     state.fileNames   = null;
     if ((lvOptions & ListViewOptions.wantsReordering) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsReordering = true;
     }
     if ((lvOptions & ListViewOptions.wantsExternalFiles) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsExternalFiles = true;
     }
     if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsToStartCustomDrag = true;
     }
     if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != (ListViewOptions)0)
     {
         ListViewGUI.ilvState.wantsToAcceptCustomDrag = true;
     }
     return(ListViewGUI.DoListView(GUILayoutUtility.GetRect(1f, (float)(state.totalRows * state.rowHeight + 3)), state, colWidths, string.Empty));
 }
Пример #5
0
 private int DoListColumn(ListViewState listView, List <ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
     {
         if (this.isSearching && selectedSearchItemFunction != null)
         {
             this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
         }
         if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
         {
             ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
         }
     }
     if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
     {
         KeyCode keyCode = Event.current.keyCode;
         if (keyCode != KeyCode.RightArrow)
         {
             if (keyCode == KeyCode.LeftArrow)
             {
                 this.m_ColumnToFocusKeyboard = columnIndex - 1;
                 Event.current.Use();
             }
         }
         else
         {
             this.m_ColumnToFocusKeyboard = columnIndex + 1;
             Event.current.Use();
         }
     }
     foreach (ListViewElement element in ListViewGUILayout.ListView(listView, ColumnView.s_Styles.background, new GUILayoutOption[]
     {
         GUILayout.Width(this.columnWidth)
     }))
     {
         ColumnViewElement columnViewElement = columnViewElements[element.row];
         if (element.row == listView.row && Event.current.type == EventType.Repaint)
         {
             Rect position = element.position;
             position.x += 1f;
             position.y += 1f;
             ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
         }
         GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
         if (columnViewElement.value is List <ColumnViewElement> )
         {
             Rect position2 = element.position;
             position2.x  = position2.xMax - (float)ColumnView.s_Styles.categoryArrowIcon.width - 5f;
             position2.y += 2f;
             GUI.Label(position2, ColumnView.s_Styles.categoryArrowIcon);
         }
         this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
         ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
     }
     if (Event.current.type == EventType.Layout)
     {
         selectedIndex = listView.row;
     }
     return(selectedIndex);
 }
 private void OnEnable()
 {
     TizenUtilities.PrepareToolPaths();
     this.m_ListView = new ListViewState(0, 0x20);
     this.RefreshDeviceList();
     this.m_ListView.totalRows = this.m_DeviceList.Length;
 }
Пример #7
0
 public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
 {
   int controlId = GUIUtility.GetControlID(ListViewGUI.listViewHash, FocusType.Native);
   state.ID = controlId;
   state.selectionChanged = false;
   Rect rect = (double) GUIClip.visibleRect.x < 0.0 || (double) GUIClip.visibleRect.y < 0.0 ? pos : ((double) pos.y >= 0.0 ? new Rect(0.0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0.0f, 0.0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height));
   if ((double) rect.width <= 0.0)
     rect.width = 1f;
   if ((double) rect.height <= 0.0)
     rect.height = 1f;
   ListViewGUI.ilvState.rect = rect;
   int yFrom = (int) ((-(double) pos.y + (double) rect.yMin) / (double) state.rowHeight);
   int yTo = yFrom + (int) Math.Ceiling((((double) rect.yMin - (double) pos.y) % (double) state.rowHeight + (double) rect.height) / (double) state.rowHeight) - 1;
   if (colWidths == null)
   {
     ListViewGUI.dummyWidths[0] = (int) rect.width;
     colWidths = ListViewGUI.dummyWidths;
   }
   ListViewGUI.ilvState.invisibleRows = yFrom;
   ListViewGUI.ilvState.endRow = yTo;
   ListViewGUI.ilvState.rectHeight = (int) rect.height;
   ListViewGUI.ilvState.state = state;
   if (yFrom < 0)
     yFrom = 0;
   if (yTo >= state.totalRows)
     yTo = state.totalRows - 1;
   return new ListViewShared.ListViewElementsEnumerator(ListViewGUI.ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0.0f, (float) (yFrom * state.rowHeight), pos.width, (float) state.rowHeight));
 }
 private void OnEnable()
 {
     this.InitUnetBroadcastDiscovery();
     this.m_ListView = new ListViewState(0, 0x20);
     this.RefreshDeviceList();
     this.m_ListView.totalRows = this.m_DeviceList.Count;
 }
Пример #9
0
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
     ListViewGUILayout.lvState = state;
     GUILayout.BeginHorizontal(style, options);
     state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
     ListViewGUILayout.BeginLayoutedListview(state, GUIStyle.none);
     state.draggedFrom = -1;
     state.draggedTo   = -1;
     state.fileNames   = (string[])null;
     if ((lvOptions & ListViewOptions.wantsReordering) != (ListViewOptions)0)
     {
         state.ilvState.wantsReordering = true;
     }
     if ((lvOptions & ListViewOptions.wantsExternalFiles) != (ListViewOptions)0)
     {
         state.ilvState.wantsExternalFiles = true;
     }
     if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != (ListViewOptions)0)
     {
         state.ilvState.wantsToStartCustomDrag = true;
     }
     if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != (ListViewOptions)0)
     {
         state.ilvState.wantsToAcceptCustomDrag = true;
     }
     return(ListViewGUILayout.DoListView(state, (int[])null, dragTitle));
 }
Пример #10
0
 public ConsoleWindow()
 {
     position     = new Rect(200, 200, 800, 400);
     m_ListView   = new ListViewState(0, 0);
     m_SearchText = string.Empty;
     EditorGUI.hyperLinkClicked += EditorGUI_HyperLinkClicked;
 }
Пример #11
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDown)) && (element.position.Contains(Event.current.mousePosition) && (Event.current.button == 0)))
     {
         DragAndDropDelay stateObject = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         stateObject.mouseDownPosition = Event.current.mousePosition;
     }
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDrag)) && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay delay2 = (DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (delay2.CanStartDrag())
         {
             object data = getDataForDraggingFunction?.Invoke(columnViewElements[listView.row].value);
             if (data != null)
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new UnityEngine.Object[0];
                 DragAndDrop.paths            = null;
                 DragAndDrop.SetGenericData("CustomDragData", data);
                 DragAndDrop.StartDrag(columnViewElements[listView.row].name);
                 Event.current.Use();
             }
         }
     }
 }
Пример #12
0
		public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, int[] colWidths, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
		{
			GUILayout.BeginHorizontal(style, new GUILayoutOption[0]);
			state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
			ListViewGUI.ilvState.beganHorizontal = true;
			state.draggedFrom = -1;
			state.draggedTo = -1;
			state.fileNames = null;
			if ((lvOptions & ListViewOptions.wantsReordering) != (ListViewOptions)0)
			{
				ListViewGUI.ilvState.wantsReordering = true;
			}
			if ((lvOptions & ListViewOptions.wantsExternalFiles) != (ListViewOptions)0)
			{
				ListViewGUI.ilvState.wantsExternalFiles = true;
			}
			if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != (ListViewOptions)0)
			{
				ListViewGUI.ilvState.wantsToStartCustomDrag = true;
			}
			if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != (ListViewOptions)0)
			{
				ListViewGUI.ilvState.wantsToAcceptCustomDrag = true;
			}
			return ListViewGUI.DoListView(GUILayoutUtility.GetRect(1f, (float)(state.totalRows * state.rowHeight + 3)), state, colWidths, string.Empty);
		}
 private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
 {
   Rect rect = ListViewGUILayout.dummyRect;
   int yFrom = 0;
   int yTo = 0;
   ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
   int controlId = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Native);
   state.ID = controlId;
   state.selectionChanged = false;
   ilvState.state = state;
   if (Event.current.type != EventType.Layout)
   {
     rect = new Rect(0.0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
     if ((double) rect.width <= 0.0)
       rect.width = 1f;
     if ((double) rect.height <= 0.0)
       rect.height = 1f;
     state.ilvState.rect = rect;
     yFrom = (int) rect.yMin / state.rowHeight;
     yTo = yFrom + (int) Math.Ceiling(((double) rect.yMin % (double) state.rowHeight + (double) rect.height) / (double) state.rowHeight) - 1;
     ilvState.invisibleRows = yFrom;
     ilvState.endRow = yTo;
     ilvState.rectHeight = (int) rect.height;
     if (yFrom < 0)
       yFrom = 0;
     if (yTo >= state.totalRows)
       yTo = state.totalRows - 1;
   }
   if (colWidths == null)
   {
     ListViewGUILayout.dummyWidths[0] = (int) rect.width;
     colWidths = ListViewGUILayout.dummyWidths;
   }
   return new ListViewShared.ListViewElementsEnumerator((ListViewShared.InternalListViewState) ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0.0f, (float) (yFrom * state.rowHeight), rect.width, (float) state.rowHeight));
 }
        static public ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
        {
            lvState = state;

            GUILayout.BeginHorizontal(style, options); // no good reason for this here, except drawing LVs background

            state.scrollPos = EditorGUILayout.BeginScrollView(state.scrollPos, options);
            BeginLayoutedListview(state, GUIStyle.none);

            state.draggedFrom = -1;
            state.draggedTo   = -1;
            state.fileNames   = null;

            if ((lvOptions & ListViewOptions.wantsReordering) != 0)
            {
                state.ilvState.wantsReordering = true;
            }
            if ((lvOptions & ListViewOptions.wantsExternalFiles) != 0)
            {
                state.ilvState.wantsExternalFiles = true;
            }
            if ((lvOptions & ListViewOptions.wantsToStartCustomDrag) != 0)
            {
                state.ilvState.wantsToStartCustomDrag = true;
            }
            if ((lvOptions & ListViewOptions.wantsToAcceptCustomDrag) != 0)
            {
                state.ilvState.wantsToAcceptCustomDrag = true;
            }

            return(DoListView(state, null, dragTitle));
        }
Пример #15
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List<ColumnViewElement> columnViewElements, ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDown)) && (element.position.Contains(Event.current.mousePosition) && (Event.current.button == 0)))
     {
         DragAndDropDelay stateObject = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         stateObject.mouseDownPosition = Event.current.mousePosition;
     }
     if (((GUIUtility.hotControl == listView.ID) && (Event.current.type == EventType.MouseDrag)) && GUIClip.visibleRect.Contains(Event.current.mousePosition))
     {
         DragAndDropDelay delay2 = (DragAndDropDelay) GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID);
         if (delay2.CanStartDrag())
         {
             object data = (getDataForDraggingFunction != null) ? getDataForDraggingFunction(columnViewElements[listView.row].value) : null;
             if (data != null)
             {
                 DragAndDrop.PrepareStartDrag();
                 DragAndDrop.objectReferences = new Object[0];
                 DragAndDrop.paths = null;
                 DragAndDrop.SetGenericData("CustomDragData", data);
                 DragAndDrop.StartDrag(columnViewElements[listView.row].name);
                 Event.current.Use();
             }
         }
     }
 }
Пример #16
0
 public ConsoleWindow()
 {
     position     = new Rect(200, 200, 800, 400);
     m_ListView   = new ListViewState(0, 0);
     m_CopyString = new StringBuilder();
     m_SearchText = string.Empty;
 }
Пример #17
0
 public ConsoleWindow()
 {
     float[] relativeSizes = new float[] { 70f, 30f };
     int[] minSizes = new int[] { 0x20, 0x20 };
     this.spl = new SplitterState(relativeSizes, minSizes, null);
     base.position = new Rect(200f, 200f, 800f, 400f);
     this.m_ListView = new ListViewState(0, 0x20);
 }
Пример #18
0
 public ConsoleWindow()
 {
     float[] relativeSizes = new float[] { 70f, 30f };
     int[]   minSizes      = new int[] { 0x20, 0x20 };
     this.spl        = new SplitterState(relativeSizes, minSizes, null);
     base.position   = new Rect(200f, 200f, 800f, 400f);
     this.m_ListView = new ListViewState(0, 0x20);
 }
 public ASServerAdminWindow(ASMainWindow parentWin)
 {
   this.lv = new ListViewState(0);
   this.lv2 = new ListViewState(0);
   this.parentWin = parentWin;
   this.servers = InternalEditorUtility.GetEditorSettingsList("ASServer", 20);
   this.server = EditorPrefs.GetString("ASAdminServer");
   this.user = "******";
 }
Пример #20
0
 public ASServerAdminWindow(ASMainWindow parentWin)
 {
     this.lv        = new ListViewState(0);
     this.lv2       = new ListViewState(0);
     this.parentWin = parentWin;
     this.servers   = InternalEditorUtility.GetEditorSettingsList("ASServer", 20);
     this.server    = EditorPrefs.GetString("ASAdminServer");
     this.user      = "******";
 }
Пример #21
0
        static public ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
        {
            int id = GUIUtility.GetControlID(listViewHash, FocusType.Passive);

            state.ID = id;

            state.selectionChanged = false;

            Rect vRect;

            if ((GUIClip.visibleRect.x < 0) || (GUIClip.visibleRect.y < 0)) // TODO: this is needed for simple LVs to work. we are not in a clip at all.
            {
                vRect = pos;
            }
            else
            {
                vRect = (pos.y < 0) ? new Rect(0, 0, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height); // check if this is custom scroll
            }
            if (vRect.width <= 0)
            {
                vRect.width = 1;
            }
            if (vRect.height <= 0)
            {
                vRect.height = 1;
            }

            ilvState.rect = vRect;

            int invisibleRows = (int)((-pos.y + vRect.yMin) / state.rowHeight);
            int endRow        = invisibleRows + (int)System.Math.Ceiling((((vRect.yMin - pos.y) % state.rowHeight) + vRect.height) / state.rowHeight) - 1;

            if (colWidths == null)
            {
                dummyWidths[0] = (int)vRect.width;
                colWidths      = dummyWidths;
            }

            ilvState.invisibleRows = invisibleRows;
            ilvState.endRow        = endRow;
            ilvState.rectHeight    = (int)vRect.height;
            ilvState.state         = state;

            if (invisibleRows < 0)
            {
                invisibleRows = 0;
            }

            if (endRow >= state.totalRows)
            {
                endRow = state.totalRows - 1;
            }

            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, invisibleRows, endRow, dragTitle, new Rect(0, invisibleRows * state.rowHeight, pos.width, state.rowHeight)));
        }
Пример #22
0
 public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
 {
   this.changesets = changesets;
   this.parentWin = parentWin;
   this.lv = new ListViewState(changesets.Length, 5);
   this.pv.lv = new ListViewState(0, 5);
   this.messageFirstLines = new string[changesets.Length];
   for (int index = 0; index < changesets.Length; ++index)
     this.messageFirstLines[index] = changesets[index].message.Split('\n')[0];
   this.totalUpdates = changesets.Length.ToString() + (changesets.Length != 1 ? " Updates" : " Update");
 }
Пример #23
0
 public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
 {
     this.changesets        = changesets;
     this.parentWin         = parentWin;
     this.lv                = new ListViewState(changesets.Length, 5);
     this.pv.lv             = new ListViewState(0, 5);
     this.messageFirstLines = new string[changesets.Length];
     for (int index = 0; index < changesets.Length; ++index)
     {
         this.messageFirstLines[index] = changesets[index].message.Split('\n')[0];
     }
     this.totalUpdates = changesets.Length.ToString() + (changesets.Length != 1 ? " Updates" : " Update");
 }
Пример #24
0
 private static void BeginLayoutedListview(ListViewState state, GUIStyle style, params GUILayoutOption[] options)
 {
     GUILayoutedListViewGroup group = (GUILayoutedListViewGroup) GUILayoutUtility.BeginLayoutGroup(style, null, typeof(GUILayoutedListViewGroup));
     group.state = state;
     state.ilvState.group = group;
     GUIUtility.GetControlID(layoutedListViewHash, FocusType.Passive);
     if (Event.current.type == EventType.Layout)
     {
         group.resetCoords = false;
         group.isVertical = true;
         group.ApplyOptions(options);
     }
 }
Пример #25
0
 private static void BeginLayoutedListview(ListViewState state, GUIStyle style, params GUILayoutOption[] options)
 {
     ListViewGUILayout.GUILayoutedListViewGroup layoutedListViewGroup = (ListViewGUILayout.GUILayoutedListViewGroup)GUILayoutUtility.BeginLayoutGroup(style, (GUILayoutOption[])null, typeof(ListViewGUILayout.GUILayoutedListViewGroup));
     layoutedListViewGroup.state = state;
     state.ilvState.group        = layoutedListViewGroup;
     GUIUtility.GetControlID(ListViewGUILayout.layoutedListViewHash, FocusType.Native);
     if (Event.current.type != EventType.Layout)
     {
         return;
     }
     layoutedListViewGroup.resetCoords = false;
     layoutedListViewGroup.isVertical  = true;
     layoutedListViewGroup.ApplyOptions(options);
 }
Пример #26
0
        private static void BeginLayoutedListview(ListViewState state, GUIStyle style, params GUILayoutOption[] options)
        {
            GUILayoutedListViewGroup group = (GUILayoutedListViewGroup)GUILayoutUtility.BeginLayoutGroup(style, null, typeof(GUILayoutedListViewGroup));

            group.state          = state;
            state.ilvState.group = group;
            GUIUtility.GetControlID(layoutedListViewHash, FocusType.Passive);
            if (Event.current.type == EventType.Layout)
            {
                group.resetCoords = false;
                group.isVertical  = true;
                group.ApplyOptions(options);
            }
        }
Пример #27
0
		public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
		{
			this.changesets = changesets;
			this.parentWin = parentWin;
			this.lv = new ListViewState(changesets.Length, 5);
			this.pv.lv = new ListViewState(0, 5);
			this.messageFirstLines = new string[changesets.Length];
			for (int i = 0; i < changesets.Length; i++)
			{
				this.messageFirstLines[i] = changesets[i].message.Split(new char[]
				{
					'\n'
				})[0];
			}
			this.totalUpdates = changesets.Length.ToString() + ((changesets.Length != 1) ? " Updates" : " Update");
		}
Пример #28
0
 public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
 {
     this.changesets        = changesets;
     this.parentWin         = parentWin;
     this.lv                = new ListViewState(changesets.Length, 5);
     this.pv.lv             = new ListViewState(0, 5);
     this.messageFirstLines = new string[changesets.Length];
     for (int i = 0; i < changesets.Length; i++)
     {
         this.messageFirstLines[i] = changesets[i].message.Split(new char[]
         {
             '\n'
         })[0];
     }
     this.totalUpdates = changesets.Length.ToString() + ((changesets.Length != 1) ? " Updates" : " Update");
 }
Пример #29
0
        public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
        {
            int controlID = GUIUtility.GetControlID(ListViewGUI.listViewHash, FocusType.Native);

            state.ID = controlID;
            state.selectionChanged = false;
            Rect rect;

            if (GUIClip.visibleRect.x < 0f || GUIClip.visibleRect.y < 0f)
            {
                rect = pos;
            }
            else
            {
                rect = ((pos.y >= 0f) ? new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0f, 0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height));
            }
            if (rect.width <= 0f)
            {
                rect.width = 1f;
            }
            if (rect.height <= 0f)
            {
                rect.height = 1f;
            }
            ListViewGUI.ilvState.rect = rect;
            int num  = (int)((-pos.y + rect.yMin) / (float)state.rowHeight);
            int num2 = num + (int)Math.Ceiling((double)(((rect.yMin - pos.y) % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;

            if (colWidths == null)
            {
                ListViewGUI.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUI.dummyWidths;
            }
            ListViewGUI.ilvState.invisibleRows = num;
            ListViewGUI.ilvState.endRow        = num2;
            ListViewGUI.ilvState.rectHeight    = (int)rect.height;
            ListViewGUI.ilvState.state         = state;
            if (num < 0)
            {
                num = 0;
            }
            if (num2 >= state.totalRows)
            {
                num2 = state.totalRows - 1;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ListViewGUI.ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), pos.width, (float)state.rowHeight)));
        }
Пример #30
0
        public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect rect;
            int  controlID = GUIUtility.GetControlID(listViewHash, FocusType.Passive);

            state.ID = controlID;
            state.selectionChanged = false;
            if ((GUIClip.visibleRect.x < 0f) || (GUIClip.visibleRect.y < 0f))
            {
                rect = pos;
            }
            else
            {
                rect = (pos.y >= 0f) ? new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0f, 0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
            }
            if (rect.width <= 0f)
            {
                rect.width = 1f;
            }
            if (rect.height <= 0f)
            {
                rect.height = 1f;
            }
            ilvState.rect = rect;
            int yFrom = (int)((-pos.y + rect.yMin) / ((float)state.rowHeight));
            int yTo   = (yFrom + ((int)Math.Ceiling((double)((((rect.yMin - pos.y) % ((float)state.rowHeight)) + rect.height) / ((float)state.rowHeight))))) - 1;

            if (colWidths == null)
            {
                dummyWidths[0] = (int)rect.width;
                colWidths      = dummyWidths;
            }
            ilvState.invisibleRows = yFrom;
            ilvState.endRow        = yTo;
            ilvState.rectHeight    = (int)rect.height;
            ilvState.state         = state;
            if (yFrom < 0)
            {
                yFrom = 0;
            }
            if (yTo >= state.totalRows)
            {
                yTo = state.totalRows - 1;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0f, (float)(yFrom * state.rowHeight), pos.width, (float)state.rowHeight)));
        }
Пример #31
0
        private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect rect  = ListViewGUILayout.dummyRect;
            int  yFrom = 0;
            int  yTo   = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
            int controlId = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Native);

            state.ID = controlId;
            state.selectionChanged = false;
            ilvState.state         = state;
            if (Event.current.type != EventType.Layout)
            {
                rect = new Rect(0.0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
                if ((double)rect.width <= 0.0)
                {
                    rect.width = 1f;
                }
                if ((double)rect.height <= 0.0)
                {
                    rect.height = 1f;
                }
                state.ilvState.rect = rect;
                yFrom = (int)rect.yMin / state.rowHeight;
                yTo   = yFrom + (int)Math.Ceiling(((double)rect.yMin % (double)state.rowHeight + (double)rect.height) / (double)state.rowHeight) - 1;
                ilvState.invisibleRows = yFrom;
                ilvState.endRow        = yTo;
                ilvState.rectHeight    = (int)rect.height;
                if (yFrom < 0)
                {
                    yFrom = 0;
                }
                if (yTo >= state.totalRows)
                {
                    yTo = state.totalRows - 1;
                }
            }
            if (colWidths == null)
            {
                ListViewGUILayout.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUILayout.dummyWidths;
            }
            return(new ListViewShared.ListViewElementsEnumerator((ListViewShared.InternalListViewState)ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0.0f, (float)(yFrom * state.rowHeight), rect.width, (float)state.rowHeight)));
        }
Пример #32
0
        private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect rect = ListViewGUILayout.dummyRect;
            int  num  = 0;
            int  num2 = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
            int controlID = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Passive);

            state.ID = controlID;
            state.selectionChanged = false;
            ilvState.state         = state;
            if (Event.current.type != EventType.Layout)
            {
                rect = new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
                if (rect.width <= 0f)
                {
                    rect.width = 1f;
                }
                if (rect.height <= 0f)
                {
                    rect.height = 1f;
                }
                state.ilvState.rect = rect;
                num  = (int)rect.yMin / state.rowHeight;
                num2 = num + (int)Math.Ceiling((double)((rect.yMin % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;
                ilvState.invisibleRows = num;
                ilvState.endRow        = num2;
                ilvState.rectHeight    = (int)rect.height;
                if (num < 0)
                {
                    num = 0;
                }
                if (num2 >= state.totalRows)
                {
                    num2 = state.totalRows - 1;
                }
            }
            if (colWidths == null)
            {
                ListViewGUILayout.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUILayout.dummyWidths;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), rect.width, (float)state.rowHeight)));
        }
Пример #33
0
 public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
 {
     Rect rect;
     int controlID = GUIUtility.GetControlID(listViewHash, FocusType.Passive);
     state.ID = controlID;
     state.selectionChanged = false;
     if ((GUIClip.visibleRect.x < 0f) || (GUIClip.visibleRect.y < 0f))
     {
         rect = pos;
     }
     else
     {
         rect = (pos.y >= 0f) ? new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0f, 0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
     }
     if (rect.width <= 0f)
     {
         rect.width = 1f;
     }
     if (rect.height <= 0f)
     {
         rect.height = 1f;
     }
     ilvState.rect = rect;
     int yFrom = (int) ((-pos.y + rect.yMin) / ((float) state.rowHeight));
     int yTo = (yFrom + ((int) Math.Ceiling((double) ((((rect.yMin - pos.y) % ((float) state.rowHeight)) + rect.height) / ((float) state.rowHeight))))) - 1;
     if (colWidths == null)
     {
         dummyWidths[0] = (int) rect.width;
         colWidths = dummyWidths;
     }
     ilvState.invisibleRows = yFrom;
     ilvState.endRow = yTo;
     ilvState.rectHeight = (int) rect.height;
     ilvState.state = state;
     if (yFrom < 0)
     {
         yFrom = 0;
     }
     if (yTo >= state.totalRows)
     {
         yTo = state.totalRows - 1;
     }
     return new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0f, (float) (yFrom * state.rowHeight), pos.width, (float) state.rowHeight));
 }
Пример #34
0
		public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
		{
			int controlID = GUIUtility.GetControlID(ListViewGUI.listViewHash, FocusType.Native);
			state.ID = controlID;
			state.selectionChanged = false;
			Rect rect;
			if (GUIClip.visibleRect.x < 0f || GUIClip.visibleRect.y < 0f)
			{
				rect = pos;
			}
			else
			{
				rect = ((pos.y >= 0f) ? new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0f, 0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height));
			}
			if (rect.width <= 0f)
			{
				rect.width = 1f;
			}
			if (rect.height <= 0f)
			{
				rect.height = 1f;
			}
			ListViewGUI.ilvState.rect = rect;
			int num = (int)((-pos.y + rect.yMin) / (float)state.rowHeight);
			int num2 = num + (int)Math.Ceiling((double)(((rect.yMin - pos.y) % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;
			if (colWidths == null)
			{
				ListViewGUI.dummyWidths[0] = (int)rect.width;
				colWidths = ListViewGUI.dummyWidths;
			}
			ListViewGUI.ilvState.invisibleRows = num;
			ListViewGUI.ilvState.endRow = num2;
			ListViewGUI.ilvState.rectHeight = (int)rect.height;
			ListViewGUI.ilvState.state = state;
			if (num < 0)
			{
				num = 0;
			}
			if (num2 >= state.totalRows)
			{
				num2 = state.totalRows - 1;
			}
			return new ListViewShared.ListViewElementsEnumerator(ListViewGUI.ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), pos.width, (float)state.rowHeight));
		}
Пример #35
0
 public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
 {
     float[] relativeSizes = new float[] { 50f, 50f };
     int[] minSizes = new int[] { 50, 50 };
     this.horSplit = new SplitterState(relativeSizes, minSizes, null);
     float[] singleArray2 = new float[] { 60f, 30f };
     int[] numArray2 = new int[] { 0x20, 0x20 };
     this.vertSplit = new SplitterState(singleArray2, numArray2, null);
     this.changesets = changesets;
     this.parentWin = parentWin;
     this.lv = new ListViewState(changesets.Length, 5);
     this.pv.lv = new ListViewState(0, 5);
     this.messageFirstLines = new string[changesets.Length];
     for (int i = 0; i < changesets.Length; i++)
     {
         char[] separator = new char[] { '\n' };
         this.messageFirstLines[i] = changesets[i].message.Split(separator)[0];
     }
     this.totalUpdates = changesets.Length.ToString() + ((changesets.Length != 1) ? " Updates" : " Update");
 }
        private static void BeginLayoutedListview(ListViewState state, GUIStyle style, params GUILayoutOption[] options)
        {
            GUILayoutedListViewGroup g = (GUILayoutedListViewGroup)GUILayoutUtility.BeginLayoutGroup(style, null, typeof(GUILayoutedListViewGroup));

            g.state = state;
            state.ilvState.group = g;

            GUIUtility.GetControlID(layoutedListViewHash, FocusType.Passive);

            switch (Event.current.type)
            {
            case EventType.Layout:
            {
                g.resetCoords = false;
                g.isVertical  = true;
                g.ApplyOptions(options);
                break;
            }
            }
        }
Пример #37
0
 public ASUpdateWindow(ASMainWindow parentWin, Changeset[] changesets)
 {
     float[] relativeSizes = new float[] { 50f, 50f };
     int[]   minSizes      = new int[] { 50, 50 };
     this.horSplit = new SplitterState(relativeSizes, minSizes, null);
     float[] singleArray2 = new float[] { 60f, 30f };
     int[]   numArray2    = new int[] { 0x20, 0x20 };
     this.vertSplit         = new SplitterState(singleArray2, numArray2, null);
     this.changesets        = changesets;
     this.parentWin         = parentWin;
     this.lv                = new ListViewState(changesets.Length, 5);
     this.pv.lv             = new ListViewState(0, 5);
     this.messageFirstLines = new string[changesets.Length];
     for (int i = 0; i < changesets.Length; i++)
     {
         char[] separator = new char[] { '\n' };
         this.messageFirstLines[i] = changesets[i].message.Split(separator)[0];
     }
     this.totalUpdates = changesets.Length.ToString() + ((changesets.Length != 1) ? " Updates" : " Update");
 }
Пример #38
0
        public static ListViewShared.ListViewElementsEnumerator DoListView(Rect pos, ListViewState state, int[] colWidths, string dragTitle)
        {
            int controlId = GUIUtility.GetControlID(ListViewGUI.listViewHash, FocusType.Native);

            state.ID = controlId;
            state.selectionChanged = false;
            Rect rect = (double)GUIClip.visibleRect.x < 0.0 || (double)GUIClip.visibleRect.y < 0.0 ? pos : ((double)pos.y >= 0.0 ? new Rect(0.0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height) : new Rect(0.0f, 0.0f, GUIClip.visibleRect.width, GUIClip.visibleRect.height));

            if ((double)rect.width <= 0.0)
            {
                rect.width = 1f;
            }
            if ((double)rect.height <= 0.0)
            {
                rect.height = 1f;
            }
            ListViewGUI.ilvState.rect = rect;
            int yFrom = (int)((-(double)pos.y + (double)rect.yMin) / (double)state.rowHeight);
            int yTo   = yFrom + (int)Math.Ceiling((((double)rect.yMin - (double)pos.y) % (double)state.rowHeight + (double)rect.height) / (double)state.rowHeight) - 1;

            if (colWidths == null)
            {
                ListViewGUI.dummyWidths[0] = (int)rect.width;
                colWidths = ListViewGUI.dummyWidths;
            }
            ListViewGUI.ilvState.invisibleRows = yFrom;
            ListViewGUI.ilvState.endRow        = yTo;
            ListViewGUI.ilvState.rectHeight    = (int)rect.height;
            ListViewGUI.ilvState.state         = state;
            if (yFrom < 0)
            {
                yFrom = 0;
            }
            if (yTo >= state.totalRows)
            {
                yTo = state.totalRows - 1;
            }
            return(new ListViewShared.ListViewElementsEnumerator(ListViewGUI.ilvState, colWidths, yFrom, yTo, dragTitle, new Rect(0.0f, (float)(yFrom * state.rowHeight), pos.width, (float)state.rowHeight)));
        }
Пример #39
0
        private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List <ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && (element.position.Contains(Event.current.mousePosition) && Event.current.button == 0))
            {
                ((DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID)).mouseDownPosition = Event.current.mousePosition;
            }
            if (GUIUtility.hotControl != listView.ID || Event.current.type != EventType.MouseDrag || (!GUIClip.visibleRect.Contains(Event.current.mousePosition) || !((DragAndDropDelay)GUIUtility.GetStateObject(typeof(DragAndDropDelay), listView.ID)).CanStartDrag()))
            {
                return;
            }
            object data = getDataForDraggingFunction != null?getDataForDraggingFunction(columnViewElements[listView.row].value) : (object)null;

            if (data == null)
            {
                return;
            }
            DragAndDrop.PrepareStartDrag();
            DragAndDrop.objectReferences = new Object[0];
            DragAndDrop.paths            = (string[])null;
            DragAndDrop.SetGenericData("CustomDragData", data);
            DragAndDrop.StartDrag(columnViewElements[listView.row].name);
            Event.current.Use();
        }
 private static void BeginLayoutedListview(ListViewState state, GUIStyle style, params GUILayoutOption[] options)
 {
   ListViewGUILayout.GUILayoutedListViewGroup layoutedListViewGroup = (ListViewGUILayout.GUILayoutedListViewGroup) GUILayoutUtility.BeginLayoutGroup(style, (GUILayoutOption[]) null, typeof (ListViewGUILayout.GUILayoutedListViewGroup));
   layoutedListViewGroup.state = state;
   state.ilvState.group = layoutedListViewGroup;
   GUIUtility.GetControlID(ListViewGUILayout.layoutedListViewHash, FocusType.Native);
   if (Event.current.type != EventType.Layout)
     return;
   layoutedListViewGroup.resetCoords = false;
   layoutedListViewGroup.isVertical = true;
   layoutedListViewGroup.ApplyOptions(options);
 }
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, GUIStyle style, params GUILayoutOption[] options)
 {
   return ListViewGUILayout.ListView(state, lvOptions, string.Empty, style, options);
 }
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
   return ListViewGUILayout.ListView(state, (ListViewOptions) 0, dragTitle, style, options);
 }
Пример #43
0
 public static ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, int[] colWidths, GUIStyle style, params GUILayoutOption[] options)
 {
     return ListView(state, (ListViewOptions) 0, colWidths, string.Empty, style, options);
 }
Пример #44
0
 public static ListViewShared.ListViewElementsEnumerator ListView(Rect pos, ListViewState state)
 {
     return DoListView(pos, state, null, string.Empty);
 }
Пример #45
0
		private static ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
		{
			Rect rect = ListViewGUILayout.dummyRect;
			int num = 0;
			int num2 = 0;
			ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;
			int controlID = GUIUtility.GetControlID(ListViewGUILayout.listViewHash, FocusType.Native);
			state.ID = controlID;
			state.selectionChanged = false;
			ilvState.state = state;
			if (Event.current.type != EventType.Layout)
			{
				rect = new Rect(0f, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);
				if (rect.width <= 0f)
				{
					rect.width = 1f;
				}
				if (rect.height <= 0f)
				{
					rect.height = 1f;
				}
				state.ilvState.rect = rect;
				num = (int)rect.yMin / state.rowHeight;
				num2 = num + (int)Math.Ceiling((double)((rect.yMin % (float)state.rowHeight + rect.height) / (float)state.rowHeight)) - 1;
				ilvState.invisibleRows = num;
				ilvState.endRow = num2;
				ilvState.rectHeight = (int)rect.height;
				if (num < 0)
				{
					num = 0;
				}
				if (num2 >= state.totalRows)
				{
					num2 = state.totalRows - 1;
				}
			}
			if (colWidths == null)
			{
				ListViewGUILayout.dummyWidths[0] = (int)rect.width;
				colWidths = ListViewGUILayout.dummyWidths;
			}
			return new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, num, num2, dragTitle, new Rect(0f, (float)(num * state.rowHeight), rect.width, (float)state.rowHeight));
		}
Пример #46
0
 public GettingLogEntriesScope(ListViewState listView)
 {
     m_Disposed         = false;
     listView.totalRows = LogEntries.StartGettingEntries();
 }
Пример #47
0
        internal static bool SendKey(ListViewShared.InternalListViewState ilvState, KeyCode keyCode, int totalCols)
        {
            ListViewState state = ilvState.state;

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

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

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

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

            case KeyCode.Home:
                state.row = 0;
                break;

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

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

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

            default:
                return(false);
            }
            state.scrollPos = ListViewShared.ListViewScrollToRow(ilvState, state.scrollPos, state.row);
            Event.current.Use();
            return(true);
        }
Пример #48
0
		public PackageExport()
		{
			this.m_ListView = new ListViewState(0, 18);
			base.position = new Rect(100f, 100f, 400f, 300f);
			base.minSize = new Vector2(400f, 200f);
		}
 static public ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, string dragTitle, GUIStyle style, params GUILayoutOption[] options)
 {
     return(ListView(state, 0, dragTitle, style, options));
 }
Пример #50
0
 private int DoListColumn(ListViewState listView, List<ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
   if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
   {
     if (this.isSearching && selectedSearchItemFunction != null)
       this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
     if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
       ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
   }
   if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
   {
     switch (Event.current.keyCode)
     {
       case KeyCode.RightArrow:
         this.m_ColumnToFocusKeyboard = columnIndex + 1;
         Event.current.Use();
         break;
       case KeyCode.LeftArrow:
         this.m_ColumnToFocusKeyboard = columnIndex - 1;
         Event.current.Use();
         break;
     }
   }
   ListViewState state = listView;
   GUIStyle background = ColumnView.s_Styles.background;
   GUILayoutOption[] guiLayoutOptionArray = new GUILayoutOption[1]{ GUILayout.Width(this.columnWidth) };
   foreach (ListViewElement element in ListViewGUILayout.ListView(state, background, guiLayoutOptionArray))
   {
     ColumnViewElement columnViewElement = columnViewElements[element.row];
     if (element.row == listView.row && Event.current.type == EventType.Repaint)
     {
       Rect position = element.position;
       ++position.x;
       ++position.y;
       ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
     }
     GUILayout.Label(columnViewElement.name);
     if (columnViewElement.value is List<ColumnViewElement>)
     {
       Rect position = element.position;
       position.x = (float) ((double) position.xMax - (double) ColumnView.s_Styles.categoryArrowIcon.width - 5.0);
       position.y += 2f;
       GUI.Label(position, (Texture) ColumnView.s_Styles.categoryArrowIcon);
     }
     this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
     ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
   }
   if (Event.current.type == EventType.Layout)
     selectedIndex = listView.row;
   return selectedIndex;
 }
Пример #51
0
		public ConsoleWindow()
		{
			base.position = new Rect(200f, 200f, 800f, 400f);
			this.m_ListView = new ListViewState(0, 32);
		}
Пример #52
0
 public ConsoleWindow()
 {
     base.position   = new Rect(200f, 200f, 800f, 400f);
     this.m_ListView = new ListViewState(0, 32);
 }
Пример #53
0
 private static void DoDragAndDrop(ListViewState listView, ListViewElement element, List<ColumnViewElement> columnViewElements, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
 {
   if (GUIUtility.hotControl == listView.ID && Event.current.type == EventType.MouseDown && (element.position.Contains(Event.current.mousePosition) && Event.current.button == 0))
     ((DragAndDropDelay) GUIUtility.GetStateObject(typeof (DragAndDropDelay), listView.ID)).mouseDownPosition = Event.current.mousePosition;
   if (GUIUtility.hotControl != listView.ID || Event.current.type != EventType.MouseDrag || (!GUIClip.visibleRect.Contains(Event.current.mousePosition) || !((DragAndDropDelay) GUIUtility.GetStateObject(typeof (DragAndDropDelay), listView.ID)).CanStartDrag()))
     return;
   object data = getDataForDraggingFunction != null ? getDataForDraggingFunction(columnViewElements[listView.row].value) : (object) null;
   if (data == null)
     return;
   DragAndDrop.PrepareStartDrag();
   DragAndDrop.objectReferences = new Object[0];
   DragAndDrop.paths = (string[]) null;
   DragAndDrop.SetGenericData("CustomDragData", data);
   DragAndDrop.StartDrag(columnViewElements[listView.row].name);
   Event.current.Use();
 }
Пример #54
0
        private int DoListColumn(ListViewState listView, List<ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ObjectColumnFunction selectedSearchItemFunction, ObjectColumnFunction selectedRegularItemFunction, ObjectColumnGetDataFunction getDataForDraggingFunction)
        {
            if (((Event.current.type == EventType.KeyDown) && (Event.current.keyCode == KeyCode.Return)) && (listView.row > -1))
            {
                if (this.isSearching && (selectedSearchItemFunction != null))
                {
                    this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
                }
                if ((!this.isSearching && (GUIUtility.keyboardControl == listView.ID)) && (selectedRegularItemFunction != null))
                {
                    DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
                }
            }
            if (((GUIUtility.keyboardControl == listView.ID) && (Event.current.type == EventType.KeyDown)) && !this.isSearching)
            {
                switch (Event.current.keyCode)
                {
                    case KeyCode.LeftArrow:
                        this.m_ColumnToFocusKeyboard = columnIndex - 1;
                        Event.current.Use();
                        break;

                    case KeyCode.RightArrow:
                        this.m_ColumnToFocusKeyboard = columnIndex + 1;
                        Event.current.Use();
                        break;
                }
            }
            GUILayoutOption[] options = new GUILayoutOption[] { GUILayout.Width(this.columnWidth) };
            IEnumerator enumerator = ListViewGUILayout.ListView(listView, s_Styles.background, options).GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    ListViewElement current = (ListViewElement) enumerator.Current;
                    ColumnViewElement columnViewElement = columnViewElements[current.row];
                    if ((current.row == listView.row) && (Event.current.type == EventType.Repaint))
                    {
                        Rect position = current.position;
                        position.x++;
                        position.y++;
                        s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
                    }
                    GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
                    if (columnViewElement.value is List<ColumnViewElement>)
                    {
                        Rect rect2 = current.position;
                        rect2.x = (rect2.xMax - s_Styles.categoryArrowIcon.width) - 5f;
                        rect2.y += 2f;
                        GUI.Label(rect2, s_Styles.categoryArrowIcon);
                    }
                    this.DoDoubleClick(current, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
                    DoDragAndDrop(listView, current, columnViewElements, getDataForDraggingFunction);
                }
            }
            finally
            {
                IDisposable disposable = enumerator as IDisposable;
                if (disposable != null)
                {
                    disposable.Dispose();
                }
            }
            if (Event.current.type == EventType.Layout)
            {
                selectedIndex = listView.row;
            }
            return selectedIndex;
        }
 static public ListViewShared.ListViewElementsEnumerator ListView(ListViewState state, ListViewOptions lvOptions, GUIStyle style, params GUILayoutOption[] options)
 {
     return(ListView(state, lvOptions, string.Empty, style, options));
 }
Пример #56
0
 private void Awake()
 {
   this.pv.lv = new ListViewState(0);
   this.isInitialUpdate = true;
 }
        static private ListViewShared.ListViewElementsEnumerator DoListView(ListViewState state, int[] colWidths, string dragTitle)
        {
            Rect vRect         = dummyRect;
            int  invisibleRows = 0;
            int  endRow        = 0;

            ListViewShared.InternalLayoutedListViewState ilvState = state.ilvState;

            //GUIUtility.CheckOnGUI ();
            int id = GUIUtility.GetControlID(listViewHash, FocusType.Passive);

            state.ID = id;
            state.selectionChanged = false;
            ilvState.state         = state;

            if (Event.current.type != EventType.Layout)
            {
                vRect = new Rect(0, state.scrollPos.y, GUIClip.visibleRect.width, GUIClip.visibleRect.height);

                if (vRect.width <= 0)
                {
                    vRect.width = 1;
                }
                if (vRect.height <= 0)
                {
                    vRect.height = 1;
                }

                state.ilvState.rect = vRect;

                invisibleRows = (int)(vRect.yMin) / state.rowHeight;
                endRow        = invisibleRows + (int)System.Math.Ceiling(((vRect.yMin % state.rowHeight) + vRect.height) / state.rowHeight) - 1;

                //if (id == GUIUtility.hotControl)
                //{
                //  s = invisibleRows.ToString() + "::" + endRow.ToString();
                //}

                ilvState.invisibleRows = invisibleRows;
                ilvState.endRow        = endRow;
                ilvState.rectHeight    = (int)vRect.height;

                if (invisibleRows < 0)
                {
                    invisibleRows = 0;
                }

                if (endRow >= state.totalRows)
                {
                    endRow = state.totalRows - 1;
                }
            }

            if (colWidths == null)
            {
                dummyWidths[0] = (int)vRect.width;
                colWidths      = dummyWidths;
            }

            return(new ListViewShared.ListViewElementsEnumerator(ilvState, colWidths, invisibleRows, endRow, dragTitle, new Rect(0, invisibleRows * state.rowHeight, vRect.width, state.rowHeight)));
        }
Пример #58
0
		private int DoListColumn(ListViewState listView, List<ColumnViewElement> columnViewElements, int columnIndex, int selectedIndex, ColumnView.ObjectColumnFunction selectedSearchItemFunction, ColumnView.ObjectColumnFunction selectedRegularItemFunction, ColumnView.ObjectColumnGetDataFunction getDataForDraggingFunction)
		{
			if (Event.current.type == EventType.KeyDown && Event.current.keyCode == KeyCode.Return && listView.row > -1)
			{
				if (this.isSearching && selectedSearchItemFunction != null)
				{
					this.DoSearchItemSelectedEvent(selectedSearchItemFunction, columnViewElements[selectedIndex].value);
				}
				if (!this.isSearching && GUIUtility.keyboardControl == listView.ID && selectedRegularItemFunction != null)
				{
					ColumnView.DoItemSelectedEvent(selectedRegularItemFunction, columnViewElements[selectedIndex].value);
				}
			}
			if (GUIUtility.keyboardControl == listView.ID && Event.current.type == EventType.KeyDown && !this.isSearching)
			{
				KeyCode keyCode = Event.current.keyCode;
				if (keyCode != KeyCode.RightArrow)
				{
					if (keyCode == KeyCode.LeftArrow)
					{
						this.m_ColumnToFocusKeyboard = columnIndex - 1;
						Event.current.Use();
					}
				}
				else
				{
					this.m_ColumnToFocusKeyboard = columnIndex + 1;
					Event.current.Use();
				}
			}
			foreach (ListViewElement element in ListViewGUILayout.ListView(listView, ColumnView.s_Styles.background, new GUILayoutOption[]
			{
				GUILayout.Width(this.columnWidth)
			}))
			{
				ColumnViewElement columnViewElement = columnViewElements[element.row];
				if (element.row == listView.row && Event.current.type == EventType.Repaint)
				{
					Rect position = element.position;
					position.x += 1f;
					position.y += 1f;
					ColumnView.s_Styles.selected.Draw(position, false, true, true, GUIUtility.keyboardControl == listView.ID);
				}
				GUILayout.Label(columnViewElement.name, new GUILayoutOption[0]);
				if (columnViewElement.value is List<ColumnViewElement>)
				{
					Rect position2 = element.position;
					position2.x = position2.xMax - (float)ColumnView.s_Styles.categoryArrowIcon.width - 5f;
					position2.y += 2f;
					GUI.Label(position2, ColumnView.s_Styles.categoryArrowIcon);
				}
				this.DoDoubleClick(element, columnViewElement, selectedSearchItemFunction, selectedRegularItemFunction);
				ColumnView.DoDragAndDrop(listView, element, columnViewElements, getDataForDraggingFunction);
			}
			if (Event.current.type == EventType.Layout)
			{
				selectedIndex = listView.row;
			}
			return selectedIndex;
		}