Пример #1
0
        public sGraphicFont(sAttribute attr, Int32 x, Int32 y, String text, float size, sFont font, sColor color, sColor backColor, cProperty.eHAlign hAlignment, cProperty.eVAlign vAlignment)
            : base(attr)
        {
            //pAttr = attr;

            pX = x;
            pY = y;

            pText  = text;
            pSize  = size;
            pFont  = font;
            pColor = color;

            if (backColor != null)
            {
                pTranparent = false;
                pBackColor  = backColor;
            }
            else
            {
                pTranparent = true;
            }

            pHAlignment = hAlignment;
            pVAlignment = vAlignment;
        }
Пример #2
0
 public sGraphicRectangel(sAttribute attr, bool filled, float linewidth, sColor color)
     : base(attr)
 {
     pFilled    = filled;
     pLineWidth = linewidth;
     pColor     = color;
 }
Пример #3
0
        public sGraphicImage(sAttribute attr, String image, Int32 x, Int32 y)
            : base(attr)
        {
            //Console.WriteLine("sGraphicImage: " + x + ":" + y);

            //pAttr = attr;
            if (image == null || image.Length == 0)
            {
                return;
            }
            if (image.ToUpper().EndsWith(".SVG"))
            {
                image = image.ToUpper().Replace(".SVG", ".PNG");
            }
            try
            {
                pImage = Image.FromFile(cDataBase.getPath(image));
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File not found! (" + cDataBase.getPath(image) + ")");
                return;
            }
            catch (OutOfMemoryException)
            {
                Console.WriteLine("Unsupported (" + cDataBase.getPath(image) + ")");
                return;
            }

            pX = x;
            pY = y;

            pWidth  = (Int32)pImage.Width;
            pHeight = (Int32)pImage.Height;
        }
Пример #4
0
        public sGraphicImage(sAttribute attr, String image, Int32 x, Int32 y)
            : base(attr)
        {
            //Console.WriteLine("sGraphicImage: " + x + ":" + y);

            //pAttr = attr;
            if (image == null || image.Length == 0)
            {
                return;
            }
            try
            {
                pImage = Image.FromFile(cDataBase.getPath(image));
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File not found! (" + cDataBase.getPath(image) + ")");
                return;
            }

            pX = x;
            pY = y;

            pWidth  = (Int32)pImage.Width;
            pHeight = (Int32)pImage.Height;
        }
Пример #5
0
        public sGraphicImage(sAttribute attr, String image)
            : base(attr)
        {
            //Console.WriteLine("sGraphicImage: ");

            //pAttr = attr;
            if (image == null || image.Length == 0)
            {
                return;
            }
            try
            {
                pImage = Image.FromFile(cDataBase.getPath(image));

                // Check correct type
                if (attr.GetType() == typeof(sAttributePixmap))
                {
                    //get size of root element (= size of a widget)
                    sAttributePixmap element     = (sAttributePixmap)attr;
                    Size             elementSize = element.pPixmap;

                    if (elementSize != null)
                    {
                        //Resize image, if imageSize and element size is diffrent
                        if (elementSize.Width != pImage.Size.Width || elementSize.Height != pImage.Height)
                        {
                            if (element.myNode.Attributes["pixmap"] != null || element.myNode.Attributes["pixmaps"] != null)
                            {
                                // ePixmap or widget element with attribute 'pixmap' (= path to image)
                                pImage = ResizeImage(pImage, elementSize.Width, elementSize.Height);
                            }
                            else if (element.myNode.Attributes["render"] != null && element.myNode.Attributes["render"].Value.ToLower().Contains("picon"))
                            {
                                // is picon
                                pImage = ResizeImageKeepAspectRatio(pImage, elementSize.Width, elementSize.Height);
                            }
                            else if (element.myNode.Attributes["render"] != null && element.myNode.Attributes["render"].Value.ToLower().Contains("eventimage"))
                            {
                                // is EventImage
                                pImage = ResizeImageKeepAspectRatio(pImage, elementSize.Width, elementSize.Height);
                            }
                            else if (element.myNode.Attributes["path"] != null)
                            {
                                //widget element with attribute 'path' (= path to image)
                                pImage = ResizeImage(pImage, elementSize.Width, elementSize.Height);
                            }
                        }
                    }
                }
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File not found! (" + cDataBase.getPath(image) + ")");
                return;
            }
        }
