The SyntaxDocument is a component that is responsible for Parsing , Folding , Undo / Redo actions and various text actions.
Наследование: System.ComponentModel.Component, IEnumerable
Пример #1
0
		public void Start(Alsing.Windows.Forms.SyntaxBoxControl syntaxbox, Alsing.SourceCode.SyntaxDocument syntaxdoc, string arguments)
		{
			this.syntaxBox = syntaxbox;
			this.syntaxDocument = syntaxdoc;
			this.Arguments = arguments;
			_stopped = false;
			try {
			worker.RunWorkerAsync();
			} catch {
			}
		}
Пример #2
0
        /// <summary>
        /// Default constructor for the SyntaxBoxControl
        /// </summary>
        public SyntaxBoxControl()
        {
            try
            {
                Document = new SyntaxDocument();


                CreateViews();


                InitializeComponent();
                SetStyle(ControlStyles.Selectable, true);

                //assign keys
                KeyboardActions.Add(new KeyboardAction(Keys.Z, false, true, false,
                                                       false, Undo));
                KeyboardActions.Add(new KeyboardAction(Keys.Y, false, true, false,
                                                       false, Redo));

                KeyboardActions.Add(new KeyboardAction(Keys.F3, false, false, false,
                                                       true, FindNext));

                KeyboardActions.Add(new KeyboardAction(Keys.C, false, true, false, true,
                                                       Copy));
                KeyboardActions.Add(new KeyboardAction(Keys.X, false, true, false,
                                                       false, CutClear));
                KeyboardActions.Add(new KeyboardAction(Keys.V, false, true, false,
                                                       false, Paste));

                KeyboardActions.Add(new KeyboardAction(Keys.Insert, false, true, false,
                                                       true, Copy));
                KeyboardActions.Add(new KeyboardAction(Keys.Delete, true, false, false,
                                                       false, Cut));
                KeyboardActions.Add(new KeyboardAction(Keys.Insert, true, false, false,
                                                       false, Paste));

                KeyboardActions.Add(new KeyboardAction(Keys.A, false, true, false, true,
                                                       SelectAll));

                KeyboardActions.Add(new KeyboardAction(Keys.F, false, true, false,
                                                       false, ShowFind));
                KeyboardActions.Add(new KeyboardAction(Keys.H, false, true, false,
                                                       false, ShowReplace));
                KeyboardActions.Add(new KeyboardAction(Keys.G, false, true, false, true,
                                                       ShowGotoLine));
                KeyboardActions.Add(new KeyboardAction(Keys.T, false, true, false,
                                                       false, ShowSettings));

                KeyboardActions.Add(new KeyboardAction(Keys.F2, false, true, false,
                                                       true, ToggleBookmark));
                KeyboardActions.Add(new KeyboardAction(Keys.F2, false, false, false,
                                                       true, GotoNextBookmark));
                KeyboardActions.Add(new KeyboardAction(Keys.F2, true, false, false,
                                                       true, GotoPreviousBookmark)
                    );

                KeyboardActions.Add(new KeyboardAction(Keys.Escape, false, false, false,
                                                       true, ClearSelection));

                KeyboardActions.Add(new KeyboardAction(Keys.Tab, false, false, false,
                                                       false, Selection.Indent));
                KeyboardActions.Add(new KeyboardAction(Keys.Tab, true, false, false,
                                                       false, Selection.Outdent));

                AutoListIcons = _AutoListIcons;
            }
            catch
            {
                //	Console.WriteLine (x.StackTrace);
            }
        }
Пример #3
0
        public void AttachDocument(SyntaxDocument document)
        {
            //_Document=document;

            if (_Document != null)
            {
                _Document.ParsingCompleted -= OnParsingCompleted;
                _Document.Parsing -= OnParse;
                _Document.Change -= OnChange;
            }

            if (document == null)
                document = new SyntaxDocument();

            _Document = document;

            if (_Document != null)
            {
                _Document.ParsingCompleted += OnParsingCompleted;
                _Document.Parsing += OnParse;
                _Document.Change += OnChange;
            }

            Redraw();
        }
 public SourceCodePrintDocument(SyntaxDocument document)
 {
     Document = document;
 }
