Example #1
0
        void Stylechanged(object sender, EventArgs e)
        {
            Gtk.TreeIter iter;
            if (!this.treeviewColors.Selection.GetSelected(out iter))
            {
                return;
            }
            ChunkProperties prop = ChunkProperties.None;

            if (checkbuttonBold.Active)
            {
                prop |= ChunkProperties.Bold;
            }
            if (checkbuttonItalic.Active)
            {
                prop |= ChunkProperties.Italic;
            }
            ChunkStyle oldStyle   = (ChunkStyle)colorStore.GetValue(iter, 1);
            bool       useBgColor = colorbuttonBg.Alpha > 0 && (colorbuttonBg.Color.Pixel != oldStyle.BackgroundColor.Pixel || oldStyle.GotBackgroundColorAssigned);

            colorStore.SetValue(iter, 1, useBgColor? new ChunkStyle(colorbuttonFg.Color, colorbuttonBg.Color, prop) : new ChunkStyle(colorbuttonFg.Color, prop));

            var newStyle = colorSheme.Clone();

            ApplyStyle(newStyle);
            this.textEditor.TextViewMargin.PurgeLayoutCache();
            this.textEditor.Document.MimeType = "text/x-csharp";
            this.textEditor.GetTextEditorData().ColorStyle = newStyle;
            this.textEditor.QueueDraw();
        }
Example #2
0
        void SetAmbientColor(Gtk.TreeIter iter, AmbientColor oldStyle)
        {
            var newStyle = new AmbientColor();

            newStyle.Color       = GetColorFromButton(colorbuttonPrimary);
            newStyle.SecondColor = GetColorFromButton(colorbuttonSecondary);

            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 #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();
        }