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); }
public static void Load() { if (Theme.loaded) { return; } Theme.loaded = true; ThemeFontset.all = ThemeFontset.Import(); ThemePalette.all = ThemePalette.Import(); ThemeSkinset.all = ThemeSkinset.Import(); ThemeIconset.all = ThemeIconset.Import(); Theme.all = Theme.Import().OrderBy(x => x.name != "Default").ToList(); }
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(); } } }
//================================= // 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); }
public ThemeFontset(ThemeFontset other) { this.Use(other); }
public ThemeFontset UseBuffer(ThemeFontset other) { this.buffer = other.buffer; return(this); }