Example #1
0
        /*public override string Text
         * {
         *  get
         *  {
         *      return base.Text;
         *  }
         *  set
         *  {
         *      base.Text = value;
         *
         *      if(tabPage != null)
         *          tabPage.Text = this.Text;
         *  }
         * }*/

        public EditorWindow(MainForm mainForm)
        {
            //this.Text = "Untitled";
            //this.WindowState = FormWindowState.Maximized;
            //this.ShowIcon = false;
            //this.ShowInTaskbar = false;
            //this.DockAreas = DockAreas.Document | DockAreas.Float;
            var cfg = Globals.LoadConfiguration();
            EditorConfigurationSection section = cfg.GetEditorConfiguration();

            textEditorControl      = new TextEditorControl();
            textEditorControl.Name = "textEditorControl";
            textEditorControl.Dock = DockStyle.Fill;
            string fontFamily = section?.FontName?.Value ?? String.Empty;
            int    fontSize   = (int)(section?.FontSize?.Value ?? 12);

            textEditorControl.Font                = new Font(new FontFamily(fontFamily), fontSize, FontStyle.Regular);
            textEditorControl.ShowEOLMarkers      = section?.ShowEOLMarkers?.Value ?? false;
            textEditorControl.ShowHRuler          = section?.ShowHRuler?.Value ?? false;
            textEditorControl.ShowInvalidLines    = section?.ShowInvalidLines?.Value ?? false;
            textEditorControl.ShowLineNumbers     = section?.ShowLineNumbers?.Value ?? false;
            textEditorControl.ShowMatchingBracket = section?.ShowMatchingBrackets?.Value ?? false;
            textEditorControl.ShowSpaces          = section?.ShowSpaces?.Value ?? false;
            textEditorControl.ShowTabs            = section?.ShowTabs?.Value ?? false;
            textEditorControl.ShowVRuler          = section?.ShowVRuler?.Value ?? false;
            textEditorControl.EnableFolding       = section?.EnableFolding?.Value ?? false;
            textEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += new EventHandler(SelectionManager_SelectionChanged);
            textEditorControl.ActiveTextAreaControl.TextArea.KeyPress += new KeyPressEventHandler(TextArea_KeyPress);
            textEditorControl.TextChanged += new EventHandler(textEditorControl_TextChanged);
            textEditorControl.Show();

            this.Controls.Add(textEditorControl);

            completionKeyHandler = CodeCompletionKeyHandler.Attach(mainForm, textEditorControl);
        }
Example #2
0
        public EditorTabPage()
        {
            cfg = Globals.LoadConfiguration();
            EditorConfigurationSection section = cfg.GetEditorConfiguration();

            string fontName = section.FontName.Value;
            float  fontSize = section.FontSize.Value;

            textEditorControl              = new TextEditorControl();
            textEditorControl.Name         = "textEditorControl";
            textEditorControl.Dock         = DockStyle.Fill;
            textEditorControl.TextChanged += new EventHandler(Handle_EditorTextChanged);
            textEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += new EventHandler(SelectionManager_SelectionChanged);
            textEditorControl.AllowCaretBeyondEOL = section?.AllowCaretBeyondEOL?.Value ?? false;
            textEditorControl.ConvertTabsToSpaces = section?.ConvertTabsToSpaces?.Value ?? false;
            textEditorControl.EnableFolding       = section?.EnableFolding?.Value ?? false;
            textEditorControl.ShowEOLMarkers      = section?.ShowEOLMarkers?.Value ?? false;
            textEditorControl.ShowHRuler          = section?.ShowHRuler?.Value ?? false;
            textEditorControl.ShowInvalidLines    = section?.ShowInvalidLines?.Value ?? false;
            textEditorControl.ShowLineNumbers     = section?.ShowLineNumbers?.Value ?? false;
            textEditorControl.ShowMatchingBracket = section?.ShowMatchingBrackets?.Value ?? false;
            textEditorControl.ShowSpaces          = section?.ShowSpaces?.Value ?? false;
            textEditorControl.ShowTabs            = section?.ShowTabs?.Value ?? false;
            textEditorControl.ShowVRuler          = section?.ShowVRuler?.Value ?? false;

            if (!string.IsNullOrWhiteSpace(fontName) && fontSize > 0)
            {
                try {
                    textEditorControl.Font = new Font(new FontFamily(fontName), fontSize, FontStyle.Regular);
                } catch (Exception ex) {
                    textEditorControl.Font = new Font(FontFamily.GenericMonospace, 9.75f, FontStyle.Regular);
                    string err = ex.Message;
                }
            }

            if (section?.HighlightCurrentLine?.Value ?? false)
            {
                textEditorControl.LineViewerStyle = LineViewerStyle.FullRow;
            }
            if (string.Compare(section?.IndentStyle?.Value, "Smart") == 0)
            {
                textEditorControl.IndentStyle = IndentStyle.Smart;
            }
            if (string.Compare(section?.IndentStyle?.Value, "Auto") == 0)
            {
                textEditorControl.IndentStyle = IndentStyle.Auto;
            }
            if (string.Compare(section?.IndentStyle?.Value, "None") == 0)
            {
                textEditorControl.IndentStyle = IndentStyle.None;
            }
            if (section.AutoInsertBrackets.Value)
            {
                textEditorControl.ActiveTextAreaControl.TextEditorProperties.AutoInsertCurlyBracket = true;
            }

            textEditorControl.Show();

            this.Controls.Add(textEditorControl);
        }
