示例#1
0
        public override RegionArea MakeRegionArea(int allocationRectangleXPosition,
                                                  int allocationRectangleYPosition,
                                                  int allocationRectangleWidth,
                                                  int allocationRectangleHeight)
        {
            BorderAndPadding bap    = propMgr.GetBorderAndPadding();
            BackgroundProps  bProps = propMgr.GetBackgroundProps();
            MarginProps      mProps = propMgr.GetMarginProps();
            int extent = this.properties.GetProperty("extent").GetLength().MValue();

            if (extent != 0)
            {
                allocationRectangleHeight = extent;
            }
            RegionArea area = new RegionArea(
                allocationRectangleXPosition
                + mProps.marginLeft,
                allocationRectangleYPosition
                - mProps.marginTop,
                allocationRectangleWidth
                - mProps.marginLeft
                - mProps.marginRight,
                allocationRectangleHeight
                - mProps.marginTop
                - mProps.marginBottom);

            area.setBackground(bProps);

            return(area);
        }
示例#2
0
        internal RegionArea MakeRegionArea(int allocationRectangleXPosition,
                                           int allocationRectangleYPosition,
                                           int allocationRectangleWidth,
                                           int allocationRectangleHeight,
                                           bool beforePrecedence,
                                           bool afterPrecedence, int beforeHeight,
                                           int afterHeight)
        {
            int extent = this.properties.GetProperty("extent").GetLength().MValue();

            int startY = allocationRectangleYPosition;
            int startH = allocationRectangleHeight;

            if (beforePrecedence)
            {
                startY -= beforeHeight;
                startH -= beforeHeight;
            }

            if (afterPrecedence)
            {
                startH -= afterHeight;
            }

            RegionArea area = new RegionArea(
                allocationRectangleXPosition + allocationRectangleWidth - extent,
                startY,
                extent,
                startH);

            area.setBackground(propMgr.GetBackgroundProps());

            return(area);
        }
示例#3
0
        public override RegionArea MakeRegionArea(int allocationRectangleXPosition,
                                                  int allocationRectangleYPosition,
                                                  int allocationRectangleWidth,
                                                  int allocationRectangleHeight)
        {
            BorderAndPadding bap    = propMgr.GetBorderAndPadding();
            BackgroundProps  bProps = propMgr.GetBackgroundProps();
            int extent = this.properties.GetProperty("extent").GetLength().MValue();

            RegionArea area = new RegionArea(
                allocationRectangleXPosition,
                allocationRectangleYPosition - allocationRectangleHeight + extent,
                allocationRectangleWidth,
                extent);

            area.setBackground(bProps);

            return(area);
        }
示例#4
0
 public void addStart(RegionArea region)
 {
     this.start = region;
 }
示例#5
0
 public void addEnd(RegionArea region)
 {
     this.end = region;
 }
示例#6
0
 public void addBefore(RegionArea region)
 {
     this.before = region;
 }
示例#7
0
 public void addAfter(RegionArea region)
 {
     this.after = region;
 }
示例#8
0
 public void addStart(RegionArea region)
 {
     this.start = region;
 }
示例#9
0
 public void addEnd(RegionArea region)
 {
     this.end = region;
 }
示例#10
0
 public void addBefore(RegionArea region)
 {
     this.before = region;
 }
示例#11
0
 public void addAfter(RegionArea region)
 {
     this.after = region;
 }
