diff --git a/mono/Assistance/MainWindow.cs b/mono/Assistance/MainWindow.cs index 350c30d..899bafc 100644 --- a/mono/Assistance/MainWindow.cs +++ b/mono/Assistance/MainWindow.cs @@ -6,7 +6,8 @@ namespace Assistance { static public void Main() { Gtk.Application.Init(); MainWindow win = new MainWindow(); - win.Show(); + win.Show(); + win.Maximize(); Gtk.Application.Run(); } @@ -23,13 +24,20 @@ namespace Assistance { Track track = null; public MainWindow(): base(Gtk.WindowType.Toplevel) { - this.Events = Gdk.EventMask.KeyPressMask - | Gdk.EventMask.KeyReleaseMask - | Gdk.EventMask.ButtonPressMask - | Gdk.EventMask.ButtonReleaseMask - | Gdk.EventMask.ButtonMotionMask - | Gdk.EventMask.PointerMotionMask; - Maximize(); + foreach(Gdk.Device device in Display.ListDevices()) { + if (device.Name.Contains("tylus")) { + device.SetMode(Gdk.InputMode.Screen); + break; + } + } + + Events = Gdk.EventMask.KeyPressMask + | Gdk.EventMask.KeyReleaseMask + | Gdk.EventMask.ButtonPressMask + | Gdk.EventMask.ButtonReleaseMask + | Gdk.EventMask.ButtonMotionMask + | Gdk.EventMask.PointerMotionMask; + ExtensionEvents = Gdk.ExtensionMode.All; } protected override bool OnDeleteEvent(Gdk.Event e) { @@ -109,6 +117,12 @@ namespace Assistance { case Gdk.Key.q: new ModifierSnowflake(workarea.document, cursor); break; + case Gdk.Key.I: + case Gdk.Key.i: + Gtk.InputDialog dialog = new Gtk.InputDialog(); + dialog.CloseButton.Clicked += (object sender, EventArgs args) => { dialog.Destroy(); }; + dialog.Show(); + break; case Gdk.Key.Delete: if (activePoint != null) activePoint.owner.remove(); @@ -179,6 +193,7 @@ namespace Assistance { activePoint.owner.onMovePoint(activePoint, cursor + offset); } else if (track != null) { + if (e.IsHint) Gdk.Display.Default.Beep(); track.points.Add(makeTrackPoint(e)); } else { activePoint = workarea.findPoint(cursor); diff --git a/mono/Assistance/Track.cs b/mono/Assistance/Track.cs index 96c5b5f..242fe6c 100644 --- a/mono/Assistance/Track.cs +++ b/mono/Assistance/Track.cs @@ -108,15 +108,25 @@ namespace Assistance { } public void draw(Cairo.Context context, bool preview = false) { - if (points.Count < 2) - return; - context.Save(); - (preview ? penPreview : pen).apply(context); - context.MoveTo(points[0].point.x, points[0].point.y); - for(int i = 1; i < points.Count; ++i) - context.LineTo(points[i].point.x, points[i].point.y); - context.Stroke(); - context.Restore(); + if (preview) { + if (points.Count < 2) + return; + context.Save(); + penPreview.apply(context); + context.MoveTo(points[0].point.x, points[0].point.y); + for(int i = 1; i < points.Count; ++i) + context.LineTo(points[i].point.x, points[i].point.y); + context.Stroke(); + context.Restore(); + } else { + context.Save(); + pen.apply(context); + foreach(TrackPoint p in points) { + context.Arc(p.point.x, p.point.y, 2.0*p.pressure*pen.width, 0.0, 2.0*Math.PI); + context.Fill(); + } + context.Restore(); + } } } }