Skip to content

Commit

Permalink
#92 : Add label to display min version required in Expert mode
Browse files Browse the repository at this point in the history
  • Loading branch information
clechasseur committed Jan 18, 2020
1 parent a64596f commit d22b1c0
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 26 deletions.
4 changes: 2 additions & 2 deletions PathCopyCopySettings/Core/Plugins/PipelinePlugins.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1754,8 +1754,8 @@ protected override bool IncludePipelineElementsInEditingControl()
}

/// <summary>
/// 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.
/// </summary>
public class ApplyPipelinePluginPipelineElement : PipelineElementWithPluginID
{
Expand Down
3 changes: 2 additions & 1 deletion PathCopyCopySettings/GlobalSuppressions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:CommandLine.Parser.defaultArgument")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:CommandLine.Parser.arguments")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:CommandLine.Parser.reporter")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:CommandLine.Parser.Argument.flags")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:CommandLine.Parser.Argument.flags")]
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0044:Add readonly modifier", Justification = "<Pending>", Scope = "member", Target = "~F:PathCopyCopy.Settings.UI.UserControls.PluginPreviewUserControl.settings")]
4 changes: 2 additions & 2 deletions PathCopyCopySettings/PathCopyCopySettings.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@
<Compile Include="UI\UserControls\PipelineElementWithExecutableUserControl.Designer.cs">
<DependentUpon>PipelineElementWithExecutableUserControl.cs</DependentUpon>
</Compile>
<Compile Include="UI\UserControls\PipelineElementWithPluginIDUserControl.cs">
<Compile Include="UI\UserControls\PipelineElementWithPluginIDUserControl.cs">
<SubType>UserControl</SubType>
</Compile>
<Compile Include="UI\UserControls\PipelineElementWithPluginIDUserControl.Designer.cs">
Expand Down Expand Up @@ -211,7 +211,7 @@
<EmbeddedResource Include="UI\UserControls\PipelineElementWithExecutableUserControl.resx">
<DependentUpon>PipelineElementWithExecutableUserControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\UserControls\PipelineElementWithPluginIDUserControl.resx">
<EmbeddedResource Include="UI\UserControls\PipelineElementWithPluginIDUserControl.resx">
<DependentUpon>PipelineElementWithPluginIDUserControl.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="UI\UserControls\PluginPreviewUserControl.resx">
Expand Down
8 changes: 4 additions & 4 deletions PathCopyCopySettings/Properties/Resources.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions PathCopyCopySettings/Properties/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -325,7 +325,7 @@ Control-click to avoid displaying an icon for this command.</value>
<value>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?</value>
</data>
<data name="PipelineElement_ApplyPlugin" xml:space="preserve">
<value>Use Base Command</value>
<value>Use Base Command (No Custom Command)</value>
</data>
<data name="PipelineElement_BackToForwardSlashes" xml:space="preserve">
<value>Turn Backslashes Into Forward Slashes</value>
Expand Down Expand Up @@ -367,7 +367,7 @@ Control-click to avoid displaying an icon for this command.</value>
<value>Remove File Extension</value>
</data>
<data name="PipelineElement_ApplyPlugin_HelpText" xml:space="preserve">
<value>Choose a base command to use to get an initial path value</value>
<value>Choose a base command (but not a custom command) to use to get an initial path value</value>
</data>
<data name="PipelineElement_BackToForwardSlashes_HelpText" xml:space="preserve">
<value>Replace every backslash ( \ ) in the path with a forward slash ( / )</value>
Expand Down Expand Up @@ -436,9 +436,9 @@ Control-click to avoid displaying an icon for this command.</value>
<value>Replaces parts of the path with environment variable references, if possible (like %USERPROFILE%, etc.)</value>
</data>
<data name="PipelineElement_ApplyPipelinePlugin" xml:space="preserve">
<value>Use Base Custom Command</value>
<value>Use Base Command</value>
</data>
<data name="PipelineElement_ApplyPipelinePlugin_HelpText" xml:space="preserve">
<value>Choose a base custom command to use to get an initial path value</value>
<value>Choose a base command to use to get an initial path value</value>
</data>
</root>

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

24 changes: 20 additions & 4 deletions PathCopyCopySettings/UI/Forms/AdvancedPipelinePluginForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -121,14 +122,18 @@ public PipelinePluginInfo EditPlugin(IWin32Window owner, PipelinePluginInfo oldI
/// <param name="e">Event arguments.</param>
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,
Expand Down Expand Up @@ -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));
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@
AAEAAAD/////AQAAAAAAAAAMAgAAAFdTeXN0ZW0uV2luZG93cy5Gb3JtcywgVmVyc2lvbj00LjAuMC4w
LCBDdWx0dXJlPW5ldXRyYWwsIFB1YmxpY0tleVRva2VuPWI3N2E1YzU2MTkzNGUwODkFAQAAACZTeXN0
ZW0uV2luZG93cy5Gb3Jtcy5JbWFnZUxpc3RTdHJlYW1lcgEAAAAERGF0YQcCAgAAAAkDAAAADwMAAABs
CgAAAk1TRnQBSQFMAgEBBAEAAUABAAFAAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
CgAAAk1TRnQBSQFMAgEBBAEAAUgBAAFIAQABEAEAARABAAT/AQkBAAj/AUIBTQE2AQQGAAE2AQQCAAEo
AwABQAMAASADAAEBAQABCAYAAQgYAAGAAgABgAMAAoABAAGAAwABgAEAAYABAAKAAgADwAEAAcAB3AHA
AQAB8AHKAaYBAAEzBQABMwEAATMBAAEzAQACMwIAAxYBAAMcAQADIgEAAykBAANVAQADTQEAA0IBAAM5
AQABgAF8Af8BAAJQAf8BAAGTAQAB1gEAAf8B7AHMAQABxgHWAe8BAAHWAucBAAGQAakBrQIAAf8BMwMA
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

/// <summary>
/// Plugin to preview. Change this to update the preview displayed.
Expand Down

0 comments on commit d22b1c0

Please sign in to comment.