Bugs fixed and new functionality:

Functionality:
V "Only numbers" range in the New dialog
V "Specify range" in the New dialog
V "Single frame", "only numbers" and "specify range" as radio buttons
Bugs:
V App allows to create fonts with a gap in symbol cequence!
V File -> New does not check for unsaveed changes!
This commit is contained in:
2025-05-17 03:52:29 +03:00
parent 03ef799381
commit d24143d1a6
4 changed files with 95 additions and 74 deletions

View File

@@ -532,6 +532,7 @@ namespace McBitFont {
}
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
checkModifiedFrame();
if (prjModified) {
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
saveToolStripMenuItem.PerformClick();
@@ -556,28 +557,27 @@ namespace McBitFont {
append = "Single";
monospaced = false;
} else {
int i;
if (form.cbNotPrintable.Checked) {
for (i = 0; i < 32; i++) {
newf = new FrameMiniature(i, neww, newh);
if (form.cbFontBased.Checked) newf = fillFrame(newf, form.dlgFont.Font, (int)form.nudShiftX.Value, (int)form.nudShiftY.Value);
frames.Add(newf);
}
int i, imin, imax;
if (form.cbDigits.Checked) {
imin = 48;
imax = 57;
} else {
if (form.cbNotPrintable.Checked) imin = 0;
else if (form.cbLatin.Checked) imin = 32;
else imin = 128;
if (form.cbExtended.Checked) imax = 255;
else if (form.cbLatin.Checked) imax = 127;
else imax = 31;
}
if (form.cbLatin.Checked) {
for (i = 32; i < 128; i++) {
newf = new FrameMiniature(i, neww, newh);
if (form.cbFontBased.Checked) newf = fillFrame(newf, form.dlgFont.Font, (int)form.nudShiftX.Value, (int)form.nudShiftY.Value);
frames.Add(newf);
}
}
if (form.cbExtended.Checked) {
for (i = 128; i < 256; i++) {
newf = new FrameMiniature(i, neww, newh);
if (form.cbFontBased.Checked) newf = fillFrame(newf, form.dlgFont.Font, (int)form.nudShiftX.Value, (int)form.nudShiftY.Value);
frames.Add(newf);
}
for (i = imin; i <= imax; i++) {
newf = new FrameMiniature(i, neww, newh);
if (form.cbFontBased.Checked) newf = fillFrame(newf, form.dlgFont.Font, (int)form.nudShiftX.Value, (int)form.nudShiftY.Value);
frames.Add(newf);
}
monospaced = form.rbMono.Checked;
}
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";

View File

@@ -50,10 +50,11 @@
this.lblShiftX = new System.Windows.Forms.Label();
this.lblShiftY = new System.Windows.Forms.Label();
this.pnlFont = new System.Windows.Forms.Panel();
this.label4 = new System.Windows.Forms.Label();
this.label3 = new System.Windows.Forms.Label();
this.nudChar2 = new System.Windows.Forms.NumericUpDown();
this.nudChar1 = new System.Windows.Forms.NumericUpDown();
this.label3 = new System.Windows.Forms.Label();
this.label4 = new System.Windows.Forms.Label();
this.cbDigits = new System.Windows.Forms.CheckBox();
((System.ComponentModel.ISupportInitialize)(this.nudNewX)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.nudNewY)).BeginInit();
this.panel1.SuspendLayout();
@@ -159,35 +160,37 @@
// cbNotPrintable
//
this.cbNotPrintable.AutoSize = true;
this.cbNotPrintable.Location = new System.Drawing.Point(140, 54);
this.cbNotPrintable.Location = new System.Drawing.Point(140, 77);
this.cbNotPrintable.Name = "cbNotPrintable";
this.cbNotPrintable.Size = new System.Drawing.Size(116, 17);
this.cbNotPrintable.TabIndex = 7;
this.cbNotPrintable.Text = "0-31 (Not printable)";
this.cbNotPrintable.UseVisualStyleBackColor = true;
this.cbNotPrintable.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// cbLatin
//
this.cbLatin.AutoSize = true;
this.cbLatin.Checked = true;
this.cbLatin.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbLatin.Location = new System.Drawing.Point(140, 77);
this.cbLatin.Location = new System.Drawing.Point(140, 100);
this.cbLatin.Name = "cbLatin";
this.cbLatin.Size = new System.Drawing.Size(91, 17);
this.cbLatin.TabIndex = 8;
this.cbLatin.Text = "32-127 (Latin)";
this.cbLatin.UseVisualStyleBackColor = true;
this.cbLatin.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// cbExtended
//
this.cbExtended.AutoSize = true;
this.cbExtended.Location = new System.Drawing.Point(140, 100);
this.cbExtended.Location = new System.Drawing.Point(140, 123);
this.cbExtended.Name = "cbExtended";
this.cbExtended.Size = new System.Drawing.Size(119, 17);
this.cbExtended.TabIndex = 9;
this.cbExtended.Text = "128-255 (Extended)";
this.cbExtended.UseVisualStyleBackColor = true;
this.cbExtended.CheckedChanged += new System.EventHandler(this.cbExtended_CheckedChanged);
this.cbExtended.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// btnOK
//
@@ -221,7 +224,7 @@
this.cbSingle.TabIndex = 12;
this.cbSingle.Text = "Single frame";
this.cbSingle.UseVisualStyleBackColor = true;
this.cbSingle.CheckedChanged += new System.EventHandler(this.cbSingle_CheckedChanged);
this.cbSingle.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// toolTip1
//
@@ -235,7 +238,7 @@
this.cbEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbEncoding.Enabled = false;
this.cbEncoding.FormattingEnabled = true;
this.cbEncoding.Location = new System.Drawing.Point(140, 123);
this.cbEncoding.Location = new System.Drawing.Point(140, 146);
this.cbEncoding.Name = "cbEncoding";
this.cbEncoding.Size = new System.Drawing.Size(121, 21);
this.cbEncoding.TabIndex = 13;
@@ -294,7 +297,7 @@
this.cbFontBased.TabIndex = 16;
this.cbFontBased.Text = "Based on a font";
this.cbFontBased.UseVisualStyleBackColor = true;
this.cbFontBased.CheckedChanged += new System.EventHandler(this.cbFontBased_CheckedChanged);
this.cbFontBased.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// lblFont
//
@@ -371,6 +374,26 @@
this.pnlFont.TabIndex = 22;
this.pnlFont.Visible = false;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(112, 152);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(45, 13);
this.label4.TabIndex = 25;
this.label4.Text = "Sample:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label3
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(14, 152);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(45, 13);
this.label3.TabIndex = 24;
this.label3.Text = "Sample:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// nudChar2
//
this.nudChar2.Location = new System.Drawing.Point(161, 149);
@@ -407,25 +430,16 @@
0});
this.nudChar1.ValueChanged += new System.EventHandler(this.nudNewX_ValueChanged);
//
// label3
// cbDigits
//
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(14, 152);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(45, 13);
this.label3.TabIndex = 24;
this.label3.Text = "Sample:";
this.label3.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
//
// label4
//
this.label4.AutoSize = true;
this.label4.Location = new System.Drawing.Point(112, 152);
this.label4.Name = "label4";
this.label4.Size = new System.Drawing.Size(45, 13);
this.label4.TabIndex = 25;
this.label4.Text = "Sample:";
this.label4.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.cbDigits.AutoSize = true;
this.cbDigits.Location = new System.Drawing.Point(140, 54);
this.cbDigits.Name = "cbDigits";
this.cbDigits.Size = new System.Drawing.Size(74, 17);
this.cbDigits.TabIndex = 23;
this.cbDigits.Text = "Digits only";
this.cbDigits.UseVisualStyleBackColor = true;
this.cbDigits.CheckedChanged += new System.EventHandler(this.checkboxChanged);
//
// New
//
@@ -433,6 +447,7 @@
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
this.CancelButton = this.btnCancel;
this.ClientSize = new System.Drawing.Size(484, 211);
this.Controls.Add(this.cbDigits);
this.Controls.Add(this.pnlFont);
this.Controls.Add(this.cbFontBased);
this.Controls.Add(this.cbEncoding);
@@ -506,5 +521,6 @@
private System.Windows.Forms.Label label3;
public System.Windows.Forms.NumericUpDown nudChar2;
public System.Windows.Forms.NumericUpDown nudChar1;
public System.Windows.Forms.CheckBox cbDigits;
}
}

