Example #1
0
        public void setup(cXMLHandler xmlhandler)
        {
            pXmlHandler = xmlhandler;

            sFont[] fonts = cDataBase.getFonts();

            //listView1.Clear();
            foreach (sFont font in fonts)
            {
                System.Windows.Forms.ListViewItem.ListViewSubItem[] subtitems = new System.Windows.Forms.ListViewItem.ListViewSubItem[6];

                subtitems[0] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[0].Text = font.Name;
                subtitems[1] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[1].Text = font.Filename;
                subtitems[2] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[2].Text = font.Path;
                subtitems[3] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[3].Text = Convert.ToString(font.Scale);
                subtitems[4] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[4].Text = Convert.ToString(font.Replacement);
                subtitems[5] = new System.Windows.Forms.ListViewItem.ListViewSubItem();
                subtitems[5].Text = "0";
                ListViewItem item = new ListViewItem(subtitems, 0);
                listView1.Items.Add(item);
            }
            listView1.RedrawItems(0, listView1.Items.Count - 1, false);
        }
Example #2
0
 static public void init(cXMLHandler XmlHandler)
 {
     pColors = new cDataBaseColor(XmlHandler);
     initFonts(XmlHandler);
     pResolution   = new cDataBaseResolution(XmlHandler);
     pImage        = new cDataBaseImage(XmlHandler);
     pWindowstyles = new cDataBaseWindowstyle(XmlHandler);
 }
Example #3
0
 static public void init(cXMLHandler XmlHandler)
 {
     pColors = new cDataBaseColor(XmlHandler);
     initFonts(XmlHandler);
     pResolution = new cDataBaseResolution(XmlHandler);
     pImage = new cDataBaseImage(XmlHandler);
     pWindowstyles = new cDataBaseWindowstyle(XmlHandler);
 }
Example #4
0
            public cDataBaseImage(cXMLHandler XmlHandler)
            {
                string[] path2 = { "skin" };
                XmlNode  Node  = XmlHandler.XmlGetRootNodeElement(null /*path2*/);

                pImages = new ArrayList();

                if (Node.HasChildNodes)
                {
                    checkImages(Node.ChildNodes);
                }
            }
Example #5
0
            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);
            }
Example #6
0
        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);
            }
        }
Example #7
0
            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);
            }
Example #8
0
        public void setup(cXMLHandler xmlhandler)
        {
            pXmlHandler = xmlhandler;

            sResolution resolution = cDataBase.pResolution.getResolution();

            if (resolution.Xres == 720 && resolution.Yres == 576)
                radioButton576.Checked = true;
            else if (resolution.Xres == 1024 && resolution.Yres == 576)
                radioButton1024.Checked = true;
            else if (resolution.Xres == 1280 && resolution.Yres == 720)
                radioButton720.Checked = true;
            else if (resolution.Xres == 1920 && resolution.Yres == 1080)
                radioButton1080.Checked = true;

        }
Example #9
0
            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)
                        );
                }
            }
Example #10
0
            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);
            }
Example #11
0
            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)));
                }
            }
Example #12
0
 public abstract bool sync(cXMLHandler XmlHandler);
Example #13
0
            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);
            }
Example #14
0
            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;
            }
Example #15
0
        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);
            }
Example #16
0
 public override bool sync(cXMLHandler XmlHandler)
 {
     return(false);
 }
Example #17
0
        //#################################################################

        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)
                        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);
                }
            }
        }
Example #18
0
            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)));
                }
            }
Example #19
0
            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)
                    );
                }
            }
Example #20
0
        //#################################################################

        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)
                    {
                        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);
                }
            }
        }
Example #21
0
        public void open(String path)
        {
            // Close all open
            close();

            cProperties.setProperty("path_skin", path);
            cProperties.setProperty("path", "./skins");
            cProperties.setProperty("path_fonts", "./fonts");

            pXmlHandler = new cXMLHandler();
            //treeview TO Xml
            pXmlHandler.XmlToTreeView(cProperties.getProperty("path") + "/" + cProperties.getProperty("path_skin_xml"), treeView1);
            cDataBase.init(pXmlHandler);

            treeView1.GetNodeAt(0, 0).Expand();

            pDesigner.drawFrame();
            pictureBox1.Invalidate();

            panelDesignerInner.AutoScrollMinSize = new Size((int)(cDataBase.pResolution.getResolution().Xres / pDesigner.zoomLevel()) + 100, (int)(cDataBase.pResolution.getResolution().Yres / pDesigner.zoomLevel()) + 100);
            MiOpen.Enabled = false;

            MiSave.Enabled = true;
            MiSaveAs.Enabled = true;
            MiClose.Enabled = true;
            MiResolution.Enabled = true;
            MiColors.Enabled = true;
            MiFonts.Enabled = true;
            MiWindowStyles.Enabled = true;
            btnSave.Enabled = true;
            btnSaveEditor.Enabled = true;

            this.addLabelToolStripMenuItem.Enabled = true;
            this.addPixmapToolStripMenuItem.Enabled = true;
            this.addWidgetToolStripMenuItem.Enabled = true;
            this.deletToolStripMenuItem.Enabled = true;
        }
Example #22
0
 public override bool sync(cXMLHandler XmlHandler) { return false; }
Example #23
0
 public abstract bool sync(cXMLHandler XmlHandler);
Example #24
0
        public void close()
        {
            pXmlHandler = null;
            pDesigner.clear();
            cDataBase.clear();
            treeView1.Nodes.Clear();
            treeView1.Invalidate();

            if (Platform.sysPlatform == Platform.ePlatform.MONO)
                textBoxEditor.Clear();
            else
                textBoxEditor2.Text = "";
            propertyGrid1.SelectedObject = null;

            pictureBox1.Invalidate();

            MiOpen.Enabled = true;

            MiSave.Enabled = false;
            MiSaveAs.Enabled = false;
            MiClose.Enabled = false;
            MiResolution.Enabled = false;
            MiColors.Enabled = false;
            MiFonts.Enabled = false;
            MiWindowStyles.Enabled = false;
            btnSave.Enabled = false;
            btnSaveEditor.Enabled = false;

            this.addLabelToolStripMenuItem.Enabled = false;
            this.addPixmapToolStripMenuItem.Enabled = false;
            this.addWidgetToolStripMenuItem.Enabled = false;
            this.deletToolStripMenuItem.Enabled = false;

            pQueue.clear();
        }
Example #25
0
            public cDataBaseImage(cXMLHandler XmlHandler)
            {
                string[] path2 = { "skin" };
                XmlNode Node = XmlHandler.XmlGetRootNodeElement(null/*path2*/);

                pImages = new ArrayList();

                if (Node.HasChildNodes)
                    checkImages(Node.ChildNodes);
            }
Example #26
0
        public void setup(cXMLHandler xmlhandler)
        {
            pXmlHandler = xmlhandler;

            refresh();
        }
Example #27
0
            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);
            }