private void OnDefaultsFileSaveNewlineChanged(object o, EventArgs args) { int active = fileSaveNewline.ActiveSelection; ConfigFileSaveNewlineOption activeOption = (ConfigFileSaveNewlineOption)Enum.ToObject(typeof(ConfigFileSaveNewlineOption), active); if (((int)activeOption) > ((int)ConfigFileSaveNewlineOption.Specific)) //Positions higher than specific are always specific too { activeOption = ConfigFileSaveNewlineOption.Specific; } Base.Config.FileSaveNewlineOption = activeOption; /* If newline is specific, newlineOption=Specific and newline holds the newline type name */ if (activeOption == ConfigFileSaveNewlineOption.Specific) { NewlineType chosenNewlineType = fileSaveNewline.ChosenNewlineType; if (!chosenNewlineType.Equals(NewlineType.Unknown)) { Base.Config.FileSaveNewline = chosenNewlineType; } } else { /* If newline option is remember last, use the system default */ Base.Config.FileSaveNewline = Core.Util.GetSystemNewlineType(); } }
private NewlineTypeComboBox BuildFileSaveNewlineComboBox() { string[] additionalActions = { Catalog.GetString("Remember the last used type") }; NewlineType newlineTypeToSelect = NewlineType.Unknown; ConfigFileSaveNewlineOption fileSaveNewlineOption = Base.Config.FileSaveNewlineOption; if (fileSaveNewlineOption == ConfigFileSaveNewlineOption.Specific) { newlineTypeToSelect = Base.Config.FileSaveNewline; } NewlineTypeComboBox comboBox = new NewlineTypeComboBox(newlineTypeToSelect, additionalActions); if (fileSaveNewlineOption != ConfigFileSaveNewlineOption.Specific) { comboBox.ActiveSelection = (int)fileSaveNewlineOption; } comboBox.SelectionChanged += OnDefaultsFileSaveNewlineChanged; return(comboBox); }