Ejemplo n.º 1
0
        private void UpdatePreviewPanel()
        {
            var tempStyle = new Style
                        {
                          Name = this.styleName.Text,
                          Font = this.fontName.Value as string ?? "",
                          ForegroundColor = this.fontColor.Color,
                          FontSize = (int)this.fontSize.Value,
                          BackgroundColor = this.bgColor.Color,
                          BackgroundImageUri = this.backgroundImage.Text,
                          Transparency = this.transparency.Value,
                          Scale = this.scale.Checked,
                          TitleMode = (TitleMode)this.titleMode.Value,
                          TitleForegroundColor = this.titleForegroundColor.Color,
                          TitleBackgroundColor = this.titleBackgroundColor.Color,
                          TitleFont = this.titleFont.Value as string ?? "",
                          TitleFontSize = (int)this.titleFontSize.Value
                        };

              Bitmap previewBitmap = new Bitmap(400, this.previewPanel.ClientArea.Height);
              Graphics g = Graphics.FromImage(previewBitmap);
              Rectangle clip = new Rectangle(0, 0, previewBitmap.Width, previewBitmap.Height);
              if (tempStyle.HasBackgroundImage)
              {
            g.DrawImage(tempStyle.GetBackgroundImage(new Size(clip.Width, clip.Height)), 0, 0);
              }
              else
              {
            g.FillRectangle(new SolidBrush(tempStyle.BackgroundColor ?? Util.BGCOLOR), clip);
              }

              this.exampleSongText.Font = tempStyle.GetFont() ?? Util.FONT;
              this.exampleSongText.ForeColor = tempStyle.ForegroundColor ?? Util.COLOR;
              this.previewPanel.Appearance.ImageBackground = previewBitmap;
              this.previewPanel.Appearance.ImageBackgroundStyle = ImageBackgroundStyle.Tiled;
              this.viewTitle.TitleFont = tempStyle.GetTitleFont() ?? Util.TITLEFONT;
              this.viewTitle.TitleBackgroundColor = tempStyle.TitleBackgroundColor ?? Util.TITLEBGCOLOR;
              this.viewTitle.TitleForegroundColor = tempStyle.TitleForegroundColor ?? Util.TITLECOLOR;
              this.viewTitle.Mode = tempStyle.TitleMode;

              exampleSongText.Top = viewTitle.Mode == TitleMode.None ? 10 : (viewTitle.Bottom + 10);
        }
Ejemplo n.º 2
0
        private void CancelBtnClickHandler(object sender, EventArgs e)
        {
            // undo "new"
              if (this.SelectedStyle.IsNew)
              {
            this.stylesList.Items.Remove(this.SelectedStyle);
            this.SelectedStyle = this.stylesList.Items.Count > 0 ? this.stylesList.Items[0] as Style : null;
              }

              // reset
              this.UpdateStyleInfo();

              this.stylesListPanel.Enabled = true;
              this.saveCancelPanel.Visible = false;
              this.saveCancelPanel.Enabled = false;
        }
