Exemplo n.º 1
0
 internal void updateGuiFromSettingsObject(Entities.DisplayAndPrintSettings displayAndPrintSettings)
 {
     this.displayAndPrintSettings = displayAndPrintSettings;
     titleColorPicker.setFontFormat(displayAndPrintSettings.TitleFormat);
     headingsColorPicker.setFontFormat(displayAndPrintSettings.HeadingsFormat);
     chordsColorPicker.setFontFormat(displayAndPrintSettings.ChordFormat);
     lyricsColorPicker.setFontFormat(displayAndPrintSettings.LyricsFormat);
     notesColorPicker.setFontFormat(displayAndPrintSettings.NoteFormat);
     backgroundColor.setColor(displayAndPrintSettings.BackgroundColor);
     verseHeadingBackgroundColor.setColor(displayAndPrintSettings.VerseHeadingBackgroundColor);
     paritalVerseHeadingBackgroundColor.setColor(displayAndPrintSettings.PartialVerseHeadingBackgroundColor);
     verseLyricsBackgroundColor1.setColor(displayAndPrintSettings.VerseLyricsBackground1Color);
     verseLyricsBackgroundColor2.setColor(displayAndPrintSettings.VerseLyricsBackground2Color);
     verseLyricsBorderColor.setColor(displayAndPrintSettings.VerseBorderColor);
 }
 void cmdRestoreSettings_Click(object sender, EventArgs e)
 {
     using (var fileDialog = new OpenFileDialog()
     {
         FileName = displayAndPrintSettings.settingsType.ToString()
     })
     {
         fileDialog.Filters.Add(FILTER);
         if (fileDialog.ShowDialog(this) == DialogResult.Ok)
         {
             displayAndPrintSettings = DisplayAndPrintSettings.loadSettings(displayAndPrintSettings.settingsType, fileDialog.FileName);
             updateGuiFromSettingsObject(displayAndPrintSettings);
             updatePreview();
         }
     }
 }
Exemplo n.º 3
0
        private static void ensureValidSettingsFile(Entities.DisplayAndPrintSettingsType type)
        {
            //get the default settings
            var defaultSettings = new Entities.DisplayAndPrintSettings(type);

            //check if the setting file is present
            var settingsFilePresent = defaultSettings.isSettingsFilePresent();

            //create the settings file if it does not already exist
            if (!settingsFilePresent)
            {
                defaultSettings.saveSettings();
            }

            //check if there are nulls in the file
            var savedSettingsFile   = Entities.DisplayAndPrintSettings.loadSettings(type);
            var nullsInSettingsFile = savedSettingsFile.nullsInFile();

            //if there are nulls in the file use the default settings file
            if (nullsInSettingsFile)
            {
                defaultSettings.saveSettings();
            }
        }
