From d22b1c02be9f30d19a6976f303d8f2db64685a3d Mon Sep 17 00:00:00 2001 From: Charles Lechasseur Date: Sat, 18 Jan 2020 17:50:42 -0500 Subject: [PATCH] #92 : Add label to display min version required in Expert mode --- .../Core/Plugins/PipelinePlugins.cs | 4 ++-- PathCopyCopySettings/GlobalSuppressions.cs | 3 ++- .../PathCopyCopySettings.csproj | 4 ++-- .../Properties/Resources.Designer.cs | 8 +++---- .../Properties/Resources.resx | 8 +++---- .../AdvancedPipelinePluginForm.Designer.cs | 24 ++++++++++++++----- .../UI/Forms/AdvancedPipelinePluginForm.cs | 24 +++++++++++++++---- .../UI/Forms/AdvancedPipelinePluginForm.resx | 2 +- .../UserControls/PluginPreviewUserControl.cs | 2 -- 9 files changed, 53 insertions(+), 26 deletions(-) diff --git a/PathCopyCopySettings/Core/Plugins/PipelinePlugins.cs b/PathCopyCopySettings/Core/Plugins/PipelinePlugins.cs index 5e26fb5..6484a9d 100644 --- a/PathCopyCopySettings/Core/Plugins/PipelinePlugins.cs +++ b/PathCopyCopySettings/Core/Plugins/PipelinePlugins.cs @@ -1754,8 +1754,8 @@ protected override bool IncludePipelineElementsInEditingControl() } /// - /// Pipeline element that applies the effect of another - /// pipeline plugin on the path. + /// Pipeline element that applies the effect of another plugin on the path. + /// This element supports pipeline plugins. /// public class ApplyPipelinePluginPipelineElement : PipelineElementWithPluginID { diff --git a/PathCopyCopySettings/GlobalSuppressions.cs b/PathCopyCopySettings/GlobalSuppressions.cs index 3fc10ac..ef3f859 100644 --- a/PathCopyCopySettings/GlobalSuppressions.cs +++ b/PathCopyCopySettings/GlobalSuppressions.cs @@ -41,4 +41,5 @@ [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:CommandLine.Parser.defaultArgument")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:CommandLine.Parser.arguments")] [assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:CommandLine.Parser.reporter")] -[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:CommandLine.Parser.Argument.flags")] \ No newline at end of file +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:CommandLine.Parser.Argument.flags")] +[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "", Scope = "member", Target = "~F:PathCopyCopy.Settings.UI.UserControls.PluginPreviewUserControl.settings")] \ No newline at end of file diff --git a/PathCopyCopySettings/PathCopyCopySettings.csproj b/PathCopyCopySettings/PathCopyCopySettings.csproj index 779257d..120a8bc 100644 --- a/PathCopyCopySettings/PathCopyCopySettings.csproj +++ b/PathCopyCopySettings/PathCopyCopySettings.csproj @@ -117,7 +117,7 @@ PipelineElementWithExecutableUserControl.cs - + UserControl @@ -211,7 +211,7 @@ PipelineElementWithExecutableUserControl.cs - + PipelineElementWithPluginIDUserControl.cs diff --git a/PathCopyCopySettings/Properties/Resources.Designer.cs b/PathCopyCopySettings/Properties/Resources.Designer.cs index a04905b..2772398 100644 --- a/PathCopyCopySettings/Properties/Resources.Designer.cs +++ b/PathCopyCopySettings/Properties/Resources.Designer.cs @@ -461,7 +461,7 @@ internal static string PCC_EXECUTOR_DLL_NAME_DEV { } /// - /// Looks up a localized string similar to Use Base Custom Command. + /// Looks up a localized string similar to Use Base Command. /// internal static string PipelineElement_ApplyPipelinePlugin { get { @@ -470,7 +470,7 @@ internal static string PipelineElement_ApplyPipelinePlugin { } /// - /// Looks up a localized string similar to Choose a base custom command to use to get an initial path value. + /// Looks up a localized string similar to Choose a base command to use to get an initial path value. /// internal static string PipelineElement_ApplyPipelinePlugin_HelpText { get { @@ -479,7 +479,7 @@ internal static string PipelineElement_ApplyPipelinePlugin_HelpText { } /// - /// Looks up a localized string similar to Use Base Command. + /// Looks up a localized string similar to Use Base Command (No Custom Command). /// internal static string PipelineElement_ApplyPlugin { get { @@ -488,7 +488,7 @@ internal static string PipelineElement_ApplyPlugin { } /// - /// Looks up a localized string similar to Choose a base command to use to get an initial path value. + /// Looks up a localized string similar to Choose a base command (but not a custom command) to use to get an initial path value. /// internal static string PipelineElement_ApplyPlugin_HelpText { get { diff --git a/PathCopyCopySettings/Properties/Resources.resx b/PathCopyCopySettings/Properties/Resources.resx index 11cb0ba..aeb9071 100644 --- a/PathCopyCopySettings/Properties/Resources.resx +++ b/PathCopyCopySettings/Properties/Resources.resx @@ -325,7 +325,7 @@ Control-click to avoid displaying an icon for this command. This custom command is now too complex to be edited in Simple Mode. If you switch, you will lose some customization. Do you really want to switch to Simple Mode? - Use Base Command + Use Base Command (No Custom Command) Turn Backslashes Into Forward Slashes @@ -367,7 +367,7 @@ Control-click to avoid displaying an icon for this command. Remove File Extension - Choose a base command to use to get an initial path value + Choose a base command (but not a custom command) to use to get an initial path value Replace every backslash ( \ ) in the path with a forward slash ( / ) @@ -436,9 +436,9 @@ Control-click to avoid displaying an icon for this command. Replaces parts of the path with environment variable references, if possible (like %USERPROFILE%, etc.) - Use Base Custom Command + Use Base Command - Choose a base custom command to use to get an initial path value + Choose a base command to use to get an initial path value \ No newline at end of file diff --git a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.Designer.cs b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.Designer.cs index 8824352..f290646 100644 --- a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.Designer.cs +++ b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.Designer.cs @@ -47,6 +47,7 @@ private void InitializeComponent() this.NewElementContextMenuStrip = new System.Windows.Forms.ContextMenuStrip(this.components); this.PreviewCtrl = new PathCopyCopy.Settings.UI.UserControls.PluginPreviewUserControl(); this.UserControlPlacementPanel = new System.Windows.Forms.Panel(); + this.MinVersionLbl = new System.Windows.Forms.Label(); this.SuspendLayout(); // // CancelBtn @@ -56,7 +57,7 @@ private void InitializeComponent() this.CancelBtn.Location = new System.Drawing.Point(551, 395); this.CancelBtn.Name = "CancelBtn"; this.CancelBtn.Size = new System.Drawing.Size(75, 23); - this.CancelBtn.TabIndex = 13; + this.CancelBtn.TabIndex = 14; this.CancelBtn.Text = "Cancel"; this.AdvancedPipelinePluginToolTip.SetToolTip(this.CancelBtn, "Do not save this custom command and close the window"); this.CancelBtn.UseVisualStyleBackColor = true; @@ -68,7 +69,7 @@ private void InitializeComponent() this.OKBtn.Location = new System.Drawing.Point(470, 395); this.OKBtn.Name = "OKBtn"; this.OKBtn.Size = new System.Drawing.Size(75, 23); - this.OKBtn.TabIndex = 12; + this.OKBtn.TabIndex = 13; this.OKBtn.Text = "OK"; this.AdvancedPipelinePluginToolTip.SetToolTip(this.OKBtn, "Save this custom command and close the window"); this.OKBtn.UseVisualStyleBackColor = true; @@ -80,7 +81,7 @@ private void InitializeComponent() this.SwitchBtn.Location = new System.Drawing.Point(12, 395); this.SwitchBtn.Name = "SwitchBtn"; this.SwitchBtn.Size = new System.Drawing.Size(94, 23); - this.SwitchBtn.TabIndex = 11; + this.SwitchBtn.TabIndex = 12; this.SwitchBtn.Text = "Simple Mode"; this.AdvancedPipelinePluginToolTip.SetToolTip(this.SwitchBtn, "Switch to Simple Mode, which is easier to use but has less customzation options"); this.SwitchBtn.UseVisualStyleBackColor = true; @@ -192,7 +193,7 @@ private void InitializeComponent() this.SelectElementLbl.Location = new System.Drawing.Point(256, 67); this.SelectElementLbl.Name = "SelectElementLbl"; this.SelectElementLbl.Size = new System.Drawing.Size(266, 13); - this.SelectElementLbl.TabIndex = 8; + this.SelectElementLbl.TabIndex = 9; this.SelectElementLbl.Text = "Please select an element in the list to edit its properties."; // // NewElementContextMenuStrip @@ -208,7 +209,7 @@ private void InitializeComponent() this.PreviewCtrl.Name = "PreviewCtrl"; this.PreviewCtrl.Plugin = null; this.PreviewCtrl.Size = new System.Drawing.Size(370, 53); - this.PreviewCtrl.TabIndex = 10; + this.PreviewCtrl.TabIndex = 11; // // UserControlPlacementPanel // @@ -218,9 +219,18 @@ private void InitializeComponent() this.UserControlPlacementPanel.Location = new System.Drawing.Point(256, 67); this.UserControlPlacementPanel.Name = "UserControlPlacementPanel"; this.UserControlPlacementPanel.Size = new System.Drawing.Size(370, 257); - this.UserControlPlacementPanel.TabIndex = 9; + this.UserControlPlacementPanel.TabIndex = 10; this.UserControlPlacementPanel.Visible = false; // + // MinVersionLbl + // + this.MinVersionLbl.AutoSize = true; + this.MinVersionLbl.Location = new System.Drawing.Point(256, 43); + this.MinVersionLbl.Name = "MinVersionLbl"; + this.MinVersionLbl.Size = new System.Drawing.Size(304, 13); + this.MinVersionLbl.TabIndex = 8; + this.MinVersionLbl.Text = "Minimum Path Copy Copy version needed to use command: {0}"; + // // AdvancedPipelinePluginForm // this.AcceptButton = this.OKBtn; @@ -228,6 +238,7 @@ private void InitializeComponent() this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; this.CancelButton = this.CancelBtn; this.ClientSize = new System.Drawing.Size(638, 430); + this.Controls.Add(this.MinVersionLbl); this.Controls.Add(this.PreviewCtrl); this.Controls.Add(this.SelectElementLbl); this.Controls.Add(this.MoveElementDownBtn); @@ -278,5 +289,6 @@ private void InitializeComponent() private System.Windows.Forms.ContextMenuStrip NewElementContextMenuStrip; private UserControls.PluginPreviewUserControl PreviewCtrl; private System.Windows.Forms.Panel UserControlPlacementPanel; + private System.Windows.Forms.Label MinVersionLbl; } } \ No newline at end of file diff --git a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.cs b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.cs index 4241b6c..6b5d663 100644 --- a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.cs +++ b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.cs @@ -23,6 +23,7 @@ using System.ComponentModel; using System.Diagnostics; using System.Drawing; +using System.Globalization; using System.Windows.Forms; using PathCopyCopy.Settings.Core.Plugins; using PathCopyCopy.Settings.Properties; @@ -121,14 +122,18 @@ public PipelinePluginInfo EditPlugin(IWin32Window owner, PipelinePluginInfo oldI /// Event arguments. private void AdvancedPipelinePluginForm_Load(object sender, EventArgs e) { + // The initial text of the MinVersionLbl control is a format string. + // Save it in its Tag to be able to reuse it. + MinVersionLbl.Tag = MinVersionLbl.Text; + // Populate the context menu strip used to create new elements. // We do this in code to be able to reuse resources to avoid string duplication. - AddNewElementMenuItem(Resources.PipelineElement_ApplyPlugin, - Resources.PipelineElement_ApplyPlugin_HelpText, - () => new ApplyPluginPipelineElement(new Guid(Resources.LONG_PATH_PLUGIN_ID))); AddNewElementMenuItem(Resources.PipelineElement_ApplyPipelinePlugin, Resources.PipelineElement_ApplyPipelinePlugin_HelpText, () => new ApplyPipelinePluginPipelineElement(new Guid(Resources.LONG_PATH_PLUGIN_ID))); + AddNewElementMenuItem(Resources.PipelineElement_ApplyPlugin, + Resources.PipelineElement_ApplyPlugin_HelpText, + () => new ApplyPluginPipelineElement(new Guid(Resources.LONG_PATH_PLUGIN_ID))); AddNewElementMenuItem("-", null, null); AddNewElementMenuItem(Resources.PipelineElement_RemoveExt, Resources.PipelineElement_RemoveExt_HelpText, @@ -219,10 +224,21 @@ private void UpdatePluginInfo() }; Debug.Assert(!pluginInfo.Global); - // Save plugin info and pipeline, then update preview. + // Save plugin info and pipeline, then update preview and min version. newPluginInfo = pluginInfo; newPipeline = pipeline; PreviewCtrl.Plugin = newPluginInfo.ToPlugin(); + Version requiredVersion = newPipeline.RequiredVersion; + int numComponents; + if (requiredVersion.Revision > 0) { + numComponents = 4; + } else if (requiredVersion.Build > 0) { + numComponents = 3; + } else { + numComponents = 2; + } + MinVersionLbl.Text = string.Format(CultureInfo.CurrentCulture, + MinVersionLbl.Tag as string, requiredVersion.ToString(numComponents)); } /// diff --git a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.resx b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.resx index 71c5ce8..ff1a0ed 100644 --- a/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.resx +++ b/PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.resx @@ -128,7 +128,7 @@ AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0 ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABs - CgAAAk1TRnQBSQFMAgEBBAEAAUABAAFAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo + CgAAAk1TRnQBSQFMAgEBBAEAAUgBAAFIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5 AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA diff --git a/PathCopyCopySettings/UI/UserControls/PluginPreviewUserControl.cs b/PathCopyCopySettings/UI/UserControls/PluginPreviewUserControl.cs index 7cd1df9..3dbd254 100644 --- a/PathCopyCopySettings/UI/UserControls/PluginPreviewUserControl.cs +++ b/PathCopyCopySettings/UI/UserControls/PluginPreviewUserControl.cs @@ -34,10 +34,8 @@ public partial class PluginPreviewUserControl : UserControl /// Plugin we're currently previewing. private Plugin plugin; -#pragma warning disable IDE0044 // Add readonly modifier /// Object used to access user settings. private UserSettings settings; -#pragma warning restore IDE0044 // Add readonly modifier /// /// Plugin to preview. Change this to update the preview displayed.