private void DoToolsGUI()
        {
            GUILayout.Label(new GUIContent("Tools"), AndroidLogcatStyles.toolbarPopupCenter);
            var rect = GUILayoutUtility.GetLastRect();

            if (Event.current.type == EventType.MouseDown && rect.Contains(Event.current.mousePosition))
            {
                var contextMenu = new AndroidContextMenu <ToolsContextMenu>();
                contextMenu.Add(ToolsContextMenu.ScreenCapture, "Screen Capture");
                contextMenu.Add(ToolsContextMenu.OpenTerminal, "Open Terminal");
                contextMenu.Add(ToolsContextMenu.StacktraceUtility, "Stacktrace Utility");
                var b = m_Runtime.UserSettings.MemoryViewerState.Behavior;
                contextMenu.Add(ToolsContextMenu.MemoryBehaviorAuto, "Memory Window/Auto Capture", b == MemoryViewerBehavior.Auto);
                contextMenu.Add(ToolsContextMenu.MemoryBehaviorManual, "Memory Window/Manual Capture", b == MemoryViewerBehavior.Manual);
                contextMenu.Add(ToolsContextMenu.MemoryBehaviorHidden, "Memory Window/Disabled", b == MemoryViewerBehavior.Hidden);
                contextMenu.Show(new Vector2(rect.x, rect.yMax), MenuToolsSelection);
            }
        }
Exemple #2
0
        void DoContextMenu(Event e)
        {
            var entries = new List <LogcatEntry>();

            foreach (var si in m_SelectedIndices)
            {
                if (si > m_LogEntries.Count - 1)
                {
                    continue;
                }
                entries.Add(m_LogEntries[si]);
            }

            var contextMenu = new AndroidContextMenu <MessagesContextMenu>();

            contextMenu.Add(MessagesContextMenu.Copy, "Copy");
            contextMenu.Add(MessagesContextMenu.SelectAll, "Select All");
            contextMenu.AddSplitter();
            contextMenu.Add(MessagesContextMenu.SaveSelection, "Save Selection...");

            if (entries.Count > 0)
            {
                var tag = entries[0].tag;
                if (!string.IsNullOrEmpty(tag))
                {
                    contextMenu.AddSplitter();
                    contextMenu.Add(MessagesContextMenu.AddTag, $"Add tag '{tag}'");
                    contextMenu.Add(MessagesContextMenu.RemoveTag, $"Remove tag '{tag}'");
                }

                var processId = entries[0].processId;
                if (processId >= 0)
                {
                    contextMenu.AddSplitter();
                    contextMenu.Add(MessagesContextMenu.FilterByProcessId, $"Filter by process id '{processId}'");
                }
            }

            contextMenu.UserData = entries.ToArray();
            contextMenu.Show(e.mousePosition, MenuSelection);
        }