setCbItemsCount() публичный статический Метод

public static setCbItemsCount ( ComboBox cb, int count, int first, bool inHex = false ) : void
cb System.Windows.Forms.ComboBox
count int
first int
inHex bool
Результат void
Пример #1
0
 private void FormStructuresName_Load(object sender, EventArgs e)
 {
     UtilsGui.setCbItemsCount(cbWidth, 64, 1);
     UtilsGui.setCbItemsCount(cbHeight, 64, 1);
     cbWidth.SelectedIndex  = StructWidth - 1;
     cbHeight.SelectedIndex = StructHeight - 1;
     cbName.Text            = StructName;
     Result = false;
 }
Пример #2
0
 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);
     }
 }
Пример #3
0
 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;
 }
Пример #4
0
        private void EditMap_Load(object sender, EventArgs e)
        {
            UtilsGui.setCbItemsCount(cbScreenNo, MapConfig.mapsInfo.Length);
            cbScreenNo.SelectedIndex = 0;
            //reloadAllData();

            cbShowSecondNametable.Checked = mapDatas.Length > 1;
            cbShowSecondNametable.Visible = mapDatas.Length > 1;

            cbSubpalette.DrawItem += cbSubpalette_DrawItemEvent;
        }
Пример #5
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();
        }
Пример #6
0
        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();
        }
Пример #7
0
        private void SaveScreensCount_Load(object sender, EventArgs e)
        {
            int scrCount = ConfigScript.screensOffset[0].recCount;

            UtilsGui.setCbItemsCount(cbFirst, scrCount);
            UtilsGui.setCbItemsCount(cbCount, scrCount);
            cbFirst.SelectedIndex = 0;
            cbCount.SelectedIndex = scrCount - 1;
            Result           = false;
            btOpen.Visible   = ExportMode;
            btImport.Visible = !ExportMode;
            lbCount.Visible  = ExportMode;
            cbCount.Visible  = ExportMode;
            tbFileName.Text  = Filename;
        }
Пример #8
0
        private void SaveScreensCount_Load(object sender, EventArgs e)
        {
            var screens  = ConfigScript.loadScreens();
            int scrCount = screens.Length;

            UtilsGui.setCbItemsCount(cbFirst, scrCount);
            UtilsGui.setCbItemsCount(cbCount, scrCount);
            cbFirst.SelectedIndex = 0;
            cbCount.SelectedIndex = scrCount - 1;
            result           = false;
            btOpen.Visible   = exportMode;
            btImport.Visible = !exportMode;
            lbCount.Visible  = exportMode;
            cbCount.Visible  = exportMode;
            tbFileName.Text  = filename;
        }
Пример #9
0
        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);
        }
Пример #10
0
        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);
            }
        }
Пример #11
0
        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();
        }
Пример #12
0
        protected virtual void initControls()
        {
            UtilsGui.setCbItemsCount(cbHierarchyLevel, ConfigScript.getbigBlocksHierarchyCount());
            UtilsGui.setCbItemsCount(cbVideoNo, ConfigScript.videoOffset.recCount);
            UtilsGui.setCbItemsCount(cbBigBlock, ConfigScript.bigBlocksOffsets[curHierarchyLevel].recCount);
            UtilsGui.setCbItemsCount(cbPaletteNo, ConfigScript.palOffset.recCount);
            cbTileset.Items.Clear();
            for (int i = 0; i < ConfigScript.blocksOffset.recCount; i++)
            {
                var str = String.Format("Tileset{0}", i);
                cbTileset.Items.Add(str);
            }

            //generic version
            cbHierarchyLevel.SelectedIndex = 0;
            cbTileset.SelectedIndex        = formMain.curActiveBlockNo;
            cbVideoNo.SelectedIndex        = formMain.curActiveVideoNo;
            cbBigBlock.SelectedIndex       = formMain.curActiveBigBlockNo;
            cbPaletteNo.SelectedIndex      = formMain.curActivePalleteNo;
            cbViewType.SelectedIndex       = Math.Min((int)formMain.curActiveViewType, cbViewType.Items.Count - 1);
        }
Пример #13
0
        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();
        }
Пример #14
0
        private void EditForm_Load(object sender, EventArgs e)
        {
            makeScreens();

            var addPath = "";

            if (!File.Exists("scroll_sprites//scrolls.png"))
            {
                addPath = "..//";
            }
            scrollSprites.Images.Clear();
            scrollSprites.Images.AddStrip(Image.FromFile(addPath + "scroll_sprites//scrolls.png"));
            doorSprites.Images.Clear();
            doorSprites.Images.AddStrip(Image.FromFile(addPath + "scroll_sprites//doors.png"));
            dirSprites.Images.Clear();
            dirSprites.Images.AddStrip(Image.FromFile(addPath + "scroll_sprites//dirs.png"));
            objPanel.Controls.Clear();
            objPanel.SuspendLayout();

            for (int i = 0; i < scrollSprites.Images.Count; i++)
            {
                var but = new Button();
                but.Size       = new Size(32, 32);
                but.ImageList  = scrollSprites;
                but.ImageIndex = i;
                but.Click     += buttonScrollClick;
                objPanel.Controls.Add(but);
            }
            objPanel.ResumeLayout();

            doorsPanel.SuspendLayout();

            for (int i = 0; i < doorSprites.Images.Count; i++)
            {
                var but = new Button();
                but.Size       = new Size(32, 32);
                but.ImageList  = doorSprites;
                but.ImageIndex = i;
                but.Click     += buttonDoorClick;
                doorsPanel.Controls.Add(but);
            }
            doorsPanel.ResumeLayout();

            blocksPanel.Controls.Clear();
            blocksPanel.SuspendLayout();
            for (int i = 0; i < ConfigScript.screensOffset[scrLevelNo].recCount; i++)
            {
                var but = new Button
                {
                    Size       = new Size(64, 64),
                    ImageList  = screenImages,
                    ImageIndex = i
                };
                but.Click += buttonBlockClick;
                blocksPanel.Controls.Add(but);
            }
            blocksPanel.ResumeLayout();

            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);
            cbVideoNo.SelectedIndex    = 0;
            cbBigBlockNo.SelectedIndex = 0;
            cbBlockNo.SelectedIndex    = 0;
            cbPaletteNo.SelectedIndex  = 0;

            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));
            }

            cbLayoutNo.SelectedIndex = 0;

            cbShowScrolls.Visible      = ConfigScript.isShowScrollsInLayout();
            btExport.Visible           =
                pnParamGeneric.Visible = true;
        }
Пример #15
0
 private void EditMap_Load(object sender, EventArgs e)
 {
     UtilsGui.setCbItemsCount(cbScreenNo, MapConfig.mapsInfo.Length);
     cbScreenNo.SelectedIndex = 0;
     //reloadAllData();
 }
Пример #16
0
        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();
        }