Exemplo n.º 1
0
        public Palette256Form(ProjectMainForm parent, Palette256 p)
        {
            m_parent = parent;
            m_palette = p;

            InitializeComponent();

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

            if (m_palette.IsBackground)
                Text = "BgPalette '" + p.Name + "'";
            else
                Text = "Palette '" + p.Name + "'";

            if (m_brushTransparent == null)
            {
                m_brushTransparent = new System.Drawing.Drawing2D.HatchBrush(
                        Options.TransparentPattern,
                        Color.LightGray, Color.Transparent);
            }
        }
Exemplo n.º 2
0
 public Palettes(Document doc, Type eType)
 {
     m_doc = doc;
     m_palettes = new Dictionary<int, Palette>();
     m_eType = eType;
     m_paletteCurrent = null;
 }
Exemplo n.º 3
0
        public Palette16 AddPalette16(string strName, int id, string strDesc)
        {
            // Don't allow a second palette with the same name.
            if (m_palettes.ContainsKey(id))
                return null;

            Palette16 pal16 = new Palette16(m_doc, this, strName, id, strDesc);
            m_palettes.Add(id, pal16);
            m_paletteCurrent = pal16;
            return pal16;
        }
Exemplo n.º 4
0
        public Spriteset AddSpriteset(string strName, int id, string strDesc, Palette pal)
        {
            // Don't allow a second spriteset with the same id.
            if (m_spritesets.ContainsKey(id))
                return null;

            Spriteset ss = new Spriteset(m_doc, strName, id, strDesc, pal);
            m_spritesets.Add(id, ss);

            // Make this spriteset the current one.
            m_ssCurrent = ss;
            return ss;
        }
Exemplo n.º 5
0
        public void TestInit()
        {
            m_doc = new Document(null);
            Assert.IsNotNull(m_doc);

            m_palette = m_doc.Palettes.AddPalette16(Options.DefaultPaletteName, 0, "");
            Assert.IsNotNull(m_palette);

            m_ss = m_doc.Spritesets.AddSpriteset(Options.DefaultSpritesetName, 0, "", m_palette);
            Assert.IsNotNull(m_ss);

            m_mgr = new UndoMgr(null, TabMgr.TabId.Sprites);
            Assert.IsNotNull(m_mgr);
        }
Exemplo n.º 6
0
        public Spriteset(Document doc, string strName, int id, string strDesc, Palette pal)
        {
            m_doc = doc;
            m_strName = strName;
            m_id = id;
            m_strDesc = strDesc;
            m_palette = pal;
            m_fIsBackground = pal.IsBackground;

            m_Maps = new List<Map>();

            if (m_doc.Owner != null)
            {
                m_winSpriteset = new SpritesetForm(m_doc.Owner, this); ;
                m_winSprite = new SpriteForm(m_doc.Owner, this, CurrentSprite);
            }
        }
Exemplo n.º 7
0
        public static void DrawPalette(Graphics g, Palette p)
        {
            int nRows = k_nPaletteRows;
            int nColumns = k_nPaletteColumns;
            int pxSize = k_pxColorSize;

            for (int iRow = 0; iRow < nRows; iRow++)
            {
                for (int iColumn = 0; iColumn < nColumns; iColumn++)
                {
                    int nIndex = iRow * nColumns + iColumn;

                    int pxX0 = 1 + iColumn * pxSize;
                    int pxY0 = 1 + iRow * pxSize;

                    //g.FillRectangle(CurrentSubpalette.Brush(nIndex%16), pxX0, pxY0, pxSize, pxSize);

                    // Draw the transparent color (index 0) using a pattern.
                    if (nIndex == 0)
                        g.FillRectangle(m_brushTransparent, pxX0, pxY0, pxSize, pxSize);

                    // Draw a border around each color swatch.
                    g.DrawRectangle(Pens.White, pxX0, pxY0, pxSize, pxSize);
                }
            }

            g.DrawRectangle(Pens.Black, 0, 0, 2 + nColumns * pxSize, 2 + nRows * pxSize);

            // Hilight the currently selected color.
            //if (m_mgr.HilightSelectedColor)
            //{
            //	int x = (m_data.currentColor % nColumns) * pxSize;
            //	int y = (m_data.currentColor / nColumns) * pxSize;
            //	g.DrawRectangle(m_penHilight, x + 1, y + 1, pxSize, pxSize);
            //}
        }
Exemplo n.º 8
0
        private void Init(Document doc, Palette mgr, int nSubpaletteID, DefaultColorSet eDefaultColorSet)
        {
            m_doc = doc;
            m_mgr = mgr;
            m_nSubpaletteID = nSubpaletteID;

            m_data = new PaletteColorData(k_nColors);
            m_Brush = new SolidBrush[k_nColors];

            // Default color = black (index 1)
            m_data.currentColor = 1;

            m_snapshot = new PaletteColorData(k_nColors);
            SetDefaultSubpaletteColors(eDefaultColorSet);
        }
Exemplo n.º 9
0
 public Subpalette(Document doc, Palette mgr, int nSubpaletteID, DefaultColorSet eDefaultColorSet)
 {
     Init(doc, mgr, nSubpaletteID, eDefaultColorSet);
 }
Exemplo n.º 10
0
 /// <summary>
 /// A new color has been selected in the subpalette. Update everyone
 /// who needs to be notified.
 /// </summary>
 public void HandleColorSelectChange(Palette p)
 {
     p.PaletteWindow().ColorSelectChanged();
 }
Exemplo n.º 11
0
        /// <summary>
        /// A new subpalette has been selected, notify all other windows that are potentially
        /// impacted by this change
        /// </summary>
        public void HandleSubpaletteSelectChange(Palette p)
        {
            p.PaletteWindow().SubpaletteSelectChanged();
            Spriteset ss;
            if (p.IsBackground)
            {
                ss = m_doc.BackgroundSpritesets.Current;
                Map m = ActiveMap();
                if (m != null)
                    m.MapWindow.SubpaletteSelectChanged();
            }
            else
            {
                ss = m_doc.Spritesets.Current;
            }

            ss.SpritesetWindow.SubpaletteSelectChanged();
            ss.SpriteWindow.SubpaletteSelectChanged();
        }
Exemplo n.º 12
0
 /// <summary>
 /// A new color has been selected in the subpalette. Update everyone
 /// who needs to be notified.
 /// </summary>
 public void HandleColorSelectChange(Palette p)
 {
     p.PaletteWindow().ColorSelectChanged();
 }
Exemplo n.º 13
0
        /// <summary>
        /// A color value has changed in the current palette.
        /// </summary>
        public void HandleColorDataChange(Palette p)
        {
            m_doc.FlushBitmaps();

            p.PaletteWindow().ColorDataChanged();
            Spriteset ss;
            if (p.IsBackground)
            {
                ss = m_doc.BackgroundSpritesets.Current;
                Map m = ActiveMap();
                if (m != null)
                    m.MapWindow.ColorDataChanged();
            }
            else
            {
                ss = m_doc.Spritesets.Current;
            }

            ss.SpritesetWindow.ColorDataChanged();
            ss.SpriteWindow.ColorDataChanged();
        }
Exemplo n.º 14
0
 public Subpalette(Document doc, Palette mgr, int nSubpaletteID, DefaultColorSet eDefaultColorSet)
 {
     Init(doc, mgr, nSubpaletteID, eDefaultColorSet);
 }