Clone in a terminal:
Commit b3f25e2
Johan Mattsson - 2015-03-13T20:46:31+00:00
b3f25e26ef43469f2d2e15753b7bb82eb9698779johan.mattsson.m@gmail.com

New icon for glyph version menu

Changed files (4)

Diff

diff --git a/libbirdfont/DropMenu.vala b/libbirdfont/DropMenu.valaindex 95a78b4..076b7e2 100644--- a/libbirdfont/DropMenu.vala+++ b/libbirdfont/DropMenu.vala@@ -31,7 +31,7 @@ public class DropMenu : GLib.Object { 	 	double menu_x = -1; 	-	bool menu_visible = false;+	public bool menu_visible = false;  	Gee.ArrayList <MenuAction> actions = new Gee.ArrayList <MenuAction> (); @@ -39,14 +39,9 @@ public class DropMenu : GLib.Object { 	 	MenuDirection direction = MenuDirection.DROP_DOWN; 	-	ImageSurface? icon = null;-	 	public signal void signal_delete_item  (int item_index); 	-	public DropMenu (string icon_file = "") {-		if (icon_file != "") {-			icon = Icons.get_icon (@"$icon_file.png");-		}+	public DropMenu () { 	} 	 	public MenuAction get_action_index (int index) {@@ -227,32 +222,6 @@ public class DropMenu : GLib.Object { 		 		cr.restore (); 	}-	-	public void draw_icon (Context cr) {-		double alpha = 1;-		ImageSurface i = (!) icon;-		-		if (!menu_visible) {-			alpha = 0;-		}-		-		cr.save ();-		-		cr.set_source_rgba (234/255.0, 234/255.0, 234/255.0, alpha);-		-		cr.rectangle (x, y, 12, 12);-		cr.fill_preserve ();-		cr.stroke ();-		-		if (likely (icon != null && i.status () == Cairo.Status.SUCCESS)) {-			cr.set_source_surface (i, x, y + (12 - i.get_height ()) / 2.0);-			cr.paint ();-		} else {-			warning ("Failed to load icon.");-		}-		-		cr.restore ();-	} }  }diff --git a/libbirdfont/OverViewItem.vala b/libbirdfont/OverViewItem.valaindex 561af2e..62ec6d6 100644--- a/libbirdfont/OverViewItem.vala+++ b/libbirdfont/OverViewItem.vala@@ -278,17 +278,22 @@ public class OverViewItem : GLib.Object { 	private void draw_menu (Context cr) { 		GlyphCollection g; 		DropMenu menu;-		+		Text icon;+				 		if (glyphs == null) { 			return; 		} 		-		g = (!) glyphs;+		icon = new Text ("dropdown_menu", 17);+		icon.load_font ("icons.bf");+		icon.use_cache (false);+		Theme.text_color (icon, "Foreground 1");+		icon.draw_at_top (cr, x + width - 32, y + height - 19); 		-		menu = g.get_version_list ();-		menu.set_position (x + width - 32, y + height - 16);-		menu.draw_icon (cr);+		g = (!) glyphs;+		menu = g.get_version_list ();		 		menu.draw_menu (cr);+		menu.set_position (x + width - 32, y + height - 16); 	} } diff --git a/libbirdfont/VersionList.vala b/libbirdfont/VersionList.valaindex 4a9672a..e7a59a4 100644--- a/libbirdfont/VersionList.vala+++ b/libbirdfont/VersionList.vala@@ -24,7 +24,7 @@ public class VersionList : DropMenu { 	public Gee.ArrayList<Glyph> glyphs; 	 	public VersionList (Glyph? g = null, GlyphCollection glyph_collection) {-		base ("version");+		base (); 		 		this.glyph_collection = glyph_collection; 		glyphs = new  Gee.ArrayList<Glyph> ();@@ -48,6 +48,8 @@ public class VersionList : DropMenu { 			Font font = BirdFont.get_current_font (); 			OverView over_view = MainWindow.get_overview (); 			+			font.touch ();+			 			index--; // first item is the add new action 			 			// delete the entire glyph if the last remaining version is removed@@ -60,7 +62,6 @@ public class VersionList : DropMenu { 			return_if_fail (0 <= index < glyphs.size); 			 			font.deleted_glyphs.add (glyph_collection.get_current ());-			font.touch (); 			 			over_view.store_undo_state (glyph_collection.copy ()); 			glyphs.remove_at (index);diff --git a/resources/icons.bf b/resources/icons.bfindex 0028cd0..53aee67 100644--- a/resources/icons.bf+++ b/resources/icons.bf@@ -124,6 +124,7 @@ GNU Lesser General Public License</copyright> 	<glyph id="1" left="-28" right="28.419182948490214"> 		<path stroke="0" skew="0" data="B 28.3602245702,27.4852661412 C 28.3602245702,11.9897661412 15.7036045702,-0.6668338588 0.2081145702,-0.6668338588 C -15.2873664298,-0.6668338588 -27.8309294298,11.9897661412 -27.8309294298,27.4852661412 C -27.8309294298,42.9807661412 -15.2873664298,55.5242661412 0.2081145702,55.5242661412 C 15.7036045702,55.5242661412 28.3602245702,42.9807661412 28.3602245702,27.4852661412" /> 		<path stroke="0" skew="0" data="B -24.2129884298,27.4852661412 C -24.2129884298,13.9450661412 -13.3320824298,2.9510661412 0.2081145702,2.9510661412 C 13.7483145702,2.9510661412 24.7422845702,13.9450661412 24.7422845702,27.4852661412 C 24.7422845702,41.0254661412 13.7483145702,51.9063661412 0.2081145702,51.9063661412 C -13.3320824298,51.9063661412 -24.2129884298,41.0254661412 -24.2129884298,27.4852661412" />+		<path stroke="0" skew="0" data="S -1.5502645503,33.9444444444 L -1.5502645503,33.9444444444" /> 	</glyph> </collection> <collection name="contrast_threshold">@@ -205,6 +206,14 @@ GNU Lesser General Public License</copyright> 		<path stroke="0" skew="0" data="B 17.0821942910,29.7820448026 C 18.1829096379,30.9238346416 18.8359698224,31.6138629544 19.0413241933,31.8520682359 C 19.7888235100,32.7720710129 20.3022166731,33.5688684032 20.5815217723,34.2424567889 C 20.8691372837,34.9242398125 21.0127695691,35.6429982004 21.0127695691,36.3987355703 C 21.0127695691,37.9923122612 20.4459719686,39.2655419222 19.3123984752,40.2184281713 C 18.1788032741,41.1712782409 16.6591411321,41.6477141311 14.7534120493,41.6477322193 C 14.0305400617,41.6477322193 13.2337462894,41.5450550338 12.3630234963,41.3397006629 C 11.4922970853,41.1343245844 10.5558543813,40.8303921560 9.5537026201,40.4279033778 M 9.5537026201,37.9143022023 C 10.5394253080,38.4646490219 11.4635453026,38.8753686175 12.3260589860,39.1464609891 C 13.1967817790,39.4175063274 14.0223237161,39.5530561293 14.8026992691,39.5530706029 C 15.9034182339,39.5530561286 16.7946800820,39.2450173390 17.4764848133,38.6289542263 C 18.1664914185,38.0128585521 18.5114874851,37.2160647798 18.5114983390,36.2385656733 C 18.5114874851,35.6389026904 18.3512886446,35.0269314698 18.0309560865,34.4026483935 C 17.7187964587,33.7865599553 17.1643288034,33.0308370571 16.3675422670,32.1354760811 C 15.9485990899,31.6590329565 14.9218019098,30.5952712661 13.2871434909,28.9441873919 C 11.6606905638,27.3013017736 10.3751381934,25.9911076022 9.4304863796,25.0136012599 M 9.4304863796,22.9189287897 M 21.1113584805,22.9189287897 M 21.1113584805,25.0136012599 M 12.4246334255,25.0136012599 C 14.4289369479,27.0589684206 15.9814572364,28.6484496015 17.0821942910,29.7820448026" /> 	</glyph> </collection>+<collection name="dropdown_menu">+	<selected id="1"/>+	<glyph id="1" left="-4" right="43.08994708994711">+		<path stroke="0" skew="0" data="S -4.0000000000,12.2098765432 L 69.2592592593,12.2098765432 L 69.2592592593,0.0000000000 L -4.0000000000,0.0000000000 L -4.0000000000,12.2098765432" />+		<path stroke="0" skew="0" data="S -4.0000000000,24.4197530865 L -4.0000000000,36.6296296296 L 69.2592592593,36.6296296296 L 69.2592592593,24.4197530865 L -4.0000000000,24.4197530865" />+		<path stroke="0" skew="0" data="S -4.0000000000,61.0493827161 L 69.2592592593,61.0493827161 L 69.2592592593,48.8395061728 L -4.0000000000,48.8395061728 L -4.0000000000,61.0493827161" />+	</glyph>+</collection> <collection unicode="U+65"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="28">@@ -772,6 +781,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="i n s e r t _ u n i c h a r" replacement="insert_unichar"/> <ligature sequence="c u t _ b a c k g r o u n d" replacement="cut_background"/> <ligature sequence="u p d a t e _ w e b v i e w" replacement="update_webview"/>+<ligature sequence="d r o p d o w n _ m e n u" replacement="dropdown_menu"/> <ligature sequence="f l i p _ v e r t i c a l" replacement="flip_vertical"/> <ligature sequence="d e l e t e _ b u t t o n" replacement="delete_button"/> <ligature sequence="c o n v e r t _ p o i n t" replacement="convert_point"/>

Contact

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