Пример #1
0
        protected void HighlightMatch(RegExpMatchResult matchResult)
        {
            var arrColors = PaneAdvRegExp.GetRegExpColors(matchResult.RegExp.ID, _views, true);

            if (arrColors.Count == 0)
            {
                arrColors.Add(new ColorInfo("", -1, RegExpBase.DefaultHighlightColor.ToArgb(), true));
            }

            ///////////////////////////////////////////////////////////////////////////////

            int nBlockLen   = matchResult.Match.Length / arrColors.Count;
            int nBlockStart = matchResult.Match.Index;

            ColorInfo ci;

            for (int i = 0; i < arrColors.Count; i++)
            {
                ci = (ColorInfo)arrColors[i];

                if (i == arrColors.Count - 1)
                {
                    nBlockLen = (matchResult.Match.Index + matchResult.Match.Length) - nBlockStart;
                }

                var style = GetCachedStyle(ci.RGB);
                textBox.GetRange(nBlockStart, nBlockStart + nBlockLen).SetStyle(style);

                nBlockStart += nBlockLen;
            }
        }
Пример #2
0
        protected override void InitViewPanes(RibbonTab tab)
        {
            this.Orientation = Orientation.Horizontal;

            //////////////////////////////////////////////////////////////////////////

            _splitter               = new SplitContainer();
            _splitter.Name          = "Splitter1";
            _splitter.Orientation   = Orientation.Vertical;
            _splitter.Dock          = DockStyle.Fill;
            _splitter.BorderStyle   = BorderStyle.Fixed3D;
            _splitter.BackColor     = MainForm.ColorBackground;
            _splitter.Panel1MinSize = 0;
            _splitter.Panel2MinSize = 0;
            this.Panel1.Controls.Add(_splitter);

            _splitter2               = new SplitContainer();
            _splitter2.Name          = "Splitter2";
            _splitter2.BorderStyle   = BorderStyle.Fixed3D;
            _splitter2.Orientation   = Orientation.Vertical;
            _splitter2.Dock          = DockStyle.Fill;
            _splitter2.BackColor     = MainForm.ColorBackground;
            _splitter2.Panel1MinSize = 0;
            _splitter2.Panel2MinSize = 0;
            this.Panel2.Controls.Add(_splitter2);

            //////////////////////////////////////////////////////////////////////////

            _paneAdvRegExp = new PaneAdvRegExp();
            _paneAdvRegExp.InitPane(_views, this, this.Panel1, tab);
            _paneAdvRegExp._eventDataModified += new EventHandler(OnDataModified);

            _splitter.Panel1.Controls.Add(_paneAdvRegExp);
            _paneAdvRegExp.ShowPane();

            //////////////////////////////////////////////////////////////////////////

            _paneDocuments = new PaneDocuments();
            _paneDocuments.InitPane(_views, this, this.Panel1, tab);
            _paneDocuments._eventDataModified += new EventHandler(OnDataModified);

            _splitter2.Panel1.Controls.Add(_paneDocuments);
            _paneDocuments.ShowPane();

            //////////////////////////////////////////////////////////////////////////

            _paneAdvNotes = new PaneAdvNotes();
            _paneAdvNotes.InitPane(_views, this, this.Panel1, tab);
            _paneAdvNotes._eventDataModified += new EventHandler(OnDataModified);
            _paneAdvNotes.CalcScores         += paneAdvNotes_CalcScores;
            _paneAdvNotes.RefreshHighlights  += new EventHandler(paneAdvNotes_RefreshHighlights);

            _splitter2.Panel2.Controls.Add(_paneAdvNotes);
            _paneAdvNotes.ShowPane();

            //////////////////////////////////////////////////////////////////////////

            _paneCodes = new PaneCodes();
            _paneCodes.InitPane(_views, this, this.Panel1, tab);
            _paneCodes._eventDataModified += new EventHandler(OnDataModified);

            _splitter.Panel2.Controls.Add(_paneCodes);
            _paneCodes.ShowPane();

            //////////////////////////////////////////////////////////////////////////

            ResetView();

            _paneDocuments.Select();
        }