From 33017193d2ca0b7b18e65526f93feb2fe3bfec46 Mon Sep 17 00:00:00 2001 From: Ian C Date: Sat, 21 May 2005 01:28:48 +0000 Subject: Changed so that editing allows alpha to be used. Font import still not working correctly. --- GfxEditor.cs | 217 +++++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 144 insertions(+), 73 deletions(-) (limited to 'GfxEditor.cs') diff --git a/GfxEditor.cs b/GfxEditor.cs index f5f002a..b78155a 100644 --- a/GfxEditor.cs +++ b/GfxEditor.cs @@ -35,7 +35,7 @@ namespace BitmapFontEd { private System.Windows.Forms.Label m_fgPreview; private System.Windows.Forms.ComboBox m_modeList; - private System.Windows.Forms.PictureBox m_edit; + 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_recent4; @@ -44,12 +44,14 @@ namespace BitmapFontEd 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.NumericUpDown m_sizeY; + private System.Windows.Forms.Label m_recent3; private System.Windows.Forms.PictureBox m_preview; + private System.Windows.Forms.NumericUpDown m_sizeY; + 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_recent3; private System.Windows.Forms.Label label14; private System.Windows.Forms.Label label15; private System.Windows.Forms.Button m_undoButton; @@ -61,7 +63,7 @@ namespace BitmapFontEd private System.Windows.Forms.Label label6; private System.Windows.Forms.Label label5; private System.Windows.Forms.Label label4; - private System.Windows.Forms.Label m_recent8; + private System.Windows.Forms.Label m_backCol; public const int MAX_SIZE=32; @@ -99,7 +101,6 @@ namespace BitmapFontEd private uint m_grid; private uint m_mx; private uint m_my; - private Color m_gridCol; private bool m_drawing; private Mode m_mode; @@ -128,10 +129,8 @@ namespace BitmapFontEd m_char=null; m_grid=8; - m_grid=8; m_mx=SIZE; m_my=SIZE; - m_gridCol=Color.LightGreen; m_editRect=m_edit.ClientRectangle; m_editBmp=new Bitmap(m_editRect.Width,m_editRect.Height); @@ -144,6 +143,8 @@ namespace BitmapFontEd m_drawing=false; m_mode=Mode.ePlot; + m_bgPreview.BackColor=Color.FromArgb(0); + if (m_editRect.Width!=SIZE && m_editRect.Height!=SIZE) { throw new Exception("GfxEditor built with bad SIZE!"); @@ -165,7 +166,7 @@ namespace BitmapFontEd /// not be able to load this method if it was changed manually. /// private void InitializeComponent() { - this.m_recent8 = new System.Windows.Forms.Label(); + 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(); @@ -177,12 +178,14 @@ namespace BitmapFontEd this.m_undoButton = new System.Windows.Forms.Button(); this.label15 = new System.Windows.Forms.Label(); this.label14 = new System.Windows.Forms.Label(); - this.m_recent3 = 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_preview = new System.Windows.Forms.PictureBox(); + this.m_edit = new System.Windows.Forms.PictureBox(); + this.m_gridCol = new System.Windows.Forms.Label(); this.m_sizeY = new System.Windows.Forms.NumericUpDown(); + this.m_preview = new System.Windows.Forms.PictureBox(); + 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(); @@ -191,22 +194,22 @@ namespace BitmapFontEd this.m_recent4 = new System.Windows.Forms.Label(); this.label11 = new System.Windows.Forms.Label(); this.m_recent1 = new System.Windows.Forms.Label(); - this.m_edit = new System.Windows.Forms.PictureBox(); + this.m_recent8 = new System.Windows.Forms.Label(); this.m_modeList = new System.Windows.Forms.ComboBox(); this.m_fgPreview = new System.Windows.Forms.Label(); ((System.ComponentModel.ISupportInitialize)(this.m_sizeX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.m_sizeY)).BeginInit(); this.SuspendLayout(); // - // m_recent8 + // m_backCol // - this.m_recent8.BackColor = System.Drawing.Color.Black; - this.m_recent8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; - this.m_recent8.Location = new System.Drawing.Point(352, 272); - this.m_recent8.Name = "m_recent8"; - this.m_recent8.Size = new System.Drawing.Size(16, 16); - this.m_recent8.TabIndex = 32; - this.m_recent8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); + 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 // @@ -260,7 +263,7 @@ namespace BitmapFontEd 0}); this.m_sizeX.Name = "m_sizeX"; this.m_sizeX.ReadOnly = true; - this.m_sizeX.Size = new System.Drawing.Size(48, 21); + this.m_sizeX.Size = new System.Drawing.Size(48, 20); this.m_sizeX.TabIndex = 19; this.m_sizeX.Value = new System.Decimal(new int[] { 1, @@ -320,21 +323,11 @@ namespace BitmapFontEd this.label14.Size = new System.Drawing.Size(16, 16); this.label14.TabIndex = 29; // - // 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_pos // - this.m_pos.Location = new System.Drawing.Point(160, 272); + this.m_pos.Location = new System.Drawing.Point(208, 272); this.m_pos.Name = "m_pos"; - this.m_pos.Size = new System.Drawing.Size(104, 24); + this.m_pos.Size = new System.Drawing.Size(56, 24); this.m_pos.TabIndex = 23; this.m_pos.TextAlign = System.Drawing.ContentAlignment.TopRight; // @@ -354,14 +347,29 @@ namespace BitmapFontEd this.label12.Size = new System.Drawing.Size(16, 16); this.label12.TabIndex = 31; // - // m_preview + // m_edit // - this.m_preview.BackColor = System.Drawing.SystemColors.Control; - this.m_preview.Location = new System.Drawing.Point(288, 184); - 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; + 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_sizeY // @@ -379,7 +387,7 @@ namespace BitmapFontEd 0}); this.m_sizeY.Name = "m_sizeY"; this.m_sizeY.ReadOnly = true; - this.m_sizeY.Size = new System.Drawing.Size(48, 21); + this.m_sizeY.Size = new System.Drawing.Size(48, 20); this.m_sizeY.TabIndex = 20; this.m_sizeY.Value = new System.Decimal(new int[] { 1, @@ -389,6 +397,25 @@ namespace BitmapFontEd this.m_sizeY.ValueChanged += new System.EventHandler(this.OnSizeHeight); this.m_sizeY.Leave += new System.EventHandler(this.OnSizeHeight); // + // m_preview + // + this.m_preview.BackColor = System.Drawing.SystemColors.Control; + this.m_preview.Location = new System.Drawing.Point(288, 184); + 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_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 // this.m_recent2.BackColor = System.Drawing.Color.Black; @@ -401,7 +428,7 @@ namespace BitmapFontEd // // m_bgPreview // - this.m_bgPreview.BackColor = System.Drawing.Color.Black; + 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, 112); this.m_bgPreview.Name = "m_bgPreview"; @@ -467,19 +494,15 @@ namespace BitmapFontEd this.m_recent1.TabIndex = 25; this.m_recent1.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // - // m_edit + // m_recent8 // - 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); + this.m_recent8.BackColor = System.Drawing.Color.Black; + this.m_recent8.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; + this.m_recent8.Location = new System.Drawing.Point(352, 272); + this.m_recent8.Name = "m_recent8"; + this.m_recent8.Size = new System.Drawing.Size(16, 16); + this.m_recent8.TabIndex = 32; + this.m_recent8.MouseUp += new System.Windows.Forms.MouseEventHandler(this.OnRecent); // // m_modeList // @@ -514,6 +537,8 @@ namespace BitmapFontEd // // GfxEditor // + this.Controls.Add(this.m_backCol); + this.Controls.Add(this.m_gridCol); this.Controls.Add(this.m_recent8); this.Controls.Add(this.m_recent7); this.Controls.Add(this.m_recent6); @@ -551,11 +576,6 @@ namespace BitmapFontEd // ------------------------------------------------------- #region Public Interfaces - public Color GridColour - { - set {m_gridCol=value;} - } - public uint CharWidth { get {return m_width;} @@ -634,14 +654,14 @@ namespace BitmapFontEd private void DrawGrid() { Graphics g=Graphics.FromImage(m_prevBmp); - Pen p=new Pen(m_gridCol); + Pen p=new Pen(m_gridCol.BackColor); g.Clear(Color.Black); Flush(ref g); g=Graphics.FromImage(m_editBmp); - g.Clear(Color.Black); + g.Clear(m_backCol.BackColor); for(int x=0;x