Done for today

This commit is contained in:
Swee 2024-05-11 23:20:06 -07:00
parent 1402f72c51
commit f05532a5bc
4 changed files with 155 additions and 67 deletions

184
Form1.Designer.cs generated
View file

@ -28,9 +28,6 @@
/// </summary> /// </summary>
private void InitializeComponent() private void InitializeComponent()
{ {
groupBox1 = new GroupBox();
radioButton2 = new RadioButton();
radioButton1 = new RadioButton();
panel1 = new Panel(); panel1 = new Panel();
groupBox3 = new GroupBox(); groupBox3 = new GroupBox();
button2 = new Button(); button2 = new Button();
@ -42,59 +39,29 @@
fileToolStripMenuItem = new ToolStripMenuItem(); fileToolStripMenuItem = new ToolStripMenuItem();
helpToolStripMenuItem = new ToolStripMenuItem(); helpToolStripMenuItem = new ToolStripMenuItem();
aboutToolStripMenuItem = new ToolStripMenuItem(); aboutToolStripMenuItem = new ToolStripMenuItem();
renderToolStripMenuItem = new ToolStripMenuItem();
fontFamilyToolStripMenuItem = new ToolStripMenuItem();
serifToolStripMenuItem = new ToolStripMenuItem();
sansSerifToolStripMenuItem = new ToolStripMenuItem();
forceMonospaceToolStripMenuItem = new ToolStripMenuItem();
Opener = new OpenFileDialog(); Opener = new OpenFileDialog();
Saver = new SaveFileDialog(); Saver = new SaveFileDialog();
groupBox1.SuspendLayout(); groupBox4 = new GroupBox();
chromiumWebBrowser1 = new CefSharp.WinForms.ChromiumWebBrowser();
button4 = new Button();
progressBar1 = new ProgressBar();
button3 = new Button();
panel1.SuspendLayout(); panel1.SuspendLayout();
groupBox3.SuspendLayout(); groupBox3.SuspendLayout();
groupBox2.SuspendLayout(); groupBox2.SuspendLayout();
menuStrip1.SuspendLayout(); menuStrip1.SuspendLayout();
groupBox4.SuspendLayout();
SuspendLayout(); SuspendLayout();
// //
// groupBox1
//
groupBox1.Controls.Add(radioButton2);
groupBox1.Controls.Add(radioButton1);
groupBox1.Dock = DockStyle.Left;
groupBox1.Location = new Point(0, 0);
groupBox1.Name = "groupBox1";
groupBox1.Size = new Size(126, 67);
groupBox1.TabIndex = 0;
groupBox1.TabStop = false;
groupBox1.Text = "File mode";
//
// radioButton2
//
radioButton2.AutoSize = true;
radioButton2.Dock = DockStyle.Top;
radioButton2.FlatStyle = FlatStyle.System;
radioButton2.Location = new Point(3, 39);
radioButton2.Name = "radioButton2";
radioButton2.Size = new Size(120, 20);
radioButton2.TabIndex = 1;
radioButton2.Text = "Render mode";
radioButton2.UseVisualStyleBackColor = true;
//
// radioButton1
//
radioButton1.AutoSize = true;
radioButton1.Checked = true;
radioButton1.Dock = DockStyle.Top;
radioButton1.FlatStyle = FlatStyle.System;
radioButton1.Location = new Point(3, 19);
radioButton1.Name = "radioButton1";
radioButton1.Size = new Size(120, 20);
radioButton1.TabIndex = 0;
radioButton1.TabStop = true;
radioButton1.Text = "Converter mode";
radioButton1.UseVisualStyleBackColor = true;
radioButton1.CheckedChanged += radioButton1_CheckedChanged;
//
// panel1 // panel1
// //
panel1.Controls.Add(groupBox3); panel1.Controls.Add(groupBox3);
panel1.Controls.Add(groupBox2); panel1.Controls.Add(groupBox2);
panel1.Controls.Add(groupBox1);
panel1.Dock = DockStyle.Top; panel1.Dock = DockStyle.Top;
panel1.Location = new Point(0, 24); panel1.Location = new Point(0, 24);
panel1.Name = "panel1"; panel1.Name = "panel1";
@ -106,9 +73,9 @@
groupBox3.Controls.Add(button2); groupBox3.Controls.Add(button2);
groupBox3.Controls.Add(textBox2); groupBox3.Controls.Add(textBox2);
groupBox3.Dock = DockStyle.Fill; groupBox3.Dock = DockStyle.Fill;
groupBox3.Location = new Point(439, 0); groupBox3.Location = new Point(401, 0);
groupBox3.Name = "groupBox3"; groupBox3.Name = "groupBox3";
groupBox3.Size = new Size(361, 67); groupBox3.Size = new Size(399, 67);
groupBox3.TabIndex = 2; groupBox3.TabIndex = 2;
groupBox3.TabStop = false; groupBox3.TabStop = false;
groupBox3.Text = "Input file"; groupBox3.Text = "Input file";
@ -119,7 +86,7 @@
button2.FlatStyle = FlatStyle.System; button2.FlatStyle = FlatStyle.System;
button2.Location = new Point(3, 42); button2.Location = new Point(3, 42);
button2.Name = "button2"; button2.Name = "button2";
button2.Size = new Size(355, 22); button2.Size = new Size(393, 22);
button2.TabIndex = 3; button2.TabIndex = 3;
button2.Text = "Select file"; button2.Text = "Select file";
button2.UseVisualStyleBackColor = true; button2.UseVisualStyleBackColor = true;
@ -131,7 +98,7 @@
textBox2.Location = new Point(3, 19); textBox2.Location = new Point(3, 19);
textBox2.Name = "textBox2"; textBox2.Name = "textBox2";
textBox2.PlaceholderText = "Type path or select file below. "; textBox2.PlaceholderText = "Type path or select file below. ";
textBox2.Size = new Size(355, 23); textBox2.Size = new Size(393, 23);
textBox2.TabIndex = 2; textBox2.TabIndex = 2;
// //
// groupBox2 // groupBox2
@ -139,9 +106,9 @@
groupBox2.Controls.Add(button1); groupBox2.Controls.Add(button1);
groupBox2.Controls.Add(textBox1); groupBox2.Controls.Add(textBox1);
groupBox2.Dock = DockStyle.Left; groupBox2.Dock = DockStyle.Left;
groupBox2.Location = new Point(126, 0); groupBox2.Location = new Point(0, 0);
groupBox2.Name = "groupBox2"; groupBox2.Name = "groupBox2";
groupBox2.Size = new Size(313, 67); groupBox2.Size = new Size(401, 67);
groupBox2.TabIndex = 1; groupBox2.TabIndex = 1;
groupBox2.TabStop = false; groupBox2.TabStop = false;
groupBox2.Text = "Output file"; groupBox2.Text = "Output file";
@ -152,7 +119,7 @@
button1.FlatStyle = FlatStyle.System; button1.FlatStyle = FlatStyle.System;
button1.Location = new Point(3, 42); button1.Location = new Point(3, 42);
button1.Name = "button1"; button1.Name = "button1";
button1.Size = new Size(307, 22); button1.Size = new Size(395, 22);
button1.TabIndex = 1; button1.TabIndex = 1;
button1.Text = "Select path"; button1.Text = "Select path";
button1.UseVisualStyleBackColor = true; button1.UseVisualStyleBackColor = true;
@ -164,12 +131,12 @@
textBox1.Location = new Point(3, 19); textBox1.Location = new Point(3, 19);
textBox1.Name = "textBox1"; textBox1.Name = "textBox1";
textBox1.PlaceholderText = "Type path or select path below. "; textBox1.PlaceholderText = "Type path or select path below. ";
textBox1.Size = new Size(307, 23); textBox1.Size = new Size(395, 23);
textBox1.TabIndex = 0; textBox1.TabIndex = 0;
// //
// menuStrip1 // menuStrip1
// //
menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem, helpToolStripMenuItem }); menuStrip1.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem, helpToolStripMenuItem, renderToolStripMenuItem });
menuStrip1.Location = new Point(0, 0); menuStrip1.Location = new Point(0, 0);
menuStrip1.Name = "menuStrip1"; menuStrip1.Name = "menuStrip1";
menuStrip1.RenderMode = ToolStripRenderMode.System; menuStrip1.RenderMode = ToolStripRenderMode.System;
@ -198,6 +165,40 @@
aboutToolStripMenuItem.Text = "About"; aboutToolStripMenuItem.Text = "About";
aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click; aboutToolStripMenuItem.Click += aboutToolStripMenuItem_Click;
// //
// renderToolStripMenuItem
//
renderToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { fontFamilyToolStripMenuItem });
renderToolStripMenuItem.Name = "renderToolStripMenuItem";
renderToolStripMenuItem.Size = new Size(56, 20);
renderToolStripMenuItem.Text = "Render";
//
// fontFamilyToolStripMenuItem
//
fontFamilyToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { serifToolStripMenuItem, sansSerifToolStripMenuItem, forceMonospaceToolStripMenuItem });
fontFamilyToolStripMenuItem.Name = "fontFamilyToolStripMenuItem";
fontFamilyToolStripMenuItem.Size = new Size(136, 22);
fontFamilyToolStripMenuItem.Text = "Font Family";
//
// serifToolStripMenuItem
//
serifToolStripMenuItem.Name = "serifToolStripMenuItem";
serifToolStripMenuItem.Size = new Size(176, 22);
serifToolStripMenuItem.Text = "Serif";
//
// sansSerifToolStripMenuItem
//
sansSerifToolStripMenuItem.Checked = true;
sansSerifToolStripMenuItem.CheckState = CheckState.Checked;
sansSerifToolStripMenuItem.Name = "sansSerifToolStripMenuItem";
sansSerifToolStripMenuItem.Size = new Size(176, 22);
sansSerifToolStripMenuItem.Text = "(Default) Sans serif";
//
// forceMonospaceToolStripMenuItem
//
forceMonospaceToolStripMenuItem.Name = "forceMonospaceToolStripMenuItem";
forceMonospaceToolStripMenuItem.Size = new Size(176, 22);
forceMonospaceToolStripMenuItem.Text = "(Force) Monospace";
//
// Opener // Opener
// //
Opener.DefaultExt = "md"; Opener.DefaultExt = "md";
@ -210,18 +211,76 @@
Saver.DefaultExt = "html"; Saver.DefaultExt = "html";
Saver.Filter = "HTML websites|*.html|All files|*.*"; Saver.Filter = "HTML websites|*.html|All files|*.*";
// //
// groupBox4
//
groupBox4.Controls.Add(progressBar1);
groupBox4.Controls.Add(chromiumWebBrowser1);
groupBox4.Controls.Add(button4);
groupBox4.Dock = DockStyle.Fill;
groupBox4.Location = new Point(0, 91);
groupBox4.Name = "groupBox4";
groupBox4.Size = new Size(800, 401);
groupBox4.TabIndex = 3;
groupBox4.TabStop = false;
groupBox4.Text = "Preview";
//
// chromiumWebBrowser1
//
chromiumWebBrowser1.ActivateBrowserOnCreation = false;
chromiumWebBrowser1.Dock = DockStyle.Fill;
chromiumWebBrowser1.Location = new Point(3, 42);
chromiumWebBrowser1.Name = "chromiumWebBrowser1";
chromiumWebBrowser1.Size = new Size(794, 356);
chromiumWebBrowser1.TabIndex = 0;
chromiumWebBrowser1.LoadingStateChanged += chromiumWebBrowser1_LoadingStateChanged;
//
// button4
//
button4.Dock = DockStyle.Top;
button4.FlatStyle = FlatStyle.System;
button4.Location = new Point(3, 19);
button4.Name = "button4";
button4.Size = new Size(794, 23);
button4.TabIndex = 1;
button4.Text = "Render preview";
button4.UseVisualStyleBackColor = true;
//
// progressBar1
//
progressBar1.Dock = DockStyle.Top;
progressBar1.Location = new Point(3, 42);
progressBar1.Name = "progressBar1";
progressBar1.Size = new Size(794, 2);
progressBar1.Style = ProgressBarStyle.Marquee;
progressBar1.TabIndex = 2;
//
// button3
//
button3.BackColor = Color.Transparent;
button3.Dock = DockStyle.Bottom;
button3.FlatStyle = FlatStyle.Flat;
button3.Location = new Point(0, 469);
button3.Name = "button3";
button3.Size = new Size(800, 23);
button3.TabIndex = 4;
button3.Text = "Convert";
button3.UseVisualStyleBackColor = false;
button3.Click += button3_Click;
//
// Form1 // Form1
// //
AutoScaleDimensions = new SizeF(7F, 15F); AutoScaleDimensions = new SizeF(7F, 15F);
AutoScaleMode = AutoScaleMode.Font; AutoScaleMode = AutoScaleMode.Font;
ClientSize = new Size(800, 492); ClientSize = new Size(800, 492);
Controls.Add(button3);
Controls.Add(groupBox4);
Controls.Add(panel1); Controls.Add(panel1);
Controls.Add(menuStrip1); Controls.Add(menuStrip1);
MainMenuStrip = menuStrip1; MainMenuStrip = menuStrip1;
MinimumSize = new Size(633, 531);
Name = "Form1"; Name = "Form1";
Text = "MintHTML"; Text = "MintHTML";
groupBox1.ResumeLayout(false); Load += Form1_Load;
groupBox1.PerformLayout();
panel1.ResumeLayout(false); panel1.ResumeLayout(false);
groupBox3.ResumeLayout(false); groupBox3.ResumeLayout(false);
groupBox3.PerformLayout(); groupBox3.PerformLayout();
@ -229,15 +288,12 @@
groupBox2.PerformLayout(); groupBox2.PerformLayout();
menuStrip1.ResumeLayout(false); menuStrip1.ResumeLayout(false);
menuStrip1.PerformLayout(); menuStrip1.PerformLayout();
groupBox4.ResumeLayout(false);
ResumeLayout(false); ResumeLayout(false);
PerformLayout(); PerformLayout();
} }
#endregion #endregion
private GroupBox groupBox1;
private RadioButton radioButton2;
private RadioButton radioButton1;
private Panel panel1; private Panel panel1;
private MenuStrip menuStrip1; private MenuStrip menuStrip1;
private ToolStripMenuItem fileToolStripMenuItem; private ToolStripMenuItem fileToolStripMenuItem;
@ -251,5 +307,15 @@
private TextBox textBox2; private TextBox textBox2;
private OpenFileDialog Opener; private OpenFileDialog Opener;
private SaveFileDialog Saver; private SaveFileDialog Saver;
private GroupBox groupBox4;
private Button button3;
private CefSharp.WinForms.ChromiumWebBrowser chromiumWebBrowser1;
private Button button4;
private ToolStripMenuItem renderToolStripMenuItem;
private ToolStripMenuItem fontFamilyToolStripMenuItem;
private ToolStripMenuItem serifToolStripMenuItem;
private ToolStripMenuItem sansSerifToolStripMenuItem;
private ToolStripMenuItem forceMonospaceToolStripMenuItem;
private ProgressBar progressBar1;
} }
} }

