7 Commits
v2.0 ... v2.2

Author SHA1 Message Date
0d923ef8ed Merge branch 'dev' - v2.2:
Changes:

Application:
- Move Select and Baseline buttons right
- Display RectSelection width and width
- Indicate modified project by adding "*" to window caption

Functionality:
- Copy/Paste should be aware of rectangle selection
- Select All function
- Select and Select All shortcuts

Bugs:
- Hostory does not record pastes from clipboard
- Undo/Redo menu availability recalculation does not happen sometimes
2025-05-27 22:04:12 +03:00
Anton Mukhin
5e1a2085cf TODO features:
Application:
- Indicate modified project by adding "*" to window caption

Functionality:
- Copy/Paste should be aware of rectangle selection
- Select All function
- Select and Select All shortcuts

Bugs:
- Hostory does not record pastes from clipboard
- Undo/Redo menu availability recalculation does not happen sometimes
2025-05-27 18:08:11 +03:00
Anton Mukhin
ca21c43926 TODO features:
- Move Select and Baseline buttons right
- Display RectSelection width and width
2025-05-27 12:09:55 +03:00
Anton Mukhin
c10a8e49ff Merge branch 'dev' - v2.1
Bugs fixed:
- EncodingProvider hotfix
- Check if frame changed before exit application
2025-05-27 10:43:14 +03:00
Anton Mukhin
5d17ba5538 Bug fixes:
- EncodingProvider hotfix
- Check if frame changed before exit application
2025-05-27 10:41:44 +03:00
4f80a5df1b Check if frame changed before exit application 2025-05-27 04:27:39 +03:00
37f2bb5eac HotFix: Open file from OS 2025-05-27 03:40:34 +03:00
11 changed files with 229 additions and 103 deletions

View File

@@ -233,7 +233,7 @@ 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";
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code) + "\n";
}
if (lines == 1) {
// "1 symbol per line" - new line offset
@@ -369,7 +369,7 @@ 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);
output += " // " + f.code.ToString() + " --> " + mainForm.DecodeSymbol(f.code);
}
output += "\n";
}

View File

