Commit 56ead05
With and height settings
Changed files (6)
modifiedgraphics/tools_and_buttons.svgaddedicons/height.pngaddedicons/width.pngmodifiedlibbirdfont/DrawingTools.valamodifiedlibbirdfont/ResizeTool.valamodifiedlibbirdfont/SpinButton.vala
Diff
@@ -905,9 +905,9 @@ borderopacity="1.0" inkscape:pageopacity="0.0" inkscape:pageshadow="2"- inkscape:zoom="4"- inkscape:cx="102.84323"- inkscape:cy="622.80931"+ inkscape:zoom="22.627417"+ inkscape:cx="164.46255"+ inkscape:cy="650.7393" inkscape:current-layer="layer1" inkscape:document-units="px" showgrid="false"@@ -2848,5 +2848,23 @@ d="m 93.495716,117.27334 c -0.157363,-1.32965 0.176971,-2.44858 1.185615,-3.27851" style="fill-opacity:1;stroke:#929292" /> </g>+ <path+ inkscape:export-ydpi="319.88824"+ inkscape:export-xdpi="319.88824"+ inkscape:export-filename="/home/johan/birdfont/icons/height.png"+ sodipodi:nodetypes="ccccccccccc"+ inkscape:connector-curvature="0"+ id="path3425-1"+ d="m 170.41296,115.08651 -0.002,-3.45224 2.59259,-0.002 -4.90418,-5.02687 -5.08475,5.09502 2.34479,-0.002 -0.0364,3.39338 -2.32656,0.0372 5.03879,5.03076 4.83716,-5.06791 z"+ style="fill:#e6e6e6;fill-opacity:1;stroke:#858585;stroke-width:0.75871521;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" />+ <path+ inkscape:export-ydpi="319.88824"+ inkscape:export-xdpi="319.88824"+ inkscape:export-filename="/home/johan/birdfont/icons/width.png"+ sodipodi:nodetypes="ccccccccccc"+ inkscape:connector-curvature="0"+ id="path3425-1-4"+ d="m 134.06548,110.09905 -3.7174,0.002 -0.002,-2.59259 -4.89429,4.90418 5.09502,5.08475 -0.002,-2.34479 3.39338,0.0364 0.0372,2.32656 5.03076,-5.03879 -4.84694,-4.83716 z"+ style="fill:#e6e6e6;fill-opacity:1;stroke:#858585;stroke-width:0.75871521;stroke-linecap:butt;stroke-linejoin:miter;stroke-miterlimit:4;stroke-opacity:1;stroke-dasharray:none" /> </g> </svg>new file mode 100644Binary files /dev/null and b/icons/height.png differnew file mode 100644Binary files /dev/null and b/icons/width.png differ@@ -318,7 +318,79 @@ public class DrawingTools : ToolCollection { }); draw_tool_modifiers.add_tool (rotation);++ // size+ SpinButton width = new SpinButton ("width", t_("Width"));+ width.set_big_number (true);+ width.set_int_value ("0.0000");+ width.set_int_step (0.01);+ width.show_icon (true);+ width.set_persistent (false);+ width.new_value_action.connect ((self) => {+ double x, y, w, h;+ Glyph glyph;+ double new_size;+ + glyph = MainWindow.get_current_glyph ();+ glyph.selection_boundaries (out x, out y, out w, out h);+ + if (glyph.active_paths.size > 0) {+ new_size = self.get_value () / w;+ + if (new_size > 0 && new_size != 1) {+ resize_tool.resize_selected_paths (new_size);+ }+ }+ + GlyphCanvas.redraw ();+ });+ draw_tool_modifiers.add_tool (width);++ // size+ SpinButton height = new SpinButton ("height", t_("Height"));+ height.set_big_number (true);+ height.set_int_value ("0.0000");+ height.set_int_step (0.01);+ height.show_icon (true);+ height.set_persistent (false);+ height.new_value_action.connect ((self) => {+ double x, y, w, h;+ Glyph glyph;+ double new_size;+ + glyph = MainWindow.get_current_glyph ();+ glyph.selection_boundaries (out x, out y, out w, out h); + if (glyph.active_paths.size > 0) {+ new_size = self.get_value () / h;+ + if (new_size > 0 && new_size != 1) {+ resize_tool.resize_selected_paths (new_size);+ }+ }+ + GlyphCanvas.redraw ();+ });+ draw_tool_modifiers.add_tool (height);+ + resize_tool.objects_resized.connect ((w, h) => {+ height.set_value_round (h, true, false);+ width.set_value_round (w, true, false);+ });+ + move_tool.objects_deselected.connect (() => {+ width.set_value_round (0, true, false);+ width.hide_value ();++ height.set_value_round (0, true, false);+ height.hide_value (); + });++ move_tool.objects_moved.connect (() => {+ width.set_value_round (MoveTool.selection_box_width, true, false);+ height.set_value_round (MoveTool.selection_box_height, true, false);+ });+ // edit stroke width object_stroke = new SpinButton ("object_stroke", t_("Stroke width")); object_stroke.set_int_value ("2.000");@@ -36,6 +36,7 @@ public class ResizeTool : Tool { static double last_rotate = 0; public signal void objects_rotated (double angle);+ public signal void objects_resized (double width, double height); public ResizeTool (string n) { base (n, t_("Resize and rotate paths"));@@ -257,25 +258,15 @@ public class ResizeTool : Tool { return ratio; } - /** Move resize handle to pixel x,y. */- void resize (double x, double y) {+ public void resize_selected_paths (double ratio) { Path rp;- double ratio; double resize_pos_x = 0; double resize_pos_y = 0; Glyph glyph = MainWindow.get_current_glyph (); double selection_minx, selection_miny, dx, dy; - ratio = get_resize_ratio (x, y);-- return_if_fail (!is_null (resized_path));- rp = (!) resized_path; get_selection_min (out resize_pos_x, out resize_pos_y); - foreach (Path selected_path in glyph.active_paths) {- selected_path.resize (ratio);- }- // resize paths foreach (Path selected_path in glyph.active_paths) { selected_path.resize (ratio);@@ -290,6 +281,21 @@ public class ResizeTool : Tool { } last_resize_y = y;+ + if (glyph.active_paths.size > 0) {+ MoveTool.get_selection_box_boundaries (out selection_box_center_x,+ out selection_box_center_y, out selection_box_width,+ out selection_box_height); + objects_resized (selection_box_width, selection_box_height);+ }+ }++ /** Move resize handle to pixel x,y. */+ void resize (double x, double y) {+ double ratio;+ + ratio = get_resize_ratio (x, y);+ resize_selected_paths (ratio); } void get_selection_min (out double x, out double y) {@@ -316,6 +316,10 @@ public class SpinButton : Tool { } if (big_number) {++ if (v == "") {+ v = "0.0000";+ } while (v.has_prefix ("0") && !v.has_prefix ("0.")) { v = v.substring (v.index_of_nth_char (1));