mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Actions support output extension now so you can use things like 7-Zip (Args: a %output %input)
This commit is contained in:
parent
a41294913c
commit
85da0dccdb
19 changed files with 298 additions and 199 deletions
|
@ -30,16 +30,19 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace HelpersLib
|
||||
{
|
||||
public class ExtCodeMenuEntry : CodeMenuEntry
|
||||
public class ActionsCodeMenuEntry : CodeMenuEntry
|
||||
{
|
||||
public ExtCodeMenuEntry(string value, string description) : base(value, description) { }
|
||||
public ActionsCodeMenuEntry(string value, string description)
|
||||
: base(value, description)
|
||||
{
|
||||
}
|
||||
|
||||
public override String ToPrefixString() { return '.' + _value; }
|
||||
public override String ToPrefixString()
|
||||
{
|
||||
return '%' + _value;
|
||||
}
|
||||
|
||||
public static readonly ExtCodeMenuEntry bmp = new ExtCodeMenuEntry("bmp", "Bitmap Image File");
|
||||
public static readonly ExtCodeMenuEntry gif = new ExtCodeMenuEntry("gif", "Graphical Interchange Format File");
|
||||
public static readonly ExtCodeMenuEntry jpg = new ExtCodeMenuEntry("jpg", "JPEG Image");
|
||||
public static readonly ExtCodeMenuEntry png = new ExtCodeMenuEntry("png", "Portable Network Graphic");
|
||||
public static readonly ExtCodeMenuEntry tif = new ExtCodeMenuEntry("tif", "Tagged Image File");
|
||||
public static readonly ActionsCodeMenuEntry FilePath = new ActionsCodeMenuEntry("input", "File path");
|
||||
public static readonly ActionsCodeMenuEntry OutputFilePath = new ActionsCodeMenuEntry("output", "File path without extension + \"Output file name extension\"");
|
||||
}
|
||||
}
|
|
@ -145,24 +145,19 @@ public static Size Offset(this Size size, int offset)
|
|||
return new Size(size.Width + offset, size.Height + offset);
|
||||
}
|
||||
|
||||
public static Rectangle RectangleOffset(this Rectangle rect, int offset)
|
||||
public static Rectangle Offset(this Rectangle rect, int offset)
|
||||
{
|
||||
return new Rectangle(rect.X - offset, rect.Y - offset, rect.Width + offset * 2, rect.Height + offset * 2);
|
||||
}
|
||||
|
||||
public static Rectangle LocationOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return new Rectangle(rect.X + offset, rect.Y + offset, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rectangle LocationOffset(this Rectangle rect, int x, int y)
|
||||
{
|
||||
return new Rectangle(rect.X + x, rect.Y + y, rect.Width, rect.Height);
|
||||
}
|
||||
|
||||
public static Rectangle SizeOffset(this Rectangle rect, int offset)
|
||||
public static Rectangle LocationOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return rect.SizeOffset(offset, offset);
|
||||
return rect.LocationOffset(offset, offset);
|
||||
}
|
||||
|
||||
public static Rectangle SizeOffset(this Rectangle rect, int width, int height)
|
||||
|
@ -170,6 +165,11 @@ public static Rectangle SizeOffset(this Rectangle rect, int width, int height)
|
|||
return new Rectangle(rect.X, rect.Y, rect.Width + width, rect.Height + height);
|
||||
}
|
||||
|
||||
public static Rectangle SizeOffset(this Rectangle rect, int offset)
|
||||
{
|
||||
return rect.SizeOffset(offset, offset);
|
||||
}
|
||||
|
||||
public static string Join<T>(this T[] array, string separator = " ")
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
|
|
|
@ -37,11 +37,12 @@ public class ExternalProgram
|
|||
public string Path { get; set; }
|
||||
public string Args { get; set; }
|
||||
public string Extensions { get; set; }
|
||||
public string OutputExtension { get; set; }
|
||||
|
||||
public ExternalProgram()
|
||||
{
|
||||
IsActive = false;
|
||||
Args = "%filepath%";
|
||||
Args = "%input";
|
||||
}
|
||||
|
||||
public ExternalProgram(string name, string path)
|
||||
|
@ -60,12 +61,11 @@ public ExternalProgram(string name, string path, string args)
|
|||
}
|
||||
}
|
||||
|
||||
public void Run(string filePath)
|
||||
public string Run(string filePath)
|
||||
{
|
||||
if (!CheckExtensions(filePath)) return;
|
||||
if (!string.IsNullOrEmpty(Path) && File.Exists(Path))
|
||||
if (!string.IsNullOrEmpty(filePath) && CheckExtensions(filePath) && !string.IsNullOrEmpty(Path) && File.Exists(Path))
|
||||
{
|
||||
filePath = '"' + filePath.Trim('"') + '"';
|
||||
filePath = filePath.Trim('"');
|
||||
|
||||
try
|
||||
{
|
||||
|
@ -79,7 +79,15 @@ public void Run(string filePath)
|
|||
}
|
||||
else
|
||||
{
|
||||
psi.Arguments = Args.Replace("%filepath%", filePath);
|
||||
string args = Args.Replace("%filepath%", '"' + filePath + '"').Replace("%input", '"' + filePath + '"');
|
||||
|
||||
if (!string.IsNullOrEmpty(OutputExtension))
|
||||
{
|
||||
filePath = Helpers.ChangeFilenameExtension(filePath, OutputExtension);
|
||||
args = args.Replace("%output", '"' + filePath + '"');
|
||||
}
|
||||
|
||||
psi.Arguments = args;
|
||||
}
|
||||
|
||||
process.StartInfo = psi;
|
||||
|
@ -89,20 +97,26 @@ public void Run(string filePath)
|
|||
process.Start();
|
||||
process.WaitForExit();
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
DebugHelper.WriteException(e);
|
||||
}
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private bool CheckExtensions(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(Extensions) || string.IsNullOrEmpty(path)) return true;
|
||||
int idx = 0;
|
||||
for (int i = 0; i <= Extensions.Length; ++i) {
|
||||
if (i == Extensions.Length || !char.IsLetterOrDigit(Extensions[i])) {
|
||||
for (int i = 0; i <= Extensions.Length; ++i)
|
||||
{
|
||||
if (i == Extensions.Length || !char.IsLetterOrDigit(Extensions[i]))
|
||||
{
|
||||
if (idx < i && path.EndsWith(Extensions.Substring(idx, i - idx))) return true;
|
||||
idx = i + 1;
|
||||
}
|
||||
|
|
|
@ -55,19 +55,45 @@ public static class Helpers
|
|||
|
||||
public static readonly Version OSVersion = Environment.OSVersion.Version;
|
||||
|
||||
// Extension without dot
|
||||
public static string GetFilenameExtension(string filePath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filePath) && filePath.Contains('.'))
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
int pos = filePath.LastIndexOf('.');
|
||||
|
||||
if (pos <= filePath.Length)
|
||||
if (pos >= 0)
|
||||
{
|
||||
return filePath.Substring(pos + 1);
|
||||
return filePath.Substring(pos + 1).ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
return string.Empty;
|
||||
return null;
|
||||
}
|
||||
|
||||
public static string ChangeFilenameExtension(string filePath, string extension)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filePath) && !string.IsNullOrEmpty(extension))
|
||||
{
|
||||
int pos = filePath.LastIndexOf('.');
|
||||
|
||||
if (pos >= 0)
|
||||
{
|
||||
filePath = filePath.Remove(pos);
|
||||
|
||||
extension = extension.Trim();
|
||||
pos = extension.LastIndexOf('.');
|
||||
|
||||
if (pos >= 0)
|
||||
{
|
||||
extension = extension.Substring(pos + 1);
|
||||
}
|
||||
|
||||
return filePath + "." + extension;
|
||||
}
|
||||
}
|
||||
|
||||
return filePath;
|
||||
}
|
||||
|
||||
private static bool IsValidFile(string filePath, Type enumType)
|
||||
|
@ -264,7 +290,8 @@ public static string[] GetEnumNamesProper<T>()
|
|||
public static T[] GetValueFields<T>()
|
||||
{
|
||||
var res = new List<T>();
|
||||
foreach (FieldInfo fi in typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public)) {
|
||||
foreach (FieldInfo fi in typeof(T).GetFields(BindingFlags.Static | BindingFlags.Public))
|
||||
{
|
||||
if (fi.FieldType != typeof(T)) continue;
|
||||
res.Add((T)fi.GetValue(null));
|
||||
}
|
||||
|
@ -294,23 +321,6 @@ public static string GetProperName(string name)
|
|||
return sb.ToString();
|
||||
}
|
||||
|
||||
// Extension without dot
|
||||
public static string GetProperExtension(string filePath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(filePath))
|
||||
{
|
||||
int dot = filePath.LastIndexOf('.');
|
||||
|
||||
if (dot >= 0)
|
||||
{
|
||||
string ext = filePath.Substring(dot + 1);
|
||||
return ext.ToLowerInvariant();
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void OpenFolder(string folderPath)
|
||||
{
|
||||
if (!string.IsNullOrEmpty(folderPath))
|
||||
|
|
|
@ -1054,7 +1054,7 @@ public static string OpenImageFileDialog()
|
|||
public static ImageFormat GetImageFormat(string filePath)
|
||||
{
|
||||
ImageFormat imageFormat = ImageFormat.Png;
|
||||
string ext = Helpers.GetProperExtension(filePath);
|
||||
string ext = Helpers.GetFilenameExtension(filePath);
|
||||
|
||||
if (!string.IsNullOrEmpty(ext))
|
||||
{
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ActionsCodeMenuEntry.cs" />
|
||||
<Compile Include="ClipboardFormat.cs" />
|
||||
<Compile Include="CodeMenu.cs" />
|
||||
<Compile Include="ColorMatrixManager.cs" />
|
||||
|
@ -86,7 +87,6 @@
|
|||
<Compile Include="DWMManager.cs" />
|
||||
<Compile Include="EncoderProgram.cs" />
|
||||
<Compile Include="CLI\ExternalCLIManager.cs" />
|
||||
<Compile Include="ExtCodeMenuEntry.cs" />
|
||||
<Compile Include="Extensions\NumberExtensions.cs" />
|
||||
<Compile Include="FontSafe.cs" />
|
||||
<Compile Include="Forms\OutputBox.cs">
|
||||
|
|
|
@ -393,7 +393,7 @@ private void DrawTips(Graphics g)
|
|||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + (primaryScreenBounds.Width / 2) - (rectWidth / 2), primaryScreenBounds.Y + offset, rectWidth, rectHeight);
|
||||
|
||||
if (textRectangle.RectangleOffset(10).Contains(CurrentMousePosition0Based))
|
||||
if (textRectangle.Offset(10).Contains(CurrentMousePosition0Based))
|
||||
{
|
||||
textRectangle.Y = primaryScreenBounds.Height - rectHeight - offset;
|
||||
}
|
||||
|
|
|
@ -282,7 +282,7 @@ private void DrawInfo(Graphics g)
|
|||
Rectangle primaryScreenBounds = CaptureHelpers.GetPrimaryScreenBounds0Based();
|
||||
Rectangle textRectangle = new Rectangle(primaryScreenBounds.X + offset, primaryScreenBounds.Y + offset, (int)textSize.Width, (int)textSize.Height);
|
||||
|
||||
if (textRectangle.RectangleOffset(10).Contains(InputManager.MousePosition0Based))
|
||||
if (textRectangle.Offset(10).Contains(InputManager.MousePosition0Based))
|
||||
{
|
||||
textRectangle.Y = primaryScreenBounds.Height - textRectangle.Height - offset;
|
||||
}
|
||||
|
|
|
@ -63,15 +63,15 @@ public override void Draw(Graphics g)
|
|||
switch (Shape)
|
||||
{
|
||||
case NodeShape.Square:
|
||||
g.DrawRectangle(Pens.White, rect.RectangleOffset(-1));
|
||||
g.DrawRectangle(Pens.White, rect.Offset(-1));
|
||||
g.DrawRectangle(Pens.Black, rect);
|
||||
break;
|
||||
case NodeShape.Circle:
|
||||
g.DrawEllipse(Pens.White, rect.RectangleOffset(-1));
|
||||
g.DrawEllipse(Pens.White, rect.Offset(-1));
|
||||
g.DrawEllipse(Pens.Black, rect);
|
||||
break;
|
||||
case NodeShape.Diamond:
|
||||
g.DrawDiamond(Pens.White, rect.RectangleOffset(-1));
|
||||
g.DrawDiamond(Pens.White, rect.Offset(-1));
|
||||
g.DrawDiamond(Pens.Black, rect);
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
namespace ShareX
|
||||
{
|
||||
partial class ExternalProgramForm
|
||||
partial class ActionsForm
|
||||
{
|
||||
/// <summary>
|
||||
/// Required designer variable.
|
||||
|
@ -39,12 +39,14 @@ private void InitializeComponent()
|
|||
this.btnCancel = new System.Windows.Forms.Button();
|
||||
this.lblExtensions = new System.Windows.Forms.Label();
|
||||
this.txtExtensions = new System.Windows.Forms.TextBox();
|
||||
this.txtOutputExtension = new System.Windows.Forms.TextBox();
|
||||
this.lblOutputExtension = new System.Windows.Forms.Label();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblName
|
||||
//
|
||||
this.lblName.AutoSize = true;
|
||||
this.lblName.Location = new System.Drawing.Point(16, 16);
|
||||
this.lblName.Location = new System.Drawing.Point(8, 8);
|
||||
this.lblName.Name = "lblName";
|
||||
this.lblName.Size = new System.Drawing.Size(38, 13);
|
||||
this.lblName.TabIndex = 0;
|
||||
|
@ -53,16 +55,16 @@ private void InitializeComponent()
|
|||
// lblPath
|
||||
//
|
||||
this.lblPath.AutoSize = true;
|
||||
this.lblPath.Location = new System.Drawing.Point(16, 40);
|
||||
this.lblPath.Location = new System.Drawing.Point(8, 56);
|
||||
this.lblPath.Name = "lblPath";
|
||||
this.lblPath.Size = new System.Drawing.Size(32, 13);
|
||||
this.lblPath.Size = new System.Drawing.Size(50, 13);
|
||||
this.lblPath.TabIndex = 2;
|
||||
this.lblPath.Text = "Path:";
|
||||
this.lblPath.Text = "File path:";
|
||||
//
|
||||
// lblArgs
|
||||
//
|
||||
this.lblArgs.AutoSize = true;
|
||||
this.lblArgs.Location = new System.Drawing.Point(16, 64);
|
||||
this.lblArgs.Location = new System.Drawing.Point(8, 104);
|
||||
this.lblArgs.Name = "lblArgs";
|
||||
this.lblArgs.Size = new System.Drawing.Size(60, 13);
|
||||
this.lblArgs.TabIndex = 5;
|
||||
|
@ -70,30 +72,37 @@ private void InitializeComponent()
|
|||
//
|
||||
// txtName
|
||||
//
|
||||
this.txtName.Location = new System.Drawing.Point(88, 12);
|
||||
this.txtName.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtName.Location = new System.Drawing.Point(8, 24);
|
||||
this.txtName.Name = "txtName";
|
||||
this.txtName.Size = new System.Drawing.Size(224, 20);
|
||||
this.txtName.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtName.TabIndex = 1;
|
||||
//
|
||||
// txtPath
|
||||
//
|
||||
this.txtPath.Location = new System.Drawing.Point(88, 36);
|
||||
this.txtPath.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtPath.Location = new System.Drawing.Point(8, 72);
|
||||
this.txtPath.Name = "txtPath";
|
||||
this.txtPath.Size = new System.Drawing.Size(176, 20);
|
||||
this.txtPath.Size = new System.Drawing.Size(248, 20);
|
||||
this.txtPath.TabIndex = 3;
|
||||
//
|
||||
// txtArguments
|
||||
//
|
||||
this.txtArguments.Location = new System.Drawing.Point(88, 60);
|
||||
this.txtArguments.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtArguments.Location = new System.Drawing.Point(8, 120);
|
||||
this.txtArguments.Name = "txtArguments";
|
||||
this.txtArguments.Size = new System.Drawing.Size(224, 20);
|
||||
this.txtArguments.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtArguments.TabIndex = 6;
|
||||
//
|
||||
// btnPathBrowse
|
||||
//
|
||||
this.btnPathBrowse.Location = new System.Drawing.Point(272, 35);
|
||||
this.btnPathBrowse.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnPathBrowse.Location = new System.Drawing.Point(264, 70);
|
||||
this.btnPathBrowse.Name = "btnPathBrowse";
|
||||
this.btnPathBrowse.Size = new System.Drawing.Size(40, 23);
|
||||
this.btnPathBrowse.Size = new System.Drawing.Size(40, 24);
|
||||
this.btnPathBrowse.TabIndex = 4;
|
||||
this.btnPathBrowse.Text = "...";
|
||||
this.btnPathBrowse.UseVisualStyleBackColor = true;
|
||||
|
@ -101,9 +110,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(156, 125);
|
||||
this.btnOK.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnOK.Location = new System.Drawing.Point(152, 248);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnOK.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnOK.TabIndex = 7;
|
||||
this.btnOK.Text = "OK";
|
||||
this.btnOK.UseVisualStyleBackColor = true;
|
||||
|
@ -111,9 +121,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnCancel
|
||||
//
|
||||
this.btnCancel.Location = new System.Drawing.Point(237, 125);
|
||||
this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.btnCancel.Location = new System.Drawing.Point(232, 248);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnCancel.Size = new System.Drawing.Size(72, 24);
|
||||
this.btnCancel.TabIndex = 8;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
|
@ -122,25 +133,47 @@ private void InitializeComponent()
|
|||
// lblExtensions
|
||||
//
|
||||
this.lblExtensions.AutoSize = true;
|
||||
this.lblExtensions.Location = new System.Drawing.Point(16, 88);
|
||||
this.lblExtensions.Location = new System.Drawing.Point(8, 200);
|
||||
this.lblExtensions.Name = "lblExtensions";
|
||||
this.lblExtensions.Size = new System.Drawing.Size(61, 13);
|
||||
this.lblExtensions.Size = new System.Drawing.Size(191, 13);
|
||||
this.lblExtensions.TabIndex = 9;
|
||||
this.lblExtensions.Text = "Extensions:";
|
||||
this.lblExtensions.Text = "Extension filter: (Example: jpg png mp4)";
|
||||
//
|
||||
// txtExtensions
|
||||
//
|
||||
this.txtExtensions.Location = new System.Drawing.Point(88, 85);
|
||||
this.txtExtensions.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtExtensions.Location = new System.Drawing.Point(8, 216);
|
||||
this.txtExtensions.Name = "txtExtensions";
|
||||
this.txtExtensions.Size = new System.Drawing.Size(224, 20);
|
||||
this.txtExtensions.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtExtensions.TabIndex = 10;
|
||||
//
|
||||
// ExternalProgramForm
|
||||
// txtOutputExtension
|
||||
//
|
||||
this.txtOutputExtension.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.txtOutputExtension.Location = new System.Drawing.Point(8, 168);
|
||||
this.txtOutputExtension.Name = "txtOutputExtension";
|
||||
this.txtOutputExtension.Size = new System.Drawing.Size(296, 20);
|
||||
this.txtOutputExtension.TabIndex = 11;
|
||||
//
|
||||
// lblOutputExtension
|
||||
//
|
||||
this.lblOutputExtension.AutoSize = true;
|
||||
this.lblOutputExtension.Location = new System.Drawing.Point(8, 152);
|
||||
this.lblOutputExtension.Name = "lblOutputExtension";
|
||||
this.lblOutputExtension.Size = new System.Drawing.Size(277, 13);
|
||||
this.lblOutputExtension.TabIndex = 12;
|
||||
this.lblOutputExtension.Text = "Output file name extension: (Empty = Use same file name)";
|
||||
//
|
||||
// ActionsForm
|
||||
//
|
||||
this.AcceptButton = this.btnOK;
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
|
||||
this.ClientSize = new System.Drawing.Size(327, 160);
|
||||
this.ClientSize = new System.Drawing.Size(313, 281);
|
||||
this.Controls.Add(this.lblOutputExtension);
|
||||
this.Controls.Add(this.txtOutputExtension);
|
||||
this.Controls.Add(this.txtExtensions);
|
||||
this.Controls.Add(this.lblExtensions);
|
||||
this.Controls.Add(this.btnCancel);
|
||||
|
@ -152,10 +185,10 @@ private void InitializeComponent()
|
|||
this.Controls.Add(this.lblArgs);
|
||||
this.Controls.Add(this.lblPath);
|
||||
this.Controls.Add(this.lblName);
|
||||
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedDialog;
|
||||
this.Name = "ExternalProgramForm";
|
||||
this.MaximizeBox = false;
|
||||
this.Name = "ActionsForm";
|
||||
this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen;
|
||||
this.Text = "External program";
|
||||
this.Text = "ShareX - Actions";
|
||||
this.ResumeLayout(false);
|
||||
this.PerformLayout();
|
||||
|
||||
|
@ -174,5 +207,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Label lblExtensions;
|
||||
private System.Windows.Forms.TextBox txtExtensions;
|
||||
private System.Windows.Forms.TextBox txtOutputExtension;
|
||||
private System.Windows.Forms.Label lblOutputExtension;
|
||||
}
|
||||
}
|
|
@ -29,23 +29,25 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX
|
||||
{
|
||||
public partial class ExternalProgramForm : Form
|
||||
public partial class ActionsForm : Form
|
||||
{
|
||||
public ExternalProgram FileAction { get; private set; }
|
||||
|
||||
public ExternalProgramForm()
|
||||
public ActionsForm()
|
||||
: this(new ExternalProgram())
|
||||
{
|
||||
}
|
||||
|
||||
public ExternalProgramForm(ExternalProgram fileAction)
|
||||
public ActionsForm(ExternalProgram fileAction)
|
||||
{
|
||||
FileAction = fileAction;
|
||||
InitializeComponent();
|
||||
Icon = ShareXResources.Icon;
|
||||
FileAction = fileAction;
|
||||
txtName.Text = fileAction.Name ?? "";
|
||||
txtPath.Text = fileAction.Path ?? "";
|
||||
txtArguments.Text = fileAction.Args ?? "";
|
||||
CodeMenu.Create<ExtCodeMenuEntry>(txtExtensions);
|
||||
CodeMenu.Create<ActionsCodeMenuEntry>(txtArguments);
|
||||
txtOutputExtension.Text = fileAction.OutputExtension ?? "";
|
||||
txtExtensions.Text = fileAction.Extensions ?? "";
|
||||
}
|
||||
|
||||
|
@ -56,10 +58,23 @@ private void btnPathBrowse_Click(object sender, EventArgs e)
|
|||
|
||||
private void btnOK_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (string.IsNullOrEmpty(txtName.Text))
|
||||
{
|
||||
MessageBox.Show("Name can't be empty.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
if (string.IsNullOrEmpty(txtPath.Text))
|
||||
{
|
||||
MessageBox.Show("File path can't be empty.", "ShareX", MessageBoxButtons.OK, MessageBoxIcon.Warning);
|
||||
return;
|
||||
}
|
||||
|
||||
FileAction.Name = txtName.Text;
|
||||
FileAction.Path = txtPath.Text;
|
||||
FileAction.Args = txtArguments.Text;
|
||||
FileAction.Extensions = txtExtensions.Text;
|
||||
FileAction.OutputExtension = txtOutputExtension.Text;
|
||||
DialogResult = DialogResult.OK;
|
||||
}
|
||||
|
|
@ -84,7 +84,7 @@ private Bitmap DrawDropImage(int size)
|
|||
|
||||
using (Pen pen = new Pen(Color.WhiteSmoke, 5) { Alignment = PenAlignment.Inset })
|
||||
{
|
||||
g.DrawRectangleProper(pen, rect.RectangleOffset(-1));
|
||||
g.DrawRectangleProper(pen, rect.Offset(-1));
|
||||
}
|
||||
|
||||
string text = "Drop\nhere";
|
||||
|
|
|
@ -131,7 +131,7 @@ protected override void OnPaint(PaintEventArgs e)
|
|||
g.FillRectangle(brush, textRect);
|
||||
}
|
||||
|
||||
g.DrawString(ToastConfig.URL, textFont, Brushes.White, textRect.RectangleOffset(-urlPadding));
|
||||
g.DrawString(ToastConfig.URL, textFont, Brushes.White, textRect.Offset(-urlPadding));
|
||||
}
|
||||
}
|
||||
else if (!string.IsNullOrEmpty(ToastConfig.Text))
|
||||
|
|
|
@ -47,7 +47,7 @@ public ScreenRegionForm(Rectangle regionRectangle)
|
|||
{
|
||||
InitializeComponent();
|
||||
|
||||
borderRectangle = regionRectangle.RectangleOffset(1);
|
||||
borderRectangle = regionRectangle.Offset(1);
|
||||
borderRectangle0Based = new Rectangle(0, 0, borderRectangle.Width, borderRectangle.Height);
|
||||
|
||||
Location = borderRectangle.Location;
|
||||
|
@ -55,7 +55,7 @@ public ScreenRegionForm(Rectangle regionRectangle)
|
|||
pInfo.Location = new Point(Width - pInfo.Width, Height - pInfo.Height);
|
||||
|
||||
Region region = new Region(ClientRectangle);
|
||||
region.Exclude(borderRectangle0Based.RectangleOffset(-1));
|
||||
region.Exclude(borderRectangle0Based.Offset(-1));
|
||||
region.Exclude(new Rectangle(0, pInfo.Location.Y, pInfo.Location.X, pInfo.Height));
|
||||
Region = region;
|
||||
|
||||
|
|
215
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
215
ShareX/Forms/TaskSettingsForm.Designer.cs
generated
|
@ -42,16 +42,12 @@ private void InitializeComponent()
|
|||
this.btnDescriptionAutoFill = new System.Windows.Forms.Button();
|
||||
this.chkOverrideFTP = new System.Windows.Forms.CheckBox();
|
||||
this.cboFTPaccounts = new System.Windows.Forms.ComboBox();
|
||||
this.btnAfterCapture = new HelpersLib.MenuButton();
|
||||
this.btnAfterUpload = new HelpersLib.MenuButton();
|
||||
this.btnDestinations = new HelpersLib.MenuButton();
|
||||
this.cmsDestinations = new System.Windows.Forms.ContextMenuStrip(this.components);
|
||||
this.tsmiImageUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiTextUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiFileUploaders = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiURLShorteners = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.tsmiURLSharingServices = new System.Windows.Forms.ToolStripMenuItem();
|
||||
this.btnTask = new HelpersLib.MenuButton();
|
||||
this.tpGeneral = new System.Windows.Forms.TabPage();
|
||||
this.panelGeneral = new System.Windows.Forms.Panel();
|
||||
this.chkShowBeforeUploadForm = new System.Windows.Forms.CheckBox();
|
||||
|
@ -133,10 +129,6 @@ private void InitializeComponent()
|
|||
this.tpActions = new System.Windows.Forms.TabPage();
|
||||
this.pActions = new System.Windows.Forms.Panel();
|
||||
this.btnActionsAdd = new System.Windows.Forms.Button();
|
||||
this.lvActions = new HelpersLib.MyListView();
|
||||
this.chActionsName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chActionsPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chActionsArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnActionsEdit = new System.Windows.Forms.Button();
|
||||
this.btnActionsRemove = new System.Windows.Forms.Button();
|
||||
this.chkUseDefaultActions = new System.Windows.Forms.CheckBox();
|
||||
|
@ -171,7 +163,16 @@ private void InitializeComponent()
|
|||
this.tpAdvanced = new System.Windows.Forms.TabPage();
|
||||
this.pgTaskSettings = new System.Windows.Forms.PropertyGrid();
|
||||
this.chkUseDefaultAdvancedSettings = new System.Windows.Forms.CheckBox();
|
||||
this.btnAfterCapture = new HelpersLib.MenuButton();
|
||||
this.btnAfterUpload = new HelpersLib.MenuButton();
|
||||
this.btnDestinations = new HelpersLib.MenuButton();
|
||||
this.btnTask = new HelpersLib.MenuButton();
|
||||
this.lvActions = new HelpersLib.MyListView();
|
||||
this.chActionsName = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chActionsPath = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chActionsArgs = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.chActionsExtensions = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
|
||||
this.btnActionsDuplicate = new System.Windows.Forms.Button();
|
||||
this.tcHotkeySettings.SuspendLayout();
|
||||
this.tpTask.SuspendLayout();
|
||||
this.cmsDestinations.SuspendLayout();
|
||||
|
@ -347,42 +348,6 @@ private void InitializeComponent()
|
|||
this.cboFTPaccounts.TabIndex = 11;
|
||||
this.cboFTPaccounts.SelectedIndexChanged += new System.EventHandler(this.cboFTPaccounts_SelectedIndexChanged);
|
||||
//
|
||||
// btnAfterCapture
|
||||
//
|
||||
this.btnAfterCapture.Location = new System.Drawing.Point(6, 93);
|
||||
this.btnAfterCapture.Menu = this.cmsAfterCapture;
|
||||
this.btnAfterCapture.Name = "btnAfterCapture";
|
||||
this.btnAfterCapture.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnAfterCapture.TabIndex = 5;
|
||||
this.btnAfterCapture.Text = "After capture...";
|
||||
this.btnAfterCapture.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnAfterCapture.UseMnemonic = false;
|
||||
this.btnAfterCapture.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnAfterUpload
|
||||
//
|
||||
this.btnAfterUpload.Location = new System.Drawing.Point(6, 149);
|
||||
this.btnAfterUpload.Menu = this.cmsAfterUpload;
|
||||
this.btnAfterUpload.Name = "btnAfterUpload";
|
||||
this.btnAfterUpload.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnAfterUpload.TabIndex = 7;
|
||||
this.btnAfterUpload.Text = "After upload...";
|
||||
this.btnAfterUpload.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnAfterUpload.UseMnemonic = false;
|
||||
this.btnAfterUpload.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnDestinations
|
||||
//
|
||||
this.btnDestinations.Location = new System.Drawing.Point(6, 205);
|
||||
this.btnDestinations.Menu = this.cmsDestinations;
|
||||
this.btnDestinations.Name = "btnDestinations";
|
||||
this.btnDestinations.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnDestinations.TabIndex = 9;
|
||||
this.btnDestinations.Text = "Destinations...";
|
||||
this.btnDestinations.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnDestinations.UseMnemonic = false;
|
||||
this.btnDestinations.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// cmsDestinations
|
||||
//
|
||||
this.cmsDestinations.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
|
||||
|
@ -392,55 +357,43 @@ private void InitializeComponent()
|
|||
this.tsmiURLShorteners,
|
||||
this.tsmiURLSharingServices});
|
||||
this.cmsDestinations.Name = "cmsDestinations";
|
||||
this.cmsDestinations.Size = new System.Drawing.Size(174, 114);
|
||||
this.cmsDestinations.Size = new System.Drawing.Size(182, 114);
|
||||
//
|
||||
// tsmiImageUploaders
|
||||
//
|
||||
this.tsmiImageUploaders.Image = global::ShareX.Properties.Resources.image;
|
||||
this.tsmiImageUploaders.Name = "tsmiImageUploaders";
|
||||
this.tsmiImageUploaders.Size = new System.Drawing.Size(173, 22);
|
||||
this.tsmiImageUploaders.Size = new System.Drawing.Size(181, 22);
|
||||
this.tsmiImageUploaders.Text = "Image uploaders";
|
||||
//
|
||||
// tsmiTextUploaders
|
||||
//
|
||||
this.tsmiTextUploaders.Image = global::ShareX.Properties.Resources.notebook;
|
||||
this.tsmiTextUploaders.Name = "tsmiTextUploaders";
|
||||
this.tsmiTextUploaders.Size = new System.Drawing.Size(173, 22);
|
||||
this.tsmiTextUploaders.Size = new System.Drawing.Size(181, 22);
|
||||
this.tsmiTextUploaders.Text = "Text uploaders";
|
||||
//
|
||||
// tsmiFileUploaders
|
||||
//
|
||||
this.tsmiFileUploaders.Image = global::ShareX.Properties.Resources.application_block;
|
||||
this.tsmiFileUploaders.Name = "tsmiFileUploaders";
|
||||
this.tsmiFileUploaders.Size = new System.Drawing.Size(173, 22);
|
||||
this.tsmiFileUploaders.Size = new System.Drawing.Size(181, 22);
|
||||
this.tsmiFileUploaders.Text = "File uploaders";
|
||||
//
|
||||
// tsmiURLShorteners
|
||||
//
|
||||
this.tsmiURLShorteners.Image = global::ShareX.Properties.Resources.edit_scale;
|
||||
this.tsmiURLShorteners.Name = "tsmiURLShorteners";
|
||||
this.tsmiURLShorteners.Size = new System.Drawing.Size(173, 22);
|
||||
this.tsmiURLShorteners.Size = new System.Drawing.Size(181, 22);
|
||||
this.tsmiURLShorteners.Text = "URL shorteners";
|
||||
//
|
||||
// tsmiURLSharingServices
|
||||
//
|
||||
this.tsmiURLSharingServices.Image = global::ShareX.Properties.Resources.globe_share;
|
||||
this.tsmiURLSharingServices.Name = "tsmiURLSharingServices";
|
||||
this.tsmiURLSharingServices.Size = new System.Drawing.Size(173, 22);
|
||||
this.tsmiURLSharingServices.Size = new System.Drawing.Size(181, 22);
|
||||
this.tsmiURLSharingServices.Text = "URL sharing services";
|
||||
//
|
||||
// btnTask
|
||||
//
|
||||
this.btnTask.Location = new System.Drawing.Point(6, 37);
|
||||
this.btnTask.Menu = this.cmsTask;
|
||||
this.btnTask.Name = "btnTask";
|
||||
this.btnTask.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnTask.TabIndex = 3;
|
||||
this.btnTask.Text = "Task...";
|
||||
this.btnTask.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnTask.UseMnemonic = false;
|
||||
this.btnTask.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// tpGeneral
|
||||
//
|
||||
this.tpGeneral.Controls.Add(this.panelGeneral);
|
||||
|
@ -1438,6 +1391,7 @@ private void InitializeComponent()
|
|||
//
|
||||
// pActions
|
||||
//
|
||||
this.pActions.Controls.Add(this.btnActionsDuplicate);
|
||||
this.pActions.Controls.Add(this.btnActionsAdd);
|
||||
this.pActions.Controls.Add(this.lvActions);
|
||||
this.pActions.Controls.Add(this.btnActionsEdit);
|
||||
|
@ -1459,43 +1413,6 @@ private void InitializeComponent()
|
|||
this.btnActionsAdd.UseVisualStyleBackColor = true;
|
||||
this.btnActionsAdd.Click += new System.EventHandler(this.btnActionsAdd_Click);
|
||||
//
|
||||
// lvActions
|
||||
//
|
||||
this.lvActions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lvActions.AutoFillColumn = true;
|
||||
this.lvActions.CheckBoxes = true;
|
||||
this.lvActions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chActionsName,
|
||||
this.chActionsPath,
|
||||
this.chActionsArgs,
|
||||
this.chActionsExtensions});
|
||||
this.lvActions.FullRowSelect = true;
|
||||
this.lvActions.Location = new System.Drawing.Point(8, 40);
|
||||
this.lvActions.MultiSelect = false;
|
||||
this.lvActions.Name = "lvActions";
|
||||
this.lvActions.Size = new System.Drawing.Size(504, 280);
|
||||
this.lvActions.TabIndex = 3;
|
||||
this.lvActions.UseCompatibleStateImageBehavior = false;
|
||||
this.lvActions.View = System.Windows.Forms.View.Details;
|
||||
this.lvActions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvActions_ItemChecked);
|
||||
//
|
||||
// chActionsName
|
||||
//
|
||||
this.chActionsName.Text = "Name";
|
||||
this.chActionsName.Width = 90;
|
||||
//
|
||||
// chActionsPath
|
||||
//
|
||||
this.chActionsPath.Text = "Path";
|
||||
this.chActionsPath.Width = 220;
|
||||
//
|
||||
// chActionsArgs
|
||||
//
|
||||
this.chActionsArgs.Text = "Args";
|
||||
this.chActionsArgs.Width = 114;
|
||||
//
|
||||
// btnActionsEdit
|
||||
//
|
||||
this.btnActionsEdit.Location = new System.Drawing.Point(88, 8);
|
||||
|
@ -1508,10 +1425,10 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnActionsRemove
|
||||
//
|
||||
this.btnActionsRemove.Location = new System.Drawing.Point(168, 8);
|
||||
this.btnActionsRemove.Location = new System.Drawing.Point(248, 8);
|
||||
this.btnActionsRemove.Name = "btnActionsRemove";
|
||||
this.btnActionsRemove.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnActionsRemove.TabIndex = 2;
|
||||
this.btnActionsRemove.TabIndex = 3;
|
||||
this.btnActionsRemove.Text = "Remove";
|
||||
this.btnActionsRemove.UseVisualStyleBackColor = true;
|
||||
this.btnActionsRemove.Click += new System.EventHandler(this.btnActionsRemove_Click);
|
||||
|
@ -1867,11 +1784,106 @@ private void InitializeComponent()
|
|||
this.chkUseDefaultAdvancedSettings.UseVisualStyleBackColor = true;
|
||||
this.chkUseDefaultAdvancedSettings.CheckedChanged += new System.EventHandler(this.chkUseDefaultAdvancedSettings_CheckedChanged);
|
||||
//
|
||||
// btnAfterCapture
|
||||
//
|
||||
this.btnAfterCapture.Location = new System.Drawing.Point(6, 93);
|
||||
this.btnAfterCapture.Menu = this.cmsAfterCapture;
|
||||
this.btnAfterCapture.Name = "btnAfterCapture";
|
||||
this.btnAfterCapture.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnAfterCapture.TabIndex = 5;
|
||||
this.btnAfterCapture.Text = "After capture...";
|
||||
this.btnAfterCapture.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnAfterCapture.UseMnemonic = false;
|
||||
this.btnAfterCapture.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnAfterUpload
|
||||
//
|
||||
this.btnAfterUpload.Location = new System.Drawing.Point(6, 149);
|
||||
this.btnAfterUpload.Menu = this.cmsAfterUpload;
|
||||
this.btnAfterUpload.Name = "btnAfterUpload";
|
||||
this.btnAfterUpload.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnAfterUpload.TabIndex = 7;
|
||||
this.btnAfterUpload.Text = "After upload...";
|
||||
this.btnAfterUpload.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnAfterUpload.UseMnemonic = false;
|
||||
this.btnAfterUpload.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnDestinations
|
||||
//
|
||||
this.btnDestinations.Location = new System.Drawing.Point(6, 205);
|
||||
this.btnDestinations.Menu = this.cmsDestinations;
|
||||
this.btnDestinations.Name = "btnDestinations";
|
||||
this.btnDestinations.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnDestinations.TabIndex = 9;
|
||||
this.btnDestinations.Text = "Destinations...";
|
||||
this.btnDestinations.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnDestinations.UseMnemonic = false;
|
||||
this.btnDestinations.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// btnTask
|
||||
//
|
||||
this.btnTask.Location = new System.Drawing.Point(6, 37);
|
||||
this.btnTask.Menu = this.cmsTask;
|
||||
this.btnTask.Name = "btnTask";
|
||||
this.btnTask.Size = new System.Drawing.Size(506, 23);
|
||||
this.btnTask.TabIndex = 3;
|
||||
this.btnTask.Text = "Task...";
|
||||
this.btnTask.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnTask.UseMnemonic = false;
|
||||
this.btnTask.UseVisualStyleBackColor = true;
|
||||
//
|
||||
// lvActions
|
||||
//
|
||||
this.lvActions.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
|
||||
| System.Windows.Forms.AnchorStyles.Left)
|
||||
| System.Windows.Forms.AnchorStyles.Right)));
|
||||
this.lvActions.AutoFillColumn = true;
|
||||
this.lvActions.CheckBoxes = true;
|
||||
this.lvActions.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
|
||||
this.chActionsName,
|
||||
this.chActionsPath,
|
||||
this.chActionsArgs,
|
||||
this.chActionsExtensions});
|
||||
this.lvActions.FullRowSelect = true;
|
||||
this.lvActions.Location = new System.Drawing.Point(8, 40);
|
||||
this.lvActions.MultiSelect = false;
|
||||
this.lvActions.Name = "lvActions";
|
||||
this.lvActions.Size = new System.Drawing.Size(504, 280);
|
||||
this.lvActions.TabIndex = 4;
|
||||
this.lvActions.UseCompatibleStateImageBehavior = false;
|
||||
this.lvActions.View = System.Windows.Forms.View.Details;
|
||||
this.lvActions.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvActions_ItemChecked);
|
||||
//
|
||||
// chActionsName
|
||||
//
|
||||
this.chActionsName.Text = "Name";
|
||||
this.chActionsName.Width = 90;
|
||||
//
|
||||
// chActionsPath
|
||||
//
|
||||
this.chActionsPath.Text = "Path";
|
||||
this.chActionsPath.Width = 220;
|
||||
//
|
||||
// chActionsArgs
|
||||
//
|
||||
this.chActionsArgs.Text = "Args";
|
||||
this.chActionsArgs.Width = 114;
|
||||
//
|
||||
// chActionsExtensions
|
||||
//
|
||||
this.chActionsExtensions.Text = "Extensions";
|
||||
this.chActionsExtensions.Width = 75;
|
||||
//
|
||||
// btnActionsDuplicate
|
||||
//
|
||||
this.btnActionsDuplicate.Location = new System.Drawing.Point(168, 8);
|
||||
this.btnActionsDuplicate.Name = "btnActionsDuplicate";
|
||||
this.btnActionsDuplicate.Size = new System.Drawing.Size(75, 23);
|
||||
this.btnActionsDuplicate.TabIndex = 2;
|
||||
this.btnActionsDuplicate.Text = "Duplicate";
|
||||
this.btnActionsDuplicate.UseVisualStyleBackColor = true;
|
||||
this.btnActionsDuplicate.Click += new System.EventHandler(this.btnActionsDuplicate_Click);
|
||||
//
|
||||
// TaskSettingsForm
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -2088,6 +2100,7 @@ private void InitializeComponent()
|
|||
private System.Windows.Forms.TabPage tpRectangleAnnotate;
|
||||
private System.Windows.Forms.PropertyGrid pgRectangleAnnotate;
|
||||
private System.Windows.Forms.ColumnHeader chActionsExtensions;
|
||||
private System.Windows.Forms.Button btnActionsDuplicate;
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -779,7 +779,7 @@ private void chkUseDefaultActions_CheckedChanged(object sender, EventArgs e)
|
|||
|
||||
private void btnActionsAdd_Click(object sender, EventArgs e)
|
||||
{
|
||||
using (ExternalProgramForm form = new ExternalProgramForm())
|
||||
using (ActionsForm form = new ActionsForm())
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
@ -809,7 +809,7 @@ private void btnActionsEdit_Click(object sender, EventArgs e)
|
|||
ListViewItem lvi = lvActions.SelectedItems[0];
|
||||
ExternalProgram fileAction = lvi.Tag as ExternalProgram;
|
||||
|
||||
using (ExternalProgramForm form = new ExternalProgramForm(fileAction))
|
||||
using (ActionsForm form = new ActionsForm(fileAction))
|
||||
{
|
||||
if (form.ShowDialog() == DialogResult.OK)
|
||||
{
|
||||
|
@ -822,6 +822,15 @@ private void btnActionsEdit_Click(object sender, EventArgs e)
|
|||
}
|
||||
}
|
||||
|
||||
private void btnActionsDuplicate_Click(object sender, EventArgs e)
|
||||
{
|
||||
foreach (ExternalProgram fileAction in lvActions.SelectedItems.Cast<ListViewItem>().Select(x => ((ExternalProgram)x.Tag).Copy()))
|
||||
{
|
||||
TaskSettings.ExternalPrograms.Add(fileAction);
|
||||
AddFileAction(fileAction);
|
||||
}
|
||||
}
|
||||
|
||||
private void btnActionsRemove_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (lvActions.SelectedItems.Count > 0)
|
||||
|
|
|
@ -128,11 +128,11 @@
|
|||
<Compile Include="Forms\DropForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ExternalProgramForm.cs">
|
||||
<Compile Include="Forms\ActionsForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Forms\ExternalProgramForm.Designer.cs">
|
||||
<DependentUpon>ExternalProgramForm.cs</DependentUpon>
|
||||
<Compile Include="Forms\ActionsForm.Designer.cs">
|
||||
<DependentUpon>ActionsForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Forms\FileExistForm.cs">
|
||||
<SubType>Form</SubType>
|
||||
|
@ -273,8 +273,8 @@
|
|||
<EmbeddedResource Include="Forms\EncoderProgramForm.resx">
|
||||
<DependentUpon>EncoderProgramForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\ExternalProgramForm.resx">
|
||||
<DependentUpon>ExternalProgramForm.cs</DependentUpon>
|
||||
<EmbeddedResource Include="Forms\ActionsForm.resx">
|
||||
<DependentUpon>ActionsForm.cs</DependentUpon>
|
||||
</EmbeddedResource>
|
||||
<EmbeddedResource Include="Forms\FileExistForm.resx">
|
||||
<DependentUpon>FileExistForm.cs</DependentUpon>
|
||||
|
|
|
@ -588,7 +588,7 @@ private void DoFileJobs()
|
|||
|
||||
foreach (ExternalProgram fileAction in actions)
|
||||
{
|
||||
fileAction.Run(Info.FilePath);
|
||||
Info.FilePath = fileAction.Run(Info.FilePath);
|
||||
}
|
||||
|
||||
Data = new FileStream(Info.FilePath, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
|
|
Loading…
Reference in a new issue