public override ChunkStyle GetStyle (ChunkStyle baseStyle)
		{
			if (baseStyle == null)
				return null;

			var style = new ChunkStyle (baseStyle);
			style.Background = BackgroundColor;
			SetForegroundColor (style);

			return style;
		}
Example #2
0
        public override ChunkStyle GetStyle(ChunkStyle baseStyle)
        {
            if (baseStyle == null)
            {
                return(null);
            }

            var style = new ChunkStyle(baseStyle);

            style.Background = BackgroundColor;
            SetForegroundColor(style);

            return(style);
        }
Example #3
0
        void Stylechanged(object sender, EventArgs e)
        {
            Gtk.TreeIter iter;
            if (!this.treeviewColors.Selection.GetSelected(out iter))
            {
                return;
            }
            var oldStyle = (ChunkStyle)colorStore.GetValue(iter, 2);
            var newStyle = new ChunkStyle(oldStyle);

            newStyle.Foreground = new Cairo.Color(colorbuttonFg.Color.Red / (double)ushort.MaxValue,
                                                  colorbuttonFg.Color.Green / (double)ushort.MaxValue,
                                                  colorbuttonFg.Color.Blue / (double)ushort.MaxValue,
                                                  colorbuttonFg.Alpha / (double)ushort.MaxValue);

            newStyle.Background = new Cairo.Color(colorbuttonBg.Color.Red / (double)ushort.MaxValue,
                                                  colorbuttonBg.Color.Green / (double)ushort.MaxValue,
                                                  colorbuttonBg.Color.Blue / (double)ushort.MaxValue,
                                                  colorbuttonBg.Alpha / (double)ushort.MaxValue);

            if (checkbuttonBold.Active)
            {
                newStyle.FontWeight = Xwt.Drawing.FontWeight.Bold;
            }
            else
            {
                newStyle.FontWeight = Xwt.Drawing.FontWeight.Normal;
            }

            if (checkbuttonItalic.Active)
            {
                newStyle.FontStyle = Xwt.Drawing.FontStyle.Italic;
            }
            else
            {
                newStyle.FontStyle = Xwt.Drawing.FontStyle.Normal;
            }

            colorStore.SetValue(iter, 2, newStyle);

            var newscheme = colorSheme.Clone();

            ApplyStyle(newscheme);

            this.textEditor.TextViewMargin.PurgeLayoutCache();
            this.textEditor.Document.MimeType = "text/x-csharp";
            this.textEditor.GetTextEditorData().ColorStyle = newscheme;
            this.textEditor.QueueDraw();
        }
Example #4
0
        public override ChunkStyle GetStyle(ChunkStyle baseStyle)
        {
            if (baseStyle == null)
            {
                return(null);
            }

            var style = new ChunkStyle(baseStyle);

            if (forground != null && editor != null)
            {
                style.Foreground = forground(editor).Foreground;
            }
            return(style);
        }
Example #5
0
        void SelectChunkStyle(TreeIter iter, ChunkStyle chunkStyle)
        {
            notebookColorChooser.Page = 0;
            SetColorToButton(colorbuttonFg, chunkStyle.Foreground);
            SetColorToButton(colorbuttonBg, chunkStyle.Background);

            checkbuttonBold.Active           = chunkStyle.FontWeight == Xwt.Drawing.FontWeight.Bold;
            checkbuttonItalic.Active         = chunkStyle.FontStyle == Xwt.Drawing.FontStyle.Italic;
            this.label4.Visible              = this.colorbuttonFg.Visible = true;
            this.colorbuttonFg.Sensitive     = true;
            this.label5.Visible              = this.colorbuttonBg.Visible = true;
            this.colorbuttonBg.Sensitive     = true;
            this.checkbuttonBold.Visible     = true;
            this.checkbuttonBold.Sensitive   = true;
            this.checkbuttonItalic.Visible   = true;
            this.checkbuttonItalic.Sensitive = true;
        }
        int DrawLinePortion(Context cr, ChunkStyle style, TextLayout layout, DocumentLine line, int visualOffset, int logicalLength)
        {
            int logicalColumn = line.GetLogicalColumn(editor, visualOffset);
            int logicalEndColumn = logicalColumn + logicalLength;
            int visualEndOffset = line.GetVisualColumn(editor, logicalEndColumn);

            int visualLength = visualEndOffset - visualOffset;

            int indexOffset = visualOffset - 1;

            layout.SetFontStyle(style.FontStyle, indexOffset, visualLength);
            layout.SetFontWeight(style.FontWeight, indexOffset, visualLength);
            if (style.Underline)
                layout.SetUnderline(indexOffset, visualLength);
            layout.SetForeground(style.Foreground, indexOffset, visualLength);

            return visualEndOffset;
        }