Пример #6
0
 public sAttributeProgress(sAttribute parent, XmlNode node)
     : base(parent, node)
 {
     if (node.Attributes["backgroundColor"] != null)
     {
         pBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
     }
     else
     {
         pBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["Background"];
     }
 }
Пример #7
0
 private void parsePair(String pair, sAttribute parent, out Int32 x, out Int32 y, Int32 w = 0, Int32 h = 0)
 {
     if (pair.Contains(","))
     {
         String[] coord = pair.Split(new Char[] { ',' });
         x = parseCoord(coord[0], parent.pWidth, w);
         y = parseCoord(coord[1], parent.pHeight, h);
     }
     else
     {
         x = getValue(pair, true);
         y = getValue(pair, false);
     }
 }
Пример #8
0
 public void updateObject(sAttribute parent, sAttribute me)
 {
     me.pAbsolutX    = parent.pAbsolutX;
     me.pAbsolutY    = parent.pAbsolutY;
     me.pRelativX    = parent.pRelativX;
     me.pRelativY    = parent.pRelativY;
     me.pWidth       = parent.pWidth;
     me.pHeight      = parent.pHeight;
     me.pName        = parent.pName;
     me.pZPosition   = parent.pZPosition;
     me.pTransparent = parent.pTransparent;
     me.pBorder      = parent.pBorder;
     me.pBorderColor = parent.pBorderColor;
     me.pBorderWidth = parent.pBorderWidth;
 }
        public sGraphicElement(sAttribute attr)
        {
            pAttr = attr;
            if (pAttr != null)
            {
                pX      = attr.pAbsolutX;
                pY      = attr.pAbsolutY;
                pWidth  = attr.pWidth;
                pHeight = attr.pHeight;

                pZPosition = attr.pZPosition;
            }
            else
            {
                pZPosition = 0;
            }
        }
Пример #10
0
        public sAttributePixmap(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["pixmap"] != null)
            {
                pPixmapName = node.Attributes["pixmap"].Value;
                try
                {
                    //PVMC Workaround
                    if (pPixmapName.Contains("ProjectValerie"))
                    {
                        pPixmapName = pPixmapName.Substring(pPixmapName.IndexOf("ProjectValerie/skins/") + "ProjectValerie/skins/".Length);
                    }
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["pixmap"] != null)
            {
                if (node.Attributes["render"].Value.ToLower() == "picon")
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "xpicon.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@xpicon.png";
                }
            }

            if (node.Attributes["alphatest"] != null)
            {
                pAlphatest = node.Attributes["alphatest"].Value.ToLower() == "on" ? cProperty.eAlphatest.on :
                             node.Attributes["alphatest"].Value.ToLower() == "blend" ? cProperty.eAlphatest.blend :
                             cProperty.eAlphatest.off;
            }
        }
Пример #11
0
        public sGraphicImage(sAttribute attr, String image)
            : base(attr)
        {
            //Console.WriteLine("sGraphicImage: ");

            //pAttr = attr;
            if (image == null || image.Length == 0)
            {
                return;
            }
            try
            {
                pImage = Image.FromFile(cDataBase.getPath(image));
            }
            catch (FileNotFoundException)
            {
                Console.WriteLine("File not found! (" + cDataBase.getPath(image) + ")");
                return;
            }
        }
Пример #12
0
        //protected sAttribute pAttr;

        public sGraphicImage(sAttribute attr, String image, Int32 x, Int32 y, Int32 w, Int32 h)
            : base(attr)
        {
            //Console.WriteLine("sGraphicImage: " + x + ":" + y + " " + w + "x" + h);

            try
            {
                pImage = Image.FromFile(cDataBase.getPath(image));
            }
            catch (FileNotFoundException ex)
            {
                Console.WriteLine("File not found! (" + cDataBase.getPath(image) + ")\n" + ex);
                return;
            }
            pX = x;
            pY = y;


            pWidth  = w < (Int32)pImage.Width ? w : (Int32)pImage.Width;
            pHeight = h < (Int32)pImage.Height ? h : (Int32)pImage.Height;;
        }