Example #3
0
        /*public override string Text
         * {
         *  get
         *  {
         *      return base.Text;
         *  }
         *  set
         *  {
         *      base.Text = value;
         *
         *      if(tabPage != null)
         *          tabPage.Text = this.Text;
         *  }
         * }*/

        public EditorWindow(MainForm mainForm)
        {
            //this.Text = "Untitled";
            //this.WindowState = FormWindowState.Maximized;
            //this.ShowIcon = false;
            //this.ShowInTaskbar = false;
            //this.DockAreas = DockAreas.Document | DockAreas.Float;

            textEditorControl      = new TextEditorControl();
            textEditorControl.Name = "textEditorControl";
            textEditorControl.Dock = DockStyle.Fill;
            textEditorControl.Font = new Font(new FontFamily(SettingsManager.Settings.ReadValue <string>("Font")),
                                              SettingsManager.Settings.ReadValue <int>("FontSize"), FontStyle.Regular);
            textEditorControl.ShowEOLMarkers      = SettingsManager.Settings.ReadValue <bool>("ShowEOLMarkers");
            textEditorControl.ShowHRuler          = SettingsManager.Settings.ReadValue <bool>("ShowHRuler");
            textEditorControl.ShowInvalidLines    = SettingsManager.Settings.ReadValue <bool>("ShowInvalidLines");
            textEditorControl.ShowLineNumbers     = SettingsManager.Settings.ReadValue <bool>("ShowLineNumbers");
            textEditorControl.ShowMatchingBracket = SettingsManager.Settings.ReadValue <bool>("HighlightMatchingBrackets");
            textEditorControl.ShowSpaces          = SettingsManager.Settings.ReadValue <bool>("ShowSpaces");
            textEditorControl.ShowTabs            = SettingsManager.Settings.ReadValue <bool>("ShowTabs");
            textEditorControl.ShowVRuler          = SettingsManager.Settings.ReadValue <bool>("ShowVRuler");
            textEditorControl.EnableFolding       = SettingsManager.Settings.ReadValue <bool>("FoldingEnabled");
            textEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += new EventHandler(SelectionManager_SelectionChanged);
            textEditorControl.ActiveTextAreaControl.TextArea.KeyPress += new KeyPressEventHandler(TextArea_KeyPress);
            textEditorControl.TextChanged += new EventHandler(textEditorControl_TextChanged);
            textEditorControl.Show();

            this.Controls.Add(textEditorControl);

            completionKeyHandler = CodeCompletionKeyHandler.Attach(mainForm, textEditorControl);
        }
Example #4
0
        public EditorTabPage()
        {
            string fontName = string.Empty;
            float  fontSize = 0;

            try
            {
                fontName = SettingsManager.ReadValue <string>("FontName");
                string stringFontSize = SettingsManager.ReadAsString("FontSize");
                fontSize = float.Parse(stringFontSize, CultureInfo.InvariantCulture);
            }
            catch (Exception ex)
            {
                Debug.WriteLine(ex.ToString());
            }

            textEditorControl              = new TextEditorControl();
            textEditorControl.Name         = "textEditorControl";
            textEditorControl.Dock         = DockStyle.Fill;
            textEditorControl.TextChanged += new EventHandler(Handle_EditorTextChanged);
            textEditorControl.ActiveTextAreaControl.TextArea.SelectionManager.SelectionChanged += new EventHandler(SelectionManager_SelectionChanged);
            textEditorControl.AllowCaretBeyondEOL = SettingsManager.ReadValue <bool>("AllowCaretBeyondEOL");
            textEditorControl.ConvertTabsToSpaces = SettingsManager.ReadValue <bool>("ConvertTabsToSpaces");
            textEditorControl.EnableFolding       = SettingsManager.ReadValue <bool>("EnableFolding");
            textEditorControl.ShowEOLMarkers      = SettingsManager.ReadValue <bool>("ShowEOLMarkers");
            textEditorControl.ShowHRuler          = SettingsManager.ReadValue <bool>("ShowHRuler");
            textEditorControl.ShowInvalidLines    = SettingsManager.ReadValue <bool>("ShowInvalidLines");
            textEditorControl.ShowLineNumbers     = SettingsManager.ReadValue <bool>("ShowLineNumbers");
            textEditorControl.ShowMatchingBracket = SettingsManager.ReadValue <bool>("ShowMatchingBrackets");
            textEditorControl.ShowSpaces          = SettingsManager.ReadValue <bool>("ShowSpaces");
            textEditorControl.ShowTabs            = SettingsManager.ReadValue <bool>("ShowTabs");
            textEditorControl.ShowVRuler          = SettingsManager.ReadValue <bool>("ShowVRuler");

            if (!string.IsNullOrWhiteSpace(fontName) && fontSize > 0)
            {
                try
                {
                    textEditorControl.Font = new Font(new FontFamily(fontName), fontSize, FontStyle.Regular);
                }
                catch (Exception ex)
                {
                    textEditorControl.Font = new Font(FontFamily.GenericMonospace, 9.75f, FontStyle.Regular);
                    string err = ex.Message;
                }
            }

            if (SettingsManager.ReadValue <bool>("HighlightCurrentLine"))
            {
                textEditorControl.LineViewerStyle = LineViewerStyle.FullRow;
            }
            if (SettingsManager.ReadValue <string>("IndentStyle") == "Smart")
            {
                textEditorControl.IndentStyle = IndentStyle.Smart;
            }
            if (SettingsManager.ReadValue <string>("IndentStyle") == "Auto")
            {
                textEditorControl.IndentStyle = IndentStyle.Auto;
            }
            if (SettingsManager.ReadValue <string>("IndentStyle") == "None")
            {
                textEditorControl.IndentStyle = IndentStyle.None;
            }
            if (SettingsManager.ReadValue <bool>("AutoInsertBrackets"))
            {
                textEditorControl.ActiveTextAreaControl.TextEditorProperties.AutoInsertCurlyBracket = true;
            }

            textEditorControl.Show();

            this.Controls.Add(textEditorControl);
        }