Example #7
0
        int DrawLinePortion(Context cr, ChunkStyle style, TextLayout layout, DocumentLine line, int visualOffset, int logicalLength)
        {
            int logicalColumn    = line.GetLogicalColumn(editor, visualOffset);
            int logicalEndColumn = logicalColumn + logicalLength;
            int visualEndOffset  = line.GetVisualColumn(editor, logicalEndColumn);

            int visualLength = visualEndOffset - visualOffset;

            int indexOffset = visualOffset - 1;

            layout.SetFontStyle(style.FontStyle, indexOffset, visualLength);
            layout.SetFontWeight(style.FontWeight, indexOffset, visualLength);
            if (style.Underline)
            {
                layout.SetUnderline(indexOffset, visualLength);
            }
            layout.SetForeground(style.Foreground, indexOffset, visualLength);

            return(visualEndOffset);
        }
Example #8
0
        public ListWidget(ListWindow win)
        {
            this.win                = win;
            this.Events             = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
            DefaultCompletionString = "";
            categoryLayout          = new Pango.Layout(this.PangoContext);
            noMatchLayout           = new Pango.Layout(this.PangoContext);
            layout      = new Pango.Layout(this.PangoContext);
            layout.Wrap = Pango.WrapMode.Char;
            var style = SyntaxModeService.GetColorStyle(IdeApp.Preferences.ColorScheme);

            SetFont();
            textColor = style.CompletionText.Foreground;

            highlightColor               = style.CompletionHighlight.GetColor("color");
            backgroundColor              = style.CompletionText.Background;
            selectedItemColor            = style.CompletionSelectedText;
            selectedItemInactiveColor    = style.CompletionSelectedInactiveText;
            selectionBorderColor         = style.CompletionBorder.GetColor("color");
            selectionBorderInactiveColor = style.CompletionInactiveBorder.GetColor("color");
        }
Example #9
0
        void SetChunkStyle(Gtk.TreeIter iter, ChunkStyle oldStyle)
        {
            var newStyle = new ChunkStyle(oldStyle);

            newStyle.Foreground = GetColorFromButton(colorbuttonFg);
            newStyle.Background = GetColorFromButton(colorbuttonBg);

            if (checkbuttonBold.Active)
            {
                newStyle.FontWeight = Xwt.Drawing.FontWeight.Bold;
            }
            else
            {
                newStyle.FontWeight = Xwt.Drawing.FontWeight.Normal;
            }

            if (checkbuttonItalic.Active)
            {
                newStyle.FontStyle = Xwt.Drawing.FontStyle.Italic;
            }
            else
            {
                newStyle.FontStyle = Xwt.Drawing.FontStyle.Normal;
            }

            colorStore.SetValue(iter, 2, newStyle);

            var newscheme = colorSheme.Clone();

            ApplyStyle(newscheme);

            this.textEditor.TextViewMargin.PurgeLayoutCache();
            this.textEditor.Document.MimeType = "text/x-csharp";
            this.textEditor.GetTextEditorData().ColorStyle = newscheme;
            this.textEditor.QueueDraw();
        }
		string Highlight (string str, ChunkStyle style)
		{
			var color = (Gdk.Color) ((HslColor)colorStyle.GetForeground (style));

			if (grayOut) {
				color = AlphaBlend (color, (Gdk.Color) ((HslColor)colorStyle.PlainText.Background), optionalAlpha);
			}

			var colorString = Mono.TextEditor.HelperMethods.GetColorString (color);
			return "<span foreground=\"" + colorString + "\">" + str + "</span>";
		}
