3 Commits

Author SHA1 Message Date
Anton Mukhin
cc161169f1 Add icons 9x9 example 2023-05-12 16:28:12 +03:00
Anton Mukhin
0ba03444d1 Add/Remove symbols 2023-05-12 14:08:21 +03:00
Anton Mukhin
302977c3f4 Export is done (I think) 2023-05-12 10:59:35 +03:00
5 changed files with 216 additions and 89 deletions

View File

@@ -37,8 +37,8 @@
this.cbNumSize = new System.Windows.Forms.ComboBox();
this.cbNumBase = new System.Windows.Forms.ComboBox();
this.gbText = new System.Windows.Forms.GroupBox();
this.label1 = new System.Windows.Forms.Label();
this.numericUpDown1 = new System.Windows.Forms.NumericUpDown();
this.lblXLines = new System.Windows.Forms.Label();
this.nudXLines = new System.Windows.Forms.NumericUpDown();
this.cbLines = new System.Windows.Forms.ComboBox();
this.cbFormat = new System.Windows.Forms.ComboBox();
this.btnGenerate = new System.Windows.Forms.Button();
@@ -47,7 +47,7 @@
this.gbOptions.SuspendLayout();
this.gbNumbers.SuspendLayout();
this.gbText.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).BeginInit();
this.SuspendLayout();
//
// txtOutput
@@ -217,8 +217,8 @@
//
// gbText
//
this.gbText.Controls.Add(this.label1);
this.gbText.Controls.Add(this.numericUpDown1);
this.gbText.Controls.Add(this.lblXLines);
this.gbText.Controls.Add(this.nudXLines);
this.gbText.Controls.Add(this.cbLines);
this.gbText.Controls.Add(this.cbFormat);
this.gbText.Location = new System.Drawing.Point(5, 234);
@@ -228,34 +228,34 @@
this.gbText.TabStop = false;
this.gbText.Text = "Text format";
//
// label1
// lblXLines
//
this.label1.AutoSize = true;
this.label1.Enabled = false;
this.label1.Location = new System.Drawing.Point(10, 76);
this.label1.Name = "label1";
this.label1.Size = new System.Drawing.Size(60, 13);
this.label1.TabIndex = 9;
this.label1.Text = "X numbers:";
this.lblXLines.AutoSize = true;
this.lblXLines.Enabled = false;
this.lblXLines.Location = new System.Drawing.Point(10, 76);
this.lblXLines.Name = "lblXLines";
this.lblXLines.Size = new System.Drawing.Size(60, 13);
this.lblXLines.TabIndex = 9;
this.lblXLines.Text = "X numbers:";
//
// numericUpDown1
// nudXLines
//
this.numericUpDown1.Enabled = false;
this.numericUpDown1.Location = new System.Drawing.Point(76, 73);
this.numericUpDown1.Maximum = new decimal(new int[] {
this.nudXLines.Enabled = false;
this.nudXLines.Location = new System.Drawing.Point(76, 73);
this.nudXLines.Maximum = new decimal(new int[] {
64,
0,
0,
0});
this.numericUpDown1.Minimum = new decimal(new int[] {
this.nudXLines.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.numericUpDown1.Name = "numericUpDown1";
this.numericUpDown1.Size = new System.Drawing.Size(55, 20);
this.numericUpDown1.TabIndex = 8;
this.numericUpDown1.Value = new decimal(new int[] {
this.nudXLines.Name = "nudXLines";
this.nudXLines.Size = new System.Drawing.Size(55, 20);
this.nudXLines.TabIndex = 8;
this.nudXLines.Value = new decimal(new int[] {
8,
0,
0,
@@ -273,6 +273,7 @@
this.cbLines.Name = "cbLines";
this.cbLines.Size = new System.Drawing.Size(121, 21);
this.cbLines.TabIndex = 7;
this.cbLines.SelectedIndexChanged += new System.EventHandler(this.cbLines_SelectedIndexChanged);
//
// cbFormat
//
@@ -334,7 +335,7 @@
this.gbNumbers.ResumeLayout(false);
this.gbText.ResumeLayout(false);
this.gbText.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).EndInit();
this.ResumeLayout(false);
}
@@ -354,8 +355,8 @@
private System.Windows.Forms.ComboBox cbNumSize;
private System.Windows.Forms.ComboBox cbNumBase;
private System.Windows.Forms.GroupBox gbText;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.NumericUpDown numericUpDown1;
private System.Windows.Forms.Label lblXLines;
private System.Windows.Forms.NumericUpDown nudXLines;
private System.Windows.Forms.ComboBox cbLines;
private System.Windows.Forms.ComboBox cbFormat;
private System.Windows.Forms.Button btnGenerate;

View File

@@ -82,6 +82,8 @@ namespace McBitFont {
int lines = cbLines.SelectedIndex;
int format = cbFormat.SelectedIndex;
bool mono = mainForm.monospaced;
int lineslim = (int)nudXLines.Value;
int fcount = mainForm.frames.Count;
int imin, jmin, imax, jmax, idir, jdir;
@@ -130,28 +132,28 @@ namespace McBitFont {
jdir = -1;
}
} else {
if (cbHDir.SelectedIndex == 0) {
// Rows; Left to right
jmin = 0;
jmax = mainForm.dotHeight;
jdir = 1;
} else {
// Rows; Right to left
jmin = mainForm.dotHeight - 1;
jmax = -1;
jdir = -1;
}
if (cbVDir.SelectedIndex == 0) {
// Rows; Top to bottom
// Rows; Left to right
imin = 0;
imax = mainForm.dotWidth;
imax = mainForm.dotHeight;
idir = 1;
} else {
// Rows; Bottom to top
imin = mainForm.dotWidth - 1;
// Rows; Right to left
imin = mainForm.dotHeight - 1;
imax = -1;
idir = -1;
}
if (cbHDir.SelectedIndex == 0) {
// Rows; Top to bottom
jmin = 0;
jmax = mainForm.dotWidth;
jdir = 1;
} else {
// Rows; Bottom to top
jmin = mainForm.dotWidth - 1;
jmax = -1;
jdir = -1;
}
}
@@ -223,7 +225,7 @@ namespace McBitFont {
uint b = 0; // current number bits
int t, x, y; // t - calculated bit number; x - actual x; y - actual y
if (com && lines != 1) {
if (com && lines != 1 && fcount > 1) {
// Comments enabled and other than "1 symbol per line" selected
// Print a symbol comment before its data
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code) + "\n";
@@ -233,16 +235,27 @@ namespace McBitFont {
output += " ";
numcount = 0;
}
if (!mono && mainForm.frames.Count > 1) {
if (!mono && fcount > 1) {
// Not a single image; Variable width font - lets post the width as a 1st number
// Should we post a prefix to the number?
pref = (!cbZeroes.Checked && ((f.width < 10 && nbase == 16) || (f.width < 2 && nbase == 2))) ? "" : prefix;
output += " " + pref + Convert.ToString(f.width, nbase).PadLeft(pad, '0') + "," + (lines == 1 ? " " : "\n");
output += (lines != 1 ? " " : "") + pref + Convert.ToString(f.width, nbase).PadLeft(pad, '0') + (lines != 0 ? (lines == 1 ? ", " : "") : ",\n");
// Count posted numbers
numcount++;
if (lines != 2) numcount = 0;
if (lines == 2 && numcount >= lineslim) {
numcount = 0;
output += "\n ";
}
}
if (lines == 2 && numcount == 0) {
// "X numbers per line" - first line of a symbol offset
output += " ";
}
//Figure out mins and maxes for variable width fonts
if (!mono) {
if (!mono && fcount > 1) {
if (cbOrder.SelectedIndex == 0) {
if (cbHDir.SelectedIndex == 0) {
// Columns; Left to right
@@ -259,19 +272,19 @@ namespace McBitFont {
jmin = f.height - 1;
}
} else {
if (cbHDir.SelectedIndex == 0) {
if (cbVDir.SelectedIndex == 0) {
// Rows; Left to right
jmax = f.height;
imax = f.height;
} else {
// Rows; Right to left
jmin = f.height - 1;
imin = f.height - 1;
}
if (cbVDir.SelectedIndex == 0) {
if (cbHDir.SelectedIndex == 0) {
// Rows; Top to bottom
imax = f.width;
jmax = f.width;
} else {
// Rows; Bottom to top
imin = f.width - 1;
jmin = f.width - 1;
}
}
}
@@ -315,6 +328,11 @@ namespace McBitFont {
// count posted numbers
numcount++;
if (lines == 2 && numcount >= lineslim && !(j + jdir == jmax && i + idir == imax)) {
// "X numbers per line" - line break
numcount = 0;
output += ",\n ";
}
}
}
if (lines == 0) {
@@ -325,12 +343,18 @@ namespace McBitFont {
if (lines == 1) {
// "1 symbol per line" - closing line
if (!f.Equals(flast)) output += ",";
if (com) {
if (com && fcount > 1) {
//...with a comment
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code);
}
output += "\n";
}
if (lines == 2) {
// "X numbers per line" - closing line
if (!f.Equals(flast)) output += ",";
output += "\n";
numcount = 0;
}
}
// Close array definition
output += "};\n";
@@ -345,7 +369,7 @@ namespace McBitFont {
MessageBox.Show("Cannot pack the font meta header into 2D array!\nChoose 1D array or disable the meta header.\n(Setting array format to 1D array)", "No header in 2D array!", MessageBoxButtons.OK, MessageBoxIcon.Information);
cbFormat.SelectedIndex = 0;
}
if (!mainForm.monospaced && cbFormat.SelectedIndex == 1) {
if (!mainForm.monospaced && cbFormat.SelectedIndex == 1 && mainForm.frames.Count > 1) {
MessageBox.Show("Cannot pack the variable width font into 2D array!\n(Setting array format to 1D array)", "2D arrays are for monospaced fonts only!", MessageBoxButtons.OK, MessageBoxIcon.Information);
cbFormat.SelectedIndex = 0;
}
@@ -356,5 +380,15 @@ namespace McBitFont {
cbLines.Enabled = true;
}
}
private void cbLines_SelectedIndexChanged(object sender, EventArgs e) {
if (cbLines.SelectedIndex == 2) {
nudXLines.Enabled = true;
lblXLines.Enabled = true;
} else {
nudXLines.Enabled = false;
lblXLines.Enabled = false;
}
}
}
}

View File

@@ -55,8 +55,8 @@
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.removeSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.applyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shiftUpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.shiftDownToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -65,11 +65,12 @@
this.invertToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mirrorXToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.mirrorYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.dlgSave = new System.Windows.Forms.SaveFileDialog();
this.dlgOpen = new System.Windows.Forms.OpenFileDialog();
this.applyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.appendSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudY)).BeginInit();
this.panel1.SuspendLayout();
@@ -324,6 +325,7 @@
this.miniList.ShowGroups = false;
this.miniList.Size = new System.Drawing.Size(343, 395);
this.miniList.SmallImageList = this.ilMiniatures;
this.miniList.Sorting = System.Windows.Forms.SortOrder.Ascending;
this.miniList.TabIndex = 12;
this.miniList.TabStop = false;
this.miniList.TileSize = new System.Drawing.Size(50, 50);
@@ -407,7 +409,9 @@
//
this.newToolStripMenuItem.Image = global::McBitFont.Properties.Resources.file;
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
this.newToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+N";
this.newToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.N)));
this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
@@ -415,7 +419,9 @@
//
this.openToolStripMenuItem.Image = global::McBitFont.Properties.Resources.folder_open;
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
this.openToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+O";
this.openToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.O)));
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Text = "Open";
this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click);
//
@@ -423,35 +429,30 @@
//
this.saveToolStripMenuItem.Image = global::McBitFont.Properties.Resources.save;
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
this.saveToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+S";
this.saveToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.S)));
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "Save as";
this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click);
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(112, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
// editToolStripMenuItem
//
this.editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.addSymbolToolStripMenuItem,
this.prependSymbolToolStripMenuItem,
this.appendSymbolToolStripMenuItem,
this.removeSymbolToolStripMenuItem,
this.applyToolStripMenuItem});
this.editToolStripMenuItem.Name = "editToolStripMenuItem";
this.editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
this.editToolStripMenuItem.Text = "Edit";
//
// addSymbolToolStripMenuItem
//
this.addSymbolToolStripMenuItem.Enabled = false;
this.addSymbolToolStripMenuItem.Image = global::McBitFont.Properties.Resources.action_add;
this.addSymbolToolStripMenuItem.Name = "addSymbolToolStripMenuItem";
this.addSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.addSymbolToolStripMenuItem.Text = "Add symbol";
//
// removeSymbolToolStripMenuItem
//
this.removeSymbolToolStripMenuItem.Enabled = false;
@@ -459,6 +460,14 @@
this.removeSymbolToolStripMenuItem.Name = "removeSymbolToolStripMenuItem";
this.removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.removeSymbolToolStripMenuItem.Text = "Remove symbol";
this.removeSymbolToolStripMenuItem.Click += new System.EventHandler(this.removeSymbolToolStripMenuItem_Click);
//
// applyToolStripMenuItem
//
this.applyToolStripMenuItem.Name = "applyToolStripMenuItem";
this.applyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.applyToolStripMenuItem.Text = "Apply";
this.applyToolStripMenuItem.Click += new System.EventHandler(this.button2_Click);
//
// toolsToolStripMenuItem
//
@@ -479,7 +488,9 @@
//
this.shiftUpToolStripMenuItem.Image = global::McBitFont.Properties.Resources.arrow_top;
this.shiftUpToolStripMenuItem.Name = "shiftUpToolStripMenuItem";
this.shiftUpToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftUpToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Up";
this.shiftUpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Up)));
this.shiftUpToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.shiftUpToolStripMenuItem.Text = "Shift Up";
this.shiftUpToolStripMenuItem.Click += new System.EventHandler(this.btnShiftUp_Click);
//
@@ -487,7 +498,9 @@
//
this.shiftDownToolStripMenuItem.Image = global::McBitFont.Properties.Resources.arrow_down;
this.shiftDownToolStripMenuItem.Name = "shiftDownToolStripMenuItem";
this.shiftDownToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftDownToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Down";
this.shiftDownToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Down)));
this.shiftDownToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.shiftDownToolStripMenuItem.Text = "Shift Down";
this.shiftDownToolStripMenuItem.Click += new System.EventHandler(this.btnShiftDown_Click);
//
@@ -495,7 +508,9 @@
//
this.shiftLeftToolStripMenuItem.Image = global::McBitFont.Properties.Resources.arrow_back;
this.shiftLeftToolStripMenuItem.Name = "shiftLeftToolStripMenuItem";
this.shiftLeftToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftLeftToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Left";
this.shiftLeftToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Left)));
this.shiftLeftToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.shiftLeftToolStripMenuItem.Text = "Shift left";
this.shiftLeftToolStripMenuItem.Click += new System.EventHandler(this.btnShiftLeft_Click);
//
@@ -503,31 +518,48 @@
//
this.shiftRightToolStripMenuItem.Image = global::McBitFont.Properties.Resources.arrow_next;
this.shiftRightToolStripMenuItem.Name = "shiftRightToolStripMenuItem";
this.shiftRightToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftRightToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Right";
this.shiftRightToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Right)));
this.shiftRightToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.shiftRightToolStripMenuItem.Text = "Shift Right";
this.shiftRightToolStripMenuItem.Click += new System.EventHandler(this.btnShiftRight_Click);
//
// invertToolStripMenuItem
//
this.invertToolStripMenuItem.Name = "invertToolStripMenuItem";
this.invertToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.invertToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+I";
this.invertToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.I)));
this.invertToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.invertToolStripMenuItem.Text = "Invert";
this.invertToolStripMenuItem.Click += new System.EventHandler(this.btnInvert_Click);
//
// mirrorXToolStripMenuItem
//
this.mirrorXToolStripMenuItem.Name = "mirrorXToolStripMenuItem";
this.mirrorXToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mirrorXToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+X";
this.mirrorXToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.X)));
this.mirrorXToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.mirrorXToolStripMenuItem.Text = "Mirror X";
this.mirrorXToolStripMenuItem.Click += new System.EventHandler(this.btnMirrorX_Click);
//
// mirrorYToolStripMenuItem
//
this.mirrorYToolStripMenuItem.Name = "mirrorYToolStripMenuItem";
this.mirrorYToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mirrorYToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Y";
this.mirrorYToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y)));
this.mirrorYToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.mirrorYToolStripMenuItem.Text = "Mirror Y";
this.mirrorYToolStripMenuItem.Click += new System.EventHandler(this.btnMirrorY_Click);
//
// exportToolStripMenuItem
//
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+E";
this.exportToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.E)));
this.exportToolStripMenuItem.Size = new System.Drawing.Size(197, 22);
this.exportToolStripMenuItem.Text = "Export";
this.exportToolStripMenuItem.Click += new System.EventHandler(this.button1_Click);
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Enabled = false;
@@ -545,19 +577,23 @@
this.dlgOpen.DefaultExt = "mbf";
this.dlgOpen.Filter = "McBitFont files|*.mbf|All files|*.*";
//
// applyToolStripMenuItem
// prependSymbolToolStripMenuItem
//
this.applyToolStripMenuItem.Name = "applyToolStripMenuItem";
this.applyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.applyToolStripMenuItem.Text = "Apply";
this.applyToolStripMenuItem.Click += new System.EventHandler(this.button2_Click);
this.prependSymbolToolStripMenuItem.Enabled = false;
this.prependSymbolToolStripMenuItem.Image = global::McBitFont.Properties.Resources.action_add;
this.prependSymbolToolStripMenuItem.Name = "prependSymbolToolStripMenuItem";
this.prependSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.prependSymbolToolStripMenuItem.Text = "Prepend symbol";
this.prependSymbolToolStripMenuItem.Click += new System.EventHandler(this.prependSymbolToolStripMenuItem_Click);
//
// exportToolStripMenuItem
// appendSymbolToolStripMenuItem
//
this.exportToolStripMenuItem.Name = "exportToolStripMenuItem";
this.exportToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exportToolStripMenuItem.Text = "Export";
this.exportToolStripMenuItem.Click += new System.EventHandler(this.button1_Click);
this.appendSymbolToolStripMenuItem.Enabled = false;
this.appendSymbolToolStripMenuItem.Image = global::McBitFont.Properties.Resources.action_add;
this.appendSymbolToolStripMenuItem.Name = "appendSymbolToolStripMenuItem";
this.appendSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.appendSymbolToolStripMenuItem.Text = "Append symbol";
this.appendSymbolToolStripMenuItem.Click += new System.EventHandler(this.prependSymbolToolStripMenuItem_Click);
//
// MainForm
//
@@ -630,7 +666,6 @@
private System.Windows.Forms.ToolStripMenuItem openToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem editToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem addSymbolToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem removeSymbolToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem shiftUpToolStripMenuItem;
@@ -645,6 +680,8 @@
private System.Windows.Forms.OpenFileDialog dlgOpen;
private System.Windows.Forms.ToolStripMenuItem applyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exportToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem prependSymbolToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem appendSymbolToolStripMenuItem;
}
}

