예제 #1
0
파일: avsW.cs 프로젝트: nuukcillo/PerrySub
        private void AddTabPage()
        {
            int new_number = tabpage++;
            string new_name = "AVS " + new_number;
            TabPage new_tab = new TabPage(new_name);
            new_tab.Text = new_name;
            //new_tab.GotFocus += new EventHandler(TabGotLove);

            tabControl.Controls.Add(new_tab);

            SplitContainer new_split = new SplitContainer();

            new_split.Dock = System.Windows.Forms.DockStyle.Fill;
            new_split.Location = new System.Drawing.Point(3, 3);
            new_split.Name = new_name;
            new_split.Orientation = System.Windows.Forms.Orientation.Horizontal;
            new_split.Panel2Collapsed = true;
            new_split.BorderStyle = System.Windows.Forms.BorderStyle.None;

            AVSTextBox new_text = new AVSTextBox();

            new_text.Dock = System.Windows.Forms.DockStyle.Fill;
            new_text.Font = new System.Drawing.Font("Courier New", 10, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
            new_text.Location = new System.Drawing.Point(0, 0);
            new_text.Size = new System.Drawing.Size(817, 546);
            new_text.Text = "";
            new_text.ScrollBars = RichTextBoxScrollBars.Both;
            new_text.WordWrap = false;
            new_text.AcceptsTab = true;
            new_text.KeyDown += new KeyEventHandler(new_text_KeyDown);
            new_text.ContextMenuStrip = menuCustom;

            Panel new_panel = new Panel();
            new_panel.Dock = System.Windows.Forms.DockStyle.Fill;
            new_panel.Location = new System.Drawing.Point(0, 0);
            new_panel.Size = new System.Drawing.Size(817, 25);
            new_panel.TabIndex = 0;
            new_panel.TabStop = false;
            new_panel.BorderStyle = BorderStyle.Fixed3D;
            new_panel.AutoScroll = true;

            PictureBox new_pict = new PictureBox();
            new_pict.Dock = DockStyle.None;
            new_pict.Location = new System.Drawing.Point(0, 0);
            new_pict.Size = new System.Drawing.Size(0,0);
            new_pict.TabIndex = 0;
            new_pict.TabStop = false;
            new_pict.BorderStyle = BorderStyle.None;

            new_panel.Controls.Add(new_pict);

            new_split.Panel1.Controls.Add(new_text);
            new_split.Panel2.Controls.Add(new_panel);

            new_tab.Controls.Add(new_split);

            fileDirectories.Add(new_number, Application.StartupPath);
        }
예제 #2
0
        /*
        protected override void WndProc(ref System.Windows.Forms.Message m)
        {

            if (m.Msg == WMisParsing)
            {
                if (isParsing) base.WndProc(ref m);
                else
                    m.Result = IntPtr.Zero;
            }
            else
                base.WndProc(ref m);
        }
        */
        private void PaintReservedWords(AVSTextBox avstext)
        {
            string actual = avstext.Text;
            avstext.SelectAll();
            avstext.SelectionColor = avstext.ForeColor;

            Regex r;
            MatchCollection mc;
            for (int j = 0; j < avs_core.Length; j++)
            {
                r = new Regex(@"\b" + avs_core[j].ToLower() + @"\b");
                mc = r.Matches(actual.ToLower());

                foreach (Match m in mc)
                {
                    avstext.Select(m.Index, m.Length);
                    avstext.SelectionColor = CoreColor;
                    avstext.SelectionFont = new Font(Font, FontStyle.Bold);
                }

            }

            for (int j = 0; j < avs_reserved.Length; j++)
            {
                r = new Regex(@"\b" + avs_reserved[j].ToLower() + @"\b");
                mc = r.Matches(actual.ToLower());

                foreach (Match m in mc)
                {
                    avstext.Select(m.Index, m.Length);
                    avstext.SelectionColor = ReservedWordsColor;
                    avstext.SelectionFont = new Font(Font, FontStyle.Bold);
                }

            }

            r = new Regex("\\b(?:[0-9]*\\.)?[0-9]+\\b");
            mc = r.Matches(actual.ToLower());

            foreach (Match m in mc)
            {
                avstext.Select(m.Index, m.Length);
                avstext.SelectionColor = IntegerColor;
            }

            r = new Regex("\"[^\"\\\\\\r\\n]*(?:\\\\.[^\"\\\\\\r\\n]*)*\"");
            mc = r.Matches(actual.ToLower());

            foreach (Match m in mc)
            {
                avstext.Select(m.Index, m.Length);
                avstext.SelectionColor = StringColor;
                avstext.SelectionFont = new Font(Font, FontStyle.Bold);
            }

            r = new Regex(commentToken + @".*");
            mc = r.Matches(actual.ToLower());

            foreach (Match m in mc)
            {
                avstext.Select(m.Index, m.Length);
                avstext.SelectionColor = CommentColor;
                avstext.SelectionFont = new Font(Font, FontStyle.Bold);
            }
        }