static public void init(cXMLHandler XmlHandler) { pColors = new cDataBaseColor(XmlHandler); initFonts(XmlHandler); pResolution = new cDataBaseResolution(XmlHandler); pImage = new cDataBaseImage(XmlHandler); pWindowstyles = new cDataBaseWindowstyle(XmlHandler); }
public void rename(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); color.pName = to; add(color); XmlNode Node = XmlHandler.XmlGetRootNodeElement(null); renameColor(Node.ChildNodes, name, to); }
public cDataBaseColor(cXMLHandler XmlHandler) { pColors = new Hashtable(); string[] path = { /*"skin", */ "colors" }; XmlNode colorNode = XmlHandler.XmlGetRootNodeElement(path); foreach (XmlNode myXmlNode in colorNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } String colorString = myXmlNode.Attributes["value"].Value; sColor color; if (colorString[0] == '#') { UInt32 colorValue = Convert.ToUInt32(colorString.Substring(1), 16); color = new sColor(myXmlNode.Attributes["name"].Value, colorValue); } else { color = new sColor(myXmlNode.Attributes["name"].Value, colorString); } if (pColors[color.pName] == null) { pColors.Add(color.pName, color); } else { String errormessage = "More than one color defined with name " + color.pName; errormessage += "\n\n" + ((sColor)pColors[color.pName]).pName + "\t#" + Convert.ToString(((sColor)pColors[color.pName]).pValue, 16);; errormessage += "\n" + color.pName + "\t#" + Convert.ToString(color.pValue, 16); errormessage += "\n"; errormessage += "\n" + "The second definition will be deleted!"; MessageBox.Show(errormessage, "Error while parsing color table", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(null /*path2*/); checkColor(Node.ChildNodes); sync(XmlHandler); }
public cDataBaseImage(cXMLHandler XmlHandler) { string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(null /*path2*/); pImages = new ArrayList(); if (Node.HasChildNodes) { checkImages(Node.ChildNodes); } }
public static void rescaleLocations(cXMLHandler XmlHandler, int o_x, int o_y, int x, int y) { scale_x = (x * 1.0) / o_x; scale_y = (y * 1.0) / o_y; string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(path2); if (Node.HasChildNodes) { checkLocations(Node.ChildNodes); } }
public void rename(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); color.pName = to; add(color); string[] path = { /*"skin", */ "colors" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(path); renameColor(Node.ChildNodes, name, to); }
public cDataBaseResolution(cXMLHandler XmlHandler) { string[] path = { /*"skin", */ "output" }; resolutionNode = XmlHandler.XmlGetRootNodeElement(path); foreach (XmlNode myXmlNode in resolutionNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } pResolution = new sResolution( Convert.ToUInt32(myXmlNode.Attributes["xres"].Value), Convert.ToUInt32(myXmlNode.Attributes["yres"].Value), Convert.ToUInt32(myXmlNode.Attributes["bpp"].Value) ); } }
public override bool sync(cXMLHandler XmlHandler) { string[] path = { /*"skin", */ "colors" }; XmlNode colorNode = XmlHandler.XmlGetRootNodeElement(path); colorNode.RemoveAll(); //Sort Names: an hashtable is not sortable, so convert it to an arraylist ArrayList sorter = new ArrayList(); sorter.AddRange(pColors.Values); sorter.Sort(); foreach (sColor color in sorter) { if (color.isNamedColor) { String[] attributes = { "color", "name", color.pName, "value",color.pValueName }; XmlHandler.XmlAppendNode(colorNode, attributes); } else { String value = Convert.ToString(color.pValue, 16); while (value.Length < 8) { value = "0" + value; } String[] attributes = { "color", "name", color.pName, "value","#" + value }; XmlHandler.XmlAppendNode(colorNode, attributes); } } return(true); }
public cDataBaseWindowstyle(cXMLHandler XmlHandler) { Hashtable colors = new Hashtable(); sFont titlefont = null; float titlesize = (float)0.0; Int32 xOff = 0, yOff = 0; ArrayList bordersets = new ArrayList(); string[] path = { /*"skin", */ "windowstyle" }; XmlNode styleNode = XmlHandler.XmlGetRootNodeElement(path); if (styleNode == null) { //<font filename= name= scale="90" /> sFont font = new sFont( "Regular", "nmsbd.ttf", 90, false ); pFonts.Add(font.Name, font); colors.Add("Background", pColors.get("#25062748")); colors.Add("LabelForeground", pColors.get("#ffffff")); colors.Add("ListboxBackground", pColors.get("#25062748")); colors.Add("ListboxForeground", pColors.get("#ffffff")); colors.Add("ListboxSelectedBackground", pColors.get("#254f7497")); colors.Add("ListboxSelectedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedBackground", pColors.get("#ff0000")); colors.Add("ListboxMarkedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedAndSelectedBackground", pColors.get("#800000")); colors.Add("ListboxMarkedAndSelectedForeground", pColors.get("#ffffff")); colors.Add("WindowTitleForeground", pColors.get("#ffffff")); colors.Add("WindowTitleBackground", pColors.get("#25062748")); sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( "bsWindow", "skin_default/b_tl.png", "skin_default/b_t.png", "skin_default/b_tr.png", "skin_default/b_l.png", "skin_default/b_r.png", "skin_default/b_bl.png", "skin_default/b_b.png", "skin_default/b_br.png"); bordersets.Add(borderset); pWindowStyle = new sWindowStyle(getFont("Regular"), 20.0f, 33, 14, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } else { foreach (XmlNode myXmlNode in styleNode.ChildNodes) { if (myXmlNode.Name == "color") { if (colors[myXmlNode.Attributes["color"].Value] == null) { colors.Add(myXmlNode.Attributes["name"].Value, pColors.get(myXmlNode.Attributes["color"].Value)); } } else if (myXmlNode.Name == "title") { String font = myXmlNode.Attributes["font"].Value; titlesize = Convert.ToSingle(font.Substring(font.IndexOf(';') + 1)); font = font.Substring(0, font.IndexOf(';')); titlefont = getFont(font); xOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(0, myXmlNode.Attributes["offset"].Value.IndexOf(','))); yOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(myXmlNode.Attributes["offset"].Value.IndexOf(',') + 1)); } else if (myXmlNode.Name == "borderset") { String pbpTopLeftName = ""; String pbpTopName = ""; String pbpTopRightName = ""; String pbpLeftName = ""; String pbpRightName = ""; String pbpBottomLeftName = ""; String pbpBottomName = ""; String pbpBottomRightName = ""; //string[] path2 = { "skin", "windowstyle", "borderset" }; //XmlNode fontNode2 = XmlHandler.XmlGetRootNodeElement(path2); foreach (XmlNode myXmlNode2 in /*fontNode2*/ myXmlNode.ChildNodes) { if (myXmlNode2.Attributes["pos"].Value == "bpTopLeft") { pbpTopLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpTop") { pbpTopName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpTopRight") { pbpTopRightName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpLeft") { pbpLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpRight") { pbpRightName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomLeft") { pbpBottomLeftName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottom") { pbpBottomName = myXmlNode2.Attributes["filename"].Value; } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomRight") { pbpBottomRightName = myXmlNode2.Attributes["filename"].Value; } } sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( myXmlNode.Attributes["name"].Value, pbpTopLeftName, pbpTopName, pbpTopRightName, pbpLeftName, pbpRightName, pbpBottomLeftName, pbpBottomName, pbpBottomRightName); bordersets.Add(borderset); } } pWindowStyle = new sWindowStyle(titlefont, titlesize, xOff, yOff, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } }
//################################################################# static private void initFonts(cXMLHandler XmlHandler) { pFonts = new Hashtable(); string[] path = { /*"skin", */ "fonts" }; XmlNode fontNode = XmlHandler.XmlGetRootNodeElement(path); if (fontNode == null) { //PVMC Workaround till proper fonts for plugins is implemented in enigma2 //We expect that the fontloader pseudo screen is the first screen in the skin path[0] = "screen"; fontNode = XmlHandler.XmlGetRootNodeElement(path); if (fontNode.Attributes["name"].Value == "PVMC_FontLoader") { Hashtable elements = new Hashtable(); foreach (XmlNode myXmlNode in fontNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } elements.Add(myXmlNode.Attributes["name"].Value, myXmlNode.Attributes["text"].Value); } Int32 api = Convert.ToInt32(elements["API"] != null ? elements["API"] : "1"); if (api >= 2) { Int32 count = Convert.ToInt32(elements["COUNT"] != null ? elements["COUNT"] : "0"); for (int i = 0; i < count; i++) { string[] fontString = ((string)elements["FONT" + i.ToString()]).Split('|'); sFont font = new sFont( fontString[1], fontString[0], Convert.ToInt32(fontString[2]), fontString[3] != "False" ); pFonts.Add(font.Name, font); } } } } else { foreach (XmlNode myXmlNode in fontNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element || myXmlNode.Name != "font") { continue; } sFont font = new sFont( myXmlNode.Attributes["name"].Value, myXmlNode.Attributes["filename"].Value, Convert.ToInt32(myXmlNode.Attributes["scale"] != null ? myXmlNode.Attributes["scale"].Value : "100"), Convert.ToInt32(myXmlNode.Attributes["replacement"] != null ? myXmlNode.Attributes["replacement"].Value : "0") != 0 ); pFonts.Add(font.Name, font); } foreach (XmlNode myXmlNode in fontNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element || myXmlNode.Name != "alias") { continue; } sFont font = new sFont( myXmlNode.Attributes["name"].Value, getFont(myXmlNode.Attributes["font"].Value).Path, 100, false ); pFonts.Add(font.Name, font); } } }
public abstract bool sync(cXMLHandler XmlHandler);
public override bool sync(cXMLHandler XmlHandler) { return(false); }
//################################################################# static private void initFonts(cXMLHandler XmlHandler) { pFonts = new Hashtable(); string[] path = { /*"skin", */ "fonts" }; XmlNode fontNode = XmlHandler.XmlGetRootNodeElement(path); if (fontNode == null) { //PVMC Workaround till proper fonts for plugins is implemented in enigma2 //We expect that the fontloader pseudo screen is the first screen in the skin path[0] = "screen"; fontNode = XmlHandler.XmlGetRootNodeElement(path); if (fontNode.Attributes["name"].Value == "PVMC_FontLoader") { Hashtable elements = new Hashtable(); foreach (XmlNode myXmlNode in fontNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } elements.Add(myXmlNode.Attributes["name"].Value, myXmlNode.Attributes["text"].Value); } Int32 api = Convert.ToInt32(elements["API"] != null ? elements["API"] : "1"); if (api >= 2) { Int32 count = Convert.ToInt32(elements["COUNT"] != null ? elements["COUNT"] : "0"); for (int i = 0; i < count; i++) { string[] fontString = ((string)elements["FONT" + i.ToString()]).Split('|'); sFont font = new sFont( fontString[1], fontString[0], Convert.ToInt32(fontString[2]), 12, "", fontString[3] != "False" ); pFonts.Add(font.Name, font); } } } } else { foreach (XmlNode myXmlNode in fontNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element || myXmlNode.Name != "font" && myXmlNode.Name != "alias") //MOD { continue; } if (myXmlNode.Name == "font") //MOD { try //MOD { if (pFonts[myXmlNode.Attributes["name"].Value] == null) { sFont font = new sFont( myXmlNode.Attributes["name"].Value, myXmlNode.Attributes["filename"].Value, Convert.ToInt32(myXmlNode.Attributes["scale"] != null ? myXmlNode.Attributes["scale"].Value : "100"), Convert.ToInt32(myXmlNode.Attributes["size"] != null), "", Convert.ToInt32(myXmlNode.Attributes["replacement"] != null ? myXmlNode.Attributes["replacement"].Value : "0") != 0); pFonts.Add(font.Name, font); } else { String errormessage = fMain.GetTranslation("More than one font defined with name") + " '" + myXmlNode.Attributes["name"].Value + "'"; MessageBox.Show(errormessage, fMain.GetTranslation("Error while parsing font table"), MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } catch { } } else if (myXmlNode.Name == "alias")//MOD { try { if (pFonts[myXmlNode.Attributes["name"].Value] == null) { sFont font = new sFont( myXmlNode.Attributes["name"].Value, getFont(myXmlNode.Attributes["font"].Value).Path, 100, Convert.ToInt32(myXmlNode.Attributes["size"].Value), myXmlNode.Attributes["font"].Value, false, true); pFonts.Add(font.Name, font); } else { String errormessage = fMain.GetTranslation("More than one font (alias) defined with name") + " '" + myXmlNode.Attributes["name"].Value + "'"; MessageBox.Show(errormessage, fMain.GetTranslation("Error while parsing font table"), MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); } } catch { } } } } }
public void removeColor(cXMLHandler XmlHandler, String name, String to) { sColor color = (sColor)pColors[name]; remove(color); }
public cDataBaseColor(cXMLHandler XmlHandler) { pColors = new Hashtable(); string[] path = { /*"skin", */ "colors" }; XmlNode colorNode = XmlHandler.XmlGetRootNodeElement(path); foreach (XmlNode myXmlNode in colorNode.ChildNodes) { if (myXmlNode.NodeType != XmlNodeType.Element) { continue; } String colorString = myXmlNode.Attributes["value"].Value; sColor color; if (colorString[0] == '#') { UInt32 colorValue = Convert.ToUInt32(colorString.Substring(1), 16); color = new sColor(myXmlNode.Attributes["name"].Value, colorValue); } else { color = new sColor(myXmlNode.Attributes["name"].Value, colorString); } if (pColors[color.pName] == null) { pColors.Add(color.pName, color); } else { String errormessage = fMain.GetTranslation("More than one color defined with name") + " '" + color.pName + "'"; errormessage += "\n\n" + ((sColor)pColors[color.pName]).pName + "\t#" + Convert.ToString(((sColor)pColors[color.pName]).pValue, 16);; errormessage += "\n" + color.pName + "\t#" + Convert.ToString(color.pValue, 16); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("The second definition will be deleted if you save manually."); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("Until you save, the second definition is still shown in TreeView!"); errormessage += "\n"; errormessage += "\n" + fMain.GetTranslation("Do you want to save and reload the skin?"); if (MessageBox.Show(errormessage, fMain.GetTranslation("Error while parsing color table"), MessageBoxButtons.YesNo, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1) == DialogResult.Yes) { MyGlobaleVariables.Reload = true; } } } string[] path2 = { "skin" }; XmlNode Node = XmlHandler.XmlGetRootNodeElement(null /*path2*/); checkColor(Node.ChildNodes); sync(XmlHandler); }
public cDataBaseWindowstyle(cXMLHandler XmlHandler) { Hashtable colors = new Hashtable(); sFont titlefont = null; float titlesize = (float)0.0; Int32 xOff = 0, yOff = 0; ArrayList bordersets = new ArrayList(); string[] path = { /*"skin", */ "windowstyle" }; XmlNode styleNode = XmlHandler.XmlGetRootNodeElement(path); if (styleNode == null) { //<font filename= name= scale="90" /> sFont font = new sFont( "Regular", "nmsbd.ttf", 90, 30, "nmsbd", false ); pFonts.Add(font.Name, font); colors.Add("Background", pColors.get("#25062748")); colors.Add("LabelForeground", pColors.get("#ffffff")); colors.Add("ListboxBackground", pColors.get("#25062748")); colors.Add("ListboxForeground", pColors.get("#ffffff")); colors.Add("ListboxSelectedBackground", pColors.get("#254f7497")); colors.Add("ListboxSelectedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedBackground", pColors.get("#ff0000")); colors.Add("ListboxMarkedForeground", pColors.get("#ffffff")); colors.Add("ListboxMarkedAndSelectedBackground", pColors.get("#800000")); colors.Add("ListboxMarkedAndSelectedForeground", pColors.get("#ffffff")); colors.Add("WindowTitleForeground", pColors.get("#ffffff")); colors.Add("WindowTitleBackground", pColors.get("#25062748")); sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( "bsWindow", "skin_default/b_tl.png", "skin_default/b_t.png", "skin_default/b_tr.png", "skin_default/b_l.png", "skin_default/b_r.png", "skin_default/b_bl.png", "skin_default/b_b.png", "skin_default/b_br.png"); bordersets.Add(borderset); pWindowStyle = new sWindowStyle(getFont("Regular"), 20.0f, 33, 14, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } else { foreach (XmlNode myXmlNode in styleNode.ChildNodes) { if (myXmlNode.Name == "color") { if (colors[myXmlNode.Attributes["color"].Value] == null) { colors.Add(myXmlNode.Attributes["name"].Value, pColors.get(myXmlNode.Attributes["color"].Value)); } } else if (myXmlNode.Name == "title") { String font = myXmlNode.Attributes["font"].Value; titlesize = Convert.ToSingle(font.Substring(font.IndexOf(';') + 1)); font = font.Substring(0, font.IndexOf(';')); titlefont = getFont(font); xOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(0, myXmlNode.Attributes["offset"].Value.IndexOf(','))); yOff = Convert.ToInt32(myXmlNode.Attributes["offset"].Value.Substring(myXmlNode.Attributes["offset"].Value.IndexOf(',') + 1)); } else if (myXmlNode.Name == "borderset") { String pbpTopLeftName = ""; String pbpTopName = ""; String pbpTopRightName = ""; String pbpLeftName = ""; String pbpRightName = ""; String pbpBottomLeftName = ""; String pbpBottomName = ""; String pbpBottomRightName = ""; //string[] path2 = { "skin", "windowstyle", "borderset" }; //XmlNode fontNode2 = XmlHandler.XmlGetRootNodeElement(path2); int anz = 0; foreach (XmlNode myXmlNode2 in /*fontNode2*/ myXmlNode.ChildNodes) { try { if (myXmlNode2.Attributes["pos"] != null) { if (myXmlNode2.Attributes["pos"].Value == "bpTopLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpTop") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpTopRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpTopRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomLeft") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomLeftName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottom") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } else if (myXmlNode2.Attributes["pos"].Value == "bpBottomRight") { if (myXmlNode2.OuterXml.Contains("filename=")) { pbpBottomRightName = myXmlNode2.Attributes["filename"].Value; } else { anz += 1; } } } else { // [pos] = null } } catch (NullReferenceException err) { MessageBox.Show("There is something wrong with your borderset" + "\n\n" + err.Message); } } if (anz > 0) { MessageBox.Show("The path of " + anz + " borderset-files is not specified!" + "\n\n", "Path(s) not specified", MessageBoxButtons.OK, MessageBoxIcon.Information); } sWindowStyle.sBorderSet borderset = new sWindowStyle.sBorderSet( myXmlNode.Attributes["name"].Value, pbpTopLeftName, pbpTopName, pbpTopRightName, pbpLeftName, pbpRightName, pbpBottomLeftName, pbpBottomName, pbpBottomRightName); bordersets.Add(borderset); } } pWindowStyle = new sWindowStyle(titlefont, titlesize, xOff, yOff, colors, (sWindowStyle.sBorderSet[])bordersets.ToArray(typeof(sWindowStyle.sBorderSet))); } }