@@ -74,6 +74,7 @@
copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
makeVarWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -103,6 +104,9 @@
chkHexCodes = new System.Windows.Forms.CheckBox();
chkRectSelect = new System.Windows.Forms.CheckBox();
label3 = new System.Windows.Forms.Label();
lblSelectionLabel = new System.Windows.Forms.Label();
lblSelection = new System.Windows.Forms.Label();
lblModified = new System.Windows.Forms.Label();
((System.ComponentModel.ISupportInitialize)nudX).BeginInit();
((System.ComponentModel.ISupportInitialize)nudY).BeginInit();
panel1.SuspendLayout();
@@ -613,7 +617,7 @@
//
// editToolStripMenuItem
//
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem });
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem, selectAllToolStripMenuItem });
editToolStripMenuItem.Name = "editToolStripMenuItem";
editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
editToolStripMenuItem.Text = "Edit";
@@ -624,7 +628,7 @@
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
undoToolStripMenuItem.Name = "undoToolStripMenuItem";
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
undoToolStripMenuItem.Text = "Undo";
undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
@@ -634,19 +638,18 @@
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
redoToolStripMenuItem.Name = "redoToolStripMenuItem";
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
redoToolStripMenuItem.Text = "Redo";
redoToolStripMenuItem.ToolTipText = "Redo canvas change";
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
//
// copyToolStripMenuItem
//
copyToolStripMenuItem.Enabled = false;
copyToolStripMenuItem.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
copyToolStripMenuItem.Name = "copyToolStripMenuItem";
copyToolStripMenuItem.ShortcutKeyDisplayString = "";
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
copyToolStripMenuItem.Text = "Copy";
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
@@ -658,7 +661,7 @@
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
pasteToolStripMenuItem.Text = "Paste";
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
@@ -667,10 +670,21 @@
//
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
selectToolStripMenuItem.Name = "selectToolStripMenuItem";
selectToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
selectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R;
selectToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
selectToolStripMenuItem.Text = "Select";
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click;
//
// selectAllToolStripMenuItem
//
selectAllToolStripMenuItem.Enabled = false;
selectAllToolStripMenuItem.Image = Properties.Resources.arrow_out;
selectAllToolStripMenuItem.Name = "selectAllToolStripMenuItem";
selectAllToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.A;
selectAllToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
selectAllToolStripMenuItem.Text = "Select All";
selectAllToolStripMenuItem.Click += selectAllToolStripMenuItem_Click;
//
// fontToolStripMenuItem
//
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem });
@@ -889,7 +903,7 @@
btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnBaseline.Image = Properties.Resources.fam_base;
btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnBaseline.Location = new System.Drawing.Point(718, 92);
btnBaseline.Location = new System.Drawing.Point(812, 93);
btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnBaseline.Name = "btnBaseline";
btnBaseline.Size = new System.Drawing.Size(88, 27);
@@ -951,9 +965,9 @@
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(620, 92);
chkRectSelect.Location = new System.Drawing.Point(718, 93);
chkRectSelect.Name = "chkRectSelect";
chkRectSelect.Size = new System.Drawing.Size(74, 27);
chkRectSelect.Size = new System.Drawing.Size(87, 27);
chkRectSelect.TabIndex = 23;
chkRectSelect.Text = " Select";
chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -972,11 +986,51 @@
label3.TabIndex = 21;
label3.Text = "Cursor:";
//
// lblSelectionLabel
//
lblSelectionLabel.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblSelectionLabel.AutoSize = true;
lblSelectionLabel.Location = new System.Drawing.Point(616, 93);
lblSelectionLabel.Name = "lblSelectionLabel";
lblSelectionLabel.Size = new System.Drawing.Size(58, 15);
lblSelectionLabel.TabIndex = 25;
lblSelectionLabel.Text = "Selection:";
lblSelectionLabel.Visible = false;
//
// lblSelection
//
lblSelection.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblSelection.AutoSize = true;
lblSelection.Location = new System.Drawing.Point(617, 108);
lblSelection.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblSelection.Name = "lblSelection";
lblSelection.Size = new System.Drawing.Size(30, 15);
lblSelection.TabIndex = 24;
lblSelection.Text = "W,H";
lblSelection.TextAlign = System.Drawing.ContentAlignment.TopRight;
lblSelection.Visible = false;
//
// lblModified
//
lblModified.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
lblModified.AutoSize = true;
lblModified.Font = new System.Drawing.Font("Segoe UI Semibold", 9F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, 204);
lblModified.ForeColor = System.Drawing.SystemColors.Highlight;
lblModified.Location = new System.Drawing.Point(616, 78);
lblModified.Name = "lblModified";
lblModified.Size = new System.Drawing.Size(91, 15);
lblModified.TabIndex = 26;
lblModified.Text = "Frame modified";
lblModified.Visible = false;
//
// MainForm
//
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);
@@ -1099,6 +1153,10 @@
private System.Windows.Forms.CheckBox chkRectSelect;
private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem importTextToolStripMenuItem1;
private System.Windows.Forms.Label lblSelectionLabel;
private System.Windows.Forms.Label lblSelection;
private System.Windows.Forms.ToolStripMenuItem selectAllToolStripMenuItem;
private System.Windows.Forms.Label lblModified;
}
}

View File

