From 2db332c8ad3dff265ab209a1ff727f30be4dbd20 Mon Sep 17 00:00:00 2001 From: Ian C Date: Mon, 1 Aug 2005 23:46:42 +0000 Subject: Initial working version --- GfxEditor.cs | 696 ++++++++++++++++++++++++++++++++++------------------------- 1 file changed, 398 insertions(+), 298 deletions(-) (limited to 'GfxEditor.cs') diff --git a/GfxEditor.cs b/GfxEditor.cs index c564a52..604f00e 100644 --- a/GfxEditor.cs +++ b/GfxEditor.cs @@ -33,41 +33,69 @@ namespace BitmapSpriteEd [ToolboxItem(true)] public class GfxEditor : System.Windows.Forms.UserControl { + private System.Windows.Forms.Label m_backCol; + private System.Windows.Forms.Label label5; private System.Windows.Forms.Label m_fgPreview; - private System.Windows.Forms.ComboBox m_modeList; - private System.Windows.Forms.Label m_recent8; - private System.Windows.Forms.Label m_recent1; - private System.Windows.Forms.Label label11; - private System.Windows.Forms.Label m_recent3; - private System.Windows.Forms.Label m_recent5; - private System.Windows.Forms.Label m_recent6; - private System.Windows.Forms.Label m_recent7; - private System.Windows.Forms.Label m_bgPreview; - private System.Windows.Forms.Label m_recent2; private System.Windows.Forms.ComboBox m_sizeY; - private System.Windows.Forms.CheckBox m_mark; - private System.Windows.Forms.PictureBox m_preview; - private System.Windows.Forms.Label m_gridCol; - private System.Windows.Forms.PictureBox m_edit; - private System.Windows.Forms.Label label12; - private System.Windows.Forms.Label label13; - private System.Windows.Forms.Label m_pos; - private System.Windows.Forms.Label m_recent4; - private System.Windows.Forms.Label label14; - private System.Windows.Forms.Label label15; - private System.Windows.Forms.Button m_undoButton; + private System.Windows.Forms.ComboBox m_sizeX; + private System.Windows.Forms.Button m_manipButton; private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label2; private System.Windows.Forms.Label label1; - private System.Windows.Forms.ComboBox m_sizeX; private System.Windows.Forms.Label label7; private System.Windows.Forms.Label label6; - private System.Windows.Forms.Label label5; + private System.Windows.Forms.PictureBox m_edit; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label m_backCol; + private System.Windows.Forms.Label m_recent8; + private System.Windows.Forms.Label m_recent7; + private System.Windows.Forms.Label m_recent4; + private System.Windows.Forms.Label m_recent5; + private System.Windows.Forms.Label m_recent6; + private System.Windows.Forms.Label label11; + private System.Windows.Forms.CheckBox m_mark; + private System.Windows.Forms.Label m_recent1; + private System.Windows.Forms.Label m_recent2; + private System.Windows.Forms.Label m_recent3; + private System.Windows.Forms.Label label13; + private System.Windows.Forms.Label label14; + private System.Windows.Forms.Label label12; + private System.Windows.Forms.Button m_undoButton; + private System.Windows.Forms.Label label15; + private System.Windows.Forms.Label m_gridCol; + private System.Windows.Forms.PictureBox m_preview; + private System.Windows.Forms.Label m_bgPreview; + private System.Windows.Forms.ComboBox m_modeList; + private System.Windows.Forms.Label m_pos; public const int MAX_SIZE=32; + public class FrameResizeEventArgs : EventArgs + { + public FrameResizeEventArgs(int width, int height) + { + m_width=width; + m_height=height; + } + + public int Width {get {return m_width;}} + public int Height {get {return m_height;}} + + private int m_width; + private int m_height; + } + + public delegate void FrameResizeEventHandler(object sender, FrameResizeEventArgs e); + + public event FrameResizeEventHandler FrameResize; + + protected virtual void OnFrameResize(FrameResizeEventArgs e) + { + if (FrameResize!=null) + { + FrameResize(this,e); + } + } + private const int SIZE=256; private Color TRANS=Color.Empty; @@ -89,35 +117,37 @@ namespace BitmapSpriteEd //private bool m_inEditor; - private Frame m_char; - private Frame m_undo; - private int m_width; - private int m_height; + private Frame m_char; + private Frame m_undo; + private int m_width; + private int m_height; + + private Rectangle m_editRect; + private Bitmap m_editBmp; + private Rectangle m_prevRect; + private Bitmap m_prevBmp; - private Rectangle m_editRect; - private Bitmap m_editBmp; - private Rectangle m_prevRect; - private Bitmap m_prevBmp; + private int m_grid; + private int m_mx; + private int m_my; - private int m_grid; - private int m_mx; - private int m_my; + private bool m_drawing; + private Mode m_mode; + private Color[,] m_overlay; + private int m_ox; + private int m_oy; + private Color m_pen; - private bool m_drawing; - private Mode m_mode; - private Color[,] m_overlay; - private int m_ox; - private int m_oy; - private Color m_pen; + private CopyMenu m_cpMenu; + private int m_cpX; + private int m_cpY; + private int m_cpWidth; + private int m_cpHeight; + private Color[,] m_cpBuff; - private CopyMenu m_cpMenu; - private int m_cpX; - private int m_cpY; - private int m_cpWidth; - private int m_cpHeight; - private Color[,] m_cpBuff; + private ManipulationMenu m_manipMenu; - private Label[] m_recent; + private Label[] m_recent; public GfxEditor() { @@ -155,6 +185,7 @@ namespace BitmapSpriteEd m_modeList.SelectedIndex=0; m_cpMenu=new CopyMenu(); + m_manipMenu=new ManipulationMenu(); m_recent=new Label[] {m_recent1,m_recent2,m_recent3,m_recent4, @@ -168,126 +199,104 @@ namespace BitmapSpriteEd /// not be able to load this method if it was changed manually. /// private void InitializeComponent() { - this.m_backCol = new System.Windows.Forms.Label(); - this.label4 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.label6 = new System.Windows.Forms.Label(); - this.label7 = new System.Windows.Forms.Label(); - this.m_sizeX = new System.Windows.Forms.ComboBox(); - this.label1 = new System.Windows.Forms.Label(); - this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); - this.m_undoButton = new System.Windows.Forms.Button(); + this.m_pos = new System.Windows.Forms.Label(); + this.m_modeList = new System.Windows.Forms.ComboBox(); + this.m_bgPreview = new System.Windows.Forms.Label(); + this.m_preview = new System.Windows.Forms.PictureBox(); + this.m_gridCol = new System.Windows.Forms.Label(); this.label15 = new System.Windows.Forms.Label(); + this.m_undoButton = new System.Windows.Forms.Button(); + this.label12 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); - this.m_recent4 = new System.Windows.Forms.Label(); - this.m_pos = new System.Windows.Forms.Label(); this.label13 = new System.Windows.Forms.Label(); - this.label12 = new System.Windows.Forms.Label(); - this.m_edit = new System.Windows.Forms.PictureBox(); - this.m_gridCol = new System.Windows.Forms.Label(); - this.m_preview = new System.Windows.Forms.PictureBox(); - this.m_mark = new System.Windows.Forms.CheckBox(); - this.m_sizeY = new System.Windows.Forms.ComboBox(); + this.m_recent3 = new System.Windows.Forms.Label(); this.m_recent2 = new System.Windows.Forms.Label(); - this.m_bgPreview = new System.Windows.Forms.Label(); - this.m_recent7 = new System.Windows.Forms.Label(); + this.m_recent1 = new System.Windows.Forms.Label(); + this.m_mark = new System.Windows.Forms.CheckBox(); + this.label11 = new System.Windows.Forms.Label(); this.m_recent6 = new System.Windows.Forms.Label(); this.m_recent5 = new System.Windows.Forms.Label(); - this.m_recent3 = new System.Windows.Forms.Label(); - this.label11 = new System.Windows.Forms.Label(); - this.m_recent1 = new System.Windows.Forms.Label(); + this.m_recent4 = new System.Windows.Forms.Label(); + this.m_recent7 = new System.Windows.Forms.Label(); this.m_recent8 = new System.Windows.Forms.Label(); - this.m_modeList = new System.Windows.Forms.ComboBox(); + this.label4 = new System.Windows.Forms.Label(); + this.m_edit = new System.Windows.Forms.PictureBox(); + this.label6 = new System.Windows.Forms.Label(); + this.label7 = new System.Windows.Forms.Label(); + this.label1 = new System.Windows.Forms.Label(); + this.label2 = new System.Windows.Forms.Label(); + this.label3 = new System.Windows.Forms.Label(); + this.m_manipButton = new System.Windows.Forms.Button(); + this.m_sizeX = new System.Windows.Forms.ComboBox(); + this.m_sizeY = new System.Windows.Forms.ComboBox(); this.m_fgPreview = new System.Windows.Forms.Label(); + this.label5 = new System.Windows.Forms.Label(); + this.m_backCol = new System.Windows.Forms.Label(); this.SuspendLayout(); // - // m_backCol - // - this.m_backCol.BackColor = System.Drawing.Color.Black; - this.m_backCol.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_backCol.Location = new System.Drawing.Point(168, 272); - this.m_backCol.Name = "m_backCol"; - this.m_backCol.Size = new System.Drawing.Size(24, 24); - this.m_backCol.TabIndex = 34; - this.m_backCol.Click += new System.EventHandler(this.OnPaper); - // - // label4 - // - this.label4.Location = new System.Drawing.Point(280, 88); - this.label4.Name = "label4"; - this.label4.Size = new System.Drawing.Size(32, 16); - this.label4.TabIndex = 10; - this.label4.Text = "Left"; - this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label5 - // - this.label5.Location = new System.Drawing.Point(336, 88); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(40, 16); - this.label5.TabIndex = 12; - this.label5.Text = "Right"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // - // label6 + // m_pos // - this.label6.Location = new System.Drawing.Point(336, 8); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(48, 16); - this.label6.TabIndex = 22; - this.label6.Text = "Height"; - this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_pos.Location = new System.Drawing.Point(208, 272); + this.m_pos.Name = "m_pos"; + this.m_pos.Size = new System.Drawing.Size(56, 24); + this.m_pos.TabIndex = 23; + this.m_pos.TextAlign = System.Drawing.ContentAlignment.TopRight; // - // label7 + // m_modeList // - this.label7.Location = new System.Drawing.Point(280, 232); - this.label7.Name = "label7"; - this.label7.Size = new System.Drawing.Size(88, 16); - this.label7.TabIndex = 24; - this.label7.Text = "Recent Colours"; - this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_modeList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_modeList.Items.AddRange(new object[] { + "Plot", + "Line", + "Rectangle", + "Filled Rect", + "Circle", + "Filled Circle", + "Ellipse", + "Filled Ellipse", + "Flood Fill", + "Copy/Paste"}); + this.m_modeList.Location = new System.Drawing.Point(280, 64); + this.m_modeList.MaxDropDownItems = 16; + this.m_modeList.Name = "m_modeList"; + this.m_modeList.Size = new System.Drawing.Size(104, 21); + this.m_modeList.TabIndex = 15; + this.m_modeList.SelectedIndexChanged += new System.EventHandler(this.OnModeSelect); // - // m_sizeX + // m_bgPreview // - this.m_sizeX.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.m_sizeX.Enabled = false; - this.m_sizeX.Items.AddRange(new object[] { - "8", - "16", - "32"}); - this.m_sizeX.Location = new System.Drawing.Point(280, 24); - this.m_sizeX.Name = "m_sizeX"; - this.m_sizeX.Size = new System.Drawing.Size(48, 21); - this.m_sizeX.TabIndex = 36; - this.m_sizeX.SelectedIndexChanged += new System.EventHandler(this.OnSizeWidth); + this.m_bgPreview.BackColor = System.Drawing.Color.Transparent; + this.m_bgPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_bgPreview.Location = new System.Drawing.Point(336, 104); + this.m_bgPreview.Name = "m_bgPreview"; + this.m_bgPreview.Size = new System.Drawing.Size(40, 32); + this.m_bgPreview.TabIndex = 18; + this.m_bgPreview.Click += new System.EventHandler(this.OnBackground); // - // label1 + // m_preview // - this.label1.Location = new System.Drawing.Point(280, 48); - this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(64, 16); - this.label1.TabIndex = 3; - this.label1.Text = "Draw Mode"; - this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_preview.BackColor = System.Drawing.SystemColors.Control; + this.m_preview.Location = new System.Drawing.Point(288, 192); + this.m_preview.Name = "m_preview"; + this.m_preview.Size = new System.Drawing.Size(34, 34); + this.m_preview.TabIndex = 1; + this.m_preview.TabStop = false; // - // label2 + // m_gridCol // - this.label2.Location = new System.Drawing.Point(280, 168); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(56, 16); - this.label2.TabIndex = 21; - this.label2.Text = "Preview"; - this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.m_gridCol.BackColor = System.Drawing.Color.Lime; + this.m_gridCol.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_gridCol.Location = new System.Drawing.Point(136, 272); + this.m_gridCol.Name = "m_gridCol"; + this.m_gridCol.Size = new System.Drawing.Size(24, 24); + this.m_gridCol.TabIndex = 33; + this.m_gridCol.Click += new System.EventHandler(this.OnGrid); // - // label3 + // label15 // - this.label3.Location = new System.Drawing.Point(280, 8); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(48, 16); - this.label3.TabIndex = 8; - this.label3.Text = "Width"; - this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.label15.Location = new System.Drawing.Point(0, 0); + this.label15.Name = "label15"; + this.label15.TabIndex = 0; // // m_undoButton // @@ -298,11 +307,13 @@ namespace BitmapSpriteEd this.m_undoButton.Text = "Undo"; this.m_undoButton.Click += new System.EventHandler(this.OnUndo); // - // label15 + // label12 // - this.label15.Location = new System.Drawing.Point(0, 0); - this.label15.Name = "label15"; - this.label15.TabIndex = 0; + this.label12.BackColor = System.Drawing.Color.White; + this.label12.Location = new System.Drawing.Point(200, 144); + this.label12.Name = "label12"; + this.label12.Size = new System.Drawing.Size(16, 16); + this.label12.TabIndex = 31; // // label14 // @@ -312,97 +323,23 @@ namespace BitmapSpriteEd this.label14.Size = new System.Drawing.Size(16, 16); this.label14.TabIndex = 29; // - // m_recent4 - // - this.m_recent4.BackColor = System.Drawing.Color.Black; - this.m_recent4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_recent4.Location = new System.Drawing.Point(352, 248); - this.m_recent4.Name = "m_recent4"; - this.m_recent4.Size = new System.Drawing.Size(16, 16); - this.m_recent4.TabIndex = 28; - this.m_recent4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); - // - // m_pos - // - this.m_pos.Location = new System.Drawing.Point(208, 272); - this.m_pos.Name = "m_pos"; - this.m_pos.Size = new System.Drawing.Size(56, 24); - this.m_pos.TabIndex = 23; - this.m_pos.TextAlign = System.Drawing.ContentAlignment.TopRight; - // // label13 // this.label13.BackColor = System.Drawing.Color.White; this.label13.Location = new System.Drawing.Point(176, 144); this.label13.Name = "label13"; this.label13.Size = new System.Drawing.Size(16, 16); - this.label13.TabIndex = 30; - // - // label12 - // - this.label12.BackColor = System.Drawing.Color.White; - this.label12.Location = new System.Drawing.Point(200, 144); - this.label12.Name = "label12"; - this.label12.Size = new System.Drawing.Size(16, 16); - this.label12.TabIndex = 31; - // - // m_edit - // - this.m_edit.BackColor = System.Drawing.SystemColors.Control; - this.m_edit.Location = new System.Drawing.Point(8, 8); - this.m_edit.Name = "m_edit"; - this.m_edit.Size = new System.Drawing.Size(256, 256); - this.m_edit.TabIndex = 0; - this.m_edit.TabStop = false; - this.m_edit.MouseEnter += new System.EventHandler(this.OnEnterEditor); - this.m_edit.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); - this.m_edit.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); - this.m_edit.MouseLeave += new System.EventHandler(this.OnLeaveEditor); - this.m_edit.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); - // - // m_gridCol - // - this.m_gridCol.BackColor = System.Drawing.Color.Lime; - this.m_gridCol.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_gridCol.Location = new System.Drawing.Point(136, 272); - this.m_gridCol.Name = "m_gridCol"; - this.m_gridCol.Size = new System.Drawing.Size(24, 24); - this.m_gridCol.TabIndex = 33; - this.m_gridCol.Click += new System.EventHandler(this.OnGrid); - // - // m_preview - // - this.m_preview.BackColor = System.Drawing.SystemColors.Control; - this.m_preview.Location = new System.Drawing.Point(288, 192); - this.m_preview.Name = "m_preview"; - this.m_preview.Size = new System.Drawing.Size(34, 34); - this.m_preview.TabIndex = 1; - this.m_preview.TabStop = false; - // - // m_mark - // - this.m_mark.Checked = true; - this.m_mark.CheckState = System.Windows.Forms.CheckState.Checked; - this.m_mark.Location = new System.Drawing.Point(280, 136); - this.m_mark.Name = "m_mark"; - this.m_mark.Size = new System.Drawing.Size(96, 32); - this.m_mark.TabIndex = 35; - this.m_mark.Text = "Highlight Dark Colours"; - this.m_mark.CheckedChanged += new System.EventHandler(this.OnMark); - // - // m_sizeY - // - this.m_sizeY.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.m_sizeY.Enabled = false; - this.m_sizeY.Items.AddRange(new object[] { - "8", - "16", - "32"}); - this.m_sizeY.Location = new System.Drawing.Point(336, 24); - this.m_sizeY.Name = "m_sizeY"; - this.m_sizeY.Size = new System.Drawing.Size(48, 21); - this.m_sizeY.TabIndex = 37; - this.m_sizeY.SelectedIndexChanged += new System.EventHandler(this.OnSizeHeight); + this.label13.TabIndex = 30; + // + // m_recent3 + // + this.m_recent3.BackColor = System.Drawing.Color.Black; + this.m_recent3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_recent3.Location = new System.Drawing.Point(328, 248); + this.m_recent3.Name = "m_recent3"; + this.m_recent3.Size = new System.Drawing.Size(16, 16); + this.m_recent3.TabIndex = 27; + this.m_recent3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // // m_recent2 // @@ -414,25 +351,34 @@ namespace BitmapSpriteEd this.m_recent2.TabIndex = 26; this.m_recent2.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_bgPreview + // m_recent1 // - this.m_bgPreview.BackColor = System.Drawing.Color.Transparent; - this.m_bgPreview.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_bgPreview.Location = new System.Drawing.Point(336, 104); - this.m_bgPreview.Name = "m_bgPreview"; - this.m_bgPreview.Size = new System.Drawing.Size(40, 32); - this.m_bgPreview.TabIndex = 18; - this.m_bgPreview.Click += new System.EventHandler(this.OnBackground); + this.m_recent1.BackColor = System.Drawing.Color.White; + this.m_recent1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_recent1.Location = new System.Drawing.Point(280, 248); + this.m_recent1.Name = "m_recent1"; + this.m_recent1.Size = new System.Drawing.Size(16, 16); + this.m_recent1.TabIndex = 25; + this.m_recent1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_recent7 + // m_mark // - this.m_recent7.BackColor = System.Drawing.Color.Black; - this.m_recent7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_recent7.Location = new System.Drawing.Point(328, 272); - this.m_recent7.Name = "m_recent7"; - this.m_recent7.Size = new System.Drawing.Size(16, 16); - this.m_recent7.TabIndex = 31; - this.m_recent7.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); + this.m_mark.Checked = true; + this.m_mark.CheckState = System.Windows.Forms.CheckState.Checked; + this.m_mark.Location = new System.Drawing.Point(280, 136); + this.m_mark.Name = "m_mark"; + this.m_mark.Size = new System.Drawing.Size(96, 32); + this.m_mark.TabIndex = 35; + this.m_mark.Text = "Highlight Dark Colours"; + this.m_mark.CheckedChanged += new System.EventHandler(this.OnMark); + // + // label11 + // + this.label11.BackColor = System.Drawing.Color.White; + this.label11.Location = new System.Drawing.Point(224, 144); + this.label11.Name = "label11"; + this.label11.Size = new System.Drawing.Size(16, 16); + this.label11.TabIndex = 32; // // m_recent6 // @@ -454,33 +400,25 @@ namespace BitmapSpriteEd this.m_recent5.TabIndex = 29; this.m_recent5.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_recent3 - // - this.m_recent3.BackColor = System.Drawing.Color.Black; - this.m_recent3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_recent3.Location = new System.Drawing.Point(328, 248); - this.m_recent3.Name = "m_recent3"; - this.m_recent3.Size = new System.Drawing.Size(16, 16); - this.m_recent3.TabIndex = 27; - this.m_recent3.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); - // - // label11 + // m_recent4 // - this.label11.BackColor = System.Drawing.Color.White; - this.label11.Location = new System.Drawing.Point(224, 144); - this.label11.Name = "label11"; - this.label11.Size = new System.Drawing.Size(16, 16); - this.label11.TabIndex = 32; + this.m_recent4.BackColor = System.Drawing.Color.Black; + this.m_recent4.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_recent4.Location = new System.Drawing.Point(352, 248); + this.m_recent4.Name = "m_recent4"; + this.m_recent4.Size = new System.Drawing.Size(16, 16); + this.m_recent4.TabIndex = 28; + this.m_recent4.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_recent1 + // m_recent7 // - this.m_recent1.BackColor = System.Drawing.Color.White; - this.m_recent1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_recent1.Location = new System.Drawing.Point(280, 248); - this.m_recent1.Name = "m_recent1"; - this.m_recent1.Size = new System.Drawing.Size(16, 16); - this.m_recent1.TabIndex = 25; - this.m_recent1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); + this.m_recent7.BackColor = System.Drawing.Color.Black; + this.m_recent7.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_recent7.Location = new System.Drawing.Point(328, 272); + this.m_recent7.Name = "m_recent7"; + this.m_recent7.Size = new System.Drawing.Size(16, 16); + this.m_recent7.TabIndex = 31; + this.m_recent7.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // // m_recent8 // @@ -492,26 +430,111 @@ namespace BitmapSpriteEd this.m_recent8.TabIndex = 32; this.m_recent8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_modeList + // label4 // - this.m_modeList.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.m_modeList.Items.AddRange(new object[] { - "Plot", - "Line", - "Rectangle", - "Filled Rect", - "Circle", - "Filled Circle", - "Ellipse", - "Filled Ellipse", - "Flood Fill", - "Copy/Paste"}); - this.m_modeList.Location = new System.Drawing.Point(280, 64); - this.m_modeList.MaxDropDownItems = 16; - this.m_modeList.Name = "m_modeList"; - this.m_modeList.Size = new System.Drawing.Size(104, 21); - this.m_modeList.TabIndex = 15; - this.m_modeList.SelectedIndexChanged += new System.EventHandler(this.OnModeSelect); + this.label4.Location = new System.Drawing.Point(280, 88); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(32, 16); + this.label4.TabIndex = 10; + this.label4.Text = "Left"; + this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // m_edit + // + this.m_edit.BackColor = System.Drawing.SystemColors.Control; + this.m_edit.Location = new System.Drawing.Point(8, 8); + this.m_edit.Name = "m_edit"; + this.m_edit.Size = new System.Drawing.Size(256, 256); + this.m_edit.TabIndex = 0; + this.m_edit.TabStop = false; + this.m_edit.MouseEnter += new System.EventHandler(this.OnEnterEditor); + this.m_edit.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); + this.m_edit.MouseMove += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); + this.m_edit.MouseLeave += new System.EventHandler(this.OnLeaveEditor); + this.m_edit.MouseDown += new System.Windows.Forms.MouseEventHandler(this.OnMouseMove); + // + // label6 + // + this.label6.Location = new System.Drawing.Point(336, 8); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(48, 16); + this.label6.TabIndex = 22; + this.label6.Text = "Height"; + this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label7 + // + this.label7.Location = new System.Drawing.Point(280, 232); + this.label7.Name = "label7"; + this.label7.Size = new System.Drawing.Size(88, 16); + this.label7.TabIndex = 24; + this.label7.Text = "Recent Colours"; + this.label7.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label1 + // + this.label1.Location = new System.Drawing.Point(280, 48); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(64, 16); + this.label1.TabIndex = 3; + this.label1.Text = "Draw Mode"; + this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label2 + // + this.label2.Location = new System.Drawing.Point(280, 168); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(56, 16); + this.label2.TabIndex = 21; + this.label2.Text = "Preview"; + this.label2.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // label3 + // + this.label3.Location = new System.Drawing.Point(280, 8); + this.label3.Name = "label3"; + this.label3.Size = new System.Drawing.Size(48, 16); + this.label3.TabIndex = 8; + this.label3.Text = "Width"; + this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // m_manipButton + // + this.m_manipButton.Enabled = false; + this.m_manipButton.Location = new System.Drawing.Point(336, 184); + this.m_manipButton.Name = "m_manipButton"; + this.m_manipButton.Size = new System.Drawing.Size(48, 24); + this.m_manipButton.TabIndex = 38; + this.m_manipButton.Text = "Manip"; + this.m_manipButton.Click += new System.EventHandler(this.OnManip); + // + // m_sizeX + // + this.m_sizeX.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_sizeX.Enabled = false; + this.m_sizeX.Items.AddRange(new object[] { + "8", + "16", + "32"}); + this.m_sizeX.Location = new System.Drawing.Point(280, 24); + this.m_sizeX.Name = "m_sizeX"; + this.m_sizeX.Size = new System.Drawing.Size(48, 21); + this.m_sizeX.TabIndex = 36; + this.m_sizeX.SelectedIndexChanged += new System.EventHandler(this.OnSizeWidth); + // + // m_sizeY + // + this.m_sizeY.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.m_sizeY.Enabled = false; + this.m_sizeY.Items.AddRange(new object[] { + "8", + "16", + "32"}); + this.m_sizeY.Location = new System.Drawing.Point(336, 24); + this.m_sizeY.Name = "m_sizeY"; + this.m_sizeY.Size = new System.Drawing.Size(48, 21); + this.m_sizeY.TabIndex = 37; + this.m_sizeY.SelectedIndexChanged += new System.EventHandler(this.OnSizeHeight); // // m_fgPreview // @@ -523,8 +546,28 @@ namespace BitmapSpriteEd this.m_fgPreview.TabIndex = 17; this.m_fgPreview.Click += new System.EventHandler(this.OnForeground); // + // label5 + // + this.label5.Location = new System.Drawing.Point(336, 88); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(40, 16); + this.label5.TabIndex = 12; + this.label5.Text = "Right"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + // + // m_backCol + // + this.m_backCol.BackColor = System.Drawing.Color.Black; + this.m_backCol.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_backCol.Location = new System.Drawing.Point(168, 272); + this.m_backCol.Name = "m_backCol"; + this.m_backCol.Size = new System.Drawing.Size(24, 24); + this.m_backCol.TabIndex = 34; + this.m_backCol.Click += new System.EventHandler(this.OnPaper); + // // GfxEditor // + this.Controls.Add(this.m_manipButton); this.Controls.Add(this.m_sizeY); this.Controls.Add(this.m_sizeX); this.Controls.Add(this.m_mark); @@ -580,6 +623,7 @@ namespace BitmapSpriteEd { m_char=value; SetUndo(null); + m_manipButton.Enabled=true; m_width=m_char.Width; m_height=m_char.Height; m_sizeX.Enabled=true; @@ -1078,6 +1122,8 @@ namespace BitmapSpriteEd DrawGrid(); DrawChar(); + + OnFrameResize(new FrameResizeEventArgs(m_width,m_height)); } void OnSizeHeight(object sender, System.EventArgs e) @@ -1098,6 +1144,8 @@ namespace BitmapSpriteEd DrawGrid(); DrawChar(); + + OnFrameResize(new FrameResizeEventArgs(m_width,m_height)); } void OnEnterEditor(object sender, System.EventArgs e) @@ -1132,9 +1180,9 @@ namespace BitmapSpriteEd { if (m_undo!=null) { - Frame s=m_char; - m_char=m_undo; - m_undo=s; + Frame u=new Frame(m_char); + m_char.CopyFrom(m_undo); + m_undo=u; DrawChar(); } } @@ -1393,6 +1441,58 @@ namespace BitmapSpriteEd RedrawChar(); } + void OnManip(object sender, System.EventArgs e) + { + Control c=(Control)sender; + bool redraw=true; + + m_manipMenu.Show(c,c.Width,c.Height/2); + + switch(m_manipMenu.Mode) + { + case ManipulationMenu.EMode.eMirrorHorizontal: + m_char.MirrorHorizontal(); + break; + + case ManipulationMenu.EMode.eMirrorVertical: + m_char.MirrorVertical(); + break; + + case ManipulationMenu.EMode.eRotateLeft: + m_char.RotateLeft(); + break; + + case ManipulationMenu.EMode.eRotateRight: + m_char.RotateRight(); + break; + + case ManipulationMenu.EMode.eScrollUp: + m_char.Scroll(0,-1); + break; + + case ManipulationMenu.EMode.eScrollDown: + m_char.Scroll(0,1); + break; + + case ManipulationMenu.EMode.eScrollLeft: + m_char.Scroll(-1,0); + break; + + case ManipulationMenu.EMode.eScrollRight: + m_char.Scroll(1,0); + break; + + case ManipulationMenu.EMode.eNothing: + redraw=false; + break; + } + + if (redraw) + { + RedrawChar(); + } + } + #endregion } } -- cgit v1.2.3