Clone in a terminal:
Commit 246fe09
Johan Mattsson - 2012-09-13T20:30:21+00:00
246fe09ee5f55592e29342d9b066588d45a4cac8johan.mattsson.m@gmail.com

new tab bar

Changed files (18)

Diff

diff --git a/icons/tab1_left.png b/icons/tab1_left.pngindex a25d0e9..5d0dc54 100644Binary files a/icons/tab1_left.png and b/icons/tab1_left.png differdiff --git a/icons/tab1_right.png b/icons/tab1_right.pngindex 191348d..c6f7b57 100644Binary files a/icons/tab1_right.png and b/icons/tab1_right.png differdiff --git a/icons/tab2_left.png b/icons/tab2_left.pngindex 2253cad..241cc90 100644Binary files a/icons/tab2_left.png and b/icons/tab2_left.png differdiff --git a/icons/tab2_right.png b/icons/tab2_right.pngindex 4036af6..fd423a8 100644Binary files a/icons/tab2_right.png and b/icons/tab2_right.png differdiff --git a/icons/tab3_left.png b/icons/tab3_left.pngindex 97a5b88..16c08d2 100644Binary files a/icons/tab3_left.png and b/icons/tab3_left.png differdiff --git a/icons/tab3_right.png b/icons/tab3_right.pngindex 7a8682b..e369bed 100644Binary files a/icons/tab3_right.png and b/icons/tab3_right.png differdiff --git a/src/BackgroundTool.vala b/src/BackgroundTool.valaindex a5375ce..37ecf70 100644--- a/src/BackgroundTool.vala+++ b/src/BackgroundTool.vala@@ -129,6 +129,9 @@ class BackgroundTool : Tool { 		dx *= 1/g.view_zoom; 		dy *= 1/g.view_zoom; 	+		dx *= PenTool.precision;+		dy *= PenTool.precision;+		 		if (bg.selected_handle == 2) { 			bg.set_img_rotation_from_coordinate (x, y); 		}diff --git a/src/ExportTool.vala b/src/ExportTool.valaindex 87222a5..b89cb90 100644--- a/src/ExportTool.vala+++ b/src/ExportTool.vala@@ -26,6 +26,8 @@ class ExportTool : Tool { 	public static bool export_thread_is_running = false; 	private static unowned Thread<void*> export_thread_handle; +	private static bool stop_export_thread = false;+ 	public ExportTool (string n) { 		base (n, "Export glyph to svg file", 'e', CTRL); 	@@ -361,6 +363,21 @@ os.put_string ( 		return export_ttf_font_path (file); 	} 	+	/** Stop a running export thread.*/+	public static void stop_export () {+		lock (stop_export_thread) {+			stop_export_thread = true;+		}+	}+	+	public static bool should_stop () {+		bool r;+		lock (stop_export_thread) {+			r = stop_export_thread;+		}+		return r;+	} +	 	public static bool export_ttf_font_path (File folder, bool async = true) { 		Font current_font = Supplement.get_current_font (); 		string path;@@ -371,8 +388,16 @@ os.put_string ( 		string temp_file; 		bool done = true; +		lock (stop_export_thread) {+			stop_export_thread = true;+		}+ 		export_mutex.lock (); +		lock (stop_export_thread) {+			stop_export_thread = false;+		}+ 		if (Supplement.win32) { 			async = false; 		}@@ -480,8 +505,13 @@ os.put_string ( 			assert (!is_null (ttf)); 			assert (!is_null (eot)); 			-			write_ttf ();-			write_eof ();+			if (!should_stop ()) { +				write_ttf ();+			}+			+			if (!should_stop ()) { +				write_eof ();+			} 			 			ExportTool.export_thread_is_running = false; 			@@ -510,6 +540,7 @@ os.put_string ( 		} 		 		void write_eof () {+			print ("WRITE EOF\n"); 			EotWriter fo;  			return_if_fail (!is_null (this));diff --git a/src/Glyph.vala b/src/Glyph.valaindex 67728a2..10d9cbd 100644--- a/src/Glyph.vala+++ b/src/Glyph.vala@@ -438,7 +438,7 @@ class Glyph : FontDisplay { 		return (int) Math.fabs (a.data.pos / SCALE - b.data.pos / SCALE);  	} 	-	public int get_width () {+	public double get_width () { 		return (int) Math.fabs (right_limit / SCALE - left_limit / SCALE); 	} @@ -1383,10 +1383,6 @@ class Glyph : FontDisplay { 		ImageSurface ps = new ImageSurface (Format.ARGB32, allocation.width, allocation.height); 		Context cmp = new Context (ps); -		cr.save ();-		draw_background_color (cr, 1);-		cr.restore ();- 		if (Supplement.show_coordinates) { 			draw_coordinate (cmp); 		}@@ -1746,6 +1742,10 @@ class Glyph : FontDisplay { 		double x, kern; 		double left, baseline; 		string last_name;++		cr.save ();+		draw_background_color (cr, 1);+		cr.restore (); 				 		x = 0; 		diff --git a/src/GlyphCanvas.vala b/src/GlyphCanvas.valaindex c4a02fd..c65ffd9 100644--- a/src/GlyphCanvas.vala+++ b/src/GlyphCanvas.vala@@ -72,13 +72,13 @@ class GlyphCanvas : DrawingArea  { 				
 				Surface s = new Surface.similar (cw.get_target (), Cairo.Content.COLOR_ALPHA, allocation.width, allocation.height);
 				Context c = new Context (s); 
-		
-				current_display.draw (allocation, c);
-				
+
 				if (current_display is Glyph) {
 					((Glyph) current_display).juxtapose (allocation, c);
 				}
-				
+						
+				current_display.draw (allocation, c);
+
 				cw.save ();
 				cw.set_source_surface (c.get_target (), 0, 0);
 				cw.paint ();
diff --git a/src/Line.vala b/src/Line.valaindex 5cc06c0..ba303bb 100644--- a/src/Line.vala+++ b/src/Line.vala@@ -135,9 +135,6 @@ class Line : GLib.Object { 		event_move_to (x, y, x, y, allocation); 	} 	-	/** Move to line to @param x, @param y and execute ove line handle -	 * event for @param x, @param y.-	 */ 	public void event_move_to (double x, double y, double ax, double ay, Allocation allocation) { 		double p, c, mx, my; 		bool a = false;diff --git a/src/MainWindow.vala b/src/MainWindow.valaindex 38f2497..2bca17d 100644--- a/src/MainWindow.vala+++ b/src/MainWindow.vala@@ -125,7 +125,7 @@ internal class MainWindow { 		}
 		
 		over_view = new OverView();
-		tabs.add_unique_tab (over_view, 75, false);
+		tabs.add_unique_tab (over_view, 100, false);
 				
 		return over_view;
 	}
diff --git a/src/MoveTool.vala b/src/MoveTool.valaindex b020a4a..b3fdf09 100644--- a/src/MoveTool.vala+++ b/src/MoveTool.vala@@ -87,12 +87,12 @@ class MoveTool : Tool { 		move_action.connect ((self, x, y)	 => { 			if (move_path) { 				Glyph glyph = MainWindow.get_current_glyph ();- 				double dx = last_x - x; 				double dy = last_y - y; +				double p = PenTool.precision;  				foreach (Path path in glyph.active_paths) {-					path.move (glyph.ivz () * -dx, glyph.ivz () * dy);+					path.move (glyph.ivz () * -dx * p, glyph.ivz () * dy * p); 				} 				 				MainWindow.get_glyph_canvas ().redraw ();diff --git a/src/OpenFontFormatWriter.vala b/src/OpenFontFormatWriter.valaindex ec09788..1c31711 100644--- a/src/OpenFontFormatWriter.vala+++ b/src/OpenFontFormatWriter.vala@@ -627,7 +627,6 @@ class LocaTable : Table { 					
 					if (0 < i < size && glyph_offsets[i - 1] > glyph_offsets[i]) {
 						warning (@"Invalid loca table, it must be sorted. ($(glyph_offsets[i - 1]) > $(glyph_offsets[i]))");
-						print_offsets ();
 					}
 				}
 				break;
@@ -638,8 +637,7 @@ class LocaTable : Table { 									
 					if (0 < i < size && glyph_offsets[i - 1] > glyph_offsets[i]) {
 						warning (@"Invalid loca table, it must be sorted. ($(glyph_offsets[i - 1]) > $(glyph_offsets[i]))");
-						print_offsets ();
-					}				
+					}		
 				}
 
 				break;
@@ -1627,6 +1625,10 @@ class GlyfTable : Table { 			printd (@"loca fd.length (): $(fd.length ())\n");
 
 			last_len = fd.length ();
+			
+			if (ExportTool.should_stop ()) {
+				break;
+			}
 		}
 
 		location_offsets.append (fd.length ()); // last entry in loca table is special
diff --git a/src/OverView.vala b/src/OverView.valaindex b09bc6e..a6896f2 100644--- a/src/OverView.vala+++ b/src/OverView.vala@@ -400,15 +400,9 @@ class OverView : FontDisplay { 		 		g = (!) gl; 		g.boundries (out x1, out y1, out x2, out y2);-		-		if (g.get_width () > w) {-			m = 0;-		} else {-			m = ((w - g.get_width ()) / 2.0) / scale;-		}-		-		gx = -x1 + m;-		gy = -f.bottom_position + 210 - 65;++		gx = 0;+		gy = h / scale - 40; 		 		Surface s = new Surface.similar (cr.get_target (), Content.COLOR_ALPHA, (int) w, (int) h); 		Context c = new Context (s);diff --git a/src/PenTool.vala b/src/PenTool.valaindex ed4dc1f..e52ef2a 100644--- a/src/PenTool.vala+++ b/src/PenTool.vala@@ -44,7 +44,7 @@ class PenTool : Tool { 	private static bool adjust_precision = false; 	private static double adjust_precision_begin_x = 0; 	private static double adjust_precision_begin_y = 0;-	private static double precision = 1;+	public static double precision = 1; 	 	public PenTool (string name) { 		base (name, "Edit path", ',', CTRL);diff --git a/src/TabBar.vala b/src/TabBar.valaindex 54cb829..e66e607 100644--- a/src/TabBar.vala+++ b/src/TabBar.vala@@ -101,19 +101,19 @@ class TabBar : DrawingArea { 				return true; 			});	 		-		set_size_request (20, 50);+		set_size_request (20, 25); 	} 	 	private void is_over_close (double x, double y, out int over, out int over_close) { 		int i = 0;-		double offset = 40;+		double offset = 0; 		 		foreach (Tab t in tabs) { 						 			if ( offset < x < offset + t.get_width ()) { 				over = i; 				-				if (28 < y < 46 && x > offset + t.get_width () - 16) {+				if (8 < y < 20 && x > offset + t.get_width () - 16) { 					over_close =  i; 				} else { 					over_close =  -1;@@ -122,7 +122,7 @@ class TabBar : DrawingArea { 				return; 			} 			-			offset += t.get_width () + 10;+			offset += t.get_width () + 3; 			i++; 		} @@ -361,30 +361,30 @@ class TabBar : DrawingArea { 		get_allocation(out alloc);  		double close_opacity;-		double offset = 40;+		double offset = 0; 		int i = 0; 		foreach (Tab t in tabs) { 			cr.save ();-			cr.translate (offset, 27);+			cr.translate (offset, 0); +			// background 			if (i == selected) {-				cr.set_source_rgba (1, 1, 1, 1);+				for (int j = 0; j < t.get_width (); j++) {+					cr.set_source_surface ((!) tab3_right, j, 2);+					cr.paint ();+				}							 			} else if (i == over) {-				cr.set_source_rgba (230/255.0, 236/255.0, 244/255.0, 1);+				for (int j = 0; j < t.get_width (); j++) {+					cr.set_source_surface ((!) tab2_right, j, 2);+					cr.paint ();+				}				 			} else {-				cr.set_source_rgba (142/255.0, 158/255.0, 190/255.0, 1);+				for (int j = 0; j < t.get_width (); j++) {+					cr.set_source_surface ((!) tab1_right, j, 2);+					cr.paint ();+				} 			} 			-			cr.rectangle(-2, 5, t.get_width (), 18);-			cr.set_line_width (0);-			cr.fill ();-						-			cr.set_source_rgba (0, 0, 0, 1);-			cr.set_font_size (12);-			cr.move_to (0, 18);-			cr.show_text (t.get_label ());-			cr.stroke ();-	 			// close 			if (t.has_close_button ()) { 				cr.set_line_width (1);@@ -401,31 +401,38 @@ class TabBar : DrawingArea { 				cr.stroke ();	 			} +			cr.set_source_rgba (0, 0, 0, 1);+			cr.set_font_size (14);+			cr.move_to (8, 18);+			cr.show_text (t.get_label ());+			cr.stroke ();+			+			// edges 			if (tab1_left != null  && tab1_right != null && tab2_left != null  && tab2_right != null && tab3_left != null  && tab3_right != null) { 				if (i == selected) {-					cr.set_source_surface ((!) tab3_left, -7, 5);+					cr.set_source_surface ((!) tab3_left, 0, 2); 					cr.paint (); 					-					cr.set_source_surface ((!) tab3_right, t.get_width () - 2, 5);+					cr.set_source_surface ((!) tab3_right, t.get_width () - 2, 2); 					cr.paint (); 				} else if (i == over) {-					cr.set_source_surface ((!) tab2_left, -7, 5);+					cr.set_source_surface ((!) tab2_left, 0, 2); 					cr.paint (); -					cr.set_source_surface ((!) tab2_right, t.get_width () - 2, 5);+					cr.set_source_surface ((!) tab2_right, t.get_width () - 2, 2); 					cr.paint (); 				} else {-					cr.set_source_surface ((!) tab1_left, -7, 5);+					cr.set_source_surface ((!) tab1_left, 0, 2); 					cr.paint (); -					cr.set_source_surface ((!) tab1_right, t.get_width () - 2, 5);+					cr.set_source_surface ((!) tab1_right, t.get_width () - 2, 2); 					cr.paint (); 				} 			}  			cr.restore (); 			-			offset += t.get_width () + 10; // FIXA 10 should be x off marg eller så+			offset += t.get_width () + 3; 			i++; 		} 	}diff --git a/src/Toolbox.vala b/src/Toolbox.valaindex 07a15b3..ea036af 100644--- a/src/Toolbox.vala+++ b/src/Toolbox.vala@@ -199,7 +199,7 @@ class Toolbox : GLib.Object  { 		// Character set tools 		Tool full_unicode = new Tool ("utf_8", "Show full unicode characters set", 'a', CTRL); 		full_unicode.select_action.connect ((self) => {-				MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 75, false);	+				MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false);	 				OverView o = MainWindow.get_overview (); 				GlyphRange gr = new GlyphRange (); 				gr.use_full_unicode_range ();@@ -210,7 +210,7 @@ class Toolbox : GLib.Object  {  		Tool custom_character_set = new Tool ("custom_character_set", "Show default characters set", 'r', CTRL); 		custom_character_set.select_action.connect ((self) => {-			MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 75, false);+			MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false); 			OverView o = MainWindow.get_overview (); 			GlyphRange gr = new GlyphRange (); 			gr.use_default_range ();@@ -221,7 +221,7 @@ class Toolbox : GLib.Object  {  		Tool avalilable_characters = new Tool ("available_characters", "Show characters in font", 'd', CTRL); 		avalilable_characters.select_action.connect ((self) => {-			MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 75, false);+			MainWindow.get_tab_bar ().add_unique_tab (new OverView (), 100, false); 			OverView o = MainWindow.get_overview (); 			o.display_all_available_glyphs (); 			MainWindow.get_tab_bar ().select_tab_name ("Overview");

Contact

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