mirror of
https://github.com/ShareX/ShareX.git
synced 2024-10-01 17:56:51 +13:00
commit
5bb5068ed2
15 changed files with 115 additions and 46 deletions
|
@ -63,6 +63,7 @@ public ImageHistoryForm(string historyPath, ImageHistorySettings settings, Actio
|
|||
ilvImages.Colors.BorderColor = ShareXResources.DarkBorderColor;
|
||||
ilvImages.Colors.ForeColor = ShareXResources.DarkTextColor;
|
||||
ilvImages.Colors.SelectedForeColor = ShareXResources.DarkTextColor;
|
||||
ilvImages.Colors.UnFocusedForeColor = ShareXResources.DarkTextColor;
|
||||
}
|
||||
|
||||
him = new HistoryItemManager(uploadFile, editImage);
|
||||
|
|
|
@ -32,6 +32,7 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public class RegionCaptureOptions
|
||||
{
|
||||
public const int DefaultMinimumSize = 5;
|
||||
public const int MagnifierPixelCountMinimum = 3;
|
||||
public const int MagnifierPixelCountMaximum = 35;
|
||||
public const int MagnifierPixelSizeMinimum = 3;
|
||||
|
@ -41,6 +42,7 @@ public class RegionCaptureOptions
|
|||
public const int MoveSpeedMaximum = 10;
|
||||
|
||||
public bool QuickCrop = true;
|
||||
public int MinimumSize = DefaultMinimumSize;
|
||||
public RegionCaptureAction RegionCaptureActionRightClick = RegionCaptureAction.RemoveShapeCancelCapture;
|
||||
public RegionCaptureAction RegionCaptureActionMiddleClick = RegionCaptureAction.SwapToolType;
|
||||
public RegionCaptureAction RegionCaptureActionX1Click = RegionCaptureAction.CaptureFullscreen;
|
||||
|
|
|
@ -33,8 +33,6 @@ namespace ShareX.ScreenCaptureLib
|
|||
{
|
||||
public abstract class BaseShape : IDisposable
|
||||
{
|
||||
protected const int MinimumSize = 3;
|
||||
|
||||
public abstract ShapeCategory ShapeCategory { get; }
|
||||
|
||||
public abstract ShapeType ShapeType { get; }
|
||||
|
@ -93,7 +91,7 @@ private set
|
|||
|
||||
public Size InitialSize { get; set; }
|
||||
|
||||
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= MinimumSize && Rectangle.Height >= MinimumSize;
|
||||
public virtual bool IsValidShape => !Rectangle.IsEmpty && Rectangle.Width >= Options.MinimumSize && Rectangle.Height >= Options.MinimumSize;
|
||||
|
||||
public virtual bool IsSelectable => Manager.CurrentTool == ShapeType || Manager.CurrentTool == ShapeType.ToolSelect;
|
||||
|
||||
|
|
|
@ -40,7 +40,7 @@ public class LineDrawingShape : BaseDrawingShape
|
|||
public bool CenterNodeActive { get; private set; }
|
||||
public int CenterPointCount { get; private set; }
|
||||
|
||||
public override bool IsValidShape => Rectangle.Width > 1 || Rectangle.Height > 1;
|
||||
public override bool IsValidShape => Rectangle.Width >= Options.MinimumSize || Rectangle.Height >= Options.MinimumSize;
|
||||
|
||||
protected override void UseLightResizeNodes()
|
||||
{
|
||||
|
|
|
@ -1179,10 +1179,10 @@ private BaseShape CheckHover()
|
|||
{
|
||||
Point location = InputManager.ClientMousePosition;
|
||||
|
||||
return new RectangleRegionShape()
|
||||
{
|
||||
Rectangle = new Rectangle(new Point(location.X - (Options.FixedSize.Width / 2), location.Y - (Options.FixedSize.Height / 2)), Options.FixedSize)
|
||||
};
|
||||
BaseShape rectangleRegionShape = CreateShape(ShapeType.RegionRectangle);
|
||||
rectangleRegionShape.Rectangle = new Rectangle(new Point(location.X - (Options.FixedSize.Width / 2),
|
||||
location.Y - (Options.FixedSize.Height / 2)), Options.FixedSize);
|
||||
return rectangleRegionShape;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1192,10 +1192,9 @@ private BaseShape CheckHover()
|
|||
{
|
||||
Rectangle hoverArea = CaptureHelpers.ScreenToClient(window.Rectangle);
|
||||
|
||||
return new RectangleRegionShape()
|
||||
{
|
||||
Rectangle = Rectangle.Intersect(Form.ClientArea, hoverArea)
|
||||
};
|
||||
BaseShape rectangleRegionShape = CreateShape(ShapeType.RegionRectangle);
|
||||
rectangleRegionShape.Rectangle = Rectangle.Intersect(Form.ClientArea, hoverArea);
|
||||
return rectangleRegionShape;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -460,7 +460,7 @@ private void InitializeComponent()
|
|||
dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle1.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle1.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle1.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
dataGridViewCellStyle1.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle1.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
|
@ -509,7 +509,7 @@ private void InitializeComponent()
|
|||
dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle3.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle3.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
|
@ -623,7 +623,7 @@ private void InitializeComponent()
|
|||
dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle5.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle5.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
|
@ -907,7 +907,7 @@ private void InitializeComponent()
|
|||
dataGridViewCellStyle7.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft;
|
||||
dataGridViewCellStyle7.BackColor = System.Drawing.SystemColors.Control;
|
||||
dataGridViewCellStyle7.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.WindowText;
|
||||
dataGridViewCellStyle7.ForeColor = System.Drawing.SystemColors.ControlText;
|
||||
dataGridViewCellStyle7.Padding = new System.Windows.Forms.Padding(0, 2, 0, 2);
|
||||
dataGridViewCellStyle7.SelectionBackColor = System.Drawing.SystemColors.Highlight;
|
||||
dataGridViewCellStyle7.SelectionForeColor = System.Drawing.SystemColors.HighlightText;
|
||||
|
|
|
@ -544,7 +544,7 @@
|
|||
<value>mbHelp</value>
|
||||
</data>
|
||||
<data name=">>mbHelp.Type" xml:space="preserve">
|
||||
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=12.4.2.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>mbHelp.Parent" xml:space="preserve">
|
||||
<value>gbCustomUploaders</value>
|
||||
|
@ -646,7 +646,7 @@
|
|||
<value>eiCustomUploaders</value>
|
||||
</data>
|
||||
<data name=">>eiCustomUploaders.Type" xml:space="preserve">
|
||||
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=12.4.2.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ShareX.HelpersLib.ExportImportControl, ShareX.HelpersLib, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>eiCustomUploaders.Parent" xml:space="preserve">
|
||||
<value>gbCustomUploaders</value>
|
||||
|
@ -2596,7 +2596,7 @@ store.book[0].title</value>
|
|||
<value>mbDestinationType</value>
|
||||
</data>
|
||||
<data name=">>mbDestinationType.Type" xml:space="preserve">
|
||||
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=12.4.2.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
<value>ShareX.HelpersLib.MenuButton, ShareX.HelpersLib, Version=13.0.0.0, Culture=neutral, PublicKeyToken=null</value>
|
||||
</data>
|
||||
<data name=">>mbDestinationType.Parent" xml:space="preserve">
|
||||
<value>$this</value>
|
||||
|
|
|
@ -296,7 +296,18 @@ private UploadResult InternalUpload(Stream stream, string fileName, bool refresh
|
|||
|
||||
ReturnResponseOnError = true;
|
||||
|
||||
UploadResult result = SendRequestFile("https://api.imgur.com/3/image", stream, fileName, "image", args, headers);
|
||||
string fileFormName;
|
||||
|
||||
if (Helpers.IsVideoFile(fileName))
|
||||
{
|
||||
fileFormName = "video";
|
||||
}
|
||||
else
|
||||
{
|
||||
fileFormName = "image";
|
||||
}
|
||||
|
||||
UploadResult result = SendRequestFile("https://api.imgur.com/3/upload", stream, fileName, fileFormName, args, headers);
|
||||
|
||||
if (!string.IsNullOrEmpty(result.Response))
|
||||
{
|
||||
|
|
40
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
40
ShareX/Controls/TaskThumbnailPanel.Designer.cs
generated
|
@ -31,14 +31,38 @@ protected override void Dispose(bool disposing)
|
|||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
this.components = new System.ComponentModel.Container();
|
||||
this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel();
|
||||
this.ttMain = new System.Windows.Forms.ToolTip(this.components);
|
||||
this.pThumbnail = new ShareX.TaskRoundedCornerPanel();
|
||||
this.pbProgress = new ShareX.HelpersLib.BlackStyleProgressBar();
|
||||
this.pbThumbnail = new System.Windows.Forms.PictureBox();
|
||||
this.lblTitle = new ShareX.HelpersLib.BlackStyleLabel();
|
||||
this.pThumbnail.SuspendLayout();
|
||||
((System.ComponentModel.ISupportInitialize)(this.pbThumbnail)).BeginInit();
|
||||
this.SuspendLayout();
|
||||
//
|
||||
// lblTitle
|
||||
//
|
||||
this.lblTitle.AutoEllipsis = true;
|
||||
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblTitle.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTitle.ForeColor = System.Drawing.Color.White;
|
||||
this.lblTitle.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblTitle.Name = "lblTitle";
|
||||
this.lblTitle.Size = new System.Drawing.Size(256, 22);
|
||||
this.lblTitle.TabIndex = 1;
|
||||
this.lblTitle.Text = "Test.png";
|
||||
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
this.lblTitle.MouseClick += new System.Windows.Forms.MouseEventHandler(this.LblTitle_MouseClick);
|
||||
//
|
||||
// ttMain
|
||||
//
|
||||
this.ttMain.AutoPopDelay = 5000;
|
||||
this.ttMain.InitialDelay = 200;
|
||||
this.ttMain.OwnerDraw = true;
|
||||
this.ttMain.ReshowDelay = 100;
|
||||
this.ttMain.Draw += new System.Windows.Forms.DrawToolTipEventHandler(this.TtMain_Draw);
|
||||
//
|
||||
// pThumbnail
|
||||
//
|
||||
this.pThumbnail.BackColor = System.Drawing.Color.Transparent;
|
||||
|
@ -82,19 +106,6 @@ private void InitializeComponent()
|
|||
this.pbThumbnail.MouseMove += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseMove);
|
||||
this.pbThumbnail.MouseUp += new System.Windows.Forms.MouseEventHandler(this.PbThumbnail_MouseUp);
|
||||
//
|
||||
// lblTitle
|
||||
//
|
||||
this.lblTitle.AutoEllipsis = true;
|
||||
this.lblTitle.BackColor = System.Drawing.Color.Transparent;
|
||||
this.lblTitle.Font = new System.Drawing.Font("Arial", 11.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
|
||||
this.lblTitle.ForeColor = System.Drawing.Color.White;
|
||||
this.lblTitle.Location = new System.Drawing.Point(0, 0);
|
||||
this.lblTitle.Name = "lblTitle";
|
||||
this.lblTitle.Size = new System.Drawing.Size(256, 22);
|
||||
this.lblTitle.TabIndex = 1;
|
||||
this.lblTitle.Text = "Test.png";
|
||||
this.lblTitle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
|
||||
//
|
||||
// TaskThumbnailPanel
|
||||
//
|
||||
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
|
||||
|
@ -116,5 +127,6 @@ private void InitializeComponent()
|
|||
private HelpersLib.BlackStyleLabel lblTitle;
|
||||
private HelpersLib.BlackStyleProgressBar pbProgress;
|
||||
private System.Windows.Forms.PictureBox pbThumbnail;
|
||||
private System.Windows.Forms.ToolTip ttMain;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -190,7 +190,7 @@ public TaskThumbnailPanel(WorkerTask task)
|
|||
|
||||
InitializeComponent();
|
||||
UpdateTheme();
|
||||
UpdateFilename();
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public void UpdateTheme()
|
||||
|
@ -200,18 +200,33 @@ public void UpdateTheme()
|
|||
lblTitle.ForeColor = ShareXResources.DarkTextColor;
|
||||
lblTitle.TextShadowColor = ShareXResources.DarkBorderColor;
|
||||
pThumbnail.PanelColor = ShareXResources.DarkBorderColor;
|
||||
ttMain.BackColor = ShareXResources.DarkBackgroundColor;
|
||||
ttMain.ForeColor = ShareXResources.DarkTextColor;
|
||||
}
|
||||
else
|
||||
{
|
||||
lblTitle.ForeColor = SystemColors.WindowText;
|
||||
lblTitle.ForeColor = SystemColors.ControlText;
|
||||
lblTitle.TextShadowColor = Color.Transparent;
|
||||
pThumbnail.PanelColor = SystemColors.ControlLight;
|
||||
ttMain.BackColor = SystemColors.Window;
|
||||
ttMain.ForeColor = SystemColors.ControlText;
|
||||
}
|
||||
}
|
||||
|
||||
public void UpdateFilename()
|
||||
public void UpdateTitle()
|
||||
{
|
||||
Title = Task.Info?.FileName;
|
||||
|
||||
if (Task.Info != null && !string.IsNullOrEmpty(Task.Info.ToString()))
|
||||
{
|
||||
lblTitle.Cursor = Cursors.Hand;
|
||||
ttMain.SetToolTip(lblTitle, Task.Info.ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
lblTitle.Cursor = Cursors.Default;
|
||||
ttMain.SetToolTip(lblTitle, null);
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateSize()
|
||||
|
@ -303,6 +318,8 @@ public void UpdateStatus()
|
|||
{
|
||||
pThumbnail.UpdateStatusColor(Task.Status);
|
||||
}
|
||||
|
||||
UpdateTitle();
|
||||
}
|
||||
|
||||
public void ClearThumbnail()
|
||||
|
@ -321,6 +338,28 @@ public void ClearThumbnail()
|
|||
ThumbnailExists = false;
|
||||
}
|
||||
|
||||
private void LblTitle_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left && Task.Info != null)
|
||||
{
|
||||
if (Task.Info.Result != null)
|
||||
{
|
||||
string url = Task.Info.Result.ToString();
|
||||
|
||||
if (!string.IsNullOrEmpty(url))
|
||||
{
|
||||
URLHelpers.OpenURL(url);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
if (!string.IsNullOrEmpty(Task.Info.FilePath))
|
||||
{
|
||||
Helpers.OpenFile(Task.Info.FilePath);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void PbThumbnail_MouseDown(object sender, MouseEventArgs e)
|
||||
{
|
||||
if (e.Button == MouseButtons.Left)
|
||||
|
@ -387,5 +426,12 @@ private void PbThumbnail_MouseMove(object sender, MouseEventArgs e)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void TtMain_Draw(object sender, DrawToolTipEventArgs e)
|
||||
{
|
||||
e.DrawBackground();
|
||||
e.DrawBorder();
|
||||
e.DrawText();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -117,4 +117,7 @@
|
|||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<metadata name="ttMain.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
|
||||
<value>17, 17</value>
|
||||
</metadata>
|
||||
</root>
|
|
@ -789,7 +789,7 @@ private void UpdateTheme()
|
|||
cmsTray.Renderer = new ToolStripCustomRenderer();
|
||||
cmsTaskInfo.Renderer = new ToolStripCustomRenderer();
|
||||
lvUploads.BackColor = SystemColors.Window;
|
||||
lvUploads.ForeColor = SystemColors.WindowText;
|
||||
lvUploads.ForeColor = SystemColors.ControlText;
|
||||
lblListViewTip.ForeColor = Color.Silver;
|
||||
scMain.SplitterColor = Color.White;
|
||||
scMain.SplitterLineColor = ProfessionalColors.SeparatorDark;
|
||||
|
|
|
@ -177,7 +177,7 @@ protected override void OnPaint(PaintEventArgs e)
|
|||
TextRenderer.DrawText(g, ToastConfig.Text, textFont, textRect.LocationOffset(1), Color.White, TextFormatFlags.Left | TextFormatFlags.EndEllipsis);
|
||||
}
|
||||
|
||||
Color borderColor = ShareXResources.UseDarkTheme ? ShareXResources.DarkBorderColor : SystemColors.WindowText;
|
||||
Color borderColor = ShareXResources.UseDarkTheme ? ShareXResources.DarkBorderColor : SystemColors.ControlText;
|
||||
using (Pen borderPen = new Pen(borderColor))
|
||||
{
|
||||
g.DrawRectangleProper(borderPen, rect);
|
||||
|
|
|
@ -1058,6 +1058,8 @@ private void btnScreenRecorderFFmpegOptions_Click(object sender, EventArgs e)
|
|||
{
|
||||
form.DefaultToolsFolder = Program.ToolsFolder;
|
||||
form.ShowDialog();
|
||||
|
||||
TaskSettings.CaptureSettings.FFmpegOptions = form.Options.FFmpeg;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -158,7 +158,7 @@ private static void Task_ImageReady(WorkerTask task)
|
|||
|
||||
if (panel != null)
|
||||
{
|
||||
panel.UpdateFilename();
|
||||
panel.UpdateTitle();
|
||||
|
||||
if (Program.Settings.TaskViewMode == TaskViewMode.ThumbnailView)
|
||||
{
|
||||
|
@ -333,12 +333,7 @@ private static void Task_TaskCompleted(WorkerTask task)
|
|||
{
|
||||
DebugHelper.WriteLine($"Task completed. Filename: {info.FileName}, Duration: {(long)info.TaskDuration.TotalMilliseconds} ms");
|
||||
|
||||
string result = info.Result.ToString();
|
||||
|
||||
if (string.IsNullOrEmpty(result) && !string.IsNullOrEmpty(info.FilePath))
|
||||
{
|
||||
result = info.FilePath;
|
||||
}
|
||||
string result = info.ToString();
|
||||
|
||||
if (lvi != null)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue