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
This commit is contained in:
2025-05-27 22:04:12 +03:00
8 changed files with 212 additions and 69 deletions

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.1";
public const string version = "2.2";
public string prjName = "Untitled";
public string prjFileName = "";
private int codepage = 1251;
@@ -79,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;
@@ -88,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();
@@ -119,7 +136,7 @@ namespace McBitFont {
tsmiCodeShift.Visible = frames.Count > 1;
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
}
[DllImport("user32.dll")]
@@ -129,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);
Array.Copy(frame.data, ff.data, frame.data.Length);
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;
}
@@ -178,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);
@@ -200,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);
@@ -240,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);
@@ -307,7 +340,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -330,7 +363,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -353,7 +386,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -375,7 +408,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -456,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;
@@ -483,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);
}
@@ -492,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);
}
@@ -514,7 +550,7 @@ namespace McBitFont {
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -538,7 +574,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -562,7 +598,7 @@ namespace McBitFont {
}
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -573,7 +609,7 @@ namespace McBitFont {
} else {
f = CopyFrame(frames.Find(x => x.code == f.code));
}
modified = false;
SetModified(false); ;
}
@@ -594,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) {
@@ -714,7 +750,7 @@ namespace McBitFont {
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
CheckModifiedFrame();
if (CheckModifiedProject()) return;
New form = new New(this);
if (form.ShowDialog() == DialogResult.OK) {
Cursor.Current = Cursors.WaitCursor;
@@ -778,7 +814,7 @@ namespace McBitFont {
prjName = "Untitled";
prjFileName = "";
SetWindowCap();
modified = false;
SetModified(false); ;
CheckForAdd();
fbuffer = false;
miniList.Items[0].Selected = true;
@@ -802,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;
@@ -826,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;
@@ -883,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);
@@ -900,6 +938,7 @@ namespace McBitFont {
CheckForAdd();
fbuffer = false;
//copyToolStripMenuItem.Enabled = true;
// Re-create history object
history = new CanvasHistory();
@@ -922,18 +961,18 @@ 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;
}
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
CheckModifiedFrame();
if (CheckModifiedProject()) return;
@@ -1000,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) {
@@ -1037,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);
}
}
@@ -1077,7 +1130,7 @@ namespace McBitFont {
history.AddPost(f);
CheckHistoryButtons();
modified = true;
SetModified();
dotPanel.Refresh();
}
@@ -1124,7 +1177,7 @@ namespace McBitFont {
}
//dotPanel.Refresh();
miniList.Refresh();
prjModified = true;
SetModified(true, true);
}
private void removeBeforeToolStripMenuItem_Click(object sender, EventArgs e) {
@@ -1140,7 +1193,7 @@ namespace McBitFont {
makeVarWidthToolStripMenuItem.Visible = false;
tsmiMakeVarWidth.Visible = false;
lblType.Text = "Variable width / Single";
prjModified = true;
SetModified(true, true);
}
public void CheckHistoryButtons() {
@@ -1206,7 +1259,7 @@ namespace McBitFont {
history.Clear();
CheckForAdd();
prjModified = true;
SetModified(true, true);
}
@@ -1220,8 +1273,9 @@ namespace McBitFont {
}
}
history.AddPost(f);
CheckHistoryButtons();
dotPanel.Refresh();
modified = true;
SetModified();
}
iform.Dispose();
}
@@ -1242,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();
}
@@ -1282,11 +1338,11 @@ namespace McBitFont {
w = w.Remove(w.IndexOf("0b"), 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);
numBase = 16;
}
try { // Try to convert a number from text
data.Add(Convert.ToUInt32(w, numBase));
@@ -1294,14 +1350,14 @@ namespace McBitFont {
catch {
continue;
}
//MessageBox.Show(w + ": Length: " + w.Length + " Bits: " + bits + " Converted: " + data.Last() + "\nData length: " + data.Count);
}
}
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
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 first = (int)data.ElementAt(4);
int last = (int)data.ElementAt(5);
@@ -1347,7 +1403,7 @@ namespace McBitFont {
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;
@@ -1360,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,9 +20,9 @@
<UseWindowsForms>true</UseWindowsForms>
<ImportWindowsDesktopTargets>true</ImportWindowsDesktopTargets>
<ApplicationIcon>icon_64.ico</ApplicationIcon>
<AssemblyVersion>2.1.0.0</AssemblyVersion>
<FileVersion>2.1.0.0</FileVersion>
<Version>$(VersionPrefix)2.1.0</Version>
<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'">

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

After

Width:  |  Height:  |  Size: 594 B