Clone in a terminal:
Commit b299c02
Johan Mattsson - 2015-04-17T17:13:14+00:00
b299c0231eb144cf4244b915cc52569c157e8ea5johan.mattsson.m@gmail.com

File buttons in tool box

Changed files (4)

Diff

diff --git a/libbirdfont/FileTools.vala b/libbirdfont/FileTools.valanew file mode 100644index 0000000..5cfd7e9--- /dev/null+++ b/libbirdfont/FileTools.vala@@ -0,0 +1,69 @@+/*+    Copyright (C) 2015 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 +    published by the Free Software Foundation; either version 3 of the +    License, or (at your option) any later version.++    This library is distributed in the hope that it will be useful, but +    WITHOUT ANY WARRANTY; without even the implied warranty of +    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +    Lesser General Public License for more details.+*/++using Cairo;+using Math;++namespace BirdFont {++public class FileTools : ToolCollection  {+	public static Gee.ArrayList<Expander> expanders;++	public FileTools () {+		expanders = new Gee.ArrayList<Expander> ();++		Expander font_name = new Expander ();+		font_name.add_tool (new FontName ());++		Expander file_tools = new Expander ();+		+		Tool new_font = new Tool ("new_font", t_("New font"));+		new_font.select_action.connect ((self) => {+			MenuTab.new_file ();+		});	+		file_tools.add_tool (new_font);++		Tool open_font = new Tool ("open_font", t_("Open font"));+		open_font.select_action.connect ((self) => {+			MenuTab.load ();+		});	+		file_tools.add_tool (open_font);++		Tool save_font = new Tool ("save_font", t_("Save font"));+		save_font.select_action.connect ((self) => {+			MenuTab.save ();+		});	+		file_tools.add_tool (save_font);++		Tool settings = new Tool ("settings", t_("Settings"));+		settings.select_action.connect ((self) => {+			MenuTab.show_settings_tab ();+		});	+		file_tools.add_tool (settings);+				+		expanders.add (font_name);					+		expanders.add (file_tools);+	}++	public override Gee.ArrayList<string> get_displays () {+		Gee.ArrayList<string> d = new Gee.ArrayList<string> ();+		return d;+	}+	+	public override Gee.ArrayList<Expander> get_expanders () {+		return expanders;+	}+}++}diff --git a/libbirdfont/Toolbox.vala b/libbirdfont/Toolbox.valaindex 6915e65..c653fec 100644--- a/libbirdfont/Toolbox.vala+++ b/libbirdfont/Toolbox.vala@@ -27,6 +27,7 @@ public class Toolbox : GLib.Object  { 	public static BackgroundTools background_tools; 	public static HiddenTools hidden_tools; 	public static SpacingTools spacing_tools;+	public static FileTools file_tools; 	 	Tool current_tool; 	@@ -63,15 +64,17 @@ public class Toolbox : GLib.Object  { 		background_tools = new BackgroundTools (); 		hidden_tools = new HiddenTools (); 		spacing_tools = new SpacingTools ();+		file_tools = new FileTools (); 		 		tool_sets.append (drawing_tools); 		tool_sets.append (kerning_tools); 		tool_sets.append (preview_tools); 		tool_sets.append (overview_tools); 		tool_sets.append (background_tools);+		// the menu has all the file_tools commands, it won't be added here 		tool_sets.append (hidden_tools); // tools without a button 		-		current_set = drawing_tools;+		current_set = file_tools; 		 		tab_bar.signal_tab_selected.connect ((tab) => { 			string tab_name = tab.get_display ().get_name ();@@ -95,7 +98,7 @@ public class Toolbox : GLib.Object  { 		} else if (t != null && ((!) t).get_display () is Glyph) { 			current_set = (ToolCollection) drawing_tools; 		} else {-			current_set = new EmptySet ();+			current_set = (ToolCollection) file_tools; 		} 		 		MainWindow.get_toolbox ().update_expanders ();diff --git a/libbirdfont/ZoomBar.vala b/libbirdfont/ZoomBar.valaindex a30d411..66ed1a0 100644--- a/libbirdfont/ZoomBar.vala+++ b/libbirdfont/ZoomBar.vala@@ -30,7 +30,7 @@ public class ZoomBar : Tool { 		base (); 		 		panel_press_action.connect ((selected, button, tx, ty) => {-			if (y <= ty <= y + h) {+			if (y <= ty <= y + h + 2) { 				set_zoom_from_mouse (tx); 				update_zoom = true; 			}diff --git a/resources/icons.bf b/resources/icons.bfindex 82c46c2..6103538 100644--- a/resources/icons.bf+++ b/resources/icons.bf@@ -541,6 +541,14 @@ GNU Lesser General Public License</copyright> 	<glyph id="1" left="-28" right="28"> 	</glyph> </collection>+<collection name="new_font">+	<selected id="1"/>+	<glyph id="1" left="-28" right="28">+		<path stroke="0" skew="0" data="S -20.0000000000,36.0000000000 L -8.0000000000,52.0000000000 L 20.0000000000,52.0000000000 L 20.0000000000,28.0000000000 L 20.0000000000,0.0000000000 L -20.0000000000,0.0000000000 L -20.0000000000,36.0000000000" />+		<path stroke="0" skew="0" data="S -16.0000000000,4.0000000000 L 16.0000000000,4.0000000000 L 16.0000000000,48.0000000000 L -5.3544973545,48.0000000000 L -16.0000000000,33.6190476190 L -16.0000000000,4.0000000000" />+		<path stroke="0" skew="0" data="S -0.8888888889,33.9444444444 L -16.8941798942,30.3730158730 L -17.5555555556,33.0185185185 L -4.1957671958,35.9285714286 L -5.1216931217,47.9656084656 L -1.6825396825,48.8915343915 L -0.8888888889,33.9444444444" />+	</glyph>+</collection> <collection name="new_point_on_path"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="35.482683982683966">@@ -576,6 +584,13 @@ GNU Lesser General Public License</copyright> 	<glyph id="1" left="-28" right="28"> 	</glyph> </collection>+<collection name="open_font">+	<selected id="1"/>+	<glyph id="1" left="-19.733203287977929" right="28.542195674601658">+		<path stroke="0" skew="0" data="B 4.5421956746,36.0000000000 C 2.5421956746,38.0000000000 -1.4578043254,42.0000000000 -3.4578043254,44.0000000000 C -6.4578043254,44.0000000000 -12.4578043254,44.0000000000 -15.4578043254,44.0000000000 C -17.7332032880,44.0000000000 -19.7332032880,44.0000000000 -19.7332032880,40.0000000000 C -19.7332032880,30.3057636146 -20.0086022506,16.0000000000 -19.7332032880,4.0000000000 C -19.7332032880,0.0000000000 -17.7332032880,0.0000000000 -15.7332032880,0.0000000000 C -10.3998699546,0.0000000000 6.2782421398,0.0000000000 24.2667967120,0.0000000000 C 26.2667967120,0.0000000000 28.2667967120,0.0000000000 28.2667967120,4.0000000000 C 28.2667967120,8.4821428571 28.3126387211,23.6922224399 28.2667967120,32.0000000000 C 28.2667967120,36.0000000000 26.2667967120,36.0000000000 24.2667967120,36.0000000000 C 16.2667967120,36.0000000000 24.2667967120,36.0000000000 16.2667967120,36.0000000000 C 12.2667967120,36.0000000000 9.8755290079,36.0000000000 4.5421956746,36.0000000000" />+		<path stroke="0" skew="0" data="B 24.2667967120,32.0000000000 C 24.2667967120,28.0000000000 24.2667967120,11.0000000000 24.2667967120,8.0000000000 C 24.2667967120,4.0000000000 22.2667967120,4.0000000000 20.2667967120,4.0000000000 C 2.2782421398,4.0000000000 -6.3998699546,4.0000000000 -11.7332032880,4.0000000000 C -13.7332032880,4.0000000000 -15.7332032880,4.0000000000 -15.7332032880,8.0000000000 C -16.0086022506,16.0000000000 -15.4578043254,26.3057636145 -15.4578043254,36.0000000000 C -15.4578043254,40.0000000000 -15.4610405714,40.1877022654 -11.4610405714,40.1877022654 C -9.3693469360,40.2675296656 -6.7514936458,40.1796116505 -5.1827234192,40.2394822006 M 2.8172765808,32.2394822006 C 16.6506099141,32.2394822006 20.2667967120,32.0000000000 24.2667967120,32.0000000000" />+	</glyph>+</collection> <collection name="orientation_arrow"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="28">@@ -709,6 +724,18 @@ GNU Lesser General Public License</copyright> 	<glyph id="1" left="-45" right="47"> 	</glyph> </collection>+<collection name="save_font">+	<selected id="1"/>+	<glyph id="1" left="-24" right="26">+		<path stroke="0" skew="0" data="B -20.0000000000,6.0000000000 C -20.0000000000,4.0000000000 -18.0000000000,2.0000000000 -16.0000000000,2.0000000000 M 20.0000000000,2.0000000000 C 22.0000000000,2.0000000000 24.0000000000,4.0000000000 24.0000000000,6.0000000000 M 24.0000000000,46.0000000000 C 24.0000000000,48.0000000000 22.0000000000,50.0000000000 20.0000000000,50.0000000000 M -16.0000000000,50.0000000000 C -18.0000000000,50.0000000000 -20.0000000000,48.0000000000 -20.0000000000,46.0000000000 M -20.0000000000,6.0000000000" />+		<path stroke="0" skew="0" data="B -16.0000000000,42.0000000000 C -16.0000000000,44.0000000000 -16.0000000000,46.0000000000 -14.0000000000,46.0000000000 M 18.0000000000,46.0000000000 C 20.0000000000,46.0000000000 20.0000000000,44.0000000000 20.0000000000,42.0000000000 M 20.0000000000,8.0000000000 C 20.0000000000,6.0000000000 18.0000000000,6.0000000000 16.0000000000,6.0000000000 M -12.0000000000,6.0000000000 C -14.0000000000,6.0000000000 -16.0000000000,6.0000000000 -16.0000000000,8.0000000000 M -16.0000000000,42.0000000000" />+		<path stroke="0" skew="0" data="B -10.0000000000,6.0000000000 M 12.0000000000,6.0000000000 M 12.0000000000,16.0000000000 M -10.0000000000,16.0000000000 M -10.0000000000,6.0000000000" />+		<path stroke="0" skew="0" data="B -6.0000000000,14.0000000000 M -2.0000000000,14.0000000000 M -2.0000000000,8.0000000000 M -6.0000000000,8.0000000000 M -6.0000000000,14.0000000000" />+		<path stroke="0" skew="0" data="B -12.0000000000,38.0000000000 M 16.0000000000,38.0000000000 M 16.0000000000,40.0000000000 M -12.0000000000,40.0000000000 M -12.0000000000,38.0000000000" />+		<path stroke="0" skew="0" data="B -12.0000000000,32.0000000000 M 16.0000000000,32.0000000000 M 16.0000000000,34.0000000000 M -12.0000000000,34.0000000000 M -12.0000000000,32.0000000000" />+		<path stroke="0" skew="0" data="B -12.0000000000,26.0000000000 M 16.0000000000,26.0000000000 M 16.0000000000,28.0000000000 M -12.0000000000,28.0000000000 M -12.0000000000,26.0000000000" />+	</glyph>+</collection> <collection name="scale_background"> 	<selected id="1"/> 	<glyph id="1" left="-28" right="28">@@ -756,6 +783,13 @@ GNU Lesser General Public License</copyright> 		<path stroke="0" skew="0" data="B 34.0138086782,9.3201581399 C 34.0138086782,5.7305573953 31.1038420587,2.8206225536 27.5142413142,2.8206225536 C 23.9246405696,2.8206225536 21.0147057280,5.7305573953 21.0147057280,9.3201581399 C 21.0147057280,12.9097588844 23.9246405696,15.8197255039 27.5142413142,15.8197255039 C 31.1038420587,15.8197255039 34.0138086782,12.9097588844 34.0138086782,9.3201581399" /> 	</glyph> </collection>+<collection name="settings">+	<selected id="1"/>+	<glyph id="1" left="-28" right="28">+		<path stroke="0" skew="0" data="B -4.4852387835,7.6777389666 M -8.1480778694,9.1949365927 M -7.9285931553,8.9875948267 M -16.2041934926,3.5563428200 M -21.4120682006,8.4105484583 M -16.6222580006,17.2002843976 M -16.5660618293,17.1471972682 M -17.9125387185,19.4832110646 M -18.3146894312,20.1439767057 M -27.9870374676,22.2486721151 M -28.1684472817,29.3657193843 M -18.5394110513,32.1012999272 M -18.5385963198,32.0579484774 M -16.1237174646,37.8879817612 M -20.7581209521,46.0891897928 M -15.3653132114,50.5931142780 M -7.0138317505,45.2792816956 M -7.0804315581,45.2145622541 M -4.0174370689,46.4832961130 M -1.6034591449,55.1272214130 M 5.5143284240,54.9776504366 M 7.5646336800,45.7540481281 M 10.6825468423,44.4625662099 M 18.1288970430,48.7974615461 M 23.1282549527,43.7287642930 M 18.5598802447,36.3198859682 M 20.6712247213,31.2226494979 M 28.0743318920,29.1908485445 M 27.9566027464,22.0724631096 M 19.6078470360,20.1773949372 M 18.2744500962,16.9582899610 M 18.3386710326,17.0206976960 M 23.5061516968,7.8761370120 M 18.1133439560,3.3722125268 M 9.7618624952,8.6860451092 M 8.6196696539,8.4439701276 M 7.0837229576,8.0140173933 M 5.0878658616,-0.9646417912 M -2.0299217073,-1.1142127676 M -4.4852387835,7.6777389666" />+		<path stroke="0" skew="0" data="B 14.7823651881,26.7170146168 C 14.7823651881,30.2576728159 13.2211349131,34.0268161197 10.7175114906,36.5304395422 T C 8.2138880682,39.0340629646 4.4447447644,40.5952932396 0.9040865652,40.5952932396 T C -2.6365716339,40.5952932396 -6.4057149377,39.0340629646 -8.9093383602,36.5304395422 T C -11.4129617827,34.0268161198 -12.9741920576,30.2576728159 -12.9741920576,26.7170146168 T C -12.9741920576,23.1763564176 -11.4129617826,19.4072131138 -8.9093383602,16.9035896913 T C -6.4057149378,14.3999662688 -2.6365716339,12.8387359939 0.9040865652,12.8387359939 T C 4.4447447644,12.8387359939 8.2138880682,14.3999662689 10.7175114906,16.9035896913 T C 13.2211349131,19.4072131138 14.7823651881,23.1763564176 14.7823651881,26.7170146168 T" />+	</glyph>+</collection> <collection name="show_all_line_handles"> 	<selected id="1"/> 	<glyph id="1" left="-34.656084656084666" right="36.904761904761905">@@ -875,7 +909,7 @@ GNU Lesser General Public License</copyright> 	<glyph id="1" left="-28" right="33.862433862433868"> 		<path stroke="0" skew="0" data="B -6.0899248168,23.2281619397 C -6.0899329556,20.1337008248 -5.3269164844,17.7969659337 -3.8008754030,16.2179491275 C -2.2642538266,14.6389323212 0.0035939027,13.8494239181 3.0026840628,13.8494239181 C 5.9911530336,13.8494239181 8.2484039902,14.6389323212 9.7744532104,16.2179491275 C 11.3110666480,17.7969659337 12.0793815056,20.1337008248 12.0793977833,23.2281619397 M 12.0793977833,38.0434024924 M 8.8524770090,38.0434024924 M 8.8524770090,23.6255653344 C 8.8524607313,21.0821770969 8.3914685612,19.2488133281 7.4695086375,18.1254903056 C 6.5475161585,17.0127559170 5.0585719206,16.4563927921 3.0026840628,16.4563927921 C 0.9361750157,16.4563927921 -0.5580676085,17.0127559170 -1.4800356711,18.1254903056 C -2.4020200113,19.2488133281 -2.8630121814,21.0821770969 -2.8630040425,23.6255653344 M -2.8630040425,38.0434024924 M -6.0899248168,38.0434024924 M -6.0899248168,23.2281619397" /> 		<path stroke="0" skew="0" data="B 33.2536298156,27.2056142010 C 33.2536298156,10.4831173296 19.6080711315,-3.1624413546 2.8855742601,-3.1624413546 C -13.8369226113,-3.1624413546 -27.4824812955,10.4831173296 -27.4824812955,27.2056142010 C -27.4824812955,43.9281110724 -13.8369226113,57.5736697565 2.8855742601,57.5736697565 C 19.6080711315,57.5736697565 33.2536298156,43.9281110724 33.2536298156,27.2056142010" />-		<path stroke="0" skew="0" data="B -22.0538300183,27.0877798061 C -22.0538300183,13.1306455577 -10.8358911985,1.9127067379 3.1212430499,1.9127067379 C 17.0783772983,1.9127067379 28.2963161181,13.1306455577 28.2963161181,27.0877798061 C 28.2963161181,41.0449140545 17.0783772983,52.2628528743 3.1212430499,52.2628528743 C -10.8358911985,52.2628528743 -22.0538300183,41.0449140545 -22.0538300183,27.0877798061" />+		<path stroke="0" skew="0" data="B -24.0894287238,27.1476503563 C -24.0894287238,12.1615514483 -12.0444675086,0.1165902330 2.9416313994,0.1165902330 C 17.9277303074,0.1165902330 29.9726915226,12.1615514483 29.9726915226,27.1476503563 C 29.9726915226,42.1337492643 17.9277303074,54.1787104795 2.9416313994,54.1787104795 C -12.0444675086,54.1787104795 -24.0894287238,42.1337492643 -24.0894287238,27.1476503563" /> 	</glyph> </collection> <collection unicode="U+75">@@ -1042,6 +1076,7 @@ GNU Lesser General Public License</copyright> <ligature sequence="m o v e _ l a y e r" replacement="move_layer"/> <ligature sequence="h e l p _ l i n e s" replacement="help_lines"/> <ligature sequence="l e f t _ a r r o w" replacement="left_arrow"/>+<ligature sequence="o p e n _ f o n t" replacement="open_font"/> <ligature sequence="m e n u _ i c o n" replacement="menu_icon"/> <ligature sequence="t t f _ u n i t s" replacement="ttf_units"/> <ligature sequence="r e c t a n g l e" replacement="rectangle"/>@@ -1053,11 +1088,14 @@ GNU Lesser General Public License</copyright> <ligature sequence="a u t o t r a c e" replacement="autotrace"/> <ligature sequence="s h o w _ g r i d" replacement="show_grid"/> <ligature sequence="i n f o _ i c o n" replacement="info_icon"/>+<ligature sequence="s a v e _ f o n t" replacement="save_font"/>+<ligature sequence="n e w _ f o n t" replacement="new_font"/> <ligature sequence="p r o g r e s s" replacement="progress"/> <ligature sequence="z o o m _ 1 _ 1" replacement="zoom_1_1"/> <ligature sequence="p e n _ t o o l" replacement="pen_tool"/> <ligature sequence="r o t a t i o n" replacement="rotation"/> <ligature sequence="z o o m _ o u t" replacement="zoom_out"/>+<ligature sequence="s e t t i n g s" replacement="settings"/> <ligature sequence="z o o m _ i n" replacement="zoom_in"/> <ligature sequence="c i r c l e" replacement="circle"/> <ligature sequence="r e s i z e" replacement="resize"/>@@ -1070,4 +1108,5 @@ GNU Lesser General Public License</copyright> <ligature sequence="m o v e" replacement="move"/> <ligature sequence="s k e w" replacement="skew"/> +<kerning left="settings" right="l" hadjustment="3.8289794922" /> </font>

Contact

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