Ejemplo n.º 1
0
        private void Save(object sender, EventArgs e)
        {
            System.Diagnostics.Debug.Assert(converterControl1.ConvertedTilesets != null);
            if (converterControl1.ConvertedTilesets.Length == 0 && tabControl1.SelectedIndex == 0)
            {
                return;
            }

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (saveFileDialog1.FileName == filepath)
            {
                // Is this message really right?
                MessageBox.Show(Vocab.GetText("sizeNotMatchErrorMsg"));
                return;
            }

            if (tabControl1.SelectedIndex == 0)
            {
                SaveConverter(saveFileDialog1.FileName);
            }
            else
            {
                editor.Save(saveFileDialog1.FileName);
            }
        }
Ejemplo n.º 2
0
        private void LoadGrid(object sender, EventArgs e)
        {
            if (tabControl1.SelectedIndex != 1)
            {
                return;
            }

            Maker.Custom.SPRITE_SIZE = Int32.Parse(textCustomSize.Text);

            if (GetTileset().TilesetName() == Maker.Custom.NAME && Maker.Custom.SPRITE_SIZE == 0)
            {
                MessageBox.Show(Vocab.GetText("sizeIsZeroErrorMsg"));
                return;
            }

            Image img = Image.FromFile(filepath);

            pictureBoxPreview.Image = null;

            try
            {
                gridInp = new TilesetEditorIntput(GetTileset(), inputPanel, img, pictureBoxPreview);
                SetOutputGrid(null, null);
            }
            catch (ConvertException ex)
            {
                MessageBox.Show(ex.Message);
            }
        }
Ejemplo n.º 3
0
        private void CutSave(object sender, EventArgs e)
        {
            ITileset tile = GetSelectedInputTileset();

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            btnSaveEachSprite.Enabled = false;

            (new Thread(() =>
            {
                try
                {
                    // FIXME: prevent stack overflow
                    tile = tile.TilesetName() == Tileset.Tileset.Custom(0).Name ?
                           Tileset.Tileset.Custom(byte.Parse(textCustomSize.Text))
                        : tile;

                    TilesetConverterVertical tilecon = new TilesetConverterCustom(tile, SpriteMode.ALIGN_TOP_LEFT, false);
                    tilecon.SaveEachSubimage(Image.FromFile(filepath), saveFileDialog1.FileName);

                    MessageBox.Show(Vocab.GetText("done"), "Tilecon");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    UIThread(delegate { btnSaveEachSprite.Enabled = true; });
                }
            })).Start();
        }
Ejemplo n.º 4
0
        private void Save(object sender, EventArgs e)
        {
            if (bitmaps == null && tabControl1.SelectedIndex == 0)
            {
                return;
            }

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            if (saveFileDialog1.FileName == filepath)
            {
                MessageBox.Show(Vocab.GetText("sizeNotMatchErrorMsg"));
                return;
            }

            if (tabControl1.SelectedIndex == 0)
            {
                SaveConverter();
            }
            else
            {
                SaveEditor();
            }
        }
Ejemplo n.º 5
0
        private void CutSave(object sender, EventArgs e)
        {
            ITileset tile = GetTileset();

            if (saveFileDialog1.ShowDialog() != DialogResult.OK)
            {
                return;
            }

            btnSaveEachSprite.Enabled = false;

            (new Thread(() =>
            {
                try
                {
                    int size = tile.TilesetName() == Maker.Custom.NAME ? Int32.Parse(textCustomSize.Text) : tile.SpriteSize();
                    TilesetConverterVertical tilecon = new TilesetConverterCustom(SpriteMode.ALIGN_TOP_LEFT, false, size);
                    tilecon.SaveEachSubimage(Image.FromFile(filepath), saveFileDialog1.FileName);

                    MessageBox.Show(Vocab.GetText("done"), "Tilecon");
                }
                catch (Exception ex)
                {
                    MessageBox.Show(ex.Message);
                }
                finally
                {
                    UIThread(delegate { btnSaveEachSprite.Enabled = true; });
                }
            })).Start();
        }
Ejemplo n.º 6
0
 /// <summary>Default constructor.</summary>
 public FormAbout()
 {
     InitializeComponent();
     labelTitle.Text = "Tileset Converter MV" + Vocab.version;
     labelAbout.Text = Vocab.aboutHelpText;
     linkLabel2.Text = Vocab.GetText("sourceCode");
 }
Ejemplo n.º 7
0
 /// <summary>Default constructor.</summary>
 public FormAbout()
 {
     InitializeComponent();
     labelTitle.Text = "Tileset Converter MV" + Vocab.version;
     linkLabel1.Text = Vocab.GetText("projectPage");
     linkLabel2.Text = Vocab.GetText("sourceCode");
 }
