Clone in a terminal:
Commit 140f6da
Johan Mattsson - 2012-09-08T15:27:34+00:00
140f6dad3d28c9ed2acfb034d6efcb5e4c1748e8johan.mattsson.m@gmail.com

always show new backgrounds

Changed files (7)

Diff

diff --git a/src/BackgroundSelection.vala b/src/BackgroundSelection.valaindex ea57544..18bcb3d 100644--- a/src/BackgroundSelection.vala+++ b/src/BackgroundSelection.vala@@ -24,38 +24,22 @@ namespace Supplement { class BackgroundSelection : FontDisplay {  	int active_box = -1;-	ImageSurface add_icon; -	Glyph glyph;+	ImageSurface add_icon; 	CutBackgroundCanvas cut_background_canvas; 	List <string> background_images = new List <string> (); 	Allocation allocation;+	Glyph glyph; 	-	public BackgroundSelection (Glyph glyph) {+	public BackgroundSelection () { 		ImageSurface? i;+		glyph = MainWindow.get_current_glyph ();+		 		i = Icons.get_icon ("add_background_image.png"); 		return_if_fail (i != null); 		add_icon = (!) i;-		this.glyph = glyph;-		+ 		CutBackgroundTool cb = (CutBackgroundTool) MainWindow.get_toolbox ().get_tool ("cut_background");-		 		cb.set_destination_file_name (glyph.get_name ());-		-		cb.new_image.connect ((file) => {-			Tool zoom_background;-			TabBar tb = MainWindow.get_tab_bar ();-			-			glyph.set_background_image (new GlyphBackgroundImage (file));--			tb.close_display (cut_background_canvas);-			tb.select_tab_name (glyph.get_name ());-			-			glyph.set_background_visible (true);-			-			zoom_background = MainWindow.get_tool ("zoom_background_image");-			zoom_background.select_action (zoom_background);--		}); 	}  	public override string get_name () {@@ -227,6 +211,7 @@ class BackgroundSelection : FontDisplay { 		bg.reset_scale (glyph); 		 		cut_background_canvas.set_background_image (bg);+		glyph.set_background_visible (true); 		 		MainWindow.get_current_glyph ().set_background_image (bg); 		tb.select_tab_name (MainWindow.get_current_glyph ().get_name ());diff --git a/src/BackgroundTool.vala b/src/BackgroundTool.valaindex abbe24d..b460cba 100644--- a/src/BackgroundTool.vala+++ b/src/BackgroundTool.vala@@ -40,7 +40,7 @@ class BackgroundTool : Tool { 	bool resize_bg; // DEL 	 	public BackgroundTool (string name) {-		base (name, "move, resize and rotate background image", 'M', CTRL|SHIFT);+		base (name, "Move, resize and rotate background image"); 		 		top_limit = 0; 		bottom_limit = 0;diff --git a/src/CutBackgroundTool.vala b/src/CutBackgroundTool.valaindex cdf2125..20443aa 100644--- a/src/CutBackgroundTool.vala+++ b/src/CutBackgroundTool.vala@@ -36,7 +36,7 @@ class CutBackgroundTool : Tool { 	string? destination_file_name = null; 	 	public CutBackgroundTool (string name) {-		base (name, "cut background image", 'u', CTRL);		+		base (name, "Cut background image");		  		select_action.connect((self) => { 		});@@ -95,7 +95,7 @@ class CutBackgroundTool : Tool { 			tb.select_tab_name (glyph.get_name ()); 			 			glyph.set_background_visible (true);-			+ 			zoom_background = MainWindow.get_tool ("zoom_background_image"); 			zoom_background.select_action (zoom_background); 		});diff --git a/src/Glyph.vala b/src/Glyph.valaindex 77c7887..204407f 100644--- a/src/Glyph.vala+++ b/src/Glyph.vala@@ -135,6 +135,8 @@ class Glyph : FontDisplay { 				} 			} 			+			((!) p).set_selected (true);+			 			active_paths.append ((!) p); 		} 	}@@ -1660,8 +1662,12 @@ class Glyph : FontDisplay { 			merge_path (p0); 		} 		-		open_path ();-		// close_path ();+		//open_path ();+		close_path ();++		foreach (Path p in path_list) {+			p.update_region_boundries ();+		}		 		 		redraw_area (0, 0, allocation.width, allocation.height); 	}@@ -1678,7 +1684,6 @@ class Glyph : FontDisplay { 				continue; 			} 			-			//path_list = Path.merge (p0.copy(), p1.copy()); 			path_list = Path.merge (p1, p0);  			if (path_list.paths.length () == 0) {@@ -1698,7 +1703,7 @@ class Glyph : FontDisplay { 			} 			 			add_active_path (mp);-+			 			active_paths.remove_all (p0); 			active_paths.remove_all (p1); diff --git a/src/GlyphBackgroundImage.vala b/src/GlyphBackgroundImage.valaindex c31b98f..6579811 100644--- a/src/GlyphBackgroundImage.vala+++ b/src/GlyphBackgroundImage.vala@@ -398,8 +398,6 @@ class GlyphBackgroundImage { 				 		draw_handle_triangle (x, y, cr, g, 6); 		-		draw_handle_triangle (0, 0, cr, g, 6);-										 		cr.restore (); 	} 		diff --git a/src/Path.vala b/src/Path.valaindex 6e3287e..aa72d73 100644--- a/src/Path.vala+++ b/src/Path.vala@@ -141,11 +141,7 @@ class Path { 	} 	 	private void draw_next (EditPoint e, EditPoint en, Context cr) {-		if (en.right_handle.type == PointType.LINE && e.left_handle.type == PointType.LINE) {-			draw_line (e, en, cr);-		} else {-			draw_curve (e, en, cr);-		}+		draw_curve (e, en, cr); 	} 	 	private static void draw_curve (EditPoint e, EditPoint en, Context cr, double alpha = 1) {@@ -1402,7 +1398,7 @@ class Path { 			cr.save (); 			 			all_of_path ((x, y) => {-				cr.set_source_rgba (0.3, 0.3, 0.3, 1);+				//cr.set_source_rgba (0.3, 0.3, 0.3, 1); 				cr.move_to (px + xc, -py + yc); 				cr.line_to (x + xc, -y + yc); 				diff --git a/src/Toolbox.vala b/src/Toolbox.valaindex 3af849b..b4d2c6e 100644--- a/src/Toolbox.vala+++ b/src/Toolbox.vala@@ -399,7 +399,7 @@ class Toolbox : DrawingArea { 		background_tools.add_tool (cut_background); 		this.cut_background = cut_background; 		-		Tool show_bg = new Tool ("show_background", "Show background image", 'F', SHIFT);+		Tool show_bg = new Tool ("show_background", "Show background image"); 		show_bg.select_action.connect((self) => { 				Glyph g = MainWindow.get_current_glyph (); 				g.set_background_visible (!g.get_background_visible ());@@ -445,7 +445,7 @@ class Toolbox : DrawingArea { 				return; 			} 			-			BackgroundSelection bgs = new BackgroundSelection ((!) g);+			BackgroundSelection bgs = new BackgroundSelection (); 			MainWindow.get_tab_bar ().add_unique_tab (bgs , 120, false); 			 			tp.show_text ("");

Contact

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