Ejemplo n.º 1
0
Archivo: Plug.cs Proyecto: massreuy/3P
        internal static void ApplyDefaultOptionsForScintilla()
        {
            // nothing has been done yet, no need to reset anything! same if we already were on a non progress file
            if (!_hasBeenInit || !Npp.PreviousFile.IsProgress)
            {
                return;
            }

            // apply default options
            Sci.TabWidth          = _tabWidth;
            Sci.UseTabs           = _indentWithTabs;
            Sci.AnnotationVisible = AnnotationMode;

            if (Sci.ViewWhitespace != WhitespaceMode.Invisible && !Sci.ViewEol)
            {
                Sci.ViewWhitespace = _whitespaceMode;
            }

            // read npp's stylers.xml file
            Sci.SetIndentGuideColor(Npp.StylersXml.IndentGuideLineBg, Npp.StylersXml.IndentGuideLineFg);
            Sci.SetWhiteSpaceColor(true, Color.Transparent, Npp.StylersXml.WhiteSpaceFg);
            Sci.SetSelectionColor(true, Npp.StylersXml.SelectionBg, Color.Transparent);
            Sci.CaretLineBackColor = Npp.StylersXml.CaretLineBg;
            Sci.CaretColor         = Npp.StylersXml.CaretFg;
            Sci.SetFoldMarginColors(true, Npp.StylersXml.FoldMarginBg, Npp.StylersXml.FoldMarginFg);
            Sci.SetFoldMarginMarkersColor(Npp.StylersXml.FoldMarginMarkerFg, Npp.StylersXml.FoldMarginMarkerBg, Npp.StylersXml.FoldMarginMarkerActiveFg);
        }
Ejemplo n.º 2
0
Archivo: Plug.cs Proyecto: massreuy/3P
        internal static void ApplyPluginOptionsForScintilla()
        {
            if (!_hasBeenInit || !Npp.PreviousFile.IsProgress)
            {
                // read default options
                _tabWidth       = Sci.TabWidth;
                _indentWithTabs = Sci.UseTabs;
                _whitespaceMode = Sci.ViewWhitespace;
                AnnotationMode  = Sci.AnnotationVisible;
                _hasBeenInit    = true;
            }

            Sci.TabWidth = Config.Instance.CodeTabSpaceNb;
            Sci.UseTabs  = false;
            if (Config.Instance.CodeShowSpaces)
            {
                Sci.ViewWhitespace = WhitespaceMode.VisibleAlways;
            }

            // apply style
            Style.SetSyntaxStyles();
            var currentStyle = Style.Current;

            Sci.SetIndentGuideColor(currentStyle.WhiteSpace.BackColor, currentStyle.WhiteSpace.ForeColor);
            Sci.SetWhiteSpaceColor(true, Color.Transparent, currentStyle.WhiteSpace.ForeColor);
            Sci.SetSelectionColor(true, currentStyle.Selection.BackColor, Color.Transparent);
            Sci.CaretLineBackColor = currentStyle.CaretLine.BackColor;
            Sci.CaretColor         = currentStyle.CaretColor.ForeColor;
            Sci.SetFoldMarginColors(true, currentStyle.FoldMargin.BackColor, currentStyle.FoldMargin.BackColor);
            Sci.SetFoldMarginMarkersColor(currentStyle.FoldMargin.ForeColor, currentStyle.FoldMargin.BackColor, currentStyle.FoldActiveMarker.ForeColor);
        }
