File->New single generation is done

This commit is contained in:
Anton Mukhin
2023-05-04 12:19:11 +03:00
parent 6e366ac081
commit d9277effdd
5 changed files with 80 additions and 48 deletions

View File

@@ -43,7 +43,7 @@
this.button1 = new System.Windows.Forms.Button();
this.outBox = new System.Windows.Forms.TextBox();
this.miniList = new System.Windows.Forms.ListView();
this.imageList1 = new System.Windows.Forms.ImageList(this.components);
this.ilMiniatures = new System.Windows.Forms.ImageList(this.components);
this.button2 = new System.Windows.Forms.Button();
this.hScroll = new System.Windows.Forms.HScrollBar();
this.vScroll = new System.Windows.Forms.VScrollBar();
@@ -51,8 +51,8 @@
this.menuStrip1 = new System.Windows.Forms.MenuStrip();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.newToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.openToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.saveToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.editToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.addSymbolToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -324,23 +324,23 @@
| System.Windows.Forms.AnchorStyles.Right)));
this.miniList.GridLines = true;
this.miniList.HideSelection = false;
this.miniList.LargeImageList = this.imageList1;
this.miniList.LargeImageList = this.ilMiniatures;
this.miniList.Location = new System.Drawing.Point(634, 347);
this.miniList.MultiSelect = false;
this.miniList.Name = "miniList";
this.miniList.ShowGroups = false;
this.miniList.Size = new System.Drawing.Size(230, 207);
this.miniList.SmallImageList = this.imageList1;
this.miniList.SmallImageList = this.ilMiniatures;
this.miniList.TabIndex = 12;
this.miniList.TabStop = false;
this.miniList.TileSize = new System.Drawing.Size(50, 70);
this.miniList.UseCompatibleStateImageBehavior = false;
//
// imageList1
// ilMiniatures
//
this.imageList1.ColorDepth = System.Windows.Forms.ColorDepth.Depth4Bit;
this.imageList1.ImageSize = new System.Drawing.Size(50, 50);
this.imageList1.TransparentColor = System.Drawing.Color.Transparent;
this.ilMiniatures.ColorDepth = System.Windows.Forms.ColorDepth.Depth4Bit;
this.ilMiniatures.ImageSize = new System.Drawing.Size(50, 50);
this.ilMiniatures.TransparentColor = System.Drawing.Color.Transparent;
//
// button2
//
@@ -411,26 +411,26 @@
// newToolStripMenuItem
//
this.newToolStripMenuItem.Name = "newToolStripMenuItem";
this.newToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.newToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.newToolStripMenuItem.Text = "New";
this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click);
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// openToolStripMenuItem
//
this.openToolStripMenuItem.Name = "openToolStripMenuItem";
this.openToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.openToolStripMenuItem.Text = "Open";
//
// saveToolStripMenuItem
//
this.saveToolStripMenuItem.Name = "saveToolStripMenuItem";
this.saveToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.saveToolStripMenuItem.Text = "Save";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem.Size = new System.Drawing.Size(103, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click);
//
@@ -447,19 +447,19 @@
// addSymbolToolStripMenuItem
//
this.addSymbolToolStripMenuItem.Name = "addSymbolToolStripMenuItem";
this.addSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.addSymbolToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.addSymbolToolStripMenuItem.Text = "Add symbol";
//
// removeSymbolToolStripMenuItem
//
this.removeSymbolToolStripMenuItem.Name = "removeSymbolToolStripMenuItem";
this.removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.removeSymbolToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.removeSymbolToolStripMenuItem.Text = "Remove symbol";
//
// fontOptionsToolStripMenuItem
//
this.fontOptionsToolStripMenuItem.Name = "fontOptionsToolStripMenuItem";
this.fontOptionsToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.fontOptionsToolStripMenuItem.Size = new System.Drawing.Size(159, 22);
this.fontOptionsToolStripMenuItem.Text = "Font Options";
//
// toolsToolStripMenuItem
@@ -479,49 +479,49 @@
// shiftUpToolStripMenuItem
//
this.shiftUpToolStripMenuItem.Name = "shiftUpToolStripMenuItem";
this.shiftUpToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftUpToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.shiftUpToolStripMenuItem.Text = "Shift Up";
this.shiftUpToolStripMenuItem.Click += new System.EventHandler(this.btnShiftUp_Click);
//
// shiftDownToolStripMenuItem
//
this.shiftDownToolStripMenuItem.Name = "shiftDownToolStripMenuItem";
this.shiftDownToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftDownToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.shiftDownToolStripMenuItem.Text = "Shift Down";
this.shiftDownToolStripMenuItem.Click += new System.EventHandler(this.btnShiftDown_Click);
//
// shiftLeftToolStripMenuItem
//
this.shiftLeftToolStripMenuItem.Name = "shiftLeftToolStripMenuItem";
this.shiftLeftToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftLeftToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.shiftLeftToolStripMenuItem.Text = "Shift left";
this.shiftLeftToolStripMenuItem.Click += new System.EventHandler(this.btnShiftLeft_Click);
//
// shiftRightToolStripMenuItem
//
this.shiftRightToolStripMenuItem.Name = "shiftRightToolStripMenuItem";
this.shiftRightToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.shiftRightToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.shiftRightToolStripMenuItem.Text = "Shift Right";
this.shiftRightToolStripMenuItem.Click += new System.EventHandler(this.btnShiftRight_Click);
//
// invertToolStripMenuItem
//
this.invertToolStripMenuItem.Name = "invertToolStripMenuItem";
this.invertToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.invertToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.invertToolStripMenuItem.Text = "Invert";
this.invertToolStripMenuItem.Click += new System.EventHandler(this.btnInvert_Click);
//
// mirrorXToolStripMenuItem
//
this.mirrorXToolStripMenuItem.Name = "mirrorXToolStripMenuItem";
this.mirrorXToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mirrorXToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.mirrorXToolStripMenuItem.Text = "Mirror X";
this.mirrorXToolStripMenuItem.Click += new System.EventHandler(this.btnMirrorX_Click);
//
// mirrorYToolStripMenuItem
//
this.mirrorYToolStripMenuItem.Name = "mirrorYToolStripMenuItem";
this.mirrorYToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.mirrorYToolStripMenuItem.Size = new System.Drawing.Size(132, 22);
this.mirrorYToolStripMenuItem.Text = "Mirror Y";
this.mirrorYToolStripMenuItem.Click += new System.EventHandler(this.btnMirrorY_Click);
//
@@ -589,7 +589,7 @@
private System.Windows.Forms.Button button1;
private System.Windows.Forms.TextBox outBox;
private System.Windows.Forms.ListView miniList;
private System.Windows.Forms.ImageList imageList1;
private System.Windows.Forms.ImageList ilMiniatures;
private System.Windows.Forms.Button button2;
private System.Windows.Forms.HScrollBar hScroll;
private System.Windows.Forms.VScrollBar vScroll;