Example #11
0
		public ListWidget (ListWindow win)
		{
			this.win = win;
			this.Events = EventMask.ButtonPressMask | EventMask.ButtonReleaseMask | EventMask.PointerMotionMask;
			DefaultCompletionString = "";
			categoryLayout = new Pango.Layout (this.PangoContext);
			noMatchLayout = new Pango.Layout (this.PangoContext);
			layout = new Pango.Layout (this.PangoContext);
			layout.Wrap = Pango.WrapMode.Char;
			var style = SyntaxModeService.GetColorStyle (IdeApp.Preferences.ColorScheme);
			SetFont ();
			textColor = style.CompletionText.Foreground;

			highlightColor = style.CompletionHighlight.Color;
			backgroundColor = style.CompletionText.Background;
			selectedItemColor = style.CompletionSelectedText;
			selectedItemInactiveColor = style.CompletionSelectedInactiveText;
			selectionBorderColor = style.CompletionBorder.Color;
			selectionBorderInactiveColor = style.CompletionInactiveBorder.Color;
			this.Show ();
		}
 public DebugTextMarker(int offset, int length, AmbientColor background, ChunkStyle forground = null)
     : base(offset, length)
 {
     this.forground  = forground;
     this.background = background;
 }
		protected virtual void SetForegroundColor (ChunkStyle style)
		{
		}
Example #14
0
 protected override void SetForegroundColor(ChunkStyle style)
 {
     style.Foreground = Editor.ColorStyle.DebuggerStackLine.Foreground;
 }
Example #15
0
		public virtual ChunkStyle GetStyle (ChunkStyle baseStyle)
		{
			return baseStyle;
		}
		protected override void SetForegroundColor (ChunkStyle style)
		{
			style.Foreground = Editor.ColorStyle.BreakpointText.Foreground;
		}
		string HighlightSemantically (string str, ChunkStyle style)
		{
			if (!MonoDevelop.SourceEditor.DefaultSourceEditorOptions.Instance.EnableSemanticHighlighting)
				return str;
			return Highlight (str, style);
		}
		protected virtual ChunkStyle CreateStyle (ChunkStyle baseStyle, Cairo.Color color, Cairo.Color bgColor)
		{
			var style = new ChunkStyle (baseStyle);
			if ((IncludedStyles & StyleFlag.Color) != 0)
				style.Foreground = color;
			
			if ((IncludedStyles & StyleFlag.BackgroundColor) != 0) {
				style.Background = bgColor;
			}
			
			if ((IncludedStyles & StyleFlag.Bold) != 0)
				style.FontWeight = Xwt.Drawing.FontWeight.Bold;
			
			if ((IncludedStyles & StyleFlag.Italic) != 0)
				style.FontStyle = Xwt.Drawing.FontStyle.Italic;
			return style;
		}
Example #19
0
 public override ChunkStyle GetStyle(ChunkStyle baseStyle)
 {
     return baseStyle;
 }
		public DebugTextMarker (int offset, int length, AmbientColor background, ChunkStyle forground = null)
			: base (offset, length)
		{
			this.forground = forground;
			this.background = background;
		}
