diff --git a/McBitFont/Export.Designer.cs b/McBitFont/Export.Designer.cs new file mode 100644 index 0000000..cb1d426 --- /dev/null +++ b/McBitFont/Export.Designer.cs @@ -0,0 +1,348 @@ +namespace McBitFont { + partial class Export { + /// + /// Required designer variable. + /// + private System.ComponentModel.IContainer components = null; + + /// + /// Clean up any resources being used. + /// + /// true if managed resources should be disposed; otherwise, false. + protected override void Dispose(bool disposing) { + if (disposing && (components != null)) { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows Form Designer generated code + + /// + /// Required method for Designer support - do not modify + /// the contents of this method with the code editor. + /// + private void InitializeComponent() { + this.txtOutput = new System.Windows.Forms.RichTextBox(); + this.gbScan = new System.Windows.Forms.GroupBox(); + this.gbOptions = new System.Windows.Forms.GroupBox(); + this.cbComments = new System.Windows.Forms.CheckBox(); + this.cbHeader = new System.Windows.Forms.CheckBox(); + this.cbOrder = new System.Windows.Forms.ComboBox(); + this.cbHDir = new System.Windows.Forms.ComboBox(); + this.cbVDir = new System.Windows.Forms.ComboBox(); + this.gbNumbers = new System.Windows.Forms.GroupBox(); + this.cbNumBase = new System.Windows.Forms.ComboBox(); + this.cbNumSize = new System.Windows.Forms.ComboBox(); + this.cbBitOrder = new System.Windows.Forms.ComboBox(); + this.gbText = new System.Windows.Forms.GroupBox(); + this.cbFormat = new System.Windows.Forms.ComboBox(); + this.cbLines = new System.Windows.Forms.ComboBox(); + this.numericUpDown1 = new System.Windows.Forms.NumericUpDown(); + this.label1 = new System.Windows.Forms.Label(); + this.btnGenerate = new System.Windows.Forms.Button(); + this.btnClose = new System.Windows.Forms.Button(); + this.gbScan.SuspendLayout(); + this.gbOptions.SuspendLayout(); + this.gbNumbers.SuspendLayout(); + this.gbText.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.numericUpDown1)).BeginInit(); + this.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("Lucida Console", 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.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; + this.txtOutput.Size = new System.Drawing.Size(529, 482); + this.txtOutput.TabIndex = 0; + this.txtOutput.Text = "// Comment.\nusing System;\n\npublic class Stuff : Form { \n public static void Main(" + + "String args) {\n }\n}\n\n\nTest\n123123\nCode code code\n\nAAAsdasdasd\n!"; + // + // 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"; + // + // gbOptions + // + 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, 65); + this.gbOptions.TabIndex = 3; + this.gbOptions.TabStop = false; + this.gbOptions.Text = "Options"; + // + // 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.cbComments.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.cbHeader.UseVisualStyleBackColor = true; + // + // 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); + // + // 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; + // + // 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; + // + // 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"; + // + // 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; + // + // 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; + // + // 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; + // + // gbText + // + this.gbText.Controls.Add(this.label1); + this.gbText.Controls.Add(this.numericUpDown1); + 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"; + // + // 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; + // + // 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; + // + // numericUpDown1 + // + this.numericUpDown1.Enabled = false; + this.numericUpDown1.Location = new System.Drawing.Point(76, 73); + this.numericUpDown1.Maximum = new decimal(new int[] { + 64, + 0, + 0, + 0}); + this.numericUpDown1.Minimum = new decimal(new int[] { + 1, + 0, + 0, + 0}); + this.numericUpDown1.Name = "numericUpDown1"; + this.numericUpDown1.Size = new System.Drawing.Size(55, 20); + this.numericUpDown1.TabIndex = 8; + this.numericUpDown1.Value = new decimal(new int[] { + 8, + 0, + 0, + 0}); + // + // label1 + // + this.label1.AutoSize = true; + this.label1.Enabled = false; + this.label1.Location = new System.Drawing.Point(10, 76); + this.label1.Name = "label1"; + this.label1.Size = new System.Drawing.Size(60, 13); + this.label1.TabIndex = 9; + this.label1.Text = "X numbers:"; + // + // btnGenerate + // + this.btnGenerate.Location = new System.Drawing.Point(5, 416); + 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); + // + // btnClose + // + this.btnClose.Location = new System.Drawing.Point(5, 464); + 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; + // + // 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, 506); + 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, 545); + 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.numericUpDown1)).EndInit(); + this.ResumeLayout(false); + + } + + #endregion + + private System.Windows.Forms.RichTextBox txtOutput; + private System.Windows.Forms.GroupBox gbScan; + private System.Windows.Forms.ComboBox cbVDir; + private System.Windows.Forms.ComboBox cbHDir; + private System.Windows.Forms.ComboBox cbOrder; + private System.Windows.Forms.GroupBox gbOptions; + private System.Windows.Forms.CheckBox cbHeader; + private System.Windows.Forms.CheckBox cbComments; + private System.Windows.Forms.GroupBox gbNumbers; + private System.Windows.Forms.ComboBox cbBitOrder; + private System.Windows.Forms.ComboBox cbNumSize; + private System.Windows.Forms.ComboBox cbNumBase; + private System.Windows.Forms.GroupBox gbText; + private System.Windows.Forms.Label label1; + private System.Windows.Forms.NumericUpDown numericUpDown1; + private System.Windows.Forms.ComboBox cbLines; + private System.Windows.Forms.ComboBox cbFormat; + private System.Windows.Forms.Button btnGenerate; + private System.Windows.Forms.Button btnClose; + } +} \ No newline at end of file diff --git a/McBitFont/Export.cs b/McBitFont/Export.cs new file mode 100644 index 0000000..56d161b --- /dev/null +++ b/McBitFont/Export.cs @@ -0,0 +1,89 @@ +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Data; +using System.Drawing; +using System.Linq; +using System.Text; +using System.Text.RegularExpressions; +using System.Threading.Tasks; +using System.Windows.Forms; + +namespace McBitFont { + public partial class Export : Form { + public Export() { + InitializeComponent(); + } + + private void Export_Load(object sender, EventArgs e) { + var groupBoxes = Controls.OfType(); + foreach (var gb in groupBoxes) { + var comboBoxes = gb.Controls.OfType(); + foreach (var cb in comboBoxes) { + cb.SelectedIndex = 0; + } + } + } + + private void cbOrder_SelectedIndexChanged(object sender, EventArgs e) { + switch (cbOrder.SelectedIndex) { + case 0: // Columns + cbBitOrder.Items[0] = "LSB Top"; + cbBitOrder.Items[1] = "MSB Top"; + cbLines.Items[0] = "1 Column per line"; + break; + case 1: // Rows + cbBitOrder.Items[0] = "LSB Left"; + cbBitOrder.Items[1] = "MSB Left"; + cbLines.Items[0] = "1 Row per line"; + break; + } + } + + void ParseLine(string line) { + Regex r = new Regex("([ \\t{}():;])"); + string[] tokens = r.Split(line); + + foreach (string token in tokens) { + // Set the tokens default color and font. + txtOutput.SelectionColor = Color.Black; + txtOutput.SelectionFont = new Font("Lucida Console", (float)9.75, FontStyle.Regular); + + // Check for a comment. + if (token == "//" || token.StartsWith("//")) { + // Find the start of the comment and then extract the whole comment. + int index = line.IndexOf("//"); + string comment = line.Substring(index, line.Length - index); + txtOutput.SelectionColor = Color.Green; + txtOutput.SelectionFont = new Font("Lucida Console", (float)9.75, FontStyle.Italic); + txtOutput.SelectedText = comment; + break; + } + + // Check whether the token is a keyword. + string[] keywords = { "public", "void", "using", "static", "class", "array", "char", "uint8_t", "uint16_t", "uint32_t", "byte" }; + for (int i = 0; i < keywords.Length; i++) { + if (keywords[i] == token) { + // Apply alternative color and font to highlight keyword. + txtOutput.SelectionColor = Color.Blue; + txtOutput.SelectionFont = new Font("Lucida Console", (float)9.75, FontStyle.Bold); + break; + } + } + txtOutput.SelectedText = token; + } + txtOutput.SelectedText = "\n"; + } + + void ParseText() { + foreach (string l in txtOutput.Lines) { + ParseLine(l); + } + } + + private void btnGenerate_Click(object sender, EventArgs e) { + txtOutput.SelectAll(); + ParseText(); + } + } +} diff --git a/McBitFont/Export.resx b/McBitFont/Export.resx new file mode 100644 index 0000000..1af7de1 --- /dev/null +++ b/McBitFont/Export.resx @@ -0,0 +1,120 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + \ No newline at end of file diff --git a/McBitFont/Form1.Designer.cs b/McBitFont/Form1.Designer.cs index ddcb209..305c63e 100644 --- a/McBitFont/Form1.Designer.cs +++ b/McBitFont/Form1.Designer.cs @@ -24,12 +24,13 @@ /// private void InitializeComponent() { this.components = new System.ComponentModel.Container(); + System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainForm)); this.dotPanel = new System.Windows.Forms.Panel(); this.nudX = new System.Windows.Forms.NumericUpDown(); this.nudY = new System.Windows.Forms.NumericUpDown(); this.label1 = new System.Windows.Forms.Label(); this.label2 = new System.Windows.Forms.Label(); - this.label3 = new System.Windows.Forms.Label(); + this.lblType = new System.Windows.Forms.Label(); this.cbZoom = new System.Windows.Forms.ComboBox(); this.label4 = new System.Windows.Forms.Label(); this.panel1 = new System.Windows.Forms.Panel(); @@ -40,11 +41,10 @@ this.btnShiftUp = new System.Windows.Forms.Button(); this.btnShiftRight = new System.Windows.Forms.Button(); this.btnShiftLeft = new System.Windows.Forms.Button(); - this.button1 = new System.Windows.Forms.Button(); - this.outBox = new System.Windows.Forms.TextBox(); + this.btnExport = new System.Windows.Forms.Button(); this.miniList = new System.Windows.Forms.ListView(); this.ilMiniatures = new System.Windows.Forms.ImageList(this.components); - this.button2 = new System.Windows.Forms.Button(); + this.btnApply = new System.Windows.Forms.Button(); this.hScroll = new System.Windows.Forms.HScrollBar(); this.vScroll = new System.Windows.Forms.VScrollBar(); this.label5 = new System.Windows.Forms.Label(); @@ -83,7 +83,7 @@ this.dotPanel.BackColor = System.Drawing.SystemColors.ControlDark; this.dotPanel.Location = new System.Drawing.Point(12, 27); this.dotPanel.Name = "dotPanel"; - this.dotPanel.Size = new System.Drawing.Size(482, 503); + this.dotPanel.Size = new System.Drawing.Size(389, 498); this.dotPanel.TabIndex = 0; this.dotPanel.Paint += new System.Windows.Forms.PaintEventHandler(this.dotPanel_Paint); this.dotPanel.MouseDown += new System.Windows.Forms.MouseEventHandler(this.dotPanel_MouseMove); @@ -93,7 +93,7 @@ // nudX // this.nudX.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.nudX.Location = new System.Drawing.Point(810, 27); + this.nudX.Location = new System.Drawing.Point(717, 27); this.nudX.Maximum = new decimal(new int[] { 255, 0, @@ -117,7 +117,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(810, 53); + this.nudY.Location = new System.Drawing.Point(717, 53); this.nudY.Maximum = new decimal(new int[] { 255, 0, @@ -142,7 +142,7 @@ // this.label1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(766, 29); + this.label1.Location = new System.Drawing.Point(673, 29); this.label1.Name = "label1"; this.label1.Size = new System.Drawing.Size(38, 13); this.label1.TabIndex = 3; @@ -152,21 +152,21 @@ // 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(763, 55); + this.label2.Location = new System.Drawing.Point(670, 55); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(41, 13); this.label2.TabIndex = 4; this.label2.Text = "Height:"; // - // label3 + // lblType // - this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(682, 76); - this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(35, 13); - this.label3.TabIndex = 0; - this.label3.Text = "label3"; + this.lblType.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); + this.lblType.Location = new System.Drawing.Point(554, 138); + this.lblType.Name = "lblType"; + this.lblType.Size = new System.Drawing.Size(217, 13); + this.lblType.TabIndex = 0; + this.lblType.Text = "Monospaced"; + this.lblType.TextAlign = System.Drawing.ContentAlignment.TopRight; // // cbZoom // @@ -186,7 +186,7 @@ "40", "45", "50"}); - this.cbZoom.Location = new System.Drawing.Point(686, 50); + this.cbZoom.Location = new System.Drawing.Point(605, 45); this.cbZoom.Name = "cbZoom"; this.cbZoom.Size = new System.Drawing.Size(59, 21); this.cbZoom.TabIndex = 6; @@ -197,7 +197,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(683, 34); + this.label4.Location = new System.Drawing.Point(602, 29); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(62, 13); this.label4.TabIndex = 7; @@ -214,7 +214,7 @@ this.panel1.Controls.Add(this.btnShiftUp); this.panel1.Controls.Add(this.btnShiftRight); this.panel1.Controls.Add(this.btnShiftLeft); - this.panel1.Location = new System.Drawing.Point(521, 27); + this.panel1.Location = new System.Drawing.Point(428, 27); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(120, 121); this.panel1.TabIndex = 9; @@ -222,7 +222,7 @@ // btnMirrorY // this.btnMirrorY.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnMirrorY.Location = new System.Drawing.Point(80, 76); + this.btnMirrorY.Location = new System.Drawing.Point(79, 80); this.btnMirrorY.Name = "btnMirrorY"; this.btnMirrorY.Size = new System.Drawing.Size(30, 30); this.btnMirrorY.TabIndex = 6; @@ -233,7 +233,7 @@ // btnMirrorX // this.btnMirrorX.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnMirrorX.Location = new System.Drawing.Point(44, 76); + this.btnMirrorX.Location = new System.Drawing.Point(43, 80); this.btnMirrorX.Name = "btnMirrorX"; this.btnMirrorX.Size = new System.Drawing.Size(30, 30); this.btnMirrorX.TabIndex = 5; @@ -244,7 +244,7 @@ // btnInvert // this.btnInvert.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnInvert.Location = new System.Drawing.Point(8, 76); + this.btnInvert.Location = new System.Drawing.Point(7, 80); this.btnInvert.Name = "btnInvert"; this.btnInvert.Size = new System.Drawing.Size(30, 30); this.btnInvert.TabIndex = 4; @@ -255,7 +255,7 @@ // btnShiftDown // this.btnShiftDown.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnShiftDown.Location = new System.Drawing.Point(44, 40); + this.btnShiftDown.Location = new System.Drawing.Point(43, 44); this.btnShiftDown.Name = "btnShiftDown"; this.btnShiftDown.Size = new System.Drawing.Size(30, 30); this.btnShiftDown.TabIndex = 3; @@ -266,7 +266,7 @@ // btnShiftUp // this.btnShiftUp.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnShiftUp.Location = new System.Drawing.Point(44, 4); + this.btnShiftUp.Location = new System.Drawing.Point(43, 8); this.btnShiftUp.Name = "btnShiftUp"; this.btnShiftUp.Size = new System.Drawing.Size(30, 30); this.btnShiftUp.TabIndex = 2; @@ -277,7 +277,7 @@ // btnShiftRight // this.btnShiftRight.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnShiftRight.Location = new System.Drawing.Point(80, 40); + this.btnShiftRight.Location = new System.Drawing.Point(79, 44); this.btnShiftRight.Name = "btnShiftRight"; this.btnShiftRight.Size = new System.Drawing.Size(30, 30); this.btnShiftRight.TabIndex = 1; @@ -288,7 +288,7 @@ // btnShiftLeft // this.btnShiftLeft.Font = new System.Drawing.Font("Microsoft Sans Serif", 12F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.btnShiftLeft.Location = new System.Drawing.Point(8, 40); + this.btnShiftLeft.Location = new System.Drawing.Point(7, 44); this.btnShiftLeft.Name = "btnShiftLeft"; this.btnShiftLeft.Size = new System.Drawing.Size(30, 30); this.btnShiftLeft.TabIndex = 0; @@ -296,28 +296,16 @@ this.btnShiftLeft.UseVisualStyleBackColor = true; this.btnShiftLeft.Click += new System.EventHandler(this.btnShiftLeft_Click); // - // button1 + // btnExport // - this.button1.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button1.Location = new System.Drawing.Point(789, 84); - this.button1.Name = "button1"; - this.button1.Size = new System.Drawing.Size(75, 23); - this.button1.TabIndex = 10; - this.button1.Text = "Generate"; - this.button1.UseVisualStyleBackColor = true; - this.button1.Click += new System.EventHandler(this.button1_Click); - // - // outBox - // - this.outBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.outBox.Font = new System.Drawing.Font("Consolas", 11F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(204))); - this.outBox.Location = new System.Drawing.Point(724, 105); - this.outBox.Multiline = true; - this.outBox.Name = "outBox"; - this.outBox.ScrollBars = System.Windows.Forms.ScrollBars.Both; - this.outBox.Size = new System.Drawing.Size(57, 40); - this.outBox.TabIndex = 11; - this.outBox.Text = "Output text here"; + 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.Name = "btnExport"; + this.btnExport.Size = new System.Drawing.Size(75, 23); + this.btnExport.TabIndex = 10; + this.btnExport.Text = "Export"; + this.btnExport.UseVisualStyleBackColor = true; + this.btnExport.Click += new System.EventHandler(this.button1_Click); // // miniList // @@ -327,11 +315,11 @@ this.miniList.GridLines = true; this.miniList.HideSelection = false; this.miniList.LargeImageList = this.ilMiniatures; - this.miniList.Location = new System.Drawing.Point(521, 154); + this.miniList.Location = new System.Drawing.Point(428, 154); this.miniList.MultiSelect = false; this.miniList.Name = "miniList"; this.miniList.ShowGroups = false; - this.miniList.Size = new System.Drawing.Size(343, 400); + this.miniList.Size = new System.Drawing.Size(343, 395); this.miniList.SmallImageList = this.ilMiniatures; this.miniList.TabIndex = 12; this.miniList.TabStop = false; @@ -345,47 +333,48 @@ this.ilMiniatures.ImageSize = new System.Drawing.Size(50, 50); this.ilMiniatures.TransparentColor = System.Drawing.Color.Transparent; // - // button2 + // btnApply // - this.button2.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); - this.button2.Location = new System.Drawing.Point(790, 113); - this.button2.Name = "button2"; - this.button2.Size = new System.Drawing.Size(75, 23); - this.button2.TabIndex = 13; - this.button2.Text = "Apply"; - this.button2.UseVisualStyleBackColor = true; - this.button2.Click += new System.EventHandler(this.button2_Click); + 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.Name = "btnApply"; + this.btnApply.Size = new System.Drawing.Size(75, 23); + this.btnApply.TabIndex = 13; + this.btnApply.Text = "Apply"; + this.btnApply.UseVisualStyleBackColor = true; + this.btnApply.Click += new System.EventHandler(this.button2_Click); // // hScroll // this.hScroll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); - this.hScroll.Location = new System.Drawing.Point(12, 533); + this.hScroll.Location = new System.Drawing.Point(12, 528); this.hScroll.Name = "hScroll"; - this.hScroll.Size = new System.Drawing.Size(482, 21); + this.hScroll.Size = new System.Drawing.Size(389, 21); this.hScroll.TabIndex = 14; - this.hScroll.ValueChanged += new System.EventHandler(this.hScroll_ValueChanged); + this.hScroll.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); // // vScroll // this.vScroll.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Right))); this.vScroll.LargeChange = 25; - this.vScroll.Location = new System.Drawing.Point(497, 27); + this.vScroll.Location = new System.Drawing.Point(404, 27); this.vScroll.Name = "vScroll"; - this.vScroll.Size = new System.Drawing.Size(21, 503); + this.vScroll.Size = new System.Drawing.Size(21, 498); this.vScroll.TabIndex = 15; - this.vScroll.ValueChanged += new System.EventHandler(this.vScroll_ValueChanged); + this.vScroll.ValueChanged += new System.EventHandler(this.scroll_ValueChanged); // // label5 // 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(670, 135); + this.label5.Location = new System.Drawing.Point(640, 71); this.label5.Name = "label5"; this.label5.Size = new System.Drawing.Size(24, 13); this.label5.TabIndex = 16; this.label5.Text = "X,Y"; + this.label5.TextAlign = System.Drawing.ContentAlignment.TopRight; // // menuStrip1 // @@ -396,7 +385,7 @@ this.aboutToolStripMenuItem}); this.menuStrip1.Location = new System.Drawing.Point(0, 0); this.menuStrip1.Name = "menuStrip1"; - this.menuStrip1.Size = new System.Drawing.Size(877, 24); + this.menuStrip1.Size = new System.Drawing.Size(784, 24); this.menuStrip1.TabIndex = 17; this.menuStrip1.Text = "menuStrip1"; // @@ -414,28 +403,28 @@ // newToolStripMenuItem // this.newToolStripMenuItem.Name = "newToolStripMenuItem"; - this.newToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.newToolStripMenuItem.Size = new System.Drawing.Size(112, 22); this.newToolStripMenuItem.Text = "New"; this.newToolStripMenuItem.Click += new System.EventHandler(this.newToolStripMenuItem_Click); // // openToolStripMenuItem // this.openToolStripMenuItem.Name = "openToolStripMenuItem"; - this.openToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.openToolStripMenuItem.Size = new System.Drawing.Size(112, 22); this.openToolStripMenuItem.Text = "Open"; this.openToolStripMenuItem.Click += new System.EventHandler(this.openToolStripMenuItem_Click); // // saveToolStripMenuItem // this.saveToolStripMenuItem.Name = "saveToolStripMenuItem"; - this.saveToolStripMenuItem.Size = new System.Drawing.Size(180, 22); + this.saveToolStripMenuItem.Size = new System.Drawing.Size(112, 22); this.saveToolStripMenuItem.Text = "Save as"; this.saveToolStripMenuItem.Click += new System.EventHandler(this.saveToolStripMenuItem_Click); // // exitToolStripMenuItem // this.exitToolStripMenuItem.Name = "exitToolStripMenuItem"; - this.exitToolStripMenuItem.Size = new System.Drawing.Size(103, 22); + this.exitToolStripMenuItem.Size = new System.Drawing.Size(112, 22); this.exitToolStripMenuItem.Text = "Exit"; this.exitToolStripMenuItem.Click += new System.EventHandler(this.exitToolStripMenuItem_Click); // @@ -452,14 +441,14 @@ // this.addSymbolToolStripMenuItem.Enabled = false; 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.Enabled = false; 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"; // // toolsToolStripMenuItem @@ -546,25 +535,26 @@ // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(877, 566); - this.Controls.Add(this.button2); - this.Controls.Add(this.button1); + this.ClientSize = new System.Drawing.Size(784, 561); + this.Controls.Add(this.btnApply); + this.Controls.Add(this.btnExport); this.Controls.Add(this.label5); this.Controls.Add(this.vScroll); this.Controls.Add(this.hScroll); this.Controls.Add(this.miniList); - this.Controls.Add(this.outBox); this.Controls.Add(this.panel1); this.Controls.Add(this.label4); this.Controls.Add(this.cbZoom); - this.Controls.Add(this.label3); + this.Controls.Add(this.lblType); this.Controls.Add(this.label2); this.Controls.Add(this.label1); this.Controls.Add(this.nudY); this.Controls.Add(this.nudX); this.Controls.Add(this.dotPanel); this.Controls.Add(this.menuStrip1); + this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.MainMenuStrip = this.menuStrip1; + this.MinimumSize = new System.Drawing.Size(800, 600); this.Name = "MainForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "McBitFont"; @@ -587,7 +577,7 @@ private System.Windows.Forms.NumericUpDown nudY; private System.Windows.Forms.Label label1; private System.Windows.Forms.Label label2; - private System.Windows.Forms.Label label3; + private System.Windows.Forms.Label lblType; private System.Windows.Forms.ComboBox cbZoom; private System.Windows.Forms.Label label4; private System.Windows.Forms.Panel panel1; @@ -598,11 +588,10 @@ private System.Windows.Forms.Button btnInvert; private System.Windows.Forms.Button btnMirrorX; private System.Windows.Forms.Button btnMirrorY; - private System.Windows.Forms.Button button1; - private System.Windows.Forms.TextBox outBox; + private System.Windows.Forms.Button btnExport; private System.Windows.Forms.ListView miniList; private System.Windows.Forms.ImageList ilMiniatures; - private System.Windows.Forms.Button button2; + private System.Windows.Forms.Button btnApply; private System.Windows.Forms.HScrollBar hScroll; private System.Windows.Forms.VScrollBar vScroll; private System.Windows.Forms.Label label5; diff --git a/McBitFont/Form1.cs b/McBitFont/Form1.cs index 248a980..bb7cb66 100644 --- a/McBitFont/Form1.cs +++ b/McBitFont/Form1.cs @@ -54,7 +54,7 @@ namespace McBitFont { } private void Form1_Load(object sender, EventArgs e) { - + lblType.Text = monospaced ? "Monospaced" : "Variable width / Single"; dotWidth = (int)nudX.Value; dotHeight = (int)nudY.Value; @@ -250,7 +250,6 @@ namespace McBitFont { private void dotPanel_MouseMove(object sender, MouseEventArgs e) { if (e.X >= w || e.X <= pixelOffset || e.Y >= h || e.Y <= pixelOffset) return; - //label3.Text = e.X.ToString() + ',' + e.Y.ToString(); int i = (e.X - pixelOffset + hScroll.Value) / (cellSize + gap); int j = (e.Y - pixelOffset + vScroll.Value) / (cellSize + gap); label5.Text = i.ToString() + ',' + j.ToString(); @@ -352,24 +351,26 @@ namespace McBitFont { } private void button1_Click(object sender, EventArgs e) { - outBox.Clear(); - String str; - Byte b = 0; - for (ushort i = 0; i < dotWidth; i++) { - str = ""; - for (ushort j = 0; j < dotHeight; j++) { - if (j % 8 == 0) b = 0; - if (f.data[i, j]) { - b |= (Byte)(1 << (j % 8)); - } - if ( ((j + 1) % 8 == 0) || j+1 == dotHeight ) { - if (str.Length > 0) str += " "; - str += "0x" + Convert.ToString(b, 16).PadLeft(2, '0') + ','; - } - } - outBox.AppendText(str); - outBox.AppendText(Environment.NewLine); - } + Export eform = new Export(); + eform.ShowDialog(); + //outBox.Clear(); + //String str; + //Byte b = 0; + //for (ushort i = 0; i < dotWidth; i++) { + // str = ""; + // for (ushort j = 0; j < dotHeight; j++) { + // if (j % 8 == 0) b = 0; + // if (f.data[i, j]) { + // b |= (Byte)(1 << (j % 8)); + // } + // if ( ((j + 1) % 8 == 0) || j+1 == dotHeight ) { + // if (str.Length > 0) str += " "; + // str += "0x" + Convert.ToString(b, 16).PadLeft(2, '0') + ','; + // } + // } + // outBox.AppendText(str); + // outBox.AppendText(Environment.NewLine); + //} } private void button2_Click(object sender, EventArgs e) { @@ -437,7 +438,7 @@ namespace McBitFont { private void newToolStripMenuItem_Click(object sender, EventArgs e) { if (prjModified) { - if (MessageBox.Show("The project is modified.\nDo you want to save the changes?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) { + if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Project was modified!", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes) { saveToolStripMenuItem.PerformClick(); return; } @@ -557,7 +558,7 @@ namespace McBitFont { private void MainForm_FormClosing(object sender, FormClosingEventArgs e) { if (prjModified) { - if (MessageBox.Show("The project is modified.\nDo you want to save the changes?", "Project was modified!", MessageBoxButtons.YesNo) == DialogResult.Yes) { + if (MessageBox.Show("The project is modified.\nAre you sure you want to quit?", "Are you sure?", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.No) { saveToolStripMenuItem.PerformClick(); e.Cancel = true; } else { @@ -566,13 +567,7 @@ namespace McBitFont { } } - private void hScroll_ValueChanged(object sender, EventArgs e) { - label5.Text = hScroll.Value.ToString(); - dotPanel.Refresh(); - } - - private void vScroll_ValueChanged(object sender, EventArgs e) { - label5.Text = vScroll.Value.ToString(); + private void scroll_ValueChanged(object sender, EventArgs e) { dotPanel.Refresh(); } diff --git a/McBitFont/Form1.resx b/McBitFont/Form1.resx index f959525..4266cbc 100644 --- a/McBitFont/Form1.resx +++ b/McBitFont/Form1.resx @@ -129,4 +129,24 @@ 336, 17 + + + + AAABAAEAEBAAAAEAGABoAwAAFgAAACgAAAAQAAAAIAAAAAEAGAAAAAAAQAMAAAAAAAAAAAAAAAAAAAAA + AAA1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTXW1tbW1tbW + 1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tbW + 1tbW1tbW1tbW1tYAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tbW1tbW1tbW1tbW1tYA + AAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tbW1tbW1tbW1tbW1tYAAAAAAADW1tbW1tY1 + NTU1NTXW1tbW1tYAAAAAAADW1tbW1tbW1tbW1tbW1tbW1tYAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYA + AAAAAADW1tbW1tbW1tbW1tbW1tbW1tYAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tYA + AAAAAADW1tbW1tYAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tYAAAAAAADW1tbW1tYA + AAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tYAAAAAAAAAAAAAAADW1tYAAAAAAADW1tbW1tY1 + NTU1NTXW1tbW1tYAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYA + AAAAAAAAAAAAAADW1tbW1tYAAAAAAAAAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAAAAAADW1tbW + 1tbW1tbW1tYAAAAAAAAAAADW1tbW1tY1NTU1NTXW1tbW1tYAAAAAAADW1tbW1tbW1tbW1tbW1tbW1tYA + AAAAAADW1tbW1tY1NTU1NTXW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tbW1tY1 + NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTU1NTUAAAAAAAAAAAAA + AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA + + \ No newline at end of file diff --git a/McBitFont/McBitFont.csproj b/McBitFont/McBitFont.csproj index 331eed7..5b56f4a 100644 --- a/McBitFont/McBitFont.csproj +++ b/McBitFont/McBitFont.csproj @@ -46,6 +46,12 @@ + + Form + + + Export.cs + Form @@ -60,6 +66,9 @@ + + Export.cs + Form1.cs diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000..d6aeb5e Binary files /dev/null and b/icon.ico differ diff --git a/icon.png b/icon.png new file mode 100644 index 0000000..12b6a6f Binary files /dev/null and b/icon.png differ