public virtual void ApplyConfig(UserConfig config) { Trace.Call(config); if (config == null) { throw new ArgumentNullException("config"); } var theme = new ThemeSettings(config); if (theme.BackgroundColor == null) { ModifyBase(Gtk.StateType.Normal); } else { ModifyBase(Gtk.StateType.Normal, theme.BackgroundColor.Value); } if (theme.ForegroundColor == null) { ModifyText(Gtk.StateType.Normal); } else { ModifyText(Gtk.StateType.Normal, theme.ForegroundColor.Value); } ModifyFont(theme.FontDescription); Settings.ApplyConfig(config); // replace nick completer if needed if (Settings.BashStyleCompletion && !(NickCompleter is LongestPrefixNickCompleter)) { NickCompleter = new LongestPrefixNickCompleter(); } else if (!Settings.BashStyleCompletion && !(NickCompleter is TabCycleNickCompleter)) { NickCompleter = new TabCycleNickCompleter(); } // set the completion character NickCompleter.CompletionChar = Settings.CompletionCharacter; }
public Entry(MainWindow mainWindow, ChatViewManager chatViewManager) { if (mainWindow == null) { throw new ArgumentNullException("mainWindow"); } if (chatViewManager == null) { throw new ArgumentNullException("chatViewManager"); } f_MainWindow = mainWindow; f_MainWindow.KeyPressed += OnKeyPressed; f_ChatViewManager = chatViewManager; Frontend.SessionPropertyChanged += delegate { InitCommandManager(); }; Settings = new EntrySettings(); NickCompleter = new TabCycleNickCompleter(); }
public virtual void ApplyConfig(UserConfig config) { Trace.Call(config); if (config == null) { throw new ArgumentNullException("config"); } Settings.ApplyConfig(config); // replace nick completer if needed if (Settings.BashStyleCompletion && !(NickCompleter is LongestPrefixNickCompleter)) { NickCompleter = new LongestPrefixNickCompleter(); } else if (!Settings.BashStyleCompletion && !(NickCompleter is TabCycleNickCompleter)) { NickCompleter = new TabCycleNickCompleter(); } // set the completion character NickCompleter.CompletionChar = Settings.CompletionCharacter; }
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 { string fontWeigth = null; if (fontStyle.Contains(" ")) { int pos = fontStyle.IndexOf(" "); fontWeigth = fontStyle.Substring(0, pos); 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"]; }