예제 #1
0
        public MainForm()
        {
            _formatList = new Dictionary <FormatKind, FileFormat>();

            _formatList[FormatKind.NES] = new FileFormat(
                "NES",
                Utils.TileType("NESTile"),
                new string[] { "nes", "fds", "chr", "bin" },
                new ColorList(Utils.NESPalette, Utils.NESDefSel)
                );

            _formatList[FormatKind.SNES] = new FileFormat(
                "SNES",
                Utils.TileType("SNESTile"),
                new string[] { "smc", "sfc", "chr", "bin" },
                new ColorPattern(Utils.SNESRGBAOrderAndDepth, Utils.SNESDefSel)
                );

            _formatList[FormatKind.MD] = new FileFormat(
                "Genesis",
                Utils.TileType("MDTile"),
                new string[] { "smd", "md", "bin" },
                new ColorPattern(Utils.MDRGBAOrderAndDepth, Utils.MDDefSel)
                );

            InitializeComponent();

            string filter = "";

            foreach (var fmt in _formatList)
            {
                filter += fmt.Value.Filter;
            }

            filter = filter.Remove(filter.Length - 1);
            this.openFileDialog1.Filter = filter;

            inputWnd  = new InputWindow(this);
            spriteWnd = new SpriteWindow(this);
            toolBox   = new ToolBox(this, inputWnd);

            // Setup MainForm events
            this.KeyPreview = true;
            this.KeyUp     += this.keyUpHandler;
            this.KeyDown   += this.keysHandler;
            this.Resize    += this.catchWindowState;
            this.Layout    += this.layoutHandler;
            Utils.ApplyRecursiveControlFunc(this, this.ConfigureControls);

            _sendTileEvents = new[]
            {
                new EventPair("Click", (s, e) => { CopyTile(inputWnd); PasteTile(spriteWnd); _tempSpriteSel = true; }),
                new EventPair("MouseEnter", (s, e) => { _tempSpriteSel = spriteWnd.Selected; spriteWnd.Selected = true; spriteWnd.Draw(); }),
                new EventPair("MouseLeave", (s, e) => { spriteWnd.Selected = _tempSpriteSel; spriteWnd.Draw(); })
            };

            UpdateMinimumSize();
            inputWnd.Focus(this);
        }
예제 #2
0
        public InputControlsTab(InputWindow wnd)
        {
            _wnd  = wnd;
            _id   = "inputControlsTab";
            _name = "Controls";

            _tabButton     = new ToolBoxButton(_name);
            _tabButton.Tag = this;

            _panel      = new Panel();
            _panel.Name = "inputControlsPanel";
            //_panel.UseVisualStyleBackColor = true;

            _offsetLabel          = new Label();
            _offsetLabel.Location = new System.Drawing.Point(5, 18);
            _offsetLabel.Name     = "inputOffsetLabel";
            _offsetLabel.Size     = new System.Drawing.Size(53, 15);
            _offsetLabel.Text     = "Offset: 0x";

            _offsetBox              = new TextBox();
            _offsetBox.Location     = new System.Drawing.Point(60, 15);
            _offsetBox.Name         = "inputOffset";
            _offsetBox.Size         = new System.Drawing.Size(60, 20);
            _offsetBox.Text         = "0";
            _offsetBox.TextChanged += this.editOffsetBox;

            _sizeLabel          = new Label();
            _sizeLabel.Location = new System.Drawing.Point(122, 18);
            _sizeLabel.Name     = "inputSizeLabel";
            _sizeLabel.AutoSize = true;
            _sizeLabel.Text     = "/";

            _sendTile          = new Button();
            _sendTile.Location = new System.Drawing.Point(200, 12);
            _sendTile.Name     = "inputSend";
            _sendTile.Size     = new System.Drawing.Size(90, 24);
            _sendTile.Text     = "Send To Sprite";
            _sendTile.UseVisualStyleBackColor = true;

            _tileSample             = new PictureBox();
            _tileSample.BackColor   = System.Drawing.SystemColors.ControlLight;
            _tileSample.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
            _tileSample.Location    = new System.Drawing.Point(300, 4);
            _tileSample.Name        = "inputSample";
            _tileSample.Size        = new System.Drawing.Size(40, 40);
            _tileSample.SizeMode    = System.Windows.Forms.PictureBoxSizeMode.StretchImage;
            _tileSample.Paint      += this.paintSample;

            _panel.Controls.Add(_offsetLabel);
            _panel.Controls.Add(_offsetBox);
            _panel.Controls.Add(_sizeLabel);
            _panel.Controls.Add(_sendTile);
            _panel.Controls.Add(_tileSample);
        }