mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-29 17:02:05 +13:00
Added quick screen color picker
This commit is contained in:
parent
82dcc38da8
commit
d724c5957c
9 changed files with 2620 additions and 2570 deletions
|
@ -267,13 +267,7 @@ protected override void Draw(Graphics g)
|
|||
|
||||
if (OneClickMode)
|
||||
{
|
||||
CurrentPosition = InputManager.MousePosition0Based;
|
||||
|
||||
if (Config.ShowInfo)
|
||||
{
|
||||
ImageHelpers.DrawTextWithOutline(g, GetColorPickerText(), new PointF(InputManager.MousePosition0Based.X + 5, InputManager.MousePosition0Based.Y + 5),
|
||||
textFont, Color.White, Color.Black);
|
||||
}
|
||||
DrawScreenColorPickerInfo(g);
|
||||
}
|
||||
|
||||
if (Config.ShowMagnifier)
|
||||
|
@ -299,10 +293,25 @@ private string GetAreaText(Rectangle area)
|
|||
return string.Format(Resources.RectangleRegion_GetAreaText_Area, area.X, area.Y, area.Width, area.Height);
|
||||
}
|
||||
|
||||
private string GetColorPickerText()
|
||||
private void DrawScreenColorPickerInfo(Graphics g)
|
||||
{
|
||||
Color color = CurrentColor;
|
||||
return string.Format(Resources.RectangleRegion_GetColorPickerText, CurrentPosition.X, CurrentPosition.Y, color.R, color.G, color.B);
|
||||
CurrentPosition = InputManager.MousePosition0Based;
|
||||
|
||||
if (Config.ShowInfo)
|
||||
{
|
||||
Color color = CurrentColor;
|
||||
|
||||
using (Brush brush = new SolidBrush(color))
|
||||
{
|
||||
Rectangle colorBox = new Rectangle(CurrentPosition.X + 5, CurrentPosition.Y + 5, 20, 20);
|
||||
g.FillRectangle(brush, colorBox);
|
||||
g.DrawRectangleProper(Pens.Black, colorBox);
|
||||
}
|
||||
|
||||
string infoText = string.Format(Resources.RectangleRegion_GetColorPickerText, color.R, color.G, color.B, CurrentPosition.X, CurrentPosition.Y);
|
||||
|
||||
ImageHelpers.DrawTextWithOutline(g, infoText, new PointF(CurrentPosition.X + 25, CurrentPosition.Y + 5), textFont, Color.White, Color.Black);
|
||||
}
|
||||
}
|
||||
|
||||
private void DrawCrosshair(Graphics g)
|
||||
|
|
|
@ -168,7 +168,7 @@ Distance: {6:0.00} px / Angle: {7:0.00}°</value>
|
|||
<value>Ctrl: Drawing mode ░ Space: Fullscreen capture</value>
|
||||
</data>
|
||||
<data name="RectangleRegion_GetColorPickerText" xml:space="preserve">
|
||||
<value>X: {0}, Y: {1}
|
||||
R: {2}, G: {3}, B: {4}</value>
|
||||
<value>R: {0}, G: {1}, B: {2}
|
||||
X: {3}, Y: {4}</value>
|
||||
<comment>@Invariant</comment></data>
|
||||
</root>
|
374
ShareX/Forms/MainForm.Designer.cs
generated
374
ShareX/Forms/MainForm.Designer.cs
generated
File diff suppressed because it is too large
Load diff
|
@ -878,6 +878,11 @@ private void tsmiCursorHelper_Click(object sender, EventArgs e)
|
|||
TaskHelpers.OpenScreenColorPicker();
|
||||
}
|
||||
|
||||
private void tsmiQuickScreenColorPicker_Click(object sender, EventArgs e)
|
||||
{
|
||||
TaskHelpers.OpenQuickScreenColorPicker();
|
||||
}
|
||||
|
||||
private void tsmiRuler_Click(object sender, EventArgs e)
|
||||
{
|
||||
TaskHelpers.OpenRuler();
|
||||
|
@ -1539,7 +1544,7 @@ private void ExecuteJob(TaskSettings taskSettings, HotkeyType job)
|
|||
TaskHelpers.OpenScreenshotsFolder();
|
||||
break;
|
||||
case HotkeyType.ScreenColorPicker:
|
||||
TaskHelpers.OpenScreenColorPicker(safeTaskSettings);
|
||||
TaskHelpers.OpenScreenColorPicker();
|
||||
break;
|
||||
case HotkeyType.Ruler:
|
||||
TaskHelpers.OpenRuler();
|
||||
|
|
File diff suppressed because it is too large
Load diff
9
ShareX/Properties/Resources.Designer.cs
generated
9
ShareX/Properties/Resources.Designer.cs
generated
|
@ -1405,6 +1405,15 @@ public static System.IO.UnmanagedMemoryStream TaskCompletedSound {
|
|||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Copied to clipboard: {0}.
|
||||
/// </summary>
|
||||
public static string TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_ {
|
||||
get {
|
||||
return ResourceManager.GetString("TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Tweet successfully sent..
|
||||
/// </summary>
|
||||
|
|
|
@ -684,4 +684,7 @@ Please run ShareX as administrator to change personal folder path.</value>
|
|||
<data name="us" type="System.Resources.ResXFileRef, System.Windows.Forms">
|
||||
<value>..\Resources\us.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
|
||||
</data>
|
||||
<data name="TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_" xml:space="preserve">
|
||||
<value>Copied to clipboard: {0}</value>
|
||||
</data>
|
||||
</root>
|
|
@ -503,14 +503,19 @@ public static void OpenScreenshotsFolder()
|
|||
}
|
||||
}
|
||||
|
||||
public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
|
||||
public static void OpenScreenColorPicker()
|
||||
{
|
||||
new ScreenColorPicker().Show();
|
||||
}
|
||||
|
||||
public static void OpenQuickScreenColorPicker(TaskSettings taskSettings = null)
|
||||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
if (taskSettings.AdvancedSettings.QuickScreenColorPicker)
|
||||
{
|
||||
PointInfo pointInfo = SelectPointColor();
|
||||
PointInfo pointInfo = SelectPointColor();
|
||||
|
||||
if (pointInfo != null)
|
||||
{
|
||||
string text;
|
||||
|
||||
switch (taskSettings.AdvancedSettings.ScreenColorPickerFormat)
|
||||
|
@ -525,10 +530,12 @@ public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
|
|||
}
|
||||
|
||||
ClipboardHelpers.CopyText(text);
|
||||
}
|
||||
else
|
||||
{
|
||||
new ScreenColorPicker().Show();
|
||||
|
||||
if (Program.MainForm.niTray.Visible)
|
||||
{
|
||||
Program.MainForm.niTray.Tag = null;
|
||||
Program.MainForm.niTray.ShowBalloonTip(3000, "ShareX", string.Format(Resources.TaskHelpers_OpenQuickScreenColorPicker_Copied_to_clipboard___0_, text), ToolTipIcon.Info);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -433,10 +433,7 @@ public Size ToastWindowSize
|
|||
[Category("Name pattern"), DefaultValue(50), Description("Maximum name pattern title (%t) length for file name.")]
|
||||
public int NamePatternMaxTitleLength { get; set; }
|
||||
|
||||
[Category("Tools"), DefaultValue(false), Description("Instead of opening screen color dialog, it will open pipette color picker and when it is closed will copy color values.")]
|
||||
public bool QuickScreenColorPicker { get; set; }
|
||||
|
||||
[Category("Tools"), DefaultValue(ColorPickerFormat.RGB), Description("if QuickScreenColorPicker enabled then what color format to copy to clipboard automatically.")]
|
||||
[Category("Tools"), DefaultValue(ColorPickerFormat.RGB), Description("When using quick screen color picker what color format to copy to clipboard automatically.")]
|
||||
public ColorPickerFormat ScreenColorPickerFormat { get; set; }
|
||||
|
||||
public TaskSettingsAdvanced()
|
||||
|
|
Loading…
Reference in a new issue