Exemplo n.º 1
0
        public void SetShadowColor(String shadowColorName, List <Bitmap> bitmaps)
        {
            Color shadowColor = Color.Gray;

            if (shadowColorName == Resources.GetString("Grey"))
            {
                shadowColor = Color.Gray;
            }
            if (shadowColorName == Resources.GetString("Transparent"))
            {
                shadowColor = Color.Transparent;
            }


            foreach (Bitmap bm in bitmaps)
            {
                if (defaultPalette == null)
                {
                    defaultPalette = ((Bitmap)bm.Clone()).Palette;
                }
                ColorPalette tempPalette = bm.Palette;
                tempPalette.Entries[254] = shadowColor;
                bm.Palette = tempPalette;
            }
            currentPalette.ShadowColorName = shadowColorName;
        }
Exemplo n.º 2
0
        public void AddRowToLibrary(string fileName, int foreshoting)
        {
            if (this.libDataGridView.Columns.Count == 0)
            {
                this.libDataGridView.Columns.Add("File", Resources.GetString("File"));
            }
            List <ExtendedBitmap> nextList = getImageList(fileName, foreshoting);
            BitmapsList           list     = new BitmapsList(fileName, foreshoting, nextList);

            lists.Add(list);
            int colunmsCount = this.libDataGridView.Columns.Count;

            if (colunmsCount - 1 < nextList.Count)
            {
                for (int i = colunmsCount; i <= nextList.Count; i++)
                {
                    DataGridViewImageColumn column = new DataGridViewImageColumn();
                    column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    column.HeaderText   = i.ToString();
                    this.libDataGridView.Columns.Add(column);
                }
            }
            this.libDataGridView.RowCount = lists.Count;
            this.dataGridView3.DataSource = new List <StciData>(infoData);
            this.dataGridView4.DataSource = new List <ETRLEData>(infoEtrleData);
        }
Exemplo n.º 3
0
        public PaletteForm(Bitmap bm)
        {
            InitializeComponent();
            this.dataGridView1.ReadOnly = true;

            this.FColors = bm.Palette.Entries;
            for (int i = 0; i < grid_size; i++)
            {
                this.dataGridView1.Rows.Add();

                for (int j = 0; j < grid_size; j++)
                {
                    int index = i * grid_size + j;
                    this.dataGridView1.Rows[i].Cells[j].Style.BackColor = this.FColors[index];
                    this.dataGridView1.Rows[i].Cells[j].Value           = index;
                }
            }

            this.pictureBox1.Image = (Bitmap)bm.Clone();

            #region SET LOCAL STRINGS

            this.btnSave.Text = Resources.GetString("Save");
            this.Text         = Resources.GetString("Palette");
            this.editToolStripMenuItem.Text = Resources.GetString("Edit");
            this.chbIndicatePixels.Text     = Resources.GetString("IndicatePixels");
            this.fileToolStripMenuItem.Text = Resources.GetString("File");
            this.openToolStripMenuItem.Text = Resources.GetString("Open...");
            this.saveToolStripMenuItem.Text = Resources.GetString("Save...");

            #endregion
        }
Exemplo n.º 4
0
        public void AddRowToLibrary(string[] bitmapFileNames, int foreshoting)
        {
            if (this.libDataGridView.Columns.Count == 0)
            {
                this.libDataGridView.Columns.Add("File", Resources.GetString("File"));
            }

            List <ExtendedBitmap> nextList = new List <ExtendedBitmap>();

            foreach (string fileName in bitmapFileNames)
            {
                Bitmap bm = new Bitmap(fileName);
                nextList.Add(new ExtendedBitmap(bm, 0, 0));
            }
            BitmapsList list = new BitmapsList(bitmapFileNames[0], foreshoting, nextList);

            lists.Add(list);
            int colunmsCount = this.libDataGridView.Columns.Count;

            if (colunmsCount - 1 < nextList.Count)
            {
                for (int i = colunmsCount; i <= nextList.Count; i++)
                {
                    DataGridViewImageColumn column = new DataGridViewImageColumn();
                    column.AutoSizeMode = DataGridViewAutoSizeColumnMode.AllCells;
                    column.HeaderText   = i.ToString();
                    this.libDataGridView.Columns.Add(column);
                }
            }
            this.libDataGridView.RowCount = lists.Count;
        }
