public static void Initialize() { if (platformService != null) { return; } object[] platforms = AddinManager.GetExtensionObjects("/MonoDevelop/Core/PlatformService"); if (platforms.Length > 0) { platformService = (PlatformService)platforms [0]; } else { platformService = new DefaultPlatformService(); LoggingService.LogFatalError("A platform service implementation has not been found."); } if (PlatformService.CanOpenTerminal) { Runtime.ProcessService.SetExternalConsoleHandler(PlatformService.StartConsoleProcess); } FileService.FileRemoved += DispatchService.GuiDispatch( new EventHandler <FileEventArgs> (NotifyFileRemoved)); FileService.FileRenamed += DispatchService.GuiDispatch( new EventHandler <FileCopyEventArgs> (NotifyFileRenamed)); // Ensure we initialize the native toolkit on the UI thread immediately // so that we can safely access this property later in other threads GC.KeepAlive(NativeToolkit); FontService.Initialize(); }
/// <summary> /// Initializes a new instance of the ItemProperties class. /// </summary> public ItemProperties(MainForm instance) : base(instance.ServiceProvider) { this.Owner = instance; this.InitializeComponent(); #region Apply custom font this.ButtonOK.Font = FontService.GetFontAlbertusMTLight(12F); this.labelPrefixProperties.Font = FontService.GetFontAlbertusMTLight(11.25F); this.labelBaseItemProperties.Font = FontService.GetFontAlbertusMTLight(11.25F); this.checkBoxFilterExtraInfo.Font = FontService.GetFontAlbertusMTLight(11.25F); this.labelSuffixProperties.Font = FontService.GetFontAlbertusMTLight(11.25F); this.Font = FontService.GetFontAlbertusMT(9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); #endregion this.Text = Resources.ItemPropertiesText; this.ButtonOK.Text = Resources.GlobalOK; this.labelPrefixProperties.Text = Resources.ItemPropertiesLabelPrefixProperties; this.labelBaseItemProperties.Text = Resources.ItemPropertiesLabelBaseItemProperties; this.labelSuffixProperties.Text = Resources.ItemPropertiesLabelSuffixProperties; this.checkBoxFilterExtraInfo.Text = Resources.ItemPropertiesCheckBoxLabelFilterExtraInfo; this.NormalizeBox = false; this.DrawCustomBorder = true; }
public override void ApplyState(VObject obj) { base.ApplyState(obj); var t = (BaseTextVObject)obj; t.Text = Txt.Replace(">", ">").Replace("<", "<").Replace(""", "\"").Replace("&", "&"); // Backward compatibility if (F_N == null && FN != null) { var font = FontService.FindSuitableFont(FN, B, I, S); t.Font.FauxBold = font.FauxBold; t.Font.FauxItalic = font.FauxItalic; t.Font.PostScriptName = font.PostScriptName; t.Font.Size = FS; } else { t.Font.FauxBold = F_FB; t.Font.FauxItalic = F_FI; t.Font.PostScriptName = F_N; t.Font.Size = F_S; } t.TextColor = TC; t.Underline = U; t.SetInternalAlignment(A); t.Tracking = Tr; t.Leading = Ld; t.CurrentFileId = CFI; t.IsRichText = IRT; t.VerticalScale = VS; t.HorizontalScale = HS; }
/// <summary> /// Initializes a new instance of the ItemSeedDialog class. /// </summary> public ItemSeedDialog(MainForm instance) : base(instance.ServiceProvider) { this.Owner = instance; this.InitializeComponent(); #region Apply custom font this.itemSeedBox.Font = FontService.GetFontAlbertusMTLight(11.25F); this.ButtonRandom.Font = FontService.GetFontAlbertusMTLight(12F); this.ButtonOk.Font = FontService.GetFontAlbertusMTLight(12F); this.ButtonCancel.Font = FontService.GetFontAlbertusMTLight(12F); this.labelInfos.Font = FontService.GetFontAlbertusMTLight(11.25F); this.Font = FontService.GetFontAlbertusMTLight(11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); #endregion this.DrawCustomBorder = true; this.Text = Resources.SeedText; this.labelInfos.Text = Resources.SeedLabel1; this.ButtonCancel.Text = Resources.GlobalCancel; this.ButtonRandom.Text = Resources.SeedBtnRandom; this.ButtonOk.Text = Resources.GlobalOK; // Set options for Right to Left reading. if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) { rightToLeftOptions = MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading; } }
public ProfileButton(FontService fontService, string label, Action clicked, int x, int y, int padding, int height, int width = -1) { _fontService = fontService; _clicked = clicked; UpdateSize(label, x, y, padding, height, width); }
/// <summary> /// Initializes a new instance of the AboutBox class. /// </summary> public AboutBox(IServiceProvider serviceProvider) : base(serviceProvider) { this.InitializeComponent(); #region Apply custom font this.labelProductName.Font = FontService.GetFontLight(11.25F); this.labelVersion.Font = FontService.GetFontLight(11.25F); this.labelCopyright.Font = FontService.GetFontLight(11.25F); this.textBoxDescription.Font = FontService.GetFontLight(9.75F); this.buttonOK.Font = FontService.GetFontLight(12F); #endregion // Initialize the AboutBox to display the product information from the assembly information. // Change assembly information settings for your application through either: // - Project->Properties->Application->Assembly Information // - AssemblyInfo.cs this.Text = string.Format(CultureInfo.CurrentCulture, Resources.AboutText, AssemblyTitle); this.labelProductName.Text = AssemblyProduct; this.labelVersion.Text = string.Format(CultureInfo.CurrentCulture, Resources.AboutVersion, AssemblyVersion); this.labelCopyright.Text = AssemblyCopyright; this.textBoxDescription.Text = Resources.AboutDescription; // AssemblyDescription; this.NormalizeBox = false; this.DrawCustomBorder = true; }
VBox CreateCategory(string categoryName, string categoryContentMarkup) { var vbox = new VBox(); vbox.Spacing = 2; if (categoryName != null) { var catLabel = new FixedWidthWrapLabel(); catLabel.Text = categoryName; catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); catLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(catLabel, false, true, 0); } var contentLabel = new FixedWidthWrapLabel(); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = categoryContentMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(contentLabel, true, true, 0); return(vbox); }
/// <summary> /// Initializes a new instance of the SearchDialog class. /// </summary> public SearchDialog(MainForm instance) : base(instance.ServiceProvider) { this.Owner = instance; this.InitializeComponent(); #region Apply custom font this.searchLabel.Font = FontService.GetFontAlbertusMT(9F); this.searchTextBox.Font = FontService.GetFontAlbertusMT(9F); this.findButton.Font = FontService.GetFontAlbertusMTLight(12F); this.cancelButton.Font = FontService.GetFontAlbertusMTLight(12F); this.Font = FontService.GetFontAlbertusMT(9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, (byte)(0)); #endregion // Load localized strings this.Text = Resources.SearchDialogCaption; this.searchLabel.Text = Resources.SearchDialogText; this.findButton.Text = Resources.MainFormSearchButtonText; this.cancelButton.Text = Resources.GlobalCancel; this.searchTextBox.Focus(); this.NormalizeBox = false; }
/// <summary> /// Initializes a new instance of the ItemSeedDialog class. /// </summary> public CharacterEditDialog(IServiceProvider serviceProvider, ITranslationService translationService, ILogger <CharacterEditDialog> log) : base(serviceProvider) { this.Log = log; this.TranslationService = translationService; this.InitializeComponent(); #region Apply custom font this.ResetMasteriesScalingButton.Font = FontService.GetFontLight(12F); this.ResetAttributesScalingButton.Font = FontService.GetFontLight(12F); this.ok.Font = FontService.GetFontLight(12F); this.cancel.Font = FontService.GetFontLight(12F); this.Font = FontService.GetFontLight(11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); new[] { this.attribGroupBox, this.levelingGroupBox, this.MasteriesGroupBox }.SelectMany(gb => gb.Controls.OfType <Control>(), (gb, child) => (gb, child)) .ToList() .ForEach(tup => tup.gb.Font = tup.child.Font = FontService.GetFontLight(11F)); #endregion this.NormalizeBox = false; this.DrawCustomBorder = true; this.cancel.Text = Resources.GlobalCancel; this.ok.Text = Resources.GlobalOK; this.ResetMasteriesScalingButton.Text = Resources.ResetMasteriesButton; this.ResetAttributesScalingButton.Text = Resources.ResetAttributesButton; }
VBox CreateCategory(string categoryName, string categoryContentMarkup) { var vbox = new VBox(); vbox.Spacing = 2; var catLabel = new MonoDevelop.Components.FixedWidthWrapLabel(); catLabel.Text = categoryName; catLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); catLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(catLabel, false, true, 0); var contentLabel = new MonoDevelop.Components.FixedWidthWrapLabel(); contentLabel.MaxWidth = Math.Max(440, this.Allocation.Width); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = true; contentLabel.BreakOnPunctuation = true; contentLabel.Markup = categoryContentMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); vbox.PackStart(contentLabel, true, true, 0); return(vbox); }
void SetOptions() { var name = FontService.FilterFontName(FontService.GetUnderlyingFontName("Editor")); hexEditor.Options.FontName = name; hexEditor.PurgeLayoutCaches(); hexEditor.Repaint(); }
void UpdateFont(MonoDevelop.Components.FixedWidthWrapLabel label) { if (label == null) { return; } label.FontDescription = FontService.GetFontDescription("Pad"); }
DefaultSourceEditorOptions(MonoDevelop.Ide.Gui.Content.TextStylePolicy currentPolicy) { LoadAllPrefs(); UpdateStylePolicy(currentPolicy); PropertyService.PropertyChanged += UpdatePreferences; FontService.RegisterFontChangedCallback("Editor", UpdateFont); FontService.RegisterFontChangedCallback("MessageBubbles", UpdateFont); }
public CommonTextEditorOptions() { PropertyService.PropertyChanged += PropertyServiceChanged; base.FontName = PropertyService.Get("FontName", FontService.MonospaceFontName); base.ColorScheme = IdeApp.Preferences.ColorScheme; FontService.RegisterFontChangedCallback("Editor", UpdateFont); FontService.RegisterFontChangedCallback("Editor(Gutter)", UpdateFont); }
protected override void OnDestroyed() { isDisposed = true; FontService.RemoveCallback(OnDiffFontChanged); IdeApp.Preferences.CustomOutputPadFont.Changed -= OnTextFontChanged; DisposeLayout(); base.OnDestroyed(); }
public CommonTextEditorOptions() { PropertyService.PropertyChanged += PropertyServiceChanged; base.FontName = PropertyService.Get("FontName", MonoDevelop.Ide.DesktopService.DefaultMonospaceFont); base.ColorScheme = PropertyService.Get("ColorScheme", "Default"); base.UseAntiAliasing = PropertyService.Get("UseAntiAliasing", true); FontService.RegisterFontChangedCallback("Editor", UpdateFont); }
public MessageBubbleCache(TextEditor editor) { this.editor = editor; errorPixbuf = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Error, Gtk.IconSize.Menu); warningPixbuf = ImageService.GetPixbuf(MonoDevelop.Ide.Gui.Stock.Warning, Gtk.IconSize.Menu); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; fontDescription = FontService.GetFontDescription("MessageBubbles"); }
internal void EnsureLayoutCreated(TextEditor editor) { if (colorMatrix == null && editor.ColorStyle != null) { bool isError = errors.Any(e => e.IsError); if (errorMatrix == null) { errorGc = (HslColor)(editor.ColorStyle.GetChunkStyle("bubble.error.text").Color); warningGc = (HslColor)(editor.ColorStyle.GetChunkStyle("bubble.warning.text").Color); errorMatrix = CreateColorMatrix(editor, true); warningMatrix = CreateColorMatrix(editor, false); } colorMatrix = isError ? errorMatrix : warningMatrix; gc = isError ? errorGc : warningGc; gcSelected = (HslColor)editor.ColorStyle.Selection.Color; gcLight = new Cairo.Color(1, 1, 1); } if (layouts != null) { return; } layouts = new List <LayoutDescriptor> (); fontDescription = FontService.GetFontDescription("MessageBubbles"); foreach (ErrorText errorText in errors) { Pango.Layout layout = new Pango.Layout(editor.PangoContext); layout.FontDescription = fontDescription; string firstLine = errorText.ErrorMessage ?? ""; int idx = firstLine.IndexOfAny(new [] { '\n', '\r' }); if (idx > 0) { firstLine = firstLine.Substring(0, idx); } layout.SetText(firstLine); KeyValuePair <int, int> textSize; if (!textWidthDictionary.TryGetValue(errorText.ErrorMessage, out textSize)) { int w, h; layout.GetPixelSize(out w, out h); textSize = new KeyValuePair <int, int> (w, h); textWidthDictionary[errorText.ErrorMessage] = textSize; } layouts.Add(new LayoutDescriptor(layout, textSize.Key, textSize.Value)); } if (errorCountLayout == null && errors.Count > 1) { errorCountLayout = new Pango.Layout(editor.PangoContext); errorCountLayout.FontDescription = fontDescription; errorCountLayout.SetText(errors.Count.ToString()); } }
public void Dispose() { FontService.RemoveCallback(UpdateFont); IdeApp.Preferences.ColorScheme.Changed -= OnColorSchemeChanged; if (context != null) { context.CodingConventionsChangedAsync -= UpdateContextOptions; } }
void ShowOverload() { ClearDescriptions(); if (current_overload >= 0 && current_overload < overloads.Count) { var o = overloads[current_overload]; headLabel.Markup = o.SignatureMarkup; headLabel.Visible = !string.IsNullOrEmpty(o.SignatureMarkup); int x, y; GetPosition(out x, out y); var geometry = DesktopService.GetUsableMonitorGeometry(Screen, Screen.GetMonitorAtPoint(x, y)); headLabel.MaxWidth = Math.Max(geometry.Width / 5, 480); if (Theme.DrawPager && overloads.Count > 1) { headLabel.WidthRequest = headLabel.RealWidth + 70; } else { headLabel.WidthRequest = -1; } foreach (var cat in o.Categories) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(cat.Item1), cat.Item2, foreColor), true, true, 4); } if (!string.IsNullOrEmpty(o.SummaryMarkup)) { descriptionBox.PackStart(CreateCategory(GetHeaderMarkup(GettextCatalog.GetString("Summary")), o.SummaryMarkup, foreColor), true, true, 4); } if (!string.IsNullOrEmpty(o.FooterMarkup)) { var contentLabel = new FixedWidthWrapLabel(); contentLabel.Wrap = Pango.WrapMode.WordChar; contentLabel.BreakOnCamelCasing = false; contentLabel.BreakOnPunctuation = false; contentLabel.MaxWidth = 400; contentLabel.Markup = o.FooterMarkup.Trim(); contentLabel.ModifyFg(StateType.Normal, foreColor.ToGdkColor()); contentLabel.FontDescription = FontService.GetFontDescription("Editor"); descriptionBox.PackEnd(contentLabel, true, true, 4); } if (string.IsNullOrEmpty(o.SummaryMarkup) && string.IsNullOrEmpty(o.FooterMarkup) && !o.Categories.Any()) { descriptionBox.Hide(); } else { descriptionBox.ShowAll(); } Theme.CurrentPage = current_overload; QueueResize(); } }
protected override void SetValue(object value) { int fontSize = Convert.ToInt32(value) * 1024; FontDescription fontDescription = FontService.MonospaceFont.Copy(); fontDescription.Size = fontSize; Runtime.RunInMainThread(() => { FontService.SetFont("Editor", fontDescription.ToString()); }).Wait(); }
public override void Dispose() { if (disposed) { return; } disposed = true; PropertyService.PropertyChanged -= PropertyServiceChanged; FontService.RemoveCallback(UpdateFont); }
protected override void SetValue(object value) { int fontSize = Convert.ToInt32(value) * 1024; FontDescription fontDescription = FontService.MonospaceFont.Copy(); fontDescription.Size = fontSize; DispatchService.GuiSyncDispatch(() => { FontService.SetFont("Editor", fontDescription.ToString()); }); }
DefaultSourceEditorOptions(TextStylePolicy currentPolicy) { wordNavigationStyle = ConfigurationProperty.Create("WordNavigationStyle", WordNavigationStyle.Windows); UpdateStylePolicy(currentPolicy); FontService.RegisterFontChangedCallback("Editor", UpdateFont); FontService.RegisterFontChangedCallback("MessageBubbles", UpdateFont); IdeApp.Preferences.ColorScheme.Changed += OnColorSchemeChanged; }
public void InitCell(Widget container, bool diffMode, string[] lines, TreePath path) { if (isDisposed) { return; } if (lines == null) { throw new ArgumentNullException("lines"); } this.lines = lines; this.diffMode = diffMode; this.path = path; if (diffMode) { if (lines != null && lines.Length > 0) { int maxlen = -1; int maxlin = -1; for (int n = 0; n < lines.Length; n++) { string line = ProcessLine(lines [n]); if (line == null) { throw new Exception("Line " + n + " from diff was null."); } if (line.Length > maxlen) { maxlen = lines [n].Length; maxlin = n; } } DisposeLayout(); layout = CreateLayout(container, lines [maxlin]); layout.GetPixelSize(out width, out lineHeight); height = lineHeight * lines.Length; width += LeftPaddingBlock + RightPadding; } else { width = height = 0; } } else { DisposeLayout(); layout = CreateLayout(container, string.Join(Environment.NewLine, lines)); layout.GetPixelSize(out width, out height); } FontService.RegisterFontChangedCallback("Editor", OnDiffFontChanged); IdeApp.Preferences.CustomOutputPadFont.Changed += OnTextFontChanged; }
public MessageBubbleCache(TextEditor editor) { this.editor = editor; errorPixbuf = ImageService.GetPixbuf("md-bubble-error", Gtk.IconSize.Menu); warningPixbuf = ImageService.GetPixbuf("md-bubble-warning", Gtk.IconSize.Menu); editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; fontDescription = FontService.GetFontDescription("MessageBubbles"); }
/// <summary> /// Initializes a new instance of the VaultMaintenanceDialog class. /// </summary> public VaultMaintenanceDialog(MainForm instance) : base(instance.ServiceProvider) { this.Owner = instance; this.InitializeComponent(); #region Apply custom font this.targetTextBox.Font = FontService.GetFontLight(11F); this.instructionsLabel.Font = FontService.GetFontLight(11F); this.okayButton.Font = FontService.GetFontLight(12F); this.cancelButton.Font = FontService.GetFontLight(12F); this.vaultListComboBox.Font = FontService.GetFontLight(11F); this.newRadioButton.Font = FontService.GetFontLight(11.25F); this.selectFunctionGroupBox.Font = FontService.GetFontLight(11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.renameRadioButton.Font = FontService.GetFontLight(11.25F); this.copyRadioButton.Font = FontService.GetFontLight(11.25F); this.deleteRadioButton.Font = FontService.GetFontLight(11.25F); this.sourceLabel.Font = FontService.GetFontLight(11F); this.targetLabel.Font = FontService.GetFontLight(11F); this.Font = FontService.GetFont(9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); #endregion // Load the localized resources this.Text = Resources.MaintenanceText; this.copyRadioButton.Text = Resources.MaintenanceRbCopy; this.deleteRadioButton.Text = Resources.MaintenanceRbDelete; this.newRadioButton.Text = Resources.MaintenanceRbNew; this.renameRadioButton.Text = Resources.MaintenanceRbRename; this.selectFunctionGroupBox.Text = Resources.MaintenanceGroup; this.selectFunctionGroupBox.ForeColor = Color.White; this.cancelButton.Text = Resources.GlobalCancel; this.okayButton.Text = Resources.GlobalOK; this.instructionsLabel.Text = Resources.MaintenanceInstructions; this.sourceLabel.Text = Resources.MaintenanceSource; this.targetLabel.Text = Resources.MaintenanceTarget; // Set options for Right to Left reading. if (CultureInfo.CurrentUICulture.TextInfo.IsRightToLeft) { rightToLeftOptions = MessageBoxOptions.RightAlign | MessageBoxOptions.RtlReading; } this.DrawCustomBorder = true; // Load the invalid characters this.invalidChars = Path.GetInvalidFileNameChars(); this.GetVaultList(); }
DefaultSourceEditorOptions(TextStylePolicy currentPolicy) { WordNavigationStyle defaultWordNavigation = WordNavigationStyle.Unix; if (Platform.IsWindows) { defaultWordNavigation = WordNavigationStyle.Windows; } wordNavigationStyle = ConfigurationProperty.Create("WordNavigationStyle", defaultWordNavigation); UpdateStylePolicy(currentPolicy); FontService.RegisterFontChangedCallback("Editor", UpdateFont); FontService.RegisterFontChangedCallback("MessageBubbles", UpdateFont); }
public MessageBubbleCache(MonoTextEditor editor) { this.editor = editor; editor.EditorOptionsChanged += HandleEditorEditorOptionsChanged; editor.TextArea.LeaveNotifyEvent += HandleLeaveNotifyEvent; editor.TextArea.MotionNotifyEvent += HandleMotionNotifyEvent; editor.TextArea.BeginHover += HandleBeginHover; editor.VAdjustment.ValueChanged += HandleValueChanged; editor.HAdjustment.ValueChanged += HandleValueChanged; fontDescription = FontService.GetFontDescription("Pad"); tooltipFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); errorCountFontDescription = FontService.GetFontDescription("Pad").CopyModified(weight: Pango.Weight.Bold); }
internal IdePreferences() { FontService.RegisterFontChangedCallback("OutputPad", delegate { if (CustomOutputPadFontChanged != null) { CustomOutputPadFontChanged(null, EventArgs.Empty); } }); FontService.RegisterFontChangedCallback("Pad", delegate { if (CustomPadFontChanged != null) { CustomPadFontChanged(null, EventArgs.Empty); } }); }
/// <summary> /// Initializes a new instance of the <see cref="FontManager"/> class. /// </summary> /// <param name="display">The display.</param> public FontManager(IDisplay display) { this.display = display; this.fontService = new FontService(); }