void on_FontChanged(object sender, EventArgs e) { FontSelectionGroup ctrl = (FontSelectionGroup)sender; _workingAppSettings.Fonts[ctrl.Index] = ctrl.FontInfo.Clone(); if (ChordSheetOptionsChanged != null) { ChordSheetOptionsChanged(this, e); } }
public SettingsDialog(AppSettings appSettings) { this.Build(); settingsPane.Page = 0; if (!string.IsNullOrEmpty(appSettings.DefaultFolder)) { defaultFolder.SetUri(appSettings.DefaultFolder); } #region Initialize Fonts _workingAppSettings = appSettings.Clone(); // Hook up the font controls _fontControls.Add(fontselectiongroup1); _fontControls.Add(fontselectiongroup2); _fontControls.Add(fontselectiongroup3); _fontControls.Add(fontselectiongroup4); _fontControls.Add(fontselectiongroup5); _fontControls.Add(fontselectiongroup6); // Build the font controls. for (int i = 0; i < _fontControls.Count; i++) { FontSelectionGroup ctrl = _fontControls [i]; ctrl.Index = i; switch ((PrintFontType)i) { case PrintFontType.Title: ctrl.Title = "Song Title:"; break; case PrintFontType.SongInfo: ctrl.Title = "Song Information Fields:"; break; case PrintFontType.Text: ctrl.Title = "Song Lyrics:"; break; case PrintFontType.Chords: ctrl.Title = "Chords:"; break; case PrintFontType.Comments: ctrl.Title = "Comments: "; break; case PrintFontType.HeaderFooterText: ctrl.Title = "Header and Footer Text:"; break; } ctrl.Changed += on_FontChanged; ctrl.FontInfo = _workingAppSettings.Fonts [i]; ctrl.TitleWidth = 150; } #endregion Initialize Fonts #region Initialize Header/Footer PopulateFieldList(cbHeaderLeft, appSettings.HeaderFieldLeft); PopulateFieldList(cbHeaderCenter, appSettings.HeaderFieldCenter); PopulateFieldList(cbHeaderRight, appSettings.HeaderFieldRight); PopulateFieldList(cbFooterLeft, appSettings.FooterFieldLeft); PopulateFieldList(cbFooterCenter, appSettings.FooterFieldCenter); PopulateFieldList(cbFooterRight, appSettings.FooterFieldRight); PopulateLineTypeList(cbHeaderLine, appSettings.HeaderLineType); PopulateLineTypeList(cbFooterLine, appSettings.FooterLineType); chkDefaultUseSharps.Active = appSettings.DefaultUseSharps; chkShowHeader.Active = appSettings.ShowHeader; chkShowFooter.Active = appSettings.ShowFooter; EnableHeaderFields(chkShowHeader.Active); EnableFooterFields(chkShowFooter.Active); #endregion Initialize Header/Footer }