Пример #1
0
        private void LayoutException(ICTextMeasure measure, CStackTraceLine[] 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)
                    {
                        CGUIStyleTextMeasure styleMeasure = measure as CGUIStyleTextMeasure;
                        if (styleMeasure != null)
                        {
                            ResolveSourceLink(styleMeasure, ref stackLines[i]);
                        }
                    }

                    totalHeight += lineHeight;
                }
            }

            this.width  = maxWidth;
            this.height = totalHeight;
        }
Пример #2
0
        private static void ResolveSourceLink(CGUIStyleTextMeasure measure, ref CStackTraceLine stackLine)
        {
            Color color = CEditorSkin.GetColor(stackLine.sourcePathExists ? CColorCode.Link : CColorCode.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        = CStringUtils.C(stackLine.line, color, sourceStart, sourceEnd);
        }