View File

@@ -36,25 +36,13 @@ namespace McBitFont {
this.Width = 300; this.Height = 250;
}
private void cbSingle_CheckedChanged(object sender, EventArgs e) {
bool c = !cbSingle.Checked;
bool f = cbFontBased.Checked;
cbNotPrintable.Enabled = c;
cbLatin.Enabled = c;
cbExtended.Enabled = c;
cbFontBased.Enabled = c;
rbMono.Enabled = c;
rbVar.Enabled = c;
pnlFont.Visible = c && f;
this.Width = c && f ? 500 : 300;
}
private void New_Load(object sender, EventArgs e) {
toolTip1.SetToolTip(nudNewX, "Frame Width;\nCharacter width;\nDefault character width for Variable width fonts");
toolTip1.SetToolTip(nudNewY, "Frame Height;\nCharacter height");
toolTip1.SetToolTip(rbMono, "Monospaced font");
toolTip1.SetToolTip(rbVar, "Variable width font");
toolTip1.SetToolTip(cbSingle, "Create one single frame");
toolTip1.SetToolTip(cbDigits, "Only digits characters with codes 48 - 57");
toolTip1.SetToolTip(cbNotPrintable, "Add not printable characters with codes 0 - 31");
toolTip1.SetToolTip(cbLatin, "Add Latin characters with codes 32 - 127");
toolTip1.SetToolTip(cbExtended, "Add Extended characters with codes 128 - 255");
@@ -157,17 +145,6 @@ namespace McBitFont {
nud.Select(0, nud.Text.Length);
}
private void cbExtended_CheckedChanged(object sender, EventArgs e) {
cbEncoding.Enabled = cbExtended.Checked;
}
private void cbFontBased_CheckedChanged(object sender, EventArgs e) {
bool c = !cbSingle.Checked;
bool f = cbFontBased.Checked;
pnlFont.Visible = c && f;
this.Width = c && f ? 500 : 300;
}
private void btnFont_Click(object sender, EventArgs e) {
if (dlgFont.ShowDialog() == DialogResult.OK) {
lblFont.Text = dlgFont.Font.Name + " " + dlgFont.Font.Size.ToString();
@@ -178,5 +155,28 @@ namespace McBitFont {
private void nudNewX_ValueChanged(object sender, EventArgs e) {
updateChars();
}
private void checkboxChanged(object sender, EventArgs e) {
if (!(sender as CheckBox).Focused) return;
bool c = !cbSingle.Checked;
bool d = !cbDigits.Checked;
bool p = cbNotPrintable.Checked;
bool x = cbExtended.Checked;
bool f = cbFontBased.Checked;
cbDigits.Enabled = c;
cbNotPrintable.Enabled = c && d;
cbLatin.Enabled = c && d;
cbExtended.Enabled = c && d;
cbFontBased.Enabled = c;
cbEncoding.Enabled = c && d && x;
rbMono.Enabled = c;
rbVar.Enabled = c;
pnlFont.Visible = c && f;
if (p && x) cbLatin.Checked = true;
this.Width = c && f ? 500 : 300;
btnOK.Enabled = !c || !d || x || p || cbLatin.Checked;
}
}
}

View File

@@ -1,13 +1,15 @@
Application:
v Implement "Save" menu
Functionality:
- Context menu in symbol navigator
- Delete symbols before/after selected
- Shift all symbols on code line (change symbol codes)
- Specify starting code (extends the shift)
- "Only numbers" range in the New dialog
- "Specify range" in the New dialog
- "Single frame", "only numbers" and "specify range" as radio buttons
V "Only numbers" range in the New dialog
V "Specify range" in the New dialog
V "Single frame", "only numbers" and "specify range" as radio buttons
- Ability to make monospaced font variable width one
- Button to Clear/Fill a block
- Undo/Redo
- Image import from a file
@@ -19,3 +21,6 @@ Functionality:
- "Packed" fonts export
Bugs:
V Every char changes its width to default on VarWidth font height change!
V App allows to create fonts with a gap in symbol cequence!
V File -> New does not check for unsaveed changes!