Example #21
0
		void Stylechanged (object sender, EventArgs e)
		{
			Gtk.TreeIter iter;
			if (!this.treeviewColors.Selection.GetSelected (out iter))
				return;
			var oldStyle = (ChunkStyle)colorStore.GetValue (iter, 2);
			var newStyle = new ChunkStyle (oldStyle);
			newStyle.Foreground = new Cairo.Color (colorbuttonFg.Color.Red / (double)ushort.MaxValue,
			                                       colorbuttonFg.Color.Green / (double)ushort.MaxValue,
			                                       colorbuttonFg.Color.Blue / (double)ushort.MaxValue,
			                                       colorbuttonFg.Alpha / (double)ushort.MaxValue);

			newStyle.Background = new Cairo.Color (colorbuttonBg.Color.Red / (double)ushort.MaxValue,
			                                       colorbuttonBg.Color.Green / (double)ushort.MaxValue,
			                                       colorbuttonBg.Color.Blue / (double)ushort.MaxValue,
			                                       colorbuttonBg.Alpha / (double)ushort.MaxValue);

			if (checkbuttonBold.Active) {
				newStyle.Weight |= TextWeight.Bold;
			} else {
				newStyle.Weight &= ~TextWeight.Bold;
			}

			if (checkbuttonItalic.Active) {
				newStyle.Weight |= TextWeight.Italic;
			} else {
				newStyle.Weight &= ~TextWeight.Italic;
			}

			colorStore.SetValue (iter, 2, newStyle);

			var newscheme = colorSheme.Clone ();
			ApplyStyle (newscheme);

			this.textEditor.TextViewMargin.PurgeLayoutCache ();
			this.textEditor.Document.MimeType = "text/x-csharp";
			this.textEditor.GetTextEditorData ().ColorStyle = newscheme;
			this.textEditor.QueueDraw ();
		}
		void SetChunkStyle (TreeNavigator navigator, ChunkStyle oldStyle)
		{
			var newStyle = new ChunkStyle (oldStyle);
			newStyle.Foreground = GetColorFromButton (colorbuttonPrimary);
			newStyle.Background = GetColorFromButton (colorbuttonSecondary);

			if (togglebuttonBold.Active) {
				newStyle.FontWeight = FontWeight.Bold;
			} else {
				newStyle.FontWeight = FontWeight.Normal;
			}

			if (togglebuttonItalic.Active) {
				newStyle.FontStyle = FontStyle.Italic;
			} else {
				newStyle.FontStyle = FontStyle.Normal;
			}

			navigator.SetValue (styleField, newStyle);

			var newscheme = colorScheme.Clone ();
			ApplyStyle (newscheme);

			this.textEditor.TextViewMargin.PurgeLayoutCache ();
			this.textEditor.Document.MimeType = "text/x-csharp";
			this.textEditor.GetTextEditorData ().ColorStyle = newscheme;
			this.textEditor.QueueDraw ();
		}
		void SelectChunkStyle (ChunkStyle chunkStyle)
		{
			SetColorToButton (colorbuttonPrimary, chunkStyle.Foreground);
			SetColorToButton (colorbuttonSecondary, chunkStyle.Background);

			this.togglebuttonBold.Active = chunkStyle.FontWeight == Xwt.Drawing.FontWeight.Bold;
			this.togglebuttonItalic.Active = chunkStyle.FontStyle == Xwt.Drawing.FontStyle.Italic;

			this.colorbuttonPrimary.LabelText = "Foreground:";
			this.colorbuttonSecondary.LabelText = "Background:";

			this.colorbuttonPrimary.Sensitive = true;
			this.colorbuttonSecondary.Sensitive = true;
			this.togglebuttonBold.Sensitive = true;
			this.togglebuttonItalic.Sensitive = true;

			this.togglebuttonBold.Visible = true;
			this.togglebuttonItalic.Visible = true;
			this.colorbuttonBorder.Visible = false;
		}
Example #24
0
 public override ChunkStyle GetStyle(ChunkStyle baseStyle)
 {
     return(baseStyle);
 }
Example #25
0
 protected override void SetForegroundColor(ChunkStyle style)
 {
     style.Foreground = Editor.ColorStyle.BreakpointText.Foreground;
 }
		public override ChunkStyle GetStyle (ChunkStyle baseStyle)
		{
			if (baseStyle == null || IncludedStyles == StyleFlag.None)
				return baseStyle;
			
			return CreateStyle (baseStyle, Color, BackgroundColor);
		}
