Example #1
0
        private void _NickCompletion()
        {
            // perform completion
            string text     = Text;
            int    position = Position;

            NickCompleter.Complete(ref text, ref position, ChatViewManager.CurrentChatView);
            Text     = text;
            Position = position;
        }
Example #2
0
        void CompleteNick()
        {
            // perform completion
            string text     = Text;
            int    position = Position;

            NickCompleter.Complete(ref text, ref position, f_ChatViewManager.CurrentChat);
            Text     = text;
            Position = position;
        }
Example #3
0
        private void _NickCompletion()
        {
            // perform completion
            string text     = Text;
            int    position = SelectionStart;

            NickCompleter.Complete(ref text, ref position, _Notebook.CurrentChatView);
            Text           = text;
            SelectionStart = position;
        }
Example #4
0
        public virtual void ApplyConfig(UserConfig config)
        {
            Trace.Call(config);

            if (config == null) {
                throw new ArgumentNullException("config");
            }

            string bgStr = (string) config["Interface/Chat/BackgroundColor"];
            if (!String.IsNullOrEmpty(bgStr)) {
                try {
                    BackColor = ColorTools.GetColor(bgStr);
                } catch (FormatException ex) {
            #if LOG4NET
                    _Logger.Error("setting background color failed", ex);
            #endif
                }
            } else {
                BackColor = Color.Empty;
            }

            string fgStr = (string) config["Interface/Chat/ForegroundColor"];
            if (!String.IsNullOrEmpty(fgStr)) {
                try {
                    ForeColor = ColorTools.GetColor(fgStr);
                } catch (FormatException ex) {
            #if LOG4NET
                    _Logger.Error("setting foreground color failed", ex);
            #endif
                }
            } else {
                ForeColor = Color.Empty;
            }

            string fontFamily = (string) config["Interface/Chat/FontFamily"];
            string fontStyle = (string) config["Interface/Chat/FontStyle"];
            int fontSize = 0;
            if (config["Interface/Chat/FontSize"] != null) {
                fontSize = (int) config["Interface/Chat/FontSize"];
            }
            Font font = null;
            if (String.IsNullOrEmpty(fontFamily)) {
                // use Monospace by default
                float? defaultSize;
                try {
                    defaultSize = Font.Size;
                } catch (NullReferenceException) {
            #if LOG4NET
                    _Logger.Error("could not get default system font size, using internal default");
            #endif
                    // Mono bug?
                    defaultSize = 12f;
                }
                font = new Font(FontFamily.GenericMonospace, defaultSize.Value);
            } else {
                if (fontStyle.Contains(" ")) {
                    int pos = fontStyle.IndexOf(" ");
                    fontStyle = fontStyle.Substring(pos + 1);
                }
                FontStyle style = (FontStyle) Enum.Parse(typeof(FontStyle), fontStyle);
                font = new Font(fontFamily, fontSize, style);
            }
            Font = font;

            // replace nick completer if needed
            bool wantBashCompletion = (bool)config["Interface/Entry/BashStyleCompletion"];
            if (wantBashCompletion && !(NickCompleter is LongestPrefixNickCompleter)) {
                NickCompleter = new LongestPrefixNickCompleter();
            } else if (!wantBashCompletion && !(NickCompleter is TabCycleNickCompleter)) {
                NickCompleter = new TabCycleNickCompleter();
            }

            // set the completion character
            NickCompleter.CompletionChar = (string)config["Interface/Entry/CompletionChar"];
        }