Example #1
0
            public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    if (HeEditorGUI.CppButton(HeEditorGUI.SpaceL(ref position, position.height)))
                    {
                        m_Owner.window.OnGoto(new GotoCommand(m_NativeObject));
                    }

                    if (m_NativeObject.gcHandle.isValid)
                    {
                        if (HeEditorGUI.GCHandleButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_NativeObject.gcHandle));
                        }
                    }

                    if (m_NativeObject.managedObject.isValid)
                    {
                        if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_NativeObject.managedObject));
                        }
                    }
                }

                base.OnGUI(position, column);
            }
            public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    GUI.Box(HeEditorGUI.SpaceL(ref position, position.height), HeEditorStyles.csImage, HeEditorStyles.iconStyle);

                    //if (m_managedObject.gcHandlesArrayIndex != -1)
                    //{
                    //    if (HeEditorGUI.GCHandleButton(HeEditorGUI.SpaceR(ref position, position.height)))
                    //    {
                    //        m_owner.m_Window.OnGoto(new GotoCommand(new RichGCHandle(m_snapshot, m_snapshot.gcHandles[m_managedObject.gcHandlesArrayIndex])));
                    //    }
                    //}

                    if (m_Object.nativeObject.isValid)
                    {
                        if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_Object.nativeObject));
                        }
                    }
                }

                switch ((Column)column)
                {
                case Column.Type:
                    HeEditorGUI.TypeName(position, typeName);
                    break;

                case Column.CppCounterpart:
                    if (m_Object.nativeObject.isValid)
                    {
                        GUI.Label(position, m_Object.nativeObject.name);
                    }
                    break;

                case Column.Size:
                    HeEditorGUI.Size(position, size);
                    break;

                case Column.Address:
                    HeEditorGUI.Address(position, m_Object.address);
                    break;

                case Column.Assembly:
                    GUI.Label(position, assembly);
                    break;
                }
            }
Example #3
0
        void TryDrawObjectButton(PropertyGridItem itm, ref Rect rect)
        {
            // We do not test against address==0 here, because if it is a static field its address might be 0
            if (itm.type.managedTypesArrayIndex < 0 || (itm is BaseClassPropertyGridItem))
            {
                return;
            }

            // If it is not a pointer, it does not point to another object
            //var type = m_snapshot.managedTypes[itm.typeIndex];
            if (!itm.type.isPointer)
            {
                return;
            }

            // If it points to null, it has no object
            var pointer = itm.myMemoryReader.ReadPointer(itm.address);

            if (pointer == 0)
            {
                return;
            }

            // Check if it is a managed object
            var managedObjIndex = m_Snapshot.FindManagedObjectOfAddress(itm.type.isArray ? itm.address : pointer);

            if (managedObjIndex != -1)
            {
                if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichManagedObject(m_Snapshot, managedObjIndex)));
                }
            }

            // Check if it is a native object
            var nativeObjIndex = m_Snapshot.FindNativeObjectOfAddress(pointer);

            if (nativeObjIndex != -1)
            {
                if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref rect, rect.height)))
                {
                    m_Owner.window.OnGoto(new GotoCommand(new RichNativeObject(m_Snapshot, nativeObjIndex)));
                }
            }
        }
Example #4
0
            public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    GUI.Box(HeEditorGUI.SpaceL(ref position, position.height), HeEditorStyles.gcHandleImage, HeEditorStyles.iconStyle);

                    if (m_GCHandle.nativeObject.isValid)
                    {
                        if (HeEditorGUI.CppButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_GCHandle.nativeObject));
                        }
                    }

                    if (m_GCHandle.managedObject.isValid)
                    {
                        if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_GCHandle.managedObject));
                        }
                    }
                }

                switch ((Column)column)
                {
                case Column.GCHandle:
                    HeEditorGUI.TypeName(position, typeName);
                    break;

                case Column.Size:
                    HeEditorGUI.Size(position, size);
                    break;

                case Column.Address:
                    HeEditorGUI.Address(position, address);
                    break;
                }
            }
Example #5
0
        void TryDrawDataVisualizerButton(PropertyGridItem itm, ref Rect rect)
        {
            if (!enabled || type.managedTypesArrayIndex == -1)
            {
                return;
            }

            if (!AbstractDataVisualizer.HasVisualizer(type.name))
            {
                return;
            }

            if (GUI.Button(HeEditorGUI.SpaceR(ref rect, rect.height), new GUIContent("", "Show in Data Visualizer."), HeEditorStyles.dataVisualizer))
            {
                var pointer = address;
                if (type.isPointer)
                {
                    pointer = myMemoryReader.ReadPointer(address);
                }

                DataVisualizerWindow.CreateWindow(m_Snapshot, myMemoryReader, pointer, type);
            }
        }
Example #6
0
            public override void OnGUI(Rect position, int column)
            {
                if (column == 0)
                {
                    HeEditorGUI.NativeObjectIcon(HeEditorGUI.SpaceL(ref position, position.height), m_Object.packed);

                    if (m_Object.managedObject.isValid)
                    {
                        if (HeEditorGUI.CsButton(HeEditorGUI.SpaceR(ref position, position.height)))
                        {
                            m_Owner.window.OnGoto(new GotoCommand(m_Object.managedObject));
                        }
                    }
                }

                switch ((Column)column)
                {
                case Column.Type:
                    GUI.Label(position, typeName);
                    break;

                case Column.Name:
                {
                    GUI.Label(position, name);

                    var e = Event.current;
                    if (e.type == EventType.ContextClick && position.Contains(e.mousePosition))
                    {
                        var menu = new GenericMenu();
                        OnShowNameContextMenu(menu);
                        if (menu.GetItemCount() > 0)
                        {
                            e.Use();
                            menu.ShowAsContext();
                        }
                    }
                }
                break;

                case Column.Size:
                    HeEditorGUI.Size(position, size);
                    break;

                case Column.Address:
                    HeEditorGUI.Address(position, address);
                    break;

                case Column.DontDestroyOnLoad:
                    GUI.Label(position, isDontDestroyOnLoad.ToString());
                    break;

                case Column.IsPersistent:
                    GUI.Label(position, isPersistent.ToString());
                    break;

                case Column.InstanceID:
                    GUI.Label(position, instanceId.ToString());
                    break;

#if HEAPEXPLORER_DISPLAY_REFS
                case Column.ReferencesCount:
                    GUI.Label(position, m_ReferencesCount.ToString());
                    break;

                case Column.ReferencedByCount:
                    GUI.Label(position, m_ReferencedByCount.ToString());
                    break;
#endif
                }
            }