From e34eee34067e5958f00764ff28d3ee17008e3b3a Mon Sep 17 00:00:00 2001 From: Ian C Date: Sun, 12 Jun 2005 22:52:18 +0000 Subject: Added button for setting all character sizes --- BitmapFontEd.MainForm.resources | Bin 19283 -> 19645 bytes BitmapFontEd.SetSizeForm.resources | Bin 0 -> 5223 bytes BitmapFontEd.cmbx | 2 +- BitmapFontEd.prjx | 14 +-- MainForm.cs | 79 +++++++++++------ SetSizeForm.cs | 172 +++++++++++++++++++++++++++++++++++++ 6 files changed, 235 insertions(+), 32 deletions(-) create mode 100644 BitmapFontEd.SetSizeForm.resources create mode 100644 SetSizeForm.cs diff --git a/BitmapFontEd.MainForm.resources b/BitmapFontEd.MainForm.resources index c5fc8fe..6d3dca8 100644 Binary files a/BitmapFontEd.MainForm.resources and b/BitmapFontEd.MainForm.resources differ diff --git a/BitmapFontEd.SetSizeForm.resources b/BitmapFontEd.SetSizeForm.resources new file mode 100644 index 0000000..bf118b0 Binary files /dev/null and b/BitmapFontEd.SetSizeForm.resources differ diff --git a/BitmapFontEd.cmbx b/BitmapFontEd.cmbx index 2a46d3a..c1b02c5 100644 --- a/BitmapFontEd.cmbx +++ b/BitmapFontEd.cmbx @@ -3,7 +3,7 @@ - + diff --git a/BitmapFontEd.prjx b/BitmapFontEd.prjx index 62470e2..8e61ba5 100644 --- a/BitmapFontEd.prjx +++ b/BitmapFontEd.prjx @@ -3,33 +3,35 @@ - + - - + + + + - + - + - + \ No newline at end of file diff --git a/MainForm.cs b/MainForm.cs index a0f3238..ea68be1 100644 --- a/MainForm.cs +++ b/MainForm.cs @@ -36,7 +36,7 @@ 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; @@ -45,9 +45,11 @@ namespace BitmapFontEd private System.Windows.Forms.Button m_mirrorVertical; private System.Windows.Forms.Button m_autoheight; private System.Windows.Forms.Button m_rotRight; + private System.Windows.Forms.Button m_setsize; private System.Windows.Forms.Button m_topleft; 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.MenuItem m_about; private System.Windows.Forms.Label label3; private System.Windows.Forms.Button m_scrollRight; @@ -63,7 +65,6 @@ namespace BitmapFontEd private System.Windows.Forms.Button m_edge; 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; @@ -147,7 +148,6 @@ namespace BitmapFontEd 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_edge = new System.Windows.Forms.Button(); @@ -163,9 +163,11 @@ namespace BitmapFontEd 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_globaladjustGroup = new System.Windows.Forms.GroupBox(); this.m_dropShadow = new System.Windows.Forms.Button(); this.m_revert = new System.Windows.Forms.Button(); this.m_topleft = new System.Windows.Forms.Button(); + this.m_setsize = new System.Windows.Forms.Button(); this.m_rotRight = new System.Windows.Forms.Button(); this.m_autoheight = new System.Windows.Forms.Button(); this.m_mirrorVertical = new System.Windows.Forms.Button(); @@ -174,15 +176,15 @@ namespace BitmapFontEd 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(); // @@ -267,15 +269,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; @@ -401,6 +394,19 @@ namespace BitmapFontEd this.m_about.Text = "&About"; this.m_about.Click += new System.EventHandler(this.OnAbout); // + // m_globaladjustGroup + // + this.m_globaladjustGroup.Controls.Add(this.m_setsize); + this.m_globaladjustGroup.Controls.Add(this.m_autoheight); + this.m_globaladjustGroup.Controls.Add(this.m_topleft); + 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, 80); + 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); @@ -428,6 +434,15 @@ namespace BitmapFontEd this.m_topleft.Text = "Align Top Left"; this.m_topleft.Click += new System.EventHandler(this.OnAlignTopLeft); // + // m_setsize + // + this.m_setsize.Location = new System.Drawing.Point(112, 48); + this.m_setsize.Name = "m_setsize"; + this.m_setsize.Size = new System.Drawing.Size(96, 24); + this.m_setsize.TabIndex = 4; + this.m_setsize.Text = "Set Size"; + this.m_setsize.Click += new System.EventHandler(this.OnSetSize); + // // m_rotRight // this.m_rotRight.Location = new System.Drawing.Point(112, 216); @@ -517,17 +532,14 @@ namespace BitmapFontEd this.m_adjustGroup.TabStop = false; this.m_adjustGroup.Text = "Adjustments and Effects"; // - // m_globaladjustGroup + // label5 // - this.m_globaladjustGroup.Controls.Add(this.m_autoheight); - this.m_globaladjustGroup.Controls.Add(this.m_topleft); - 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, 80); - 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 // @@ -595,8 +607,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); } @@ -1178,5 +1190,22 @@ namespace BitmapFontEd m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]); } + + void OnSetSize(object sender, System.EventArgs e) + { + SetSizeForm d=new SetSizeForm(); + + if (d.ShowDialog()==DialogResult.OK) + { + FetchEdit(); + + foreach (BitmapChar c in m_chars) + { + c.Resize(d.CharWidth,d.CharHeight); + } + + m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]); + } + } } } diff --git a/SetSizeForm.cs b/SetSizeForm.cs new file mode 100644 index 0000000..74d6738 --- /dev/null +++ b/SetSizeForm.cs @@ -0,0 +1,172 @@ +// XXX - YYY +// Copyright (C) 200X Ian Cowburn +// +// This program is free software; you can redistribute it and/or +// modify it under the terms of the GNU General Public License +// as published by the Free Software Foundation; either version 2 +// of the License, or (at your option) any later version. +// +// This program is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU General Public License for more details. +// +// You should have received a copy of the GNU General Public License +// along with this program; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +// +// $Id$ +// + +using System; +using System.Drawing; +using System.Windows.Forms; + +namespace BitmapFontEd +{ + /// + /// Description of SetSizeForm. + /// + public class SetSizeForm : System.Windows.Forms.Form + { + private System.Windows.Forms.TrackBar m_width; + private System.Windows.Forms.TrackBar m_height; + private System.Windows.Forms.Button m_cancel; + private System.Windows.Forms.Label m_widthtxt; + private System.Windows.Forms.Label m_heighttxt; + private System.Windows.Forms.Button m_ok; + + public SetSizeForm() + { + // + // The InitializeComponent() call is required for Windows Forms designer support. + // + InitializeComponent(); + } + + public int CharWidth {get {return m_width.Value;}} + public int CharHeight {get {return m_height.Value;}} + + #region Windows Forms Designer generated code + /// + /// This method is required for Windows Forms designer support. + /// Do not change the method contents inside the source code editor. The Forms designer might + /// not be able to load this method if it was changed manually. + /// + private void InitializeComponent() { + this.m_ok = new System.Windows.Forms.Button(); + this.m_heighttxt = new System.Windows.Forms.Label(); + this.m_widthtxt = new System.Windows.Forms.Label(); + this.m_cancel = new System.Windows.Forms.Button(); + this.m_height = new System.Windows.Forms.TrackBar(); + this.m_width = new System.Windows.Forms.TrackBar(); + ((System.ComponentModel.ISupportInitialize)(this.m_height)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.m_width)).BeginInit(); + this.SuspendLayout(); + // + // m_ok + // + this.m_ok.Location = new System.Drawing.Point(88, 144); + this.m_ok.Name = "m_ok"; + this.m_ok.Size = new System.Drawing.Size(88, 24); + this.m_ok.TabIndex = 5; + this.m_ok.Text = "OK"; + this.m_ok.Click += new System.EventHandler(this.OnOK); + // + // m_heighttxt + // + this.m_heighttxt.Location = new System.Drawing.Point(8, 72); + this.m_heighttxt.Name = "m_heighttxt"; + this.m_heighttxt.Size = new System.Drawing.Size(266, 16); + this.m_heighttxt.TabIndex = 3; + this.m_heighttxt.Text = "Height: 16"; + // + // m_widthtxt + // + this.m_widthtxt.Location = new System.Drawing.Point(8, 8); + this.m_widthtxt.Name = "m_widthtxt"; + this.m_widthtxt.Size = new System.Drawing.Size(264, 16); + this.m_widthtxt.TabIndex = 1; + this.m_widthtxt.Text = "Width: 16"; + // + // m_cancel + // + this.m_cancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.m_cancel.Location = new System.Drawing.Point(184, 144); + this.m_cancel.Name = "m_cancel"; + this.m_cancel.Size = new System.Drawing.Size(88, 24); + this.m_cancel.TabIndex = 4; + this.m_cancel.Text = "Cancel"; + // + // m_height + // + this.m_height.LargeChange = 4; + this.m_height.Location = new System.Drawing.Point(0, 88); + this.m_height.Maximum = 32; + this.m_height.Minimum = 1; + this.m_height.Name = "m_height"; + this.m_height.Size = new System.Drawing.Size(280, 42); + this.m_height.TabIndex = 2; + this.m_height.Value = 16; + this.m_height.Scroll += new System.EventHandler(this.OnHeight); + // + // m_width + // + this.m_width.LargeChange = 4; + this.m_width.Location = new System.Drawing.Point(0, 24); + this.m_width.Maximum = 32; + this.m_width.Minimum = 1; + this.m_width.Name = "m_width"; + this.m_width.Size = new System.Drawing.Size(280, 42); + this.m_width.TabIndex = 0; + this.m_width.Value = 16; + this.m_width.Scroll += new System.EventHandler(this.OnWidth); + // + // SetSizeForm + // + this.AcceptButton = this.m_ok; + this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); + this.CancelButton = this.m_cancel; + this.ClientSize = new System.Drawing.Size(282, 175); + this.Controls.Add(this.m_ok); + this.Controls.Add(this.m_cancel); + this.Controls.Add(this.m_heighttxt); + this.Controls.Add(this.m_height); + this.Controls.Add(this.m_widthtxt); + this.Controls.Add(this.m_width); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "SetSizeForm"; + this.ShowInTaskbar = false; + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent; + this.Text = "Set Size of All Characters"; + ((System.ComponentModel.ISupportInitialize)(this.m_height)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.m_width)).EndInit(); + this.ResumeLayout(false); + } + #endregion + + void OnWidth(object sender, System.EventArgs e) + { + m_widthtxt.Text="Width: " + m_width.Value; + } + + void OnHeight(object sender, System.EventArgs e) + { + m_heighttxt.Text="Height: " + m_height.Value; + } + + void OnOK(object sender, System.EventArgs e) + { + DialogResult=DialogResult.OK; + Close(); + } + + void OnCancel(object sender, System.EventArgs e) + { + DialogResult=DialogResult.Cancel; + Close(); + } + } +} -- cgit v1.2.3