Clone in a terminal:
Commit a8cea9a
Johan Mattsson - 2014-11-13T00:17:37+00:00
a8cea9a1bf82d66ca1eb08f527260dc4abd733f9johan.mattsson.m@gmail.com

Display a background image to the empty tool box

Changed files (6)

Diff

diff --git a/AUTHORS b/AUTHORSindex c1267e6..5b3a3a2 100644--- a/AUTHORS+++ b/AUTHORS@@ -5,3 +5,4 @@ Eduardo Schettino Zhantong Zhang Clemens Lang Hideki Yamane+Rene Mensendiff --git a/icons/corvus_monedula.png b/icons/corvus_monedula.pngnew file mode 100644index 0000000..755278bBinary files /dev/null and b/icons/corvus_monedula.png differdiff --git a/libbirdfont/ColorTool.vala b/libbirdfont/ColorTool.valaindex 06e8d5c..237c9a6 100644--- a/libbirdfont/ColorTool.vala+++ b/libbirdfont/ColorTool.vala@@ -34,6 +34,7 @@ public class ColorTool : Tool { 		 		color_updated.connect (() => { 			MainWindow.get_toolbox ().redraw ((int)x, (int)y, (int)x + 20, (int)y + 20);+			GlyphCanvas.redraw (); 		}); 	} 	diff --git a/libbirdfont/DrawingTools.vala b/libbirdfont/DrawingTools.valaindex a6ee6fe..e91f975 100644--- a/libbirdfont/DrawingTools.vala+++ b/libbirdfont/DrawingTools.vala@@ -1000,7 +1000,8 @@ public class DrawingTools : ToolCollection  { 		idle.set_callback (() => { 			MainWindow.get_toolbox ().reset_active_tool (); 		-			pen_tool.set_selected (true);+			foresight_tool.set_selected (true);+			update_drawing_and_background_tools (foresight_tool); 			 			select_draw_tool ();			 			set_point_type_from_preferences ();diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 4a17b3d..d39ab63 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -62,6 +62,7 @@ public class Toolbox : GLib.Object  { 		 		tab_bar.signal_tab_selected.connect ((tab) => { 			string tab_name = tab.get_display ().get_name ();+			 			if (tab_name == "Kerning") { 				current_set = kerning_tools; 			} else if (tab_name == "Preview") {@@ -70,9 +71,12 @@ public class Toolbox : GLib.Object  { 				current_set = overview_tools; 			} else if (tab_name == "Backgrounds") { 				current_set = background_tools;-			} else {+			} else if (tab.get_display () is Glyph) { 				current_set = drawing_tools;-			}+			} else {+				current_set = new EmptySet ();+			} +		 			 			update_expanders (); 			redraw (0, 0, allocation_width, allocation_height);@@ -420,17 +424,52 @@ public class Toolbox : GLib.Object  { 	} 	 	public void draw (int w, int h, Context cr) { -		cr.save ();+		EmptySet empty_set;+		ImageSurface bg; 		-		cr.rectangle (0, 0, w, h);-		cr.set_line_width (0);-		cr.set_source_rgba (51/255.0, 54/255.0, 59/255.0, 1);-		cr.fill ();+		if (current_set is EmptySet) {+			empty_set = (EmptySet) current_set;+			+			if (empty_set.background != null) {+				bg = (!) empty_set.background;+				+				cr.save ();+				cr.scale ((double) allocation_width / bg.get_width (), (double) allocation_height / bg.get_height ());+				cr.set_source_surface (bg, 0, 0);+				cr.paint ();				+				cr.restore ();+				+				draw_expanders (w, h, cr);+			}+		} else {+			cr.save ();+			+			cr.rectangle (0, 0, w, h);+			cr.set_line_width (0);+			cr.set_source_rgba (51/255.0, 54/255.0, 59/255.0, 1);+			cr.fill (); -		draw_expanders (w, h, cr);+			draw_expanders (w, h, cr);+			+			cr.restore ();+		}+	}+	+	public class EmptySet : ToolCollection  {+		+		public ImageSurface? background;+		Gee.ArrayList<Expander> expanders; 		-		cr.restore ();+		public EmptySet () {+			background = Icons.get_icon ("corvus_monedula.png");+			expanders = new Gee.ArrayList<Expander> ();+		}+		+		public override Gee.ArrayList<Expander> get_expanders () {+			return expanders;+		} 	}+ }  }diff --git a/libbirdfont/ZoomBar.vala b/libbirdfont/ZoomBar.valaindex e69a1d0..0ad37af 100644--- a/libbirdfont/ZoomBar.vala+++ b/libbirdfont/ZoomBar.vala@@ -103,7 +103,6 @@ public class ZoomBar : Tool { 	} 	 	void draw_bar (Context cr) {-		double scale = Toolbox.get_scale (); 		double height = h; 		double radius = height / 2; 		double margin = w * 0.1;

Contact

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