Ejemplo n.º 3
0
 public static void SetDefaultScintillaStyles()
 {
     // read npp's stylers.xml file
     Sci.SetIndentGuideColor(Npp.StylersXml.IndentGuideLineBg, Npp.StylersXml.IndentGuideLineFg);
     Sci.SetWhiteSpaceColor(true, Color.Transparent, Npp.StylersXml.WhiteSpaceFg);
     Sci.SetSelectionColor(true, Npp.StylersXml.SelectionBg, Color.Transparent);
     Sci.CaretLineBackColor = Npp.StylersXml.CaretLineBg;
     Sci.CaretColor         = Npp.StylersXml.CaretFg;
     Sci.SetFoldMarginColors(true, Npp.StylersXml.FoldMarginBg, Npp.StylersXml.FoldMarginFg);
     Sci.SetFoldMarginMarkersColor(Npp.StylersXml.FoldMarginMarkerFg, Npp.StylersXml.FoldMarginMarkerBg, Npp.StylersXml.FoldMarginMarkerActiveFg);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Call this method to set the back/fore color and font type of each type used in 3P according to the
        /// styles defined in the SyntaxHighlighting file
        /// </summary>
        public void SetScintillaStyles()
        {
            // Default
            SetFontStyle((byte)SciMsg.STYLE_DEFAULT, GetStyle(SciStyleId.Default));
            SetFontStyle((byte)SciMsg.STYLE_CONTROLCHAR, GetStyle(SciStyleId.Default));

            foreach (var kpv in Items)
            {
                SetFontStyle((byte)kpv.Key, kpv.Value);
            }

            // line numbers
            SetFontStyle((byte)SciMsg.STYLE_LINENUMBER, GetStyle(SciStyleId.LineNumberMargin));

            // set url as strings
            SetFontStyle(80, GetStyle(SciStyleId.SimpleQuote));

            // brace highlighting
            SetFontStyle((byte)SciMsg.STYLE_BRACELIGHT, GetStyle(SciStyleId.BraceHighLight));
            SetFontStyle((byte)SciMsg.STYLE_BRACEBAD, GetStyle(SciStyleId.BadBraceHighLight));

            // smart highlighting in npp
            Sci.GetIndicator(29).ForeColor = GetStyle(SciStyleId.SmartHighLighting).ForeColor;

            // Setting styles for errors
            SetErrorStyles((byte)ErrorLevel.Information, GetStyle(SciStyleId.Error0));
            SetErrorStyles((byte)ErrorLevel.Warning, GetStyle(SciStyleId.Error1));
            SetErrorStyles((byte)ErrorLevel.StrongWarning, GetStyle(SciStyleId.Error2));
            SetErrorStyles((byte)ErrorLevel.Error, GetStyle(SciStyleId.Error3));
            SetErrorStyles((byte)ErrorLevel.Critical, GetStyle(SciStyleId.Error4));

            Sci.SetIndentGuideColor(GetStyle(SciStyleId.WhiteSpace).BackColor, GetStyle(SciStyleId.WhiteSpace).ForeColor);
            Sci.SetWhiteSpaceColor(true, Color.Transparent, GetStyle(SciStyleId.WhiteSpace).ForeColor);
            Sci.SetSelectionColor(true, GetStyle(SciStyleId.Selection).BackColor, Color.Transparent);
            Sci.CaretLineBackColor = GetStyle(SciStyleId.CaretLine).BackColor;
            Sci.CaretColor         = GetStyle(SciStyleId.CaretColor).ForeColor;

            // Set colors for all folding markers and margin
            Sci.SetFoldMarginColors(true, GetStyle(SciStyleId.FoldMargin).BackColor, GetStyle(SciStyleId.FoldMargin).BackColor);
            Sci.SetFoldMarginMarkersColor(GetStyle(SciStyleId.FoldMargin).ForeColor, GetStyle(SciStyleId.FoldMargin).BackColor, GetStyle(SciStyleId.FoldActiveMarker).ForeColor);

            // Configure folding markers with respective symbols
            Sci.GetMarker(Sci.Marker.FolderEnd).Symbol     = MarkerSymbol.BoxPlusConnected;
            Sci.GetMarker(Sci.Marker.Folder).Symbol        = MarkerSymbol.BoxPlus;
            Sci.GetMarker(Sci.Marker.FolderMidTail).Symbol = MarkerSymbol.TCorner;
            Sci.GetMarker(Sci.Marker.FolderOpenMid).Symbol = MarkerSymbol.BoxMinusConnected;
            Sci.GetMarker(Sci.Marker.FolderSub).Symbol     = MarkerSymbol.VLine;
            Sci.GetMarker(Sci.Marker.FolderTail).Symbol    = MarkerSymbol.LCorner;
            Sci.GetMarker(Sci.Marker.FolderOpen).Symbol    = MarkerSymbol.BoxMinus;
        }