View file

@ -1,3 +1,6 @@
using CefSharp;
using CefSharp.WinForms;
namespace MintHTML namespace MintHTML
{ {
public partial class Form1 : Form public partial class Form1 : Form
@ -7,11 +10,6 @@ namespace MintHTML
InitializeComponent(); InitializeComponent();
} }
private void radioButton1_CheckedChanged(object sender, EventArgs e)
{
groupBox2.Enabled = radioButton1.Checked;
}
private void aboutToolStripMenuItem_Click(object sender, EventArgs e) private void aboutToolStripMenuItem_Click(object sender, EventArgs e)
{ {
MessageBox.Show("MintHTML is a simple Markdown converter and renderer made by SweeZero.", "About", MessageBoxButtons.OK); MessageBox.Show("MintHTML is a simple Markdown converter and renderer made by SweeZero.", "About", MessageBoxButtons.OK);
@ -27,6 +25,22 @@ namespace MintHTML
{ {
Saver.ShowDialog(); Saver.ShowDialog();
textBox1.Text = Saver.FileName; textBox1.Text = Saver.FileName;
}
private void chromiumWebBrowser1_LoadingStateChanged(object sender, CefSharp.LoadingStateChangedEventArgs e)
{
}
private void Form1_Load(object sender, EventArgs e)
{
chromiumWebBrowser1.LoadHtml("<style>html{font-family: sans-serif}</style><h1>MintHTML</h1><p>Open a markdown file and press \"Render preview\" to see the output here.</p>");
}
private void button3_Click(object sender, EventArgs e)
{
} }
} }
} }

View file

@ -121,9 +121,12 @@
<value>17, 17</value> <value>17, 17</value>
</metadata> </metadata>
<metadata name="Opener.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="Opener.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>132, 17</value> <value>120, 18</value>
</metadata> </metadata>
<metadata name="Saver.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"> <metadata name="Saver.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<value>271, 17</value> <value>201, 20</value>
</metadata>
<metadata name="$this.TrayHeight" type="System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>64</value>
</metadata> </metadata>
</root> </root>

View file

@ -4,8 +4,13 @@
<OutputType>WinExe</OutputType> <OutputType>WinExe</OutputType>
<TargetFramework>net6.0-windows7.0</TargetFramework> <TargetFramework>net6.0-windows7.0</TargetFramework>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<UseWindowsForms>true</UseWindowsForms> <UseWindowsForms>True</UseWindowsForms>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<CefSharpAnyCpuSupport>true</CefSharpAnyCpuSupport>
</PropertyGroup> </PropertyGroup>
<ItemGroup>
<PackageReference Include="CefSharp.WinForms.NETCore" Version="124.3.50" />
</ItemGroup>
</Project> </Project>