Beispiel #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);
        }
Beispiel #2
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);
        }
        public static CodeCompletionKeyHandler Attach(MainForm mainForm, TextEditorControl editor)
        {
            CodeCompletionKeyHandler cckh = new CodeCompletionKeyHandler(mainForm, editor);

            editor.ActiveTextAreaControl.TextArea.KeyEventHandler += cckh.TextArea_KeyEventHandler;

            return(cckh);
        }