TODO features:

Application:
V Export comments now respects "Code in Hex" checkbox on the main form

Bugs:
V Frame modified flag persists when switching to another frame after rejected to save previous frame
V Ctrl-C, Ctrl-V doesn't work in the Note editbox because it tries to copy/paste the frame!
V Post "Backslash" instead of \ in comments
This commit is contained in:
2025-07-17 02:21:41 +03:00
parent dd3309d8ea
commit fe63d1bfab
5 changed files with 77 additions and 53 deletions

View File

@@ -233,7 +233,12 @@ 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); string character = f.code switch {
92 => "Backslash",
_ => mainForm.DecodeSymbol(f.code),
};
string code = mainForm.chkHexCodes.Checked ? "0x" + Convert.ToString(f.code, 16).PadLeft(2, '0').ToUpper() : f.code.ToString();
output += " // " + code + " --> " + character;
if (f.note != "" && f.note != null) output += " (" + f.note.ToString() + ")"; if (f.note != "" && f.note != null) output += " (" + f.note.ToString() + ")";
output += "\n"; output += "\n";
} }
@@ -371,7 +376,12 @@ 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); string character = f.code switch {
92 => "Backslash",
_ => mainForm.DecodeSymbol(f.code),
};
string code = mainForm.chkHexCodes.Checked ? "0x" + Convert.ToString(f.code, 16).PadLeft(2, '0').ToUpper() : f.code.ToString();
output += " // " + code + " --> " + character;
if (f.note != "" && f.note != null) output += " (" + f.note.ToString() + ")"; if (f.note != "" && f.note != null) output += " (" + f.note.ToString() + ")";
} }
output += "\n"; output += "\n";

View File

@@ -1216,13 +1216,13 @@
// //
cmBaseline.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiTopline, tsmiMidline, tsmiBaseline }); cmBaseline.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiTopline, tsmiMidline, tsmiBaseline });
cmBaseline.Name = "cmBaseline"; cmBaseline.Name = "cmBaseline";
cmBaseline.Size = new System.Drawing.Size(181, 92); cmBaseline.Size = new System.Drawing.Size(121, 70);
// //
// tsmiTopline // tsmiTopline
// //
tsmiTopline.Image = Properties.Resources.fam_top; tsmiTopline.Image = Properties.Resources.fam_top;
tsmiTopline.Name = "tsmiTopline"; tsmiTopline.Name = "tsmiTopline";
tsmiTopline.Size = new System.Drawing.Size(180, 22); tsmiTopline.Size = new System.Drawing.Size(120, 22);
tsmiTopline.Text = "Top line"; tsmiTopline.Text = "Top line";
tsmiTopline.ToolTipText = "Set top base line"; tsmiTopline.ToolTipText = "Set top base line";
tsmiTopline.Click += tsmiTopline_Click; tsmiTopline.Click += tsmiTopline_Click;
@@ -1231,7 +1231,7 @@
// //
tsmiMidline.Image = Properties.Resources.fam_mid; tsmiMidline.Image = Properties.Resources.fam_mid;
tsmiMidline.Name = "tsmiMidline"; tsmiMidline.Name = "tsmiMidline";
tsmiMidline.Size = new System.Drawing.Size(180, 22); tsmiMidline.Size = new System.Drawing.Size(120, 22);
tsmiMidline.Text = "Mid line"; tsmiMidline.Text = "Mid line";
tsmiMidline.ToolTipText = "Set middle base line"; tsmiMidline.ToolTipText = "Set middle base line";
tsmiMidline.Click += tsmiMidline_Click; tsmiMidline.Click += tsmiMidline_Click;
@@ -1240,7 +1240,7 @@
// //
tsmiBaseline.Image = Properties.Resources.fam_base; tsmiBaseline.Image = Properties.Resources.fam_base;
tsmiBaseline.Name = "tsmiBaseline"; tsmiBaseline.Name = "tsmiBaseline";
tsmiBaseline.Size = new System.Drawing.Size(180, 22); tsmiBaseline.Size = new System.Drawing.Size(120, 22);
tsmiBaseline.Text = "Base line"; tsmiBaseline.Text = "Base line";
tsmiBaseline.ToolTipText = "Set bottom (base) line"; tsmiBaseline.ToolTipText = "Set bottom (base) line";
tsmiBaseline.Click += tsmiBaseline_Click; tsmiBaseline.Click += tsmiBaseline_Click;
@@ -1358,7 +1358,6 @@
private System.Windows.Forms.ToolStripMenuItem tsmiMakeVarWidth; private System.Windows.Forms.ToolStripMenuItem tsmiMakeVarWidth;
private System.Windows.Forms.ToolStripMenuItem importImageToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem importImageToolStripMenuItem;
private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox chkHexCodes;
private System.Windows.Forms.Button btnFill; private System.Windows.Forms.Button btnFill;
private System.Windows.Forms.ToolStripMenuItem FillToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem FillToolStripMenuItem;
private System.Windows.Forms.CheckBox chkRectSelect; private System.Windows.Forms.CheckBox chkRectSelect;
@@ -1393,6 +1392,7 @@
private System.Windows.Forms.ToolStripMenuItem tsmiBaseline; private System.Windows.Forms.ToolStripMenuItem tsmiBaseline;
private System.Windows.Forms.ToolStripMenuItem tsmiMidline; private System.Windows.Forms.ToolStripMenuItem tsmiMidline;
private System.Windows.Forms.ToolStripMenuItem tsmiTopline; private System.Windows.Forms.ToolStripMenuItem tsmiTopline;
public System.Windows.Forms.CheckBox chkHexCodes;
} }
} }