Пример #13
0
        public sAttributeListbox(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["backgroundColor"] != null)
            {
                pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else
            {
                pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"];
            }

            if (node.Attributes["foregroundColor"] != null)
            {
                pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value);
            }
            else
            {
                pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"];
            }

            if (myNode.Attributes["font"] != null)
            {
                pFont     = cDataBase.getFont(myNode.Attributes["font"].Value);
                pFontSize = pFont.Size;
            }

            if (myNode.Attributes["secondfont"] != null)
            {
                pFontSecond     = cDataBase.getFont(myNode.Attributes["secondfont"].Value);
                pFontSecondSize = pFontSecond.Size;
            }

            //if (node.HasChildNodes && node.FirstChild.Attributes["type"] != null && node.FirstChild.Attributes["type"].Value.ToLower() == "templatedmulticontent")
            //{
            //    String input = node.FirstChild.InnerText;
            //    Match match = Regex.Match(input, @"""itemHeight"": (\d+)");
            //    if (match.Success)
            //        pItemHeight = Int16.Parse(match.Groups[1].ToString());

            //    //MessageBox.Show(match.Groups[1].ToString());

            //}

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"];


            if (node.Attributes["backgroundPixmap"] != null)
            {
                pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value;
                try
                {
                    pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pBackgroundPixmap = null;
                }
            }
            if (node.Attributes["selectionPixmap"] != null)
            {
                pSelectionPixmapName = node.Attributes["selectionPixmap"].Value;
                try
                {
                    pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pSelectionPixmap = null;
                }
            }

            if (myNode.Attributes["scrollbarMode"] != null)
            {
                pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways :
                                 myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand :
                                 cProperty.eScrollbarMode.showNever;
            }

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

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

            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;
                }
            }


            if (node.Attributes["itemHeight"] != null)
            {
                pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim());
            }
            else
            if (pItemHeight == 0)
            {
                pItemHeight = 20;
            }


            String entries = cPreviewText.getText(parent.Name, Name);

            if (entries.Length > 0)
            {
                pPreviewEntries = new List <string>(entries.Split('|'));
            }
            else
            {
                for (int i = 1; i < 50; i++)
                {
                    pPreviewEntries.Add("List entry " + i);
                }
            }
        }
