summaryrefslogtreecommitdiff
path: root/MainForm.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MainForm.cs')
-rw-r--r--MainForm.cs166
1 files changed, 162 insertions, 4 deletions
diff --git a/MainForm.cs b/MainForm.cs
index 00d7514..a0f3238 100644
--- a/MainForm.cs
+++ b/MainForm.cs
@@ -43,7 +43,9 @@ namespace BitmapFontEd
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_autoheight;
private System.Windows.Forms.Button m_rotRight;
+ 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.MenuItem m_about;
@@ -69,6 +71,7 @@ namespace BitmapFontEd
private System.Windows.Forms.MenuItem m_open;
private System.Windows.Forms.Button m_mirrorHorizontal;
private System.Windows.Forms.GroupBox m_selectGroup;
+ private System.Windows.Forms.Button m_autowidth;
private System.Windows.Forms.Button m_clear;
private GfxEditor m_edit;
@@ -136,6 +139,7 @@ namespace BitmapFontEd
/// </summary>
private void InitializeComponent() {
this.m_clear = new System.Windows.Forms.Button();
+ this.m_autowidth = new System.Windows.Forms.Button();
this.m_selectGroup = new System.Windows.Forms.GroupBox();
this.m_mirrorHorizontal = new System.Windows.Forms.Button();
this.m_open = new System.Windows.Forms.MenuItem();
@@ -161,7 +165,9 @@ namespace BitmapFontEd
this.m_about = new System.Windows.Forms.MenuItem();
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_rotRight = new System.Windows.Forms.Button();
+ this.m_autoheight = 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();
@@ -189,6 +195,15 @@ namespace BitmapFontEd
this.m_clear.Text = "Clear";
this.m_clear.Click += new System.EventHandler(this.OnClear);
//
+ // m_autowidth
+ //
+ this.m_autowidth.Location = new System.Drawing.Point(112, 40);
+ this.m_autowidth.Name = "m_autowidth";
+ this.m_autowidth.Size = new System.Drawing.Size(96, 24);
+ this.m_autowidth.TabIndex = 19;
+ this.m_autowidth.Text = "Auto Width";
+ this.m_autowidth.Click += new System.EventHandler(this.OnAutoWidth);
+ //
// m_selectGroup
//
this.m_selectGroup.Controls.Add(this.m_codeSelect);
@@ -298,7 +313,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.Size = new System.Drawing.Size(96, 24);
this.m_resize.TabIndex = 1;
this.m_resize.Text = "Resize All";
this.m_resize.Click += new System.EventHandler(this.OnResize);
@@ -404,6 +419,15 @@ namespace BitmapFontEd
this.m_revert.Text = "Revert";
this.m_revert.Click += new System.EventHandler(this.OnRevert);
//
+ // m_topleft
+ //
+ this.m_topleft.Location = new System.Drawing.Point(112, 16);
+ this.m_topleft.Name = "m_topleft";
+ this.m_topleft.Size = new System.Drawing.Size(96, 24);
+ this.m_topleft.TabIndex = 2;
+ this.m_topleft.Text = "Align Top Left";
+ this.m_topleft.Click += new System.EventHandler(this.OnAlignTopLeft);
+ //
// m_rotRight
//
this.m_rotRight.Location = new System.Drawing.Point(112, 216);
@@ -413,6 +437,15 @@ namespace BitmapFontEd
this.m_rotRight.Text = "Right";
this.m_rotRight.Click += new System.EventHandler(this.OnRotateRight);
//
+ // m_autoheight
+ //
+ this.m_autoheight.Location = new System.Drawing.Point(8, 48);
+ this.m_autoheight.Name = "m_autoheight";
+ this.m_autoheight.Size = new System.Drawing.Size(96, 24);
+ this.m_autoheight.TabIndex = 3;
+ this.m_autoheight.Text = "Auto Height";
+ this.m_autoheight.Click += new System.EventHandler(this.OnAutoHeight);
+ //
// m_mirrorVertical
//
this.m_mirrorVertical.Location = new System.Drawing.Point(112, 88);
@@ -459,6 +492,7 @@ namespace BitmapFontEd
//
// m_adjustGroup
//
+ this.m_adjustGroup.Controls.Add(this.m_autowidth);
this.m_adjustGroup.Controls.Add(this.m_grabFont);
this.m_adjustGroup.Controls.Add(this.m_edge);
this.m_adjustGroup.Controls.Add(this.m_dropShadow);
@@ -476,19 +510,21 @@ namespace BitmapFontEd
this.m_adjustGroup.Controls.Add(this.label3);
this.m_adjustGroup.Controls.Add(this.m_clear);
this.m_adjustGroup.Controls.Add(this.m_applyAll);
- this.m_adjustGroup.Location = new System.Drawing.Point(424, 64);
+ this.m_adjustGroup.Location = new System.Drawing.Point(424, 96);
this.m_adjustGroup.Name = "m_adjustGroup";
- this.m_adjustGroup.Size = new System.Drawing.Size(216, 384);
+ this.m_adjustGroup.Size = new System.Drawing.Size(216, 352);
this.m_adjustGroup.TabIndex = 3;
this.m_adjustGroup.TabStop = false;
this.m_adjustGroup.Text = "Adjustments and Effects";
//
// m_globaladjustGroup
//
+ 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, 48);
+ 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";
@@ -658,6 +694,7 @@ namespace BitmapFontEd
{
m_chars.Output(str);
m_path=fsel.FileName;
+ m_save.Enabled=true;
str.Close();
}
catch (Exception ex)
@@ -1020,5 +1057,126 @@ namespace BitmapFontEd
}
}
}
+
+ void OnAlignTopLeft(object sender, System.EventArgs e)
+ {
+ int row=Int32.MaxValue;
+ int col=Int32.MaxValue;
+ int gap=0;
+
+ if (Util.YesNo("Leave one column gap to left and top?"))
+ {
+ gap=1;
+ }
+
+ foreach (BitmapChar c in m_chars)
+ {
+ if (c.FirstUsedColumn!=-1)
+ {
+ row=Math.Min(c.FirstUsedRow-gap,row);
+ }
+
+ if (c.FirstUsedRow!=-1)
+ {
+ col=Math.Min(c.FirstUsedColumn-gap,col);
+ }
+ }
+
+ if (col==0 && row==0)
+ {
+ Util.Message("There is a character already aligned to the top left");
+ return;
+ }
+
+ if (Util.YesNo("Characters will be scrolled up by " + row + " row(s)\n" +
+ "and left by " + col + " column(s)\n\nContinue?"))
+ {
+ FetchEdit();
+
+ foreach (BitmapChar c in m_chars)
+ {
+ c.Scroll(-col,-row);
+ }
+
+ m_chars.Changed=true;
+
+ m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
+ }
+ }
+
+ void OnAutoWidth(object sender, System.EventArgs e)
+ {
+ int gap=1;
+
+ if (Util.YesNo("Leave one column gap on right?"))
+ {
+ gap=2;
+ }
+
+ FetchEdit();
+
+ if (m_applyAll.Checked)
+ {
+ foreach (BitmapChar c in m_chars)
+ {
+ int col=Math.Max(1,Math.Min(GfxEditor.MAX_SIZE,c.LastUsedColumn+gap));
+ c.Resize(col,c.Height);
+ }
+ }
+ else
+ {
+ int col=Math.Max(1,Math.Min(GfxEditor.MAX_SIZE,m_chars[m_selected].LastUsedColumn+gap));
+ m_chars[m_selected].Resize(col,m_chars[m_selected].Height);
+ }
+
+ m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
+ }
+
+ void OnAutoHeight(object sender, System.EventArgs e)
+ {
+ bool each=false;
+
+ switch(Util.YesNoCancel("Set all characters to the same height?"))
+ {
+ case DialogResult.Yes:
+ each=false;
+ break;
+ case DialogResult.No:
+ each=true;
+ break;
+ default:
+ return;
+ }
+
+ FetchEdit();
+
+ if (each)
+ {
+ foreach (BitmapChar c in m_chars)
+ {
+ int row=Math.Max(1,Math.Min(GfxEditor.MAX_SIZE,c.LastUsedRow+1));
+
+ c.Resize(c.Width,row);
+ }
+ }
+ else
+ {
+ int row=1;
+
+ foreach (BitmapChar c in m_chars)
+ {
+ row=Math.Max(row,Math.Min(GfxEditor.MAX_SIZE,c.LastUsedRow+1));
+ }
+
+ foreach (BitmapChar c in m_chars)
+ {
+ c.Resize(c.Width,row);
+ }
+ }
+
+ m_chars.Changed=true;
+
+ m_edit.BitmapChar=new BitmapChar(m_chars[m_selected]);
+ }
}
}