예제 #1
0
        /// <summary>
        /// Sets a style for an Error annotation (reduced font + segoe ui) and for markers
        /// </summary>
        private void SetErrorStyles(byte errorLevel, StyleThemeItem styleItem)
        {
            int   curFontSize = Sci.GetStyle(0).Size;
            Color bgColor     = styleItem.BackColor;
            Color fgColor     = styleItem.ForeColor;

            var normalStyle = Sci.GetStyle(OpenedFilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Normal));

            normalStyle.Font      = "Segoe ui";
            normalStyle.Size      = (int)(curFontSize * 0.9);
            normalStyle.ForeColor = fgColor;
            normalStyle.BackColor = bgColor;

            var boldStyle = Sci.GetStyle(OpenedFilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Bold));

            boldStyle.Font      = "Segoe ui";
            boldStyle.Size      = (int)(curFontSize * 0.9);
            boldStyle.Bold      = true;
            boldStyle.ForeColor = fgColor;
            boldStyle.BackColor = bgColor;

            var italicStyle = Sci.GetStyle(OpenedFilesInfo.GetStyleOf((ErrorLevel)errorLevel, ErrorFontWeight.Italic));

            italicStyle.Font      = "Segoe ui";
            italicStyle.Size      = (int)(curFontSize * 0.9);
            italicStyle.Italic    = true;
            italicStyle.ForeColor = fgColor;
            italicStyle.BackColor = bgColor;

            var markerStyle = Sci.GetMarker(errorLevel);

            markerStyle.Symbol = MarkerSymbol.SmallRect;
            markerStyle.SetBackColor(bgColor);
            markerStyle.SetForeColor(fgColor);
        }
예제 #2
0
        private void SetFontStyle(byte styleNumber, StyleThemeItem styleItem)
        {
            var nppStyle = Sci.GetStyle(styleNumber);

            if (styleItem.BackColor != Color.Transparent)
            {
                nppStyle.BackColor = styleItem.BackColor;
            }

            if (styleItem.ForeColor != Color.Transparent)
            {
                nppStyle.ForeColor = styleItem.ForeColor;
            }

            if (styleItem.FontType > 0)
            {
                nppStyle.Bold   = styleItem.FontType.IsBitSet(1);
                nppStyle.Italic = styleItem.FontType.IsBitSet(2);
            }

            if (!string.IsNullOrEmpty(styleItem.FontName))
            {
                nppStyle.Font = styleItem.FontName;
            }
        }