Example #27
0
		void SelectChunkStyle (TreeIter iter, ChunkStyle chunkStyle)
		{
			notebookColorChooser.Page = 0;
			SetColorToButton (colorbuttonFg, chunkStyle.Foreground);
			SetColorToButton (colorbuttonBg, chunkStyle.Background);

			checkbuttonBold.Active = chunkStyle.FontWeight == Xwt.Drawing.FontWeight.Bold;
			checkbuttonItalic.Active = chunkStyle.FontStyle == Xwt.Drawing.FontStyle.Italic;
			this.label4.Visible = this.colorbuttonFg.Visible = true;
			this.colorbuttonFg.Sensitive = true;
			this.label5.Visible = this.colorbuttonBg.Visible = true;
			this.colorbuttonBg.Sensitive = true;
			this.checkbuttonBold.Visible = true;
			this.checkbuttonBold.Sensitive = true;
			this.checkbuttonItalic.Visible = true;
			this.checkbuttonItalic.Sensitive = true;
		}
		public override ChunkStyle GetStyle (ChunkStyle baseStyle)
		{
			if (baseStyle == null)
				return null;

			var style = new ChunkStyle (baseStyle);
			if (forground != null && editor != null) {
				style.Foreground = forground(editor).Foreground;
			}
			return style;
		}
		public override ChunkStyle GetStyle (ChunkStyle baseStyle)
		{
			ChunkStyle st = new ChunkStyle (baseStyle);
			st.Foreground = new Cairo.Color (125, 125, 125);
			return st;
		}
		protected override void SetForegroundColor (ChunkStyle style)
		{
			style.Foreground = Editor.ColorStyle.DebuggerStackLine.Foreground;
		}
        protected override void OnDrawPage(PrintContext context, int pageNr)
        {
            using (var cr = context.CairoContext) {
                double xPos = 0, yPos = 0;

                PrintHeader(cr, context, pageNr, ref xPos, ref yPos);

                int startLine = pageNr * linesPerPage;
                int endLine   = Math.Min(startLine + linesPerPage - 1, doc.LineCount);

                //FIXME: use proper 1-layout-per-line
                for (int i = startLine; i < endLine; i++)
                {
                    var line = doc.GetLine(i + 1);
                    if (!settings.UseHighlighting)
                    {
                        string text = doc.GetTextAt(line);
                        text = text.Replace("\t", new string (' ', settings.TabSize));

                        layout.SetText(text);
                        cr.MoveTo(xPos, yPos);
                        Pango.CairoHelper.ShowLayout(cr, layout);

                        yPos += lineHeight;
                        continue;
                    }

                    Chunk startChunk = doc.SyntaxMode.GetChunks(doc, style, line, line.Offset, line.Length);
                    for (Chunk chunk = startChunk; chunk != null; chunk = chunk != null ? chunk.Next : null)
                    {
                        ChunkStyle chunkStyle = chunk != null?chunk.GetChunkStyle(style) : null;

                        string text = chunk.GetText(doc);
                        text = text.Replace("\t", new string (' ', settings.TabSize));
                        layout.SetText(text);

                        var atts = ResetAttributes();

                        atts.Insert(new Pango.AttrForeground(chunkStyle.Color.Red, chunkStyle.Color.Green, chunkStyle.Color.Blue));

                        if (chunkStyle.Bold)
                        {
                            atts.Insert(new Pango.AttrWeight(Pango.Weight.Bold));
                        }
                        if (chunkStyle.Italic)
                        {
                            atts.Insert(new Pango.AttrStyle(Pango.Style.Italic));
                        }
                        if (chunkStyle.Underline)
                        {
                            atts.Insert(new Pango.AttrUnderline(Pango.Underline.Single));
                        }

                        cr.MoveTo(xPos, yPos);
                        Pango.CairoHelper.ShowLayout(cr, layout);

                        int wout, hout;
                        layout.GetSize(out wout, out hout);
                        double w = wout / Pango.Scale.PangoScale;

                        xPos += w;

                        if (w > pageWidth)
                        {
                            break;
                        }
                    }
                    xPos  = 0;
                    yPos += lineHeight;
                }

                PrintFooter(cr, context, pageNr, ref xPos, ref yPos);
            }
        }
Example #32
0
		void SetChunkStyle (Gtk.TreeIter iter, ChunkStyle oldStyle)
		{
			var newStyle = new ChunkStyle (oldStyle);
			newStyle.Foreground = GetColorFromButton (colorbuttonFg);
			newStyle.Background =GetColorFromButton (colorbuttonBg);

			if (checkbuttonBold.Active) {
				newStyle.FontWeight = Xwt.Drawing.FontWeight.Bold;
			} else {
				newStyle.FontWeight = Xwt.Drawing.FontWeight.Normal;
			}

			if (checkbuttonItalic.Active) {
				newStyle.FontStyle = Xwt.Drawing.FontStyle.Italic;
			} else {
				newStyle.FontStyle = Xwt.Drawing.FontStyle.Normal;
			}

			colorStore.SetValue (iter, 2, newStyle);

			var newscheme = colorSheme.Clone ();
			ApplyStyle (newscheme);

			this.textEditor.TextViewMargin.PurgeLayoutCache ();
			this.textEditor.Document.MimeType = "text/x-csharp";
			this.textEditor.GetTextEditorData ().ColorStyle = newscheme;
			this.textEditor.QueueDraw ();
		}
Example #33
0
 protected virtual void SetForegroundColor(ChunkStyle style)
 {
 }