using System;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Text;
using System.Windows.Forms;

namespace TeslaConsole;

public class PlasmaFontTool : Form
{
	private IContainer components;

	private TableLayoutPanel tableLayoutPanel1;

	private PlasmaView mLargePlasma;

	private PlasmaView mSmallPlasma;

	private TableLayoutPanel tableLayoutPanel2;

	private TextBox mText;

	private Label mTextLabel;

	private Label mFontLabel;

	private ComboBox mFont;

	protected override void Dispose(bool disposing)
	{
		if (disposing && components != null)
		{
			components.Dispose();
		}
		base.Dispose(disposing);
	}

	private void InitializeComponent()
	{
		this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
		this.mLargePlasma = new TeslaConsole.PlasmaView();
		this.mSmallPlasma = new TeslaConsole.PlasmaView();
		this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
		this.mText = new System.Windows.Forms.TextBox();
		this.mTextLabel = new System.Windows.Forms.Label();
		this.mFontLabel = new System.Windows.Forms.Label();
		this.mFont = new System.Windows.Forms.ComboBox();
		this.tableLayoutPanel1.SuspendLayout();
		this.tableLayoutPanel2.SuspendLayout();
		base.SuspendLayout();
		this.tableLayoutPanel1.ColumnCount = 2;
		this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 66.66666f));
		this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 33.33334f));
		this.tableLayoutPanel1.Controls.Add(this.mLargePlasma, 0, 0);
		this.tableLayoutPanel1.Controls.Add(this.mSmallPlasma, 1, 1);
		this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 1, 0);
		this.tableLayoutPanel1.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tableLayoutPanel1.Location = new System.Drawing.Point(0, 0);
		this.tableLayoutPanel1.Name = "tableLayoutPanel1";
		this.tableLayoutPanel1.RowCount = 3;
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25f));
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50f));
		this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 25f));
		this.tableLayoutPanel1.Size = new System.Drawing.Size(1035, 425);
		this.tableLayoutPanel1.TabIndex = 0;
		this.mLargePlasma.BackColor = System.Drawing.Color.Black;
		this.mLargePlasma.Dock = System.Windows.Forms.DockStyle.Fill;
		this.mLargePlasma.Enabled = false;
		this.mLargePlasma.ForeColor = System.Drawing.Color.DarkOrange;
		this.mLargePlasma.Location = new System.Drawing.Point(3, 3);
		this.mLargePlasma.Name = "mLargePlasma";
		this.tableLayoutPanel1.SetRowSpan(this.mLargePlasma, 3);
		this.mLargePlasma.Size = new System.Drawing.Size(683, 419);
		this.mLargePlasma.TabIndex = 0;
		this.mSmallPlasma.BackColor = System.Drawing.Color.Black;
		this.mSmallPlasma.Dock = System.Windows.Forms.DockStyle.Fill;
		this.mSmallPlasma.Enabled = false;
		this.mSmallPlasma.ForeColor = System.Drawing.Color.DarkOrange;
		this.mSmallPlasma.Location = new System.Drawing.Point(692, 109);
		this.mSmallPlasma.Name = "mSmallPlasma";
		this.mSmallPlasma.Size = new System.Drawing.Size(340, 206);
		this.mSmallPlasma.TabIndex = 1;
		this.tableLayoutPanel2.ColumnCount = 2;
		this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
		this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100f));
		this.tableLayoutPanel2.Controls.Add(this.mText, 1, 1);
		this.tableLayoutPanel2.Controls.Add(this.mTextLabel, 0, 1);
		this.tableLayoutPanel2.Controls.Add(this.mFontLabel, 0, 0);
		this.tableLayoutPanel2.Controls.Add(this.mFont, 1, 0);
		this.tableLayoutPanel2.Dock = System.Windows.Forms.DockStyle.Fill;
		this.tableLayoutPanel2.Location = new System.Drawing.Point(692, 3);
		this.tableLayoutPanel2.Name = "tableLayoutPanel2";
		this.tableLayoutPanel2.RowCount = 3;
		this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
		this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle());
		this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100f));
		this.tableLayoutPanel2.Size = new System.Drawing.Size(340, 100);
		this.tableLayoutPanel2.TabIndex = 2;
		this.mText.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.mText.Location = new System.Drawing.Point(40, 30);
		this.mText.Name = "mText";
		this.mText.Size = new System.Drawing.Size(297, 20);
		this.mText.TabIndex = 0;
		this.mText.TextChanged += new System.EventHandler(RebuildImages);
		this.mTextLabel.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.mTextLabel.AutoSize = true;
		this.mTextLabel.Location = new System.Drawing.Point(3, 33);
		this.mTextLabel.Name = "mTextLabel";
		this.mTextLabel.Size = new System.Drawing.Size(31, 13);
		this.mTextLabel.TabIndex = 1;
		this.mTextLabel.Text = "Text:";
		this.mFontLabel.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.mFontLabel.AutoSize = true;
		this.mFontLabel.Location = new System.Drawing.Point(3, 7);
		this.mFontLabel.Name = "mFontLabel";
		this.mFontLabel.Size = new System.Drawing.Size(31, 13);
		this.mFontLabel.TabIndex = 2;
		this.mFontLabel.Text = "Font:";
		this.mFont.Anchor = System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right;
		this.mFont.FormattingEnabled = true;
		this.mFont.Location = new System.Drawing.Point(40, 3);
		this.mFont.Name = "mFont";
		this.mFont.Size = new System.Drawing.Size(297, 21);
		this.mFont.TabIndex = 3;
		this.mFont.SelectedIndexChanged += new System.EventHandler(RebuildImages);
		base.AutoScaleDimensions = new System.Drawing.SizeF(6f, 13f);
		base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
		base.ClientSize = new System.Drawing.Size(1035, 425);
		base.Controls.Add(this.tableLayoutPanel1);
		base.Name = "PlasmaFontTool";
		this.Text = "Plasma Font Tool";
		this.tableLayoutPanel1.ResumeLayout(false);
		this.tableLayoutPanel2.ResumeLayout(false);
		this.tableLayoutPanel2.PerformLayout();
		base.ResumeLayout(false);
	}

	public PlasmaFontTool()
	{
		InitializeComponent();
		FontFamily[] families = new InstalledFontCollection().Families;
		foreach (FontFamily fontFamily in families)
		{
			mFont.Items.Add(fontFamily.Name);
		}
		mFont.SelectedItem = "Microsoft Sans Serif";
	}

	private void RebuildImages(object sender, EventArgs e)
	{
		PlasmaBitmaps.GenerateBitmaps(out var large, out var small, mFont.Text, mText.Text);
		mLargePlasma.SetBitmap(large);
		mSmallPlasma.SetBitmap(small);
		large.Dispose();
		small.Dispose();
	}
}
