Commit b7a80c2
Free hand icon and a bug fix related to merging of paths drawn with the TrackTool.
Changed files (6)
modifiedgraphics/tools_and_buttons.svgaddedicons/track.pngmodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/Path.valamodifiedlibbirdfont/TrackTool.valamodifiedscripts/bavala.py
Diff
@@ -413,16 +413,16 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2"- inkscape:zoom="10.181818"- inkscape:cx="53.5"- inkscape:cy="367.54911"+ inkscape:zoom="5.4770642"+ inkscape:cx="199"+ inkscape:cy="703.5" inkscape:current-layer="layer1" inkscape:document-units="px" showgrid="false"- inkscape:window-width="1280"- inkscape:window-height="969"- inkscape:window-x="-2"- inkscape:window-y="-3"+ inkscape:window-width="1215"+ inkscape:window-height="776"+ inkscape:window-x="65"+ inkscape:window-y="24" inkscape:window-maximized="1" showguides="true" inkscape:guide-bbox="true"@@ -1836,14 +1836,14 @@ y="389.10025">AV</tspan></text> <path sodipodi:type="arc"- style="opacity:0.72016458000000005;fill:url(#radialGradient3581);fill-opacity:1"+ style="opacity:0.72016458;fill:url(#radialGradient3581);fill-opacity:1" id="path3573" sodipodi:cx="200.75377" sodipodi:cy="25.919598" sodipodi:rx="30.703518" sodipodi:ry="30.703518" d="m 231.45729,25.919598 a 30.703518,30.703518 0 1 1 -61.40704,0 30.703518,30.703518 0 1 1 61.40704,0 z"- transform="translate(13.934673,8.0301508)"+ transform="translate(88.105125,10.391382)" inkscape:export-filename="/home/johan/birdfont/icons/delay_circle.png" inkscape:export-xdpi="319.88824" inkscape:export-ydpi="319.88824" />@@ -1886,5 +1886,29 @@ y="328.78897" x="128.93886" sodipodi:role="line">B</tspan></text>+ <path+ style="fill:#e6e6e6;stroke:#858585;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"+ d="m 198.28069,52.221957 4.30578,9.722719 2.77792,-1.111168 -5.69474,-12.77843 -2.91681,1.111168 z"+ id="path3617"+ inkscape:connector-curvature="0"+ inkscape:export-filename="/home/johan/birdfont/icons/track.png"+ inkscape:export-xdpi="319.89001"+ inkscape:export-ydpi="319.89001" />+ <path+ style="fill:none;stroke:#000000;stroke-width:0.59260023px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"+ d="m 194.88239,63.475848 c 2.26624,-4.567729 6.53453,3.336107 9.74418,1.026228 0.72121,-0.519032 0.65487,-0.262366 0.47533,-0.94071"+ id="path3623"+ inkscape:connector-curvature="0"+ inkscape:export-filename="/home/johan/birdfont/icons/track.png"+ inkscape:export-xdpi="319.89001"+ inkscape:export-ydpi="319.89001" />+ <path+ style="fill:none;stroke:#858585;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"+ d="m 203.99938,61.379513 1.22611,2.787498"+ id="path3621"+ inkscape:connector-curvature="0"+ inkscape:export-filename="/home/johan/birdfont/icons/track.png"+ inkscape:export-xdpi="319.89001"+ inkscape:export-ydpi="319.89001" /> </g> </svg>new file mode 100644Binary files /dev/null and b/icons/track.png differ@@ -75,7 +75,7 @@ public class DrawingTools : ToolCollection { Tool stroke_tool = new StrokeTool ("stroke"); // create outline from path draw_tools.add_tool (stroke_tool); - Tool track_tool = new TrackTool ("track"); // create outline from path+ Tool track_tool = new TrackTool ("track"); // draw outline on free hand draw_tools.add_tool (track_tool); // quadratic Bézier points@@ -135,8 +135,17 @@ public class Path { } } + public EditPoint get_first_point () {+ if (unlikely (points.length () == 0)) {+ warning ("No point");+ return new EditPoint ();+ }+ + return points.first ().data;+ }+ public EditPoint get_last_point () {- if (points.length () == 0) {+ if (unlikely (points.length () == 0)) { warning ("No point"); return new EditPoint (); }@@ -37,7 +37,9 @@ public class TrackTool : Tool { int join_y = -1; bool join_paths = false; - public TrackTool (string tool_tip) {+ public TrackTool (string name) {+ base (name, t_("Draw paths on free hand"));+ press_action.connect ((self, b, x, y) => { Glyph glyph = MainWindow.get_current_glyph (); Path p;@@ -178,7 +180,17 @@ public class TrackTool : Tool { public static void merge_paths (Path a, PointSelection b) { Glyph g; Path merged = a.copy ();- ++ if (a.points.length () < 2) {+ warning ("Less than two points in path.");+ return;+ }++ if (b.path.points.length () < 2) {+ warning ("Less than two points in path.");+ return;+ }+ if (!b.is_first ()) { b.path.close (); b.path.reverse ();@@ -191,6 +203,10 @@ public class TrackTool : Tool { g.add_path (merged); + a.delete_last_point ();+ + update_corner_handle (a.get_last_point (), b.path.get_first_point ());+ g.delete_path (a); g.delete_path (b.path); @@ -199,6 +215,8 @@ public class TrackTool : Tool { merged.recalculate_linear_handles (); merged.reopen (); + merged.delete_last_point ();+ if (PenTool.is_counter_path (merged)) { merged.force_direction (Direction.COUNTER_CLOCKWISE); } else {@@ -206,6 +224,16 @@ public class TrackTool : Tool { } } + static void update_corner_handle (EditPoint end, EditPoint new_start) {+ EditPointHandle h1, h2;+ + h1 = end.get_right_handle ();+ h2 = new_start.get_left_handle ();+ + h1.convert_to_line ();+ h2.convert_to_line ();+ }+ PointSelection? get_path_with_end_point (int x, int y) { Glyph glyph = MainWindow.get_current_glyph (); EditPoint e;@@ -296,7 +324,7 @@ public class TrackTool : Tool { update_cycles = 0; } - if (update_cycles > 10) {+ if (update_cycles > 5) { // cycles of 100 ms convert_points_to_line (); last_update = get_current_time (); add_corner (last_x, last_y);@@ -165,7 +165,7 @@ class Vala(object): } def gen_ln(self):- """generate a symbilic link to the generated ".so" file"""+ """generate a symbolic link to the generated ".so" file""" so_file = self.so.rsplit('/')[-1] create_link = "ln -s -T " + so_file + " " + self.so_link_name + " " create_link += "&& mv " + self.so_link_name + " " + self.build + "/"