Ejemplo n.º 3
0
        private void NewStyleClickHandler(object sender, EventArgs e)
        {
            var name = sender == this.newFromSelectedBtn && this.SelectedStyle != null ? this.SelectedStyle.Name + " (Kopie)"
              : "Neuer Style " + DateTime.Now.ToString("dd.MM.yyyy");
              var newStyle = Style.CreateNewStyle(this._storage.PhysicalStorage, name);
              this.stylesList.Items.Add(newStyle);

              if (sender == this.newFromSelectedBtn && this.SelectedStyle != null)
              {
            newStyle.BackgroundColor = this.SelectedStyle.BackgroundColor;
            newStyle.BackgroundImageUri = this.SelectedStyle.BackgroundImageUri;
            newStyle.Font = this.SelectedStyle.Font;
            newStyle.FontSize = this.SelectedStyle.FontSize;
            newStyle.ForegroundColor = this.SelectedStyle.ForegroundColor;
            newStyle.Scale = this.SelectedStyle.Scale;
            newStyle.Transparency = this.SelectedStyle.Transparency;
            newStyle.TitleMode = SelectedStyle.TitleMode;
            newStyle.TitleForegroundColor = this.SelectedStyle.TitleForegroundColor;
            newStyle.TitleBackgroundColor = this.SelectedStyle.TitleBackgroundColor;
            newStyle.TitleFont = this.SelectedStyle.TitleFont;
            newStyle.TitleFontSize = this.SelectedStyle.TitleFontSize;
              }
              else
              {
            newStyle.Font = Util.FONT.Name;
            newStyle.FontSize = (int)Util.FONT.SizeInPoints;
            newStyle.ForegroundColor = Util.COLOR;
            newStyle.BackgroundColor = Util.BGCOLOR;
              }
              this.SelectedStyle = newStyle;

              this.stylesListPanel.Enabled = false;
              this.saveCancelPanel.Visible = true;
              this.saveCancelPanel.Enabled = true;
        }
Ejemplo n.º 4
0
        private void OnSelectedIndexChangedHandler(object sender, EventArgs e)
        {
            if (this.stylesList.Items.Count == 0)
              {
            return;
              }

              if (this.stylesList.SelectedIndex < 0)
              {
            this.stylesList.SelectedIndex = 0;
              }
              else
              {
            this.SelectedStyle = (Style)this.stylesList.SelectedItem;
              }

              this.stylesListPanel.Enabled = true;
              this.saveCancelPanel.Visible = false;
              this.saveCancelPanel.Enabled = false;
        }
Ejemplo n.º 5
0
        public void SetStyleAsDefault(Style style)
        {
            if (style.IsDefault)
            {
                return;
            }

            foreach (Style s in this.Styles)
            {
                if (s.IsDefault)
                {
                    s.IsDefault = false;
                    this.SaveStyle(s);
                    break;
                }
            }

            style.IsDefault = true;
            this.SaveStyle(style);
        }
Ejemplo n.º 6
0
 private void DeleteClickHandler(object sender, EventArgs e)
 {
     if (!this._storage.IsStyleInUse(this.SelectedStyle) ||
     MessageBox.Show(this, @"Dieser Style wird von mindestens einem Lied verwendet." + Environment.NewLine +
                                            @"Soll er trotzdem gelöscht werden?", @"Löschen bestätigen",
                                      MessageBoxButtons.YesNo,
                                      MessageBoxIcon.Exclamation) == DialogResult.Yes)
       {
     var styleToDelete = this.SelectedStyle;
     this.stylesList.Items.Remove(styleToDelete);
     this.SelectedStyle = this.stylesList.Items.Count > 0 ? this.stylesList.Items[0] as Style : null;
     styleToDelete.Delete();
       }
 }
Ejemplo n.º 7
0
 public void SaveStyle(Style style)
 {
     if (style.IsNew)
     {
         this.styles.Add(style);
     }
     this.SaveStyleDoc();
 }
Ejemplo n.º 8
0
 public void DeleteStyle(Style style)
 {
     this.styles.Remove(style);
     this.SaveStyleDoc();
 }
Ejemplo n.º 9
0
 public static Style CreateNewStyle(IPhysicalStorage storage, string name)
 {
     var style = new Style(storage) { Name = name };
       style._isNew = true;
       return style;
 }
Ejemplo n.º 10
0
        public void SetStyleAsDefault(Style style)
        {
            if (style.IsDefault) return;

              // set the given style as new default style
              this.PhysicalStorage.SetStyleAsDefault(style);

              // update all songs with default style
              foreach (Song song in this._songList.Values.Cast<Song>().Where(song => song.UseDefaultStyle))
              {
            song.Style = style;
              }
        }
Ejemplo n.º 11
0
 public bool IsStyleInUse(Style style)
 {
     return this._songList.Values.Cast<Song>().Any(song => song.Style == style);
 }