mirror of
https://github.com/greenshot/greenshot
synced 2025-07-16 10:03:44 -07:00
Removed more dead code
This commit is contained in:
parent
601236833b
commit
2bbaa4a9a7
38 changed files with 66 additions and 943 deletions
|
@ -40,9 +40,6 @@ namespace Greenshot.Destinations {
|
|||
private readonly IImageEditor editor;
|
||||
private static readonly Image greenshotIcon = GreenshotResources.GetGreenshotIcon().ToBitmap();
|
||||
|
||||
public EditorDestination() {
|
||||
}
|
||||
|
||||
public EditorDestination(IImageEditor editor) {
|
||||
this.editor = editor;
|
||||
}
|
||||
|
|
|
@ -30,16 +30,12 @@ namespace Greenshot.Drawing {
|
|||
/// <summary>
|
||||
/// empty container for filter-only elements
|
||||
/// </summary>
|
||||
[Serializable()]
|
||||
[Serializable]
|
||||
public abstract class FilterContainer : DrawableContainer {
|
||||
|
||||
public enum PreparedFilterMode {OBFUSCATE, HIGHLIGHT};
|
||||
public enum PreparedFilter {BLUR, PIXELIZE, TEXT_HIGHTLIGHT, AREA_HIGHLIGHT, GRAYSCALE, MAGNIFICATION};
|
||||
|
||||
public PreparedFilter Filter {
|
||||
get { return (PreparedFilter)GetFieldValue(FieldType.PREPARED_FILTER_HIGHLIGHT); }
|
||||
}
|
||||
|
||||
public FilterContainer(Surface parent) : base(parent) {
|
||||
Init();
|
||||
}
|
||||
|
|
|
@ -1,122 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System;
|
||||
using System.Drawing.Drawing2D;
|
||||
|
||||
namespace Greenshot.Drawing {
|
||||
/// <summary>
|
||||
/// TODO: currently this is only used in the capture form, we might move this code directly to there!
|
||||
/// </summary>
|
||||
public abstract class RoundedRectangle {
|
||||
[Flags]
|
||||
public enum RectangleCorners {
|
||||
None = 0, TopLeft = 1, TopRight = 2,
|
||||
BottomLeft = 4, BottomRight = 8,
|
||||
All = TopLeft | TopRight | BottomLeft | BottomRight
|
||||
}
|
||||
|
||||
public static GraphicsPath Create2(int x, int y, int width, int height, int radius) {
|
||||
GraphicsPath gp = new GraphicsPath();
|
||||
gp.AddLine(x + radius, y, x + width - radius * 2, y); // Line
|
||||
gp.AddArc(x + width - radius * 2, y, radius * 2, radius * 2, 270, 90); // Corner
|
||||
gp.AddLine(x + width, y + radius, x + width, y + height - radius * 2); // Line
|
||||
gp.AddArc(x + width - radius * 2, y + height - radius * 2, radius * 2, radius * 2, 0, 90); // Corner
|
||||
gp.AddLine(x + width - radius * 2, y + height, x + radius, y + height); // Line
|
||||
gp.AddArc(x, y + height - radius * 2, radius * 2, radius * 2, 90, 90); // Corner
|
||||
gp.AddLine(x, y + height - radius * 2, x, y + radius); // Line
|
||||
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90); // Corner
|
||||
gp.CloseFigure();
|
||||
|
||||
return gp;
|
||||
}
|
||||
|
||||
public static GraphicsPath Create(int x, int y, int width, int height, int radius, RectangleCorners corners) {
|
||||
int xw = x + width;
|
||||
int yh = y + height;
|
||||
int xwr = xw - radius;
|
||||
int yhr = yh - radius;
|
||||
int xr = x + radius;
|
||||
int yr = y + radius;
|
||||
int r2 = radius * 2;
|
||||
int xwr2 = xw - r2;
|
||||
int yhr2 = yh - r2;
|
||||
|
||||
GraphicsPath p = new GraphicsPath();
|
||||
p.StartFigure();
|
||||
|
||||
//Top Left Corner
|
||||
if ((RectangleCorners.TopLeft & corners) == RectangleCorners.TopLeft) {
|
||||
p.AddArc(x, y, r2, r2, 180, 90);
|
||||
} else {
|
||||
p.AddLine(x, yr, x, y);
|
||||
p.AddLine(x, y, xr, y);
|
||||
}
|
||||
|
||||
//Top Edge
|
||||
p.AddLine(xr, y, xwr, y);
|
||||
|
||||
//Top Right Corner
|
||||
if ((RectangleCorners.TopRight & corners) == RectangleCorners.TopRight) {
|
||||
p.AddArc(xwr2, y, r2, r2, 270, 90);
|
||||
} else {
|
||||
p.AddLine(xwr, y, xw, y);
|
||||
p.AddLine(xw, y, xw, yr);
|
||||
}
|
||||
|
||||
//Right Edge
|
||||
p.AddLine(xw, yr, xw, yhr);
|
||||
|
||||
//Bottom Right Corner
|
||||
if ((RectangleCorners.BottomRight & corners) == RectangleCorners.BottomRight) {
|
||||
p.AddArc(xwr2, yhr2, r2, r2, 0, 90);
|
||||
} else {
|
||||
p.AddLine(xw, yhr, xw, yh);
|
||||
p.AddLine(xw, yh, xwr, yh);
|
||||
}
|
||||
|
||||
//Bottom Edge
|
||||
p.AddLine(xwr, yh, xr, yh);
|
||||
|
||||
//Bottom Left Corner
|
||||
if ((RectangleCorners.BottomLeft & corners) == RectangleCorners.BottomLeft) {
|
||||
p.AddArc(x, yhr2, r2, r2, 90, 90);
|
||||
} else {
|
||||
p.AddLine(xr, yh, x, yh);
|
||||
p.AddLine(x, yh, x, yhr);
|
||||
}
|
||||
|
||||
//Left Edge
|
||||
p.AddLine(x, yhr, x, yr);
|
||||
|
||||
p.CloseFigure();
|
||||
return p;
|
||||
}
|
||||
|
||||
public static GraphicsPath Create(int x, int y, int width, int height, int radius) {
|
||||
return Create(x, y, width, height, radius, RectangleCorners.All);
|
||||
}
|
||||
|
||||
public static GraphicsPath Create(int x, int y, int width, int height) {
|
||||
return Create(x, y, width, height, 5);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -905,7 +905,7 @@ namespace Greenshot.Forms {
|
|||
// horizontal ruler
|
||||
if (fixedRect.Width > hSpace + 3)
|
||||
{
|
||||
using GraphicsPath p = RoundedRectangle.Create2(
|
||||
using GraphicsPath p = CreateRoundedRectangle(
|
||||
fixedRect.X + (fixedRect.Width / 2 - hSpace / 2) + 3,
|
||||
fixedRect.Y - dist - 7,
|
||||
measureWidth.Width - 3,
|
||||
|
@ -923,7 +923,7 @@ namespace Greenshot.Forms {
|
|||
// vertical ruler
|
||||
if (fixedRect.Height > vSpace + 3)
|
||||
{
|
||||
using GraphicsPath p = RoundedRectangle.Create2(
|
||||
using GraphicsPath p = CreateRoundedRectangle(
|
||||
fixedRect.X - measureHeight.Width + 1,
|
||||
fixedRect.Y + (fixedRect.Height / 2 - vSpace / 2) + 2,
|
||||
measureHeight.Width - 3,
|
||||
|
@ -990,7 +990,7 @@ namespace Greenshot.Forms {
|
|||
string xy = _cursorPos.X + " x " + _cursorPos.Y;
|
||||
using Font f = new Font(FontFamily.GenericSansSerif, 8);
|
||||
Size xySize = TextRenderer.MeasureText(xy, f);
|
||||
using GraphicsPath gp = RoundedRectangle.Create2(_cursorPos.X + 5, _cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3);
|
||||
using GraphicsPath gp = CreateRoundedRectangle(_cursorPos.X + 5, _cursorPos.Y + 5, xySize.Width - 3, xySize.Height, 3);
|
||||
using (Brush bgBrush = new SolidBrush(Color.FromArgb(200, 217, 240, 227))) {
|
||||
graphics.FillPath(bgBrush, gp);
|
||||
}
|
||||
|
@ -1014,5 +1014,21 @@ namespace Greenshot.Forms {
|
|||
DrawZoom(graphics, sourceRectangle, destinationRectangle);
|
||||
}
|
||||
}
|
||||
|
||||
private static GraphicsPath CreateRoundedRectangle(int x, int y, int width, int height, int radius)
|
||||
{
|
||||
var gp = new GraphicsPath();
|
||||
gp.AddLine(x + radius, y, x + width - radius * 2, y); // Line
|
||||
gp.AddArc(x + width - radius * 2, y, radius * 2, radius * 2, 270, 90); // Corner
|
||||
gp.AddLine(x + width, y + radius, x + width, y + height - radius * 2); // Line
|
||||
gp.AddArc(x + width - radius * 2, y + height - radius * 2, radius * 2, radius * 2, 0, 90); // Corner
|
||||
gp.AddLine(x + width - radius * 2, y + height, x + radius, y + height); // Line
|
||||
gp.AddArc(x, y + height - radius * 2, radius * 2, radius * 2, 90, 90); // Corner
|
||||
gp.AddLine(x, y + height - radius * 2, x, y + radius); // Line
|
||||
gp.AddArc(x, y, radius * 2, radius * 2, 180, 90); // Corner
|
||||
gp.CloseFigure();
|
||||
|
||||
return gp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -59,8 +59,6 @@ namespace Greenshot.Forms {
|
|||
set { PreviewColor(value, this); }
|
||||
}
|
||||
|
||||
public IList<Color> RecentColors => EditorConfig.RecentColors;
|
||||
|
||||
private void CreateColorPalette(int x, int y, int w, int h) {
|
||||
CreateColorButtonColumn(255, 0, 0, x, y, w, h, 11);
|
||||
x += w;
|
||||
|
|
|
@ -512,14 +512,6 @@ namespace Greenshot.Forms {
|
|||
|
||||
public ICaptureDetails CaptureDetails => _surface.CaptureDetails;
|
||||
|
||||
public ToolStripMenuItem GetPluginMenuItem() {
|
||||
return pluginToolStripMenuItem;
|
||||
}
|
||||
|
||||
public ToolStripMenuItem GetFileMenuItem() {
|
||||
return fileStripMenuItem;
|
||||
}
|
||||
|
||||
private void BtnSaveClick(object sender, EventArgs e) {
|
||||
string destinationDesignation = FileDestination.DESIGNATION;
|
||||
if (_surface.LastSaveFullPath == null) {
|
||||
|
|
|
@ -60,26 +60,6 @@ namespace Greenshot.Helpers {
|
|||
ieAccessible.ActivateIETab(tabIndex);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Return true if the supplied window has a sub-window which covers more than the supplied percentage
|
||||
/// </summary>
|
||||
/// <param name="someWindow">WindowDetails to check</param>
|
||||
/// <param name="minimumPercentage">min percentage</param>
|
||||
/// <returns></returns>
|
||||
public static bool IsMostlyIeWindow(WindowDetails someWindow, int minimumPercentage) {
|
||||
WindowDetails ieWindow = someWindow.GetChild("Internet Explorer_Server");
|
||||
if (ieWindow == null) return false;
|
||||
|
||||
Rectangle wholeClient = someWindow.ClientRectangle;
|
||||
Rectangle partClient = ieWindow.ClientRectangle;
|
||||
int percentage = (int)(100*(float)(partClient.Width * partClient.Height) / (wholeClient.Width * wholeClient.Height));
|
||||
Log.InfoFormat("Window {0}, ie part {1}, percentage {2}", wholeClient, partClient, percentage);
|
||||
if (percentage > minimumPercentage) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Does the supplied window have a IE part?
|
||||
/// </summary>
|
||||
|
|
|
@ -34,13 +34,6 @@ namespace GreenshotConfluencePlugin {
|
|||
private IDictionary _displayValues;
|
||||
private IDictionary _reverseValues;
|
||||
|
||||
public EnumDisplayer() {
|
||||
}
|
||||
|
||||
public EnumDisplayer(Type type) {
|
||||
Type = type;
|
||||
}
|
||||
|
||||
public Type Type {
|
||||
get { return _type; }
|
||||
set {
|
||||
|
|
|
@ -1,113 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Collections;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GreenshotConfluencePlugin.Forms
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is an implementation of the 'IComparer' interface.
|
||||
/// </summary>
|
||||
public class ListViewColumnSorter : IComparer {
|
||||
/// <summary>
|
||||
/// Specifies the column to be sorted
|
||||
/// </summary>
|
||||
private int _columnToSort;
|
||||
/// <summary>
|
||||
/// Specifies the order in which to sort (i.e. 'Ascending').
|
||||
/// </summary>
|
||||
private SortOrder _orderOfSort;
|
||||
/// <summary>
|
||||
/// Case insensitive comparer object
|
||||
/// </summary>
|
||||
private readonly CaseInsensitiveComparer _objectCompare;
|
||||
|
||||
/// <summary>
|
||||
/// Class constructor. Initializes various elements
|
||||
/// </summary>
|
||||
public ListViewColumnSorter() {
|
||||
// Initialize the column to '0'
|
||||
_columnToSort = 0;
|
||||
|
||||
// Initialize the sort order to 'none'
|
||||
_orderOfSort = SortOrder.None;
|
||||
|
||||
// Initialize the CaseInsensitiveComparer object
|
||||
_objectCompare = new CaseInsensitiveComparer();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// This method is inherited from the IComparer interface. It compares the two objects passed using a case insensitive comparison.
|
||||
/// </summary>
|
||||
/// <param name="x">First object to be compared</param>
|
||||
/// <param name="y">Second object to be compared</param>
|
||||
/// <returns>The result of the comparison. "0" if equal, negative if 'x' is less than 'y' and positive if 'x' is greater than 'y'</returns>
|
||||
public int Compare(object x, object y) {
|
||||
int compareResult;
|
||||
ListViewItem listviewX, listviewY;
|
||||
|
||||
// Cast the objects to be compared to ListViewItem objects
|
||||
listviewX = (ListViewItem)x;
|
||||
listviewY = (ListViewItem)y;
|
||||
|
||||
// Compare the two items
|
||||
compareResult = _objectCompare.Compare(listviewX.SubItems[_columnToSort].Text, listviewY.SubItems[_columnToSort].Text);
|
||||
|
||||
// Calculate correct return value based on object comparison
|
||||
if (_orderOfSort == SortOrder.Ascending) {
|
||||
// Ascending sort is selected, return normal result of compare operation
|
||||
return compareResult;
|
||||
} else if (_orderOfSort == SortOrder.Descending) {
|
||||
// Descending sort is selected, return negative result of compare operation
|
||||
return (-compareResult);
|
||||
} else {
|
||||
// Return '0' to indicate they are equal
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the number of the column to which to apply the sorting operation (Defaults to '0').
|
||||
/// </summary>
|
||||
public int SortColumn {
|
||||
set {
|
||||
_columnToSort = value;
|
||||
}
|
||||
get {
|
||||
return _columnToSort;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the order of sorting to apply (for example, 'Ascending' or 'Descending').
|
||||
/// </summary>
|
||||
public SortOrder Order {
|
||||
set {
|
||||
_orderOfSort = value;
|
||||
}
|
||||
get {
|
||||
return _orderOfSort;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -29,14 +29,6 @@ namespace GreenshotOfficePlugin.OfficeInterop
|
|||
/// </summary>
|
||||
Office97 = 8,
|
||||
/// <summary>
|
||||
/// Office 2000
|
||||
/// </summary>
|
||||
Office2000 = 9,
|
||||
/// <summary>
|
||||
/// Office 2002
|
||||
/// </summary>
|
||||
Office2002 = 10,
|
||||
/// <summary>
|
||||
/// Office 2003
|
||||
/// </summary>
|
||||
Office2003 = 11,
|
||||
|
|
|
@ -47,11 +47,6 @@ namespace GreenshotPhotobucketPlugin {
|
|||
[IniProperty("Username", Description = "The Photobucket api username", ExcludeIfNull = true)]
|
||||
public string Username { get; set; }
|
||||
|
||||
public int Credits {
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A form for username/password
|
||||
/// </summary>
|
||||
|
|
|
@ -22,13 +22,8 @@ namespace GreenshotPicasaPlugin {
|
|||
public enum LangKey
|
||||
{
|
||||
upload_menu_item,
|
||||
settings_title,
|
||||
label_upload_format,
|
||||
upload_success,
|
||||
upload_failure,
|
||||
communication_wait,
|
||||
Configure,
|
||||
label_AfterUpload,
|
||||
label_AfterUploadLinkToClipBoard
|
||||
Configure
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,10 +53,6 @@ namespace GreenshotPlugin.Controls {
|
|||
}
|
||||
}
|
||||
|
||||
public SaveImageFileDialog() {
|
||||
Init();
|
||||
}
|
||||
|
||||
public SaveImageFileDialog(ICaptureDetails captureDetails) {
|
||||
_captureDetails = captureDetails;
|
||||
Init();
|
||||
|
|
|
@ -564,14 +564,6 @@ EndSelection:<<<<<<<4
|
|||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Wrapper for Clipboard.GetText created for Bug #3432313
|
||||
/// </summary>
|
||||
/// <returns>string if there is text on the clipboard</returns>
|
||||
public static string GetText() {
|
||||
return GetText(GetDataObject());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get Text from the DataObject
|
||||
/// </summary>
|
||||
|
|
|
@ -21,7 +21,6 @@
|
|||
|
||||
using GreenshotPlugin.Core.Enums;
|
||||
using GreenshotPlugin.UnmanagedHelpers;
|
||||
using log4net;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.Runtime.InteropServices;
|
||||
|
@ -36,8 +35,6 @@ namespace GreenshotPlugin.Core
|
|||
/// </summary>
|
||||
public static class DpiHelper
|
||||
{
|
||||
private static readonly ILog Log = LogManager.GetLogger(typeof(DpiHelper));
|
||||
|
||||
/// <summary>
|
||||
/// This is the default DPI for the screen
|
||||
/// </summary>
|
||||
|
|
|
@ -28,29 +28,6 @@ namespace GreenshotPlugin.Core.Enums
|
|||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum HResult
|
||||
{
|
||||
#pragma warning disable 1591
|
||||
S_OK = 0,
|
||||
S_FALSE = 1,
|
||||
E_FAIL = unchecked((int)0x80004005),
|
||||
E_INVALIDARG = unchecked((int)0x80070057),
|
||||
E_NOTIMPL = unchecked((int)0x80004001),
|
||||
E_POINTER = unchecked((int)0x80004003),
|
||||
E_PENDING = unchecked((int)0x8000000A),
|
||||
E_NOINTERFACE = unchecked((int)0x80004002),
|
||||
E_ABORT = unchecked((int)0x80004004),
|
||||
E_ACCESSDENIED = unchecked((int)0x80070006),
|
||||
E_HANDLE = unchecked((int)0x80070006),
|
||||
E_UNEXPECTED = unchecked((int)0x8000FFFF),
|
||||
E_FILENOTFOUND = unchecked((int)0x80070002),
|
||||
E_PATHNOTFOUND = unchecked((int)0x80070003),
|
||||
E_INVALID_DATA = unchecked((int)0x8007000D),
|
||||
E_OUTOFMEMORY = unchecked((int)0x8007000E),
|
||||
E_INSUFFICIENT_BUFFER = unchecked((int)0x8007007A),
|
||||
WSAECONNABORTED = unchecked((int)0x80072745),
|
||||
WSAECONNRESET = unchecked((int)0x80072746),
|
||||
ERROR_TOO_MANY_CMDS = unchecked((int)0x80070038),
|
||||
ERROR_NOT_SUPPORTED = unchecked((int)0x80070032),
|
||||
TYPE_E_ELEMENTNOTFOUND = unchecked((int)0x8002802B)
|
||||
#pragma warning restore 1591
|
||||
}
|
||||
}
|
||||
|
|
|
@ -467,16 +467,6 @@ namespace GreenshotPlugin.Core {
|
|||
return returnIcon;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the number of icon in the file
|
||||
/// </summary>
|
||||
/// <param name="location">Location of the EXE or DLL</param>
|
||||
/// <returns></returns>
|
||||
public static int CountAssociatedIcons(string location)
|
||||
{
|
||||
return Shell32.ExtractIconEx(location, -1, out _, out _, 0);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply the effect to the bitmap
|
||||
/// </summary>
|
||||
|
@ -1063,16 +1053,6 @@ namespace GreenshotPlugin.Core {
|
|||
ApplyImageAttributes(source, sourceRect, dest, destRect, imageAttributes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply image attributes to the image
|
||||
/// </summary>
|
||||
/// <param name="source">Image to apply matrix to</param>
|
||||
/// <param name="imageAttributes">ImageAttributes to apply</param>
|
||||
public static void ApplyColorMatrix(Bitmap source, ImageAttributes imageAttributes)
|
||||
{
|
||||
ApplyImageAttributes(source, Rectangle.Empty, source, Rectangle.Empty, imageAttributes);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Apply a color matrix by copying from the source to the destination
|
||||
/// </summary>
|
||||
|
@ -1242,16 +1222,6 @@ namespace GreenshotPlugin.Core {
|
|||
return clone;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the supplied Bitmap has a PixelFormat we support
|
||||
/// </summary>
|
||||
/// <param name="image">bitmap to check</param>
|
||||
/// <returns>bool if we support it</returns>
|
||||
public static bool SupportsPixelFormat(Image image)
|
||||
{
|
||||
return SupportsPixelFormat(image.PixelFormat);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if we support the pixel format
|
||||
/// </summary>
|
||||
|
@ -1462,30 +1432,6 @@ namespace GreenshotPlugin.Core {
|
|||
return newImage;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a scaled version of the sourceBitmap
|
||||
/// </summary>
|
||||
/// <param name="sourceBitmap"></param>
|
||||
/// <param name="percent">1-99 to make smaller, use 101 and more to make the picture bigger</param>
|
||||
/// <returns></returns>
|
||||
public static Bitmap ScaleByPercent(Bitmap sourceBitmap, int percent)
|
||||
{
|
||||
float nPercent = (float)percent / 100;
|
||||
|
||||
int sourceWidth = sourceBitmap.Width;
|
||||
int sourceHeight = sourceBitmap.Height;
|
||||
int destWidth = (int)(sourceWidth * nPercent);
|
||||
int destHeight = (int)(sourceHeight * nPercent);
|
||||
|
||||
Bitmap scaledBitmap = CreateEmpty(destWidth, destHeight, sourceBitmap.PixelFormat, Color.Empty, sourceBitmap.HorizontalResolution, sourceBitmap.VerticalResolution);
|
||||
using (Graphics graphics = Graphics.FromImage(scaledBitmap))
|
||||
{
|
||||
graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
|
||||
graphics.DrawImage(sourceBitmap, new Rectangle(0, 0, destWidth, destHeight), new Rectangle(0, 0, sourceWidth, sourceHeight), GraphicsUnit.Pixel);
|
||||
}
|
||||
return scaledBitmap;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Resize canvas with pixel to the left, right, top and bottom
|
||||
/// </summary>
|
||||
|
|
|
@ -50,8 +50,6 @@ namespace GreenshotPlugin.Core {
|
|||
public enum OAuth2AuthorizeMode {
|
||||
Unknown, // Will give an exception, caller needs to specify another value
|
||||
LocalServer, // Will specify a redirect URL to http://localhost:port/authorize, while having a HttpListener
|
||||
MonitorTitle, // Not implemented yet: Will monitor for title changes
|
||||
Pin, // Not implemented yet: Will ask the user to enter the shown PIN
|
||||
EmbeddedBrowser, // Will open into an embedded _browser (OAuthLoginForm), and catch the redirect
|
||||
OutOfBoundAuto
|
||||
}
|
||||
|
|
|
@ -358,16 +358,6 @@ namespace GreenshotPlugin.Core
|
|||
return _childWindows;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve children with a certain title or classname
|
||||
/// </summary>
|
||||
/// <param name="titlePattern">The regexp to look for in the title</param>
|
||||
/// <param name="classnamePattern">The regexp to look for in the classname</param>
|
||||
/// <returns>List WindowDetails with all the found windows, or an empty list</returns>
|
||||
public IEnumerable<WindowDetails> FindChildren(string titlePattern, string classnamePattern) {
|
||||
return FindWindow(Children, titlePattern, classnamePattern);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the window's handle
|
||||
/// </summary>
|
||||
|
|
|
@ -36,16 +36,6 @@ namespace GreenshotPlugin.Interop
|
|||
[Flags]
|
||||
internal enum FileDescriptorFlags : uint
|
||||
{
|
||||
ClsId = 0x00000001,
|
||||
SizePoint = 0x00000002,
|
||||
Attributes = 0x00000004,
|
||||
CreateTime = 0x00000008,
|
||||
AccessTime = 0x00000010,
|
||||
WritesTime = 0x00000020,
|
||||
FileSize = 0x00000040,
|
||||
ProgressUI = 0x00004000,
|
||||
LinkUI = 0x00008000,
|
||||
Unicode = 0x80000000,
|
||||
}
|
||||
|
||||
internal static class FileDescriptorReader
|
||||
|
|
|
@ -24,7 +24,6 @@ using System.Collections.Generic;
|
|||
using System.ComponentModel;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Drawing.Imaging;
|
||||
using System.Windows.Forms;
|
||||
using GreenshotPlugin.Interfaces.Drawing.Adorners;
|
||||
|
||||
|
@ -213,14 +212,4 @@ namespace GreenshotPlugin.Interfaces.Drawing
|
|||
}
|
||||
void Load(string filename);
|
||||
}
|
||||
|
||||
public interface IMetafileContainer : IDrawableContainer
|
||||
{
|
||||
Metafile Metafile
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
void Load(string filename);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
*/
|
||||
|
||||
using System.Drawing;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace GreenshotPlugin.Interfaces.Forms {
|
||||
/// <summary>
|
||||
|
@ -35,18 +34,6 @@ namespace GreenshotPlugin.Interfaces.Forms {
|
|||
/// <returns>Bitmap</returns>
|
||||
Image GetImageForExport();
|
||||
|
||||
/// <summary>
|
||||
/// Get the ToolStripMenuItem where plugins can place their Menu entrys
|
||||
/// </summary>
|
||||
/// <returns>ToolStripMenuItem</returns>
|
||||
ToolStripMenuItem GetPluginMenuItem();
|
||||
|
||||
/// <summary>
|
||||
/// Get the File ToolStripMenuItem
|
||||
/// </summary>
|
||||
/// <returns>ToolStripMenuItem</returns>
|
||||
ToolStripMenuItem GetFileMenuItem();
|
||||
|
||||
/// <summary>
|
||||
/// Make the ICaptureDetails from the current Surface in the EditorForm available.
|
||||
/// </summary>
|
||||
|
|
|
@ -1,34 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
namespace GreenshotPlugin.Interfaces
|
||||
{
|
||||
/// <summary>
|
||||
/// Alignment Enums for positioning
|
||||
/// </summary>
|
||||
//public enum HorizontalAlignment {LEFT, CENTER, RIGHT};
|
||||
public enum VerticalAlignment
|
||||
{
|
||||
TOP,
|
||||
CENTER,
|
||||
BOTTOM
|
||||
};
|
||||
}
|
|
@ -35,8 +35,6 @@ namespace GreenshotPlugin.Interop {
|
|||
/// </summary>
|
||||
public sealed class COMWrapper : RealProxy, IDisposable, IRemotingTypeInfo {
|
||||
private static readonly ILog Log = LogManager.GetLogger(typeof(COMWrapper));
|
||||
private const int MK_E_UNAVAILABLE = -2147221021;
|
||||
private const int CO_E_CLASSSTRING = -2147221005;
|
||||
public const int RPC_E_CALL_REJECTED = unchecked((int)0x80010001);
|
||||
public const int RPC_E_FAIL = unchecked((int)0x80004005);
|
||||
|
||||
|
@ -60,83 +58,6 @@ namespace GreenshotPlugin.Interop {
|
|||
/// </summary>
|
||||
private readonly string _targetName;
|
||||
|
||||
[DllImport("ole32.dll")]
|
||||
private static extern int ProgIDFromCLSID([In] ref Guid clsid, [MarshalAs(UnmanagedType.LPWStr)] out string lplpszProgId);
|
||||
// Converts failure HRESULTs to exceptions:
|
||||
[DllImport("oleaut32", PreserveSig=false)]
|
||||
private static extern void GetActiveObject(ref Guid rclsid, IntPtr pvReserved, [MarshalAs(UnmanagedType.IUnknown)] out object ppunk);
|
||||
|
||||
/// <summary>
|
||||
/// Gets a COM object and returns the transparent proxy which intercepts all calls to the object
|
||||
/// </summary>
|
||||
/// <typeparam name="T">Interface which defines the method and properties to intercept</typeparam>
|
||||
/// <returns>Transparent proxy to the real proxy for the object</returns>
|
||||
/// <remarks>T must be an interface decorated with the <see cref="ComProgIdAttribute"/>attribute.</remarks>
|
||||
public static T GetInstance<T>() {
|
||||
Type type = typeof(T);
|
||||
if (null == type) {
|
||||
throw new ArgumentNullException(nameof(T));
|
||||
}
|
||||
if (!type.IsInterface) {
|
||||
throw new ArgumentException("The specified type must be an interface.", nameof(T));
|
||||
}
|
||||
|
||||
var progIdAttribute = ComProgIdAttribute.GetAttribute(type);
|
||||
if (string.IsNullOrEmpty(progIdAttribute?.Value)) {
|
||||
throw new ArgumentException("The specified type must define a ComProgId attribute.", nameof(T));
|
||||
}
|
||||
string progId = progIdAttribute.Value;
|
||||
|
||||
object comObject = null;
|
||||
|
||||
// Convert from clsid to Prog ID, if needed
|
||||
if (progId.StartsWith("clsid:")) {
|
||||
Guid guid = new Guid(progId.Substring(6));
|
||||
int result = ProgIDFromCLSID(ref guid, out progId);
|
||||
if (result != 0) {
|
||||
// Restore progId, as it's overwritten
|
||||
progId = progIdAttribute.Value;
|
||||
|
||||
try {
|
||||
GetActiveObject(ref guid, IntPtr.Zero, out comObject);
|
||||
} catch (Exception) {
|
||||
Log.WarnFormat("Error {0} getting instance for class id {1}", result, progIdAttribute.Value);
|
||||
}
|
||||
if (comObject == null) {
|
||||
Log.WarnFormat("Error {0} getting progId {1}", result, progIdAttribute.Value);
|
||||
}
|
||||
} else {
|
||||
Log.InfoFormat("Mapped {0} to progId {1}", progIdAttribute.Value, progId);
|
||||
}
|
||||
}
|
||||
|
||||
if (comObject == null) {
|
||||
try {
|
||||
comObject = Marshal.GetActiveObject(progId);
|
||||
} catch (COMException comE) {
|
||||
if (comE.ErrorCode == MK_E_UNAVAILABLE) {
|
||||
Log.DebugFormat("No current instance of {0} object available.", progId);
|
||||
} else if (comE.ErrorCode == CO_E_CLASSSTRING) {
|
||||
Log.WarnFormat("Unknown progId {0}", progId);
|
||||
} else {
|
||||
Log.Warn("Error getting active object for " + progIdAttribute.Value, comE);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
Log.Warn("Error getting active object for " + progIdAttribute.Value, e);
|
||||
}
|
||||
}
|
||||
|
||||
if (comObject != null) {
|
||||
if (comObject is IDispatch) {
|
||||
COMWrapper wrapper = new COMWrapper(comObject, type, progIdAttribute.Value);
|
||||
return (T)wrapper.GetTransparentProxy();
|
||||
} else {
|
||||
return (T)comObject;
|
||||
}
|
||||
}
|
||||
return default;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A simple create instance, doesn't create a wrapper!!
|
||||
/// </summary>
|
||||
|
|
|
@ -35,8 +35,6 @@ namespace GreenshotPlugin.Interop {
|
|||
}
|
||||
|
||||
public enum MONITOR_APP_VISIBILITY {
|
||||
MAV_UNKNOWN = 0, // The mode for the monitor is unknown
|
||||
MAV_NO_APP_VISIBLE = 1,
|
||||
MAV_APP_VISIBLE = 2
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,15 +26,7 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ClassLongIndex
|
||||
{
|
||||
GCL_CBCLSEXTRA = -20, // the size, in bytes, of the extra memory associated with the class. Setting this value does not change the number of extra bytes already allocated.
|
||||
GCL_CBWNDEXTRA = -18, // the size, in bytes, of the extra window memory associated with each window in the class. Setting this value does not change the number of extra bytes already allocated. For information on how to access this memory, see SetWindowLong.
|
||||
GCL_HBRBACKGROUND = -10, // a handle to the background brush associated with the class.
|
||||
GCL_HCURSOR = -12, // a handle to the cursor associated with the class.
|
||||
GCL_HICON = -14, // a handle to the icon associated with the class.
|
||||
GCL_HICONSM = -34, // a handle to the small icon associated with the class.
|
||||
GCL_HMODULE = -16, // a handle to the module that registered the class.
|
||||
GCL_MENUNAME = -8, // the address of the menu name string. The string identifies the menu resource associated with the class.
|
||||
GCL_STYLE = -26, // the window-class style bits.
|
||||
GCL_WNDPROC = -24, // the address of the window procedure, or a handle representing the address of the window procedure. You must use the CallWindowProc function to call the window procedure.
|
||||
}
|
||||
}
|
|
@ -29,166 +29,15 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
/// </summary>
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum DeviceCaps {
|
||||
/// <summary>
|
||||
/// Device driver version
|
||||
/// </summary>
|
||||
DRIVERVERSION = 0,
|
||||
/// <summary>
|
||||
/// Device classification
|
||||
/// </summary>
|
||||
TECHNOLOGY = 2,
|
||||
/// <summary>
|
||||
/// Horizontal size in millimeters
|
||||
/// </summary>
|
||||
HORZSIZE = 4,
|
||||
/// <summary>
|
||||
/// Vertical size in millimeters
|
||||
/// </summary>
|
||||
VERTSIZE = 6,
|
||||
/// <summary>
|
||||
/// Horizontal width in pixels
|
||||
/// </summary>
|
||||
HORZRES = 8,
|
||||
/// <summary>
|
||||
/// Vertical height in pixels
|
||||
/// </summary>
|
||||
VERTRES = 10,
|
||||
/// <summary>
|
||||
/// Number of bits per pixel
|
||||
/// </summary>
|
||||
BITSPIXEL = 12,
|
||||
/// <summary>
|
||||
/// Number of planes
|
||||
/// </summary>
|
||||
PLANES = 14,
|
||||
/// <summary>
|
||||
/// Number of brushes the device has
|
||||
/// </summary>
|
||||
NUMBRUSHES = 16,
|
||||
/// <summary>
|
||||
/// Number of pens the device has
|
||||
/// </summary>
|
||||
NUMPENS = 18,
|
||||
/// <summary>
|
||||
/// Number of markers the device has
|
||||
/// </summary>
|
||||
NUMMARKERS = 20,
|
||||
/// <summary>
|
||||
/// Number of fonts the device has
|
||||
/// </summary>
|
||||
NUMFONTS = 22,
|
||||
/// <summary>
|
||||
/// Number of colors the device supports
|
||||
/// </summary>
|
||||
NUMCOLORS = 24,
|
||||
/// <summary>
|
||||
/// Size required for device descriptor
|
||||
/// </summary>
|
||||
PDEVICESIZE = 26,
|
||||
/// <summary>
|
||||
/// Curve capabilities
|
||||
/// </summary>
|
||||
CURVECAPS = 28,
|
||||
/// <summary>
|
||||
/// Line capabilities
|
||||
/// </summary>
|
||||
LINECAPS = 30,
|
||||
/// <summary>
|
||||
/// Polygonal capabilities
|
||||
/// </summary>
|
||||
POLYGONALCAPS = 32,
|
||||
/// <summary>
|
||||
/// Text capabilities
|
||||
/// </summary>
|
||||
TEXTCAPS = 34,
|
||||
/// <summary>
|
||||
/// Clipping capabilities
|
||||
/// </summary>
|
||||
CLIPCAPS = 36,
|
||||
/// <summary>
|
||||
/// Bitblt capabilities
|
||||
/// </summary>
|
||||
RASTERCAPS = 38,
|
||||
/// <summary>
|
||||
/// Length of the X leg
|
||||
/// </summary>
|
||||
ASPECTX = 40,
|
||||
/// <summary>
|
||||
/// Length of the Y leg
|
||||
/// </summary>
|
||||
ASPECTY = 42,
|
||||
/// <summary>
|
||||
/// Length of the hypotenuse
|
||||
/// </summary>
|
||||
ASPECTXY = 44,
|
||||
/// <summary>
|
||||
/// Shading and Blending caps
|
||||
/// </summary>
|
||||
SHADEBLENDCAPS = 45,
|
||||
|
||||
/// <summary>
|
||||
/// Logical pixels inch in X
|
||||
/// </summary>
|
||||
LOGPIXELSX = 88,
|
||||
/// <summary>
|
||||
/// Logical pixels inch in Y
|
||||
/// </summary>
|
||||
LOGPIXELSY = 90,
|
||||
|
||||
/// <summary>
|
||||
/// Number of entries in physical palette
|
||||
/// </summary>
|
||||
SIZEPALETTE = 104,
|
||||
/// <summary>
|
||||
/// Number of reserved entries in palette
|
||||
/// </summary>
|
||||
NUMRESERVED = 106,
|
||||
/// <summary>
|
||||
/// Actual color resolution
|
||||
/// </summary>
|
||||
COLORRES = 108,
|
||||
|
||||
// Printing related DeviceCaps. These replace the appropriate Escapes
|
||||
/// <summary>
|
||||
/// Physical Width in device units
|
||||
/// </summary>
|
||||
PHYSICALWIDTH = 110,
|
||||
/// <summary>
|
||||
/// Physical Height in device units
|
||||
/// </summary>
|
||||
PHYSICALHEIGHT = 111,
|
||||
/// <summary>
|
||||
/// Physical Printable Area x margin
|
||||
/// </summary>
|
||||
PHYSICALOFFSETX = 112,
|
||||
/// <summary>
|
||||
/// Physical Printable Area y margin
|
||||
/// </summary>
|
||||
PHYSICALOFFSETY = 113,
|
||||
/// <summary>
|
||||
/// Scaling factor x
|
||||
/// </summary>
|
||||
SCALINGFACTORX = 114,
|
||||
/// <summary>
|
||||
/// Scaling factor y
|
||||
/// </summary>
|
||||
SCALINGFACTORY = 115,
|
||||
|
||||
/// <summary>
|
||||
/// Current vertical refresh rate of the display device (for displays only) in Hz
|
||||
/// </summary>
|
||||
VREFRESH = 116,
|
||||
/// <summary>
|
||||
/// Horizontal width of entire desktop in pixels
|
||||
/// </summary>
|
||||
DESKTOPVERTRES = 117,
|
||||
/// <summary>
|
||||
/// Vertical height of entire desktop in pixels
|
||||
/// </summary>
|
||||
DESKTOPHORZRES = 118,
|
||||
/// <summary>
|
||||
/// Preferred blt alignment
|
||||
/// </summary>
|
||||
BLTALIGNMENT = 119
|
||||
VREFRESH = 116
|
||||
}
|
||||
}
|
|
@ -30,17 +30,6 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum EventObjects
|
||||
{
|
||||
OBJID_ALERT = -10,
|
||||
OBJID_CARET = -8,
|
||||
OBJID_CLIENT = -4,
|
||||
OBJID_CURSOR = -9,
|
||||
OBJID_HSCROLL = -6,
|
||||
OBJID_MENU = -3,
|
||||
OBJID_SIZEGRIP = -7,
|
||||
OBJID_SOUND = -11,
|
||||
OBJID_SYSMENU = -1,
|
||||
OBJID_TITLEBAR = -2,
|
||||
OBJID_VSCROLL = -5,
|
||||
OBJID_WINDOW = 0
|
||||
}
|
||||
}
|
|
@ -27,38 +27,7 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[Flags]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ExtendedWindowStyleFlags : uint {
|
||||
WS_EX_DLGMODALFRAME = 0x00000001,
|
||||
WS_EX_NOPARENTNOTIFY = 0x00000004,
|
||||
WS_EX_TOPMOST = 0x00000008,
|
||||
WS_EX_ACCEPTFILES = 0x00000010,
|
||||
WS_EX_TRANSPARENT = 0x00000020,
|
||||
|
||||
//#if(WINVER >= 0x0400)
|
||||
WS_EX_MDICHILD = 0x00000040,
|
||||
WS_EX_TOOLWINDOW = 0x00000080,
|
||||
WS_EX_WINDOWEDGE = 0x00000100,
|
||||
WS_EX_CLIENTEDGE = 0x00000200,
|
||||
WS_EX_CONTEXTHELP = 0x00000400,
|
||||
|
||||
WS_EX_RIGHT = 0x00001000,
|
||||
WS_EX_LEFT = 0x00000000,
|
||||
WS_EX_RTLREADING = 0x00002000,
|
||||
WS_EX_LTRREADING = 0x00000000,
|
||||
WS_EX_LEFTSCROLLBAR = 0x00004000,
|
||||
WS_EX_RIGHTSCROLLBAR = 0x00000000,
|
||||
|
||||
WS_EX_CONTROLPARENT = 0x00010000,
|
||||
WS_EX_STATICEDGE = 0x00020000,
|
||||
WS_EX_APPWINDOW = 0x00040000,
|
||||
|
||||
//WS_EX_OVERLAPPEDWINDOW = (WS_EX_WINDOWEDGE | WS_EX_CLIENTEDGE),
|
||||
//WS_EX_PALETTEWINDOW = (WS_EX_WINDOWEDGE | WS_EX_TOOLWINDOW | WS_EX_TOPMOST),
|
||||
|
||||
WS_EX_LAYERED = 0x00080000,
|
||||
WS_EX_NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
|
||||
WS_EX_NOREDIRECTIONBITMAP = 0x00200000, //The window does not render to a redirection surface. This is for windows that do not have visible content or that use mechanisms other than surfaces to provide their visual.
|
||||
WS_EX_LAYOUTRTL = 0x00400000, // Right to left mirroring
|
||||
WS_EX_COMPOSITED = 0x02000000,
|
||||
WS_EX_NOACTIVATE = 0x08000000 // A top-level window created with this style does not become the foreground window when the user clicks it. The system does not bring this window to the foreground when the user minimizes or closes the foreground window.
|
||||
}
|
||||
}
|
|
@ -1,36 +0,0 @@
|
|||
/*
|
||||
* Greenshot - a free and open source screenshot tool
|
||||
* Copyright (C) 2007-2021 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on GitHub https://github.com/greenshot/greenshot
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation, either version 1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum GetWindowCommand : uint {
|
||||
GW_HWNDFIRST = 0,
|
||||
GW_HWNDLAST = 1,
|
||||
GW_HWNDNEXT = 2,
|
||||
GW_HWNDPREV = 3,
|
||||
GW_OWNER = 4,
|
||||
GW_CHILD = 5,
|
||||
GW_ENABLEDPOPUP = 6
|
||||
}
|
||||
}
|
|
@ -27,15 +27,7 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[Flags]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum ProcessAccessFlags : uint {
|
||||
All = 0x001F0FFF,
|
||||
Terminate = 0x00000001,
|
||||
CreateThread = 0x00000002,
|
||||
VMOperation = 0x00000008,
|
||||
VMRead = 0x00000010,
|
||||
VMWrite = 0x00000020,
|
||||
DupHandle = 0x00000040,
|
||||
SetInformation = 0x00000200,
|
||||
QueryInformation = 0x00000400,
|
||||
Synchronize = 0x00100000
|
||||
}
|
||||
}
|
|
@ -27,7 +27,5 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
public enum RegionResult {
|
||||
REGION_ERROR = 0,
|
||||
REGION_NULLREGION = 1,
|
||||
REGION_SIMPLEREGION = 2,
|
||||
REGION_COMPLEXREGION = 3
|
||||
}
|
||||
}
|
|
@ -30,9 +30,6 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[Flags]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum SendMessageTimeoutFlags : uint {
|
||||
SMTO_NORMAL = 0x0,
|
||||
SMTO_BLOCK = 0x1,
|
||||
SMTO_ABORTIFHUNG = 0x2,
|
||||
SMTO_NOTIMEOUTIFNOTHUNG = 0x8
|
||||
SMTO_NORMAL = 0x0
|
||||
}
|
||||
}
|
|
@ -31,15 +31,9 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum SoundFlags
|
||||
{
|
||||
SND_SYNC = 0x0000, // play synchronously (default)
|
||||
SND_ASYNC = 0x0001, // play asynchronously
|
||||
SND_NODEFAULT = 0x0002, // silence (!default) if sound not found
|
||||
SND_MEMORY = 0x0004, // pszSound points to a memory file
|
||||
SND_LOOP = 0x0008, // loop the sound until next sndPlaySound
|
||||
SND_NOSTOP = 0x0010, // don't stop any currently playing sound
|
||||
SND_NOWAIT = 0x00002000, // don't wait if the driver is busy
|
||||
SND_ALIAS = 0x00010000, // name is a registry alias
|
||||
SND_ALIAS_ID = 0x00110000, // alias is a predefined id
|
||||
SND_FILENAME = 0x00020000, // name is file name
|
||||
}
|
||||
}
|
|
@ -27,10 +27,6 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums
|
|||
public enum WindowLongIndex
|
||||
{
|
||||
GWL_EXSTYLE = -20, // Sets a new extended window style.
|
||||
GWL_HINSTANCE = -6, // Sets a new application instance handle.
|
||||
GWL_ID = -12, // Sets a new identifier of the child window. The window cannot be a top-level window.
|
||||
GWL_STYLE = -16, // Sets a new window style.
|
||||
GWL_USERDATA = -21, // Sets the user data associated with the window. This data is intended for use by the application that created the window. Its value is initially zero.
|
||||
GWL_WNDPROC = -4 // Sets a new address for the window procedure. You cannot change this attribute if the window does not belong to the same process as the calling thread.
|
||||
}
|
||||
}
|
|
@ -29,58 +29,6 @@ namespace GreenshotPlugin.UnmanagedHelpers.Enums {
|
|||
[Flags]
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
public enum WindowStyleFlags : long {
|
||||
//WS_OVERLAPPED = 0x00000000,
|
||||
WS_POPUP = 0x80000000,
|
||||
WS_CHILD = 0x40000000,
|
||||
WS_MINIMIZE = 0x20000000,
|
||||
WS_VISIBLE = 0x10000000,
|
||||
WS_DISABLED = 0x08000000,
|
||||
WS_CLIPSIBLINGS = 0x04000000,
|
||||
WS_CLIPCHILDREN = 0x02000000,
|
||||
WS_MAXIMIZE = 0x01000000,
|
||||
WS_BORDER = 0x00800000,
|
||||
WS_DLGFRAME = 0x00400000,
|
||||
WS_VSCROLL = 0x00200000,
|
||||
WS_HSCROLL = 0x00100000,
|
||||
WS_SYSMENU = 0x00080000,
|
||||
WS_THICKFRAME = 0x00040000,
|
||||
WS_GROUP = 0x00020000,
|
||||
WS_TABSTOP = 0x00010000,
|
||||
|
||||
WS_UNK8000 = 0x00008000,
|
||||
WS_UNK4000 = 0x00004000,
|
||||
WS_UNK2000 = 0x00002000,
|
||||
WS_UNK1000 = 0x00001000,
|
||||
WS_UNK800 = 0x00000800,
|
||||
WS_UNK400 = 0x00000400,
|
||||
WS_UNK200 = 0x00000200,
|
||||
WS_UNK100 = 0x00000100,
|
||||
WS_UNK80 = 0x00000080,
|
||||
WS_UNK40 = 0x00000040,
|
||||
WS_UNK20 = 0x00000020,
|
||||
WS_UNK10 = 0x00000010,
|
||||
WS_UNK8 = 0x00000008,
|
||||
WS_UNK4 = 0x00000004,
|
||||
WS_UNK2 = 0x00000002,
|
||||
WS_UNK1 = 0x00000001,
|
||||
|
||||
//WS_MINIMIZEBOX = 0x00020000,
|
||||
//WS_MAXIMIZEBOX = 0x00010000,
|
||||
|
||||
//WS_CAPTION = WS_BORDER | WS_DLGFRAME,
|
||||
//WS_TILED = WS_OVERLAPPED,
|
||||
//WS_ICONIC = WS_MINIMIZE,
|
||||
//WS_SIZEBOX = WS_THICKFRAME,
|
||||
//WS_TILEDWINDOW = WS_OVERLAPPEDWINDOW,
|
||||
|
||||
//WS_OVERLAPPEDWINDOW = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME | WS_MINIMIZEBOX | WS_MAXIMIZEBOX,
|
||||
//WS_POPUPWINDOW = WS_POPUP | WS_BORDER | WS_SYSMENU
|
||||
//WS_CHILDWINDOW = WS_CHILD
|
||||
}
|
||||
|
||||
// See http://msdn.microsoft.com/en-us/library/aa969530(v=vs.85).aspx
|
||||
|
||||
// Get/Set WindowLong Enum See: http://msdn.microsoft.com/en-us/library/ms633591.aspx
|
||||
|
||||
// See: http://msdn.microsoft.com/en-us/library/ms633545.aspx
|
||||
}
|
||||
|
|
|
@ -72,10 +72,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern IntPtr GetParent(IntPtr hWnd);
|
||||
|
||||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern IntPtr GetWindow(IntPtr hWnd, GetWindowCommand uCmd);
|
||||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern int ShowWindow(IntPtr hWnd, ShowWindowCommand nCmdShow);
|
||||
[DllImport("user32", CharSet = CharSet.Unicode, SetLastError = true)]
|
||||
public static extern int GetWindowText(IntPtr hWnd, StringBuilder lpString, int cch);
|
||||
|
||||
|
@ -191,17 +187,6 @@ namespace GreenshotPlugin.UnmanagedHelpers {
|
|||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern bool CloseDesktop(IntPtr hDesktop);
|
||||
|
||||
/// <summary>
|
||||
/// The GetWindowDC function retrieves the device context (DC) for the entire window, including title bar, menus, and scroll bars. A window device context permits painting anywhere in a window, because the origin of the device context is the upper-left corner of the window instead of the client area.
|
||||
/// GetWindowDC assigns default attributes to the window device context each time it retrieves the device context.Previous attributes are lost.
|
||||
/// See <a href="https://docs.microsoft.com/en-us/windows/desktop/api/winuser/nf-winuser-getwindowdc">GetWindowDC function</a>
|
||||
/// </summary>
|
||||
/// <param name="hWnd">A handle to the window whose DC is to be retrieved. If this value is NULL, GetWindowDC retrieves the DC for the entire screen.</param>
|
||||
/// <returns>If the function succeeds, the return value is a handle to a device context for the specified window.</returns>
|
||||
[DllImport("user32", SetLastError = true)]
|
||||
public static extern IntPtr GetWindowDC(IntPtr hWnd);
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Retrieves the cursor location safely, accounting for DPI settings in Vista/Windows 7.
|
||||
/// </summary>
|
||||
|
|
|
@ -29,22 +29,6 @@ namespace GreenshotWin10Plugin.Internal
|
|||
/// </summary>
|
||||
internal sealed class MemoryRandomAccessStream : MemoryStream, IRandomAccessStream
|
||||
{
|
||||
/// <summary>
|
||||
/// Default constructor
|
||||
/// </summary>
|
||||
public MemoryRandomAccessStream()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Constructor where also bytes are already passed
|
||||
/// </summary>
|
||||
/// <param name="bytes">byte array</param>
|
||||
public MemoryRandomAccessStream(byte[] bytes)
|
||||
{
|
||||
Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public IInputStream GetInputStreamAt(ulong position)
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue