1 // 2 // LineCurveTool.cs 3 // 4 // Author: 5 // Jonathan Pobst <monkey@jpobst.com> 6 // 7 // Copyright (c) 2010 Jonathan Pobst 8 // 9 // Permission is hereby granted, free of charge, to any person obtaining a copy 10 // of this software and associated documentation files (the "Software"), to deal 11 // in the Software without restriction, including without limitation the rights 12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 13 // copies of the Software, and to permit persons to whom the Software is 14 // furnished to do so, subject to the following conditions: 15 // 16 // The above copyright notice and this permission notice shall be included in 17 // all copies or substantial portions of the Software. 18 // 19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 25 // THE SOFTWARE. 26 27 using System; 28 using Cairo; 29 using Pinta.Core; 30 using Mono.Unix; 31 using System.Collections.Generic; 32 using System.Linq; 33 34 namespace Pinta.Tools 35 { 36 public class LineCurveTool : ShapeTool 37 { 38 public override string Name 39 { 40 get { return Catalog.GetString("Line/Curve"); } 41 } 42 public override string Icon { 43 get { return "Tools.Line.png"; } 44 } 45 public override string StatusBarText { 46 get { return Catalog.GetString ("Left click to draw a shape with the primary color." + 47 "\nLeft click on a shape to add a control point." + 48 "\nLeft click on a control point and drag to move it." + 49 "\nRight click on a control point and drag to change its tension." + 50 "\nHold Shift to snap to angles." + 51 "\nUse arrow keys to move the selected control point." + 52 "\nPress Ctrl + left/right arrows to select control points by order." + 53 "\nPress Delete to delete the selected control point." + 54 "\nPress Space to add a new control point at the mouse position." + 55 "\nHold Ctrl while pressing Space to create the control point at the exact same position." + 56 "\nHold Ctrl while left clicking on a control point to create a new shape at the exact same position." + 57 "\nHold Ctrl while clicking outside of the image bounds to create a new shape starting at the edge." + 58 "\nPress Enter to finalize the shape."); 59 } 60 } 61 public override Gdk.Cursor DefaultCursor { 62 get { return new Gdk.Cursor (Gdk.Display.Default, PintaCore.Resources.GetIcon ("Cursor.Line.png"), 9, 18); } 63 } 64 public override int Priority { 65 get { return 39; } 66 } 67 68 public override BaseEditEngine.ShapeTypes ShapeType 69 { 70 get 71 { 72 return BaseEditEngine.ShapeTypes.OpenLineCurveSeries; 73 } 74 } 75 LineCurveTool()76 public LineCurveTool() 77 { 78 EditEngine = new LineCurveEditEngine(this); 79 80 BaseEditEngine.CorrespondingTools.Add(ShapeType, this); 81 } 82 } 83 } 84