From a724d8852cfc2e342ac1c72023179424910731cb Mon Sep 17 00:00:00 2001 From: Samuel Lambert Date: Sun, 15 Jan 2023 19:25:00 -0500 Subject: [PATCH] Script Add/Remove Support and editor fixes --- BrilliantShiningScriptEditor.csproj | 9 +++ Forms/FormMain.Designer.cs | 1 + Forms/FormMain.cs | 48 ++++++++++- Forms/FormTextBox.Designer.cs | 104 ++++++++++++++++++++++++ Forms/FormTextBox.cs | 34 ++++++++ Forms/FormTextBox.resx | 120 ++++++++++++++++++++++++++++ Monaco/editor_init.js | 6 ++ 7 files changed, 319 insertions(+), 3 deletions(-) create mode 100644 Forms/FormTextBox.Designer.cs create mode 100644 Forms/FormTextBox.cs create mode 100644 Forms/FormTextBox.resx diff --git a/BrilliantShiningScriptEditor.csproj b/BrilliantShiningScriptEditor.csproj index ba3a954..7ae47f4 100644 --- a/BrilliantShiningScriptEditor.csproj +++ b/BrilliantShiningScriptEditor.csproj @@ -115,11 +115,20 @@ FormMain.cs + + Form + + + FormTextBox.cs + FormMain.cs + + FormTextBox.cs + ResXFileCodeGenerator Designer diff --git a/Forms/FormMain.Designer.cs b/Forms/FormMain.Designer.cs index 57695b9..8121ecf 100644 --- a/Forms/FormMain.Designer.cs +++ b/Forms/FormMain.Designer.cs @@ -301,6 +301,7 @@ private void InitializeComponent() this.Name = "FormMain"; this.Text = "Brilliant Shining Script Editor"; this.Load += new System.EventHandler(this.FormMain_Load); + this.SizeChanged += new System.EventHandler(this.FormMain_SizeChanged); this.stripMain.ResumeLayout(false); this.stripMain.PerformLayout(); ((System.ComponentModel.ISupportInitialize)(this.webEditor)).EndInit(); diff --git a/Forms/FormMain.cs b/Forms/FormMain.cs index 0c86bed..b0abd15 100644 --- a/Forms/FormMain.cs +++ b/Forms/FormMain.cs @@ -41,7 +41,7 @@ private void FormMain_Load(object sender, EventArgs e) LoadPage(); } - private void webEditor_NavigationCompleted(object sender, Microsoft.Web.WebView2.Core.CoreWebView2NavigationCompletedEventArgs e) + private void webEditor_NavigationCompleted(object sender, CoreWebView2NavigationCompletedEventArgs e) { stripMain.Enabled = true; } @@ -65,6 +65,7 @@ private string GetEditorValue() string code = ExecuteEditorScript("editor.getValue()"); code = code.Replace("\"", ""); code = code.Replace("\\n", "\n"); + code = code.Replace("\\r", ""); return code; } @@ -97,6 +98,11 @@ private static string EditorWait(Task task) return wait; } + + private void FormMain_SizeChanged(object sender, EventArgs e) + { + ExecuteEditorScript("editor.layout()"); + } #endregion private void AddToolTips() @@ -122,8 +128,9 @@ private void UpdateScriptList(List