Exemplo n.º 1
0
        private void LayoutException(ITextMeasure measure, StackTraceLine[] stackLines, float maxWidth)
        {
            float nextX       = 0.0f;
            float totalHeight = measure.CalcHeight(value, maxWidth);

            if (stackLines != null)
            {
                for (int i = 0; i < stackLines.Length; ++i)
                {
                    float lineHeight = measure.CalcHeight(stackLines[i].line, maxWidth);
                    stackLines[i].frame = new Rect(nextX, totalHeight, maxWidth, lineHeight);

                    if (stackLines[i].sourcePathStart != -1)
                    {
                        GUIStyleTextMeasure styleMeasure = measure as GUIStyleTextMeasure;
                        if (styleMeasure != null)
                        {
                            ResolveSourceLink(styleMeasure, ref stackLines[i]);
                        }
                    }

                    totalHeight += lineHeight;
                }
            }

            this.width  = maxWidth;
            this.height = totalHeight;
        }
Exemplo n.º 2
0
        private static void ResolveSourceLink(GUIStyleTextMeasure measure, ref StackTraceLine stackLine)
        {
            Color color = EditorSkin.GetColor(stackLine.sourcePathExists ? ColorCode.Link : ColorCode.LinkInnactive);

            int sourceStart = stackLine.sourcePathStart;
            int sourceEnd   = stackLine.sourcePathEnd;

            GUIStyle   style   = measure.Style;
            GUIContent content = new GUIContent(stackLine.line);

            float startPosX = style.GetCursorPixelPosition(stackLine.frame, content, sourceStart).x - 1;
            float endPosX   = style.GetCursorPixelPosition(stackLine.frame, content, sourceEnd).x + 1;

            stackLine.sourceFrame = new Rect(startPosX, stackLine.frame.y, endPosX - startPosX, stackLine.frame.height);
            stackLine.line        = StringUtils.C(stackLine.line, color, sourceStart, sourceEnd);
        }
Exemplo n.º 3
0
        private static void ResolveSourceLink(GUIStyleTextMeasure measure, ref StackTraceLine stackLine)
        {
            Color color = EditorSkin.GetColor(stackLine.sourcePathExists ? ColorCode.Link : ColorCode.LinkInnactive);

            int sourceStart = stackLine.sourcePathStart;
            int sourceEnd = stackLine.sourcePathEnd;

            GUIStyle style = measure.Style;
            GUIContent content = new GUIContent(stackLine.line);

            float startPosX = style.GetCursorPixelPosition(stackLine.frame, content, sourceStart).x - 1;
            float endPosX = style.GetCursorPixelPosition(stackLine.frame, content, sourceEnd).x + 1;

            stackLine.sourceFrame = new Rect(startPosX, stackLine.frame.y, endPosX - startPosX, stackLine.frame.height);
            stackLine.line = StringUtils.C(stackLine.line, color, sourceStart, sourceEnd);
        }