Clone in a terminal:
Commit e218589
Johan Mattsson - 2015-03-18T11:57:43+00:00
e2185892fda676615a0a7884178beb077978c593johan.mattsson.m@gmail.com

Merge icon in color theme

Changed files (16)

Diff

diff --git a/icons/active_edit_point.png b/icons/active_edit_point.pngdeleted file mode 100644index 3d649c8..0000000Binary files a/icons/active_edit_point.png and /dev/null differdiff --git a/icons/active_edit_point_cubic.png b/icons/active_edit_point_cubic.pngdeleted file mode 100644index 0dcdeda..0000000Binary files a/icons/active_edit_point_cubic.png and /dev/null differdiff --git a/icons/active_edit_point_handle.png b/icons/active_edit_point_handle.pngdeleted file mode 100644index 62ea2f9..0000000Binary files a/icons/active_edit_point_handle.png and /dev/null differdiff --git a/icons/active_selected_edit_point.png b/icons/active_selected_edit_point.pngdeleted file mode 100644index 0dcdeda..0000000Binary files a/icons/active_selected_edit_point.png and /dev/null differdiff --git a/icons/active_selected_edit_point_cubic.png b/icons/active_selected_edit_point_cubic.pngdeleted file mode 100644index 0dcdeda..0000000Binary files a/icons/active_selected_edit_point_cubic.png and /dev/null differdiff --git a/icons/edit_point.png b/icons/edit_point.pngdeleted file mode 100644index a626123..0000000Binary files a/icons/edit_point.png and /dev/null differdiff --git a/icons/edit_point_cubic.png b/icons/edit_point_cubic.pngdeleted file mode 100644index f4827d6..0000000Binary files a/icons/edit_point_cubic.png and /dev/null differdiff --git a/icons/edit_point_handle.png b/icons/edit_point_handle.pngdeleted file mode 100644index f588bbe..0000000Binary files a/icons/edit_point_handle.png and /dev/null differdiff --git a/icons/selected_edit_point.png b/icons/selected_edit_point.pngdeleted file mode 100644index 0dcdeda..0000000Binary files a/icons/selected_edit_point.png and /dev/null differdiff --git a/icons/selected_edit_point_cubic.png b/icons/selected_edit_point_cubic.pngdeleted file mode 100644index 0dcdeda..0000000Binary files a/icons/selected_edit_point_cubic.png and /dev/null differdiff --git a/icons/selected_edit_point_handle.png b/icons/selected_edit_point_handle.pngdeleted file mode 100644index a95b8b1..0000000Binary files a/icons/selected_edit_point_handle.png and /dev/null differdiff --git a/icons/tie_is_active.png b/icons/tie_is_active.pngdeleted file mode 100644index 0e112e7..0000000Binary files a/icons/tie_is_active.png and /dev/null differdiff --git a/libbirdfont/Path.vala b/libbirdfont/Path.valaindex 68aa26b..87f4b23 100644--- a/libbirdfont/Path.vala+++ b/libbirdfont/Path.vala@@ -64,24 +64,8 @@ public class Path { 	 	public delegate bool SegmentIterator (EditPoint start, EditPoint stop); 	-	public static ImageSurface? edit_point_image = null;-	public static ImageSurface? active_edit_point_image = null;-	-	public static ImageSurface? edit_point_handle_image = null;-	public static ImageSurface? active_edit_point_handle_image = null;-	public static ImageSurface? selected_edit_point_handle_image = null;--	public static ImageSurface? selected_edit_point_image = null;-	public static ImageSurface? active_selected_edit_point_image = null;--	public static ImageSurface? cubic_edit_point_image = null;-	public static ImageSurface? cubic_active_edit_point_image = null;--	public static ImageSurface? cubic_selected_edit_point_image = null;-	public static ImageSurface? cubic_active_selected_edit_point_image = null;-	 	/** The stroke of an outline when the path is not filled. */-	public static double stroke_width = 1;+	public static double stroke_width = 0; 	public static bool show_all_line_handles = true; 	public static bool fill_open_path = false; 	@@ -95,25 +79,17 @@ public class Path { 	 	public Path () {	 		string width;--		if (edit_point_image == null) {-			edit_point_image = Icons.get_icon ("edit_point.png");-			active_edit_point_image = Icons.get_icon ("active_edit_point.png");-			edit_point_handle_image = Icons.get_icon ("edit_point_handle.png");-			active_edit_point_handle_image = Icons.get_icon ("active_edit_point_handle.png");-			selected_edit_point_handle_image = Icons.get_icon ("selected_edit_point_handle.png");-			selected_edit_point_image = Icons.get_icon ("selected_edit_point.png");-			active_selected_edit_point_image = Icons.get_icon ("active_selected_edit_point.png");-			cubic_edit_point_image = Icons.get_icon ("edit_point_cubic.png");-			cubic_active_edit_point_image = Icons.get_icon ("active_edit_point_cubic.png");-			cubic_selected_edit_point_image = Icons.get_icon ("selected_edit_point_cubic.png");-			cubic_active_selected_edit_point_image  = Icons.get_icon ("active_selected_edit_point_cubic.png");-	+		+		if (unlikely (stroke_width < 1)) { 			width = Preferences.get ("stroke_width"); 			if (width != "") { 				stroke_width = double.parse (width); 			} 		}++		if (stroke_width < 1) {+			stroke_width = 1;+		} 	}  	public bool is_filled () {@@ -504,7 +480,7 @@ public class Path { 		}  	} 	-	static void draw_control_point (Context cr, double x, double y, string color) {+	public static void draw_control_point (Context cr, double x, double y, string color, double size = 3.5) { 		Glyph g = MainWindow.get_current_glyph (); 		double ivz = 1 / g.view_zoom; 		double width = size * Math.sqrt (stroke_width) * ivz;diff --git a/libbirdfont/PenTool.vala b/libbirdfont/PenTool.valaindex bd0a2e8..785613f 100644--- a/libbirdfont/PenTool.vala+++ b/libbirdfont/PenTool.vala@@ -62,9 +62,7 @@ public class PenTool : Tool { 	// The pixel where the user pressed the mouse button 	public static int begin_action_x = 0;  	public static int begin_action_y = 0;-	-	private static ImageSurface? tie_icon = null;-	+		 	/* First move action must move the current point in to the grid. */ 	bool first_move_action = false; 	@@ -95,8 +93,6 @@ public class PenTool : Tool { 		clockwise = new Gee.ArrayList<Path> (); 		counter_clockwise = new Gee.ArrayList<Path> (); 		-		tie_icon = Icons.get_icon ("tie_is_active.png");-		 		select_action.connect ((self) => { 		}); @@ -1191,34 +1187,21 @@ public class PenTool : Tool { 	 	/** Higlight the selected point on Android. */ 	void draw_point_selection_circle (Context cr) {-		ImageSurface img;-		ImageSurface? i = null;-		double x, y;-		double ratio; 		PointSelection ps; 		 		if (active_handle.active) {-			i = Path.edit_point_handle_image;+			Path.draw_control_point (cr, Glyph.path_coordinate_x (begin_action_x),+				Glyph.path_coordinate_y (begin_action_y), "Control Point Handle");			 		} else if (selected_points.size > 0) { 			ps = selected_points.get (selected_points.size - 1); 			-			i = (ps.point.type == PointType.CUBIC) -				? Path.cubic_edit_point_image : Path.edit_point_image;-		}-		-		if (i != null) {-			img = (!) i;	-			-			cr.save ();-			ratio = 60 * MainWindow.units / img.get_width ();-			cr.scale (ratio, ratio);-			x = begin_action_x - ratio * img.get_width () / 2;-			x /= ratio;-			y = begin_action_y - ratio * img.get_height () / 2;-			y /= ratio;-			cr.set_source_surface (img, x, y);-			cr.paint ();-			cr.restore ();+			if (ps.point.type == PointType.CUBIC) {+				Path.draw_control_point (cr, Glyph.path_coordinate_x (begin_action_x),+					Glyph.path_coordinate_y (begin_action_y), "Selected Cubic Control Point");+			} else {+				Path.draw_control_point (cr, Glyph.path_coordinate_x (begin_action_x),+					Glyph.path_coordinate_y (begin_action_y), "Selected Quadratic Control Point");			+			} 		} 	} 	@@ -1239,37 +1222,14 @@ public class PenTool : Tool { 	} 	 	public static void draw_join_icon (Context cr, double x, double y) {-		double scale = (BirdFont.android) ? 5 : 1;-		draw_icon (tie_icon, cr, x, y, scale);-	}--	public static void draw_icon (ImageSurface? i, Context cr, double x, double y, double scale = 1) {-		ImageSurface img;-		double px, py, ratio;-		-		if (i != null) {-			img = (!) tie_icon;	-					-			cr.save ();-			-			ratio = scale;-			ratio *= 0.23; // 72 to 320 dpi-			ratio *=  MainWindow.units;-			cr.scale (ratio, ratio);-			-			px = x - ratio * img.get_width () / 2;-			py = y - ratio * img.get_height () / 2;-			px /= ratio;-			py /= ratio;-			-			cr.set_source_surface (img, px, py);-			cr.paint ();-			cr.restore ();-		} else {-			warning ("No image.");-		}+		cr.save ();+		Theme.color (cr, "Merge");		+		cr.move_to (x, y);+		cr.arc (x, y, 15, 0, 2 * Math.PI);+		cr.close_path ();+		cr.fill ();+		cr.restore (); 	}-		  	void draw_merge_icon (Context cr) { 		double x, y;diff --git a/libbirdfont/Theme.vala b/libbirdfont/Theme.valaindex 6be1559..8fafc4f 100644--- a/libbirdfont/Theme.vala+++ b/libbirdfont/Theme.vala@@ -173,17 +173,19 @@ public class Theme : GLib.Object { 		 		Theme.set_default_color ("Selected Active Cubic Control Point", 0, 0, 0, 1); 		Theme.set_default_color ("Selected Cubic Control Point", 0, 0, 0, 1);-		Theme.set_default_color ("Active Cubic Control Point", 160 / 255.0, 160 / 255.0, 160 / 255.0, 1);+		Theme.set_default_color ("Active Cubic Control Point", 70 / 255.0, 70 / 255.0, 70 / 255.0, 1); 		Theme.set_default_color ("Cubic Control Point", 116 / 255.0, 116 / 255.0, 116 / 255.0, 1);  		Theme.set_default_color ("Selected Active Quadratic Control Point", 0, 0, 0, 1); 		Theme.set_default_color ("Selected Quadratic Control Point", 0, 0, 0, 1);-		Theme.set_default_color ("Active Quadratic Control Point", 131 / 255.0, 182 / 255.0, 255 / 255.0, 1);+		Theme.set_default_color ("Active Quadratic Control Point", 85 / 255.0, 115 / 255.0, 149 / 255.0, 1); 		Theme.set_default_color ("Quadratic Control Point", 123 / 255.0, 151 / 255.0, 184 / 255.0, 1);  		Theme.set_default_color ("Selected Control Point Handle", 0, 0, 0, 1);-		Theme.set_default_color ("Active Control Point Handle", 80 / 255.0, 118 / 255.0, 64 / 255.0, 1);-		Theme.set_default_color ("Control Point Handle", 56 / 255.0, 62 / 255.0, 45 / 255.0, 1);+		Theme.set_default_color ("Active Control Point Handle", 81 / 255.0, 147 / 255.0, 90 / 255.0, 1);+		Theme.set_default_color ("Control Point Handle", 81 / 255.0, 147 / 255.0, 90 / 255.0, 1);+		+		Theme.set_default_color ("Merge", 101 / 255.0, 108 / 255.0, 116 / 255.0, 0.3);  		if (BirdFont.has_argument ("--test")) { 			current_theme = "generated_theme.theme";@@ -266,6 +268,7 @@ public class Theme : GLib.Object { 			t_("Active Control Point Handle"); 			t_("Control Point Handle"); +			t_("Merge"); 		} 	} 	diff --git a/resources/default.theme b/resources/default.themeindex 98774cb..5a8581d 100644--- a/resources/default.theme+++ b/resources/default.theme@@ -3,7 +3,7 @@ 	<color name="Highlighted 1" red="0.91764705882352937" green="0.30196078431372547" blue="0.10196078431372549" alpha="1"/> 	<color name="Guide 1" red="0.69999999999999996" green="0.69999999999999996" blue="0.80000000000000004" alpha="1"/> 	<color name="Foreground 6" red="0.17647058823529413" green="0.17647058823529413" blue="0.17647058823529413" alpha="1"/>-	<color name="Active Quadratic Control Point" red="0.51372549019607838" green="0.71372549019607845" blue="1" alpha="1"/>+	<color name="Active Quadratic Control Point" red="0.33333333333333331" green="0.45098039215686275" blue="0.58431372549019611" alpha="1"/> 	<color name="Background 1" red="1" green="1" blue="1" alpha="1"/> 	<color name="Guide 2" red="0.69999999999999996" green="0" blue="0" alpha="0.5"/> 	<color name="Foreground 7" red="0.85882352941176465" green="0.8666666666666667" blue="0.9137254901960784" alpha="1"/>@@ -20,7 +20,7 @@ 	<color name="Selected Active Cubic Control Point" red="0" green="0" blue="0" alpha="1"/> 	<color name="Selected Cubic Control Point" red="0" green="0" blue="0" alpha="1"/> 	<color name="Background 7" red="0.2196078431372549" green="0.23137254901960785" blue="0.25490196078431371" alpha="1"/>-	<color name="Control Point Handle" red="0.2196078431372549" green="0.24313725490196078" blue="0.17647058823529413" alpha="1"/>+	<color name="Control Point Handle" red="0.31764705882352939" green="0.57647058823529407" blue="0.35294117647058826" alpha="1"/> 	<color name="Background 8" red="0.21568627450980393" green="0.21568627450980393" blue="0.21568627450980393" alpha="1"/> 	<color name="Fill Color" red="0.5" green="0.5" blue="0.5" alpha="1"/> 	<color name="Background 9" red="0.28235294117647058" green="0.28235294117647058" blue="0.28235294117647058" alpha="1"/>@@ -51,9 +51,10 @@ 	<color name="Overview Foreground" red="0.17647058823529413" green="0.17647058823529413" blue="0.17647058823529413" alpha="1"/> 	<color name="Tool Foreground" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> 	<color name="Selected Quadratic Control Point" red="0" green="0" blue="0" alpha="1"/>-	<color name="Active Cubic Control Point" red="0.62745098039215685" green="0.62745098039215685" blue="0.62745098039215685" alpha="1"/>+	<color name="Active Cubic Control Point" red="0.27450980392156865" green="0.27450980392156865" blue="0.27450980392156865" alpha="1"/> 	<color name="Foreground 1" red="0" green="0" blue="0" alpha="1"/>-	<color name="Active Control Point Handle" red="0.31372549019607843" green="0.46274509803921571" blue="0.25098039215686274" alpha="1"/>+	<color name="Active Control Point Handle" red="0.31764705882352939" green="0.57647058823529407" blue="0.35294117647058826" alpha="1"/>+	<color name="Merge" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="0.29999999999999999"/> 	<color name="Foreground 2" red="0.396078431372549" green="0.42352941176470588" blue="0.45490196078431372" alpha="1"/> 	<color name="Foreground 3" red="0.10196078431372549" green="0.11764705882352941" blue="0.12549019607843137" alpha="1"/> 	<color name="Overview Selected Foreground" red="0.17647058823529413" green="0.17647058823529413" blue="0.17647058823529413" alpha="1"/>

Contact

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