View File

@@ -138,6 +138,8 @@ namespace McBitFont {
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
}
} else {
if (nudX.Focused) modified = true;
}
prjModified = true;
dotResize((int)nudX.Value, dotHeight);
@@ -389,7 +391,7 @@ namespace McBitFont {
frames[index] = f;
var sizedBMP = getMiniPictue(f);
string s = f.code.ToString();
string s = f.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)sizedBMP);
sizedBMP.Dispose();
@@ -490,7 +492,7 @@ namespace McBitFont {
}
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString();
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
codepage =(form.cbEncoding.SelectedItem as New.EncodingItem).Code;
var sss = decodeSymbol(ff.code);
@@ -503,6 +505,8 @@ namespace McBitFont {
prjName = "Untitled";
this.Text = "McBitFont " + version + " - " + prjName;
modified = false;
checkForAdd();
}
}
@@ -515,7 +519,9 @@ namespace McBitFont {
modified = false;
}
if (miniList.SelectedItems.Count == 0) {
miniList.Items[0].Selected = true;
removeSymbolToolStripMenuItem.Enabled = false;
return;
//miniList.Items[0].Selected = true;
}
var sel = miniList.SelectedItems[0];
int code = Convert.ToInt32(sel.ImageKey);
@@ -524,6 +530,12 @@ namespace McBitFont {
nudY.Value = ff.height;
f = ff;
dotPanel.Refresh();
ff = frames.Find(x => x.code == code);
if (frames.Count > 1 && (ff.Equals(frames.First()) || ff.Equals(frames.Last()))) {
removeSymbolToolStripMenuItem.Enabled = true;
} else {
removeSymbolToolStripMenuItem.Enabled = false;
}
}
private void saveToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -584,6 +596,49 @@ namespace McBitFont {
prjName = Path.GetFileNameWithoutExtension(dlgOpen.FileName);
this.Text = "McBitFont " + version + " - " + prjName;
checkForAdd();
}
}
private void removeSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
if (miniList.SelectedItems.Count == 0) {
removeSymbolToolStripMenuItem.Enabled = false;
return;
}
var sel = miniList.SelectedItems[0].ImageKey;
int code = Convert.ToInt32(miniList.SelectedItems[0].ImageKey);
FrameMiniature ff = frames.Find(x => x.code == code);
frames.Remove(ff);
miniList.SelectedItems[0].Remove();
//miniList.Items[0].Selected = true;
}
private void prependSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
FrameMiniature ff;
if (sender == prependSymbolToolStripMenuItem) {
ff = new FrameMiniature(frames.First().code - 1, dotWidth, dotHeight);
frames.Insert(0, ff);
} else {
ff = new FrameMiniature(frames.Last().code + 1, dotWidth, dotHeight);
frames.Add(ff);
}
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
var sss = decodeSymbol(ff.code);
miniList.Items.Add(s, s + ' ' + sss, s);
checkForAdd();
}
private void checkForAdd() {
if (frames.Count > 1) {
if (frames.First().code > 0) prependSymbolToolStripMenuItem.Enabled = true;
else prependSymbolToolStripMenuItem.Enabled = false;
if (frames.Last().code < 255) appendSymbolToolStripMenuItem.Enabled = true;
else appendSymbolToolStripMenuItem.Enabled = false;
} else {
prependSymbolToolStripMenuItem.Enabled = false;
appendSymbolToolStripMenuItem.Enabled = false;
}
}

BIN
icons_9x9.mbf Normal file

Binary file not shown.