TODO feature: Frame note field to store a frame description

This commit is contained in:
2025-07-03 01:03:12 +03:00
parent 2c2a8d6158
commit 37abcf2c8e
6 changed files with 65 additions and 29 deletions

View File

@@ -34,6 +34,7 @@
cbZoom = new System.Windows.Forms.ComboBox();
label4 = new System.Windows.Forms.Label();
panel1 = new System.Windows.Forms.Panel();
tbFrameNote = new System.Windows.Forms.TextBox();
btnFill = new System.Windows.Forms.Button();
btnClear = new System.Windows.Forms.Button();
btnMirrorY = new System.Windows.Forms.Button();
@@ -231,7 +232,7 @@
// panel1
//
panel1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
panel1.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
panel1.Controls.Add(tbFrameNote);
panel1.Controls.Add(btnFill);
panel1.Controls.Add(btnClear);
panel1.Controls.Add(btnMirrorY);
@@ -241,17 +242,28 @@
panel1.Controls.Add(btnShiftUp);
panel1.Controls.Add(btnShiftRight);
panel1.Controls.Add(btnShiftLeft);
panel1.Location = new System.Drawing.Point(472, 31);
panel1.Location = new System.Drawing.Point(472, 24);
panel1.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
panel1.Name = "panel1";
panel1.Size = new System.Drawing.Size(140, 139);
panel1.Size = new System.Drawing.Size(140, 154);
panel1.TabIndex = 9;
//
// tbFrameNote
//
tbFrameNote.Location = new System.Drawing.Point(7, 127);
tbFrameNote.Name = "tbFrameNote";
tbFrameNote.PlaceholderText = "Frame note";
tbFrameNote.Size = new System.Drawing.Size(119, 23);
tbFrameNote.TabIndex = 9;
toolTip1.SetToolTip(tbFrameNote, "Frame note");
tbFrameNote.WordWrap = false;
tbFrameNote.TextChanged += tbFrameNote_TextChanged;
//
// btnFill
//
btnFill.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnFill.Image = Properties.Resources.Canvas_Fill;
btnFill.Location = new System.Drawing.Point(92, 9);
btnFill.Location = new System.Drawing.Point(91, 3);
btnFill.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnFill.Name = "btnFill";
btnFill.Size = new System.Drawing.Size(35, 35);
@@ -264,7 +276,7 @@
//
btnClear.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnClear.Image = Properties.Resources.Canvas_Clear;
btnClear.Location = new System.Drawing.Point(8, 9);
btnClear.Location = new System.Drawing.Point(7, 3);
btnClear.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnClear.Name = "btnClear";
btnClear.Size = new System.Drawing.Size(35, 35);
@@ -277,7 +289,7 @@
//
btnMirrorY.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnMirrorY.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_vertical_16;
btnMirrorY.Location = new System.Drawing.Point(92, 92);
btnMirrorY.Location = new System.Drawing.Point(91, 86);
btnMirrorY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnMirrorY.Name = "btnMirrorY";
btnMirrorY.Size = new System.Drawing.Size(35, 35);
@@ -290,7 +302,7 @@
//
btnMirrorX.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnMirrorX.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_horizontal_16;
btnMirrorX.Location = new System.Drawing.Point(50, 92);
btnMirrorX.Location = new System.Drawing.Point(49, 86);
btnMirrorX.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnMirrorX.Name = "btnMirrorX";
btnMirrorX.Size = new System.Drawing.Size(35, 35);
@@ -303,7 +315,7 @@
//
btnInvert.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnInvert.Image = Properties.Resources.z_contrast;
btnInvert.Location = new System.Drawing.Point(8, 92);
btnInvert.Location = new System.Drawing.Point(7, 86);
btnInvert.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnInvert.Name = "btnInvert";
btnInvert.Size = new System.Drawing.Size(35, 35);
@@ -316,7 +328,7 @@
//
btnShiftDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftDown.Image = Properties.Resources.z_down;
btnShiftDown.Location = new System.Drawing.Point(50, 51);
btnShiftDown.Location = new System.Drawing.Point(49, 45);
btnShiftDown.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnShiftDown.Name = "btnShiftDown";
btnShiftDown.Size = new System.Drawing.Size(35, 35);
@@ -329,7 +341,7 @@
//
btnShiftUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftUp.Image = Properties.Resources.z_uo;
btnShiftUp.Location = new System.Drawing.Point(50, 9);
btnShiftUp.Location = new System.Drawing.Point(49, 3);
btnShiftUp.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnShiftUp.Name = "btnShiftUp";
btnShiftUp.Size = new System.Drawing.Size(35, 35);
@@ -342,7 +354,7 @@
//
btnShiftRight.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftRight.Image = Properties.Resources.z_right;
btnShiftRight.Location = new System.Drawing.Point(92, 51);
btnShiftRight.Location = new System.Drawing.Point(91, 45);
btnShiftRight.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnShiftRight.Name = "btnShiftRight";
btnShiftRight.Size = new System.Drawing.Size(35, 35);
@@ -355,7 +367,7 @@
//
btnShiftLeft.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftLeft.Image = Properties.Resources.z_left;
btnShiftLeft.Location = new System.Drawing.Point(8, 51);
btnShiftLeft.Location = new System.Drawing.Point(7, 45);
btnShiftLeft.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnShiftLeft.Name = "btnShiftLeft";
btnShiftLeft.Size = new System.Drawing.Size(35, 35);
@@ -392,6 +404,7 @@
miniList.MultiSelect = false;
miniList.Name = "miniList";
miniList.ShowGroups = false;
miniList.ShowItemToolTips = true;
miniList.Size = new System.Drawing.Size(427, 455);
miniList.SmallImageList = ilMiniatures;
miniList.Sorting = System.Windows.Forms.SortOrder.Ascending;
@@ -675,7 +688,7 @@
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
undoToolStripMenuItem.Name = "undoToolStripMenuItem";
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
undoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
undoToolStripMenuItem.Text = "Undo";
undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
@@ -685,7 +698,7 @@
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
redoToolStripMenuItem.Name = "redoToolStripMenuItem";
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
redoToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
redoToolStripMenuItem.Text = "Redo";
redoToolStripMenuItem.ToolTipText = "Redo canvas change";
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
@@ -696,7 +709,7 @@
copyToolStripMenuItem.Name = "copyToolStripMenuItem";
copyToolStripMenuItem.ShortcutKeyDisplayString = "";
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
copyToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
copyToolStripMenuItem.Text = "Copy";
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
@@ -707,7 +720,7 @@
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
pasteToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
pasteToolStripMenuItem.Text = "Paste";
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
@@ -717,7 +730,7 @@
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
selectToolStripMenuItem.Name = "selectToolStripMenuItem";
selectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R;
selectToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
selectToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
selectToolStripMenuItem.Text = "Select";
selectToolStripMenuItem.ToolTipText = "Toggle Rectangle selection tool";
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click;
@@ -728,7 +741,7 @@
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(180, 22);
selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
selectAllToolStripMenuItem.Text = "Select All";
selectAllToolStripMenuItem.ToolTipText = "Select entire canvas";
selectAllToolStripMenuItem.Click += selectAllToolStripMenuItem_Click;
@@ -1219,6 +1232,7 @@
((System.ComponentModel.ISupportInitialize)nudX).EndInit();
((System.ComponentModel.ISupportInitialize)nudY).EndInit();
panel1.ResumeLayout(false);
panel1.PerformLayout();
cmMinilist.ResumeLayout(false);
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
@@ -1332,6 +1346,7 @@
public System.Windows.Forms.NumericUpDown nudBrush;
private System.Windows.Forms.Label lblBrush;
private System.Windows.Forms.ToolStripMenuItem frameScreenshotToolStripMenuItem;
private System.Windows.Forms.TextBox tbFrameNote;
}
}

