From 5b1dcc88cc0cce380065ff183fe42c862fb8a6d4 Mon Sep 17 00:00:00 2001
From: chylex <contact@chylex.com>
Date: Sat, 28 Apr 2018 15:19:58 +0200
Subject: [PATCH] Make Plugins form always show Configure button when
 configurable

---
 Plugins/Controls/PluginControl.cs | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/Plugins/Controls/PluginControl.cs b/Plugins/Controls/PluginControl.cs
index e33abf31..f3bfc04e 100644
--- a/Plugins/Controls/PluginControl.cs
+++ b/Plugins/Controls/PluginControl.cs
@@ -9,6 +9,7 @@ namespace TweetDuck.Plugins.Controls{
     sealed partial class PluginControl : UserControl{
         private readonly PluginManager pluginManager;
         private readonly Plugin plugin;
+        private readonly bool isConfigurable;
         
         private int nextHeight;
 
@@ -20,6 +21,8 @@ public PluginControl(PluginManager pluginManager, Plugin plugin) : this(){
             this.pluginManager = pluginManager;
             this.plugin = plugin;
 
+            this.isConfigurable = pluginManager.IsPluginConfigurable(plugin);
+
             float dpiScale = this.GetDPIScale();
 
             if (dpiScale > 1F){
@@ -58,7 +61,7 @@ private void panelDescription_Resize(object sender, EventArgs e){
             Font font = labelDescription.Font;
             int descriptionLines = TextRenderer.MeasureText(labelDescription.Text, font, new Size(maxWidth, int.MaxValue), TextFormatFlags.WordBreak).Height/(font.Height-1);
             
-            int requiredLines = Math.Max(descriptionLines, 1+(string.IsNullOrEmpty(labelVersion.Text) ? 0 : 1)+(btnConfigure.Visible ? 1 : 0));
+            int requiredLines = Math.Max(descriptionLines, 1+(string.IsNullOrEmpty(labelVersion.Text) ? 0 : 1)+(isConfigurable ? 1 : 0));
             
             switch(requiredLines){
                 case 1: nextHeight = MaximumSize.Height-2*(font.Height-1); break;
@@ -111,7 +114,8 @@ private void UpdatePluginState(){
                 labelName.ForeColor = textColor;
                 labelDescription.ForeColor = textColor;
                 btnToggleState.Text = isEnabled ? "Disable" : "Enable";
-                btnConfigure.Visible = isEnabled && pluginManager.IsPluginConfigurable(plugin);
+                btnConfigure.Visible = isConfigurable;
+                btnConfigure.Enabled = isEnabled;
             }
             else{
                 labelName.ForeColor = Color.DarkRed;