protected virtual void refillPanel() { //GUI if (mapObjects.Controls.Count == 0) { return; } mapObjects.SuspendLayout(); int startIndex = curPageIndex * BLOCKS_PER_PAGE; int endIndex = Math.Min(startIndex + BLOCKS_PER_PAGE, ConfigScript.getBlocksCount()); int pi = 0; for (int i = startIndex; i < endIndex; i++, pi++) { Panel p = (Panel)mapObjects.Controls[pi]; p.Visible = true; Label lb = (Label)p.Controls[0]; lb.Text = String.Format("{0:X}", i); PictureBox pb = (PictureBox)p.Controls[1]; pb.Image = makeObjImage(i); ComboBox cbColor = (ComboBox)p.Controls[2]; cbColor.SelectedIndex = objects[i].getSubpallete(); ComboBox cbType = (ComboBox)p.Controls[3]; cbType.SelectedIndex = objects[i].getType(); } for (; pi < mapObjects.Controls.Count; pi++) { Panel p = (Panel)mapObjects.Controls[pi]; p.Visible = false; } mapObjects.ResumeLayout(); }
private void preparePanel() { //GUI mapObjects.Controls.Clear(); mapObjects.SuspendLayout(); int endIndex = Math.Min(BLOCKS_PER_PAGE, ConfigScript.getBlocksCount()); for (int i = 0; i < endIndex; i++) { var obj = objects[i]; int curPanelX = 0; Panel fp = new Panel(); fp.Size = new Size(mapObjects.Width - 25, TILE_SIZE * obj.h); // Label lb = new Label(); lb.Location = new Point(curPanelX, 0); lb.Size = new Size(32, 32); lb.Tag = i; lb.Text = String.Format("{0:X}", i); fp.Controls.Add(lb); curPanelX += lb.Size.Width; // PictureBox pb = new PictureBox(); pb.Location = new Point(curPanelX, 0); pb.Size = new Size(TILE_SIZE * obj.w, TILE_SIZE * obj.h); pb.Tag = i; pb.MouseClick += new MouseEventHandler(pb_MouseClick); fp.Controls.Add(pb); curPanelX += pb.Size.Width + 6; // ComboBox cbColor = new ComboBox(); cbColor.Size = cbSubpalette.Size; cbColor.Location = new Point(curPanelX, 0); cbColor.Tag = pb; cbColor.DrawMode = DrawMode.OwnerDrawVariable; cbColor.DrawItem += new DrawItemEventHandler(cbSubpalette_DrawItemEvent); cbColor.Items.AddRange(subPalItems); cbColor.DropDownStyle = ComboBoxStyle.DropDownList; cbColor.SelectedIndexChanged += cbColor_SelectedIndexChanged; fp.Controls.Add(cbColor); curPanelX += cbColor.Size.Width; // ComboBox cbType = new ComboBox(); var objectTypes = ConfigScript.getBlockTypeNames(); cbType.Items.AddRange(objectTypes); cbType.Location = new Point(curPanelX, 0); cbType.Size = new Size(120, 21); cbType.Tag = i; cbType.DropDownStyle = ComboBoxStyle.DropDownList; cbType.SelectedIndexChanged += cbType_SelectedIndexChanged; fp.Controls.Add(cbType); mapObjects.Controls.Add(fp); } mapObjects.ResumeLayout(); refillPanel(); }
protected void btClear_Click(object sender, EventArgs e) { if (MessageBox.Show("Are you sure want to clear all blocks?", "Clear", MessageBoxButtons.YesNo) != DialogResult.Yes) { return; } for (int i = 0; i < ConfigScript.getBlocksCount(curActiveBigBlock); i++) { objects[i] = new ObjRec(0, 0, 0, 0, 0, 0); } dirty = true; refillPanel(); }
protected virtual void resetControls() { UtilsGui.setCbItemsCount(cbVideo, ConfigScript.videoOffset.recCount); UtilsGui.setCbItemsCount(cbTileset, ConfigScript.blocksOffset.recCount); UtilsGui.setCbItemsCount(cbPalette, ConfigScript.palOffset.recCount); UtilsGui.setCbIndexWithoutUpdateLevel(cbTileset, cbLevelSelect_SelectedIndexChanged, formMain.curActiveBigBlockNo); //small blocks no? UtilsGui.setCbIndexWithoutUpdateLevel(cbVideo, VisibleOnlyChange_SelectedIndexChanged, formMain.curActiveVideoNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbPalette, VisibleOnlyChange_SelectedIndexChanged, formMain.curActivePalleteNo); curActiveBigBlock = formMain.curActiveBigBlockNo; //small blocks no? curActiveVideo = formMain.curActiveVideoNo; curActivePal = formMain.curActivePalleteNo; UtilsGui.setCbIndexWithoutUpdateLevel(cbSubpalette, cbSubpalette_SelectedIndexChanged); UtilsGui.setCbItemsCount(cbPanelNo, (ConfigScript.getBlocksCount(curActiveBigBlock) + BlocksPerPage - 1) / BlocksPerPage); UtilsGui.setCbIndexWithoutUpdateLevel(cbPanelNo, cbPanelNo_SelectedIndexChanged); }
public static void setBlocksLinearWithoutAttrib(int blockIndex, ObjRec[] blocksData) { writeBlocksLinear(blocksData, Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getBlocksCount(), false); }
public static ObjRec[] getBlocksLinear4x2withoutAttrib(int blockIndex) { return(Utils.readBlocksLinear(Globals.romdata, ConfigScript.getTilesAddr(blockIndex), 4, 2, ConfigScript.getBlocksCount(), false)); }
public static void setBlocksFromTiles16Pal1(int blockIndex, ObjRec[] blocksData) { writeBlocksLinearTiles16Pal1(blocksData, Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getPalBytesAddr(), ConfigScript.getBlocksCount()); }
public static ObjRec[] getBlocksFromTiles16Pal1(int blockIndex) { return(readBlocksLinearTiles16Pal1(Globals.romdata, ConfigScript.getTilesAddr(blockIndex), ConfigScript.getPalBytesAddr(), ConfigScript.getBlocksCount())); }