Exemple #1
0
        /// <summary>
        /// Handles the incoming events
        /// </summary>
        public void HandleEvent(Object sender, NotifyEvent e, HandlingPriority prority)
        {
            ITabbedDocument  document = PluginBase.MainForm.CurrentDocument;
            ScintillaControl doc      = null;

            if (document != null)
            {
                doc = document.SciControl;
            }

            switch (e.Type)
            {
            case EventType.ApplySettings:
                UpdateSettings();
                break;

            case EventType.UIRefresh:
                try
                {
                    if (pluginPanel.Visible && !(MainForm == null))
                    {
                        if (doc.SelectionStart == doc.SelectionEnd)
                        {
                            if (settingObject.FeedOnCaret)
                            {
                                typingTimer.Stop();
                                typingTimer.Start();
                            }
                            pluginUI.SelectionChanged(false);
                        }
                        else
                        {
                            pluginUI.SelectionChanged();
                        }
                    }
                }
                catch
                {
                    // ignore any error
                }

                break;

            case EventType.Keys:
                Keys key = ((KeyEvent)e).Value;
                if (key == settingObject.ReplaceShortcut)
                {
                    pluginUI.EnableFocus(true);
                    e.Handled = false;
                }
                else if (key == settingObject.FindShortcut)
                {
                    pluginUI.EnableFocus();
                    e.Handled = true;
                }
                break;
            }
        }