// ------------------------------------------------------------------- // InitializeParameters // ------------------------------------------------------------------- public void InitializeParameters(SystemGraphic graphic, Type type = null, OptionsKind optionsKind = OptionsKind.None, SystemGraphic graphicTileset = null) { Graphic = graphic; OptionsKind = optionsKind; GraphicTileset = graphicTileset; DialogKind = type == null ? typeof(DialogPreviewGraphic) : type; listBox1.Items[0] = graphic.GraphicName; }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogPreviewGraphicSelectFrame(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset) { OptionsKind = optionsKind; // Picture PictureBox = new TilesetSelectorPicture(); PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; PictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; panelPicture.Controls.Clear(); panelPicture.Controls.Add(PictureBox); // Options GrowLabel label = new GrowLabel(); label.Dock = DockStyle.Fill; switch (optionsKind) { case OptionsKind.CharacterSelection: label.Text = "Select the number of frames and if there are diagonals:"; break; } label.Margin = new Padding(0, 0, 0, 20); tableLayoutPanel4.Controls.Add(label, 0, 2); TableLayoutPanel panelRectangle = new TableLayoutPanel(); panelRectangle.Dock = DockStyle.Fill; panelRectangle.RowCount = 3; panelRectangle.ColumnCount = 2; tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3); Label rectangleLabel = new Label(); rectangleLabel.Text = "Frames:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 0); rectangleLabel = new Label(); rectangleLabel.Text = "Diagonals:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 1); NumericFrames.Minimum = 1; NumericFrames.Maximum = 999; NumericFrames.Value = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Frames]; panelRectangle.Controls.Add(NumericFrames, 1, 0); ComboBoxDialog.DropDownStyle = ComboBoxStyle.DropDownList; ComboBoxDialog.Items.Add("No"); ComboBoxDialog.Items.Add("Yes"); ComboBoxDialog.SelectedIndex = (int)graphic.Options[(int)SystemGraphic.OptionsEnum.Diagonal]; panelRectangle.Controls.Add(ComboBoxDialog, 1, 1); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 63)); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); // Actualize list (delete _act) and adding tileset List <ListViewItem> list = new List <ListViewItem>(); for (int i = 0; i < listView1.Items.Count; i++) { list.Add(listView1.Items[i]); } for (int i = 1; i < list.Count; i++) { string path = Path.GetFileNameWithoutExtension(list[i].Text); if (path.Length - 4 >= 0) { if (path.Substring(path.Length - 4, 4) == "_act") { listView1.Items.Remove(list[i]); } } } listView1.Items.Insert(1, WANOK.TILESET_IMAGE_STRING); // Events PictureBox.MouseEnter += PictureBox_MouseEnter; PictureBox.MouseDown += PictureBox_MouseDown; PictureBox.MouseUp += PictureBox_MouseUp; listView1.SelectedIndexChanged += ListView1_SelectedIndexChanged; NumericFrames.ValueChanged += NumericFrames_ValueChanged; ComboBoxDialog.SelectedIndexChanged += ComboBoxDialog_SelectedIndexChanged; }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogPreviewGraphicSelectRectangle(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) : base(graphic, optionsKind, graphicTileset) { OptionsKind = optionsKind; // Picture PictureBox = new PixelSelectPictureBox(); PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; PictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; panelPicture.Controls.Clear(); panelPicture.Controls.Add(PictureBox); // Options GrowLabel label = new GrowLabel(); label.Dock = DockStyle.Fill; switch (optionsKind) { case OptionsKind.BarSelection: label.Text = "Select the rectangle that represents the filled bar:"; break; } label.Margin = new Padding(0, 0, 0, 20); tableLayoutPanel4.Controls.Add(label, 0, 2); TableLayoutPanel panelRectangle = new TableLayoutPanel(); panelRectangle.Dock = DockStyle.Fill; panelRectangle.RowCount = 5; panelRectangle.ColumnCount = 2; tableLayoutPanel4.Controls.Add(panelRectangle, 0, 3); Label rectangleLabel = new Label(); rectangleLabel.Text = "X:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 0); rectangleLabel = new Label(); rectangleLabel.Text = "Y:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 1); rectangleLabel = new Label(); rectangleLabel.Text = "Width:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 2); rectangleLabel = new Label(); rectangleLabel.Text = "Height:"; rectangleLabel.TextAlign = ContentAlignment.MiddleLeft; panelRectangle.Controls.Add(rectangleLabel, 0, 3); numericButtonX.Minimum = 0; numericButtonY.Minimum = 0; numericButtonWidth.Minimum = 1; numericButtonHeight.Minimum = 1; numericButtonX.Maximum = 32000; numericButtonY.Maximum = 32000; numericButtonWidth.Maximum = 32000; numericButtonHeight.Maximum = 32000; numericButtonX.Value = (int)graphic.Options[0]; numericButtonY.Value = (int)graphic.Options[1]; numericButtonWidth.Value = (int)graphic.Options[2]; numericButtonHeight.Value = (int)graphic.Options[3]; panelRectangle.Controls.Add(numericButtonX, 1, 0); panelRectangle.Controls.Add(numericButtonY, 1, 1); panelRectangle.Controls.Add(numericButtonWidth, 1, 2); panelRectangle.Controls.Add(numericButtonHeight, 1, 3); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Absolute, 50)); panelRectangle.ColumnStyles.Add(new ColumnStyle(SizeType.Percent, 100)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.AutoSize)); panelRectangle.RowStyles.Add(new RowStyle(SizeType.Percent, 100)); // Update image rectangle PictureBox.SelectionRectangle.X = (int)numericButtonX.Value; PictureBox.SelectionRectangle.Y = (int)numericButtonY.Value; PictureBox.SelectionRectangle.Width = (int)numericButtonWidth.Value; PictureBox.SelectionRectangle.Height = (int)numericButtonHeight.Value; PictureBox.Refresh(); // Events PictureBox.MouseEnter += PictureBox_MouseEnter; PictureBox.MouseDown += PictureBox_MouseDown; PictureBox.MouseUp += PictureBox_MouseUp; PictureBox.MouseMove += PictureBox_MouseMove; numericButtonX.ValueChanged += UpdateRectangle; numericButtonY.ValueChanged += UpdateRectangle; numericButtonWidth.ValueChanged += UpdateRectangle; numericButtonHeight.ValueChanged += UpdateRectangle; listView1.SelectedIndexChanged += UpdateRectangle; }
// ------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------- public DialogPreviewGraphic(SystemGraphic graphic, OptionsKind optionsKind, SystemGraphic graphicTileset = null) { InitializeComponent(); GraphicTileset = graphicTileset; // Control Control = new DialogPreviewGraphicControl(graphic.CreateCopy()); Text = graphic.GraphicKind.ToString() + " graphic preview"; // list listView1.Select(); listView1.HeaderStyle = ColumnHeaderStyle.None; ColumnHeader header = new ColumnHeader(); header.Text = ""; header.Name = ""; listView1.Columns.Add(header); listView1.Columns[0].Width = listView1.Size.Width - 4; listView1.Items[0].Selected = true; List <string> LocalFiles = Control.GetLocalFiles(); List <string> RTPFiles = Control.GetRTPFiles(); for (int i = 0; i < LocalFiles.Count; i++) { listView1.Items.Add(Path.GetFileName(LocalFiles[i]), 0); if (!graphic.IsNone() && graphic.GraphicName == listView1.Items[i + 1].Text && !graphic.IsRTP) { listView1.Items[i + 1].Selected = true; } } for (int i = LocalFiles.Count; i < LocalFiles.Count + RTPFiles.Count; i++) { listView1.Items.Add(Path.GetFileName(RTPFiles[i - LocalFiles.Count]), 1); if (!graphic.IsNone() && graphic.GraphicName == listView1.Items[i + 1].Text && graphic.IsRTP) { listView1.Items[i + 1].Selected = true; } } // Picture PictureBox.SizeMode = PictureBoxSizeMode.StretchImage; PictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; PictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; //panelPicture.Controls.Add(PictureBox); TilesetPictureBox.SizeMode = PictureBoxSizeMode.StretchImage; TilesetPictureBox.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor; TilesetPictureBox.LoadTexture(graphicTileset == null ? new SystemGraphic(GraphicKind.Tileset) : graphicTileset, WANOK.RELATION_SIZE); TilesetPictureBox.BackColor = WANOK.COLOR_BACKGROUND_PREVIEW_IMAGE; if (graphic.IsTileset()) { TilesetPictureBox.SetCurrentTexture((int)graphic.Options[0] * WANOK.BASIC_SQUARE_SIZE, (int)graphic.Options[1] * WANOK.BASIC_SQUARE_SIZE, (int)graphic.Options[2], (int)graphic.Options[3]); } else { TilesetPictureBox.SetCurrentTexture(0, 0, 1, 1); } // Zoom trackBarZoom.Minimum = -ZoomTime; trackBarZoom.Maximum = ZoomTime; // Paint groupBox groupBox1.Paint += MainForm.PaintBorderGroupBox; // Events AddEvent(); }