Clone in a terminal:
Commit 41db3e0
Johan Mattsson - 2012-08-07T16:18:13+00:00
41db3e074a77f576c4f3114a99673d74cc67bd31johan.mattsson.m@gmail.com

TabBar graphics

Changed files (8)

Diff

diff --git a/icons/tab1_left.png b/icons/tab1_left.pngnew file mode 100644index 0000000..a25d0e9Binary files /dev/null and b/icons/tab1_left.png differdiff --git a/icons/tab1_right.png b/icons/tab1_right.pngnew file mode 100644index 0000000..191348dBinary files /dev/null and b/icons/tab1_right.png differdiff --git a/icons/tab2_left.png b/icons/tab2_left.pngnew file mode 100644index 0000000..2253cadBinary files /dev/null and b/icons/tab2_left.png differdiff --git a/icons/tab2_right.png b/icons/tab2_right.pngnew file mode 100644index 0000000..4036af6Binary files /dev/null and b/icons/tab2_right.png differdiff --git a/icons/tab3_left.png b/icons/tab3_left.pngnew file mode 100644index 0000000..97a5b88Binary files /dev/null and b/icons/tab3_left.png differdiff --git a/icons/tab3_right.png b/icons/tab3_right.pngnew file mode 100644index 0000000..7a8682bBinary files /dev/null and b/icons/tab3_right.png differdiff --git a/src/OverView.vala b/src/OverView.valaindex b0976a4..36218b0 100644--- a/src/OverView.vala+++ b/src/OverView.vala@@ -371,6 +371,10 @@ class OverView : FontDisplay { 		double gx, gy; 		double x1, x2, y1, y2; 		double scale = nail_zoom_width / 150.0;+		double w, h, m;+		+		w = nail_width  - 19;+		h = nail_height - 22; 		 		scale = nail_zoom_height / (210.0 - 15.0); 		@@ -383,18 +387,29 @@ class OverView : FontDisplay { 		g = (!) gl; 		g.boundries (out x1, out y1, out x2, out y2); 		-		gx = -x1;-		gy = -f.bottom_position + 210 - 45;+		if (g.get_width () > w) {+			m = ((g.get_width () - w) / 2.0) / scale;+		} else {+			m = ((w - g.get_width ()) / 2.0) / scale;+		}+		+		gx = -x1 + m;+		gy = -f.bottom_position + 210 - 65; 		-		Surface s = new Surface.similar (cr.get_target (), Content.COLOR_ALPHA, nail_width, nail_height - 15);+		Surface s = new Surface.similar (cr.get_target (), Content.COLOR_ALPHA, (int) w, (int) h); 		Context c = new Context (s); 		-		c.scale (scale, scale);-	-		Svg.draw_svg_path (c, g.get_svg_data (), gx, gy, 1.2);+		/*+		c.set_source_rgb (200/255.0, 200/255.0, 229/255.0);+		c.rectangle (0, 0, w, h);	+		c.fill ();+		*/+		+		c.scale (scale, scale);				+		Svg.draw_svg_path (c, g.get_svg_data (), gx, gy, 1.0); 		 		cr.save ();-		cr.set_source_surface (s, x - 14 + nail_width / 4.0, y - 15);+		cr.set_source_surface (s, x - 6, y); 		cr.paint (); 		cr.restore (); diff --git a/src/TabBar.vala b/src/TabBar.valaindex 258d146..fb978f8 100644--- a/src/TabBar.vala+++ b/src/TabBar.vala@@ -34,12 +34,29 @@ class TabBar : DrawingArea { 	Tab? previous_tab = null; 	Tab? current_tab = null; -	public TabBar () {		+	ImageSurface? tab1_left = null;+	ImageSurface? tab1_right = null;++	ImageSurface? tab2_left = null;+	ImageSurface? tab2_right = null;++	ImageSurface? tab3_left = null;+	ImageSurface? tab3_right = null;+				+	public TabBar () {+		tab1_left = Icons.get_icon ("tab1_left.png");+		tab1_right = Icons.get_icon ("tab1_right.png");++		tab2_left = Icons.get_icon ("tab2_left.png");+		tab2_right = Icons.get_icon ("tab2_right.png");++		tab3_left = Icons.get_icon ("tab3_left.png");+		tab3_right = Icons.get_icon ("tab3_right.png");+				 		set_extension_events (ExtensionMode.CURSOR | EventMask.POINTER_MOTION_MASK);+		add_events (EventMask.BUTTON_PRESS_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK); 	  -	  add_events (EventMask.BUTTON_PRESS_MASK | EventMask.POINTER_MOTION_MASK | EventMask.LEAVE_NOTIFY_MASK);-	  -	  motion_notify_event.connect ((t, e)=> {+		motion_notify_event.connect ((t, e)=> { 			Allocation alloc; 			is_over_close (e.x, e.y, out over, out over_close); 			get_allocation (out alloc);@@ -96,7 +113,7 @@ class TabBar : DrawingArea { 			if ( offset < x < offset + t.get_width ()) { 				over = i; 				-				if (15 < y < 50 - 15 && x > offset + t.get_width () - 16) {+				if (28 < y < 46 && x > offset + t.get_width () - 16) { 					over_close =  i; 				} else { 					over_close =  -1;@@ -336,13 +353,13 @@ class TabBar : DrawingArea { 				cr.set_source_rgba (142/255.0, 158/255.0, 190/255.0, 1); 			} 			-			cr.rectangle(-2, 10, t.get_width (), 4);+			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, 0);+			cr.move_to (0, 18); 			cr.show_text (t.get_label ()); 			cr.stroke (); 	@@ -353,18 +370,40 @@ class TabBar : DrawingArea { 				close_opacity = (over_close == i) ? 1 : 0.2;  				cr.set_source_rgba (0, 0, 0, close_opacity); 				-				cr.move_to (t.get_width () - 5, -6);-				cr.line_to (t.get_width () - 10, -1);+				cr.move_to (t.get_width () - 5, 11);+				cr.line_to (t.get_width () - 10, 16); -				cr.move_to (t.get_width () - 10, -6);-				cr.line_to (t.get_width () - 5, -1);+				cr.move_to (t.get_width () - 10, 11);+				cr.line_to (t.get_width () - 5, 16); 				 				cr.stroke ();	 			}-							++			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.paint ();+					+					cr.set_source_surface ((!) tab3_right, t.get_width () - 2, 5);+					cr.paint ();+				} else if (i == over) {+					cr.set_source_surface ((!) tab2_left, -7, 5);+					cr.paint ();++					cr.set_source_surface ((!) tab2_right, t.get_width () - 2, 5);+					cr.paint ();+				} else {+					cr.set_source_surface ((!) tab1_left, -7, 5);+					cr.paint ();++					cr.set_source_surface ((!) tab1_right, t.get_width () - 2, 5);+					cr.paint ();+				}+			}+ 			cr.restore (); 			-			offset += t.get_width () + 10; // FIXA 10 shoud be x off marg eller så+			offset += t.get_width () + 10; // FIXA 10 should be x off marg eller så 			i++; 		} 	}

Contact

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