Example #1
0
        public bool LoadXML_bgimages(XmlNode xnode)
        {
            foreach (XmlNode xn in xnode.ChildNodes)
            {
                switch (xn.Name)
                {
                case "bgimage_pal8":
                    string strName = XMLUtils.GetXMLAttribute(xn, "name");
                    int    id      = XMLUtils.GetXMLIntegerAttribute(xn, "id");
                    string strDesc = XMLUtils.GetXMLAttribute(xn, "desc");
                    string strSize = XMLUtils.GetXMLAttribute(xn, "size");

                    string[] aSize   = strSize.Split('x');
                    int      nWidth  = XMLUtils.ParseInteger(aSize[0]);
                    int      nHeight = XMLUtils.ParseInteger(aSize[1]);

                    if (m_bgimages.ContainsKey(id))
                    {
                        m_doc.ErrorString("A background image with id={0} already exists.", id);
                        return(false);
                    }

                    BgImage bgi = new BgImage(m_doc, strName, id, strDesc);
                    if (!bgi.LoadXML_bgimage_pal8(xn, nWidth, nHeight))
                    {
                        return(false);
                    }

                    m_bgimages.Add(id, bgi);
                    CurrentImage = bgi;
                    break;
                }
            }
            return(true);
        }
Example #2
0
        public BgImage AddBgImage(string strName, int id, string strDesc, Bitmap bm)
        {
            // Auto-generate a new id.
            if (id == -1)
            {
                id = m_nNextId++;
                while (m_bgimages.ContainsKey(id))
                {
                    id = m_nNextId++;
                }
            }

            if (m_bgimages.ContainsKey(id))
            {
                return(null);
            }

            BgImage bgi = new BgImage(m_doc, strName, id, strDesc);

            if (bgi.LoadBitmap(bm))
            {
                m_bgimages.Add(id, bgi);
                CurrentImage = bgi;
                if (m_doc.Owner != null)
                {
                    m_doc.Owner.HandleBackgroundImageListChanged(this);
                }
            }
            else
            {
                bgi = null;
            }
            return(bgi);
        }
Example #3
0
        public BgImageProperties(Document doc, BgImage bgi)
        {
            InitializeComponent();

            m_doc     = doc;
            m_bgimage = bgi;

            UpdateSpriteInfo();
        }
Example #4
0
        public BgImages(Document doc)
        {
            m_doc = doc;
            m_bgimages = new Dictionary<int, BgImage>();
            m_bgiCurrent = null;

            if (m_doc.Owner != null)
            {
                m_winBgImageList = new BgImageListForm(m_doc.Owner, this); ;
                m_winBgImage = new BgImageForm(m_doc.Owner, null);
            }
        }
Example #5
0
        public BgImages(Document doc)
        {
            m_doc        = doc;
            m_bgimages   = new Dictionary <int, BgImage>();
            m_bgiCurrent = null;

            if (m_doc.Owner != null)
            {
                m_winBgImageList = new BgImageListForm(m_doc.Owner, this);;
                m_winBgImage     = new BgImageForm(m_doc.Owner, null);
            }
        }
Example #6
0
 public void SelectFirstImage()
 {
     if (NumImages >= 1)
     {
         foreach (BgImage bgi in m_bgimages.Values)
         {
             CurrentImage = bgi;
             break;
         }
     }
     else
     {
         CurrentImage = null;
     }
 }
Example #7
0
        public BgImageForm(ProjectMainForm parent, BgImage bgi)
        {
            m_parent  = parent;
            m_bgimage = bgi;

            InitializeComponent();

            m_toolbox = new Toolbox_BgImage();

            MdiParent       = parent;
            FormBorderStyle = FormBorderStyle.SizableToolWindow;
            StartPosition   = FormStartPosition.Manual;
            Visible         = false;
            ControlBox      = false;

            // Set to 16x.
            cbZoom.SelectedIndex = (int)ZoomLevel.Zoom_16x;
            cbZoom.Enabled       = false;

            lNoImage.Visible = false;
        }
Example #8
0
 public void SetBgImage(BgImage bgi)
 {
     m_bgimage = bgi;
     pbBgImage.Invalidate();
     SetTitle();
 }
Example #9
0
        public BgImage AddBgImage(string strName, int id, string strDesc, Bitmap bm)
        {
            // Auto-generate a new id.
            if (id == -1)
            {
                id = m_nNextId++;
                while (m_bgimages.ContainsKey(id))
                    id = m_nNextId++;
            }

            if (m_bgimages.ContainsKey(id))
                return null;

            BgImage bgi = new BgImage(m_doc, strName, id, strDesc);
            if (bgi.LoadBitmap(bm))
            {
                m_bgimages.Add(id, bgi);
                CurrentImage = bgi;
                if (m_doc.Owner != null)
                    m_doc.Owner.HandleBackgroundImageListChanged(this);
            }
            else
                bgi = null;
            return bgi;
        }
Example #10
0
        public bool LoadXML_bgimages(XmlNode xnode)
        {
            foreach (XmlNode xn in xnode.ChildNodes)
            {
                switch (xn.Name)
                {
                    case "bgimage_pal8":
                        string strName = XMLUtils.GetXMLAttribute(xn, "name");
                        int id = XMLUtils.GetXMLIntegerAttribute(xn, "id");
                        string strDesc = XMLUtils.GetXMLAttribute(xn, "desc");
                        string strSize = XMLUtils.GetXMLAttribute(xn, "size");

                        string[] aSize = strSize.Split('x');
                        int nWidth = XMLUtils.ParseInteger(aSize[0]);
                        int nHeight = XMLUtils.ParseInteger(aSize[1]);

                        if (m_bgimages.ContainsKey(id))
                        {
                            m_doc.ErrorString("A background image with id={0} already exists.", id);
                            return false;
                        }

                        BgImage bgi = new BgImage(m_doc, strName, id, strDesc);
                        if (!bgi.LoadXML_bgimage_pal8(xn, nWidth, nHeight))
                            return false;

                        m_bgimages.Add(id, bgi);
                        CurrentImage = bgi;
                        break;
                }
            }
            return true;
        }
Example #11
0
 public void Clear()
 {
     m_bgimages.Clear();
     m_bgiCurrent = null;
 }
Example #12
0
 public void Clear()
 {
     m_bgimages.Clear();
     m_bgiCurrent = null;
 }