Пример #5
0
 /// <summary>
 /// Required method for Designer support - do not modify
 /// the contents of this method with the code editor.
 /// </summary>
 public void InitializeComponent()
 {
     this.components = new System.ComponentModel.Container();
     System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditForm));
     this.statusBar1 = new System.Windows.Forms.StatusBar();
     this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
     this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
     this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
     this.sDoc = new Alsing.SourceCode.SyntaxDocument(this.components);
     this.sBox = new Alsing.Windows.Forms.SyntaxBoxControl();
     this.syntaxDocument1 = new Alsing.SourceCode.SyntaxDocument(this.components);
     this.MenuStrip1 = new System.Windows.Forms.MenuStrip();
     this.FileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.NewToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.OpenToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.SaveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.SaveAsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator1 = new System.Windows.Forms.ToolStripSeparator();
     this.PrintSetupToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.PrintToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
     this.ExitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.EditToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.UndoToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
     this.CutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.CopyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.PasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator5 = new System.Windows.Forms.ToolStripSeparator();
     this.SelectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.TimeDateToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.GotoLineToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator6 = new System.Windows.Forms.ToolStripSeparator();
     this.FindToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ReplaceToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
     this.ShowTABCharactersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ShowTabGuidesToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ShowFaoldingToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ShowEOLMarkersToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ShowScopeIndicatorToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ToolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.DocumentSettingsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
     this.ExitToolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
     this.IntelliMouseControl1 = new Alsing.Windows.Forms.CoreLib.IntelliMouseControl();
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel1).BeginInit();
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel2).BeginInit();
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel3).BeginInit();
     this.MenuStrip1.SuspendLayout();
     this.SuspendLayout();
     //
     //statusBar1
     //
     this.statusBar1.Location = new System.Drawing.Point(0, 471);
     this.statusBar1.Name = "statusBar1";
     this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
                                         this.statusBarPanel1,
                                         this.statusBarPanel2,
                                         this.statusBarPanel3
                                     });
     this.statusBar1.ShowPanels = true;
     this.statusBar1.Size = new System.Drawing.Size(504, 22);
     this.statusBar1.TabIndex = 1;
     //
     //statusBarPanel1
     //
     this.statusBarPanel1.Name = "statusBarPanel1";
     this.statusBarPanel1.Width = 200;
     //
     //statusBarPanel2
     //
     this.statusBarPanel2.Name = "statusBarPanel2";
     this.statusBarPanel2.Width = 200;
     //
     //statusBarPanel3
     //
     this.statusBarPanel3.Name = "statusBarPanel3";
     //
     //sDoc
     //
     this.sDoc.Lines = new string[] { "abc" };
     this.sDoc.MaxUndoBufferSize = 1000;
     this.sDoc.Modified = false;
     this.sDoc.UndoStep = 0;
     //
     //sBox
     //
     this.sBox.ActiveView = Alsing.Windows.Forms.ActiveView.BottomRight;
     this.sBox.AutoListPosition = null;
     this.sBox.AutoListSelectedText = "a123";
     this.sBox.AutoListVisible = false;
     this.sBox.BackColor = System.Drawing.Color.White;
     this.sBox.BorderStyle = Alsing.Windows.Forms.BorderStyle.None;
     this.sBox.ChildBorderColor = System.Drawing.Color.White;
     this.sBox.ChildBorderStyle = Alsing.Windows.Forms.BorderStyle.None;
     this.sBox.CopyAsRTF = true;
     this.sBox.Dock = System.Windows.Forms.DockStyle.Fill;
     this.sBox.Document = this.sDoc;
     this.sBox.FontName = "Courier new";
     this.sBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
     this.sBox.InfoTipCount = 1;
     this.sBox.InfoTipPosition = null;
     this.sBox.InfoTipSelectedIndex = 1;
     this.sBox.InfoTipVisible = false;
     this.sBox.Location = new System.Drawing.Point(0, 24);
     this.sBox.LockCursorUpdate = false;
     this.sBox.Name = "sBox";
     this.sBox.ScopeIndicatorColor = System.Drawing.Color.Black;
     this.sBox.Size = new System.Drawing.Size(504, 447);
     this.sBox.SmoothScroll = false;
     this.sBox.SplitviewH = -4;
     this.sBox.SplitviewV = -4;
     this.sBox.TabGuideColor = System.Drawing.Color.FromArgb(Convert.ToInt32(Convert.ToByte(222)), Convert.ToInt32(Convert.ToByte(219)), Convert.ToInt32(Convert.ToByte(214)));
     this.sBox.TabIndex = 3;
     this.sBox.Text = "syntaxBoxControl1";
     this.sBox.TooltipDelay = 100;
     this.sBox.WhitespaceColor = System.Drawing.SystemColors.ControlDark;
     //
     //syntaxDocument1
     //
     this.syntaxDocument1.Lines = new string[] { "" };
     this.syntaxDocument1.MaxUndoBufferSize = 1000;
     this.syntaxDocument1.Modified = false;
     this.syntaxDocument1.UndoStep = 0;
     //
     //MenuStrip1
     //
     this.MenuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
                                        this.FileToolStripMenuItem,
                                        this.EditToolStripMenuItem,
                                        this.ToolsToolStripMenuItem,
                                        this.ExitToolStripMenuItem1
                                    });
     this.MenuStrip1.Location = new System.Drawing.Point(0, 0);
     this.MenuStrip1.Name = "MenuStrip1";
     this.MenuStrip1.Size = new System.Drawing.Size(504, 24);
     this.MenuStrip1.TabIndex = 4;
     this.MenuStrip1.Text = "MenuStrip1";
     //
     //FileToolStripMenuItem
     //
     this.FileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
                                                           this.NewToolStripMenuItem,
                                                           this.OpenToolStripMenuItem,
                                                           this.SaveToolStripMenuItem,
                                                           this.SaveAsToolStripMenuItem,
                                                           this.ToolStripSeparator1,
                                                           this.PrintSetupToolStripMenuItem,
                                                           this.PrintToolStripMenuItem,
                                                           this.ToolStripSeparator2,
                                                           this.ExitToolStripMenuItem
                                                       });
     this.FileToolStripMenuItem.Name = "FileToolStripMenuItem";
     this.FileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
     this.FileToolStripMenuItem.Text = "&File";
     //
     //NewToolStripMenuItem
     //
     this.NewToolStripMenuItem.Name = "NewToolStripMenuItem";
     this.NewToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.NewToolStripMenuItem.Text = "&New";
     //
     //OpenToolStripMenuItem
     //
     this.OpenToolStripMenuItem.Name = "OpenToolStripMenuItem";
     this.OpenToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.OpenToolStripMenuItem.Text = "&Open";
     //
     //SaveToolStripMenuItem
     //
     this.SaveToolStripMenuItem.Name = "SaveToolStripMenuItem";
     this.SaveToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.SaveToolStripMenuItem.Text = "&Save";
     //
     //SaveAsToolStripMenuItem
     //
     this.SaveAsToolStripMenuItem.Name = "SaveAsToolStripMenuItem";
     this.SaveAsToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Shift) | System.Windows.Forms.Keys.S);
     this.SaveAsToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.SaveAsToolStripMenuItem.Text = "Save As";
     //
     //ToolStripSeparator1
     //
     this.ToolStripSeparator1.Name = "ToolStripSeparator1";
     this.ToolStripSeparator1.Size = new System.Drawing.Size(183, 6);
     //
     //PrintSetupToolStripMenuItem
     //
     this.PrintSetupToolStripMenuItem.Name = "PrintSetupToolStripMenuItem";
     this.PrintSetupToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.PrintSetupToolStripMenuItem.Text = "Print Preview";
     //
     //PrintToolStripMenuItem
     //
     this.PrintToolStripMenuItem.Name = "PrintToolStripMenuItem";
     this.PrintToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.PrintToolStripMenuItem.Text = "&Print";
     //
     //ToolStripSeparator2
     //
     this.ToolStripSeparator2.Name = "ToolStripSeparator2";
     this.ToolStripSeparator2.Size = new System.Drawing.Size(183, 6);
     //
     //ExitToolStripMenuItem
     //
     this.ExitToolStripMenuItem.Name = "ExitToolStripMenuItem";
     this.ExitToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4);
     this.ExitToolStripMenuItem.Size = new System.Drawing.Size(186, 22);
     this.ExitToolStripMenuItem.Text = "E&xit";
     //
     //EditToolStripMenuItem
     //
     this.EditToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
                                                           this.UndoToolStripMenuItem,
                                                           this.ToolStripSeparator3,
                                                           this.CutToolStripMenuItem,
                                                           this.CopyToolStripMenuItem,
                                                           this.PasteToolStripMenuItem,
                                                           this.ToolStripSeparator5,
                                                           this.SelectAllToolStripMenuItem,
                                                           this.TimeDateToolStripMenuItem,
                                                           this.GotoLineToolStripMenuItem,
                                                           this.ToolStripSeparator6,
                                                           this.FindToolStripMenuItem,
                                                           this.ReplaceToolStripMenuItem,
                                                           this.ToolStripSeparator4,
                                                           this.ShowTABCharactersToolStripMenuItem,
                                                           this.ShowTabGuidesToolStripMenuItem,
                                                           this.ShowFaoldingToolStripMenuItem,
                                                           this.ShowEOLMarkersToolStripMenuItem,
                                                           this.ShowScopeIndicatorToolStripMenuItem
                                                       });
     this.EditToolStripMenuItem.Name = "EditToolStripMenuItem";
     this.EditToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
     this.EditToolStripMenuItem.Text = "&Edit";
     //
     //UndoToolStripMenuItem
     //
     this.UndoToolStripMenuItem.Name = "UndoToolStripMenuItem";
     this.UndoToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z);
     this.UndoToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.UndoToolStripMenuItem.Text = "Undo";
     //
     //ToolStripSeparator3
     //
     this.ToolStripSeparator3.Name = "ToolStripSeparator3";
     this.ToolStripSeparator3.Size = new System.Drawing.Size(185, 6);
     //
     //CutToolStripMenuItem
     //
     this.CutToolStripMenuItem.Name = "CutToolStripMenuItem";
     this.CutToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X);
     this.CutToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.CutToolStripMenuItem.Text = "Cut";
     //
     //CopyToolStripMenuItem
     //
     this.CopyToolStripMenuItem.Name = "CopyToolStripMenuItem";
     this.CopyToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C);
     this.CopyToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.CopyToolStripMenuItem.Text = "Copy";
     //
     //PasteToolStripMenuItem
     //
     this.PasteToolStripMenuItem.Name = "PasteToolStripMenuItem";
     this.PasteToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V);
     this.PasteToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.PasteToolStripMenuItem.Text = "Paste";
     //
     //ToolStripSeparator5
     //
     this.ToolStripSeparator5.Name = "ToolStripSeparator5";
     this.ToolStripSeparator5.Size = new System.Drawing.Size(185, 6);
     //
     //SelectAllToolStripMenuItem
     //
     this.SelectAllToolStripMenuItem.Name = "SelectAllToolStripMenuItem";
     this.SelectAllToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A);
     this.SelectAllToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.SelectAllToolStripMenuItem.Text = "Select All";
     //
     //TimeDateToolStripMenuItem
     //
     this.TimeDateToolStripMenuItem.Name = "TimeDateToolStripMenuItem";
     this.TimeDateToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.F5;
     this.TimeDateToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.TimeDateToolStripMenuItem.Text = "Time/Date";
     //
     //GotoLineToolStripMenuItem
     //
     this.GotoLineToolStripMenuItem.Name = "GotoLineToolStripMenuItem";
     this.GotoLineToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.GotoLineToolStripMenuItem.Text = "Goto Line";
     //
     //ToolStripSeparator6
     //
     this.ToolStripSeparator6.Name = "ToolStripSeparator6";
     this.ToolStripSeparator6.Size = new System.Drawing.Size(185, 6);
     //
     //FindToolStripMenuItem
     //
     this.FindToolStripMenuItem.Name = "FindToolStripMenuItem";
     this.FindToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.F);
     this.FindToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.FindToolStripMenuItem.Text = "Find";
     //
     //ReplaceToolStripMenuItem
     //
     this.ReplaceToolStripMenuItem.Name = "ReplaceToolStripMenuItem";
     this.ReplaceToolStripMenuItem.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R);
     this.ReplaceToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ReplaceToolStripMenuItem.Text = "Replace";
     //
     //ToolStripSeparator4
     //
     this.ToolStripSeparator4.Name = "ToolStripSeparator4";
     this.ToolStripSeparator4.Size = new System.Drawing.Size(185, 6);
     //
     //ShowTABCharactersToolStripMenuItem
     //
     this.ShowTABCharactersToolStripMenuItem.Name = "ShowTABCharactersToolStripMenuItem";
     this.ShowTABCharactersToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ShowTABCharactersToolStripMenuItem.Text = "Show TAB Characters";
     //
     //ShowTabGuidesToolStripMenuItem
     //
     this.ShowTabGuidesToolStripMenuItem.Name = "ShowTabGuidesToolStripMenuItem";
     this.ShowTabGuidesToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ShowTabGuidesToolStripMenuItem.Text = "Show Tab Guides";
     //
     //ShowFaoldingToolStripMenuItem
     //
     this.ShowFaoldingToolStripMenuItem.Checked = true;
     this.ShowFaoldingToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
     this.ShowFaoldingToolStripMenuItem.Name = "ShowFaoldingToolStripMenuItem";
     this.ShowFaoldingToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ShowFaoldingToolStripMenuItem.Text = "Show Folding";
     //
     //ShowEOLMarkersToolStripMenuItem
     //
     this.ShowEOLMarkersToolStripMenuItem.Name = "ShowEOLMarkersToolStripMenuItem";
     this.ShowEOLMarkersToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ShowEOLMarkersToolStripMenuItem.Text = "Show EOL Markers";
     //
     //ShowScopeIndicatorToolStripMenuItem
     //
     this.ShowScopeIndicatorToolStripMenuItem.Name = "ShowScopeIndicatorToolStripMenuItem";
     this.ShowScopeIndicatorToolStripMenuItem.Size = new System.Drawing.Size(188, 22);
     this.ShowScopeIndicatorToolStripMenuItem.Text = "Show Scope Indicator";
     //
     //ToolsToolStripMenuItem
     //
     this.ToolsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.DocumentSettingsToolStripMenuItem });
     this.ToolsToolStripMenuItem.Name = "ToolsToolStripMenuItem";
     this.ToolsToolStripMenuItem.Size = new System.Drawing.Size(48, 20);
     this.ToolsToolStripMenuItem.Text = "Tools";
     this.ToolsToolStripMenuItem.Visible = false;
     //
     //DocumentSettingsToolStripMenuItem
     //
     this.DocumentSettingsToolStripMenuItem.Name = "DocumentSettingsToolStripMenuItem";
     this.DocumentSettingsToolStripMenuItem.Size = new System.Drawing.Size(175, 22);
     this.DocumentSettingsToolStripMenuItem.Text = "Document Settings";
     //
     //ExitToolStripMenuItem1
     //
     this.ExitToolStripMenuItem1.Name = "ExitToolStripMenuItem1";
     this.ExitToolStripMenuItem1.ShortcutKeys = (System.Windows.Forms.Keys)(System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F4);
     this.ExitToolStripMenuItem1.Size = new System.Drawing.Size(37, 20);
     this.ExitToolStripMenuItem1.Text = "Exit";
     //
     //IntelliMouseControl1
     //
     this.IntelliMouseControl1.Image = null;
     this.IntelliMouseControl1.Location = new System.Drawing.Point(152, 117);
     this.IntelliMouseControl1.Name = "IntelliMouseControl1";
     this.IntelliMouseControl1.Size = new System.Drawing.Size(32, 32);
     this.IntelliMouseControl1.TabIndex = 5;
     this.IntelliMouseControl1.Text = "IntelliMouseControl1";
     this.IntelliMouseControl1.TransparencyKey = System.Drawing.Color.FromArgb(Convert.ToInt32(Convert.ToByte(255)), Convert.ToInt32(Convert.ToByte(0)), Convert.ToInt32(Convert.ToByte(255)));
     //
     //EditForm
     //
     this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
     this.ClientSize = new System.Drawing.Size(504, 493);
     this.Controls.Add(this.IntelliMouseControl1);
     this.Controls.Add(this.sBox);
     this.Controls.Add(this.statusBar1);
     this.Controls.Add(this.MenuStrip1);
     this.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25f, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, Convert.ToByte(0));
     this.Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
     this.Name = "EditForm";
     this.Text = "Edit form";
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel1).EndInit();
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel2).EndInit();
     ((System.ComponentModel.ISupportInitialize)this.statusBarPanel3).EndInit();
     this.MenuStrip1.ResumeLayout(false);
     this.MenuStrip1.PerformLayout();
     this.ResumeLayout(false);
     this.PerformLayout();
 }
