private void cbLevel_SelectedIndexChanged(object sender, EventArgs e) { if (!UtilsGui.askToSave(ref dirty, saveToFile, returnCbLevelIndex)) { return; } if (cbLayoutNo.SelectedIndex == -1) { return; } curActiveLayout = cbLayoutNo.SelectedIndex; curWidth = ConfigScript.getLevelWidth(curActiveLayout); curHeight = ConfigScript.getLevelHeight(curActiveLayout); drawMode = MapDrawMode.Screens; curActiveBlock = 0; activeBlock.Image = screenImages.Images[0]; updatePanelsVisibility(); cbLayoutNo.Items.Clear(); foreach (var lr in ConfigScript.getLevelRecs()) { cbLayoutNo.Items.Add(String.Format("0x{0:X} ({1}x{2})", lr.layoutAddr, lr.width, lr.height)); } UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged, curActiveLayout); reloadLevelLayer(); }
private void cbLevel_SelectedIndexChanged(object sender, EventArgs e) { if (cbLayoutNo.SelectedIndex == -1) { return; } bool realReload = sender == cbLayoutNo; bool reloadObjects = realReload; if (!readOnly && realReload) { if (!UtilsGui.askToSave(ref dirty, saveToFile, returnCbLevelIndex)) { return; } } curActiveLayout = cbLayoutNo.SelectedIndex; curScale = cbScale.SelectedIndex + 1; //TODO: normal scale factors; cbLayoutNo.Items.Clear(); foreach (var lr in ConfigScript.levelRecs) { cbLayoutNo.Items.Add(String.Format("{0}:0x{1:X} ({2}x{3})", lr.name, lr.layoutAddr, lr.width, lr.height)); } UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged, curActiveLayout); reloadLevel(reloadObjects); resizeMapScreen(); mapScreen.Invalidate(); }
private void resetTileStructControls() { if (curTileStruct != null) { UtilsGui.setCbItemsCount(cbWidth, 64, 1); UtilsGui.setCbItemsCount(cbHeight, 64, 1); UtilsGui.setCbIndexWithoutUpdateLevel(cbWidth, cbWidth_SelectedIndexChanged, curTileStruct.Width - 1); UtilsGui.setCbIndexWithoutUpdateLevel(cbHeight, cbWidth_SelectedIndexChanged, curTileStruct.Height - 1); } }
private void updateMappingControls(int index) { ushort word = tiles[index]; UtilsGui.setCbIndexWithoutUpdateLevel(cbTile, cbTile_SelectedIndexChanged, Mapper.tileIdx(word)); UtilsGui.setCbIndexWithoutUpdateLevel(cbPal, cbPal_SelectedIndexChanged, Mapper.palIdx(word)); UtilsGui.setCbCheckedWithoutUpdateLevel(cbHFlip, cbHFlip_CheckedChanged, Mapper.hf(word)); UtilsGui.setCbCheckedWithoutUpdateLevel(cbVFlip, cbVFlip_CheckedChanged, Mapper.vf(word)); UtilsGui.setCbCheckedWithoutUpdateLevel(cbPrior, cbPrior_CheckedChanged, Mapper.p(word)); }
private void EditVideo_Load(object sender, EventArgs e) { curActiveVideo = 0; curSubPal = 0; UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount); UtilsGui.setCbItemsCount(cbPalleteNo, ConfigScript.palOffset.recCount); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbVideoNo_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbSubPal, cbVideoNo_SelectedIndexChanged); //UtilsGui.setCbIndexWithoutUpdateLevel(cbPalleteNo, cbPalleteNo_SelectedIndexChanged); cbPalleteNo.SelectedIndex = 0; }
private void SegaBlockEdit_Load(object sender, EventArgs e) { dirty = false; reloadTiles(); UtilsGui.setCbItemsCount(cbPalSubpart, 4); UtilsGui.setCbIndexWithoutUpdateLevel(cbPalSubpart, cbPalNo_SelectedIndexChanged); UtilsGui.setCbItemsCount(cbBlockNo, getBlocksCount(), inHex: true); UtilsGui.setCbItemsCount(cbTile, SEGA_TILES_COUNT, inHex: true); UtilsGui.setCbItemsCount(cbPal, 4); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbBlockNo_SelectedIndexChanged); resetControls(); }
private void cbLevelPair_SelectedIndexChanged(object sender, EventArgs e) { if ( cbTileset.SelectedIndex == -1 || cbVideoNo.SelectedIndex == -1 || cbPaletteNo.SelectedIndex == -1 || cbPart.SelectedIndex == -1 || cbViewType.SelectedIndex == -1 || cbSmallBlock.SelectedIndex == -1 || cbHierarchyLevel.SelectedIndex == -1 ) { return; } if (!readOnly && dirty && (sender == cbTileset || sender == cbHierarchyLevel)) { DialogResult dr = MessageBox.Show("Tiles was changed. Do you want to save current tileset?", "Save", MessageBoxButtons.YesNoCancel); if (dr == DialogResult.Cancel) { returnCbLevelIndexes(); return; } else if (dr == DialogResult.Yes) { if (!saveToFile()) { returnCbLevelIndexes(); return; } } else { dirty = false; updateSaveVisibility(); } } //generic version curHierarchyLevel = cbHierarchyLevel.SelectedIndex; curTileset = cbTileset.SelectedIndex; curSmallBlockNo = cbSmallBlock.SelectedIndex; curViewType = (MapViewType)cbViewType.SelectedIndex; curVideo = cbVideoNo.SelectedIndex; curPallete = cbPaletteNo.SelectedIndex; curPart = cbPart.SelectedIndex; UtilsGui.setCbItemsCount(cbPart, Math.Max(ConfigScript.getBigBlocksCount(curHierarchyLevel) / 256, 1)); UtilsGui.setCbIndexWithoutUpdateLevel(cbPart, cbLevelPair_SelectedIndexChanged, curPart); reloadLevel(); }
private void cbGroup_SelectedIndexChanged(object sender, EventArgs e) { if (cbGroup.SelectedIndex < 0) { return; } GroupRec g = ConfigScript.getGroup(cbGroup.SelectedIndex); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged, g.videoNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged, g.bigBlockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged, g.blockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged, g.palNo); cbLevel_SelectedIndexChanged(cbVideoNo, new EventArgs()); }
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); }
private void EnemyEditor_Load(object sender, EventArgs e) { KeyPreview = true; if (ConfigScript.usePicturesInstedBlocks) { //TODO: set big blocks sizes from picture bigBlocks = UtilsGDI.setBlocksForPictures(); } reloadPictures(); fillObjPanel(); UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount); UtilsGui.setCbItemsCount(cbBigBlockNo, ConfigScript.bigBlocksOffsets[0].recCount); UtilsGui.setCbItemsCount(cbBlockNo, ConfigScript.blocksOffset.recCount); UtilsGui.setCbItemsCount(cbPaletteNo, ConfigScript.palOffset.recCount); UtilsGui.setCbItemsCount(cbScale, 2, 1); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged, formMain.curActiveVideoNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged, formMain.curActiveBlockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged, formMain.curActiveBigBlockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged, formMain.curActivePalleteNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbTool, cbTool_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbScale, cbLevel_SelectedIndexChanged, 1); cbLayoutNo.Items.Clear(); foreach (var lr in ConfigScript.getLevelRecs()) { cbLayoutNo.Items.Add(String.Format("{0}:0x{1:X} ({2}x{3})", lr.name, lr.layoutAddr, lr.width, lr.height)); } UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged); bttSave.Enabled = ConfigScript.setObjectsFunc != null; btSort.Visible = ConfigScript.sortObjectsFunc != null; UtilsGui.setCbItemsCount(cbBigObjectNo, 256, 0, true); cbLevel_SelectedIndexChanged(cbLayoutNo, new EventArgs()); resizeMapScreen(); cbGroup.Items.Clear(); foreach (var g in ConfigScript.getGroups()) { cbGroup.Items.Add(g.name); } }
private void cbLevel_SelectedIndexChanged(object sender, EventArgs e) { if (cbLayoutNo.SelectedIndex == -1) { return; } bool realReload = sender == cbLayoutNo; bool reloadObjects = realReload; if (!readOnly && realReload) { if (!UtilsGui.askToSave(ref dirty, saveToFile, returnCbLevelIndex)) { return; } } curActiveLayout = cbLayoutNo.SelectedIndex; curScale = cbScale.SelectedIndex + 1; //TODO: normal scale factors; cbLayoutNo.Items.Clear(); foreach (var lr in ConfigScript.getLevelRecs()) { cbLayoutNo.Items.Add(String.Format("{0} : 0x{1:X} ({2}x{3})", lr.name, lr.layoutAddr, lr.width, lr.height)); } UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged, curActiveLayout); if (sender == cbLayoutNo) { var g = getLevelRecForGameType().group; if (g != null) { UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged, g.videoNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged, g.bigBlockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged, g.blockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged, g.palNo); reloadLevelLayerData(); cbGroup.SelectedIndex = -1; } reloadScreens(); } reloadLevel(reloadObjects); resizeMapScreen(); mapScreen.Invalidate(); }
private void cbGroup_SelectedIndexChanged(object sender, EventArgs e) { if (cbGroup.SelectedIndex < 0) { return; } GroupRec g = ConfigScript.getGroup(cbGroup.SelectedIndex); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged, g.videoNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged, g.bigBlockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged, g.blockNo); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged, g.palNo); cbLevel_SelectedIndexChanged(cbVideoNo, new EventArgs()); if (g.firstScreen < 0 || g.firstScreen <= cbScreenNo.Items.Count) { cbScreenNo.SelectedIndex = g.firstScreen - 1; } }
private void resetControls() { curActiveLevelForScreen = 0; resetScreens(); UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount); UtilsGui.setCbItemsCount(cbBigBlockNo, ConfigScript.bigBlocksOffsets[0].recCount); UtilsGui.setCbItemsCount(cbBlockNo, ConfigScript.blocksOffset.recCount); UtilsGui.setCbItemsCount(cbPaletteNo, ConfigScript.palOffset.recCount); UtilsGui.setCbItemsCount(cbLevelNo, ConfigScript.getLevelsCount()); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbLevelNo, cbLevelNo_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbViewType, cbLevel_SelectedIndexChanged); cbGroup.Items.Clear(); foreach (var g in ConfigScript.getGroups()) { cbGroup.Items.Add(g.name); } dirty = false; updateSaveVisibility(); showNeiScreens = true; showAxis = true; showBrush = true; useStructs = false; curActiveLayer = 0; reloadGameType(); changeLevelIndex(true); bttBigBlocks.Enabled = ConfigScript.isBigBlockEditorEnabled; bttBlocks.Enabled = ConfigScript.isBlockEditorEnabled; bttEnemies.Enabled = ConfigScript.isEnemyEditorEnabled; bttShowLayer1.Visible = ConfigScript.getLayersCount() > 1; bttShowLayer2.Visible = ConfigScript.getLayersCount() > 1; bttLayer.Visible = ConfigScript.getLayersCount() > 1; pnGroups.Visible = ConfigScript.getGroups().Length > 0; resetMapScreenSize(); }
private void SegaBlockEdit_Load(object sender, EventArgs e) { //Change size without event, it will call later /*pnBlocks.SizeChanged -= pnBlocks_SizeChanged; * splitContainer1.Location = new Point(0, 35); * splitContainer1.Width = this.Width - 21; * splitContainer1.Height = this.Height - 81; * pnBlocks.SizeChanged += pnBlocks_SizeChanged;*/ dirty = false; reloadTiles(); UtilsGui.setCbItemsCount(cbPalSubpart, 4); UtilsGui.setCbIndexWithoutUpdateLevel(cbPalSubpart, cbPalNo_SelectedIndexChanged); UtilsGui.setCbItemsCount(cbBlockNo, getBlocksCount(), inHex: true); UtilsGui.setCbItemsCount(cbTile, SegaTilesCount, inHex: true); UtilsGui.setCbItemsCount(cbPal, 4); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbBlockNo_SelectedIndexChanged); resetControls(); }
private void returnCbLevelIndex() { UtilsGui.setCbIndexWithoutUpdateLevel(cbLayoutNo, cbLevel_SelectedIndexChanged, curActiveLayout); //save width/height }
private void resetControls() { clearSubeditorButtons(); ConfigScript.plugins.ForEach((p) => p.addToolButton(this)); ConfigScript.plugins.ForEach((p) => p.addSubeditorButton(this)); resetScreens(); UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount); UtilsGui.setCbItemsCount(cbBigBlockNo, ConfigScript.bigBlocksOffsets[0].recCount); UtilsGui.setCbItemsCount(cbBlockNo, ConfigScript.blocksOffset.recCount); UtilsGui.setCbItemsCount(cbPaletteNo, ConfigScript.palOffset.recCount); UtilsGui.setCbIndexWithoutUpdateLevel(cbVideoNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbBigBlockNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbBlockNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbPaletteNo, cbLevel_SelectedIndexChanged); UtilsGui.setCbIndexWithoutUpdateLevel(cbViewType, cbLevel_SelectedIndexChanged); cbGroup.Items.Clear(); foreach (var g in ConfigScript.getGroups()) { cbGroup.Items.Add(g.name); } dirty = false; updateSaveVisibility(); showNeiScreens = true; showAxis = true; showBrush = true; useStructs = false; curActiveLayer = 0; reloadGameType(); changeLevelIndex(true); bttBigBlocks.Enabled = ConfigScript.isBigBlockEditorEnabled; bttBlocks.Enabled = ConfigScript.isBlockEditorEnabled; bttEnemies.Enabled = ConfigScript.isEnemyEditorEnabled; bool isTwoLayers = getLayersCount() > 1; bool isPhysicsLayer = ConfigScript.loadPhysicsLayerFunc != null; bool isAdditionalRender = ConfigScript.renderToMainScreenFunc != null; bttShowLayer1.Visible = isTwoLayers || isPhysicsLayer; bttShowLayer2.Visible = isTwoLayers; bttAdditionalRender.Visible = isAdditionalRender; bttPhysicsLayerRender.Checked = false; bttPhysicsLayerRender.Visible = isPhysicsLayer; bttLayer.Visible = isTwoLayers || isPhysicsLayer; tsLayer1.Enabled = true; tsLayer2.Enabled = isTwoLayers; tsLayerPhysics.Enabled = isPhysicsLayer; curActiveLayer = 0; physicsLayerSelected = false; updateLayersMenuItemsChecked(curActiveLayer); pnGroups.Visible = ConfigScript.getGroups().Length > 0; updateScaleMenuItemsChecked(Array.FindIndex(scaleFactors, el => el == curScale)); //float comparasion with == is danger updateLayersMenuItemsChecked(curActiveLayer); resetMapScreenSize(); }