Exemplo n.º 1
0
 public void AddCSharpCodeForm(string title, string text)
 {
     CSharp.SharpCodeForm sharpForm = new SharpCodeForm(text);
     sharpForm.Text = title;
     sharpForm.ShowIcon = true;
     sharpForm.Show(WorkPanel, WeifenLuo.WinFormsUI.Docking.DockState.Document);
 }
Exemplo n.º 2
0
        public void ShowFor(SharpCodeForm parent, TextEditorControl editor, bool replaceMode)
        {
            Editor = editor;
            StepParent = parent;

            _search.ClearScanRegion();
            var sm = editor.ActiveTextAreaControl.SelectionManager;
            if (sm.HasSomethingSelected && sm.SelectionCollection.Count == 1)
            {
                var sel = sm.SelectionCollection[0];
                if (sel.StartPosition.Line == sel.EndPosition.Line)
                    TxtSearch.Text = sm.SelectedText;
                else
                    _search.SetScanRegion(sel);
            }
            else
            {
                // Get the current word that the caret is on
                Caret caret = editor.ActiveTextAreaControl.Caret;
                int start = TextUtilities.FindWordStart(editor.Document, caret.Offset);
                int endAt = TextUtilities.FindWordEnd(editor.Document, caret.Offset);
                TxtSearch.Text = editor.Document.GetText(start, endAt - start);
            }

            //ReplaceMode = replaceMode;

            this.Owner = (Form)editor.TopLevelControl;
            this.Show();

            TxtSearch.SelectAll();
            TxtSearch.Focus();

            if (!_highlightGroups.ContainsKey(_editor))
                _highlightGroups[_editor] = new HighlightGroup(_editor);
            HighlightGroup group = _highlightGroups[_editor];
            group.ClearMarkers();
        }