1 Commits

Author SHA1 Message Date
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
8 changed files with 69 additions and 212 deletions

View File

@@ -74,7 +74,6 @@
copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); copyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); pasteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); selectToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
selectAllToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); fontToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
makeVarWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); makeVarWidthToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); prependSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -104,9 +103,6 @@
chkHexCodes = new System.Windows.Forms.CheckBox(); chkHexCodes = new System.Windows.Forms.CheckBox();
chkRectSelect = new System.Windows.Forms.CheckBox(); chkRectSelect = new System.Windows.Forms.CheckBox();
label3 = new System.Windows.Forms.Label(); 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)nudX).BeginInit();
((System.ComponentModel.ISupportInitialize)nudY).BeginInit(); ((System.ComponentModel.ISupportInitialize)nudY).BeginInit();
panel1.SuspendLayout(); panel1.SuspendLayout();
@@ -617,7 +613,7 @@
// //
// editToolStripMenuItem // editToolStripMenuItem
// //
editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem, selectAllToolStripMenuItem }); editToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { undoToolStripMenuItem, redoToolStripMenuItem, copyToolStripMenuItem, pasteToolStripMenuItem, selectToolStripMenuItem });
editToolStripMenuItem.Name = "editToolStripMenuItem"; editToolStripMenuItem.Name = "editToolStripMenuItem";
editToolStripMenuItem.Size = new System.Drawing.Size(39, 20); editToolStripMenuItem.Size = new System.Drawing.Size(39, 20);
editToolStripMenuItem.Text = "Edit"; editToolStripMenuItem.Text = "Edit";
@@ -628,7 +624,7 @@
undoToolStripMenuItem.Image = Properties.Resources.arrow_undo; undoToolStripMenuItem.Image = Properties.Resources.arrow_undo;
undoToolStripMenuItem.Name = "undoToolStripMenuItem"; undoToolStripMenuItem.Name = "undoToolStripMenuItem";
undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z; undoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Z;
undoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); undoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
undoToolStripMenuItem.Text = "Undo"; undoToolStripMenuItem.Text = "Undo";
undoToolStripMenuItem.ToolTipText = "Undo last canvas change"; undoToolStripMenuItem.ToolTipText = "Undo last canvas change";
undoToolStripMenuItem.Click += undoToolStripMenuItem_Click; undoToolStripMenuItem.Click += undoToolStripMenuItem_Click;
@@ -638,18 +634,19 @@
redoToolStripMenuItem.Image = Properties.Resources.arrow_redo; redoToolStripMenuItem.Image = Properties.Resources.arrow_redo;
redoToolStripMenuItem.Name = "redoToolStripMenuItem"; redoToolStripMenuItem.Name = "redoToolStripMenuItem";
redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y; redoToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.Y;
redoToolStripMenuItem.Size = new System.Drawing.Size(164, 22); redoToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
redoToolStripMenuItem.Text = "Redo"; redoToolStripMenuItem.Text = "Redo";
redoToolStripMenuItem.ToolTipText = "Redo canvas change"; redoToolStripMenuItem.ToolTipText = "Redo canvas change";
redoToolStripMenuItem.Click += redoToolStripMenuItem_Click; redoToolStripMenuItem.Click += redoToolStripMenuItem_Click;
// //
// copyToolStripMenuItem // copyToolStripMenuItem
// //
copyToolStripMenuItem.Enabled = false;
copyToolStripMenuItem.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16; copyToolStripMenuItem.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
copyToolStripMenuItem.Name = "copyToolStripMenuItem"; copyToolStripMenuItem.Name = "copyToolStripMenuItem";
copyToolStripMenuItem.ShortcutKeyDisplayString = ""; copyToolStripMenuItem.ShortcutKeyDisplayString = "";
copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C; copyToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.C;
copyToolStripMenuItem.Size = new System.Drawing.Size(164, 22); copyToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
copyToolStripMenuItem.Text = "Copy"; copyToolStripMenuItem.Text = "Copy";
copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard"; copyToolStripMenuItem.ToolTipText = "Copy current symbol to clipboard";
copyToolStripMenuItem.Click += copyToolStripMenuItem_Click; copyToolStripMenuItem.Click += copyToolStripMenuItem_Click;
@@ -661,7 +658,7 @@
pasteToolStripMenuItem.Name = "pasteToolStripMenuItem"; pasteToolStripMenuItem.Name = "pasteToolStripMenuItem";
pasteToolStripMenuItem.ShortcutKeyDisplayString = ""; pasteToolStripMenuItem.ShortcutKeyDisplayString = "";
pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V; pasteToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.V;
pasteToolStripMenuItem.Size = new System.Drawing.Size(164, 22); pasteToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
pasteToolStripMenuItem.Text = "Paste"; pasteToolStripMenuItem.Text = "Paste";
pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol"; pasteToolStripMenuItem.ToolTipText = "Paste from clipboard to current symbol";
pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click; pasteToolStripMenuItem.Click += pasteToolStripMenuItem_Click;
@@ -670,21 +667,10 @@
// //
selectToolStripMenuItem.Image = Properties.Resources.fam_rectt; selectToolStripMenuItem.Image = Properties.Resources.fam_rectt;
selectToolStripMenuItem.Name = "selectToolStripMenuItem"; selectToolStripMenuItem.Name = "selectToolStripMenuItem";
selectToolStripMenuItem.ShortcutKeys = System.Windows.Forms.Keys.Control | System.Windows.Forms.Keys.R; selectToolStripMenuItem.Size = new System.Drawing.Size(144, 22);
selectToolStripMenuItem.Size = new System.Drawing.Size(164, 22);
selectToolStripMenuItem.Text = "Select"; selectToolStripMenuItem.Text = "Select";
selectToolStripMenuItem.Click += selectToolStripMenuItem_Click; 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
// //
fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem }); fontToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { makeVarWidthToolStripMenuItem, prependSymbolToolStripMenuItem, appendSymbolToolStripMenuItem, removeSymbolToolStripMenuItem, removeBeforeToolStripMenuItem, removeAfterToolStripMenuItem, CodeShiftToolStripMenuItem });
@@ -903,7 +889,7 @@
btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right; btnBaseline.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right;
btnBaseline.Image = Properties.Resources.fam_base; btnBaseline.Image = Properties.Resources.fam_base;
btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; btnBaseline.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
btnBaseline.Location = new System.Drawing.Point(812, 93); btnBaseline.Location = new System.Drawing.Point(718, 92);
btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3); btnBaseline.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnBaseline.Name = "btnBaseline"; btnBaseline.Name = "btnBaseline";
btnBaseline.Size = new System.Drawing.Size(88, 27); btnBaseline.Size = new System.Drawing.Size(88, 27);
@@ -965,9 +951,9 @@
chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button; chkRectSelect.Appearance = System.Windows.Forms.Appearance.Button;
chkRectSelect.Image = Properties.Resources.fam_rectt; chkRectSelect.Image = Properties.Resources.fam_rectt;
chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight; chkRectSelect.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
chkRectSelect.Location = new System.Drawing.Point(718, 93); chkRectSelect.Location = new System.Drawing.Point(620, 92);
chkRectSelect.Name = "chkRectSelect"; chkRectSelect.Name = "chkRectSelect";
chkRectSelect.Size = new System.Drawing.Size(87, 27); chkRectSelect.Size = new System.Drawing.Size(74, 27);
chkRectSelect.TabIndex = 23; chkRectSelect.TabIndex = 23;
chkRectSelect.Text = " Select"; chkRectSelect.Text = " Select";
chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; chkRectSelect.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
@@ -986,51 +972,11 @@
label3.TabIndex = 21; label3.TabIndex = 21;
label3.Text = "Cursor:"; 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 // MainForm
// //
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F); AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
ClientSize = new System.Drawing.Size(915, 647); ClientSize = new System.Drawing.Size(915, 647);
Controls.Add(lblModified);
Controls.Add(lblSelectionLabel);
Controls.Add(lblSelection);
Controls.Add(chkRectSelect); Controls.Add(chkRectSelect);
Controls.Add(chkHexCodes); Controls.Add(chkHexCodes);
Controls.Add(label3); Controls.Add(label3);
@@ -1153,10 +1099,6 @@
private System.Windows.Forms.CheckBox chkRectSelect; private System.Windows.Forms.CheckBox chkRectSelect;
private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem; private System.Windows.Forms.ToolStripMenuItem selectToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem importTextToolStripMenuItem1; 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; public bool monospaced = false;
private bool modified = false; private bool modified = false;
private bool prjModified = false; private bool prjModified = false;
public const string version = "2.2"; public const string version = "2.1";
public string prjName = "Untitled"; public string prjName = "Untitled";
public string prjFileName = ""; public string prjFileName = "";
private int codepage = 1251; private int codepage = 1251;
@@ -79,22 +79,6 @@ namespace McBitFont {
h = pixelOffset + dotHeight * (cellSize + gap); 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) { private void Form1_Load(object sender, EventArgs e) {
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
tsmiMakeVarWidth.Visible = monospaced; tsmiMakeVarWidth.Visible = monospaced;
@@ -104,7 +88,6 @@ namespace McBitFont {
selection1 = new Point(0, 0); selection1 = new Point(0, 0);
selection2 = new Point(dotWidth - 1, dotHeight - 1); selection2 = new Point(dotWidth - 1, dotHeight - 1);
UpdateSelectionLabel(dotWidth, dotHeight);
gap = (cellSize < 5) ? 0 : 1; gap = (cellSize < 5) ? 0 : 1;
SetNewWH(); SetNewWH();
@@ -146,19 +129,9 @@ namespace McBitFont {
return (int)(((ushort)lowPart) | (uint)(highPart << 16)); return (int)(((ushort)lowPart) | (uint)(highPart << 16));
} }
private FrameMiniature CopyFrame(FrameMiniature frame, bool clipboard = false) { private static FrameMiniature CopyFrame(FrameMiniature frame) {
int width = chkRectSelect.Checked ? selection2.X - selection1.X + 1 : frame.width; var ff = new FrameMiniature(frame.code, frame.width, frame.height);
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); Array.Copy(frame.data, ff.data, frame.data.Length);
return ff; return ff;
} }
@@ -205,10 +178,10 @@ namespace McBitFont {
ilMiniatures.Images.Add(s, (Image)bmp); ilMiniatures.Images.Add(s, (Image)bmp);
miniList.Items[s].ImageKey = s; miniList.Items[s].ImageKey = s;
} }
SetModified(true, true); prjModified = true;
} }
if (nudX.Focused) { if (nudX.Focused) {
SetModified(); modified = true;
} }
DotResize((int)nudX.Value, dotHeight); DotResize((int)nudX.Value, dotHeight);
@@ -227,8 +200,8 @@ namespace McBitFont {
miniList.Items[s].ImageKey = s; miniList.Items[s].ImageKey = s;
} }
if (nudY.Focused) { if (nudY.Focused) {
SetModified(); modified = true;
SetModified(true, true); prjModified = true;
} }
DotResize(dotWidth, (int)nudY.Value); DotResize(dotWidth, (int)nudY.Value);
@@ -267,14 +240,8 @@ namespace McBitFont {
f = FrameResize(f, ww, hh); f = FrameResize(f, ww, hh);
dotWidth = ww; dotWidth = ww;
dotHeight = hh; dotHeight = hh;
if (selection2.X > dotWidth - 1) { if (selection2.X > dotWidth - 1) selection2.X = dotWidth - 1;
selection2.X = dotWidth - 1; if (selection2.Y > dotHeight - 1) selection2.Y = dotHeight - 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(); SetNewWH();
cbZoom_SelectedIndexChanged(cbZoom, null); cbZoom_SelectedIndexChanged(cbZoom, null);
@@ -340,7 +307,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -363,7 +330,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -386,7 +353,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -408,7 +375,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -489,9 +456,6 @@ namespace McBitFont {
Point p1 = new(selection1.X, selection1.Y); Point p1 = new(selection1.X, selection1.Y);
Point p2 = new(selection2.X, selection2.Y); Point p2 = new(selection2.X, selection2.Y);
NormPoints(ref p1, ref p2); 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; x = pixelOffset + (p1.X - 1) * (cellSize + gap) - hScroll.Value - 1;
y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1; y = pixelOffset + (p1.Y - 1) * (cellSize + gap) - vScroll.Value - 1;
x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1; x2 = pixelOffset + (p2.X + 2) * (cellSize + gap) - hScroll.Value - 1;
@@ -519,7 +483,7 @@ namespace McBitFont {
fChanged = true; fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value; int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value; int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
SetModified(); modified = true;
rect1 = new Rectangle(x, y, cellSize, cellSize); rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1); dotPanel.Invalidate(rect1);
} }
@@ -528,7 +492,7 @@ namespace McBitFont {
fChanged = true; fChanged = true;
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value; int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value; int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
SetModified(); modified = true;
rect1 = new Rectangle(x, y, cellSize, cellSize); rect1 = new Rectangle(x, y, cellSize, cellSize);
dotPanel.Invalidate(rect1); dotPanel.Invalidate(rect1);
} }
@@ -550,7 +514,7 @@ namespace McBitFont {
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -574,7 +538,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -598,7 +562,7 @@ namespace McBitFont {
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -609,7 +573,7 @@ namespace McBitFont {
} else { } else {
f = CopyFrame(frames.Find(x => x.code == f.code)); f = CopyFrame(frames.Find(x => x.code == f.code));
} }
SetModified(false); ; modified = false;
} }
@@ -630,8 +594,8 @@ namespace McBitFont {
ilMiniatures.Images.RemoveByKey(s); ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)sizedBMP); ilMiniatures.Images.Add(s, (Image)sizedBMP);
sizedBMP.Dispose(); sizedBMP.Dispose();
SetModified(false); modified = false;
SetModified(true, true); prjModified = true;
} }
private static Bitmap GetMiniPictue(FrameMiniature m) { private static Bitmap GetMiniPictue(FrameMiniature m) {
@@ -814,7 +778,7 @@ namespace McBitFont {
prjName = "Untitled"; prjName = "Untitled";
prjFileName = ""; prjFileName = "";
SetWindowCap(); SetWindowCap();
SetModified(false); ; modified = false;
CheckForAdd(); CheckForAdd();
fbuffer = false; fbuffer = false;
miniList.Items[0].Selected = true; miniList.Items[0].Selected = true;
@@ -838,7 +802,7 @@ namespace McBitFont {
tsmiRemoveSymbol.Enabled = false; tsmiRemoveSymbol.Enabled = false;
tsmiRemoveBefore.Enabled = false; tsmiRemoveBefore.Enabled = false;
tsmiRemoveAfter.Enabled = false; tsmiRemoveAfter.Enabled = false;
//copyToolStripMenuItem.Enabled = false; copyToolStripMenuItem.Enabled = false;
pasteToolStripMenuItem.Enabled = false; pasteToolStripMenuItem.Enabled = false;
return; return;
//miniList.Items[0].Selected = true; //miniList.Items[0].Selected = true;
@@ -862,7 +826,7 @@ namespace McBitFont {
removeSymbolToolStripMenuItem.Enabled = false; removeSymbolToolStripMenuItem.Enabled = false;
tsmiRemoveSymbol.Enabled = false; tsmiRemoveSymbol.Enabled = false;
} }
//copyToolStripMenuItem.Enabled = true; copyToolStripMenuItem.Enabled = true;
if (ff.Equals(frames.First())) { if (ff.Equals(frames.First())) {
removeBeforeToolStripMenuItem.Enabled = false; removeBeforeToolStripMenuItem.Enabled = false;
removeAfterToolStripMenuItem.Enabled = true; removeAfterToolStripMenuItem.Enabled = true;
@@ -919,16 +883,14 @@ namespace McBitFont {
nudY.ValueChanged -= nudY_ValueChanged; nudY.ValueChanged -= nudY_ValueChanged;
nudX.Value = frames.First().width; nudX.Value = frames.First().width;
nudY.Value = frames.First().height; 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); DotResize((int)nudX.Value, (int)nudY.Value);
nudX.ValueChanged += nudX_ValueChanged; nudX.ValueChanged += nudX_ValueChanged;
nudY.ValueChanged += nudY_ValueChanged; nudY.ValueChanged += nudY_ValueChanged;
f = CopyFrame(frames.First()); f = CopyFrame(frames.First());
dotPanel.Refresh(); dotPanel.Refresh();
miniList.Refresh(); miniList.Refresh();
SetModified(false); modified = false;
SetModified(false, true); prjModified = false;
prjFileName = filename; prjFileName = filename;
prjName = Path.GetFileNameWithoutExtension(filename); prjName = Path.GetFileNameWithoutExtension(filename);
@@ -938,7 +900,6 @@ namespace McBitFont {
CheckForAdd(); CheckForAdd();
fbuffer = false; fbuffer = false;
//copyToolStripMenuItem.Enabled = true;
// Re-create history object // Re-create history object
history = new CanvasHistory(); history = new CanvasHistory();
@@ -961,14 +922,14 @@ namespace McBitFont {
MessagePackSerializer.Serialize(ms, sav); MessagePackSerializer.Serialize(ms, sav);
ms.Close(); ms.Close();
} }
prjModified = false;
prjName = Path.GetFileNameWithoutExtension(filename); prjName = Path.GetFileNameWithoutExtension(filename);
prjFileName = filename; prjFileName = filename;
SetModified(false, true); SetWindowCap();
} }
private void SetWindowCap(string suffix = "") { private void SetWindowCap() {
this.Text = "McBitFont v" + version + " - " + prjName + suffix; this.Text = "McBitFont v" + version + " - " + prjName;
} }
@@ -1039,40 +1000,26 @@ namespace McBitFont {
private void copyToolStripMenuItem_Click(object sender, EventArgs e) { private void copyToolStripMenuItem_Click(object sender, EventArgs e) {
fbuffer = true; fbuffer = true;
fbuf = CopyFrame(f, true); fbuf = CopyFrame(f);
pasteToolStripMenuItem.Enabled = true; pasteToolStripMenuItem.Enabled = true;
} }
private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { private void pasteToolStripMenuItem_Click(object sender, EventArgs e) {
history.AddPre(f);
if (fbuf.width == f.width && fbuf.height == f.height) { if (fbuf.width == f.width && fbuf.height == f.height) {
Array.Copy(fbuf.data, f.data, fbuf.data.Length); Array.Copy(fbuf.data, f.data, fbuf.data.Length);
} else { } else {
int di, dj, wmax, hmax, selw, selh; var wmax = (fbuf.width > f.width) ? f.width : fbuf.width;
if (chkRectSelect.Checked) { var hmax = (fbuf.height > f.height) ? f.height : fbuf.height;
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 i = 0; i < wmax; i++) {
for (int j = 0; j < hmax; j++) { for (int j = 0; j < hmax; j++) {
f.data[i + di, j + dj] = fbuf.data[i, j]; f.data[i, j] = fbuf.data[i, j];
} }
} }
} }
history.AddPost(f);
CheckHistoryButtons();
dotPanel.Refresh(); dotPanel.Refresh();
SetModified(); modified = true;
} }
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) { private void aboutToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1090,7 +1037,7 @@ namespace McBitFont {
if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) { if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
SaveFrame(); SaveFrame();
} }
SetModified(false); modified = false;
} }
} }
@@ -1130,7 +1077,7 @@ namespace McBitFont {
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons(); CheckHistoryButtons();
SetModified(); modified = true;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -1177,7 +1124,7 @@ namespace McBitFont {
} }
//dotPanel.Refresh(); //dotPanel.Refresh();
miniList.Refresh(); miniList.Refresh();
SetModified(true, true); prjModified = true;
} }
private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) { private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1193,7 +1140,7 @@ namespace McBitFont {
makeVarWidthToolStripMenuItem.Visible = false; makeVarWidthToolStripMenuItem.Visible = false;
tsmiMakeVarWidth.Visible = false; tsmiMakeVarWidth.Visible = false;
lblType.Text = "Variable width / Single"; lblType.Text = "Variable width / Single";
SetModified(true, true); prjModified = true;
} }
public void CheckHistoryButtons() { public void CheckHistoryButtons() {
@@ -1259,7 +1206,7 @@ namespace McBitFont {
history.Clear(); history.Clear();
CheckForAdd(); CheckForAdd();
SetModified(true, true); prjModified = true;
} }
@@ -1273,9 +1220,8 @@ namespace McBitFont {
} }
} }
history.AddPost(f); history.AddPost(f);
CheckHistoryButtons();
dotPanel.Refresh(); dotPanel.Refresh();
SetModified(); modified = true;
} }
iform.Dispose(); iform.Dispose();
} }
@@ -1296,8 +1242,6 @@ namespace McBitFont {
} }
private void chkRectSelect_CheckedChanged(object sender, EventArgs e) { private void chkRectSelect_CheckedChanged(object sender, EventArgs e) {
lblSelection.Visible = lblSelectionLabel.Visible = chkRectSelect.Checked;
selectAllToolStripMenuItem.Enabled = chkRectSelect.Checked;
dotPanel.Refresh(); dotPanel.Refresh();
} }
@@ -1338,7 +1282,7 @@ namespace McBitFont {
w = w.Remove(w.IndexOf("0b"), 2); w = w.Remove(w.IndexOf("0b"), 2);
numBase = 2; numBase = 2;
} }
if (w.Contains("0x")) { // Check if value is written as hexadecimal if (w.Contains("0x") ) { // Check if value is written as hexadecimal
w = w.Remove(w.IndexOf("0x"), 2); w = w.Remove(w.IndexOf("0x"), 2);
numBase = 16; numBase = 16;
} }
@@ -1357,7 +1301,7 @@ namespace McBitFont {
if (MessageBox.Show(bits + "-bit font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5) + "\nDo you want to load it?", "Import from text file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { if (MessageBox.Show(bits + "-bit font found. " + data.Count + " numbers (" + data.Count * bits / 8 + " bytes) total\n" + "Start code: " + data.ElementAt(4) + " End code: " + data.ElementAt(5) + "\nDo you want to load it?", "Import from text file", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
// Font header // Font header
bool packed = data.ElementAt(0) == 1; bool packed = data.ElementAt(0) == 1;
int width = (int)data.ElementAt(1); int width= (int)data.ElementAt(1);
int height = (int)data.ElementAt(2); int height = (int)data.ElementAt(2);
int first = (int)data.ElementAt(4); int first = (int)data.ElementAt(4);
int last = (int)data.ElementAt(5); int last = (int)data.ElementAt(5);
@@ -1403,7 +1347,7 @@ namespace McBitFont {
miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s); miniList.Items.Add(s, (chkHexCodes.Checked ? sHex : s) + ' ' + sss, s);
} }
} }
SetModified(true, true); prjModified = true;
if (miniList.Items.Count > 0) miniList.Items[0].Selected = true; if (miniList.Items.Count > 0) miniList.Items[0].Selected = true;
f = frames[0]; f = frames[0];
dotWidth = f.width; dotWidth = f.width;
@@ -1416,13 +1360,5 @@ 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)); //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,9 +20,9 @@
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets> <ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>icon_64.ico</ApplicationIcon> <ApplicationIcon>icon_64.ico</ApplicationIcon>
<AssemblyVersion>2.2.0.0</AssemblyVersion> <AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.2.0.0</FileVersion> <FileVersion>2.1.0.0</FileVersion>
<Version>$(VersionPrefix)2.2.0</Version> <Version>$(VersionPrefix)2.1.0</Version>
<Copyright>Anton Mukhin</Copyright> <Copyright>Anton Mukhin</Copyright>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'"> <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">

