Esempio n. 1
0
        private void Regex_Click(Object sender, RoutedEventArgs e)
        {
            //frame.Navigate(new Uri("Views\\Regex.xaml", UriKind.Relative));
            var frm = new RegexWindow();

            frm.Show();
        }
Esempio n. 2
0
    void _ShowRegexInfo(_SciTextBox tb, bool F1)
    {
        if (_regexWindow == null || !_cRegex.Checked)
        {
            return;
        }
        if (_regexWindow.UserClosed)
        {
            if (!F1)
            {
                return;
            }
            _regexWindow.UserClosed = false;
        }

        if (!_regexWindow.Window.IsHandleCreated)
        {
            var r = ((AWnd)this).Rect;
            r.Offset(0, -20);
            _regexWindow.Show(Program.MainForm, r, true);
        }
        else
        {
            _regexWindow.Window.Show();
        }

        _regexWindow.InsertInControl = tb;

        bool replace = tb == _tReplace;
        var  s       = _regexWindow.CurrentTopic;

        if (s == "replace")
        {
            if (!replace)
            {
                _regexWindow.CurrentTopic = _regexTopic;
            }
        }
        else if (replace)
        {
            _regexTopic = s;
            _regexWindow.CurrentTopic = "replace";
        }
    }
Esempio n. 3
0
    public void RegexWindowShow(SciCode doc, string code, int pos16, TextSpan stringSpan, bool replace)
    {
        int j = stringSpan.Start, vi = _StringPrefixLength(code, j);

        if (!replace && (vi == 0 || !(code[j] == '@' || code[j + 1] == '@')))
        {
            ADialog.ShowInfo(null, "Regular expression string should be like @\"text\", not like \"text\". The Regex tool will not escape \\ when inserting text.");
        }

        if (_regexWindow == null)
        {
            _regexWindow             = new RegexWindow();
            _regexWindow.Window.Name = "Ci.Regex";             //prevent hiding when activated
        }

        var r = CiUtil.GetCaretRectFromPos(doc, pos16);
        int i = Au.Util.ADpi.ScaleInt(100);

        r.Width = i;
        r.Inflate(i, 0);
        _regexWindow.Show(doc, r, false, PopupAlignment.TPM_CENTERALIGN | PopupAlignment.TPM_VERTICAL);
        _regexWindow.InsertInControl = doc;
        var s = _regexWindow.CurrentTopic;

        if (s == "replace")
        {
            if (!replace)
            {
                _regexWindow.CurrentTopic = _regexTopic;
            }
        }
        else if (replace)
        {
            _regexTopic = s;
            _regexWindow.CurrentTopic = "replace";
        }
        doc.ZTempRanges_Add(this, stringSpan.Start + vi + 1, stringSpan.End - 1, onLeave: () => _regexWindow.Hide());
    }