private void btnInsertRow_Click(object sender, System.EventArgs e) { int todo = tilesetViewer.TilesWide - (vsp.tileCount % tilesetViewer.TilesWide); if (todo == 0) { todo = tilesetViewer.TilesWide; } int startInsert = vsp.tileCount; Ops.AddRemoveTilesGroup artg = new Ops.AddRemoveTilesGroup(0); Operations.OperationManager om = Global.opManager; om.beginGroup("VSP Manager: Insert Row"); for (int i = 0; i < todo; i++) { artg.addRecord(startInsert, 0); } om.addExec(artg); om.endGroup(); updateScrollbar(); tilesetViewer.Invalidate(); }
private void btnInsertTile_Click(object sender, System.EventArgs e) { Operations.OperationManager om = Global.opManager; om.beginGroup("VSP Manager: Insert Tile"); Ops.AddRemoveTilesGroup artg = new Ops.AddRemoveTilesGroup(0); artg.addRecord(Global.ActiveVsp.tileCount, 0); om.addExec(artg); om.endGroup(); updateScrollbar(); tilesetViewer.Invalidate(); }
public void setTile(string layer, int x, int y, int val) { MapLayer ml = editedMap.findLayer(layer); if (ml == null) { return; } int mli = editedMap.findLayerIndex(ml); if (x >= 0 && x < ml.Width && y >= 0 && y < ml.Height) { if (bTweak) { ml.setTile(x, y, val); } else { opManager.addExec(new Ops.SetTile(0, mli, x, y, val)); bDirty = true; } } }
private void btnDeleteRow_Click(object sender, System.EventArgs e) { int toDelete = vsp.tileCount % tilesetViewer.TilesWide; if (toDelete == 0) { toDelete = tilesetViewer.TilesWide; } if (vsp.tileCount == 0) { toDelete = 0; } if (toDelete == 0) { return; } int startDelete = (vsp.tileCount / tilesetViewer.TilesWide) * tilesetViewer.TilesWide; if (toDelete == tilesetViewer.TilesWide) { startDelete -= tilesetViewer.TilesWide; } Ops.AddRemoveTilesGroup artg = new Ops.AddRemoveTilesGroup(0); Operations.OperationManager om = Global.opManager; om.beginGroup("VSP Manager: Delete Row"); for (int i = 0; i < toDelete; i++) { artg.addRecord(startDelete, 1); } om.addExec(artg); om.endGroup(); updateScrollbar(); tilesetViewer.Invalidate(); }