View File

@@ -80,16 +80,6 @@ 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> /// <summary>
/// Looks up a localized resource of type System.Drawing.Bitmap. /// Looks up a localized resource of type System.Drawing.Bitmap.
/// </summary> /// </summary>

View File

@@ -142,9 +142,6 @@
<data name="arrow_redo" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\redo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </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"> <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> <value>..\Resources\icon.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
@@ -205,8 +202,8 @@
<data name="Famfamfam-Silk-Page-white.16" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <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>
<data name="folder_table" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="Famfamfam-Silk-Disk.16" 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> <value>..\Resources\Famfamfam-Silk-Disk.16.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="Canvas_Fill" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\Canvas_Fill.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
@@ -226,7 +223,7 @@
<data name="icon_64" type="System.Resources.ResXFileRef, System.Windows.Forms"> <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> <value>..\Resources\icon_64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
<data name="arrow_out" type="System.Resources.ResXFileRef, System.Windows.Forms"> <data name="folder_table" 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> <value>..\Resources\folder_table.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data> </data>
</root> </root>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 594 B

View File

@@ -1,15 +1,7 @@
Application: Application:
V Move Select and Baseline buttons right
V Display RectSelection width and width
V Indicate modified project by adding "*" to window caption
Functionality: Functionality:
V Copy/Paste should be aware of rectangle selection
V Select All function
V Select and Select All shortcuts
Bugs: Bugs:
V EncodingProvider hotfix V EncodingProvider hotfix
V Check if frame changed before exit application 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.

Before

Width:  |  Height:  |  Size: 594 B