54 Commits
v2.5 ... main

Author SHA1 Message Date
6c860943a5 mctext lib fix 2025-07-19 09:02:49 +03:00
1852c697fc mctext lib update 2025-07-19 08:11:56 +03:00
Anton Mukhin
e76132cadb Update Readme.md 2025-07-18 17:57:19 +03:00
Anton Mukhin
5948948eee Update Readme.md 2025-07-18 17:55:37 +03:00
Anton Mukhin
c4067410c5 Little readme.md update 2025-07-18 17:39:23 +03:00
fe63d1bfab 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
2025-07-17 02:21:41 +03:00
Anton Mukhin
dd3309d8ea Update TODO 2025-07-15 14:49:16 +03:00
Anton Mukhin
8efbd4da55 Updated TODO (found another bug) 2025-07-15 14:27:39 +03:00
Anton Mukhin
6a6d8f3e68 Update TODO (found a bug) 2025-07-15 14:23:47 +03:00
Anton Mukhin
a7d052e799 fonts.h and fonts.c example for the library 2025-07-14 17:31:11 +03:00
Anton Mukhin
ec9fbc4250 Update TODO.txt 2025-07-14 11:53:22 +03:00
Anton Mukhin
2e217c9a9e Remove old format examples 2025-07-11 10:14:56 +03:00
Anton Mukhin
d10da7cb20 My logo as example 2025-07-09 18:44:42 +03:00
Anton Mukhin
7db0b6d76e Merge branch 'dev' - v2.9
Changes:

Application:
- Special cursor to indicate baseline set
- Special cursor when dragging canvas with middle mouse button

Functionality:
- Show note field in Export comments
- When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw
- Frame screenshot can be copied to clipboard with some limitations (no transparency)
- Besides Baseline, also make top and mid lines

Bugs:
- Fixed "Frame modified" check. It leaves modified flag if user refused to save changes.
- Middle mouse button tries to change selection while dragging canvas with rectSelection tool active
2025-07-08 17:20:35 +03:00
Anton Mukhin
2930c42260 Screenshots updated 2025-07-08 17:12:10 +03:00
Anton Mukhin
ace97302f2 Tooltip text for new buttons 2025-07-08 17:09:03 +03:00
Anton Mukhin
ad15f08233 TODO features:
Application:
- Special cursor to indicate baseline set
- Special cursor when dragging canvas with middle mouse button

Functionality:
- Beside Baseline, also make top and mid lines

Bugs:
- Middle mouse button tries to change selection while dragging canvas with rectSelection tool active
2025-07-08 17:00:55 +03:00
Anton Mukhin
64531aecf0 TODO update 2025-07-08 12:18:29 +03:00
Anton Mukhin
4dd4743b21 TODO feature: Frame screenshot can be copied to clipboard with some limitations (no transparency) 2025-07-08 12:11:46 +03:00
Anton Mukhin
686ff7b780 Bug fixed: Fixed "Frame modified" check. It leaves modified flag if user refused to save changes. 2025-07-08 10:56:17 +03:00
Anton Mukhin
30729aca2f TODO feature: When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw 2025-07-08 10:49:26 +03:00
Anton Mukhin
6cbc206260 TODO feature: Show note field in Export comments 2025-07-08 10:10:35 +03:00
d70d8d8a3c DOTO update 2025-07-07 00:10:06 +03:00
e5a4baadb7 Merge branch 'dev' - v2.8
Changes:

Functionality:
- Screensot a frame function
- Frame note field to store a frame description
2025-07-03 01:13:05 +03:00
37abcf2c8e TODO feature: Frame note field to store a frame description 2025-07-03 01:03:12 +03:00
2c2a8d6158 Update examples 2025-07-02 23:58:54 +03:00
Anton Mukhin
4115455a54 TODO feature: Screensot a frame function 2025-07-02 20:06:14 +03:00
67be566605 Main window screenshot update 2025-07-01 00:29:39 +03:00
7aa75224ee Merge branch 'dev' - v2.7
Changes:

Application:
- Cursor for rectangular selection tool
- Icons for tool buttons
- Tooltips now has keyboard shortcuts info

Bugs:
- Fix selection info: change comma to x

Other:
- Examples update
- C library example
2025-07-01 00:09:23 +03:00
4fe2af03b0 TODO features:
V Cursor for rectangular selection tool
V Icons for tool buttons
V Tooltips now has keyboard shortcuts info

V Fix selection info: change comma to x
2025-07-01 00:07:01 +03:00
Anton Mukhin
fc4822065a mctext library fix 2025-06-27 12:45:31 +03:00
Anton Mukhin
3778a753fb Update TODO 2025-06-27 12:18:27 +03:00
Anton Mukhin
20bd7095dd mctext.c library fix 2025-06-26 14:42:19 +03:00
8ed1e33f22 Alagard 9x17 font finished 2025-06-25 02:00:28 +03:00
Anton Mukhin
1eb463c94f STM32 HAL library example 2025-06-23 12:31:24 +03:00
30142fda26 Examples update 2025-06-21 03:53:12 +03:00
Anton Mukhin
70a4d34d69 quick file rename 2025-06-20 17:52:45 +03:00
Anton Mukhin
c913525b31 More font examples 2025-06-20 17:21:13 +03:00
Anton Mukhin
42c72b907f Update TODO 2025-06-20 17:20:39 +03:00
Anton Mukhin
32a8ffd749 Merge branch 'dev' - v2.6
Changes

Application:
- Option to hide symbols list to narrow the side bar
- Buttons to select previous/next symbol with shortcuts
- Custom cursor showing painting brush size

Functionality:
- Fix straight (Ctrl/Shift) lines paint to reset coordinate on mouse-up even if Ctrl/Shift is still held
- Command to make all blank symbols zero-width
- Alt-Scroll to change painting brush size
2025-06-20 11:38:20 +03:00
Anton Mukhin
c092aebeca v2.6 release preps 2025-06-20 11:35:00 +03:00
Anton Mukhin
346088b532 TODO features:
- Custom cursor showing painting size
- Alt-Scroll to change painting size
2025-06-19 17:30:30 +03:00
Anton Mukhin
ac7981d40a TODO update 2025-06-19 10:34:15 +03:00
Anton Mukhin
dd3ecfcf3e TODO feature: Fix straight (Ctrl/Shift) lines paint to reset coordinate on mouse-up even if Ctrl/Shift is still held 2025-06-19 10:14:57 +03:00
Anton Mukhin
6ba4a56197 TODO feature: Command to make all blank symbols zero-width 2025-06-19 10:09:35 +03:00
Anton Mukhin
87b46ec714 WIP: Working on "zerofy widht for blank symbols" feature 2025-06-18 17:55:09 +03:00
Anton Mukhin
12593ef7ad TODO update; new font example 2025-06-18 17:05:19 +03:00
Anton Mukhin
b01bff86b9 basis33 font example 2025-06-18 11:09:31 +03:00
3e734432f4 WIP: New font
https://www.1001fonts.com/bitmap+cyrillic+pixel-fonts.html
2025-06-18 03:15:21 +03:00
aa5b8354d6 Pixel 3x5 cyr font 2025-06-17 21:54:57 +03:00
Anton Mukhin
7952263595 TODO features:
- Option to hide symbols list to narrow the side bar
- Buttons to select previous/next symbol with shortcuts
2025-06-17 17:03:08 +03:00
07906b8abc 2 new Latin font examples 2025-06-10 22:00:55 +03:00
25e54c35e7 WIP: foldable side bar 2025-06-03 22:47:39 +03:00
fc3ef33f3e WIP: foldable side bar 2025-06-03 22:20:47 +03:00
68 changed files with 1862 additions and 257 deletions

View File