示例#12
0
        public override void ReadData(ESPReader reader, long dataEnd)
        {
            while (reader.BaseStream.Position < dataEnd)
            {
                string subTag = reader.PeekTag();

                switch (subTag)
                {
                case "EDID":
                    if (EditorID == null)
                    {
                        EditorID = new SimpleSubrecord <String>();
                    }

                    EditorID.ReadBinary(reader);
                    break;

                case "ICON":
                    if (LargeIcon == null)
                    {
                        LargeIcon = new SimpleSubrecord <String>();
                    }

                    LargeIcon.ReadBinary(reader);
                    break;

                case "MICO":
                    if (SmallIcon == null)
                    {
                        SmallIcon = new SimpleSubrecord <String>();
                    }

                    SmallIcon.ReadBinary(reader);
                    break;

                case "RCLR":
                    if (MapColor == null)
                    {
                        MapColor = new SimpleSubrecord <Color>();
                    }

                    MapColor.ReadBinary(reader);
                    break;

                case "WNAM":
                    if (Worldspace == null)
                    {
                        Worldspace = new RecordReference();
                    }

                    Worldspace.ReadBinary(reader);
                    break;

                case "RPLI":
                    if (Areas == null)
                    {
                        Areas = new List <RegionArea>();
                    }

                    RegionArea tempRPLI = new RegionArea();
                    tempRPLI.ReadBinary(reader);
                    Areas.Add(tempRPLI);
                    break;

                case "RDAT":
                    if (DataEntries == null)
                    {
                        DataEntries = new List <RegionDataEntry>();
                    }

                    RegionDataEntry tempRDAT = new RegionDataEntry();
                    tempRDAT.ReadBinary(reader);
                    DataEntries.Add(tempRDAT);
                    break;

                default:
                    throw new Exception();
                }
            }
        }
