From 2a940c8933d2b8285ce919721ec35e4ca71ca8ee Mon Sep 17 00:00:00 2001 From: Anton Mukhin Date: Sun, 18 May 2025 00:50:05 +0300 Subject: [PATCH] TODO feature: Copy-paste to a symbol with different size --- McBitFont/Form1.cs | 26 ++++++++++++++++---------- TODO.txt | 3 ++- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 7155c19..f6e3901 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -221,8 +221,6 @@ namespace McBitFont { w = pixelOffset + dotWidth * (cellSize + gap); h = pixelOffset + dotHeight * (cellSize + gap); cbZoom_SelectedIndexChanged(cbZoom, null); - - fbuffer = false; } private void cbZoom_SelectedIndexChanged(object sender, EventArgs e) { @@ -607,12 +605,7 @@ namespace McBitFont { private void miniList_SelectedIndexChanged(object sender, EventArgs e) { if (miniList.FocusedItem == null) return; - if (modified) { - if (MessageBox.Show("Current symbol is modified.\nDo you want to save the changes?", "Symbol was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) { - saveFrame(); - } - modified = false; - } + checkModifiedFrame(); if (miniList.SelectedItems.Count == 0) { removeSymbolToolStripMenuItem.Enabled = false; copyToolStripMenuItem.Enabled = false; @@ -777,7 +770,19 @@ namespace McBitFont { } private void pasteToolStripMenuItem_Click(object sender, EventArgs e) { - Array.Copy(fbuf.data, f.data, fbuf.data.Length); + 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; + + for (int i = 0; i < wmax; i++) { + for (int j = 0; j < hmax; j++) { + f.data[i,j] = fbuf.data[i,j]; + } + } + } + dotPanel.Refresh(); modified = true; } @@ -794,9 +799,10 @@ namespace McBitFont { // Check modified / Save frame private void checkModifiedFrame() { if (modified) { - if (MessageBox.Show("Current frame is modified.\nDo you want to apply the changes first?", "The frame 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(); } + modified = false; } } diff --git a/TODO.txt b/TODO.txt index bbb0bea..8c64334 100644 --- a/TODO.txt +++ b/TODO.txt @@ -14,11 +14,12 @@ V "Single frame", "only numbers" and "specify range" as radio buttons - Undo/Redo - Image import from a file - Import from a text array -- Copy-paste to a symbol with different size +V Copy-paste to a symbol with different size - Rectangle selection to mass-paint, shift and mirror pixels - Change height of variable width fonts with ability to choose which side to add pixels to V Make it possible to have zero width chars in VarWidth fonts - "Packed" fonts export +- Tooltips on main form Bugs: V Every char changes its width to default on VarWidth font height change!