Clone in a terminal:
Commit 3bf69b2
Johan Mattsson - 2015-11-28T13:20:34+00:00
3bf69b215484723549eda626797459d080296fcbjohan.mattsson.m@gmail.com

Merge branch '2.14' of github.com:johanmattssonm/birdfont into 2.14

Changed files (6)

Diff

diff --git a/libbirdfont/AbstractMenu.vala b/libbirdfont/AbstractMenu.valaindex 3ee76a0..19c8e3d 100644--- a/libbirdfont/AbstractMenu.vala+++ b/libbirdfont/AbstractMenu.vala@@ -36,11 +36,15 @@ public class AbstractMenu : GLib.Object { 				if (tab_name == "Preview") { 					MenuTab.select_overview (); 				}+				+				MainWindow.hide_scrollbar ();+			} else {+				MainWindow.show_scrollbar (); 			} 		} 	} 	-	public bool menu_visibility = false;+	private bool menu_visibility = false; 	public SubMenu top_menu;  	SubMenu current_menu;@@ -219,7 +223,7 @@ public class AbstractMenu : GLib.Object { 				y += height; 			} 			-			menu_visibility = false;+			show_menu = false; 			current_menu = (!) top_menu; 			GlyphCanvas.redraw (); 		}diff --git a/libbirdfont/BackgroundSelectionTool.vala b/libbirdfont/BackgroundSelectionTool.valaindex 859e8cc..9b7eb3e 100644--- a/libbirdfont/BackgroundSelectionTool.vala+++ b/libbirdfont/BackgroundSelectionTool.vala@@ -28,6 +28,7 @@ public class BackgroundSelectionTool : CutBackgroundTool { 		new_image.connect (add_new_image);  		select_action.connect ((t) => {+			DrawingTools.move_canvas.set_selected (false); 			GlyphCanvas.redraw (); 		}); diff --git a/libbirdfont/ExportTool.vala b/libbirdfont/ExportTool.valaindex 04ab11f..4280792 100644--- a/libbirdfont/ExportTool.vala+++ b/libbirdfont/ExportTool.vala@@ -148,7 +148,7 @@ public class ExportTool : GLib.Object { 	 	public static void export_current_glyph () { 		FileChooser fc = new FileChooser ();-		fc.file_selected.connect ((f) => {+		fc.file_selected.connect ((selected_file) => { 			Glyph glyph = MainWindow.get_current_glyph (); 			FontDisplay fd = MainWindow.get_current_display (); 			string glyph_svg;@@ -159,19 +159,34 @@ public class ExportTool : GLib.Object { 			string fn; 			int i; 			-			name = glyph.get_name ();-			-			if (f == null) {+			if (fd is Glyph) {+				glyph = MainWindow.get_current_glyph ();+			} else if (fd is OverView) {+				OverView overview = MainWindow.get_overview ();+				Glyph? g = overview.get_selected_glyph ();+				+				if (g == null) {+					warning("No glyhp selected in overview.");+					return;+				}+				+				glyph = (!) g;+			} else { 				return; 			} 			-			svg_file = (!) f;--			if (!(fd is Glyph)) {+			name = glyph.get_name ();+			+			if (selected_file == null) { 				return; 			} 			+			svg_file = (!) selected_file;+ 			try {+#if MAC+				file = File.new_for_path (svg_file);+#else 				i = 1; 				fn = svg_file.replace (".svg", ""); 				file = File.new_for_path (fn + ".svg");@@ -179,8 +194,8 @@ public class ExportTool : GLib.Object { 					file = File.new_for_path (fn + @"$i.svg"); 					i++; 				}-				-				glyph_svg = export_current_glyph_to_string ();+#endif				+				glyph_svg = export_to_string (glyph, false); 				os = new DataOutputStream (file.create(FileCreateFlags.REPLACE_DESTINATION)); 				os.put_string (glyph_svg); 		diff --git a/libbirdfont/MainWindow.vala b/libbirdfont/MainWindow.valaindex 8f32ee8..0c814fb 100644--- a/libbirdfont/MainWindow.vala+++ b/libbirdfont/MainWindow.vala@@ -36,6 +36,8 @@ public class MainWindow : GLib.Object { 	/** Number of pixels per mm */
 	public static double units = 1;
 
+	private static double scrollbar_size = -1;
+	
 	public MainWindow () {
 		singleton = this;
 		
@@ -131,10 +133,10 @@ public class MainWindow : GLib.Object { 	public static void init () {
 		singleton = new MainWindow ();
 	}
--	public static RecentFiles get_recent_files_tab () {-		return file_tab;-	}+
+	public static RecentFiles get_recent_files_tab () {
+		return file_tab;
+	}
 	
 	public static void open_recent_files_tab () {
 		// FIXME: do not idle 
@@ -250,8 +252,21 @@ public class MainWindow : GLib.Object { 		MainWindow.native_window.file_chooser (title, fc, flags);
 	}
 	
+	public static void hide_scrollbar () {
+		if (!is_null (MainWindow.native_window)) {
+			MainWindow.native_window.set_scrollbar_size (-1);
+		}
+	}	
+
+	public static void show_scrollbar () {
+		if (!is_null (MainWindow.native_window)) {
+			MainWindow.native_window.set_scrollbar_size (scrollbar_size);
+		}
+	}
+	
 	public static void set_scrollbar_size (double size) {
 		if (!is_null (MainWindow.native_window)) {
+			scrollbar_size = size;
 			MainWindow.native_window.set_scrollbar_size (size);
 		}
 	}
@@ -290,43 +305,43 @@ public class MainWindow : GLib.Object { 	public static LigatureList get_ligature_display () {
 		return ligature_display;
 	}
--	public static void next_tab () {-		TabBar tb = MainWindow.get_tab_bar ();-		int n = tb.get_selected () + 1;-			-		if (!(0 <= n < tb.get_length ())) {-			return;-		}-			-		tb.select_tab (n);-	}--	public static void previous_tab () {-		TabBar tb = MainWindow.get_tab_bar ();-		int n = tb.get_selected () - 1;--		if (!(0 <= n < tb.get_length ())) {-			return;-		}-			-		tb.select_tab (n);-	}--	public static void close_tab () {-		TabBar tb = MainWindow.get_tab_bar ();-		int n = tb.get_selected ();--		if (!(0 <= n < tb.get_length ())) {-			return;-		}-		-		tb.close_tab (n);+
+	public static void next_tab () {
+		TabBar tb = MainWindow.get_tab_bar ();
+		int n = tb.get_selected () + 1;
+			
+		if (!(0 <= n < tb.get_length ())) {
+			return;
+		}
+			
+		tb.select_tab (n);
+	}
+
+	public static void previous_tab () {
+		TabBar tb = MainWindow.get_tab_bar ();
+		int n = tb.get_selected () - 1;
+
+		if (!(0 <= n < tb.get_length ())) {
+			return;
+		}
+			
+		tb.select_tab (n);
+	}
+
+	public static void close_tab () {
+		TabBar tb = MainWindow.get_tab_bar ();
+		int n = tb.get_selected ();
+
+		if (!(0 <= n < tb.get_length ())) {
+			return;
+		}
+		
+		tb.close_tab (n);
 	}
 	
 	public static void set_toolbox (Toolbox tb) {
 		tools = tb;
-	}+	}
 }
 
 }
diff --git a/libbirdfont/OverView.vala b/libbirdfont/OverView.valaindex 50c9052..40d3f01 100644--- a/libbirdfont/OverView.vala+++ b/libbirdfont/OverView.vala@@ -129,6 +129,14 @@ public class OverView : FontDisplay { 		update_scrollbar (); 		reset_zoom (); 	}++	public Glyph? get_selected_glyph () {+		if (selected_items.size == 0) {+			return null;+		}+		+		return selected_items.get (0).get_current ();+	} 	 	public void select_all_glyphs () { 		Font f;diff --git a/libbirdfont/StrokeTool.vala b/libbirdfont/StrokeTool.valaindex 9fa98e8..b0b6176 100644--- a/libbirdfont/StrokeTool.vala+++ b/libbirdfont/StrokeTool.vala@@ -535,10 +535,8 @@ public class StrokeTool : GLib.Object { 			next = lep.get_next (); 			hidden = new EditPoint (0, 0, PointType.QUADRATIC); 			-			px = next.get_right_handle ().x -				+ (next.get_left_handle ().x - prev.get_right_handle ().x) / 2.0;-			py = next.get_right_handle ().y -				+ (next.get_left_handle ().y - prev.get_right_handle ().y) / 2.0;+			px = (next.get_left_handle ().x + prev.get_right_handle ().x) / 2.0;+			py = (next.get_left_handle ().y + prev.get_right_handle ().y) / 2.0; 			hidden.independent_x = px; 			hidden.independent_y = py; 			

Contact

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