示例#13
0
        public override void ReadDataXML(XElement ele, ElderScrollsPlugin master)
        {
            XElement subEle;

            if (ele.TryPathTo("EditorID", false, out subEle))
            {
                if (EditorID == null)
                {
                    EditorID = new SimpleSubrecord <String>();
                }

                EditorID.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Large", false, out subEle))
            {
                if (LargeIcon == null)
                {
                    LargeIcon = new SimpleSubrecord <String>();
                }

                LargeIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Icon/Small", false, out subEle))
            {
                if (SmallIcon == null)
                {
                    SmallIcon = new SimpleSubrecord <String>();
                }

                SmallIcon.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("MapColor", false, out subEle))
            {
                if (MapColor == null)
                {
                    MapColor = new SimpleSubrecord <Color>();
                }

                MapColor.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Worldspace", false, out subEle))
            {
                if (Worldspace == null)
                {
                    Worldspace = new RecordReference();
                }

                Worldspace.ReadXML(subEle, master);
            }
            if (ele.TryPathTo("Areas", false, out subEle))
            {
                if (Areas == null)
                {
                    Areas = new List <RegionArea>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RegionArea tempRPLI = new RegionArea();
                    tempRPLI.ReadXML(e, master);
                    Areas.Add(tempRPLI);
                }
            }
            if (ele.TryPathTo("DataEntries", false, out subEle))
            {
                if (DataEntries == null)
                {
                    DataEntries = new List <RegionDataEntry>();
                }

                foreach (XElement e in subEle.Elements())
                {
                    RegionDataEntry tempRDAT = new RegionDataEntry();
                    tempRDAT.ReadXML(e, master);
                    DataEntries.Add(tempRDAT);
                }
            }
        }
示例#14
0
        protected internal override void End()
        {
            int pageWidth =
                this.properties.GetProperty("page-width").GetLength().MValue();
            int pageHeight =
                this.properties.GetProperty("page-height").GetLength().MValue();
            MarginProps mProps = propMgr.GetMarginProps();

            int contentRectangleXPosition = mProps.marginLeft;
            int contentRectangleYPosition = pageHeight - mProps.marginTop;
            int contentRectangleWidth     = pageWidth - mProps.marginLeft
                                            - mProps.marginRight;
            int contentRectangleHeight = pageHeight - mProps.marginTop
                                         - mProps.marginBottom;

            this.pageMaster = new PageMaster(pageWidth, pageHeight);
            if (getRegion(RegionBody.REGION_CLASS) != null)
            {
                BodyRegionArea body =
                    (BodyRegionArea)getRegion(RegionBody.REGION_CLASS).MakeRegionArea(contentRectangleXPosition,
                                                                                      contentRectangleYPosition,
                                                                                      contentRectangleWidth,
                                                                                      contentRectangleHeight);
                this.pageMaster.addBody(body);
            }
            else
            {
                FonetDriver.ActiveDriver.FireFonetError(
                    "simple-page-master must have a region of class " +
                    RegionBody.REGION_CLASS);
            }

            if (getRegion(RegionBefore.REGION_CLASS) != null)
            {
                RegionArea before =
                    getRegion(RegionBefore.REGION_CLASS).MakeRegionArea(contentRectangleXPosition,
                                                                        contentRectangleYPosition, contentRectangleWidth,
                                                                        contentRectangleHeight);
                this.pageMaster.addBefore(before);
                beforePrecedence =
                    ((RegionBefore)getRegion(RegionBefore.REGION_CLASS)).getPrecedence();
                beforeHeight = before.GetHeight();
            }
            else
            {
                beforePrecedence = false;
            }

            if (getRegion(RegionAfter.REGION_CLASS) != null)
            {
                RegionArea after =
                    getRegion(RegionAfter.REGION_CLASS).MakeRegionArea(contentRectangleXPosition,
                                                                       contentRectangleYPosition, contentRectangleWidth,
                                                                       contentRectangleHeight);
                this.pageMaster.addAfter(after);
                afterPrecedence =
                    ((RegionAfter)getRegion(RegionAfter.REGION_CLASS)).getPrecedence();
                afterHeight = after.GetHeight();
            }
            else
            {
                afterPrecedence = false;
            }

            if (getRegion(RegionStart.REGION_CLASS) != null)
            {
                RegionArea start =
                    ((RegionStart)getRegion(RegionStart.REGION_CLASS)).MakeRegionArea(contentRectangleXPosition,
                                                                                      contentRectangleYPosition, contentRectangleWidth,
                                                                                      contentRectangleHeight, beforePrecedence,
                                                                                      afterPrecedence, beforeHeight, afterHeight);
                this.pageMaster.addStart(start);
            }

            if (getRegion(RegionEnd.REGION_CLASS) != null)
            {
                RegionArea end =
                    ((RegionEnd)getRegion(RegionEnd.REGION_CLASS)).MakeRegionArea(contentRectangleXPosition,
                                                                                  contentRectangleYPosition, contentRectangleWidth,
                                                                                  contentRectangleHeight, beforePrecedence,
                                                                                  afterPrecedence, beforeHeight, afterHeight);
                this.pageMaster.addEnd(end);
            }
        }
示例#15
0
        private void addArea_Click(object sender, EventArgs e)
        {
            Rectangle rect = mapDisplay.HighlightedArea;
            int zMin = 9999;

            if (rect.Width <= 0)
            {
                SpecifyArea sa = new SpecifyArea();
                sa.Initialize(xSlider.Maximum, ySlider.Maximum);
                sa.ShowDialog();

                if (sa.Canceled)
                    return;

                rect = sa.Area;
                zMin = sa.zMin;
            }

            Region r = null;
            TreeNode node = null;

            FindRegionNode(ref r, ref node, false);

            if (node == null || r == null)
                return;

            ChangesMade = true;

            foreach (RegionArea area in r.Area)
            {
                if (area.Area.X == rect.X &&
                    area.Area.Y == rect.Y &&
                    area.Area.Width == rect.Width &&
                    area.Area.Height == rect.Height)
                    return;
            }

            RegionArea newArea = new RegionArea(rect, zMin);
            r.Area.Add(newArea);

            bool areaNodeFound = false;

            foreach (TreeNode child in node.Nodes)
            {
                RegionTag tag = (RegionTag)child.Tag;

                if (tag.Reference == "area")
                {
                    areaNodeFound = true;

                    TreeNode areaNode = new TreeNode(String.Format("x={0}, y={1}, width={2}, height={3}{4}", newArea.Area.X, newArea.Area.Y,
                        newArea.Area.Width, newArea.Area.Height, (newArea.ZMin != 9999 ? String.Format(", zmin={0}", newArea.ZMin) : "")));
                    areaNode.Tag = new RegionTag(r, "regionarea", r.Area.Count - 1);
                    child.Nodes.Add(areaNode);
                }
            }

            if (!areaNodeFound)
            {
                TreeNode childNode = new TreeNode("Area");
                childNode.Tag = new RegionTag(r, "area");

                TreeNode areaNode = new TreeNode(String.Format("x={0}, y={1}, width={2}, height={3}{4}", newArea.Area.X, newArea.Area.Y,
                    newArea.Area.Width, newArea.Area.Height, (newArea.ZMin != 9999 ? String.Format(", zmin={0}", newArea.ZMin) : "")));
                areaNode.Tag = new RegionTag(r, "regionarea", r.Area.Count - 1);
                childNode.Nodes.Add(areaNode);

                node.Nodes.Add(childNode);
            }
        }