Пример #6
0
        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(EditForm));
            this.statusBar1 = new System.Windows.Forms.StatusBar();
            this.statusBarPanel1 = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanel2 = new System.Windows.Forms.StatusBarPanel();
            this.statusBarPanel3 = new System.Windows.Forms.StatusBarPanel();
            this.sDoc = new Alsing.SourceCode.SyntaxDocument(this.components);
            this.tbrSettings = new System.Windows.Forms.ToolBar();
            this.btnWhitespace = new System.Windows.Forms.ToolBarButton();
            this.btnTabGuides = new System.Windows.Forms.ToolBarButton();
            this.btnFolding = new System.Windows.Forms.ToolBarButton();
            this.btnSettings = new System.Windows.Forms.ToolBarButton();
            this.imlIcons = new System.Windows.Forms.ImageList(this.components);
            this.sBox = new Alsing.Windows.Forms.SyntaxBoxControl();
            this.syntaxDocument1 = new Alsing.SourceCode.SyntaxDocument(this.components);
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).BeginInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).BeginInit();
            this.SuspendLayout();
            // 
            // statusBar1
            // 
            this.statusBar1.Location = new System.Drawing.Point(0, 471);
            this.statusBar1.Name = "statusBar1";
            this.statusBar1.Panels.AddRange(new System.Windows.Forms.StatusBarPanel[] {
            this.statusBarPanel1,
            this.statusBarPanel2,
            this.statusBarPanel3});
            this.statusBar1.ShowPanels = true;
            this.statusBar1.Size = new System.Drawing.Size(504, 22);
            this.statusBar1.TabIndex = 1;
            // 
            // statusBarPanel1
            // 
            this.statusBarPanel1.Name = "statusBarPanel1";
            this.statusBarPanel1.Width = 200;
            // 
            // statusBarPanel2
            // 
            this.statusBarPanel2.Name = "statusBarPanel2";
            this.statusBarPanel2.Width = 200;
            // 
            // statusBarPanel3
            // 
            this.statusBarPanel3.Name = "statusBarPanel3";
            // 
            // sDoc
            // 
            this.sDoc.Lines = new string[] {
        "abc"};
            this.sDoc.MaxUndoBufferSize = 1000;
            this.sDoc.Modified = false;
            this.sDoc.UndoStep = 0;
            this.sDoc.Change += new System.EventHandler(this.sDoc_Change);
            this.sDoc.ModifiedChanged += new System.EventHandler(this.sDoc_ModifiedChanged);
            // 
            // tbrSettings
            // 
            this.tbrSettings.Appearance = System.Windows.Forms.ToolBarAppearance.Flat;
            this.tbrSettings.AutoSize = false;
            this.tbrSettings.Buttons.AddRange(new System.Windows.Forms.ToolBarButton[] {
            this.btnWhitespace,
            this.btnTabGuides,
            this.btnFolding,
            this.btnSettings});
            this.tbrSettings.Divider = false;
            this.tbrSettings.Dock = System.Windows.Forms.DockStyle.Left;
            this.tbrSettings.DropDownArrows = true;
            this.tbrSettings.ImageList = this.imlIcons;
            this.tbrSettings.Location = new System.Drawing.Point(0, 0);
            this.tbrSettings.Name = "tbrSettings";
            this.tbrSettings.ShowToolTips = true;
            this.tbrSettings.Size = new System.Drawing.Size(25, 471);
            this.tbrSettings.TabIndex = 2;
            this.tbrSettings.ButtonClick += new System.Windows.Forms.ToolBarButtonClickEventHandler(this.tbrSettings_ButtonClick);
            // 
            // btnWhitespace
            // 
            this.btnWhitespace.ImageIndex = 1;
            this.btnWhitespace.Name = "btnWhitespace";
            this.btnWhitespace.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.btnWhitespace.ToolTipText = "Toggle Whitespace On/Off";
            // 
            // btnTabGuides
            // 
            this.btnTabGuides.ImageIndex = 0;
            this.btnTabGuides.Name = "btnTabGuides";
            this.btnTabGuides.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.btnTabGuides.ToolTipText = "Toggle Tab guides On/Off";
            // 
            // btnFolding
            // 
            this.btnFolding.ImageIndex = 2;
            this.btnFolding.Name = "btnFolding";
            this.btnFolding.Pushed = true;
            this.btnFolding.Style = System.Windows.Forms.ToolBarButtonStyle.ToggleButton;
            this.btnFolding.ToolTipText = "Toggle Folding On/Off";
            // 
            // btnSettings
            // 
            this.btnSettings.Name = "btnSettings";
            this.btnSettings.Text = "S";
            // 
            // imlIcons
            // 
            this.imlIcons.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imlIcons.ImageStream")));
            this.imlIcons.TransparentColor = System.Drawing.Color.Transparent;
            this.imlIcons.Images.SetKeyName(0, "");
            this.imlIcons.Images.SetKeyName(1, "");
            this.imlIcons.Images.SetKeyName(2, "");
            // 
            // sBox
            // 
            this.sBox.ActiveView = Alsing.Windows.Forms.ActiveView.BottomRight;
            this.sBox.AutoListPosition = null;
            this.sBox.AutoListSelectedText = "a123";
            this.sBox.AutoListVisible = false;
            this.sBox.BackColor = System.Drawing.Color.White;
            this.sBox.BorderStyle = Alsing.Windows.Forms.BorderStyle.None;
            this.sBox.ChildBorderColor = System.Drawing.Color.White;
            this.sBox.ChildBorderStyle = Alsing.Windows.Forms.BorderStyle.None;
            this.sBox.CopyAsRTF = false;
            this.sBox.Dock = System.Windows.Forms.DockStyle.Fill;
            this.sBox.Document = this.sDoc;
            this.sBox.FontName = "Courier new";
            this.sBox.ImeMode = System.Windows.Forms.ImeMode.NoControl;
            this.sBox.InfoTipCount = 1;
            this.sBox.InfoTipPosition = null;
            this.sBox.InfoTipSelectedIndex = 1;
            this.sBox.InfoTipVisible = false;
            this.sBox.Location = new System.Drawing.Point(25, 0);
            this.sBox.LockCursorUpdate = false;
            this.sBox.Name = "sBox";
            this.sBox.ScopeIndicatorColor = System.Drawing.Color.Black;
            this.sBox.ShowScopeIndicator = false;
            this.sBox.Size = new System.Drawing.Size(479, 471);
            this.sBox.SmoothScroll = false;
            this.sBox.SplitviewH = -4;
            this.sBox.SplitviewV = -4;
            this.sBox.TabGuideColor = System.Drawing.Color.FromArgb(((int)(((byte)(222)))), ((int)(((byte)(219)))), ((int)(((byte)(214)))));
            this.sBox.TabIndex = 3;
            this.sBox.Text = "syntaxBoxControl1";
            this.sBox.WhitespaceColor = System.Drawing.SystemColors.ControlDark;
            // 
            // syntaxDocument1
            // 
            this.syntaxDocument1.Lines = new string[] {
        ""};
            this.syntaxDocument1.MaxUndoBufferSize = 1000;
            this.syntaxDocument1.Modified = false;
            this.syntaxDocument1.UndoStep = 0;
            // 
            // EditForm
            // 
            this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
            this.ClientSize = new System.Drawing.Size(504, 493);
            this.Controls.Add(this.sBox);
            this.Controls.Add(this.tbrSettings);
            this.Controls.Add(this.statusBar1);
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "EditForm";
            this.Text = "EditForm";
            this.Closing += new System.ComponentModel.CancelEventHandler(this.EditForm_Closing);
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel1)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel2)).EndInit();
            ((System.ComponentModel.ISupportInitialize)(this.statusBarPanel3)).EndInit();
            this.ResumeLayout(false);

        }
