Beispiel #1
0
        //protected sAttribute pAttr;

        public sGraphicFont(sAttribute attr, Int32 x, Int32 y, String text, float size, sFont font, sColor color, cProperty.eHAlign hAlignment, cProperty.eVAlign vAlignment)
            : base(attr)
        {
            //pAttr = attr;

            pX = x;
            pY = y;

            pText = text;
            pSize = size;
            pFont = font;
            pColor = color;
            pHAlignment = hAlignment;
            pVAlignment = vAlignment;

            pTranparent = true;
        }
Beispiel #2
0
        /// <summary>
        /// ///////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>

        public sAttributeLabel(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
 
            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (myNode.Attributes["text"] != null)
                pText = myNode.Attributes["text"].Value;

            if (myNode.Attributes["font"] != null)
            {
                String tmpfont = myNode.Attributes["font"].Value;
                float size = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1));
                String fontname = tmpfont.Substring(0, tmpfont.IndexOf(';'));
                pFont = cDataBase.getFont(fontname);
                pFontSize = size;
            }
            else
            {
                pFont = cDataBase.getFont("Regular");
                pFontSize = 16;
            }

            if (myNode.Attributes["backgroundColor"] != null)
                pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value);
            else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null)
                pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"];
            else
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];

            if (myNode.Attributes["foregroundColor"] != null)
                pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value);
            else
                pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];

            if (myNode.Attributes["valign"] != null)
                pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top :
                    myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center :
                    cProperty.eVAlign.Bottom;

            if (myNode.Attributes["halign"] != null)
                pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left :
                    myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center :
                    cProperty.eHAlign.Right;

            if (myNode.Attributes["noWrap"] != null)
                pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false;


            if (pText == null || pText.Length > 0)
                if(Name.Length > 0)
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
        }
        public sAttributeScreen(XmlNode node)
            : base(node)
        {
            if (node == null)
                return;


            pZPosition = -100;

            if (node.Attributes["title"] != null)
                pTitle = node.Attributes["title"].Value;

            if (node.Attributes["flags"] != null)
                switch (node.Attributes["flags"].Value)
                {
                    case "wfNoBorder":
                        pFlags = eFlags.wfNoBorder;
                        break;
                    case "wfBorder":
                    default:
                        pFlags = eFlags.wfBorder;
                        break;
                 }

            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (node.Attributes["backgroundColor"] != null)
                pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            else
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];

            if (node.Attributes["labelforeground"] != null)
                pTitle = node.Attributes["labelforeground"].Value;
            else
                pLabelForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];

            pTitleFont = pWindowStyle.pFont;
            pTitleSize = pWindowStyle.pTitleSize * (((float)pTitleFont.Scale) / 100.0F);

            pTitleXOff = pWindowStyle.pXOff;
            pTitleYOff = pWindowStyle.pYOff;

            /*pbpTopLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopLeft;
            pbpTop = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTop;
            pbpTopRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopRight;
            pbpLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpLeft;
            pbpRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpRight;
            pbpBottomLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomLeft;
            pbpBottom = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottom;
            pbpBottomRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomRight;*/

            sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get();
            sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsWindow"];

            if (borderset != null)
            {

                if (borderset.pbpTopLeftName.Length > 0)
                {
                    pbpTopLeftName = borderset.pbpTopLeftName;
                    pbpTopLeft = borderset.pbpTopLeft;
                }
                if (borderset.pbpTopName.Length > 0)
                {
                    pbpTopName = borderset.pbpTopName;
                    pbpTop = borderset.pbpTop;
                }
                if (borderset.pbpTopRightName.Length > 0)
                {
                    pbpTopRightName = borderset.pbpTopRightName;
                    pbpTopRight = borderset.pbpTopRight;
                }


                if (borderset.pbpLeftName.Length > 0)
                {
                    pbpLeftName = borderset.pbpLeftName;
                    pbpLeft = borderset.pbpLeft;
                }
                if (borderset.pbpRightName.Length > 0)
                {
                    pbpRightName = borderset.pbpRightName;
                    pbpRight = borderset.pbpRight;
                }


                if (borderset.pbpBottomLeftName.Length > 0)
                {
                    pbpBottomLeftName = borderset.pbpBottomLeftName;
                    pbpBottomLeft = borderset.pbpBottomLeft;
                }
                if (borderset.pbpBottomName.Length > 0)
                {
                    pbpBottomName = borderset.pbpBottomName;
                    pbpBottom = borderset.pbpBottom;
                }
                if (borderset.pbpBottomRightName.Length > 0)
                {
                    pbpBottomRightName = borderset.pbpBottomRightName;
                    pbpBottomRight = borderset.pbpBottomRight;
                }
            }
        }
Beispiel #4
0
        public sWindowStyle(sFont font, float titlesize, Int32 xOff, Int32 yOff, Hashtable colors, sBorderSet[] bordersets)
        {
            pFont = font;
            pTitleSize = titlesize;
            pXOff = xOff;
            pYOff = yOff;

            pColors = colors;/*new Hashtable();
            foreach (sColor color in colors)
                pColors.Add(color.pName, color);*/

            pBorderSets = new Hashtable();
            foreach (sBorderSet borderset in bordersets)
                pBorderSets.Add(borderset.pName, borderset);
        }
Beispiel #5
0
 static public sFont[] getFonts()
 {
     sFont[] fonts = new sFont[pFonts.Count];
     pFonts.Values.CopyTo(fonts, 0);
     return fonts;
 }
Beispiel #6
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);
                }
            }
        }
Beispiel #7
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)));
                }
            }
