Compare commits
7 Commits
Author | SHA1 | Date | |
---|---|---|---|
0d923ef8ed | |||
|
5e1a2085cf | ||
|
ca21c43926 | ||
|
c10a8e49ff | ||
|
5d17ba5538 | ||
4f80a5df1b | |||
37f2bb5eac |
@@ -233,7 +233,7 @@ namespace McBitFont {
|
|||||||
if (com && lines != 1 && fcount > 1) {
|
if (com && lines != 1 && fcount > 1) {
|
||||||
// Comments enabled and other than "1 symbol per line" selected
|
// Comments enabled and other than "1 symbol per line" selected
|
||||||
// Print a symbol comment before its data
|
// Print a symbol comment before its data
|
||||||
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code) + "\n";
|
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code) + "\n";
|
||||||
}
|
}
|
||||||
if (lines == 1) {
|
if (lines == 1) {
|
||||||
// "1 symbol per line" - new line offset
|
// "1 symbol per line" - new line offset
|
||||||
@@ -369,7 +369,7 @@ namespace McBitFont {
|
|||||||
if (!f.Equals(flast) && f.width > 0) output += ",";
|
if (!f.Equals(flast) && f.width > 0) output += ",";
|
||||||
if (com && fcount > 1) {
|
if (com && fcount > 1) {
|
||||||
//...with a comment
|
//...with a comment
|
||||||
output += " // " + f.code.ToString() + " --> " + mainForm.decodeSymbol(f.code);
|
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code);
|
||||||
}
|
}
|
||||||
output += "\n";
|
output += "\n";
|
||||||
}
|
}
|
||||||
|
78
McBitFont/Form1.Designer.cs
generated
78
McBitFont/Form1.Designer.cs
generated
@@ -74,6 +74,7 @@
|
|||||||
copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
|
selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
makeVarWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
makeVarWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||||
@@ -103,6 +104,9 @@
|
|||||||
chkHexCodes = new System.Windows.Forms.CheckBox();
|
chkHexCodes = new System.Windows.Forms.CheckBox();
|
||||||
chkRectSelect = new System.Windows.Forms.CheckBox();
|
chkRectSelect = new System.Windows.Forms.CheckBox();
|
||||||
label3 = new System.Windows.Forms.Label();
|
label3 = new System.Windows.Forms.Label();
|
||||||
|
lblSelectionLabel = new System.Windows.Forms.Label();
|
||||||
|
lblSelection = new System.Windows.Forms.Label();
|
||||||
|
lblModified = new System.Windows.Forms.Label();
|
||||||
((System.ComponentModel.ISupportInitialize)nudX).BeginInit();
|
((System.ComponentModel.ISupportInitialize)nudX).BeginInit();
|
||||||
((System.ComponentModel.ISupportInitialize)nudY).BeginInit();
|
((System.ComponentModel.ISupportInitialize)nudY).BeginInit();
|
||||||
panel1.SuspendLayout();
|
panel1.SuspendLayout();
|
||||||
@@ -613,7 +617,7 @@
|
|||||||
//
|
//
|
||||||
// editToolStripMenuItem
|
// editToolStripMenuItem
|
||||||
//
|
//
|
||||||
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem });
|
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem, selectAllToolStripMenuItem });
|
||||||
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
editToolStripMenuItem.Name = "editToolStripMenuItem";
|
||||||
editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
|
||||||
editToolStripMenuItem.Text = "Edit";
|
editToolStripMenuItem.Text = "Edit";
|
||||||
@@ -624,7 +628,7 @@
|
|||||||
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
|
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
|
||||||
undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
undoToolStripMenuItem.Name = "undoToolStripMenuItem";
|
||||||
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
|
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
|
||||||
undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
undoToolStripMenuItem.Text = "Undo";
|
undoToolStripMenuItem.Text = "Undo";
|
||||||
undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
|
undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
|
||||||
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
|
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
|
||||||
@@ -634,19 +638,18 @@
|
|||||||
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
|
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
|
||||||
redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
redoToolStripMenuItem.Name = "redoToolStripMenuItem";
|
||||||
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
|
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
|
||||||
redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
redoToolStripMenuItem.Text = "Redo";
|
redoToolStripMenuItem.Text = "Redo";
|
||||||
redoToolStripMenuItem.ToolTipText = "Redo canvas change";
|
redoToolStripMenuItem.ToolTipText = "Redo canvas change";
|
||||||
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
|
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
// copyToolStripMenuItem
|
// copyToolStripMenuItem
|
||||||
//
|
//
|
||||||
copyToolStripMenuItem.Enabled = false;
|
|
||||||
copyToolStripMenuItem.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
|
copyToolStripMenuItem.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
|
||||||
copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
copyToolStripMenuItem.Name = "copyToolStripMenuItem";
|
||||||
copyToolStripMenuItem.ShortcutKeyDisplayString = "";
|
copyToolStripMenuItem.ShortcutKeyDisplayString = "";
|
||||||
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
|
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
|
||||||
copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
copyToolStripMenuItem.Text = "Copy";
|
copyToolStripMenuItem.Text = "Copy";
|
||||||
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
|
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
|
||||||
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
|
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
|
||||||
@@ -658,7 +661,7 @@
|
|||||||
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
|
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
|
||||||
pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
|
pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
|
||||||
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
|
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
|
||||||
pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
pasteToolStripMenuItem.Text = "Paste";
|
pasteToolStripMenuItem.Text = "Paste";
|
||||||
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
|
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
|
||||||
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
|
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
|
||||||
@@ -667,10 +670,21 @@
|
|||||||
//
|
//
|
||||||
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
|
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
|
||||||
selectToolStripMenuItem.Name = "selectToolStripMenuItem";
|
selectToolStripMenuItem.Name = "selectToolStripMenuItem";
|
||||||
selectToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
|
selectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R;
|
||||||
|
selectToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
selectToolStripMenuItem.Text = "Select";
|
selectToolStripMenuItem.Text = "Select";
|
||||||
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click;
|
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click;
|
||||||
//
|
//
|
||||||
|
// selectAllToolStripMenuItem
|
||||||
|
//
|
||||||
|
selectAllToolStripMenuItem.Enabled = false;
|
||||||
|
selectAllToolStripMenuItem.Image = Properties.Resources.arrow_out;
|
||||||
|
selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
|
||||||
|
selectAllToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A;
|
||||||
|
selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
|
||||||
|
selectAllToolStripMenuItem.Text = "Select All";
|
||||||
|
selectAllToolStripMenuItem.Click += selectAllToolStripMenuItem_Click;
|
||||||
|
//
|
||||||
// fontToolStripMenuItem
|
// fontToolStripMenuItem
|
||||||
//
|
//
|
||||||
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem });
|
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem });
|
||||||
@@ -889,7 +903,7 @@
|
|||||||
btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
btnBaseline.Image = Properties.Resources.fam_base;
|
btnBaseline.Image = Properties.Resources.fam_base;
|
||||||
btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
btnBaseline.Location = new System.Drawing.Point(718, 92);
|
btnBaseline.Location = new System.Drawing.Point(812, 93);
|
||||||
btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
|
||||||
btnBaseline.Name = "btnBaseline";
|
btnBaseline.Name = "btnBaseline";
|
||||||
btnBaseline.Size = new System.Drawing.Size(88, 27);
|
btnBaseline.Size = new System.Drawing.Size(88, 27);
|
||||||
@@ -951,9 +965,9 @@
|
|||||||
chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button;
|
chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button;
|
||||||
chkRectSelect.Image = Properties.Resources.fam_rectt;
|
chkRectSelect.Image = Properties.Resources.fam_rectt;
|
||||||
chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
chkRectSelect.Location = new System.Drawing.Point(620, 92);
|
chkRectSelect.Location = new System.Drawing.Point(718, 93);
|
||||||
chkRectSelect.Name = "chkRectSelect";
|
chkRectSelect.Name = "chkRectSelect";
|
||||||
chkRectSelect.Size = new System.Drawing.Size(74, 27);
|
chkRectSelect.Size = new System.Drawing.Size(87, 27);
|
||||||
chkRectSelect.TabIndex = 23;
|
chkRectSelect.TabIndex = 23;
|
||||||
chkRectSelect.Text = " Select";
|
chkRectSelect.Text = " Select";
|
||||||
chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||||
@@ -972,11 +986,51 @@
|
|||||||
label3.TabIndex = 21;
|
label3.TabIndex = 21;
|
||||||
label3.Text = "Cursor:";
|
label3.Text = "Cursor:";
|
||||||
//
|
//
|
||||||
|
// lblSelectionLabel
|
||||||
|
//
|
||||||
|
lblSelectionLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblSelectionLabel.AutoSize = true;
|
||||||
|
lblSelectionLabel.Location = new System.Drawing.Point(616, 93);
|
||||||
|
lblSelectionLabel.Name = "lblSelectionLabel";
|
||||||
|
lblSelectionLabel.Size = new System.Drawing.Size(58, 15);
|
||||||
|
lblSelectionLabel.TabIndex = 25;
|
||||||
|
lblSelectionLabel.Text = "Selection:";
|
||||||
|
lblSelectionLabel.Visible = false;
|
||||||
|
//
|
||||||
|
// lblSelection
|
||||||
|
//
|
||||||
|
lblSelection.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblSelection.AutoSize = true;
|
||||||
|
lblSelection.Location = new System.Drawing.Point(617, 108);
|
||||||
|
lblSelection.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
|
||||||
|
lblSelection.Name = "lblSelection";
|
||||||
|
lblSelection.Size = new System.Drawing.Size(30, 15);
|
||||||
|
lblSelection.TabIndex = 24;
|
||||||
|
lblSelection.Text = "W,H";
|
||||||
|
lblSelection.TextAlign = System.Drawing.ContentAlignment.TopRight;
|
||||||
|
lblSelection.Visible = false;
|
||||||
|
//
|
||||||
|
// lblModified
|
||||||
|
//
|
||||||
|
lblModified.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
lblModified.AutoSize = true;
|
||||||
|
lblModified.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
|
||||||
|
lblModified.ForeColor = System.Drawing.SystemColors.Highlight;
|
||||||
|
lblModified.Location = new System.Drawing.Point(616, 78);
|
||||||
|
lblModified.Name = "lblModified";
|
||||||
|
lblModified.Size = new System.Drawing.Size(91, 15);
|
||||||
|
lblModified.TabIndex = 26;
|
||||||
|
lblModified.Text = "Frame modified";
|
||||||
|
lblModified.Visible = false;
|
||||||
|
//
|
||||||
// MainForm
|
// MainForm
|
||||||
//
|
//
|
||||||
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
|
||||||
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||||
ClientSize = new System.Drawing.Size(915, 647);
|
ClientSize = new System.Drawing.Size(915, 647);
|
||||||
|
Controls.Add(lblModified);
|
||||||
|
Controls.Add(lblSelectionLabel);
|
||||||
|
Controls.Add(lblSelection);
|
||||||
Controls.Add(chkRectSelect);
|
Controls.Add(chkRectSelect);
|
||||||
Controls.Add(chkHexCodes);
|
Controls.Add(chkHexCodes);
|
||||||
Controls.Add(label3);
|
Controls.Add(label3);
|
||||||
@@ -1099,6 +1153,10 @@
|
|||||||
private System.Windows.Forms.CheckBox chkRectSelect;
|
private System.Windows.Forms.CheckBox chkRectSelect;
|
||||||
private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
|
private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
|
||||||
private System.Windows.Forms.ToolStripMenuItem importTextToolStripMenuItem1;
|
private System.Windows.Forms.ToolStripMenuItem importTextToolStripMenuItem1;
|
||||||
|
private System.Windows.Forms.Label lblSelectionLabel;
|
||||||
|
private System.Windows.Forms.Label lblSelection;
|
||||||
|
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
|
||||||
|
private System.Windows.Forms.Label lblModified;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -57,7 +57,7 @@ namespace McBitFont {
|
|||||||
public bool monospaced = false;
|
public bool monospaced = false;
|
||||||
private bool modified = false;
|
private bool modified = false;
|
||||||
private bool prjModified = false;
|
private bool prjModified = false;
|
||||||
public const string version = "2.0";
|
public const string version = "2.2";
|
||||||
public string prjName = "Untitled";
|
public string prjName = "Untitled";
|
||||||
public string prjFileName = "";
|
public string prjFileName = "";
|
||||||
private int codepage = 1251;
|
private int codepage = 1251;
|
||||||
@@ -70,6 +70,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
public MainForm() {
|
public MainForm() {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
this.dotPanel.MouseWheel += new MouseEventHandler(this.DotPanel_MouseWheel);
|
this.dotPanel.MouseWheel += new MouseEventHandler(this.DotPanel_MouseWheel);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -78,6 +79,22 @@ namespace McBitFont {
|
|||||||
h = pixelOffset + dotHeight * (cellSize + gap);
|
h = pixelOffset + dotHeight * (cellSize + gap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void UpdateSelectionLabel(int width, int height) {
|
||||||
|
lblSelection.Text = width.ToString() + ',' + height.ToString();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void SetModified(bool modif = true, bool prj = false) {
|
||||||
|
string suffix = "";
|
||||||
|
if (prj) {
|
||||||
|
prjModified = modif;
|
||||||
|
if (modif) suffix = " *";
|
||||||
|
SetWindowCap(suffix);
|
||||||
|
} else {
|
||||||
|
modified = modif;
|
||||||
|
lblModified.Visible = modif;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void Form1_Load(object sender, EventArgs e) {
|
private void Form1_Load(object sender, EventArgs e) {
|
||||||
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
|
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
|
||||||
tsmiMakeVarWidth.Visible = monospaced;
|
tsmiMakeVarWidth.Visible = monospaced;
|
||||||
@@ -87,6 +104,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
selection1 = new Point(0, 0);
|
selection1 = new Point(0, 0);
|
||||||
selection2 = new Point(dotWidth - 1, dotHeight - 1);
|
selection2 = new Point(dotWidth - 1, dotHeight - 1);
|
||||||
|
UpdateSelectionLabel(dotWidth, dotHeight);
|
||||||
|
|
||||||
gap = (cellSize < 5) ? 0 : 1;
|
gap = (cellSize < 5) ? 0 : 1;
|
||||||
SetNewWH();
|
SetNewWH();
|
||||||
@@ -118,7 +136,7 @@ namespace McBitFont {
|
|||||||
tsmiCodeShift.Visible = frames.Count > 1;
|
tsmiCodeShift.Visible = frames.Count > 1;
|
||||||
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
|
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
|
||||||
|
|
||||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
@@ -128,9 +146,19 @@ namespace McBitFont {
|
|||||||
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
|
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FrameMiniature CopyFrame(FrameMiniature frame) {
|
private FrameMiniature CopyFrame(FrameMiniature frame, bool clipboard = false) {
|
||||||
var ff = new FrameMiniature(frame.code, frame.width, frame.height);
|
int width = chkRectSelect.Checked ? selection2.X - selection1.X + 1 : frame.width;
|
||||||
Array.Copy(frame.data, ff.data, frame.data.Length);
|
int height = chkRectSelect.Checked ? selection2.Y - selection1.Y + 1 : frame.height;
|
||||||
|
var ff = new FrameMiniature(frame.code, width, height);
|
||||||
|
|
||||||
|
if (chkRectSelect.Checked && clipboard) {
|
||||||
|
for (int i = 0; i <= selection2.X - selection1.X; i++)
|
||||||
|
for (int j = 0; j <= selection2.Y - selection1.Y; j++) {
|
||||||
|
ff.data[i, j] = frame.data[i + selection1.X, j + selection1.Y];
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
Array.Copy(frame.data, ff.data, frame.data.Length);
|
||||||
|
|
||||||
return ff;
|
return ff;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,10 +205,10 @@ namespace McBitFont {
|
|||||||
ilMiniatures.Images.Add(s, (Image)bmp);
|
ilMiniatures.Images.Add(s, (Image)bmp);
|
||||||
miniList.Items[s].ImageKey = s;
|
miniList.Items[s].ImageKey = s;
|
||||||
}
|
}
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
}
|
}
|
||||||
if (nudX.Focused) {
|
if (nudX.Focused) {
|
||||||
modified = true;
|
SetModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
DotResize((int)nudX.Value, dotHeight);
|
DotResize((int)nudX.Value, dotHeight);
|
||||||
@@ -199,8 +227,8 @@ namespace McBitFont {
|
|||||||
miniList.Items[s].ImageKey = s;
|
miniList.Items[s].ImageKey = s;
|
||||||
}
|
}
|
||||||
if (nudY.Focused) {
|
if (nudY.Focused) {
|
||||||
modified = true;
|
SetModified();
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
DotResize(dotWidth, (int)nudY.Value);
|
DotResize(dotWidth, (int)nudY.Value);
|
||||||
@@ -239,8 +267,14 @@ namespace McBitFont {
|
|||||||
f = FrameResize(f, ww, hh);
|
f = FrameResize(f, ww, hh);
|
||||||
dotWidth = ww;
|
dotWidth = ww;
|
||||||
dotHeight = hh;
|
dotHeight = hh;
|
||||||
if (selection2.X > dotWidth - 1) selection2.X = dotWidth - 1;
|
if (selection2.X > dotWidth - 1) {
|
||||||
if (selection2.Y > dotHeight - 1) selection2.Y = dotHeight - 1;
|
selection2.X = dotWidth - 1;
|
||||||
|
UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1);
|
||||||
|
}
|
||||||
|
if (selection2.Y > dotHeight - 1) {
|
||||||
|
selection2.Y = dotHeight - 1;
|
||||||
|
UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1);
|
||||||
|
}
|
||||||
SetNewWH();
|
SetNewWH();
|
||||||
cbZoom_SelectedIndexChanged(cbZoom, null);
|
cbZoom_SelectedIndexChanged(cbZoom, null);
|
||||||
|
|
||||||
@@ -306,7 +340,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -329,7 +363,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -352,7 +386,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -374,7 +408,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -455,6 +489,9 @@ namespace McBitFont {
|
|||||||
Point p1 = new(selection1.X, selection1.Y);
|
Point p1 = new(selection1.X, selection1.Y);
|
||||||
Point p2 = new(selection2.X, selection2.Y);
|
Point p2 = new(selection2.X, selection2.Y);
|
||||||
NormPoints(ref p1, ref p2);
|
NormPoints(ref p1, ref p2);
|
||||||
|
|
||||||
|
UpdateSelectionLabel(p2.X - p1.X + 1, p2.Y - p1.Y + 1);
|
||||||
|
|
||||||
x = pixelOffset + (p1.X - 1) * (cellSize + gap) - hScroll.Value - 1;
|
x = pixelOffset + (p1.X - 1) * (cellSize + gap) - hScroll.Value - 1;
|
||||||
y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1;
|
y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1;
|
||||||
x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1;
|
x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1;
|
||||||
@@ -482,7 +519,7 @@ namespace McBitFont {
|
|||||||
fChanged = true;
|
fChanged = true;
|
||||||
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
||||||
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
||||||
modified = true;
|
SetModified();
|
||||||
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
||||||
dotPanel.Invalidate(rect1);
|
dotPanel.Invalidate(rect1);
|
||||||
}
|
}
|
||||||
@@ -491,7 +528,7 @@ namespace McBitFont {
|
|||||||
fChanged = true;
|
fChanged = true;
|
||||||
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
||||||
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
||||||
modified = true;
|
SetModified();
|
||||||
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
||||||
dotPanel.Invalidate(rect1);
|
dotPanel.Invalidate(rect1);
|
||||||
}
|
}
|
||||||
@@ -513,7 +550,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -537,7 +574,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -561,7 +598,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -572,7 +609,7 @@ namespace McBitFont {
|
|||||||
} else {
|
} else {
|
||||||
f = CopyFrame(frames.Find(x => x.code == f.code));
|
f = CopyFrame(frames.Find(x => x.code == f.code));
|
||||||
}
|
}
|
||||||
modified = false;
|
SetModified(false); ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -593,8 +630,8 @@ namespace McBitFont {
|
|||||||
ilMiniatures.Images.RemoveByKey(s);
|
ilMiniatures.Images.RemoveByKey(s);
|
||||||
ilMiniatures.Images.Add(s, (Image)sizedBMP);
|
ilMiniatures.Images.Add(s, (Image)sizedBMP);
|
||||||
sizedBMP.Dispose();
|
sizedBMP.Dispose();
|
||||||
modified = false;
|
SetModified(false);
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private static Bitmap GetMiniPictue(FrameMiniature m) {
|
private static Bitmap GetMiniPictue(FrameMiniature m) {
|
||||||
@@ -681,14 +718,14 @@ namespace McBitFont {
|
|||||||
Application.Exit();
|
Application.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public string decodeSymbol(int code) {
|
public string DecodeSymbol(int code) {
|
||||||
var enc = Encoding.GetEncoding(codepage);
|
var enc = Encoding.GetEncoding(codepage);
|
||||||
if (code < 32) return "";
|
if (code < 32) return "";
|
||||||
return enc.GetString(new byte[] { (byte)code });
|
return enc.GetString(new byte[] { (byte)code });
|
||||||
}
|
}
|
||||||
|
|
||||||
private FrameMiniature DrawFrameChar(FrameMiniature ff, Font font, int sx, int sy) {
|
private FrameMiniature DrawFrameChar(FrameMiniature ff, Font font, int sx, int sy) {
|
||||||
string s = decodeSymbol(ff.code);
|
string s = DecodeSymbol(ff.code);
|
||||||
Bitmap bmp = new Bitmap(ff.width, ff.height);
|
Bitmap bmp = new Bitmap(ff.width, ff.height);
|
||||||
Graphics g = Graphics.FromImage(bmp);
|
Graphics g = Graphics.FromImage(bmp);
|
||||||
g.Clear(Color.White);
|
g.Clear(Color.White);
|
||||||
@@ -713,7 +750,7 @@ namespace McBitFont {
|
|||||||
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
CheckModifiedFrame();
|
CheckModifiedFrame();
|
||||||
if (CheckModifiedProject()) return;
|
if (CheckModifiedProject()) return;
|
||||||
|
|
||||||
New form = new New(this);
|
New form = new New(this);
|
||||||
if (form.ShowDialog() == DialogResult.OK) {
|
if (form.ShowDialog() == DialogResult.OK) {
|
||||||
Cursor.Current = Cursors.WaitCursor;
|
Cursor.Current = Cursors.WaitCursor;
|
||||||
@@ -766,7 +803,7 @@ namespace McBitFont {
|
|||||||
foreach (FrameMiniature ff in frames) {
|
foreach (FrameMiniature ff in frames) {
|
||||||
var s = ff.code.ToString().PadLeft(3, '0');
|
var s = ff.code.ToString().PadLeft(3, '0');
|
||||||
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
||||||
var sss = decodeSymbol(ff.code);
|
var sss = DecodeSymbol(ff.code);
|
||||||
miniList.Items.Add(s, s + ' ' + append + sss, s);
|
miniList.Items.Add(s, s + ' ' + append + sss, s);
|
||||||
}
|
}
|
||||||
f = CopyFrame(frames.First());
|
f = CopyFrame(frames.First());
|
||||||
@@ -777,7 +814,7 @@ namespace McBitFont {
|
|||||||
prjName = "Untitled";
|
prjName = "Untitled";
|
||||||
prjFileName = "";
|
prjFileName = "";
|
||||||
SetWindowCap();
|
SetWindowCap();
|
||||||
modified = false;
|
SetModified(false); ;
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
fbuffer = false;
|
fbuffer = false;
|
||||||
miniList.Items[0].Selected = true;
|
miniList.Items[0].Selected = true;
|
||||||
@@ -801,7 +838,7 @@ namespace McBitFont {
|
|||||||
tsmiRemoveSymbol.Enabled = false;
|
tsmiRemoveSymbol.Enabled = false;
|
||||||
tsmiRemoveBefore.Enabled = false;
|
tsmiRemoveBefore.Enabled = false;
|
||||||
tsmiRemoveAfter.Enabled = false;
|
tsmiRemoveAfter.Enabled = false;
|
||||||
copyToolStripMenuItem.Enabled = false;
|
//copyToolStripMenuItem.Enabled = false;
|
||||||
pasteToolStripMenuItem.Enabled = false;
|
pasteToolStripMenuItem.Enabled = false;
|
||||||
return;
|
return;
|
||||||
//miniList.Items[0].Selected = true;
|
//miniList.Items[0].Selected = true;
|
||||||
@@ -825,7 +862,7 @@ namespace McBitFont {
|
|||||||
removeSymbolToolStripMenuItem.Enabled = false;
|
removeSymbolToolStripMenuItem.Enabled = false;
|
||||||
tsmiRemoveSymbol.Enabled = false;
|
tsmiRemoveSymbol.Enabled = false;
|
||||||
}
|
}
|
||||||
copyToolStripMenuItem.Enabled = true;
|
//copyToolStripMenuItem.Enabled = true;
|
||||||
if (ff.Equals(frames.First())) {
|
if (ff.Equals(frames.First())) {
|
||||||
removeBeforeToolStripMenuItem.Enabled = false;
|
removeBeforeToolStripMenuItem.Enabled = false;
|
||||||
removeAfterToolStripMenuItem.Enabled = true;
|
removeAfterToolStripMenuItem.Enabled = true;
|
||||||
@@ -874,7 +911,7 @@ namespace McBitFont {
|
|||||||
foreach (FrameMiniature ff in frames) {
|
foreach (FrameMiniature ff in frames) {
|
||||||
var s = ff.code.ToString().PadLeft(3, '0');
|
var s = ff.code.ToString().PadLeft(3, '0');
|
||||||
var sHex = 'x' + Convert.ToString(ff.code, 16).PadLeft(2, '0').ToUpper();
|
var sHex = 'x' + Convert.ToString(ff.code, 16).PadLeft(2, '0').ToUpper();
|
||||||
var sss = decodeSymbol(ff.code);
|
var sss = DecodeSymbol(ff.code);
|
||||||
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
||||||
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
|
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
|
||||||
}
|
}
|
||||||
@@ -882,14 +919,16 @@ namespace McBitFont {
|
|||||||
nudY.ValueChanged -= nudY_ValueChanged;
|
nudY.ValueChanged -= nudY_ValueChanged;
|
||||||
nudX.Value = frames.First().width;
|
nudX.Value = frames.First().width;
|
||||||
nudY.Value = frames.First().height;
|
nudY.Value = frames.First().height;
|
||||||
|
selection1.X = 0; selection1.Y = 0;
|
||||||
|
selection2.X = (int)nudX.Value - 1; selection2.Y = (int)nudY.Value - 1;
|
||||||
DotResize((int)nudX.Value, (int)nudY.Value);
|
DotResize((int)nudX.Value, (int)nudY.Value);
|
||||||
nudX.ValueChanged += nudX_ValueChanged;
|
nudX.ValueChanged += nudX_ValueChanged;
|
||||||
nudY.ValueChanged += nudY_ValueChanged;
|
nudY.ValueChanged += nudY_ValueChanged;
|
||||||
f = CopyFrame(frames.First());
|
f = CopyFrame(frames.First());
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
miniList.Refresh();
|
miniList.Refresh();
|
||||||
modified = false;
|
SetModified(false);
|
||||||
prjModified = false;
|
SetModified(false, true);
|
||||||
|
|
||||||
prjFileName = filename;
|
prjFileName = filename;
|
||||||
prjName = Path.GetFileNameWithoutExtension(filename);
|
prjName = Path.GetFileNameWithoutExtension(filename);
|
||||||
@@ -899,6 +938,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
fbuffer = false;
|
fbuffer = false;
|
||||||
|
//copyToolStripMenuItem.Enabled = true;
|
||||||
|
|
||||||
// Re-create history object
|
// Re-create history object
|
||||||
history = new CanvasHistory();
|
history = new CanvasHistory();
|
||||||
@@ -921,18 +961,18 @@ namespace McBitFont {
|
|||||||
MessagePackSerializer.Serialize(ms, sav);
|
MessagePackSerializer.Serialize(ms, sav);
|
||||||
ms.Close();
|
ms.Close();
|
||||||
}
|
}
|
||||||
prjModified = false;
|
|
||||||
prjName = Path.GetFileNameWithoutExtension(filename);
|
prjName = Path.GetFileNameWithoutExtension(filename);
|
||||||
prjFileName = filename;
|
prjFileName = filename;
|
||||||
SetWindowCap();
|
SetModified(false, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetWindowCap() {
|
private void SetWindowCap(string suffix = "") {
|
||||||
this.Text = "McBitFont v" + version + " - " + prjName;
|
this.Text = "McBitFont v" + version + " - " + prjName + suffix;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
CheckModifiedFrame();
|
CheckModifiedFrame();
|
||||||
if (CheckModifiedProject()) return;
|
if (CheckModifiedProject()) return;
|
||||||
@@ -968,7 +1008,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
var s = ff.code.ToString().PadLeft(3, '0');
|
var s = ff.code.ToString().PadLeft(3, '0');
|
||||||
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
|
||||||
var sss = decodeSymbol(ff.code);
|
var sss = DecodeSymbol(ff.code);
|
||||||
miniList.Items.Add(s, s + ' ' + sss, s);
|
miniList.Items.Add(s, s + ' ' + sss, s);
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
}
|
}
|
||||||
@@ -999,26 +1039,40 @@ namespace McBitFont {
|
|||||||
|
|
||||||
private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
fbuffer = true;
|
fbuffer = true;
|
||||||
fbuf = CopyFrame(f);
|
fbuf = CopyFrame(f, true);
|
||||||
pasteToolStripMenuItem.Enabled = true;
|
pasteToolStripMenuItem.Enabled = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
|
history.AddPre(f);
|
||||||
if (fbuf.width == f.width && fbuf.height == f.height) {
|
if (fbuf.width == f.width && fbuf.height == f.height) {
|
||||||
Array.Copy(fbuf.data, f.data, fbuf.data.Length);
|
Array.Copy(fbuf.data, f.data, fbuf.data.Length);
|
||||||
} else {
|
} else {
|
||||||
var wmax = (fbuf.width > f.width) ? f.width : fbuf.width;
|
int di, dj, wmax, hmax, selw, selh;
|
||||||
var hmax = (fbuf.height > f.height) ? f.height : fbuf.height;
|
if (chkRectSelect.Checked) {
|
||||||
|
di = selection1.X;
|
||||||
|
dj = selection1.Y;
|
||||||
|
selw = selection2.X - selection1.X + 1;
|
||||||
|
selh = selection2.Y - selection1.Y + 1;
|
||||||
|
wmax = fbuf.width > selw ? selw : fbuf.width;
|
||||||
|
hmax = fbuf.height > selh ? selh : fbuf.height;
|
||||||
|
} else {
|
||||||
|
di = 0;
|
||||||
|
dj = 0;
|
||||||
|
wmax = (fbuf.width > f.width) ? f.width : fbuf.width;
|
||||||
|
hmax = (fbuf.height > f.height) ? f.height : fbuf.height;
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < wmax; i++) {
|
for (int i = 0; i < wmax; i++) {
|
||||||
for (int j = 0; j < hmax; j++) {
|
for (int j = 0; j < hmax; j++) {
|
||||||
f.data[i, j] = fbuf.data[i, j];
|
f.data[i + di, j + dj] = fbuf.data[i, j];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
history.AddPost(f);
|
||||||
|
CheckHistoryButtons();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
modified = true;
|
SetModified();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
@@ -1036,7 +1090,7 @@ namespace McBitFont {
|
|||||||
if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
||||||
SaveFrame();
|
SaveFrame();
|
||||||
}
|
}
|
||||||
modified = false;
|
SetModified(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1076,7 +1130,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
modified = true;
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1089,6 +1143,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
|
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
|
||||||
|
CheckModifiedFrame();
|
||||||
if (prjModified) {
|
if (prjModified) {
|
||||||
if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) {
|
if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) {
|
||||||
e.Cancel = true;
|
e.Cancel = true;
|
||||||
@@ -1122,7 +1177,7 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
//dotPanel.Refresh();
|
//dotPanel.Refresh();
|
||||||
miniList.Refresh();
|
miniList.Refresh();
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
@@ -1138,7 +1193,7 @@ namespace McBitFont {
|
|||||||
makeVarWidthToolStripMenuItem.Visible = false;
|
makeVarWidthToolStripMenuItem.Visible = false;
|
||||||
tsmiMakeVarWidth.Visible = false;
|
tsmiMakeVarWidth.Visible = false;
|
||||||
lblType.Text = "Variable width / Single";
|
lblType.Text = "Variable width / Single";
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void CheckHistoryButtons() {
|
public void CheckHistoryButtons() {
|
||||||
@@ -1189,7 +1244,7 @@ namespace McBitFont {
|
|||||||
frames[i] = ff;
|
frames[i] = ff;
|
||||||
|
|
||||||
var key = ff.code.ToString().PadLeft(3, '0');
|
var key = ff.code.ToString().PadLeft(3, '0');
|
||||||
var text = decodeSymbol(ff.code);
|
var text = DecodeSymbol(ff.code);
|
||||||
ilMiniatures.Images.Add(key, (Image)GetMiniPictue(ff));
|
ilMiniatures.Images.Add(key, (Image)GetMiniPictue(ff));
|
||||||
miniList.Items.Add(key, key + ' ' + text, key);
|
miniList.Items.Add(key, key + ' ' + text, key);
|
||||||
}
|
}
|
||||||
@@ -1204,7 +1259,7 @@ namespace McBitFont {
|
|||||||
|
|
||||||
history.Clear();
|
history.Clear();
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1218,8 +1273,9 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
history.AddPost(f);
|
history.AddPost(f);
|
||||||
|
CheckHistoryButtons();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
modified = true;
|
SetModified();
|
||||||
}
|
}
|
||||||
iform.Dispose();
|
iform.Dispose();
|
||||||
}
|
}
|
||||||
@@ -1228,7 +1284,7 @@ namespace McBitFont {
|
|||||||
if (frames.Count == 1) return;
|
if (frames.Count == 1) return;
|
||||||
foreach (ListViewItem item in miniList.Items) {
|
foreach (ListViewItem item in miniList.Items) {
|
||||||
var code = Convert.ToInt32(item.ImageKey);
|
var code = Convert.ToInt32(item.ImageKey);
|
||||||
var symbol = decodeSymbol(code);
|
var symbol = DecodeSymbol(code);
|
||||||
if (chkHexCodes.Checked) {
|
if (chkHexCodes.Checked) {
|
||||||
var sHex = 'x' + Convert.ToString(code, 16).PadLeft(2, '0').ToUpper();
|
var sHex = 'x' + Convert.ToString(code, 16).PadLeft(2, '0').ToUpper();
|
||||||
item.Text = sHex + ' ' + symbol;
|
item.Text = sHex + ' ' + symbol;
|
||||||
@@ -1240,6 +1296,8 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void chkRectSelect_CheckedChanged(object sender, EventArgs e) {
|
private void chkRectSelect_CheckedChanged(object sender, EventArgs e) {
|
||||||
|
lblSelection.Visible = lblSelectionLabel.Visible = chkRectSelect.Checked;
|
||||||
|
selectAllToolStripMenuItem.Enabled = chkRectSelect.Checked;
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1280,11 +1338,11 @@ namespace McBitFont {
|
|||||||
w = w.Remove(w.IndexOf("0b"), 2);
|
w = w.Remove(w.IndexOf("0b"), 2);
|
||||||
numBase = 2;
|
numBase = 2;
|
||||||
}
|
}
|
||||||
if (w.Contains("0x") ) { // Check if value is written as hexadecimal
|
if (w.Contains("0x")) { // Check if value is written as hexadecimal
|
||||||
w = w.Remove(w.IndexOf("0x"), 2);
|
w = w.Remove(w.IndexOf("0x"), 2);
|
||||||
numBase = 16;
|
numBase = 16;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
try { // Try to convert a number from text
|
try { // Try to convert a number from text
|
||||||
data.Add(Convert.ToUInt32(w, numBase));
|
data.Add(Convert.ToUInt32(w, numBase));
|
||||||
@@ -1292,14 +1350,14 @@ namespace McBitFont {
|
|||||||
catch {
|
catch {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
//MessageBox.Show(w + ": Length: " + w.Length + " Bits: " + bits + " Converted: " + data.Last() + "\nData length: " + data.Count);
|
//MessageBox.Show(w + ": Length: " + w.Length + " Bits: " + bits + " Converted: " + data.Last() + "\nData length: " + data.Count);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (MessageBox.Show(bits + "-bit font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5) + "\nDo you want to load it?", "Import from text file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
if (MessageBox.Show(bits + "-bit font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5) + "\nDo you want to load it?", "Import from text file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
||||||
// Font header
|
// Font header
|
||||||
bool packed = data.ElementAt(0) == 1;
|
bool packed = data.ElementAt(0) == 1;
|
||||||
int width= (int)data.ElementAt(1);
|
int width = (int)data.ElementAt(1);
|
||||||
int height = (int)data.ElementAt(2);
|
int height = (int)data.ElementAt(2);
|
||||||
int first = (int)data.ElementAt(4);
|
int first = (int)data.ElementAt(4);
|
||||||
int last = (int)data.ElementAt(5);
|
int last = (int)data.ElementAt(5);
|
||||||
@@ -1340,12 +1398,12 @@ namespace McBitFont {
|
|||||||
|
|
||||||
var s = (last - first > 0) ? newf.code.ToString().PadLeft(3, '0') : "000";
|
var s = (last - first > 0) ? newf.code.ToString().PadLeft(3, '0') : "000";
|
||||||
var sHex = (last - first > 0) ? 'x' + Convert.ToString(newf.code, 16).PadLeft(2, '0').ToUpper() : "0x0";
|
var sHex = (last - first > 0) ? 'x' + Convert.ToString(newf.code, 16).PadLeft(2, '0').ToUpper() : "0x0";
|
||||||
var sss = (last - first > 0) ? decodeSymbol(newf.code) : "Single";
|
var sss = (last - first > 0) ? DecodeSymbol(newf.code) : "Single";
|
||||||
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(newf));
|
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(newf));
|
||||||
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
|
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
prjModified = true;
|
SetModified(true, true);
|
||||||
if (miniList.Items.Count > 0) miniList.Items[0].Selected = true;
|
if (miniList.Items.Count > 0) miniList.Items[0].Selected = true;
|
||||||
f = frames[0];
|
f = frames[0];
|
||||||
dotWidth = f.width;
|
dotWidth = f.width;
|
||||||
@@ -1358,5 +1416,13 @@ namespace McBitFont {
|
|||||||
//MessageBox.Show(bits + "-font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5));
|
//MessageBox.Show(bits + "-font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
|
selection1.X = 0;
|
||||||
|
selection1.Y = 0;
|
||||||
|
selection2.X = dotWidth - 1;
|
||||||
|
selection2.Y = dotHeight - 1;
|
||||||
|
dotPanel.Refresh();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -20,8 +20,10 @@
|
|||||||
<UseWindowsForms>true</UseWindowsForms>
|
<UseWindowsForms>true</UseWindowsForms>
|
||||||
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
|
||||||
<ApplicationIcon>icon_64.ico</ApplicationIcon>
|
<ApplicationIcon>icon_64.ico</ApplicationIcon>
|
||||||
<AssemblyVersion>2.0.0.0</AssemblyVersion>
|
<AssemblyVersion>2.2.0.0</AssemblyVersion>
|
||||||
<FileVersion>2.0.0.0</FileVersion>
|
<FileVersion>2.2.0.0</FileVersion>
|
||||||
|
<Version>$(VersionPrefix)2.2.0</Version>
|
||||||
|
<Copyright>Anton Mukhin</Copyright>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
<DebugType>portable</DebugType>
|
<DebugType>portable</DebugType>
|
||||||
|
@@ -108,8 +108,8 @@ namespace McBitFont {
|
|||||||
|
|
||||||
Bitmap bmp, result;
|
Bitmap bmp, result;
|
||||||
Graphics g;
|
Graphics g;
|
||||||
chars[0] = mainForm.decodeSymbol((int)nudChar1.Value);
|
chars[0] = mainForm.DecodeSymbol((int)nudChar1.Value);
|
||||||
chars[1] = mainForm.decodeSymbol((int)nudChar2.Value);
|
chars[1] = mainForm.DecodeSymbol((int)nudChar2.Value);
|
||||||
for (int i = 0; i < 2; i++) {
|
for (int i = 0; i < 2; i++) {
|
||||||
bmp = new Bitmap((int)nudNewX.Value, (int)nudNewY.Value);
|
bmp = new Bitmap((int)nudNewX.Value, (int)nudNewY.Value);
|
||||||
g = Graphics.FromImage(bmp);
|
g = Graphics.FromImage(bmp);
|
||||||
|
10
McBitFont/Properties/Resources.Designer.cs
generated
10
McBitFont/Properties/Resources.Designer.cs
generated
@@ -80,6 +80,16 @@ namespace McBitFont.Properties {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
|
/// </summary>
|
||||||
|
internal static System.Drawing.Bitmap arrow_out {
|
||||||
|
get {
|
||||||
|
object obj = ResourceManager.GetObject("arrow_out", resourceCulture);
|
||||||
|
return ((System.Drawing.Bitmap)(obj));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
/// Looks up a localized resource of type System.Drawing.Bitmap.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@@ -142,6 +142,9 @@
|
|||||||
<data name="arrow_redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="arrow_redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="Famfamfam-Silk-Disk.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
|
<value>..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
|
</data>
|
||||||
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icon" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
@@ -202,8 +205,8 @@
|
|||||||
<data name="Famfamfam-Silk-Page-white.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Famfamfam-Silk-Page-white.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Famfamfam-Silk-Page-white.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Famfamfam-Silk-Page-white.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Famfamfam-Silk-Disk.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="folder_table" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="Canvas_Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="Canvas_Fill" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\Canvas_Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\Canvas_Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
@@ -223,7 +226,7 @@
|
|||||||
<data name="icon_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="icon_64" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\icon_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\icon_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="folder_table" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
<data name="arrow_out" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||||
<value>..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
<value>..\Resources\arrow_out.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||||
</data>
|
</data>
|
||||||
</root>
|
</root>
|
BIN
McBitFont/Resources/arrow_out.png
Normal file
BIN
McBitFont/Resources/arrow_out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 594 B |
33
TODO.txt
33
TODO.txt
@@ -1,28 +1,15 @@
|
|||||||
Application:
|
Application:
|
||||||
V Migrate from .Net Framework 4.7 to .NET 9
|
V Move Select and Baseline buttons right
|
||||||
V New Save file format! Use McBitFont v1.7 to convert old save files to the new format.
|
V Display RectSelection width and width
|
||||||
V Better quality pictures in symbol list
|
V Indicate modified project by adding "*" to window caption
|
||||||
V Spinning cursor when application is busy
|
|
||||||
V Change Menu icons
|
|
||||||
V Re-arranged menu items
|
|
||||||
V Option to display codes in Hex numbers
|
|
||||||
V Make symbol list wider to display 8 characters instead of 7
|
|
||||||
|
|
||||||
Functionality:
|
Functionality:
|
||||||
V Fill canvas button
|
V Copy/Paste should be aware of rectangle selection
|
||||||
V Context menu in symbol navigator
|
V Select All function
|
||||||
V Delete symbols before/after selected
|
V Select and Select All shortcuts
|
||||||
V Shift all symbols on code line (change symbol codes)
|
|
||||||
V Specify starting code (extends the shift)
|
|
||||||
V Ability to make monospaced font a variable width one
|
|
||||||
V Undo/Redo for canvas changes
|
|
||||||
V Image import from a file
|
|
||||||
V Import from a text array
|
|
||||||
V Rectangle selection to mass-paint, shift and mirror pixels etc...
|
|
||||||
V "Packed" fonts export
|
|
||||||
V "Bytes total comment in export
|
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
V Improper bytes count for 16 or 32 bit numbers export
|
V EncodingProvider hotfix
|
||||||
V Exception on Code Shift when nothing is selected in Symbols List
|
V Check if frame changed before exit application
|
||||||
V Wrongly mark Project as modified on symbol selection
|
V Hostory does not record pastes from clipboard
|
||||||
|
V Undo/Redo menu availability recalculation does not happen sometimes
|
||||||
|
Binary file not shown.
BIN
icons/famfamfam/arrow_out.png
Normal file
BIN
icons/famfamfam/arrow_out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 594 B |
Reference in New Issue
Block a user