Exemplo n.º 5
0
        void edit(ExtendedBitmap editingExBm, string tempFile)
        {
            Bitmap image = editingExBm.Bm;

            try
            {
                using (FileStream fs = File.OpenWrite(tempFile))
                {
                    image.Save(fs, ImageFormat.Bmp);
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show(exc.StackTrace);
            }
            ProcessStartInfo startInfo = new ProcessStartInfo(this.editorPath, tempFile);

            try
            {
                Process paintProcess = Process.Start(startInfo);
                paintProcess.EnableRaisingEvents = true;
                paintProcess.Exited += new EventHandler(paintProcess_Exited);
            }
            catch
            {
                MessageBox.Show(@"Invalid grafics editor. Please, select another.
For example, MS Paint or Adobe Fotoshop.", Resources.GetString("Error"),
                                MessageBoxButtons.OK, MessageBoxIcon.Error);
                this.editorPath = null;
            }
        }
Exemplo n.º 6
0
        void Initialize()
        {
            InitializeComponent();

            #region SET LOCAL STRINGS
            this.bLACKToolStripMenuItem.Text             = Resources.GetString("Blacks");
            this.bLACKToolStripMenuItem1.Text            = Resources.GetString("Blacks");
            this.bLACKToolStripMenuItem2.Text            = Resources.GetString("Black");
            this.toolStripMenuItem1.Text                 = Resources.GetString("Black");
            this.автообновлениеToolStripMenuItem.Text    = Resources.GetString("Autoupdating");
            this.bROWToolStripMenuItem.Text              = Resources.GetString("Brown");
            this.копироватьВБуферToolStripMenuItem1.Text = Resources.GetString("CopyToBuffer");
            this.dARKToolStripMenuItem.Text              = Resources.GetString("Dark");
            this.bLUEToolStripMenuItem1.Text             = Resources.GetString("DarkBlue");
            this.bLUEToolStripMenuItem.Text              = Resources.GetString("DarkBlues");
            this.rEDBROWNToolStripMenuItem.Text          = Resources.GetString("DarkRed");
            this.bROWNToolStripMenuItem.Text             = Resources.GetString("Darks");
            this.dIRTBLNDEToolStripMenuItem.Text         = Resources.GetString("Dirty");
            this.редактироватьToolStripMenuItem.Text     = Resources.GetString("Edit");
            this.toolStripMenuItem4.Text                 = Resources.GetString("Editing");
            this.wHITEToolStripMenuItem.Text             = Resources.GetString("GrayHaired");
            this.gREENToolStripMenuItem1.Text            = Resources.GetString("Green");
            this.gREENToolStripMenuItem.Text             = Resources.GetString("Greens");
            this.gREYToolStripMenuItem.Text              = Resources.GetString("Grey");
            this.сераяToolStripMenuItem.Text             = Resources.GetString("Grey");
            this.кислотныеЦветаToolStripMenuItem.Text    = Resources.GetString("InitialPalette");
            this.вставитьИзБуфераToolStripMenuItem.Text  = Resources.GetString("InsertFromBuffer");
            this.jEANToolStripMenuItem1.Text             = Resources.GetString("Jeans");
            this.jEANToolStripMenuItem.Text              = Resources.GetString("Jeanses");
            this.фуфайкаToolStripMenuItem.Text           = Resources.GetString("Jersey");
            this.tANToolStripMenuItem.Text               = Resources.GetString("Leather");
            this.bLONDToolStripMenuItem.Text             = Resources.GetString("Light");
            this.палитраToolStripMenuItem.Text           = Resources.GetString("Palette");
            this.pINKToolStripMenuItem.Text              = Resources.GetString("Pink");
            this.rEDToolStripMenuItem1.Text              = Resources.GetString("Red");
            this.удалитьToolStripMenuItem1.Text          =
                String.Format("{0}...", Resources.GetString("Remove"));
            this.удалитьToolStripMenuItem.Text             = Resources.GetString("Remove");
            this.rEDToolStripMenuItem.Text                 = Resources.GetString("Roody");
            this.сохранитьКакToolStripMenuItem.Text        = Resources.GetString("SaveAs");
            this.сохранитьToolStripMenuItem.Text           = Resources.GetString("Save");
            this.кожаToolStripMenuItem1.Text               = Resources.GetString("Skin");
            this.tANToolStripMenuItem1.Text                = Resources.GetString("Sunburnt");
            this.прозрачнаяToolStripMenuItem.Text          = Resources.GetString("Transparent");
            this.кожаToolStripMenuItem.Text                = Resources.GetString("Trousers");
            this.посмотретьToolStripMenuItem.Text          = Resources.GetString("View");
            this.toolStripMenuItem3.Text                   = Resources.GetString("Violet");
            this.wHITEToolStripMenuItem1.Text              = Resources.GetString("White");
            this.bEIGEToolStripMenuItem.Text               = Resources.GetString("Woolen");
            this.yELLOWToolStripMenuItem.Text              = Resources.GetString("Yellow");
            this.посмотретьСинхронноToolStripMenuItem.Text = Resources.GetString("ViewSynchronously");
            this.автообновлениеToolStripMenuItem.Text      = Resources.GetString("Autoupdating");
            this.теньToolStripMenuItem.Text                = Resources.GetString("Shadow");
            this.волосыToolStripMenuItem.Text              = Resources.GetString("Hair");
            this.refreshToolStripButton3.ToolTipText       = Resources.GetString("Refresh");
            this.палитраToolStripMenuItem1.Text            = Resources.GetString("Palette");
            #endregion
        }
Exemplo n.º 7
0
 void Initialize()
 {
     InitializeComponent();
     this.cancelButton.Text = Resources.GetString("Cancel");
     this.textBox1.Text     = Resources.GetString("MyPalette");
     this.label1.Text       = Resources.GetString("PaletteName");
     this.okButton.Text     = Resources.GetString("Save");
     this.Text = Resources.GetString("SavePalette");
 }
Exemplo n.º 8
0
 void Initialize()
 {
     InitializeComponent();
     this.Text           = Resources.GetString("BreakdownForeshortenings");
     this.button2.Text   = Resources.GetString("Cancel");
     this.label2.Text    = Resources.GetString("InTotalForeshortenings");
     this.button1.Text   = Resources.GetString("Save");
     this.label1.Text    = Resources.GetString("SumForeshortenings");
     this.checkBox1.Text = Resources.GetString("NoAnimated");
 }
Exemplo n.º 9
0
 private void numericUpDown_ValueChanged(object sender, EventArgs e)
 {
     this.label1.Text = String.Format("{5}: {0},  {4}: {1},  {3}: {2}.",
                                      sum, count, sum - count, Resources.GetString("Difference"),
                                      Resources.GetString("InTotalFrames"), Resources.GetString("SumForeshortenings"));
     if (sum - count != 0)
     {
         this.label1.BackColor = Color.FromArgb(255, 255, 64, 64);
         this.button1.Enabled  = false;
     }
     else
     {
         this.label1.BackColor = Color.Transparent;
         this.button1.Enabled  = true;
     }
 }
Exemplo n.º 10
0
        public ManualForm()
        {
            InitializeComponent();
            this.Text = Resources.GetString("Help");
            string helpFile = Path.Combine(Application.StartupPath, "help.htm");

            if (File.Exists(helpFile))
            {
                this.helpWebBrowser.Url = new Uri(helpFile);
            }
            else
            {
                this.helpWebBrowser.DocumentStream = new MemoryStream(Properties.Resources.help);
            }
            //MessageBox.Show(String.Format("{0} help.htm", Resources.GetString("NoFile")),
            //  Resources.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
        }
Exemplo n.º 11
0
        private void удалитьПалитруStripButton2_Click(object sender, EventArgs e)
        {
            DeletePaletteForm deleteForm = new DeletePaletteForm(userPalettes);

            if (deleteForm.ShowDialog() == DialogResult.OK)
            {
                int index = deleteForm.PaletteIndex;
                if (MessageBox.Show(String.Format("{1}: {0}?",
                                                  userPalettes[index].PaletteName, Resources.GetString("RemovePalette")),
                                    Resources.GetString("Attention"), MessageBoxButtons.YesNo, MessageBoxIcon.Warning) == DialogResult.Yes)
                {
                    this.userPalettes.RemoveAt(index);
                    this.палитраToolStripMenuItem.DropDownItems.RemoveAt(index + 10);
                    this.workDataGridView.Invalidate();
                }
            }
        }
Exemplo n.º 12
0
        void Initialize()
        {
            InitializeComponent();

            #region SET LOCAL STRINGS
            this.добавитьToolStripMenuItem.Text         = Resources.GetString("AddToWorking");
            this.оПрограммеToolStripMenuItem1.Text      = Resources.GetString("About");
            this.копироватьВБуферToolStripMenuItem.Text = Resources.GetString("CopyToBuffer");
            this.файлToolStripMenuItem.Text             = Resources.GetString("File");
            this.оПрограммеToolStripMenuItem.Text       = Resources.GetString("Information");
            this.открытьToolStripMenuItem.Text          = Resources.GetString("Open");
            this.Text = Resources.GetString("StiEditor");
            this.просмотретьToolStripMenuItem.Text          = Resources.GetString("View");
            this.просмотретьСинхронноToolStripMenuItem.Text = Resources.GetString("ViewSynchronously");
            this.помощьToolStripMenuItem.Text = Resources.GetString("Help");
            this.добавитьВПроигрывательToolStripMenuItem.Text = Resources.GetString("AddToPlayer");
            #endregion
        }
Exemplo n.º 13
0
        public Foreshortening(List <ExtendedBitmap> movie)
        {
            Initialize();

            this.count = movie.Count;
            this.movie = movie;

            if (count % 8 == 0)
            {
                this.numericUpDown1.Value             = this.numericUpDown2.Value =
                    this.numericUpDown3.Value         = this.numericUpDown4.Value =
                        this.numericUpDown5.Value     = this.numericUpDown6.Value =
                            this.numericUpDown7.Value = this.numericUpDown8.Value = count / 8;
                this.numericUpDown9.Value             = 8;
            }
            else if (count % 6 == 0)
            {
                this.numericUpDown1.Value         = this.numericUpDown2.Value =
                    this.numericUpDown3.Value     = this.numericUpDown4.Value =
                        this.numericUpDown5.Value = this.numericUpDown6.Value = count / 6;
                this.numericUpDown9.Value         = 6;
            }
            else if (count % 4 == 0)
            {
                this.numericUpDown1.Value     = this.numericUpDown2.Value =
                    this.numericUpDown3.Value = this.numericUpDown4.Value = count / 4;
                this.numericUpDown9.Value     = 4;
            }
            else if (count % 2 == 0)
            {
                this.numericUpDown1.Value = this.numericUpDown2.Value = count / 2;
                this.numericUpDown9.Value = 2;
            }
            else
            {
                this.numericUpDown1.Value = count;
                this.numericUpDown9.Value = 1;
            }

            this.label1.Text = String.Format("{5}: {0},  {4}: {1},  {3}: {2}.",
                                             sum, count, sum - count, Resources.GetString("Difference"),
                                             Resources.GetString("InTotalFrames"), Resources.GetString("SumForeshortenings"));
        }
Exemplo n.º 14
0
        void Initialize()
        {
            InitializeComponent();

            #region SET LOCAL STRINGS
            this.label4.Text = Resources.GetString("Displacement");
            this.label3.Text = Resources.GetString("Displacement");
            this.загрузитьToolStripMenuItem.Text = Resources.GetString("Load");
            this.label5.Text = Resources.GetString("Number");
            this.label1.Text = Resources.GetString("Number");
            this.сохранитьСмещенияButton3.Text = Resources.GetString("SaveDisplacement");
            this.label6.Text  = Resources.GetString("Scale");
            this.label2.Text  = Resources.GetString("Scale");
            this.button1.Text = Resources.GetString("Start");
            this.button2.Text = Resources.GetString("Stop");
            this.фонToolStripMenuItem.Text              = Resources.GetString("Background");
            this.chbForAllFrames.Text                   = Resources.GetString("ForAllFrames");
            this.настройкиToolStripMenuItem.Text        = Resources.GetString("Settings");
            this.отрисовыватьТайлToolStripMenuItem.Text = Resources.GetString("DrawTile");
            this.прозрачностьToolStripMenuItem.Text     = Resources.GetString("TransparentBackground");
            this.прозрачностьТеньToolStripMenuItem.Text = Resources.GetString("TransparentShadow");
            #endregion
        }
Exemplo n.º 15
0
        public EditorMainForm(string cultureInfo)
        {
            Initialize();

            if (cultureInfo != null && cultureInfo != "")
            {
                EditorMainForm.configExists = false;
                EditorMainForm.config.AppSettings.Settings.Remove("cultureInfo");
                EditorMainForm.config.AppSettings.Settings.Add("cultureInfo", cultureInfo);
            }

            string rootDir = null;

            if (File.Exists("dotNetStiEditor.exe.config"))
            {
                rootDir = ConfigurationManager.AppSettings.Get("RootDir");
            }
            if (rootDir == null || !Directory.Exists(rootDir))
            {
                EditorMainForm.configExists = false;
                if (this.folderBrowserDialog1.ShowDialog() == DialogResult.OK)
                {
                    rootDir = this.folderBrowserDialog1.SelectedPath;
                    EditorMainForm.config.AppSettings.Settings.Remove("RootDir");
                    EditorMainForm.config.AppSettings.Settings.Add("RootDir", rootDir);
                }
            }
            if (rootDir == null)
            {
                rootDir = Application.StartupPath;
            }
            this.browser   = new Browser(this, Directory.CreateDirectory(rootDir));
            this.workSpace = new WorkSpace(this);
            this.player    = new Player(workSpace);

            if (File.Exists(Path.Combine(Application.StartupPath, "Layout.user.config")))
            {
                dockManager = new DockContentManager(this.panel, this, true,
                                                     delegate
                {
                    return(Assembly.GetAssembly
                               (this.GetType()).GetManifestResourceStream(this.GetType(), "Layout.user.config"));
                }
                                                     );
            }
            else
            {
                dockManager = new DockContentManager(this.panel, this, true,
                                                     delegate { return(new MemoryStream(Properties.Resources.Layout_user)); });
            }


            dockManager.AddControl(this.libDataGridView, "libDataGridView", Resources.GetString("Library"));
            dockManager.AddControl(this.browser, "browser", Resources.GetString("Files"));
            dockManager.AddControl(this.workSpace, "workSpace", Resources.GetString("WorkingArea"));
            player.Dock = DockStyle.Fill;
            dockManager.AddControl(this.player, "player", Resources.GetString("Player"));
            dockManager.AddControl(this.dataGridView3, "dataGridView3", Resources.GetString("Info"));
            dockManager.AddControl(this.dataGridView4, "dataGridView4", Resources.GetString("Info2"));

            this.menuStrip1.Items.Add(dockManager.GenerateMenu(Resources.GetString("Windows"),
                                                               Resources.GetString("ShowAll"), Resources.GetString("Lock"), Resources.GetString("DefaultPosition")));
        }
Exemplo n.º 16
0
        private List <ExtendedBitmap> getImageList(string fileName, int foreshorting)
        {
            if (fileName.EndsWith(".sti", StringComparison.InvariantCultureIgnoreCase))
            {
                StciData stciData = new StciData(fileName, 0);
                infoData.Add(stciData);
                List <ExtendedBitmap> bm = new List <ExtendedBitmap>();
                if (stciData._Indexed != null)
                {
                    try
                    {
                        ETRLEData data = IndexedConverter.LoadIndexedImageData(stciData);
                        bm = IndexedConverter.ConvertEtrleDataToBitmaps(data, foreshorting);
                        infoEtrleData.Add(data);
                    }
                    catch (Exception exc)
                    {
                        MessageBox.Show(String.Format("{3} {0}/n{1}/n{2}",
                                                      fileName, exc.Message, exc.StackTrace, Resources.GetString("LoadingError")));
                    }
                }
                else
                {
                    ExtendedBitmap exBm = RGBConverter.GetBitmap(stciData);
                    exBm.ApplicationData = null;
                    bm.Add(exBm);
                }
                return(bm);
            }
            else if (fileName.EndsWith(".tif", StringComparison.InvariantCultureIgnoreCase))
            {
                List <Bitmap> bitmaps = TIFF.ConvertTiffToBitmaps(fileName);
                return(bitmaps.ConvertAll <ExtendedBitmap>(
                           delegate(Bitmap bm) { return new ExtendedBitmap(bm, 0, 0); }));
            }
            else if (fileName.EndsWith(".gif", StringComparison.InvariantCultureIgnoreCase))
            {
                List <ExtendedBitmap> result = new List <ExtendedBitmap>();
                try
                {
                    bool containsLocalPalette;
                    result = GIF.ConvertGifToBitmaps(fileName, 0, out containsLocalPalette);
                    if (containsLocalPalette)
                    {
                        MessageBox.Show(Resources.GetString("FileContainsLocaPalettes"),
                                        Resources.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
                catch (Exception exc)
                {
                    MessageBox.Show(exc.Message,                     //Resources.GetString("FileContainsLocaPalettes"),
                                    Resources.GetString("Attention"), MessageBoxButtons.OK, MessageBoxIcon.Warning);
                }

                return(result);
            }
            else if (fileName.EndsWith(".bmp", StringComparison.InvariantCultureIgnoreCase))
            {
                List <ExtendedBitmap> result = new List <ExtendedBitmap>();
                Bitmap bm = new Bitmap(fileName);
                result.Add(new ExtendedBitmap(bm, 0, 0));
                return(result);
            }
            else if (fileName.EndsWith(".pcx", StringComparison.InvariantCultureIgnoreCase))
            {
                List <ExtendedBitmap> result = new List <ExtendedBitmap>();
                Bitmap bm = new Bitmap(fileName);
                result.Add(new ExtendedBitmap(bm, 0, 0));
                return(result);
            }
            else
            {
                return(null);
            }
        }