コード例 #1
0
        public override bool StorePanelContents()
        {
            SharpDevelopTextEditorProperties properties = SharpDevelopTextEditorProperties.Instance;

            if (((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Enabled)
            {
                properties.TextRenderingHint = ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked
                                        ? TextRenderingHint.ClearTypeGridFit : TextRenderingHint.SystemDefault;
            }
            else
            {
                properties.TextRenderingHint = TextRenderingHint.SystemDefault;
            }
            properties.MouseWheelTextZoom = ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked;
            //((Properties)CustomizationObject).Set("EnableCodeCompletion", ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked);
            properties.EnableFolding = ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked;
            Font currentFont = CurrentFont;

            if (currentFont != null)
            {
                properties.Font = currentFont;
            }
            properties.EncodingCodePage           = CharacterEncodings.GetCodePageByIndex(((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex);
            properties.ShowQuickClassBrowserPanel = ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked;

            IViewContent activeViewContent = WorkbenchSingleton.Workbench.ActiveViewContent;

            if (activeViewContent is ITextEditorControlProvider)
            {
                TextEditorControl textarea = ((ITextEditorControlProvider)activeViewContent).TextEditorControl;
                textarea.OptionsChanged();
            }
            return(true);
        }
コード例 #2
0
        public override bool StorePanelContents()
        {
            ((Properties)CustomizationObject).Set("DoubleBuffer", ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("UseAntiAliasFont", ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("MouseWheelTextZoom", ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked);
            //((Properties)CustomizationObject).Set("EnableCodeCompletion", ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked);
            ((Properties)CustomizationObject).Set("EnableFolding", ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked);
            Font currentFont = CurrentFont;

            if (currentFont != null)
            {
                ((Properties)CustomizationObject).Set("DefaultFont", currentFont.ToString());
            }
            ((Properties)CustomizationObject).Set("Encoding", CharacterEncodings.GetCodePageByIndex(((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex));
            ((Properties)CustomizationObject).Set("ShowQuickClassBrowserPanel", ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked);

            IWorkbenchWindow window = WorkbenchSingleton.Workbench.ActiveWorkbenchWindow;

            if (window != null && (window.ViewContent is ITextEditorControlProvider))
            {
                TextEditorControl textarea = ((ITextEditorControlProvider)window.ViewContent).TextEditorControl;
                textarea.OptionsChanged();
            }
            return(true);
        }
コード例 #3
0
        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();
        }
コード例 #4
0
        public override bool StorePanelContents()
        {
            ((IProperties)CustomizationObject).SetProperty("DoubleBuffer", ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked);
            ((IProperties)CustomizationObject).SetProperty("UseAntiAliasFont", ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked);
            ((IProperties)CustomizationObject).SetProperty("MouseWheelTextZoom", ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked);
            ((IProperties)CustomizationObject).SetProperty("EnableCodeCompletion", ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked);
            ((IProperties)CustomizationObject).SetProperty("EnableFolding", ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked);
            ((IProperties)CustomizationObject).SetProperty("DefaultFont", CurrentFont.ToString());
            ((IProperties)CustomizationObject).SetProperty("Encoding", CharacterEncodings.GetCodePageByIndex(((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex));
            ((IProperties)CustomizationObject).SetProperty("ShowQuickClassBrowserPanel", ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked);



            IViewContent content = WorkbenchSingleton.Workbench.ActiveViewContent;

            if (content != null && (content is TextEditorView))
            {
                TextEditorControl textEditorContorl = content.Control as TextEditorControl;
                textEditorContorl.OptionsChanged();
            }
            return(true);
        }
コード例 #5
0
        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();
        }
コード例 #6
0
        public override void LoadPanelContents()
        {
            SetupFromXmlFile(Path.Combine(PropertyService.DataDirectory, @"resources\panels\GeneralTextEditorPanel.xfrm"));

            ((CheckBox)ControlDictionary["enableDoublebufferingCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("DoubleBuffer", true);
            ((CheckBox)ControlDictionary["enableCodeCompletionCheckBox"]).Checked  = ((IProperties)CustomizationObject).GetProperty("EnableCodeCompletion", true);
            ((CheckBox)ControlDictionary["enableFoldingCheckBox"]).Checked         = ((IProperties)CustomizationObject).GetProperty("EnableFolding", true);
            ((CheckBox)ControlDictionary["showQuickClassBrowserCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("ShowQuickClassBrowserPanel", true);

            ((CheckBox)ControlDictionary["enableAAFontRenderingCheckBox"]).Checked = ((IProperties)CustomizationObject).GetProperty("UseAntiAliasFont", false);
            ((CheckBox)ControlDictionary["mouseWheelZoomCheckBox"]).Checked        = ((IProperties)CustomizationObject).GetProperty("MouseWheelTextZoom", true);

            foreach (String name in CharacterEncodings.Names)
            {
                ((ComboBox)ControlDictionary["textEncodingComboBox"]).Items.Add(name);
            }
            int encodingIndex = 0;

            try
            {
                encodingIndex = CharacterEncodings.GetEncodingIndex((Int32)((IProperties)CustomizationObject).GetProperty("Encoding", encoding));
            }
            catch
            {
                encodingIndex = CharacterEncodings.GetEncodingIndex(encoding);
            }
            ((ComboBox)ControlDictionary["textEncodingComboBox"]).SelectedIndex = encodingIndex;
            encoding = CharacterEncodings.GetEncodingByIndex(encodingIndex).CodePage;

            Font currentFont = ParseFont(((IProperties)CustomizationObject).GetProperty("DefaultFont", new Font("Courier New", 10)).ToString());

            for (int i = 6; i <= 24; ++i)
            {
                ((ComboBox)ControlDictionary["fontSizeComboBox"]).Items.Add(i);
            }
            ((ComboBox)ControlDictionary["fontSizeComboBox"]).Text         = currentFont.Size.ToString();
            ((ComboBox)ControlDictionary["fontSizeComboBox"]).TextChanged += new EventHandler(UpdateFontPreviewLabel);

            InstalledFontCollection installedFontCollection = new InstalledFontCollection();

            int index = 0;

            foreach (FontFamily fontFamily in installedFontCollection.Families)
            {
                if (fontFamily.IsStyleAvailable(FontStyle.Regular) && fontFamily.IsStyleAvailable(FontStyle.Bold) && fontFamily.IsStyleAvailable(FontStyle.Italic))
                {
                    if (fontFamily.Name == currentFont.Name)
                    {
                        index = ((ComboBox)ControlDictionary["fontListComboBox"]).Items.Count;
                    }
                    ((ComboBox)ControlDictionary["fontListComboBox"]).Items.Add(new FontDescriptor(fontFamily.Name, IsMonospaced(fontFamily)));
                }
            }

            ((ComboBox)ControlDictionary["fontListComboBox"]).SelectedIndex         = index;
            ((ComboBox)ControlDictionary["fontListComboBox"]).TextChanged          += new EventHandler(UpdateFontPreviewLabel);
            ((ComboBox)ControlDictionary["fontListComboBox"]).SelectedIndexChanged += new EventHandler(UpdateFontPreviewLabel);
            ((ComboBox)ControlDictionary["fontListComboBox"]).MeasureItem          += new System.Windows.Forms.MeasureItemEventHandler(this.MeasureComboBoxItem);
            ((ComboBox)ControlDictionary["fontListComboBox"]).DrawItem             += new System.Windows.Forms.DrawItemEventHandler(this.ComboBoxDrawItem);

            boldComboBoxFont = new Font(ControlDictionary["fontListComboBox"].Font, FontStyle.Bold);

            UpdateFontPreviewLabel(this, EventArgs.Empty);
        }