Exemple #1
0
        void classes_SelectedIndexChanged(object sender, EventArgs e)
        {
            AdvancedTextBox atb = ServiceHost.File[codefile.Fullname] as AdvancedTextBox;

            if (atb != null)
            {
                ICodeType ct = classes.SelectedItem as ICodeType;

                if (ct != null)
                {
                    List <ICodeMember> mems = new List <ICodeMember>();

                    foreach (ICodeMember cm in ct.Members)
                    {
                        if (!(cm is ICodeType))
                        {
                            mems.Add(cm);
                        }
                    }

                    mems.Sort(delegate(ICodeMember a, ICodeMember b) { return(a.Name.CompareTo(b.Name)); });

                    members.DataSource = mems;

                    if (!binding)
                    {
                        atb.Buffer.SelectLocation(ct.Location);
                        atb.ScrollToCaretUpper();
                        atb.Select();
                    }
                }
            }
        }
Exemple #2
0
        public bool Open()
        {
            OpenFileDialog openFileDiag = new OpenFileDialog();

            openFileDiag.Title  = "Open File";
            openFileDiag.Filter = "All types (*.*)|*.*|Text Files (*.txt)|*.txt";

            if (openFileDiag.ShowDialog() == DialogResult.OK)
            {
                _fileName  = openFileDiag.SafeFileName;
                _filePath  = openFileDiag.FileName;
                TabTitle   = _fileName;
                TabToolTip = _filePath;

                _tabControl.Refresh();

                _advandedTextBox.Lines = File.ReadAllLines(_filePath, _textEncoding);
                _advandedTextBox.Select(_advandedTextBox.TextLength, 0);
                _advandedTextBox.CreateSnapshot();
                Focus();

                Saved = _advandedTextBox.DoesCurrentTextEqualSnapshot();
                return(true);
            }
            return(false);
        }
Exemple #3
0
        void members_SelectedIndexChanged(object sender, EventArgs e)
        {
            AdvancedTextBox atb = ServiceHost.File[codefile.Fullname] as AdvancedTextBox;

            if (atb != null)
            {
                if (!binding)
                {
                    atb.Buffer.SelectLocation((members.SelectedItem as ICodeMember).Location);
                    atb.ScrollToCaretUpper();
                    atb.Select();
                }
            }
        }
Exemple #4
0
        private void button1_Click(object sender, System.EventArgs e)
        {
            button1.BackColor = SystemColors.Control;
            RichTextBoxFinds options = 0;
            int end   = atb.TextLength - 1;
            int start = atb.SelectionStart + atb.SelectionLength;

            if (checkBox1.Checked)
            {
                options |= RichTextBoxFinds.MatchCase;
            }
            if (checkBox2.Checked)
            {
                options |= RichTextBoxFinds.WholeWord;
            }
            if (checkBox3.Checked)
            {
                options |= RichTextBoxFinds.Reverse;
                end      = start - 1;
                start    = 0;
            }
            if (checkBox4.Checked)
            {
                options |= RichTextBoxFinds.NoHighlight;
            }

            int    pos;
            string pat = lastfind = comboBox1.Text;

            pos = atb.Find(pat, start, end, options);
            if (pos != -1)
            {
                atb.Select(pos, pat.Length);
                atb.ScrollToCaret();
            }
            else
            {
                button1.Enabled = false;
            }
        }