View File

@@ -63,7 +63,6 @@ namespace McBitFont {
public FrameMiniature f; public FrameMiniature f;
public List<FrameMiniature> frames = new List<FrameMiniature>(); public List<FrameMiniature> frames = new List<FrameMiniature>();
//private CanvasHistory history = new();
private ChangeHistory history; private ChangeHistory history;
private int cellSize = 10; private int cellSize = 10;
public int dotWidth, dotHeight; public int dotWidth, dotHeight;
@@ -73,7 +72,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.9"; public const string version = "2.10";
public string prjName = "Untitled"; public string prjName = "Untitled";
public string prjFileName = ""; public string prjFileName = "";
public int codepage = 1251; public int codepage = 1251;
@@ -83,6 +82,7 @@ namespace McBitFont {
private SetLines set_lines = SetLines.SL_None; private SetLines set_lines = SetLines.SL_None;
private Point selection1, selection2; private Point selection1, selection2;
private Point[,] sidebarLocs = new Point[2, 3]; private Point[,] sidebarLocs = new Point[2, 3];
private bool frameClipboard = false;
public MainForm() { public MainForm() {
@@ -475,6 +475,9 @@ namespace McBitFont {
var rectSel = chkRectSelect.Checked; var rectSel = chkRectSelect.Checked;
bool rectSelUpdated = false; bool rectSelUpdated = false;
// Set input focus to minilist if any mouse button is held
if (!miniList.Focused && e.Button != MouseButtons.None) miniList.Focus();
// Drag with middle mouse button // Drag with middle mouse button
if (vScroll.Enabled || hScroll.Enabled) { if (vScroll.Enabled || hScroll.Enabled) {
if (mouseDownMiddle) { if (mouseDownMiddle) {
@@ -1182,47 +1185,58 @@ namespace McBitFont {
} }
private void copyToolStripMenuItem_Click(object sender, EventArgs e) { private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
var bb = MessagePackSerializer.Serialize(CopyFrame(f, true)); if (tbFrameNote.Focused) {
DataObject clpbObj = new DataObject(clpbFormat.Name, bb); tbFrameNote.Copy();
Clipboard.SetDataObject(clpbObj, true); frameClipboard = false;
} else {
var bb = MessagePackSerializer.Serialize(CopyFrame(f, true));
DataObject clpbObj = new DataObject(clpbFormat.Name, bb);
Clipboard.SetDataObject(clpbObj, true);
frameClipboard = true;
}
} }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { private void pasteToolStripMenuItem_Click(object sender, EventArgs e) {
// Try to read from clipboard if (tbFrameNote.Focused) {
try { if (!frameClipboard) tbFrameNote.Paste();
IDataObject clpbObj = Clipboard.GetDataObject(); } else if (frameClipboard) {
byte[] bb = (byte[])clpbObj.GetData(clpbFormat.Name); // Try to read from clipboard
fbuf = MessagePackSerializer.Deserialize<FrameMiniature>(bb); try {
} IDataObject clpbObj = Clipboard.GetDataObject();
catch { byte[] bb = (byte[])clpbObj.GetData(clpbFormat.Name);
return; fbuf = MessagePackSerializer.Deserialize<FrameMiniature>(bb);
} }
catch {
int di, dj, wmax, hmax, selw, selh; return;
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 j = 0; j < hmax; j++) {
f.data[i + di, j + dj] = fbuf.data[i, j];
} }
}
history.Add(f); int di, dj, wmax, hmax, selw, selh;
CheckHistoryButtons(); if (chkRectSelect.Checked) {
dotPanel.Refresh(); di = selection1.X;
SetModified(); 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 j = 0; j < hmax; j++) {
f.data[i + di, j + dj] = fbuf.data[i, j];
}
}
history.Add(f);
CheckHistoryButtons();
dotPanel.Refresh();
SetModified();
}
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1239,8 +1253,8 @@ namespace McBitFont {
if (modified) { if (modified) {
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();
SetModified(false);
} }
SetModified(false);
} }
} }

View File

@@ -20,9 +20,9 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets> <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>icon_64.ico</ApplicationIcon> <ApplicationIcon>icon_64.ico</ApplicationIcon>
<AssemblyVersion>2.9.0.0</AssemblyVersion> <AssemblyVersion>2.10.0.0</AssemblyVersion>
<FileVersion>2.9.0.0</FileVersion> <FileVersion>2.10.0.0</FileVersion>
<Version>$(VersionPrefix)2.9.0</Version> <Version>$(VersionPrefix)2.10.0</Version>
<Copyright>Anton Mukhin</Copyright> <Copyright>Anton Mukhin</Copyright>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -1,11 +1,11 @@
Application: Application:
- Consider migrating to WPF in order to make DPI aware UI - Consider migrating to WPF in order to make DPI aware UI
V Export comments now respects "Code in Hex" checkbox on the main form
Functionality: Functionality:
Bugs: Bugs:
- Frame modified flag persists when switching to another frame after rejected to save previous frame V Frame modified flag persists when switching to another frame after rejected to save previous frame
- Ctrl-C, Ctrl-V doesn't work in the Note editbox because it tries to copy/paste the frame! V Ctrl-C, Ctrl-V doesn't work in the Note editbox because it tries to copy/paste the frame!
- Post "Backslash" instead of \ in comments V Post "Backslash" instead of \ in comments