Пример #14
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)
            {
                sFont[] fonts = cDataBase.getFonts();

                float  size     = 0;
                String fontname = "";

                String tmpfont = myNode.Attributes["font"].Value;
                try
                {
                    size      = Convert.ToSingle(tmpfont.Substring(tmpfont.IndexOf(';') + 1));
                    fontname  = tmpfont.Substring(0, tmpfont.IndexOf(';'));
                    pFont     = cDataBase.getFont(fontname);
                    pFontSize = size;
                }
                catch
                {
                    // In <fonts> suchen
                    sFont query = Array.Find(fonts, x => x.Name.Equals(tmpfont));
                    if (query != null)
                    {
                        size      = query.Size;
                        fontname  = query.FontName;
                        pFont     = cDataBase.getFont(fontname);
                        pFontSize = size;
                    }
                    else
                    {
                        MessageBox.Show("Font '" + tmpfont + "' not found!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
            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)
            {
                // Show text for elements without render attribute, if they have a font attribute
                if (myNode.Attributes["font"] != null)
                {
                    if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null)
                    {
                        // show name
                        pText = myNode.Attributes["name"].Value;
                    }
                }
            }

            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
        public sAttributeWidget(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["source"] != null)
            {
                pSource = node.Attributes["source"].Value;
            }

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

            if (pRender == null)
            {
                if (node.Attributes["pixmap"] != null || node.Attributes["pixmaps"] != null)
                {
                    pRender = "Pixmap";
                }
                else if (pName == "menu" || pName == "list" || pName.EndsWith("list")) //depreceated
                {
                    pRender = "Listbox";
                }
                else if (pName == "PositionGauge") //depreceated
                {
                    pRender = "PositionGauge";
                }
                else if (node.Attributes["pointer"] != null)
                {
                    pRender = "PositionGauge";
                }
                else
                {
                    pRender = "Label";
                }
            }

            if (pRender.ToLower() == "label" || pRender.ToLower() == "fixedlabel" || pRender.ToLower() == "vrunningtext" || pRender.ToLower() == "metrixreloadedscreennamelabel")
            {
                pLabel = new sAttributeLabel(parent, node);
            }
            else if (pRender.ToLower().Contains("pixmap"))
            {
                pPixmap = new sAttributePixmap(parent, node);
            }
            else if (pRender.ToLower() == "picon")
            {
                pPixmap = new sAttributePixmap(parent, node);
            }
            else if (pRender.ToLower() == "xpicon")
            {
                pPixmap = new sAttributePixmap(parent, node);
            }
            else if (pRender.ToLower().Contains("xhdpicon"))
            {
                pPixmap = new sAttributePixmap(parent, node);
            }
            else if (pRender.ToLower().Contains("eventimage"))
            {
                pPixmap = new sAttributePixmap(parent, node);
            }
            else if (pRender.ToLower() == "progress")
            {
                pProgress = new sAttributeProgress(parent, node);
            }
            else if (pRender.ToLower() == "listbox")
            {
                pListbox = new sAttributeListbox(parent, node);
            }
            else
            {
                //Any Render that use path attribute
                if (node.Attributes["path"] != null)
                {
                    pPixmap = new sAttributePixmap(parent, node);
                }
            }

            if (pSource != null && pSource.Length > 0)
            {
                String text = cPreviewText.getText(parent.Name, pSource);

                if (text == null || text.Length == 0)
                {
                    // Show text for elements with render attribute, if they have a font attribute
                    if (myNode.Attributes["font"] != null)
                    {
                        if (myNode.Attributes["name"] != null)
                        {
                            // show name
                            text = myNode.Attributes["name"].Value;
                        }
                        else if (myNode.Attributes["source"] != null)
                        {
                            // show source
                            text = myNode.Attributes["source"].Value;
                        }
                        else
                        {
                            text = "widget";
                        }
                    }
                }

                if (text.Length > 0)
                {
                    if (pLabel != null && (pLabel.pText == null || pLabel.pText.Length == 0))
                    {
                        pLabel.pPreviewText = text;
                    }
                    if (pListbox != null)
                    {
                        pListbox.pPreviewEntries = text.Split('|');
                    }
                }
            }

            if (node.HasChildNodes)
            {
                foreach (XmlNode nodeConverter in node.ChildNodes)
                {
                    if (nodeConverter.Attributes != null)
                    {
                        String type      = nodeConverter.Attributes["type"].Value;
                        String parameter = nodeConverter.InnerText;

                        String text = cConverter.getText(pSource, type, parameter);
                        if (text != null)
                        {
                            if (pLabel != null)
                            {
                                if (text.Length > 0 && (pLabel.pText == null || pLabel.pText.Length <= 0))
                                {
                                    pLabel.pPreviewText = text;
                                }

                                if (text == "MAGIC#TRUE" || text == "MAGIC#FALSE")
                                {
                                    pLabel.pPreviewText = text;
                                }
                            }
                            else if (pPixmap != null)
                            {
                                if (text == "MAGIC#TRUE")
                                {
                                    //pLabel.pText = "";
                                }
                                else if (text == "MAGIC#FALSE")
                                {
                                    pPixmap.pPixmap = new Size(0, 0);
                                    pPixmap.pHide   = true;
                                }
                            }
                        }
                    }
                }

                cConverter.reset();
            }
            else
            {
                if (pSource != null)
                {
                    if (pSource.ToLower() == "title")
                    {
                        if (parent is sAttributeScreen)
                        {
                            if (pLabel != null)
                            {
                                pLabel.pPreviewText = ((sAttributeScreen)parent).pTitle;
                            }
                        }
                    }
                }
            }
        }
Пример #16
0
        public sAttributePixmap(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            // ePixmap or widget element with attribute 'pixmap' (= path to image)
            if (node.Attributes["pixmap"] != null)
            {
                pPixmapName = node.Attributes["pixmap"].Value;
                try
                {
                    //PVMC Workaround
                    if (pPixmapName.Contains("ProjectValerie"))
                    {
                        pPixmapName = pPixmapName.Substring(pPixmapName.IndexOf("ProjectValerie/skins/") + "ProjectValerie/skins/".Length);
                    }
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));

                    // Element has scale attribute -> take size attribute
                    if (node.Attributes["scale"] != null)
                    {
                        pPixmap = new Size(this.Size.Width, this.Size.Height);
                    }
                    else
                    {
                        pPixmap = pixmap.Size;
                    }
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["pixmaps"] != null)
            {
                pPixmapName = node.Attributes["pixmaps"].Value.Split(',')[0];
                try
                {
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));

                    // Element has scale attribute -> take size attribute
                    if (node.Attributes["scale"] != null)
                    {
                        pPixmap = new Size(this.Size.Width, this.Size.Height);
                    }
                    else
                    {
                        pPixmap = pixmap.Size;
                    }
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["path"] != null)
            {
                //Any Render that use path attribute
                String path = node.Attributes["path"].Value;
                try
                {
                    // take random picture in path
                    string[] filePaths = Directory.GetFiles(@cDataBase.getPath(path));

                    pPixmapName = cProperties.getProperty("path_skin").Replace("./", "\\").Replace("/", "\\") + "/" + path + "/" + System.IO.Path.GetFileName(filePaths[0]);
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));

                    // Element has scale attribute -> take size attribute
                    if (node.Attributes["scale"] != null)
                    {
                        pPixmap = new Size(this.Size.Width, this.Size.Height);
                    }
                    else
                    {
                        pPixmap = pixmap.Size;
                    }
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }

                //MessageBox.Show(node.Attributes["path"].Value);
            }
            else if (node.Attributes["render"] != null && node.Attributes["render"].Value.ToLower().Contains("picon"))
            {
                try
                {
                    String piconFileName = "picon.png";

                    if (node.Attributes["render"].Value.ToLower().Contains("xpicon"))
                    {
                        piconFileName = "xpicon.png";
                    }
                    else if (node.Attributes["render"].Value.ToLower().Contains("xhdpicon"))
                    {
                        piconFileName = "xhdpicon.png";
                    }

                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + piconFileName, true);

                    // size of root element (= size of a widget)
                    pPixmap = new Size(this.Size.Width, this.Size.Height);

                    pixmap.Dispose();
                    pPixmapName = "@" + piconFileName;
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["render"] != null && node.Attributes["render"].Value.ToLower().Contains("eventimage"))
            {
                try
                {
                    String eventImageFileName = "eventimage.jpg";

                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + eventImageFileName, true);

                    // size of root element (= size of a widget)
                    pPixmap = new Size(this.Size.Width, this.Size.Height);

                    pixmap.Dispose();
                    pPixmapName = "@" + eventImageFileName;
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }


            if (node.Attributes["alphatest"] != null)
            {
                pAlphatest = node.Attributes["alphatest"].Value.ToLower() == "on" ? cProperty.eAlphatest.on :
                             node.Attributes["alphatest"].Value.ToLower() == "blend" ? cProperty.eAlphatest.blend :
                             cProperty.eAlphatest.off;
            }
        }
