Exemplo n.º 1
0
        private void refresh()
        {
            refreshEditor();

            propertyGrid1.SelectedObject = null;

            TreeNode selectedNode = treeView1.SelectedNode;
            if (selectedNode != null)
            {
                int hash = selectedNode.GetHashCode();
                XmlNode node = pXmlHandler.getXmlNode(hash);
                {
                    //Get Screen Node
                    XmlNode screenNode = node;
                    //As we could be selecting a sub Element, walk up
                    while (screenNode != null && screenNode.Name != "screen")
                    {
                        hash = pXmlHandler.XmlGetParentHandle(hash);
                        screenNode = pXmlHandler.getXmlNode(hash);
                    }

                    pDesigner.clear();

                    if (screenNode != null)
                    {
                        //Draw Screen and its Elements

                        if (cProperties.getPropertyBool("enable_backdrop"))
                            pDesigner.drawBackground();

                        sAttribute subattr = null;
                        {
                            sAttribute attr = new sAttributeScreen(screenNode);
                            if (screenNode.Name == "screen")
                            {
                                //sAttribute subattr = new sAttributeScreen(node);
                                propertyGrid1.SelectedObject = attr;
                            }
                            pDesigner.draw(attr);

                            XmlNode[] nodes = pXmlHandler.XmlGetChildNodes(hash);

                            if (nodes.Length > 0 && screenNode != node)
                                propertyGrid1.SelectedObject = null;

                            foreach (XmlNode tmpnode in nodes)
                            {
                                 if (tmpnode.Name == "eLabel")
                                {
                                    subattr = new sAttributeLabel(attr, tmpnode);
                                    pDesigner.draw(subattr);
                                }
                                else if (tmpnode.Name == "ePixmap")
                                {
                                    subattr = new sAttributePixmap(attr, tmpnode);
                                    pDesigner.draw(subattr);
                                }
                                else if (tmpnode.Name == "widget")
                                {
                                    subattr = new sAttributeWidget(attr, tmpnode);
                                    pDesigner.draw(subattr);
                                }

                                 if (tmpnode == node)
                                 {
                                     propertyGrid1.SelectedObject = subattr;
                                     if (cProperties.getPropertyBool("fading"))
                                         pDesigner.drawFog((int)subattr.pAbsolutX, (int)subattr.pAbsolutY, (int)subattr.pWidth, (int)subattr.pHeight);
                                 }
                            }
                        }
                          
                        pDesigner.drawFrame();
                    }

                    pDesigner.sort();
                    pictureBox1.Invalidate();
                }
            }
        }
Exemplo n.º 2
0
        //protected sAttributePixmap pAttr;

        public sGraphicPixmap(sAttributePixmap attr)
            : base(attr)
        {
            pAttr = attr;
        }
Exemplo n.º 3
0
 //protected sAttributePixmap pAttr;
 
 public sGraphicPixmap(sAttributePixmap attr)
     : base(attr)
 {
     pAttr = attr;
 }
Exemplo n.º 4
0
        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)
                {
                    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")
            {
                pLabel = new sAttributeLabel(parent, node);
            }
            else if (pRender.ToLower() == "pixmap")
            {
                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);
            }

            if (pSource != null && pSource.Length > 0)
            {
                String text = cPreviewText.getText(parent.Name, pSource);
                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")
                                {
                                    //pLabel.pText = "";
                                }
                                else if (text == "MAGIC#FALSE")
                                {
                                    pLabel.pPreviewText = "";
                                }
                            }
                            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;
                            }
                        }
                    }
                }
            }
        }
Exemplo n.º 5
0
        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)
                    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")
            {
                pLabel = new sAttributeLabel(parent, node);
            }
            else if (pRender.ToLower() == "pixmap")
            {
                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);
            }

            if (pSource != null && pSource.Length > 0)
            {
                String text = cPreviewText.getText(parent.Name, pSource);
                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")
                                {
                                    //pLabel.pText = "";
                                }
                                else if (text == "MAGIC#FALSE")
                                {
                                    pLabel.pPreviewText = "";
                                }
                            }
                            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;
                        }
                    }
                }
            }
        }