|
|
726e8a |
using System;
|
|
|
726e8a |
|
|
|
726e8a |
namespace Assistance {
|
|
|
c66393 |
[Flags]
|
|
|
c66393 |
public enum Modifiers {
|
|
|
c66393 |
None = 0,
|
|
|
c66393 |
Interpolation = 1,
|
|
|
c66393 |
Guideline = 2,
|
|
|
c66393 |
Multiline = 4
|
|
|
c66393 |
};
|
|
|
c66393 |
|
|
|
a62e15 |
public class Tool {
|
|
|
a62e15 |
public Modifiers getAvailableModifiers()
|
|
|
a62e15 |
{ return Modifiers.None; }
|
|
|
a62e15 |
|
|
|
38c95c |
public void activate() { }
|
|
|
38c95c |
|
|
|
38c95c |
public void keyPress(Gdk.Key key, InputState state) { }
|
|
|
38c95c |
public void keyRelease(Gdk.Key key, InputState state) { }
|
|
|
38c95c |
public void buttonPress(Gdk.Device device, uint button, InputState state) { }
|
|
|
38c95c |
public void buttonRelease(Gdk.Device device, uint button, InputState state) { }
|
|
|
38c95c |
|
|
|
38c95c |
public bool paintBegin() { return false; }
|
|
|
38c95c |
public void paintTrackBegin(Track track) { }
|
|
|
38c95c |
public void paintTrackPoint(Track track) { }
|
|
|
38c95c |
public void paintTrackEnd(Track track) { }
|
|
|
38c95c |
public bool paintApply() { return false; }
|
|
|
38c95c |
public void paintCancel() { }
|
|
|
38c95c |
|
|
|
a62e15 |
public void draw(Cairo.Context context) { }
|
|
|
77e178 |
|
|
|
a62e15 |
public void deactivate() { }
|
|
|
726e8a |
}
|
|
|
726e8a |
}
|
|
|
726e8a |
|
|
|
a62e15 |
/*
|
|
|
a62e15 |
TODO:
|
|
|
a62e15 |
//////////////////////////////////////////
|
|
|
a62e15 |
// deprecated
|
|
|
a62e15 |
//////////////////////////////////////////
|
|
|
a62e15 |
|
|
|
a62e15 |
public static readonly Pen pen = new Pen("Dark Green", 3.0);
|
|
|
a62e15 |
public static readonly Pen penSpecial = new Pen("Blue", 3.0);
|
|
|
a62e15 |
public static readonly Pen penPreview = new Pen("Dark Green", 1.0, 0.25);
|
|
|
a62e15 |
|
|
|
a62e15 |
public void draw(Cairo.Context context, bool preview = false) {
|
|
|
a62e15 |
if (preview) {
|
|
|
a62e15 |
if (points.Count < 2)
|
|
|
a62e15 |
return;
|
|
|
a62e15 |
context.Save();
|
|
|
a62e15 |
penPreview.apply(context);
|
|
|
a62e15 |
context.MoveTo(points[0].point.x, points[0].point.y);
|
|
|
a62e15 |
for(int i = 1; i < points.Count; ++i)
|
|
|
a62e15 |
context.LineTo(points[i].point.x, points[i].point.y);
|
|
|
a62e15 |
context.Stroke();
|
|
|
a62e15 |
context.Restore();
|
|
|
a62e15 |
} else {
|
|
|
a62e15 |
context.Save();
|
|
|
a62e15 |
pen.apply(context);
|
|
|
a62e15 |
foreach(TrackPoint p in points) {
|
|
|
a62e15 |
double t = p.keyState.howLongPressed(Gdk.Key.m)
|
|
|
a62e15 |
+ p.buttonState.howLongPressed(3);
|
|
|
a62e15 |
double w = p.pressure*pen.width + 5.0*t;
|
|
|
a62e15 |
context.Arc(p.point.x, p.point.y, 2.0*w, 0.0, 2.0*Math.PI);
|
|
|
a62e15 |
context.Fill();
|
|
|
a62e15 |
}
|
|
|
a62e15 |
context.Restore();
|
|
|
a62e15 |
}
|
|
|
a62e15 |
}
|
|
|
a62e15 |
|
|
|
a62e15 |
public Rectangle getBounds() {
|
|
|
a62e15 |
if (points.Count == 0)
|
|
|
a62e15 |
return new Rectangle();
|
|
|
a62e15 |
Rectangle bounds = new Rectangle(points[0].point);
|
|
|
a62e15 |
foreach(TrackPoint p in points)
|
|
|
a62e15 |
bounds = bounds.expand(p.point);
|
|
|
a62e15 |
return bounds.inflate(Math.Max(pen.width, penPreview.width) + 2.0);
|
|
|
a62e15 |
}
|
|
|
a62e15 |
*/
|