Frame list management fixed
This commit is contained in:
@@ -13,6 +13,7 @@ using System.Runtime.InteropServices;
|
||||
using System.IO;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Runtime.InteropServices.ComTypes;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace McBitFont {
|
||||
public partial class MainForm : Form {
|
||||
@@ -69,7 +70,7 @@ namespace McBitFont {
|
||||
frames.Add(new FrameMiniature(0, dotWidth, dotHeight));
|
||||
miniList.Items.Add("0", "0 Single", "0");
|
||||
miniList.Refresh();
|
||||
f = frames.Find(x => x.code == 0);
|
||||
f = copyFrame(frames.Find(x => x.code == 0));
|
||||
|
||||
ListViewItem_SetSpacing(miniList, 50 + 2, 50 + 22);
|
||||
}
|
||||
@@ -81,6 +82,12 @@ namespace McBitFont {
|
||||
return (int)(((ushort)lowPart) | (uint)(highPart << 16));
|
||||
}
|
||||
|
||||
FrameMiniature copyFrame(FrameMiniature frame) {
|
||||
var ff = new FrameMiniature(frame.code, frame.width, frame.height);
|
||||
Array.Copy(frame.data, ff.data, frame.data.Length);
|
||||
return ff;
|
||||
}
|
||||
|
||||
public void ListViewItem_SetSpacing(ListView listview, short leftPadding, short topPadding) {
|
||||
const int LVM_FIRST = 0x1000;
|
||||
const int LVM_SETICONSPACING = LVM_FIRST + 53;
|
||||
@@ -438,7 +445,7 @@ namespace McBitFont {
|
||||
|
||||
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
if (prjModified) {
|
||||
if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Project was modified!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
||||
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) {
|
||||
saveToolStripMenuItem.PerformClick();
|
||||
return;
|
||||
}
|
||||
@@ -475,11 +482,14 @@ namespace McBitFont {
|
||||
foreach (FrameMiniature ff in frames) {
|
||||
var s = ff.code.ToString();
|
||||
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
|
||||
miniList.Items.Add(s, s+' '+append+(char)ff.code, s);
|
||||
var sss = s + ' ' + append + (char)(ff.code);
|
||||
//byte[] aaa = { (byte)ff.code}
|
||||
//Debug.WriteLine(sss.ToString() + Encoding.UTF8.GetString(new byte[] { 0x10, 0x04 }));
|
||||
miniList.Items.Add(s, s+' '+append+(char)(ff.code), s);
|
||||
}
|
||||
nudX.Value =neww;
|
||||
nudY.Value = newh;
|
||||
f = frames.First();
|
||||
f = copyFrame(frames.First());
|
||||
dotPanel.Refresh();
|
||||
miniList.Refresh();
|
||||
form.Dispose();
|
||||
@@ -492,10 +502,11 @@ 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;
|
||||
}
|
||||
var sel = miniList.SelectedItems[0];
|
||||
int code = Convert.ToInt32(sel.ImageKey);
|
||||
FrameMiniature ff = frames.Find(x => x.code == code);
|
||||
FrameMiniature ff = copyFrame(frames.Find(x => x.code == code));
|
||||
nudX.Value = ff.width;
|
||||
nudY.Value = ff.height;
|
||||
f = ff;
|
||||
@@ -518,7 +529,7 @@ namespace McBitFont {
|
||||
|
||||
private void openToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
if (prjModified) {
|
||||
if (MessageBox.Show("The project is modified.\nDo you want to save the changes?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
||||
if (MessageBox.Show("The project is modified.\nDo you want to save it first?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) {
|
||||
saveToolStripMenuItem.PerformClick();
|
||||
return;
|
||||
}
|
||||
@@ -548,7 +559,7 @@ namespace McBitFont {
|
||||
dotResize((int)nudX.Value, (int)nudY.Value);
|
||||
nudX.ValueChanged += nudX_ValueChanged;
|
||||
nudY.ValueChanged += nudY_ValueChanged;
|
||||
f = frames.First();
|
||||
f = copyFrame(frames.First());
|
||||
dotPanel.Refresh();
|
||||
miniList.Refresh();
|
||||
modified = false;
|
||||
@@ -559,7 +570,6 @@ namespace McBitFont {
|
||||
private void MainForm_FormClosing(object sender, FormClosingEventArgs e) {
|
||||
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) {
|
||||
saveToolStripMenuItem.PerformClick();
|
||||
e.Cancel = true;
|
||||
} else {
|
||||
e.Cancel = false;
|
||||
|
Reference in New Issue
Block a user