Exemplo n.º 4
0
        public FontAndColorPanel(Entities.DisplayAndPrintSettings displayAndPrintSettings)
        {
            this.displayAndPrintSettings = displayAndPrintSettings;
            titleColorPicker             = new FontAndColorPicker("Title", FontAndColorPicker.FontAndColorPickerType.FontAndColor);
            headingsColorPicker          = new FontAndColorPicker("Headings", FontAndColorPicker.FontAndColorPickerType.FontAndColor);
            chordsColorPicker            = new FontAndColorPicker("Chords", FontAndColorPicker.FontAndColorPickerType.FontAndColor, true);
            lyricsColorPicker            = new FontAndColorPicker("Lyrics", FontAndColorPicker.FontAndColorPickerType.FontAndColor, true);
            notesColorPicker             = new FontAndColorPicker("Notes", FontAndColorPicker.FontAndColorPickerType.FontAndColor);
            backgroundColor                    = new FontAndColorPicker("Background Color", FontAndColorPicker.FontAndColorPickerType.Color);
            verseHeadingBackgroundColor        = new FontAndColorPicker("Verse Heading Background Color", FontAndColorPicker.FontAndColorPickerType.Color);
            paritalVerseHeadingBackgroundColor = new FontAndColorPicker("Partial Heading Background Color", FontAndColorPicker.FontAndColorPickerType.Color);
            verseLyricsBackgroundColor1        = new FontAndColorPicker("Verse Background Color 1", FontAndColorPicker.FontAndColorPickerType.Color);
            verseLyricsBackgroundColor2        = new FontAndColorPicker("Verse Background Color 2", FontAndColorPicker.FontAndColorPickerType.Color);
            verseLyricsBorderColor             = new FontAndColorPicker("Verse Border Color", FontAndColorPicker.FontAndColorPickerType.Color);

            updateGuiFromSettingsObject(displayAndPrintSettings);

            Content = new TableLayout()
            {
                Style = "padded-table",
                Rows  =
                {
                    new TableRow()
                    {
                        Cells =
                        {
                            new Label(),
                            new Label()
                            {
                                Text = "Font"
                            },
                            new Label()
                            {
                                Text = "Size"
                            },
                            new Label()
                            {
                                Text = "Color"
                            },
                            new Label()
                            {
                                Text = "Style"
                            }
                        }
                    },
                    titleColorPicker,
                    headingsColorPicker,
                    chordsColorPicker,
                    lyricsColorPicker,
                    notesColorPicker,
                    backgroundColor,
                    verseHeadingBackgroundColor,
                    paritalVerseHeadingBackgroundColor,
                    verseLyricsBackgroundColor1,
                    verseLyricsBackgroundColor2,
                    verseLyricsBorderColor,
                    null
                }
            };

            titleColorPicker.ItemChanged                   += ColorPicker_ItemChanged;
            headingsColorPicker.ItemChanged                += ColorPicker_ItemChanged;
            chordsColorPicker.ItemChanged                  += ColorPicker_ItemChanged;
            lyricsColorPicker.ItemChanged                  += ColorPicker_ItemChanged;
            notesColorPicker.ItemChanged                   += ColorPicker_ItemChanged;
            backgroundColor.ItemChanged                    += ColorPicker_ItemChanged;
            verseHeadingBackgroundColor.ItemChanged        += ColorPicker_ItemChanged;
            paritalVerseHeadingBackgroundColor.ItemChanged += ColorPicker_ItemChanged;
            verseLyricsBackgroundColor1.ItemChanged        += ColorPicker_ItemChanged;
            verseLyricsBackgroundColor2.ItemChanged        += ColorPicker_ItemChanged;
            verseLyricsBorderColor.ItemChanged             += ColorPicker_ItemChanged;
        }
        public DisplayAndPrintPreferences(Entities.DisplayAndPrintSettings displayAndPrintSettings, Song currentSong)
        {
            this._currentSong = currentSong;
            //populate values
            this.displayAndPrintSettings = displayAndPrintSettings;

            fontAndColorPanel = new FontAndColorPanel();

            songMetadataTemplatesPanel = new SongMetadataTemplatesPanel();

            cmbSongOrientation.Items.Add("Horizontal");
            cmbSongOrientation.Items.Add("Vertical");


            updateGuiFromSettingsObject(this.displayAndPrintSettings);

            Content = splitter1 = new Splitter()
            {
                Position = Helpers.FormHelper.getScreenXPercentageInPixels(30),
                Panel1   = new TableLayout()
                {
                    Rows =
                    {
                        new GroupBox()
                        {
                            Text    = "Visibility",
                            Content = new TableLayout()
                            {
                                Style = "padded-table",
                                Rows  =
                                {
                                    new TableRow()
                                    {
                                        Cells =   { new Label()
                                                    {
                                                        Text = "Show Chords"
                                                    }, chkShowChords }
                                    },
                                    new TableRow()
                                    {
                                        Cells =   { new Label()
                                                    {
                                                        Text = "Show Lyrics"
                                                    }, chkShowLyrics }
                                    },
                                    new TableRow()
                                    {
                                        Cells =   { new Label()
                                                    {
                                                        Text = "Show Notes"
                                                    }, chkShowNotes }
                                    },
                                    new TableRow()
                                    {
                                        Cells =   { new Label()
                                                    {
                                                        Text = "Display Each Song Section Once"
                                                    }, chkDisplayEachSongSectionOnce }
                                    },
                                    new TableRow()
                                    {
                                        Cells =   { new Label()
                                                    {
                                                        Text = "Song Orientation"
                                                    }, cmbSongOrientation, null }
                                    },
                                    null,
                                }
                            }
                        },
                        new GroupBox()
                        {
                            Text    = "Fonts And Colors",
                            Content = fontAndColorPanel
                        },
                        new GroupBox()
                        {
                            Text    = "Song Metadata Templates",
                            Content = songMetadataTemplatesPanel
                        },
                        new GroupBox()
                        {
                            Text    = "Backup/Restore Settings",
                            Content = new TableLayout()
                            {
                                Style = "padded-table",
                                Rows  =
                                {
                                    new TableRow()
                                    {
                                        Cells =   { cmdBackupSettings, cmdRestoreSettings,cmdRevertSettings, cmdResetSettings, null }
                                    }
                                }
                            }
                        },
                        null
                    }
                },
                Panel2 = new GroupBox()
                {
                    Text = "Preview", Content = webPreview
                }
            };

            updatePreview();
            chkShowChords.CheckedChanged += FieldChanged;
            chkShowLyrics.CheckedChanged += FieldChanged;
            chkShowNotes.CheckedChanged  += FieldChanged;
            chkDisplayEachSongSectionOnce.CheckedChanged += FieldChanged;
            fontAndColorPanel.ItemChanged           += FieldChanged;
            songMetadataTemplatesPanel.ItemChanged  += FieldChanged;
            cmbSongOrientation.SelectedIndexChanged += FieldChanged;

            cmdBackupSettings.Click  += cmdBackupSettings_Click;
            cmdRestoreSettings.Click += cmdRestoreSettings_Click;
            cmdRevertSettings.Click  += cmdRevertSettings_Click;
            cmdResetSettings.Click   += cmdResetSettings_Click;
        }
 void cmdResetSettings_Click(object sender, EventArgs e)
 {
     displayAndPrintSettings = new DisplayAndPrintSettings(displayAndPrintSettings.settingsType);
     updateGuiFromSettingsObject(displayAndPrintSettings);
     updatePreview();
 }