WIP: Packed fonts...

This commit is contained in:
Anton Mukhin
2025-05-20 17:08:42 +03:00
parent ca42d3819f
commit 5e55c0a5ea
5 changed files with 333 additions and 306 deletions

View File

@@ -23,331 +23,337 @@
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent() {
this.components = new System.ComponentModel.Container();
this.txtOutput = new System.Windows.Forms.RichTextBox();
this.gbScan = new System.Windows.Forms.GroupBox();
this.cbVDir = new System.Windows.Forms.ComboBox();
this.cbHDir = new System.Windows.Forms.ComboBox();
this.cbOrder = new System.Windows.Forms.ComboBox();
this.gbOptions = new System.Windows.Forms.GroupBox();
this.cbZeroes = new System.Windows.Forms.CheckBox();
this.cbHeader = new System.Windows.Forms.CheckBox();
this.cbComments = new System.Windows.Forms.CheckBox();
this.gbNumbers = new System.Windows.Forms.GroupBox();
this.cbBitOrder = new System.Windows.Forms.ComboBox();
this.cbNumSize = new System.Windows.Forms.ComboBox();
this.cbNumBase = new System.Windows.Forms.ComboBox();
this.gbText = new System.Windows.Forms.GroupBox();
this.lblXLines = new System.Windows.Forms.Label();
this.nudXLines = new System.Windows.Forms.NumericUpDown();
this.cbLines = new System.Windows.Forms.ComboBox();
this.cbFormat = new System.Windows.Forms.ComboBox();
this.btnGenerate = new System.Windows.Forms.Button();
this.btnClose = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.gbScan.SuspendLayout();
this.gbOptions.SuspendLayout();
this.gbNumbers.SuspendLayout();
this.gbText.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).BeginInit();
this.SuspendLayout();
components = new System.ComponentModel.Container();
txtOutput = new System.Windows.Forms.RichTextBox();
gbScan = new System.Windows.Forms.GroupBox();
cbVDir = new System.Windows.Forms.ComboBox();
cbHDir = new System.Windows.Forms.ComboBox();
cbOrder = new System.Windows.Forms.ComboBox();
gbOptions = new System.Windows.Forms.GroupBox();
cbPacked = new System.Windows.Forms.CheckBox();
cbZeroes = new System.Windows.Forms.CheckBox();
cbHeader = new System.Windows.Forms.CheckBox();
cbComments = new System.Windows.Forms.CheckBox();
gbNumbers = new System.Windows.Forms.GroupBox();
cbBitOrder = new System.Windows.Forms.ComboBox();
cbNumSize = new System.Windows.Forms.ComboBox();
cbNumBase = new System.Windows.Forms.ComboBox();
gbText = new System.Windows.Forms.GroupBox();
lblXLines = new System.Windows.Forms.Label();
nudXLines = new System.Windows.Forms.NumericUpDown();
cbLines = new System.Windows.Forms.ComboBox();
cbFormat = new System.Windows.Forms.ComboBox();
btnGenerate = new System.Windows.Forms.Button();
btnClose = new System.Windows.Forms.Button();
toolTip1 = new System.Windows.Forms.ToolTip(components);
gbScan.SuspendLayout();
gbOptions.SuspendLayout();
gbNumbers.SuspendLayout();
gbText.SuspendLayout();
((System.ComponentModel.ISupportInitialize)nudXLines).BeginInit();
SuspendLayout();
//
// txtOutput
//
this.txtOutput.AcceptsTab = true;
this.txtOutput.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.txtOutput.AutoWordSelection = true;
this.txtOutput.DetectUrls = false;
this.txtOutput.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204)));
this.txtOutput.HideSelection = false;
this.txtOutput.Location = new System.Drawing.Point(151, 12);
this.txtOutput.Name = "txtOutput";
this.txtOutput.Size = new System.Drawing.Size(529, 507);
this.txtOutput.TabIndex = 0;
this.txtOutput.Text = "";
this.txtOutput.WordWrap = false;
txtOutput.AcceptsTab = true;
txtOutput.Anchor = System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
txtOutput.AutoWordSelection = true;
txtOutput.DetectUrls = false;
txtOutput.Font = new System.Drawing.Font("Courier New", 9.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, 204);
txtOutput.HideSelection = false;
txtOutput.Location = new System.Drawing.Point(176, 14);
txtOutput.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
txtOutput.Name = "txtOutput";
txtOutput.Size = new System.Drawing.Size(616, 584);
txtOutput.TabIndex = 0;
txtOutput.Text = "";
txtOutput.WordWrap = false;
//
// gbScan
//
this.gbScan.Controls.Add(this.cbVDir);
this.gbScan.Controls.Add(this.cbHDir);
this.gbScan.Controls.Add(this.cbOrder);
this.gbScan.Location = new System.Drawing.Point(5, 12);
this.gbScan.Name = "gbScan";
this.gbScan.Size = new System.Drawing.Size(140, 105);
this.gbScan.TabIndex = 1;
this.gbScan.TabStop = false;
this.gbScan.Text = "Scan";
gbScan.Controls.Add(cbVDir);
gbScan.Controls.Add(cbHDir);
gbScan.Controls.Add(cbOrder);
gbScan.Location = new System.Drawing.Point(6, 14);
gbScan.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbScan.Name = "gbScan";
gbScan.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbScan.Size = new System.Drawing.Size(163, 121);
gbScan.TabIndex = 1;
gbScan.TabStop = false;
gbScan.Text = "Scan";
//
// cbVDir
//
this.cbVDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbVDir.FormattingEnabled = true;
this.cbVDir.Items.AddRange(new object[] {
"Top to Bottom",
"Bottom to Top"});
this.cbVDir.Location = new System.Drawing.Point(10, 73);
this.cbVDir.Name = "cbVDir";
this.cbVDir.Size = new System.Drawing.Size(121, 21);
this.cbVDir.TabIndex = 2;
cbVDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbVDir.FormattingEnabled = true;
cbVDir.Items.AddRange(new object[] { "Top to Bottom", "Bottom to Top" });
cbVDir.Location = new System.Drawing.Point(12, 84);
cbVDir.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbVDir.Name = "cbVDir";
cbVDir.Size = new System.Drawing.Size(140, 23);
cbVDir.TabIndex = 2;
//
// cbHDir
//
this.cbHDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbHDir.FormattingEnabled = true;
this.cbHDir.Items.AddRange(new object[] {
"Left to Right",
"Right to Left"});
this.cbHDir.Location = new System.Drawing.Point(10, 46);
this.cbHDir.Name = "cbHDir";
this.cbHDir.Size = new System.Drawing.Size(121, 21);
this.cbHDir.TabIndex = 1;
cbHDir.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbHDir.FormattingEnabled = true;
cbHDir.Items.AddRange(new object[] { "Left to Right", "Right to Left" });
cbHDir.Location = new System.Drawing.Point(12, 53);
cbHDir.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbHDir.Name = "cbHDir";
cbHDir.Size = new System.Drawing.Size(140, 23);
cbHDir.TabIndex = 1;
//
// cbOrder
//
this.cbOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbOrder.FormattingEnabled = true;
this.cbOrder.Items.AddRange(new object[] {
"Columns",
"Rows"});
this.cbOrder.Location = new System.Drawing.Point(10, 19);
this.cbOrder.Name = "cbOrder";
this.cbOrder.Size = new System.Drawing.Size(121, 21);
this.cbOrder.TabIndex = 0;
this.cbOrder.SelectedIndexChanged += new System.EventHandler(this.cbOrder_SelectedIndexChanged);
cbOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbOrder.FormattingEnabled = true;
cbOrder.Items.AddRange(new object[] { "Columns", "Rows" });
cbOrder.Location = new System.Drawing.Point(12, 22);
cbOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbOrder.Name = "cbOrder";
cbOrder.Size = new System.Drawing.Size(140, 23);
cbOrder.TabIndex = 0;
cbOrder.SelectedIndexChanged += cbOrder_SelectedIndexChanged;
//
// gbOptions
//
this.gbOptions.Controls.Add(this.cbZeroes);
this.gbOptions.Controls.Add(this.cbHeader);
this.gbOptions.Controls.Add(this.cbComments);
this.gbOptions.Location = new System.Drawing.Point(5, 345);
this.gbOptions.Name = "gbOptions";
this.gbOptions.Size = new System.Drawing.Size(140, 88);
this.gbOptions.TabIndex = 3;
this.gbOptions.TabStop = false;
this.gbOptions.Text = "Options";
gbOptions.Controls.Add(cbPacked);
gbOptions.Controls.Add(cbZeroes);
gbOptions.Controls.Add(cbHeader);
gbOptions.Controls.Add(cbComments);
gbOptions.Location = new System.Drawing.Point(6, 398);
gbOptions.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbOptions.Name = "gbOptions";
gbOptions.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbOptions.Size = new System.Drawing.Size(163, 116);
gbOptions.TabIndex = 3;
gbOptions.TabStop = false;
gbOptions.Text = "Options";
//
// cbPacked
//
cbPacked.AutoSize = true;
cbPacked.Location = new System.Drawing.Point(7, 90);
cbPacked.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbPacked.Name = "cbPacked";
cbPacked.Size = new System.Drawing.Size(89, 19);
cbPacked.TabIndex = 3;
cbPacked.Text = "Packed font";
toolTip1.SetToolTip(cbPacked, "Pack symbols utilizing all bits within a symbol");
cbPacked.UseVisualStyleBackColor = true;
cbPacked.CheckedChanged += cbPacked_CheckedChanged;
//
// cbZeroes
//
this.cbZeroes.AutoSize = true;
this.cbZeroes.Checked = true;
this.cbZeroes.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbZeroes.Location = new System.Drawing.Point(6, 65);
this.cbZeroes.Name = "cbZeroes";
this.cbZeroes.Size = new System.Drawing.Size(98, 17);
this.cbZeroes.TabIndex = 2;
this.cbZeroes.Text = "Leading zeroes";
this.toolTip1.SetToolTip(this.cbZeroes, "Add leading zeroes: 0x01 / 0x1");
this.cbZeroes.UseVisualStyleBackColor = true;
cbZeroes.AutoSize = true;
cbZeroes.Checked = true;
cbZeroes.CheckState = System.Windows.Forms.CheckState.Checked;
cbZeroes.Location = new System.Drawing.Point(7, 66);
cbZeroes.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbZeroes.Name = "cbZeroes";
cbZeroes.Size = new System.Drawing.Size(104, 19);
cbZeroes.TabIndex = 2;
cbZeroes.Text = "Leading zeroes";
toolTip1.SetToolTip(cbZeroes, "Add leading zeroes: 0x01 / 0x1");
cbZeroes.UseVisualStyleBackColor = true;
//
// cbHeader
//
this.cbHeader.AutoSize = true;
this.cbHeader.Checked = true;
this.cbHeader.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbHeader.Location = new System.Drawing.Point(6, 19);
this.cbHeader.Name = "cbHeader";
this.cbHeader.Size = new System.Drawing.Size(86, 17);
this.cbHeader.TabIndex = 1;
this.cbHeader.Text = "Meta header";
this.toolTip1.SetToolTip(this.cbHeader, "Add meta header with meta data");
this.cbHeader.UseVisualStyleBackColor = true;
this.cbHeader.CheckedChanged += new System.EventHandler(this.cbFormat_SelectedIndexChanged);
cbHeader.AutoSize = true;
cbHeader.Checked = true;
cbHeader.CheckState = System.Windows.Forms.CheckState.Checked;
cbHeader.Location = new System.Drawing.Point(7, 18);
cbHeader.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbHeader.Name = "cbHeader";
cbHeader.Size = new System.Drawing.Size(92, 19);
cbHeader.TabIndex = 1;
cbHeader.Text = "Meta header";
toolTip1.SetToolTip(cbHeader, "Add meta header with meta data");
cbHeader.UseVisualStyleBackColor = true;
cbHeader.CheckedChanged += cbFormat_SelectedIndexChanged;
//
// cbComments
//
this.cbComments.AutoSize = true;
this.cbComments.Checked = true;
this.cbComments.CheckState = System.Windows.Forms.CheckState.Checked;
this.cbComments.Location = new System.Drawing.Point(6, 42);
this.cbComments.Name = "cbComments";
this.cbComments.Size = new System.Drawing.Size(75, 17);
this.cbComments.TabIndex = 0;
this.cbComments.Text = "Comments";
this.toolTip1.SetToolTip(this.cbComments, "Add descriptive comments");
this.cbComments.UseVisualStyleBackColor = true;
cbComments.AutoSize = true;
cbComments.Checked = true;
cbComments.CheckState = System.Windows.Forms.CheckState.Checked;
cbComments.Location = new System.Drawing.Point(7, 42);
cbComments.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbComments.Name = "cbComments";
cbComments.Size = new System.Drawing.Size(85, 19);
cbComments.TabIndex = 0;
cbComments.Text = "Comments";
toolTip1.SetToolTip(cbComments, "Add descriptive comments");
cbComments.UseVisualStyleBackColor = true;
//
// gbNumbers
//
this.gbNumbers.Controls.Add(this.cbBitOrder);
this.gbNumbers.Controls.Add(this.cbNumSize);
this.gbNumbers.Controls.Add(this.cbNumBase);
this.gbNumbers.Location = new System.Drawing.Point(5, 123);
this.gbNumbers.Name = "gbNumbers";
this.gbNumbers.Size = new System.Drawing.Size(140, 105);
this.gbNumbers.TabIndex = 4;
this.gbNumbers.TabStop = false;
this.gbNumbers.Text = "Numbers";
gbNumbers.Controls.Add(cbBitOrder);
gbNumbers.Controls.Add(cbNumSize);
gbNumbers.Controls.Add(cbNumBase);
gbNumbers.Location = new System.Drawing.Point(6, 142);
gbNumbers.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbNumbers.Name = "gbNumbers";
gbNumbers.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbNumbers.Size = new System.Drawing.Size(163, 121);
gbNumbers.TabIndex = 4;
gbNumbers.TabStop = false;
gbNumbers.Text = "Numbers";
//
// cbBitOrder
//
this.cbBitOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbBitOrder.FormattingEnabled = true;
this.cbBitOrder.Items.AddRange(new object[] {
"LSB Top",
"MSB Top"});
this.cbBitOrder.Location = new System.Drawing.Point(10, 19);
this.cbBitOrder.Name = "cbBitOrder";
this.cbBitOrder.Size = new System.Drawing.Size(121, 21);
this.cbBitOrder.TabIndex = 5;
cbBitOrder.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbBitOrder.FormattingEnabled = true;
cbBitOrder.Items.AddRange(new object[] { "LSB Top", "MSB Top" });
cbBitOrder.Location = new System.Drawing.Point(12, 22);
cbBitOrder.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbBitOrder.Name = "cbBitOrder";
cbBitOrder.Size = new System.Drawing.Size(140, 23);
cbBitOrder.TabIndex = 5;
//
// cbNumSize
//
this.cbNumSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNumSize.FormattingEnabled = true;
this.cbNumSize.Items.AddRange(new object[] {
"8 bit",
"16 bit",
"32 bit"});
this.cbNumSize.Location = new System.Drawing.Point(10, 73);
this.cbNumSize.Name = "cbNumSize";
this.cbNumSize.Size = new System.Drawing.Size(121, 21);
this.cbNumSize.TabIndex = 4;
cbNumSize.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbNumSize.FormattingEnabled = true;
cbNumSize.Items.AddRange(new object[] { "8 bit", "16 bit", "32 bit" });
cbNumSize.Location = new System.Drawing.Point(12, 84);
cbNumSize.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbNumSize.Name = "cbNumSize";
cbNumSize.Size = new System.Drawing.Size(140, 23);
cbNumSize.TabIndex = 4;
//
// cbNumBase
//
this.cbNumBase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbNumBase.FormattingEnabled = true;
this.cbNumBase.Items.AddRange(new object[] {
"Hexadecimal",
"Binary",
"Decimal"});
this.cbNumBase.Location = new System.Drawing.Point(10, 46);
this.cbNumBase.Name = "cbNumBase";
this.cbNumBase.Size = new System.Drawing.Size(121, 21);
this.cbNumBase.TabIndex = 3;
cbNumBase.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbNumBase.FormattingEnabled = true;
cbNumBase.Items.AddRange(new object[] { "Hexadecimal", "Binary", "Decimal" });
cbNumBase.Location = new System.Drawing.Point(12, 53);
cbNumBase.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbNumBase.Name = "cbNumBase";
cbNumBase.Size = new System.Drawing.Size(140, 23);
cbNumBase.TabIndex = 3;
//
// gbText
//
this.gbText.Controls.Add(this.lblXLines);
this.gbText.Controls.Add(this.nudXLines);
this.gbText.Controls.Add(this.cbLines);
this.gbText.Controls.Add(this.cbFormat);
this.gbText.Location = new System.Drawing.Point(5, 234);
this.gbText.Name = "gbText";
this.gbText.Size = new System.Drawing.Size(140, 105);
this.gbText.TabIndex = 5;
this.gbText.TabStop = false;
this.gbText.Text = "Text format";
gbText.Controls.Add(lblXLines);
gbText.Controls.Add(nudXLines);
gbText.Controls.Add(cbLines);
gbText.Controls.Add(cbFormat);
gbText.Location = new System.Drawing.Point(6, 270);
gbText.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbText.Name = "gbText";
gbText.Padding = new System.Windows.Forms.Padding(4, 3, 4, 3);
gbText.Size = new System.Drawing.Size(163, 121);
gbText.TabIndex = 5;
gbText.TabStop = false;
gbText.Text = "Text format";
//
// lblXLines
//
this.lblXLines.AutoSize = true;
this.lblXLines.Enabled = false;
this.lblXLines.Location = new System.Drawing.Point(10, 76);
this.lblXLines.Name = "lblXLines";
this.lblXLines.Size = new System.Drawing.Size(60, 13);
this.lblXLines.TabIndex = 9;
this.lblXLines.Text = "X numbers:";
lblXLines.AutoSize = true;
lblXLines.Enabled = false;
lblXLines.Location = new System.Drawing.Point(12, 88);
lblXLines.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0);
lblXLines.Name = "lblXLines";
lblXLines.Size = new System.Drawing.Size(67, 15);
lblXLines.TabIndex = 9;
lblXLines.Text = "X numbers:";
//
// nudXLines
//
this.nudXLines.Enabled = false;
this.nudXLines.Location = new System.Drawing.Point(76, 73);
this.nudXLines.Maximum = new decimal(new int[] {
64,
0,
0,
0});
this.nudXLines.Minimum = new decimal(new int[] {
1,
0,
0,
0});
this.nudXLines.Name = "nudXLines";
this.nudXLines.Size = new System.Drawing.Size(55, 20);
this.nudXLines.TabIndex = 8;
this.nudXLines.Value = new decimal(new int[] {
8,
0,
0,
0});
nudXLines.Enabled = false;
nudXLines.Location = new System.Drawing.Point(89, 84);
nudXLines.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
nudXLines.Maximum = new decimal(new int[] { 64, 0, 0, 0 });
nudXLines.Minimum = new decimal(new int[] { 1, 0, 0, 0 });
nudXLines.Name = "nudXLines";
nudXLines.Size = new System.Drawing.Size(64, 23);
nudXLines.TabIndex = 8;
nudXLines.Value = new decimal(new int[] { 8, 0, 0, 0 });
//
// cbLines
//
this.cbLines.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbLines.FormattingEnabled = true;
this.cbLines.Items.AddRange(new object[] {
"1 Column per line",
"1 Symbol per line",
"X Numbers per line"});
this.cbLines.Location = new System.Drawing.Point(10, 46);
this.cbLines.Name = "cbLines";
this.cbLines.Size = new System.Drawing.Size(121, 21);
this.cbLines.TabIndex = 7;
this.cbLines.SelectedIndexChanged += new System.EventHandler(this.cbLines_SelectedIndexChanged);
cbLines.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbLines.FormattingEnabled = true;
cbLines.Items.AddRange(new object[] { "1 Column per line", "1 Symbol per line", "X Numbers per line" });
cbLines.Location = new System.Drawing.Point(12, 53);
cbLines.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbLines.Name = "cbLines";
cbLines.Size = new System.Drawing.Size(140, 23);
cbLines.TabIndex = 7;
cbLines.SelectedIndexChanged += cbLines_SelectedIndexChanged;
//
// cbFormat
//
this.cbFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
this.cbFormat.FormattingEnabled = true;
this.cbFormat.Items.AddRange(new object[] {
"1D C array",
"2D C array",
"Comma separated"});
this.cbFormat.Location = new System.Drawing.Point(10, 19);
this.cbFormat.Name = "cbFormat";
this.cbFormat.Size = new System.Drawing.Size(121, 21);
this.cbFormat.TabIndex = 6;
this.cbFormat.SelectedIndexChanged += new System.EventHandler(this.cbFormat_SelectedIndexChanged);
cbFormat.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList;
cbFormat.FormattingEnabled = true;
cbFormat.Items.AddRange(new object[] { "1D C array", "2D C array", "Comma separated" });
cbFormat.Location = new System.Drawing.Point(12, 22);
cbFormat.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
cbFormat.Name = "cbFormat";
cbFormat.Size = new System.Drawing.Size(140, 23);
cbFormat.TabIndex = 6;
cbFormat.SelectedIndexChanged += cbFormat_SelectedIndexChanged;
//
// btnGenerate
//
this.btnGenerate.Location = new System.Drawing.Point(5, 439);
this.btnGenerate.Name = "btnGenerate";
this.btnGenerate.Size = new System.Drawing.Size(140, 30);
this.btnGenerate.TabIndex = 6;
this.btnGenerate.Text = "Generate";
this.btnGenerate.UseVisualStyleBackColor = true;
this.btnGenerate.Click += new System.EventHandler(this.btnGenerate_Click);
btnGenerate.Location = new System.Drawing.Point(6, 520);
btnGenerate.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnGenerate.Name = "btnGenerate";
btnGenerate.Size = new System.Drawing.Size(163, 35);
btnGenerate.TabIndex = 6;
btnGenerate.Text = "Generate";
btnGenerate.UseVisualStyleBackColor = true;
btnGenerate.Click += btnGenerate_Click;
//
// btnClose
//
this.btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
this.btnClose.Location = new System.Drawing.Point(5, 487);
this.btnClose.Name = "btnClose";
this.btnClose.Size = new System.Drawing.Size(140, 30);
this.btnClose.TabIndex = 7;
this.btnClose.Text = "Close";
this.btnClose.UseVisualStyleBackColor = true;
btnClose.DialogResult = System.Windows.Forms.DialogResult.Cancel;
btnClose.Location = new System.Drawing.Point(6, 562);
btnClose.Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
btnClose.Name = "btnClose";
btnClose.Size = new System.Drawing.Size(163, 35);
btnClose.TabIndex = 7;
btnClose.Text = "Close";
btnClose.UseVisualStyleBackColor = true;
//
// toolTip1
//
this.toolTip1.AutoPopDelay = 10000;
this.toolTip1.InitialDelay = 500;
this.toolTip1.ReshowDelay = 100;
toolTip1.AutoPopDelay = 10000;
toolTip1.InitialDelay = 500;
toolTip1.ReshowDelay = 100;
//
// Export
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.CancelButton = this.btnClose;
this.ClientSize = new System.Drawing.Size(692, 531);
this.Controls.Add(this.btnClose);
this.Controls.Add(this.btnGenerate);
this.Controls.Add(this.gbText);
this.Controls.Add(this.gbNumbers);
this.Controls.Add(this.gbOptions);
this.Controls.Add(this.gbScan);
this.Controls.Add(this.txtOutput);
this.MinimumSize = new System.Drawing.Size(700, 570);
this.Name = "Export";
this.ShowIcon = false;
this.ShowInTaskbar = false;
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
this.Text = "Export";
this.Load += new System.EventHandler(this.Export_Load);
this.gbScan.ResumeLayout(false);
this.gbOptions.ResumeLayout(false);
this.gbOptions.PerformLayout();
this.gbNumbers.ResumeLayout(false);
this.gbText.ResumeLayout(false);
this.gbText.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.nudXLines)).EndInit();
this.ResumeLayout(false);
AutoScaleDimensions = new System.Drawing.SizeF(7F, 15F);
AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
CancelButton = btnClose;
ClientSize = new System.Drawing.Size(807, 613);
Controls.Add(btnClose);
Controls.Add(btnGenerate);
Controls.Add(gbText);
Controls.Add(gbNumbers);
Controls.Add(gbOptions);
Controls.Add(gbScan);
Controls.Add(txtOutput);
Margin = new System.Windows.Forms.Padding(4, 3, 4, 3);
MinimumSize = new System.Drawing.Size(814, 652);
Name = "Export";
ShowIcon = false;
ShowInTaskbar = false;
StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
Text = "Export";
Load += Export_Load;
gbScan.ResumeLayout(false);
gbOptions.ResumeLayout(false);
gbOptions.PerformLayout();
gbNumbers.ResumeLayout(false);
gbText.ResumeLayout(false);
gbText.PerformLayout();
((System.ComponentModel.ISupportInitialize)nudXLines).EndInit();
ResumeLayout(false);
}
@@ -374,5 +380,6 @@
private System.Windows.Forms.Button btnClose;
private System.Windows.Forms.CheckBox cbZeroes;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.CheckBox cbPacked;
}
}