View File

@@ -28,12 +28,12 @@ namespace McBitFont {
private FrameMiniature f;
List<FrameMiniature> frames = new List<FrameMiniature>();
//public FrameMiniature[] collection;
private int cellSize = 10;
private int dotWidth, dotHeight;
private int pixelOffset = 5;
private int gap;
private int w, h;
bool monospaced = false;
public Form1() {
InitializeComponent();
@@ -53,9 +53,10 @@ namespace McBitFont {
cbZoom.SelectedIndex = 3;
cbZoom.SelectedIndexChanged += cbZoom_SelectedIndexChanged;
f = new FrameMiniature(1, dotWidth, dotHeight);
frames.Add(f);
miniList.Items.Add("Single", "Single", 0);
frames.Add(new FrameMiniature(0, dotWidth, dotHeight));
miniList.Items.Add("0", "0 Single", "0");
miniList.Refresh();
f = frames.Find(x => x.code == 0);
}
private void dotPanel_MouseWheel(object sender, MouseEventArgs e) {
@@ -297,10 +298,9 @@ namespace McBitFont {
private void button2_Click(object sender, EventArgs e) {
var sizedBMP = getMiniPictue(f);
imageList1.Images.RemoveByKey("Single");
imageList1.Images.Add("Single", (Image)sizedBMP);
miniList.Items[miniList.Items.IndexOfKey("Single")].ImageKey = "Single";
string s = f.code.ToString();
ilMiniatures.Images.RemoveByKey(s);
ilMiniatures.Images.Add(s, (Image)sizedBMP);
sizedBMP.Dispose();
}
@@ -312,7 +312,7 @@ namespace McBitFont {
Color c;
for (int i = 0; i < m.width; i++) {
for (int j = 0; j < m.height; j++) {
c = f.data[i, j] ? Color.Black : Color.White;
c = m.data[i, j] ? Color.Black : Color.White;
bmp.SetPixel(i+imin, j+jmin, c);
}
}
@@ -326,7 +326,7 @@ namespace McBitFont {
SolidBrush sbb = new SolidBrush(Color.Black);
SolidBrush sbw = new SolidBrush(Color.White);
SolidBrush sb;
Pen p = new Pen(Color.LightSkyBlue);
Pen p = new Pen(Color.FromArgb(64, Color.Green));
int x, y;
for (int i=0; i<dotWidth; i++) {
@@ -352,7 +352,31 @@ namespace McBitFont {
private void newToolStripMenuItem_Click(object sender, EventArgs e) {
New form = new New();
form.ShowDialog();
if (form.ShowDialog() == DialogResult.OK) {
frames.Clear();
miniList.Clear();
ilMiniatures.Images.Clear();
string append = "";
int neww = (int)form.nudNewX.Value;
int newh = (int)form.nudNewY.Value;
if (form.cbSingle.Checked) {
frames.Add( new FrameMiniature(0, neww, newh));
//f = frames.Find(x => x.code == 0);
append = " Single";
}
foreach (FrameMiniature ff in frames) {
var s = ff.code.ToString();
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
miniList.Items.Add(s, s+append, s);
}
nudX.Value =neww;
nudY.Value = newh;
f = frames.First();
dotPanel.Refresh();
miniList.Refresh();
}
}
private void hScroll_ValueChanged(object sender, EventArgs e) {

View File

@@ -117,7 +117,7 @@
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="imageList1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<metadata name="ilMiniatures.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="menuStrip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">

View File

@@ -62,6 +62,7 @@
0,
0,
0});
this.nudNewX.Enter += new System.EventHandler(this.nudFocus);
//
// nudNewY
//
@@ -84,6 +85,7 @@
0,
0,
0});
this.nudNewY.Enter += new System.EventHandler(this.nudFocus);
//
// label1
//
@@ -233,18 +235,18 @@
#endregion
private System.Windows.Forms.NumericUpDown nudNewX;
private System.Windows.Forms.NumericUpDown nudNewY;
public System.Windows.Forms.NumericUpDown nudNewX;
public System.Windows.Forms.NumericUpDown nudNewY;
private System.Windows.Forms.Label label1;
private System.Windows.Forms.Label label2;
private System.Windows.Forms.RadioButton rbMono;
private System.Windows.Forms.RadioButton rbVar;
private System.Windows.Forms.CheckBox cbNotPrintable;
private System.Windows.Forms.CheckBox cbLatin;
private System.Windows.Forms.CheckBox cbExtended;
public System.Windows.Forms.RadioButton rbMono;
public System.Windows.Forms.RadioButton rbVar;
public System.Windows.Forms.CheckBox cbNotPrintable;
public System.Windows.Forms.CheckBox cbLatin;
public System.Windows.Forms.CheckBox cbExtended;
private System.Windows.Forms.Button btnOK;
private System.Windows.Forms.Button btnCancel;
private System.Windows.Forms.CheckBox cbSingle;
public System.Windows.Forms.CheckBox cbSingle;
private System.Windows.Forms.ToolTip toolTip1;
}
}

View File

@@ -41,5 +41,11 @@ namespace McBitFont {
private void btnOK_Click(object sender, EventArgs e) {
DialogResult= DialogResult.OK;
}
private void nudFocus(object sender, EventArgs e) {
NumericUpDown nud = (NumericUpDown)sender;
nud.Select(0, nud.Text.Length);
}
}
}