Clone in a terminal:
Commit d2ead8b
Johan Mattsson - 2016-10-08T15:32:35+00:00
d2ead8b701fbaec11d5b2685a6ac7e056ec7dd7bjohan.mattsson.m@gmail.com

Update colors

Changed files (7)

Diff

diff --git a/libbirdfont/EmptyTab.vala b/libbirdfont/EmptyTab.valaindex 498260b..ea59ddd 100644--- a/libbirdfont/EmptyTab.vala+++ b/libbirdfont/EmptyTab.vala@@ -40,7 +40,7 @@ public class EmptyTab : FontDisplay { 		cr.rectangle (0, 0, allocation.width, allocation.height); 		cr.fill (); 		cr.restore ();-	}	+	} }  }diff --git a/libbirdfont/Glyph.vala b/libbirdfont/Glyph.valaindex 5daf4a5..02cd13f 100644--- a/libbirdfont/Glyph.vala+++ b/libbirdfont/Glyph.vala@@ -441,7 +441,7 @@ public class Glyph : FontDisplay { 			} 		} -		redraw_area (0, 0, allocation.width, allocation.height);+		GlyphCanvas.redraw (); 	}  	public virtual void add_path (Path p) {diff --git a/libbirdfont/GlyphCanvas.vala b/libbirdfont/GlyphCanvas.valaindex 44782b1..b6fbb40 100644--- a/libbirdfont/GlyphCanvas.vala+++ b/libbirdfont/GlyphCanvas.vala@@ -84,7 +84,7 @@ public class GlyphCanvas : GLib.Object { 		if (MenuTab.has_suppress_event ()) {
 			warning ("Do not call redraw from background thread.");
 		} else {
-			signal_redraw_area (x, y, w, h);
+			signal_redraw_area (x, y, w + (int) MainWindow.scrollbar.width, h);
 		}
 	}
 	
diff --git a/libbirdfont/RecentFiles.vala b/libbirdfont/RecentFiles.valaindex b80d7fc..0377d27 100644--- a/libbirdfont/RecentFiles.vala+++ b/libbirdfont/RecentFiles.vala@@ -42,12 +42,16 @@ public class RecentFiles : Table { 		} else if (row.get_index () == RECENT_FONT) { 			return_if_fail (row.get_row_data () is Font); 			f = (Font) row.get_row_data ();+			MainWindow.scrollbar.set_size (0);+			GlyphCanvas.redraw (); 			load_font (f.get_path ()); 		} else if (row.get_index () == BACKUP) { 			return_if_fail (row.get_row_data () is Font); 			f = (Font) row.get_row_data (); 			delete_backup (f.get_file_name ()); 		}++		GlyphCanvas.redraw (); 	}  	public override void update_rows () {diff --git a/libbirdfont/Scrollbar.vala b/libbirdfont/Scrollbar.valaindex 792b9e6..afcb34f 100644--- a/libbirdfont/Scrollbar.vala+++ b/libbirdfont/Scrollbar.vala@@ -25,6 +25,7 @@ public class Scrollbar : GLib.Object { 	public double height = 0; 	public double corner = 0; 	public double scroll_max = 1;+	public double margin = 0;  	public double motion_x = 0; 	public double motion_y = 0;@@ -34,10 +35,14 @@ public class Scrollbar : GLib.Object { 	}  	public bool button_press (uint button, double x, double y) {+		if (!is_visible ()) {+			return false;+		}+		 		double h = height * position * scroll_max; 	 		if (left_x < x < left_x + width &&-			 h < y < h + height * size) {+			 h - corner < y < h + height * size + corner + 2 * margin) { 			 	 			motion_x = x; 			motion_y = y;@@ -49,6 +54,10 @@ public class Scrollbar : GLib.Object { 	}  	public bool button_release (uint button, double x, double y) {+		if (!is_visible ()) {+			return false;+		}+		 		if (move) { 			move = false; 			return true;@@ -56,18 +65,15 @@ public class Scrollbar : GLib.Object { 			double h = height * position * scroll_max; 			 			if (y > h + size * height) {-				print (@"down   $position\n");				 				position += size; 			}  			 			if (y < h) {-				print (@"up   $position\n"); 				position -= size; 			} 			 			if (position > 1) { 				position = 1;-				print (@"max $scroll_max\n"); 			} else if (position < 0) { 				position = 0;			 			}@@ -82,9 +88,8 @@ public class Scrollbar : GLib.Object { 	  	public bool motion (double x, double y) {-		if (!move) {-			return false;-			+		if (!move || !is_visible ()) {+			return false;	 		}  		double p = (y - motion_y) / (height - size * height);@@ -107,6 +112,10 @@ public class Scrollbar : GLib.Object { 	} 	 	public void draw (Context cr, WidgetAllocation content_allocation, double width) {+		if (!is_visible ()) {+			return;+		}		+		 		cr.save ();  		this.width = width;		@@ -114,21 +123,23 @@ public class Scrollbar : GLib.Object { 		this.height = content_allocation.height; 		this.corner = 4 * Screen.get_scale (); 		this.scroll_max = 1 - size - 2 * corner / height;+		this.margin = 2 * Screen.get_scale (); 				-		Theme.color (cr, "Scrollbar Background");	+		Theme.color (cr, "Table Background 1");	 		cr.rectangle (left_x, 0, width, height);		 		cr.fill ();		 -		Theme.color (cr, "Scrollbar Foreground");+		Theme.color (cr, "Tool Foreground"); 		double h = height * position * scroll_max;-		Widget.draw_rounded_rectangle (cr, left_x, h, width, height * size, corner);			+		+		Widget.draw_rounded_rectangle (cr, left_x + margin, h, width - 2 * margin, height * size + 2 * margin, corner);			 		cr.fill (); 		 		cr.restore (); 	} 	 	public bool is_visible () {-		return true;+		return 0 < size < 1; 	}  	public void set_size (double size) {diff --git a/libbirdfont/TabContent.vala b/libbirdfont/TabContent.valaindex 623e1e3..d21c8fa 100644--- a/libbirdfont/TabContent.vala+++ b/libbirdfont/TabContent.vala@@ -132,6 +132,10 @@ public class TabContent : GLib.Object { 		}  		alloc = GlyphCanvas.get_allocation ();+		+		double scollbar_width = 10 * Screen.get_scale ();+		alloc.width += (int) scollbar_width;+		 		pause_surface = Screen.create_background_surface (alloc.width, alloc.height); 		cr = new Context ((!) pause_surface); 		cr.scale (Screen.get_scale (), Screen.get_scale ());diff --git a/libbirdfont/Theme.vala b/libbirdfont/Theme.valaindex 1cafb61..12cd082 100644--- a/libbirdfont/Theme.vala+++ b/libbirdfont/Theme.vala@@ -1,5 +1,5 @@ /*-	Copyright (C) 2015 Johan Mattsson+	Copyright (C) 2015 2016 Johan Mattsson  	This library is free software; you can redistribute it and/or modify  	it under the terms of the GNU Lesser General Public License as @@ -111,10 +111,7 @@ public class Theme : GLib.Object { 		Theme.set_default_color ("Default Background", 238 / 255.0, 239 / 255.0, 243 / 255.0, 1); 		Theme.set_default_color ("Headline Background", 110 / 255.0, 113 / 255.0, 130 / 255.0, 1); 		-		Theme.set_default_color ("Checkbox Background", 255 / 255.0, 255 / 255.0, 255 / 255.0, 1);-		Theme.set_default_color ("Scrollbar Background", 202 / 255.0, 202 / 255.0, 202 / 202.0, 1);-		Theme.set_default_color ("Scrollbar Foreground", 158 / 255.0, 158 / 255.0, 158 / 202.0, 1);-				+		Theme.set_default_color ("Checkbox Background", 255 / 255.0, 255 / 255.0, 255 / 255.0, 1);				 		Theme.set_default_color ("Foreground 1", 0, 0, 0, 1); 		 		Theme.set_default_color ("Text Foreground", 3 / 255.0, 16 / 255.0, 24 / 255.0, 1);@@ -221,8 +218,6 @@ public class Theme : GLib.Object { 		Theme.set_default_color ("Headline Background", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1); 		 		Theme.set_default_color ("Checkbox Background", 101 / 255.0, 108 / 255.0, 116 / 255.0, 1);-		Theme.set_default_color ("Scrollbar Background", 202 / 255.0, 202 / 255.0, 202 / 202.0, 1);-		Theme.set_default_color ("Scrollbar Foreground", 158 / 255.0, 158 / 255.0, 158 / 202.0, 1); 		 		Theme.set_default_color ("Foreground 1", 0, 0, 0, 1); 		@@ -328,9 +323,6 @@ public class Theme : GLib.Object { 		Theme.set_default_color ("Headline Background", 0, 0, 0, 1); 		 		Theme.set_default_color ("Checkbox Background", 1, 1, 1, 1);-		Theme.set_default_color ("Scrollbar Background", 1, 1, 1, 1);-		Theme.set_default_color ("Scrollbar Foreground", 0, 0, 0, 1);-		 		Theme.set_default_color ("Foreground 1", 0, 0, 0, 1); 		 		Theme.set_default_color ("Text Foreground", 0, 0, 0, 1);@@ -437,8 +429,6 @@ public class Theme : GLib.Object { 			t_("Default Background"); 			 			t_("Checkbox Background");-			t_("Scrollbar Foreground");-			t_("Scrollbar Background"); 			 			t_("Foreground 1"); 			t_("Text Foreground");

Contact

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