mirror of
https://github.com/greenshot/greenshot
synced 2025-08-22 06:23:24 -07:00
Fixes
This commit is contained in:
parent
0d15124cae
commit
aac7354a6e
3 changed files with 79 additions and 71 deletions
|
@ -33,6 +33,7 @@ Source: {#ReleaseDir}\Newtonsoft.Json.dll; DestDir: {app}; Components: greenshot
|
||||||
Source: {#ReleaseDir}\Emoji.Wpf.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
Source: {#ReleaseDir}\Emoji.Wpf.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
Source: {#ReleaseDir}\Typography.GlyphLayout.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
Source: {#ReleaseDir}\Typography.GlyphLayout.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
Source: {#ReleaseDir}\Typography.OpenFont.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
Source: {#ReleaseDir}\Typography.OpenFont.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
|
Source: {#ReleaseDir}\Stfu.dll; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
Source: {#GreenshotProjectDir}\log4net.xml; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion
|
Source: {#GreenshotProjectDir}\log4net.xml; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion
|
||||||
Source: {#ReleaseDir}\checksum.SHA256; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
Source: {#ReleaseDir}\checksum.SHA256; DestDir: {app}; Components: greenshot; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
;Source: ..\greenshot-defaults.ini; DestDir: {app}; Flags: overwritereadonly ignoreversion replacesameversion
|
;Source: ..\greenshot-defaults.ini; DestDir: {app}; Flags: overwritereadonly ignoreversion replacesameversion
|
||||||
|
|
|
@ -44,8 +44,11 @@ namespace Greenshot.Editor.Drawing
|
||||||
{
|
{
|
||||||
private static readonly ILog Log = LogManager.GetLogger(typeof(IconContainer));
|
private static readonly ILog Log = LogManager.GetLogger(typeof(IconContainer));
|
||||||
|
|
||||||
|
[NonSerialized] private static EmojiContainer _currentContainer;
|
||||||
|
[NonSerialized] private static ElementHost _emojiPickerHost;
|
||||||
|
[NonSerialized] private static Emoji.Wpf.Picker _emojiPicker;
|
||||||
|
|
||||||
[NonSerialized] private System.Windows.Controls.Image _image;
|
[NonSerialized] private System.Windows.Controls.Image _image;
|
||||||
[NonSerialized] private ElementHost _emojiPicker;
|
|
||||||
[NonSerialized] private bool _firstSelection = true;
|
[NonSerialized] private bool _firstSelection = true;
|
||||||
|
|
||||||
private string _emoji;
|
private string _emoji;
|
||||||
|
@ -82,44 +85,45 @@ namespace Greenshot.Editor.Drawing
|
||||||
|
|
||||||
private void ShowEmojiPicker()
|
private void ShowEmojiPicker()
|
||||||
{
|
{
|
||||||
if (_emojiPicker == null)
|
_currentContainer = this;
|
||||||
{
|
|
||||||
var picker = new Emoji.Wpf.Picker();
|
|
||||||
picker.Picked += (_, args) =>
|
|
||||||
{
|
|
||||||
Emoji = args.Emoji;
|
|
||||||
Invalidate();
|
|
||||||
};
|
|
||||||
|
|
||||||
_emojiPicker = new ElementHost();
|
CreatePickerControl();
|
||||||
_emojiPicker.Dock = DockStyle.None;
|
|
||||||
_emojiPicker.Child = picker;
|
|
||||||
}
|
|
||||||
|
|
||||||
var emojiPickerChild = ((Emoji.Wpf.Picker)_emojiPicker.Child);
|
|
||||||
emojiPickerChild.Selection = Emoji;
|
|
||||||
|
|
||||||
var absRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
var absRectangle = GuiRectangle.GetGuiRectangle(Left, Top, Width, Height);
|
||||||
var displayRectangle = Parent.ToSurfaceCoordinates(absRectangle);
|
var displayRectangle = Parent.ToSurfaceCoordinates(absRectangle);
|
||||||
_emojiPicker.Width = 0; // Trick to hide the picker's button
|
_emojiPickerHost.Width = 0; // Trick to hide the picker's button
|
||||||
_emojiPicker.Height = displayRectangle.Height;
|
_emojiPickerHost.Height = displayRectangle.Height;
|
||||||
_emojiPicker.Left = displayRectangle.Left;
|
_emojiPickerHost.Left = displayRectangle.Left;
|
||||||
_emojiPicker.Top = displayRectangle.Top;
|
_emojiPickerHost.Top = displayRectangle.Top;
|
||||||
|
|
||||||
if (_parent != null)
|
_emojiPicker.Selection = Emoji;
|
||||||
|
_emojiPicker.ShowPopup = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void CreatePickerControl()
|
||||||
|
{
|
||||||
|
if (_emojiPickerHost == null)
|
||||||
{
|
{
|
||||||
_parent.KeysLocked = true;
|
_emojiPicker = new Emoji.Wpf.Picker();
|
||||||
_parent.Controls.Add(_emojiPicker);
|
_emojiPicker.Picked += (_, args) =>
|
||||||
}
|
{
|
||||||
|
_currentContainer.Emoji = args.Emoji;
|
||||||
|
_currentContainer.Invalidate();
|
||||||
|
};
|
||||||
|
|
||||||
emojiPickerChild.ShowPopup = true;
|
_emojiPickerHost = new ElementHost();
|
||||||
|
_emojiPickerHost.Dock = DockStyle.None;
|
||||||
|
_emojiPickerHost.Child = _emojiPicker;
|
||||||
|
|
||||||
|
_parent.Controls.Add(_emojiPickerHost);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HideEmojiPicker()
|
private void HideEmojiPicker()
|
||||||
{
|
{
|
||||||
if (_parent != null && _emojiPicker != null)
|
if (_emojiPicker != null)
|
||||||
{
|
{
|
||||||
_parent.Controls.Remove(_emojiPicker);
|
_emojiPicker.ShowPopup = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -321,37 +321,37 @@ namespace Greenshot.Editor.Forms
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private void AddDestinations()
|
private void AddDestinations()
|
||||||
{
|
{
|
||||||
Invoke((MethodInvoker) delegate
|
Invoke((MethodInvoker)delegate
|
||||||
{
|
{
|
||||||
// Create export buttons
|
// Create export buttons
|
||||||
foreach (IDestination destination in DestinationHelper.GetAllDestinations())
|
foreach (IDestination destination in DestinationHelper.GetAllDestinations())
|
||||||
{
|
{
|
||||||
if (destination.Priority <= 2)
|
if (destination.Priority <= 2)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!destination.IsActive)
|
if (!destination.IsActive)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (destination.DisplayIcon == null)
|
if (destination.DisplayIcon == null)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
AddDestinationButton(destination);
|
AddDestinationButton(destination);
|
||||||
}
|
}
|
||||||
catch (Exception addingException)
|
catch (Exception addingException)
|
||||||
{
|
{
|
||||||
Log.WarnFormat("Problem adding destination {0}", destination.Designation);
|
Log.WarnFormat("Problem adding destination {0}", destination.Designation);
|
||||||
Log.Warn("Exception: ", addingException);
|
Log.Warn("Exception: ", addingException);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddDestinationButton(IDestination toolstripDestination)
|
private void AddDestinationButton(IDestination toolstripDestination)
|
||||||
|
@ -579,6 +579,9 @@ namespace Greenshot.Editor.Forms
|
||||||
case DrawingModes.Path:
|
case DrawingModes.Path:
|
||||||
SetButtonChecked(btnFreehand);
|
SetButtonChecked(btnFreehand);
|
||||||
break;
|
break;
|
||||||
|
case DrawingModes.Emoji:
|
||||||
|
SetButtonChecked(btnEmoji);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -611,7 +614,7 @@ namespace Greenshot.Editor.Forms
|
||||||
private void BtnPrintClick(object sender, EventArgs e)
|
private void BtnPrintClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
// The BeginInvoke is a solution for the printdialog not having focus
|
// The BeginInvoke is a solution for the printdialog not having focus
|
||||||
BeginInvoke((MethodInvoker) delegate { DestinationHelper.ExportCapture(true, WellKnownDestinations.Printer, _surface, _surface.CaptureDetails); });
|
BeginInvoke((MethodInvoker)delegate { DestinationHelper.ExportCapture(true, WellKnownDestinations.Printer, _surface, _surface.CaptureDetails); });
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CloseToolStripMenuItemClick(object sender, EventArgs e)
|
private void CloseToolStripMenuItemClick(object sender, EventArgs e)
|
||||||
|
@ -1270,9 +1273,9 @@ namespace Greenshot.Editor.Forms
|
||||||
textVerticalAlignmentButton.Visible = props.HasFieldValue(FieldType.TEXT_VERTICAL_ALIGNMENT);
|
textVerticalAlignmentButton.Visible = props.HasFieldValue(FieldType.TEXT_VERTICAL_ALIGNMENT);
|
||||||
shadowButton.Visible = props.HasFieldValue(FieldType.SHADOW);
|
shadowButton.Visible = props.HasFieldValue(FieldType.SHADOW);
|
||||||
counterLabel.Visible = counterUpDown.Visible = props.HasFieldValue(FieldType.FLAGS)
|
counterLabel.Visible = counterUpDown.Visible = props.HasFieldValue(FieldType.FLAGS)
|
||||||
&& ((FieldFlag) props.GetFieldValue(FieldType.FLAGS) & FieldFlag.COUNTER) == FieldFlag.COUNTER;
|
&& ((FieldFlag)props.GetFieldValue(FieldType.FLAGS) & FieldFlag.COUNTER) == FieldFlag.COUNTER;
|
||||||
btnConfirm.Visible = btnCancel.Visible = props.HasFieldValue(FieldType.FLAGS)
|
btnConfirm.Visible = btnCancel.Visible = props.HasFieldValue(FieldType.FLAGS)
|
||||||
&& ((FieldFlag) props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE;
|
&& ((FieldFlag)props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE;
|
||||||
|
|
||||||
obfuscateModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_OBFUSCATE);
|
obfuscateModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_OBFUSCATE);
|
||||||
highlightModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT);
|
highlightModeButton.Visible = props.HasFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT);
|
||||||
|
@ -1302,11 +1305,11 @@ namespace Greenshot.Editor.Forms
|
||||||
Image icon;
|
Image icon;
|
||||||
if (stepLabels <= 20)
|
if (stepLabels <= 20)
|
||||||
{
|
{
|
||||||
icon = (Image) resources.GetObject($"btnStepLabel{stepLabels:00}.Image");
|
icon = (Image)resources.GetObject($"btnStepLabel{stepLabels:00}.Image");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
icon = (Image) resources.GetObject("btnStepLabel20+.Image");
|
icon = (Image)resources.GetObject("btnStepLabel20+.Image");
|
||||||
}
|
}
|
||||||
|
|
||||||
btnStepLabel.Image = icon;
|
btnStepLabel.Image = icon;
|
||||||
|
@ -1315,7 +1318,7 @@ namespace Greenshot.Editor.Forms
|
||||||
FieldAggregator props = _surface.FieldAggregator;
|
FieldAggregator props = _surface.FieldAggregator;
|
||||||
// if a confirmable element is selected, we must disable most of the controls
|
// if a confirmable element is selected, we must disable most of the controls
|
||||||
// since we demand confirmation or cancel for confirmable element
|
// since we demand confirmation or cancel for confirmable element
|
||||||
if (props.HasFieldValue(FieldType.FLAGS) && ((FieldFlag) props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE)
|
if (props.HasFieldValue(FieldType.FLAGS) && ((FieldFlag)props.GetFieldValue(FieldType.FLAGS) & FieldFlag.CONFIRMABLE) == FieldFlag.CONFIRMABLE)
|
||||||
{
|
{
|
||||||
// disable most controls
|
// disable most controls
|
||||||
if (!_controlsDisabledDueToConfirmable)
|
if (!_controlsDisabledDueToConfirmable)
|
||||||
|
@ -1506,14 +1509,14 @@ namespace Greenshot.Editor.Forms
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
clickedDestination = (IDestination) clickedControl.Tag;
|
clickedDestination = (IDestination)clickedControl.Tag;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (sender is ToolStripMenuItem item)
|
if (sender is ToolStripMenuItem item)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem clickedMenuItem = item;
|
ToolStripMenuItem clickedMenuItem = item;
|
||||||
clickedDestination = (IDestination) clickedMenuItem.Tag;
|
clickedDestination = (IDestination)clickedMenuItem.Tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1550,17 +1553,17 @@ namespace Greenshot.Editor.Forms
|
||||||
|
|
||||||
private void Insert_window_toolstripmenuitemMouseEnter(object sender, EventArgs e)
|
private void Insert_window_toolstripmenuitemMouseEnter(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem captureWindowMenuItem = (ToolStripMenuItem) sender;
|
ToolStripMenuItem captureWindowMenuItem = (ToolStripMenuItem)sender;
|
||||||
var mainForm = SimpleServiceProvider.Current.GetInstance<IGreenshotMainForm>();
|
var mainForm = SimpleServiceProvider.Current.GetInstance<IGreenshotMainForm>();
|
||||||
mainForm.AddCaptureWindowMenuItems(captureWindowMenuItem, Contextmenu_window_Click);
|
mainForm.AddCaptureWindowMenuItems(captureWindowMenuItem, Contextmenu_window_Click);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Contextmenu_window_Click(object sender, EventArgs e)
|
private void Contextmenu_window_Click(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
ToolStripMenuItem clickedItem = (ToolStripMenuItem) sender;
|
ToolStripMenuItem clickedItem = (ToolStripMenuItem)sender;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
WindowDetails windowToCapture = (WindowDetails) clickedItem.Tag;
|
WindowDetails windowToCapture = (WindowDetails)clickedItem.Tag;
|
||||||
ICapture capture = new Capture();
|
ICapture capture = new Capture();
|
||||||
using (Graphics graphics = Graphics.FromHwnd(Handle))
|
using (Graphics graphics = Graphics.FromHwnd(Handle))
|
||||||
{
|
{
|
||||||
|
@ -1575,8 +1578,8 @@ namespace Greenshot.Editor.Forms
|
||||||
capture = captureHelper.CaptureWindow(windowToCapture, capture, coreConfiguration.WindowCaptureMode);
|
capture = captureHelper.CaptureWindow(windowToCapture, capture, coreConfiguration.WindowCaptureMode);
|
||||||
if (capture?.CaptureDetails != null && capture.Image != null)
|
if (capture?.CaptureDetails != null && capture.Image != null)
|
||||||
{
|
{
|
||||||
((Bitmap) capture.Image).SetResolution(capture.CaptureDetails.DpiX, capture.CaptureDetails.DpiY);
|
((Bitmap)capture.Image).SetResolution(capture.CaptureDetails.DpiX, capture.CaptureDetails.DpiY);
|
||||||
_surface.AddImageContainer((Bitmap) capture.Image, 100, 100);
|
_surface.AddImageContainer((Bitmap)capture.Image, 100, 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
Activate();
|
Activate();
|
||||||
|
@ -1756,7 +1759,7 @@ namespace Greenshot.Editor.Forms
|
||||||
var canvas = Surface as Control;
|
var canvas = Surface as Control;
|
||||||
Size canvasSize = canvas.Size;
|
Size canvasSize = canvas.Size;
|
||||||
Size currentClientSize = panel1.ClientSize;
|
Size currentClientSize = panel1.ClientSize;
|
||||||
Panel panel = (Panel) canvas?.Parent;
|
Panel panel = (Panel)canvas?.Parent;
|
||||||
if (panel == null)
|
if (panel == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -1849,8 +1852,8 @@ namespace Greenshot.Editor.Forms
|
||||||
|
|
||||||
private void ZoomSetValueMenuItemClick(object sender, EventArgs e)
|
private void ZoomSetValueMenuItemClick(object sender, EventArgs e)
|
||||||
{
|
{
|
||||||
var senderMenuItem = (ToolStripMenuItem) sender;
|
var senderMenuItem = (ToolStripMenuItem)sender;
|
||||||
var nextValue = Fraction.Parse((string) senderMenuItem.Tag);
|
var nextValue = Fraction.Parse((string)senderMenuItem.Tag);
|
||||||
|
|
||||||
ZoomSetValue(nextValue);
|
ZoomSetValue(nextValue);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue