From cac0e5a6f3baeaa2e891677c79bba00ff3c44e1a Mon Sep 17 00:00:00 2001 From: Ian C Date: Wed, 18 May 2005 01:34:00 +0000 Subject: Development changes --- MainForm.cs | 240 +++++++++++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 189 insertions(+), 51 deletions(-) (limited to 'MainForm.cs') diff --git a/MainForm.cs b/MainForm.cs index 078741e..efc34c5 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -19,6 +19,8 @@ // using System; using System.Drawing; +using System.Drawing.Imaging; +using System.Drawing.Drawing2D; using System.Windows.Forms; using System.Text; using System.IO; @@ -34,19 +36,23 @@ namespace BitmapFontEd private System.Windows.Forms.Label label1; private System.Windows.Forms.MenuItem m_helpMenu; private System.Windows.Forms.NumericUpDown m_codeSelect; - private System.Windows.Forms.GroupBox m_globaladjustGroup; + private System.Windows.Forms.Label label5; private System.Windows.Forms.GroupBox m_adjustGroup; private System.Windows.Forms.Button m_scrollDown; private System.Windows.Forms.Button m_scrollUp; + private System.Windows.Forms.MenuItem m_break1; private System.Windows.Forms.MenuItem m_fileMenu; private System.Windows.Forms.Button m_mirrorVertical; private System.Windows.Forms.Button m_rotRight; private System.Windows.Forms.Button m_revert; private System.Windows.Forms.Button m_dropShadow; + private System.Windows.Forms.GroupBox m_globaladjustGroup; + private System.Windows.Forms.Button m_glow; private System.Windows.Forms.MenuItem m_about; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button m_scrollRight; private System.Windows.Forms.CheckBox m_applyAll; + private System.Windows.Forms.Button m_grabFont; private System.Windows.Forms.Label label6; private System.Windows.Forms.Button m_rotLeft; private System.Windows.Forms.Label label4; @@ -56,13 +62,11 @@ namespace BitmapFontEd private System.Windows.Forms.ComboBox m_asciiSelect; private System.Windows.Forms.MenuItem m_quit; private System.Windows.Forms.MenuItem m_save; - private System.Windows.Forms.Label label5; private System.Windows.Forms.MenuItem m_saveAs; private System.Windows.Forms.Button m_scrollLeft; private System.Windows.Forms.GroupBox m_editGroup; private System.Windows.Forms.MenuItem m_new; private System.Windows.Forms.MenuItem m_open; - private System.Windows.Forms.MenuItem menuItem6; private System.Windows.Forms.Button m_mirrorHorizontal; private System.Windows.Forms.GroupBox m_selectGroup; private System.Windows.Forms.Button m_clear; @@ -75,6 +79,8 @@ namespace BitmapFontEd private DropShadowForm m_shadowForm; + private Color m_glowCol=Color.White; + public MainForm() { // @@ -132,13 +138,11 @@ namespace BitmapFontEd this.m_clear = new System.Windows.Forms.Button(); this.m_selectGroup = new System.Windows.Forms.GroupBox(); this.m_mirrorHorizontal = new System.Windows.Forms.Button(); - this.menuItem6 = new System.Windows.Forms.MenuItem(); this.m_open = new System.Windows.Forms.MenuItem(); this.m_new = new System.Windows.Forms.MenuItem(); this.m_editGroup = new System.Windows.Forms.GroupBox(); this.m_scrollLeft = new System.Windows.Forms.Button(); this.m_saveAs = new System.Windows.Forms.MenuItem(); - this.label5 = new System.Windows.Forms.Label(); this.m_save = new System.Windows.Forms.MenuItem(); this.m_quit = new System.Windows.Forms.MenuItem(); this.m_asciiSelect = new System.Windows.Forms.ComboBox(); @@ -148,27 +152,31 @@ namespace BitmapFontEd this.label4 = new System.Windows.Forms.Label(); this.m_rotLeft = new System.Windows.Forms.Button(); this.label6 = new System.Windows.Forms.Label(); + this.m_grabFont = new System.Windows.Forms.Button(); this.m_applyAll = new System.Windows.Forms.CheckBox(); this.m_scrollRight = new System.Windows.Forms.Button(); this.label3 = new System.Windows.Forms.Label(); this.m_about = new System.Windows.Forms.MenuItem(); + this.m_glow = new System.Windows.Forms.Button(); + this.m_globaladjustGroup = new System.Windows.Forms.GroupBox(); this.m_dropShadow = new System.Windows.Forms.Button(); this.m_revert = new System.Windows.Forms.Button(); this.m_rotRight = new System.Windows.Forms.Button(); this.m_mirrorVertical = new System.Windows.Forms.Button(); this.m_fileMenu = new System.Windows.Forms.MenuItem(); + this.m_break1 = new System.Windows.Forms.MenuItem(); this.m_scrollUp = new System.Windows.Forms.Button(); this.m_scrollDown = new System.Windows.Forms.Button(); this.m_adjustGroup = new System.Windows.Forms.GroupBox(); - this.m_globaladjustGroup = new System.Windows.Forms.GroupBox(); + this.label5 = new System.Windows.Forms.Label(); this.m_codeSelect = new System.Windows.Forms.NumericUpDown(); this.m_helpMenu = new System.Windows.Forms.MenuItem(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); this.m_selectGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_charSelect)).BeginInit(); - this.m_adjustGroup.SuspendLayout(); this.m_globaladjustGroup.SuspendLayout(); + this.m_adjustGroup.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).BeginInit(); this.SuspendLayout(); // @@ -177,7 +185,7 @@ namespace BitmapFontEd this.m_clear.Location = new System.Drawing.Point(8, 40); this.m_clear.Name = "m_clear"; this.m_clear.Size = new System.Drawing.Size(96, 24); - this.m_clear.TabIndex = 2; + this.m_clear.TabIndex = 3; this.m_clear.Text = "Clear"; this.m_clear.Click += new System.EventHandler(this.OnClear); // @@ -201,15 +209,10 @@ namespace BitmapFontEd this.m_mirrorHorizontal.Location = new System.Drawing.Point(8, 88); this.m_mirrorHorizontal.Name = "m_mirrorHorizontal"; this.m_mirrorHorizontal.Size = new System.Drawing.Size(96, 24); - this.m_mirrorHorizontal.TabIndex = 4; + this.m_mirrorHorizontal.TabIndex = 5; this.m_mirrorHorizontal.Text = "Horizontal"; this.m_mirrorHorizontal.Click += new System.EventHandler(this.OnHorizontalMirror); // - // menuItem6 - // - this.menuItem6.Index = 4; - this.menuItem6.Text = "-"; - // // m_open // this.m_open.Index = 1; @@ -229,7 +232,7 @@ namespace BitmapFontEd this.m_editGroup.Location = new System.Drawing.Point(8, 8); this.m_editGroup.Name = "m_editGroup"; this.m_editGroup.Size = new System.Drawing.Size(408, 328); - this.m_editGroup.TabIndex = 0; + this.m_editGroup.TabIndex = 1; this.m_editGroup.TabStop = false; this.m_editGroup.Text = "Editor"; // @@ -238,7 +241,7 @@ namespace BitmapFontEd this.m_scrollLeft.Location = new System.Drawing.Point(8, 136); this.m_scrollLeft.Name = "m_scrollLeft"; this.m_scrollLeft.Size = new System.Drawing.Size(96, 24); - this.m_scrollLeft.TabIndex = 7; + this.m_scrollLeft.TabIndex = 8; this.m_scrollLeft.Text = "Left"; this.m_scrollLeft.Click += new System.EventHandler(this.OnLeftScroll); // @@ -249,15 +252,6 @@ namespace BitmapFontEd this.m_saveAs.Text = "S&ave as..."; this.m_saveAs.Click += new System.EventHandler(this.OnSaveAs); // - // label5 - // - this.label5.Location = new System.Drawing.Point(8, 200); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(72, 16); - this.label5.TabIndex = 11; - this.label5.Text = "Rotate"; - this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; - // // m_save // this.m_save.Index = 2; @@ -279,7 +273,7 @@ namespace BitmapFontEd this.m_asciiSelect.MaxDropDownItems = 20; this.m_asciiSelect.Name = "m_asciiSelect"; this.m_asciiSelect.Size = new System.Drawing.Size(64, 21); - this.m_asciiSelect.TabIndex = 8; + this.m_asciiSelect.TabIndex = 9; this.m_asciiSelect.SelectedIndexChanged += new System.EventHandler(this.OnSelectByChar); // // m_resize @@ -287,7 +281,7 @@ namespace BitmapFontEd this.m_resize.Location = new System.Drawing.Point(8, 16); this.m_resize.Name = "m_resize"; this.m_resize.Size = new System.Drawing.Size(88, 24); - this.m_resize.TabIndex = 0; + this.m_resize.TabIndex = 1; this.m_resize.Text = "Resize All"; this.m_resize.Click += new System.EventHandler(this.OnResize); // @@ -303,7 +297,7 @@ namespace BitmapFontEd this.m_charSelect.Maximum = 94; this.m_charSelect.Name = "m_charSelect"; this.m_charSelect.Size = new System.Drawing.Size(392, 42); - this.m_charSelect.TabIndex = 5; + this.m_charSelect.TabIndex = 6; this.m_charSelect.Scroll += new System.EventHandler(this.OnSelectChar); // // label4 @@ -320,7 +314,7 @@ namespace BitmapFontEd this.m_rotLeft.Location = new System.Drawing.Point(8, 216); this.m_rotLeft.Name = "m_rotLeft"; this.m_rotLeft.Size = new System.Drawing.Size(96, 24); - this.m_rotLeft.TabIndex = 12; + this.m_rotLeft.TabIndex = 13; this.m_rotLeft.Text = "Left"; this.m_rotLeft.Click += new System.EventHandler(this.OnRotateLeft); // @@ -333,6 +327,15 @@ namespace BitmapFontEd this.label6.Text = "Special Effects"; this.label6.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // + // m_grabFont + // + this.m_grabFont.Location = new System.Drawing.Point(8, 304); + this.m_grabFont.Name = "m_grabFont"; + this.m_grabFont.Size = new System.Drawing.Size(96, 24); + this.m_grabFont.TabIndex = 18; + this.m_grabFont.Text = "Grab Font"; + this.m_grabFont.Click += new System.EventHandler(this.OnGrabFont); + // // m_applyAll // this.m_applyAll.Location = new System.Drawing.Point(8, 16); @@ -346,7 +349,7 @@ namespace BitmapFontEd this.m_scrollRight.Location = new System.Drawing.Point(112, 136); this.m_scrollRight.Name = "m_scrollRight"; this.m_scrollRight.Size = new System.Drawing.Size(96, 24); - this.m_scrollRight.TabIndex = 8; + this.m_scrollRight.TabIndex = 9; this.m_scrollRight.Text = "Right"; this.m_scrollRight.Click += new System.EventHandler(this.OnRightScroll); // @@ -365,12 +368,31 @@ namespace BitmapFontEd this.m_about.Text = "&About"; this.m_about.Click += new System.EventHandler(this.OnAbout); // + // m_glow + // + this.m_glow.Location = new System.Drawing.Point(112, 272); + this.m_glow.Name = "m_glow"; + this.m_glow.Size = new System.Drawing.Size(96, 24); + this.m_glow.TabIndex = 17; + this.m_glow.Text = "Glow"; + this.m_glow.Click += new System.EventHandler(this.OnGlow); + // + // m_globaladjustGroup + // + this.m_globaladjustGroup.Controls.Add(this.m_resize); + this.m_globaladjustGroup.Location = new System.Drawing.Point(424, 8); + this.m_globaladjustGroup.Name = "m_globaladjustGroup"; + this.m_globaladjustGroup.Size = new System.Drawing.Size(216, 48); + this.m_globaladjustGroup.TabIndex = 2; + this.m_globaladjustGroup.TabStop = false; + this.m_globaladjustGroup.Text = "Global Adjustments"; + // // m_dropShadow // this.m_dropShadow.Location = new System.Drawing.Point(8, 272); this.m_dropShadow.Name = "m_dropShadow"; this.m_dropShadow.Size = new System.Drawing.Size(96, 24); - this.m_dropShadow.TabIndex = 15; + this.m_dropShadow.TabIndex = 16; this.m_dropShadow.Text = "Drop Shadow"; this.m_dropShadow.Click += new System.EventHandler(this.OnDropShadow); // @@ -379,7 +401,7 @@ namespace BitmapFontEd this.m_revert.Location = new System.Drawing.Point(304, 64); this.m_revert.Name = "m_revert"; this.m_revert.Size = new System.Drawing.Size(88, 24); - this.m_revert.TabIndex = 6; + this.m_revert.TabIndex = 7; this.m_revert.Text = "Revert"; this.m_revert.Click += new System.EventHandler(this.OnRevert); // @@ -388,7 +410,7 @@ namespace BitmapFontEd this.m_rotRight.Location = new System.Drawing.Point(112, 216); this.m_rotRight.Name = "m_rotRight"; this.m_rotRight.Size = new System.Drawing.Size(96, 24); - this.m_rotRight.TabIndex = 13; + this.m_rotRight.TabIndex = 14; this.m_rotRight.Text = "Right"; this.m_rotRight.Click += new System.EventHandler(this.OnRotateRight); // @@ -397,7 +419,7 @@ namespace BitmapFontEd this.m_mirrorVertical.Location = new System.Drawing.Point(112, 88); this.m_mirrorVertical.Name = "m_mirrorVertical"; this.m_mirrorVertical.Size = new System.Drawing.Size(96, 24); - this.m_mirrorVertical.TabIndex = 5; + this.m_mirrorVertical.TabIndex = 6; this.m_mirrorVertical.Text = "Vertical"; this.m_mirrorVertical.Click += new System.EventHandler(this.OnVerticalMirror); // @@ -409,16 +431,21 @@ namespace BitmapFontEd this.m_open, this.m_save, this.m_saveAs, - this.menuItem6, + this.m_break1, this.m_quit}); this.m_fileMenu.Text = "&File"; // + // m_break1 + // + this.m_break1.Index = 4; + this.m_break1.Text = "-"; + // // m_scrollUp // this.m_scrollUp.Location = new System.Drawing.Point(8, 168); this.m_scrollUp.Name = "m_scrollUp"; this.m_scrollUp.Size = new System.Drawing.Size(96, 24); - this.m_scrollUp.TabIndex = 9; + this.m_scrollUp.TabIndex = 10; this.m_scrollUp.Text = "Up"; this.m_scrollUp.Click += new System.EventHandler(this.OnUpScroll); // @@ -427,12 +454,14 @@ namespace BitmapFontEd this.m_scrollDown.Location = new System.Drawing.Point(112, 168); this.m_scrollDown.Name = "m_scrollDown"; this.m_scrollDown.Size = new System.Drawing.Size(96, 24); - this.m_scrollDown.TabIndex = 10; + this.m_scrollDown.TabIndex = 11; this.m_scrollDown.Text = "Down"; this.m_scrollDown.Click += new System.EventHandler(this.OnDownScroll); // // m_adjustGroup // + this.m_adjustGroup.Controls.Add(this.m_grabFont); + this.m_adjustGroup.Controls.Add(this.m_glow); this.m_adjustGroup.Controls.Add(this.m_dropShadow); this.m_adjustGroup.Controls.Add(this.label6); this.m_adjustGroup.Controls.Add(this.m_rotRight); @@ -455,21 +484,20 @@ namespace BitmapFontEd this.m_adjustGroup.TabStop = false; this.m_adjustGroup.Text = "Adjustments and Effects"; // - // m_globaladjustGroup + // label5 // - this.m_globaladjustGroup.Controls.Add(this.m_resize); - this.m_globaladjustGroup.Location = new System.Drawing.Point(424, 8); - this.m_globaladjustGroup.Name = "m_globaladjustGroup"; - this.m_globaladjustGroup.Size = new System.Drawing.Size(216, 48); - this.m_globaladjustGroup.TabIndex = 2; - this.m_globaladjustGroup.TabStop = false; - this.m_globaladjustGroup.Text = "Global Adjustments"; + this.label5.Location = new System.Drawing.Point(8, 200); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(72, 16); + this.label5.TabIndex = 11; + this.label5.Text = "Rotate"; + this.label5.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; // // m_codeSelect // this.m_codeSelect.Location = new System.Drawing.Point(88, 64); this.m_codeSelect.Maximum = new System.Decimal(new int[] { - 127, + 126, 0, 0, 0}); @@ -481,7 +509,7 @@ namespace BitmapFontEd this.m_codeSelect.Name = "m_codeSelect"; this.m_codeSelect.ReadOnly = true; this.m_codeSelect.Size = new System.Drawing.Size(64, 20); - this.m_codeSelect.TabIndex = 9; + this.m_codeSelect.TabIndex = 10; this.m_codeSelect.Value = new System.Decimal(new int[] { 32, 0, @@ -531,8 +559,8 @@ namespace BitmapFontEd this.Closing += new System.ComponentModel.CancelEventHandler(this.OnClosing); this.m_selectGroup.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_charSelect)).EndInit(); - this.m_adjustGroup.ResumeLayout(false); this.m_globaladjustGroup.ResumeLayout(false); + this.m_adjustGroup.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.m_codeSelect)).EndInit(); this.ResumeLayout(false); } @@ -682,7 +710,7 @@ namespace BitmapFontEd { if (!m_inSelect) { - SelectChar(Convert.ToInt32(m_codeSelect.Value-32)); + SelectChar(Convert.ToInt32(m_codeSelect.Value)-32); } } @@ -727,9 +755,12 @@ namespace BitmapFontEd if (m_applyAll.Checked) { - foreach (BitmapChar c in m_chars) + if (Util.YesNo("Clear ALL Characters?")) { - c.Clear(m_edit.SelectedBackground); + foreach (BitmapChar c in m_chars) + { + c.Clear(m_edit.SelectedBackground); + } } } else @@ -879,5 +910,112 @@ namespace BitmapFontEd m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]); } } + + void OnGlow(object sender, System.EventArgs e) + { + ColorDialog d=new ColorDialog(); + + d.Color=m_glowCol; + d.FullOpen=true; + + if (d.ShowDialog()==DialogResult.OK) + { + m_glowCol=d.Color; + + FetchEdit(); + + if (m_applyAll.Checked) + { + foreach (BitmapChar c in m_chars) + { + c.Glow(m_glowCol); + } + } + else + { + m_chars[m_selected].Glow(m_glowCol); + } + + m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]); + } + } + + private void GrabChar(Bitmap bmp, BitmapChar c) + { + int x,y; + int mx,my; + bool found; + + //System.Diagnostics.Debugger.Break(); + + c.Clear(m_edit.BackColor); + + found=false; + + for(my=GfxEditor.MAX_SIZE-1;my>=0 && !found;my--) + for(x=0;x=0 && !found;mx--) + for(y=0;y