Пример #1
0
 public ThemeFontset Use(ThemeFontset other)
 {
     this.name = other.name;
     this.path = other.path;
     foreach (var item in other.fonts)
     {
         this.fonts[item.Key] = other.fonts[item.Key].Copy();
     }
     return(this);
 }
Пример #2
0
 public Theme Use(Theme other)
 {
     this.UseVariables(other, typeof(InternalAttribute).AsList());
     if (this.name.IsEmpty())
     {
         this.name = other.name;
     }
     if (this.path.IsEmpty())
     {
         this.path = other.path;
     }
     this.skinset = other.skinset;
     this.iconset = other.iconset;
     this.palette = other.palette;
     this.fontset = other.fontset;
     return(this);
 }
Пример #3
0
 public void Deserialize(string data)
 {
     foreach (var line in data.GetLines())
     {
         if (line.Trim().IsEmpty())
         {
             continue;
         }
         var term  = line.Parse("", " ").Trim();
         var value = line.Parse(" ").Trim().Trim("=").Trim();
         if (term.Matches("CustomizablePalette", true))
         {
             this.customizablePalette = value.ToBool();
         }
         else if (term.Matches("CustomizableFontset", true))
         {
             this.customizableFontset = value.ToBool();
         }
         else if (term.Matches("CustomizableIconset", true))
         {
             this.customizableIconset = value.ToBool();
         }
         else if (term.Matches("Palette", true))
         {
             this.palette = ThemePalette.all.Find(x => x.name == value) ?? new ThemePalette();
         }
         else if (term.Matches("Fontset", true))
         {
             this.fontset = ThemeFontset.all.Find(x => x.name == value) ?? new ThemeFontset();
         }
         else if (term.Matches("Iconset", true))
         {
             this.iconset = ThemeIconset.all.Find(x => x.name == value) ?? new ThemeIconset();
         }
         else if (term.Matches("Skinset", true))
         {
             var variants = value.Split("+");
             this.defaultVariants = variants.Skip(1).ToArray();
             this.skinset         = ThemeSkinset.all.Find(x => x.name == variants[0]) ?? new ThemeSkinset();
         }
     }
 }
Пример #4
0
 //=================================
 // Utilities
 //=================================
 public bool Matches(ThemeFontset other)
 {
     foreach (var item in this.fonts)
     {
         var name      = item.Key;
         var themeFont = item.Value;
         if (!other.fonts.ContainsKey(name))
         {
             return(false);
         }
         bool mismatchedFont       = themeFont.font != other.fonts[name].font;
         bool mismatchedSizeOffset = themeFont.sizeOffset != other.fonts[name].sizeOffset;
         bool mismatchedOffsetX    = themeFont.offsetX != other.fonts[name].offsetX;
         bool mismatchedOffsetY    = themeFont.offsetY != other.fonts[name].offsetY;
         if (mismatchedFont || mismatchedSizeOffset || mismatchedOffsetX || mismatchedOffsetY)
         {
             return(false);
         }
     }
     return(true);
 }
Пример #5
0
 public ThemeFontset(ThemeFontset other)
 {
     this.Use(other);
 }
Пример #6
0
 public ThemeFontset UseBuffer(ThemeFontset other)
 {
     this.buffer = other.buffer;
     return(this);
 }