public override void LoadPanelContents() { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GeneralTextEditorPanel.xfrm")); fontListComboBox = ((ComboBox)ControlDictionary["fontListComboBox"]); fontSizeComboBox = ((ComboBox)ControlDictionary["fontSizeComboBox"]); SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance; ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked = properties.EnableFolding; ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = properties.ShowQuickClassBrowserPanel; if (IsClearTypeEnabled) { // Somehow, SingleBitPerPixelGridFit still renders as Cleartype if cleartype is enabled // and we're using the TextRenderer for rendering. // So we cannot support not using antialiasing if system-wide font smoothening is enabled. ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = true; ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Enabled = false; } else { ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = (properties.TextRenderingHint == TextRenderingHint.AntiAliasGridFit || properties.TextRenderingHint == TextRenderingHint.ClearTypeGridFit); } ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked = properties.MouseWheelTextZoom; foreach (String name in CharacterEncodings.Names) { ((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name); } int encodingIndex = 0; try { encodingIndex = CharacterEncodings.GetEncodingIndex(properties.EncodingCodePage); } catch { encodingIndex = CharacterEncodings.GetEncodingIndex(Encoding.UTF8.CodePage); } ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex; for (int i = 6; i <= 24; ++i) { fontSizeComboBox.Items.Add(i); } fontSizeComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); fontSizeComboBox.Enabled = false; fontListComboBox.Enabled = false; fontListComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); fontListComboBox.SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel); Font currentFont = FontSelectionPanel.ParseFont(properties.FontContainer.DefaultFont.ToString()); helper = new FontSelectionPanelHelper(fontSizeComboBox, fontListComboBox, currentFont); fontListComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(helper.MeasureComboBoxItem); fontListComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(helper.ComboBoxDrawItem); UpdateFontPreviewLabel(null, null); helper.StartThread(); }
public override void LoadPanelContents() { SetupFromXmlStream(this.GetType().Assembly.GetManifestResourceStream("Resources.GeneralTextEditorPanel.xfrm")); fontListComboBox = ((ComboBox)ControlDictionary["fontListComboBox"]); fontSizeComboBox = ((ComboBox)ControlDictionary["fontSizeComboBox"]); ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked = ((Properties)CustomizationObject).Get("DoubleBuffer", true); //((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked = ((Properties)CustomizationObject).Get("EnableCodeCompletion", true); ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked = ((Properties)CustomizationObject).Get("EnableFolding", true); ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = ((Properties)CustomizationObject).Get("ShowQuickClassBrowserPanel", true); ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = ((Properties)CustomizationObject).Get("UseAntiAliasFont", false); ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked = ((Properties)CustomizationObject).Get("MouseWheelTextZoom", true); foreach (String name in CharacterEncodings.Names) { ((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name); } int encodingIndex = 0; try { encodingIndex = CharacterEncodings.GetEncodingIndex((Int32)((Properties)CustomizationObject).Get("Encoding", encoding)); } catch { encodingIndex = CharacterEncodings.GetEncodingIndex(encoding); } ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex; encoding = CharacterEncodings.GetEncodingByIndex(encodingIndex).CodePage; for (int i = 6; i <= 24; ++i) { fontSizeComboBox.Items.Add(i); } fontSizeComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); fontSizeComboBox.Enabled = false; fontListComboBox.Enabled = false; fontListComboBox.TextChanged += new EventHandler(UpdateFontPreviewLabel); fontListComboBox.SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel); Font currentFont = FontSelectionPanel.ParseFont(((Properties)CustomizationObject).Get("DefaultFont", ResourceService.DefaultMonospacedFont.ToString()).ToString()); helper = new FontSelectionPanelHelper(fontSizeComboBox, fontListComboBox, currentFont); fontListComboBox.MeasureItem += new System.Windows.Forms.MeasureItemEventHandler(helper.MeasureComboBoxItem); fontListComboBox.DrawItem += new System.Windows.Forms.DrawItemEventHandler(helper.ComboBoxDrawItem); UpdateFontPreviewLabel(null, null); helper.StartThread(); }