Пример #17
0
 private void parsePair(String pair, sAttribute parent, out Int32 x, out Int32 y, Int32 w = 0, Int32 h = 0)
 {
     String[] coord = pair.Split(new Char[] { ',' });
     x = parseCoord(coord[0], parent.pWidth, w);
     y = parseCoord(coord[1], parent.pHeight, h);
 }
Пример #18
0
        public sAttributeListbox(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            if (node.Attributes["backgroundColor"] != null)
            {
                pListboxBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            }
            else
            {
                pListboxBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxBackground"];
            }

            if (node.Attributes["foregroundColor"] != null)
            {
                pListboxForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["foregroundColor"].Value);
            }
            else
            {
                pListboxForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxForeground"];
            }


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxSelectedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedForeground"];


            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedBackgroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedBackgroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedBackground"];

            //if (node.Attributes["backgroundColor"] != null)
            //    pListboxMarkedAndSelectedForegroundColor = (sColor)cDataBase.pColors.get(node.Attributes["backgroundColor"].Value);
            //else
            pListboxMarkedAndSelectedForegroundColor = (sColor)((sWindowStyle)cDataBase.pWindowstyles.get()).pColors["ListboxMarkedAndSelectedForeground"];


            if (node.Attributes["backgroundPixmap"] != null)
            {
                pBackgroundPixmapName = node.Attributes["backgroundPixmap"].Value;
                try
                {
                    pBackgroundPixmap = Image.FromFile(cDataBase.getPath(pBackgroundPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pBackgroundPixmap = null;
                }
            }
            if (node.Attributes["selectionPixmap"] != null)
            {
                pSelectionPixmapName = node.Attributes["selectionPixmap"].Value;
                try
                {
                    pSelectionPixmap = Image.FromFile(cDataBase.getPath(pSelectionPixmapName));
                }
                catch (FileNotFoundException)
                {
                    pSelectionPixmap = null;
                }
            }

            if (myNode.Attributes["scrollbarMode"] != null)
            {
                pScrollbarMode = myNode.Attributes["scrollbarMode"].Value.ToLower() == "showAlways".ToLower() ? cProperty.eScrollbarMode.showAlways :
                                 myNode.Attributes["scrollbarMode"].Value.ToLower() == "showOnDemand".ToLower() ? cProperty.eScrollbarMode.showOnDemand :
                                 cProperty.eScrollbarMode.showNever;
            }

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

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

            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;
                }
            }


            if (node.Attributes["itemHeight"] != null)
            {
                pItemHeight = Convert.ToInt32(node.Attributes["itemHeight"].Value.Trim());
            }
            else
            {
                pItemHeight = 20;
            }


            String entries = cPreviewText.getText(parent.Name, Name);

            if (entries.Length > 0)
            {
                pPreviewEntries = entries.Split('|');
            }
        }