@@ -57,7 +57,7 @@ namespace McBitFont {
public bool monospaced = false;
private bool modified = false;
private bool prjModified = false;
public const string version = "2.0";
public const string version = "2.2";
public string prjName = "Untitled";
public string prjFileName = "";
private int codepage = 1251;
@@ -70,6 +70,7 @@ namespace McBitFont {
public MainForm() {
InitializeComponent();
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
this.dotPanel.MouseWheel += new MouseEventHandler(this.DotPanel_MouseWheel);
}
@@ -78,6 +79,22 @@ namespace McBitFont {
h = pixelOffset + dotHeight * (cellSize + gap);
}
private void UpdateSelectionLabel(int width, int height) {
lblSelection.Text = width.ToString() + ',' + height.ToString();
}
private void SetModified(bool modif = true, bool prj = false) {
string suffix = "";
if (prj) {
prjModified = modif;
if (modif) suffix = " *";
SetWindowCap(suffix);
} else {
modified = modif;
lblModified.Visible = modif;
}
}
private void Form1_Load(object sender, EventArgs e) {
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
tsmiMakeVarWidth.Visible = monospaced;
@@ -87,6 +104,7 @@ namespace McBitFont {
selection1 = new Point(0, 0);
selection2 = new Point(dotWidth - 1, dotHeight - 1);
UpdateSelectionLabel(dotWidth, dotHeight);
gap = (cellSize < 5) ? 0 : 1;
SetNewWH();
@@ -118,7 +136,7 @@ namespace McBitFont {
tsmiCodeShift.Visible = frames.Count > 1;
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
}
[DllImport("user32.dll")]
@@ -128,9 +146,19 @@ namespace McBitFont {
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
}
private static FrameMiniature CopyFrame(FrameMiniature frame) {
var ff = new FrameMiniature(frame.code, frame.width, frame.height);
private FrameMiniature CopyFrame(FrameMiniature frame, bool clipboard = false) {
int width = chkRectSelect.Checked ? selection2.X - selection1.X + 1 : frame.width;
int height = chkRectSelect.Checked ? selection2.Y - selection1.Y + 1 : frame.height;
var ff = new FrameMiniature(frame.code, width, height);
if (chkRectSelect.Checked && clipboard) {
for (int i = 0; i <= selection2.X - selection1.X; i++)
for (int j = 0; j <= selection2.Y - selection1.Y; j++) {
ff.data[i, j] = frame.data[i + selection1.X, j + selection1.Y];
}
} else
Array.Copy(frame.data, ff.data, frame.data.Length);
return ff;
}
@@ -177,10 +205,10 @@ namespace McBitFont {
ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s;
}
prjModified = true;
SetModified(true, true);
}
if (nudX.Focused) {
modified = true;
SetModified();
}
DotResize((int)nudX.Value, dotHeight);
@@ -199,8 +227,8 @@ namespace McBitFont {
miniList.Items[s].ImageKey = s;
}
if (nudY.Focused) {
modified = true;
prjModified = true;
SetModified();
SetModified(true, true);
}
DotResize(dotWidth, (int)nudY.Value);
@@ -239,8 +267,14 @@ namespace McBitFont {
f = FrameResize(f, ww, hh);
dotWidth = ww;
dotHeight = hh;
if (selection2.X > dotWidth - 1) selection2.X = dotWidth - 1;
if (selection2.Y > dotHeight - 1) selection2.Y = dotHeight - 1;
if (selection2.X > dotWidth - 1) {
selection2.X = dotWidth - 1;
UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1);
}
if (selection2.Y > dotHeight - 1) {
selection2.Y = dotHeight - 1;
UpdateSelectionLabel(selection2.X - selection1.X + 1, selection2.Y - selection1.Y + 1);
}
SetNewWH();
cbZoom_SelectedIndexChanged(cbZoom, null);
@@ -306,7 +340,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -329,7 +363,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -352,7 +386,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -374,7 +408,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -455,6 +489,9 @@ namespace McBitFont {
Point p1 = new(selection1.X, selection1.Y);
Point p2 = new(selection2.X, selection2.Y);
NormPoints(ref p1, ref p2);
UpdateSelectionLabel(p2.X - p1.X + 1, p2.Y - p1.Y + 1);
x = pixelOffset + (p1.X - 1) * (cellSize + gap) - hScroll.Value - 1;
y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1;
x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1;
@@ -482,7 +519,7 @@ namespace McBitFont {
fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
modified = true;
SetModified();
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
}
@@ -491,7 +528,7 @@ namespace McBitFont {
fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
modified = true;
SetModified();
rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1);
}
@@ -513,7 +550,7 @@ namespace McBitFont {
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -537,7 +574,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -561,7 +598,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -572,7 +609,7 @@ namespace McBitFont {
} else {
f = CopyFrame(frames.Find(x => x.code == f.code));
}
modified = false;
SetModified(false); ;
}
@@ -593,8 +630,8 @@ namespace McBitFont {
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)sizedBMP);
sizedBMP.Dispose();
modified = false;
prjModified = true;
SetModified(false);
SetModified(true, true);
}
private static Bitmap GetMiniPictue(FrameMiniature m) {
@@ -681,14 +718,14 @@ namespace McBitFont {
Application.Exit();
}
public string decodeSymbol(int code) {
public string DecodeSymbol(int code) {
var enc = Encoding.GetEncoding(codepage);
if (code < 32) return "";
return enc.GetString(new byte[] { (byte)code });
}
private FrameMiniature DrawFrameChar(FrameMiniature ff, Font font, int sx, int sy) {
string s = decodeSymbol(ff.code);
string s = DecodeSymbol(ff.code);
Bitmap bmp = new Bitmap(ff.width, ff.height);
Graphics g = Graphics.FromImage(bmp);
g.Clear(Color.White);
@@ -766,7 +803,7 @@ namespace McBitFont {
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
miniList.Items.Add(s, s + ' ' + append + sss, s);
}
f = CopyFrame(frames.First());
@@ -777,7 +814,7 @@ namespace McBitFont {
prjName = "Untitled";
prjFileName = "";
SetWindowCap();
modified = false;
SetModified(false); ;
CheckForAdd();
fbuffer = false;
miniList.Items[0].Selected = true;
@@ -801,7 +838,7 @@ namespace McBitFont {
tsmiRemoveSymbol.Enabled = false;
tsmiRemoveBefore.Enabled = false;
tsmiRemoveAfter.Enabled = false;
copyToolStripMenuItem.Enabled = false;
//copyToolStripMenuItem.Enabled = false;
pasteToolStripMenuItem.Enabled = false;
return;
//miniList.Items[0].Selected = true;
@@ -825,7 +862,7 @@ namespace McBitFont {
removeSymbolToolStripMenuItem.Enabled = false;
tsmiRemoveSymbol.Enabled = false;
}
copyToolStripMenuItem.Enabled = true;
//copyToolStripMenuItem.Enabled = true;
if (ff.Equals(frames.First())) {
removeBeforeToolStripMenuItem.Enabled = false;
removeAfterToolStripMenuItem.Enabled = true;
@@ -874,7 +911,7 @@ namespace McBitFont {
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString().PadLeft(3, '0');
var sHex = 'x' + Convert.ToString(ff.code, 16).PadLeft(2, '0').ToUpper();
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
}
@@ -882,14 +919,16 @@ namespace McBitFont {
nudY.ValueChanged -= nudY_ValueChanged;
nudX.Value = frames.First().width;
nudY.Value = frames.First().height;
selection1.X = 0; selection1.Y = 0;
selection2.X = (int)nudX.Value - 1; selection2.Y = (int)nudY.Value - 1;
DotResize((int)nudX.Value, (int)nudY.Value);
nudX.ValueChanged += nudX_ValueChanged;
nudY.ValueChanged += nudY_ValueChanged;
f = CopyFrame(frames.First());
dotPanel.Refresh();
miniList.Refresh();
modified = false;
prjModified = false;
SetModified(false);
SetModified(false, true);
prjFileName = filename;
prjName = Path.GetFileNameWithoutExtension(filename);
@@ -899,6 +938,7 @@ namespace McBitFont {
CheckForAdd();
fbuffer = false;
//copyToolStripMenuItem.Enabled = true;
// Re-create history object
history = new CanvasHistory();
@@ -921,14 +961,14 @@ namespace McBitFont {
MessagePackSerializer.Serialize(ms, sav);
ms.Close();
}
prjModified = false;
prjName = Path.GetFileNameWithoutExtension(filename);
prjFileName = filename;
SetWindowCap();
SetModified(false, true);
}
private void SetWindowCap() {
this.Text = "McBitFont v" + version + " - " + prjName;
private void SetWindowCap(string suffix = "") {
this.Text = "McBitFont v" + version + " - " + prjName + suffix;
}
@@ -968,7 +1008,7 @@ namespace McBitFont {
var s = ff.code.ToString().PadLeft(3, '0');
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(ff));
var sss = decodeSymbol(ff.code);
var sss = DecodeSymbol(ff.code);
miniList.Items.Add(s, s + ' ' + sss, s);
CheckForAdd();
}
@@ -999,26 +1039,40 @@ namespace McBitFont {
private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
fbuffer = true;
fbuf = CopyFrame(f);
fbuf = CopyFrame(f, true);
pasteToolStripMenuItem.Enabled = true;
}
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) {
history.AddPre(f);
if (fbuf.width == f.width && fbuf.height == f.height) {
Array.Copy(fbuf.data, f.data, fbuf.data.Length);
} else {
var wmax = (fbuf.width > f.width) ? f.width : fbuf.width;
var hmax = (fbuf.height > f.height) ? f.height : fbuf.height;
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, j] = fbuf.data[i, j];
f.data[i + di, j + dj] = fbuf.data[i, j];
}
}
}
history.AddPost(f);
CheckHistoryButtons();
dotPanel.Refresh();
modified = true;
SetModified();
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1036,7 +1090,7 @@ namespace McBitFont {
if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
SaveFrame();
}
modified = false;
SetModified(false);
}
}
@@ -1076,7 +1130,7 @@ namespace McBitFont {
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -1089,6 +1143,7 @@ namespace McBitFont {
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
CheckModifiedFrame();
if (prjModified) {
if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) {
e.Cancel = true;
@@ -1122,7 +1177,7 @@ namespace McBitFont {
}
//dotPanel.Refresh();
miniList.Refresh();
prjModified = true;
SetModified(true, true);
}
private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1138,7 +1193,7 @@ namespace McBitFont {
makeVarWidthToolStripMenuItem.Visible = false;
tsmiMakeVarWidth.Visible = false;
lblType.Text = "Variable width / Single";
prjModified = true;
SetModified(true, true);
}
public void CheckHistoryButtons() {
@@ -1189,7 +1244,7 @@ namespace McBitFont {
frames[i] = ff;
var key = ff.code.ToString().PadLeft(3, '0');
var text = decodeSymbol(ff.code);
var text = DecodeSymbol(ff.code);
ilMiniatures.Images.Add(key, (Image)GetMiniPictue(ff));
miniList.Items.Add(key, key + ' ' + text, key);
}
@@ -1204,7 +1259,7 @@ namespace McBitFont {
history.Clear();
CheckForAdd();
prjModified = true;
SetModified(true, true);
}
@@ -1218,8 +1273,9 @@ namespace McBitFont {
}
}
history.AddPost(f);
CheckHistoryButtons();
dotPanel.Refresh();
modified = true;
SetModified();
}
iform.Dispose();
}
@@ -1228,7 +1284,7 @@ namespace McBitFont {
if (frames.Count == 1) return;
foreach (ListViewItem item in miniList.Items) {
var code = Convert.ToInt32(item.ImageKey);
var symbol = decodeSymbol(code);
var symbol = DecodeSymbol(code);
if (chkHexCodes.Checked) {
var sHex = 'x' + Convert.ToString(code, 16).PadLeft(2, '0').ToUpper();
item.Text = sHex + ' ' + symbol;
@@ -1240,6 +1296,8 @@ namespace McBitFont {
}
private void chkRectSelect_CheckedChanged(object sender, EventArgs e) {
lblSelection.Visible = lblSelectionLabel.Visible = chkRectSelect.Checked;
selectAllToolStripMenuItem.Enabled = chkRectSelect.Checked;
dotPanel.Refresh();
}
@@ -1340,12 +1398,12 @@ namespace McBitFont {
var s = (last - first > 0) ? newf.code.ToString().PadLeft(3, '0') : "000";
var sHex = (last - first > 0) ? 'x' + Convert.ToString(newf.code, 16).PadLeft(2, '0').ToUpper() : "0x0";
var sss = (last - first > 0) ? decodeSymbol(newf.code) : "Single";
var sss = (last - first > 0) ? DecodeSymbol(newf.code) : "Single";
ilMiniatures.Images.Add(s, (Image)GetMiniPictue(newf));
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
}
}
prjModified = true;
SetModified(true, true);
if (miniList.Items.Count > 0) miniList.Items[0].Selected = true;
f = frames[0];
dotWidth = f.width;
@@ -1358,5 +1416,13 @@ namespace McBitFont {
//MessageBox.Show(bits + "-font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5));
}
}
private void selectAllToolStripMenuItem_Click(object sender, EventArgs e) {
selection1.X = 0;
selection1.Y = 0;
selection2.X = dotWidth - 1;
selection2.Y = dotHeight - 1;
dotPanel.Refresh();
}
}
}

View File

@@ -20,8 +20,10 @@
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>icon_64.ico</ApplicationIcon>
<AssemblyVersion>2.0.0.0</AssemblyVersion>
<FileVersion>2.0.0.0</FileVersion>
<AssemblyVersion>2.2.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion>
<Version>$(VersionPrefix)2.2.0</Version>
<Copyright>Anton Mukhin</Copyright>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DebugType>portable</DebugType>

View File

@@ -108,8 +108,8 @@ namespace McBitFont {
Bitmap bmp, result;
Graphics g;
chars[0] = mainForm.decodeSymbol((int)nudChar1.Value);
chars[1] = mainForm.decodeSymbol((int)nudChar2.Value);
chars[0] = mainForm.DecodeSymbol((int)nudChar1.Value);
chars[1] = mainForm.DecodeSymbol((int)nudChar2.Value);
for (int i = 0; i < 2; i++) {
bmp = new Bitmap((int)nudNewX.Value, (int)nudNewY.Value);
g = Graphics.FromImage(bmp);

View File

@@ -80,6 +80,16 @@ namespace McBitFont.Properties {
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>
internal static System.Drawing.Bitmap arrow_out {
get {
object obj = ResourceManager.GetObject("arrow_out", resourceCulture);
return ((System.Drawing.Bitmap)(obj));
}
}
/// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary>

View File

@@ -142,6 +142,9 @@
<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>
@@ -202,8 +205,8 @@
<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="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 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="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>
@@ -223,7 +226,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="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="arrow_out" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Resources\arrow_out.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: 594 B

View File

@@ -1,28 +1,15 @@
Application:
V Migrate from .Net Framework 4.7 to .NET 9
V New Save file format! Use McBitFont v1.7 to convert old save files to the new format.
V Better quality pictures in symbol list
V Spinning cursor when application is busy
V Change Menu icons
V Re-arranged menu items
V Option to display codes in Hex numbers
V Make symbol list wider to display 8 characters instead of 7
V Move Select and Baseline buttons right
V Display RectSelection width and width
V Indicate modified project by adding "*" to window caption
Functionality:
V Fill canvas button
V Context menu in symbol navigator
V Delete symbols before/after selected
V Shift all symbols on code line (change symbol codes)
V Specify starting code (extends the shift)
V Ability to make monospaced font a variable width one
V Undo/Redo for canvas changes
V Image import from a file
V Import from a text array
V Rectangle selection to mass-paint, shift and mirror pixels etc...
V "Packed" fonts export
V "Bytes total comment in export
V Copy/Paste should be aware of rectangle selection
V Select All function
V Select and Select All shortcuts
Bugs:
V Improper bytes count for 16 or 32 bit numbers export
V Exception on Code Shift when nothing is selected in Symbols List
V Wrongly mark Project as modified on symbol selection
V EncodingProvider hotfix
V Check if frame changed before exit application
V Hostory does not record pastes from clipboard
V Undo/Redo menu availability recalculation does not happen sometimes

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 594 B