Clone in a terminal:
Commit f686744
Johan Mattsson - 2015-04-19T10:31:16+00:00
f686744b7eebf7ac8b6383c8c088acc3c8066adajohan.mattsson.m@gmail.com

Replace resize handle with an icon from the icon font

Changed files (4)

Diff

diff --git a/icons/corvus_monedula.png b/icons/corvus_monedula.pngdeleted file mode 100644index 755278b..0000000Binary files a/icons/corvus_monedula.png and /dev/null differdiff --git a/icons/resize_handle.png b/icons/resize_handle.pngdeleted file mode 100644index c3e19b7..0000000Binary files a/icons/resize_handle.png and /dev/null differdiff --git a/libbirdfont/ResizeTool.vala b/libbirdfont/ResizeTool.valaindex 57e0078..3da05ee 100644--- a/libbirdfont/ResizeTool.vala+++ b/libbirdfont/ResizeTool.vala@@ -1,5 +1,5 @@ /*-    Copyright (C) 2013 Johan Mattsson+    Copyright (C) 2013 2015 Johan Mattsson      This library is free software; you can redistribute it and/or modify      it under the terms of the GNU Lesser General Public License as @@ -26,8 +26,6 @@ public class ResizeTool : Tool {  	bool move_paths = false; -	ImageSurface? resize_handle;- 	static double selection_box_width = 0; 	static double selection_box_height = 0; 	static double selection_box_center_x = 0;@@ -45,8 +43,6 @@ public class ResizeTool : Tool { 	 	public ResizeTool (string n) { 		base (n, t_("Resize and rotate paths"));-		-		resize_handle = Icons.get_icon ("resize_handle.png"); 	 		select_action.connect((self) => { 		});@@ -99,6 +95,8 @@ public class ResizeTool : Tool { 			DrawingTools.move_tool.press (b, x, y); 			 			move_paths = true;+			+			update_selection_box (); 		});  		release_action.connect((self, b, x, y) => {@@ -118,10 +116,7 @@ public class ResizeTool : Tool { 			}  			if (!rotate_path) {-				MoveTool.update_boundaries_for_selection ();-				MoveTool.get_selection_box_boundaries (out selection_box_center_x,-					out selection_box_center_y, out selection_box_width,-					out selection_box_height);	+				update_selection_box (); 			} 		 			if (move_paths || rotate_path || resize_path) {@@ -132,12 +127,21 @@ public class ResizeTool : Tool { 		}); 		 		draw_action.connect ((self, cr, glyph) => {+			Text handle; 			Glyph g = MainWindow.get_current_glyph ();-			ImageSurface resize_img = (!) resize_handle; 			 			foreach (Path p in g.active_paths) {-				cr.set_source_surface (resize_img, Glyph.reverse_path_coordinate_x (p.xmax) - 10, Glyph.reverse_path_coordinate_y (p.ymax) - 10);-				cr.paint ();+				handle = new Text ("resize_handle", 60 * MainWindow.units);+				handle.load_font ("icons.bf");+				+				handle.widget_x = Glyph.reverse_path_coordinate_x (p.xmax)+					- handle.get_sidebearing_extent () / 2.0;+					+				handle.widget_y = Glyph.reverse_path_coordinate_y (p.ymax)+					- handle.get_height () / 2.0;+				+				Theme.text_color (handle, "Highlighted 1");+				handle.draw (cr); 			} 			 			if (g.active_paths.size > 0) {@@ -252,7 +256,7 @@ public class ResizeTool : Tool { 		cr.rectangle (cx + hx - 2.5, cy + hy - 2.5, 5, 5); 		cr.fill (); 					-		cr.restore ();				+		cr.restore (); 	} 	 	double get_resize_ratio (double px, double py) {@@ -296,13 +300,18 @@ public class ResizeTool : Tool { 		} 		 		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);	+			update_selection_box (); 			objects_resized (selection_box_width, selection_box_height); 		} 	} +	void update_selection_box () {+		MoveTool.update_boundaries_for_selection ();+		MoveTool.get_selection_box_boundaries (out selection_box_center_x,+				out selection_box_center_y, out selection_box_width,+				out selection_box_height);+	}+ 	/** Move resize handle to pixel x,y. */ 	void resize (double px, double py) { 		double ratio;@@ -355,7 +364,7 @@ public class ResizeTool : Tool { 	bool is_over_resize_handle (Path p, double x, double y) { 		double handle_x = Math.fabs (Glyph.reverse_path_coordinate_x (p.xmax));  		double handle_y = Math.fabs (Glyph.reverse_path_coordinate_y (p.ymax));-		return fabs (handle_x - x + 10) < 20 * MainWindow.units && fabs (handle_y - y + 10) < 20 * MainWindow.units;+		return Path.distance (handle_x, x, handle_y, y) < 12 * MainWindow.units; 	} 	 	public void skew (double skew) {diff --git a/resources/icons.bf b/resources/icons.bfindex 8417d6d..473b5dd 100644--- a/resources/icons.bf+++ b/resources/icons.bf@@ -721,6 +721,12 @@ GNU Lesser General Public License</copyright> 		<path stroke="0" skew="0" data="B -2.5762853516,40.1415509288 M -1.2950353516,38.8603009288 M -2.5762853516,37.5790509288 M -9.2637853516,30.8915509288 M -10.4825353516,29.6728009288 M -11.7637853516,30.8290509288 M -17.3575353516,35.9853009288 M -17.3575353516,9.2978509288 M 10.5487146484,9.2978509288 M 5.7674646484,14.2040509288 M 4.5487146484,15.4540509288 M 5.7674646484,16.7040509288 M 11.2362146484,22.4228009288 M 12.5174646484,23.7665509288 M 13.8299646484,22.4540509288 M 18.6424646484,17.6415509288 M 18.6424646484,45.7978009288 M -8.2637853516,45.7978009288 M -2.5762853516,40.1415509288" /> 	</glyph> </collection>+<collection name="resize_handle">+	<selected id="1"/>+	<glyph id="1" left="-28" right="20.375000000000004">+		<path stroke="0" skew="0" data="S 16.3437500000,46.5788834951 L 16.3437500000,6.2663834951 L -23.9687500000,46.5788834951 L 16.3437500000,46.5788834951" />+	</glyph>+</collection> <collection name="reverse_path"> 	<selected id="1"/> 	<glyph id="1" left="-26.309523809523803" right="45.383597883597901">@@ -1068,90 +1074,91 @@ GNU Lesser General Public License</copyright> <ligature sequence="i n s e r t _ g l y p h _ f r o m _ o v e r v i e w" replacement="insert_glyph_from_overview"/> <ligature sequence="h i g h _ c o n t r a s t _ b a c k g r o u n d" replacement="high_contrast_background"/> <ligature sequence="p r e v i o u s _ k e r n i n g _ s t r i n g" replacement="previous_kerning_string"/>-<ligature sequence="s h o w _ x h e i g h t _ h e l p l i n e s" replacement="show_xheight_helplines"/> <ligature sequence="g e n e r a t e _ h t m l _ d o c u m e n t" replacement="generate_html_document"/>-<ligature sequence="s h o w _ a l l _ l i n e _ h a n d l e s" replacement="show_all_line_handles"/>-<ligature sequence="b a c k g r o u n d _ h e l p _ l i n e s" replacement="background_help_lines"/>-<ligature sequence="a u t o _ t r a c e _ r e s o l u t i o n" replacement="auto_trace_resolution"/>-<ligature sequence="z o o m _ b a c k g r o u n d _ i m a g e" replacement="zoom_background_image"/>+<ligature sequence="s h o w _ x h e i g h t _ h e l p l i n e s" replacement="show_xheight_helplines"/> <ligature sequence="o r i e n t a t i o n _ c l o c k w i s e" replacement="orientation_clockwise"/>-<ligature sequence="a u t o _ t r a c e _ s i m p l i f y" replacement="auto_trace_simplify"/>+<ligature sequence="z o o m _ b a c k g r o u n d _ i m a g e" replacement="zoom_background_image"/>+<ligature sequence="a u t o _ t r a c e _ r e s o l u t i o n" replacement="auto_trace_resolution"/>+<ligature sequence="b a c k g r o u n d _ h e l p _ l i n e s" replacement="background_help_lines"/>+<ligature sequence="s h o w _ a l l _ l i n e _ h a n d l e s" replacement="show_all_line_handles"/> <ligature sequence="n e x t _ k e r n i n g _ s t r i n g" replacement="next_kerning_string"/>-<ligature sequence="k e r n i n g _ t e x t _ i n p u t" replacement="kerning_text_input"/>+<ligature sequence="a u t o _ t r a c e _ s i m p l i f y" replacement="auto_trace_simplify"/> <ligature sequence="c o n t r a s t _ t h r e s h o l d" replacement="contrast_threshold"/>-<ligature sequence="o r i e n t a t i o n _ a r r o w" replacement="orientation_arrow"/>-<ligature sequence="d e l e t e _ b a c k g r o u n d" replacement="delete_background"/>-<ligature sequence="n e w _ p o i n t _ o n _ p a t h" replacement="new_point_on_path"/>-<ligature sequence="i n s e r t _ b a c k g r o u n d" replacement="insert_background"/>-<ligature sequence="s e l e c t _ b a c k g r o u n d" replacement="select_background"/>+<ligature sequence="k e r n i n g _ t e x t _ i n p u t" replacement="kerning_text_input"/> <ligature sequence="s t r o k e _ t o _ o u t l i n e" replacement="stroke_to_outline"/>-<ligature sequence="s c a l e _ b a c k g r o u n d" replacement="scale_background"/>-<ligature sequence="q u a d r a t i c _ p o i n t s" replacement="quadratic_points"/>+<ligature sequence="s e l e c t _ b a c k g r o u n d" replacement="select_background"/>+<ligature sequence="i n s e r t _ b a c k g r o u n d" replacement="insert_background"/>+<ligature sequence="n e w _ p o i n t _ o n _ p a t h" replacement="new_point_on_path"/>+<ligature sequence="d e l e t e _ b a c k g r o u n d" replacement="delete_background"/>+<ligature sequence="o r i e n t a t i o n _ a r r o w" replacement="orientation_arrow"/> <ligature sequence="o r i e n t a t i o n _ b o t h" replacement="orientation_both"/>-<ligature sequence="m o v e _ b a c k g r o u n d" replacement="move_background"/>-<ligature sequence="f l i p _ h o r i z o n t a l" replacement="flip_horizontal"/>-<ligature sequence="s h o w _ b a c k g r o u n d" replacement="show_background"/>+<ligature sequence="q u a d r a t i c _ p o i n t s" replacement="quadratic_points"/>+<ligature sequence="s c a l e _ b a c k g r o u n d" replacement="scale_background"/> <ligature sequence="z o o m _ b o u n d a r i e s" replacement="zoom_boundaries"/>-<ligature sequence="i n s e r t _ u n i c h a r" replacement="insert_unichar"/>-<ligature sequence="c u t _ b a c k g r o u n d" replacement="cut_background"/>-<ligature sequence="u p d a t e _ w e b v i e w" replacement="update_webview"/>+<ligature sequence="s h o w _ b a c k g r o u n d" replacement="show_background"/>+<ligature sequence="f l i p _ h o r i z o n t a l" replacement="flip_horizontal"/>+<ligature sequence="m o v e _ b a c k g r o u n d" replacement="move_background"/> <ligature sequence="f i l l _ o p e n _ p a t h" replacement="fill_open_path"/>-<ligature sequence="d r o p d o w n _ m e n u" replacement="dropdown_menu"/>-<ligature sequence="f l i p _ v e r t i c a l" replacement="flip_vertical"/>-<ligature sequence="d e l e t e _ b u t t o n" replacement="delete_button"/>-<ligature sequence="c o n v e r t _ p o i n t" replacement="convert_point"/>-<ligature sequence="d o u b l e _ p o i n t s" replacement="double_points"/>-<ligature sequence="k e r n i n g _ c l a s s" replacement="kerning_class"/>+<ligature sequence="u p d a t e _ w e b v i e w" replacement="update_webview"/>+<ligature sequence="c u t _ b a c k g r o u n d" replacement="cut_background"/>+<ligature sequence="i n s e r t _ u n i c h a r" replacement="insert_unichar"/> <ligature sequence="a d d _ n e w _ t h e m e" replacement="add_new_theme"/>-<ligature sequence="y _ c o o r d i n a t e" replacement="y_coordinate"/>-<ligature sequence="x _ c o o r d i n a t e" replacement="x_coordinate"/>-<ligature sequence="c u b i c _ p o i n t s" replacement="cubic_points"/>-<ligature sequence="r e v e r s e _ p a t h" replacement="reverse_path"/>-<ligature sequence="e x p o r t _ f o n t s" replacement="export_fonts"/>+<ligature sequence="k e r n i n g _ c l a s s" replacement="kerning_class"/>+<ligature sequence="d o u b l e _ p o i n t s" replacement="double_points"/>+<ligature sequence="c o n v e r t _ p o i n t" replacement="convert_point"/>+<ligature sequence="d e l e t e _ b u t t o n" replacement="delete_button"/>+<ligature sequence="f l i p _ v e r t i c a l" replacement="flip_vertical"/>+<ligature sequence="d r o p d o w n _ m e n u" replacement="dropdown_menu"/>+<ligature sequence="r e s i z e _ h a n d l e" replacement="resize_handle"/> <ligature sequence="a p p l y _ s t r o k e" replacement="apply_stroke"/>-<ligature sequence="r i g h t _ a r r o w" replacement="right_arrow"/>-<ligature sequence="b e z i e r _ l i n e" replacement="bezier_line"/>-<ligature sequence="c r e a t e _ l i n e" replacement="create_line"/>-<ligature sequence="s p i n _ b u t t o n" replacement="spin_button"/>+<ligature sequence="e x p o r t _ f o n t s" replacement="export_fonts"/>+<ligature sequence="r e v e r s e _ p a t h" replacement="reverse_path"/>+<ligature sequence="c u b i c _ p o i n t s" replacement="cubic_points"/>+<ligature sequence="x _ c o o r d i n a t e" replacement="x_coordinate"/>+<ligature sequence="y _ c o o r d i n a t e" replacement="y_coordinate"/> <ligature sequence="m o v e _ c a n v a s" replacement="move_canvas"/>-<ligature sequence="l e f t _ a r r o w" replacement="left_arrow"/>-<ligature sequence="h e l p _ l i n e s" replacement="help_lines"/>-<ligature sequence="m o v e _ l a y e r" replacement="move_layer"/>-<ligature sequence="s e l e c t _ a l l" replacement="select_all"/>-<ligature sequence="p o i n t _ t o o l" replacement="point_tool"/>+<ligature sequence="s p i n _ b u t t o n" replacement="spin_button"/>+<ligature sequence="c r e a t e _ l i n e" replacement="create_line"/>+<ligature sequence="b e z i e r _ l i n e" replacement="bezier_line"/>+<ligature sequence="r i g h t _ a r r o w" replacement="right_arrow"/> <ligature sequence="f u l l _ g l y p h" replacement="full_glyph"/>-<ligature sequence="s a v e _ f o n t" replacement="save_font"/>-<ligature sequence="i n f o _ i c o n" replacement="info_icon"/>-<ligature sequence="s h o w _ g r i d" replacement="show_grid"/>-<ligature sequence="a u t o t r a c e" replacement="autotrace"/>-<ligature sequence="u n d o _ t o o l" replacement="undo_tool"/>-<ligature sequence="t i e _ p o i n t" replacement="tie_point"/>-<ligature sequence="s y m m e t r i c" replacement="symmetric"/>-<ligature sequence="f o r e s i g h t" replacement="foresight"/>-<ligature sequence="z o o m _ t o o l" replacement="zoom_tool"/>-<ligature sequence="r e c t a n g l e" replacement="rectangle"/>-<ligature sequence="t t f _ u n i t s" replacement="ttf_units"/>-<ligature sequence="m e n u _ i c o n" replacement="menu_icon"/>+<ligature sequence="p o i n t _ t o o l" replacement="point_tool"/>+<ligature sequence="s e l e c t _ a l l" replacement="select_all"/>+<ligature sequence="m o v e _ l a y e r" replacement="move_layer"/>+<ligature sequence="h e l p _ l i n e s" replacement="help_lines"/>+<ligature sequence="l e f t _ a r r o w" replacement="left_arrow"/> <ligature sequence="o p e n _ f o n t" replacement="open_font"/>-<ligature sequence="s e t t i n g s" replacement="settings"/>-<ligature sequence="z o o m _ o u t" replacement="zoom_out"/>-<ligature sequence="r o t a t i o n" replacement="rotation"/>-<ligature sequence="p e n _ t o o l" replacement="pen_tool"/>-<ligature sequence="z o o m _ 1 _ 1" replacement="zoom_1_1"/>-<ligature sequence="p r o g r e s s" replacement="progress"/>+<ligature sequence="m e n u _ i c o n" replacement="menu_icon"/>+<ligature sequence="t t f _ u n i t s" replacement="ttf_units"/>+<ligature sequence="r e c t a n g l e" replacement="rectangle"/>+<ligature sequence="z o o m _ t o o l" replacement="zoom_tool"/>+<ligature sequence="f o r e s i g h t" replacement="foresight"/>+<ligature sequence="s y m m e t r i c" replacement="symmetric"/>+<ligature sequence="t i e _ p o i n t" replacement="tie_point"/>+<ligature sequence="u n d o _ t o o l" replacement="undo_tool"/>+<ligature sequence="a u t o t r a c e" replacement="autotrace"/>+<ligature sequence="s h o w _ g r i d" replacement="show_grid"/>+<ligature sequence="i n f o _ i c o n" replacement="info_icon"/>+<ligature sequence="s a v e _ f o n t" replacement="save_font"/> <ligature sequence="n e w _ f o n t" replacement="new_font"/>+<ligature sequence="p r o g r e s s" replacement="progress"/>+<ligature sequence="z o o m _ 1 _ 1" replacement="zoom_1_1"/>+<ligature sequence="p e n _ t o o l" replacement="pen_tool"/>+<ligature sequence="r o t a t i o n" replacement="rotation"/>+<ligature sequence="z o o m _ o u t" replacement="zoom_out"/>+<ligature sequence="s e t t i n g s" replacement="settings"/> <ligature sequence="z o o m _ i n" replacement="zoom_in"/>-<ligature sequence="h e i g h t" replacement="height"/>-<ligature sequence="r e s i z e" replacement="resize"/>-<ligature sequence="c i r c l e" replacement="circle"/> <ligature sequence="s t r o k e" replacement="stroke"/>-<ligature sequence="t h e m e" replacement="theme"/>-<ligature sequence="w i d t h" replacement="width"/>+<ligature sequence="c i r c l e" replacement="circle"/>+<ligature sequence="r e s i z e" replacement="resize"/>+<ligature sequence="h e i g h t" replacement="height"/> <ligature sequence="t r a c k" replacement="track"/>-<ligature sequence="s k e w" replacement="skew"/>-<ligature sequence="m o v e" replacement="move"/>-<ligature sequence="p r e v" replacement="prev"/>+<ligature sequence="w i d t h" replacement="width"/>+<ligature sequence="t h e m e" replacement="theme"/> <ligature sequence="n e x t" replacement="next"/>+<ligature sequence="p r e v" replacement="prev"/>+<ligature sequence="m o v e" replacement="move"/>+<ligature sequence="s k e w" replacement="skew"/>  <kerning left="settings" right="l" hadjustment="3.8289794922" /> </font>

Contact

Email: johan.mattsson.m@gmail.com
Mastodon: typo.social/@birdfont
GitHub: johanmattssonm
LinkedIn: johan-mattsson-2ab324112