View File

@@ -18,11 +18,12 @@ namespace McBitFont {
[Serializable]
[MessagePackObject]
public struct FrameMiniature {
public FrameMiniature(int cc, int ww, int hh) {
public FrameMiniature(int cc, int ww, int hh, string frameNote = "") {
code = cc;
width = ww;
height = hh;
data = new bool[ww, hh];
note = frameNote;
}
[Key(0)]
public int code;
@@ -32,6 +33,8 @@ namespace McBitFont {
public int height;
[Key(3)]
public bool[,] data;
[Key(8)]
public string note;
};
[Serializable]
@@ -112,12 +115,12 @@ namespace McBitFont {
// Remember sidebar panels locations
private void SideBarRecalc() {
sidebarLocs[0, 0] = new Point(this.Width - 459, 31);
sidebarLocs[0, 1] = new Point(this.Width - 316, 24);
sidebarLocs[0, 2] = new Point(this.Width - 487, 31);
sidebarLocs[1, 0] = new Point(this.Width - panel1.Width - 70, 180);
sidebarLocs[1, 1] = new Point(this.Width - pnlInfo.Width - 110, 320);
sidebarLocs[1, 2] = new Point(dotPanel.Width + 17, 31);
sidebarLocs[0, 0] = new Point(this.Width - 459, 24); // tool panel
sidebarLocs[0, 1] = new Point(this.Width - 316, 24); // info panel
sidebarLocs[0, 2] = new Point(this.Width - 487, 31); // vertical scroll
sidebarLocs[1, 0] = new Point(this.Width - panel1.Width - 70, 180); // tool panel
sidebarLocs[1, 1] = new Point(this.Width - pnlInfo.Width - 110, 340); // info panel
sidebarLocs[1, 2] = new Point(dotPanel.Width + 17, 31); // vertical scroll
}
@@ -191,8 +194,10 @@ namespace McBitFont {
for (int j = 0; j <= selection2.Y - selection1.Y; j++) {
ff.data[i, j] = frame.data[i + selection1.X, j + selection1.Y];
}
} else
} else {
Array.Copy(frame.data, ff.data, frame.data.Length);
ff.note = frame.note;
}
return ff;
}
@@ -717,6 +722,7 @@ namespace McBitFont {
string s = f.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)sizedBMP);
miniList.Items[miniList.Items.IndexOfKey(s)].ToolTipText = f.note;
sizedBMP.Dispose();
SetModified(false);
SetModified(true, true);
@@ -935,6 +941,7 @@ namespace McBitFont {
nudX.Value = ff.width;
nudY.Value = ff.height;
f = ff;
tbFrameNote.Text = ff.note;
history.Add(code);
@@ -983,7 +990,7 @@ namespace McBitFont {
var sHex = 'x' + Convert.ToString(f.code, 16).PadLeft(2, '0').ToUpper();
var sss = DecodeSymbol(f.code);
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(f));
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s).ToolTipText = f.note;
}
}
@@ -1015,10 +1022,9 @@ namespace McBitFont {
nudX.ValueChanged += nudX_ValueChanged;
nudY.ValueChanged += nudY_ValueChanged;
f = CopyFrame(frames.First());
tbFrameNote.Text = frames.First().note;
dotPanel.Refresh();
miniList.Refresh();
SetModified(false);
SetModified(false, true);
prjFileName = filename;
prjName = Path.GetFileNameWithoutExtension(filename);
@@ -1037,6 +1043,8 @@ namespace McBitFont {
zerofyWidthToolStripMenuItem.Enabled = !monospaced;
tsmiCodeShift.Visible = frames.Count > 1;
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
SetModified(false);
SetModified(false, true);
Cursor.Current = Cursors.Default;
}
@@ -1700,5 +1708,12 @@ namespace McBitFont {
iform.ShowDialog();
iform.Dispose();
}
private void tbFrameNote_TextChanged(object sender, EventArgs e) {
if (tbFrameNote.Focused) {
f.note = tbFrameNote.Text;
SetModified();
}
}
}
}

View File

@@ -64,3 +64,8 @@ Code Shift dialog
Font PNG export example
![PNG export example](/images/Font_Minecraft_Rus_5x7_vw.png)
Frame screenshot dialog
![Frame screenshot](/images/Screenshot_Frame-screenshot.png)

View File

@@ -3,6 +3,7 @@ Application:
Functionality:
V Screensot a frame function
V Frame note field to store a frame description
Bugs:

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 54 KiB

After

Width:  |  Height:  |  Size: 54 KiB