Пример #19
0
 public sAttribute(sAttribute parent, XmlNode node)
 {
     init(parent, node);
 }
Пример #20
0
        private void init(sAttribute parent, XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            myNode = node;

            _pParent = parent;

            if (node.Attributes["size"] != null)
            {
                parsePair(node.Attributes["size"].Value, parent, out pWidth, out pHeight);
            }
            else
            {
                pWidth  = parent.pWidth;
                pHeight = parent.pHeight;
            }

            if (node.Attributes["position"] != null)
            {
                String pos = node.Attributes["position"].Value;
                if (pos == "fill")
                {
                    pRelativX = 0;
                    pRelativY = 0;
                    pWidth    = parent.pWidth;
                    pHeight   = parent.pHeight;
                }
                else
                {
                    parsePair(pos, parent, out pRelativX, out pRelativY, pWidth, pHeight);
                }
            }
            else
            {
                pRelativX = 0;
                pRelativY = 0;
            }
            pAbsolutX = parent.pAbsolutX + pRelativX;
            pAbsolutY = parent.pAbsolutY + pRelativY;

            if (node.Attributes["name"] != null)
            {
                pName = node.Attributes["name"].Value.Trim();
            }
            else
            {
                pName = "";
            }

            if (node.Attributes["zPosition"] != null)
            {
                pZPosition = Convert.ToInt32(node.Attributes["zPosition"].Value.Trim());
            }
            else
            {
                pZPosition = 0;
            }

            if (node.Attributes["transparent"] != null)
            {
                pTransparent = Convert.ToUInt32(node.Attributes["transparent"].Value.Trim()) != 0;
            }
            else
            {
                pTransparent = false;
            }

            if (node.Attributes["borderWidth"] != null)
            {
                pBorderWidth = Convert.ToUInt32(node.Attributes["borderWidth"].Value.Trim());
            }
            else
            {
                pBorderWidth = 0;
            }

            if (node.Attributes["borderColor"] != null)
            {
                pBorderColor = (sColor)cDataBase.pColors.get(node.Attributes["borderColor"].Value.Trim());
            }
            else
            {
                pBorderColor = null;
            }

            pBorder = (pBorderWidth > 0 && pBorderColor != null);

            if (node.Attributes["name"] != null && node.Attributes["position"] == null && node.Attributes["size"] == null && node.Name == "screen")
            {
                pTransparent = false;
            }
        }
Пример #21
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);
                }
            }
        }
