Fixed some interface usage, also cleanup of the surface & editor code. This should theoretically allow usage of home made IDrawableContainer objects, which plug-ins supply.

Also made it possible to reuse the editor, currently only available editors which have a non modified surface can be reused. And only than if the configuration is set to do so.

git-svn-id: http://svn.code.sf.net/p/greenshot/code/trunk@2100 7dccd23d-a4a3-4e1f-8c07-b4c1b4018ab4
This commit is contained in:
RKrom 2012-09-26 16:57:16 +00:00
commit f9abcac063
13 changed files with 233 additions and 154 deletions

View file

@ -22,12 +22,13 @@ using System;
using System.Drawing;
using System.Drawing.Imaging;
using System.Windows.Forms;
using System.ComponentModel;
namespace Greenshot.Plugin.Drawing {
public enum RenderMode {EDIT, EXPORT};
public enum EditStatus {UNDRAWN, DRAWING, MOVING, RESIZING, IDLE};
public interface IDrawableContainer {
public interface IDrawableContainer : INotifyPropertyChanged {
ISurface Parent {
get;
}
@ -76,9 +77,22 @@ namespace Greenshot.Plugin.Drawing {
get;
}
EditStatus Status {
get;
set;
}
void AlignToParent(HorizontalAlignment horizontalAlignment, VerticalAlignment verticalAlignment);
void Invalidate();
void Dispose();
bool ClickableAt(int x, int y);
void HideGrippers();
void ShowGrippers();
void MoveBy(int x, int y);
bool HandleMouseDown(int x, int y);
void HandleMouseUp(int x, int y);
bool HandleMouseMove(int x, int y);
bool InitContent();
void MakeBoundsChangeUndoable(bool allowMerge);
}
public interface ITextContainer: IDrawableContainer {

View file

@ -70,9 +70,10 @@ namespace Greenshot.Plugin {
ICaptureDetails CaptureDetails {
get;
}
ISurface Surface {
get;
set;
}
}
}

View file

@ -25,6 +25,7 @@ using System.Windows.Forms;
using Greenshot.Plugin.Drawing;
using System.IO;
using System.Collections.Generic;
namespace Greenshot.Plugin {
/// <summary>
@ -58,13 +59,18 @@ namespace Greenshot.Plugin {
public delegate void SurfaceSizeChangeEventHandler(object source);
public delegate void SurfaceMessageEventHandler(object source, SurfaceMessageEventArgs eventArgs);
public delegate void SurfaceElementEventHandler(object source, IList<IDrawableContainer> element);
public delegate void SurfaceDrawingModeEventHandler(object source, DrawingModes drawingMode);
public enum DrawingModes { None, Rect, Ellipse, Text, Line, Arrow, Crop, Highlight, Obfuscate, Bitmap, Path }
/// <summary>
/// The interface to the Surface object, so Plugins can use it.
/// </summary>
public interface ISurface : IDisposable {
event SurfaceSizeChangeEventHandler SurfaceSizeChanged;
event SurfaceMessageEventHandler SurfaceMessage;
event SurfaceMessageEventHandler SurfaceMessage;
event SurfaceDrawingModeEventHandler DrawingModeChanged;
event SurfaceElementEventHandler MovingElementChanged;
/// <summary>
/// Get/Set the image to the Surface