Compare commits
8 Commits
Author | SHA1 | Date | |
---|---|---|---|
72ad6e5be0 | |||
9d1ca65f34 | |||
|
dd3f4f4b4b | ||
|
8889b846dc | ||
|
fe0e1dabfd | ||
|
e0786bdb07 | ||
4fa818f35e | |||
11b268a350 |
26
McBitFont/Form1.Designer.cs
generated
26
McBitFont/Form1.Designer.cs
generated
@@ -73,6 +73,7 @@
|
||||
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.dlgSave = new System.Windows.Forms.SaveFileDialog();
|
||||
this.dlgOpen = new System.Windows.Forms.OpenFileDialog();
|
||||
this.btnBaseline = new System.Windows.Forms.Button();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudX)).BeginInit();
|
||||
((System.ComponentModel.ISupportInitialize)(this.nudY)).BeginInit();
|
||||
this.panel1.SuspendLayout();
|
||||
@@ -122,7 +123,7 @@
|
||||
// nudY
|
||||
//
|
||||
this.nudY.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.nudY.Location = new System.Drawing.Point(717, 53);
|
||||
this.nudY.Location = new System.Drawing.Point(717, 49);
|
||||
this.nudY.Maximum = new decimal(new int[] {
|
||||
255,
|
||||
0,
|
||||
@@ -157,7 +158,7 @@
|
||||
//
|
||||
this.label2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label2.AutoSize = true;
|
||||
this.label2.Location = new System.Drawing.Point(670, 55);
|
||||
this.label2.Location = new System.Drawing.Point(670, 51);
|
||||
this.label2.Name = "label2";
|
||||
this.label2.Size = new System.Drawing.Size(41, 13);
|
||||
this.label2.TabIndex = 4;
|
||||
@@ -202,7 +203,7 @@
|
||||
//
|
||||
this.label4.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label4.AutoSize = true;
|
||||
this.label4.Location = new System.Drawing.Point(602, 29);
|
||||
this.label4.Location = new System.Drawing.Point(604, 29);
|
||||
this.label4.Name = "label4";
|
||||
this.label4.Size = new System.Drawing.Size(62, 13);
|
||||
this.label4.TabIndex = 7;
|
||||
@@ -304,7 +305,7 @@
|
||||
// btnExport
|
||||
//
|
||||
this.btnExport.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnExport.Location = new System.Drawing.Point(696, 99);
|
||||
this.btnExport.Location = new System.Drawing.Point(696, 109);
|
||||
this.btnExport.Name = "btnExport";
|
||||
this.btnExport.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnExport.TabIndex = 10;
|
||||
@@ -343,7 +344,7 @@
|
||||
// btnApply
|
||||
//
|
||||
this.btnApply.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnApply.Location = new System.Drawing.Point(589, 99);
|
||||
this.btnApply.Location = new System.Drawing.Point(615, 109);
|
||||
this.btnApply.Name = "btnApply";
|
||||
this.btnApply.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnApply.TabIndex = 13;
|
||||
@@ -376,7 +377,7 @@
|
||||
//
|
||||
this.label5.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.label5.AutoSize = true;
|
||||
this.label5.Location = new System.Drawing.Point(640, 71);
|
||||
this.label5.Location = new System.Drawing.Point(554, 114);
|
||||
this.label5.Name = "label5";
|
||||
this.label5.Size = new System.Drawing.Size(24, 13);
|
||||
this.label5.TabIndex = 16;
|
||||
@@ -636,11 +637,23 @@
|
||||
this.dlgOpen.DefaultExt = "mbf";
|
||||
this.dlgOpen.Filter = "McBitFont files|*.mbf|All files|*.*";
|
||||
//
|
||||
// btnBaseline
|
||||
//
|
||||
this.btnBaseline.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnBaseline.Location = new System.Drawing.Point(615, 80);
|
||||
this.btnBaseline.Name = "btnBaseline";
|
||||
this.btnBaseline.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnBaseline.TabIndex = 18;
|
||||
this.btnBaseline.Text = "Baseline";
|
||||
this.btnBaseline.UseVisualStyleBackColor = true;
|
||||
this.btnBaseline.Click += new System.EventHandler(this.btnBaseline_Click);
|
||||
//
|
||||
// MainForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(784, 561);
|
||||
this.Controls.Add(this.btnBaseline);
|
||||
this.Controls.Add(this.btnApply);
|
||||
this.Controls.Add(this.btnExport);
|
||||
this.Controls.Add(this.label5);
|
||||
@@ -725,6 +738,7 @@
|
||||
private System.Windows.Forms.ToolStripMenuItem appendSymbolToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem copyToolStripMenuItem;
|
||||
private System.Windows.Forms.ToolStripMenuItem pasteToolStripMenuItem;
|
||||
private System.Windows.Forms.Button btnBaseline;
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -37,6 +37,7 @@ namespace McBitFont {
|
||||
public struct SaveBlock {
|
||||
public bool monospaced;
|
||||
public int codepage;
|
||||
public int baseline;
|
||||
public List<FrameMiniature> frames;
|
||||
}
|
||||
|
||||
@@ -50,11 +51,13 @@ namespace McBitFont {
|
||||
public bool monospaced = false;
|
||||
bool modified = false;
|
||||
bool prjModified = false;
|
||||
public const string version = "1.2";
|
||||
public const string version = "1.6";
|
||||
public string prjName = "Untitled";
|
||||
public int codepage = 1251;
|
||||
private FrameMiniature fbuf;
|
||||
private bool fbuffer = false;
|
||||
public int baseline = 0;
|
||||
public bool set_base = false;
|
||||
|
||||
public MainForm() {
|
||||
InitializeComponent();
|
||||
@@ -138,7 +141,7 @@ namespace McBitFont {
|
||||
for (int i = 0; i < frames.Count; i++) {
|
||||
frames[i] = frameResize(frames[i], (int)nudX.Value, dotHeight);
|
||||
bmp = getMiniPictue(frames[i]);
|
||||
string s = frames[i].code.ToString();
|
||||
string s = frames[i].code.ToString().PadLeft(3, '0');
|
||||
ilMiniatures.Images.RemoveByKey(s);
|
||||
ilMiniatures.Images.Add(s, (Image)bmp);
|
||||
miniList.Items[s].ImageKey = s;
|
||||
@@ -155,11 +158,12 @@ namespace McBitFont {
|
||||
for (int i = 0; i < frames.Count; i++) {
|
||||
frames[i] = frameResize(frames[i], dotWidth, (int)nudY.Value);
|
||||
bmp = getMiniPictue(frames[i]);
|
||||
string s = frames[i].code.ToString();
|
||||
string s = frames[i].code.ToString().PadLeft(3, '0');
|
||||
ilMiniatures.Images.RemoveByKey(s);
|
||||
ilMiniatures.Images.Add(s, (Image)bmp);
|
||||
miniList.Items[s].ImageKey = s;
|
||||
}
|
||||
if (nudY.Focused) modified = true;
|
||||
prjModified = true;
|
||||
dotResize(dotWidth, (int)nudY.Value);
|
||||
}
|
||||
@@ -275,6 +279,27 @@ namespace McBitFont {
|
||||
}
|
||||
|
||||
private void dotPanel_MouseMove(object sender, MouseEventArgs e) {
|
||||
Rectangle rect1, rect2;
|
||||
if (set_base) {
|
||||
|
||||
int yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
|
||||
rect1 = new Rectangle(pixelOffset, yy, w, 2);
|
||||
baseline = (e.Y - pixelOffset + vScroll.Value) / (cellSize + gap);
|
||||
|
||||
if (baseline >= dotHeight) baseline = dotHeight - 1;
|
||||
if (baseline < 0) baseline = 0;
|
||||
|
||||
yy = pixelOffset + baseline * (cellSize + gap) - vScroll.Value - 1;
|
||||
rect2 = new Rectangle(pixelOffset, yy, w, 2);
|
||||
|
||||
dotPanel.Invalidate(rect1);
|
||||
dotPanel.Invalidate(rect2);
|
||||
|
||||
if (e.Button == MouseButtons.Left) {
|
||||
set_base = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
if (e.X >= w || e.X <= pixelOffset || e.Y >= h || e.Y <= pixelOffset) return;
|
||||
int i = (e.X - pixelOffset + hScroll.Value) / (cellSize + gap);
|
||||
int j = (e.Y - pixelOffset + vScroll.Value) / (cellSize + gap);
|
||||
@@ -286,8 +311,9 @@ namespace McBitFont {
|
||||
f.data[i, j] = true;
|
||||
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
||||
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
||||
g.FillRectangle(sbb, x, y, cellSize, cellSize);
|
||||
modified = true;
|
||||
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
||||
dotPanel.Invalidate(rect1);
|
||||
}
|
||||
if (e.Button == MouseButtons.Right && f.data[i, j]) {
|
||||
Graphics g = dotPanel.CreateGraphics();
|
||||
@@ -295,8 +321,9 @@ namespace McBitFont {
|
||||
f.data[i, j] = false;
|
||||
int x = pixelOffset + i * (cellSize + gap) - hScroll.Value;
|
||||
int y = pixelOffset + j * (cellSize + gap) - vScroll.Value;
|
||||
g.FillRectangle(sbw, x, y, cellSize, cellSize);
|
||||
modified = true;
|
||||
rect1 = new Rectangle(x, y, cellSize, cellSize);
|
||||
dotPanel.Invalidate(rect1);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -450,9 +477,19 @@ namespace McBitFont {
|
||||
}
|
||||
if (f.data[i, j]) sb = sbb;
|
||||
else sb = sbw;
|
||||
g.FillRectangle(sb, x, y, cellSize, cellSize);
|
||||
g.FillRectangle(sb, x, (baseline == j ? y+1 : y), cellSize, (baseline == j ? cellSize-1 : cellSize));
|
||||
}
|
||||
}
|
||||
|
||||
if (baseline > 0 && gap > 0) {
|
||||
x = pixelOffset - hScroll.Value;
|
||||
y = pixelOffset + baseline * (cellSize + gap) - vScroll.Value;
|
||||
g.DrawLine(
|
||||
new Pen(Color.Blue, 2),
|
||||
x, y,
|
||||
w, y
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
private void exitToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
@@ -538,10 +575,10 @@ namespace McBitFont {
|
||||
monospaced = form.rbMono.Checked;
|
||||
}
|
||||
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
|
||||
codepage = (form.cbEncoding.SelectedItem as New.EncodingItem).Code;
|
||||
foreach (FrameMiniature ff in frames) {
|
||||
var s = ff.code.ToString().PadLeft(3, '0');
|
||||
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
|
||||
codepage =(form.cbEncoding.SelectedItem as New.EncodingItem).Code;
|
||||
var sss = decodeSymbol(ff.code);
|
||||
miniList.Items.Add(s, s+' '+append+sss, s);
|
||||
}
|
||||
@@ -550,11 +587,14 @@ namespace McBitFont {
|
||||
miniList.Refresh();
|
||||
form.Dispose();
|
||||
|
||||
baseline = 0;
|
||||
|
||||
prjName = "Untitled";
|
||||
this.Text = "McBitFont " + version + " - " + prjName;
|
||||
modified = false;
|
||||
checkForAdd();
|
||||
fbuffer = false;
|
||||
dotPanel.Refresh();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -592,11 +632,17 @@ namespace McBitFont {
|
||||
}
|
||||
|
||||
private void saveToolStripMenuItem_Click(object sender, EventArgs e) {
|
||||
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) {
|
||||
saveFrame();
|
||||
}
|
||||
}
|
||||
if (dlgSave.ShowDialog() == DialogResult.OK) {
|
||||
SaveBlock sav;
|
||||
sav.monospaced = monospaced;
|
||||
sav.frames = frames;
|
||||
sav.codepage = codepage;
|
||||
sav.baseline = baseline;
|
||||
BinaryFormatter formatter = new BinaryFormatter();
|
||||
using (Stream ms = File.OpenWrite(dlgSave.FileName)) {
|
||||
formatter.Serialize(ms, sav);
|
||||
@@ -625,14 +671,16 @@ namespace McBitFont {
|
||||
}
|
||||
monospaced = sav.monospaced;
|
||||
codepage = sav.codepage;
|
||||
baseline = sav.baseline;
|
||||
lblType.Text = monospaced ? "Monospaced" : "Variable width / Single";
|
||||
frames = sav.frames;
|
||||
miniList.Items.Clear();
|
||||
ilMiniatures.Images.Clear();
|
||||
foreach (FrameMiniature ff in frames) {
|
||||
var s = ff.code.ToString().PadLeft(3, '0');
|
||||
var sss = decodeSymbol(ff.code);
|
||||
ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff));
|
||||
miniList.Items.Add(s, s + ' ' + (char)ff.code, s);
|
||||
miniList.Items.Add(s, s + ' ' + sss, s);
|
||||
}
|
||||
nudX.ValueChanged -= nudX_ValueChanged;
|
||||
nudY.ValueChanged -= nudY_ValueChanged;
|
||||
@@ -713,6 +761,10 @@ namespace McBitFont {
|
||||
form.ShowDialog();
|
||||
}
|
||||
|
||||
private void btnBaseline_Click(object sender, EventArgs e) {
|
||||
set_base = !set_base;
|
||||
}
|
||||
|
||||
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) {
|
||||
|
@@ -32,5 +32,5 @@ using System.Runtime.InteropServices;
|
||||
// Можно задать все значения или принять номера сборки и редакции по умолчанию
|
||||
// используя "*", как показано ниже:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.2.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.2.0.0")]
|
||||
[assembly: AssemblyVersion("1.6.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.6.0.0")]
|
||||
|
BIN
examples/CP437_Cyr_8x16.mbf
Normal file
BIN
examples/CP437_Cyr_8x16.mbf
Normal file
Binary file not shown.
BIN
examples/Font_5x7.mbf
Normal file
BIN
examples/Font_5x7.mbf
Normal file
Binary file not shown.
BIN
examples/Numbers_11x16.mbf
Normal file
BIN
examples/Numbers_11x16.mbf
Normal file
Binary file not shown.
BIN
examples/Numbers_13x20.mbf
Normal file
BIN
examples/Numbers_13x20.mbf
Normal file
Binary file not shown.
BIN
examples/gyver_icons_7x7.mbf
Normal file
BIN
examples/gyver_icons_7x7.mbf
Normal file
Binary file not shown.
BIN
examples/gyver_icons_8x8.mbf
Normal file
BIN
examples/gyver_icons_8x8.mbf
Normal file
Binary file not shown.
Reference in New Issue
Block a user