Ejemplo n.º 8
0
        // TODO: make it work in convertercontrol too
        private void ChangeLang(Vocab.Lang l)
        {
            Vocab.currentLanguage = l;

            saveFileDialog1.Filter = Vocab.GetText("pngFiles") + " (*.png) | *.png";
            openFileDialog1.Filter = Vocab.GetText("imageFiles") + " (*.gif, *.bmp, *.jpg, *.jpeg, *.jpe, *.jfif, *.png) | *.gif; *bmp; *.jpg; *.jpeg; *.jpe; *.jfif; *.png";

            convertAndSaveItem.Text = Vocab.GetText("convert");
            setTransparentItem.Text = Vocab.GetText("setTransparency");
            Vocab.GetText("ignoreAlpha");
            Vocab.GetText("conversion");

            labelSpriteSize.Text   = Vocab.GetText("spriteSize");
            btnSaveEachSprite.Text = saveEachSpritesItem.Text = Vocab.GetText("saveEachSprite");
            btnOpen.Text           = openTilesetItem.Text = Vocab.GetText("openTileset");
            btnSave.Text           = saveToolStripItem.Text = Vocab.GetText("save");
            ignoreItem.Text        = Vocab.GetText("ignoreAlpha");

            cbMode.Items[0] = topLeftItem.Text = Vocab.GetText("topLeftAlign");
            cbMode.Items[1] = topCenterItem.Text = Vocab.GetText("topCenterAlign");
            cbMode.Items[2] = topRightItem.Text = Vocab.GetText("topRightAlign");
            cbMode.Items[3] = middleLeftItem.Text = Vocab.GetText("middleLeftAlign");
            cbMode.Items[4] = middleCenterItem.Text = Vocab.GetText("middleCenterAlign");
            cbMode.Items[5] = middleRightItem.Text = Vocab.GetText("middleRightAlign");
            cbMode.Items[6] = bottomLeftItem.Text = Vocab.GetText("bottomLeftAlign");
            cbMode.Items[7] = bottomCenterItem.Text = Vocab.GetText("bottomCenterAlign");
            cbMode.Items[8] = bottomRightItem.Text = Vocab.GetText("bottomRightAlign");
            cbMode.Items[9] = resizeItem.Text = Vocab.GetText("resize");

            menuStrip1.Items[0].Text = Vocab.GetText("file");
            modeMenu.Text            = Vocab.GetText("mode");
            exitItem.Text            = Vocab.GetText("exit");

            menuStrip1.Items[1].Text = tabConverter.Text = Vocab.GetText("converter");
            menuStrip1.Items[2].Text = tabEditor.Text = Vocab.GetText("editor");

            setInputTilesetItem.Text          = btnSetInputTileset.Text = Vocab.GetText("setTileset");
            clearPreviewItem.Text             = btnClearPreview.Text = Vocab.GetText("clearSelectedTile");
            outputTilesetItem.Text            = Vocab.GetText("outputTileset");
            clearAndSetOutputTilesetItem.Text = Vocab.GetText("clearAndSetTileset");

            menuStrip1.Items[3].Text         = Vocab.GetText("language");
            englishToolStripMenuItem.Text    = Vocab.GetText("english");
            portugueseToolStripMenuItem.Text = Vocab.GetText("portuguese");

            menuStrip1.Items[4].Text    = Vocab.GetText("help");
            aboutToolStripMenuItem.Text = Vocab.GetText("about");

            btnClearAndSet.Text = Vocab.GetText("clearAndSetTileset");
            converterControl1.ChangeLang();
            editor.ChangeLang();
        }
Ejemplo n.º 9
0
        private void Convert(object sender, EventArgs e)
        {
            TilesetConverterBase con;
            ITileset             tileset = GetTileset();

            btnConvert.Text = Vocab.GetText("wait");

            try
            {
                switch (tileset.TilesetName())
                {
                case Maker.Alpha.NAME:
                    con = new TilesetConverterVerticalApha(tileset, (SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked);
                    break;

                case Maker.R95.NAME:
                case Maker.S97.NAME:
                case Maker.XP_Tile.NAME:
                    con = new TilesetConverterVertical(tileset, (SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked);
                    break;

                case Maker.XP_Auto.NAME:
                    con = new TilesetConverterAutotileXP(tileset, (SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked);
                    break;

                case Maker.R2k_2k3_A.NAME:
                case Maker.R2k_2k3_B.NAME:
                case Maker.R2k_2k3_AB.NAME:
                case Maker.R2k_2k3_Auto.NAME:
                case Maker.R2k_2k3_AnimObj.NAME:
                    con = new TilesetConverterVerticalRM2K3(tileset, (SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked);
                    break;

                case Maker.Custom.NAME:
                    con = new TilesetConverterCustom((SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked, Int32.Parse(textCustomSize.Text));
                    break;

                default:
                    con = new TilesetConverterVX(tileset, (SpriteMode)cbMode.SelectedIndex, checkIgnore.Checked);
                    break;
                }
                bitmaps = con.ConvertToMV(Image.FromFile(filepath));
            }
            catch (ConvertException ex)
            {
                MessageBox.Show(ex.Message);
                return;
            }

            if (bitmaps == null)
            {
                btnConvert.Text = Vocab.GetText("converter");
                return;
            }

            pictureBoxOutput.Image     = bitmaps[0];
            btnNextImg.Enabled         = btnPreviusImg.Enabled = false;
            btnTransparency.Enabled    = true;
            setTransparentItem.Enabled = true;

            if (bitmaps.Length > 1)
            {
                btnNextImg.Enabled = btnPreviusImg.Enabled = true;
            }
            else
            {
                btnNextImg.Enabled = btnPreviusImg.Enabled = false;
            }

            bmpCurrentIndex         = 0;
            labelMVPagesNumber.Text = bmpCurrentIndex + 1 + "/" + bitmaps.Length;
            btnConvert.Text         = Vocab.GetText("converter");
        }