Пример #22
0
        public sAttribute(sAttribute parent, XmlNode node)
        {
            if (node == null)
            {
                return;
            }

            myNode = node;

            _pParent = parent;

            try
            {
                pWidth  = Convert.ToInt32(node.Attributes["size"].Value.Substring(0, node.Attributes["size"].Value.IndexOf(',')).Trim());
                pHeight = Convert.ToInt32(node.Attributes["size"].Value.Substring(node.Attributes["size"].Value.IndexOf(',') + 1).Trim());
            }
            catch
            {
                pWidth  = (int)cDataBase.pResolution.getResolution().Xres;
                pHeight = (int)cDataBase.pResolution.getResolution().Yres;
            }


            try
            {
                String sRelativeX = node.Attributes["position"].Value.Substring(0, node.Attributes["position"].Value.IndexOf(',')).Trim();
                if (sRelativeX.Equals("center"))
                {
                    pRelativX = (Int32)(cDataBase.pResolution.getResolution().Xres - pWidth) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativX = Convert.ToInt32(sRelativeX);
                }
            } catch
            {
                pRelativX = 0;
            }
            pAbsolutX = parent.pAbsolutX + pRelativX;

            try
            {
                String sRelativeY = node.Attributes["position"].Value.Substring(node.Attributes["position"].Value.IndexOf(',') + 1).Trim();
                if (sRelativeY.Equals("center"))
                {
                    pRelativY = (Int32)(cDataBase.pResolution.getResolution().Yres - pHeight) >> 1 /*1/2*/;
                }
                else
                {
                    pRelativY = Convert.ToInt32(sRelativeY);
                }
            }
            catch
            {
                pRelativY = 0;
            }
            pAbsolutY = parent.pAbsolutY + pRelativY;


            if (node.Attributes["name"] != null)
            {
                pName = node.Attributes["name"].Value.Trim();
            }
            else
            {
                pName = "";
            }

            if (node.Attributes["zPosition"] != null)
            {
                pZPosition = Convert.ToInt32(node.Attributes["zPosition"].Value.Trim());
            }
            else
            {
                pZPosition = 0;
            }

            if (node.Attributes["transparent"] != null)
            {
                pTransparent = Convert.ToUInt32(node.Attributes["transparent"].Value.Trim()) != 0;
            }
            else
            {
                pTransparent = false;
            }

            if (node.Attributes["borderWidth"] != null)
            {
                pBorderWidth = Convert.ToUInt32(node.Attributes["borderWidth"].Value.Trim());
            }
            else
            {
                pBorderWidth = 0;
            }

            if (node.Attributes["borderColor"] != null)
            {
                pBorderColor = (sColor)cDataBase.pColors.get(node.Attributes["borderColor"].Value.Trim());
            }
            else
            {
                pBorderColor = null;
            }

            if (pBorderWidth > 0 && pBorderColor != null)
            {
                pBorder = true;
            }
            else
            {
                pBorder = false;
            }
        }
