diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index e89526f..bcb3454 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -479,13 +479,13 @@ namespace McBitFont { } } monospaced = form.rbMono.Checked; + lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; foreach (FrameMiniature ff in frames) { var s = ff.code.ToString(); ilMiniatures.Images.Add(s, (Image)getMiniPictue(ff)); - 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); + var enc = Encoding.GetEncoding((form.cbEncoding.SelectedItem as New.EncodingItem).Code); + var sss = enc.GetString(new byte[] { (byte)ff.code }); + miniList.Items.Add(s, s+' '+append+sss, s); } nudX.Value =neww; nudY.Value = newh; diff --git a/McBitFont/New.Designer.cs b/McBitFont/New.Designer.cs index 3a66ea5..27d0c49 100644 --- a/McBitFont/New.Designer.cs +++ b/McBitFont/New.Designer.cs @@ -37,13 +37,14 @@ this.btnCancel = new System.Windows.Forms.Button(); this.cbSingle = new System.Windows.Forms.CheckBox(); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); + this.cbEncoding = new System.Windows.Forms.ComboBox(); ((System.ComponentModel.ISupportInitialize)(this.nudNewX)).BeginInit(); ((System.ComponentModel.ISupportInitialize)(this.nudNewY)).BeginInit(); this.SuspendLayout(); // // nudNewX // - this.nudNewX.Location = new System.Drawing.Point(74, 11); + this.nudNewX.Location = new System.Drawing.Point(74, 19); this.nudNewX.Maximum = new decimal(new int[] { 255, 0, @@ -66,7 +67,7 @@ // // nudNewY // - this.nudNewY.Location = new System.Drawing.Point(74, 37); + this.nudNewY.Location = new System.Drawing.Point(74, 45); this.nudNewY.Maximum = new decimal(new int[] { 255, 0, @@ -90,7 +91,7 @@ // label1 // this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(30, 13); + this.label1.Location = new System.Drawing.Point(30, 21); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(38, 13); this.label1.TabIndex = 2; @@ -100,7 +101,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(27, 39); + this.label2.Location = new System.Drawing.Point(27, 47); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 13); this.label2.TabIndex = 3; @@ -111,7 +112,7 @@ // this.rbMono.AutoSize = true; this.rbMono.Checked = true; - this.rbMono.Location = new System.Drawing.Point(30, 63); + this.rbMono.Location = new System.Drawing.Point(30, 71); this.rbMono.Name = "rbMono"; this.rbMono.Size = new System.Drawing.Size(81, 17); this.rbMono.TabIndex = 4; @@ -122,7 +123,7 @@ // rbVar // this.rbVar.AutoSize = true; - this.rbVar.Location = new System.Drawing.Point(30, 86); + this.rbVar.Location = new System.Drawing.Point(30, 94); this.rbVar.Name = "rbVar"; this.rbVar.Size = new System.Drawing.Size(91, 17); this.rbVar.TabIndex = 5; @@ -132,7 +133,7 @@ // cbNotPrintable // this.cbNotPrintable.AutoSize = true; - this.cbNotPrintable.Location = new System.Drawing.Point(146, 38); + this.cbNotPrintable.Location = new System.Drawing.Point(146, 35); this.cbNotPrintable.Name = "cbNotPrintable"; this.cbNotPrintable.Size = new System.Drawing.Size(116, 17); this.cbNotPrintable.TabIndex = 7; @@ -144,7 +145,7 @@ this.cbLatin.AutoSize = true; this.cbLatin.Checked = true; this.cbLatin.CheckState = System.Windows.Forms.CheckState.Checked; - this.cbLatin.Location = new System.Drawing.Point(146, 61); + this.cbLatin.Location = new System.Drawing.Point(146, 58); this.cbLatin.Name = "cbLatin"; this.cbLatin.Size = new System.Drawing.Size(91, 17); this.cbLatin.TabIndex = 8; @@ -154,16 +155,17 @@ // cbExtended // this.cbExtended.AutoSize = true; - this.cbExtended.Location = new System.Drawing.Point(146, 84); + this.cbExtended.Location = new System.Drawing.Point(146, 81); this.cbExtended.Name = "cbExtended"; this.cbExtended.Size = new System.Drawing.Size(119, 17); this.cbExtended.TabIndex = 9; this.cbExtended.Text = "128-255 (Extended)"; this.cbExtended.UseVisualStyleBackColor = true; + this.cbExtended.CheckedChanged += new System.EventHandler(this.cbExtended_CheckedChanged); // // btnOK // - this.btnOK.Location = new System.Drawing.Point(56, 121); + this.btnOK.Location = new System.Drawing.Point(56, 143); this.btnOK.Name = "btnOK"; this.btnOK.Size = new System.Drawing.Size(75, 23); this.btnOK.TabIndex = 10; @@ -173,7 +175,8 @@ // // btnCancel // - this.btnCancel.Location = new System.Drawing.Point(165, 121); + this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.btnCancel.Location = new System.Drawing.Point(165, 143); this.btnCancel.Name = "btnCancel"; this.btnCancel.Size = new System.Drawing.Size(75, 23); this.btnCancel.TabIndex = 11; @@ -184,7 +187,7 @@ // cbSingle // this.cbSingle.AutoSize = true; - this.cbSingle.Location = new System.Drawing.Point(146, 15); + this.cbSingle.Location = new System.Drawing.Point(146, 12); this.cbSingle.Name = "cbSingle"; this.cbSingle.Size = new System.Drawing.Size(84, 17); this.cbSingle.TabIndex = 12; @@ -199,12 +202,23 @@ this.toolTip1.ReshowDelay = 100; this.toolTip1.ToolTipTitle = "Info"; // + // cbEncoding + // + this.cbEncoding.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.cbEncoding.Enabled = false; + this.cbEncoding.FormattingEnabled = true; + this.cbEncoding.Location = new System.Drawing.Point(146, 104); + this.cbEncoding.Name = "cbEncoding"; + this.cbEncoding.Size = new System.Drawing.Size(121, 21); + this.cbEncoding.TabIndex = 13; + // // New // this.AcceptButton = this.btnOK; this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None; this.CancelButton = this.btnCancel; - this.ClientSize = new System.Drawing.Size(284, 161); + this.ClientSize = new System.Drawing.Size(284, 181); + this.Controls.Add(this.cbEncoding); this.Controls.Add(this.cbSingle); this.Controls.Add(this.btnCancel); this.Controls.Add(this.btnOK); @@ -219,9 +233,9 @@ this.Controls.Add(this.nudNewX); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog; this.MaximizeBox = false; - this.MaximumSize = new System.Drawing.Size(300, 200); + this.MaximumSize = new System.Drawing.Size(300, 220); this.MinimizeBox = false; - this.MinimumSize = new System.Drawing.Size(300, 200); + this.MinimumSize = new System.Drawing.Size(300, 220); this.Name = "New"; this.ShowIcon = false; this.ShowInTaskbar = false; @@ -250,5 +264,6 @@ private System.Windows.Forms.Button btnCancel; public System.Windows.Forms.CheckBox cbSingle; private System.Windows.Forms.ToolTip toolTip1; + public System.Windows.Forms.ComboBox cbEncoding; } } \ No newline at end of file diff --git a/McBitFont/New.cs b/McBitFont/New.cs index ea55cb0..674982f 100644 --- a/McBitFont/New.cs +++ b/McBitFont/New.cs @@ -10,6 +10,22 @@ using System.Windows.Forms; namespace McBitFont { public partial class New : Form { + + public class EncodingItem { + public string Text { get; set; } + public int Code { get; set; } + + public EncodingItem(int code, string text) { + Code = code; + Text = text; + } + + public override string ToString() { + return Text; + } + } + + public New() { InitializeComponent(); } @@ -32,6 +48,17 @@ namespace McBitFont { toolTip1.SetToolTip(cbNotPrintable, "Add not printable characters with codes 0 - 31"); toolTip1.SetToolTip(cbLatin, "Add Latin characters with codes 32 - 127"); toolTip1.SetToolTip(cbExtended, "Add Extended characters with codes 128 - 255"); + + cbEncoding.Items.Clear(); + cbEncoding.Items.Add(new EncodingItem(1250, "Central European")); + cbEncoding.Items.Add(new EncodingItem(1251, "Cyrillic")); + cbEncoding.Items.Add(new EncodingItem(1252, "Western European")); + cbEncoding.Items.Add(new EncodingItem(1253, "Greek")); + cbEncoding.Items.Add(new EncodingItem(1254, "Turkish")); + cbEncoding.Items.Add(new EncodingItem(1255, "Hebrew")); + cbEncoding.Items.Add(new EncodingItem(1256, "Arabic")); + cbEncoding.Items.Add(new EncodingItem(1257, "Baltic")); + cbEncoding.SelectedIndex = 1; } private void btnCancel_Click(object sender, EventArgs e) { @@ -47,5 +74,9 @@ namespace McBitFont { nud.Select(0, nud.Text.Length); } + + private void cbExtended_CheckedChanged(object sender, EventArgs e) { + cbEncoding.Enabled = cbExtended.Checked; + } } }