@@ -15,7 +15,7 @@ namespace McBitFont {
}
private void About_Load(object sender, EventArgs e) {
lblVersion.Text = "Version: v" + MainForm.version;
lblVersion.Text = "Version: " + MainForm.version;
}
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e) {

View File

@@ -233,7 +233,14 @@ namespace McBitFont {
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";
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() + ")";
output += "\n";
}
if (lines == 1) {
// "1 symbol per line" - new line offset
@@ -369,7 +376,13 @@ namespace McBitFont {
if (!f.Equals(flast) && f.width > 0) output += ",";
if (com && fcount > 1) {
//...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() + ")";
}
output += "\n";
}

View File

@@ -54,7 +54,7 @@
nudSpace.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
nudSpace.Name = "nudSpace";
nudSpace.Size = new System.Drawing.Size(40, 23);
nudSpace.TabIndex = 1;
nudSpace.TabIndex = 2;
toolTip1.SetToolTip(nudSpace, "Space between symbols in pixels");
nudSpace.Value = new decimal(new int[] { 1, 0, 0, 0 });
nudSpace.ValueChanged += Scrolling;
@@ -75,7 +75,7 @@
tbText.Location = new System.Drawing.Point(12, 55);
tbText.Name = "tbText";
tbText.Size = new System.Drawing.Size(260, 29);
tbText.TabIndex = 3;
tbText.TabIndex = 1;
toolTip1.SetToolTip(tbText, "Text to test the font with");
tbText.TextChanged += Text_Changed;
//
@@ -125,12 +125,12 @@
//
cbZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbZoom.FormattingEnabled = true;
cbZoom.Items.AddRange(new object[] { "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" });
cbZoom.Items.AddRange(new object[] { "1", "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" });
cbZoom.Location = new System.Drawing.Point(222, 6);
cbZoom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbZoom.Name = "cbZoom";
cbZoom.Size = new System.Drawing.Size(50, 23);
cbZoom.TabIndex = 19;
cbZoom.TabIndex = 3;
cbZoom.TabStop = false;
toolTip1.SetToolTip(cbZoom, "Zoom level");
cbZoom.SelectedIndexChanged += ZoomChanged;
@@ -149,7 +149,7 @@
btnCopy.Location = new System.Drawing.Point(110, 214);
btnCopy.Name = "btnCopy";
btnCopy.Size = new System.Drawing.Size(80, 30);
btnCopy.TabIndex = 21;
btnCopy.TabIndex = 5;
btnCopy.Text = " Copy";
btnCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnCopy, "Copy BitPixels you see to Clipboard");
@@ -162,7 +162,7 @@
chkBaseline.Location = new System.Drawing.Point(203, 36);
chkBaseline.Name = "chkBaseline";
chkBaseline.Size = new System.Drawing.Size(69, 19);
chkBaseline.TabIndex = 20;
chkBaseline.TabIndex = 4;
chkBaseline.Text = "Baseline";
chkBaseline.UseVisualStyleBackColor = true;
chkBaseline.CheckedChanged += Scrolling;

View File

@@ -28,12 +28,13 @@
dotPanel = new System.Windows.Forms.Panel();
nudX = new System.Windows.Forms.NumericUpDown();
nudY = new System.Windows.Forms.NumericUpDown();
label1 = new System.Windows.Forms.Label();
label2 = new System.Windows.Forms.Label();
lblWidth = new System.Windows.Forms.Label();
lblHeight = new System.Windows.Forms.Label();
lblType = new System.Windows.Forms.Label();
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();
@@ -69,6 +70,7 @@
importImageToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
exportToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
exportFontLayoutPNGToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
frameScreenshotToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator2 = new System.Windows.Forms.ToolStripSeparator();
exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -85,8 +87,12 @@
removeSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
removeBeforeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
removeAfterToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
zerofyWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
CodeShiftToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator3 = new System.Windows.Forms.ToolStripSeparator();
previousSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
nextSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toolStripSeparator4 = new System.Windows.Forms.ToolStripSeparator();
testFontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
canvasToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
ClearToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -100,6 +106,7 @@
mirrorYToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
applyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
toggleBarToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
dlgSave = new System.Windows.Forms.SaveFileDialog();
dlgOpen = new System.Windows.Forms.OpenFileDialog();
btnBaseline = new System.Windows.Forms.Button();
@@ -108,16 +115,28 @@
chkTopSide = new System.Windows.Forms.CheckBox();
chkHexCodes = new System.Windows.Forms.CheckBox();
chkRectSelect = new System.Windows.Forms.CheckBox();
nudBrush = new System.Windows.Forms.NumericUpDown();
label3 = new System.Windows.Forms.Label();
lblSelectionLabel = new System.Windows.Forms.Label();
lblSelection = new System.Windows.Forms.Label();
lblModified = new System.Windows.Forms.Label();
dlgSavePNG = new System.Windows.Forms.SaveFileDialog();
pnlRightButtons = new System.Windows.Forms.Panel();
lblBrush = new System.Windows.Forms.Label();
pnlInfo = new System.Windows.Forms.Panel();
cmBaseline = new System.Windows.Forms.ContextMenuStrip(components);
tsmiTopline = new System.Windows.Forms.ToolStripMenuItem();
tsmiMidline = new System.Windows.Forms.ToolStripMenuItem();
tsmiBaseline = new System.Windows.Forms.ToolStripMenuItem();
((System.ComponentModel.ISupportInitialize)nudX).BeginInit();
((System.ComponentModel.ISupportInitialize)nudY).BeginInit();
panel1.SuspendLayout();
cmMinilist.SuspendLayout();
menuStrip1.SuspendLayout();
((System.ComponentModel.ISupportInitialize)nudBrush).BeginInit();
pnlRightButtons.SuspendLayout();
pnlInfo.SuspendLayout();
cmBaseline.SuspendLayout();
SuspendLayout();
//
// dotPanel
@@ -137,8 +156,7 @@
//
// nudX
//
nudX.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
nudX.Location = new System.Drawing.Point(777, 31);
nudX.Location = new System.Drawing.Point(59, 3);
nudX.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
nudX.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
nudX.Name = "nudX";
@@ -150,8 +168,7 @@
//
// nudY
//
nudY.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
nudY.Location = new System.Drawing.Point(777, 57);
nudY.Location = new System.Drawing.Point(59, 27);
nudY.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
nudY.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
nudY.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
@@ -162,32 +179,29 @@
nudY.Value = new decimal(new int[] { 32, 0, 0, 0 });
nudY.ValueChanged += nudY_ValueChanged;
//
// label1
// lblWidth
//
label1.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label1.AutoSize = true;
label1.Location = new System.Drawing.Point(726, 33);
label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label1.Name = "label1";
label1.Size = new System.Drawing.Size(42, 15);
label1.TabIndex = 3;
label1.Text = "Width:";
lblWidth.AutoSize = true;
lblWidth.Location = new System.Drawing.Point(8, 5);
lblWidth.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblWidth.Name = "lblWidth";
lblWidth.Size = new System.Drawing.Size(42, 15);
lblWidth.TabIndex = 3;
lblWidth.Text = "Width:";
//
// label2
// lblHeight
//
label2.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label2.AutoSize = true;
label2.Location = new System.Drawing.Point(722, 59);
label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label2.Name = "label2";
label2.Size = new System.Drawing.Size(46, 15);
label2.TabIndex = 4;
label2.Text = "Height:";
lblHeight.AutoSize = true;
lblHeight.Location = new System.Drawing.Point(4, 29);
lblHeight.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblHeight.Name = "lblHeight";
lblHeight.Size = new System.Drawing.Size(46, 15);
lblHeight.TabIndex = 4;
lblHeight.Text = "Height:";
//
// lblType
//
lblType.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblType.Location = new System.Drawing.Point(718, 159);
lblType.Location = new System.Drawing.Point(2, 136);
lblType.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblType.Name = "lblType";
lblType.Size = new System.Drawing.Size(181, 15);
@@ -201,19 +215,19 @@
cbZoom.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbZoom.FormattingEnabled = true;
cbZoom.Items.AddRange(new object[] { "2", "3", "5", "10", "15", "20", "25", "30", "35", "40", "45", "50" });
cbZoom.Location = new System.Drawing.Point(619, 52);
cbZoom.Location = new System.Drawing.Point(7, 28);
cbZoom.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbZoom.Name = "cbZoom";
cbZoom.Size = new System.Drawing.Size(75, 23);
cbZoom.TabIndex = 6;
cbZoom.TabStop = false;
toolTip1.SetToolTip(cbZoom, "Canvas zoom level");
toolTip1.SetToolTip(cbZoom, "Canvas zoom level (Ctrl+Scroll)");
//
// label4
//
label4.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label4.AutoSize = true;
label4.Location = new System.Drawing.Point(618, 33);
label4.Location = new System.Drawing.Point(6, 9);
label4.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
label4.Name = "label4";
label4.Size = new System.Drawing.Size(69, 15);
@@ -223,7 +237,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);
@@ -233,47 +247,58 @@
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.Location = new System.Drawing.Point(92, 9);
btnFill.Image = Properties.Resources.Canvas_Fill;
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);
btnFill.TabIndex = 8;
btnFill.Text = "⬤";
toolTip1.SetToolTip(btnFill, "Paint canvas black");
toolTip1.SetToolTip(btnFill, "Paint canvas black (Ctrl+B)");
btnFill.UseVisualStyleBackColor = true;
btnFill.Click += btnFill_Click;
//
// btnClear
//
btnClear.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnClear.Location = new System.Drawing.Point(8, 9);
btnClear.Image = Properties.Resources.Canvas_Clear;
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);
btnClear.TabIndex = 7;
btnClear.Text = "○";
toolTip1.SetToolTip(btnClear, "Paint canvas white");
toolTip1.SetToolTip(btnClear, "Paint canvas white (Ctrl+W)");
btnClear.UseVisualStyleBackColor = true;
btnClear.Click += btnClear_Click;
//
// btnMirrorY
//
btnMirrorY.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnMirrorY.Location = new System.Drawing.Point(92, 92);
btnMirrorY.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_vertical_16;
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);
btnMirrorY.TabIndex = 6;
btnMirrorY.Text = "⩥";
toolTip1.SetToolTip(btnMirrorY, "Mirror by Y axis (vertical)");
btnMirrorY.UseVisualStyleBackColor = true;
btnMirrorY.Click += btnMirrorY_Click;
@@ -281,12 +306,12 @@
// btnMirrorX
//
btnMirrorX.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnMirrorX.Location = new System.Drawing.Point(50, 92);
btnMirrorX.Image = Properties.Resources.Famfamfam_Silk_Shape_flip_horizontal_16;
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);
btnMirrorX.TabIndex = 5;
btnMirrorX.Text = "◮";
toolTip1.SetToolTip(btnMirrorX, "Mirror by X axis (horizontal)");
btnMirrorX.UseVisualStyleBackColor = true;
btnMirrorX.Click += btnMirrorX_Click;
@@ -294,73 +319,72 @@
// btnInvert
//
btnInvert.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnInvert.Location = new System.Drawing.Point(8, 92);
btnInvert.Image = Properties.Resources.z_contrast;
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);
btnInvert.TabIndex = 4;
btnInvert.Text = "◪";
toolTip1.SetToolTip(btnInvert, "Invert pixel colors");
toolTip1.SetToolTip(btnInvert, "Invert pixel colors (Ctrl+I)");
btnInvert.UseVisualStyleBackColor = true;
btnInvert.Click += btnInvert_Click;
//
// btnShiftDown
//
btnShiftDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftDown.Location = new System.Drawing.Point(50, 51);
btnShiftDown.Image = Properties.Resources.z_down;
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);
btnShiftDown.TabIndex = 3;
btnShiftDown.Text = "▼";
toolTip1.SetToolTip(btnShiftDown, "Shift pixels down");
toolTip1.SetToolTip(btnShiftDown, "Shift pixels down (Ctrl+Down)");
btnShiftDown.UseVisualStyleBackColor = true;
btnShiftDown.Click += btnShiftDown_Click;
//
// btnShiftUp
//
btnShiftUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftUp.Location = new System.Drawing.Point(50, 9);
btnShiftUp.Image = Properties.Resources.z_uo;
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);
btnShiftUp.TabIndex = 2;
btnShiftUp.Text = "▲";
toolTip1.SetToolTip(btnShiftUp, "Shift pixels up");
toolTip1.SetToolTip(btnShiftUp, "Shift pixels up (Ctrl+Up)");
btnShiftUp.UseVisualStyleBackColor = true;
btnShiftUp.Click += btnShiftUp_Click;
//
// btnShiftRight
//
btnShiftRight.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftRight.Location = new System.Drawing.Point(92, 51);
btnShiftRight.Image = Properties.Resources.z_right;
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);
btnShiftRight.TabIndex = 1;
btnShiftRight.Text = "▶";
toolTip1.SetToolTip(btnShiftRight, "Shift pixels right");
toolTip1.SetToolTip(btnShiftRight, "Shift pixels right (Ctrl+Right)");
btnShiftRight.UseVisualStyleBackColor = true;
btnShiftRight.Click += btnShiftRight_Click;
//
// btnShiftLeft
//
btnShiftLeft.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
btnShiftLeft.Location = new System.Drawing.Point(8, 51);
btnShiftLeft.Image = Properties.Resources.z_left;
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);
btnShiftLeft.TabIndex = 0;
btnShiftLeft.Text = "◀";
toolTip1.SetToolTip(btnShiftLeft, "Shift pixels left");
toolTip1.SetToolTip(btnShiftLeft, "Shift pixels left (Ctrl+Left)");
btnShiftLeft.UseVisualStyleBackColor = true;
btnShiftLeft.Click += btnShiftLeft_Click;
//
// btnExport
//
btnExport.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnExport.Image = Properties.Resources.z_export;
btnExport.Location = new System.Drawing.Point(812, 126);
btnExport.Location = new System.Drawing.Point(94, 109);
btnExport.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnExport.Name = "btnExport";
btnExport.Size = new System.Drawing.Size(88, 27);
@@ -368,7 +392,7 @@
btnExport.Text = " Export";
btnExport.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
btnExport.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnExport, "Configure and export data");
toolTip1.SetToolTip(btnExport, "Configure and export data (Ctrl+E)");
btnExport.UseVisualStyleBackColor = true;
btnExport.Click += Export_Click;
//
@@ -385,6 +409,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;
@@ -476,9 +501,8 @@
//
// btnApply
//
btnApply.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnApply.Image = Properties.Resources.z_tick;
btnApply.Location = new System.Drawing.Point(718, 126);
btnApply.Location = new System.Drawing.Point(4, 109);
btnApply.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnApply.Name = "btnApply";
btnApply.Size = new System.Drawing.Size(88, 27);
@@ -486,7 +510,7 @@
btnApply.Text = " Apply";
btnApply.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
btnApply.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnApply, "Apply changes made to the symbol");
toolTip1.SetToolTip(btnApply, "Apply changes made to the symbol (Ctrl+Space)");
btnApply.UseVisualStyleBackColor = true;
btnApply.Click += button2_Click;
//
@@ -518,7 +542,7 @@
//
lblCoords.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblCoords.AutoSize = true;
lblCoords.Location = new System.Drawing.Point(616, 138);
lblCoords.Location = new System.Drawing.Point(4, 114);
lblCoords.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblCoords.Name = "lblCoords";
lblCoords.Size = new System.Drawing.Size(24, 15);
@@ -528,7 +552,7 @@
//
// menuStrip1
//
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, fontToolStripMenuItem, canvasToolStripMenuItem, aboutToolStripMenuItem });
menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { fileToolStripMenuItem, editToolStripMenuItem, fontToolStripMenuItem, canvasToolStripMenuItem, aboutToolStripMenuItem, toggleBarToolStripMenuItem });
menuStrip1.Location = new System.Drawing.Point(0, 0);
menuStrip1.Name = "menuStrip1";
menuStrip1.Padding = new System.Windows.Forms.Padding(7, 2, 0, 2);
@@ -538,7 +562,7 @@
//
// fileToolStripMenuItem
//
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, importTextToolStripMenuItem1, importImageToolStripMenuItem, exportToolStripMenuItem, exportFontLayoutPNGToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem });
fileToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { newToolStripMenuItem, openToolStripMenuItem, saveToolStripMenuItem, saveAsToolStripMenuItem, toolStripSeparator1, importTextToolStripMenuItem1, importImageToolStripMenuItem, exportToolStripMenuItem, exportFontLayoutPNGToolStripMenuItem, frameScreenshotToolStripMenuItem, toolStripSeparator2, exitToolStripMenuItem });
fileToolStripMenuItem.Name = "fileToolStripMenuItem";
fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
fileToolStripMenuItem.Text = "File";
@@ -623,13 +647,23 @@
//
// exportFontLayoutPNGToolStripMenuItem
//
exportFontLayoutPNGToolStripMenuItem.Image = Properties.Resources.picture_go;
exportFontLayoutPNGToolStripMenuItem.Image = Properties.Resources.picture_save;
exportFontLayoutPNGToolStripMenuItem.Name = "exportFontLayoutPNGToolStripMenuItem";
exportFontLayoutPNGToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
exportFontLayoutPNGToolStripMenuItem.Text = "Export font layout PNG";
exportFontLayoutPNGToolStripMenuItem.ToolTipText = "Create an image with all a table showing all 256 symbols";
exportFontLayoutPNGToolStripMenuItem.Click += ExportPNG;
//
// frameScreenshotToolStripMenuItem
//
frameScreenshotToolStripMenuItem.Image = Properties.Resources.picture_go;
frameScreenshotToolStripMenuItem.Name = "frameScreenshotToolStripMenuItem";
frameScreenshotToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.P;
frameScreenshotToolStripMenuItem.Size = new System.Drawing.Size(224, 22);
frameScreenshotToolStripMenuItem.Text = "Frame Screenshot";
frameScreenshotToolStripMenuItem.ToolTipText = "Make a screenshot of the current frame and save it to a file or copy to clipboard";
frameScreenshotToolStripMenuItem.Click += frameScreenshotToolStripMenuItem_Click;
//
// toolStripSeparator2
//
toolStripSeparator2.Name = "toolStripSeparator2";
@@ -719,16 +753,17 @@
//
// fontToolStripMenuItem
//
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem, toolStripSeparator3, testFontToolStripMenuItem });
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, zerofyWidthToolStripMenuItem, CodeShiftToolStripMenuItem, toolStripSeparator3, previousSymbolToolStripMenuItem, nextSymbolToolStripMenuItem, toolStripSeparator4, testFontToolStripMenuItem });
fontToolStripMenuItem.Name = "fontToolStripMenuItem";
fontToolStripMenuItem.Size = new System.Drawing.Size(43, 20);
fontToolStripMenuItem.Text = "Font";
fontToolStripMenuItem.DropDownOpening += fontToolStripMenuItem_DropDownOpening;
//
// makeVarWidthToolStripMenuItem
//
makeVarWidthToolStripMenuItem.Image = Properties.Resources.z_asterisk;
makeVarWidthToolStripMenuItem.Name = "makeVarWidthToolStripMenuItem";
makeVarWidthToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
makeVarWidthToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
makeVarWidthToolStripMenuItem.Text = "Make Variable Width";
makeVarWidthToolStripMenuItem.ToolTipText = "Make Font Variable width one";
makeVarWidthToolStripMenuItem.Visible = false;
@@ -741,7 +776,7 @@
prependSymbolToolStripMenuItem.Name = "prependSymbolToolStripMenuItem";
prependSymbolToolStripMenuItem.ShortcutKeyDisplayString = "Ctrl+Ins";
prependSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Insert;
prependSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
prependSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
prependSymbolToolStripMenuItem.Text = "Prepend symbol";
prependSymbolToolStripMenuItem.ToolTipText = "Add a symbol to the beginning of the sequence";
prependSymbolToolStripMenuItem.Click += prependSymbolToolStripMenuItem_Click;
@@ -753,7 +788,7 @@
appendSymbolToolStripMenuItem.Name = "appendSymbolToolStripMenuItem";
appendSymbolToolStripMenuItem.ShortcutKeyDisplayString = "";
appendSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.End;
appendSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
appendSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
appendSymbolToolStripMenuItem.Text = "Append symbol";
appendSymbolToolStripMenuItem.ToolTipText = "Add a symbol to the end of the sequence";
appendSymbolToolStripMenuItem.Click += prependSymbolToolStripMenuItem_Click;
@@ -765,7 +800,7 @@
removeSymbolToolStripMenuItem.Name = "removeSymbolToolStripMenuItem";
removeSymbolToolStripMenuItem.ShortcutKeyDisplayString = "";
removeSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Delete;
removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
removeSymbolToolStripMenuItem.Text = "Remove symbol";
removeSymbolToolStripMenuItem.ToolTipText = "Remove current symbol (works only for first or last symbol in the sequence)";
removeSymbolToolStripMenuItem.Click += removeSymbolToolStripMenuItem_Click;
@@ -775,7 +810,7 @@
removeBeforeToolStripMenuItem.Enabled = false;
removeBeforeToolStripMenuItem.Image = Properties.Resources.delete;
removeBeforeToolStripMenuItem.Name = "removeBeforeToolStripMenuItem";
removeBeforeToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
removeBeforeToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
removeBeforeToolStripMenuItem.Text = "Remove all before selected";
removeBeforeToolStripMenuItem.ToolTipText = "Remove all symbols before current one";
removeBeforeToolStripMenuItem.Click += removeBeforeToolStripMenuItem_Click;
@@ -785,16 +820,26 @@
removeAfterToolStripMenuItem.Enabled = false;
removeAfterToolStripMenuItem.Image = Properties.Resources.delete;
removeAfterToolStripMenuItem.Name = "removeAfterToolStripMenuItem";
removeAfterToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
removeAfterToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
removeAfterToolStripMenuItem.Text = "Remove all after selected";
removeAfterToolStripMenuItem.ToolTipText = "Remove all symbols after current one";
removeAfterToolStripMenuItem.Click += removeAfterToolStripMenuItem_Click;
//
// zerofyWidthToolStripMenuItem
//
zerofyWidthToolStripMenuItem.Enabled = false;
zerofyWidthToolStripMenuItem.Image = Properties.Resources.text_letterspacing2;
zerofyWidthToolStripMenuItem.Name = "zerofyWidthToolStripMenuItem";
zerofyWidthToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
zerofyWidthToolStripMenuItem.Text = "Make all blank symbols 0-width";
zerofyWidthToolStripMenuItem.ToolTipText = "Make width equals zero for all blank symbols (except code 32 (space))";
zerofyWidthToolStripMenuItem.Click += ZerofyBlankWidth;
//
// CodeShiftToolStripMenuItem
//
CodeShiftToolStripMenuItem.Image = Properties.Resources.z_align_center;
CodeShiftToolStripMenuItem.Name = "CodeShiftToolStripMenuItem";
CodeShiftToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
CodeShiftToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
CodeShiftToolStripMenuItem.Text = "Code shift";
CodeShiftToolStripMenuItem.ToolTipText = "Shift the font on the code line";
CodeShiftToolStripMenuItem.Click += CodeShiftToolStripMenuItem_Click;
@@ -802,13 +847,38 @@
// toolStripSeparator3
//
toolStripSeparator3.Name = "toolStripSeparator3";
toolStripSeparator3.Size = new System.Drawing.Size(212, 6);
toolStripSeparator3.Size = new System.Drawing.Size(238, 6);
//
// previousSymbolToolStripMenuItem
//
previousSymbolToolStripMenuItem.Image = Properties.Resources.arrow_turn_left;
previousSymbolToolStripMenuItem.Name = "previousSymbolToolStripMenuItem";
previousSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Left;
previousSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
previousSymbolToolStripMenuItem.Text = "Previous Symbol";
previousSymbolToolStripMenuItem.ToolTipText = "Select previous symbol";
previousSymbolToolStripMenuItem.Click += previousSymbolToolStripMenuItem_Click;
//
// nextSymbolToolStripMenuItem
//
nextSymbolToolStripMenuItem.Image = Properties.Resources.arrow_turn_right;
nextSymbolToolStripMenuItem.Name = "nextSymbolToolStripMenuItem";
nextSymbolToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.Right;
nextSymbolToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
nextSymbolToolStripMenuItem.Text = "Next symbol";
nextSymbolToolStripMenuItem.ToolTipText = "Select next symbol";
nextSymbolToolStripMenuItem.Click += nextSymbolToolStripMenuItem_Click;
//
// toolStripSeparator4
//
toolStripSeparator4.Name = "toolStripSeparator4";
toolStripSeparator4.Size = new System.Drawing.Size(238, 6);
//
// testFontToolStripMenuItem
//
testFontToolStripMenuItem.Image = Properties.Resources.font;
testFontToolStripMenuItem.Name = "testFontToolStripMenuItem";
testFontToolStripMenuItem.Size = new System.Drawing.Size(215, 22);
testFontToolStripMenuItem.Size = new System.Drawing.Size(241, 22);
testFontToolStripMenuItem.Text = "Test font";
testFontToolStripMenuItem.ToolTipText = "Open dialog where you can test the font with any text you type";
testFontToolStripMenuItem.Click += TestFont_Click;
@@ -934,6 +1004,16 @@
aboutToolStripMenuItem.Text = "About";
aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click;
//
// toggleBarToolStripMenuItem
//
toggleBarToolStripMenuItem.Alignment = System.Windows.Forms.ToolStripItemAlignment.Right;
toggleBarToolStripMenuItem.CheckOnClick = true;
toggleBarToolStripMenuItem.Name = "toggleBarToolStripMenuItem";
toggleBarToolStripMenuItem.Size = new System.Drawing.Size(35, 20);
toggleBarToolStripMenuItem.Text = ">>";
toggleBarToolStripMenuItem.ToolTipText = "Toggle side bar state";
toggleBarToolStripMenuItem.Click += toggleBarToolStripMenuItem_Click;
//
// dlgSave
//
dlgSave.DefaultExt = "mbf";
@@ -946,19 +1026,18 @@
//
// btnBaseline
//
btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnBaseline.Image = Properties.Resources.fam_base;
btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnBaseline.Location = new System.Drawing.Point(812, 93);
btnBaseline.Image = Properties.Resources.fam_lines;
btnBaseline.Location = new System.Drawing.Point(94, 81);
btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnBaseline.Name = "btnBaseline";
btnBaseline.Size = new System.Drawing.Size(88, 27);
btnBaseline.TabIndex = 18;
btnBaseline.Text = " Baseline";
btnBaseline.Text = " Lines";
btnBaseline.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnBaseline, "Set irtual base line for the font");
toolTip1.SetToolTip(btnBaseline, "Set irtual base lines for the font");
btnBaseline.UseVisualStyleBackColor = true;
btnBaseline.Click += btnBaseline_Click;
btnBaseline.Paint += btnBaseline_Paint;
//
// toolTip1
//
@@ -968,9 +1047,8 @@
//
// chkLeftSide
//
chkLeftSide.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
chkLeftSide.AutoSize = true;
chkLeftSide.Location = new System.Drawing.Point(831, 33);
chkLeftSide.Location = new System.Drawing.Point(113, 5);
chkLeftSide.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
chkLeftSide.Name = "chkLeftSide";
chkLeftSide.Size = new System.Drawing.Size(70, 19);
@@ -981,9 +1059,8 @@
//
// chkTopSide
//
chkTopSide.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
chkTopSide.AutoSize = true;
chkTopSide.Location = new System.Drawing.Point(831, 58);
chkTopSide.Location = new System.Drawing.Point(113, 28);
chkTopSide.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
chkTopSide.Name = "chkTopSide";
chkTopSide.Size = new System.Drawing.Size(70, 19);
@@ -996,7 +1073,7 @@
//
chkHexCodes.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
chkHexCodes.AutoSize = true;
chkHexCodes.Location = new System.Drawing.Point(618, 155);
chkHexCodes.Location = new System.Drawing.Point(6, 131);
chkHexCodes.Name = "chkHexCodes";
chkHexCodes.Size = new System.Drawing.Size(95, 19);
chkHexCodes.TabIndex = 22;
@@ -1007,26 +1084,38 @@
//
// chkRectSelect
//
chkRectSelect.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button;
chkRectSelect.Image = Properties.Resources.fam_rectt;
chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
chkRectSelect.Location = new System.Drawing.Point(718, 93);
chkRectSelect.Location = new System.Drawing.Point(4, 81);
chkRectSelect.Name = "chkRectSelect";
chkRectSelect.Size = new System.Drawing.Size(87, 27);
chkRectSelect.Size = new System.Drawing.Size(88, 27);
chkRectSelect.TabIndex = 23;
chkRectSelect.Text = " Select";
chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
chkRectSelect.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(chkRectSelect, "Turn on/off rectangle selection");
toolTip1.SetToolTip(chkRectSelect, "Turn on/off rectangle selection (Ctrl+R)");
chkRectSelect.UseVisualStyleBackColor = true;
chkRectSelect.CheckedChanged += chkRectSelect_CheckedChanged;
//
// nudBrush
//
nudBrush.Location = new System.Drawing.Point(59, 51);
nudBrush.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
nudBrush.Maximum = new decimal(new int[] { 32, 0, 0, 0 });
nudBrush.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
nudBrush.Name = "nudBrush";
nudBrush.Size = new System.Drawing.Size(47, 23);
nudBrush.TabIndex = 24;
toolTip1.SetToolTip(nudBrush, "Symbol height (Alt+Scroll)");
nudBrush.Value = new decimal(new int[] { 1, 0, 0, 0 });
nudBrush.ValueChanged += nudBrush_ValueChanged;
//
// label3
//
label3.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
label3.AutoSize = true;
label3.Location = new System.Drawing.Point(615, 123);
label3.Location = new System.Drawing.Point(3, 99);
label3.Name = "label3";
label3.Size = new System.Drawing.Size(45, 15);
label3.TabIndex = 21;
@@ -1036,7 +1125,7 @@
//
lblSelectionLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblSelectionLabel.AutoSize = true;
lblSelectionLabel.Location = new System.Drawing.Point(616, 93);
lblSelectionLabel.Location = new System.Drawing.Point(4, 69);
lblSelectionLabel.Name = "lblSelectionLabel";
lblSelectionLabel.Size = new System.Drawing.Size(58, 15);
lblSelectionLabel.TabIndex = 25;
@@ -1047,12 +1136,12 @@
//
lblSelection.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblSelection.AutoSize = true;
lblSelection.Location = new System.Drawing.Point(617, 108);
lblSelection.Location = new System.Drawing.Point(5, 84);
lblSelection.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblSelection.Name = "lblSelection";
lblSelection.Size = new System.Drawing.Size(30, 15);
lblSelection.Size = new System.Drawing.Size(32, 15);
lblSelection.TabIndex = 24;
lblSelection.Text = "W,H";
lblSelection.Text = "WxH";
lblSelection.TextAlign = System.Drawing.ContentAlignment.TopRight;
lblSelection.Visible = false;
//
@@ -1062,7 +1151,7 @@
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.Location = new System.Drawing.Point(4, 54);
lblModified.Name = "lblModified";
lblModified.Size = new System.Drawing.Size(91, 15);
lblModified.TabIndex = 26;
@@ -1074,37 +1163,103 @@
dlgSavePNG.DefaultExt = "png";
dlgSavePNG.Filter = "PNG Image|*.png;*.PNG";
//
// pnlRightButtons
//
pnlRightButtons.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
pnlRightButtons.Controls.Add(nudBrush);
pnlRightButtons.Controls.Add(lblBrush);
pnlRightButtons.Controls.Add(chkLeftSide);
pnlRightButtons.Controls.Add(nudX);
pnlRightButtons.Controls.Add(nudY);
pnlRightButtons.Controls.Add(lblWidth);
pnlRightButtons.Controls.Add(lblHeight);
pnlRightButtons.Controls.Add(chkRectSelect);
pnlRightButtons.Controls.Add(lblType);
pnlRightButtons.Controls.Add(btnExport);
pnlRightButtons.Controls.Add(btnApply);
pnlRightButtons.Controls.Add(chkTopSide);
pnlRightButtons.Controls.Add(btnBaseline);
pnlRightButtons.Location = new System.Drawing.Point(715, 24);
pnlRightButtons.Margin = new System.Windows.Forms.Padding(0);
pnlRightButtons.Name = "pnlRightButtons";
pnlRightButtons.Size = new System.Drawing.Size(184, 154);
pnlRightButtons.TabIndex = 27;
//
// lblBrush
//
lblBrush.AutoSize = true;
lblBrush.Location = new System.Drawing.Point(10, 54);
lblBrush.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblBrush.Name = "lblBrush";
lblBrush.Size = new System.Drawing.Size(40, 15);
lblBrush.TabIndex = 25;
lblBrush.Text = "Brush:";
//
// pnlInfo
//
pnlInfo.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
pnlInfo.Controls.Add(label4);
pnlInfo.Controls.Add(cbZoom);
pnlInfo.Controls.Add(lblCoords);
pnlInfo.Controls.Add(lblModified);
pnlInfo.Controls.Add(label3);
pnlInfo.Controls.Add(lblSelectionLabel);
pnlInfo.Controls.Add(chkHexCodes);
pnlInfo.Controls.Add(lblSelection);
pnlInfo.Location = new System.Drawing.Point(615, 24);
pnlInfo.Margin = new System.Windows.Forms.Padding(0);
pnlInfo.Name = "pnlInfo";
pnlInfo.Size = new System.Drawing.Size(103, 154);
pnlInfo.TabIndex = 28;
//
// cmBaseline
//
cmBaseline.Items.AddRange(new System.Windows.Forms.ToolStripItem[] { tsmiTopline, tsmiMidline, tsmiBaseline });
cmBaseline.Name = "cmBaseline";
cmBaseline.Size = new System.Drawing.Size(121, 70);
//
// tsmiTopline
//
tsmiTopline.Image = Properties.Resources.fam_top;
tsmiTopline.Name = "tsmiTopline";
tsmiTopline.Size = new System.Drawing.Size(120, 22);
tsmiTopline.Text = "Top line";
tsmiTopline.ToolTipText = "Set top base line";
tsmiTopline.Click += tsmiTopline_Click;
//
// tsmiMidline
//
tsmiMidline.Image = Properties.Resources.fam_mid;
tsmiMidline.Name = "tsmiMidline";
tsmiMidline.Size = new System.Drawing.Size(120, 22);
tsmiMidline.Text = "Mid line";
tsmiMidline.ToolTipText = "Set middle base line";
tsmiMidline.Click += tsmiMidline_Click;
//
// tsmiBaseline
//
tsmiBaseline.Image = Properties.Resources.fam_base;
tsmiBaseline.Name = "tsmiBaseline";
tsmiBaseline.Size = new System.Drawing.Size(120, 22);
tsmiBaseline.Text = "Base line";
tsmiBaseline.ToolTipText = "Set bottom (base) line";
tsmiBaseline.Click += tsmiBaseline_Click;
//
// MainForm
//
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(915, 647);
Controls.Add(lblModified);
Controls.Add(lblSelectionLabel);
Controls.Add(lblSelection);
Controls.Add(chkRectSelect);
Controls.Add(chkHexCodes);
Controls.Add(label3);
Controls.Add(chkTopSide);
Controls.Add(chkLeftSide);
Controls.Add(btnBaseline);
Controls.Add(btnApply);
Controls.Add(btnExport);
Controls.Add(lblCoords);
Controls.Add(pnlInfo);
Controls.Add(pnlRightButtons);
Controls.Add(vScroll);
Controls.Add(hScroll);
Controls.Add(miniList);
Controls.Add(panel1);
Controls.Add(label4);
Controls.Add(cbZoom);
Controls.Add(lblType);
Controls.Add(label2);
Controls.Add(label1);
Controls.Add(nudY);
Controls.Add(nudX);
Controls.Add(dotPanel);
Controls.Add(menuStrip1);
Icon = (System.Drawing.Icon)resources.GetObject("$this.Icon");
KeyPreview = true;
MainMenuStrip = menuStrip1;
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
MinimumSize = new System.Drawing.Size(931, 686);
@@ -1113,12 +1268,21 @@
Text = "McBitFont";
FormClosing += MainForm_FormClosing;
Load += Form1_Load;
KeyDown += MainForm_KeyDown;
KeyUp += MainForm_KeyUp;
((System.ComponentModel.ISupportInitialize)nudX).EndInit();
((System.ComponentModel.ISupportInitialize)nudY).EndInit();
panel1.ResumeLayout(false);
panel1.PerformLayout();
cmMinilist.ResumeLayout(false);
menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout();
((System.ComponentModel.ISupportInitialize)nudBrush).EndInit();
pnlRightButtons.ResumeLayout(false);
pnlRightButtons.PerformLayout();
pnlInfo.ResumeLayout(false);
pnlInfo.PerformLayout();
cmBaseline.ResumeLayout(false);
ResumeLayout(false);
PerformLayout();
@@ -1127,8 +1291,8 @@
#endregion
private System.Windows.Forms.Panel dotPanel;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.Label lblWidth;
private System.Windows.Forms.Label lblHeight;
private System.Windows.Forms.Label lblType;
private System.Windows.Forms.ComboBox cbZoom;
private System.Windows.Forms.Label label4;
@@ -1194,7 +1358,6 @@
private System.Windows.Forms.ToolStripMenuItem tsmiMakeVarWidth;
private System.Windows.Forms.ToolStripMenuItem importImageToolStripMenuItem;
private System.Windows.Forms.Label label3;
private System.Windows.Forms.CheckBox chkHexCodes;
private System.Windows.Forms.Button btnFill;
private System.Windows.Forms.ToolStripMenuItem FillToolStripMenuItem;
private System.Windows.Forms.CheckBox chkRectSelect;
@@ -1214,6 +1377,22 @@
public System.Windows.Forms.ImageList ilMiniatures;
public System.Windows.Forms.NumericUpDown nudX;
public System.Windows.Forms.NumericUpDown nudY;
private System.Windows.Forms.ToolStripMenuItem previousSymbolToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem nextSymbolToolStripMenuItem;
private System.Windows.Forms.Panel pnlRightButtons;
private System.Windows.Forms.Panel pnlInfo;
private System.Windows.Forms.ToolStripMenuItem toggleBarToolStripMenuItem;
private System.Windows.Forms.ToolStripSeparator toolStripSeparator4;
private System.Windows.Forms.ToolStripMenuItem zerofyWidthToolStripMenuItem;
public System.Windows.Forms.NumericUpDown nudBrush;
private System.Windows.Forms.Label lblBrush;
private System.Windows.Forms.ToolStripMenuItem frameScreenshotToolStripMenuItem;
private System.Windows.Forms.TextBox tbFrameNote;
private System.Windows.Forms.ContextMenuStrip cmBaseline;
private System.Windows.Forms.ToolStripMenuItem tsmiBaseline;
private System.Windows.Forms.ToolStripMenuItem tsmiMidline;
private System.Windows.Forms.ToolStripMenuItem tsmiTopline;
public System.Windows.Forms.CheckBox chkHexCodes;
}
}

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]
@@ -42,14 +45,24 @@ namespace McBitFont {
[Key(5)]
public int codepage;
[Key(6)]
public int baseline;
public int baseline1;
[Key(9)]
public int baseline2;
[Key(10)]
public int baseline3;
[Key(7)]
public List<FrameMiniature> frames;
}
public enum SetLines {
SL_None = 0,
SL_Base,
SL_Mid,
SL_Top
}
public FrameMiniature f;
public List<FrameMiniature> frames = new List<FrameMiniature>();
//private CanvasHistory history = new();
private ChangeHistory history;
private int cellSize = 10;
public int dotWidth, dotHeight;
@@ -59,15 +72,17 @@ namespace McBitFont {
public bool monospaced = false;
private bool modified = false;
private bool prjModified = false;
public const string version = "2.5";
public const string version = "2.10";
public string prjName = "Untitled";
public string prjFileName = "";
public int codepage = 1251;
private FrameMiniature fbuf;
private readonly DataFormats.Format clpbFormat = DataFormats.GetFormat("McBitFontFrame");
private int baseline = 0;
private bool set_base = false;
private int baseline1 = 0, baseline2 = 0, baseline3 = 0;
private SetLines set_lines = SetLines.SL_None;
private Point selection1, selection2;
private Point[,] sidebarLocs = new Point[2, 3];
private bool frameClipboard = false;
public MainForm() {
@@ -82,7 +97,7 @@ namespace McBitFont {
}
private void UpdateSelectionLabel(int width, int height) {
lblSelection.Text = width.ToString() + ',' + height.ToString();
lblSelection.Text = width.ToString() + 'x' + height.ToString();
}
public void SetModified(bool modif = true, bool prj = false) {
@@ -97,6 +112,30 @@ namespace McBitFont {
}
}
// Check if a frame is "blank"
private static bool IsFrameBlank(FrameMiniature frame) {
if (frame.code == 32) return false; // Space character is always blank, so skip it
for (int i = 0; i < frame.width; i++) {
for (int j = 0; j < frame.height; j++) {
if (frame.data[i, j]) return false;
}
}
return true;
}
// Remember sidebar panels locations
private void SideBarRecalc() {
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
}
private void Form1_Load(object sender, EventArgs e) {
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
tsmiMakeVarWidth.Visible = monospaced;
@@ -141,7 +180,12 @@ namespace McBitFont {
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
CheckForAdd();
SideBarRecalc();
// Create default cursor
SetPanelCursor();
}
[DllImport("user32.dll")]
@@ -161,8 +205,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;
}
@@ -188,6 +234,12 @@ namespace McBitFont {
if (t > hScroll.Maximum) t = hScroll.Maximum;
hScroll.Value = t;
}
} else if (ModifierKeys.HasFlag(Keys.Alt)) {
t += (int)nudBrush.Value;
if (t < nudBrush.Minimum) t = (int)nudBrush.Minimum;
if (t > nudBrush.Maximum) t = (int)nudBrush.Maximum;
if (t > dotWidth || t > dotHeight) t = dotWidth < dotHeight ? dotWidth : dotHeight;
nudBrush.Value = t;
} else {
if (vScroll.Enabled) {
t = t * -1 * (cellSize + gap) + vScroll.Value;
@@ -201,14 +253,8 @@ namespace McBitFont {
public void nudX_ValueChanged(object sender, EventArgs e) {
Cursor.Current = Cursors.WaitCursor;
if (monospaced) {
Bitmap bmp;
for (int i = 0; i < frames.Count; i++) {
frames[i] = FrameResize(frames[i], (int)nudX.Value, dotHeight);
bmp = GetMiniPictue(frames[i]);
string s = frames[i].code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
frames[i] = FrameResize(frames[i], (int)nudX.Value, dotHeight, true);
}
SetModified(true, true);
}
@@ -219,20 +265,14 @@ namespace McBitFont {
DotResize((int)nudX.Value, dotHeight);
if (monospaced) history.Add(frames);
else history.Add(f);
Cursor.Current = Cursors.Default;
}
public void nudY_ValueChanged(object sender, EventArgs e) {
Cursor.Current = Cursors.WaitCursor;
Bitmap bmp;
for (int i = 0; i < frames.Count; i++) {
frames[i] = FrameResize(frames[i], frames[i].width, (int)nudY.Value);
bmp = GetMiniPictue(frames[i]);
string s = frames[i].code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
frames[i] = FrameResize(frames[i], frames[i].width, (int)nudY.Value, true);
}
if (nudY.Focused) {
SetModified();
@@ -244,7 +284,7 @@ namespace McBitFont {
Cursor.Current = Cursors.Default;
}
private FrameMiniature FrameResize(FrameMiniature ff, int neww, int newh) {
private FrameMiniature FrameResize(FrameMiniature ff, int neww, int newh, bool updateMiniList = false) {
int oldw = ff.width;
int oldh = ff.height;
int di = 0, dj = 0;
@@ -269,6 +309,15 @@ namespace McBitFont {
}
ff.data = t;
// update miniList with images
if (updateMiniList) {
Bitmap bmp = GetMiniPictue(ff);
string s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
}
return ff;
}
@@ -313,6 +362,7 @@ namespace McBitFont {
vScroll.Enabled = true;
}
SetPanelCursor();
dotPanel.Refresh();
}
@@ -425,6 +475,9 @@ namespace McBitFont {
var rectSel = chkRectSelect.Checked;
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
if (vScroll.Enabled || hScroll.Enabled) {
if (mouseDownMiddle) {
@@ -451,16 +504,22 @@ namespace McBitFont {
mouseDownMiddle = true;
mouseX = e.X;
mouseY = e.Y;
SetPanelCursor();
}
if (mouseDownMiddle && e.Button == MouseButtons.None) {
mouseDownMiddle = false;
SetPanelCursor();
}
}
// Moving baseline
Rectangle rect1, rect2;
if (set_base) {
if (set_lines > SetLines.SL_None) {
int baseline = 0;
if (set_lines == SetLines.SL_Base) baseline = baseline1;
if (set_lines == SetLines.SL_Mid) baseline = baseline2;
if (set_lines == SetLines.SL_Top) baseline = baseline3;
int yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
rect1 = new Rectangle(pixelOffset, yy, w, 2);
@@ -472,11 +531,17 @@ namespace McBitFont {
yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
rect2 = new Rectangle(pixelOffset, yy, w, 2);
if (set_lines == SetLines.SL_Base) baseline1 = baseline;
if (set_lines == SetLines.SL_Mid) baseline2 = baseline;
if (set_lines == SetLines.SL_Top) baseline3 = baseline;
dotPanel.Invalidate(rect1);
dotPanel.Invalidate(rect2);
if (e.Button == MouseButtons.Left) {
set_base = false;
set_lines = SetLines.SL_None;
SetPanelCursor();
SetModified(true, true);
return;
}
}
@@ -495,7 +560,7 @@ namespace McBitFont {
selection2.Y = j;
}
}
if (e.Button != MouseButtons.None && !mouseDown) {
if ((e.Button == MouseButtons.Left || e.Button == MouseButtons.Right) && !mouseDown) {
// Started to move a mouse with button held
mouseDown = true;
if (rectSel) {
@@ -504,7 +569,7 @@ namespace McBitFont {
selection2.X = i;
selection2.Y = j;
dotPanel.Invalidate();
} //else history.AddPre(f, false);
}
}
if (e.Button == MouseButtons.None && mouseDown) {
// Released a mouse button
@@ -513,7 +578,7 @@ namespace McBitFont {
NormPoints(ref selection1, ref selection2);
dotPanel.Invalidate();
} else {
if (fChanged) {
if (fChanged) {
fChanged = false;
history.Add(f);
}
@@ -553,36 +618,46 @@ namespace McBitFont {
}
// Check for Shift / Ctrl keys for straight lines
if (ModifierKeys.HasFlag(Keys.Shift)) {
if (ModifierKeys.HasFlag(Keys.Shift) && mouseDown) {
j = lastY;
} else if (ModifierKeys.HasFlag(Keys.Control)) {
} else if (ModifierKeys.HasFlag(Keys.Control) && mouseDown && !CAKeyDown) {
i = lastX;
}
lastX = i;
lastY = j;
// Paint black / white
if (e.Button == MouseButtons.Left && !f.data[i, j]) {
f.data[i, j] = true;
fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
SetModified();
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
if (e.Button == MouseButtons.Left) {
if (PaintPixel(i, j, true)) fChanged = true;
}
if (e.Button == MouseButtons.Right && f.data[i, j]) {
f.data[i, j] = false;
fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
SetModified();
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
if (e.Button == MouseButtons.Right) {
if (PaintPixel(i, j, false)) fChanged = true;
}
}
private bool PaintPixel(int i, int j, bool color) {
bool changed = false;
for (int a = 0; a < (int)nudBrush.Value; a++) {
if (i + a >= f.width) break;
for (int b = 0; b < (int)nudBrush.Value; b++) {
if (j + b >= f.height) break;
if (f.data[i + a, j + b] != color) {
f.data[i + a, j + b] = color;
int x = pixelOffset + (i + a) * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + (j + b) * (cellSize + gap) - vScroll.Value;
Rectangle rect1 = new(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
SetModified();
changed = true;
}
}
}
return changed;
}
private void btnInvert_Click(object sender, EventArgs e) {
int x, y, x2, y2;
@@ -673,6 +748,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);
@@ -724,21 +800,36 @@ namespace McBitFont {
// Fill the cell with color
if (f.data[i, j]) sb = sbb;
else sb = sbw;
g.FillRectangle(sb, x, (baseline == j ? y + 1 : y), cellSize, (baseline == j ? cellSize - 1 : cellSize));
g.FillRectangle(sb, x, ((baseline1 == j || baseline2 == j || baseline3 == j) ? y + 1 : y), cellSize, ((baseline1 == j || baseline2 == j || baseline3 == j) ? cellSize - 1 : cellSize));
}
}
// Draw the baseline
if (baseline > 0 && gap > 0) {
// Draw the base lines
if (baseline1 > 0 || baseline2 > 0 || baseline3 > 0) {
x = pixelOffset - hScroll.Value;
y = pixelOffset + baseline * (cellSize + gap) - vScroll.Value;
Pen sbBase = new(Color.Blue, 2);
g.DrawLine(sbBase, x, y, w, y);
// Base line
if (baseline1 > 0) {
Pen sbBase = new(Color.Blue, gap > 0 ? 2 : 1);
y = pixelOffset + baseline1 * (cellSize + gap) - vScroll.Value;
g.DrawLine(sbBase, x, y, w, y);
}
// Mid line
if (baseline2 > 0) {
Pen sbBase = new(Color.MediumPurple, gap > 0 ? 2 : 1);
y = pixelOffset + baseline2 * (cellSize + gap) - vScroll.Value;
g.DrawLine(sbBase, x, y, w, y);
}
// Top line
if (baseline3 > 0) {
Pen sbBase = new(Color.FromArgb(0x16, 0x8b, 0x76), gap > 0 ? 2 : 1);
y = pixelOffset + baseline3 * (cellSize + gap) - vScroll.Value;
g.DrawLine(sbBase, x, y, w, y);
}
}
// Draw the Rect selection
if (chkRectSelect.Checked) {
if (chkRectSelect.Checked || CAKeyDown) {
Point p1 = new(selection1.X, selection1.Y);
Point p2 = new(selection2.X, selection2.Y);
NormPoints(ref p1, ref p2);
@@ -839,6 +930,7 @@ namespace McBitFont {
}
makeVarWidthToolStripMenuItem.Visible = monospaced;
tsmiMakeVarWidth.Visible = monospaced;
zerofyWidthToolStripMenuItem.Enabled = !monospaced;
CodeShiftToolStripMenuItem.Visible = !form.cbSingle.Checked;
tsmiCodeShift.Visible = !form.cbSingle.Checked;
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
@@ -852,7 +944,9 @@ namespace McBitFont {
f = CopyFrame(frames.First());
form.Dispose();
baseline = 0;
baseline1 = 0;
baseline2 = 0;
baseline3 = 0;
prjName = "Untitled";
prjFileName = "";
@@ -890,7 +984,8 @@ namespace McBitFont {
nudX.Value = ff.width;
nudY.Value = ff.height;
f = ff;
tbFrameNote.Text = ff.note;
history.Add(code);
@@ -938,7 +1033,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;
}
}
@@ -952,7 +1047,9 @@ namespace McBitFont {
}
monospaced = sav.monospaced;
codepage = sav.codepage;
baseline = sav.baseline;
baseline1 = sav.baseline1;
baseline2 = sav.baseline2;
baseline3 = sav.baseline3;
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
frames = sav.frames;
makeVarWidthToolStripMenuItem.Visible = monospaced;
@@ -970,10 +1067,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);
@@ -989,8 +1085,11 @@ namespace McBitFont {
tsmiMakeVarWidth.Visible = monospaced;
makeVarWidthToolStripMenuItem.Visible = monospaced;
zerofyWidthToolStripMenuItem.Enabled = !monospaced;
tsmiCodeShift.Visible = frames.Count > 1;
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
SetModified(false);
SetModified(false, true);
Cursor.Current = Cursors.Default;
}
@@ -999,7 +1098,9 @@ namespace McBitFont {
sav.monospaced = monospaced;
sav.frames = frames;
sav.codepage = codepage;
sav.baseline = baseline;
sav.baseline1 = baseline1;
sav.baseline2 = baseline2;
sav.baseline3 = baseline3;
using (Stream ms = File.OpenWrite(filename)) {
MessagePackSerializer.Serialize(ms, sav);
@@ -1084,47 +1185,58 @@ namespace McBitFont {
}
private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
var bb = MessagePackSerializer.Serialize(CopyFrame(f, true));
DataObject clpbObj = new DataObject(clpbFormat.Name, bb);
Clipboard.SetDataObject(clpbObj, true);
if (tbFrameNote.Focused) {
tbFrameNote.Copy();
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) {
// Try to read from clipboard
try {
IDataObject clpbObj = Clipboard.GetDataObject();
byte[] bb = (byte[])clpbObj.GetData(clpbFormat.Name);
fbuf = MessagePackSerializer.Deserialize<FrameMiniature>(bb);
}
catch {
return;
}
int di, dj, wmax, hmax, selw, selh;
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];
if (tbFrameNote.Focused) {
if (!frameClipboard) tbFrameNote.Paste();
} else if (frameClipboard) {
// Try to read from clipboard
try {
IDataObject clpbObj = Clipboard.GetDataObject();
byte[] bb = (byte[])clpbObj.GetData(clpbFormat.Name);
fbuf = MessagePackSerializer.Deserialize<FrameMiniature>(bb);
}
catch {
return;
}
}
history.Add(f);
CheckHistoryButtons();
dotPanel.Refresh();
SetModified();
int di, dj, wmax, hmax, selw, selh;
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);
CheckHistoryButtons();
dotPanel.Refresh();
SetModified();
}
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1133,7 +1245,7 @@ namespace McBitFont {
}
private void btnBaseline_Click(object sender, EventArgs e) {
set_base = !set_base;
cmBaseline.Show(btnBaseline, new Point(0, btnBaseline.Height));
}
// Check modified / Save frame
@@ -1242,6 +1354,7 @@ namespace McBitFont {
monospaced = false;
makeVarWidthToolStripMenuItem.Visible = false;
tsmiMakeVarWidth.Visible = false;
zerofyWidthToolStripMenuItem.Enabled = true;
lblType.Text = "Variable width / Single";
SetModified(true, true);
}
@@ -1347,6 +1460,9 @@ namespace McBitFont {
private void chkRectSelect_CheckedChanged(object sender, EventArgs e) {
lblSelection.Visible = lblSelectionLabel.Visible = chkRectSelect.Checked;
selectAllToolStripMenuItem.Enabled = chkRectSelect.Checked;
SetPanelCursor();
dotPanel.Refresh();
}
@@ -1475,7 +1591,7 @@ namespace McBitFont {
}
private void TestFont_Click(object sender, EventArgs e) {
var tester = new FontTester(codepage, dotHeight, baseline, frames);
var tester = new FontTester(codepage, dotHeight, baseline1, frames);
tester.ShowDialog();
}
@@ -1573,5 +1689,146 @@ namespace McBitFont {
}
}
private void toggleBarToolStripMenuItem_Click(object sender, EventArgs e) {
int state;
dotPanel.Width = this.Width - (toggleBarToolStripMenuItem.Checked ? 260 : 504);
SideBarRecalc();
if (toggleBarToolStripMenuItem.Checked) {
toggleBarToolStripMenuItem.Text = "<<";
state = 1;
} else {
toggleBarToolStripMenuItem.Text = ">>";
state = 0;
}
panel1.Location = sidebarLocs[state, 0];
pnlInfo.Location = sidebarLocs[state, 1];
miniList.Visible = !toggleBarToolStripMenuItem.Checked;
vScroll.Location = sidebarLocs[state, 2];
hScroll.Width = dotPanel.Width;
cbZoom.Focus();
}
private void PrevNextMenuCheck() {
if (frames.Count < 2) {
nextSymbolToolStripMenuItem.Enabled = false;
previousSymbolToolStripMenuItem.Enabled = false;
return;
}
previousSymbolToolStripMenuItem.Enabled = f.code != frames.First().code;
nextSymbolToolStripMenuItem.Enabled = f.code != frames.Last().code;
}
private void fontToolStripMenuItem_DropDownOpening(object sender, EventArgs e) {
PrevNextMenuCheck();
}
private void previousSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
if (f.code != frames.First().code && miniList.SelectedItems.Count > 0) {
miniList.Items[miniList.SelectedIndices[0] - 1].Selected = true;
}
PrevNextMenuCheck();
}
private void nextSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
if (f.code != frames.Last().code && miniList.SelectedItems.Count > 0) {
miniList.Items[miniList.SelectedIndices[0] + 1].Selected = true;
}
PrevNextMenuCheck();
}
private void ZerofyBlankWidth(object sender, EventArgs e) {
if (monospaced) return; // Does not work for monospaced fonts
if (frames.Count < 2) return; // Does not work for single images
bool flag = false;
for (int i = 0; i < frames.Count; i++) {
if (IsFrameBlank(frames[i])) {
frames[i] = FrameResize(frames[i], 0, dotHeight, true);
flag = true;
}
}
if (flag) {
SetModified(true, true);
MiniList_SelectedIndexChanged(miniList, EventArgs.Empty);
}
}
private void nudBrush_ValueChanged(object sender, EventArgs e) {
SetPanelCursor();
}
private void frameScreenshotToolStripMenuItem_Click(object sender, EventArgs e) {
FrameScreenshot iform = new(f);
iform.ShowDialog();
iform.Dispose();
}
private void tbFrameNote_TextChanged(object sender, EventArgs e) {
if (tbFrameNote.Focused) {
f.note = tbFrameNote.Text;
SetModified();
}
}
static bool CAKeyDown = false;
private void MainForm_KeyDown(object sender, KeyEventArgs e) {
if (CAKeyDown) return;
if (chkRectSelect.Checked && e.Control && e.Alt) {
chkRectSelect.Checked = false;
CAKeyDown = true;
dotPanel.Invalidate();
e.Handled = true;
}
}
private void MainForm_KeyUp(object sender, KeyEventArgs e) {
if (CAKeyDown && !e.Control && !e.Alt) {
chkRectSelect.Checked = true;
CAKeyDown = false;
e.Handled = true;
}
}
private void btnBaseline_Paint(object sender, PaintEventArgs e) {
Button btn = (sender as Button);
int arrowX = btn.ClientRectangle.Width - btn.Padding.Right - 14;
int arrowY = btn.ClientRectangle.Height / 2 - 1;
Color color = btn.Enabled ? ForeColor : SystemColors.ControlDark;
using Brush brush = new SolidBrush(color);
using Pen pen = new Pen(color);
Point[] arrow = [new Point(arrowX, arrowY), new Point(arrowX + 7, arrowY), new Point(arrowX + 3, arrowY + 4)];
e.Graphics.FillPolygon(brush, arrow);
e.Graphics.DrawLine(pen, arrowX - 5, btn.ClientRectangle.Top + 4, arrowX - 5, btn.ClientRectangle.Bottom - 4);
}
private void tsmiBaseline_Click(object sender, EventArgs e) {
if (set_lines == SetLines.SL_Base) set_lines = SetLines.SL_None;
else set_lines = SetLines.SL_Base;
SetPanelCursor();
}
private void tsmiMidline_Click(object sender, EventArgs e) {
if (set_lines == SetLines.SL_Mid) set_lines = SetLines.SL_None;
else set_lines = SetLines.SL_Mid;
SetPanelCursor();
}
private void tsmiTopline_Click(object sender, EventArgs e) {
if (set_lines == SetLines.SL_Top) set_lines = SetLines.SL_None;
else set_lines = SetLines.SL_Top;
SetPanelCursor();
}
private void SetPanelCursor() {
if (mouseDownMiddle) dotPanel.Cursor = McCursor.GetCursorDrag();
else if (set_lines > SetLines.SL_None) dotPanel.Cursor = McCursor.GetCursorLines();
else if (chkRectSelect.Checked) dotPanel.Cursor = McCursor.GetCursorSelect();
else dotPanel.Cursor = McCursor.GetCursor((int)nudBrush.Value, cellSize, gap);
}
}
}

View File

@@ -138,6 +138,9 @@
<metadata name="dlgSavePNG.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>644, 17</value>
</metadata>
<metadata name="cmBaseline.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>763, 17</value>
</metadata>
<assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
<data name="$this.Icon" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>

169
McBitFont/FrameScreenshot.Designer.cs generated Normal file
View File

@@ -0,0 +1,169 @@
namespace McBitFont {
partial class FrameScreenshot {
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing) {
if (disposing && (components != null)) {
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
components = new System.ComponentModel.Container();
btnClose = new System.Windows.Forms.Button();
btnOK = new System.Windows.Forms.Button();
toolTip1 = new System.Windows.Forms.ToolTip(components);
nudUpscale = new System.Windows.Forms.NumericUpDown();
chkTransparent = new System.Windows.Forms.CheckBox();
chkBlackBG = new System.Windows.Forms.CheckBox();
btnCopy = new System.Windows.Forms.Button();
dlgSaveImage = new System.Windows.Forms.SaveFileDialog();
lblUpscale = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)nudUpscale).BeginInit();
SuspendLayout();
//
// btnClose
//
btnClose.Location = new System.Drawing.Point(234, 67);
btnClose.Name = "btnClose";
btnClose.Size = new System.Drawing.Size(88, 27);
btnClose.TabIndex = 3;
btnClose.Text = "Close";
toolTip1.SetToolTip(btnClose, "Close the dialog");
btnClose.UseVisualStyleBackColor = true;
btnClose.Click += btnClose_Click;
//
// btnOK
//
btnOK.Image = Properties.Resources.Famfamfam_Silk_Disk_16;
btnOK.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnOK.Location = new System.Drawing.Point(12, 67);
btnOK.Name = "btnOK";
btnOK.Size = new System.Drawing.Size(88, 27);
btnOK.TabIndex = 1;
btnOK.Text = "Save";
btnOK.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnOK, "Save to file");
btnOK.UseVisualStyleBackColor = true;
btnOK.Click += btnOK_Click;
//
// toolTip1
//
toolTip1.AutoPopDelay = 10000;
toolTip1.InitialDelay = 500;
toolTip1.ReshowDelay = 100;
//
// nudUpscale
//
nudUpscale.Location = new System.Drawing.Point(71, 27);
nudUpscale.Maximum = new decimal(new int[] { 255, 0, 0, 0 });
nudUpscale.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
nudUpscale.Name = "nudUpscale";
nudUpscale.Size = new System.Drawing.Size(51, 23);
nudUpscale.TabIndex = 2;
toolTip1.SetToolTip(nudUpscale, "Pixel upscale factor (4 means that for each frame pixel there will be 4x4 pixels generated)");
nudUpscale.Value = new decimal(new int[] { 4, 0, 0, 0 });
//
// chkTransparent
//
chkTransparent.AutoSize = true;
chkTransparent.Location = new System.Drawing.Point(144, 18);
chkTransparent.Name = "chkTransparent";
chkTransparent.Size = new System.Drawing.Size(155, 19);
chkTransparent.TabIndex = 5;
chkTransparent.Text = "Transparent background";
toolTip1.SetToolTip(chkTransparent, "Make background transparent (Doesn't work with clipboard - background will be gray)");
chkTransparent.UseVisualStyleBackColor = true;
chkTransparent.CheckedChanged += chkTransparent_CheckedChanged;
//
// chkBlackBG
//
chkBlackBG.AutoSize = true;
chkBlackBG.Enabled = false;
chkBlackBG.Location = new System.Drawing.Point(144, 35);
chkBlackBG.Name = "chkBlackBG";
chkBlackBG.Size = new System.Drawing.Size(132, 19);
chkBlackBG.TabIndex = 6;
chkBlackBG.Text = "Background is black";
toolTip1.SetToolTip(chkBlackBG, "White color is considered as background by default. Check this to invert that");
chkBlackBG.UseVisualStyleBackColor = true;
//
// btnCopy
//
btnCopy.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
btnCopy.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnCopy.Location = new System.Drawing.Point(122, 67);
btnCopy.Name = "btnCopy";
btnCopy.Size = new System.Drawing.Size(88, 27);
btnCopy.TabIndex = 7;
btnCopy.Text = "Copy";
btnCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
toolTip1.SetToolTip(btnCopy, "Copy to clipboard");
btnCopy.UseVisualStyleBackColor = true;
btnCopy.Click += btnCopy_Click;
//
// dlgSaveImage
//
dlgSaveImage.DefaultExt = "png";
dlgSaveImage.Filter = "PNG Image|*.png;*.PNG";
//
// lblUpscale
//
lblUpscale.AutoSize = true;
lblUpscale.Location = new System.Drawing.Point(71, 9);
lblUpscale.Name = "lblUpscale";
lblUpscale.Size = new System.Drawing.Size(51, 15);
lblUpscale.TabIndex = 4;
lblUpscale.Text = "Upscale:";
//
// FrameScreenshot
//
AcceptButton = btnClose;
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
CancelButton = btnClose;
ClientSize = new System.Drawing.Size(334, 111);
Controls.Add(btnCopy);
Controls.Add(chkBlackBG);
Controls.Add(chkTransparent);
Controls.Add(nudUpscale);
Controls.Add(lblUpscale);
Controls.Add(btnClose);
Controls.Add(btnOK);
FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
Name = "FrameScreenshot";
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
Text = "Frame Screenshot";
Load += FrameScreenshot_Load;
((System.ComponentModel.ISupportInitialize)nudUpscale).EndInit();
ResumeLayout(false);
PerformLayout();
}
#endregion
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.SaveFileDialog dlgSaveImage;
private System.Windows.Forms.Label lblUpscale;
private System.Windows.Forms.NumericUpDown nudUpscale;
private System.Windows.Forms.CheckBox chkTransparent;
private System.Windows.Forms.CheckBox chkBlackBG;
private System.Windows.Forms.Button btnCopy;
}
}

View File

@@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Drawing.Imaging;
using System.IO;
using System.Linq;
using System.Security.Policy;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using static McBitFont.MainForm;
namespace McBitFont {
public partial class FrameScreenshot : Form {
private FrameMiniature f;
public FrameScreenshot(FrameMiniature frame) {
InitializeComponent();
f = frame;
}
private Bitmap GenerateScreenshot() {
int upscale = (int)nudUpscale.Value;
int x, y;
bool transp = chkTransparent.Checked;
bool blackBG = chkBlackBG.Checked;
Bitmap bmp = new(f.width * upscale, f.height * upscale);
SolidBrush bb = new(Color.Black);
SolidBrush bw = new(Color.White);
using (Graphics g = Graphics.FromImage(bmp)) {
for (x = 0; x < f.width; x++) {
for (y = 0; y < f.height; y++) {
if (f.data[x, y]) {
if (!transp || (transp && !blackBG)) g.FillRectangle(bb, x * upscale, y * upscale, upscale, upscale);
} else
if (!transp || (transp && blackBG)) g.FillRectangle(bw, x * upscale, y * upscale, upscale, upscale);
}
}
}
return bmp;
}
private void btnOK_Click(object sender, EventArgs e) {
if (dlgSaveImage.ShowDialog() == DialogResult.OK) {
Bitmap bmp = GenerateScreenshot();
bool err = false;
try {
bmp.Save(dlgSaveImage.FileName, ImageFormat.Png);
}
catch (Exception ex) {
err = true;
MessageBox.Show("There was an error during image save: " + ex.Message, "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
if (!err) MessageBox.Show("Screenshot has been saved!", "Success!", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
}
private void FrameScreenshot_Load(object sender, EventArgs e) {
btnOK.Focus();
}
private void btnClose_Click(object sender, EventArgs e) {
DialogResult = DialogResult.OK;
}
private void chkTransparent_CheckedChanged(object sender, EventArgs e) {
chkBlackBG.Enabled = chkTransparent.Checked;
}
private void btnCopy_Click(object sender, EventArgs e) {
Bitmap bmp = GenerateScreenshot();
using MemoryStream stream = new();
bmp.Save(stream, ImageFormat.Png);
DataObject data = new("PNG", stream);
data.SetImage(bmp);
Clipboard.SetDataObject(data, true);
}
}
}

View File

@@ -0,0 +1,126 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="dlgSaveImage.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>115, 17</value>
</metadata>
</root>

View File

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

172
McBitFont/McCursor.cs Normal file
View File

@@ -0,0 +1,172 @@
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace McBitFont {
internal class McCursor {
public struct IconInfo {
public bool fIcon;
public int xHotspot;
public int yHotspot;
public IntPtr hbmMask;
public IntPtr hbmColor;
}
[DllImport("user32.dll")]
[return: MarshalAs(UnmanagedType.Bool)]
public static extern bool GetIconInfo(IntPtr hIcon, ref IconInfo pIconInfo);
[DllImport("user32.dll")]
public static extern IntPtr CreateIconIndirect(ref IconInfo icon);
/// <summary>
/// Create a cursor from a bitmap without resizing and with the specified
/// hot spot
/// </summary>
public static Cursor CreateCursorNoResize(Bitmap bmp, int xHotSpot, int yHotSpot) {
IntPtr ptr = bmp.GetHicon();
IconInfo tmp = new IconInfo();
GetIconInfo(ptr, ref tmp);
tmp.xHotspot = xHotSpot;
tmp.yHotspot = yHotSpot;
tmp.fIcon = false;
ptr = CreateIconIndirect(ref tmp);
return new Cursor(ptr);
}
/// <summary>
/// Create a 32x32 cursor from a bitmap, with the hot spot in the middle
/// </summary>
public static Cursor CreateCursor(Bitmap bmp) {
int xHotSpot = 16;
int yHotSpot = 16;
IntPtr ptr = ((Bitmap)ResizeImage(bmp, 32, 32)).GetHicon();
IconInfo tmp = new IconInfo();
GetIconInfo(ptr, ref tmp);
tmp.xHotspot = xHotSpot;
tmp.yHotspot = yHotSpot;
tmp.fIcon = false;
ptr = CreateIconIndirect(ref tmp);
return new Cursor(ptr);
}
/// <summary>
/// Resize the image to the specified width and height.
/// </summary>
/// <param name="image">The image to resize.</param>
/// <param name="width">The width to resize to.</param>
/// <param name="height">The height to resize to.</param>
/// <returns>The resized image.</returns>
public static Bitmap ResizeImage(Image image, int width, int height) {
var destRect = new Rectangle(0, 0, width, height);
var destImage = new Bitmap(width, height);
destImage.SetResolution(image.HorizontalResolution, image.VerticalResolution);
using (var graphics = Graphics.FromImage(destImage)) {
graphics.CompositingMode = CompositingMode.SourceCopy;
graphics.CompositingQuality = CompositingQuality.HighQuality;
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
graphics.SmoothingMode = SmoothingMode.HighQuality;
graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
using (var wrapMode = new ImageAttributes()) {
wrapMode.SetWrapMode(WrapMode.TileFlipXY);
graphics.DrawImage(image, destRect, 0, 0, image.Width, image.Height, GraphicsUnit.Pixel, wrapMode);
}
}
return destImage;
}
public static Cursor GetCursor(int penSize, int cellSize, int gap) {
int size = (cellSize + gap) * penSize;
Bitmap bmp = new(size, size);
Pen pb = new(Color.Black, 1);
SolidBrush bw = new(Color.FromArgb(160, Color.White));
using (Graphics g = Graphics.FromImage(bmp)) {
g.DrawRectangle(pb, 0, 0, size-1, size-1);
g.FillRectangle(bw, 1, 1, size - 2, size - 2);
}
return CreateCursorNoResize(bmp, cellSize / 2, cellSize / 2);
}
public static Cursor GetCursorSelect() {
Point[] arrow = { new(1, 1), new(12, 12), new(11, 13), new(6, 13), new(2, 17), new(1, 16) };
Point[] corner1 = { new(13, 6), new(20, 6), new(20, 13), new(17, 13), new(17, 9), new(13, 9) };
Point[] corner2 = { new(17, 16), new(20, 16), new(20, 23), new(13, 23), new(13, 20), new(17, 20) };
Point[] corner3 = { new(3, 16), new(6, 16), new(6, 20), new(10, 20), new(10, 23), new(3, 23) };
Point[] corner4 = { new(6, 6), new(10, 6), new(10, 9), new(6, 9) };
Bitmap bmp = new(21, 24);
Pen pb = new(Color.Black, 1);
SolidBrush bw = new (Color.White);
using (Graphics g = Graphics.FromImage(bmp)) {
g.FillPolygon(bw, corner1);
g.DrawPolygon(pb, corner1);
g.FillPolygon(bw, corner2);
g.DrawPolygon(pb, corner2);
g.FillPolygon(bw, corner3);
g.DrawPolygon(pb, corner3);
g.FillPolygon(bw, corner4);
g.DrawPolygon(pb, corner4);
g.FillPolygon(bw, arrow);
g.DrawPolygon(pb, arrow);
}
return CreateCursorNoResize(bmp, 1, 1);
}
public static Cursor GetCursorLines() {
Point[] arrow = { new(1, 1), new(12, 12), new(11, 13), new(6, 13), new(2, 17), new(1, 16) };
Rectangle line = new(0, 18, 20, 5);
Bitmap bmp = new(21, 24);
Pen pb = new(Color.Black, 1);
Pen pw = new(Color.White, 1);
SolidBrush bw = new(Color.White);
SolidBrush bb = new(Color.Black);
using (Graphics g = Graphics.FromImage(bmp)) {
g.FillPolygon(bw, arrow);
g.DrawPolygon(pb, arrow);
g.FillRectangle(bb, line);
g.DrawRectangle(pw, line);
}
return CreateCursorNoResize(bmp, 1, 1);
}
public static Cursor GetCursorDrag() {
Point[] arrow1 = { new(11, 0), new(15, 4), new(13, 4), new(13, 7), new(9, 7), new(9, 4), new(7, 4) };
Point[] arrow2 = { new(22, 11), new(18, 15), new(18, 13), new(15, 13), new(15, 9), new(18, 9), new(18, 7) };
Point[] arrow3 = { new(11, 22), new(7, 18), new(9, 18), new(9, 15), new(13, 15), new(13, 18), new(15, 18) };
Point[] arrow4 = { new(0, 11), new(4, 7), new(4, 9), new(7, 9), new(7, 13), new(4, 13), new(4, 15) };
Bitmap bmp = new(23, 23);
Pen pb = new(Color.Black, 1);
SolidBrush bw = new(Color.White);
using (Graphics g = Graphics.FromImage(bmp)) {
g.FillPolygon(bw, arrow1);
g.DrawPolygon(pb, arrow1);
g.FillPolygon(bw, arrow2);
g.DrawPolygon(pb, arrow2);
g.FillPolygon(bw, arrow3);
g.DrawPolygon(pb, arrow3);
g.FillPolygon(bw, arrow4);
g.DrawPolygon(pb, arrow4);
}
return CreateCursorNoResize(bmp, 11, 11);
}
}
}

View File

@@ -100,6 +100,26 @@ namespace McBitFont.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_turn_left {
get {
object obj = ResourceManager.GetObject("arrow_turn_left", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_turn_right {
get {
object obj = ResourceManager.GetObject("arrow_turn_right", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -160,6 +180,26 @@ namespace McBitFont.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap fam_lines {
get {
object obj = ResourceManager.GetObject("fam_lines", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap fam_mid {
get {
object obj = ResourceManager.GetObject("fam_mid", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -170,6 +210,16 @@ namespace McBitFont.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap fam_top {
get {
object obj = ResourceManager.GetObject("fam_top", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
@@ -320,6 +370,26 @@ namespace McBitFont.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap picture_save {
get {
object obj = ResourceManager.GetObject("picture_save", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap text_letterspacing2 {
get {
object obj = ResourceManager.GetObject("text_letterspacing2", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -118,6 +118,9 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="fam_mid" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fam_mid.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="z_left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -130,24 +133,30 @@
<data name="Famfamfam-Silk-Page-paste.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Famfamfam-Silk-Page-paste.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="folder_table" 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>
</data>
<data name="folder_open" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\folder_open.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="Famfamfam-Silk-Page-copy.16" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\Famfamfam-Silk-Page-copy.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="font" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\font.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="picture_go" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arrow_inout" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_inout.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="font" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\font.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="picture_save" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_save.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
</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">
<value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
@@ -181,20 +190,23 @@
<data name="z_shading" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\shading.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arrow_turn_left" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_turn_left.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="add" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\add.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="icon_32" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\icon_32.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="z_undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="fam_lines" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fam_lines.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="z_tick" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\tick.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="z_undo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_undo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="z_redo" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -208,8 +220,17 @@
<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>
</data>
<data name="folder_table" 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>
<data name="delete" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\delete.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<data name="arrow_turn_right" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_turn_right.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</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="text_letterspacing2" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\text_letterspacing2.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
<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>
@@ -232,7 +253,7 @@
<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>
</data>
<data name="picture_go" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\picture_go.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
<data name="fam_top" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\fam_top.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

View File

@@ -2,7 +2,11 @@
McFLY's Bit Font and Image Editor
Features:
Download in the [Releases](https://gitea.mcflyer.ru/McFLY/McBitFont/releases) section!
Library example instructions to implement to STM32 code: [mctext](STM32_HAL_Lib/README.md)
**Features:**
- Generate a project based on a font installed in the system
- Basic pixel manipulations: shift, flip, invert, etc...
- Import an image
@@ -12,21 +16,22 @@ Features:
- Export to a PNG image showing all the characters in a table
- Test your font in special dialog
Requires:
**Requires:**
- Windows 7+
- .NET 9
Some basic hints on the interface:
**Some basic hints on the interface:**
- Mouse 1 to mark a pixel black
- Mouse 2 to mark a pixel white
- Drag the mouse holding a button to draw pixels
- Hold middle mouse button to drag the canvas
- Hold Shift to constrain painting horizontally
- Hold Ctrl to constrain painting vertically
- Mouse Scroll to scroll up and down
- Shift + scroll to scroll left and right
- Crtl + scroll to zoom
Download in the [Releases](https://gitea.mcflyer.ru/McFLY/McBitFont/releases) section!
- Alt + Scroll to change painting brush size
- When Rectangle selection tool is active hold Ctrl+Alt to temporary disable it to be able to draw
#### Important:
**Since v2.0 new save file format is implemented. You can use [McBitFont v1.7](https://gitea.mcflyer.ru/McFLY/McBitFont/releases/tag/v1.7) to convert old saved files to the new format.**
@@ -61,3 +66,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)

13
STM32_HAL_Lib/README.md Normal file
View File

@@ -0,0 +1,13 @@
# McText Library
- The library uses "Left to Right, Top to bottom" scan and "LSB Top" for pixels alignment
#### Instructions
To use the library you have to have a display driver with a function that paints a single pixel with X and Y coordinates and 0/1 color.<br>
Find "SET A FUNCTION NAME HERE!" text in *mctext.c* file and change the function name that suits your driver.<br>
**Note:** it is possible that you will have to change parameters in the function to match your driver.
**Note:** check the "include" in *mctext.h* file to match your HAL. (stm32f1xx_hal.h is fo STM32F1 MCU series)
Now use **mct_String** function to draw a string of text.

285
STM32_HAL_Lib/fonts.c Normal file
View File

@@ -0,0 +1,285 @@
/*
ST7565 LCD library
Anton Mukhin, 2023
*/
#include <fonts.h>
/* Font header map:
uint8_t packed; // Is it a packed font?
uint8_t width; // Font width in pixels
uint8_t height; // Font height in pixels
uint8_t space; // Space between characters
uint8_t first; // First character code
uint8_t last; // Last character code
*/
const uint8_t font_5x7_vw[] = {
// Meta header
1, // Is it a packed font?
0, // Font width in pixels; 0 - variable width
7, // Font height in pixels
1, // Font space (between symbols) in pixels
0, // First character code
255, // Last character code
// Data:
0x00, // 0 -->
0x05, 0xff, 0xff, 0xff, 0xff, 0x07, // 1 -->
0x05, 0xff, 0x60, 0x30, 0xf8, 0x07, // 2 -->
0x00, // 3 -->
0x00, // 4 -->
0x00, // 5 -->
0x00, // 6 -->
0x00, // 7 -->
0x05, 0x0c, 0x0f, 0xcf, 0xc3, 0x00, // 8 -->
0x05, 0x08, 0x96, 0x8f, 0x85, 0x00, // 9 -->
0x05, 0x08, 0xa4, 0x1f, 0x89, 0x00, // 10 -->
0x05, 0x22, 0x0a, 0x82, 0x22, 0x02, // 11 -->
0x05, 0x10, 0x0c, 0x07, 0x03, 0x01, // 12 -->
0x05, 0x3e, 0x9f, 0xcf, 0xe7, 0x03, // 13 -->
0x05, 0x08, 0x8e, 0x8f, 0x83, 0x00, // 14 -->
0x05, 0x1c, 0x9f, 0xcf, 0xc7, 0x01, // 15 -->
0x18, 0x1c, 0x0e, 0x87, 0xc3, 0xe1, 0xf8, 0xfe, 0xff, 0xbf, 0x48, 0x04, 0x00, 0xfc, 0xff, 0x7f, 0x1f, 0x87, 0xc3, 0xe1, 0x70, 0x38, // 16 --> Not connected
0x18, 0x1c, 0x0e, 0x87, 0xe3, 0xfb, 0xff, 0x83, 0xff, 0x60, 0xb7, 0x3b, 0xfe, 0x8f, 0xbb, 0xdd, 0xf5, 0xdf, 0xc7, 0xe1, 0x70, 0x38, // 17 --> IDC
0x18, 0x1c, 0xdf, 0x7f, 0xb8, 0xff, 0x5f, 0xa7, 0xeb, 0xff, 0x79, 0x1d, 0xfc, 0xaf, 0xab, 0xeb, 0x7f, 0xb4, 0xda, 0xfe, 0xfb, 0x38, // 18 --> RS485
0x0a, 0x0c, 0x06, 0x00, 0xc0, 0x60, 0x00, 0x00, 0x0c, 0x06, // 19 -->
0x00, // 20 -->
0x00, // 21 -->
0x00, // 22 -->
0x00, // 23 -->
0x09, 0xc2, 0x70, 0xd4, 0x09, 0xe0, 0x48, 0xfe, 0x10, // 24 -->
0x09, 0x00, 0xe1, 0x1f, 0x08, 0x38, 0x15, 0x8b, 0x39, // 25 -->
0x00, // 26 -->
0x00, // 27 -->
0x00, // 28 -->
0x00, // 29 -->
0x00, // 30 -->
0x00, // 31 -->
0x01, 0x00, // 32 -->
0x01, 0x5f, // 33 --> !
0x03, 0x07, 0xc0, 0x01, // 34 --> "
0x05, 0x94, 0x3f, 0xe5, 0x4f, 0x01, // 35 --> #
0x05, 0x24, 0xd5, 0x5f, 0x25, 0x01, // 36 --> $
0x05, 0xa3, 0x09, 0x82, 0x2c, 0x06, // 37 --> %
0x05, 0xb6, 0x64, 0x55, 0x04, 0x05, // 38 --> &
0x02, 0x85, 0x01, // 39 --> '
0x02, 0xbe, 0x20, // 40 --> (
0x02, 0x41, 0x1f, // 41 --> )
0x05, 0x14, 0x84, 0x0f, 0x41, 0x01, // 42 --> *
0x05, 0x08, 0x84, 0x0f, 0x81, 0x00, // 43 --> +
0x02, 0x50, 0x18, // 44 --> ,
0x05, 0x08, 0x04, 0x02, 0x81, 0x00, // 45 --> -
0x02, 0x60, 0x30, // 46 --> .
0x05, 0x20, 0x08, 0x82, 0x20, 0x00, // 47 --> /
0x05, 0xbe, 0x68, 0xb2, 0xe8, 0x03, // 48 --> 0
0x05, 0x00, 0xe1, 0x1f, 0x08, 0x00, // 49 --> 1
0x05, 0xc2, 0x70, 0x34, 0x69, 0x04, // 50 --> 2
0x05, 0xa1, 0x60, 0x71, 0x19, 0x03, // 51 --> 3
0x05, 0x18, 0x8a, 0xe4, 0x0f, 0x01, // 52 --> 4
0x05, 0xa7, 0x62, 0xb1, 0x98, 0x03, // 53 --> 5
0x05, 0x3c, 0x65, 0x32, 0x09, 0x03, // 54 --> 6
0x05, 0x83, 0x40, 0x3c, 0x71, 0x00, // 55 --> 7
0x05, 0xb6, 0x64, 0x32, 0x69, 0x03, // 56 --> 8
0x05, 0x86, 0x64, 0x32, 0xe5, 0x01, // 57 --> 9
0x02, 0x36, 0x1b, // 58 --> :
0x02, 0x56, 0x1b, // 59 --> ;
0x04, 0x08, 0x8a, 0x28, 0x08, // 60 --> <
0x05, 0x14, 0x0a, 0x85, 0x42, 0x01, // 61 --> =
0x04, 0x41, 0x11, 0x05, 0x01, // 62 --> >
0x05, 0x82, 0x40, 0x34, 0x61, 0x00, // 63 --> ?
0x05, 0xb2, 0x64, 0x3e, 0xe8, 0x03, // 64 --> @
0x05, 0xfe, 0x48, 0x24, 0xe2, 0x07, // 65 --> A
0x05, 0xff, 0x64, 0x32, 0x69, 0x03, // 66 --> B
0x05, 0xbe, 0x60, 0x30, 0x28, 0x02, // 67 --> C
0x05, 0xff, 0x60, 0x50, 0xc4, 0x01, // 68 --> D
0x05, 0xff, 0x64, 0x32, 0x19, 0x04, // 69 --> E
0x05, 0xff, 0x44, 0x22, 0x11, 0x00, // 70 --> F
0x05, 0xbe, 0x60, 0x32, 0xa9, 0x07, // 71 --> G
0x05, 0x7f, 0x04, 0x02, 0xf1, 0x07, // 72 --> H
0x03, 0xc1, 0x7f, 0x10, // 73 --> I
0x05, 0x20, 0x60, 0xf0, 0x17, 0x00, // 74 --> J
0x05, 0x7f, 0x04, 0x45, 0x14, 0x04, // 75 --> K
0x05, 0x7f, 0x20, 0x10, 0x08, 0x04, // 76 --> L
0x05, 0x7f, 0x01, 0x43, 0xf0, 0x07, // 77 --> M
0x05, 0x7f, 0x02, 0x02, 0xf2, 0x07, // 78 --> N
0x05, 0xbe, 0x60, 0x30, 0xe8, 0x03, // 79 --> O
0x05, 0xff, 0x44, 0x22, 0x61, 0x00, // 80 --> P
0x05, 0xbe, 0x60, 0x34, 0xe4, 0x05, // 81 --> Q
0x05, 0xff, 0x44, 0x26, 0x65, 0x04, // 82 --> R
0x05, 0xc6, 0x64, 0x32, 0x19, 0x03, // 83 --> S
0x05, 0x81, 0xc0, 0x3f, 0x10, 0x00, // 84 --> T
0x05, 0x3f, 0x20, 0x10, 0xf8, 0x03, // 85 --> U
0x05, 0x1f, 0x10, 0x10, 0xf4, 0x01, // 86 --> V
0x05, 0x3f, 0x20, 0x0e, 0xf8, 0x03, // 87 --> W
0x05, 0x63, 0x0a, 0x82, 0x32, 0x06, // 88 --> X
0x05, 0x07, 0x04, 0x1c, 0x71, 0x00, // 89 --> Y
0x05, 0xe1, 0x68, 0xb2, 0x38, 0x04, // 90 --> Z
0x02, 0xff, 0x20, // 91 --> [
0x05, 0x02, 0x02, 0x02, 0x02, 0x02, // 92 --> backslash
0x02, 0xc1, 0x3f, // 93 --> ]
0x03, 0x04, 0x01, 0x01, // 94 --> ^
0x05, 0x40, 0x20, 0x10, 0x08, 0x04, // 95 --> _
0x03, 0x01, 0x01, 0x01, // 96 --> `
0x04, 0x20, 0x2a, 0x15, 0x0f, // 97 --> a
0x04, 0x7f, 0x24, 0x11, 0x07, // 98 --> b
0x04, 0x38, 0x22, 0x11, 0x04, // 99 --> c
0x04, 0x38, 0x22, 0xf2, 0x0f, // 100 --> d
0x04, 0x38, 0x2a, 0x15, 0x03, // 101 --> e
0x04, 0x08, 0x7f, 0x42, 0x00, // 102 --> f
0x04, 0x0c, 0xa9, 0xd4, 0x07, // 103 --> g
0x04, 0x7f, 0x04, 0x01, 0x0f, // 104 --> h
0x03, 0xc4, 0x3e, 0x10, // 105 --> i
0x04, 0x20, 0x20, 0xb1, 0x07, // 106 --> j
0x04, 0x7f, 0x08, 0x8a, 0x08, // 107 --> k
0x03, 0xc1, 0x3f, 0x10, // 108 --> l
0x05, 0x7c, 0x02, 0x86, 0x80, 0x07, // 109 --> m
0x04, 0x7c, 0x04, 0x01, 0x0f, // 110 --> n
0x04, 0x38, 0x22, 0x11, 0x07, // 111 --> o
0x04, 0x7c, 0x0a, 0x05, 0x01, // 112 --> p
0x04, 0x08, 0x0a, 0x86, 0x0f, // 113 --> q
0x04, 0x7c, 0x04, 0x01, 0x01, // 114 --> r
0x04, 0x48, 0x2a, 0x15, 0x04, // 115 --> s
0x04, 0x84, 0x1f, 0x11, 0x04, // 116 --> t
0x04, 0x3c, 0x20, 0x88, 0x0f, // 117 --> u
0x05, 0x1c, 0x10, 0x10, 0xc4, 0x01, // 118 --> v
0x05, 0x3c, 0x20, 0x0e, 0xc8, 0x03, // 119 --> w
0x04, 0x6c, 0x08, 0x84, 0x0d, // 120 --> x
0x04, 0x0c, 0x28, 0x94, 0x07, // 121 --> y
0x04, 0x64, 0x3a, 0x97, 0x09, // 122 --> z
0x03, 0x08, 0x5b, 0x10, // 123 --> {
0x01, 0x7f, // 124 --> |
0x03, 0x41, 0x1b, 0x02, // 125 --> }
0x05, 0x08, 0x02, 0x03, 0x41, 0x00, // 126 --> ~
0x00, // 127 --> 
0x05, 0x81, 0x7f, 0x2a, 0x19, 0x03, // 128 --> <20>
0x00, // 129 --> <20>
0x00, // 130 --> <20>
0x00, // 131 --> <20>
0x03, 0x70, 0x00, 0x1c, // 132 --> <20>
0x05, 0x40, 0x00, 0x10, 0x00, 0x04, // 133 --> <20>
0x05, 0x04, 0xc2, 0x9f, 0x40, 0x00, // 134 --> <20>
0x05, 0x14, 0xca, 0x9f, 0x42, 0x01, // 135 --> <20>
0x05, 0xbe, 0x6a, 0x35, 0x28, 0x02, // 136 --> <20>
0x05, 0xa8, 0x7f, 0x2a, 0x65, 0x00, // 137 --> <20>
0x00, // 138 --> <20>
0x03, 0x10, 0x14, 0x11, // 139 --> <20>
0x00, // 140 --> <20>
0x05, 0x04, 0xc1, 0x47, 0x40, 0x00, // 141 --> <20>
0x05, 0x10, 0x10, 0x1f, 0x04, 0x01, // 142 --> <20>
0x05, 0x08, 0x8e, 0x0a, 0x81, 0x00, // 143 --> <20>
0x05, 0x08, 0x84, 0x8a, 0x83, 0x00, // 144 --> <20>
0x00, // 145 --> <20>
0x00, // 146 --> <20>
0x00, // 147 --> <20>
0x03, 0x07, 0xc0, 0x01, // 148 --> <20>
0x03, 0x14, 0x04, 0x05, // 149 --> <20>
0x03, 0x08, 0x04, 0x02, // 150 --> <20>
0x05, 0x08, 0x04, 0x02, 0x81, 0x00, // 151 --> <20>
0x00, // 152 -->
0x00, // 153 --> <20>
0x00, // 154 --> <20>
0x03, 0x22, 0x0a, 0x02, // 155 --> <20>
0x00, // 156 --> <20>
0x05, 0x78, 0x30, 0x14, 0x49, 0x00, // 157 --> <20>
0x05, 0x04, 0x24, 0x14, 0x8c, 0x07, // 158 --> <20>
0x05, 0x90, 0x44, 0x61, 0xf0, 0x00, // 159 --> <20>
0x05, 0x8f, 0x41, 0x21, 0x01, 0x01, // 160 --> <20>
0x00, // 161 --> <20>
0x00, // 162 --> <20>
0x00, // 163 --> <20>
0x05, 0x5d, 0x91, 0x48, 0xd4, 0x05, // 164 --> <20>
0x00, // 165 --> <20>
0x01, 0x77, // 166 --> <20>
0x00, // 167 --> <20>
0x05, 0xfe, 0xa5, 0x72, 0x29, 0x04, // 168 --> <20>
0x05, 0xbe, 0xf1, 0x7a, 0xed, 0x03, // 169 --> <20>
0x05, 0xbe, 0x64, 0x32, 0x29, 0x02, // 170 --> <20>
0x05, 0x08, 0x8a, 0x8a, 0x22, 0x02, // 171 --> <20>
0x05, 0x08, 0x04, 0x02, 0x81, 0x03, // 172 --> <20>
0x00, // 173 --> <20>
0x05, 0x9e, 0x50, 0x6d, 0xe5, 0x01, // 174 --> <20>
0x05, 0x80, 0x00, 0x3f, 0x00, 0x00, // 175 --> <20>
0x05, 0x83, 0x1d, 0x91, 0x88, 0x02, // 176 --> <20>
0x03, 0x24, 0x17, 0x09, // 177 --> <20>
0x00, // 178 --> <20>
0x00, // 179 --> <20>
0x00, // 180 --> <20>
0x05, 0x7c, 0x08, 0x08, 0xc4, 0x03, // 181 --> <20>
0x05, 0x86, 0x7f, 0xe0, 0x1f, 0x00, // 182 --> <20>
0x03, 0x1c, 0x0e, 0x07, // 183 --> <20>
0x04, 0x39, 0x6a, 0x15, 0x03, // 184 --> <20>
0x04, 0x7c, 0x0c, 0x8c, 0x0f, // 185 --> <20>
0x04, 0x38, 0x2a, 0x95, 0x08, // 186 --> <20>
0x05, 0x22, 0x8a, 0x8a, 0x82, 0x00, // 187 --> <20>
0x05, 0xc1, 0x60, 0x37, 0x18, 0x04, // 188 --> <20>
0x05, 0xc1, 0x6e, 0xb0, 0x1b, 0x04, // 189 --> <20>
0x05, 0xdd, 0x60, 0x37, 0xd8, 0x05, // 190 --> <20>
0x05, 0x00, 0x02, 0x9c, 0x00, 0x00, // 191 --> <20>
0x05, 0xfe, 0x48, 0x24, 0xe2, 0x07, // 192 --> <20>
0x05, 0xff, 0x64, 0x32, 0x39, 0x03, // 193 --> <20>
0x05, 0xff, 0x64, 0x32, 0x69, 0x03, // 194 --> <20>
0x05, 0xff, 0x40, 0x20, 0x30, 0x00, // 195 --> <20>
0x05, 0x60, 0x5f, 0xe8, 0x07, 0x06, // 196 --> <20>
0x05, 0xff, 0x64, 0x32, 0x19, 0x04, // 197 --> <20>
0x05, 0x77, 0xc4, 0x1f, 0x71, 0x07, // 198 --> <20>
0x05, 0xc1, 0x64, 0x32, 0x69, 0x03, // 199 --> <20>
0x05, 0x7f, 0x08, 0x82, 0xf0, 0x07, // 200 --> <20>
0x05, 0xfe, 0x90, 0x24, 0xe1, 0x07, // 201 --> <20>
0x05, 0x7f, 0x04, 0x45, 0x14, 0x04, // 202 --> <20>
0x05, 0x40, 0x5f, 0x20, 0xf0, 0x07, // 203 --> <20>
0x05, 0x7f, 0x01, 0x43, 0xf0, 0x07, // 204 --> <20>
0x05, 0x7f, 0x04, 0x02, 0xf1, 0x07, // 205 --> <20>
0x05, 0xbe, 0x60, 0x30, 0xe8, 0x03, // 206 --> <20>
0x05, 0xff, 0x40, 0x20, 0xf0, 0x07, // 207 --> <20>
0x05, 0xff, 0x44, 0x22, 0x61, 0x00, // 208 --> <20>
0x05, 0xbe, 0x60, 0x30, 0x28, 0x02, // 209 --> <20>
0x05, 0x81, 0xc0, 0x3f, 0x10, 0x00, // 210 --> <20>
0x05, 0x27, 0x24, 0x12, 0xf9, 0x03, // 211 --> <20>
0x05, 0x1c, 0xd1, 0x5f, 0xc4, 0x01, // 212 --> <20>
0x05, 0x63, 0x1a, 0x82, 0x32, 0x06, // 213 --> <20>
0x05, 0x3f, 0x10, 0xe8, 0x07, 0x06, // 214 --> <20>
0x05, 0x07, 0x04, 0x02, 0xf1, 0x07, // 215 --> <20>
0x05, 0x7f, 0xe0, 0x1f, 0xf8, 0x07, // 216 --> <20>
0x05, 0x3f, 0xd0, 0x0f, 0xf4, 0x07, // 217 --> <20>
0x05, 0x81, 0x3f, 0x12, 0x09, 0x03, // 218 --> <20>
0x05, 0x7f, 0x24, 0x12, 0xf6, 0x07, // 219 --> <20>
0x05, 0x7f, 0x24, 0x12, 0x09, 0x03, // 220 --> <20>
0x05, 0xa2, 0x60, 0x32, 0xe9, 0x03, // 221 --> <20>
0x05, 0x7f, 0x84, 0x2f, 0xe8, 0x03, // 222 --> <20>
0x05, 0xc6, 0x54, 0x26, 0xf1, 0x07, // 223 --> <20>
0x04, 0x20, 0x2a, 0x15, 0x0f, // 224 --> <20>
0x04, 0xbe, 0x62, 0x11, 0x07, // 225 --> <20>
0x04, 0x7c, 0x2a, 0x16, 0x04, // 226 --> <20>
0x03, 0x7c, 0x02, 0x01, // 227 --> <20>
0x05, 0x60, 0x1c, 0x89, 0x07, 0x06, // 228 --> <20>
0x04, 0x38, 0x2a, 0x15, 0x03, // 229 --> <20>
0x05, 0x6c, 0x08, 0x1f, 0xc2, 0x06, // 230 --> <20>
0x04, 0x44, 0x2a, 0x15, 0x05, // 231 --> <20>
0x04, 0x7c, 0x10, 0x84, 0x0f, // 232 --> <20>
0x04, 0x7c, 0x90, 0xa4, 0x0f, // 233 --> <20>
0x04, 0x7c, 0x08, 0x8a, 0x08, // 234 --> <20>
0x04, 0x40, 0x1c, 0x81, 0x0f, // 235 --> <20>
0x05, 0x7c, 0x04, 0x04, 0xc1, 0x07, // 236 --> <20>
0x04, 0x7c, 0x08, 0x84, 0x0f, // 237 --> <20>
0x04, 0x38, 0x22, 0x11, 0x07, // 238 --> <20>
0x04, 0x7c, 0x02, 0x81, 0x0f, // 239 --> <20>
0x04, 0x7c, 0x0a, 0x05, 0x01, // 240 --> <20>
0x04, 0x38, 0x22, 0x11, 0x04, // 241 --> <20>
0x03, 0x04, 0x3e, 0x01, // 242 --> <20>
0x04, 0x0c, 0x28, 0x94, 0x07, // 243 --> <20>
0x05, 0x10, 0x14, 0x1f, 0x05, 0x01, // 244 --> <20>
0x04, 0x6c, 0x08, 0x84, 0x0d, // 245 --> <20>
0x04, 0x3c, 0x10, 0x0f, 0x0c, // 246 --> <20>
0x04, 0x0c, 0x08, 0x84, 0x0f, // 247 --> <20>
0x05, 0x7c, 0x20, 0x1f, 0xc8, 0x07, // 248 --> <20>
0x05, 0x3c, 0x10, 0x0f, 0xc4, 0x07, // 249 --> <20>
0x04, 0x04, 0x3e, 0x14, 0x04, // 250 --> <20>
0x05, 0x7c, 0x28, 0x14, 0xc4, 0x07, // 251 --> <20>
0x04, 0x7c, 0x28, 0x14, 0x04, // 252 --> <20>
0x04, 0x44, 0x2a, 0x15, 0x07, // 253 --> <20>
0x05, 0x7c, 0x08, 0x8e, 0x88, 0x03, // 254 --> <20>
0x04, 0x48, 0x1a, 0x85, 0x0f // 255 --> <20>
};

27
STM32_HAL_Lib/fonts.h Normal file
View File

@@ -0,0 +1,27 @@
/*
ST7565 LCD Font library
Anton Mukhin, 2023
*/
#ifndef INC_FONTS_H_
#define INC_FONTS_H_
#include <stdint.h>
#define FONT_HEADER 6
/* Font header map:
uint8_t packed; // Is it a packed font?
uint8_t width; // Font width in pixels
uint8_t height; // Font height in pixels
uint8_t space; // Space between characters
uint8_t first; // First character code
uint8_t last; // Last character code
*/
extern const uint8_t font_5x7_vw[];
#endif /* INC_FONTS_H_ */

141
STM32_HAL_Lib/mctext.c Normal file
View File

@@ -0,0 +1,141 @@
/*
* mctext.c
*
* Created on: May 16, 2025
* Author: Anton Mukhin
*/
#include "mctext.h"
#include "ST7565.h"
//=========================== SET A FUNCTION NAME HERE! ===========================//
// A function from display driver to set a pixel (x, y, color)
void (*mct_SetPixel)(uint8_t, uint8_t, uint8_t) = ST7565_SetPixel;
//=================================================================================//
// Draw a single character. Returns width of drawn character
uint8_t mct_CharTS(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font, uint8_t transp, uint8_t scale) {
uint8_t pk = font[0]; // Is it a packed font?
uint8_t w = font[1]; // Font char width
uint8_t h = font[2]; // Font char height
uint8_t fc = font[4]; // First char code in the font
uint8_t lc = font[5]; // Last char code in the font
uint8_t i, j, p, s, b, seg; // i-cur.column, j-cur.row of 8, p-rows of 8, s-height in cur.row of 8, b-cur.bit in cur.row, seg-byte.segment
uint8_t bps; // Bytes per symbol for packed fonts
uint16_t o; // Current offset
uint8_t sx, sy; // To paint scaled pixel
if (c < fc || c > lc) return 0;
if (x > LCDWIDTH) return 0;
if (y + h * scale > LCDHEIGHT) return 0;
// Calc the offset for desired symbol
if (pk) { // The font is packed
if (w) { // The font is monospaced
bps = w*h/8; // Bytes per symbol
if ((w*h)%8 > 0) bps++; // Correction for the last byte
o = FONT_HEADER+(c-fc)*bps; // Offset for desired symbol
} else { // The font is not monospaced
o = FONT_HEADER; // Starting offset
for (i=0; i<c-fc; i++) { // Going through every symbol
bps = font[o]*h/8; // Bytes per current symbol
if ((font[o]*h)%8 > 0) bps++; // Correction for the last byte
o += bps + 1; // Adding symbol's width to the offset (+ width byte)
}
w = font[o]; // Desired symbol's width
o++; // Offset for desired symbol's data
}
// Draw the packed symbol!
bps = w*h/8; // Bytes per current symbol
if ((w*h)%8 > 0) bps++; // Correction for the last byte
b = 0; // bit indexer in "current" byte
for (i=0; i<w*scale; i+=scale) { // Going through columns
if (x+i > LCDWIDTH) return i-1; // Check if we're out of display size
for (j=0; j<h*scale; j+=scale) { // Going through rows in column [i]
if (b == 0) seg = font[o];
if ((seg>>b) & 1) {
for (sx = 0; sx < scale; sx++)
for (sy = 0; sy < scale; sy++)
mct_SetPixel(x+i+sx, y+j+sy, color); // Paint the pixel
} else if (!transp) {
for (sx = 0; sx < scale; sx++)
for (sy = 0; sy < scale; sy++)
mct_SetPixel(x+i+sx, y+j+sy, !color); // Paint the background pixel
}
if (b < 7) b++; else {b = 0; o++;} // Track bits and bytes
}
}
} else { // The font is not packed
p = (h%8 > 0) ? h/8 + 1 : h/8; // Bytes in one column
if (w) { // The font is monospaced
o = FONT_HEADER+(c-fc)*w*p; // Offset for desired symbol
} else { // The font is not monospaced
o = FONT_HEADER; // Starting offset
for (i=0; i<c-fc; i++) { // Going through every symbol
o += font[o]*p + 1; // Adding symbol's width to the offset
}
w = font[o]; // Desired symbol's width
o++; // Offset for desired symbol's data
}
// Draw the symbol
for (i=0; i<w*scale; i+=scale) { // Going through columns
if (x+i > LCDWIDTH) return i-1; // Check if we're out of display size
for (j=0; j<p; j++) { // Going through bytes in single column
s = (h - j*8 >= 8) ? 8 : (h - j*8) % 8; // Clac the amount of pixels in current byte
seg = font[o];
for (b=0; b<s; b++) { // Going through the byte and paint the pixel if the bit is 1
if ((seg>>b) & 1) {
for (sx = 0; sx < scale; sx++)
for (sy = 0; sy < scale; sy++)
mct_SetPixel(x+i+sx, y+j*8*scale+b*scale+sy, color);
} else if (!transp) {
for (sx = 0; sx < scale; sx++)
for (sy = 0; sy < scale; sy++)
mct_SetPixel(x+i+sx, y+j*8*scale+b*scale+sy, !color);
}
}
o++;
}
//mct_SetPixel(x+i, y, color); // For testing purposes
}
}
return w*scale;
}
// Draw a single character. Not scaled
uint8_t mct_CharT(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font, uint8_t transp) {
return mct_CharTS(x, y, c, color, font, transp, 1);
}
// Draw a single character. Transparent background. Returns width of drawn character
uint8_t mct_Char(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font) {
return mct_CharT(x, y, c, color, font, 1);
}
// Draw a string of characters. Transparency, Scale
void mct_StringTS(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font, uint8_t transp, uint8_t scale) {
uint8_t w = font[1]; // Font char width
uint8_t h = font[2]; // Font char height
uint8_t s = font[3]; // Font space between characters
if (y+h*scale > LCDHEIGHT) return;
while (c[0] != 0) {
//if (x+w > LCDWIDTH) return;
w = mct_CharTS(x, y, (unsigned char)*c, color, font, transp, scale);
c++;
x += w + s*scale;
}
}
// Draw a string of characters
void mct_String(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font) {
mct_StringTS(x, y, c, color, font, 1, 1);
}

29
STM32_HAL_Lib/mctext.h Normal file
View File

@@ -0,0 +1,29 @@
/*
* mctext.h
*
* Created on: May 16, 2025
* Author: Anton Mukhin
*/
#ifndef INC_MCTEXT_H_
#define INC_MCTEXT_H_
#include "stm32g0xx_hal.h"
// Draw a single character. Returns width of drawn character
uint8_t mct_CharTS(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font, uint8_t transp, uint8_t scale);
// Draw a single character. Not scaled
uint8_t mct_CharT(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font, uint8_t transp);
// Draw a single character. Transparent background. Returns width of drawn character
uint8_t mct_Char(uint8_t x, uint8_t y, unsigned char c, uint8_t color, const uint8_t *font);
// Draw a string of characters. Transparency, Scale
void mct_StringTS(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font, uint8_t transp, uint8_t scale);
// Draw a string of characters
void mct_String(uint8_t x, uint8_t y, const char *c, uint8_t color, const uint8_t *font);
#endif /* INC_MCTEXT_H_ */

View File

@@ -1,11 +1,11 @@
Application:
- 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:
V Middle mouse - drag the canvas
V Straight line painting (hold Shift / Ctrl)
V A button to Copy from Test font dialog to then paste into another frame
Bugs:
V Nothing selected after removing a symbol. Potential error throw on "Apply"
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

Binary file not shown.

Binary file not shown.

BIN
examples/Cursors.mbfont Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
examples/icons_14x14.mbfont Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 512 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 489 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 B

BIN
icons/famfamfam/fam_mid.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 137 B

BIN
icons/famfamfam/fam_top.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 136 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 357 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 52 KiB

3
temp.txt Normal file
View File

@@ -0,0 +1,3 @@
MainForm.Size: 931; 686
panel1: 472; 31
pnlRightButtons: