rich text box test 1

This commit is contained in:
Anton Mukhin
2023-05-11 14:00:37 +03:00
parent fc60991d85
commit 84561f1ac1

View File

@@ -124,7 +124,7 @@ namespace McBitFont {
} }
private void btnGenerate_Click(object sender, EventArgs e) { private void btnGenerate_Click(object sender, EventArgs e) {
//string output = ""; string output = "";
txtOutput.Clear(); txtOutput.Clear();
bool com = cbComments.Checked; bool com = cbComments.Checked;
bool hdr = cbHeader.Checked; bool hdr = cbHeader.Checked;
@@ -132,21 +132,21 @@ namespace McBitFont {
if (com) { if (com) {
//Header comments //Header comments
txtOutput.AppendText(comments["header"]); output += comments["header"];
txtOutput.AppendText(comments["scan_order"] + cbOrder.Text + "\n"); output += comments["scan_order"] + cbOrder.Text + "\n";
txtOutput.AppendText(comments["scan_hdir"] + cbHDir.Text + "\n"); output += comments["scan_hdir"] + cbHDir.Text + "\n";
txtOutput.AppendText(comments["scan_vdir"] + cbVDir.Text + "\n\n"); output += comments["scan_vdir"] + cbVDir.Text + "\n\n";
txtOutput.AppendText(comments["num_bit_order"] + cbBitOrder.Text + "\n"); output += comments["num_bit_order"] + cbBitOrder.Text + "\n";
txtOutput.AppendText(comments["num_base"] + cbNumBase.Text + "\n"); output += comments["num_base"] + cbNumBase.Text + "\n";
txtOutput.AppendText(comments["num_size"] + cbNumSize.Text + "\n\n"); output += comments["num_size"] + cbNumSize.Text + "\n\n";
txtOutput.AppendText(comments["text_format"] + cbFormat.Text + "\n"); output += comments["text_format"] + cbFormat.Text + "\n";
txtOutput.AppendText(comments["text_lines"] + cbLines.Text + "\n\n"); output += comments["text_lines"] + cbLines.Text + "\n\n";
if (hdr) { if (hdr) {
// comment about meta header map // comment about meta header map
txtOutput.AppendText(comments["font_header_map"] + "\n\n"); output += comments["font_header_map"] + "\n\n";
} }
} }
@@ -240,9 +240,9 @@ namespace McBitFont {
} }
//Array definition //Array definition
txtOutput.AppendText("const " + dataType + " " + mainForm.prjName + "[] = {\n"); output += "const " + dataType + " " + mainForm.prjName + "[] = {\n";
if (com) txtOutput.AppendText(" // Data:\n"); if (com) output += " // Data:\n";
foreach ( MainForm.FrameMiniature f in mainForm.frames) { foreach ( MainForm.FrameMiniature f in mainForm.frames) {
// For each frame // For each frame
string str; string str;
@@ -252,7 +252,7 @@ namespace McBitFont {
if (com && lines != 1) { if (com && lines != 1) {
// Comments enabled and other than "1 symbol per line" selected // Comments enabled and other than "1 symbol per line" selected
// Print a symbol comment before its data // Print a symbol comment before its data
txtOutput.AppendText(" // " + f.code.ToString() + " --> \n"); output += " // " + f.code.ToString() + " --> \n";
} }
for (int i = imin; i != imax; i += idir) { for (int i = imin; i != imax; i += idir) {
str = " "; str = " ";
@@ -283,16 +283,17 @@ namespace McBitFont {
str += pref + Convert.ToString(b, nbase).PadLeft(pad, '0') + ','; str += pref + Convert.ToString(b, nbase).PadLeft(pad, '0') + ',';
} }
} }
txtOutput.AppendText(str); output += str;
txtOutput.AppendText(Environment.NewLine); output += Environment.NewLine;
} }
txtOutput.AppendText(Environment.NewLine); output += Environment.NewLine;
} }
// Close array definition // Close array definition
txtOutput.AppendText("};\n"); output += "};\n";
txtOutput.SelectAll(); txtOutput.Text = output;
ParseText(); //txtOutput.SelectAll();
//ParseText();
txtOutput.SelectionStart = 0; txtOutput.SelectionStart = 0;
txtOutput.ScrollToCaret(); txtOutput.ScrollToCaret();
} }