コード例 #1
0
            /// <summary>
            /// Get the label of the timeline event
            /// </summary>
            /// <returns>The list of strings and colours which need to be joined to make a label</returns>
            public List <Tuple <string, WritableRgbaFloat> > Label()
            {
                Debug.Assert(_item is not null);
                if (_cachedLabel != null && _cachedLabelTheme == Themes.ThemeVariant)
                {
                    return(_cachedLabel);
                }

                _cachedLabel      = new List <Tuple <string, WritableRgbaFloat> >();
                _cachedLabelTheme = Themes.ThemeVariant;

                WritableRgbaFloat textColour = Themes.GetThemeColourWRF(Themes.eThemeColour.WindowText);

                switch (_eventType)
                {
                case eTimelineEvent.ProcessStart:
                {
                    TraceRecord trace = (TraceRecord)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Process ({trace.PID}) Started", textColour));
                    break;
                }

                case eTimelineEvent.ProcessEnd:
                {
                    TraceRecord trace = (TraceRecord)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Process ({trace.PID}) Ended", textColour));
                    break;
                }

                case eTimelineEvent.ThreadStart:
                {
                    ProtoGraph graph = (ProtoGraph)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Thread ({graph.ThreadID}) Started", textColour));
                    break;
                }

                case eTimelineEvent.ThreadEnd:
                {
                    ProtoGraph graph = (ProtoGraph)_item;
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Thread ({graph.ThreadID}) Ended", textColour));
                    break;
                }

                case eTimelineEvent.APICall:
                {
                    Logging.APICALL call       = (Logging.APICALL)_item;
                    NodeData        n          = call.Node !;
                    var             labelitems = n.CreateColourisedSymbolCall(call.Graph, call.Index, textColour, Themes.GetThemeColourWRF(Themes.eThemeColour.Emphasis1));
                    _cachedLabel.AddRange(labelitems);
                    break;
                }

                default:
                    _cachedLabel.Add(new Tuple <string, WritableRgbaFloat>($"Bad timeline event: ", textColour));
                    Debug.Assert(false, $"Bad timeline event: {_eventType}");
                    return(_cachedLabel);
                }
                return(_cachedLabel);
            }
コード例 #2
0
        private static void GetChangeIcon(string changeType, out char icon, out WritableRgbaFloat colour)
        {
            switch (changeType)
            {
            case "Added":
                icon   = ImGuiController.FA_ICON_PLUS;
                colour = new WritableRgbaFloat(System.Drawing.Color.Green);
                break;

            case "Changed":
                icon   = ImGuiController.FA_ICON_RIGHT;
                colour = new WritableRgbaFloat(System.Drawing.Color.Blue);
                break;

            case "Fixed":
                icon   = ImGuiController.FA_ICON_WRENCH;
                colour = new WritableRgbaFloat(System.Drawing.Color.Blue);
                break;

            case "Security":
                icon   = ImGuiController.FA_ICON_WARNING;
                colour = new WritableRgbaFloat(System.Drawing.Color.Red);
                break;

            case "Deprecated":
                icon   = ImGuiController.FA_ICON_DOWN;
                colour = new WritableRgbaFloat(0xff131313);
                break;

            case "Removed":
                icon   = ImGuiController.FA_ICON_CROSS;
                colour = new WritableRgbaFloat(0x00737373);
                break;

            default:
                icon   = '?';
                colour = new WritableRgbaFloat(0xff353535);
                break;
            }
        }