View File

@@ -79,6 +79,7 @@ namespace McBitFont {
txtOutput.Clear();
bool com = cbComments.Checked;
bool hdr = cbHeader.Checked;
bool packed = cbPacked.Checked;
int lines = cbLines.SelectedIndex;
int format = cbFormat.SelectedIndex;
bool mono = mainForm.monospaced;
@@ -156,7 +157,7 @@ namespace McBitFont {
}
}
// C data type selection
ushort bits = 8;
string dataType = "uint8_t";
switch (cbNumSize.SelectedIndex) {
@@ -197,9 +198,10 @@ namespace McBitFont {
}
// Array definition
if ( format == 0 || format == 1 ) output += "const " + dataType + " " + mainForm.prjName + "[]" + (format==1?"[]":"") + " = {\n";
if (format == 0 || format == 1) output += "const " + dataType + " " + mainForm.prjName + "[]" + (format == 1 ? "[]" : "") + " = {\n";
// Should we add the meta header?
// TODO: PACKED FONT FLAG!!!! ==================================
if (hdr) {
output +=
" // Meta header\n" +
@@ -220,7 +222,7 @@ namespace McBitFont {
if (com) output += " // Data:\n";
MainForm.FrameMiniature flast = mainForm.frames.Last();
foreach ( MainForm.FrameMiniature f in mainForm.frames) {
foreach (MainForm.FrameMiniature f in mainForm.frames) {
// For each frame
uint b = 0; // current number bits
int t, x, y; // t - calculated bit number; x - actual x; y - actual y
@@ -289,6 +291,7 @@ namespace McBitFont {
}
}
t = jdir < 0 ? bits+1 : -1;
for (int i = imin; i != imax; i += idir) {
if (lines == 0) {
// "Column/Row per line" - new line offset
@@ -296,8 +299,13 @@ namespace McBitFont {
numcount = 0;
}
for (int j = jmin; j != jmax; j += jdir) {
if (packed) {
t += jdir;
if (t < 0 || t % bits == 0) t = jdir < 0 ? bits : 0;
} else {
if (jdir < 0) t = jmin - j;
else t = j;
}
if (t % bits == 0) b = 0;
if (cbOrder.SelectedIndex == 0) { // Columns
@@ -316,7 +324,7 @@ namespace McBitFont {
}
}
if (((t + 1) % bits == 0) || j + jdir == jmax) {
if (((t + 1) % bits == 0) || (j + jdir == jmax && !packed)) {
// we have filled a number with bits - let's post it
// should we post a comma before the number?
@@ -337,9 +345,19 @@ namespace McBitFont {
}
if (lines == 0) {
// "Column/Row per line" - closing line
output += cbracket + ((i+idir==imax) && f.Equals(flast) ? "" : ",") + "\n";
output += cbracket + ((i + idir == imax) && f.Equals(flast) ? "" : ",") + "\n";
}
}
if (packed && (f.width * f.height / 8) % bits > 0) {
// post leftovers in last byte
// should we post a prefix to the number?
pref = (!cbZeroes.Checked && ((b < 10 && nbase == 16) || (b < 2 && nbase == 2))) ? "" : prefix;
output += ", " + pref + Convert.ToString(b, nbase).PadLeft(pad, '0');
// count posted numbers
numcount++;
}
if (lines == 1) {
// "1 symbol per line" - closing line
if (!f.Equals(flast) && f.width > 0) output += ",";
@@ -390,5 +408,10 @@ namespace McBitFont {
lblXLines.Enabled = false;
}
}
private void cbPacked_CheckedChanged(object sender, EventArgs e) {
cbLines.Enabled = !cbPacked.Checked;
if (cbPacked.Checked) cbLines.SelectedIndex = 1;
}
}
}

View File

@@ -120,7 +120,4 @@
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
<metadata name="toolTip1.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>17, 17</value>
</metadata>
</root>

Binary file not shown.

Binary file not shown.