Compare commits
9 Commits
Author | SHA1 | Date | |
---|---|---|---|
|
780f92ccf5 | ||
|
cebbdc63c8 | ||
|
8ca83b7edc | ||
|
9cfe8ef5c3 | ||
76ca7ccf35 | |||
|
3c656b36a7 | ||
|
9f6f5ba5d7 | ||
|
4fa3d9bc49 | ||
|
1a26a2d16b |
@@ -61,7 +61,7 @@ namespace McBitFont {
|
|||||||
public FrameMiniature? Canvas { get; set; } = canvas;
|
public FrameMiniature? Canvas { get; set; } = canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static FrameMiniature CopyFrameSimple(FrameMiniature f) {
|
public static FrameMiniature CopyFrameSimple(FrameMiniature f) {
|
||||||
FrameMiniature newf = new(f.code, f.width, f.height);
|
FrameMiniature newf = new(f.code, f.width, f.height);
|
||||||
Array.Copy(f.data, newf.data, f.data.Length);
|
Array.Copy(f.data, newf.data, f.data.Length);
|
||||||
return newf;
|
return newf;
|
||||||
|
25
McBitFont/FontTester.Designer.cs
generated
25
McBitFont/FontTester.Designer.cs
generated
@@ -34,6 +34,7 @@
|
|||||||
lblZoom = new System.Windows.Forms.Label();
|
lblZoom = new System.Windows.Forms.Label();
|
||||||
cbZoom = new System.Windows.Forms.ComboBox();
|
cbZoom = new System.Windows.Forms.ComboBox();
|
||||||
toolTip1 = new System.Windows.Forms.ToolTip(components);
|
toolTip1 = new System.Windows.Forms.ToolTip(components);
|
||||||
|
btnCopy = new System.Windows.Forms.Button();
|
||||||
chkBaseline = new System.Windows.Forms.CheckBox();
|
chkBaseline = new System.Windows.Forms.CheckBox();
|
||||||
((System.ComponentModel.ISupportInitialize)nudSpace).BeginInit();
|
((System.ComponentModel.ISupportInitialize)nudSpace).BeginInit();
|
||||||
SuspendLayout();
|
SuspendLayout();
|
||||||
@@ -98,7 +99,7 @@
|
|||||||
vScroll.LargeChange = 25;
|
vScroll.LargeChange = 25;
|
||||||
vScroll.Location = new System.Drawing.Point(251, 84);
|
vScroll.Location = new System.Drawing.Point(251, 84);
|
||||||
vScroll.Name = "vScroll";
|
vScroll.Name = "vScroll";
|
||||||
vScroll.Size = new System.Drawing.Size(21, 125);
|
vScroll.Size = new System.Drawing.Size(21, 104);
|
||||||
vScroll.TabIndex = 17;
|
vScroll.TabIndex = 17;
|
||||||
vScroll.ValueChanged += Scrolling;
|
vScroll.ValueChanged += Scrolling;
|
||||||
//
|
//
|
||||||
@@ -140,6 +141,21 @@
|
|||||||
toolTip1.InitialDelay = 500;
|
toolTip1.InitialDelay = 500;
|
||||||
toolTip1.ReshowDelay = 100;
|
toolTip1.ReshowDelay = 100;
|
||||||
//
|
//
|
||||||
|
// btnCopy
|
||||||
|
//
|
||||||
|
btnCopy.Anchor = System.Windows.Forms.AnchorStyles.Bottom;
|
||||||
|
btnCopy.Image = Properties.Resources.Famfamfam_Silk_Page_copy_16;
|
||||||
|
btnCopy.ImageAlign = System.Drawing.ContentAlignment.MiddleRight;
|
||||||
|
btnCopy.Location = new System.Drawing.Point(110, 214);
|
||||||
|
btnCopy.Name = "btnCopy";
|
||||||
|
btnCopy.Size = new System.Drawing.Size(80, 30);
|
||||||
|
btnCopy.TabIndex = 21;
|
||||||
|
btnCopy.Text = " Copy";
|
||||||
|
btnCopy.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
|
||||||
|
toolTip1.SetToolTip(btnCopy, "Copy BitPixels you see to Clipboard");
|
||||||
|
btnCopy.UseVisualStyleBackColor = true;
|
||||||
|
btnCopy.MouseClick += Copy_Click;
|
||||||
|
//
|
||||||
// chkBaseline
|
// chkBaseline
|
||||||
//
|
//
|
||||||
chkBaseline.AutoSize = true;
|
chkBaseline.AutoSize = true;
|
||||||
@@ -155,7 +171,8 @@
|
|||||||
//
|
//
|
||||||
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(284, 221);
|
ClientSize = new System.Drawing.Size(284, 251);
|
||||||
|
Controls.Add(btnCopy);
|
||||||
Controls.Add(chkBaseline);
|
Controls.Add(chkBaseline);
|
||||||
Controls.Add(cbZoom);
|
Controls.Add(cbZoom);
|
||||||
Controls.Add(lblZoom);
|
Controls.Add(lblZoom);
|
||||||
@@ -168,13 +185,14 @@
|
|||||||
Controls.Add(lblSpace);
|
Controls.Add(lblSpace);
|
||||||
MaximizeBox = false;
|
MaximizeBox = false;
|
||||||
MinimizeBox = false;
|
MinimizeBox = false;
|
||||||
MinimumSize = new System.Drawing.Size(260, 260);
|
MinimumSize = new System.Drawing.Size(300, 290);
|
||||||
Name = "FontTester";
|
Name = "FontTester";
|
||||||
ShowIcon = false;
|
ShowIcon = false;
|
||||||
ShowInTaskbar = false;
|
ShowInTaskbar = false;
|
||||||
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
|
||||||
Text = "Font Tester";
|
Text = "Font Tester";
|
||||||
Load += FontTester_Load;
|
Load += FontTester_Load;
|
||||||
|
Resize += Form_Resize;
|
||||||
((System.ComponentModel.ISupportInitialize)nudSpace).EndInit();
|
((System.ComponentModel.ISupportInitialize)nudSpace).EndInit();
|
||||||
ResumeLayout(false);
|
ResumeLayout(false);
|
||||||
PerformLayout();
|
PerformLayout();
|
||||||
@@ -193,5 +211,6 @@
|
|||||||
private System.Windows.Forms.ToolTip toolTip1;
|
private System.Windows.Forms.ToolTip toolTip1;
|
||||||
private System.Windows.Forms.ComboBox cbZoom;
|
private System.Windows.Forms.ComboBox cbZoom;
|
||||||
private System.Windows.Forms.CheckBox chkBaseline;
|
private System.Windows.Forms.CheckBox chkBaseline;
|
||||||
|
private System.Windows.Forms.Button btnCopy;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,4 +1,5 @@
|
|||||||
using System;
|
using MessagePack;
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Data;
|
using System.Data;
|
||||||
@@ -24,6 +25,8 @@ namespace McBitFont {
|
|||||||
private int cellSize;
|
private int cellSize;
|
||||||
private int width;
|
private int width;
|
||||||
|
|
||||||
|
private readonly DataFormats.Format clpbFormat = DataFormats.GetFormat("McBitFontFrame");
|
||||||
|
|
||||||
public FontTester(int codepage, int height, int baseline, List<MainForm.FrameMiniature> frames) {
|
public FontTester(int codepage, int height, int baseline, List<MainForm.FrameMiniature> frames) {
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
|
||||||
@@ -53,7 +56,7 @@ namespace McBitFont {
|
|||||||
int space = (int)nudSpace.Value;
|
int space = (int)nudSpace.Value;
|
||||||
int index = 0;
|
int index = 0;
|
||||||
for (int c = 0; c < encoded.Length; c++) {
|
for (int c = 0; c < encoded.Length; c++) {
|
||||||
// Check if we have suck symbol
|
// Check if we have such symbol
|
||||||
var f = frames.FindAll(x => x.code == encoded[c]);
|
var f = frames.FindAll(x => x.code == encoded[c]);
|
||||||
if (f.Count == 1) {
|
if (f.Count == 1) {
|
||||||
// Draw the symbol
|
// Draw the symbol
|
||||||
@@ -160,6 +163,42 @@ namespace McBitFont {
|
|||||||
private void Scrolling(object sender, EventArgs e) {
|
private void Scrolling(object sender, EventArgs e) {
|
||||||
dotPanel.Invalidate();
|
dotPanel.Invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void Form_Resize(object sender, EventArgs e) {
|
||||||
|
btnCopy.Left = this.Width / 2 - 40;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void Copy_Click(object sender, MouseEventArgs e) {
|
||||||
|
if (encoded.Length < 1) {
|
||||||
|
MessageBox.Show("Nothing to copy! Type some symbols first.", "Error!", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
// Sycle through ecoded bytes of test text
|
||||||
|
int space = (int)nudSpace.Value;
|
||||||
|
int index = 0;
|
||||||
|
int i, j;
|
||||||
|
MainForm.FrameMiniature ff = new(0, width, frames[0].height);
|
||||||
|
for (int c = 0; c < encoded.Length; c++) {
|
||||||
|
// Check if we have such symbol
|
||||||
|
var f = frames.FindAll(x => x.code == encoded[c]);
|
||||||
|
if (f.Count == 1) {
|
||||||
|
// Draw the symbol
|
||||||
|
for (i = 0; i < f[0].width; i++) {
|
||||||
|
for (j = 0; j < f[0].height; j++) {
|
||||||
|
// Fill the frame with data
|
||||||
|
ff.data[index + i, j] = f[0].data[i, j];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
index += (f[0].width > 0 ? f[0].width + space : 0);
|
||||||
|
} else {
|
||||||
|
index += 5 + space;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// Copy the frame we made into Clipboard
|
||||||
|
var bb = MessagePackSerializer.Serialize(ChangeHistory.CopyFrameSimple(ff));
|
||||||
|
DataObject clpbObj = new DataObject(clpbFormat.Name, bb);
|
||||||
|
Clipboard.SetDataObject(clpbObj, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
7
McBitFont/Form1.Designer.cs
generated
7
McBitFont/Form1.Designer.cs
generated
@@ -493,7 +493,10 @@
|
|||||||
// hScroll
|
// hScroll
|
||||||
//
|
//
|
||||||
hScroll.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
hScroll.Anchor = System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
|
||||||
|
hScroll.Enabled = false;
|
||||||
|
hScroll.LargeChange = 2;
|
||||||
hScroll.Location = new System.Drawing.Point(14, 609);
|
hScroll.Location = new System.Drawing.Point(14, 609);
|
||||||
|
hScroll.Maximum = 1;
|
||||||
hScroll.Name = "hScroll";
|
hScroll.Name = "hScroll";
|
||||||
hScroll.Size = new System.Drawing.Size(427, 21);
|
hScroll.Size = new System.Drawing.Size(427, 21);
|
||||||
hScroll.TabIndex = 14;
|
hScroll.TabIndex = 14;
|
||||||
@@ -502,8 +505,10 @@
|
|||||||
// vScroll
|
// vScroll
|
||||||
//
|
//
|
||||||
vScroll.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
|
vScroll.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right;
|
||||||
vScroll.LargeChange = 25;
|
vScroll.Enabled = false;
|
||||||
|
vScroll.LargeChange = 2;
|
||||||
vScroll.Location = new System.Drawing.Point(444, 31);
|
vScroll.Location = new System.Drawing.Point(444, 31);
|
||||||
|
vScroll.Maximum = 1;
|
||||||
vScroll.Name = "vScroll";
|
vScroll.Name = "vScroll";
|
||||||
vScroll.Size = new System.Drawing.Size(21, 575);
|
vScroll.Size = new System.Drawing.Size(21, 575);
|
||||||
vScroll.TabIndex = 15;
|
vScroll.TabIndex = 15;
|
||||||
|
@@ -59,7 +59,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.4";
|
public const string version = "2.5";
|
||||||
public string prjName = "Untitled";
|
public string prjName = "Untitled";
|
||||||
public string prjFileName = "";
|
public string prjFileName = "";
|
||||||
public int codepage = 1251;
|
public int codepage = 1251;
|
||||||
@@ -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]);
|
||||||
@@ -140,7 +142,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
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) {
|
||||||
@@ -298,6 +296,7 @@ namespace McBitFont {
|
|||||||
if (w <= dotPanel.Width) {
|
if (w <= dotPanel.Width) {
|
||||||
hScroll.Enabled = false;
|
hScroll.Enabled = false;
|
||||||
hScroll.Value = 0;
|
hScroll.Value = 0;
|
||||||
|
vScroll.Maximum = 0;
|
||||||
} else {
|
} else {
|
||||||
hScroll.Maximum = w - dotPanel.Width + 12;
|
hScroll.Maximum = w - dotPanel.Width + 12;
|
||||||
hScroll.Minimum = 0;
|
hScroll.Minimum = 0;
|
||||||
@@ -307,6 +306,7 @@ namespace McBitFont {
|
|||||||
if (h <= dotPanel.Height) {
|
if (h <= dotPanel.Height) {
|
||||||
vScroll.Enabled = false;
|
vScroll.Enabled = false;
|
||||||
vScroll.Value = 0;
|
vScroll.Value = 0;
|
||||||
|
vScroll.Maximum = 0;
|
||||||
} else {
|
} else {
|
||||||
vScroll.Maximum = h - dotPanel.Height + 12;
|
vScroll.Maximum = h - dotPanel.Height + 12;
|
||||||
vScroll.Minimum = 0;
|
vScroll.Minimum = 0;
|
||||||
@@ -335,7 +335,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 +345,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -359,7 +357,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 +367,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -383,7 +379,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 +389,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -406,7 +400,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,19 +410,54 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
}
|
}
|
||||||
|
|
||||||
private bool mouseDown = false;
|
private bool mouseDown = false; // Used in canvas history tracking and rectangle selection logics
|
||||||
private bool fChanged = false;
|
private bool fChanged = false; // Used in canvas history (undo / redo) tracking
|
||||||
|
private bool mouseDownMiddle = false; // Used in middle mouse dragging logic
|
||||||
|
private int mouseX, mouseY; // To remember last mouse X and Y (used in middle mouse dragging logic)
|
||||||
|
private int lastX = 0, lastY = 0; // Used for drawing straight lines
|
||||||
private void dotPanel_MouseMove(object sender, MouseEventArgs e) {
|
private void dotPanel_MouseMove(object sender, MouseEventArgs e) {
|
||||||
var rectSel = chkRectSelect.Checked;
|
var rectSel = chkRectSelect.Checked;
|
||||||
bool rectSelUpdated = false;
|
bool rectSelUpdated = false;
|
||||||
|
|
||||||
|
// Drag with middle mouse button
|
||||||
|
if (vScroll.Enabled || hScroll.Enabled) {
|
||||||
|
if (mouseDownMiddle) {
|
||||||
|
var dY = mouseY - e.Y <= -cellSize - gap || mouseY - e.Y >= cellSize + gap;
|
||||||
|
var dX = mouseX - e.X <= -cellSize - gap || mouseX - e.X >= cellSize + gap;
|
||||||
|
int newY = vScroll.Value;
|
||||||
|
int newX = hScroll.Value;
|
||||||
|
if (dX) {
|
||||||
|
newX += (mouseX - e.X);
|
||||||
|
if (newX < hScroll.Minimum) newX = hScroll.Minimum;
|
||||||
|
if (newX > hScroll.Maximum) newX = hScroll.Maximum;
|
||||||
|
mouseX = e.X;
|
||||||
|
hScroll.Value = newX;
|
||||||
|
}
|
||||||
|
if (dY) {
|
||||||
|
newY += (mouseY - e.Y);
|
||||||
|
if (newY < vScroll.Minimum) newY = vScroll.Minimum;
|
||||||
|
if (newY > vScroll.Maximum) newY = vScroll.Maximum;
|
||||||
|
mouseY = e.Y;
|
||||||
|
vScroll.Value = newY;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!mouseDownMiddle && e.Button == MouseButtons.Middle) {
|
||||||
|
mouseDownMiddle = true;
|
||||||
|
mouseX = e.X;
|
||||||
|
mouseY = e.Y;
|
||||||
|
}
|
||||||
|
if (mouseDownMiddle && e.Button == MouseButtons.None) {
|
||||||
|
mouseDownMiddle = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Moving baseline
|
// Moving baseline
|
||||||
Rectangle rect1, rect2;
|
Rectangle rect1, rect2;
|
||||||
if (set_base) {
|
if (set_base) {
|
||||||
@@ -485,13 +513,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();
|
||||||
@@ -529,6 +552,15 @@ namespace McBitFont {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check for Shift / Ctrl keys for straight lines
|
||||||
|
if (ModifierKeys.HasFlag(Keys.Shift)) {
|
||||||
|
j = lastY;
|
||||||
|
} else if (ModifierKeys.HasFlag(Keys.Control)) {
|
||||||
|
i = lastX;
|
||||||
|
}
|
||||||
|
lastX = i;
|
||||||
|
lastY = j;
|
||||||
|
|
||||||
// Paint black / white
|
// Paint black / white
|
||||||
if (e.Button == MouseButtons.Left && !f.data[i, j]) {
|
if (e.Button == MouseButtons.Left && !f.data[i, j]) {
|
||||||
f.data[i, j] = true;
|
f.data[i, j] = true;
|
||||||
@@ -554,8 +586,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 +594,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -577,7 +606,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 +617,6 @@ namespace McBitFont {
|
|||||||
b--;
|
b--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -602,7 +629,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 +640,6 @@ namespace McBitFont {
|
|||||||
b--;
|
b--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -786,7 +811,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 +863,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 +883,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 +985,6 @@ namespace McBitFont {
|
|||||||
|
|
||||||
CheckForAdd();
|
CheckForAdd();
|
||||||
|
|
||||||
// Re-create history object
|
|
||||||
//history = new CanvasHistory();
|
|
||||||
history.Clear();
|
history.Clear();
|
||||||
|
|
||||||
tsmiMakeVarWidth.Visible = monospaced;
|
tsmiMakeVarWidth.Visible = monospaced;
|
||||||
@@ -1017,9 +1035,11 @@ namespace McBitFont {
|
|||||||
var sel = miniList.SelectedItems[0].ImageKey;
|
var sel = miniList.SelectedItems[0].ImageKey;
|
||||||
int code = Convert.ToInt32(miniList.SelectedItems[0].ImageKey);
|
int code = Convert.ToInt32(miniList.SelectedItems[0].ImageKey);
|
||||||
FrameMiniature ff = frames.Find(x => x.code == code);
|
FrameMiniature ff = frames.Find(x => x.code == code);
|
||||||
|
bool isLast = frames.Last().Equals(ff);
|
||||||
frames.Remove(ff);
|
frames.Remove(ff);
|
||||||
miniList.SelectedItems[0].Remove();
|
miniList.SelectedItems[0].Remove();
|
||||||
//miniList.Items[0].Selected = true;
|
|
||||||
|
miniList.Items[isLast ? miniList.Items.Count - 1 : 0].Selected = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prependSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
private void prependSymbolToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||||
@@ -1080,7 +1100,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 +1121,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
dotPanel.Refresh();
|
dotPanel.Refresh();
|
||||||
@@ -1152,8 +1170,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 +1178,6 @@ namespace McBitFont {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//history.AddPost(f);
|
|
||||||
history.Add(f);
|
history.Add(f);
|
||||||
CheckHistoryButtons();
|
CheckHistoryButtons();
|
||||||
SetModified();
|
SetModified();
|
||||||
@@ -1244,14 +1259,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 +1316,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();
|
||||||
|
@@ -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.4.0.0</AssemblyVersion>
|
<AssemblyVersion>2.5.0.0</AssemblyVersion>
|
||||||
<FileVersion>2.4.0.0</FileVersion>
|
<FileVersion>2.5.0.0</FileVersion>
|
||||||
<Version>$(VersionPrefix)2.4.0</Version>
|
<Version>$(VersionPrefix)2.5.0</Version>
|
||||||
<Copyright>Anton Mukhin</Copyright>
|
<Copyright>Anton Mukhin</Copyright>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
|
@@ -20,6 +20,8 @@ Some basic hints on the interface:
|
|||||||
- Mouse 1 to mark a pixel black
|
- Mouse 1 to mark a pixel black
|
||||||
- Mouse 2 to mark a pixel white
|
- Mouse 2 to mark a pixel white
|
||||||
- Drag the mouse holding a button to draw pixels
|
- Drag the mouse holding a button to draw pixels
|
||||||
|
- Hold Shift to constrain painting horizontally
|
||||||
|
- Hold Ctrl to constrain painting vertically
|
||||||
- Mouse Scroll to scroll up and down
|
- Mouse Scroll to scroll up and down
|
||||||
- Shift + scroll to scroll left and right
|
- Shift + scroll to scroll left and right
|
||||||
- Crtl + scroll to zoom
|
- Crtl + scroll to zoom
|
||||||
|
10
TODO.txt
10
TODO.txt
@@ -1,11 +1,11 @@
|
|||||||
Application:
|
Application:
|
||||||
- Consider migrating to WPF in order to make DPI aware UI
|
- Consider migrating to WPF in order to make DPI aware UI
|
||||||
V Copy-Paste now uses System clipboard and it is possible to copy-paste from/to different instances of running program
|
|
||||||
|
|
||||||
Functionality:
|
Functionality:
|
||||||
V Rewrite history class so it tracks all changes, not only a canvas changes
|
V Middle mouse - drag the canvas
|
||||||
|
V Straight line painting (hold Shift / Ctrl)
|
||||||
|
V A button to Copy from Test font dialog to then paste into another frame
|
||||||
|
|
||||||
Bugs:
|
Bugs:
|
||||||
V In some cases after switching to a symbol dotPanel mouse move causes "Out of range" exception (history.Pre after width change?)
|
V Nothing selected after removing a symbol. Potential error throw on "Apply"
|
||||||
V Switching between symbols while select tool is active and small area selected trows an error
|
|
||||||
V Full frame Copy in Clipboard does not respect selection on Paste operation
|
|
Binary file not shown.
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 12 KiB |
Reference in New Issue
Block a user