예제 #1
0
        void HandleButtonOkClicked(object sender, EventArgs e)
        {
            Gtk.TreeIter iter;
            if (!store.IterNthChild(out iter, comboboxBaseStyle.Active))
            {
                return;
            }
            string name = (string)store.GetValue(iter, 0);

            var style = SyntaxHighlightingService.GetEditorTheme(name);

            style = style.CloneWithName(entryName.Text);

            string path     = MonoDevelop.Ide.Editor.TextEditorDisplayBinding.SyntaxModePath;
            string baseName = style.Name.Replace(" ", "_");

            while (File.Exists(System.IO.Path.Combine(path, baseName + ".tmTheme")))
            {
                baseName = baseName + "_";
            }
            string fileName = System.IO.Path.Combine(path, baseName + ".tmTheme");

            try {
                using (var writer = new StreamWriter(fileName))
                    TextMateFormat.Save(writer, style);
            } catch (Exception ex) {
                LoggingService.LogInternalError(ex);
            }
        }
예제 #2
0
        protected override void OnBeginPrint(PrintContext context)
        {
            layout = PangoUtil.CreateLayout(context);
            layout.FontDescription = settings.Font;

            using (var PangoContext = context.CreatePangoContext())
                using (var metrics = PangoContext.GetMetrics(settings.Font, PangoContext.Language)) {
                    lineHeight = Math.Ceiling(0.5 + (metrics.Ascent + metrics.Descent) / Pango.Scale.PangoScale);
                }

            SetHeaderFormat(settings.HeaderFormat);
            SetFooterFormat(settings.FooterFormat);

            style = SyntaxHighlightingService.GetEditorTheme(settings.EditorTheme);

            pageWidth  = context.PageSetup.GetPageWidth(Unit.Pixel);
            pageHeight = context.PageSetup.GetPageHeight(Unit.Pixel);
            double contentHeight = pageHeight
                                   - (headerLines > 0? settings.HeaderPadding : 0)
                                   - (footerLines > 0? settings.FooterPadding : 0);

            linesPerPage = (int)(contentHeight / lineHeight) - (headerLines + footerLines);
            totalPages   = (int)Math.Ceiling((double)editor.LineCount / linesPerPage);

            NPages = totalPages;

            base.OnBeginPrint(context);
        }
        protected override void OnBeginPrint(PrintContext context)
        {
            layout = PangoUtil.CreateLayout(context);
            layout.FontDescription = settings.Font;

            layout.FontDescription.Weight = Pango.Weight.Bold;
            layout.SetText(" ");
            int w, h;

            layout.GetSize(out w, out h);
            this.lineHeight = h / Pango.Scale.PangoScale;
            layout.FontDescription.Weight = Pango.Weight.Normal;

            SetHeaderFormat(settings.HeaderFormat);
            SetFooterFormat(settings.FooterFormat);

            style = SyntaxHighlightingService.GetEditorTheme(settings.EditorTheme);

            pageWidth  = context.PageSetup.GetPageWidth(Unit.Pixel);
            pageHeight = context.PageSetup.GetPageHeight(Unit.Pixel);
            double contentHeight = pageHeight
                                   - (headerLines > 0? settings.HeaderPadding : 0)
                                   - (footerLines > 0? settings.FooterPadding : 0);

            linesPerPage = (int)(contentHeight / lineHeight) - (headerLines + footerLines);
            totalPages   = (int)Math.Ceiling((double)doc.LineCount / linesPerPage);

            NPages = totalPages;

            base.OnBeginPrint(context);
        }
예제 #4
0
 public static EditorTheme GetEditorTheme(this ITextEditorOptions options)
 {
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     return(SyntaxHighlightingService.GetEditorTheme(options.EditorTheme));
 }
예제 #5
0
 static EditorTheme GetColorTheme()
 {
     try {
         var theme = SyntaxHighlightingService.GetEditorTheme(Ide.IdeApp.Preferences.ColorScheme);
         if (theme.FitsIdeTheme(Ide.IdeApp.Preferences.UserInterfaceTheme))
         {
             return(theme);
         }
         return(Ide.IdeApp.Preferences.UserInterfaceTheme.GetDefaultColorStyle());
     } catch (Exception e) {
         LoggingService.LogError("Error getting color theme", e);
         return(SyntaxHighlightingService.DefaultColorStyle);
     }
 }
예제 #6
0
 EditorTheme LoadStyle(string styleName, out bool error)
 {
     try {
         error = false;
         return(SyntaxHighlightingService.GetEditorTheme(styleName));
     } catch (StyleImportException) {
         error = true;
         return(new EditorTheme(styleName, new System.Collections.Generic.List <ThemeSetting> (SyntaxHighlightingService.DefaultColorStyle.Settings)));
     } catch (Exception e) {
         LoggingService.LogError("Error while loading color theme " + styleName, e);
         error = true;
         return(new EditorTheme(styleName, new System.Collections.Generic.List <ThemeSetting> (SyntaxHighlightingService.DefaultColorStyle.Settings)));
     }
 }
예제 #7
0
        void UpdateStyles(object sender = null, EventArgs e = null)
        {
            highlightStyle = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);
            if (!highlightStyle.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme))
            {
                highlightStyle = SyntaxHighlightingService.GetDefaultColorStyle(Ide.IdeApp.Preferences.UserInterfaceTheme);
            }

            if (IsRealized)
            {
                store.Foreach((model, path, iter) => {
                    model.EmitRowChanged(path, iter);
                    return(false);
                });
            }
        }
예제 #8
0
        void UpdateStyle()
        {
            var scheme = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);

            if (!scheme.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme))
            {
                scheme = SyntaxHighlightingService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceTheme);
            }

            Theme.SetSchemeColors(scheme);
            Theme.Font        = FontService.SansFont.CopyModified(Styles.FontScale11).ToXwtFont();
            Theme.ShadowColor = Styles.PopoverWindow.ShadowColor;
            foreColor         = Styles.PopoverWindow.DefaultTextColor.ToCairoColor();

            headlabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            headlabel.FontDescription = FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11);

            //if (this.Visible)
            //	QueueDraw ();
        }
        internal void SetDefaultScheme()
        {
            var scheme = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);

            if (!scheme.FitsIdeTheme(IdeApp.Preferences.UserInterfaceTheme))
            {
                scheme = SyntaxHighlightingService.GetDefaultColorStyle(IdeApp.Preferences.UserInterfaceTheme);
            }

            Theme.SetSchemeColors(scheme);
            foreColor = Styles.PopoverWindow.DefaultTextColor.ToCairoColor();
            headLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor());
            headLabel.FontDescription = IdeServices.FontService.GetFontDescription("Editor").CopyModified(Styles.FontScale11);
            Theme.Font        = IdeServices.FontService.SansFont.CopyModified(Styles.FontScale11).ToXwtFont();
            Theme.ShadowColor = Styles.PopoverWindow.ShadowColor;
                        #pragma warning disable CS0612 // Type or member is obsolete
            if (this.Visible)
            {
                ShowOverload();
            }
                        #pragma warning restore CS0612
        }
예제 #10
0
 public virtual MonoDevelop.Ide.Editor.Highlighting.EditorTheme GetEditorTheme()
 {
     return(SyntaxHighlightingService.GetEditorTheme(EditorThemeName));
 }
 void SetStyle()
 {
     colorStyle = SyntaxHighlightingService.GetEditorTheme(IdeApp.Preferences.ColorScheme);
 }