Beispiel #8
0
        /// <summary>
        /// ///////////////////////////////////////////////////////////////////
        /// </summary>
        /// <param name="parent"></param>
        /// <param name="node"></param>

        public sAttributeLabel(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (myNode.Attributes["text"] != null)
            {
                pText = myNode.Attributes["text"].Value;
            }

            if (myNode.Attributes["font"] != null)
            {
                String tmpfont  = myNode.Attributes["font"].Value;
                float  size     = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1));
                String fontname = tmpfont.Substring(0, tmpfont.IndexOf(';'));
                pFont     = cDataBase.getFont(fontname);
                pFontSize = size;
            }
            else
            {
                pFont     = cDataBase.getFont("Regular");
                pFontSize = 16;
            }

            if (myNode.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["backgroundColor"].Value);
            }
            else if ((sColor)pWindowStyle.pColors["LabelBackground"] != null)
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["LabelBackground"];
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (myNode.Attributes["foregroundColor"] != null)
            {
                pForegroundColor = (sColor)cDataBase.pColors.get(myNode.Attributes["foregroundColor"].Value);
            }
            else
            {
                pForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            if (myNode.Attributes["valign"] != null)
            {
                pValign = myNode.Attributes["valign"].Value.ToLower() == "top" ? cProperty.eVAlign.Top :
                          myNode.Attributes["valign"].Value.ToLower() == "center" ? cProperty.eVAlign.Center :
                          cProperty.eVAlign.Bottom;
            }

            if (myNode.Attributes["halign"] != null)
            {
                pHalign = myNode.Attributes["halign"].Value.ToLower() == "left" ? cProperty.eHAlign.Left :
                          myNode.Attributes["halign"].Value.ToLower() == "center" ? cProperty.eHAlign.Center :
                          cProperty.eHAlign.Right;
            }

            if (myNode.Attributes["noWrap"] != null)
            {
                pNoWrap = Convert.ToUInt32(myNode.Attributes["noWrap"].Value.ToLower()) != 0 ? true : false;
            }


            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
Beispiel #9
0
        public sAttributeScreen(XmlNode node)
            : base(node)
        {
            if (node == null)
            {
                return;
            }


            pZPosition = -100;

            if (node.Attributes["title"] != null)
            {
                pTitle = node.Attributes["title"].Value;
            }

            if (node.Attributes["flags"] != null)
            {
                switch (node.Attributes["flags"].Value)
                {
                case "wfNoBorder":
                    pFlags = eFlags.wfNoBorder;
                    break;

                case "wfBorder":
                default:
                    pFlags = eFlags.wfBorder;
                    break;
                }
            }

            pWindowStyle = (sWindowStyle)cDataBase.pWindowstyles.get();

            if (node.Attributes["backgroundColor"] != null)
            {
                pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else
            {
                pBackgroundColor = (sColor)pWindowStyle.pColors["Background"];
            }

            if (node.Attributes["labelforeground"] != null)
            {
                pTitle = node.Attributes["labelforeground"].Value;
            }
            else
            {
                pLabelForegroundColor = (sColor)pWindowStyle.pColors["LabelForeground"];
            }

            pTitleFont = pWindowStyle.pFont;
            pTitleSize = pWindowStyle.pTitleSize * (((float)pTitleFont.Scale) / 100.0F);

            pTitleXOff = pWindowStyle.pXOff;
            pTitleYOff = pWindowStyle.pYOff;

            /*pbpTopLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopLeft;
             * pbpTop = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTop;
             * pbpTopRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpTopRight;
             * pbpLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpLeft;
             * pbpRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpRight;
             * pbpBottomLeft = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomLeft;
             * pbpBottom = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottom;
             * pbpBottomRight = ((sWindowStyle.sBorderSet)pWindowStyle.pBorderSets["bsWindow"]).pbpBottomRight;*/

            sWindowStyle style = (sWindowStyle)cDataBase.pWindowstyles.get();

            sWindowStyle.sBorderSet borderset = (sWindowStyle.sBorderSet)style.pBorderSets["bsWindow"];

            if (borderset != null)
            {
                if (borderset.pbpTopLeftName.Length > 0)
                {
                    pbpTopLeftName = borderset.pbpTopLeftName;
                    pbpTopLeft     = borderset.pbpTopLeft;
                }
                if (borderset.pbpTopName.Length > 0)
                {
                    pbpTopName = borderset.pbpTopName;
                    pbpTop     = borderset.pbpTop;
                }
                if (borderset.pbpTopRightName.Length > 0)
                {
                    pbpTopRightName = borderset.pbpTopRightName;
                    pbpTopRight     = borderset.pbpTopRight;
                }


                if (borderset.pbpLeftName.Length > 0)
                {
                    pbpLeftName = borderset.pbpLeftName;
                    pbpLeft     = borderset.pbpLeft;
                }
                if (borderset.pbpRightName.Length > 0)
                {
                    pbpRightName = borderset.pbpRightName;
                    pbpRight     = borderset.pbpRight;
                }


                if (borderset.pbpBottomLeftName.Length > 0)
                {
                    pbpBottomLeftName = borderset.pbpBottomLeftName;
                    pbpBottomLeft     = borderset.pbpBottomLeft;
                }
                if (borderset.pbpBottomName.Length > 0)
                {
                    pbpBottomName = borderset.pbpBottomName;
                    pbpBottom     = borderset.pbpBottom;
                }
                if (borderset.pbpBottomRightName.Length > 0)
                {
                    pbpBottomRightName = borderset.pbpBottomRightName;
                    pbpBottomRight     = borderset.pbpBottomRight;
                }
            }
        }