Пример #23
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)
            {
                pFont     = cDataBase.getFont(myNode.Attributes["font"].Value);
                pFontSize = pFont.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)
            {
                // Show text for elements without render attribute, if they have a font attribute
                if (myNode.Attributes["font"] != null)
                {
                    if (myNode.Attributes["name"] != null && myNode.Attributes["source"] == null)
                    {
                        // show name
                        pText = myNode.Attributes["name"].Value;
                    }
                }
            }

            if (pText == null || pText.Length > 0)
            {
                if (Name.Length > 0)
                {
                    pPreviewText = cPreviewText.getText(parent.Name, Name);
                }
            }
        }
        public sAttributePixmap(sAttribute parent, XmlNode node)
            : base(parent, node)
        {
            // ePixmap or widget element with attribute 'pixmap' (= path to image)
            if (node.Attributes["pixmap"] != null)
            {
                pPixmapName = node.Attributes["pixmap"].Value;
                if (pPixmapName.ToLower().EndsWith(".svg"))
                {
                    pPixmapName = pPixmapName.ToLower().Replace(".svg", ".png");
                }
                try
                {
                    //PVMC Workaround
                    if (pPixmapName.Contains("ProjectValerie"))
                    {
                        pPixmapName = pPixmapName.Substring(pPixmapName.IndexOf("ProjectValerie/skins/") + "ProjectValerie/skins/".Length);
                    }
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));

                    // Element has scale attribute -> take size attribute
                    if (node.Attributes["scale"] != null)
                    {
                        pPixmap = new Size(this.Size.Width, this.Size.Height);
                    }
                    else
                    {
                        pPixmap = pixmap.Size;
                    }
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
                catch (OutOfMemoryException) // If Pixmap isn't a image or broken
                {
                    MessageBox.Show("File: '" + pPixmapName + "' seems to be corrupt!", "File corrupt?", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["pixmaps"] != null)
            {
                pPixmapName = node.Attributes["pixmaps"].Value.Split(',')[0];
                try
                {
                    if (pPixmapName.ToLower().EndsWith(".svg"))
                    {
                        pPixmapName = pPixmapName.ToLower().Replace(".svg", ".png");
                    }
                    Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));

                    // Element has scale attribute -> take size attribute
                    if (node.Attributes["scale"] != null)
                    {
                        pPixmap = new Size(this.Size.Width, this.Size.Height);
                    }
                    else
                    {
                        pPixmap = pixmap.Size;
                    }
                    pixmap.Dispose();
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
                catch (OutOfMemoryException) // If Pixmap isn't a image or broken
                {
                    MessageBox.Show("File: '" + pPixmapName + "' seems to be corrupt!", "File corrupt?", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["path"] != null)
            {
                //Any Render that use path attribute
                String path = node.Attributes["path"].Value;
                try
                {
                    // take random picture in path
                    string[] filePaths = null;
                    try
                    {
                        filePaths = Directory.GetFiles(@cDataBase.getPath(path));
                    }
                    catch
                    {
                        // Bug Fix: if path contains skin-path
                        try
                        {
                            path      = path.Replace(cProperties.getProperty("path_skin"), "");
                            filePaths = Directory.GetFiles(@cDataBase.getPath(path));
                        }
                        catch
                        {
                        }
                    }

                    if (filePaths != null && filePaths.Length > 0) // MOD
                    {
                        Random rand  = new Random();
                        int    rnd   = 0;
                        string ext   = string.Empty;
                        int    count = 0;
                        while (ext != ".jpg" && ext != ".png" && ext != ".jpeg" && count != 50) // Only take images, try for 50 times to find a image
                        {
                            rnd = rand.Next(0, filePaths.Length);
                            ext = System.IO.Path.GetExtension(filePaths[rnd]).ToLower();
                            count++;
                        }

                        pPixmapName = cProperties.getProperty("path_skin").Replace("./", "\\").Replace("/", "\\") + "/" + path + "/" + System.IO.Path.GetFileName(filePaths[rnd]);
                        Image pixmap = Image.FromFile(cDataBase.getPath(pPixmapName));
                        // Element has scale attribute -> take size attribute
                        if (node.Attributes["scale"] != null)
                        {
                            pPixmap = new Size(this.Size.Width, this.Size.Height);
                        }
                        else
                        {
                            pPixmap = pixmap.Size;
                        }
                        pixmap.Dispose();
                    }
                    else
                    {
                        Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                        pPixmap = pixmap.Size;
                        pixmap.Dispose();
                        pPixmapName = "@broken.png";
                    }
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
                catch (OutOfMemoryException) // If Pixmap isn't a image or broken
                {
                    MessageBox.Show("File: '" + pPixmapName + "' seems to be corrupt!", "File corrupt?", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }
            else if (node.Attributes["render"] != null && node.Attributes["render"].Value.ToLower().Contains("picon"))
            {
                try
                {
                    String piconFileName = "picon.png";

                    if (node.Attributes["render"].Value.ToLower().Contains("xpicon"))
                    {
                        piconFileName = "xpicon.png";
                    }
                    else if (node.Attributes["render"].Value.ToLower().Contains("xhdpicon"))
                    {
                        piconFileName = "xhdpicon.png";
                    }

                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + piconFileName, true);

                    // size of root element (= size of a widget)
                    pPixmap = new Size(this.Size.Width, this.Size.Height);

                    pixmap.Dispose();
                    pPixmapName = "@" + piconFileName;
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }

            else if (node.Attributes["render"] != null && node.Attributes["render"].Value.ToLower().Contains("eventimage"))
            {
                try
                {
                    String eventImageFileName = "eventimage.jpg";

                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + eventImageFileName, true);

                    // size of root element (= size of a widget)
                    pPixmap = new Size(this.Size.Width, this.Size.Height);

                    pixmap.Dispose();
                    pPixmapName = "@" + eventImageFileName;
                }
                catch (FileNotFoundException)
                {
                    Image pixmap = Image.FromFile(Application.StartupPath + cProperties.getProperty("path_skins").Replace("./", "\\").Replace("/", "\\") + "broken.png", true);
                    pPixmap = pixmap.Size;
                    pixmap.Dispose();
                    pPixmapName = "@broken.png";
                }
            }


            if (node.Attributes["alphatest"] != null)
            {
                pAlphatest = node.Attributes["alphatest"].Value.ToLower() == "on" ? cProperty.eAlphatest.on :
                             node.Attributes["alphatest"].Value.ToLower() == "blend" ? cProperty.eAlphatest.blend :
                             cProperty.eAlphatest.off;
            }
        }