Пример #7
0
    private SourceCodePrintDocument getPrintDocument(string name)
    {
        //get the filename for the syntax definition so we can
        //reload it and apply our own styleset for printing.
        int index = Array.IndexOf(p_SyntaxDefinitions, p_SyntaxDefinition);
        string filename = p_SyntaxDefinitionFilenames[index];

        //load the syntax defintion
        SyntaxDefinition definition = SyntaxDefinition.FromSyntaxFile(filename);
        applyStyle(definition.Styles, Color.White, Color.Black);

        //clone the current document under the new syntax definitions
        SyntaxDocument document = new SyntaxDocument();
        document.Parser.Init(definition);
        document.Text = Contents;

        //return a printable document
        return new SourceCodePrintDocument() {
            Document = document,
            DocumentName = name
        };
    }
Пример #8
0
 public void SetText(string Title, string Text)
 {
     this.Text = Title;
     this.Title = Title;
     if(this._FileLoaded) this.Controls.RemoveAt(this.Controls.Count - 1);
     this._FileLoaded = true;
     _CurrentSyntaxDocument = new SyntaxDocument();
     _SyntaxBoxControlInstance = new SyntaxBoxControl();
     if (Title.EndsWith(".cs")) _CurrentSyntaxDocument.SyntaxFile = "SyntaxFiles\\C#.syn";
     else if (Title.EndsWith(".vertex") || Title.EndsWith(".fragment")) _CurrentSyntaxDocument.SyntaxFile = "SyntaxFiles\\GLSL.syn";
     else if (Title.EndsWith(".cpp") || Title.EndsWith(".hpp") || Title.EndsWith(".c") || Title.EndsWith(".h")) _CurrentSyntaxDocument.SyntaxFile = "SyntaxFiles\\C++.syn";
     _CurrentSyntaxDocument.Text = Text;
     _SyntaxBoxControlInstance.Document = _CurrentSyntaxDocument;
     _SyntaxBoxControlInstance.Dock = DockStyle.Fill;
     SyntaxDefinition SyntaxD = _SyntaxBoxControlInstance.Document.Parser.SyntaxDefinition;
     TextStyle[] Styles = SyntaxD.Styles;
     _SyntaxBoxControlInstance.LineNumberBackColor = Color.FromArgb(30,30,30);
     _SyntaxBoxControlInstance.LineNumberBorderColor = Color.FromArgb(30, 30, 30);
     _SyntaxBoxControlInstance.LineNumberForeColor = Color.FromArgb(200,200,200);
     _SyntaxBoxControlInstance.ScrollBars = ScrollBars.None;
     if (Title.EndsWith(".cs"))
     {
         for (int i = 0; i < Styles.Length; i++)
         {
             if (Styles[i].Name == "CS Code")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.White;
             }
             if (Styles[i].Name == "CS Comment")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(255, 50, 80);
             }
             if (Styles[i].Name == "CS Datatype")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(60, 70, 255);
             }
             if (Styles[i].Name == "CS Keyword")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 140, 255);
             }
             if (Styles[i].Name == "CS Number")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.ForestGreen;
             }
             if (Styles[i].Name == "CS Operator")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 120, 150);
             }
             if (Styles[i].Name == "CS Region")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.DarkGray;
             }
             if (Styles[i].Name == "CS Scope")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Gray;
             }
             if (Styles[i].Name == "CS String")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Orange;
             }
             if (Styles[i].Name == "CS URL")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(50, 60, 120);
             }
             if (Styles[i].Name == "CS XML Attrib")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "CS XML Comment")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "CS XML String")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "CS XML Tag")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "CS XML Tag Text")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
         }
     }
     else if (Title.EndsWith(".vertex") || Title.EndsWith(".fragment"))
     {
         for (int i = 0; i < Styles.Length; i++)
         {
             if (Styles[i].Name == "GLSL Code")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.White;
             }
             if (Styles[i].Name == "GLSL Comment")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(255, 50, 80);
             }
             if (Styles[i].Name == "GLSL Types")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(60, 70, 255);
             }
             if (Styles[i].Name == "GLSL Keywords")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 140, 255);
             }
             if (Styles[i].Name == "GLSL Special Variables")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 140);
                 Styles[i].ForeColor = Color.FromArgb(120, 140, 255);
             }
             if (Styles[i].Name == "GLSL Math Methods")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 140);
                 Styles[i].ForeColor = Color.FromArgb(120, 140, 255);
             }
             if (Styles[i].Name == "GLSL Number")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.ForestGreen;
             }
             if (Styles[i].Name == "GLSL Operator")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 120, 150);
             }
             if (Styles[i].Name == "GLSL Scope")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Gray;
             }
         }
     }
     else if (Title.EndsWith(".cpp") || Title.EndsWith(".hpp") || Title.EndsWith(".c") || Title.EndsWith(".h"))
     {
         for (int i = 0; i < Styles.Length; i++)
         {
             if (Styles[i].Name == "cpp Code")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.White;
             }
             if (Styles[i].Name == "cpp Comment")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(255, 50, 80);
             }
             if (Styles[i].Name == "cpp Keyword")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(60, 70, 255);
             }
             if (Styles[i].Name == "cpp Keyword2")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 140, 255);
             }
             if (Styles[i].Name == "cpp Keyword3")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(180, 210, 255);
             }
             if (Styles[i].Name == "cpp Number")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.ForestGreen;
             }
             if (Styles[i].Name == "cpp Operator")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(120, 120, 150);
             }
             if (Styles[i].Name == "cpp Region")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.DarkGray;
             }
             if (Styles[i].Name == "cpp Scope")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Gray;
             }
             if (Styles[i].Name == "cpp String")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Orange;
             }
             if (Styles[i].Name == "cpp URL")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.FromArgb(50, 60, 120);
             }
             if (Styles[i].Name == "cpp XML Attrib")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "cpp XML Comment")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "cpp XML String")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "cpp XML Tag")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
             if (Styles[i].Name == "cpp XML Tag Text")
             {
                 Styles[i].BackColor = Color.FromArgb(40, 40, 40);
                 Styles[i].ForeColor = Color.Purple;
             }
         }
     }
     else
     {
         for (int i = 0; i < Styles.Length; i++)
         {
             Styles[i].BackColor = Color.FromArgb(40, 40, 40);
             Styles[i].ForeColor = Color.White;
         }
     }
     this.ContentPanel.Controls.Add(_SyntaxBoxControlInstance);
 }