From 547a22bfd2e69e8ef2df42788a475d425a24f38a Mon Sep 17 00:00:00 2001 From: Thorsten Sommer Date: Sat, 29 Oct 2022 20:18:00 +0200 Subject: [PATCH] Added button for manual triggered source generation --- .../Components/SectionTree.Designer.cs | 19 +++++++++++++++++ .../UI WinForms/Components/SectionTree.cs | 20 ++++++++++++++++++ .../UI WinForms/Resources/Icons.Designer.cs | 10 +++++++++ .../UI WinForms/Resources/Icons.resx | 3 +++ .../Resources/icons8-code-512 (2).png | Bin 0 -> 4648 bytes 5 files changed, 52 insertions(+) create mode 100644 I18N Commander/UI WinForms/Resources/icons8-code-512 (2).png diff --git a/I18N Commander/UI WinForms/Components/SectionTree.Designer.cs b/I18N Commander/UI WinForms/Components/SectionTree.Designer.cs index ebd2639..219fbad 100644 --- a/I18N Commander/UI WinForms/Components/SectionTree.Designer.cs +++ b/I18N Commander/UI WinForms/Components/SectionTree.Designer.cs @@ -34,6 +34,7 @@ this.buttonAdd = new System.Windows.Forms.Button(); this.buttonRemove = new System.Windows.Forms.Button(); this.buttonRename = new System.Windows.Forms.Button(); + this.buttonGenerate = new System.Windows.Forms.Button(); this.treeView = new System.Windows.Forms.TreeView(); this.toolTip = new System.Windows.Forms.ToolTip(this.components); this.tableLayout.SuspendLayout(); @@ -61,6 +62,7 @@ this.flowLayoutBottom.Controls.Add(this.buttonAdd); this.flowLayoutBottom.Controls.Add(this.buttonRemove); this.flowLayoutBottom.Controls.Add(this.buttonRename); + this.flowLayoutBottom.Controls.Add(this.buttonGenerate); this.flowLayoutBottom.Dock = System.Windows.Forms.DockStyle.Fill; this.flowLayoutBottom.Location = new System.Drawing.Point(0, 445); this.flowLayoutBottom.Margin = new System.Windows.Forms.Padding(0); @@ -115,6 +117,22 @@ this.buttonRename.UseVisualStyleBackColor = true; this.buttonRename.Click += new System.EventHandler(this.buttonRename_Click); // + // buttonGenerate + // + this.buttonGenerate.AutoSize = true; + this.buttonGenerate.Enabled = false; + this.buttonGenerate.FlatAppearance.BorderSize = 0; + this.buttonGenerate.FlatStyle = System.Windows.Forms.FlatStyle.Flat; + this.buttonGenerate.Image = global::UI_WinForms.Resources.Icons.icons8_code_512__2_; + this.buttonGenerate.Location = new System.Drawing.Point(201, 3); + this.buttonGenerate.Name = "buttonGenerate"; + this.buttonGenerate.Size = new System.Drawing.Size(60, 60); + this.buttonGenerate.TabIndex = 3; + this.buttonGenerate.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText; + this.toolTip.SetToolTip(this.buttonGenerate, "Triggers all enabled generators"); + this.buttonGenerate.UseVisualStyleBackColor = true; + this.buttonGenerate.Click += new System.EventHandler(this.buttonGenerate_Click); + // // treeView // this.treeView.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; @@ -159,5 +177,6 @@ private TreeView treeView; private ToolTip toolTip; private Button buttonRename; + private Button buttonGenerate; } } diff --git a/I18N Commander/UI WinForms/Components/SectionTree.cs b/I18N Commander/UI WinForms/Components/SectionTree.cs index d402363..a62c2f7 100644 --- a/I18N Commander/UI WinForms/Components/SectionTree.cs +++ b/I18N Commander/UI WinForms/Components/SectionTree.cs @@ -28,8 +28,23 @@ public partial class SectionTree : UserControl // Subscribe to the load event: this.Load += this.LoadNodes; + this.Load += (sender, args) => this.SetupGeneratorButton(); } + private async void SetupGeneratorButton() + { + this.buttonGenerate.Enabled = false; + + // Depend the generator button's visibility on the generator settings: + this.buttonGenerate.Enabled = await AppSettings.GetGeneratorDotnetEnabled() || await AppSettings.GetGeneratorGodotEnabled(); + + // Subscribe to the changed settings event: + AppEvents.WhenSettingsChanged += async (sender, args) => + { + this.buttonGenerate.Enabled = await AppSettings.GetGeneratorDotnetEnabled() || await AppSettings.GetGeneratorGodotEnabled(); + }; + } + private async void LoadNodes(object? sender, EventArgs e) { if(this.DesignMode) @@ -277,4 +292,9 @@ public partial class SectionTree : UserControl selectedNode.Text = alteredSection.Result!.Name; selectedNode.Name = alteredSection.Result.DataKey; // [sic] name is the key } + + private void buttonGenerate_Click(object sender, EventArgs e) + { + + } } \ No newline at end of file diff --git a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs index 7a66bfe..cf5126b 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.Designer.cs +++ b/I18N Commander/UI WinForms/Resources/Icons.Designer.cs @@ -150,6 +150,16 @@ namespace UI_WinForms.Resources { } } + /// + /// Looks up a localized resource of type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap icons8_code_512__2_ { + get { + object obj = ResourceManager.GetObject("icons8_code_512__2_", resourceCulture); + return ((System.Drawing.Bitmap)(obj)); + } + } + /// /// Looks up a localized resource of type System.Drawing.Bitmap. /// diff --git a/I18N Commander/UI WinForms/Resources/Icons.resx b/I18N Commander/UI WinForms/Resources/Icons.resx index 538f121..8e6f5c8 100644 --- a/I18N Commander/UI WinForms/Resources/Icons.resx +++ b/I18N Commander/UI WinForms/Resources/Icons.resx @@ -145,6 +145,9 @@ icons8-code-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + icons8-code-512 (2).png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + icons8-collectibles-512.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/I18N Commander/UI WinForms/Resources/icons8-code-512 (2).png b/I18N Commander/UI WinForms/Resources/icons8-code-512 (2).png new file mode 100644 index 0000000000000000000000000000000000000000..298896d04c932a90ea36cf54ce3609b76af8bd9a GIT binary patch literal 4648 zcmai2c|4SB`yW}d6{jT1VT?7*j9oJs`@XNkWH|;iW5UcdGZ>UzvP7uJ5>b&TaU!Wf zsd0>*7LhDP6tW~Dy$_wY-t(UG{(gTvb3ga}y{_+d-PiVfK9lTVXTFR706z!>+GS~B z;smVFt%sKf_(dKV&jW$Ds);V{baz`Dq#rpLhV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