mirror of
https://github.com/greenshot/greenshot
synced 2025-08-20 13:33:27 -07:00
Made the re/undo code from the branch work in this, this is a manual copy as something went horribly wrong with the repository. Before building I first want to check if everything is there.[skip ci]
This commit is contained in:
parent
9702ac730f
commit
45615275cf
35 changed files with 1890 additions and 922 deletions
|
@ -3,7 +3,7 @@
|
|||
* Copyright (C) 2007-2015 Thomas Braun, Jens Klingen, Robin Krom
|
||||
*
|
||||
* For more information see: http://getgreenshot.org/
|
||||
* The Greenshot project is hosted on Sourceforge: http://sourceforge.net/projects/greenshot/
|
||||
* 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
|
||||
|
@ -18,63 +18,74 @@
|
|||
* 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 Greenshot.Core;
|
||||
using Greenshot.Memento;
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using GreenshotPlugin.Interfaces.Drawing;
|
||||
using System;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Windows.Forms;
|
||||
|
||||
using Greenshot.Plugin.Drawing;
|
||||
using System.IO;
|
||||
using System.Collections.Generic;
|
||||
using Greenshot.Core;
|
||||
|
||||
namespace Greenshot.Plugin {
|
||||
namespace Greenshot.Plugin
|
||||
{
|
||||
/// <summary>
|
||||
/// Alignment Enums for possitioning
|
||||
/// </summary>
|
||||
//public enum HorizontalAlignment {LEFT, CENTER, RIGHT};
|
||||
public enum VerticalAlignment {TOP, CENTER, BOTTOM};
|
||||
public enum VerticalAlignment { TOP, CENTER, BOTTOM };
|
||||
|
||||
public enum SurfaceMessageTyp {
|
||||
public enum SurfaceMessageTyp
|
||||
{
|
||||
FileSaved,
|
||||
Error,
|
||||
Info,
|
||||
UploadedUri
|
||||
}
|
||||
|
||||
public class SurfaceMessageEventArgs : EventArgs {
|
||||
public SurfaceMessageTyp MessageType {
|
||||
public class SurfaceMessageEventArgs : EventArgs
|
||||
{
|
||||
public SurfaceMessageTyp MessageType
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public string Message {
|
||||
public string Message
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
public ISurface Surface {
|
||||
public ISurface Surface
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class SurfaceElementEventArgs : EventArgs {
|
||||
public IList<IDrawableContainer> Elements {
|
||||
public class SurfaceElementEventArgs : EventArgs
|
||||
{
|
||||
public IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
public class SurfaceDrawingModeEventArgs : EventArgs {
|
||||
public DrawingModes DrawingMode {
|
||||
public class SurfaceDrawingModeEventArgs : EventArgs
|
||||
{
|
||||
public DrawingModes DrawingMode
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public delegate void SurfaceSizeChangeEventHandler(object sender, EventArgs e);
|
||||
public delegate void SurfaceMessageEventHandler(object sender, SurfaceMessageEventArgs e);
|
||||
public delegate void SurfaceElementEventHandler(object sender, SurfaceElementEventArgs e);
|
||||
public delegate void SurfaceDrawingModeEventHandler(object sender, SurfaceDrawingModeEventArgs e);
|
||||
public enum DrawingModes {
|
||||
public enum DrawingModes
|
||||
{
|
||||
None,
|
||||
Rect,
|
||||
Ellipse,
|
||||
|
@ -93,7 +104,8 @@ namespace Greenshot.Plugin {
|
|||
/// <summary>
|
||||
/// The interface to the Surface object, so Plugins can use it.
|
||||
/// </summary>
|
||||
public interface ISurface : IDisposable {
|
||||
public interface ISurface : IDisposable
|
||||
{
|
||||
event SurfaceSizeChangeEventHandler SurfaceSizeChanged;
|
||||
event SurfaceMessageEventHandler SurfaceMessage;
|
||||
event SurfaceDrawingModeEventHandler DrawingModeChanged;
|
||||
|
@ -102,11 +114,17 @@ namespace Greenshot.Plugin {
|
|||
/// <summary>
|
||||
/// Unique ID of the Surface
|
||||
/// </summary>
|
||||
Guid ID {
|
||||
Guid ID
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
IDrawableContainerList Elements
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get/Set the image to the Surface
|
||||
/// get will give the image as is currently visible
|
||||
|
@ -116,18 +134,19 @@ namespace Greenshot.Plugin {
|
|||
/// The setter will clone the passed bitmap and dispose it when the Surface is disposed
|
||||
/// This means that the supplied image needs to be disposed by the calling code (if needed!)
|
||||
/// </summary>
|
||||
Image Image {
|
||||
Image Image
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Get the current Image from the Editor for Exporting (save/upload etc)
|
||||
/// Don't forget to call image.Dispose() when finished!!!
|
||||
/// </summary>
|
||||
/// <returns>Bitmap</returns>
|
||||
Image GetImageForExport();
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Add a TextContainer, at the given location, to the Surface.
|
||||
/// The TextContainer will be "re"sized to the text size.
|
||||
|
@ -154,7 +173,8 @@ namespace Greenshot.Plugin {
|
|||
long SaveElementsToStream(Stream stream);
|
||||
void LoadElementsFromStream(Stream stream);
|
||||
|
||||
bool HasSelectedElements {
|
||||
bool HasSelectedElements
|
||||
{
|
||||
get;
|
||||
}
|
||||
void RemoveSelectedElements();
|
||||
|
@ -162,9 +182,32 @@ namespace Greenshot.Plugin {
|
|||
void CopySelectedElements();
|
||||
void PasteElementFromClipboard();
|
||||
void DuplicateSelectedElements();
|
||||
void DeselectElement(IDrawableContainer container);
|
||||
void DeselectElement(IDrawableContainer container, bool generateEvents = true);
|
||||
void DeselectAllElements();
|
||||
void SelectElement(IDrawableContainer container);
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="elements">IDrawableContainerList</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
void AddElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void RemoveElements(IDrawableContainerList elements, bool makeUndoable = true);
|
||||
void SelectElements(IDrawableContainerList elements);
|
||||
|
||||
/// <summary>
|
||||
/// Add an element to the surface
|
||||
/// </summary>
|
||||
/// <param name="element">IDrawableContainer</param>
|
||||
/// <param name="makeUndoable">Should it be placed on the undo stack?</param>
|
||||
/// <param name="invalidate">Should it be invalidated (draw)</param>
|
||||
void AddElement(IDrawableContainer element, bool makeUndoable = true, bool invalidate = true);
|
||||
|
||||
/// <summary>
|
||||
/// Select the supplied container
|
||||
/// </summary>
|
||||
/// <param name="container">IDrawableContainer</param>
|
||||
/// <param name="invalidate">false to skip invalidation</param>
|
||||
void SelectElement(IDrawableContainer container, bool invalidate = true, bool generateEvents = true);
|
||||
/// <summary>
|
||||
/// Is the supplied container "on" the surface?
|
||||
/// </summary>
|
||||
|
@ -173,31 +216,46 @@ namespace Greenshot.Plugin {
|
|||
bool IsOnSurface(IDrawableContainer container);
|
||||
void Invalidate(Rectangle rectangleToInvalidate);
|
||||
void Invalidate();
|
||||
bool Modified {
|
||||
bool Modified
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string LastSaveFullPath {
|
||||
string LastSaveFullPath
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string UploadURL {
|
||||
string UploadURL
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable);
|
||||
/// <summary>
|
||||
/// Remove an element of the elements list
|
||||
/// </summary>
|
||||
/// <param name="elementToRemove">Element to remove</param>
|
||||
/// <param name="makeUndoable">flag specifying if the remove needs to be undoable</param>
|
||||
/// <param name="invalidate">flag specifying if an surface invalidate needs to be called</param>
|
||||
/// <param name="generateEvents">flag specifying if the deselect needs to generate an event</param>
|
||||
void RemoveElement(IDrawableContainer elementToRemove, bool makeUndoable = true, bool invalidate = true, bool generateEvents = true);
|
||||
|
||||
void SendMessageEvent(object source, SurfaceMessageTyp messageType, string message);
|
||||
void ApplyBitmapEffect(IEffect effect);
|
||||
void RemoveCursor();
|
||||
bool HasCursor {
|
||||
bool HasCursor
|
||||
{
|
||||
get;
|
||||
}
|
||||
|
||||
ICaptureDetails CaptureDetails {
|
||||
ICaptureDetails CaptureDetails
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
int Width { get; }
|
||||
int Height { get; }
|
||||
|
||||
void MakeUndoable(IMemento memento, bool allowMerge);
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue