Hotfix: history object creation time
This commit is contained in:
@@ -128,6 +128,8 @@ namespace McBitFont {
|
|||||||
|
|
||||||
fbuf = new FrameMiniature(0, dotWidth, dotHeight);
|
fbuf = new FrameMiniature(0, dotWidth, dotHeight);
|
||||||
|
|
||||||
|
history = new(this);
|
||||||
|
|
||||||
// Chek for arguments
|
// Chek for arguments
|
||||||
if (Environment.GetCommandLineArgs().Length > 1) {
|
if (Environment.GetCommandLineArgs().Length > 1) {
|
||||||
LoadProject(Environment.GetCommandLineArgs()[1]);
|
LoadProject(Environment.GetCommandLineArgs()[1]);
|
||||||
@@ -139,8 +141,7 @@ namespace McBitFont {
|
|||||||
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
|
CodeShiftToolStripMenuItem.Visible = frames.Count > 1;
|
||||||
|
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
|
|
||||||
history = new(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll")]
|
[DllImport("user32.dll")]
|
||||||
@@ -285,9 +286,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
SetNewWH();
|
SetNewWH();
|
||||||
cbZoom_SelectedIndexChanged(cbZoom, null);
|
cbZoom_SelectedIndexChanged(cbZoom, null);
|
||||||
|
|
||||||
// Re-create history object
|
|
||||||
//history = new CanvasHistory();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cbZoom_SelectedIndexChanged(object sender, EventArgs e) {
|
private void cbZoom_SelectedIndexChanged(object sender, EventArgs e) {
|
||||||
@@ -335,7 +333,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (int i = x; i <= x2; i++) {
|
for (int i = x; i <= x2; i++) {
|
||||||
c = f.data[i, y];
|
c = f.data[i, y];
|
||||||
for (int j = y; j <= y2; j++) {
|
for (int j = y; j <= y2; j++) {
|
||||||
@@ -346,7 +343,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -359,7 +355,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (int i = x; i <= x2; i++) {
|
for (int i = x; i <= x2; i++) {
|
||||||
c = f.data[i, y2];
|
c = f.data[i, y2];
|
||||||
for (int j = y2; j >= y; j--) {
|
for (int j = y2; j >= y; j--) {
|
||||||
@@ -370,7 +365,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -383,7 +377,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (int j = y; j <= y2; j++) {
|
for (int j = y; j <= y2; j++) {
|
||||||
c = f.data[x, j];
|
c = f.data[x, j];
|
||||||
for (int i = x; i <= x2; i++) {
|
for (int i = x; i <= x2; i++) {
|
||||||
@@ -394,7 +387,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -406,7 +398,6 @@ namespace McBitFont {
|
|||||||
bool c;
|
bool c;
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (int j = y; j <= y2; j++) {
|
for (int j = y; j <= y2; j++) {
|
||||||
c = f.data[x2, j];
|
c = f.data[x2, j];
|
||||||
for (int i = x2; i >= x; i--) {
|
for (int i = x2; i >= x; i--) {
|
||||||
@@ -417,7 +408,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -485,13 +475,8 @@ namespace McBitFont {
|
|||||||
NormPoints(ref selection1, ref selection2);
|
NormPoints(ref selection1, ref selection2);
|
||||||
dotPanel.Invalidate();
|
dotPanel.Invalidate();
|
||||||
} else {
|
} else {
|
||||||
//if (!fChanged) {
|
|
||||||
// history.Remove(false);
|
|
||||||
//} else {
|
|
||||||
if (fChanged) {
|
if (fChanged) {
|
||||||
fChanged = false;
|
fChanged = false;
|
||||||
//history.ApplyAdded();
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
}
|
}
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
@@ -554,8 +539,6 @@ namespace McBitFont {
|
|||||||
private void btnInvert_Click(object sender, EventArgs e) {
|
private void btnInvert_Click(object sender, EventArgs e) {
|
||||||
int x, y, x2, y2;
|
int x, y, x2, y2;
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
for (int i = x; i <= x2; i++) {
|
for (int i = x; i <= x2; i++) {
|
||||||
@@ -564,7 +547,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -577,7 +559,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (j = y; j <= y2; j++) {
|
for (j = y; j <= y2; j++) {
|
||||||
a = x;
|
a = x;
|
||||||
b = x2;
|
b = x2;
|
||||||
@@ -589,7 +570,6 @@ namespace McBitFont {
|
|||||||
b--;
|
b--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -602,7 +582,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
for (i = x; i <= x2; i++) {
|
for (i = x; i <= x2; i++) {
|
||||||
a = y;
|
a = y;
|
||||||
b = y2;
|
b = y2;
|
||||||
@@ -614,7 +593,6 @@ namespace McBitFont {
|
|||||||
b--;
|
b--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -786,7 +764,6 @@ namespace McBitFont {
|
|||||||
FrameMiniature newf;
|
FrameMiniature newf;
|
||||||
if (form.cbSingle.Checked) {
|
if (form.cbSingle.Checked) {
|
||||||
frames.Add(new FrameMiniature(0, neww, newh));
|
frames.Add(new FrameMiniature(0, neww, newh));
|
||||||
//f = frames.Find(x => x.code == 0);
|
|
||||||
append = "Single";
|
append = "Single";
|
||||||
monospaced = false;
|
monospaced = false;
|
||||||
} else {
|
} else {
|
||||||
@@ -839,8 +816,6 @@ namespace McBitFont {
|
|||||||
miniList.Refresh();
|
miniList.Refresh();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
|
|
||||||
// Re-create history object
|
|
||||||
//history = new CanvasHistory();
|
|
||||||
history.Clear();
|
history.Clear();
|
||||||
|
|
||||||
Cursor.Current = Cursors.Default;
|
Cursor.Current = Cursors.Default;
|
||||||
@@ -861,8 +836,6 @@ namespace McBitFont {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
dotPanel.SuspendLayout();
|
dotPanel.SuspendLayout();
|
||||||
// Clear history
|
|
||||||
//history.Clear();
|
|
||||||
|
|
||||||
var sel = miniList.SelectedItems[0];
|
var sel = miniList.SelectedItems[0];
|
||||||
int code = Convert.ToInt32(sel.ImageKey);
|
int code = Convert.ToInt32(sel.ImageKey);
|
||||||
@@ -965,8 +938,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
|
|
||||||
// Re-create history object
|
|
||||||
//history = new CanvasHistory();
|
|
||||||
history.Clear();
|
history.Clear();
|
||||||
|
|
||||||
tsmiMakeVarWidth.Visible = monospaced;
|
tsmiMakeVarWidth.Visible = monospaced;
|
||||||
@@ -1019,7 +990,6 @@ namespace McBitFont {
|
|||||||
FrameMiniature ff = frames.Find(x => x.code == code);
|
FrameMiniature ff = frames.Find(x => x.code == code);
|
||||||
frames.Remove(ff);
|
frames.Remove(ff);
|
||||||
miniList.SelectedItems[0].Remove();
|
miniList.SelectedItems[0].Remove();
|
||||||
//miniList.Items[0].Selected = true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prependSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void prependSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
@@ -1080,7 +1050,6 @@ namespace McBitFont {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
int di, dj, wmax, hmax, selw, selh;
|
int di, dj, wmax, hmax, selw, selh;
|
||||||
if (chkRectSelect.Checked) {
|
if (chkRectSelect.Checked) {
|
||||||
di = selection1.X;
|
di = selection1.X;
|
||||||
@@ -1102,7 +1071,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
@@ -1152,8 +1120,6 @@ namespace McBitFont {
|
|||||||
private void FillFrame(bool val) {
|
private void FillFrame(bool val) {
|
||||||
int x, y, x2, y2;
|
int x, y, x2, y2;
|
||||||
|
|
||||||
//history.AddPre(f);
|
|
||||||
|
|
||||||
(x, y, x2, y2) = RectSelCoords();
|
(x, y, x2, y2) = RectSelCoords();
|
||||||
|
|
||||||
for (int i = x; i <= x2; i++) {
|
for (int i = x; i <= x2; i++) {
|
||||||
@@ -1162,7 +1128,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -1244,14 +1209,12 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void undoToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void undoToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
//history.Undo(f);
|
|
||||||
history.Undo();
|
history.Undo();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void redoToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void redoToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
//history.Redo(f);
|
|
||||||
history.Redo();
|
history.Redo();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
@@ -1303,13 +1266,11 @@ namespace McBitFont {
|
|||||||
private void importImageToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void importImageToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
ImageImporter iform = new ImageImporter(f.width, f.height);
|
ImageImporter iform = new ImageImporter(f.width, f.height);
|
||||||
if (iform.ShowDialog() == DialogResult.OK) {
|
if (iform.ShowDialog() == DialogResult.OK) {
|
||||||
//history.AddPre(f);
|
|
||||||
for (int i = 0; i < iform.bmpScaled.Width; i++) {
|
for (int i = 0; i < iform.bmpScaled.Width; i++) {
|
||||||
for (int j = 0; j < iform.bmpScaled.Height; j++) {
|
for (int j = 0; j < iform.bmpScaled.Height; j++) {
|
||||||
f.data[i, j] = iform.bmpScaled.GetPixel(i, j).ToArgb().Equals(Color.Black.ToArgb());
|
f.data[i, j] = iform.bmpScaled.GetPixel(i, j).ToArgb().Equals(Color.Black.ToArgb());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
|
Reference in New Issue
Block a user