Пример #1
0
        void NavigateToFileContent(TextBox textBox)
        {
            try
            {
                int caretPosition     = textBox.SelectionStart;
                int startLinePosition = textBox.Text.LastIndexOf("\n", caretPosition);
                int endLinePosition   = textBox.Text.IndexOf("\n", startLinePosition + 1);
                textBox.SelectionStart  = startLinePosition + 1;
                textBox.SelectionLength = endLinePosition - startLinePosition;

                string lineText = textBox.SelectedText;
                int    line;
                int    column;
                string file;

                if (lineText != null && lineText.ParseAsFileReference(out file, out line, out column))
                {
                    if (!KeyInterceptor.IsPressed(Keys.ControlKey))
                    {
                        NormaliseFileReference(ref file, ref line);
                    }
                    this.NavigateToFileContent(file, line, column);
                }
            }
            catch { } //it is expected to fail if the line does not contain the file content position spec. This is also the reason for not validating any "IndexOf" results.
        }
Пример #2
0
 static void MapTxt_MouseWheel(object sender, MouseEventArgs e, Action <Control, bool> customHandler)
 {
     if (KeyInterceptor.IsPressed(Keys.ControlKey))
     {
         var control = (Control)sender;
         if (customHandler != null)
         {
             customHandler(control, e.Delta > 0);
         }
         else
         {
             var fontSizeDelta = e.Delta > 0 ? 2 : -2;
             control.ChangeFontSize(fontSizeDelta);
         }
     }
 }
Пример #3
0
        static void Instance_KeyDown(Keys key, int repeatCount, ref bool handled)
        {
            foreach (var shortcut in internalShortcuts.Keys)
            {
                if ((byte)key == shortcut._key && !IsDocumentHotKeyExcluded())
                {
                    Modifiers modifiers = KeyInterceptor.GetModifiers();

                    if (modifiers.IsCtrl == shortcut.IsCtrl && modifiers.IsShift == shortcut.IsShift && modifiers.IsAlt == shortcut.IsAlt)
                    {
                        handled = true;
                        var handler = internalShortcuts[shortcut];
                        handler.Item2();
                    }
                }
            }
        }